diff options
author | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-06 01:44:06 +0700 |
---|---|---|
committer | Mikhail Gusarov <dottedmag@dottedmag.net> | 2010-05-13 00:22:37 +0700 |
commit | 3f3ff971ecff9936cebafc813af9193b97bba89c (patch) | |
tree | fdbbad794a42488b7ffe41eed7aba4e498335f55 /os/xdmauth.c | |
parent | 96c7ab27c383ec767f62a7a11e5fd76f86363fbc (diff) |
Replace X-allocation functions with their C89 counterparts
The only remaining X-functions used in server are XNF*, the rest is converted to
plain alloc/calloc/realloc/free/strdup.
X* functions are still exported from server and x* macros are still defined in
header file, so both ABI and API are not affected by this change.
Signed-off-by: Mikhail Gusarov <dottedmag@dottedmag.net>
Reviewed-by: Peter Hutterer <peter.hutterer@who-t.net>
Diffstat (limited to 'os/xdmauth.c')
-rw-r--r-- | os/xdmauth.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/os/xdmauth.c b/os/xdmauth.c index 7fab73111..31c1b4c41 100644 --- a/os/xdmauth.c +++ b/os/xdmauth.c @@ -239,7 +239,7 @@ XdmClientAuthTimeout (long now) prev->next = next; else xdmClients = next; - xfree (client); + free(client); } else prev = client; @@ -259,20 +259,20 @@ XdmAuthorizationValidate (unsigned char *plain, int length, *reason = "Bad XDM authorization key length"; return NULL; } - client = xalloc (sizeof (XdmClientAuthRec)); + client = malloc(sizeof (XdmClientAuthRec)); if (!client) return NULL; XdmClientAuthDecode (plain, client); if (!XdmcpCompareKeys (&client->rho, rho)) { - xfree (client); + free(client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed key comparison)"; return NULL; } for (i = 18; i < 24; i++) if (plain[i] != 0) { - xfree (client); + free(client); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed NULL check)"; return NULL; @@ -287,15 +287,15 @@ XdmAuthorizationValidate (unsigned char *plain, int length, #if defined(TCPCONN) || defined(STREAMSCONN) if (family == FamilyInternet && memcmp((char *)addr, client->client, 4) != 0) { - xfree (client); - xfree (addr); + free(client); + free(addr); if (reason) *reason = "Invalid XDM-AUTHORIZATION-1 key (failed address comparison)"; return NULL; } #endif - xfree (addr); + free(addr); } } now = time(0); @@ -308,7 +308,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, XdmClientAuthTimeout (now); if (abs (client->time - now) > TwentyMinutes) { - xfree (client); + free(client); if (reason) *reason = "Excessive XDM-AUTHORIZATION-1 time offset"; return NULL; @@ -317,7 +317,7 @@ XdmAuthorizationValidate (unsigned char *plain, int length, { if (XdmClientAuthCompare (existing, client)) { - xfree (client); + free(client); if (reason) *reason = "XDM authorization key matches an existing client!"; return NULL; @@ -363,7 +363,7 @@ XdmAddCookie (unsigned short data_length, const char *data, XID id) /* the first octet of the key must be zero */ if (key_bits[0] != '\0') return 0; - new = xalloc (sizeof (XdmAuthorizationRec)); + new = malloc(sizeof (XdmAuthorizationRec)); if (!new) return 0; new->next = xdmAuth; @@ -385,7 +385,7 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie, /* Auth packets must be a multiple of 8 bytes long */ if (cookie_length & 7) return (XID) -1; - plain = xalloc (cookie_length); + plain = malloc(cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { @@ -394,11 +394,11 @@ XdmCheckCookie (unsigned short cookie_length, const char *cookie, { client->next = xdmClients; xdmClients = client; - xfree (plain); + free(plain); return auth->id; } } - xfree (plain); + free(plain); return (XID) -1; } @@ -411,13 +411,13 @@ XdmResetCookie (void) for (auth = xdmAuth; auth; auth=next_auth) { next_auth = auth->next; - xfree (auth); + free(auth); } xdmAuth = 0; for (client = xdmClients; client; client=next_client) { next_client = client->next; - xfree (client); + free(client); } xdmClients = (XdmClientAuthPtr) 0; return 1; @@ -430,21 +430,21 @@ XdmToID (unsigned short cookie_length, char *cookie) XdmClientAuthPtr client; unsigned char *plain; - plain = xalloc (cookie_length); + plain = malloc(cookie_length); if (!plain) return (XID) -1; for (auth = xdmAuth; auth; auth=auth->next) { XdmcpUnwrap ((unsigned char *)cookie, (unsigned char *)&auth->key, plain, cookie_length); if ((client = XdmAuthorizationValidate (plain, cookie_length, &auth->rho, NULL, NULL)) != NULL) { - xfree (client); - xfree (cookie); - xfree (plain); + free(client); + free(cookie); + free(plain); return auth->id; } } - xfree (cookie); - xfree (plain); + free(cookie); + free(plain); return (XID) -1; } @@ -489,7 +489,7 @@ XdmRemoveCookie (unsigned short data_length, const char *data) XdmcpCompareKeys (key_bits, &auth->key)) { xdmAuth = auth->next; - xfree (auth); + free(auth); return 1; } } |