xselinux: Remove use of devPrivates init/free callbacks.
Commit eb9210097e
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>
This commit is contained in:
parent
bca85e2e12
commit
c9e7ca4404
|
@ -151,12 +151,7 @@ SELinuxLabelClient(ClientPtr client)
|
||||||
if (bytes <= 0)
|
if (bytes <= 0)
|
||||||
goto finish;
|
goto finish;
|
||||||
|
|
||||||
subj->command = malloc(bytes);
|
strncpy(subj->command, path, COMMAND_LEN - 1);
|
||||||
if (!subj->command)
|
|
||||||
goto finish;
|
|
||||||
|
|
||||||
memcpy(subj->command, path, bytes);
|
|
||||||
subj->command[bytes - 1] = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
finish:
|
finish:
|
||||||
|
@ -464,7 +459,7 @@ SELinuxExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata)
|
||||||
|
|
||||||
/* If this is a new object that needs labeling, do it now */
|
/* If this is a new object that needs labeling, do it now */
|
||||||
/* XXX there should be a separate callback for this */
|
/* XXX there should be a separate callback for this */
|
||||||
if (obj->sid == unlabeled_sid) {
|
if (obj->sid == NULL) {
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
|
|
||||||
serv = dixLookupPrivate(&serverClient->devPrivates, subjectKey);
|
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 int netlink_fd;
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -953,11 +915,6 @@ SELinuxFlaskInit(void)
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
/* Register callbacks */
|
/* 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(&ClientStateCallback, SELinuxClientState, NULL);
|
||||||
ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL);
|
ret &= AddCallback(&ResourceStateCallback, SELinuxResourceState, NULL);
|
||||||
|
|
||||||
|
|
|
@ -36,6 +36,8 @@ CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
* Types
|
* Types
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define COMMAND_LEN 64
|
||||||
|
|
||||||
/* subject state (clients and devices only) */
|
/* subject state (clients and devices only) */
|
||||||
typedef struct {
|
typedef struct {
|
||||||
security_id_t sid;
|
security_id_t sid;
|
||||||
|
@ -46,7 +48,7 @@ typedef struct {
|
||||||
security_id_t sel_use_sid;
|
security_id_t sel_use_sid;
|
||||||
security_id_t prp_use_sid;
|
security_id_t prp_use_sid;
|
||||||
struct avc_entry_ref aeref;
|
struct avc_entry_ref aeref;
|
||||||
char *command;
|
char command[COMMAND_LEN];
|
||||||
int privileged;
|
int privileged;
|
||||||
} SELinuxSubjectRec;
|
} SELinuxSubjectRec;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue