Fix management-external-cert option parsing error
PATCH 1/1 Fix management-external-cert option parsing error
- Allow --management-external-cert as an alternative to --cert
- Also make sure --cert and --management-external-cert are not both specified, and clarify in the man page that the latter must be used with --management-external-key.
--- doc/openvpn.8 | 1 + src/openvpn/options.c | 15 +++++++++++---- 2 files changed, 12 insertions(+), 4 deletions(-)
doc/openvpn.8 +1 -0
@@ -2647,6 +2647,7 @@ option (client-only). .B certificate-hint is an arbitrary string which is passed to a management interface client as an argument of NEED-CERTIFICATE notification. +Requires \-\-management\-external\-key. .\"********************************************************* .TP .B \-\-management\-forget\-disconnect
src/openvpn/options.c +11 -4
@@ -2263,6 +2263,13 @@ options_postprocess_verify_ce (const struct options *options, const struct conne {msg (M_USAGE ,"--key and --management-external-key are mutually exclusive" ); } + else if((options->management_flags & MF_EXTERNAL_CERT)) + { +if (options->cert_file) +msg (M_USAGE ,"--cert and --management-external-cert are mutually exclusive" ); +else if (!(options->management_flags &MF_EXTERNAL_KEY )) +msg (M_USAGE ,"--management-external-cert must be used with --management-external-key" ); + } else#endif #ifdef ENABLE_CRYPTOAPI
@@ -2318,14 +2325,14 @@ options_postprocess_verify_ce (const struct options *options, const struct conneif (pull) { -const int sum = (options->cert_file !=NULL ) + +const int sum = #ifdef MANAGMENT_EXTERNAL_KEY - ((options->priv_key_file !=NULL ) || (options->management_flags &MF_EXTERNAL_KEY )); + ((options->cert_file !=NULL ) || (options->management_flags &MF_EXTERNAL_CERT )) + + ((options->priv_key_file !=NULL ) || (options->management_flags &MF_EXTERNAL_KEY ));#else - (options->priv_key_file !=NULL ); + (options->cert_file !=NULL ) + (options->priv_key_file !=NULL );#endif -if (sum ==0 ) {#if P2MP
Signature · 1 line
1.7.10.4
Hi,
Quoted 4 lines · Selva Nair
- Allow --management-external-cert as an alternative to --cert
- Also make sure --cert and --management-external-cert are not both specified, and clarify in the man page that the latter must be used with --management-external-key.
Not being familiar with this particular code section - is this master-only or master + 2.3?
(Proper review to be done later)
gert
Signature · 4 lines
USENET is *not* the non-clickable part of WWW!
//www.muc.de/~gert/
Gert Doering - Munich, Germany [email protected]...
fax: +49-89-35655025 [email protected]...Hi
Quoted 11 lines · Gert Doering
Hi,
Quoted 4 lines · Selva Nair
- Allow --management-external-cert as an alternative to --cert
- Also make sure --cert and --management-external-cert are not both specified, and clarify in the man page that the latter must be used with --management-external-key.Not being familiar with this particular code section - is this master-only or master + 2.3?
This is master only.
Selva
ACK. I wonder when this got broken, or whether it was never fully implemented...
(I feel comfortable ACKing something "crypto-related" because it effectively isn't - it's option parsing, and validating combinations of options that need to be "both there" or "both not there")
Your patch has been applied to the master branch.
commit d023fb661cca578dc977c9bd5e7d681de15e38a3
Author: Selva Nair Date: Thu Jun 16 22:54:53 2016 -0400
Fix management-external-cert option parsing error
Signed-off-by: Selva Nair <[email protected]...>
Acked-by: Gert Doering <[email protected]...>
Message-Id: <[email protected]...>
URL: http://article.gmane.org/gmane.network.openvpn.devel/11929
Signed-off-by: Gert Doering <[email protected]...>--
kind regards,
Gert Doering