我在 RHEL 上尝试了下面的代码行,效果非常好。在 Linux 上,我只需要获得 Kerberos 票。
mport ldap
import ldap.sasl
conn=ldap.initialize('ldap://auto.test-auto.com',trace_level=2)
conn.set_option(ldap.OPT_PROTOCOL_VERSION, ldap.VERSION3)
conn.set_option(ldap.OPT_REFERRALS,0)
sasl = ldap.sasl.gssapi()
conn.sasl_interactive_bind_s('', sasl)
然后我将同样的东西复制到安装了 ActivePython-2.7","python-ldap-2.4.10","openssl-0.9.8o","setup-sasl-1.5.27" 的 Windows 2k3 服务器中。
Traceback (most recent call last):
File "C:\susanta\test-sasl.py", line 10, in <module>
conn.sasl_interactive_bind_s('', sasl)
File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 229, in sasl_interactive_bind_s
return self._ldap_call(self._l.sasl_interactive_bind_s,who,auth,RequestControlTuples(serverctrls),RequestControlTuples(clientctrls),sasl_flags)
File "C:\Python27\lib\site-packages\ldap\ldapobject.py", line 99, in _ldap_call
result = func(*args,**kwargs)
LOCAL_ERROR: {'desc': 'Local error'}
有人可以帮我吗?