aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--config_default2
-rw-r--r--lib/MGA/Advisories.pm31
2 files changed, 10 insertions, 23 deletions
diff --git a/config_default b/config_default
index f44561d..fbcd072 100644
--- a/config_default
+++ b/config_default
@@ -20,6 +20,6 @@ advisory_types:
prefix: MGAA
security:
prefix: MGASA
-bugzilla_url: https://bugs.mageia.org/xmlrpc.cgi
+bugzilla_url: https://bugs.mageia.org/
bugzilla_login:
bugzilla_password:
diff --git a/lib/MGA/Advisories.pm b/lib/MGA/Advisories.pm
index aaba0f7..e56770d 100644
--- a/lib/MGA/Advisories.pm
+++ b/lib/MGA/Advisories.pm
@@ -10,7 +10,6 @@ use Email::Simple;
use Email::Simple::Creator;
use LWP::UserAgent;
use File::Basename;
-use HTTP::Cookies;
use XMLRPC::Lite;
#use Data::Dump qw(dd);
@@ -37,7 +36,7 @@ my %tools = (
my %bz = (
proxy => undef,
- cookies => undef,
+ token => undef
);
my @report_logs;
@@ -66,22 +65,8 @@ sub init_bz {
return 1 if ($bz{proxy});
return 0 if (!$config->{bugzilla_url});
- my $cookiefile = $ENV{HOME} . '/.mga-advisories/bugzilla-cookies.txt';
- if (!-d dirname($cookiefile)) {
- return 0 unless mkdir dirname($cookiefile);
- }
-
- $bz{cookies} = new HTTP::Cookies(
- file => $cookiefile,
- ignore_discard => 1,
- autosave => 1
- );
-
- # Q. Do I need to load the cookies or does this happen magically?
-
$bz{proxy} = XMLRPC::Lite->proxy(
- $config->{bugzilla_url},
- cookie_jar => $bz{cookies}
+ $config->{bugzilla_url} . "xmlrpc.cgi"
);
#$bz{proxy}->import(+trace => 'debug');
@@ -93,16 +78,15 @@ sub call_bz {
return 0 if (!init_bz());
+ $args[0]->{token} = $bz{token} if ($bz{token});
+
my $soapresult = $bz{proxy}->call($method, @args);
if ($soapresult->fault) {
if ($soapresult->faultcode == 410) {
# We need to login
-
- # Q. Do we need to save manually?
- $bz{cookies}->save();
- # TODO: chmod the jar... to 600
-
if (login_bz()) {
+ $args[0]->{token} = $bz{token};
+
# Try the call again now we're logged in.
$soapresult = $bz{proxy}->call($method, @args);
return $soapresult->result unless $soapresult->fault;
@@ -143,6 +127,9 @@ sub login_bz {
remember => 1
}
);
+ if ($soapresult->result && $soapresult->result->{token}) {
+ $bz{token} = $soapresult->result->{token};
+ }
return 1 unless $soapresult->fault;
}
return 0;