SHA256
1
0
forked from pool/whois
whois/whois-5.0.11-mkpasswd-support-Owl-patched-libcrypt.diff

64 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(-)
Index: whois-5.0.11/Makefile
===================================================================
--- whois-5.0.11.orig/Makefile
+++ whois-5.0.11/Makefile
@@ -44,8 +44,12 @@ 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 += -lowcrypt
+endif
mkpasswd_LDADD += -lcrypt
endif
Index: whois-5.0.11/mkpasswd.c
===================================================================
--- whois-5.0.11.orig/mkpasswd.c
+++ whois-5.0.11/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);