Active Directory/Search for a user: Difference between revisions
Content added Content deleted
m (move UNIX Shell to correct position) |
(Add REXX implementation) |
||
Line 380: | Line 380: | ||
l.unbind() |
l.unbind() |
||
</lang> |
</lang> |
||
=={{header|REXX}}== |
|||
{{Works with|ooRexx}} |
|||
{{Works with|Regina}} |
|||
A little contrived; this [[REXX]] program drives the <tt>ldapsearch</tt> command. |
|||
<lang REXX>/* Rexx */ |
|||
do |
|||
LDAP_URL = 'ldap://localhost:11389' |
|||
LDAP_DN_STR = 'uid=admin,ou=system' |
|||
LDAP_CREDS = '********' |
|||
LDAP_BASE_DN = 'ou=users,o=mojo' |
|||
LDAP_SCOPE = 'sub' |
|||
LDAP_FILTER = '"(&(objectClass=person)(&(uid=*mil*)))"' |
|||
LDAP_ATTRIBUTES = '"dn" "cn" "sn" "uid"' |
|||
ldapCommand = , |
|||
'ldapsearch' , |
|||
'-s base' , |
|||
'-H' LDAP_URL , |
|||
'-LLL' , |
|||
'-x' , |
|||
'-v' , |
|||
'-s' LDAP_SCOPE , |
|||
'-D' LDAP_DN_STR , |
|||
'-w' LDAP_CREDS , |
|||
'-b' LDAP_BASE_DN , |
|||
LDAP_FILTER , |
|||
LDAP_ATTRIBUTES , |
|||
'' |
|||
say ldapCommand |
|||
address command, |
|||
ldapCommand |
|||
return |
|||
end |
|||
exit |
|||
</lang> |
|||
'''Output:''' |
|||
<pre> |
|||
ldapsearch -s base -H ldap://localhost:11389 -LLL -x -v -s sub -D uid=admin,ou=system -w ******** -b ou=users,o=mojo "(&(objectClass=person)(&(uid=*mil*)))" "dn" "cn" "sn" "uid" |
|||
ldap_initialize( ldap://localhost:11389/??base ) |
|||
filter: (&(objectClass=person)(&(uid=*mil*))) |
|||
requesting: dn cn sn uid |
|||
dn: cn=John Milton,ou=users,o=mojo |
|||
uid: jmilton |
|||
sn: Milton |
|||
cn: John Milton |
|||
</pre> |
|||
=={{header|Ruby}}== |
=={{header|Ruby}}== |
||
Line 571: | Line 621: | ||
LDAP_PORT=11389 |
LDAP_PORT=11389 |
||
LDAP_DN_STR="uid=admin,ou=system" |
LDAP_DN_STR="uid=admin,ou=system" |
||
LDAP_CREDS=" |
LDAP_CREDS="********" |
||
LDAP_BASE_DN="ou=users,o=mojo" |
LDAP_BASE_DN="ou=users,o=mojo" |
||
LDAP_SCOPE="sub" |
LDAP_SCOPE="sub" |