diff options
author | Martin Babinsky <mbabinsk@redhat.com> | 2015-08-03 13:36:29 +0200 |
---|---|---|
committer | Jan Cholasta <jcholast@redhat.com> | 2015-08-04 13:57:33 +0200 |
commit | 8b3ed42d6b2bab57793b9921a672ed8994469109 (patch) | |
tree | 8901352623c4be0ee04ce6d9d6fd7d45e1ee5b31 /ipalib/plugins/baseuser.py | |
parent | d0db86f9b5ec33b9015163035ff84da20d859a2a (diff) | |
download | freeipa-8b3ed42d6b2bab57793b9921a672ed8994469109.tar.gz freeipa-8b3ed42d6b2bab57793b9921a672ed8994469109.tar.xz freeipa-8b3ed42d6b2bab57793b9921a672ed8994469109.zip |
store certificates issued for user entries as userCertificate;binary
This patch forces the user management CLI command to store certificates as
userCertificate;binary attribute. The code to retrieve of user information was
modified to enable outputting of userCertificate;binary attribute to the
command line.
The modification also fixes https://fedorahosted.org/freeipa/ticket/5173
Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipalib/plugins/baseuser.py')
-rw-r--r-- | ipalib/plugins/baseuser.py | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/ipalib/plugins/baseuser.py b/ipalib/plugins/baseuser.py index bd66cf5a3..5eede7a98 100644 --- a/ipalib/plugins/baseuser.py +++ b/ipalib/plugins/baseuser.py @@ -187,7 +187,7 @@ class baseuser(LDAPObject): 'telephonenumber', 'title', 'memberof', 'nsaccountlock', 'memberofindirect', 'ipauserauthtype', 'userclass', 'ipatokenradiusconfiglink', 'ipatokenradiususername', - 'krbprincipalexpiration', 'usercertificate', + 'krbprincipalexpiration', 'usercertificate;binary', ] search_display_attributes = [ 'uid', 'givenname', 'sn', 'homedirectory', 'loginshell', @@ -465,10 +465,27 @@ class baseuser(LDAPObject): assert isinstance(user, DN) return self._user_status(user, DN(self.delete_container_dn, api.env.basedn)) + def convert_usercertificate_pre(self, entry_attrs): + if 'usercertificate' in entry_attrs: + entry_attrs['usercertificate;binary'] = entry_attrs.pop( + 'usercertificate') + + def convert_usercertificate_post(self, entry_attrs, **options): + if 'usercertificate;binary' in entry_attrs: + entry_attrs['usercertificate'] = entry_attrs.pop( + 'usercertificate;binary') + class baseuser_add(LDAPCreate): """ Prototype command plugin to be implemented by real plugin """ + def pre_common_callback(self, ldap, dn, entry_attrs, **options): + assert isinstance(dn, DN) + self.obj.convert_usercertificate_pre(entry_attrs) + + def post_common_callback(self, ldap, dn, entry_attrs, **options): + assert isinstance(dn, DN) + self.obj.convert_usercertificate_post(entry_attrs, **options) class baseuser_del(LDAPDelete): """ @@ -542,6 +559,7 @@ class baseuser_mod(LDAPUpdate): self.check_userpassword(entry_attrs, **options) self.check_objectclass(ldap, dn, entry_attrs) + self.obj.convert_usercertificate_pre(entry_attrs) def post_common_callback(self, ldap, dn, entry_attrs, **options): assert isinstance(dn, DN) @@ -554,6 +572,7 @@ class baseuser_mod(LDAPUpdate): convert_nsaccountlock(entry_attrs) self.obj.convert_manager(entry_attrs, **options) self.obj.get_password_attributes(ldap, dn, entry_attrs) + self.obj.convert_usercertificate_post(entry_attrs, **options) convert_sshpubkey_post(ldap, dn, entry_attrs) radius_dn2pk(self.api, entry_attrs) @@ -584,6 +603,7 @@ class baseuser_find(LDAPSearch): for attrs in entries: self.obj.convert_manager(attrs, **options) self.obj.get_password_attributes(ldap, attrs.dn, attrs) + self.obj.convert_usercertificate_post(attrs, **options) if (lockout): attrs['nsaccountlock'] = True else: @@ -598,5 +618,6 @@ class baseuser_show(LDAPRetrieve): assert isinstance(dn, DN) self.obj.convert_manager(entry_attrs, **options) self.obj.get_password_attributes(ldap, dn, entry_attrs) + self.obj.convert_usercertificate_post(entry_attrs, **options) convert_sshpubkey_post(ldap, dn, entry_attrs) radius_dn2pk(self.api, entry_attrs) |