This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 2.x development tree".
The branch, master has been updated
via 191347cc465f81898540e6e07fb6c610d87af372 (commit)
via cc79d2810fc81ddd1608803995ead2fe11276271 (commit)
from 9d418afb8ce566f28efa56f01f584ed9cdb633d5 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit 191347cc465f81898540e6e07fb6c610d87af372
Author: Arne Fitzenreiter <arne_f(a)ipfire.org>
Date: Thu Nov 4 08:04:20 2021 +0000
core161: add ovpnmain.cgi
Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>
commit cc79d2810fc81ddd1608803995ead2fe11276271
Author: Stefan Schantl <stefan.schantl(a)ipfire.org>
Date: Wed Nov 3 19:18:55 2021 +0100
ovpnmain.cgi: Do not interpret $? as error code of move()
Signed-off-by: Stefan Schantl <stefan.schantl(a)ipfire.org>
Signed-off-by: Arne Fitzenreiter <arne_f(a)ipfire.org>
-----------------------------------------------------------------------
Summary of changes:
config/rootfiles/core/161/filelists/files | 1 +
html/cgi-bin/ovpnmain.cgi | 41 ++++++++++++-------------------
2 files changed, 17 insertions(+), 25 deletions(-)
Difference in files:
diff --git a/config/rootfiles/core/161/filelists/files b/config/rootfiles/core/161/filelists/files
index 3d0a9d1bd..51f6e5dd3 100644
--- a/config/rootfiles/core/161/filelists/files
+++ b/config/rootfiles/core/161/filelists/files
@@ -7,6 +7,7 @@ etc/suricata/suricata.yaml
opt/pakfire/etc/pakfire.conf
opt/pakfire/lib/functions.pl
srv/web/ipfire/cgi-bin/index.cgi
+srv/web/ipfire/cgi-bin/ovpnmain.cgi
srv/web/ipfire/cgi-bin/pakfire.cgi
srv/web/ipfire/cgi-bin/proxy.cgi
srv/web/ipfire/cgi-bin/qos.cgi
diff --git a/html/cgi-bin/ovpnmain.cgi b/html/cgi-bin/ovpnmain.cgi
index 2ebf384ed..f99bfdef7 100644
--- a/html/cgi-bin/ovpnmain.cgi
+++ b/html/cgi-bin/ovpnmain.cgi
@@ -1432,18 +1432,17 @@ END
unlink ($filename);
goto UPLOADCA_ERROR;
} else {
- # Delete if old key exists
- if (-f "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}") {
- unlink "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}";
+ # Delete if old key exists
+ if (-f "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}") {
+ unlink "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}";
}
- move($filename, "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}");
- if ($? ne 0) {
+
+ unless(move($filename, "${General::swroot}/ovpn/ca/$cgiparams{'DH_NAME'}")) {
$errormessage = "$Lang::tr{'dh key move failed'}: $!";
unlink ($filename);
goto UPLOADCA_ERROR;
- }
+ }
}
-
###
### Upload CA Certificate
###
@@ -1489,8 +1488,7 @@ END
unlink ($filename);
goto UPLOADCA_ERROR;
} else {
- move($filename, "${General::swroot}/ovpn/ca/$cgiparams{'CA_NAME'}cert.pem");
- if ($? ne 0) {
+ unless(move($filename, "${General::swroot}/ovpn/ca/$cgiparams{'CA_NAME'}cert.pem")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
goto UPLOADCA_ERROR;
@@ -1814,8 +1812,7 @@ END
}
}
- move("$tempdir/cacert.pem", "${General::swroot}/ovpn/ca/cacert.pem");
- if ($? ne 0) {
+ unless(move("$tempdir/cacert.pem", "${General::swroot}/ovpn/ca/cacert.pem")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
unlink ("${General::swroot}/ovpn/ca/cacert.pem");
@@ -1824,8 +1821,7 @@ END
goto ROOTCERT_ERROR;
}
- move("$tempdir/hostcert.pem", "${General::swroot}/ovpn/certs/servercert.pem");
- if ($? ne 0) {
+ unless(move("$tempdir/hostcert.pem", "${General::swroot}/ovpn/certs/servercert.pem")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
unlink ("${General::swroot}/ovpn/ca/cacert.pem");
@@ -1834,8 +1830,7 @@ END
goto ROOTCERT_ERROR;
}
- move("$tempdir/serverkey.pem", "${General::swroot}/ovpn/certs/serverkey.pem");
- if ($? ne 0) {
+ unless(move("$tempdir/serverkey.pem", "${General::swroot}/ovpn/certs/serverkey.pem")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
unlink ("${General::swroot}/ovpn/ca/cacert.pem");
@@ -3395,22 +3390,19 @@ END
print FILE "status /var/run/openvpn/$n2nname[0]-n2n 10\n";
close FILE;
- move("$tempdir/$uplconffilename", "${General::swroot}/ovpn/n2nconf/$n2nname[0]/$uplconffilename2");
-
- if ($? ne 0) {
+ unless(move("$tempdir/$uplconffilename", "${General::swroot}/ovpn/n2nconf/$n2nname[0]/$uplconffilename2")) {
$errormessage = "*.conf move failed: $!";
unlink ($filename);
goto N2N_ERROR;
}
- move("$tempdir/$uplp12name", "${General::swroot}/ovpn/certs/$uplp12name2");
- chmod 0600, "${General::swroot}/ovpn/certs/$uplp12name";
-
- if ($? ne 0) {
+ unless(move("$tempdir/$uplp12name", "${General::swroot}/ovpn/certs/$uplp12name2")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
goto N2N_ERROR;
- }
+ }
+
+ chmod 0600, "${General::swroot}/ovpn/certs/$uplp12name";
my $complzoactive;
my $mssfixactive;
@@ -4175,8 +4167,7 @@ if ($cgiparams{'TYPE'} eq 'net') {
unlink ($filename);
goto VPNCONF_ERROR;
} else {
- move($filename, "${General::swroot}/ovpn/certs/$cgiparams{'NAME'}cert.pem");
- if ($? ne 0) {
+ unless(move($filename, "${General::swroot}/ovpn/certs/$cgiparams{'NAME'}cert.pem")) {
$errormessage = "$Lang::tr{'certificate file move failed'}: $!";
unlink ($filename);
goto VPNCONF_ERROR;
hooks/post-receive
--
IPFire 2.x development tree