Merged revisions 104015 via svnmerge from
authorKevin P. Fleming <kpfleming@digium.com>
Thu, 21 Feb 2008 14:44:04 +0000 (14:44 +0000)
committerKevin P. Fleming <kpfleming@digium.com>
Thu, 21 Feb 2008 14:44:04 +0000 (14:44 +0000)
https://origsvn.digium.com/svn/asterisk/branches/1.4

........
r104015 | kpfleming | 2008-02-21 08:33:51 -0600 (Thu, 21 Feb 2008) | 2 lines

reduce the likelihood that HTTP Manager session ids will consist of primarily '1' bits

........

git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@104016 65c4cc65-6c06-0410-ace0-fbb531ad65f3

main/manager.c

index ee370c3..d4ba834 100644 (file)
@@ -3427,7 +3427,7 @@ static struct ast_str *generic_http_callback(enum output_format format,
                ast_mutex_init(&s->__lock);
                ast_mutex_lock(&s->__lock);
                s->inuse = 1;
-               s->managerid = rand() | 1;      /* make sure it is non-zero */
+               s->managerid = (rand() ^ (unsigned long) s) | 1;        /* make sure it is non-zero */
                s->last_ev = grab_last();
                AST_LIST_LOCK(&sessions);
                AST_LIST_INSERT_HEAD(&sessions, s, list);