*** LWP/Protocol/ldap.pm~
--- LWP/Protocol/ldap.pm
***************
*** 56,63 ****
my $host = $url->host;
my $port = $url->port;
! my $user = $url->user;
! my $password = $url->password;
# Create an initial response object
my $response = new HTTP::Response &HTTP::Status::RC_OK, "Document follows";
--- 56,62 ----
my $host = $url->host;
my $port = $url->port;
! my ($user, $password) = split(":", $url->userinfo, 2);
# Create an initial response object
my $response = new HTTP::Response &HTTP::Status::RC_OK, "Document follows";
***************
*** 65,71 ****
my $ldap = new Net::LDAP($host, port => $port);
! my $mesg = $ldap->bind;
if ($mesg->code) {
my $res = new HTTP::Response &HTTP::Status::RC_BAD_REQUEST,
--- 64,70 ----
my $ldap = new Net::LDAP($host, port => $port);
! my $mesg = $ldap->bind($user, password => $password);
if ($mesg->code) {
my $res = new HTTP::Response &HTTP::Status::RC_BAD_REQUEST,
***************
*** 94,135 ****
return $res;
}
else {
! my $content = "
Directory Search Results\n";
my $entry;
my $index;
for($index = 0 ; $entry = $mesg->entry($index) ; $index++ ) {
my $attr;
! $content .= $index ? "   |
\n"
! : "";
! $content .= "" . $entry->dn . " |
\n";
foreach $attr ($entry->attributes) {
my $vals = $entry->get_value($attr, asref => 1);
my $val;
! $content .= " 1);
! $content .= ">" . $attr . "  | \n";
my $j = 0;
foreach $val (@$vals) {
$val = qq!$val! if $val =~ /^https?:/;
$val = qq!$val! if $val =~ /^[-\w]+\@[-.\w]+$/;
! $content .= "
" if $j++;
! $content .= "" . $val . " |
\n";
}
}
}
! $content .= "
" if $index;
$content .= "
";
$content .= $index ? sprintf("%s Match%s found",$index, $index>1 ? "es" : "")
! : "No Matches found";
! $content .= "\n";
$response->header('Content-Type' => 'text/html');
$response->header('Content-Length', length($content));
$response = $self->collect_once($arg, $response, $content)
--- 93,133 ----
return $res;
}
else {
! my $content = "Directory Search Results\n";
my $entry;
my $index;
for($index = 0 ; $entry = $mesg->entry($index) ; $index++ ) {
my $attr;
! $content .= $index ? qq{   |
\n} : "";
! $content .= qq{} . $entry->dn . " |
\n";
foreach $attr ($entry->attributes) {
my $vals = $entry->get_value($attr, asref => 1);
my $val;
! $content .= q{ 1);
! $content .= ">" . $attr . "  | \n";
my $j = 0;
foreach $val (@$vals) {
$val = qq!$val! if $val =~ /^https?:/;
$val = qq!$val! if $val =~ /^[-\w]+\@[-.\w]+$/;
! $content .= "
" if $j++;
! $content .= "" . $val . " |
\n";
}
}
}
! $content .= "
" if $index;
$content .= "
";
$content .= $index ? sprintf("%s Match%s found",$index, $index>1 ? "es" : "")
! : "No Matches found";
! $content .= "\n";
$response->header('Content-Type' => 'text/html');
$response->header('Content-Length', length($content));
$response = $self->collect_once($arg, $response, $content)
***************
*** 141,143 ****
--- 139,143 ----
$response;
}
+
+ 1;
Diff finished at Fri Apr 12 16:40:12