Active Directory/Search for a user: Difference between revisions
Content added Content deleted
(Add Java implementation) |
(Add UNIX Shell implementation) |
||
Line 533: | Line 533: | ||
5 File(s) 748,993,785 bytes |
5 File(s) 748,993,785 bytes |
||
7 Dir(s) 952,183,820,288 bytes free</pre> |
7 Dir(s) 952,183,820,288 bytes free</pre> |
||
=={{header|UNIX Shell}}== |
|||
A shell script to drive the <tt>ldapsearch</tt> command. |
|||
<lang bash>#!/bin/sh |
|||
LDAP_HOST="localhost" |
|||
LDAP_PORT=11389 |
|||
LDAP_DN_STR="uid=admin,ou=system" |
|||
LDAP_CREDS="secret" |
|||
LDAP_BASE_DN="ou=users,o=mojo" |
|||
LDAP_SCOPE="sub" |
|||
LDAP_FILTER="(&(objectClass=person)(&(uid=*mil*)))" |
|||
LDAP_ATTRIBUTES="dn cn sn uid" |
|||
ldapsearch \ |
|||
-s base \ |
|||
-h $LDAP_HOST \ |
|||
-p $LDAP_PORT \ |
|||
-LLL \ |
|||
-x \ |
|||
-v \ |
|||
-s $LDAP_SCOPE \ |
|||
-D $LDAP_DN_STR \ |
|||
-w $LDAP_CREDS \ |
|||
-b $LDAP_BASE_DN \ |
|||
$LDAP_FILTER \ |
|||
$LDAP_ATTRIBUTES |
|||
</lang> |
|||
'''Output:''' |
|||
<pre> |
|||
ldap_initialize( ldap://localhost:11389 ) |
|||
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|Tcl}}== |
=={{header|Tcl}}== |