diff options
author | Eamon Walsh <ewalsh@tycho.nsa.gov> | 2010-05-12 20:25:30 -0400 |
---|---|---|
committer | Keith Packard <keithp@keithp.com> | 2010-05-13 10:07:31 -0700 |
commit | c9e7ca4404803fe44d4684e0bb2ca2ee10fd4bb3 (patch) | |
tree | a38876b646954be87a21be94fede984aae0a566e /Xext/xselinux_hooks.c | |
parent | bca85e2e127a8a23e3a2debcfeb3ae07cd3c66ac (diff) |
xselinux: Remove use of devPrivates init/free callbacks.
Commit eb9210097efea81065c301e5b6b4da7a566deb4a removed the
sidget/sidput calls which were the major reason for using the
callbacks. The remaining operations can be skipped or worked
around.
Signed-off-by: Eamon Walsh <ewalsh@tycho.nsa.gov>
Reviewed-by: Keith Packard <keithp@keithp.com>
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'Xext/xselinux_hooks.c')
-rw-r--r-- | Xext/xselinux_hooks.c | 47 |
1 files changed, 2 insertions, 45 deletions
diff --git a/Xext/xselinux_hooks.c b/Xext/xselinux_hooks.c index 135992a91..13e5243c2 100644 --- a/Xext/xselinux_hooks.c +++ b/Xext/xselinux_hooks.c @@ -151,12 +151,7 @@ SELinuxLabelClient(ClientPtr client) if (bytes <= 0) goto finish; - subj->command = malloc(bytes); - if (!subj->command) - goto finish; - - memcpy(subj->command, path, bytes); - subj->command[bytes - 1] = 0; + strncpy(subj->command, path, COMMAND_LEN - 1); } finish: @@ -464,7 +459,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) /* If this is a new object that needs labeling, do it now */ /* XXX there should be a separate callback for this */ - if (obj->sid == unlabeled_sid) { + if (obj->sid == NULL) { security_id_t sid; serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey); @@ -809,39 +804,6 @@ SELinuxResourceState(CallbackListPtr *pcbl, pointer unused, pointer calldata) } -/* - * DevPrivates Callbacks - */ - -static void -SELinuxSubjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - PrivateCallbackRec *rec = calldata; - SELinuxSubjectRec *subj = *rec->value; - - subj->sid = unlabeled_sid; - - avc_entry_ref_init(&subj->aeref); -} - -static void -SELinuxSubjectFree(CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - PrivateCallbackRec *rec = calldata; - SELinuxSubjectRec *subj = *rec->value; - - free(subj->command); -} - -static void -SELinuxObjectInit(CallbackListPtr *pcbl, pointer unused, pointer calldata) -{ - PrivateCallbackRec *rec = calldata; - SELinuxObjectRec *obj = *rec->value; - - obj->sid = unlabeled_sid; -} - static int netlink_fd; static void @@ -953,11 +915,6 @@ SELinuxFlaskInit(void) NULL); /* Register callbacks */ - ret &= dixRegisterPrivateInitFunc(subjectKey, SELinuxSubjectInit, NULL); - ret &= dixRegisterPrivateDeleteFunc(subjectKey, SELinuxSubjectFree, NULL); - ret &= dixRegisterPrivateInitFunc(objectKey, SELinuxObjectInit, NULL); - ret &= dixRegisterPrivateInitFunc(dataKey, SELinuxObjectInit, NULL); - ret &= AddCallback(&ClientStateCallback, SELinuxClientState, NULL); ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL); |