]> git.sur5r.net Git - openldap/commitdiff
Add {CLEARTEXT} password-hash support
authorKurt Zeilenga <kurt@openldap.org>
Wed, 12 Jun 2002 00:43:34 +0000 (00:43 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Wed, 12 Jun 2002 00:43:34 +0000 (00:43 +0000)
libraries/liblutil/passwd.c

index dba06c9b2b1d8e5901726477d4a9755de7e5c901..7a04154b98d65787e16778a9102f104214414223 100644 (file)
@@ -180,6 +180,11 @@ static struct berval *hash_crypt(
        const struct berval *passwd );
 #endif
 
+#ifdef SLAPD_CLEARTEXT
+static struct berval *hash_clear(
+       const struct pw_scheme *scheme,
+       const struct berval *passwd );
+#endif
 
 static const struct pw_scheme pw_schemes[] =
 {
@@ -212,7 +217,7 @@ static const struct pw_scheme pw_schemes[] =
 
 #ifdef SLAPD_CLEARTEXT
        /* psuedo scheme */
-       { {0, "{CLEARTEXT}"}, NULL, NULL },
+       { {0, "{CLEARTEXT}"}, NULL, hash_clear },
 #endif
 
        { {0, NULL}, NULL, NULL }
@@ -224,11 +229,9 @@ static const struct pw_scheme *get_scheme(
        int i;
 
        for( i=0; pw_schemes[i].name.bv_val; i++) {
-               if( pw_schemes[i].name.bv_len == 0 ) continue;
+               if( pw_schemes[i].name.bv_val == NULL ) continue;
 
-               if( strncasecmp(scheme, pw_schemes[i].name.bv_val,
-                       pw_schemes[i].name.bv_len) == 0 )
-               {
+               if( strcasecmp(scheme, pw_schemes[i].name.bv_val ) == 0 ) {
                        return &pw_schemes[i];
                }
        }
@@ -1257,3 +1260,14 @@ int lutil_salt_format(const char *format)
 
        return 0;
 }
+
+#ifdef SLAPD_CLEARTEXT
+static struct berval *hash_clear(
+       const struct pw_scheme *scheme,
+       const struct berval  *passwd )
+{
+       return ber_bvdup( (struct berval *) passwd );
+}
+#endif
+
+