diff options
author | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-20 21:28:41 +0000 |
---|---|---|
committer | Denis Vlasenko <vda.linux@googlemail.com> | 2007-07-20 21:28:41 +0000 |
commit | 21d1014b5b91d1a1319273945291b7a9f4717827 (patch) | |
tree | b84eadba35d31f923ef62579652e4e5d76678c38 /libbb | |
parent | 2f6ae43b9c74d393a139007377895e8c50b8af9a (diff) | |
download | busybox-w32-21d1014b5b91d1a1319273945291b7a9f4717827.tar.gz busybox-w32-21d1014b5b91d1a1319273945291b7a9f4717827.tar.bz2 busybox-w32-21d1014b5b91d1a1319273945291b7a9f4717827.zip |
chpasswd: new applet by Alexander Shishkin <virtuoso@slind.org>
Diffstat (limited to 'libbb')
-rw-r--r-- | libbb/Kbuild | 3 | ||||
-rw-r--r-- | libbb/crypt_make_salt.c | 9 |
2 files changed, 5 insertions, 7 deletions
diff --git a/libbb/Kbuild b/libbb/Kbuild index 659586717..c0cbe1aa9 100644 --- a/libbb/Kbuild +++ b/libbb/Kbuild | |||
@@ -104,7 +104,8 @@ lib-y += xreadlink.o | |||
104 | lib-$(CONFIG_FEATURE_MOUNT_LOOP) += loop.o | 104 | lib-$(CONFIG_FEATURE_MOUNT_LOOP) += loop.o |
105 | lib-$(CONFIG_LOSETUP) += loop.o | 105 | lib-$(CONFIG_LOSETUP) += loop.o |
106 | lib-$(CONFIG_FEATURE_MTAB_SUPPORT) += mtab.o | 106 | lib-$(CONFIG_FEATURE_MTAB_SUPPORT) += mtab.o |
107 | lib-$(CONFIG_PASSWD) += pw_encrypt.o crypt_make_salt.o | 107 | lib-$(CONFIG_PASSWD) += pw_encrypt.o crypt_make_salt.o update_passwd.o |
108 | lib-$(CONFIG_CHPASSWD) += pw_encrypt.o crypt_make_salt.o update_passwd.o | ||
108 | lib-$(CONFIG_CRYPTPW) += pw_encrypt.o crypt_make_salt.o | 109 | lib-$(CONFIG_CRYPTPW) += pw_encrypt.o crypt_make_salt.o |
109 | lib-$(CONFIG_SULOGIN) += pw_encrypt.o | 110 | lib-$(CONFIG_SULOGIN) += pw_encrypt.o |
110 | lib-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) += pw_encrypt.o | 111 | lib-$(CONFIG_FEATURE_HTTPD_AUTH_MD5) += pw_encrypt.o |
diff --git a/libbb/crypt_make_salt.c b/libbb/crypt_make_salt.c index 12e96328f..ebdf02420 100644 --- a/libbb/crypt_make_salt.c +++ b/libbb/crypt_make_salt.c | |||
@@ -24,12 +24,9 @@ static int i64c(int i) | |||
24 | return ('a' - 38 + i); | 24 | return ('a' - 38 + i); |
25 | } | 25 | } |
26 | 26 | ||
27 | 27 | int crypt_make_salt(char *p, int cnt, int x) | |
28 | void crypt_make_salt(char *p, int cnt) | ||
29 | { | 28 | { |
30 | unsigned x = x; /* it's pointless to initialize it anyway :) */ | 29 | x += getpid() + time(NULL); |
31 | |||
32 | x += getpid() + time(NULL) + clock(); | ||
33 | do { | 30 | do { |
34 | /* x = (x*1664525 + 1013904223) % 2^32 generator is lame | 31 | /* x = (x*1664525 + 1013904223) % 2^32 generator is lame |
35 | * (low-order bit is not "random", etc...), | 32 | * (low-order bit is not "random", etc...), |
@@ -44,5 +41,5 @@ void crypt_make_salt(char *p, int cnt) | |||
44 | *p++ = i64c(x >> 22); | 41 | *p++ = i64c(x >> 22); |
45 | } while (--cnt); | 42 | } while (--cnt); |
46 | *p = '\0'; | 43 | *p = '\0'; |
44 | return x; | ||
47 | } | 45 | } |
48 | |||