Changeset 3621 in MondoRescue for branches/3.3/mindi-busybox/loginutils
- Timestamp:
- Dec 20, 2016, 4:07:32 PM (8 years ago)
- Location:
- branches/3.3
- Files:
-
- 1 added
- 14 edited
- 1 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/3.3/mindi-busybox/loginutils/Config.src
r3232 r3621 5 5 6 6 menu "Login/Password Management Utilities" 7 8 INSERT9 7 10 8 config FEATURE_SHADOWPASSWDS … … 94 92 user which has password encrypted with these algorithms. 95 93 96 config ADDUSER 97 bool "adduser" 98 default y 99 help 100 Utility for creating a new user account. 101 102 config FEATURE_ADDUSER_LONG_OPTIONS 103 bool "Enable long options" 104 default y 105 depends on ADDUSER && LONG_OPTS 106 help 107 Support long options for the adduser applet. 108 109 config FEATURE_CHECK_NAMES 110 bool "Enable sanity check on user/group names in adduser and addgroup" 111 default n 112 depends on ADDUSER || ADDGROUP 113 help 114 Enable sanity check on user and group names in adduser and addgroup. 115 To avoid problems, the user or group name should consist only of 116 letters, digits, underscores, periods, at signs and dashes, 117 and not start with a dash (as defined by IEEE Std 1003.1-2001). 118 For compatibility with Samba machine accounts "$" is also supported 119 at the end of the user or group name. 120 121 config FIRST_SYSTEM_ID 122 int "First valid system uid or gid for adduser and addgroup" 123 depends on ADDUSER || ADDGROUP 124 range 0 64900 125 default 100 126 help 127 First valid system uid or gid for adduser and addgroup 128 129 config LAST_SYSTEM_ID 130 int "Last valid system uid or gid for adduser and addgroup" 131 depends on ADDUSER || ADDGROUP 132 range 0 64900 133 default 999 134 help 135 Last valid system uid or gid for adduser and addgroup 136 137 config ADDGROUP 138 bool "addgroup" 139 default y 140 help 141 Utility for creating a new group account. 142 143 config FEATURE_ADDGROUP_LONG_OPTIONS 144 bool "Enable long options" 145 default y 146 depends on ADDGROUP && LONG_OPTS 147 help 148 Support long options for the addgroup applet. 149 150 config FEATURE_ADDUSER_TO_GROUP 151 bool "Support for adding users to groups" 152 default y 153 depends on ADDGROUP 154 help 155 If called with two non-option arguments, 156 addgroup will add an existing user to an 157 existing group. 158 159 config DELUSER 160 bool "deluser" 161 default y 162 help 163 Utility for deleting a user account. 164 165 config DELGROUP 166 bool "delgroup" 167 default y 168 help 169 Utility for deleting a group account. 170 171 config FEATURE_DEL_USER_FROM_GROUP 172 bool "Support for removing users from groups" 173 default y 174 depends on DELGROUP 175 help 176 If called with two non-option arguments, deluser 177 or delgroup will remove an user from a specified group. 178 179 config GETTY 180 bool "getty" 181 default y 182 select FEATURE_SYSLOG 183 help 184 getty lets you log in on a tty. It is normally invoked by init. 185 186 Note that you can save a few bytes by disabling it and 187 using login applet directly. 188 If you need to reset tty attributes before calling login, 189 this script approximates getty: 190 191 exec </dev/$1 >/dev/$1 2>&1 || exit 1 192 reset 193 stty sane; stty ispeed 38400; stty ospeed 38400 194 printf "%s login: " "`hostname`" 195 read -r login 196 exec /bin/login "$login" 197 198 config LOGIN 199 bool "login" 200 default y 201 select FEATURE_SYSLOG 202 help 203 login is used when signing onto a system. 204 205 Note that Busybox binary must be setuid root for this applet to 206 work properly. 207 208 config LOGIN_SESSION_AS_CHILD 209 bool "Run logged in session in a child process" 210 default y if PAM 211 depends on LOGIN 212 help 213 Run the logged in session in a child process. This allows 214 login to clean up things such as utmp entries or PAM sessions 215 when the login session is complete. If you use PAM, you 216 almost always would want this to be set to Y, else PAM session 217 will not be cleaned up. 218 219 config PAM 220 bool "Support for PAM (Pluggable Authentication Modules)" 221 default n 222 depends on LOGIN 223 help 224 Use PAM in login(1) instead of direct access to password database. 225 226 config LOGIN_SCRIPTS 227 bool "Support for login scripts" 228 depends on LOGIN 229 default y 230 help 231 Enable this if you want login to execute $LOGIN_PRE_SUID_SCRIPT 232 just prior to switching from root to logged-in user. 233 234 config FEATURE_NOLOGIN 235 bool "Support for /etc/nologin" 236 default y 237 depends on LOGIN 238 help 239 The file /etc/nologin is used by (some versions of) login(1). 240 If it exists, non-root logins are prohibited. 241 242 config FEATURE_SECURETTY 243 bool "Support for /etc/securetty" 244 default y 245 depends on LOGIN 246 help 247 The file /etc/securetty is used by (some versions of) login(1). 248 The file contains the device names of tty lines (one per line, 249 without leading /dev/) on which root is allowed to login. 250 251 config PASSWD 252 bool "passwd" 253 default y 254 select FEATURE_SYSLOG 255 help 256 passwd changes passwords for user and group accounts. A normal user 257 may only change the password for his/her own account, the super user 258 may change the password for any account. The administrator of a group 259 may change the password for the group. 260 261 Note that Busybox binary must be setuid root for this applet to 262 work properly. 263 264 config FEATURE_PASSWD_WEAK_CHECK 265 bool "Check new passwords for weakness" 266 default y 267 depends on PASSWD 268 help 269 With this option passwd will refuse new passwords which are "weak". 270 271 config CRYPTPW 272 bool "cryptpw" 273 default y 274 help 275 Encrypts the given password with the crypt(3) libc function 276 using the given salt. Debian has this utility under mkpasswd 277 name. Busybox provides mkpasswd as an alias for cryptpw. 278 279 config CHPASSWD 280 bool "chpasswd" 281 default y 282 help 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. 285 286 config 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 293 config SU 294 bool "su" 295 default y 296 select FEATURE_SYSLOG 297 help 298 su is used to become another user during a login session. 299 Invoked without a username, su defaults to becoming the super user. 300 301 Note that Busybox binary must be setuid root for this applet to 302 work properly. 303 304 config FEATURE_SU_SYSLOG 305 bool "Enable su to write to syslog" 306 default y 307 depends on SU 308 309 config FEATURE_SU_CHECKS_SHELLS 310 bool "Enable su to check user's shell to be listed in /etc/shells" 311 depends on SU 312 default y 313 314 config SULOGIN 315 bool "sulogin" 316 default y 317 select FEATURE_SYSLOG 318 help 319 sulogin is invoked when the system goes into single user 320 mode (this is done through an entry in inittab). 321 322 config VLOCK 323 bool "vlock" 324 default y 325 help 326 Build the "vlock" applet which allows you to lock (virtual) terminals. 327 328 Note that Busybox binary must be setuid root for this applet to 329 work properly. 94 INSERT 330 95 331 96 endmenu -
branches/3.3/mindi-busybox/loginutils/Kbuild.src
r2725 r3621 8 8 9 9 INSERT 10 lib-$(CONFIG_ADDGROUP) += addgroup.o11 lib-$(CONFIG_ADDUSER) += adduser.o12 lib-$(CONFIG_CRYPTPW) += cryptpw.o13 lib-$(CONFIG_CHPASSWD) += chpasswd.o14 lib-$(CONFIG_GETTY) += getty.o15 lib-$(CONFIG_LOGIN) += login.o16 lib-$(CONFIG_PASSWD) += passwd.o17 lib-$(CONFIG_SU) += su.o18 lib-$(CONFIG_SULOGIN) += sulogin.o19 lib-$(CONFIG_VLOCK) += vlock.o20 lib-$(CONFIG_DELUSER) += deluser.o21 lib-$(CONFIG_DELGROUP) += deluser.o -
branches/3.3/mindi-busybox/loginutils/add-remove-shell.c
r3232 r3621 8 8 * for details. 9 9 */ 10 11 //applet:IF_ADD_SHELL( APPLET_ODDNAME(add-shell , add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, add_shell ))12 //applet:IF_REMOVE_SHELL(APPLET_ODDNAME(remove-shell, add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, remove_shell))13 14 //kbuild:lib-$(CONFIG_ADD_SHELL) += add-remove-shell.o15 //kbuild:lib-$(CONFIG_REMOVE_SHELL) += add-remove-shell.o16 17 10 //config:config ADD_SHELL 18 11 //config: bool "add-shell" … … 26 19 //config: help 27 20 //config: Remove shells from /etc/shells. 21 22 //applet:IF_ADD_SHELL( APPLET_ODDNAME(add-shell , add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, add_shell )) 23 //applet:IF_REMOVE_SHELL(APPLET_ODDNAME(remove-shell, add_remove_shell, BB_DIR_USR_SBIN, BB_SUID_DROP, remove_shell)) 24 25 //kbuild:lib-$(CONFIG_ADD_SHELL) += add-remove-shell.o 26 //kbuild:lib-$(CONFIG_REMOVE_SHELL) += add-remove-shell.o 28 27 29 28 //usage:#define add_shell_trivial_usage … … 101 100 } 102 101 /* copy shell name from old to new file */ 103 p rintf("%s\n",line);102 puts(line); 104 103 next_line: 105 104 free(line); … … 113 112 while (*cpp) { 114 113 if (*cpp != dont_add) 115 p rintf("%s\n",*cpp);114 puts(*cpp); 116 115 cpp++; 117 116 } -
branches/3.3/mindi-busybox/loginutils/addgroup.c
r3232 r3621 10 10 * 11 11 */ 12 //config:config ADDGROUP 13 //config: bool "addgroup" 14 //config: default y 15 //config: help 16 //config: Utility for creating a new group account. 17 //config: 18 //config:config FEATURE_ADDGROUP_LONG_OPTIONS 19 //config: bool "Enable long options" 20 //config: default y 21 //config: depends on ADDGROUP && LONG_OPTS 22 //config: help 23 //config: Support long options for the addgroup applet. 24 //config: 25 //config:config FEATURE_ADDUSER_TO_GROUP 26 //config: bool "Support for adding users to groups" 27 //config: default y 28 //config: depends on ADDGROUP 29 //config: help 30 //config: If called with two non-option arguments, 31 //config: addgroup will add an existing user to an 32 //config: existing group. 33 34 //applet:IF_ADDGROUP(APPLET(addgroup, BB_DIR_USR_SBIN, BB_SUID_DROP)) 35 36 //kbuild:lib-$(CONFIG_ADDGROUP) += addgroup.o 12 37 13 38 //usage:#define addgroup_trivial_usage 14 //usage: "[-g GID] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP"39 //usage: "[-g GID] [-S] " IF_FEATURE_ADDUSER_TO_GROUP("[USER] ") "GROUP" 15 40 //usage:#define addgroup_full_usage "\n\n" 16 //usage: "Add a group " IF_FEATURE_ADDUSER_TO_GROUP("or add a user to a group") "\n"41 //usage: "Add a group" IF_FEATURE_ADDUSER_TO_GROUP(" or add a user to a group") "\n" 17 42 //usage: "\n -g GID Group id" 18 43 //usage: "\n -S Create a system group" … … 23 48 #error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config 24 49 #endif 50 #if CONFIG_LAST_ID < CONFIG_LAST_SYSTEM_ID 51 #error Bad LAST_ID or LAST_SYSTEM_ID in .config 52 #endif 25 53 26 54 #define OPT_GID (1 << 0) 27 55 #define OPT_SYSTEM_ACCOUNT (1 << 1) 28 56 29 /* We assume GID_T_MAX == INT_MAX */30 57 static void xgroup_study(struct group *g) 31 58 { 32 unsigned max = INT_MAX;59 unsigned max = CONFIG_LAST_ID; 33 60 34 61 /* Make sure gr_name is unused */ … … 47 74 } else { 48 75 g->gr_gid = CONFIG_LAST_SYSTEM_ID + 1; 49 max = 64999;50 76 } 51 77 } … … 126 152 { 127 153 unsigned opts; 128 unsigned gid = 0;154 const char *gid = "0"; 129 155 130 156 /* need to be root */ … … 140 166 * addgroup user group 141 167 * Check for min, max and missing args */ 142 opt_complementary = "-1:?2 :g+";168 opt_complementary = "-1:?2"; 143 169 opts = getopt32(argv, "g:S", &gid); 144 170 /* move past the commandline options */ … … 176 202 { 177 203 die_if_bad_username(argv[0]); 178 new_group(argv[0], gid);204 new_group(argv[0], xatou_range(gid, 0, CONFIG_LAST_ID)); 179 205 } 180 206 /* Reached only on success */ -
branches/3.3/mindi-busybox/loginutils/adduser.c
r3232 r3621 8 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 9 */ 10 //config:config ADDUSER 11 //config: bool "adduser" 12 //config: default y 13 //config: help 14 //config: Utility for creating a new user account. 15 //config: 16 //config:config FEATURE_ADDUSER_LONG_OPTIONS 17 //config: bool "Enable long options" 18 //config: default y 19 //config: depends on ADDUSER && LONG_OPTS 20 //config: help 21 //config: Support long options for the adduser applet. 22 //config: 23 //config:config FEATURE_CHECK_NAMES 24 //config: bool "Enable sanity check on user/group names in adduser and addgroup" 25 //config: default n 26 //config: depends on ADDUSER || ADDGROUP 27 //config: help 28 //config: Enable sanity check on user and group names in adduser and addgroup. 29 //config: To avoid problems, the user or group name should consist only of 30 //config: letters, digits, underscores, periods, at signs and dashes, 31 //config: and not start with a dash (as defined by IEEE Std 1003.1-2001). 32 //config: For compatibility with Samba machine accounts "$" is also supported 33 //config: at the end of the user or group name. 34 //config: 35 //config:config LAST_ID 36 //config: int "Last valid uid or gid for adduser and addgroup" 37 //config: depends on ADDUSER || ADDGROUP 38 //config: default 60000 39 //config: help 40 //config: Last valid uid or gid for adduser and addgroup 41 //config: 42 //config:config FIRST_SYSTEM_ID 43 //config: int "First valid system uid or gid for adduser and addgroup" 44 //config: depends on ADDUSER || ADDGROUP 45 //config: range 0 LAST_ID 46 //config: default 100 47 //config: help 48 //config: First valid system uid or gid for adduser and addgroup 49 //config: 50 //config:config LAST_SYSTEM_ID 51 //config: int "Last valid system uid or gid for adduser and addgroup" 52 //config: depends on ADDUSER || ADDGROUP 53 //config: range FIRST_SYSTEM_ID LAST_ID 54 //config: default 999 55 //config: help 56 //config: Last valid system uid or gid for adduser and addgroup 57 58 //applet:IF_ADDUSER(APPLET(adduser, BB_DIR_USR_SBIN, BB_SUID_DROP)) 59 60 //kbuild:lib-$(CONFIG_ADDUSER) += adduser.o 10 61 11 62 //usage:#define adduser_trivial_usage … … 21 72 //usage: "\n -H Don't create home directory" 22 73 //usage: "\n -u UID User id" 74 //usage: "\n -k SKEL Skeleton directory (/etc/skel)" 23 75 24 76 #include "libbb.h" … … 27 79 #error Bad LAST_SYSTEM_ID or FIRST_SYSTEM_ID in .config 28 80 #endif 81 #if CONFIG_LAST_ID < CONFIG_LAST_SYSTEM_ID 82 #error Bad LAST_ID or LAST_SYSTEM_ID in .config 83 #endif 84 29 85 30 86 /* #define OPT_HOME (1 << 0) */ /* unused */ … … 36 92 #define OPT_DONT_MAKE_HOME (1 << 6) 37 93 #define OPT_UID (1 << 7) 38 39 /* We assume UID_T_MAX == INT_MAX */ 94 #define OPT_SKEL (1 << 8) 95 40 96 /* remix */ 41 97 /* recoded such that the uid may be passed in *p */ 42 98 static void passwd_study(struct passwd *p) 43 99 { 44 int max = UINT_MAX;100 int max = CONFIG_LAST_ID; 45 101 46 102 if (getpwnam(p->pw_name)) { … … 55 111 } else { 56 112 p->pw_uid = CONFIG_LAST_SYSTEM_ID + 1; 57 max = 64999;58 113 } 59 114 } … … 133 188 "no-create-home\0" No_argument "H" 134 189 "uid\0" Required_argument "u" 190 "skel\0" Required_argument "k" 135 191 ; 136 192 #endif … … 148 204 char *p; 149 205 unsigned opts; 206 char *uid; 207 const char *skel = "/etc/skel"; 150 208 151 209 #if ENABLE_FEATURE_ADDUSER_LONG_OPTIONS … … 163 221 pw.pw_dir = NULL; 164 222 165 /* at most two non-option args */223 /* at least one and at most two non-option args */ 166 224 /* disable interactive passwd for system accounts */ 167 opt_complementary = "?2:SD:u+"; 168 if (sizeof(pw.pw_uid) == sizeof(int)) { 169 opts = getopt32(argv, "h:g:s:G:DSHu:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &pw.pw_uid); 170 } else { 171 unsigned uid; 172 opts = getopt32(argv, "h:g:s:G:DSHu:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &uid); 173 if (opts & OPT_UID) { 174 pw.pw_uid = uid; 175 } 176 } 225 opt_complementary = "-1:?2:SD"; 226 opts = getopt32(argv, "h:g:s:G:DSHu:k:", &pw.pw_dir, &pw.pw_gecos, &pw.pw_shell, &usegroup, &uid, &skel); 227 if (opts & OPT_UID) 228 pw.pw_uid = xatou_range(uid, 0, CONFIG_LAST_ID); 229 177 230 argv += optind; 178 231 pw.pw_name = argv[0]; … … 253 306 }; 254 307 /* Be silent on any errors (like: no /etc/skel) */ 255 logmode = LOGMODE_NONE; 256 copy_file("/etc/skel", pw.pw_dir, FILEUTILS_RECUR); 308 if (!(opts & OPT_SKEL)) 309 logmode = LOGMODE_NONE; 310 copy_file(skel, pw.pw_dir, FILEUTILS_RECUR); 257 311 logmode = LOGMODE_STDIO; 258 312 chown_main(4, (char**)args); -
branches/3.3/mindi-busybox/loginutils/chpasswd.c
r3232 r3621 6 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 7 */ 8 #include "libbb.h" 8 //config:config CHPASSWD 9 //config: bool "chpasswd" 10 //config: default y 11 //config: help 12 //config: Reads a file of user name and password pairs from standard input 13 //config: and uses this information to update a group of existing users. 14 //config: 15 //config:config FEATURE_DEFAULT_PASSWD_ALGO 16 //config: string "Default password encryption method (passwd -a, cryptpw -m parameter)" 17 //config: default "des" 18 //config: depends on PASSWD || CRYPTPW 19 //config: help 20 //config: Possible choices are "d[es]", "m[d5]", "s[ha256]" or "sha512". 21 22 //applet:IF_CHPASSWD(APPLET(chpasswd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 23 24 //kbuild:lib-$(CONFIG_CHPASSWD) += chpasswd.o 9 25 10 26 //usage:#define chpasswd_trivial_usage 11 //usage: IF_LONG_OPTS("[--md5|--encrypted ]") IF_NOT_LONG_OPTS("[-m|-e]")27 //usage: IF_LONG_OPTS("[--md5|--encrypted|--crypt-method]") IF_NOT_LONG_OPTS("[-m|-e|-c]") 12 28 //usage:#define chpasswd_full_usage "\n\n" 13 29 //usage: "Read user:password from stdin and update /etc/passwd\n" 14 30 //usage: IF_LONG_OPTS( 15 //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" 16 //usage: "\n -m,--md5 Use MD5 encryption instead of DES" 31 //usage: "\n -e,--encrypted Supplied passwords are in encrypted form" 32 //usage: "\n -m,--md5 Use MD5 encryption instead of DES" 33 //usage: "\n -c,--crypt-method Use the specified method to encrypt the passwords" 17 34 //usage: ) 18 35 //usage: IF_NOT_LONG_OPTS( 19 36 //usage: "\n -e Supplied passwords are in encrypted form" 20 37 //usage: "\n -m Use MD5 encryption instead of DES" 38 //usage: "\n -c Use the specified method to encrypt the passwords" 21 39 //usage: ) 22 40 23 //TODO: implement -c ALGO 41 #include "libbb.h" 24 42 25 43 #if ENABLE_LONG_OPTS 26 44 static const char chpasswd_longopts[] ALIGN1 = 27 "encrypted\0" No_argument "e" 28 "md5\0" No_argument "m" 45 "encrypted\0" No_argument "e" 46 "md5\0" No_argument "m" 47 "crypt-method\0" Required_argument "c" 29 48 ; 30 49 #endif … … 37 56 { 38 57 char *name; 58 const char *algo = CONFIG_FEATURE_DEFAULT_PASSWD_ALGO; 39 59 int opt; 40 60 … … 42 62 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); 43 63 44 opt_complementary = "m--e :e--m";64 opt_complementary = "m--ec:e--mc:c--em"; 45 65 IF_LONG_OPTS(applet_long_options = chpasswd_longopts;) 46 opt = getopt32(argv, "em ");66 opt = getopt32(argv, "emc:", &algo); 47 67 48 68 while ((name = xmalloc_fgetline(stdin)) != NULL) { … … 60 80 free_me = NULL; 61 81 if (!(opt & OPT_ENC)) { 62 char salt[ sizeof("$N$XXXXXXXX")];82 char salt[MAX_PW_SALT_LEN]; 63 83 64 crypt_make_salt(salt, 1);65 84 if (opt & OPT_MD5) { 66 salt[0] = '$'; 67 salt[1] = '1'; 68 salt[2] = '$'; 69 crypt_make_salt(salt + 3, 4); 85 /* Force MD5 if the -m flag is set */ 86 algo = "md5"; 70 87 } 88 89 crypt_make_pw_salt(salt, algo); 71 90 free_me = pass = pw_encrypt(pass, salt, 0); 72 91 } … … 87 106 bb_error_msg_and_die("an error occurred updating password for %s", name); 88 107 if (rc) 89 bb_ info_msg("Password for '%s' changed", name);108 bb_error_msg("password for '%s' changed", name); 90 109 logmode = LOGMODE_STDIO; 91 110 free(name); -
branches/3.3/mindi-busybox/loginutils/cryptpw.c
r3232 r3621 10 10 * Licensed under GPLv2, see file LICENSE in this source tree. 11 11 */ 12 //config:config CRYPTPW 13 //config: bool "cryptpw" 14 //config: default y 15 //config: help 16 //config: Encrypts the given password with the crypt(3) libc function 17 //config: using the given salt. 18 //config: 19 //config:config MKPASSWD 20 //config: bool "mkpasswd" 21 //config: default y 22 //config: help 23 //config: Encrypts the given password with the crypt(3) libc function 24 //config: using the given salt. Debian has this utility under mkpasswd 25 //config: name. Busybox provides mkpasswd as an alias for cryptpw. 26 27 //applet:IF_CRYPTPW(APPLET(cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP)) 28 // APPLET_ODDNAME:name main location suid_type help 29 //applet:IF_MKPASSWD(APPLET_ODDNAME(mkpasswd, cryptpw, BB_DIR_USR_BIN, BB_SUID_DROP, cryptpw)) 30 31 //kbuild:lib-$(CONFIG_CRYPTPW) += cryptpw.o 32 //kbuild:lib-$(CONFIG_MKPASSWD) += cryptpw.o 12 33 13 34 //usage:#define cryptpw_trivial_usage … … 15 36 /* We do support -s, we just don't mention it */ 16 37 //usage:#define cryptpw_full_usage "\n\n" 17 //usage: "Crypt PASSWORD using crypt(3)\n"18 //usage: IF_LONG_OPTS(19 //usage: "\n -P,--password-fd=N Read password from fd N"20 /* //usage: "\n -s,--stdin Use stdin; like -P0" */21 //usage: "\n -m,--method=TYPE Encryption method"22 //usage: "\n -S,--salt=SALT"23 //usage: )24 //usage: IF_NOT_LONG_OPTS(25 //usage: "\n -P N Read password from fd N"26 /* //usage: "\n -s Use stdin; like -P0" */27 //usage: "\n -m TYPE Encryption method TYPE"28 //usage: "\n -S SALT"29 //usage: )30 31 /* mkpasswd is an alias to cryptpw */32 //usage:#define mkpasswd_trivial_usage33 //usage: "[OPTIONS] [PASSWORD] [SALT]"34 /* We do support -s, we just don't mention it */35 //usage:#define mkpasswd_full_usage "\n\n"36 38 //usage: "Crypt PASSWORD using crypt(3)\n" 37 39 //usage: IF_LONG_OPTS( … … 93 95 char salt[MAX_PW_SALT_LEN]; 94 96 char *salt_ptr; 97 char *password; 95 98 const char *opt_m, *opt_S; 96 99 int fd; … … 124 127 xmove_fd(fd, STDIN_FILENO); 125 128 126 p uts(pw_encrypt(127 argv[0] ? argv[0] : (128 129 130 (isatty(STDIN_FILENO) && applet_name[0] == 'm')129 password = argv[0]; 130 if (!password) { 131 /* Only mkpasswd, and only from tty, prompts. 132 * Otherwise it is a plain read. */ 133 password = (ENABLE_MKPASSWD && isatty(STDIN_FILENO) && applet_name[0] == 'm') 131 134 ? bb_ask_stdin("Password: ") 132 135 : xmalloc_fgetline(stdin) 133 ), 134 salt, 1)); 136 ; 137 /* may still be NULL on EOF/error */ 138 } 139 140 if (password) 141 puts(pw_encrypt(password, salt, 1)); 135 142 136 143 return EXIT_SUCCESS; -
branches/3.3/mindi-busybox/loginutils/deluser.c
r3232 r3621 8 8 * 9 9 * Licensed under GPLv2, see file LICENSE in this source tree. 10 *11 10 */ 11 //config:config DELUSER 12 //config: bool "deluser" 13 //config: default y 14 //config: help 15 //config: Utility for deleting a user account. 16 //config: 17 //config:config DELGROUP 18 //config: bool "delgroup" 19 //config: default y 20 //config: help 21 //config: Utility for deleting a group account. 22 //config: 23 //config:config FEATURE_DEL_USER_FROM_GROUP 24 //config: bool "Support for removing users from groups" 25 //config: default y 26 //config: depends on DELGROUP 27 //config: help 28 //config: If called with two non-option arguments, deluser 29 //config: or delgroup will remove an user from a specified group. 30 31 //applet:IF_DELUSER(APPLET(deluser, BB_DIR_USR_SBIN, BB_SUID_DROP)) 32 //applet:IF_DELGROUP(APPLET_ODDNAME(delgroup, deluser, BB_DIR_USR_SBIN, BB_SUID_DROP, delgroup)) 33 34 //kbuild:lib-$(CONFIG_DELUSER) += deluser.o 35 //kbuild:lib-$(CONFIG_DELGROUP) += deluser.o 12 36 13 37 //usage:#define deluser_trivial_usage 14 //usage: "USER"38 //usage: IF_LONG_OPTS("[--remove-home] ") "USER" 15 39 //usage:#define deluser_full_usage "\n\n" 16 40 //usage: "Delete USER from the system" 41 // --remove-home is self-explanatory enough to put it in --help 17 42 18 43 //usage:#define delgroup_trivial_usage … … 38 63 int do_deluser = (ENABLE_DELUSER && (!ENABLE_DELGROUP || applet_name[3] == 'u')); 39 64 65 #if !ENABLE_LONG_OPTS 66 const int opt_delhome = 0; 67 #else 68 int opt_delhome = 0; 69 if (do_deluser) { 70 applet_long_options = 71 "remove-home\0" No_argument "\xff"; 72 opt_delhome = getopt32(argv, ""); 73 argv += opt_delhome; 74 argc -= opt_delhome; 75 } 76 #endif 77 40 78 if (geteuid() != 0) 41 79 bb_error_msg_and_die(bb_msg_perm_denied_are_you_root); … … 56 94 if (do_deluser) { 57 95 /* "deluser USER" */ 58 xgetpwnam(name); /* bail out if USER is wrong */ 96 struct passwd *pw; 97 98 pw = xgetpwnam(name); /* bail out if USER is wrong */ 59 99 pfile = bb_path_passwd_file; 60 100 if (ENABLE_FEATURE_SHADOWPASSWDS) 61 101 sfile = bb_path_shadow_file; 102 if (opt_delhome) 103 remove_file(pw->pw_dir, FILEUTILS_RECUR); 62 104 } else { 63 105 struct group *gr; … … 74 116 /* "delgroup GROUP" */ 75 117 struct passwd *pw; 76 struct passwd pwent;77 118 /* Check if the group is in use */ 78 #define passwd_buf bb_common_bufsiz1 79 while (!getpwent_r(&pwent, passwd_buf, sizeof(passwd_buf), &pw)) {80 if (pwent.pw_gid == gr->gr_gid)81 bb_error_msg_and_die("'%s' still has '%s' as their primary group!", pwent.pw_name, name);119 while ((pw = getpwent()) != NULL) { 120 if (pw->pw_gid == gr->gr_gid) 121 bb_error_msg_and_die("'%s' still has '%s' as their primary group!", 122 pw->pw_name, name); 82 123 } 83 124 //endpwent(); … … 98 139 } while (ENABLE_FEATURE_SHADOWPASSWDS && pfile); 99 140 100 if (ENABLE_DELGROUP && do_deluser > 0) { 101 /* "deluser USER" also should try to delete 102 * same-named group. IOW: do "delgroup USER" 103 */ 141 if (do_deluser > 0) { 142 /* Delete user from all groups */ 143 if (update_passwd(bb_path_group_file, NULL, NULL, name) == -1) 144 return EXIT_FAILURE; 145 146 if (ENABLE_DELGROUP) { 147 /* "deluser USER" also should try to delete 148 * same-named group. IOW: do "delgroup USER" 149 */ 104 150 // On debian deluser is a perl script that calls userdel. 105 151 // From man userdel: 106 152 // If USERGROUPS_ENAB is defined to yes in /etc/login.defs, userdel will 107 153 // delete the group with the same name as the user. 108 do_deluser = -1; 109 goto do_delgroup; 154 do_deluser = -1; 155 goto do_delgroup; 156 } 110 157 } 111 158 return EXIT_SUCCESS; -
branches/3.3/mindi-busybox/loginutils/getty.c
r3232 r3621 22 22 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 23 23 */ 24 //config:config GETTY 25 //config: bool "getty" 26 //config: default y 27 //config: select FEATURE_SYSLOG 28 //config: help 29 //config: getty lets you log in on a tty. It is normally invoked by init. 30 //config: 31 //config: Note that you can save a few bytes by disabling it and 32 //config: using login applet directly. 33 //config: If you need to reset tty attributes before calling login, 34 //config: this script approximates getty: 35 //config: 36 //config: exec </dev/$1 >/dev/$1 2>&1 || exit 1 37 //config: reset 38 //config: stty sane; stty ispeed 38400; stty ospeed 38400 39 //config: printf "%s login: " "`hostname`" 40 //config: read -r login 41 //config: exec /bin/login "$login" 42 43 //applet:IF_GETTY(APPLET(getty, BB_DIR_SBIN, BB_SUID_DROP)) 44 45 //kbuild:lib-$(CONFIG_GETTY) += getty.o 24 46 25 47 #include "libbb.h" … … 335 357 */ 336 358 337 /* line buffered input (NL or EOL or EOF chars end a line); 338 * recognize INT/QUIT/SUSP chars; 339 * echo input chars; 340 * echo BS-SP-BS on erase character; 341 * echo kill char specially, not as ^c (ECHOKE controls how exactly); 342 * erase all input via BS-SP-BS on kill char (else go to next line) 343 */ 344 G.tty_attrs.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE; 359 /* ICANON line buffered input (NL or EOL or EOF chars end a line); 360 * ISIG recognize INT/QUIT/SUSP chars; 361 * ECHO echo input chars; 362 * ECHOE echo BS-SP-BS on erase character; 363 * ECHOK echo kill char specially, not as ^c (ECHOKE controls how exactly); 364 * ECHOKE erase all input via BS-SP-BS on kill char (else go to next line) 365 * ECHOCTL Echo ctrl chars as ^c (else echo verbatim: 366 * e.g. up arrow emits "ESC-something" and thus moves cursor up!) 367 */ 368 G.tty_attrs.c_lflag |= ICANON | ISIG | ECHO | ECHOE | ECHOK | ECHOKE | ECHOCTL; 345 369 /* Other bits in c_lflag: 346 370 * XCASE Map uppercase to \lowercase [tried, doesn't work] 347 371 * ECHONL Echo NL even if ECHO is not set 348 * ECHOCTL Echo ctrl chars as ^c (else don't echo) - maybe set this?349 372 * ECHOPRT On erase, echo erased chars 350 373 * [qwe<BS><BS><BS> input looks like "qwe\ewq/" on screen] … … 520 543 } 521 544 545 static void sleep10(void) 546 { 547 sleep(10); 548 } 549 522 550 int getty_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 523 551 int getty_main(int argc UNUSED_PARAM, char **argv) … … 557 585 // getsid(0), getpgid(0)); 558 586 bb_perror_msg_and_die("setsid"); 587 /* 588 * When we can end up here? 589 * Example: setsid() fails when run alone in interactive shell: 590 * # getty 115200 /dev/tty2 591 * because shell's child (getty) is put in a new process group. 592 * But doesn't fail if shell is not interactive 593 * (and therefore doesn't create process groups for pipes), 594 * or if getty is not the first process in the process group: 595 * # true | getty 115200 /dev/tty2 596 */ 559 597 } 560 598 /* Looks like we are already a session leader. … … 589 627 590 628 /* Logging. We want special flavor of error_msg_and_die */ 591 die_ sleep =10;629 die_func = sleep10; 592 630 msg_eol = "\r\n"; 593 631 /* most likely will internally use fd #3 in CLOEXEC mode: */ … … 696 734 * and getty is not suid-root applet */ 697 735 /* With -n, logname == NULL, and login will ask for username instead */ 698 BB_EXECLP(G.login, G.login, "--", logname, NULL);736 BB_EXECLP(G.login, G.login, "--", logname, (char *)0); 699 737 bb_error_msg_and_die("can't execute '%s'", G.login); 700 738 } -
branches/3.3/mindi-busybox/loginutils/login.c
r3232 r3621 3 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 4 4 */ 5 //config:config LOGIN 6 //config: bool "login" 7 //config: default y 8 //config: select FEATURE_SYSLOG 9 //config: help 10 //config: login is used when signing onto a system. 11 //config: 12 //config: Note that Busybox binary must be setuid root for this applet to 13 //config: work properly. 14 //config: 15 //config:config LOGIN_SESSION_AS_CHILD 16 //config: bool "Run logged in session in a child process" 17 //config: default y if PAM 18 //config: depends on LOGIN 19 //config: help 20 //config: Run the logged in session in a child process. This allows 21 //config: login to clean up things such as utmp entries or PAM sessions 22 //config: when the login session is complete. If you use PAM, you 23 //config: almost always would want this to be set to Y, else PAM session 24 //config: will not be cleaned up. 25 //config: 26 //config:config LOGIN_SCRIPTS 27 //config: bool "Support for login scripts" 28 //config: depends on LOGIN 29 //config: default y 30 //config: help 31 //config: Enable this if you want login to execute $LOGIN_PRE_SUID_SCRIPT 32 //config: just prior to switching from root to logged-in user. 33 //config: 34 //config:config FEATURE_NOLOGIN 35 //config: bool "Support for /etc/nologin" 36 //config: default y 37 //config: depends on LOGIN 38 //config: help 39 //config: The file /etc/nologin is used by (some versions of) login(1). 40 //config: If it exists, non-root logins are prohibited. 41 //config: 42 //config:config FEATURE_SECURETTY 43 //config: bool "Support for /etc/securetty" 44 //config: default y 45 //config: depends on LOGIN 46 //config: help 47 //config: The file /etc/securetty is used by (some versions of) login(1). 48 //config: The file contains the device names of tty lines (one per line, 49 //config: without leading /dev/) on which root is allowed to login. 50 51 //applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */ 52 //applet:IF_LOGIN(APPLET(login, BB_DIR_BIN, BB_SUID_REQUIRE)) 53 54 //kbuild:lib-$(CONFIG_LOGIN) += login.o 5 55 6 56 //usage:#define login_trivial_usage … … 9 59 //usage: "Begin a new session on the system\n" 10 60 //usage: "\n -f Don't authenticate (user already authenticated)" 11 //usage: "\n -h Name of the remote host"61 //usage: "\n -h HOST Host user came from (for network logins)" 12 62 //usage: "\n -p Preserve environment" 13 63 14 64 #include "libbb.h" 65 #include "common_bufsiz.h" 15 66 #include <syslog.h> 16 67 #include <sys/resource.h> … … 29 80 # include <security/pam_appl.h> 30 81 # include <security/pam_misc.h> 82 83 # if 0 84 /* This supposedly can be used to avoid double password prompt, 85 * if used instead of standard misc_conv(): 86 * 87 * "When we want to authenticate first with local method and then with tacacs for example, 88 * the password is asked for local method and if not good is asked a second time for tacacs. 89 * So if we want to authenticate a user with tacacs, and the user exists localy, the password is 90 * asked two times before authentication is accepted." 91 * 92 * However, code looks shaky. For example, why misc_conv() return value is ignored? 93 * Are msg[i] and resp[i] indexes handled correctly? 94 */ 95 static char *passwd = NULL; 96 static int my_conv(int num_msg, const struct pam_message **msg, 97 struct pam_response **resp, void *data) 98 { 99 int i; 100 for (i = 0; i < num_msg; i++) { 101 switch (msg[i]->msg_style) { 102 case PAM_PROMPT_ECHO_OFF: 103 if (passwd == NULL) { 104 misc_conv(num_msg, msg, resp, data); 105 passwd = xstrdup(resp[i]->resp); 106 return PAM_SUCCESS; 107 } 108 109 resp[0] = xzalloc(sizeof(struct pam_response)); 110 resp[0]->resp = passwd; 111 passwd = NULL; 112 resp[0]->resp_retcode = PAM_SUCCESS; 113 resp[1] = NULL; 114 return PAM_SUCCESS; 115 116 default: 117 break; 118 } 119 } 120 121 return PAM_SUCCESS; 122 } 123 # endif 124 31 125 static const struct pam_conv conv = { 32 126 misc_conv, … … 46 140 struct termios tty_attrs; 47 141 } FIX_ALIASING; 48 #define G (*(struct globals*) &bb_common_bufsiz1)49 #define INIT_G() do { } while (0)142 #define G (*(struct globals*)bb_common_bufsiz1) 143 #define INIT_G() do { setup_common_bufsiz(); } while (0) 50 144 51 145 … … 421 515 * If we get interrupted by SIGALRM, we need to restore attrs. 422 516 */ 423 if ( correct_password(pw))517 if (ask_and_check_password(pw) > 0) 424 518 break; 425 519 #endif /* ENABLE_PAM */ … … 455 549 if (safe_waitpid(child_pid, NULL, 0) == -1) 456 550 bb_perror_msg("waitpid"); 457 update_utmp (child_pid, DEAD_PROCESS, NULL, NULL, NULL);551 update_utmp_DEAD_PROCESS(child_pid); 458 552 } 459 553 IF_PAM(login_pam_end(pamh);) … … 490 584 #endif 491 585 492 motd(); 586 if (access(".hushlogin", F_OK) != 0) 587 motd(); 493 588 494 589 if (pw->pw_uid == 0) -
branches/3.3/mindi-busybox/loginutils/passwd.c
r3232 r3621 3 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 4 4 */ 5 //config:config PASSWD 6 //config: bool "passwd" 7 //config: default y 8 //config: select FEATURE_SYSLOG 9 //config: help 10 //config: passwd changes passwords for user and group accounts. A normal user 11 //config: may only change the password for his/her own account, the super user 12 //config: may change the password for any account. The administrator of a group 13 //config: may change the password for the group. 14 //config: 15 //config: Note that Busybox binary must be setuid root for this applet to 16 //config: work properly. 17 //config: 18 //config:config FEATURE_PASSWD_WEAK_CHECK 19 //config: bool "Check new passwords for weakness" 20 //config: default y 21 //config: depends on PASSWD 22 //config: help 23 //config: With this option passwd will refuse new passwords which are "weak". 24 25 //applet:/* Needs to be run by root or be suid root - needs to change /etc/{passwd,shadow}: */ 26 //applet:IF_PASSWD(APPLET(passwd, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) 27 28 //kbuild:lib-$(CONFIG_PASSWD) += passwd.o 5 29 6 30 //usage:#define passwd_trivial_usage … … 17 41 #include <syslog.h> 18 42 #include <sys/resource.h> /* setrlimit */ 19 20 static void nuke_str(char *str)21 {22 if (str) memset(str, 0, strlen(str));23 }24 43 25 44 static char* new_password(const struct passwd *pw, uid_t myuid, const char *algo) … … 212 231 if (rc < 0) 213 232 bb_error_msg_and_die("can't update password file %s", filename); 214 bb_ info_msg("Password for %s changed by %s", name, myname);233 bb_error_msg("password for %s changed by %s", name, myname); 215 234 216 235 /*if (ENABLE_FEATURE_CLEAN_UP) free(newp); - can't, it may be non-malloced */ -
branches/3.3/mindi-busybox/loginutils/su.c
r3232 r3621 5 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 */ 7 //config:config SU 8 //config: bool "su" 9 //config: default y 10 //config: select FEATURE_SYSLOG 11 //config: help 12 //config: su is used to become another user during a login session. 13 //config: Invoked without a username, su defaults to becoming the super user. 14 //config: 15 //config: Note that Busybox binary must be setuid root for this applet to 16 //config: work properly. 17 //config: 18 //config:config FEATURE_SU_SYSLOG 19 //config: bool "Enable su to write to syslog" 20 //config: default y 21 //config: depends on SU 22 //config: 23 //config:config FEATURE_SU_CHECKS_SHELLS 24 //config: bool "Enable su to check user's shell to be listed in /etc/shells" 25 //config: depends on SU 26 //config: default y 7 27 8 #include "libbb.h" 9 #include <syslog.h> 28 //applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */ 29 //applet:IF_SU(APPLET(su, BB_DIR_BIN, BB_SUID_REQUIRE)) 30 31 //kbuild:lib-$(CONFIG_SU) += su.o 10 32 11 33 //usage:#define su_trivial_usage … … 17 39 //usage: "\n -c CMD Command to pass to 'sh -c'" 18 40 //usage: "\n -s SH Shell to use instead of user's default" 41 42 #include "libbb.h" 43 #include <syslog.h> 19 44 20 45 #if ENABLE_FEATURE_SU_CHECKS_SHELLS … … 94 119 pw = xgetpwnam(opt_username); 95 120 96 if (cur_uid == 0 || correct_password(pw)) {121 if (cur_uid == 0 || ask_and_check_password(pw) > 0) { 97 122 if (ENABLE_FEATURE_SU_SYSLOG) 98 123 syslog(LOG_NOTICE, "%c %s %s:%s", … … 102 127 syslog(LOG_NOTICE, "%c %s %s:%s", 103 128 '-', tty, old_user, opt_username); 129 bb_do_delay(LOGIN_FAIL_DELAY); 104 130 bb_error_msg_and_die("incorrect password"); 105 131 } -
branches/3.3/mindi-busybox/loginutils/sulogin.c
r3232 r3621 5 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 6 */ 7 //config:config SULOGIN 8 //config: bool "sulogin" 9 //config: default y 10 //config: select FEATURE_SYSLOG 11 //config: help 12 //config: sulogin is invoked when the system goes into single user 13 //config: mode (this is done through an entry in inittab). 14 15 //applet:IF_SULOGIN(APPLET(sulogin, BB_DIR_SBIN, BB_SUID_DROP)) 16 17 //kbuild:lib-$(CONFIG_SULOGIN) += sulogin.o 7 18 8 19 //usage:#define sulogin_trivial_usage … … 15 26 #include <syslog.h> 16 27 17 //static void catchalarm(int UNUSED_PARAM junk)18 //{19 // exit(EXIT_FAILURE);20 //}21 22 23 28 int sulogin_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 24 29 int sulogin_main(int argc UNUSED_PARAM, char **argv) 25 30 { 26 char *cp;27 31 int timeout = 0; 28 32 struct passwd *pwd; 29 33 const char *shell; 30 #if ENABLE_FEATURE_SHADOWPASSWDS 31 /* Using _r function to avoid pulling in static buffers */ 32 char buffer[256]; 33 struct spwd spw; 34 #endif 34 35 /* Note: sulogin is not a suid app. It is meant to be run by init 36 * for single user / emergency mode. init starts it as root. 37 * Normal users (potentially malisious ones) can only run it under 38 * their UID, therefore no paranoia here is warranted: 39 * $LD_LIBRARY_PATH in env, TTY = /dev/sda 40 * are no more dangerous here than in e.g. cp applet. 41 */ 35 42 36 43 logmode = LOGMODE_BOTH; … … 49 56 } 50 57 51 /* Malicious use like "sulogin /dev/sda"? */ 52 if (!isatty(0) || !isatty(1) || !isatty(2)) { 53 logmode = LOGMODE_SYSLOG; 54 bb_error_msg_and_die("not a tty"); 58 pwd = getpwuid(0); 59 if (!pwd) { 60 bb_error_msg_and_die("no password entry for root"); 55 61 } 56 62 57 /* Clear dangerous stuff, set PATH */58 sanitize_env_if_suid();59 60 pwd = getpwuid(0);61 if (!pwd) {62 goto auth_error;63 }64 65 #if ENABLE_FEATURE_SHADOWPASSWDS66 {67 /* getspnam_r may return 0 yet set result to NULL.68 * At least glibc 2.4 does this. Be extra paranoid here. */69 struct spwd *result = NULL;70 int r = getspnam_r(pwd->pw_name, &spw, buffer, sizeof(buffer), &result);71 if (r || !result) {72 goto auth_error;73 }74 pwd->pw_passwd = result->sp_pwdp;75 }76 #endif77 78 63 while (1) { 79 char *encrypted;80 64 int r; 81 65 82 /* cp points to a static buffer that is zeroed every time */83 cp = bb_ask(STDIN_FILENO, timeout,84 "Give root password for system maintenance\n"85 "(or type Control-D for normal startup):");86 87 if (!cp || !*cp) {88 bb_ info_msg("Normal startup");66 r = ask_and_check_password_extended(pwd, timeout, 67 "Give root password for system maintenance\n" 68 "(or type Control-D for normal startup):" 69 ); 70 if (r < 0) { 71 /* ^D, ^C, timeout, or read error */ 72 bb_error_msg("normal startup"); 89 73 return 0; 90 74 } 91 encrypted = pw_encrypt(cp, pwd->pw_passwd, 1); 92 r = strcmp(encrypted, pwd->pw_passwd); 93 free(encrypted); 94 if (r == 0) { 75 if (r > 0) { 95 76 break; 96 77 } 97 78 bb_do_delay(LOGIN_FAIL_DELAY); 98 bb_ info_msg("Login incorrect");79 bb_error_msg("Login incorrect"); 99 80 } 100 memset(cp, 0, strlen(cp));101 // signal(SIGALRM, SIG_DFL);102 81 103 bb_ info_msg("System Maintenance Mode");82 bb_error_msg("starting shell for system maintenance"); 104 83 105 84 IF_SELINUX(renew_current_security_context()); … … 113 92 /* Exec login shell with no additional parameters. Never returns. */ 114 93 run_shell(shell, 1, NULL, NULL); 115 116 auth_error:117 bb_error_msg_and_die("no password entry for root");118 94 } -
branches/3.3/mindi-busybox/loginutils/vlock.c
r3232 r3621 14 14 */ 15 15 /* Fixed by Erik Andersen to do passwords the tinylogin way... 16 * It now works with md5, sha1, etc passwords. */ 16 * It now works with md5, sha1, etc passwords. 17 */ 18 //config:config VLOCK 19 //config: bool "vlock" 20 //config: default y 21 //config: help 22 //config: Build the "vlock" applet which allows you to lock (virtual) terminals. 23 //config: 24 //config: Note that Busybox binary must be setuid root for this applet to 25 //config: work properly. 26 27 //applet:/* Needs to be run by root or be suid root - needs to change uid and gid: */ 28 //applet:IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) 29 30 //kbuild:lib-$(CONFIG_VLOCK) += vlock.o 17 31 18 32 //usage:#define vlock_trivial_usage … … 105 119 pw->pw_name 106 120 ); 107 if ( correct_password(pw)) {121 if (ask_and_check_password(pw) > 0) { 108 122 break; 109 123 }
Note:
See TracChangeset
for help on using the changeset viewer.