[nycphp-talk] PHP/LDAP
Yusuf Qasim - eXostream Communications
yqasim at exostream.com
Wed Aug 28 10:53:34 EDT 2002
I would like to temporarily unsubscribe while I am at college. Thanks
Yusuf Qasim
Quinnipiac University Undergraduate
Ext. 7018
-----Original Message-----
From: Tim Sailer [mailto:sailer at bnl.gov]
Sent: Wednesday, August 28, 2002 10:13 AM
To: NYPHP Talk
Subject: [nycphp-talk] PHP/LDAP
Hrrm. Original email was bounced, so trying again.
I need some guidance from the LDAP gurus, I think. I've long been
able to get PHP to read from LDAP, but now I have the need to write,
and I'm running up against a strange problem.
Basic code is as follows:
----
<?
$ds=ldap_connect("ldapmachine.bnl.gov");
if (!$ds)
{
echo "No connect! Result was ".$ds;
exit;
}
#non-anon bind, since we have to update stuff.
$nab=ldap_bind($ds,"cn=admin,dc=bnl,dc=gov","password");
if (!$nab)
{
echo "Bind failed! Exiting...";
exit;
}
$searchstring="(uid=".$uid.")";
$sr=ldap_search($ds,"dc=bnl,dc=gov","$searchstring");
echo "Search String: <b>$searchstring</b><br>";
$info=ldap_get_entries($ds,$sr);
$dn=$info["dn"];
echo $dn;
#$info1["objectClass"]="inetLocalMailRecipient";
$bla=ldap_mod_add($ds,"$dn",$info1);
ldap_close($ds);
----
Now, this is just test code, but it should work. $uid gets
passed from a form, and I just want to add an objectClass,
and 2 attributes. What I get is this from PHP:
Warning: LDAP: modify operation could not be completed. in
/var/www/ldap/mklabmail.php on line 33
And this from LDAP:
Aug 28 08:47:58 ldapmachine slapd[243]: conn=84871 op=0 BIND
dn="CN=ADMIN,DC=BNL,DC=GOV" method=128
Aug 28 08:47:58 ldapmachine slapd[243]: conn=84871 op=0 RESULT tag=97
err=0 text=
Aug 28 08:47:58 ldapmachine slapd[245]: conn=84871 op=1 SRCH
base="dc=bnl,dc=gov" scope=2 filter="(uid=krl2)"
Aug 28 08:47:58 ldapmachine slapd[245]: conn=84871 op=1 SEARCH RESULT
tag=101 err=0 text=
Aug 28 08:47:58 ldapmachine slapd[344]: do_modify: root dse!
Aug 28 08:47:58 ldapmachine slapd[344]: conn=84871 op=2 RESULT tag=103
err=53 text=modify upon the root DSE not supported
Aug 28 08:47:58 ldapmachine slapd[345]: conn=84871 op=3 UNBIND
Aug 28 08:47:58 ldapmachine slapd[345]: conn=-1 fd=15 closed
I'm *not trying* to change the root dse! What am I stupidly doing
wrong?
Tim
--
Tim Sailer <sailer at bnl.gov>
Application Services
Information Technology Division
Brookhaven National Laboratory (631) 344-3001
More information about the talk
mailing list