aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2011-05-13 03:19:01 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2011-05-13 03:19:01 +0200
commit12a432715f066cf9d677316a39c9e0ebc6d72404 (patch)
tree14a33cdedbd6ba7739449cc3dec968b55a01efad /include
parent0806e401d6747c391fa0427e0ccba9951f9a1c3d (diff)
downloadbusybox-12a432715f066cf9d677316a39c9e0ebc6d72404.tar.gz
adduser: safe username passing to passwd/addgroup
passwd: support creating SHA passwords random code shrink function old new delta crypt_make_pw_salt - 87 +87 adduser_main 883 904 +21 ... crypt_make_salt 99 89 -10 chpasswd_main 329 312 -17 packed_usage 28731 28691 -40 passwd_main 1070 1000 -70 cryptpw_main 310 224 -86 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/12 up/down: 154/-288) Total: -134 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h9
1 files changed, 7 insertions, 2 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 4232c38f4..89e8e4452 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1259,14 +1259,19 @@ extern int correct_password(const struct passwd *pw) FAST_FUNC;
#endif
extern char *pw_encrypt(const char *clear, const char *salt, int cleanup) FAST_FUNC;
extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) FAST_FUNC;
-/* rnd is additional random input. New one is returned.
+/*
+ * rnd is additional random input. New one is returned.
* Useful if you call crypt_make_salt many times in a row:
* rnd = crypt_make_salt(buf1, 4, 0);
* rnd = crypt_make_salt(buf2, 4, rnd);
* rnd = crypt_make_salt(buf3, 4, rnd);
* (otherwise we risk having same salt generated)
*/
-extern int crypt_make_salt(char *p, int cnt, int rnd) FAST_FUNC;
+extern int crypt_make_salt(char *p, int cnt /*, int rnd*/) FAST_FUNC;
+/* "$N$" + sha_salt_16_bytes + NUL */
+#define MAX_PW_SALT_LEN (3 + 16 + 1)
+extern char* crypt_make_pw_salt(char p[MAX_PW_SALT_LEN], const char *algo) FAST_FUNC;
+
/* Returns number of lines changed, or -1 on error */
#if !(ENABLE_FEATURE_ADDUSER_TO_GROUP || ENABLE_FEATURE_DEL_USER_FROM_GROUP)