summaryrefslogtreecommitdiffstats
path: root/ipapython/ipaldap.py
diff options
context:
space:
mode:
authorTomas Krizek <tkrizek@redhat.com>2016-10-06 08:45:43 +0200
committerMartin Basti <mbasti@redhat.com>2016-11-07 11:34:03 +0100
commit60e38ecc7ff6b983f4f3af0a66c08eb3a3fda22d (patch)
tree98b938d57645632d7bd0a66c1a2e31fc11d29c25 /ipapython/ipaldap.py
parentde58a5c60596de8b45c8016c3318bac78305477a (diff)
downloadfreeipa-60e38ecc7ff6b983f4f3af0a66c08eb3a3fda22d.tar.gz
freeipa-60e38ecc7ff6b983f4f3af0a66c08eb3a3fda22d.tar.xz
freeipa-60e38ecc7ff6b983f4f3af0a66c08eb3a3fda22d.zip
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 <mbasti@redhat.com> Reviewed-By: Jan Cholasta <jcholast@redhat.com>
Diffstat (limited to 'ipapython/ipaldap.py')
-rw-r--r--ipapython/ipaldap.py10
1 files changed, 3 insertions, 7 deletions
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: