summaryrefslogtreecommitdiffstats
path: root/pf.c
diff options
context:
space:
mode:
authorDavid Sommerseth <dazo@users.sourceforge.net>2010-04-16 22:09:48 +0200
committerDavid Sommerseth <dazo@users.sourceforge.net>2010-10-21 11:37:03 +0200
commit495e3cec5d15655058cd70983b8a0d65bd403d84 (patch)
tree0d3079adfccdb24f3c4e1cd192ebf05882f23ded /pf.c
parent4e1cc5f6dda22e9ff121d3753066775c25448bcc (diff)
downloadopenvpn-495e3cec5d15655058cd70983b8a0d65bd403d84.tar.gz
openvpn-495e3cec5d15655058cd70983b8a0d65bd403d84.tar.xz
openvpn-495e3cec5d15655058cd70983b8a0d65bd403d84.zip
Renamed all calls to create_temp_filename()
All places where create_temp_filename() was called are now calling create_temp_file(). Extra checks on the result of create_temp_file() is added in addition. Signed-off-by: David Sommerseth <dazo@users.sourceforge.net> Acked-by: Gert Doering <gert@greenie.muc.de>
Diffstat (limited to 'pf.c')
-rw-r--r--pf.c33
1 files changed, 17 insertions, 16 deletions
diff --git a/pf.c b/pf.c
index a27de4b..3ce2ef2 100644
--- a/pf.c
+++ b/pf.c
@@ -554,24 +554,25 @@ pf_init_context (struct context *c)
#ifdef PLUGIN_PF
if (plugin_defined (c->plugins, OPENVPN_PLUGIN_ENABLE_PF))
{
- const char *pf_file = create_temp_filename (c->options.tmp_dir, "pf", &gc);
- delete_file (pf_file);
- setenv_str (c->c2.es, "pf_file", pf_file);
-
- if (plugin_call (c->plugins, OPENVPN_PLUGIN_ENABLE_PF, NULL, NULL, c->c2.es) == OPENVPN_PLUGIN_FUNC_SUCCESS)
- {
- event_timeout_init (&c->c2.pf.reload, 1, now);
- c->c2.pf.filename = string_alloc (pf_file, NULL);
- c->c2.pf.enabled = true;
+ const char *pf_file = create_temp_file (c->options.tmp_dir, "pf", &gc);
+ if( pf_file ) {
+ setenv_str (c->c2.es, "pf_file", pf_file);
+
+ if (plugin_call (c->plugins, OPENVPN_PLUGIN_ENABLE_PF, NULL, NULL, c->c2.es) == OPENVPN_PLUGIN_FUNC_SUCCESS)
+ {
+ event_timeout_init (&c->c2.pf.reload, 1, now);
+ c->c2.pf.filename = string_alloc (pf_file, NULL);
+ c->c2.pf.enabled = true;
#ifdef ENABLE_DEBUG
- if (check_debug_level (D_PF_DEBUG))
- pf_context_print (&c->c2.pf, "pf_init_context#1", D_PF_DEBUG);
+ if (check_debug_level (D_PF_DEBUG))
+ pf_context_print (&c->c2.pf, "pf_init_context#1", D_PF_DEBUG);
#endif
- }
- else
- {
- msg (M_WARN, "WARNING: OPENVPN_PLUGIN_ENABLE_PF disabled");
- }
+ }
+ else
+ {
+ msg (M_WARN, "WARNING: OPENVPN_PLUGIN_ENABLE_PF disabled");
+ }
+ }
}
#endif
#ifdef MANAGEMENT_PF