"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890./";
#ifdef SLAPD_CRYPT
-static const char *salt_format = NULL;
+static char *salt_format = NULL;
#endif
struct pw_scheme;
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 )
pw->bv_val[pw->bv_len] = '\0';
return pw;
}
+#endif /* SLAPD_LMHASH || SLAPD_CRYPT */
static struct berval * pw_string64(
const struct pw_scheme *sc,
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;