]> git.ipfire.org Git - ipfire-2.x.git/commitdiff
vpnmain.cgi: Return the entire error message if OpenSSL fails
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 30 Jan 2024 17:45:43 +0000 (17:45 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Wed, 7 Feb 2024 11:07:53 +0000 (11:07 +0000)
The function did not evaluate the return code which is why it used a
hack to figure out if some output is an error or not.

This is being fixed in this commit and the entire output is being
returned if the return code is non-zero.

Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
html/cgi-bin/vpnmain.cgi

index 8b05a0de7915b014f656303c1328f827b46e725d..d82e6b5c9426082829276c761a27bfa3e7a57a0c 100644 (file)
@@ -229,13 +229,14 @@ sub callssl ($) {
        my $opt = shift;
        my $retssl = `/usr/bin/openssl $opt 2>&1`; #redirect stderr
        my $ret = '';
-       foreach my $line (split (/\n/, $retssl)) {
-               &General::log("ipsec", "$line") if (0); # 1 for verbose logging
-               $ret .= '<br>'.$line if ( $line =~ /error|unknown/ );
-       }
-       if ($ret) {
-               $ret= &Header::cleanhtml($ret);
+
+       if ($?) {
+               foreach my $line (split (/\n/, $retssl)) {
+                       &General::log("ipsec", "$line") if (0); # 1 for verbose logging
+                       $ret .= '<br>' . &Header::escape($line);
+               }
        }
+
        return $ret ? "$Lang::tr{'openssl produced an error'}: $ret" : '' ;
 }
 ###