diff options
author | Christian Poessinger <christian@poessinger.com> | 2020-05-22 17:25:54 +0200 |
---|---|---|
committer | Christian Poessinger <christian@poessinger.com> | 2020-05-22 17:25:54 +0200 |
commit | 63fce1034230f2f80056cfd911948e2b5602669b (patch) | |
tree | a634d33efc5a8bf64ce1b157f4b873264b3a20ce /src/conf_mode/system-login.py | |
parent | 5e74e68bcf2458309e1d9a153ee28b1359ba923c (diff) | |
download | vyos-1x-63fce1034230f2f80056cfd911948e2b5602669b.tar.gz vyos-1x-63fce1034230f2f80056cfd911948e2b5602669b.zip |
login: T2492: must use try/except when adding user for the first time
Diffstat (limited to 'src/conf_mode/system-login.py')
-rwxr-xr-x | src/conf_mode/system-login.py | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/src/conf_mode/system-login.py b/src/conf_mode/system-login.py index 87c26ee31..536c5f70e 100755 --- a/src/conf_mode/system-login.py +++ b/src/conf_mode/system-login.py @@ -230,14 +230,18 @@ def generate(login): "authentication encrypted-password '{password_encrypted}'" .format(**user), env=env) - elif getspnam(user['name']).sp_pwdp == user['password_encrypted']: - # If the current encrypted bassword matches the encrypted password - # from the config - do not update it. This will remove the encrypted - # value from the system logs. - # - # The encrypted password will be set only once during the first boot - # after an image upgrade. - user['password_encrypted'] = '' + else: + try: + if getspnam(user['name']).sp_pwdp == user['password_encrypted']: + # If the current encrypted bassword matches the encrypted password + # from the config - do not update it. This will remove the encrypted + # value from the system logs. + # + # The encrypted password will be set only once during the first boot + # after an image upgrade. + user['password_encrypted'] = '' + except: + pass if len(login['radius_server']) > 0: render(radius_config_file, 'system-login/pam_radius_auth.conf.tmpl', |