* [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates @ 2021-08-24 15:50 Michael Tremer 2021-08-24 15:50 ` [PATCH 2/3] IPsec: Do not interpret $? as error code of move() Michael Tremer ` (2 more replies) 0 siblings, 3 replies; 6+ messages in thread From: Michael Tremer @ 2021-08-24 15:50 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 907 bytes --] Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org> --- html/cgi-bin/vpnmain.cgi | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index d54b56577..980601ba0 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -849,7 +849,7 @@ END print "Content-Disposition: attachment; filename=cacert.pem\r\n\r\n"; my @cert = &General::system_output("/usr/bin/openssl", "x509", "-in", "${General::swroot}/ca/cacert.pem"); - print "@cert"; + print join("", @cert); exit(0); } ### @@ -861,7 +861,7 @@ END print "Content-Disposition: attachment; filename=hostcert.pem\r\n\r\n"; my @cert = &General::system_output("/usr/bin/openssl", "x509", "-in", "${General::swroot}/certs/hostcert.pem"); - print "@cert"; + print join("", @cert); exit(0); } ### -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 2/3] IPsec: Do not interpret $? as error code of move() 2021-08-24 15:50 [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Michael Tremer @ 2021-08-24 15:50 ` Michael Tremer 2021-09-03 16:27 ` Stefan Schantl 2021-08-24 15:50 ` [PATCH 3/3] vpnmain.cgi: " Michael Tremer 2021-09-03 16:26 ` [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Stefan Schantl 2 siblings, 1 reply; 6+ messages in thread From: Michael Tremer @ 2021-08-24 15:50 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 822 bytes --] Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org> --- html/cgi-bin/vpnmain.cgi | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index 980601ba0..e9064e19c 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -2042,9 +2042,8 @@ END unlink ($filename); goto VPNCONF_ERROR; } else { - move($filename, "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem"); - if ($? ne 0) { - $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + unless (move($filename, "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'} ($filename): $!"; unlink ($filename); goto VPNCONF_ERROR; } -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 2/3] IPsec: Do not interpret $? as error code of move() 2021-08-24 15:50 ` [PATCH 2/3] IPsec: Do not interpret $? as error code of move() Michael Tremer @ 2021-09-03 16:27 ` Stefan Schantl 0 siblings, 0 replies; 6+ messages in thread From: Stefan Schantl @ 2021-09-03 16:27 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 1507 bytes --] Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> Tested-by: Stefan Schantl <stefan.schantl(a)ipfire.org> > Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org> > --- > html/cgi-bin/vpnmain.cgi | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi > index 980601ba0..e9064e19c 100644 > --- a/html/cgi-bin/vpnmain.cgi > +++ b/html/cgi-bin/vpnmain.cgi > @@ -2042,9 +2042,8 @@ END > unlink ($filename); > goto VPNCONF_ERROR; > } else { > - move($filename, > "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem"); > - if ($? ne 0) { > - $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + unless (move($filename, > "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'} ($filename): $!"; > unlink ($filename); > goto VPNCONF_ERROR; > } ^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH 3/3] vpnmain.cgi: Do not interpret $? as error code of move() 2021-08-24 15:50 [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Michael Tremer 2021-08-24 15:50 ` [PATCH 2/3] IPsec: Do not interpret $? as error code of move() Michael Tremer @ 2021-08-24 15:50 ` Michael Tremer 2021-09-03 16:27 ` Stefan Schantl 2021-09-03 16:26 ` [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Stefan Schantl 2 siblings, 1 reply; 6+ messages in thread From: Michael Tremer @ 2021-08-24 15:50 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 3235 bytes --] From: Stefan Schantl <stefan.schantl(a)ipfire.org> Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> --- html/cgi-bin/vpnmain.cgi | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi index e9064e19c..7bb0d1b35 100644 --- a/html/cgi-bin/vpnmain.cgi +++ b/html/cgi-bin/vpnmain.cgi @@ -675,8 +675,7 @@ END unlink ($filename); goto UPLOADCA_ERROR; } else { - move($filename, "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem"); - if ($? ne 0) { + unless(move($filename, "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem")) { $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; unlink ($filename); goto UPLOADCA_ERROR; @@ -947,20 +946,23 @@ END if (!$errormessage) { &General::log("ipsec", "Moving cacert..."); - move("/tmp/newcacert", "${General::swroot}/ca/cacert.pem"); - $errormessage = "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); + unless(move("/tmp/newcacert", "${General::swroot}/ca/cacert.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + } } if (!$errormessage) { &General::log("ipsec", "Moving host cert..."); - move("/tmp/newhostcert", "${General::swroot}/certs/hostcert.pem"); - $errormessage = "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); + unless(move("/tmp/newhostcert", "${General::swroot}/certs/hostcert.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + } } if (!$errormessage) { &General::log("ipsec", "Moving private key..."); - move("/tmp/newhostkey", "${General::swroot}/certs/hostkey.pem"); - $errormessage = "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); + unless(move("/tmp/newhostkey", "${General::swroot}/certs/hostkey.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + } } #cleanup temp files @@ -1979,8 +1981,11 @@ END while (grep(/Imported-$idx/, @names) ) {$idx++}; $cgiparams{'CA_NAME'}="Imported-$idx"; $cgiparams{'CERT_NAME'}=&Header::cleanhtml(getCNfromcert ('/tmp/newhostcert')); - move("/tmp/newcacert", "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem"); - $errormessage = "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); + + unless(move("/tmp/newcacert", "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + } + if (!$errormessage) { my $key = &General::findhasharraykey (\%cahash); $cahash{$key}[0] = $cgiparams{'CA_NAME'}; @@ -1993,8 +1998,9 @@ END } if (!$errormessage) { &General::log("ipsec", "Moving host cert..."); - move("/tmp/newhostcert", "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem"); - $errormessage = "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); + unless(move("/tmp/newhostcert", "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) { + $errormessage = "$Lang::tr{'certificate file move failed'}: $!"; + } } #cleanup temp files -- 2.20.1 ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 3/3] vpnmain.cgi: Do not interpret $? as error code of move() 2021-08-24 15:50 ` [PATCH 3/3] vpnmain.cgi: " Michael Tremer @ 2021-09-03 16:27 ` Stefan Schantl 0 siblings, 0 replies; 6+ messages in thread From: Stefan Schantl @ 2021-09-03 16:27 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 6153 bytes --] Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> Tested-by: Stefan Schantl <stefan.schantl(a)ipfire.org> > From: Stefan Schantl <stefan.schantl(a)ipfire.org> > > Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> > --- > html/cgi-bin/vpnmain.cgi | 30 ++++++++++++++++++------------ > 1 file changed, 18 insertions(+), 12 deletions(-) > > diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi > index e9064e19c..7bb0d1b35 100644 > --- a/html/cgi-bin/vpnmain.cgi > +++ b/html/cgi-bin/vpnmain.cgi > @@ -675,8 +675,7 @@ END > unlink ($filename); > goto UPLOADCA_ERROR; > } else { > - move($filename, > "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem"); > - if ($? ne 0) { > + unless(move($filename, > "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem")) { > $errormessage = "$Lang::tr{'certificate file > move failed'}: $!"; > unlink ($filename); > goto UPLOADCA_ERROR; > @@ -947,20 +946,23 @@ END > > if (!$errormessage) { > &General::log("ipsec", "Moving cacert..."); > - move("/tmp/newcacert", > "${General::swroot}/ca/cacert.pem"); > - $errormessage = "$Lang::tr{'certificate file > move failed'}: $!" if ($? ne 0); > + unless(move("/tmp/newcacert", > "${General::swroot}/ca/cacert.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + } > } > > if (!$errormessage) { > &General::log("ipsec", "Moving host > cert..."); > - move("/tmp/newhostcert", > "${General::swroot}/certs/hostcert.pem"); > - $errormessage = "$Lang::tr{'certificate file > move failed'}: $!" if ($? ne 0); > + unless(move("/tmp/newhostcert", > "${General::swroot}/certs/hostcert.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + } > } > > if (!$errormessage) { > &General::log("ipsec", "Moving private > key..."); > - move("/tmp/newhostkey", > "${General::swroot}/certs/hostkey.pem"); > - $errormessage = "$Lang::tr{'certificate file > move failed'}: $!" if ($? ne 0); > + unless(move("/tmp/newhostkey", > "${General::swroot}/certs/hostkey.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + } > } > > #cleanup temp files > @@ -1979,8 +1981,11 @@ END > while (grep(/Imported-$idx/, > @names) ) {$idx++}; > $cgiparams{'CA_NAME'}="Import > ed-$idx"; > $cgiparams{'CERT_NAME'}=&Head > er::cleanhtml(getCNfromcert ('/tmp/newhostcert')); > - move("/tmp/newcacert", > "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem"); > - $errormessage = > "$Lang::tr{'certificate file move failed'}: $!" if ($? ne 0); > + > + unless(move("/tmp/newcacert", > "${General::swroot}/ca/$cgiparams{'CA_NAME'}cert.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + } > + > if (!$errormessage) { > my $key = > &General::findhasharraykey (\%cahash); > $cahash{$key}[0] = > $cgiparams{'CA_NAME'}; > @@ -1993,8 +1998,9 @@ END > } > if (!$errormessage) { > &General::log("ipsec", "Moving host > cert..."); > - move("/tmp/newhostcert", > "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem"); > - $errormessage = "$Lang::tr{'certificate file > move failed'}: $!" if ($? ne 0); > + unless(move("/tmp/newhostcert", > "${General::swroot}/certs/$cgiparams{'NAME'}cert.pem")) { > + $errormessage = > "$Lang::tr{'certificate file move failed'}: $!"; > + } > } > > #cleanup temp files ^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates 2021-08-24 15:50 [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Michael Tremer 2021-08-24 15:50 ` [PATCH 2/3] IPsec: Do not interpret $? as error code of move() Michael Tremer 2021-08-24 15:50 ` [PATCH 3/3] vpnmain.cgi: " Michael Tremer @ 2021-09-03 16:26 ` Stefan Schantl 2 siblings, 0 replies; 6+ messages in thread From: Stefan Schantl @ 2021-09-03 16:26 UTC (permalink / raw) To: development [-- Attachment #1: Type: text/plain, Size: 1368 bytes --] Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org> Tested-by: Stefan Schantl <stefan.schantl(a)ipfire.org> > Signed-off-by: Michael Tremer <michael.tremer(a)ipfire.org> > --- > html/cgi-bin/vpnmain.cgi | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/html/cgi-bin/vpnmain.cgi b/html/cgi-bin/vpnmain.cgi > index d54b56577..980601ba0 100644 > --- a/html/cgi-bin/vpnmain.cgi > +++ b/html/cgi-bin/vpnmain.cgi > @@ -849,7 +849,7 @@ END > print "Content-Disposition: attachment; > filename=cacert.pem\r\n\r\n"; > > my @cert = > &General::system_output("/usr/bin/openssl", "x509", "-in", > "${General::swroot}/ca/cacert.pem"); > - print "@cert"; > + print join("", @cert); > exit(0); > } > ### > @@ -861,7 +861,7 @@ END > print "Content-Disposition: attachment; > filename=hostcert.pem\r\n\r\n"; > > my @cert = > &General::system_output("/usr/bin/openssl", "x509", "-in", > "${General::swroot}/certs/hostcert.pem"); > - print "@cert"; > + print join("", @cert); > exit(0); > } > ### ^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2021-09-03 16:27 UTC | newest] Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2021-08-24 15:50 [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Michael Tremer 2021-08-24 15:50 ` [PATCH 2/3] IPsec: Do not interpret $? as error code of move() Michael Tremer 2021-09-03 16:27 ` Stefan Schantl 2021-08-24 15:50 ` [PATCH 3/3] vpnmain.cgi: " Michael Tremer 2021-09-03 16:27 ` Stefan Schantl 2021-09-03 16:26 ` [PATCH 1/3] IPsec: Fix extra whitespace in exported certificates Stefan Schantl
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox