afuna: Cat under a blanket. Text: "Cats are just little people with Fur and Fangs" (Default)
afuna ([personal profile] afuna) wrote in [site community profile] changelog2009-09-03 04:50 pm

[dw-free] crossposter: get_proxy call is not safe if xmlrpc call failed.

[commit: http://hg.dwscoalition.org/dw-free/rev/64f0c8961635]

http://bugs.dwscoalition.org/show_bug.cgi?id=1635

Fix issues triggered when xpost fails: replace call to get_proxy (which
errors); make a copy of the job args (that you don't delete from) so that
the job can run multiple times in case of failure.

Patch by [personal profile] exor674.

Files modified:
  • cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm
  • cgi-bin/DW/Worker/XPostWorker.pm
--------------------------------------------------------------------------------
diff -r 1524067c3278 -r 64f0c8961635 cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm
--- a/cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm	Thu Sep 03 16:31:33 2009 +0000
+++ b/cgi-bin/DW/External/XPostProtocol/LJXMLRPC.pm	Thu Sep 03 16:49:29 2009 +0000
@@ -43,9 +43,9 @@ sub _skeleton {
 # LJ-XMLRPC library class.
 sub _call_xmlrpc {
     my ($self, $xmlrpc, $mode, $req) = @_;
-    
+
     my $result = eval { $xmlrpc->call("LJ.XMLRPC.$mode", $req) };
-    
+
     if ($result) {
         if ($result->fault) {
             # error from server
@@ -64,7 +64,7 @@ sub _call_xmlrpc {
         # connection error
         return {
             success => 0,
-            error => LJ::Lang::ml("xpost.error.connection", { url => $xmlrpc->get_proxy })
+            error => LJ::Lang::ml("xpost.error.connection", { url => $xmlrpc->proxy->endpoint })
         } 
     }
 }
diff -r 1524067c3278 -r 64f0c8961635 cgi-bin/DW/Worker/XPostWorker.pm
--- a/cgi-bin/DW/Worker/XPostWorker.pm	Thu Sep 03 16:31:33 2009 +0000
+++ b/cgi-bin/DW/Worker/XPostWorker.pm	Thu Sep 03 16:49:29 2009 +0000
@@ -48,7 +48,7 @@ sub work {
 sub work {
     my ($class, $job) = @_;
 
-    my $arg = $job->arg;
+    my $arg = { %{$job->arg} };
 
     my ($uid, $ditemid, $acctid, $password, $auth_challenge, $auth_response, $delete) = map { delete $arg->{$_} } qw( uid ditemid accountid password auth_challenge auth_response delete );
 
--------------------------------------------------------------------------------

Post a comment in response:

This account has disabled anonymous posting.
If you don't have an account you can create one now.
HTML doesn't work in the subject.
More info about formatting

If you are unable to use this captcha for any reason, please contact us by email at support@dreamwidth.org