From 60e38ecc7ff6b983f4f3af0a66c08eb3a3fda22d Mon Sep 17 00:00:00 2001 From: Tomas Krizek Date: Thu, 6 Oct 2016 08:45:43 +0200 Subject: ipaldap: merge external_bind into LDAPClient * Rename do_external_bind to external_bind * Remove user_name argument in external_bind() and always set it to effective user name https://fedorahosted.org/freeipa/ticket/6461 Reviewed-By: Martin Basti Reviewed-By: Jan Cholasta --- ipapython/ipaldap.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) (limited to 'ipapython') diff --git a/ipapython/ipaldap.py b/ipapython/ipaldap.py index c4f8c7c2e..4016a657d 100644 --- a/ipapython/ipaldap.py +++ b/ipapython/ipaldap.py @@ -1084,11 +1084,11 @@ class LDAPClient(object): self.conn.simple_bind_s( bind_dn, bind_password, server_controls, client_controls) - def external_bind(self, user_name, server_controls=None, - client_controls=None): + def external_bind(self, server_controls=None, client_controls=None): """ Perform SASL bind operation using the SASL EXTERNAL mechanism. """ + user_name = pwd.getpwuid(os.geteuid()).pw_name with self.error_handler(): auth_tokens = ldap.sasl.external(user_name) self._flush_schema() @@ -1634,9 +1634,6 @@ class IPAdmin(LDAPClient): def do_sasl_gssapi_bind(self): self.gssapi_bind() - def do_external_bind(self, user_name=None): - self.external_bind(user_name) - def do_bind(self, dm_password="", autobind=AUTOBIND_AUTO): if dm_password: self.simple_bind(bind_dn=DIRMAN_DN, bind_password=dm_password) @@ -1644,8 +1641,7 @@ class IPAdmin(LDAPClient): if autobind != AUTOBIND_DISABLED and os.getegid() == 0 and self.ldapi: try: # autobind - pw_name = pwd.getpwuid(os.geteuid()).pw_name - self.do_external_bind(pw_name) + self.external_bind() return except errors.NotFound: if autobind == AUTOBIND_ENABLED: -- cgit