]> git.sur5r.net Git - openldap/blobdiff - libraries/liblutil/passwd.c
ITS#7182 Expose the peer address of a connection.
[openldap] / libraries / liblutil / passwd.c
index cb9f0e034ac7853783badeb4cb5f109b37650789..d5ab32617261f06e9f4a11ab9df444d3aae4b4f0 100644 (file)
@@ -1,7 +1,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2009 The OpenLDAP Foundation.
+ * Copyright 1998-2012 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,14 @@ typedef des_key_schedule des_context;
 #define des_finish(key, schedule) 
 
 #elif defined(HAVE_MOZNSS)
-#      include <pk11pub.h>
+/*
+  hack hack hack
+  We need to define this here so that nspr/obsolete/protypes.h will not be included
+  if that file is included, it will create a uint32 typedef that will cause the
+  one in lutil_sha1.h to blow up
+*/
+#define PROTYPES_H 1
+#      include <nss/pk11pub.h>
 typedef PK11SymKey *des_key;
 typedef unsigned char des_data_block[8];
 typedef PK11Context *des_context[1];
@@ -417,7 +424,7 @@ static int pw_string(
 }
 #endif /* SLAPD_LMHASH || SLAPD_CRYPT */
 
-static int pw_string64(
+int lutil_passwd_string64(
        const struct berval *sc,
        const struct berval *hash,
        struct berval *b64,
@@ -657,7 +664,7 @@ static int chk_md5(
  * abstract away setting the parity.
  */
 static void
-des_set_key( des_key *key, unsigned char *keyData)
+des_set_key_and_parity( des_key *key, unsigned char *keyData)
 {
     memcpy(key, keyData, 8);
     des_set_odd_parity( key );
@@ -670,7 +677,7 @@ des_set_key( des_key *key, unsigned char *keyData)
  * implement MozNSS wrappers for the openSSL calls 
  */
 static void
-des_set_key( des_key *key, unsigned char *keyData)
+des_set_key_and_parity( des_key *key, unsigned char *keyData)
 {
     SECItem keyDataItem;
     PK11SlotInfo *slot;
@@ -825,7 +832,7 @@ static void lmPasswd_to_key(
        k[6] = ((lpw[5] & 0x3F) << 2) | (lpw[6] >> 6);
        k[7] = ((lpw[6] & 0x7F) << 1);
                
-       des_set_key( key, k );
+       des_set_key_and_parity( key, k );
 }      
 
 static int chk_lanman(
@@ -1044,7 +1051,7 @@ static int hash_ssha1(
                (const unsigned char *)salt.bv_val, salt.bv_len );
        lutil_SHA1Final( SHA1digest, &SHA1context );
 
-       return pw_string64( scheme, &digest, hash, &salt);
+       return lutil_passwd_string64( scheme, &digest, hash, &salt);
 }
 
 static int hash_sha1(
@@ -1064,7 +1071,7 @@ static int hash_sha1(
                (const unsigned char *)passwd->bv_val, passwd->bv_len );
        lutil_SHA1Final( SHA1digest, &SHA1context );
             
-       return pw_string64( scheme, &digest, hash, NULL);
+       return lutil_passwd_string64( scheme, &digest, hash, NULL);
 }
 #endif
 
@@ -1096,7 +1103,7 @@ static int hash_smd5(
                (const unsigned char *) salt.bv_val, salt.bv_len );
        lutil_MD5Final( MD5digest, &MD5context );
 
-       return pw_string64( scheme, &digest, hash, &salt );
+       return lutil_passwd_string64( scheme, &digest, hash, &salt );
 }
 
 static int hash_md5(
@@ -1118,7 +1125,7 @@ static int hash_md5(
                (const unsigned char *) passwd->bv_val, passwd->bv_len );
        lutil_MD5Final( MD5digest, &MD5context );
 
-       return pw_string64( scheme, &digest, hash, NULL );
+       return lutil_passwd_string64( scheme, &digest, hash, NULL );
 ;
 }