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:
|
||||
fields[3] = str(int(minweeks) * 7)
|
||||
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:
|
||||
fields[4] = str(int(maxweeks) * 7)
|
||||
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:
|
||||
fields[5] = str(int(warnweeks) * 7)
|
||||
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