From 63fce1034230f2f80056cfd911948e2b5602669b Mon Sep 17 00:00:00 2001 From: Christian Poessinger Date: Fri, 22 May 2020 17:25:54 +0200 Subject: login: T2492: must use try/except when adding user for the first time --- src/conf_mode/system-login.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'src') 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', -- cgit v1.2.3