download_message does not handle authentication properly
Bug #778692 reported by
Steve Gaarder
This bug affects 1 person
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
OCS Inventory: Unified Unix Agent |
Fix Released
|
Low
|
mortheres |
Bug Description
When using a server that requires authentication and deploying a package, the package is downloaded and installed ok, but the success message never arrives because the routine download_message does not present the configured user name and password. Instead, it just retries forever, getting a 401 error each time. It appears that the problem is in this line:
$ua->credentials( $context-
because when I replace the variable with the hard-coded name and port of my server, it works.
Changed in ocsinventory-unix-agent: | |
assignee: | nobody → mortheres (mortheres) |
Changed in ocsinventory-unix-agent: | |
status: | Fix Committed → Fix Released |
To post a comment you must log in.
One way to fix this is to add this subroutine:
sub getnetloc{
# extract from the server URL a name of the form hostname:port
my $serverurl = shift;
my $s = ""; ://([\w\ -\.]+): (\d+)/! ) { ([\w\-\.]+)/!) { /([\w\-\.]+)/!) {
if ($serverurl =~ m!https*
$s = "${1}:$2";
} elsif ($serverurl =~ m!http://
$s = "${1}:80";
} elsif ($serverurl =~ m!https:/
$s = "${1}:443";
}
return $s;
}
And then change the offending line above to: