[Pkg-shadow-commits] r1451 - in upstream/trunk: . libmisc

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Fri Nov 23 21:04:43 UTC 2007


Author: nekral-guest
Date: 2007-11-23 21:04:43 +0000 (Fri, 23 Nov 2007)
New Revision: 1451

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/libmisc/salt.c
Log:
* Move the srandom call to gensalt.
* Replace the test on salt_size by an assert.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2007-11-23 20:51:43 UTC (rev 1450)
+++ upstream/trunk/ChangeLog	2007-11-23 21:04:43 UTC (rev 1451)
@@ -1,5 +1,11 @@
 2007-11-23  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* libmisc/salt.c: Move the srandom call to gensalt.
+	* libmisc/salt.c (gensalt): Replace the test on salt_size by an
+	assert.
+
+2007-11-23  Nicolas François  <nicolas.francois at centraliens.net>
+
 	Patch contributed by Dan Kopecek <dkopecek at redhat.com>
 	* src/chpasswd.c, src/chgpasswd.c, src/newusers.c: Fix compilation
 	when ENCRYPTMETHOD_SELECT is not defined.

Modified: upstream/trunk/libmisc/salt.c
===================================================================
--- upstream/trunk/libmisc/salt.c	2007-11-23 20:51:43 UTC (rev 1450)
+++ upstream/trunk/libmisc/salt.c	2007-11-23 21:04:43 UTC (rev 1451)
@@ -143,14 +143,14 @@
  
   salt[0] = '\0';
   
-  if (salt_size >= MIN_SALT_SIZE &&
-      salt_size <= MAX_SALT_SIZE) {
+	assert (salt_size >= MIN_SALT_SIZE &&
+	        salt_size <= MAX_SALT_SIZE);
+	srandom ((unsigned int)time(NULL));
     strcat (salt, l64a (random()));
     do {
       strcat (salt, l64a (random()));
     } while (strlen (salt) < salt_size);
     salt[salt_size] = '\0';
-  }
   
   return salt;
 }
@@ -217,7 +217,6 @@
 	 * Concatenate a pseudo random salt.
 	 */
 	assert (sizeof (result) > strlen (result) + salt_len);
-	srandom ((unsigned int)time(NULL));
 	strncat (result, gensalt (salt_len),
 		 sizeof (result) - strlen (result) - 1);
 




More information about the Pkg-shadow-commits mailing list