const struct berval *salt,
const struct berval *cred );
+#ifdef LUTIL_SHA1_BYTES
static int chk_sha1(
const struct pw_scheme *scheme,
const struct berval *passwd,
const struct berval *salt,
const struct berval *cred );
+#endif
static int chk_crypt(
const struct pw_scheme *scheme,
const struct berval *passwd,
const struct berval *cred );
-
+#ifdef LUTIL_SHA1_BYTES
/* password hash routines */
static int *hash_sha1(
const struct pw_scheme *scheme,
const struct berval *salt,
struct berval **passwd_out,
struct berval **salt_out );
+#endif
static int *hash_md5(
const struct pw_scheme *scheme,
static const struct pw_scheme pw_schemes[] =
{
+#ifdef LUTIL_SHA1_BYTES
{ {sizeof("SHA1")-1, "SHA1"}, chk_sha1, 0 /* hash_sha1 */, 4 },
+#endif
{ {sizeof("MD5")-1, "MD5"}, chk_md5, 0 /* hash_md5 */, 4 },
#ifdef SLAPD_CRYPT
/* PASSWORD CHECK ROUTINES */
+#ifdef LUTIL_SHA1_BYTES
static int chk_sha1(
const struct pw_scheme *sc,
const struct berval * passwd,
ber_memfree(orig_salt);
return rc;
}
+#endif
static int chk_md5(
const struct pw_scheme *sc,
#ifdef SLAPD_GENERATE
+#ifdef LUTIL_SHA1_BYTES
static struct berval *hash_ssha1(
const struct pw_scheme *scheme,
const struct berval *passwd )
return pw_string64( scheme, &digest, NULL);
}
+#endif
static struct berval *hash_smd5(
const struct pw_scheme *scheme,
const struct berval *passwd,
const struct berval *cred );
+#ifdef LUTIL_SHA1_BYTES
static int chk_ssha1(
const struct pw_scheme *scheme,
const struct berval *passwd,
const struct pw_scheme *scheme,
const struct berval *passwd,
const struct berval *cred );
+#endif
#ifdef SLAPD_LMHASH
static int chk_lanman(
#endif
+#ifdef LUTIL_SHA1_BYTES
/* password hash routines */
static struct berval *hash_sha1(
const struct pw_scheme *scheme,
static struct berval *hash_ssha1(
const struct pw_scheme *scheme,
const struct berval *passwd );
+#endif
static struct berval *hash_smd5(
const struct pw_scheme *scheme,
static const struct pw_scheme pw_schemes[] =
{
+#ifdef LUTIL_SHA1_BYTES
{ {sizeof("{SSHA}")-1, "{SSHA}"}, chk_ssha1, hash_ssha1 },
{ {sizeof("{SHA}")-1, "{SHA}"}, chk_sha1, hash_sha1 },
+#endif
{ {sizeof("{SMD5}")-1, "{SMD5}"}, chk_smd5, hash_smd5 },
{ {sizeof("{MD5}")-1, "{MD5}"}, chk_md5, hash_md5 },
/* PASSWORD CHECK ROUTINES */
+#ifdef LUTIL_SHA1_BYTES
static int chk_ssha1(
const struct pw_scheme *sc,
const struct berval * passwd,
ber_memfree(orig_pass);
return rc ? 1 : 0;
}
+#endif
static int chk_smd5(
const struct pw_scheme *sc,
/* PASSWORD GENERATION ROUTINES */
+#ifdef LUTIL_SHA1_BYTES
static struct berval *hash_ssha1(
const struct pw_scheme *scheme,
const struct berval *passwd )
return pw_string64( scheme, &digest, NULL);
}
+#endif
static struct berval *hash_smd5(
const struct pw_scheme *scheme,
*/
#include "portable.h"
+#include <ac/bytes.h>
#include <ac/string.h>
/* include socket.h to get sys/types.h and/or winsock2.h */
#include "lutil_sha1.h"
+#ifdef LUTIL_SHA1_BYTES
+
/* undefining this will cause pointer alignment errors */
#define SHA1HANDSOFF /* Copies data before messing with it. */
#define rol(value, bits) (((value) << (bits)) | ((value) >> (32 - (bits))))
lutil_SHA1Update(&ctx, data, len);
return(lutil_SHA1End(&ctx, buf));
}
+
+#endif