summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2005-10-30 16:52:43 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2005-10-30 16:52:43 +0000
commit5a660c73236b7b48e46646f7181b9a3827a1f15e (patch)
tree677b45b2db22a796300a07cc91dddefd345a4745
parenteb435f6437dcfbbeecec78b9ca67af22290863f1 (diff)
downloadgnutls-5a660c73236b7b48e46646f7181b9a3827a1f15e.tar.gz
added the --require-cert option to gnutls-serv
-rw-r--r--src/serv-gaa.c1659
-rw-r--r--src/serv-gaa.h30
-rw-r--r--src/serv.c7
-rw-r--r--src/serv.gaa5
4 files changed, 827 insertions, 874 deletions
diff --git a/src/serv-gaa.c b/src/serv-gaa.c
index 8c7972cf5f..7b010600a6 100644
--- a/src/serv-gaa.c
+++ b/src/serv-gaa.c
@@ -19,148 +19,147 @@ void serv_version(void);
#endif
#endif
-static void *gaa_malloc(size_t size)
-{
- void *ret;
- ret = malloc(size);
- if (ret == NULL) {
- fprintf(stderr, "gaa: could not allocate memory");
- exit(1);
- }
- return ret;
+static void* gaa_malloc( size_t size) {
+void* ret;
+ ret = malloc(size);
+ if (ret==NULL) {
+ fprintf(stderr, "gaa: could not allocate memory");
+ exit(1);
+ }
+ return ret;
}
-static void __gaa_helpsingle(char short_name, char *name,
- char *arg_desc, char *opt_help)
+static void __gaa_helpsingle(char short_name, char *name,
+ char *arg_desc, char *opt_help)
{
- int col1, col3, col4, tabsize = 3, curr;
- int i;
-
- col1 = 5; /* Default values */
- col3 = 30;
- col4 = 70;
-
- curr = 0;
- for (i = 0; i < col1; i++) {
- printf(" ");
- curr++;
- }
- if (short_name) {
- if (name && *name) {
- printf("-%c, ", short_name);
- curr += 4;
- } else {
- printf("-%c ", short_name);
- curr += 3;
- }
- }
- if (name && *name) {
- printf("--%s ", name);
- curr += 3 + strlen(name);
- }
- if (arg_desc && *arg_desc) {
- printf("%s ", arg_desc);
- curr += 1 + strlen(arg_desc);
- }
- if (curr >= col3) {
- printf("\n");
- curr = 0;
- }
- if (opt_help) { /* let's print the option's help body */
- const char *str = opt_help;
- while (*str) {
- while (curr < col3) {
- printf(" ");
- curr++;
- }
- switch (*str) {
- case '\n':
- printf("\n");
- curr = 0;
- break;
- case '\t':
- do {
- printf(" ");
- curr++;
- }
- while ((curr - col3) % tabsize != 0 && curr < col4);
- case ' ':
- if (*str == ' ') {
- curr++;
- printf(" ");
- }
- for (i = 1; str[i] && str[i] != ' ' && str[i] != '\n'
- && str[i] != '\t'; i++);
- if (curr + i - 1 >= col4)
- curr = col4;
- break;
- default:
- printf("%c", *str);
- curr++;
- }
- if (curr >= col4) {
- printf("\n");
- curr = 0;
- }
- str++;
- }
- }
- printf("\n");
+ int col1, col3, col4, tabsize = 3, curr;
+ int i;
+
+ col1 = 5; /* Default values */
+ col3 = 30;
+ col4 = 70;
+
+ curr = 0;
+ for(i = 0; i < col1; i++)
+ {
+ printf(" ");
+ curr++;
+ }
+ if(short_name)
+ {
+ if(name && *name)
+ {
+ printf("-%c, ", short_name);
+ curr += 4;
+ }
+ else
+ {
+ printf("-%c ", short_name);
+ curr += 3;
+ }
+ }
+ if(name && *name)
+ {
+ printf("--%s ", name);
+ curr += 3 + strlen(name);
+ }
+ if(arg_desc && *arg_desc)
+ {
+ printf("%s ", arg_desc);
+ curr += 1 + strlen(arg_desc);
+ }
+ if(curr >= col3)
+ {
+ printf("\n");
+ curr = 0;
+ }
+ if(opt_help) /* let's print the option's help body */
+ {
+ const char *str = opt_help;
+ while(*str)
+ {
+ while(curr < col3)
+ {
+ printf(" ");
+ curr++;
+ }
+ switch(*str)
+ {
+ case '\n':
+ printf("\n");
+ curr = 0;
+ break;
+ case '\t':
+ do
+ {
+ printf(" ");
+ curr++;
+ }
+ while((curr - col3) % tabsize != 0 && curr < col4);
+ case ' ':
+ if(*str == ' ')
+ {
+ curr++;
+ printf(" ");
+ }
+ for(i = 1; str[i] && str[i] != ' ' && str[i] != '\n'
+ && str[i] != '\t'; i++);
+ if(curr + i - 1 >= col4)
+ curr = col4;
+ break;
+ default:
+ printf("%c", *str);
+ curr++;
+ }
+ if(curr >= col4)
+ {
+ printf("\n");
+ curr = 0;
+ }
+ str++;
+ }
+ }
+ printf("\n");
}
void gaa_help(void)
{
- printf("GNU TLS test server\nUsage: gnutls-serv [options]\n\n\n");
- __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
- __gaa_helpsingle('g', "generate", "",
- "Generate Diffie Hellman Parameters.");
- __gaa_helpsingle('p', "port", "integer ", "The port to connect to.");
- __gaa_helpsingle('q', "quiet", "", "Suppress some messages.");
- __gaa_helpsingle(0, "nodb", "", "Does not use the resume database.");
- __gaa_helpsingle(0, "http", "", "Act as an HTTP Server.");
- __gaa_helpsingle(0, "echo", "", "Act as an Echo Server.");
- __gaa_helpsingle(0, "dhparams", "FILE ", "DH params file to use.");
- __gaa_helpsingle(0, "x509fmtder", "",
- "Use DER format for certificates");
- __gaa_helpsingle(0, "x509cafile", "FILE ", "Certificate file to use.");
- __gaa_helpsingle(0, "x509crlfile", "FILE ", "CRL file to use.");
- __gaa_helpsingle(0, "pgpkeyring", "FILE ",
- "PGP Key ring file to use.");
- __gaa_helpsingle(0, "pgptrustdb", "FILE ", "PGP trustdb file to use.");
- __gaa_helpsingle(0, "pgpkeyfile", "FILE ", "PGP Key file to use.");
- __gaa_helpsingle(0, "pgpcertfile", "FILE ",
- "PGP Public Key (certificate) file to use.");
- __gaa_helpsingle(0, "x509keyfile", "FILE ", "X.509 key file to use.");
- __gaa_helpsingle(0, "x509certfile", "FILE ",
- "X.509 Certificate file to use.");
- __gaa_helpsingle(0, "x509dsakeyfile", "FILE ",
- "Alternative X.509 key file to use.");
- __gaa_helpsingle(0, "x509dsacertfile", "FILE ",
- "Alternative X.509 certificate file to use.");
- __gaa_helpsingle(0, "srppasswd", "FILE ", "SRP password file to use.");
- __gaa_helpsingle(0, "srppasswdconf", "FILE ",
- "SRP password conf file to use.");
- __gaa_helpsingle(0, "ciphers", "cipher1 cipher2... ",
- "Ciphers to enable.");
- __gaa_helpsingle(0, "protocols", "protocol1 protocol2... ",
- "Protocols to enable.");
- __gaa_helpsingle(0, "comp", "comp1 comp2... ",
- "Compression methods to enable.");
- __gaa_helpsingle(0, "macs", "mac1 mac2... ", "MACs to enable.");
- __gaa_helpsingle(0, "kx", "kx1 kx2... ",
- "Key exchange methods to enable.");
- __gaa_helpsingle(0, "ctypes", "certType1 certType2... ",
- "Certificate types to enable.");
- __gaa_helpsingle('l', "list", "",
- "Print a list of the supported algorithms and modes.");
- __gaa_helpsingle('h', "help", "", "prints this help");
- __gaa_helpsingle('v', "version", "",
- "prints the program's version number");
- __gaa_helpsingle(0, "copyright", "", "prints the program's license");
+ printf("GNU TLS test server\nUsage: gnutls-serv [options]\n\n\n");
+ __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
+ __gaa_helpsingle('g', "generate", "", "Generate Diffie Hellman Parameters.");
+ __gaa_helpsingle('p', "port", "integer ", "The port to connect to.");
+ __gaa_helpsingle('q', "quiet", "", "Suppress some messages.");
+ __gaa_helpsingle(0, "nodb", "", "Does not use the resume database.");
+ __gaa_helpsingle(0, "http", "", "Act as an HTTP Server.");
+ __gaa_helpsingle(0, "echo", "", "Act as an Echo Server.");
+ __gaa_helpsingle(0, "dhparams", "FILE ", "DH params file to use.");
+ __gaa_helpsingle(0, "x509fmtder", "", "Use DER format for certificates");
+ __gaa_helpsingle(0, "x509cafile", "FILE ", "Certificate file to use.");
+ __gaa_helpsingle(0, "x509crlfile", "FILE ", "CRL file to use.");
+ __gaa_helpsingle(0, "pgpkeyring", "FILE ", "PGP Key ring file to use.");
+ __gaa_helpsingle(0, "pgptrustdb", "FILE ", "PGP trustdb file to use.");
+ __gaa_helpsingle(0, "pgpkeyfile", "FILE ", "PGP Key file to use.");
+ __gaa_helpsingle(0, "pgpcertfile", "FILE ", "PGP Public Key (certificate) file to use.");
+ __gaa_helpsingle(0, "x509keyfile", "FILE ", "X.509 key file to use.");
+ __gaa_helpsingle(0, "x509certfile", "FILE ", "X.509 Certificate file to use.");
+ __gaa_helpsingle(0, "x509dsakeyfile", "FILE ", "Alternative X.509 key file to use.");
+ __gaa_helpsingle(0, "x509dsacertfile", "FILE ", "Alternative X.509 certificate file to use.");
+ __gaa_helpsingle(0, "require-cert", "", "Require a valid certificate.");
+ __gaa_helpsingle(0, "srppasswd", "FILE ", "SRP password file to use.");
+ __gaa_helpsingle(0, "srppasswdconf", "FILE ", "SRP password conf file to use.");
+ __gaa_helpsingle(0, "ciphers", "cipher1 cipher2... ", "Ciphers to enable.");
+ __gaa_helpsingle(0, "protocols", "protocol1 protocol2... ", "Protocols to enable.");
+ __gaa_helpsingle(0, "comp", "comp1 comp2... ", "Compression methods to enable.");
+ __gaa_helpsingle(0, "macs", "mac1 mac2... ", "MACs to enable.");
+ __gaa_helpsingle(0, "kx", "kx1 kx2... ", "Key exchange methods to enable.");
+ __gaa_helpsingle(0, "ctypes", "certType1 certType2... ", "Certificate types to enable.");
+ __gaa_helpsingle('l', "list", "", "Print a list of the supported algorithms and modes.");
+ __gaa_helpsingle('h', "help", "", "prints this help");
+ __gaa_helpsingle('v', "version", "", "prints the program's version number");
+ __gaa_helpsingle(0, "copyright", "", "prints the program's license");
#line 100 "gaa.skel"
}
-
/* Copy of C area */
#line 104 "gaa.skel"
@@ -170,96 +169,106 @@ void gaa_help(void)
typedef struct _gaainfo gaainfo;
-struct _gaainfo {
-#line 95 "serv.gaa"
- char **ctype;
+struct _gaainfo
+{
+#line 98 "serv.gaa"
+ char **ctype;
+#line 97 "serv.gaa"
+ int nctype;
#line 94 "serv.gaa"
- int nctype;
-#line 91 "serv.gaa"
- char **kx;
+ char **kx;
+#line 93 "serv.gaa"
+ int nkx;
#line 90 "serv.gaa"
- int nkx;
-#line 87 "serv.gaa"
- char **macs;
+ char **macs;
+#line 89 "serv.gaa"
+ int nmacs;
#line 86 "serv.gaa"
- int nmacs;
-#line 83 "serv.gaa"
- char **comp;
+ char **comp;
+#line 85 "serv.gaa"
+ int ncomp;
#line 82 "serv.gaa"
- int ncomp;
-#line 79 "serv.gaa"
- char **proto;
+ char **proto;
+#line 81 "serv.gaa"
+ int nproto;
#line 78 "serv.gaa"
- int nproto;
-#line 75 "serv.gaa"
- char **ciphers;
-#line 74 "serv.gaa"
- int nciphers;
+ char **ciphers;
+#line 77 "serv.gaa"
+ int nciphers;
+#line 73 "serv.gaa"
+ char *srp_passwd_conf;
#line 70 "serv.gaa"
- char *srp_passwd_conf;
+ char *srp_passwd;
#line 67 "serv.gaa"
- char *srp_passwd;
+ int require_cert;
#line 64 "serv.gaa"
- char *x509_dsacertfile;
+ char *x509_dsacertfile;
#line 61 "serv.gaa"
- char *x509_dsakeyfile;
+ char *x509_dsakeyfile;
#line 58 "serv.gaa"
- char *x509_certfile;
+ char *x509_certfile;
#line 55 "serv.gaa"
- char *x509_keyfile;
+ char *x509_keyfile;
#line 52 "serv.gaa"
- char *pgp_certfile;
+ char *pgp_certfile;
#line 49 "serv.gaa"
- char *pgp_keyfile;
+ char *pgp_keyfile;
#line 46 "serv.gaa"
- char *pgp_trustdb;
+ char *pgp_trustdb;
#line 43 "serv.gaa"
- char *pgp_keyring;
+ char *pgp_keyring;
#line 40 "serv.gaa"
- char *x509_crlfile;
+ char *x509_crlfile;
#line 37 "serv.gaa"
- char *x509_cafile;
+ char *x509_cafile;
#line 34 "serv.gaa"
- int fmtder;
+ int fmtder;
#line 31 "serv.gaa"
- char *dh_params_file;
+ char *dh_params_file;
#line 27 "serv.gaa"
- int http;
+ int http;
#line 24 "serv.gaa"
- int nodb;
+ int nodb;
#line 21 "serv.gaa"
- int quiet;
+ int quiet;
#line 18 "serv.gaa"
- int port;
+ int port;
#line 15 "serv.gaa"
- int generate;
+ int generate;
#line 12 "serv.gaa"
- int debug;
+ int debug;
#line 114 "gaa.skel"
};
#ifdef __cplusplus
-extern "C" {
+extern "C"
+{
#endif
- int gaa(int argc, char *argv[], gaainfo * gaaval);
+ int gaa(int argc, char *argv[], gaainfo *gaaval);
void gaa_help(void);
-
- int gaa_file(const char *name, gaainfo * gaaval);
-
+
+ int gaa_file(const char *name, gaainfo *gaaval);
+
#ifdef __cplusplus
}
#endif
+
+
#endif
+
#line 135 "gaa.skel"
+
/* C declarations */
+
#define GAAERROR(x) \
{ \
gaa_error = 1; \
return x; \
}
+
static char *gaa_current_option;
static int gaa_error = 0;
@@ -282,7 +291,7 @@ static int gaa_error = 0;
#define GAA_MULTIPLE_OPTION 3
#define GAA_REST 0
-#define GAA_NB_OPTION 31
+#define GAA_NB_OPTION 32
#define GAAOPTID_copyright 1
#define GAAOPTID_version 2
#define GAAOPTID_help 3
@@ -295,25 +304,26 @@ static int gaa_error = 0;
#define GAAOPTID_ciphers 10
#define GAAOPTID_srppasswdconf 11
#define GAAOPTID_srppasswd 12
-#define GAAOPTID_x509dsacertfile 13
-#define GAAOPTID_x509dsakeyfile 14
-#define GAAOPTID_x509certfile 15
-#define GAAOPTID_x509keyfile 16
-#define GAAOPTID_pgpcertfile 17
-#define GAAOPTID_pgpkeyfile 18
-#define GAAOPTID_pgptrustdb 19
-#define GAAOPTID_pgpkeyring 20
-#define GAAOPTID_x509crlfile 21
-#define GAAOPTID_x509cafile 22
-#define GAAOPTID_x509fmtder 23
-#define GAAOPTID_dhparams 24
-#define GAAOPTID_echo 25
-#define GAAOPTID_http 26
-#define GAAOPTID_nodb 27
-#define GAAOPTID_quiet 28
-#define GAAOPTID_port 29
-#define GAAOPTID_generate 30
-#define GAAOPTID_debug 31
+#define GAAOPTID_require_cert 13
+#define GAAOPTID_x509dsacertfile 14
+#define GAAOPTID_x509dsakeyfile 15
+#define GAAOPTID_x509certfile 16
+#define GAAOPTID_x509keyfile 17
+#define GAAOPTID_pgpcertfile 18
+#define GAAOPTID_pgpkeyfile 19
+#define GAAOPTID_pgptrustdb 20
+#define GAAOPTID_pgpkeyring 21
+#define GAAOPTID_x509crlfile 22
+#define GAAOPTID_x509cafile 23
+#define GAAOPTID_x509fmtder 24
+#define GAAOPTID_dhparams 25
+#define GAAOPTID_echo 26
+#define GAAOPTID_http 27
+#define GAAOPTID_nodb 28
+#define GAAOPTID_quiet 29
+#define GAAOPTID_port 30
+#define GAAOPTID_generate 31
+#define GAAOPTID_debug 32
#line 168 "gaa.skel"
@@ -356,7 +366,7 @@ if(gaa_error == 1) \
{ \
gaa_error = 0; \
return GAA_ERROR_INVALID_ARG; \
-}
+}
@@ -434,7 +444,7 @@ if(k == 0) \
printf("You must give at least one option of '%s'\n", str); \
return 0; \
}
-
+
#define GAA_INCOMP(str) \
k = 0; \
for(i = 0; i < strlen(str); i++) \
@@ -453,7 +463,7 @@ if(k > 1) \
printf("The options '%s' are incompatible\n", str); \
return 0; \
}
-
+
static char **GAAargv;
static int GAAargc;
@@ -465,25 +475,25 @@ static int gaa_getint(char *arg)
{
int tmp;
char a;
- if (sscanf(arg, "%d%c", &tmp, &a) < 1) {
- printf("Option %s: '%s' isn't an integer\n", gaa_current_option,
- arg);
- GAAERROR(-1);
+ if(sscanf(arg, "%d%c", &tmp, &a) < 1)
+ {
+ printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg);
+ GAAERROR(-1);
}
return tmp;
}
static char gaa_getchar(char *arg)
{
- if (strlen(arg) != 1) {
- printf("Option %s: '%s' isn't an character\n", gaa_current_option,
- arg);
- GAAERROR(-1);
+ if(strlen(arg) != 1)
+ {
+ printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg);
+ GAAERROR(-1);
}
return arg[0];
}
-static char *gaa_getstr(char *arg)
+static char* gaa_getstr(char *arg)
{
return arg;
}
@@ -491,251 +501,273 @@ static float gaa_getfloat(char *arg)
{
float tmp;
char a;
- if (sscanf(arg, "%f%c", &tmp, &a) < 1) {
- printf("Option %s: '%s' isn't a float number\n",
- gaa_current_option, arg);
- GAAERROR(-1);
+ if(sscanf(arg, "%f%c", &tmp, &a) < 1)
+ {
+ printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg);
+ GAAERROR(-1);
}
return tmp;
}
-
/* option structures */
-struct GAAOPTION_ctypes {
- char **arg1;
- int size1;
+struct GAAOPTION_ctypes
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_kx {
- char **arg1;
- int size1;
+struct GAAOPTION_kx
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_macs {
- char **arg1;
- int size1;
+struct GAAOPTION_macs
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_comp {
- char **arg1;
- int size1;
+struct GAAOPTION_comp
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_protocols {
- char **arg1;
- int size1;
+struct GAAOPTION_protocols
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_ciphers {
- char **arg1;
- int size1;
+struct GAAOPTION_ciphers
+{
+ char** arg1;
+ int size1;
};
-struct GAAOPTION_srppasswdconf {
- char *arg1;
- int size1;
+struct GAAOPTION_srppasswdconf
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_srppasswd {
- char *arg1;
- int size1;
+struct GAAOPTION_srppasswd
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509dsacertfile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509dsacertfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509dsakeyfile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509dsakeyfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509certfile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509certfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509keyfile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509keyfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_pgpcertfile {
- char *arg1;
- int size1;
+struct GAAOPTION_pgpcertfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_pgpkeyfile {
- char *arg1;
- int size1;
+struct GAAOPTION_pgpkeyfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_pgptrustdb {
- char *arg1;
- int size1;
+struct GAAOPTION_pgptrustdb
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_pgpkeyring {
- char *arg1;
- int size1;
+struct GAAOPTION_pgpkeyring
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509crlfile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509crlfile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_x509cafile {
- char *arg1;
- int size1;
+struct GAAOPTION_x509cafile
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_dhparams {
- char *arg1;
- int size1;
+struct GAAOPTION_dhparams
+{
+ char* arg1;
+ int size1;
};
-struct GAAOPTION_port {
- int arg1;
- int size1;
+struct GAAOPTION_port
+{
+ int arg1;
+ int size1;
};
-struct GAAOPTION_debug {
- int arg1;
- int size1;
+struct GAAOPTION_debug
+{
+ int arg1;
+ int size1;
};
-
+
#line 349 "gaa.skel"
static int gaa_is_an_argument(char *str)
{
#ifdef GAA_WIN32
- if (str[0] == '/' && str[1] != 0)
+ if(str[0] == '/' && str[1] != 0)
return GAA_MULTIPLE_OPTION;
#endif
- if (str[0] != '-')
- return GAA_NOT_AN_OPTION;
- if (str[1] == 0)
- return GAA_NOT_AN_OPTION;
- if (str[1] == '-') {
- if (str[2] != 0)
- return GAA_WORD_OPTION;
- else
- return GAA_NOT_AN_OPTION;
+ if(str[0] != '-')
+ return GAA_NOT_AN_OPTION;
+ if(str[1] == 0)
+ return GAA_NOT_AN_OPTION;
+ if(str[1] == '-')
+ {
+ if(str[2] != 0)
+ return GAA_WORD_OPTION;
+ else
+ return GAA_NOT_AN_OPTION;
}
- if (str[2] == 0)
- return GAA_LETTER_OPTION;
+ if(str[2] == 0)
+ return GAA_LETTER_OPTION;
else
- return GAA_MULTIPLE_OPTION;
+ return GAA_MULTIPLE_OPTION;
}
static int gaa_get_option_num(char *str, int status)
{
- switch (status) {
- case GAA_LETTER_OPTION:
- GAA_CHECK1STR("", GAAOPTID_ctypes);
- GAA_CHECK1STR("", GAAOPTID_kx);
- GAA_CHECK1STR("", GAAOPTID_macs);
- GAA_CHECK1STR("", GAAOPTID_comp);
- GAA_CHECK1STR("", GAAOPTID_protocols);
- GAA_CHECK1STR("", GAAOPTID_ciphers);
- GAA_CHECK1STR("", GAAOPTID_srppasswdconf);
- GAA_CHECK1STR("", GAAOPTID_srppasswd);
- GAA_CHECK1STR("", GAAOPTID_x509dsacertfile);
- GAA_CHECK1STR("", GAAOPTID_x509dsakeyfile);
- GAA_CHECK1STR("", GAAOPTID_x509certfile);
- GAA_CHECK1STR("", GAAOPTID_x509keyfile);
- GAA_CHECK1STR("", GAAOPTID_pgpcertfile);
- GAA_CHECK1STR("", GAAOPTID_pgpkeyfile);
- GAA_CHECK1STR("", GAAOPTID_pgptrustdb);
- GAA_CHECK1STR("", GAAOPTID_pgpkeyring);
- GAA_CHECK1STR("", GAAOPTID_x509crlfile);
- GAA_CHECK1STR("", GAAOPTID_x509cafile);
- GAA_CHECK1STR("", GAAOPTID_dhparams);
- GAA_CHECK1STR("p", GAAOPTID_port);
- GAA_CHECK1STR("d", GAAOPTID_debug);
- case GAA_MULTIPLE_OPTION:
+ switch(status)
+ {
+ case GAA_LETTER_OPTION:
+ GAA_CHECK1STR("", GAAOPTID_ctypes);
+ GAA_CHECK1STR("", GAAOPTID_kx);
+ GAA_CHECK1STR("", GAAOPTID_macs);
+ GAA_CHECK1STR("", GAAOPTID_comp);
+ GAA_CHECK1STR("", GAAOPTID_protocols);
+ GAA_CHECK1STR("", GAAOPTID_ciphers);
+ GAA_CHECK1STR("", GAAOPTID_srppasswdconf);
+ GAA_CHECK1STR("", GAAOPTID_srppasswd);
+ GAA_CHECK1STR("", GAAOPTID_x509dsacertfile);
+ GAA_CHECK1STR("", GAAOPTID_x509dsakeyfile);
+ GAA_CHECK1STR("", GAAOPTID_x509certfile);
+ GAA_CHECK1STR("", GAAOPTID_x509keyfile);
+ GAA_CHECK1STR("", GAAOPTID_pgpcertfile);
+ GAA_CHECK1STR("", GAAOPTID_pgpkeyfile);
+ GAA_CHECK1STR("", GAAOPTID_pgptrustdb);
+ GAA_CHECK1STR("", GAAOPTID_pgpkeyring);
+ GAA_CHECK1STR("", GAAOPTID_x509crlfile);
+ GAA_CHECK1STR("", GAAOPTID_x509cafile);
+ GAA_CHECK1STR("", GAAOPTID_dhparams);
+ GAA_CHECK1STR("p", GAAOPTID_port);
+ GAA_CHECK1STR("d", GAAOPTID_debug);
+ case GAA_MULTIPLE_OPTION:
#line 375 "gaa.skel"
- GAA_CHECK1STR("", GAAOPTID_copyright);
- GAA_CHECK1STR("v", GAAOPTID_version);
- GAA_CHECK1STR("h", GAAOPTID_help);
- GAA_CHECK1STR("l", GAAOPTID_list);
- GAA_CHECK1STR("", GAAOPTID_x509fmtder);
- GAA_CHECK1STR("", GAAOPTID_echo);
- GAA_CHECK1STR("", GAAOPTID_http);
- GAA_CHECK1STR("", GAAOPTID_nodb);
- GAA_CHECK1STR("q", GAAOPTID_quiet);
- GAA_CHECK1STR("g", GAAOPTID_generate);
+ GAA_CHECK1STR("", GAAOPTID_copyright);
+ GAA_CHECK1STR("v", GAAOPTID_version);
+ GAA_CHECK1STR("h", GAAOPTID_help);
+ GAA_CHECK1STR("l", GAAOPTID_list);
+ GAA_CHECK1STR("", GAAOPTID_require_cert);
+ GAA_CHECK1STR("", GAAOPTID_x509fmtder);
+ GAA_CHECK1STR("", GAAOPTID_echo);
+ GAA_CHECK1STR("", GAAOPTID_http);
+ GAA_CHECK1STR("", GAAOPTID_nodb);
+ GAA_CHECK1STR("q", GAAOPTID_quiet);
+ GAA_CHECK1STR("g", GAAOPTID_generate);
#line 277 "gaa.skel"
- break;
- case GAA_WORD_OPTION:
- GAA_CHECKSTR("copyright", GAAOPTID_copyright);
- GAA_CHECKSTR("version", GAAOPTID_version);
- GAA_CHECKSTR("help", GAAOPTID_help);
- GAA_CHECKSTR("list", GAAOPTID_list);
- GAA_CHECKSTR("ctypes", GAAOPTID_ctypes);
- GAA_CHECKSTR("kx", GAAOPTID_kx);
- GAA_CHECKSTR("macs", GAAOPTID_macs);
- GAA_CHECKSTR("comp", GAAOPTID_comp);
- GAA_CHECKSTR("protocols", GAAOPTID_protocols);
- GAA_CHECKSTR("ciphers", GAAOPTID_ciphers);
- GAA_CHECKSTR("srppasswdconf", GAAOPTID_srppasswdconf);
- GAA_CHECKSTR("srppasswd", GAAOPTID_srppasswd);
- GAA_CHECKSTR("x509dsacertfile", GAAOPTID_x509dsacertfile);
- GAA_CHECKSTR("x509dsakeyfile", GAAOPTID_x509dsakeyfile);
- GAA_CHECKSTR("x509certfile", GAAOPTID_x509certfile);
- GAA_CHECKSTR("x509keyfile", GAAOPTID_x509keyfile);
- GAA_CHECKSTR("pgpcertfile", GAAOPTID_pgpcertfile);
- GAA_CHECKSTR("pgpkeyfile", GAAOPTID_pgpkeyfile);
- GAA_CHECKSTR("pgptrustdb", GAAOPTID_pgptrustdb);
- GAA_CHECKSTR("pgpkeyring", GAAOPTID_pgpkeyring);
- GAA_CHECKSTR("x509crlfile", GAAOPTID_x509crlfile);
- GAA_CHECKSTR("x509cafile", GAAOPTID_x509cafile);
- GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder);
- GAA_CHECKSTR("dhparams", GAAOPTID_dhparams);
- GAA_CHECKSTR("echo", GAAOPTID_echo);
- GAA_CHECKSTR("http", GAAOPTID_http);
- GAA_CHECKSTR("nodb", GAAOPTID_nodb);
- GAA_CHECKSTR("quiet", GAAOPTID_quiet);
- GAA_CHECKSTR("port", GAAOPTID_port);
- GAA_CHECKSTR("generate", GAAOPTID_generate);
- GAA_CHECKSTR("debug", GAAOPTID_debug);
+ break;
+ case GAA_WORD_OPTION:
+ GAA_CHECKSTR("copyright", GAAOPTID_copyright);
+ GAA_CHECKSTR("version", GAAOPTID_version);
+ GAA_CHECKSTR("help", GAAOPTID_help);
+ GAA_CHECKSTR("list", GAAOPTID_list);
+ GAA_CHECKSTR("ctypes", GAAOPTID_ctypes);
+ GAA_CHECKSTR("kx", GAAOPTID_kx);
+ GAA_CHECKSTR("macs", GAAOPTID_macs);
+ GAA_CHECKSTR("comp", GAAOPTID_comp);
+ GAA_CHECKSTR("protocols", GAAOPTID_protocols);
+ GAA_CHECKSTR("ciphers", GAAOPTID_ciphers);
+ GAA_CHECKSTR("srppasswdconf", GAAOPTID_srppasswdconf);
+ GAA_CHECKSTR("srppasswd", GAAOPTID_srppasswd);
+ GAA_CHECKSTR("require-cert", GAAOPTID_require_cert);
+ GAA_CHECKSTR("x509dsacertfile", GAAOPTID_x509dsacertfile);
+ GAA_CHECKSTR("x509dsakeyfile", GAAOPTID_x509dsakeyfile);
+ GAA_CHECKSTR("x509certfile", GAAOPTID_x509certfile);
+ GAA_CHECKSTR("x509keyfile", GAAOPTID_x509keyfile);
+ GAA_CHECKSTR("pgpcertfile", GAAOPTID_pgpcertfile);
+ GAA_CHECKSTR("pgpkeyfile", GAAOPTID_pgpkeyfile);
+ GAA_CHECKSTR("pgptrustdb", GAAOPTID_pgptrustdb);
+ GAA_CHECKSTR("pgpkeyring", GAAOPTID_pgpkeyring);
+ GAA_CHECKSTR("x509crlfile", GAAOPTID_x509crlfile);
+ GAA_CHECKSTR("x509cafile", GAAOPTID_x509cafile);
+ GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder);
+ GAA_CHECKSTR("dhparams", GAAOPTID_dhparams);
+ GAA_CHECKSTR("echo", GAAOPTID_echo);
+ GAA_CHECKSTR("http", GAAOPTID_http);
+ GAA_CHECKSTR("nodb", GAAOPTID_nodb);
+ GAA_CHECKSTR("quiet", GAAOPTID_quiet);
+ GAA_CHECKSTR("port", GAAOPTID_port);
+ GAA_CHECKSTR("generate", GAAOPTID_generate);
+ GAA_CHECKSTR("debug", GAAOPTID_debug);
#line 281 "gaa.skel"
break;
- default:
- break;
- }
+ default: break;
+ }
return GAA_ERROR_NOMATCH;
}
-static int gaa_try(int gaa_num, int gaa_index, gaainfo * gaaval,
- char *opt_list)
+static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
{
int OK = 0;
int gaa_last_non_option;
- struct GAAOPTION_ctypes GAATMP_ctypes;
- struct GAAOPTION_kx GAATMP_kx;
- struct GAAOPTION_macs GAATMP_macs;
- struct GAAOPTION_comp GAATMP_comp;
- struct GAAOPTION_protocols GAATMP_protocols;
- struct GAAOPTION_ciphers GAATMP_ciphers;
- struct GAAOPTION_srppasswdconf GAATMP_srppasswdconf;
- struct GAAOPTION_srppasswd GAATMP_srppasswd;
- struct GAAOPTION_x509dsacertfile GAATMP_x509dsacertfile;
- struct GAAOPTION_x509dsakeyfile GAATMP_x509dsakeyfile;
- struct GAAOPTION_x509certfile GAATMP_x509certfile;
- struct GAAOPTION_x509keyfile GAATMP_x509keyfile;
- struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile;
- struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile;
- struct GAAOPTION_pgptrustdb GAATMP_pgptrustdb;
- struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring;
- struct GAAOPTION_x509crlfile GAATMP_x509crlfile;
- struct GAAOPTION_x509cafile GAATMP_x509cafile;
- struct GAAOPTION_dhparams GAATMP_dhparams;
- struct GAAOPTION_port GAATMP_port;
- struct GAAOPTION_debug GAATMP_debug;
+ struct GAAOPTION_ctypes GAATMP_ctypes;
+ struct GAAOPTION_kx GAATMP_kx;
+ struct GAAOPTION_macs GAATMP_macs;
+ struct GAAOPTION_comp GAATMP_comp;
+ struct GAAOPTION_protocols GAATMP_protocols;
+ struct GAAOPTION_ciphers GAATMP_ciphers;
+ struct GAAOPTION_srppasswdconf GAATMP_srppasswdconf;
+ struct GAAOPTION_srppasswd GAATMP_srppasswd;
+ struct GAAOPTION_x509dsacertfile GAATMP_x509dsacertfile;
+ struct GAAOPTION_x509dsakeyfile GAATMP_x509dsakeyfile;
+ struct GAAOPTION_x509certfile GAATMP_x509certfile;
+ struct GAAOPTION_x509keyfile GAATMP_x509keyfile;
+ struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile;
+ struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile;
+ struct GAAOPTION_pgptrustdb GAATMP_pgptrustdb;
+ struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring;
+ struct GAAOPTION_x509crlfile GAATMP_x509crlfile;
+ struct GAAOPTION_x509cafile GAATMP_x509cafile;
+ struct GAAOPTION_dhparams GAATMP_dhparams;
+ struct GAAOPTION_port GAATMP_port;
+ struct GAAOPTION_debug GAATMP_debug;
#line 393 "gaa.skel"
#ifdef GAA_REST_EXISTS
@@ -743,384 +775,302 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo * gaaval,
#endif
opt_list[gaa_num] = 1;
-
- for (gaa_last_non_option = gaa_index;
- (gaa_last_non_option != GAAargc)
- && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) ==
- GAA_NOT_AN_OPTION); gaa_last_non_option++);
-
- if (gaa_num == GAA_REST) {
- gaa_index = 1;
- gaa_last_non_option = GAAargc;
+
+ for(gaa_last_non_option = gaa_index;
+ (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION);
+ gaa_last_non_option++);
+
+ if(gaa_num == GAA_REST)
+ {
+ gaa_index = 1;
+ gaa_last_non_option = GAAargc;
}
+
+ switch(gaa_num)
+ {
+ case GAAOPTID_copyright:
+ OK = 0;
+#line 106 "serv.gaa"
+{ print_serv_license(); exit(0); ;};
- switch (gaa_num) {
- case GAAOPTID_copyright:
+ return GAA_OK;
+ break;
+ case GAAOPTID_version:
OK = 0;
-#line 103 "serv.gaa"
- {
- print_serv_license();
- exit(0);;
- };
+#line 105 "serv.gaa"
+{ serv_version(); exit(0); ;};
- return GAA_OK;
- break;
- case GAAOPTID_version:
+ return GAA_OK;
+ break;
+ case GAAOPTID_help:
OK = 0;
-#line 102 "serv.gaa"
- {
- serv_version();
- exit(0);;
- };
+#line 103 "serv.gaa"
+{ gaa_help(); exit(0); ;};
- return GAA_OK;
- break;
- case GAAOPTID_help:
+ return GAA_OK;
+ break;
+ case GAAOPTID_list:
OK = 0;
-#line 100 "serv.gaa"
- {
- gaa_help();
- exit(0);;
- };
+#line 102 "serv.gaa"
+{ print_list(); exit(0); ;};
- return GAA_OK;
- break;
- case GAAOPTID_list:
+ return GAA_OK;
+ break;
+ case GAAOPTID_ctypes:
OK = 0;
+ GAA_LIST_FILL(GAATMP_ctypes.arg1, gaa_getstr, char*, GAATMP_ctypes.size1);
#line 99 "serv.gaa"
- {
- print_list();
- exit(0);;
- };
+{ gaaval->ctype = GAATMP_ctypes.arg1; gaaval->nctype = GAATMP_ctypes.size1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_ctypes:
+ return GAA_OK;
+ break;
+ case GAAOPTID_kx:
OK = 0;
- GAA_LIST_FILL(GAATMP_ctypes.arg1, gaa_getstr, char *,
- GAATMP_ctypes.size1);
-#line 96 "serv.gaa"
- {
- gaaval->ctype = GAATMP_ctypes.arg1;
- gaaval->nctype = GAATMP_ctypes.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_kx:
+ GAA_LIST_FILL(GAATMP_kx.arg1, gaa_getstr, char*, GAATMP_kx.size1);
+#line 95 "serv.gaa"
+{ gaaval->kx = GAATMP_kx.arg1; gaaval->nkx = GAATMP_kx.size1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_macs:
OK = 0;
- GAA_LIST_FILL(GAATMP_kx.arg1, gaa_getstr, char *, GAATMP_kx.size1);
-#line 92 "serv.gaa"
- {
- gaaval->kx = GAATMP_kx.arg1;
- gaaval->nkx = GAATMP_kx.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_macs:
+ GAA_LIST_FILL(GAATMP_macs.arg1, gaa_getstr, char*, GAATMP_macs.size1);
+#line 91 "serv.gaa"
+{ gaaval->macs = GAATMP_macs.arg1; gaaval->nmacs = GAATMP_macs.size1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_comp:
OK = 0;
- GAA_LIST_FILL(GAATMP_macs.arg1, gaa_getstr, char *,
- GAATMP_macs.size1);
-#line 88 "serv.gaa"
- {
- gaaval->macs = GAATMP_macs.arg1;
- gaaval->nmacs = GAATMP_macs.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_comp:
+ GAA_LIST_FILL(GAATMP_comp.arg1, gaa_getstr, char*, GAATMP_comp.size1);
+#line 87 "serv.gaa"
+{ gaaval->comp = GAATMP_comp.arg1; gaaval->ncomp = GAATMP_comp.size1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_protocols:
OK = 0;
- GAA_LIST_FILL(GAATMP_comp.arg1, gaa_getstr, char *,
- GAATMP_comp.size1);
-#line 84 "serv.gaa"
- {
- gaaval->comp = GAATMP_comp.arg1;
- gaaval->ncomp = GAATMP_comp.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_protocols:
+ GAA_LIST_FILL(GAATMP_protocols.arg1, gaa_getstr, char*, GAATMP_protocols.size1);
+#line 83 "serv.gaa"
+{ gaaval->proto = GAATMP_protocols.arg1; gaaval->nproto = GAATMP_protocols.size1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_ciphers:
OK = 0;
- GAA_LIST_FILL(GAATMP_protocols.arg1, gaa_getstr, char *,
- GAATMP_protocols.size1);
-#line 80 "serv.gaa"
- {
- gaaval->proto = GAATMP_protocols.arg1;
- gaaval->nproto = GAATMP_protocols.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_ciphers:
+ GAA_LIST_FILL(GAATMP_ciphers.arg1, gaa_getstr, char*, GAATMP_ciphers.size1);
+#line 79 "serv.gaa"
+{ gaaval->ciphers = GAATMP_ciphers.arg1; gaaval->nciphers = GAATMP_ciphers.size1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_srppasswdconf:
OK = 0;
- GAA_LIST_FILL(GAATMP_ciphers.arg1, gaa_getstr, char *,
- GAATMP_ciphers.size1);
-#line 76 "serv.gaa"
- {
- gaaval->ciphers = GAATMP_ciphers.arg1;
- gaaval->nciphers = GAATMP_ciphers.size1;
- };
-
- return GAA_OK;
- break;
- case GAAOPTID_srppasswdconf:
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_srppasswdconf.arg1, gaa_getstr, GAATMP_srppasswdconf.size1);
+ gaa_index++;
+#line 74 "serv.gaa"
+{ gaaval->srp_passwd_conf = GAATMP_srppasswdconf.arg1 ;};
+
+ return GAA_OK;
+ break;
+ case GAAOPTID_srppasswd:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_srppasswdconf.arg1, gaa_getstr,
- GAATMP_srppasswdconf.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1);
+ gaa_index++;
#line 71 "serv.gaa"
- {
- gaaval->srp_passwd_conf = GAATMP_srppasswdconf.arg1;
- };
+{ gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_srppasswd:
+ return GAA_OK;
+ break;
+ case GAAOPTID_require_cert:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr,
- GAATMP_srppasswd.size1);
- gaa_index++;
#line 68 "serv.gaa"
- {
- gaaval->srp_passwd = GAATMP_srppasswd.arg1;
- };
+{ gaaval->require_cert = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509dsacertfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509dsacertfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509dsacertfile.arg1, gaa_getstr,
- GAATMP_x509dsacertfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509dsacertfile.arg1, gaa_getstr, GAATMP_x509dsacertfile.size1);
+ gaa_index++;
#line 65 "serv.gaa"
- {
- gaaval->x509_dsacertfile = GAATMP_x509dsacertfile.arg1;
- };
+{ gaaval->x509_dsacertfile = GAATMP_x509dsacertfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509dsakeyfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509dsakeyfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509dsakeyfile.arg1, gaa_getstr,
- GAATMP_x509dsakeyfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509dsakeyfile.arg1, gaa_getstr, GAATMP_x509dsakeyfile.size1);
+ gaa_index++;
#line 62 "serv.gaa"
- {
- gaaval->x509_dsakeyfile = GAATMP_x509dsakeyfile.arg1;
- };
+{ gaaval->x509_dsakeyfile = GAATMP_x509dsakeyfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509certfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509certfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr,
- GAATMP_x509certfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1);
+ gaa_index++;
#line 59 "serv.gaa"
- {
- gaaval->x509_certfile = GAATMP_x509certfile.arg1;
- };
+{ gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509keyfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509keyfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr,
- GAATMP_x509keyfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1);
+ gaa_index++;
#line 56 "serv.gaa"
- {
- gaaval->x509_keyfile = GAATMP_x509keyfile.arg1;
- };
+{ gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_pgpcertfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_pgpcertfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr,
- GAATMP_pgpcertfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1);
+ gaa_index++;
#line 53 "serv.gaa"
- {
- gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1;
- };
+{ gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_pgpkeyfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_pgpkeyfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr,
- GAATMP_pgpkeyfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1);
+ gaa_index++;
#line 50 "serv.gaa"
- {
- gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1;
- };
+{ gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_pgptrustdb:
+ return GAA_OK;
+ break;
+ case GAAOPTID_pgptrustdb:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgptrustdb.arg1, gaa_getstr,
- GAATMP_pgptrustdb.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_pgptrustdb.arg1, gaa_getstr, GAATMP_pgptrustdb.size1);
+ gaa_index++;
#line 47 "serv.gaa"
- {
- gaaval->pgp_trustdb = GAATMP_pgptrustdb.arg1;
- };
+{ gaaval->pgp_trustdb = GAATMP_pgptrustdb.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_pgpkeyring:
+ return GAA_OK;
+ break;
+ case GAAOPTID_pgpkeyring:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr,
- GAATMP_pgpkeyring.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1);
+ gaa_index++;
#line 44 "serv.gaa"
- {
- gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1;
- };
+{ gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509crlfile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509crlfile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr,
- GAATMP_x509crlfile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1);
+ gaa_index++;
#line 41 "serv.gaa"
- {
- gaaval->x509_crlfile = GAATMP_x509crlfile.arg1;
- };
+{ gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509cafile:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509cafile:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr,
- GAATMP_x509cafile.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1);
+ gaa_index++;
#line 38 "serv.gaa"
- {
- gaaval->x509_cafile = GAATMP_x509cafile.arg1;
- };
+{ gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_x509fmtder:
+ return GAA_OK;
+ break;
+ case GAAOPTID_x509fmtder:
OK = 0;
#line 35 "serv.gaa"
- {
- gaaval->fmtder = 1;
- };
+{ gaaval->fmtder = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_dhparams:
+ return GAA_OK;
+ break;
+ case GAAOPTID_dhparams:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_dhparams.arg1, gaa_getstr, GAATMP_dhparams.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_dhparams.arg1, gaa_getstr, GAATMP_dhparams.size1);
+ gaa_index++;
#line 32 "serv.gaa"
- {
- gaaval->dh_params_file = GAATMP_dhparams.arg1;
- };
+{ gaaval->dh_params_file = GAATMP_dhparams.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_echo:
+ return GAA_OK;
+ break;
+ case GAAOPTID_echo:
OK = 0;
#line 29 "serv.gaa"
- {
- gaaval->http = 0;
- };
+{ gaaval->http = 0 ;};
- return GAA_OK;
- break;
- case GAAOPTID_http:
+ return GAA_OK;
+ break;
+ case GAAOPTID_http:
OK = 0;
#line 28 "serv.gaa"
- {
- gaaval->http = 1;
- };
+{ gaaval->http = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_nodb:
+ return GAA_OK;
+ break;
+ case GAAOPTID_nodb:
OK = 0;
#line 25 "serv.gaa"
- {
- gaaval->nodb = 1;
- };
+{ gaaval->nodb = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_quiet:
+ return GAA_OK;
+ break;
+ case GAAOPTID_quiet:
OK = 0;
#line 22 "serv.gaa"
- {
- gaaval->quiet = 1;
- };
+{ gaaval->quiet = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_port:
+ return GAA_OK;
+ break;
+ case GAAOPTID_port:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_port.arg1, gaa_getint, GAATMP_port.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_port.arg1, gaa_getint, GAATMP_port.size1);
+ gaa_index++;
#line 19 "serv.gaa"
- {
- gaaval->port = GAATMP_port.arg1;
- };
+{ gaaval->port = GAATMP_port.arg1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_generate:
+ return GAA_OK;
+ break;
+ case GAAOPTID_generate:
OK = 0;
#line 16 "serv.gaa"
- {
- gaaval->generate = 1;
- };
+{ gaaval->generate = 1 ;};
- return GAA_OK;
- break;
- case GAAOPTID_debug:
+ return GAA_OK;
+ break;
+ case GAAOPTID_debug:
OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
- gaa_index++;
+ GAA_TESTMOREARGS;
+ GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
+ gaa_index++;
#line 13 "serv.gaa"
- {
- gaaval->debug = GAATMP_debug.arg1;
- };
+{ gaaval->debug = GAATMP_debug.arg1 ;};
- return GAA_OK;
- break;
+ return GAA_OK;
+ break;
#line 413 "gaa.skel"
- default:
- break;
+ default: break;
}
return GAA_ERROR_UNKNOWN;
}
-int gaa(int argc, char **argv, gaainfo * gaaval)
+int gaa(int argc, char **argv, gaainfo *gaaval)
{
int tmp1, tmp2;
int i, j;
@@ -1129,46 +1079,24 @@ int gaa(int argc, char **argv, gaainfo * gaaval)
GAAargv = argv;
GAAargc = argc;
- opt_list = (char *) gaa_malloc(GAA_NB_OPTION + 1);
+ opt_list = (char*) gaa_malloc(GAA_NB_OPTION + 1);
- for (i = 0; i < GAA_NB_OPTION + 1; i++)
- opt_list[i] = 0;
+ for(i = 0; i < GAA_NB_OPTION + 1; i++)
+ opt_list[i] = 0;
/* initialization */
- if (inited == 0) {
-
-#line 106 "serv.gaa"
- {
- gaaval->generate = 0;
- gaaval->port = 5556;
- gaaval->http = 0;
- gaaval->ciphers = NULL;
- gaaval->kx = NULL;
- gaaval->comp = NULL;
- gaaval->macs = NULL;
- gaaval->ctype = NULL;
- gaaval->nciphers = 0;
- gaaval->nkx = 0;
- gaaval->ncomp = 0;
- gaaval->nmacs = 0;
- gaaval->nctype = 0;
- gaaval->nodb = 0;
- gaaval->x509_cafile = NULL;
- gaaval->pgp_keyfile = NULL;
- gaaval->pgp_certfile = NULL;
- gaaval->x509_keyfile = NULL;
- gaaval->x509_certfile = NULL;
- gaaval->x509_crlfile = NULL;
- gaaval->x509_dsakeyfile = NULL;
- gaaval->x509_dsacertfile = NULL;
- gaaval->srp_passwd = NULL;
- gaaval->srp_passwd_conf = NULL;
- gaaval->quiet = 0;
- gaaval->pgp_trustdb = NULL;
- gaaval->pgp_keyring = NULL;
- gaaval->fmtder = 0;
- gaaval->dh_params_file = NULL;
- gaaval->debug = 0;;
- };
+ if(inited == 0)
+ {
+
+#line 109 "serv.gaa"
+{ gaaval->generate=0; gaaval->port=5556; gaaval->http=0; gaaval->ciphers=NULL;
+ gaaval->kx=NULL; gaaval->comp=NULL; gaaval->macs=NULL; gaaval->ctype=NULL; gaaval->nciphers=0;
+ gaaval->nkx=0; gaaval->ncomp=0; gaaval->nmacs=0; gaaval->nctype = 0; gaaval->nodb = 0;
+ gaaval->x509_cafile = NULL; gaaval->pgp_keyfile=NULL; gaaval->pgp_certfile=NULL;
+ gaaval->x509_keyfile=NULL; gaaval->x509_certfile=NULL; gaaval->x509_crlfile = NULL;
+ gaaval->x509_dsakeyfile=NULL; gaaval->x509_dsacertfile=NULL;
+ gaaval->srp_passwd=NULL; gaaval->srp_passwd_conf=NULL; gaaval->quiet = 0;
+ gaaval->pgp_trustdb=NULL; gaaval->pgp_keyring=NULL; gaaval->fmtder = 0;
+ gaaval->dh_params_file=NULL; gaaval->debug=0; gaaval->require_cert = 0; ;};
}
inited = 1;
@@ -1176,173 +1104,186 @@ int gaa(int argc, char **argv, gaainfo * gaaval)
gaa_arg_used = NULL;
if (argc > 0) {
- gaa_arg_used = gaa_malloc(argc * sizeof(char));
+ gaa_arg_used = gaa_malloc(argc * sizeof(char));
}
- for (i = 1; i < argc; i++)
- gaa_arg_used[i] = 0;
- for (i = 1; i < argc; i++) {
- if (gaa_arg_used[i] == 0) {
- j = 0;
- tmp1 = gaa_is_an_argument(GAAargv[i]);
- switch (tmp1) {
- case GAA_WORD_OPTION:
- j++;
- case GAA_LETTER_OPTION:
- j++;
- tmp2 = gaa_get_option_num(argv[i] + j, tmp1);
- if (tmp2 == GAA_ERROR_NOMATCH) {
- printf("Invalid option '%s'\n", argv[i] + j);
- return 0;
- }
- switch (gaa_try(tmp2, i + 1, gaaval, opt_list)) {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",
- gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- gaa_arg_used[i] = 1;
- break;
- case GAA_MULTIPLE_OPTION:
- for (j = 1; j < strlen(argv[i]); j++) {
- tmp2 = gaa_get_option_num(argv[i] + j, tmp1);
- if (tmp2 == GAA_ERROR_NOMATCH) {
- printf("Invalid option '%c'\n", *(argv[i] + j));
- return 0;
- }
- switch (gaa_try(tmp2, i + 1, gaaval, opt_list)) {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",
- gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- }
- gaa_arg_used[i] = 1;
- break;
- default:
- break;
- }
- }
+ for(i = 1; i < argc; i++)
+ gaa_arg_used[i] = 0;
+ for(i = 1; i < argc; i++)
+ {
+ if(gaa_arg_used[i] == 0)
+ {
+ j = 0;
+ tmp1 = gaa_is_an_argument(GAAargv[i]);
+ switch(tmp1)
+ {
+ case GAA_WORD_OPTION:
+ j++;
+ case GAA_LETTER_OPTION:
+ j++;
+ tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
+ if(tmp2 == GAA_ERROR_NOMATCH)
+ {
+ printf("Invalid option '%s'\n", argv[i]+j);
+ return 0;
+ }
+ switch(gaa_try(tmp2, i+1, gaaval, opt_list))
+ {
+ case GAA_ERROR_NOTENOUGH_ARGS:
+ printf("'%s': not enough arguments\n",gaa_current_option);
+ return 0;
+ case GAA_ERROR_INVALID_ARG:
+ printf("Invalid arguments\n");
+ return 0;
+ case GAA_OK:
+ break;
+ default:
+ printf("Unknown error\n");
+ }
+ gaa_arg_used[i] = 1;
+ break;
+ case GAA_MULTIPLE_OPTION:
+ for(j = 1; j < strlen(argv[i]); j++)
+ {
+ tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
+ if(tmp2 == GAA_ERROR_NOMATCH)
+ {
+ printf("Invalid option '%c'\n", *(argv[i]+j));
+ return 0;
+ }
+ switch(gaa_try(tmp2, i+1, gaaval, opt_list))
+ {
+ case GAA_ERROR_NOTENOUGH_ARGS:
+ printf("'%s': not enough arguments\n",gaa_current_option);
+ return 0;
+ case GAA_ERROR_INVALID_ARG:
+ printf("Invalid arguments\n");
+ return 0;
+ case GAA_OK:
+ break;
+ default:
+ printf("Unknown error\n");
+ }
+ }
+ gaa_arg_used[i] = 1;
+ break;
+ default: break;
+ }
+ }
}
- if (gaa_processing_file == 0) {
+if(gaa_processing_file == 0)
+{
#line 507 "gaa.skel"
#ifdef GAA_REST_EXISTS
- switch (gaa_try(GAA_REST, 1, gaaval, opt_list)) {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("Rest: not enough arguments\n");
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
-#endif
+ switch(gaa_try(GAA_REST, 1, gaaval, opt_list))
+ {
+ case GAA_ERROR_NOTENOUGH_ARGS:
+ printf("Rest: not enough arguments\n");
+ return 0;
+ case GAA_ERROR_INVALID_ARG:
+ printf("Invalid arguments\n");
+ return 0;
+ case GAA_OK:
+ break;
+ default:
+ printf("Unknown error\n");
}
- for (i = 1; i < argc; i++) {
- if (gaa_arg_used[i] == 0) {
- printf("Too many arguments\n");
- return 0;
- }
+#endif
+}
+ for(i = 1; i < argc; i++)
+ {
+ if(gaa_arg_used[i] == 0)
+ {
+ printf("Too many arguments\n");
+ return 0;
+ }
}
free(gaa_arg_used);
free(opt_list);
return -1;
}
-struct gaastrnode {
+struct gaastrnode
+{
char *str;
struct gaastrnode *next;
};
typedef struct gaastrnode gaa_str_node;
-static int gaa_internal_get_next_str(FILE * file, gaa_str_node * tmp_str,
- int argc)
+static int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc)
{
int pos_ini;
int a;
int i = 0, len = 0, newline = 0;
- if (argc == 1) {
- newline = 1;
- len = 2;
+ if(argc == 1) {
+ newline = 1;
+ len = 2;
}
-
- a = fgetc(file);
- if (a == EOF)
- return 0;
-
- while (a == ' ' || a == 9 || a == '\n') {
- if (a == '\n') {
- newline = 1;
- len = 2;
- }
- a = fgetc(file);
- if (a == EOF)
- return 0;
+
+ a = fgetc( file);
+ if (a == EOF) return 0;
+
+ while(a == ' ' || a == 9 || a == '\n')
+ {
+ if(a == '\n')
+ {
+ newline=1;
+ len = 2;
+ }
+ a = fgetc( file);
+ if (a == EOF) return 0;
}
pos_ini = ftell(file) - 1;
- while (a != ' ' && a != 9 && a != '\n') {
+ while(a != ' ' && a != 9 && a != '\n')
+ {
- len++;
- a = fgetc(file);
- if (a == EOF)
- return 0; //a = ' ';
+ len++;
+ a = fgetc( file);
+ if(a==EOF) return 0; //a = ' ';
}
len += 1;
tmp_str->str = gaa_malloc((len) * sizeof(char));
- if (newline == 1) {
- tmp_str->str[0] = '-';
- tmp_str->str[1] = '-';
- i = 2;
- } else {
- i = 0;
+ if(newline == 1)
+ {
+ tmp_str->str[0] = '-';
+ tmp_str->str[1] = '-';
+ i = 2;
+ }
+ else
+ {
+ i = 0;
}
- fseek(file, pos_ini, SEEK_SET);
- do {
- a = fgetc(file);
-
- if (a == EOF) {
- i += 2;
- break;
- }
- tmp_str->str[i] = a;
- i++;
+ fseek(file,pos_ini, SEEK_SET);
+ do
+ {
+ a = fgetc( file);
+
+ if (a == EOF) {
+ i+=2;
+ break;
+ }
+ tmp_str->str[i] = a;
+ i++;
}
- while (a != ' ' && a != 9 && a != '\n' && i < len);
+ while(a != ' ' && a != 9 && a != '\n' && i < len);
tmp_str->str[i - 1] = 0;
- fseek(file, -1, SEEK_CUR);
+ fseek(file,- 1, SEEK_CUR);
/* printf("%d\n", ftell(file)); */
-
+
return -1;
}
-int gaa_file(const char *name, gaainfo * gaaval)
+int gaa_file(const char *name, gaainfo *gaaval)
{
gaa_str_node *first_str, **tmp_str, *tmp_str2;
int rval, i;
@@ -1351,36 +1292,38 @@ int gaa_file(const char *name, gaainfo * gaaval)
FILE *file;
gaa_processing_file = 1;
-
- if ((file = fopen(name, "r")) == NULL) {
- printf("Couldn't open '%s' configuration file for reading\n",
- name);
- return 1;
+
+ if((file = fopen(name, "r")) == NULL)
+ {
+ printf("Couldn't open '%s' configuration file for reading\n", name);
+ return 1;
}
-
+
tmp_str = &first_str;
- do {
- argc++;
- *tmp_str = gaa_malloc(sizeof(gaa_str_node));
+ do
+ {
+ argc++;
+ *tmp_str = gaa_malloc(sizeof(gaa_str_node));
- (*tmp_str)->str = NULL;
- (*tmp_str)->next = NULL;
+ (*tmp_str)->str = NULL;
+ (*tmp_str)->next = NULL;
- rval = gaa_internal_get_next_str(file, *tmp_str, argc);
- tmp_str = &((*tmp_str)->next);
+ rval = gaa_internal_get_next_str(file, *tmp_str, argc);
+ tmp_str = &((*tmp_str)->next);
}
- while (rval == -1);
-
- if (rval == 1)
- return 0;
-
- argv = gaa_malloc((1 + argc) * sizeof(char *));
+ while(rval == -1);
+
+ if(rval == 1)
+ return 0;
+
+ argv = gaa_malloc((1 + argc) * sizeof(char*));
tmp_str2 = first_str;
argv[0] = "cfg";
- for (i = 1; i < argc; i++) {
- argv[i] = tmp_str2->str;
- tmp_str2 = tmp_str2->next;
+ for(i = 1; i < argc; i++)
+ {
+ argv[i] = tmp_str2->str;
+ tmp_str2 = tmp_str2->next;
}
rval = gaa(argc, argv, gaaval);
diff --git a/src/serv-gaa.h b/src/serv-gaa.h
index 373bfab9ed..f46930fc00 100644
--- a/src/serv-gaa.h
+++ b/src/serv-gaa.h
@@ -8,34 +8,36 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 95 "serv.gaa"
+#line 98 "serv.gaa"
char **ctype;
-#line 94 "serv.gaa"
+#line 97 "serv.gaa"
int nctype;
-#line 91 "serv.gaa"
+#line 94 "serv.gaa"
char **kx;
-#line 90 "serv.gaa"
+#line 93 "serv.gaa"
int nkx;
-#line 87 "serv.gaa"
+#line 90 "serv.gaa"
char **macs;
-#line 86 "serv.gaa"
+#line 89 "serv.gaa"
int nmacs;
-#line 83 "serv.gaa"
+#line 86 "serv.gaa"
char **comp;
-#line 82 "serv.gaa"
+#line 85 "serv.gaa"
int ncomp;
-#line 79 "serv.gaa"
+#line 82 "serv.gaa"
char **proto;
-#line 78 "serv.gaa"
+#line 81 "serv.gaa"
int nproto;
-#line 75 "serv.gaa"
+#line 78 "serv.gaa"
char **ciphers;
-#line 74 "serv.gaa"
+#line 77 "serv.gaa"
int nciphers;
-#line 70 "serv.gaa"
+#line 73 "serv.gaa"
char *srp_passwd_conf;
-#line 67 "serv.gaa"
+#line 70 "serv.gaa"
char *srp_passwd;
+#line 67 "serv.gaa"
+ int require_cert;
#line 64 "serv.gaa"
char *x509_dsacertfile;
#line 61 "serv.gaa"
diff --git a/src/serv.c b/src/serv.c
index 6b322ea2a2..4ff6a78a9a 100644
--- a/src/serv.c
+++ b/src/serv.c
@@ -50,6 +50,7 @@ static int debug;
int verbose;
static int nodb;
+int require_cert;
char *srp_passwd;
char *srp_passwd_conf;
@@ -318,7 +319,10 @@ gnutls_session initialize_session(void)
if (cert_cred != NULL)
gnutls_credentials_set(session, GNUTLS_CRD_CERTIFICATE, cert_cred);
- gnutls_certificate_server_set_request(session, GNUTLS_CERT_REQUEST);
+ if (require_cert)
+ gnutls_certificate_server_set_request(session, GNUTLS_CERT_REQUIRE);
+ else
+ gnutls_certificate_server_set_request(session, GNUTLS_CERT_REQUEST);
return session;
}
@@ -1031,6 +1035,7 @@ void gaa_parser(int argc, char **argv)
exit(1);
}
+ require_cert = info.require_cert;
debug = info.debug;
verbose = info.quiet;
nodb = info.nodb;
diff --git a/src/serv.gaa b/src/serv.gaa
index 09f54e835c..d19071111e 100644
--- a/src/serv.gaa
+++ b/src/serv.gaa
@@ -64,6 +64,9 @@ option (x509dsakeyfile) STR "FILE" { $x509_dsakeyfile = $1 } "Alternative X.509
#char *x509_dsacertfile;
option (x509dsacertfile) STR "FILE" { $x509_dsacertfile = $1 } "Alternative X.509 certificate file to use."
+#int require_cert;
+option (require-cert) { $require_cert = 1 } "Require a valid certificate."
+
#char *srp_passwd;
option (srppasswd) STR "FILE" { $srp_passwd = $1 } "SRP password file to use."
@@ -111,6 +114,6 @@ init { $generate=0; $port=5556; $http=0; $ciphers=NULL;
$x509_dsakeyfile=NULL; $x509_dsacertfile=NULL;
$srp_passwd=NULL; $srp_passwd_conf=NULL; $quiet = 0;
$pgp_trustdb=NULL; $pgp_keyring=NULL; $fmtder = 0;
- $dh_params_file=NULL; $debug=0; }
+ $dh_params_file=NULL; $debug=0; $require_cert = 0; }