1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00
samba-mirror/python
Tim Beale 7a410ccb5f netcmd: Fix passwordsettings --max-pwd-age command
The min_pwd_age and max_pwd_age parameters are both optional and default
to None. However, if we just set the max-pwd-age, then the check
'min_pwd_age >= max_pwd_age' will throw a Python exception because it's
trying to compare an int to NoneType (min_pwd_age). This works on Python 2
but is a problem on Python 3.

We could just add a check that min_pwd_age is not None, but that defeats
the point of having the check if you're only setting either the min or
max age indepedently.

This patch gets the current min/max password age from the DB (in ticks).
If either setting is changed, the ticks will be updated. Then at the end
we check the min is still less than the max (to do this, we convert the
ticks back to days in the interests of readability).

BUG: https://bugzilla.samba.org/show_bug.cgi?id=13873

Signed-off-by: Tim Beale <timbeale@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>

Autobuild-User(master): Andrew Bartlett <abartlet@samba.org>
Autobuild-Date(master): Fri Apr  5 08:03:08 UTC 2019 on sn-devel-144
2019-04-05 08:03:08 +00:00
..
examples PY3: change shebang to python3 in misc dirs 2018-12-14 18:00:40 +01:00
samba netcmd: Fix passwordsettings --max-pwd-age command 2019-04-05 08:03:08 +00:00
samba_external
modules.c python/modules: maintain correct refcount for path items 2019-01-29 13:45:32 +01:00
modules.h
py3compat.h python: Add new compat PYARG_STR_UNI format 2019-01-13 00:40:26 +01:00
pyglue.c python: use 'et' as format for ParseTuple with python2 2019-01-13 00:40:26 +01:00
wscript build: Remove bld.gen_python_environments() 2019-03-21 04:06:14 +00:00