SHA256
1
0
forked from pool/whois
whois/whois-5.0.11-mkpasswd-support-Owl-patched-libcrypt.diff
Cristian Rodríguez 9f4f7e06b6 Accepting request 76616 from home:lnussel:crypt_blowfish
- enable use of crypt_gensalt to support all glibc supported
  algorithms
- allow 8bit passwords read from file
- support new blowfish $2y algorithm

I've sent the patches to Marco d'Itri <md@linux.it>, he said he will
include them in the next whois release.

OBS-URL: https://build.opensuse.org/request/show/76616
OBS-URL: https://build.opensuse.org/package/show/network:utilities/whois?expand=0&rev=19
2011-07-27 06:21:55 +00:00

69 lines
1.8 KiB
Diff

From 1f6bc61a9b79472234571092493d6d980826e736 Mon Sep 17 00:00:00 2001
From: Ludwig Nussel <ludwig.nussel@suse.de>
Date: Thu, 14 Jul 2011 13:06:14 +0200
Subject: [PATCH whois 1/7] support Owl patched libcrypt
Owl (and upcoming openSUSE) patch crypt_gensalt directly into libc's
libcrypt.
---
Makefile | 7 ++++++-
mkpasswd.c | 8 ++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/Makefile b/Makefile
index 44f09dd..66c4cbe 100644
--- a/Makefile
+++ b/Makefile
@@ -44,9 +44,14 @@ endif
ifdef HAVE_XCRYPT
mkpasswd_LDADD += -lxcrypt
-DEFS += -DHAVE_XCRYPT
+DEFS += -DHAVE_XCRYPT -DHAVE_CRYPT_GENSALT
else
+ifdef HAVE_CRYPT_GENSALT
+DEFS += -DHAVE_CRYPT_GENSALT
mkpasswd_LDADD += -lcrypt
+else
+mkpasswd_LDADD += -lcrypt
+endif
endif
##############################################################################
diff --git a/mkpasswd.c b/mkpasswd.c
index 176d980..43403d4 100644
--- a/mkpasswd.c
+++ b/mkpasswd.c
@@ -36,6 +36,10 @@
#include <xcrypt.h>
#include <sys/stat.h>
#endif
+#ifdef HAVE_CRYPT_GENSALT
+#define _OW_SOURCE
+#include <crypt.h>
+#endif
#ifdef HAVE_GETTIMEOFDAY
#include <sys/time.h>
#endif
@@ -82,7 +86,7 @@ static const struct crypt_method methods[] = {
#if defined FreeBSD
{ "bf", "$2$", 22, 22, 0, "Blowfish (FreeBSD)" },
#endif
-#if defined OpenBSD || (defined __SVR4 && defined __sun) || defined HAVE_XCRYPT
+#if defined OpenBSD || (defined __SVR4 && defined __sun) || defined HAVE_CRYPT_GENSALT
{ "bf", "$2a$", 22, 22, 1, "Blowfish" },
#endif
#if defined FreeBSD
@@ -264,7 +268,7 @@ int main(int argc, char *argv[])
strcat(salt, rounds_str);
strcat(salt, salt_arg);
} else {
-#ifdef HAVE_XCRYPT
+#ifdef HAVE_CRYPT_GENSALT
void *entropy = get_random_bytes(64);
salt = crypt_gensalt(salt_prefix, rounds, entropy, 64);
--
1.7.3.4