[Fedora-directory-commits] ldapserver/ldap/servers/plugins/pwdstorage sha_pwd.c, 1.5, 1.6

Richard Allen Megginson (rmeggins) fedora-directory-commits at redhat.com
Mon Oct 9 21:43:00 UTC 2006


Author: rmeggins

Update of /cvs/dirsec/ldapserver/ldap/servers/plugins/pwdstorage
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv878

Modified Files:
	sha_pwd.c 
Log Message:
Bug(s) fixed: 199321
Bug Description:  incorrect base64 encoding of SHA passwords crashes server
Reviewed by: nkinder (Thanks!)
Fix Description: Check the return value of ldif_base64_decode to see if it is less than zero first before the other comparisons.  This is the error condition, so we can just return an error.  Additionally, the other comparisons with the unsigned should be ok since we know that the hash_len is a positive number.
Platforms tested: FC5
Flag Day: no
Doc impact: no



Index: sha_pwd.c
===================================================================
RCS file: /cvs/dirsec/ldapserver/ldap/servers/plugins/pwdstorage/sha_pwd.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- sha_pwd.c	6 Sep 2005 21:15:15 -0000	1.5
+++ sha_pwd.c	9 Oct 2006 21:42:57 -0000	1.6
@@ -115,7 +115,10 @@
         if ( dbhash == NULL ) goto loser;
     }
     hash_len = ldif_base64_decode( dbpwd, dbhash );
-    if ( hash_len >= shaLen ) {
+    if (hash_len < 0) {
+        slapi_log_error( SLAPI_LOG_PLUGIN, plugin_name, hasherrmsg, schemeName, dbpwd );
+        goto loser;
+    } else if ( hash_len >= shaLen ) {
         salt.bv_val = (void*)(dbhash + shaLen);
         salt.bv_len = hash_len - shaLen;
     } else if ( hash_len == DS40B1_SALTED_SHA_LENGTH ) {




More information about the Fedora-directory-commits mailing list