allow non-integer values in /etc/default/passwd to mirror solaris behavior
This commit is contained in:
parent
de8b6b55f7
commit
82f6f08712
1 changed files with 15 additions and 3 deletions
|
@ -1459,11 +1459,23 @@ class SunOS(User):
|
|||
fields[1] = self.password
|
||||
fields[2] = str(int(time.time() // 86400))
|
||||
if minweeks:
|
||||
try:
|
||||
fields[3] = str(int(minweeks) * 7)
|
||||
except ValueError:
|
||||
# mirror solaris, which allows for any value in this field, and ignores anything that is not an int.
|
||||
pass
|
||||
if maxweeks:
|
||||
try:
|
||||
fields[4] = str(int(maxweeks) * 7)
|
||||
except ValueError:
|
||||
# mirror solaris, which allows for any value in this field, and ignores anything that is not an int.
|
||||
pass
|
||||
if warnweeks:
|
||||
try:
|
||||
fields[5] = str(int(warnweeks) * 7)
|
||||
except ValueError:
|
||||
# mirror solaris, which allows for any value in this field, and ignores anything that is not an int.
|
||||
pass
|
||||
line = ':'.join(fields)
|
||||
lines.append('%s\n' % line)
|
||||
open(self.SHADOWFILE, 'w+').writelines(lines)
|
||||
|
|
Loading…
Reference in a new issue