aboutsummaryrefslogtreecommitdiff
path: root/libbb/pw_encrypt.c
diff options
context:
space:
mode:
authorDenis Vlasenko <vda.linux@googlemail.com>2008-06-15 18:35:34 +0000
committerDenis Vlasenko <vda.linux@googlemail.com>2008-06-15 18:35:34 +0000
commitb4c5bf615e0cd0da41222b853627ce2c893cba5c (patch)
tree6a631fbd817d16dce6f0d16ed7381ee54cfd7b71 /libbb/pw_encrypt.c
parent5703c22a51a154db17e6a7f6426a95232542cc9e (diff)
downloadbusybox-b4c5bf615e0cd0da41222b853627ce2c893cba5c.tar.gz
Specially for Bernhard Fischer introduce USE_BB_CRYPT
which selects between libc/custom crypt routines.
Diffstat (limited to 'libbb/pw_encrypt.c')
-rw-r--r--libbb/pw_encrypt.c17
1 files changed, 17 insertions, 0 deletions
diff --git a/libbb/pw_encrypt.c b/libbb/pw_encrypt.c
index 762cbab27..c1e927e23 100644
--- a/libbb/pw_encrypt.c
+++ b/libbb/pw_encrypt.c
@@ -9,6 +9,8 @@
#include "libbb.h"
+#if ENABLE_USE_BB_CRYPT
+
/*
* DES and MD5 crypt implementations are taken from uclibc.
* They were modified to not use static buffers.
@@ -69,3 +71,18 @@ char *pw_encrypt(const char *clear, const char *salt, int cleanup)
return encrypted;
}
+
+#else /* if !ENABLE_USE_BB_CRYPT */
+
+char *pw_encrypt(const char *clear, const char *salt, int cleanup)
+{
+#if 0 /* was CONFIG_FEATURE_SHA1_PASSWORDS, but there is no such thing??? */
+ if (strncmp(salt, "$2$", 3) == 0) {
+ return xstrdup(sha1_crypt(clear));
+ }
+#endif
+
+ return xstrdup(crypt(clear, salt));
+}
+
+#endif