Hi,

On 15/09/17 05:34, Steffan Karger wrote:
> close_instance() tries to remove the file in c2.pf.filename, but that only
> works if we actually set that if we fail.  So, set that filename as soon
> as we know we've created the file.
> 
> Signed-off-by: Steffan Karger <steffan.kar...@fox-it.com>
> ---
>  src/openvpn/pf.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/openvpn/pf.c b/src/openvpn/pf.c
> index 5fe1734..3faaebd 100644
> --- a/src/openvpn/pf.c
> +++ b/src/openvpn/pf.c
> @@ -625,12 +625,12 @@ pf_init_context(struct context *c)
>          const char *pf_file = create_temp_file(c->options.tmp_dir, "pf", 
> &gc);

what prevents us from calling create_temp_file() directly with
c->c2.pf.filename and &c->c2.gc as arguments?

Cheers,

>          if (pf_file)
>          {
> +            c->c2.pf.filename = string_alloc(pf_file, &c->c2.gc);
>              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, &c->c2.gc);
>                  c->c2.pf.enabled = true;
>  #ifdef ENABLE_DEBUG
>                  if (check_debug_level(D_PF_DEBUG))
> 

-- 
Antonio Quartulli

Attachment: signature.asc
Description: OpenPGP digital signature

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to