os: make MitGenerateCookie() independent of XCSECURITY
Analogous to previous commit. Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Reviewed-by: Jon Turney <jon.turney@dronecode.org.uk>
This commit is contained in:
parent
292ee71516
commit
1ef6569225
|
@ -68,32 +68,6 @@ static xcb_auth_info_t auth_info;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef XCSECURITY
|
#ifndef XCSECURITY
|
||||||
static char cookie[16]; /* 128 bits */
|
|
||||||
|
|
||||||
XID
|
|
||||||
MitGenerateCookie(unsigned data_length,
|
|
||||||
const char *data,
|
|
||||||
XID id, unsigned *data_length_return, char **data_return)
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
int status;
|
|
||||||
|
|
||||||
while (data_length--) {
|
|
||||||
cookie[i++] += *data++;
|
|
||||||
if (i >= sizeof(cookie))
|
|
||||||
i = 0;
|
|
||||||
}
|
|
||||||
GenerateRandomData(sizeof(cookie), cookie);
|
|
||||||
status = MitAddCookie(sizeof(cookie), cookie, id);
|
|
||||||
if (!status) {
|
|
||||||
id = -1;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
*data_return = cookie;
|
|
||||||
*data_length_return = sizeof(cookie);
|
|
||||||
}
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
static
|
static
|
||||||
XID
|
XID
|
||||||
|
|
|
@ -133,8 +133,6 @@ MitRemoveCookie(unsigned short data_length, const char *data)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef XCSECURITY
|
|
||||||
|
|
||||||
static char cookie[16]; /* 128 bits */
|
static char cookie[16]; /* 128 bits */
|
||||||
|
|
||||||
XID
|
XID
|
||||||
|
@ -161,5 +159,3 @@ MitGenerateCookie(unsigned data_length,
|
||||||
}
|
}
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* XCSECURITY */
|
|
||||||
|
|
Loading…
Reference in New Issue