[issue17676] spwd uses -1 for empty attributes

Alex Waite report at bugs.python.org
Tue Apr 9 15:28:48 CEST 2013


New submission from Alex Waite:

spwd uses -1 rather than '' for empty attributes. This is different from the behaviour in the pwd module, and makes it more difficult to generate a new, valid shadow entry.

In my opinion, simply doing a ':'.join(str(val) for val in rec) should result in a valid entry. With pwd this is currently possible. Not so with spwd.

pwd:
import pwd
rec = pwd.getpwnam('alex')
print ':'.join(str(val) for val in rec)

spwd:
import spwd
rec = spwd.getspnam('alex')
shdw = ''
for idx, val in enumerate(recs_shdw):
    if idx != 0:
        shdw += ':'

    if val != -1:
        shdw += str(val)

print shdw

----------
messages: 186402
nosy: Alexqw
priority: normal
severity: normal
status: open
title: spwd uses -1 for empty attributes
type: behavior
versions: Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17676>
_______________________________________


More information about the Python-bugs-list mailing list