aboutsummaryrefslogtreecommitdiff
path: root/libpwdgrp/pwd_grp.c
Commit message (Collapse)AuthorAgeFilesLines
* libpwdgrp: reinstate Tito's optional atexit freeingGravatar Denys Vlasenko2015-01-031-0/+15
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: fix a memory leak in getXXnam (we did not save address of string buf)Gravatar Denys Vlasenko2015-01-031-57/+74
| | | | | | | | | | | | | | | | | | | | | | function old new delta convert_to_struct 261 269 +8 const_sp_db 20 24 +4 const_pw_db 20 24 +4 const_gr_db 20 24 +4 tokenize 144 147 +3 parse_common 185 188 +3 get_S 82 85 +3 bb_internal_getpwent_r 188 185 -3 gr_off 4 - -4 getXXnam 171 165 -6 pw_off 7 - -7 getgrouplist_internal 237 229 -8 getXXnam_r 215 207 -8 sp_off 9 - -9 ------------------------------------------------------------------------------ (add/remove: 0/3 grow/shrink: 7/4 up/down: 29/-45) Total: -16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: tweak comments, replace one xmalloc with xzallocGravatar Denys Vlasenko2015-01-031-23/+17
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: use FAST_FUNC to make "matching ABI" optimization more likely to ↵Gravatar Denys Vlasenko2015-01-021-16/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | succeed See bb_internal_get*nam_r size reduction: function old new delta bb_internal_getpwent_r 167 176 +9 getXXnam_r 204 206 +2 sulogin_main 326 325 -1 su_main 471 470 -1 read_line_input 3832 3831 -1 print_stat 865 864 -1 prepare_socket_fd 283 282 -1 load_crontab 777 776 -1 fork_job 456 455 -1 do_shm 884 883 -1 do_sem 637 636 -1 do_msg 783 782 -1 complete_username 124 123 -1 bb_internal_getgrouplist 71 70 -1 xgetpwuid 27 25 -2 xgetpwnam 27 25 -2 xgetgrnam 27 25 -2 xgetgrgid 27 25 -2 uid2uname 18 16 -2 login_main 980 978 -2 gid2group 18 16 -2 get_shell_name 54 52 -2 change_identity 50 48 -2 bb_internal_initgroups 50 48 -2 argstr 1261 1259 -2 print_perms 177 174 -3 inetd_main 2077 2074 -3 run_applet_no_and_exit 446 442 -4 fileaction_setowngrp 89 85 -4 deluser_main 312 308 -4 bb_internal_getpwuid 19 15 -4 bb_internal_getpwnam 11 7 -4 bb_internal_getgrnam 14 10 -4 bb_internal_getgrgid 19 15 -4 adduser_main 865 861 -4 passwd_main 989 984 -5 get_passwd 97 92 -5 data_extract_all 887 882 -5 check_user_passwd 490 485 -5 get_groups 81 75 -6 ftpd_main 2178 2171 -7 bb_internal_getspnam_r 42 18 -24 bb_internal_getpwnam_r 39 15 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/41 up/down: 11/-153) Total: -142 bytes text data bss dec hex filename 923167 928 17676 941771 e5ecb busybox_old 923023 928 17676 941627 e5e3b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: rewritten to use malloced implementationGravatar Tito Ragusa2015-01-021-880/+358
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This removed buffer size limitations. function old new delta convert_to_struct - 269 +269 getXXnam_r - 204 +204 parse_common - 185 +185 getXXnam - 164 +164 tokenize - 126 +126 bb_internal_getpwent_r 102 167 +65 get_S 30 88 +58 getgrouplist_internal 195 240 +45 const_sp_db - 20 +20 const_pw_db - 20 +20 const_gr_db - 20 +20 bb_internal_endpwent 27 36 +9 bb_internal_endgrent 27 36 +9 decode_one_format 726 734 +8 bb_internal_setpwent 17 24 +7 volume_id_probe_iso9660 319 322 +3 scriptreplay_main 204 207 +3 mkfs_minix_main 2684 2687 +3 id_main 478 480 +2 hash_find 233 235 +2 pstree_main 321 322 +1 gr_off 3 4 +1 expand_one_var 1579 1578 -1 pwf 4 - -4 grf 4 - -4 pack_gzip 1787 1780 -7 addattr32 67 56 -11 buffer_fill_and_print 191 178 -13 dpkg_main 2944 2927 -17 bb_internal_setgrent 17 - -17 bb_internal_getpwuid 38 19 -19 bb_internal_getgrgid 44 19 -25 bb_internal_getpwnam 38 11 -27 bb_internal_getgrnam 44 14 -30 bb_internal_fgetpwent_r 51 - -51 bb_internal_fgetgrent_r 51 - -51 bb_internal_getspnam_r 121 42 -79 bb_internal_getpwnam_r 121 39 -82 bb_internal_getgrent_r 102 - -102 bb__parsepwent 110 - -110 bb_internal_getpwuid_r 113 - -113 bb_internal_getgrgid_r 113 - -113 bb__parsespent 120 - -120 bb_internal_getgrnam_r 121 - -121 bb__pgsreader 213 - -213 bb__parsegrent 226 - -226 ------------------------------------------------------------------------------ (add/remove: 8/13 grow/shrink: 14/11 up/down: 1224/-1556) Total: -332 bytes text data bss dec hex filename 923471 928 17684 942083 e6003 busybox_old 923167 928 17676 941771 e5ecb busybox_unstripped Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* whitespace cleanup. no code changesGravatar Denys Vlasenko2013-01-141-7/+7
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp/pwd_grp.c: use same static buffer for all getpwXX functionsGravatar Denys Vlasenko2012-01-061-62/+38
| | | | | | | This should save more than 0.5k of malloced memory in applets which use those functions. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp/pwd_grp.c: set opened /etc/{passwd,group,shadow} fds CLOEXECGravatar Denys Vlasenko2012-01-061-0/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* move passwd, shadow, group and gshadow path definitions to libbb.hGravatar Tito Ragusa2011-01-161-10/+0
| | | | | | | ...and define them only if the used libc doesn't. Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: whitespace fixesGravatar Denys Vlasenko2010-10-281-3/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: make GNU licensing statement forms more regularGravatar Denys Vlasenko2010-08-161-6/+5
| | | | | | | 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>
* libpwdgrp: comment out unused dataGravatar Denys Vlasenko2010-04-021-3/+3
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: comment out more unused functionsGravatar Denys Vlasenko2010-03-311-8/+22
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: comment out functions with UNUSED_SINCE_WE_AVOID_STATIC_BUFSGravatar Denys Vlasenko2010-03-311-31/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: style cleanupsGravatar Denys Vlasenko2010-03-311-86/+91
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: code style fixes, no real code changesGravatar Denys Vlasenko2010-03-311-14/+14
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: can't depend on strlen(line_buff) != 0Gravatar Denys Vlasenko2010-03-311-40/+42
| | | | | | | function old new delta bb__pgsreader 188 202 +14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* *: optimize code size in strtoul callsGravatar Denys Vlasenko2009-09-231-9/+9
| | | | | | | | | | | | function old new delta bb_parse_mode 433 431 -2 rtnl_rtntype_a2n 202 198 -4 ParseField 511 498 -13 bb_init_module_24 4730 4675 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* Patches to enable FreeBSD buildGravatar Denys Vlasenko2009-07-051-1/+1
| | | | | | | | | platform.h: fix wrong check for endianness, fix lchown aliasing to chown on uclibc. Code seems to not be affected in my testing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* remove redundant NULL checkGravatar Denis Vlasenko2008-09-271-4/+0
|
* libpwdgrp: make it coexist with <pwd.h>, <grp.h> and <shadow.h>.Gravatar Denis Vlasenko2008-09-261-0/+2
| | | | | | allows to get rid of hacks in libbb.h (extra declaration of setgroups - now it comes from grp.h as intended).
* id: fix "id <user>" case. Requires getgrouplist().Gravatar Denis Vlasenko2008-09-181-23/+47
| | | | | | | | | | | | function old new delta getgrouplist_internal - 200 +200 id_main 462 539 +77 bb_internal_getgrouplist - 67 +67 bb__parsespent 119 117 -2 bb_internal_initgroups 213 58 -155 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 1/2 up/down: 344/-157) Total: 187 bytes
* libbb: [x]fopen_for_{read,write} introduced and used.Gravatar Denis Vlasenko2008-07-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (by Valdimir) function old new delta config_open2 - 41 +41 config_read 507 542 +35 find_pair 169 187 +18 fopen_for_write - 14 +14 fopen_for_read - 14 +14 find_main 406 418 +12 xfopen_for_write - 10 +10 xfopen_for_read - 10 +10 popstring 134 140 +6 parse_inittab 396 401 +5 next_token 923 928 +5 pack_gzip 1659 1661 +2 bb__parsespent 117 119 +2 fallbackSort 1719 1717 -2 evalvar 1376 1374 -2 qrealloc 36 33 -3 ... ... ... ... singlemount 4579 4569 -10 process_stdin 443 433 -10 patch_main 1111 1101 -10 ifupdown_main 2175 2165 -10 file_action_grep 90 80 -10 uuidcache_init 649 637 -12 hush_main 797 785 -12 read_config 230 217 -13 dpkg_main 3835 3820 -15 read_line_input 3134 3110 -24 sysctl_main 232 203 -29 config_open 40 10 -30 WARN_BAD_LINE 44 - -44 login_main 1714 1575 -139 ------------------------------------------------------------------------------ (add/remove: 5/1 grow/shrink: 8/74 up/down: 174/-737) Total: -563 bytes
* libbb: introduce and use xrealloc_vectorGravatar Denis Vlasenko2008-07-081-5/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta xrealloc_vector_helper - 51 +51 create_list 84 99 +15 getopt_main 690 695 +5 passwd_main 1049 1053 +4 get_cached 85 89 +4 msh_main 1377 1380 +3 add_match 42 41 -1 read_lines 720 718 -2 grave 1068 1066 -2 fill_match_lines 143 141 -2 add_to_dirlist 67 65 -2 add_input_file 49 47 -2 act 252 250 -2 fsck_main 2252 2246 -6 man_main 765 757 -8 bb_internal_initgroups 228 220 -8 cut_main 1052 1041 -11 add_edge_to_node 55 43 -12 dpkg_main 3851 3835 -16 ifupdown_main 2202 2178 -24 sort_main 838 812 -26 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 5/15 up/down: 82/-124) Total: -42 bytes
* inetd: use change_identity().Gravatar Denis Vlasenko2008-03-201-18/+9
| | | | | | | | | | | | | libbb: shrink our internal initgroups(). httpd: remove stray 'else' and 'index_page = "index.html"' function old new delta httpd_main 750 743 -7 inetd_main 2033 2011 -22 bb_internal_initgroups 251 228 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-52) Total: -52 bytes
* trylink: produce even more info about final link stageGravatar Denis Vlasenko2007-08-121-31/+33
| | | | | | | | | trylink: explain how to modify link and drastically decrease amount of padding (unfortunately, needs hand editing ATM). *: add ALIGN1 / ALIGN2 to global strings and arrays of bytes and shorts size saving: 0.5k
* style fix (stray space before ';')Gravatar Denis Vlasenko2007-07-211-2/+2
|
* libpwdgrp/pwd_grp.c: allocate local storage on first call, not in bss. -1k bssGravatar Denis Vlasenko2007-06-181-27/+96
| | | | | | | | | | | | | | function old new delta get_S - 31 +31 bb_internal_getpwnam 38 44 +6 bb_internal_getgrnam 38 44 +6 bb_internal_getgrgid 38 44 +6 ptr_to_statics - 4 +4 static.resultbuf 88 - -88 static.buffer 1024 - -1024 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 3/0 up/down: 53/-1112) Total: -1059 bytes
* style fixesGravatar Denis Vlasenko2007-04-131-2/+2
|
* Do not fail password check if shadow password does not exist -Gravatar Denis Vlasenko2007-03-131-4/+16
| | | | | | | | | | | | | | | | | | | | | | 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
* fixdep.c: avoit doing memcmp in most casesGravatar Denis Vlasenko2006-12-301-43/+42
| | | | | uidgid_get.c: add forgotten copyright notice pwd/grp/shadow: avoid collisions with libc names
* fix build without shadow supportGravatar Denis Vlasenko2006-12-281-75/+92
|
* build system overhaulGravatar Denis Vlasenko2006-10-051-125/+6
|
* Standardize on the vi editing directives being on the first line.Gravatar "Robert P. J. Day"2006-07-021-0/+1
|
* More removal of "#if 0" content.Gravatar "Robert P. J. Day"2006-07-011-13/+0
|
* I broke allbareconfig with half-finished cleanups I'd forgotten weren't done.Gravatar Rob Landley2006-06-201-3/+1
| | | | | Got both to a decent stopping point. (There's a lot more cleanup to do on ls.c but now is not the time...)
* skip_whitespace() shouldn't claim its return value is const, it doesn't knowGravatar Rob Landley2006-06-181-4/+4
| | | | that and callers wind up typecasting it back.
* - include proper headers.Gravatar Bernhard Reutner-Fischer2006-04-051-1/+2
|
* Typo fixes brought to you by the letters a, l, and Robert P. Day.Gravatar Rob Landley2006-03-031-3/+3
|
* just whitespaceGravatar Tim Riker2006-01-251-24/+24
|
* - move GETXXKEY_R_FUNC into an internal helper file to allow for compilingGravatar Bernhard Reutner-Fischer2005-10-281-46/+43
| | | | with IMA.
* Shaun Jackman pointed out that fgets_unlocked() and friends are gnu extensionsGravatar Rob Landley2005-10-081-17/+5
| | | | | not in newlib, and also that all the _unlocked variants are kind of pointless in this context.
* Replace the old and somewhat buggy pwd_grp stuff with the shinyGravatar Eric Andersen2004-07-151-0/+1116
new stuff mjn3 wrote for uClibc