diff --git a/CHANGES b/CHANGES index e763ef1..f8cffaf 100644 --- a/CHANGES +++ b/CHANGES @@ -6,6 +6,9 @@ Changes since 2.4.21: Lib/ * LDIFParser now also accepts value-spec without a space after the colon. +* Added key-word argument authz_id to LDAPObject methods + sasl_non_interactive_bind_s(), sasl_external_bind_s() and + sasl_gssapi_bind_s() Doc/ * Started missing docs for sub-module ldap.sasl. @@ -1207,4 +1210,4 @@ Released 2.0.0pre02 2002-02-01 ---------------------------------------------------------------- Released 1.10alpha3 2000-09-19 -$Id: CHANGES,v 1.359 2015/10/24 15:27:03 stroeder Exp $ +$Id: CHANGES,v 1.360 2015/10/24 15:42:41 stroeder Exp $ diff --git a/Lib/ldap/ldapobject.py b/Lib/ldap/ldapobject.py index c807973..39f0f75 100644 --- a/Lib/ldap/ldapobject.py +++ b/Lib/ldap/ldapobject.py @@ -3,7 +3,7 @@ See http://www.python-ldap.org/ for details. -\$Id: ldapobject.py,v 1.147 2015/08/08 13:37:41 stroeder Exp $ +\$Id: ldapobject.py,v 1.148 2015/10/24 15:42:41 stroeder Exp $ Compability: - Tested with Python 2.0+ but should work with Python 1.5.x @@ -243,23 +243,29 @@ def sasl_interactive_bind_s(self,who,auth,serverctrls=None,clientctrls=None,sasl """ return self._ldap_call(self._l.sasl_interactive_bind_s,who,auth,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls),sasl_flags) - def sasl_non_interactive_bind_s(self,sasl_mech,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET): + def sasl_non_interactive_bind_s(self,sasl_mech,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET,authz_id=''): """ Send a SASL bind request using a non-interactive SASL method (e.g. GSSAPI, EXTERNAL) """ - self.sasl_interactive_bind_s('',ldap.sasl.sasl({},sasl_mech)) + self.sasl_interactive_bind_s( + '', + ldap.sasl.sasl( + {ldap.sasl.CB_USER:authz_id}, + sasl_mech + ) + ) - def sasl_external_bind_s(self,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET): + def sasl_external_bind_s(self,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET,authz_id=''): """ Send SASL bind request using SASL mech EXTERNAL """ - self.sasl_non_interactive_bind_s('EXTERNAL',serverctrls,clientctrls,sasl_flags) + self.sasl_non_interactive_bind_s('EXTERNAL',serverctrls,clientctrls,sasl_flags,authz_id) - def sasl_gssapi_bind_s(self,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET): + def sasl_gssapi_bind_s(self,serverctrls=None,clientctrls=None,sasl_flags=ldap.SASL_QUIET,authz_id=''): """ Send SASL bind request using SASL mech GSSAPI """ - self.sasl_non_interactive_bind_s('GSSAPI',serverctrls,clientctrls,sasl_flags) + self.sasl_non_interactive_bind_s('GSSAPI',serverctrls,clientctrls,sasl_flags,authz_id) def sasl_bind_s(self,dn,mechanism,cred,serverctrls=None,clientctrls=None): """