aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2012-01-08 16:44:37 +0100
committerDenys Vlasenko <vda.linux@googlemail.com>2012-01-08 16:44:37 +0100
commitd45efd3a9f6854ab662afe272aeae5779300b126 (patch)
treeda55232b26da14f80665c5783f23c97dc94fb339
parent3e0c428c45fdb7ec51bd3c8ee1f072385d2e62ac (diff)
downloadbusybox-w32-d45efd3a9f6854ab662afe272aeae5779300b126.tar.gz
busybox-w32-d45efd3a9f6854ab662afe272aeae5779300b126.tar.bz2
busybox-w32-d45efd3a9f6854ab662afe272aeae5779300b126.zip
passwd,cryptpw: make default encryption algorithm configurable
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--loginutils/Config.src7
-rw-r--r--loginutils/chpasswd.c2
-rw-r--r--loginutils/cryptpw.c2
-rw-r--r--loginutils/passwd.c2
4 files changed, 11 insertions, 2 deletions
diff --git a/loginutils/Config.src b/loginutils/Config.src
index 14ce53434..9bf79afee 100644
--- a/loginutils/Config.src
+++ b/loginutils/Config.src
@@ -283,6 +283,13 @@ config CHPASSWD
283 Reads a file of user name and password pairs from standard input 283 Reads a file of user name and password pairs from standard input
284 and uses this information to update a group of existing users. 284 and uses this information to update a group of existing users.
285 285
286config FEATURE_DEFAULT_PASSWD_ALGO
287 string "Default password encryption method (passwd -a, cryptpw -m parameter)"
288 default "des"
289 depends on PASSWD || CRYPTPW
290 help
291 Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512".
292
286config SU 293config SU
287 bool "su" 294 bool "su"
288 default y 295 default y
diff --git a/loginutils/chpasswd.c b/loginutils/chpasswd.c
index b7df57e5d..54ed73795 100644
--- a/loginutils/chpasswd.c
+++ b/loginutils/chpasswd.c
@@ -20,6 +20,8 @@
20//usage: "\n -m Use MD5 encryption instead of DES" 20//usage: "\n -m Use MD5 encryption instead of DES"
21//usage: ) 21//usage: )
22 22
23//TODO: implement -c ALGO
24
23#if ENABLE_LONG_OPTS 25#if ENABLE_LONG_OPTS
24static const char chpasswd_longopts[] ALIGN1 = 26static const char chpasswd_longopts[] ALIGN1 =
25 "encrypted\0" No_argument "e" 27 "encrypted\0" No_argument "e"
diff --git a/loginutils/cryptpw.c b/loginutils/cryptpw.c
index b244f55e3..a36f920f4 100644
--- a/loginutils/cryptpw.c
+++ b/loginutils/cryptpw.c
@@ -105,7 +105,7 @@ int cryptpw_main(int argc UNUSED_PARAM, char **argv)
105 applet_long_options = mkpasswd_longopts; 105 applet_long_options = mkpasswd_longopts;
106#endif 106#endif
107 fd = STDIN_FILENO; 107 fd = STDIN_FILENO;
108 opt_m = "d"; 108 opt_m = CONFIG_FEATURE_DEFAULT_PASSWD_ALGO;
109 opt_S = NULL; 109 opt_S = NULL;
110 /* at most two non-option arguments; -P NUM */ 110 /* at most two non-option arguments; -P NUM */
111 opt_complementary = "?2:P+"; 111 opt_complementary = "?2:P+";
diff --git a/loginutils/passwd.c b/loginutils/passwd.c
index 1cfafaec3..b83db0083 100644
--- a/loginutils/passwd.c
+++ b/loginutils/passwd.c
@@ -94,7 +94,7 @@ int passwd_main(int argc UNUSED_PARAM, char **argv)
94 }; 94 };
95 unsigned opt; 95 unsigned opt;
96 int rc; 96 int rc;
97 const char *opt_a = "d"; /* des */ 97 const char *opt_a = CONFIG_FEATURE_DEFAULT_PASSWD_ALGO;
98 const char *filename; 98 const char *filename;
99 char *myname; 99 char *myname;
100 char *name; 100 char *name;