Dear Net::LDAPers,

I'm using Net:LDAP to add/remove user accounts from LDAP. I've created a
subroutine that adds the user to a group after their account is already
created. I'm trying to add an additional MemberUID attribute to an
existing posixGroup object. Here's my subroutine:

sub ldap_add_group2
{
    my $ldap = $_[0];
    my $ldap_base = $_[1];
    my $username = $_[2];
    my $group2 = $_[3];
    my $debug = $_[4];  

    my $entry;
    my $mesg;
    my $code;
    my $error;
    my $group_dn = "$group2,ou=Group,$ldap_base";
   
    if ($debug) {
    print "Adding $username to secondary group $group2 ($group_dn)\n";
    }
    $entry = Net::LDAP::Entry->new($dn);
    $entry->add('memberUid' => "$username");
    $mesg = $entry->update($ldap);
    $code = $mesg->code();
    if ($code == 0) {
    if ($debug) {
        print "$Username added to LDAP group $group2\n";
    }
    } else {
    $error = $mesg->error();
    print "$error\n";
    print "Error: Could not add $user to secondary group $group\n";
    exit(1);
    }
}

  
This code is producing this error:

addRequest.addRequest.objectName is undefined at
/usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP/Message.pm line 194.
 at /usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP/Entry.pm line 269.
addRequest.addRequest.objectName is undefined at
/usr/local/perl-5.14.2/lib/site_perl/5.14.2/Net/LDAP/Message.pm line 194.

I know I'm probably doing something silly wrong. Can anyone point me in
the right direction?


-- 
Prentice 

Reply via email to