aboutsummaryrefslogtreecommitdiff
path: root/libpwdgrp
diff options
context:
space:
mode:
Diffstat (limited to 'libpwdgrp')
-rw-r--r--libpwdgrp/pwd_grp.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/libpwdgrp/pwd_grp.c b/libpwdgrp/pwd_grp.c
index 3886facf0..cefbc8a7e 100644
--- a/libpwdgrp/pwd_grp.c
+++ b/libpwdgrp/pwd_grp.c
@@ -16,11 +16,10 @@
16 * a) must contain the expected number of fields (as per count of field 16 * a) must contain the expected number of fields (as per count of field
17 * delimeters ":") or we will complain with a error message. 17 * delimeters ":") or we will complain with a error message.
18 * b) leading and trailing whitespace in fields is stripped. 18 * b) leading and trailing whitespace in fields is stripped.
19 * c) some fields are not allowed to be empty (e.g. username, uid/gid, 19 * c) some fields are not allowed to be empty (e.g. username, uid/gid),
20 * homedir, shell) and in this case NULL is returned and errno is 20 * and in this case NULL is returned and errno is set to EINVAL.
21 * set to EINVAL. This behaviour could be easily changed by 21 * This behaviour could be easily changed by modifying PW_DEF, GR_DEF,
22 * modifying PW_DEF, GR_DEF, SP_DEF strings (uppercase 22 * SP_DEF strings (uppercase makes a field mandatory).
23 * makes a field mandatory).
24 * d) the string representing uid/gid must be convertible by strtoXX 23 * d) the string representing uid/gid must be convertible by strtoXX
25 * functions, or errno is set to EINVAL. 24 * functions, or errno is set to EINVAL.
26 * e) leading and trailing whitespace in group member names is stripped. 25 * e) leading and trailing whitespace in group member names is stripped.
@@ -58,7 +57,7 @@ struct passdb {
58 * I = uid,gid, l = long maybe empty, m = members, 57 * I = uid,gid, l = long maybe empty, m = members,
59 * r = reserved 58 * r = reserved
60 */ 59 */
61#define PW_DEF "SsIIsSS" 60#define PW_DEF "SsIIsss"
62#define GR_DEF "SsIm" 61#define GR_DEF "SsIm"
63#define SP_DEF "Ssllllllr" 62#define SP_DEF "Ssllllllr"
64 63
@@ -70,8 +69,8 @@ static const struct const_passdb const_pw_db = {
70 offsetof(struct passwd, pw_uid), /* 2 I */ 69 offsetof(struct passwd, pw_uid), /* 2 I */
71 offsetof(struct passwd, pw_gid), /* 3 I */ 70 offsetof(struct passwd, pw_gid), /* 3 I */
72 offsetof(struct passwd, pw_gecos), /* 4 s */ 71 offsetof(struct passwd, pw_gecos), /* 4 s */
73 offsetof(struct passwd, pw_dir), /* 5 S */ 72 offsetof(struct passwd, pw_dir), /* 5 s */
74 offsetof(struct passwd, pw_shell) /* 6 S */ 73 offsetof(struct passwd, pw_shell) /* 6 s */
75 }, 74 },
76 sizeof(PW_DEF)-1, sizeof(struct passwd) 75 sizeof(PW_DEF)-1, sizeof(struct passwd)
77}; 76};
@@ -122,7 +121,7 @@ static struct statics *ptr_to_statics;
122#if ENABLE_FEATURE_CLEAN_UP 121#if ENABLE_FEATURE_CLEAN_UP
123static void free_static(void) 122static void free_static(void)
124{ 123{
125 free(S.db[0].malloced); 124 free(S.db[0].malloced);
126 free(S.db[1].malloced); 125 free(S.db[1].malloced);
127# if ENABLE_USE_BB_SHADOW 126# if ENABLE_USE_BB_SHADOW
128 free(S.db[2].malloced); 127 free(S.db[2].malloced);