From: Jim H. <ha...@us...> - 2001-02-06 14:31:13
|
Clif, I attempted to test this with Novell NDS8.5. I got the error: Can't call method "attributes" on an undefined value at findschema line 10, <STDIN> chunk 1. I first tried it with an anonymous bind and it failed, then I added code for an authenticated bind and tried it with an account with essentially all rights and still got the same message. Here is my code: #!/usr/local/bin/perl use Net::LDAP; use Net::LDAP::Schema; use Term::ReadKey; $ldap = Net::LDAP->new('directory.usna.edu'); validate(); $schema = $ldap->schema(); @atts = $schema->attributes(); print "first 3 attribites:\n"; for $i (0..2) {print " $atts[$i]\n"}; @usna_atts = $schema->attributes( 'USNAperson'); print "USNA person:\n"; foreach $v (@usna_atts) { print " $v\n"}; @dts = $schema->ditstructurerules(); print "first 3 structure rules:\n"; for $i (0..2) {print " $dts[$i]\n"}; @dtc = $schema->ditcontentrules(); print "first 3 content rules:\n"; for $i (0..2) {print " $dtc[$i]\n"}; print $schema->is_objectclass('newPilotPerson')?'correct':'wrong'," about npp\n";print "oid for squad ",$schema->is_attribute('USNAsquad'),"\n"; sub validate { print "your login "; chomp ( my $login = <>); print "your passwd "; ReadMode 'noecho'; my $password = ReadLine 0; chomp $password; ReadMode 'normal'; print "\n"; $ldap->bind ( version=>3) ; #first find dn for this login my $basedn = "o=usna"; my $filter = "(uid=$login)"; my $mesg = $ldap->search( base => $basedn, filter => $filter, attrs => ["dn"] ); if ($mesg->code || ($mesg->count() != 1)) { print "Couldn't find $login, message is \n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n"; exit; } my $entry = $mesg->entry(0); my $admindn = $entry->dn; $mesg = $ldap->bind (dn => $admindn, password => $password, version => 3) ; if ($mesg->code) { print "Couldn't bind to $login, message is \n ", Net::LDAP::Util::ldap_error_name($mesg->code), "\n"; exit; } } |