[exim-dev] [Bug 722] Need a random number generator

Etusivu
Poista viesti
Vastaa
Lähettäjä: Roman Odaisky
Päiväys:  
Vastaanottaja: exim-dev
Aihe: [exim-dev] [Bug 722] Need a random number generator
------- You are receiving this mail because: -------
You are on the CC list for the bug.

http://bugs.exim.org/show_bug.cgi?id=722

Roman Odaisky <to.roma.from.eximbug@???> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|RESOLVED                    |REOPENED
         Resolution|WONTFIX                     |





--- Comment #2 from Roman Odaisky <to.roma.from.eximbug@???> 2008-06-20 09:04:02 ---
That does not solve the problem. ‘Some sensible data’ is still predictable.
Messages arriving over the same connection are likely to have the same values
of $tod_epoch, $pid and other variables, which is hardly good for load
balancing. Also, how would one use ${md5} to choose one of three items from a
list?

Implementing $rand seems very simple, just cloning the code for $pid:

$ fgrep -C 1 pid expand.c
  vtype_reply,          /* value not used; get reply from headers */
  vtype_pid,            /* value not used; result is pid */
  vtype_host_lookup,    /* value not used; get host name */
--
  { "parent_local_part",   vtype_stringptr,   &deliver_localpart_parent },
  { "pid",                 vtype_pid,         NULL },
  { "primary_hostname",    vtype_stringptr,   &primary_hostname },
--


    case vtype_pid:
    sprintf(CS var_buffer, "%d", (int)getpid()); /* pid */
    return var_buffer;


and calling srand() somewhere.

WBR, Roman.


--
Configure bugmail: http://bugs.exim.org/userprefs.cgi?tab=email