[Date Prev][Date Next] [Chronological] [Thread] [Top]

[PATCH] smbk5passwd module should uppercase the NT/LM hashes



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

I was playing with smbk5passwd from HEAD built for 2.2, and I found that
 it worked, but the alpha characters in the sambaNTPassword and
sambaLMPassword attrbitutes were lower-cased (whereas previously they
were upper-cased, as set by samba or other tools).

With this change, the module does the right thing (ie after a password
change with ldappasswd I could authenticate to samba with the new password).

Regards,
Buchan	

Index: contrib/slapd-modules/smbk5pwd/smbk5pwd.c
===================================================================
RCS file:
/repo/OpenLDAP/pkg/ldap/contrib/slapd-modules/smbk5pwd/smbk5pwd.c,v
retrieving revision 1.3
diff -u -r1.3 smbk5pwd.c
- --- contrib/slapd-modules/smbk5pwd/smbk5pwd.c   24 Jan 2005 20:46:06 -0000
1.3
+++ contrib/slapd-modules/smbk5pwd/smbk5pwd.c   1 Apr 2005 12:59:25 -0000
@@ -51,6 +51,7 @@
 #ifdef DO_SAMBA
 #include <openssl/des.h>
 #include <openssl/md4.h>
+#include <ac/ctype.h>

 static AttributeDescription *ad_sambaLMPassword;
 static AttributeDescription *ad_sambaNTPassword;
@@ -104,8 +105,8 @@
        a = out->bv_val;
        b = (unsigned char *)in;
        for (i=0; i<HASHLEN; i++) {
- -               *a++ = hex[*b >> 4];
- -               *a++ = hex[*b++ & 0x0f];
+               *a++ = TOUPPER(hex[*b >> 4]);
+               *a++ = TOUPPER(hex[*b++ & 0x0f]);
        }
        *a++ = '\0';
 }

- --
Buchan Milne                      Senior Support Technician
Obsidian Systems                  http://www.obsidian.co.za
B.Eng          RHCE (803004789010797),LPIC-1 (LPI000074592)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQFCTZNPrJK6UGDSBKcRAl8BAJ9EAKefb8hv9rQve78Wg5djxLuPHgCfaV03
q6Ex0y6wKHrzxlDKPMPICx4=
=LA9c
-----END PGP SIGNATURE-----