From: Jim H. <ha...@us...> - 2000-06-13 19:37:17
|
The problem with the returned error looking strange is with your printing $mesg->error instead of Net::LDAP::Util::ldap_error_text($mesg->code). --Jim Harle US Naval Academy On Tue, 13 Jun 2000, Yann Ramin wrote: > Hi, > Ok, I'm back and have a perplexing question to answer. The code below > is supposed to add a user to a group, but dies in a funny error. I have > the program output: > > # ./X11UInfo > Entry: cn=Student, ou=System Groups, ou=Groups, dc=montereyhigh, dc=com > User: cn=He He, dc=montereyhigh,dc=com > 83 object at /usr/lib/perl5/site_perl/5.6.0/Convert/ASN1/_encode.pm line > 47. > > > > And code: > > sub add_user_to_group { > my ($self, $user, $group) = @_; > > if ($self->user_in_group($user, $group) != 1) { > # Already there my friend :) > return 1; > } > > my $mesg = $self->{LDAP}->search ( # perform a search > base => "ou=Groups, ".$self->{ldap_config_base}, > filter => "(&(cn=".$group.")(objectclass=groupofNames))" > ); > my @entries = $mesg->entries; > my $entr = @entries[0]; > my $entry = $entr->dn; > > print "Entry: $entry\nUser: $user\n"; > my $mesg = $self->{LDAP}->modify($dn, > changes => [ > add => [ member => $user > ] > ] > ); > if ($mesg->code) { > print $mesg->code." ".$mesg->error; > return 1; > } > return 0; > > > } > > > > -- > > -------------------------------------------------------------------- > Yann Ramin at...@at... > Atrus Trivalie Productions www.redshift.com/~yramin > Monterey High IT www.montereyhigh.com > ICQ 46805627 > AIM oddatrus > Marina, CA > > "All cats die. Socrates is dead. Therefore Socrates is a cat." > - The Logician > > # fortune > "To be responsive at this time, though I will simply say, and therefore > this is a repeat of what I said previously, that which I am unable to > offer in response is based on information available to make no such > statement." > -------------------------------------------------------------------- > > |