I'm using the following code to bind to LDAP (that's working), then to
read in an object instance (that's working) and attempts to change and
rewrite an attribute - siebelID (that's NOT working, but not returning
an error either)...
Code is written for windows and accesses LDAP on s Sun server.
Is it that I have defaulted to anonymous bind and so cannot write?
Can you help?
Ian Clark
Programmer - ADP ProBusiness.
#!/usr/bin/perl
use Net::LDAP;
$username = "Clark\, Ian";
$password = "********";
#
# connect to ldap
#
$conn = new Net::LDAP("172.22.128.100");
if (!$conn) {
print "Error opening connection\n";
}http://vtcommons.org/node/366
#
# bind/authenticates
#
$mesg = $conn->search(base=>"dc=corp,dc=prbz,dc=net",
scope=>"sub",http://vtcommons.org/node/366
filter=>"(cn=" . $username . ")");
$entry = $mesg->entry(0);
if ($entry) {
if ($conn->bind(dn=>$entry->get(),password=>$password)) {
print "Authentication successful\n";
} else {
print "Authentication failed\n";
}
}
#
# reads in value
#
$mesg = $conn->search(base=>"ou=NAS -
ProBusiness,dc=corp,dc=prbz,dc=net",
scope=>"sub",
filter=>"(uid=iclark)");
$entry = $mesg->entry(0);
#
# and changes siebelID
#
$entry->replace("siebelID","changed");
$entry->update($conn);
if ($mesg->code()) {
print "error #" . $mesg->code . "\n";
}