authselect: harden uninstallation of ipa client

When ipa client is uninstalled, the content of sysrestore.state
is read to restore the previous authselect profile and features.
The code should properly handle the case where sysrestore.state
contains the header for the authselect section, but the key=value
for profile and features are missing.

Fixes https://pagure.io/freeipa/issue/7657

Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
Florence Blanc-Renaud 2018-09-14 18:08:26 +02:00
parent 7729bb73b4
commit d0173c9548

View File

@ -162,8 +162,10 @@ class RedHatAuthSelect(RedHatAuthToolBase):
profile = 'sssd'
features = ''
else:
profile = statestore.restore_state('authselect', 'profile')
features = statestore.restore_state('authselect', 'features_list')
profile = \
statestore.restore_state('authselect', 'profile') or 'sssd'
features = \
statestore.restore_state('authselect', 'features_list') or ''
statestore.delete_state('authselect', 'mkhomedir')
cmd = [paths.AUTHSELECT, "select", profile, features, "--force"]