Xext: security: use x_rpcbuf_t for reply payload assembly

Use x_rpcbuf_t for reply payload and X_SEND_REPLY_WITH_RPCBUF()
for sending it all out.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult
2025-08-25 17:03:59 +02:00
committed by Enrico Weigelt
parent cd86e5f69a
commit e1315e22db

View File

@@ -403,7 +403,6 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
Bool removeAuth = FALSE; /* if bailout, call RemoveAuthorization? */
int err; /* error to return from this function */
XID authId; /* authorization ID assigned by os layer */
xSecurityGenerateAuthorizationReply reply; /* reply struct */
unsigned int trustLevel; /* trust level of new auth */
XID group; /* group of new auth */
CARD32 timeout; /* timeout of new auth */
@@ -533,31 +532,26 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
/* tell client the auth id and data */
reply = (xSecurityGenerateAuthorizationReply) {
.type = X_Reply,
.sequenceNumber = client->sequence,
.length = bytes_to_int32(authdata_len),
x_rpcbuf_t rpcbuf = { .swapped = client->swapped, .err_clear = TRUE };
x_rpcbuf_write_binary_pad(&rpcbuf, pAuthdata, authdata_len);
xSecurityGenerateAuthorizationReply reply = {
.authId = authId,
.dataLength = authdata_len
};
if (client->swapped) {
swapl(&reply.length);
swaps(&reply.sequenceNumber);
swapl(&reply.authId);
swaps(&reply.dataLength);
}
WriteToClient(client, SIZEOF(xSecurityGenerateAuthorizationReply), &reply);
WriteToClient(client, authdata_len, pAuthdata);
SecurityAudit
("client %d generated authorization %lu trust %d timeout %lu group %lu events %lu\n",
client->index, (unsigned long)pAuth->id, pAuth->trustLevel, (unsigned long)pAuth->timeout,
(unsigned long)pAuth->group, (unsigned long)eventMask);
/* the request succeeded; don't call RemoveAuthorization or free pAuth */
return Success;
return X_SEND_REPLY_WITH_RPCBUF(client, reply, rpcbuf);
bailout:
if (removeAuth)