From: Nikos Mavrogiannopoulos Date: Sat, 21 Jan 2012 01:22:11 +0000 (+0100) Subject: updated parameter parsing. X-Git-Tag: gnutls_3_0_13~250 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=b399c12ca778ce35764c794918eca4c7bbed6ed2;p=thirdparty%2Fgnutls.git updated parameter parsing. --- diff --git a/src/cli-args.c b/src/cli-args.c index 3f8c39f7a0..ade11abe99 100644 --- a/src/cli-args.c +++ b/src/cli-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (cli-args.c) * - * It has been AutoGen-ed January 21, 2012 at 01:58:52 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:15:53 AM by AutoGen 5.12 * From the definitions cli-args.def * and the template file options * @@ -1077,7 +1077,7 @@ static void doOptX509cafile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1095,7 +1095,7 @@ static void doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1113,7 +1113,7 @@ static void doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1131,7 +1131,7 @@ static void doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1149,7 +1149,7 @@ static void doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1167,7 +1167,7 @@ static void doOptX509keyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1185,7 +1185,7 @@ static void doOptX509certfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 diff --git a/src/cli-args.def.in b/src/cli-args.def.in index ed50025241..c5583b521f 100644 --- a/src/cli-args.def.in +++ b/src/cli-args.def.in @@ -137,7 +137,7 @@ information on allowed keywords"; flag = { name = x509cafile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Certificate file or PKCS #11 URL to use"; doc = ""; }; @@ -145,7 +145,7 @@ flag = { flag = { name = x509crlfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "CRL file to use"; doc = ""; }; @@ -153,7 +153,7 @@ flag = { flag = { name = pgpkeyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Key file to use"; doc = ""; }; @@ -161,7 +161,7 @@ flag = { flag = { name = pgpkeyring; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Key ring file to use"; doc = ""; }; @@ -169,7 +169,7 @@ flag = { flag = { name = pgpcertfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Public Key (certificate) file to use"; doc = ""; }; @@ -177,7 +177,7 @@ flag = { flag = { name = x509keyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "X.509 key file or PKCS #11 URL to use"; doc = ""; }; @@ -185,7 +185,7 @@ flag = { flag = { name = x509certfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "X.509 Certificate file or PKCS #11 URL to use"; doc = ""; }; diff --git a/src/cli-args.h b/src/cli-args.h index c05ff9bbcf..49cf4459f4 100644 --- a/src/cli-args.h +++ b/src/cli-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (cli-args.h) * - * It has been AutoGen-ed January 21, 2012 at 01:58:52 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:15:53 AM by AutoGen 5.12 * From the definitions cli-args.def * and the template file options * diff --git a/src/serv-args.c b/src/serv-args.c index 45b7e19aeb..8311611c91 100644 --- a/src/serv-args.c +++ b/src/serv-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (serv-args.c) * - * It has been AutoGen-ed January 21, 2012 at 01:58:47 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:14:19 AM by AutoGen 5.12 * From the definitions serv-args.def * and the template file options * @@ -861,9 +861,9 @@ static tOptDesc optDesc[OPTION_CT] = { * Define the Gnutls_Serv Option Environment */ static char const zPROGNAME[12] = "GNUTLS_SERV"; -static char const zUsageTitle[101] = +static char const zUsageTitle[100] = "gnutls-serv - GnuTLS server - Ver. 3.0.12\n\ -USAGE: %s [ - [] | --[{=| }] ]... \n"; +USAGE: %s [ - [] | --[{=| }] ]...\n"; #define zRcName NULL #define apzHomeList NULL @@ -916,8 +916,7 @@ tOptions gnutls_servOptions = { + OPTPROC_SHORTOPT + OPTPROC_LONGOPT + OPTPROC_NO_REQ_OPT - + OPTPROC_ARGS_REQ - + OPTPROC_REORDER + + OPTPROC_NO_ARGS + OPTPROC_GNUUSAGE + OPTPROC_MISUSE ), 0, NULL, /* current option index, current option */ @@ -1027,7 +1026,7 @@ static void doOptDhparams(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1045,7 +1044,7 @@ static void doOptX509cafile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1063,7 +1062,7 @@ static void doOptX509crlfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1081,7 +1080,7 @@ static void doOptPgpkeyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1099,7 +1098,7 @@ static void doOptPgpkeyring(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1117,7 +1116,7 @@ static void doOptPgpcertfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1135,7 +1134,7 @@ static void doOptX509keyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1153,7 +1152,7 @@ static void doOptX509certfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1171,7 +1170,7 @@ static void doOptX509dsakeyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1189,7 +1188,7 @@ static void doOptX509dsacertfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1207,7 +1206,7 @@ static void doOptX509ecckeyfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1225,7 +1224,7 @@ static void doOptX509ecccertfile(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1243,7 +1242,7 @@ static void doOptSrppasswd(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1261,7 +1260,7 @@ static void doOptSrppasswdconf(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 @@ -1279,7 +1278,7 @@ static void doOptPskpasswd(tOptions* pOptions, tOptDesc* pOptDesc) { static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; + FTYPE_MODE_MUST_EXIST + FTYPE_MODE_NO_OPEN; static tuFileMode mode; #ifndef O_CLOEXEC # define O_CLOEXEC 0 diff --git a/src/serv-args.def.in b/src/serv-args.def.in index 00da5d96a9..424cab2d92 100644 --- a/src/serv-args.def.in +++ b/src/serv-args.def.in @@ -8,8 +8,6 @@ detail = "Server program that listens to incoming TLS connections."; gnu-usage; no-misuse-usage; disable-save; -reorder-args; -argument; long-opts; config-header = 'config.h'; export = '#include '; @@ -120,7 +118,7 @@ information on allowed keywords"; flag = { name = dhparams; arg-type = file; - file-exists; + file-exists = yes; descrip = "DH params file to use"; doc = ""; }; @@ -128,7 +126,7 @@ flag = { flag = { name = x509cafile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Certificate file or PKCS #11 URL to use"; doc = ""; }; @@ -136,7 +134,7 @@ flag = { flag = { name = x509crlfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "CRL file to use"; doc = ""; }; @@ -144,7 +142,7 @@ flag = { flag = { name = pgpkeyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Key file to use"; doc = ""; }; @@ -152,7 +150,7 @@ flag = { flag = { name = pgpkeyring; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Key ring file to use"; doc = ""; }; @@ -160,7 +158,7 @@ flag = { flag = { name = pgpcertfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "PGP Public Key (certificate) file to use"; doc = ""; }; @@ -168,7 +166,7 @@ flag = { flag = { name = x509keyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "X.509 key file or PKCS #11 URL to use"; doc = ""; }; @@ -176,7 +174,7 @@ flag = { flag = { name = x509certfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "X.509 Certificate file or PKCS #11 URL to use"; doc = ""; }; @@ -184,7 +182,7 @@ flag = { flag = { name = x509dsakeyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Alternative X.509 key file or PKCS #11 URL to use"; doc = ""; }; @@ -192,7 +190,7 @@ flag = { flag = { name = x509dsacertfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Alternative X.509 Certificate file or PKCS #11 URL to use"; doc = ""; }; @@ -200,7 +198,7 @@ flag = { flag = { name = x509ecckeyfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Alternative X.509 key file or PKCS #11 URL to use"; doc = ""; }; @@ -208,7 +206,7 @@ flag = { flag = { name = x509ecccertfile; arg-type = file; - file-exists; + file-exists = yes; descrip = "Alternative X.509 Certificate file or PKCS #11 URL to use"; doc = ""; }; @@ -223,7 +221,7 @@ flag = { flag = { name = srppasswd; arg-type = file; - file-exists; + file-exists = yes; descrip = "SRP password file to use"; doc = ""; }; @@ -231,7 +229,7 @@ flag = { flag = { name = srppasswdconf; arg-type = file; - file-exists; + file-exists = yes; descrip = "SRP password configuration file to use"; doc = ""; }; @@ -239,7 +237,7 @@ flag = { flag = { name = pskpasswd; arg-type = file; - file-exists; + file-exists = yes; descrip = "PSK password file to use"; doc = ""; }; diff --git a/src/serv-args.h b/src/serv-args.h index b663e6b2a4..b34ea76b0a 100644 --- a/src/serv-args.h +++ b/src/serv-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (serv-args.h) * - * It has been AutoGen-ed January 21, 2012 at 01:58:47 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:14:19 AM by AutoGen 5.12 * From the definitions serv-args.def * and the template file options * diff --git a/src/serv.c b/src/serv.c index e0ed4a4a70..7d87ce2fd0 100644 --- a/src/serv.c +++ b/src/serv.c @@ -58,7 +58,7 @@ static int http = 0; static int x509ctype; static int debug = 0; -int verbose; +int verbose = 1; static int nodb; static int noticket; int require_cert; @@ -414,7 +414,7 @@ peer_print_info (gnutls_session_t session, int *ret_length, char *crtinfo = NULL; size_t ncrtinfo = 0; - if (verbose != 0) + if (verbose == 0) { http_buffer = malloc (len); if (http_buffer == NULL) @@ -427,7 +427,6 @@ peer_print_info (gnutls_session_t session, int *ret_length, *ret_length = sizeof (DEFAULT_DATA) + sizeof (HTTP_BEGIN) + sizeof (HTTP_END) - 3; return http_buffer; - } if (gnutls_certificate_type_get (session) == GNUTLS_CRT_X509) @@ -924,8 +923,6 @@ main (int argc, char **argv) sockets_init (); - optionProcess( &gnutls_servOptions, argc, argv); - if (nodb == 0) wrap_db_init (); @@ -1260,7 +1257,7 @@ static void tcp_server(const char* name, int port) gl_fd_to_handle (accept_fd)); j->handshake_ok = 0; - if (verbose == 0) + if (verbose != 0) { tt = time (0); ctt = ctime (&tt); @@ -1306,10 +1303,10 @@ static void tcp_server(const char* name, int port) else if (r == 0) { if (gnutls_session_is_resumed (j->tls_session) != 0 - && verbose == 0) + && verbose != 0) printf ("*** This is a resumed session\n"); - if (verbose == 0) + if (verbose != 0) { printf ("\n* Successful handshake from %s\n", human_addr ((struct sockaddr *) @@ -1429,9 +1426,9 @@ static void tcp_server(const char* name, int port) else if (r == 0) { if (gnutls_session_is_resumed (j->tls_session) != 0 - && verbose == 0) + && verbose != 0) printf ("*** This is a resumed session\n"); - if (verbose == 0) + if (verbose != 0) { printf ("- connection from %s\n", human_addr ((struct sockaddr *) @@ -1547,16 +1544,22 @@ static void tcp_server(const char* name, int port) static void cmd_parser (int argc, char **argv) { + optionProcess( &gnutls_servOptions, argc, argv); + disable_client_cert = ENABLED_OPT(DISABLE_CLIENT_CERT); require_cert = ENABLED_OPT(REQUIRE_CLIENT_CERT); if (ENABLED_OPT(DEBUG)) debug = OPT_VALUE_DEBUG; - verbose = !ENABLED_OPT(QUIET); + if (ENABLED_OPT(QUIET)) + verbose = 0; + nodb = ENABLED_OPT(NODB); noticket = ENABLED_OPT(NOTICKET); - http = ENABLED_OPT(HTTP); + if (ENABLED_OPT(ECHO)) + http = 0; + else http = 1; if (ENABLED_OPT(X509FMTDER)) x509ctype = GNUTLS_X509_FMT_DER; @@ -1568,41 +1571,41 @@ static void cmd_parser (int argc, char **argv) if (ENABLED_OPT(DHPARAMS)) dh_params_file = OPT_ARG(DHPARAMS); - if (HAVE_OPT(X509KEYFILE)) + if (ENABLED_OPT(X509KEYFILE)) x509_keyfile = OPT_ARG(X509KEYFILE); - if (HAVE_OPT(X509CERTFILE)) + if (ENABLED_OPT(X509CERTFILE)) x509_certfile = OPT_ARG(X509CERTFILE); - if (HAVE_OPT(X509DSAKEYFILE)) + if (ENABLED_OPT(X509DSAKEYFILE)) x509_dsakeyfile = OPT_ARG(X509DSAKEYFILE); - if (HAVE_OPT(X509DSACERTFILE)) + if (ENABLED_OPT(X509DSACERTFILE)) x509_dsacertfile = OPT_ARG(X509DSACERTFILE); - if (HAVE_OPT(X509ECCKEYFILE)) + if (ENABLED_OPT(X509ECCKEYFILE)) x509_ecckeyfile = OPT_ARG(X509ECCKEYFILE); - if (HAVE_OPT(X509CERTFILE)) + if (ENABLED_OPT(X509CERTFILE)) x509_ecccertfile = OPT_ARG(X509ECCCERTFILE); - if (HAVE_OPT(X509CAFILE)) + if (ENABLED_OPT(X509CAFILE)) x509_cafile = OPT_ARG(X509CAFILE); - if (HAVE_OPT(X509CRLFILE)) + if (ENABLED_OPT(X509CRLFILE)) x509_crlfile = OPT_ARG(X509CRLFILE); - if (HAVE_OPT(PGPKEYFILE)) + if (ENABLED_OPT(PGPKEYFILE)) pgp_keyfile = OPT_ARG(PGPKEYFILE); - if (HAVE_OPT(PGPCERTFILE)) + if (ENABLED_OPT(PGPCERTFILE)) pgp_certfile = OPT_ARG(PGPCERTFILE); - if (HAVE_OPT(PGPKEYRING)) + if (ENABLED_OPT(PGPKEYRING)) pgp_keyring = OPT_ARG(PGPKEYRING); - if (HAVE_OPT(SRPPASSWD)) + if (ENABLED_OPT(SRPPASSWD)) srp_passwd = OPT_ARG(SRPPASSWD); - if (HAVE_OPT(SRPPASSWDCONF)) + if (ENABLED_OPT(SRPPASSWDCONF)) srp_passwd_conf = OPT_ARG(SRPPASSWDCONF); - if (HAVE_OPT(PSKPASSWD)) + if (ENABLED_OPT(PSKPASSWD)) psk_passwd = OPT_ARG(PSKPASSWD); } diff --git a/src/srptool-args.c b/src/srptool-args.c index 38b0b82a4b..2fc0990ab8 100644 --- a/src/srptool-args.c +++ b/src/srptool-args.c @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (srptool-args.c) * - * It has been AutoGen-ed January 21, 2012 at 01:58:49 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:15:51 AM by AutoGen 5.12 * From the definitions srptool-args.def * and the template file options * @@ -145,7 +145,7 @@ static char const zPasswd_ConfText[] = static char const zPasswd_Conf_NAME[] = "PASSWD_CONF"; static char const zPasswd_Conf_Name[] = "passwd-conf"; #define PASSWD_CONF_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Create_Conf option description: @@ -155,7 +155,7 @@ static char const zCreate_ConfText[] = static char const zCreate_Conf_NAME[] = "CREATE_CONF"; static char const zCreate_Conf_Name[] = "create-conf"; #define CREATE_CONF_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE)) + | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) /* * Help/More_Help/Version option descriptions: @@ -189,7 +189,7 @@ extern tOptProc optionStackArg, optionTimeDate, optionTimeVal, optionUnstackArg, optionVersionStderr; static tOptProc - doOptCreate_Conf, doOptDebug, doOptPasswd_Conf, doUsageOpt; + doOptDebug, doUsageOpt; /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * @@ -276,7 +276,7 @@ static tOptDesc optDesc[OPTION_CT] = { /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, - /* option proc */ doOptPasswd_Conf, + /* option proc */ NULL, /* desc, NAME, name */ zPasswd_ConfText, zPasswd_Conf_NAME, zPasswd_Conf_Name, /* disablement strs */ NULL, NULL }, @@ -288,7 +288,7 @@ static tOptDesc optDesc[OPTION_CT] = { /* last opt argumnt */ { NULL }, /* arg list/cookie */ NULL, /* must/cannot opts */ NULL, NULL, - /* option proc */ doOptCreate_Conf, + /* option proc */ NULL, /* desc, NAME, name */ zCreate_ConfText, zCreate_Conf_NAME, zCreate_Conf_Name, /* disablement strs */ NULL, NULL }, @@ -467,42 +467,6 @@ emit_ranges: optionShowRange(pOptions, pOptDesc, (void *)rng, 1); } - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * For the passwd-conf option. - */ -static void -doOptPasswd_Conf(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; - static tuFileMode mode; -#ifndef O_CLOEXEC -# define O_CLOEXEC 0 -#endif - mode.file_flags = O_CLOEXEC; - - optionFileCheck(pOptions, pOptDesc, type, mode); -} - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * For the create-conf option. - */ -static void -doOptCreate_Conf(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static teOptFileType const type = - FTYPE_MODE_MAY_EXIST + FTYPE_MODE_NO_OPEN; - static tuFileMode mode; -#ifndef O_CLOEXEC -# define O_CLOEXEC 0 -#endif - mode.file_flags = O_CLOEXEC; - - optionFileCheck(pOptions, pOptDesc, type, mode); -} /* extracted from optcode.tlib near line 666 */ #if ENABLE_NLS diff --git a/src/srptool-args.def.in b/src/srptool-args.def.in index e3375bb765..0fb80afdcf 100644 --- a/src/srptool-args.def.in +++ b/src/srptool-args.def.in @@ -79,15 +79,14 @@ flag = { flag = { name = passwd-conf; value = v; - arg-type = file; - file-exists; + arg-type = string; descrip = "specify a password conf file."; doc = "Specify a filename or a PKCS #11 URL to read the CAs from."; }; flag = { name = create-conf; - arg-type = file; + arg-type = string; descrip = "Generate a password configuration file."; doc = "This generates a password configuration file (tpasswd.conf) containing the required for TLS parameters."; diff --git a/src/srptool-args.h b/src/srptool-args.h index 1b38ac5e88..7eb07cdfe2 100644 --- a/src/srptool-args.h +++ b/src/srptool-args.h @@ -2,7 +2,7 @@ * * DO NOT EDIT THIS FILE (srptool-args.h) * - * It has been AutoGen-ed January 21, 2012 at 01:58:49 AM by AutoGen 5.12 + * It has been AutoGen-ed January 21, 2012 at 02:15:51 AM by AutoGen 5.12 * From the definitions srptool-args.def * and the template file options *