From 4c61bf84b11e26e6f22648668c95ea760a379163 Mon Sep 17 00:00:00 2001 From: marha Date: Fri, 11 Jun 2010 12:14:52 +0000 Subject: xserver git update 11/6/2010 --- xorg-server/Xext/security.c | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'xorg-server/Xext/security.c') diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c index 4201e583d..183fa06c7 100644 --- a/xorg-server/Xext/security.c +++ b/xorg-server/Xext/security.c @@ -51,8 +51,8 @@ static RESTYPE RTEventClient; static CallbackListPtr SecurityValidateGroupCallback = NULL; /* Private state record */ -static int stateKeyIndex; -static DevPrivateKey stateKey = &stateKeyIndex; +static DevPrivateKeyRec stateKeyRec; +#define stateKey (&stateKeyRec) /* This is what we store as client security state */ typedef struct { @@ -242,7 +242,7 @@ SecurityDeleteAuthorizationEventClient( else pAuth->eventClients = pEventClient->next; free(pEventClient); - return(Success); + return Success; } prev = pEventClient; } @@ -604,7 +604,7 @@ bailout: if (removeAuth) RemoveAuthorization(stuff->nbytesAuthProto, protoname, authdata_len, pAuthdata); - if (pAuth) free(pAuth); + free(pAuth); return err; } /* ProcSecurityGenerateAuthorization */ @@ -805,7 +805,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) Mask allowed = SecurityResourceMask; subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); - obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey); /* disable background None for untrusted windows */ if ((requested & DixCreateAccess) && (rec->rtype == RT_WINDOW)) @@ -831,8 +830,11 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) allowed |= DixReadAccess; } - if (SecurityDoCheck(subj, obj, requested, allowed) == Success) - return; + if (clients[cid] != NULL) { + obj = dixLookupPrivate(&clients[cid]->devPrivates, stateKey); + if (SecurityDoCheck(subj, obj, requested, allowed) == Success) + return; + } SecurityAudit("Security: denied client %d access %x to resource 0x%x " "of client %d on request %s\n", rec->client->index, @@ -1108,7 +1110,7 @@ SecurityExtensionInit(INITARGS) RTEventClient |= RC_NEVERRETAIN; /* Allocate the private storage */ - if (!dixRequestPrivate(stateKey, sizeof(SecurityStateRec))) + if (!dixRegisterPrivateKey(stateKey, PRIVATE_CLIENT, sizeof(SecurityStateRec))) FatalError("SecurityExtensionSetup: Can't allocate client private.\n"); /* Register callbacks */ -- cgit v1.2.3