X-Git-Url: https://git.hcoop.net/hcoop/debian/courier-authlib.git/blobdiff_plain/330026da191ad124643fae36d739652130ea9e79..abbcc258303efeaef9502d406b8f7aee877f3d2f:/cryptpassword.c diff --git a/cryptpassword.c b/cryptpassword.c index 1ad4a50..89f9dd4 100644 --- a/cryptpassword.c +++ b/cryptpassword.c @@ -1,5 +1,5 @@ /* -** Copyright 2001-2002 Double Precision, Inc. See COPYING for +** Copyright 2001-2008 Double Precision, Inc. See COPYING for ** distribution information. */ @@ -16,8 +16,10 @@ #endif #include "auth.h" #include +#include "md5/md5.h" +#include "sha1/sha1.h" -static const char rcsid[]="$Id: cryptpassword.c,v 1.9 2007/10/07 18:33:22 mrsam Exp $"; +static const char rcsid[]="$Id: cryptpassword.c,v 1.10 2008/07/10 02:43:55 mrsam Exp $"; #if HAVE_CRYPT #if NEED_CRYPT_PROTOTYPE @@ -25,14 +27,6 @@ extern char *crypt(const char *, const char *); #endif #endif -#if HAVE_MD5LIB -#include "md5/md5.h" -#endif - -#if HAVE_SHA1LIB -#include "sha1/sha1.h" -#endif - static const char crypt_salt[65]="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789./"; static const char *crypt_hash(const char *pw) @@ -55,7 +49,6 @@ static const char *crypt_hash(const char *pw) return (crypt(pw, salt)); } -#if HAVE_MD5LIB static const char *crypt_md5_wrapper(const char *pw) { struct timeval tv; @@ -79,7 +72,6 @@ static const char *crypt_md5_wrapper(const char *pw) return (md5_crypt(pw, salt)); } -#endif char *authcryptpasswd(const char *password, const char *encryption_hint) { @@ -88,8 +80,6 @@ char *authcryptpasswd(const char *password, const char *encryption_hint) const char *p; char *pp; -#if HAVE_MD5LIB - if (!encryption_hint || strncmp(encryption_hint, "$1$", 3) == 0) { pfix=""; @@ -108,9 +98,7 @@ char *authcryptpasswd(const char *password, const char *encryption_hint) hash_func= &md5_hash_raw; pfix="{MD5RAW}"; } -#endif -#if HAVE_SHA1LIB if (!encryption_hint || strncasecmp(encryption_hint, "{SHA}", 5) == 0) { hash_func= &sha1_hash; @@ -123,7 +111,6 @@ char *authcryptpasswd(const char *password, const char *encryption_hint) hash_func= &sha256_hash; pfix="{SHA256}"; } -#endif if (!hash_func) {