[Pkg-shadow-commits] r1411 - in upstream/trunk: . libmisc
nekral-guest at alioth.debian.org
nekral-guest at alioth.debian.org
Mon Nov 19 22:34:48 UTC 2007
Author: nekral-guest
Date: 2007-11-19 22:34:48 +0000 (Mon, 19 Nov 2007)
New Revision: 1411
Modified:
upstream/trunk/ChangeLog
upstream/trunk/libmisc/salt.c
Log:
* libmisc/salt.c (MAGNUM): Terminate the array with nul (the array
is then used with strcat).
* libmisc/salt.c (crypt_make_salt): Initialize result[0] to nul at
the beginning (was not initialized when USE_PAM).
* libmisc/salt.c (crypt_make_salt): Check that ENCRYPT_METHOD is a
valid crypt method.
Modified: upstream/trunk/ChangeLog
===================================================================
--- upstream/trunk/ChangeLog 2007-11-19 22:16:50 UTC (rev 1410)
+++ upstream/trunk/ChangeLog 2007-11-19 22:34:48 UTC (rev 1411)
@@ -1,5 +1,14 @@
2007-11-19 Nicolas François <nicolas.francois at centraliens.net>
+ * libmisc/salt.c (MAGNUM): Terminate the array with nul (the array
+ is then used with strcat).
+ * libmisc/salt.c (crypt_make_salt): Initialize result[0] to nul at
+ the beginning (was not initialized when USE_PAM).
+ * libmisc/salt.c (crypt_make_salt): Check that ENCRYPT_METHOD is a
+ valid crypt method.
+
+2007-11-19 Nicolas François <nicolas.francois at centraliens.net>
+
* NEWS, libmisc/obscure.c, libmisc/salt.c, src/passwd.c,
lib/getdef.c, etc/login.defs: Add support for SHA256 and SHA512
encrypt methods. Apply RedHat's patch shadow-4.0.18.1-sha256.patch.
Modified: upstream/trunk/libmisc/salt.c
===================================================================
--- upstream/trunk/libmisc/salt.c 2007-11-19 22:16:50 UTC (rev 1410)
+++ upstream/trunk/libmisc/salt.c 2007-11-19 22:34:48 UTC (rev 1411)
@@ -59,7 +59,9 @@
* version of crypt() instead of the standard one.
*/
-#define MAGNUM(array,ch) (array)[0]= (array)[2] = '$',(array)[1]=(ch)
+#define MAGNUM(array,ch) (array)[0]= (array)[2] = '$',\
+ (array)[1]=(ch),\
+ (array)[2]='\0'
char *crypt_make_salt (void)
{
@@ -68,6 +70,8 @@
int max_salt_len = 8;
char *method;
+ result[0] = '\0';
+
#ifndef USE_PAM
#ifdef ENCRYPTMETHOD_SELECT
if ((method = getdef_str ("ENCRYPT_METHOD")) == NULL) {
@@ -75,8 +79,7 @@
if (getdef_bool ("MD5_CRYPT_ENAB")) {
MAGNUM(result,'1');
max_salt_len = 11;
- } else
- result[0] = '\0';
+ }
#ifdef ENCRYPTMETHOD_SELECT
} else {
if (!strncmp (method, "MD5", 3)) {
@@ -88,10 +91,13 @@
} else if (!strncmp (method, "SHA512", 6)) {
MAGNUM(result, '6');
max_salt_len = 11; /* XXX: should not be fixed */
- } else if (!strncmp (method, "DES", 3))
+ } else if (0 != strncmp (method, "DES", 3)) {
+ fprintf (stderr,
+ _("Invalid ENCRYPT_METHOD value: '%s'.\n"
+ "Defaulting to DES.\n"),
+ method);
result[0] = '\0';
- else
- result[0] = '\0';
+ }
}
#endif /* ENCRYPTMETHOD_SELECT */
#endif /* USE_PAM */
More information about the Pkg-shadow-commits
mailing list