C
cwoollard
Hello, I hope somebody can help me,
I have this program that is listed below that searches an ldap server
for parameters passed on the command line.
It does work but it doesn't skip binary data that is also returned (in
this case jpeg images). I thought that adding the below line would do
the trick, but it doesn't seem to. Maybe I am doing something wrong.
next if ( $entry =~ /;binary$/ );
Can anybody help
Thanks
chris
use Net::LDAP;
$server = $ARGV[0];
$port = getservbyname("ldap","tcp") || "389";
$basedn = "ou=staff,dc=somewhere,dc=co,dc=uk";
$scope = "sub";
$c = new Net::LDAP($server, port=>$port) or
die "Unable to connect to $server: $@\n";
$c->bind( ) or die "Unable to bind: $@\n"; # anonymous bind
$searchobj = $c->search(base => $basedn, scope => $scope,
filter => $ARGV[1]);
die "Bad search, errorcode #".$searchobj->code() if $searchobj->code(
);
@entries = $searchobj->entries;
foreach $entry (@entries) {
next if ( $entry =~ /;binary$/ );
$entry->dump;
}
I have this program that is listed below that searches an ldap server
for parameters passed on the command line.
It does work but it doesn't skip binary data that is also returned (in
this case jpeg images). I thought that adding the below line would do
the trick, but it doesn't seem to. Maybe I am doing something wrong.
next if ( $entry =~ /;binary$/ );
Can anybody help
Thanks
chris
use Net::LDAP;
$server = $ARGV[0];
$port = getservbyname("ldap","tcp") || "389";
$basedn = "ou=staff,dc=somewhere,dc=co,dc=uk";
$scope = "sub";
$c = new Net::LDAP($server, port=>$port) or
die "Unable to connect to $server: $@\n";
$c->bind( ) or die "Unable to bind: $@\n"; # anonymous bind
$searchobj = $c->search(base => $basedn, scope => $scope,
filter => $ARGV[1]);
die "Bad search, errorcode #".$searchobj->code() if $searchobj->code(
);
@entries = $searchobj->entries;
foreach $entry (@entries) {
next if ( $entry =~ /;binary$/ );
$entry->dump;
}