Strengthen the algorithm that generates a random cookie for /detach.
This is a backwards-compatible change, no update to the scr-bx binary is necessary. git-svn-id: svn://svn.code.sf.net/p/bitchx/code/trunk@358 13b04d17-f746-0410-82c6-800466cd88b0
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
[Changes 1.2c01]
|
[Changes 1.2c01]
|
||||||
|
|
||||||
|
* Strengthen the cookie generation algorithm for /detach. (caf)
|
||||||
|
|
||||||
* RANDOM_SOURCE now only affects the rand() scripting function. (caf)
|
* RANDOM_SOURCE now only affects the rand() scripting function. (caf)
|
||||||
|
|
||||||
* Make RANDOM_LOCAL_PORTS actually random. (caf)
|
* Make RANDOM_LOCAL_PORTS actually random. (caf)
|
||||||
|
|||||||
@@ -2559,13 +2559,16 @@ void kill_attached_if_needed(int type)
|
|||||||
|
|
||||||
void make_cookie(void)
|
void make_cookie(void)
|
||||||
{
|
{
|
||||||
int i, j;
|
unsigned char rand_bytes[21];
|
||||||
memset(connect_cookie, 0, sizeof(connect_cookie));
|
int i;
|
||||||
for (i = 0; i < (int) (20.0 * rand()/RAND_MAX) + 5; i++)
|
char *cookie;
|
||||||
{
|
|
||||||
j = (int)(95.0 * rand()/RAND_MAX);
|
for (i = 0; i < sizeof rand_bytes; i++)
|
||||||
connect_cookie[i] = j + 32;
|
rand_bytes[i] = random_number(0);
|
||||||
}
|
|
||||||
|
cookie = base64_encode(rand_bytes, sizeof rand_bytes);
|
||||||
|
strlcpy(connect_cookie, cookie, sizeof connect_cookie);
|
||||||
|
new_free(&cookie);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int create_ipc_socket(void)
|
static int create_ipc_socket(void)
|
||||||
|
|||||||
Reference in New Issue
Block a user