Package: cpu
Version: 1.4.3-9.1
Severity: wishlist
This patch implements md5crypt password support, eg: (cpu.conf)
- HASH = "md5crypt"
Here is the patch:
Index: src/plugins/ldap/ld.c
===================================================================
--- src/plugins/ldap/ld.c (revision 1)
+++ src/plugins/ldap/ld.c (working copy)
@@ -478,6 +478,9 @@
case H_CRYPT:
return ldap_hashes[H_CRYPT];
break;
+ case H_MD5CRYPT: /* HvB */
+ return ldap_hashes[H_CRYPT];
+ break;
case H_CLEAR:
/* FIXME: this should work so that the prefix is returned for the
correct hash but the password doesn't get encrypted */
Index: src/include/util/hash.h
===================================================================
--- src/include/util/hash.h (revision 1)
+++ src/include/util/hash.h (working copy)
@@ -49,12 +49,14 @@
#define PASSWORD_SIZE 128
/* hash_t should have a one-to-one correspondence with hashes */
+/* HVB added H_MD5CRYPT */
typedef enum {
H_SHA1 = 0,
H_SSHA1,
H_MD5,
H_SMD5,
H_CRYPT,
+ H_MD5CRYPT,
H_CLEAR,
H_UNKNOWN,
} hash_t;
Index: src/util/hash.c
===================================================================
--- src/util/hash.c (revision 1)
+++ src/util/hash.c (working copy)
@@ -50,6 +50,7 @@
"md5",
"smd5",
"crypt",
+ "md5crypt",
"clear",
NULL
};
@@ -140,6 +141,11 @@
char * passphrase = NULL;
size_t plen = 0;
+ /*
+ * HvB
+ */
+ char md5salt[32];
+
if ( password == NULL )
return NULL;
@@ -189,9 +195,20 @@
fprintf(stderr, "Your c library is missing 'crypt'\n");
#endif
break;
+
+ case H_MD5CRYPT: /* HvB */
+#ifdef HAVE_LIBCRYPT
+ snprintf(md5salt, sizeof(md5salt),"$1$%s", cgetSalt());
+ temp = crypt(password, md5salt);
+#else
+ fprintf(stderr, "Your c library is missing 'crypt'\n");
+#endif
+ break;
+
case H_CLEAR:
temp = password;
break;
+
default:
fprintf(stderr, "getHash: Unknown hash type.\n");
return NULL;
-- System Information:
Debian Release: 4.0
APT prefers stable
APT policy: (500, 'stable')
Architecture: i386 (i686)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.17.11-openib-1
Locale: LANG=C, LC_CTYPE=C (charmap=ANSI_X3.4-1968)
Versions of packages cpu depends on:
ii cracklib2 2.7-19 pro-active password checker librar
ii debconf [debconf-2.0] 1.5.11 Debian configuration management sy
ii libc6 2.3.6.ds1-13 GNU C Library: Shared libraries
ii libldap2 2.1.30-13.3 OpenLDAP libraries
ii ucf 2.0020 Update Configuration File: preserv
cpu recommends no packages.
-- debconf information excluded
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]