From: Kurt Zeilenga Date: Wed, 12 Jun 2002 00:43:34 +0000 (+0000) Subject: Add {CLEARTEXT} password-hash support X-Git-Tag: NO_SLAP_OP_BLOCKS~1482 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=56bbe054903877616a8a4c119b2f886f2d7f3424;p=openldap Add {CLEARTEXT} password-hash support --- diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index dba06c9b2b..7a04154b98 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -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 + +