X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=libraries%2Fliblutil%2Fpasswd.c;h=739c833bc6db2fa7883084f7e1b2afa8415556b3;hb=6456e5f5593c09bf6a446e82e690181beed3d077;hp=5a04acfdccbae1ecd80f1eb71be6331ec55728b3;hpb=8d4c20cd6dcc40c1028d2a9d8874eebd47b6cfcf;p=openldap diff --git a/libraries/liblutil/passwd.c b/libraries/liblutil/passwd.c index 5a04acfdcc..739c833bc6 100644 --- a/libraries/liblutil/passwd.c +++ b/libraries/liblutil/passwd.c @@ -66,7 +66,7 @@ static const unsigned char crypt64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./"; #ifdef SLAPD_CRYPT -static const char *salt_format = NULL; +static char *salt_format = NULL; #endif struct pw_scheme; @@ -373,6 +373,8 @@ struct berval * lutil_passwd_hash( return (sc->hash_fn)( sc, passwd ); } +/* pw_string is only called when SLAPD_LMHASH or SLAPD_CRYPT is defined */ +#if defined(SLAPD_LMHASH) || defined(SLAPD_CRYPT) static struct berval * pw_string( const struct pw_scheme *sc, const struct berval *passwd ) @@ -394,6 +396,7 @@ static struct berval * pw_string( pw->bv_val[pw->bv_len] = '\0'; return pw; } +#endif /* SLAPD_LMHASH || SLAPD_CRYPT */ static struct berval * pw_string64( const struct pw_scheme *sc, @@ -1239,15 +1242,9 @@ static struct berval *hash_crypt( int lutil_salt_format(const char *format) { #ifdef SLAPD_CRYPT - if (format) { - if (salt_format) - free(salt_format); - salt_format = strdup(format); - } else { // unset if they pass in NULL - if (salt_format) - free(salt_format); - salt_format = NULL; - } + free( salt_format ); + + salt_format = format != NULL ? strdup( format ) : NULL; #endif return 0;