[tools 2/2] testbot: Use MakeOfficialURL() in non-CGI scripts.

Francois Gouget fgouget at codeweavers.com
Tue Apr 5 07:21:03 CDT 2022


Non-CGI scripts should not have $HTTP_HOST anyway so this is the same as
MakeSecureURL().

Signed-off-by: Francois Gouget <fgouget at codeweavers.com>
---
 testbot/bin/WineRunBuild.pl      | 2 +-
 testbot/bin/WineRunReconfig.pl   | 8 ++++----
 testbot/bin/WineRunTask.pl       | 4 ++--
 testbot/bin/WineRunWineTest.pl   | 4 ++--
 testbot/bin/WineSendLog.pl       | 4 ++--
 testbot/lib/WineTestBot/Users.pm | 8 ++++----
 6 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/testbot/bin/WineRunBuild.pl b/testbot/bin/WineRunBuild.pl
index 1bddc0402..7e8fcede1 100755
--- a/testbot/bin/WineRunBuild.pl
+++ b/testbot/bin/WineRunBuild.pl
@@ -334,7 +334,7 @@ if (!$Domain->IsPoweredOn())
   NotifyAdministrator("Putting the ". $VM->Name ." VM offline",
     "The ". $VM->Name ." VM should have been powered on to run the task\n".
     "below but its state was ". $Domain->GetStateDescription() ." instead.\n".
-    MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
+    MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
     "So the VM has been put offline and the TestBot will try to regain\n".
     "access to it.");
   WrapUpAndExit('queued', undef, undef, 'boterror vm off');
diff --git a/testbot/bin/WineRunReconfig.pl b/testbot/bin/WineRunReconfig.pl
index c1e6e4443..e86326889 100755
--- a/testbot/bin/WineRunReconfig.pl
+++ b/testbot/bin/WineRunReconfig.pl
@@ -336,7 +336,7 @@ if (!$Domain->IsPoweredOn())
   NotifyAdministrator("Putting the ". $VM->Name ." VM offline",
     "The ". $VM->Name ." VM should have been powered on to run the task\n".
     "below but its state was ". $Domain->GetStateDescription() ." instead.\n".
-    MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
+    MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
     "So the VM has been put offline and the TestBot will try to regain\n".
     "access to it.");
   WrapUpAndExit('queued', undef, undef, 'boterror vm off');
@@ -432,7 +432,7 @@ if ($TA->GetFile("Reconfig.log", "$TaskDir/task.log"))
     NotifyAdministrator("The ". $VM->Name ." build failed",
                         "The ". $VM->Name ." build failed and $Status\n\n".
                         "See the link below for more details:\n".
-                        MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
+                        MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
     $NewStatus = "badbuild";
   }
   my $LogErrMsg = CreateLogErrorsCache($LogInfo);
@@ -546,7 +546,7 @@ if ($NewStatus eq 'completed')
                         "Could not recreate the $IdleSnapshot snapshot:\n\n".
                         "$ErrMessage\n\n".
                         "See the link below for more details:\n".
-                        MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
+                        MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
     FatalError("Could not recreate the $IdleSnapshot snapshot: $ErrMessage\n");
   }
 
@@ -562,7 +562,7 @@ if ($NewStatus eq 'completed')
         ." after its update:\n\n".
         "$ErrMessage\n\n".
         "See the link below for more details:\n".
