我正在使用google api与我的活动目录2008进行通信。以下是tutorial1的示例代码。
from ad import Client, Creds, activate
domain = 'freeadi.org'
user = 'Administrator'
password = 'Pass123'
creds = Creds(domain)
creds.acquire(user, password)
activate(creds)
client = Client(domain)
users = client.search('(objectClass=user)')
for dn,attrs in users:
name = attrs['sAMAccountName'][0]
print '-> %s' % name
但是我收到以下错误。
ldap.LOCAL_ERROR: {'info': 'SASL(-1): generic failure: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server not found in Kerberos database)', 'desc': 'Local error'}
。这是http://code.google.com/p/python-ad/wiki/TutorialOne的示例代码。我已经根据我的需要更改了用户名和密码。
嗨,谢谢你的回复,但我仍然感到困惑。我用离心机加入我的广告。但是当我运行代码时,我的日志文件给了我一些古怪的日志,我真的不知道,因为我对这个话题很新。这是我的日志文件的输出:
Jun 28 19:22:02 sdahal1 sudo: pam_unix(sudo:session): session closed for user root
Jun 28 19:24:24 sdahal1 sshd13724?: Connection closed by 192.168.0.113 preauth?
Jun 28 19:24:54 sdahal1 adclient998?: INFO <fd:19 PAMVerifyPassword> audit User 'sadahal' authenticated based on Kerberos exchange to AD
Jun 28 19:24:54 sdahal1 adclient998?: INFO <fd:19 PAMIsUserAllowedAccess> audit User 'sadahal' is authorized
Jun 28 19:27:56 sdahal1 sudo: pam_unix(sudo:session): session closed for user root
Jun 28 19:28:04 sdahal1 python: GSSAPI Error: Unspecified GSS failure. Minor code may provide more information (Server not found in Kerberos database)
Jun 28 19:28:17 sdahal1 adclient998?: INFO <fd:19 PAMVerifyPassword> audit User 'sadahal' authenticated based on Kerberos exchange to AD
Jun 28 19:28:17 sdahal1 adclient998?: INFO <fd:23 PAMIsUserAllowedAccess> audit User 'sadahal' is authorized
Jun 28 19:28:17 sdahal1 sudo: