aboutsummaryrefslogtreecommitdiff
path: root/xorg-server/Xext/security.c
diff options
context:
space:
mode:
authormarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
committermarha <marha@users.sourceforge.net>2009-09-06 18:48:27 +0000
commita915739887477b28d924ecc8417ee107d125bd6c (patch)
treec02f315476b61892d1fd89182e18943dce8d6277 /xorg-server/Xext/security.c
parent6f25a23db1df27e992c34f6fd4c82e83c44fc2e2 (diff)
downloadvcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.gz
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.tar.bz2
vcxsrv-a915739887477b28d924ecc8417ee107d125bd6c.zip
Switched to xorg-server-1.6.99.900.tar.gz
Diffstat (limited to 'xorg-server/Xext/security.c')
-rw-r--r--xorg-server/Xext/security.c33
1 files changed, 18 insertions, 15 deletions
diff --git a/xorg-server/Xext/security.c b/xorg-server/Xext/security.c
index 1a90a82b1..42eb9f01d 100644
--- a/xorg-server/Xext/security.c
+++ b/xorg-server/Xext/security.c
@@ -37,7 +37,7 @@ in this Software without prior written authorization from The Open Group.
#include "registry.h"
#include "xacestr.h"
#include "securitysrv.h"
-#include <X11/extensions/securstr.h>
+#include <X11/extensions/securproto.h>
#include "modinit.h"
/* Extension stuff */
@@ -408,7 +408,7 @@ SecurityEventSelectForAuthorization(
}
}
- pEventClient = (OtherClients *) xalloc(sizeof(OtherClients));
+ pEventClient = xalloc(sizeof(OtherClients));
if (!pEventClient)
return BadAlloc;
pEventClient->mask = mask;
@@ -450,9 +450,9 @@ ProcSecurityGenerateAuthorization(
/* check request length */
REQUEST_AT_LEAST_SIZE(xSecurityGenerateAuthorizationReq);
- len = SIZEOF(xSecurityGenerateAuthorizationReq) >> 2;
- len += (stuff->nbytesAuthProto + (unsigned)3) >> 2;
- len += (stuff->nbytesAuthData + (unsigned)3) >> 2;
+ len = bytes_to_int32(SIZEOF(xSecurityGenerateAuthorizationReq));
+ len += bytes_to_int32(stuff->nbytesAuthProto);
+ len += bytes_to_int32(stuff->nbytesAuthData);
values = ((CARD32 *)stuff) + len;
len += Ones(stuff->valueMask);
if (client->req_len != len)
@@ -520,7 +520,7 @@ ProcSecurityGenerateAuthorization(
}
protoname = (char *)&stuff[1];
- protodata = protoname + ((stuff->nbytesAuthProto + (unsigned)3) >> 2);
+ protodata = protoname + bytes_to_int32(stuff->nbytesAuthProto);
/* call os layer to generate the authorization */
@@ -540,7 +540,7 @@ ProcSecurityGenerateAuthorization(
/* associate additional information with this auth ID */
- pAuth = (SecurityAuthorizationPtr)xalloc(sizeof(SecurityAuthorizationRec));
+ pAuth = xalloc(sizeof(SecurityAuthorizationRec));
if (!pAuth)
{
err = BadAlloc;
@@ -580,7 +580,7 @@ ProcSecurityGenerateAuthorization(
/* tell client the auth id and data */
rep.type = X_Reply;
- rep.length = (authdata_len + 3) >> 2;
+ rep.length = bytes_to_int32(authdata_len);
rep.sequenceNumber = client->sequence;
rep.authId = authId;
rep.dataLength = authdata_len;
@@ -623,13 +623,16 @@ ProcSecurityRevokeAuthorization(
{
REQUEST(xSecurityRevokeAuthorizationReq);
SecurityAuthorizationPtr pAuth;
+ int rc;
REQUEST_SIZE_MATCH(xSecurityRevokeAuthorizationReq);
- pAuth = (SecurityAuthorizationPtr)SecurityLookupIDByType(client,
- stuff->authId, SecurityAuthorizationResType, DixDestroyAccess);
- if (!pAuth)
- return SecurityErrorBase + XSecurityBadAuthorization;
+ rc = dixLookupResourceByType((pointer *)&pAuth, stuff->authId,
+ SecurityAuthorizationResType, client,
+ DixDestroyAccess);
+ if (rc != Success)
+ return (rc == BadValue) ?
+ SecurityErrorBase + XSecurityBadAuthorization : rc;
FreeResource(stuff->authId, RT_NONE);
return Success;
@@ -685,10 +688,10 @@ SProcSecurityGenerateAuthorization(
swaps(&stuff->nbytesAuthProto, n);
swaps(&stuff->nbytesAuthData, n);
swapl(&stuff->valueMask, n);
- values_offset = ((stuff->nbytesAuthProto + (unsigned)3) >> 2) +
- ((stuff->nbytesAuthData + (unsigned)3) >> 2);
+ values_offset = bytes_to_int32(stuff->nbytesAuthProto) +
+ bytes_to_int32(stuff->nbytesAuthData);
if (values_offset >
- stuff->length - (sz_xSecurityGenerateAuthorizationReq >> 2))
+ stuff->length - bytes_to_int32(sz_xSecurityGenerateAuthorizationReq))
return BadLength;
values = (CARD32 *)(&stuff[1]) + values_offset;
nvalues = (((CARD32 *)stuff) + stuff->length) - values;