On Fri, Jun 15, 2012 at 04:25:31PM +0400, Eugene Agafonov wrote:
> Does jabberd2 work after is re-compiled with 12.04?
No.
> Anyway, I suspect you blame the following expat's function:
>
> static unsigned long
> generate_hash_secret_salt(void)
> {
> unsigned int seed = time(NULL) % UINT_MAX;
> srand(seed);
> return rand();
> }
>
> It is called once (per parser instance) with quite random value
> based on current time.
> That's the mostly recommended way to initialize pseudo-random
> generator as far as I remember
> so it looks safe for me.
No, the problem is that jabberd2 creates a new parser for each
connection and needs a random id for each connection. Now if there are
2 connections within a second, the random number generator gets
reseeded with the same initial value and you get the same random id
for both connections.
Christof
--
http://cmeerw.org sip:cmeerw at cmeerw.org
mailto:cmeerw at cmeerw.org xmpp:cmeerw at cmeerw.org