summaryrefslogtreecommitdiff
path: root/src/core/busname.h
diff options
context:
space:
mode:
authorDaniel Mack <zonque@gmail.com>2014-03-06 22:42:42 +0100
committerDaniel Mack <zonque@gmail.com>2014-03-07 19:14:05 +0100
commit54d76c92868838e17d6aad0a3bb0cc7a5b11e35f (patch)
treec094188e6eb2ac57b19bc64acc295654c160185d /src/core/busname.h
parentfb255b31c5f4eca821d60a2c9b1235a513f15732 (diff)
busname: add parser for bus name policies
There are three directives to specify bus name polices in .busname files: * AllowUser [username] [access] * AllowGroup [groupname] [access] * AllowWorld [access] Where [access] is one of * 'see': The user/group/world is allowed to see a name on the bus * 'talk': The user/group/world is allowed to talk to a name * 'own': The user/group/world is allowed to own a name There is no user added yet in this commit.
Diffstat (limited to 'src/core/busname.h')
-rw-r--r--src/core/busname.h34
1 files changed, 34 insertions, 0 deletions
diff --git a/src/core/busname.h b/src/core/busname.h
index 6debd48551..f79f510ea2 100644
--- a/src/core/busname.h
+++ b/src/core/busname.h
@@ -22,6 +22,7 @@
***/
typedef struct BusName BusName;
+typedef struct BusNamePolicy BusNamePolicy;
#include "unit.h"
@@ -54,6 +55,36 @@ struct BusName {
BusNameResult result;
sd_event_source *event_source;
+
+ LIST_HEAD(BusNamePolicy, policy);
+};
+
+typedef enum BusNamePolicyType {
+ BUSNAME_POLICY_TYPE_USER,
+ BUSNAME_POLICY_TYPE_GROUP,
+ BUSNAME_POLICY_TYPE_WORLD,
+ _BUSNAME_POLICY_TYPE_MAX,
+ _BUSNAME_POLICY_TYPE_INVALID = -1
+} BusNamePolicyType;
+
+typedef enum BusNamePolicyAccess {
+ BUSNAME_POLICY_ACCESS_SEE,
+ BUSNAME_POLICY_ACCESS_TALK,
+ BUSNAME_POLICY_ACCESS_OWN,
+ _BUSNAME_POLICY_ACCESS_MAX,
+ _BUSNAME_POLICY_ACCESS_INVALID = -1
+} BusNamePolicyAccess;
+
+struct BusNamePolicy {
+ BusNamePolicyType type;
+ BusNamePolicyAccess access;
+
+ union {
+ uid_t uid;
+ gid_t gid;
+ };
+
+ LIST_FIELDS(BusNamePolicy, policy);
};
extern const UnitVTable busname_vtable;
@@ -63,3 +94,6 @@ BusNameState busname_state_from_string(const char *s) _pure_;
const char* busname_result_to_string(BusNameResult i) _const_;
BusNameResult busname_result_from_string(const char *s) _pure_;
+
+const char* busname_policy_access_to_string(BusNamePolicyAccess i) _const_;
+BusNamePolicyAccess busname_policy_access_from_string(const char *s) _pure_;