]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
gnutls-serv: make --disable-client-cert and --require-client-cert options incompatible
authorNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 2 Jul 2018 06:10:45 +0000 (08:10 +0200)
committerNikos Mavrogiannopoulos <nmav@redhat.com>
Mon, 2 Jul 2018 06:11:18 +0000 (08:11 +0200)
That is refuse to run when both options are specified.

Resolves #502

Signed-off-by: Nikos Mavrogiannopoulos <nmav@redhat.com>
src/serv-args.c.bak
src/serv-args.def

index f697eb5eb16dafdaf5d4cdc9aa36221b780f5aba..e0896afbc3f7e86665938fc249a51f66bdd6e8f4 100644 (file)
@@ -395,7 +395,8 @@ static char const gnutls_serv_opt_strs[3442] =
         | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
 
 /**
- *  disable-client-cert option description:
+ *  disable-client-cert option description with
+ *  "Must also have options" and "Incompatible options":
  */
 /** Descriptive text for the disable-client-cert option */
 #define DISABLE_CLIENT_CERT_DESC      (gnutls_serv_opt_strs+1627)
@@ -403,6 +404,9 @@ static char const gnutls_serv_opt_strs[3442] =
 #define DISABLE_CLIENT_CERT_NAME      (gnutls_serv_opt_strs+1663)
 /** Name string for the disable-client-cert option */
 #define DISABLE_CLIENT_CERT_name      (gnutls_serv_opt_strs+1683)
+/** Other options that appear in conjunction with the disable-client-cert option */
+static int const aDisable_Client_CertCantList[] = {
+    INDEX_OPT_REQUIRE_CLIENT_CERT, NO_EQUIVALENT };
 /** Compiled in flag settings for the disable-client-cert option */
 #define DISABLE_CLIENT_CERT_FLAGS     (OPTST_DISABLED)
 
@@ -936,7 +940,7 @@ static tOptDesc optDesc[OPTION_CT] = {
      /* opt state flags  */ DISABLE_CLIENT_CERT_FLAGS, 0,
      /* last opt argumnt */ { NULL }, /* --disable-client-cert */
      /* arg list/cookie  */ NULL,
-     /* must/cannot opts */ NULL, NULL,
+     /* must/cannot opts */ NULL, aDisable_Client_CertCantList,
      /* option proc      */ NULL,
      /* desc, NAME, name */ DISABLE_CLIENT_CERT_DESC, DISABLE_CLIENT_CERT_NAME, DISABLE_CLIENT_CERT_name,
      /* disablement strs */ NULL, NULL },
index 5f133ed617f63f6d590e1fffb8c2752ba883f673..e7bb574d2ea640b4b736f1234e47323e50f5c494 100644 (file)
@@ -107,6 +107,7 @@ flag = {
     value     = a;
     descrip   = "Do not request a client certificate";
     doc      = "";
+    flags-cant = require-client-cert;
 };
 
 flag = {