]> git.ipfire.org Git - thirdparty/asterisk.git/commitdiff
Merged revisions 184726 via svnmerge from
authorRussell Bryant <russell@russellbryant.com>
Fri, 27 Mar 2009 18:09:49 +0000 (18:09 +0000)
committerRussell Bryant <russell@russellbryant.com>
Fri, 27 Mar 2009 18:09:49 +0000 (18:09 +0000)
https://origsvn.digium.com/svn/asterisk/trunk

........
r184726 | russell | 2009-03-27 13:04:43 -0500 (Fri, 27 Mar 2009) | 2 lines

Use ast_random() instead of rand() to ensure we use the best RNG available.

........

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

apps/app_minivm.c
main/manager.c

index 632edd08ffa7ce3c8b6fbfc39593ad66223eafb2..731f0602842f2f9b026038c6084c37f532477b55 100644 (file)
@@ -1031,7 +1031,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
        } 
        ast_debug(4, "Fromstring now: %s\n", ast_strlen_zero(passdata) ? "-default-" : passdata);
 
-       fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)rand(), vmu->username, (int)getpid(), who);
+       fprintf(p, "Message-ID: <Asterisk-%d-%s-%d-%s>\n", (unsigned int)ast_random(), vmu->username, (int)getpid(), who);
        len_passdata = strlen(vmu->fullname) * 2 + 3;
        passdata2 = alloca(len_passdata);
        if (!ast_strlen_zero(vmu->email))
@@ -1064,7 +1064,7 @@ static int sendmail(struct minivm_template *template, struct minivm_account *vmu
        fprintf(p, "MIME-Version: 1.0\n");
 
        /* Something unique. */
-       snprintf(bound, sizeof(bound), "voicemail_%s%d%d", vmu->username, (int)getpid(), (unsigned int)rand());
+       snprintf(bound, sizeof(bound), "voicemail_%s%d%d", vmu->username, (int)getpid(), (unsigned int)ast_random());
 
        fprintf(p, "Content-Type: multipart/mixed; boundary=\"%s\"\n\n\n", bound);
 
index 9e83328cd9adbb59b923672247a52fe8bb022c58..4ee08a4a6188dfc7c47a81b1227392a4bb9d131c 100644 (file)
@@ -3791,7 +3791,7 @@ static struct ast_str *generic_http_callback(enum output_format format,
                 * properties of the rand() function (and the constantcy of s), that
                 * won't happen twice in a row.
                 */
-               while ((session->managerid = rand() ^ (unsigned long) session) == 0);
+               while ((session->managerid = ast_random() ^ (unsigned long) session) == 0);
                session->last_ev = grab_last();
                AST_LIST_HEAD_INIT_NOLOCK(&session->datastores);
                AST_LIST_LOCK(&sessions);