mirror of
https://github.com/vincentmli/bpfire.git
synced 2026-04-28 11:43:25 +02:00
openvpn: Move remving files in /var/run to openvpnctrl
This commit is contained in:
@@ -1237,9 +1237,6 @@ SETTINGS_ERROR:
|
|||||||
while ($file = glob("${General::swroot}/ovpn/n2nconf/*")) {
|
while ($file = glob("${General::swroot}/ovpn/n2nconf/*")) {
|
||||||
system ("rm -rf $file");
|
system ("rm -rf $file");
|
||||||
}
|
}
|
||||||
while ($file = glob("/var/run/openvpn/*-n2n")) {
|
|
||||||
unlink $file;
|
|
||||||
}
|
|
||||||
|
|
||||||
# Remove everything from the collectd configuration
|
# Remove everything from the collectd configuration
|
||||||
&writecollectdconf();
|
&writecollectdconf();
|
||||||
@@ -2362,8 +2359,6 @@ else
|
|||||||
if (-e "${General::swroot}/ovpn/n2nconf/$confighash{$cgiparams{'KEY'}}[1]") {
|
if (-e "${General::swroot}/ovpn/n2nconf/$confighash{$cgiparams{'KEY'}}[1]") {
|
||||||
rmdir ("${General::swroot}/ovpn/n2nconf/$confighash{$cgiparams{'KEY'}}[1]") || die "Kann Verzeichnis nicht loeschen: $!";
|
rmdir ("${General::swroot}/ovpn/n2nconf/$confighash{$cgiparams{'KEY'}}[1]") || die "Kann Verzeichnis nicht loeschen: $!";
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink("/var/run/openvpn/$confighash{$cgiparams{'KEY'}}[1]-n2n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink ("${General::swroot}/ovpn/certs/$confighash{$cgiparams{'KEY'}}[1]cert.pem");
|
unlink ("${General::swroot}/ovpn/certs/$confighash{$cgiparams{'KEY'}}[1]cert.pem");
|
||||||
|
|||||||
@@ -46,6 +46,18 @@ struct connection_struct {
|
|||||||
|
|
||||||
typedef struct connection_struct connection;
|
typedef struct connection_struct connection;
|
||||||
|
|
||||||
|
static int recursive_remove_callback(const char* fpath, const struct stat* sb, int typeflag, struct FTW* ftwbuf) {
|
||||||
|
int rv = remove(fpath);
|
||||||
|
if (rv)
|
||||||
|
perror(fpath);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int recursive_remove(const char* path) {
|
||||||
|
return nftw(path, recursive_remove_callback, 64, FTW_DEPTH | FTW_PHYS);
|
||||||
|
}
|
||||||
|
|
||||||
void exithandler(void)
|
void exithandler(void)
|
||||||
{
|
{
|
||||||
if(kv)
|
if(kv)
|
||||||
@@ -539,6 +551,7 @@ int startNet2Net(char *name) {
|
|||||||
int killNet2Net(char *name) {
|
int killNet2Net(char *name) {
|
||||||
connection *conn = NULL;
|
connection *conn = NULL;
|
||||||
connection *conn_iter;
|
connection *conn_iter;
|
||||||
|
int rc = 0;
|
||||||
|
|
||||||
conn_iter = getConnections();
|
conn_iter = getConnections();
|
||||||
|
|
||||||
@@ -571,22 +584,15 @@ int killNet2Net(char *name) {
|
|||||||
snprintf(command, STRING_SIZE - 1, "/bin/rm -f %s", pidfile);
|
snprintf(command, STRING_SIZE - 1, "/bin/rm -f %s", pidfile);
|
||||||
executeCommand(command);
|
executeCommand(command);
|
||||||
|
|
||||||
|
char runfile[STRING_SIZE];
|
||||||
|
snprintf(runfile, STRING_SIZE - 1, "/var/run/openvpn/%s-n2n", conn->name);
|
||||||
|
rc = recursive_remove(runfile);
|
||||||
|
if (rc)
|
||||||
|
perror(runfile);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int recursive_remove_callback(const char* fpath, const struct stat* sb, int typeflag, struct FTW* ftwbuf) {
|
|
||||||
int rv = remove(fpath);
|
|
||||||
if (rv)
|
|
||||||
perror(fpath);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
static int recursive_remove(const char* path) {
|
|
||||||
return nftw(path, recursive_remove_callback, 64, FTW_DEPTH | FTW_PHYS);
|
|
||||||
}
|
|
||||||
|
|
||||||
int deleterrd(char *name) {
|
int deleterrd(char *name) {
|
||||||
char rrd_dir[STRING_SIZE];
|
char rrd_dir[STRING_SIZE];
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user