-        MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
+        MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n");
     }
     else
     {
diff --git a/testbot/bin/WineRunTask.pl b/testbot/bin/WineRunTask.pl
index eb81cf04d..d872ba5fa 100755
--- a/testbot/bin/WineRunTask.pl
+++ b/testbot/bin/WineRunTask.pl
@@ -386,7 +386,7 @@ if (!$Domain->IsPoweredOn())
   NotifyAdministrator("Putting the ". $VM->Name ." VM offline",
     "The ". $VM->Name ." VM should have been powered on to run the task\n".
     "below but its state was ". $Domain->GetStateDescription() ." instead.\n".
-    MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
+    MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
     "So the VM has been put offline and the TestBot will try to regain\n".
     "access to it.");
   WrapUpAndExit('queued', undef, undef, undef, 'boterror vm off');
@@ -466,7 +466,7 @@ elsif ($Step->Type eq "suite")
   if (defined($WebHostName))
   {
     my $URL = GetTaskURL($JobId, $StepNo, $TaskNo, 1);
-    $Script .= "-u ". BatchQuote(MakeSecureURL($URL)) ." ";
+    $Script .= "-u ". BatchQuote(MakeOfficialURL($URL)) ." ";
   }
   my $Tag = $VM->Type ne "win64" ? "" : $Step->FileType eq "exe64" ? "64" : "32";
   $Tag = BuildTag($VM->Name, $Tag);
diff --git a/testbot/bin/WineRunWineTest.pl b/testbot/bin/WineRunWineTest.pl
index 352671934..62a7fc5bc 100755
--- a/testbot/bin/WineRunWineTest.pl
+++ b/testbot/bin/WineRunWineTest.pl
@@ -383,7 +383,7 @@ if (!$Domain->IsPoweredOn())
   NotifyAdministrator("Putting the ". $VM->Name ." VM offline",
     "The ". $VM->Name ." VM should have been powered on to run the task\n".
     "below but its state was ". $Domain->GetStateDescription() ." instead.\n".
-    MakeSecureURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
+    MakeOfficialURL(GetTaskURL($JobId, $StepNo, $TaskNo)) ."\n\n".
     "So the VM has been put offline and the TestBot will try to regain\n".
     "access to it.");
   WrapUpAndExit('queued', undef, undef, 'boterror vm off');
@@ -437,7 +437,7 @@ if ($Step->Type eq "suite")
   if (defined $WebHostName)
   {
     my $URL = GetTaskURL($JobId, $StepNo, $TaskNo, 1);
-    $Script .= "-u ". ShQuote(MakeSecureURL($URL)) ." ";
+    $Script .= "-u ". ShQuote(MakeOfficialURL($URL)) ." ";
   }
   my $Info = $VM->Description ? $VM->Description : "";
   if ($VM->Details)
diff --git a/testbot/bin/WineSendLog.pl b/testbot/bin/WineSendLog.pl
index 65c95de4d..954edaebd 100755
--- a/testbot/bin/WineSendLog.pl
+++ b/testbot/bin/WineSendLog.pl
@@ -48,6 +48,7 @@ use WineTestBot::Jobs;
 use WineTestBot::Log;
 use WineTestBot::LogUtils;
 use WineTestBot::StepsTasks;
+use WineTestBot::Utils;
 
 
 my $PART_BOUNDARY = "==13F70BD1-BA1B-449A-9CCB-B6A8E90CED47==";
@@ -184,8 +185,7 @@ sub SendLog($)
   my $StepsTasks = CreateStepsTasks(undef, $Job);
   my @SortedKeys = sort { $a <=> $b } @{$StepsTasks->GetKeys()};
 
-  my $JobURL = ($UseSSL ? "https://" : "http://") .
-               "$WebHostName/JobDetails.pl?Key=". $Job->GetKey();
+  my $JobURL = MakeOfficialURL("/JobDetails.pl?Key=". $Job->GetKey());
 
 
   #
diff --git a/testbot/lib/WineTestBot/Users.pm b/testbot/lib/WineTestBot/Users.pm
index 772a2b7e8..bd9cf358b 100644
--- a/testbot/lib/WineTestBot/Users.pm
+++ b/testbot/lib/WineTestBot/Users.pm
@@ -138,8 +138,8 @@ sub Approve($)
     return $ErrMessage;
   }
 
-  my $URL = MakeSecureURL("/ResetPassword.pl?Name=" . uri_escape($self->Name) .
-                          "&ResetCode=" . uri_escape($self->ResetCode));
+  my $URL = MakeOfficialURL("/ResetPassword.pl?Name=". uri_escape($self->Name)
+                            ."&ResetCode=". uri_escape($self->ResetCode));
   my $Recipient = $self->GetEMailRecipient();
   open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
   print SENDMAIL <<"EOF";
@@ -177,8 +177,8 @@ sub SendResetCode($)
     return $ErrMessage;
   }
 
-  my $URL = MakeSecureURL("/ResetPassword.pl?Name=" . uri_escape($self->Name) .
-                          "&ResetCode=" . uri_escape($self->ResetCode));
+  my $URL = MakeOfficialURL("/ResetPassword.pl?Name=". uri_escape($self->Name)
+                            ."&ResetCode=". uri_escape($self->ResetCode));
   my $UserName = $self->Name;
   my $Recipient = $self->GetEMailRecipient();
   open (SENDMAIL, "|/usr/sbin/sendmail -oi -t -odq");
-- 
2.30.2



More information about the wine-devel mailing list