aboutsummaryrefslogtreecommitdiff
path: root/libpwdgrp
Commit message (Collapse)AuthorAgeFilesLines
* libpwdgrp: do not require that /etc/passwd entries have nonempty home and shellGravatar Denys Vlasenko2015-10-121-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: fix thinko in getpwnamGravatar Tito Ragusa2015-02-191-9/+1
| | | | | | | | | | | | function old new delta parse_file - 64 +64 getXXnam_r 162 138 -24 getXXnam 90 50 -40 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 64/-64) Total: 0 bytes Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: use getpwent() instead of getpwent_r()Gravatar Denys Vlasenko2015-02-071-15/+43
| | | | | | | | | | | | | | | | | function old new delta massage_data_for_non_r_func - 90 +90 bb_internal_getpwent - 69 +69 getXXnam_r 94 162 +68 fill_bounds 131 128 -3 deluser_main 355 310 -45 complete_username 123 78 -45 getXXnam 163 90 -73 massage_data_for_r_func 103 - -103 bb_internal_getpwent_r 121 - -121 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 1/5 up/down: 227/-407) Total: -163 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: line counting in error meesages is broken, remove itGravatar Tito Ragusa2015-01-061-3/+1
| | | | | Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: fixes suggested by Tito, comment tweaksGravatar Denys Vlasenko2015-01-051-13/+14
| | | | | | | | function old new delta bb_internal_getpwent_r 100 121 +21 parse_common 202 203 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: another code shrinkGravatar Denys Vlasenko2015-01-041-38/+31
| | | | | | | | | | | function old new delta massage_data_for_r_func - 110 +110 bb_internal_getpwent_r 173 100 -73 getXXnam_r 176 95 -81 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/2 up/down: 110/-154) Total: -44 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: code shrinkGravatar Denys Vlasenko2015-01-041-25/+16
| | | | | | | | | | | | | function old new delta parse_common 206 205 -1 getgrouplist_internal 229 225 -4 bb_internal_getpwent_r 182 173 -9 getXXnam 232 222 -10 getXXnam_r 216 176 -40 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/5 up/down: 0/-64) Total: -64 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: getgrXXX: empty string is not a member name, do not store itGravatar Denys Vlasenko2015-01-031-1/+4
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* fix a SEGV in previous commitGravatar Denys Vlasenko2015-01-031-1/+1
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: fix counting of commas in group listGravatar Denys Vlasenko2015-01-031-16/+18
| | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: store getXXnam result in a single malloc blockGravatar Denys Vlasenko2015-01-031-26/+32
| | | | | | | | | | | | | | | | | | This saves a bit of memory but more importantly, allows to create xmalloc_getpwnam() API where result can be deleted simply using free(). function old new delta getXXnam 134 173 +39 parse_common 188 212 +24 convert_to_struct 277 290 +13 get_S 90 88 -2 tokenize 129 126 -3 bb_internal_getpwent_r 175 172 -3 getXXnam_r 208 198 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/4 up/down: 76/-18) Total: 58 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: make db->def[] one byte shorterGravatar Denys Vlasenko2015-01-031-6/+11
| | | | | | | In the future I will need another uint8_t, want to fit it w/o using another word on 32 bits. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* libpwdgrp: use a better estimate of max struct sizeGravatar Denys Vlasenko2015-01-031-5/+4
| | | | | | | | | | | Previous code's trick with bitwise OR was giving this on 32-bit x86: sizeof(struct passwd):28 sizeof(struct group):16 sizeof(struct spwd):36 sizeof(struct_result):60 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* 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-022-941/+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>
* simplify parsing of /etc/busybox.confGravatar Denys Vlasenko2011-05-161-1/+2
| | | | | | | function old new delta parse_config_file 799 667 -132 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 cleanupGravatar Denys Vlasenko2010-10-291-2/+2
| | | | Signed-off-by: Denys Vlasenko <dvlasenk@redhat.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-163-13/+11
| | | | | | | 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>
* mass renaming Kbuild -> Kbuild.src, Config.in -> Config.srcGravatar Denys Vlasenko2010-06-041-0/+0
| | | | 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
* watchdog: add -T optionGravatar Denis Vlasenko2008-09-071-4/+1
| | | | | | | | function old new delta watchdog_main 159 219 +60 mdev: support match by major,minor. See bug 4714. +100 bytes.
* libbb: [x]fopen_for_{read,write} introduced and used.Gravatar Denis Vlasenko2008-07-212-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (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
* whitespace fixes, no code changedGravatar Denis Vlasenko2008-07-211-2/+2
|
* - first pass to unify/cleanup uid handling (-236b)Gravatar Bernhard Reutner-Fischer2008-07-211-2/+6
| | | | This needs further love, alot of love.. Tito?
* 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
* *: introduce and use FAST_FUNC: regparm on i386, otherwise no-onGravatar Denis Vlasenko2008-06-271-2/+2
| | | | | | | text data bss dec hex filename 808035 611 6868 815514 c719a busybox_old 804472 611 6868 811951 c63af busybox_unstripped
* 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
* usage.c: remove reference to busybox.hGravatar Denis Vlasenko2007-05-261-1/+1
| | | | | *: s/include "busybox.h"/include "libbb.h"
* we were basically ignoring CONFIG_USE_BB_PWD_GRP (assuming =y),Gravatar Denis Vlasenko2007-05-181-1/+3
| | | | fix this