3. clean client connect defered ret file when close instance.

diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
index 27c6e935..7291d651 100644
--- a/src/openvpn/multi.c
+++ b/src/openvpn/multi.c
@@ -685,6 +685,9 @@ multi_close_instance(struct multi_context *m,
     set_cc_config(mi, NULL);
 #endif

+    // client connect deferred ret file delete
+    ccs_delete_deferred_ret_file(mi);
+
     multi_client_disconnect_script(m, mi);

     if (mi->did_open_context)
wei wang <lny...@gmail.com> 于2019年4月22日周一 下午5:26写道:
>
> 1. When client-connect tests whether the user has written the
> configuration, we should check to see if the file size is 0, not
> whether the file exists.
>     Because the configuration file is created by openvpn itself.
> 2. multi_client_connect_early_setup should be called for the first time.
>
> diff --git a/src/openvpn/multi.c b/src/openvpn/multi.c
> index 697994b8..27c6e935 100644
> --- a/src/openvpn/multi.c
> +++ b/src/openvpn/multi.c
> @@ -1641,9 +1641,13 @@ multi_client_connect_post(struct multi_context *m,
>                            const char *dc_file,
>                            unsigned int *option_types_found)
>  {
> -    /* Did script generate a dynamic config file? */
> -    if (platform_test_file(dc_file))
> -    {
> +    /* Did script write config to dynamic config file? */
> +    platform_stat_t dc_stat = {0};
> +    if (platform_stat(dc_file, &dc_stat) < 0) {
> +        return;
> +    }
> +
> +    if (dc_stat.st_size > 0) {
>          options_server_import(&mi->context.options,
>                                dc_file,
>                                D_IMPORT_ERRORS|M_OPTERR,
> @@ -2474,13 +2478,13 @@ multi_connection_established(struct
> multi_context *m, struct multi_instance *mi)
>              /* Initially we have no handler that has returned a result */
>              mi->client_connect_status = CC_STATUS_DEFERRED_NO_RESULT;
>              from_deferred = false;
> +            multi_client_connect_early_setup(m, mi);
>          }
>          else
>          {
>              from_deferred = true;
>          }
>
> -        multi_client_connect_early_setup(m, mi);
>
>          bool cc_succeeded = true;
>
> Gert Doering <g...@greenie.muc.de> 于2019年4月20日周六 下午11:07写道:
> >
> > Hi,
> >
> > On Sat, Apr 20, 2019 at 04:37:03PM +0800, wei wang wrote:
> > > I have found that the patch set
> > > "https://patchwork.openvpn.net/project/openvpn2/list/?series=413"; has
> > > implement it.
> > > But it has not been updated for several months. Is there someone still
> > > work on it?  We test with it for client-connect script, and find some
> > > bug.
> > > I am very happy to provide if needed.
> >
> > We're working on reviewing, fixing and merging it.
> >
> > So if you have feedback or even found a bug, please send it in (preferrably
> > in reply to the original mail, so patchwork can pick it up, but just here
> > in the thread is good enough).
> >
> > gert
> > --
> > "If was one thing all people took for granted, was conviction that if you
> >  feed honest figures into a computer, honest figures come out. Never doubted
> >  it myself till I met a computer with a sense of humor."
> >                              Robert A. Heinlein, The Moon is a Harsh 
> > Mistress
> >
> > Gert Doering - Munich, Germany                             
> > g...@greenie.muc.de
>
>
>
> --
> Regards,
> Wang Wei



-- 
Regards,
Wang Wei


_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to