You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
cpu/cpu-1.4.3-md5crypt.patch

76 lines
2.1 KiB
Diff

diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/include/util/hash.h mezzanine_patched_cpu-1.4.3/src/include/util/hash.h
--- cpu-1.4.3/src/include/util/hash.h 2003-09-26 22:27:01.000000000 -0400
+++ mezzanine_patched_cpu-1.4.3/src/include/util/hash.h 2007-07-24 15:26:10.000000000 -0400
@@ -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;
diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/plugins/ldap/ld.c mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c
--- cpu-1.4.3/src/plugins/ldap/ld.c 2007-07-24 15:26:53.000000000 -0400
+++ mezzanine_patched_cpu-1.4.3/src/plugins/ldap/ld.c 2007-07-24 15:26:10.000000000 -0400
@@ -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 */
diff -Nur -x '*.orig' -x '*.rej' cpu-1.4.3/src/util/hash.c mezzanine_patched_cpu-1.4.3/src/util/hash.c
--- cpu-1.4.3/src/util/hash.c 2003-10-22 17:29:19.000000000 -0400
+++ mezzanine_patched_cpu-1.4.3/src/util/hash.c 2007-07-24 15:26:10.000000000 -0400
@@ -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;
@@ -185,9 +191,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;