Hello, world! Both dspam and dspamc seem to initialize the random generator in a pretty strange way: instead of calling "time" as a function and using its result, the _address_ of the function is used as a random seed and it is shifted to the left by the PID, which is usually greater than word size, leading to undefined result.
This patch fixes both problems. Have a nice fortnight -- Martin `MJ' Mares <[EMAIL PROTECTED]> http://mj.ucw.cz/ Faculty of Math and Physics, Charles University, Prague, Czech Rep., Earth There really exists a Microsoft product that doesn't suck -- unfortunately, it's a vacuum cleaner. --- dspam-3.8.0/src/dspam.c.mj 2006-12-12 16:33:45.000000000 +0100 +++ dspam-3.8.0/src/dspam.c 2007-05-25 13:38:09.000000000 +0200 @@ -110,7 +110,7 @@ struct nt_c c_nt; struct passwd *pwent; - srand ((long) time << (long) getpid ()); + srand ((long) time(NULL) ^ (long) getpid ()); umask (006); /* rw-rw---- */ setbuf (stdout, NULL); /* unbuffered output */ #ifdef DEBUG --- dspam-3.8.0/src/dspamc.c.mj 2006-05-13 03:12:59.000000000 +0200 +++ dspam-3.8.0/src/dspamc.c 2007-05-24 15:35:25.000000000 +0200 @@ -105,7 +105,7 @@ DO_DEBUG = 0; #endif - srand ((long) time << (long) getpid()); + srand ((long) time(NULL) ^ (long) getpid()); umask (006); #ifndef DAEMON