From: Michael Tremer <michael.tremer@ipfire.org>
To: development@lists.ipfire.org
Subject: [PATCH 2/3] vpnmain.cgi: Return the entire error message if OpenSSL fails
Date: Tue, 30 Jan 2024 17:45:43 +0000 [thread overview]
Message-ID: <20240130174544.3986725-2-michael.tremer@ipfire.org> (raw)
In-Reply-To: <20240130174544.3986725-1-michael.tremer@ipfire.org>
[-- Attachment #1: Type: text/plain, Size: 1185 bytes --]
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(a)ipfire.org>
---
html/cgi-bin/vpnmain.cgi | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi
index 8b05a0de7..d82e6b5c9 100644
--- a/html/cgi-bin/vpnmain.cgi
+++ b/html/cgi-bin/vpnmain.cgi
@@ -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" : '' ;
}
###
--
2.39.2
next prev parent reply other threads:[~2024-01-30 17:45 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-01-30 17:45 [PATCH 1/3] vpnmain.cgi: Do not use a bad source for randomness Michael Tremer
2024-01-30 17:45 ` Michael Tremer [this message]
2024-01-30 17:45 ` [PATCH 3/3] vpnmain.cgi: Add option to regenerate the host certificate Michael Tremer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240130174544.3986725-2-michael.tremer@ipfire.org \
--to=michael.tremer@ipfire.org \
--cc=development@lists.ipfire.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox