summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorSamuel Thibault <samuel.thibault@ens-lyon.org>2014-10-09 23:40:49 +0200
committerDavid Sommerseth <davids@redhat.com>2014-10-14 18:01:47 +0200
commit7da9d40243e0743e2d050ceb6ae34e467dd58973 (patch)
treef9b91d5db4fdd6e05ed4a4184e06a588b5040510 /src
parented5a400e138812cd6572845f4299f61e12716f53 (diff)
downloadopenvpn-7da9d40243e0743e2d050ceb6ae34e467dd58973.tar.gz
openvpn-7da9d40243e0743e2d050ceb6ae34e467dd58973.tar.xz
openvpn-7da9d40243e0743e2d050ceb6ae34e467dd58973.zip
Ensure that client-connect files are always deleted
On a long-running, busy server using either a plug-in which hooks into OPENVPN_PLUGIN_CLIENT_CONNECT or a configuration using --client-connect a lot of unused files will be lingering and potentially filling up the file system with temporary files if the plug-in or --client-connect script fails. This patch ensures that these files are always removed in the end, regardless if the plug-in or script succeeds or fails. Signed-off-by: David Sommerseth <davids@redhat.com> Acked-by: David Sommerseth <davids@redhat.com> Message-Id: 20141012195919.GU3738@type URL: http://thread.gmane.org/gmane.network.openvpn.devel/9104/focus=9118
Diffstat (limited to 'src')
-rw-r--r--src/openvpn/multi.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 5910154..dc96854 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -1459,10 +1459,6 @@ multi_client_connect_post (struct multi_context *m,
option_types_found,
mi->context.c2.es);
- if (!platform_unlink (dc_file))
- msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
- dc_file);
-
/*
* If the --client-connect script generates a config file
* with an --ifconfig-push directive, it will override any
@@ -1705,6 +1701,11 @@ multi_connection_established (struct multi_context *m, struct multi_instance *mi
multi_client_connect_post (m, mi, dc_file, option_permissions_mask, &option_types_found);
++cc_succeeded_count;
}
+
+ if (!platform_unlink (dc_file))
+ msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
+ dc_file);
+
script_depr_failed:
argv_reset (&argv);
}
@@ -1758,6 +1759,11 @@ multi_connection_established (struct multi_context *m, struct multi_instance *mi
}
else
cc_succeeded = false;
+
+ if (!platform_unlink (dc_file))
+ msg (D_MULTI_ERRORS, "MULTI: problem deleting temporary file: %s",
+ dc_file);
+
script_failed:
argv_reset (&argv);
}