I imagine this is obvious to some but it isn't to me. I wrote this simple 
script to update 
a single attribute of an existing 389 entry. It is shown below: 



#!/usr/bin/perl 


use Net::LDAP; 
use Net::LDAP::Entry; 
use Net::LDAP::LDIF; 
use Net::LDAP::Message; 


$ldap = Net::LDAP->new('localhost') or die "$@"; 
$bind_mesg = $ldap->bind( "cn=directory manager", password=>"secret" ); 
$bind_mesg->code && die $bind_mesg->error; 


$search_mesg = $ldap->search(base => "ou=People,dc=crud,dc=edu", 
filter => "uid=someuid"); 


die "error: ", $mesg->error() 
if (($search_mesg->code()) || ($search_mesg->count !=1)); 


$cur_entry = $search_mesg->entry(0); 


$cur_entry->replace('cn' => 'changedcn'); 
$cur_entry->changetype(modify); 
$update_mesg = $cur_entry->update($ldap); 
$update_mesg->code && die $update_mesg->error; 


$bind_mesg = $ldap->unbind; 

When I include the "$cur_entry->changetype(modify);" line, the script returns: 



No attributes to update at ./ldap-update.pl line 23, <DATA> line 751. 


If I comment that out, the script works swimmingly. I banged my head on this 
for a while. What am I missing? 


Thanks, Chris 

Reply via email to