rh7.2/php4.1.1/openldap2.0.22
i need help with my short php script to search and display user attributes. following
is the
output from my script:
connect result is Resource id #1
Binding ...Bind result is 1
Search result is Resource id #2
Number of entires returned is 1
Getting entries ...
Data for 1 items returned:
dn is: uid=tim,ou=subdept,o=dept,dc=myorg,dc=com
first cn entry is: Tim Tom
first email entry is: [EMAIL PROTECTED]
first createTimestamp entry is:
first userPassword entry is:
Closing connection
why can't i see the createTimestamp and userPassword bcos i did an *authenticated
bind* !
the script:
<?php
$ds=ldap_connect("192.168.10.120");
echo "connect result is ".$ds."<p>";
if ($ds) {
echo "Binding ...";
$r=ldap_bind($ds,"cn=myorg_admin,o=Administrators,dc=myorg,dc=com","secret");
echo "Bind result is ".$r."<p>";
$sr=ldap_search($ds,"dc=myorg,dc=com","ou=subdept");
echo "Search result is ".$sr."<p>";
echo "Number of entires returned is ".ldap_count_entries($ds,$sr)."<p>";
echo "Getting entries ...<p>";
$info = ldap_get_entries($ds, $sr);
echo "Data for ".$info["count"]." items returned:<p>";
for ($i=0; $i<$info["count"]; $i++) {
echo "dn is: ". $info[$i]["dn"] ."<br>";
echo "first cn entry is: ". $info[$i]["cn"][0] ."<br>";
echo "first email entry is: ". $info[$i]["mail"][0] ."<br>";
echo "first createTimestamp entry is: ". $info[$i]["createTimestamp"][0]
."<br>";
echo "first userPassword entry is: ". $info[$i]["userPassword"][0] ."<p>";
}
echo "Closing connection";
ldap_close($ds);
}
else {
echo "<h4>Unable to connect to LDAP server</h4>";
}
?>
this is my slapd.conf
---------------------
#######################################################################
# ldbm database definitions
#######################################################################
database ldbm
suffix "dc=myorg,dc=com"
rootdn "cn=myorg_admin,o=Administrators,dc=myorg,dc=com"
cachesize 1000000
dbcachesize 1000000
# Cleartext passwords, especially for the rootdn, should
# be avoid. See slappasswd(8) and slapd.conf(5) for details.
# Use of strong authentication encouraged.
rootpw secret
# The database directory MUST exist prior to running slapd AND
# should only be accessible by the slapd/tools. Mode 700 recommended.
directory /usr/local/var/openldap-ldbm
# Indices to maintain
index cn,sn,uid pres,eq
index mail,mailAlternateAddress eq
index objectClass eq
access to attr=userPassword
by dn="cn=myorg_admin,o=Administrators,dc=myorg,dc=com" write
by dn="cn=courier,o=Administrators,dc=myorg,dc=com" read
by dn="cn=qmail,o=Administrators,dc=myorg,dc=com" read
by self write
by * auth
access to *
by dn="cn=myorg_admin,o=Administrators,dc=myorg,dc=com" write
by dn="cn=courier,o=Administrators,dc=myorg,dc=com" read
by dn="cn=qmail,o=Administrators,dc=myorg,dc=com" read
by self read
by anonymous read
please advise.
TIA
-
tim
__________________________________________________
Do You Yahoo!?
Yahoo! Greetings - Send FREE e-cards for every occasion!
http://greetings.yahoo.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php