-
Notifications
You must be signed in to change notification settings - Fork 0
/
testADServers.cfc
46 lines (42 loc) · 1.42 KB
/
testADServers.cfc
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<cfcomponent>
<cffunction name="login" access="remote" returntype="any">
<cfset var adServerList=form.adServers/>
<cfset var username = "">
<!--- http://docs.lucee.org/reference/tags/ldap.html --->
<!--- attribues = list of values we would like returned for the user we are querying --->
<!--- the non secure port is 389 and does not require the secure, username and password attributes (anonymous connection to ldap server) --->
<cfif Len(form.unamePrefix)>
<cfset username = form.unamePrefix & form.uname>
<cfelse>
<cfset username = form.uname >
</cfif>
<cfloop list="#adServerList#" index="AD">
<cftry>
<cfldap
action="query"
name="results"
start="#form.start#"
scope="#form.scope#"
server="#AD#"
filter="(&(objectCategory=Person)(objectClass=user)(sAMAccountName=#form.uname#)(!(userAccountControl:1.2.840.113556.1.4.803:=2)))"
attributes="#form.attributes#"
port="#form.serverPort#"
username="#username#"
password="#form.upassword#"
timeout="500"
rebind="#form.bindCall#">
<cfcatch type="any">
<!---ADs Fail--->
<cfoutput>
<h3>#AD#: failed</h3>
<br></cfoutput>
</cfcatch>
</cftry>
<cfif isDefined('results.columnList') AND results.columnList neq "">
<cfoutput><h3>#AD#: success</h3>
<br></cfoutput>
</cfif>
</cfloop>
<cfreturn>
</cffunction>
</cfcomponent>