aboutsummaryrefslogtreecommitdiff
path: root/loginutils/passwd.c
AgeCommit message (Collapse)Author
2020-12-13help text tweaksDenys Vlasenko
function old new delta packed_usage 33547 33545 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2020-11-29libbb: bb_do_delay(3) -> pause_after_failed_login(), and stop looping thereDenys Vlasenko
function old new delta pause_after_failed_login - 9 +9 vlock_main 358 353 -5 sulogin_main 252 247 -5 su_main 484 479 -5 passwd_main 936 931 -5 login_main 967 962 -5 bb_do_delay 68 - -68 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/5 up/down: 9/-93) Total: -84 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-04-30Optionally re-introduce bb_info_msg()James Byrne
Between Busybox 1.24.2 and 1.25.0 the bb_info_msg() function was eliminated and calls to it changed to be bb_error_msg(). The downside of this is that daemons now log all messages to syslog at the LOG_ERR level which makes it hard to filter errors from informational messages. This change optionally re-introduces bb_info_msg(), controlled by a new option FEATURE_SYSLOG_INFO, restores all the calls to bb_info_msg() that were removed (only in applets that set logmode to LOGMODE_SYSLOG or LOGMODE_BOTH), and also changes informational messages in ifplugd and ntpd. The code size change of this is as follows (using 'defconfig' on x86_64 with gcc 7.3.0-27ubuntu1~18.04) function old new delta bb_info_msg - 182 +182 bb_vinfo_msg - 27 +27 static.log7 194 198 +4 log8 190 191 +1 log5 190 191 +1 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 3/0 up/down: 215/-45) Total: 170 bytes If you don't care about everything being logged at LOG_ERR level then when FEATURE_SYSLOG_INFO is disabled Busybox actually gets smaller: function old new delta static.log7 194 200 +6 log8 190 193 +3 log5 190 193 +3 syslog_level 1 - -1 bb_verror_msg 583 581 -2 crondlog 45 - -45 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 3/1 up/down: 12/-48) Total: -36 bytes Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2019-01-08passwd: initialize pointers correctlyEinar Jón
Fix for running passwd as root (or sudo passwd $USER). Crashed on call to free(orig) during cleanup. Fix regression from commit 17058a06c4333fc0c492c168c8a971ebd0fd5a5a Root user never changes the orig pointer, so when cleaning up, passwd tried to free orig=(char*)"" Example: sudo passwd $USER Changing password for xxx New password: Bad password: too short Retype password: Passwords don't match free(): invalid pointer Aborted function old new delta passwd_main 958 961 +3 Signed-off-by: Einar Jón <tolvupostur@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-08libbb.h: always include sys/resource.hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-07libbb: switch bb_ask_noecho() to "mallocing" string return APIDenys Vlasenko
function old new delta bb_ask_noecho 313 330 +17 get_cred_or_die 125 115 -10 passwd_main 995 958 -37 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/2 up/down: 17/-47) Total: -30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-07libbb: rename bb_ask -> bb_ask_noecho, bb_ask_confirmation -> ↵Denys Vlasenko
bb_ask_y_confirmation Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-27config: trim/improve item names and help texts, take 2Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21config: deindent all help textsDenys Vlasenko
Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18Update menuconfig items with approximate applet sizesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-01-20password utils: improve --help, make DEFAULT_PASSWD_ALGO visible if CHPASSWDDenys Vlasenko
Was: $ cryptpw --help ... Print crypt(3) hashed PASSWORD -P,--password-fd=N Read password from fd N -m,--method=TYPE Encryption method -S,--salt=SALT User: "What methods exist? which one os default?" Now: Print crypt(3) hashed PASSWORD -P,--password-fd N Read password from fd N -m,--method TYPE des,md5,sha256/512 (default des) -S,--salt SALT Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30Replace a few more bb_info_msg's by bb_error_msg or printfDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-19loginutils/*: convert to new-style "one file" appletsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-19libbb: move nuke_str() from passwd into libbbDenys Vlasenko
function old new delta nuke_str - 15 +15 ask_and_check_password_extended 215 206 -9 init_main 781 771 -10 nuke_str 27 - -27 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/2 up/down: 15/-46) Total: -31 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-05include sys/resource.h where neededMike Frysinger
We use functions from sys/resource.h in misc applets, but don't include the header. This breaks building with newer glibc versions, so add the include where needed. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
2012-01-08passwd,cryptpw: make default encryption algorithm configurableDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05*: remove "Options:" string from help textsDenys Vlasenko
function old new delta packed_usage 28706 28623 -83 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13passwd: shorter help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-13adduser: safe username passing to passwd/addgroupDenys Vlasenko
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>
2011-04-05passwd,chpasswd: reset password in /etc/passwd to "x" if /etc/shadow was updatedTito Ragusa
Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-03move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c ↵Pere Orga
editors/*.c loginutils/*.c mailutils/*.c Signed-off-by: Pere Orga <gotrunks@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-08s/FAIL_DELAY/LOGIN_FAIL_DELAY/Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16*: make GNU licensing statement forms more regularDenys Vlasenko
This change retains "or later" state! No licensing _changes_ here, only form is adjusted (article, space between "GPL" and "v2" and so on). Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-09passwd: do not complain about /etc/shadow needlesslyDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13*: use "can't" instead of "cannot"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02passwd: do not complain if /etc/shadow is missingDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-04-14*: unify concurrent-safe update of /etc/{passwd,group,[g]shadow}Denis Vlasenko
by Tito (farmatito AT tiscali.it) function old new delta update_passwd 743 1171 +428 bb_perror_nomsg - 9 +9 find_main 436 444 +8 passwd_main 1023 1027 +4 nameval 202 206 +4 chpasswd_main 315 319 +4 bb__parsespent 119 117 -2 adduser_main 654 650 -4 addgroup_main 345 341 -4 sv_main 1228 1222 -6 deluser_main 173 160 -13 bb_internal_putpwent 69 - -69 add_user_to_group 231 - -231 del_line_matching 460 31 -429 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 5/6 up/down: 457/-758) Total: -301 bytes
2009-03-11*: remove LOG_NOWAITDenis Vlasenko
2008-12-03libbb: introduce and use xgetpwnam. ~ -150 bytes.Denis Vlasenko
2008-12-03- add new applet mkpasswd(1)Bernhard Reutner-Fischer
function old new delta bb_ask - 355 +355 mkpasswd_main - 296 +296 .rodata 121746 121847 +101 packed_usage 24632 24689 +57 static.methods - 21 +21 gmatch 229 248 +19 bb_ask_stdin - 11 +11 applet_names 1949 1958 +9 applet_main 1172 1176 +4 sulogin_main 503 505 +2 applet_nameofs 586 588 +2 sha256_hash 329 327 -2 correct_password 208 206 -2 parse_command 1442 1439 -3 get_cred_or_die 145 141 -4 passwd_main 1054 1044 -10 bb_askpass 348 - -348 ------------------------------------------------------------------------------ (add/remove: 4/1 grow/shrink: 7/5 up/down: 877/-369) Total: 508 bytes
2008-12-02libbb: password/group function helpers rewritten by Tito:Denis Vlasenko
function old new delta xgetpwuid - 27 +27 uid2uname_utoa - 22 +22 gid2group_utoa - 22 +22 uid2uname - 18 +18 gid2group - 18 +18 buffer_fill_and_print 179 196 +17 print_user 12 24 +12 print_group 12 24 +12 get_cached 89 99 +10 ... print_common 134 120 -14 vlock_main 415 396 -19 logger_main 410 387 -23 crontab_main 642 609 -33 bb_getpwuid 42 - -42 bb_getgrgid 42 - -42 bb_getug 80 - -80 ------------------------------------------------------------------------------ (add/remove: 6/3 grow/shrink: 9/11 up/down: 187/-296) Total: -109 bytes
2008-07-21- first pass to unify/cleanup uid handling (-236b)Bernhard Reutner-Fischer
This needs further love, alot of love.. Tito?
2008-07-05*: rename ATTRIBUTE_XXX to just XXX.Denis Vlasenko
2008-06-12make pw_encrypt() return malloc'ed string.Denis Vlasenko
text data bss dec hex filename 759802 604 6684 767090 bb472 busybox_old 759804 604 6676 767084 bb46c busybox_unstripped
2008-06-12uclibc insists on having 70k static buffer for crypt.Denis Vlasenko
For bbox it's not acceptable. Roll our own des and md5 crypt implementation. Against older uclibc: text data bss dec hex filename 759945 604 6684 767233 bb501 busybox_old 759766 604 6684 767054 bb44e busybox_unstripped so, we still save on code size.
2008-03-17*: add -Wunused-parameter; fix resulting breakageDenis Vlasenko
function old new delta procps_scan 1265 1298 +33 aliascmd 278 283 +5 parse_file_cmd 116 120 +4 dname_enc 373 377 +4 setcmd 90 93 +3 execcmd 57 60 +3 count_lines 72 74 +2 process_command_subs 340 339 -1 test_main 409 407 -2 mknod_main 179 177 -2 handle_incoming_and_exit 2653 2651 -2 argstr 1312 1310 -2 shiftcmd 131 128 -3 exitcmd 46 43 -3 dotcmd 297 294 -3 breakcmd 86 83 -3 evalpipe 353 349 -4 evalcommand 1180 1176 -4 evalcmd 109 105 -4 send_tree 374 369 -5 mkfifo_main 82 77 -5 evalsubshell 152 147 -5 typecmd 75 69 -6 letcmd 61 55 -6 add_cmd 1190 1183 -7 main 891 883 -8 ash_main 1415 1407 -8 parse_stream 1377 1367 -10 alloc_procps_scan 55 - -55 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 7/21 up/down: 54/-148) Total: -94 bytes text data bss dec hex filename 797195 658 7428 805281 c49a1 busybox_old 797101 658 7428 805187 c4943 busybox_unstripped
2008-02-16libbb: introduce bb_signals and bb_signals_recursive,Denis Vlasenko
which sets same handler for many signals. sig_catch is nuked (bb_signals_recursive is more descriptive name). *: use them as appropriate. function old new delta bb_signals_recursive - 95 +95 bb_signals - 52 +52 run_command 258 273 +15 svlogd_main 1368 1377 +9 runsv_main 1746 1752 +6 runsvdir_main 1643 1646 +3 UNSPEC_print 64 66 +2 time_main 1128 1127 -1 ... resize_main 246 210 -36 sig_catch 63 - -63 set_fatal_sighandler 85 14 -71 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 5/24 up/down: 182/-548) Total: -366 bytes
2008-01-27- fix conflicting decls of syslog related facilitynames and prioritynames tablesBernhard Reutner-Fischer
2007-10-29appletlib.c: make it actally follow _BB_SUID_ALWAYS rulesDenis Vlasenko
adduser: implement -S and code shrink / fix uid selection *: sanitize getspnam_r use text data bss dec hex filename 777042 974 9676 787692 c04ec busybox_old 776883 974 9676 787533 c044d busybox_unstripped
2007-10-11add -fvisibility=hidden to CC flags, mark XXX_main functionsDenis Vlasenko
EXTERNALLY_VISIBLE. 5% size reduction of libbusybox.so
2007-08-18don't pass argc in getopt32, it's superfluousDenis Vlasenko
(add/remove: 0/0 grow/shrink: 12/131 up/down: 91/-727) Total: -636 bytes text data bss dec hex filename 773469 1058 11092 785619 bfcd3 busybox_old 772644 1058 11092 784794 bf99a busybox_unstripped
2007-07-27passwd: fix bug: we are trying to update shadow even if user's record is in ↵Denis Vlasenko
passwd! getspnam is guilty, it lies that user record exists in shadow.
2007-07-27bb_getpwuid, bb_getgrgid: change order of arguments to more intuitive one;Denis Vlasenko
comment thoroughly when they die and when they dont.
2007-07-20chpasswd: new applet by Alexander Shishkin <virtuoso@slind.org>Denis Vlasenko
2007-05-26usage.c: remove reference to busybox.hDenis Vlasenko
*: s/include "busybox.h"/include "libbb.h"
2007-05-08cryptpw: new applet (a bit less than 3k added)Denis Vlasenko
(by Thomas Lundquist <lists@zelow.no>)
2007-03-13Do not fail password check if shadow password does not exist -Denis Vlasenko
fall back to ordinary one Reduced usage of functions returning datain static buffers. (mostly passwd/group/shadow related): function old new delta correct_password 143 193 +50 sulogin_main 490 533 +43 adduser_main 732 774 +42 passwd_main 1875 1915 +40 addgroup_main 330 365 +35 bb_internal_getspnam 38 - -38 bb_internal_fgetpwent 38 - -38 bb_internal_fgetgrent 38 - -38 static.resultbuf 168 88 -80 static.buffer 1872 1104 -768 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 5/2 up/down: 210/-962) Total: -752 bytes
2007-02-03suppress warnings about easch <applet>_main() havingDenis Vlasenko
no preceding prototype
2007-01-29preparatory patch for -Wwrite-strings #3Denis Vlasenko
2006-12-30fix for uclibc-without-shadow.h compilationDenis Vlasenko