diff options
author | Stefan Krah <skrah@bytereef.org> | 2016-04-25 23:09:18 (GMT) |
---|---|---|
committer | Stefan Krah <skrah@bytereef.org> | 2016-04-25 23:09:18 (GMT) |
commit | 267b639a2655d283282813219730704a8d2743b7 (patch) | |
tree | b6b35a76827f1f9d6aea1634ebaae2739d136724 /Modules | |
parent | 8e1da5823b4dabbc5e60f8ee27411070a37804ef (diff) | |
download | cpython-267b639a2655d283282813219730704a8d2743b7.zip cpython-267b639a2655d283282813219730704a8d2743b7.tar.gz cpython-267b639a2655d283282813219730704a8d2743b7.tar.bz2 |
Issue #20306: The pw_gecos and pw_passwd fields are not required by POSIX.
If they aren't present, set them to an empty string.
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/pwdmodule.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/pwdmodule.c b/Modules/pwdmodule.c index 281c30b..c503256 100644 --- a/Modules/pwdmodule.c +++ b/Modules/pwdmodule.c @@ -75,10 +75,18 @@ mkpwent(struct passwd *p) #define SETS(i,val) sets(v, i, val) SETS(setIndex++, p->pw_name); +#if defined(HAVE_STRUCT_PASSWD_PW_PASSWD) SETS(setIndex++, p->pw_passwd); +#else + SETS(setIndex++, ""); +#endif PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromUid(p->pw_uid)); PyStructSequence_SET_ITEM(v, setIndex++, _PyLong_FromGid(p->pw_gid)); +#if defined(HAVE_STRUCT_PASSWD_PW_GECOS) SETS(setIndex++, p->pw_gecos); +#else + SETS(setIndex++, ""); +#endif SETS(setIndex++, p->pw_dir); SETS(setIndex++, p->pw_shell); |