Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit affcea6

Browse files
authored
Update ldap.py
1 parent 7e965f9 commit affcea6

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ldap.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
def login_ldap(username, password):
99
try:
1010
# print("开始执行")
11-
Server = "ldap://127.0.0.1:389"
11+
Server = "ldap://8.8.8.8:389"
1212
baseDN = "dc=baidu,dc=com"
1313
searchScope = ldap.SCOPE_SUBTREE
1414
# 设置过滤属性,这里只显示cn=test的信息
@@ -64,6 +64,9 @@ def login_ldap(username, password):
6464
ret['mail'] = Attrs['mail'][0]
6565
ret['username'] = Attrs['name'][0]
6666
ret['nickname'] = Attrs['displayName'][0]
67+
ret['sAMAccountName'] = Attrs['sAMAccountName'][0]
68+
ret['memberOf'] = Attrs['memberOf'][0]
69+
ret['distinguishedName'] = Attrs['distinguishedName'][0]
6770
ret['code'] = 200010
6871
# print Attrs['memberOf'][0]
6972
#print Attrs['sAMAccountName'][0]
@@ -84,4 +87,4 @@ def login_ldap(username, password):
8487
username = "" # ldap中用户名
8588
password = "" # ldap中密码
8689

87-
print login_ldap(username, password)
90+
print login_ldap(username, password)

0 commit comments

Comments
 (0)