diff options
author | marha <marha@users.sourceforge.net> | 2009-07-25 19:39:46 +0000 |
---|---|---|
committer | marha <marha@users.sourceforge.net> | 2009-07-25 19:39:46 +0000 |
commit | 4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05 (patch) | |
tree | c1e02b9d3509aa97703aa4b540d4cd22ec4600ed /xorg-server/Xext/security.c | |
parent | dc3c299dd0995549e2a6973ca0f25b254afd38a5 (diff) | |
download | vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.gz vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.tar.bz2 vcxsrv-4a3dbb926ae3f5410198d7cc4f4ebe4f62eebf05.zip |
Added xorg-server-1.6.2.tar.gz
Diffstat (limited to 'xorg-server/Xext/security.c')
-rw-r--r-- | xorg-server/Xext/security.c | 65 |
1 files changed, 33 insertions, 32 deletions
diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c index ad30e06b8..b9f411ec4 100644 --- a/xorg-server/Xext/security.c +++ b/xorg-server/Xext/security.c @@ -38,9 +38,6 @@ in this Software without prior written authorization from The Open Group. #include "xacestr.h" #include "securitysrv.h" #include <X11/extensions/securstr.h> -#ifdef XAPPGROUP -#include "appgroup.h" -#endif #include "modinit.h" /* Extension stuff */ @@ -53,7 +50,8 @@ static RESTYPE RTEventClient; static CallbackListPtr SecurityValidateGroupCallback = NULL; /* Private state record */ -static DevPrivateKey stateKey = &stateKey; +static int stateKeyIndex; +static DevPrivateKey stateKey = &stateKeyIndex; /* This is what we store as client security state */ typedef struct { @@ -63,10 +61,10 @@ typedef struct { } SecurityStateRec; /* Extensions that untrusted clients shouldn't have access to */ -static char *SecurityUntrustedExtensions[] = { - "RandR", - "SECURITY", - "XFree86-DGA", +static char *SecurityTrustedExtensions[] = { + "XC-MISC", + "BIG-REQUESTS", + "XpExtension", NULL }; @@ -76,6 +74,7 @@ static char *SecurityUntrustedExtensions[] = { static const Mask SecurityResourceMask = DixGetAttrAccess | DixReceiveAccess | DixListPropAccess | DixGetPropAccess | DixListAccess; +static const Mask SecurityWindowExtraMask = DixRemoveAccess; static const Mask SecurityRootWindowExtraMask = DixReceiveAccess | DixSendAccess | DixAddAccess | DixRemoveAccess; static const Mask SecurityDeviceMask = @@ -376,7 +375,7 @@ ProcSecurityQueryVersion( rep.minorVersion = SECURITY_MINOR_VERSION; if(client->swapped) { - register char n; + char n; swaps(&rep.sequenceNumber, n); swaps(&rep.majorVersion, n); swaps(&rep.minorVersion, n); @@ -588,7 +587,7 @@ ProcSecurityGenerateAuthorization( if (client->swapped) { - register char n; + char n; swapl(&rep.length, n); swaps(&rep.sequenceNumber, n); swapl(&rep.authId, n); @@ -661,7 +660,7 @@ SProcSecurityQueryVersion( ClientPtr client) { REQUEST(xSecurityQueryVersionReq); - register char n; + char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSecurityQueryVersionReq); @@ -676,7 +675,7 @@ SProcSecurityGenerateAuthorization( ClientPtr client) { REQUEST(xSecurityGenerateAuthorizationReq); - register char n; + char n; CARD32 *values; unsigned long nvalues; int values_offset; @@ -703,7 +702,7 @@ SProcSecurityRevokeAuthorization( ClientPtr client) { REQUEST(xSecurityRevokeAuthorizationReq); - register char n; + char n; swaps(&stuff->length, n); REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq); @@ -819,6 +818,10 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) if (subj->haveState && subj->trustLevel != XSecurityClientTrusted) ((WindowPtr)rec->res)->forcedBG = TRUE; + /* additional permissions for specific resource types */ + if (rec->rtype == RT_WINDOW) + allowed |= SecurityWindowExtraMask; + /* special checks for server-owned resources */ if (cid == 0) { if (rec->rtype & RC_DRAWABLE) @@ -837,11 +840,6 @@ SecurityResource(CallbackListPtr *pcbl, pointer unused, pointer calldata) if (SecurityDoCheck(subj, obj, requested, allowed) == Success) return; -#ifdef XAPPGROUP - if (rec->id == XagDefaultColormap(rec->client)) - return; -#endif - SecurityAudit("Security: denied client %d access %x to resource 0x%x " "of client %d on request %s\n", rec->client->index, requested, rec->id, cid, @@ -859,16 +857,18 @@ SecurityExtension(CallbackListPtr *pcbl, pointer unused, pointer calldata) subj = dixLookupPrivate(&rec->client->devPrivates, stateKey); - if (subj->haveState && subj->trustLevel != XSecurityClientTrusted) - while (SecurityUntrustedExtensions[i]) - if (!strcmp(SecurityUntrustedExtensions[i++], rec->ext->name)) { - SecurityAudit("Security: denied client %d access to extension " - "%s on request %s\n", - rec->client->index, rec->ext->name, - SecurityLookupRequestName(rec->client)); - rec->status = BadAccess; - return; - } + if (subj->haveState && subj->trustLevel == XSecurityClientTrusted) + return; + + while (SecurityTrustedExtensions[i]) + if (!strcmp(SecurityTrustedExtensions[i++], rec->ext->name)) + return; + + SecurityAudit("Security: denied client %d access to extension " + "%s on request %s\n", + rec->client->index, rec->ext->name, + SecurityLookupRequestName(rec->client)); + rec->status = BadAccess; } static void @@ -953,9 +953,10 @@ SecuritySend(CallbackListPtr *pcbl, pointer unused, pointer calldata) SecurityAudit("Security: denied client %d from sending event " "of type %s to window 0x%x of client %d\n", - rec->client->index, rec->pWin->drawable.id, - wClient(rec->pWin)->index, - LookupEventName(rec->events[i].u.u.type)); + rec->client->index, + LookupEventName(rec->events[i].u.u.type), + rec->pWin->drawable.id, + wClient(rec->pWin)->index); rec->status = BadAccess; return; } @@ -1049,7 +1050,7 @@ SecurityClientState(CallbackListPtr *pcbl, pointer unused, pointer calldata) break; default: - break; + break; } } |