os: auth: let GenerateAuthorization() return 0 on error

XID = 0 already is used as sign for error in several places,
so let's use that here, too.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
This commit is contained in:
Enrico Weigelt, metux IT consult 2025-03-10 14:20:00 +01:00
parent a68f5c125c
commit 6c6e0b09a1
4 changed files with 4 additions and 4 deletions

View File

@ -491,7 +491,7 @@ ProcSecurityGenerateAuthorization(ClientPtr client)
authId = GenerateAuthorization(stuff->nbytesAuthProto, protoname,
stuff->nbytesAuthData, protodata,
&authdata_len, &pAuthdata);
if ((XID) ~0L == authId) {
if (!authId) {
return SecurityErrorBase + XSecurityBadAuthorizationProtocol;
}

View File

@ -68,7 +68,7 @@ winGenerateAuthorization(void)
g_authId = GenerateAuthorization(strlen(AUTH_NAME),
AUTH_NAME,
0, NULL, &g_uiAuthDataLen, &g_pAuthData);
if ((XID) ~0L == g_authId) {
if (!g_authId) {
ErrorF("winGenerateAuthorization - GenerateAuthorization failed\n");
return FALSE;
}

View File

@ -293,5 +293,5 @@ GenerateAuthorization(unsigned name_length,
data_length_return, data_return);
}
}
return -1;
return 0;
}

View File

@ -161,7 +161,7 @@ MitGenerateCookie(unsigned data_length,
GenerateRandomData(sizeof(cookie), cookie);
XID id = MitAddCookie(sizeof(cookie), cookie);
if (!id)
return -1;
return 0;
*data_return = cookie;
*data_length_return = sizeof(cookie);