On Tue, Jan 10, 2017 at 2:12 PM, David Sommerseth <openvpn@sf.lists.
topphemmelig.net> wrote:

> The attached patch is cleaning up this a bit, avoiding some of the
> scoping and the not really useful 'bool ret' variable.
>


In the patch  you correctly break out of the while() on when man-even-loop
prematurely returns due to signal but do not return false on signal. This
could potentially cause the current remote to be accepted if the UI sends a
signal instead of ACCEPT in answer to  the >REMOTE query.

Here is my suggestion which involves only a very small change:


>     volatile struct connection_entry *ce = &c->options.ce;
> -    int ret = true;
> +
>

leave that as in original


>
>      update_time();
>      if (management)
>      {
> @@ -266,17 +266,14 @@ ce_management_query_remote(struct context *c)
>              management_event_loop_n_seconds(management, 1);
>              if (IS_SIG(c))
>              {
> -                ret = false;
>

leave this as in original


>                  break;
>              }
>          }
>      }
> -    {
> -        const int flags = ((ce->flags>>CE_MAN_QUERY_REMOTE_SHIFT) &
> CE_MAN_QUERY_REMOTE_MASK);
> -        ret = (flags != CE_MAN_QUERY_REMOTE_SKIP);
> -    }
>

Make the above conditional on ret = true -- i.e., if ret has turned false
due to signal do not change it.



>      gc_free(&gc);
> -    return ret;
>

Leave as in original


> +
> +    const int flags = ((ce->flags>>CE_MAN_QUERY_REMOTE_SHIFT) &
> CE_MAN_QUERY_REMOTE_MASK);
> +    return (flags != CE_MAN_QUERY_REMOTE_SKIP);;
>

delete these


>  }

 #endif /* ENABLE_MANAGEMENT */

Selva
------------------------------------------------------------------------------
Developer Access Program for Intel Xeon Phi Processors
Access to Intel Xeon Phi processor-based developer platforms.
With one year of Intel Parallel Studio XE.
Training and support from Colfax.
Order your platform today. http://sdm.link/xeonphi
_______________________________________________
Openvpn-devel mailing list
Openvpn-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openvpn-devel

Reply via email to