--- bin/ldap.pl 2008/03/13 13:12:46 7 +++ bin/ldap.pl 2008/03/13 14:00:40 9 @@ -11,24 +11,31 @@ BEGIN { Jifty->new; }; -my $ldap = Net::LDAP->new( 'ldap1.skole.local' ) or die "$@"; +my $ldap_config = Jifty->config->app('LDAP'); +Jifty->log->debug( "config->app(LDAP) = ",dump( $ldap_config ) ); + +my $ldap = Net::LDAP->new( Jifty->config->app('LDAP')->{Server} ) or die "$@"; # an anonymous bind -my $mesg = $ldap->bind; +#my $mesg = $ldap->bind; +my $mesg = $ldap->bind( + DN => Jifty->config->app('LDAP')->{DN}, + password => Jifty->config->app('LDAP')->{Password}, +); # perform a search $mesg = $ldap->search( base => "dc=skole,dc=hr", # filter => "(&(sn=Barr) (o=Texas Instruments))", filter => "(objectClass=hrEduPerson)", - sizelimit => 100, # off + sizelimit => 3, # 0 = off ); if ( $mesg->code ) { warn $mesg->code, ": ", $mesg->error, "\n"; } -warn "# found ", $mesg->count, " entries\n"; +Jifty->log->info( "found ", $mesg->count, " entries" ); foreach my $entry ( $mesg->entries ) { @@ -48,7 +55,7 @@ } } - warn dump( $data ); + Jifty->log->debug( dump( $data ) ); $user->load_or_create( %$data ); }