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 <[email protected]>
<http://bugs.python.org/issue17676>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com