[Pkg-shadow-commits] r1673 - in upstream/trunk: . lib

nekral-guest at alioth.debian.org nekral-guest at alioth.debian.org
Sun Jan 6 13:49:00 UTC 2008


Author: nekral-guest
Date: 2008-01-06 13:49:00 +0000 (Sun, 06 Jan 2008)
New Revision: 1673

Modified:
   upstream/trunk/ChangeLog
   upstream/trunk/lib/encrypt.c
Log:
Set the method string as a constant string.


Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog	2008-01-06 13:42:47 UTC (rev 1672)
+++ upstream/trunk/ChangeLog	2008-01-06 13:49:00 UTC (rev 1673)
@@ -1,5 +1,9 @@
 2008-01-06  Nicolas François  <nicolas.francois at centraliens.net>
 
+	* lib/encrypt.c: Set the method string as a constant string.
+
+2008-01-06  Nicolas François  <nicolas.francois at centraliens.net>
+
 	* lib/port.c: Assume <errno.h> declares errno.
 
 2008-01-06  Nicolas François  <nicolas.francois at centraliens.net>

Modified: upstream/trunk/lib/encrypt.c
===================================================================
--- upstream/trunk/lib/encrypt.c	2008-01-06 13:42:47 UTC (rev 1672)
+++ upstream/trunk/lib/encrypt.c	2008-01-06 13:49:00 UTC (rev 1673)
@@ -54,7 +54,7 @@
 	 * supported, and return a DES encrypted password. */
 	if (salt && salt[0] == '$' && strlen (cp) <= 13)
 	{
-		char *method = "$1$";
+		const char *method;
 		switch (salt[1])
 		{
 			case '1':
@@ -67,7 +67,11 @@
 				method = "SHA512";
 				break;
 			default:
-				method[1] = salt[1];
+			{
+				static char nummethod[4] = "$x$";
+				nummethod[1] = salt[1];
+				method = &nummethod[0];
+			}
 		}
 		fprintf (stderr,
 			 _("crypt method not supported by libcrypt? (%s)\n"),




More information about the Pkg-shadow-commits mailing list