File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 8
8
def login_ldap (username , password ):
9
9
try :
10
10
# print("开始执行")
11
- Server = "ldap://127.0.0.1 :389"
11
+ Server = "ldap://8.8.8.8 :389"
12
12
baseDN = "dc=baidu,dc=com"
13
13
searchScope = ldap .SCOPE_SUBTREE
14
14
# 设置过滤属性,这里只显示cn=test的信息
@@ -64,6 +64,9 @@ def login_ldap(username, password):
64
64
ret ['mail' ] = Attrs ['mail' ][0 ]
65
65
ret ['username' ] = Attrs ['name' ][0 ]
66
66
ret ['nickname' ] = Attrs ['displayName' ][0 ]
67
+ ret ['sAMAccountName' ] = Attrs ['sAMAccountName' ][0 ]
68
+ ret ['memberOf' ] = Attrs ['memberOf' ][0 ]
69
+ ret ['distinguishedName' ] = Attrs ['distinguishedName' ][0 ]
67
70
ret ['code' ] = 200010
68
71
# print Attrs['memberOf'][0]
69
72
#print Attrs['sAMAccountName'][0]
@@ -84,4 +87,4 @@ def login_ldap(username, password):
84
87
username = "" # ldap中用户名
85
88
password = "" # ldap中密码
86
89
87
- print login_ldap (username , password )
90
+ print login_ldap (username , password )
You can’t perform that action at this time.
0 commit comments