--- /dev/null
+/* -*- buffer-read-only: t -*- vi: set ro:
+ *
+ * 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
+ * From the definitions serv-args.def
+ * and the template file options
+ *
+ * Generated from AutoOpts 35:0:10 templates.
+ *
+ * AutoOpts is a copyrighted work. This source file is not encumbered
+ * by AutoOpts licensing, but is provided under the licensing terms chosen
+ * by the gnutls-serv author or copyright holder. AutoOpts is
+ * licensed under the terms of the LGPL. The redistributable library
+ * (``libopts'') is licensed under the terms of either the LGPL or, at the
+ * users discretion, the BSD license. See the AutoOpts and/or libopts sources
+ * for details.
+ *
+ * This source file is copyrighted and licensed under the following terms:
+ *
+ * Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.
+ * This is free software. It is licensed for use, modification and
+ * redistribution under the terms of the
+ * GNU General Public License, version 3 or later
+ * <http://gnu.org/licenses/gpl.html>
+ *
+PFX>gnutls-serv is free software: you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * gnutls-serv is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * See the GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+#include <sys/types.h>
+
+#include <limits.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <errno.h>
+#define OPTION_CODE_COMPILE 1
+#include "serv-args.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+extern FILE * option_usage_fp;
+
+/* TRANSLATORS: choose the translation for option names wisely because you
+ cannot ever change your mind. */
+static char const zCopyright[279] =
+"gnutls-serv 3.0.12\n\
+Copyright (C) 2000-2012 Free Software Foundation, all rights reserved.\n\
+This is free software. It is licensed for use, modification and\n\
+redistribution under the terms of the\n\
+GNU General Public License, version 3 or later\n\
+ <http://gnu.org/licenses/gpl.html>\n";
+static char const zLicenseDescrip[611] =
+"gnutls-serv is free software: you can redistribute it and/or modify it\n\
+under the terms of the GNU General Public License as published by the\n\
+Free Software Foundation, either version 3 of the License, or (at your\n\
+option) any later version.\n\n\
+gnutls-serv is distributed in the hope that it will be useful, but WITHOUT\n\
+ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n\
+FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n\
+for more details.\n\n\
+You should have received a copy of the GNU General Public License along\n\
+with this program. If not, see <http://www.gnu.org/licenses/>.\n";
+
+extern tUsageProc optionUsage;
+
+#ifndef NULL
+# define NULL 0
+#endif
+
+/*
+ * Debug option description:
+ */
+static char const zDebugText[] =
+ "Enable debugging";
+static char const zDebug_NAME[] = "DEBUG";
+static char const zDebug_Name[] = "debug";
+#define DEBUG_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * Noticket option description:
+ */
+static char const zNoticketText[] =
+ "Don't accept session tickets";
+static char const zNoticket_NAME[] = "NOTICKET";
+static char const zNoticket_Name[] = "noticket";
+#define NOTICKET_FLAGS (OPTST_DISABLED)
+
+/*
+ * Generate option description:
+ */
+static char const zGenerateText[] =
+ "Generate Diffie-Hellman and RSA-export parameters";
+static char const zGenerate_NAME[] = "GENERATE";
+static char const zGenerate_Name[] = "generate";
+#define GENERATE_FLAGS (OPTST_DISABLED)
+
+/*
+ * Quiet option description:
+ */
+static char const zQuietText[] =
+ "Suppress some messages";
+static char const zQuiet_NAME[] = "QUIET";
+static char const zQuiet_Name[] = "quiet";
+#define QUIET_FLAGS (OPTST_DISABLED)
+
+/*
+ * Nodb option description:
+ */
+static char const zNodbText[] =
+ "Do not use a resumption database";
+static char const zNodb_NAME[] = "NODB";
+static char const zNodb_Name[] = "nodb";
+#define NODB_FLAGS (OPTST_DISABLED)
+
+/*
+ * Http option description:
+ */
+static char const zHttpText[] =
+ "Act as an HTTP server";
+static char const zHttp_NAME[] = "HTTP";
+static char const zHttp_Name[] = "http";
+#define HTTP_FLAGS (OPTST_DISABLED)
+
+/*
+ * Echo option description:
+ */
+static char const zEchoText[] =
+ "Act as an Echo server";
+static char const zEcho_NAME[] = "ECHO";
+static char const zEcho_Name[] = "echo";
+#define ECHO_FLAGS (OPTST_DISABLED)
+
+/*
+ * Udp option description:
+ */
+static char const zUdpText[] =
+ "Use DTLS (datagram TLS) over UDP";
+static char const zUdp_NAME[] = "UDP";
+static char const zUdp_Name[] = "udp";
+#define UDP_FLAGS (OPTST_DISABLED)
+
+/*
+ * Mtu option description:
+ */
+static char const zMtuText[] =
+ "Set MTU for datagram TLS";
+static char const zMtu_NAME[] = "MTU";
+static char const zMtu_Name[] = "mtu";
+#define MTU_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * Disable_Client_Cert option description:
+ */
+static char const zDisable_Client_CertText[] =
+ "Do not request a client certificate";
+static char const zDisable_Client_Cert_NAME[] = "DISABLE_CLIENT_CERT";
+static char const zDisable_Client_Cert_Name[]= "disable-client-cert";
+#define DISABLE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
+
+/*
+ * Require_Client_Cert option description:
+ */
+static char const zRequire_Client_CertText[] =
+ "Require a client certificate";
+static char const zRequire_Client_Cert_NAME[] = "REQUIRE_CLIENT_CERT";
+static char const zRequire_Client_Cert_Name[]= "require-client-cert";
+#define REQUIRE_CLIENT_CERT_FLAGS (OPTST_DISABLED)
+
+/*
+ * X509fmtder option description:
+ */
+static char const zX509fmtderText[] =
+ "Use DER format for certificates to read from";
+static char const zX509fmtder_NAME[] = "X509FMTDER";
+static char const zX509fmtder_Name[] = "x509fmtder";
+#define X509FMTDER_FLAGS (OPTST_DISABLED)
+
+/*
+ * Priority option description:
+ */
+static char const zPriorityText[] =
+ "Priorities string";
+static char const zPriority_NAME[] = "PRIORITY";
+static char const zPriority_Name[] = "priority";
+#define PRIORITY_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Dhparams option description:
+ */
+static char const zDhparamsText[] =
+ "DH params file to use";
+static char const zDhparams_NAME[] = "DHPARAMS";
+static char const zDhparams_Name[] = "dhparams";
+#define DHPARAMS_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509cafile option description:
+ */
+static char const zX509cafileText[] =
+ "Certificate file or PKCS #11 URL to use";
+static char const zX509cafile_NAME[] = "X509CAFILE";
+static char const zX509cafile_Name[] = "x509cafile";
+#define X509CAFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509crlfile option description:
+ */
+static char const zX509crlfileText[] =
+ "CRL file to use";
+static char const zX509crlfile_NAME[] = "X509CRLFILE";
+static char const zX509crlfile_Name[] = "x509crlfile";
+#define X509CRLFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pgpkeyfile option description:
+ */
+static char const zPgpkeyfileText[] =
+ "PGP Key file to use";
+static char const zPgpkeyfile_NAME[] = "PGPKEYFILE";
+static char const zPgpkeyfile_Name[] = "pgpkeyfile";
+#define PGPKEYFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pgpkeyring option description:
+ */
+static char const zPgpkeyringText[] =
+ "PGP Key ring file to use";
+static char const zPgpkeyring_NAME[] = "PGPKEYRING";
+static char const zPgpkeyring_Name[] = "pgpkeyring";
+#define PGPKEYRING_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pgpcertfile option description:
+ */
+static char const zPgpcertfileText[] =
+ "PGP Public Key (certificate) file to use";
+static char const zPgpcertfile_NAME[] = "PGPCERTFILE";
+static char const zPgpcertfile_Name[] = "pgpcertfile";
+#define PGPCERTFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509keyfile option description:
+ */
+static char const zX509keyfileText[] =
+ "X.509 key file or PKCS #11 URL to use";
+static char const zX509keyfile_NAME[] = "X509KEYFILE";
+static char const zX509keyfile_Name[] = "x509keyfile";
+#define X509KEYFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509certfile option description:
+ */
+static char const zX509certfileText[] =
+ "X.509 Certificate file or PKCS #11 URL to use";
+static char const zX509certfile_NAME[] = "X509CERTFILE";
+static char const zX509certfile_Name[] = "x509certfile";
+#define X509CERTFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509dsakeyfile option description:
+ */
+static char const zX509dsakeyfileText[] =
+ "Alternative X.509 key file or PKCS #11 URL to use";
+static char const zX509dsakeyfile_NAME[] = "X509DSAKEYFILE";
+static char const zX509dsakeyfile_Name[] = "x509dsakeyfile";
+#define X509DSAKEYFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509dsacertfile option description:
+ */
+static char const zX509dsacertfileText[] =
+ "Alternative X.509 Certificate file or PKCS #11 URL to use";
+static char const zX509dsacertfile_NAME[] = "X509DSACERTFILE";
+static char const zX509dsacertfile_Name[] = "x509dsacertfile";
+#define X509DSACERTFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509ecckeyfile option description:
+ */
+static char const zX509ecckeyfileText[] =
+ "Alternative X.509 key file or PKCS #11 URL to use";
+static char const zX509ecckeyfile_NAME[] = "X509ECCKEYFILE";
+static char const zX509ecckeyfile_Name[] = "x509ecckeyfile";
+#define X509ECCKEYFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * X509ecccertfile option description:
+ */
+static char const zX509ecccertfileText[] =
+ "Alternative X.509 Certificate file or PKCS #11 URL to use";
+static char const zX509ecccertfile_NAME[] = "X509ECCCERTFILE";
+static char const zX509ecccertfile_Name[] = "x509ecccertfile";
+#define X509ECCCERTFILE_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pgpsubkey option description:
+ */
+static char const zPgpsubkeyText[] =
+ "PGP subkey to use (hex or auto)";
+static char const zPgpsubkey_NAME[] = "PGPSUBKEY";
+static char const zPgpsubkey_Name[] = "pgpsubkey";
+#define PGPSUBKEY_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Srppasswd option description:
+ */
+static char const zSrppasswdText[] =
+ "SRP password file to use";
+static char const zSrppasswd_NAME[] = "SRPPASSWD";
+static char const zSrppasswd_Name[] = "srppasswd";
+#define SRPPASSWD_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Srppasswdconf option description:
+ */
+static char const zSrppasswdconfText[] =
+ "SRP password configuration file to use";
+static char const zSrppasswdconf_NAME[] = "SRPPASSWDCONF";
+static char const zSrppasswdconf_Name[] = "srppasswdconf";
+#define SRPPASSWDCONF_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pskpasswd option description:
+ */
+static char const zPskpasswdText[] =
+ "PSK password file to use";
+static char const zPskpasswd_NAME[] = "PSKPASSWD";
+static char const zPskpasswd_Name[] = "pskpasswd";
+#define PSKPASSWD_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_FILE))
+
+/*
+ * Pskhint option description:
+ */
+static char const zPskhintText[] =
+ "PSK identity hint to use";
+static char const zPskhint_NAME[] = "PSKHINT";
+static char const zPskhint_Name[] = "pskhint";
+#define PSKHINT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Port option description:
+ */
+static char const zPortText[] =
+ "The port to connect to";
+static char const zPort_NAME[] = "PORT";
+static char const zPort_Name[] = "port";
+#define PORT_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC))
+
+/*
+ * List option description:
+ */
+static char const zListText[] =
+ "Print a list of the supported algorithms and modes";
+static char const zList_NAME[] = "LIST";
+static char const zList_Name[] = "list";
+#define LIST_FLAGS (OPTST_DISABLED \
+ | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING))
+
+/*
+ * Help/More_Help/Version option descriptions:
+ */
+static char const zHelpText[] = "Display extended usage information and exit";
+static char const zHelp_Name[] = "help";
+#ifdef HAVE_WORKING_FORK
+#define OPTST_MORE_HELP_FLAGS (OPTST_IMM | OPTST_NO_INIT)
+static char const zMore_Help_Name[] = "more-help";
+static char const zMore_HelpText[] = "Extended usage information passed thru pager";
+#else
+#define OPTST_MORE_HELP_FLAGS (OPTST_OMITTED | OPTST_NO_INIT)
+#define zMore_Help_Name NULL
+#define zMore_HelpText NULL
+#endif
+#ifdef NO_OPTIONAL_OPT_ARGS
+# define OPTST_VERSION_FLAGS OPTST_IMM | OPTST_NO_INIT
+#else
+# define OPTST_VERSION_FLAGS OPTST_SET_ARGTYPE(OPARG_TYPE_STRING) | \
+ OPTST_ARG_OPTIONAL | OPTST_IMM | OPTST_NO_INIT
+#endif
+
+static char const zVersionText[] = "Output version information and exit";
+static char const zVersion_Name[] = "version";
+/*
+ * Declare option callback procedures
+ */
+extern tOptProc
+ optionBooleanVal, optionNestedVal, optionNumericVal,
+ optionPagedUsage, optionPrintVersion, optionResetOpt,
+ optionStackArg, optionTimeDate, optionTimeVal,
+ optionUnstackArg, optionVersionStderr;
+static tOptProc
+ doOptDebug, doOptDhparams, doOptMtu,
+ doOptPgpcertfile, doOptPgpkeyfile, doOptPgpkeyring,
+ doOptPskpasswd, doOptSrppasswd, doOptSrppasswdconf,
+ doOptX509cafile, doOptX509certfile, doOptX509crlfile,
+ doOptX509dsacertfile, doOptX509dsakeyfile, doOptX509ecccertfile,
+ doOptX509ecckeyfile, doOptX509keyfile, doUsageOpt;
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the Gnutls_Serv Option Descriptions.
+ */
+static tOptDesc optDesc[OPTION_CT] = {
+ { /* entry idx, value */ 0, VALUE_OPT_DEBUG,
+ /* equiv idx, value */ 0, VALUE_OPT_DEBUG,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ DEBUG_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptDebug,
+ /* desc, NAME, name */ zDebugText, zDebug_NAME, zDebug_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 1, VALUE_OPT_NOTICKET,
+ /* equiv idx, value */ 1, VALUE_OPT_NOTICKET,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ NOTICKET_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zNoticketText, zNoticket_NAME, zNoticket_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 2, VALUE_OPT_GENERATE,
+ /* equiv idx, value */ 2, VALUE_OPT_GENERATE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ GENERATE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zGenerateText, zGenerate_NAME, zGenerate_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 3, VALUE_OPT_QUIET,
+ /* equiv idx, value */ 3, VALUE_OPT_QUIET,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ QUIET_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zQuietText, zQuiet_NAME, zQuiet_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 4, VALUE_OPT_NODB,
+ /* equiv idx, value */ 4, VALUE_OPT_NODB,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ NODB_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zNodbText, zNodb_NAME, zNodb_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 5, VALUE_OPT_HTTP,
+ /* equiv idx, value */ 5, VALUE_OPT_HTTP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ HTTP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zHttpText, zHttp_NAME, zHttp_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 6, VALUE_OPT_ECHO,
+ /* equiv idx, value */ 6, VALUE_OPT_ECHO,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ ECHO_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zEchoText, zEcho_NAME, zEcho_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 7, VALUE_OPT_UDP,
+ /* equiv idx, value */ 7, VALUE_OPT_UDP,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ UDP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zUdpText, zUdp_NAME, zUdp_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 8, VALUE_OPT_MTU,
+ /* equiv idx, value */ 8, VALUE_OPT_MTU,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ MTU_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptMtu,
+ /* desc, NAME, name */ zMtuText, zMtu_NAME, zMtu_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 9, VALUE_OPT_DISABLE_CLIENT_CERT,
+ /* equiv idx, value */ 9, VALUE_OPT_DISABLE_CLIENT_CERT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ DISABLE_CLIENT_CERT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zDisable_Client_CertText, zDisable_Client_Cert_NAME, zDisable_Client_Cert_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 10, VALUE_OPT_REQUIRE_CLIENT_CERT,
+ /* equiv idx, value */ 10, VALUE_OPT_REQUIRE_CLIENT_CERT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ REQUIRE_CLIENT_CERT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zRequire_Client_CertText, zRequire_Client_Cert_NAME, zRequire_Client_Cert_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 11, VALUE_OPT_X509FMTDER,
+ /* equiv idx, value */ 11, VALUE_OPT_X509FMTDER,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509FMTDER_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zX509fmtderText, zX509fmtder_NAME, zX509fmtder_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 12, VALUE_OPT_PRIORITY,
+ /* equiv idx, value */ 12, VALUE_OPT_PRIORITY,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PRIORITY_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zPriorityText, zPriority_NAME, zPriority_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 13, VALUE_OPT_DHPARAMS,
+ /* equiv idx, value */ 13, VALUE_OPT_DHPARAMS,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ DHPARAMS_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptDhparams,
+ /* desc, NAME, name */ zDhparamsText, zDhparams_NAME, zDhparams_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 14, VALUE_OPT_X509CAFILE,
+ /* equiv idx, value */ 14, VALUE_OPT_X509CAFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509CAFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509cafile,
+ /* desc, NAME, name */ zX509cafileText, zX509cafile_NAME, zX509cafile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 15, VALUE_OPT_X509CRLFILE,
+ /* equiv idx, value */ 15, VALUE_OPT_X509CRLFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509CRLFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509crlfile,
+ /* desc, NAME, name */ zX509crlfileText, zX509crlfile_NAME, zX509crlfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 16, VALUE_OPT_PGPKEYFILE,
+ /* equiv idx, value */ 16, VALUE_OPT_PGPKEYFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PGPKEYFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptPgpkeyfile,
+ /* desc, NAME, name */ zPgpkeyfileText, zPgpkeyfile_NAME, zPgpkeyfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 17, VALUE_OPT_PGPKEYRING,
+ /* equiv idx, value */ 17, VALUE_OPT_PGPKEYRING,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PGPKEYRING_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptPgpkeyring,
+ /* desc, NAME, name */ zPgpkeyringText, zPgpkeyring_NAME, zPgpkeyring_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 18, VALUE_OPT_PGPCERTFILE,
+ /* equiv idx, value */ 18, VALUE_OPT_PGPCERTFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PGPCERTFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptPgpcertfile,
+ /* desc, NAME, name */ zPgpcertfileText, zPgpcertfile_NAME, zPgpcertfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 19, VALUE_OPT_X509KEYFILE,
+ /* equiv idx, value */ 19, VALUE_OPT_X509KEYFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509KEYFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509keyfile,
+ /* desc, NAME, name */ zX509keyfileText, zX509keyfile_NAME, zX509keyfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 20, VALUE_OPT_X509CERTFILE,
+ /* equiv idx, value */ 20, VALUE_OPT_X509CERTFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509CERTFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509certfile,
+ /* desc, NAME, name */ zX509certfileText, zX509certfile_NAME, zX509certfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 21, VALUE_OPT_X509DSAKEYFILE,
+ /* equiv idx, value */ 21, VALUE_OPT_X509DSAKEYFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509DSAKEYFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509dsakeyfile,
+ /* desc, NAME, name */ zX509dsakeyfileText, zX509dsakeyfile_NAME, zX509dsakeyfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 22, VALUE_OPT_X509DSACERTFILE,
+ /* equiv idx, value */ 22, VALUE_OPT_X509DSACERTFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509DSACERTFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509dsacertfile,
+ /* desc, NAME, name */ zX509dsacertfileText, zX509dsacertfile_NAME, zX509dsacertfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 23, VALUE_OPT_X509ECCKEYFILE,
+ /* equiv idx, value */ 23, VALUE_OPT_X509ECCKEYFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509ECCKEYFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509ecckeyfile,
+ /* desc, NAME, name */ zX509ecckeyfileText, zX509ecckeyfile_NAME, zX509ecckeyfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 24, VALUE_OPT_X509ECCCERTFILE,
+ /* equiv idx, value */ 24, VALUE_OPT_X509ECCCERTFILE,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ X509ECCCERTFILE_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptX509ecccertfile,
+ /* desc, NAME, name */ zX509ecccertfileText, zX509ecccertfile_NAME, zX509ecccertfile_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 25, VALUE_OPT_PGPSUBKEY,
+ /* equiv idx, value */ 25, VALUE_OPT_PGPSUBKEY,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PGPSUBKEY_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zPgpsubkeyText, zPgpsubkey_NAME, zPgpsubkey_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 26, VALUE_OPT_SRPPASSWD,
+ /* equiv idx, value */ 26, VALUE_OPT_SRPPASSWD,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SRPPASSWD_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptSrppasswd,
+ /* desc, NAME, name */ zSrppasswdText, zSrppasswd_NAME, zSrppasswd_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 27, VALUE_OPT_SRPPASSWDCONF,
+ /* equiv idx, value */ 27, VALUE_OPT_SRPPASSWDCONF,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ SRPPASSWDCONF_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptSrppasswdconf,
+ /* desc, NAME, name */ zSrppasswdconfText, zSrppasswdconf_NAME, zSrppasswdconf_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 28, VALUE_OPT_PSKPASSWD,
+ /* equiv idx, value */ 28, VALUE_OPT_PSKPASSWD,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PSKPASSWD_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doOptPskpasswd,
+ /* desc, NAME, name */ zPskpasswdText, zPskpasswd_NAME, zPskpasswd_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 29, VALUE_OPT_PSKHINT,
+ /* equiv idx, value */ 29, VALUE_OPT_PSKHINT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PSKHINT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zPskhintText, zPskhint_NAME, zPskhint_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 30, VALUE_OPT_PORT,
+ /* equiv idx, value */ 30, VALUE_OPT_PORT,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ PORT_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionNumericVal,
+ /* desc, NAME, name */ zPortText, zPort_NAME, zPort_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ 31, VALUE_OPT_LIST,
+ /* equiv idx, value */ 31, VALUE_OPT_LIST,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ LIST_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ NULL,
+ /* desc, NAME, name */ zListText, zList_NAME, zList_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_VERSION, VALUE_OPT_VERSION,
+ /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_VERSION_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPrintVersion,
+ /* desc, NAME, name */ zVersionText, NULL, zVersion_Name,
+ /* disablement strs */ NULL, NULL },
+
+
+
+ { /* entry idx, value */ INDEX_OPT_HELP, VALUE_OPT_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_IMM | OPTST_NO_INIT, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ doUsageOpt,
+ /* desc, NAME, name */ zHelpText, NULL, zHelp_Name,
+ /* disablement strs */ NULL, NULL },
+
+ { /* entry idx, value */ INDEX_OPT_MORE_HELP, VALUE_OPT_MORE_HELP,
+ /* equiv idx value */ NO_EQUIVALENT, 0,
+ /* equivalenced to */ NO_EQUIVALENT,
+ /* min, max, act ct */ 0, 1, 0,
+ /* opt state flags */ OPTST_MORE_HELP_FLAGS, 0,
+ /* last opt argumnt */ { NULL },
+ /* arg list/cookie */ NULL,
+ /* must/cannot opts */ NULL, NULL,
+ /* option proc */ optionPagedUsage,
+ /* desc, NAME, name */ zMore_HelpText, NULL, zMore_Help_Name,
+ /* disablement strs */ NULL, NULL }
+};
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * Define the Gnutls_Serv Option Environment
+ */
+static char const zPROGNAME[12] = "GNUTLS_SERV";
+static char const zUsageTitle[101] =
+"gnutls-serv - GnuTLS server - Ver. 3.0.12\n\
+USAGE: %s [ -<flag> [<val>] | --<name>[{=| }<val>] ]... \n";
+#define zRcName NULL
+#define apzHomeList NULL
+
+static char const zBugsAddr[19] = "bug-gnutls@gnu.org";
+#define zExplain NULL
+static char const zDetail[65] = "\n\
+Server program that listens to incoming TLS connections.\n";
+static char const zFullVersion[] = GNUTLS_SERV_FULL_VERSION;
+/* extracted from optcode.tlib near line 515 */
+
+#if defined(ENABLE_NLS)
+# define OPTPROC_BASE OPTPROC_TRANSLATE
+ static tOptionXlateProc translate_option_strings;
+#else
+# define OPTPROC_BASE OPTPROC_NONE
+# define translate_option_strings NULL
+#endif /* ENABLE_NLS */
+
+
+#define gnutls_serv_full_usage NULL
+static char const gnutls_serv_short_usage[] =
+ "Usage: gnutls-serv [options]\n\
+gnutls-serv --help for usage instructions.\n";
+
+#ifndef PKGDATADIR
+# define PKGDATADIR ""
+#endif
+
+#ifndef WITH_PACKAGER
+# define gnutls_serv_packager_info NULL
+#else
+static char const gnutls_serv_packager_info[] =
+ "Packaged by " WITH_PACKAGER
+
+# ifdef WITH_PACKAGER_VERSION
+ " ("WITH_PACKAGER_VERSION")"
+# endif
+
+# ifdef WITH_PACKAGER_BUG_REPORTS
+ "\nReport gnutls_serv bugs to " WITH_PACKAGER_BUG_REPORTS
+# endif
+ "\n";
+#endif
+
+tOptions gnutls_servOptions = {
+ OPTIONS_STRUCT_VERSION,
+ 0, NULL, /* original argc + argv */
+ ( OPTPROC_BASE
+ + OPTPROC_ERRSTOP
+ + OPTPROC_SHORTOPT
+ + OPTPROC_LONGOPT
+ + OPTPROC_NO_REQ_OPT
+ + OPTPROC_ARGS_REQ
+ + OPTPROC_REORDER
+ + OPTPROC_GNUUSAGE
+ + OPTPROC_MISUSE ),
+ 0, NULL, /* current option index, current option */
+ NULL, NULL, zPROGNAME,
+ zRcName, zCopyright, zLicenseDescrip,
+ zFullVersion, apzHomeList, zUsageTitle,
+ zExplain, zDetail, optDesc,
+ zBugsAddr, /* address to send bugs to */
+ NULL, NULL, /* extensions/saved state */
+ optionUsage, /* usage procedure */
+ translate_option_strings, /* translation procedure */
+ /*
+ * Indexes to special options
+ */
+ { INDEX_OPT_MORE_HELP, /* more-help option index */
+ NO_EQUIVALENT, /* save option index */
+ NO_EQUIVALENT, /* '-#' option index */
+ NO_EQUIVALENT /* index of default opt */
+ },
+ 35 /* full option count */, 32 /* user option count */,
+ gnutls_serv_full_usage, gnutls_serv_short_usage,
+ NULL, NULL,
+ PKGDATADIR, gnutls_serv_packager_info
+};
+
+/*
+ * Create the static procedure(s) declared above.
+ */
+static void
+doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc)
+{
+ (void)pOptions;
+ USAGE(GNUTLS_SERV_EXIT_SUCCESS);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * For the debug option.
+ */
+static void
+doOptDebug(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static const struct {long const rmin, rmax;} rng[1] = {
+ { 0 , 9999 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * For the mtu option.
+ */
+static void
+doOptMtu(tOptions* pOptions, tOptDesc* pOptDesc)
+{
+ static const struct {long const rmin, rmax;} rng[1] = {
+ { 0, 17000 } };
+ int ix;
+
+ if (pOptions <= OPTPROC_EMIT_LIMIT)
+ goto emit_ranges;
+ optionNumericVal(pOptions, pOptDesc);
+
+ for (ix = 0; ix < 1; ix++) {
+ if (pOptDesc->optArg.argInt < rng[ix].rmin)
+ continue; /* ranges need not be ordered. */
+ if (pOptDesc->optArg.argInt == rng[ix].rmin)
+ return;
+ if (rng[ix].rmax == LONG_MIN)
+ continue;
+ if (pOptDesc->optArg.argInt <= rng[ix].rmax)
+ return;
+ }
+
+ option_usage_fp = stderr;
+
+emit_ranges:
+
+ optionShowRange(pOptions, pOptDesc, (void *)rng, 1);
+}
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * For the dhparams option.
+ */
+static void
+doOptDhparams(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 x509cafile option.
+ */
+static void
+doOptX509cafile(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 x509crlfile option.
+ */
+static void
+doOptX509crlfile(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 pgpkeyfile option.
+ */
+static void
+doOptPgpkeyfile(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 pgpkeyring option.
+ */
+static void
+doOptPgpkeyring(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 pgpcertfile option.
+ */
+static void
+doOptPgpcertfile(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 x509keyfile option.
+ */
+static void
+doOptX509keyfile(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 x509certfile option.
+ */
+static void
+doOptX509certfile(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 x509dsakeyfile option.
+ */
+static void
+doOptX509dsakeyfile(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 x509dsacertfile option.
+ */
+static void
+doOptX509dsacertfile(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 x509ecckeyfile option.
+ */
+static void
+doOptX509ecckeyfile(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 x509ecccertfile option.
+ */
+static void
+doOptX509ecccertfile(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 srppasswd option.
+ */
+static void
+doOptSrppasswd(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 srppasswdconf option.
+ */
+static void
+doOptSrppasswdconf(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 pskpasswd option.
+ */
+static void
+doOptPskpasswd(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
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <autoopts/usage-txt.h>
+
+static char* AO_gettext(char const* pz);
+static void coerce_it(void** s);
+
+static char*
+AO_gettext(char const* pz)
+{
+ char* pzRes;
+ if (pz == NULL)
+ return NULL;
+ pzRes = _(pz);
+ if (pzRes == pz)
+ return pzRes;
+ pzRes = strdup(pzRes);
+ if (pzRes == NULL) {
+ fputs(_("No memory for duping translated strings\n"), stderr);
+ exit(GNUTLS_SERV_EXIT_FAILURE);
+ }
+ return pzRes;
+}
+
+static void coerce_it(void** s) { *s = AO_gettext(*s);
+}
+
+/*
+ * This invokes the translation code (e.g. gettext(3)).
+ */
+static void
+translate_option_strings(void)
+{
+ tOptions * const pOpt = &gnutls_servOptions;
+
+ /*
+ * Guard against re-translation. It won't work. The strings will have
+ * been changed by the first pass through this code. One shot only.
+ */
+ if (option_usage_text.field_ct != 0) {
+ /*
+ * Do the translations. The first pointer follows the field count
+ * field. The field count field is the size of a pointer.
+ */
+ tOptDesc * pOD = pOpt->pOptDesc;
+ char ** ppz = (char**)(void*)&(option_usage_text);
+ int ix = option_usage_text.field_ct;
+
+ do {
+ ppz++;
+ *ppz = AO_gettext(*ppz);
+ } while (--ix > 0);
+
+ coerce_it((void*)&(pOpt->pzCopyright));
+ coerce_it((void*)&(pOpt->pzCopyNotice));
+ coerce_it((void*)&(pOpt->pzFullVersion));
+ coerce_it((void*)&(pOpt->pzUsageTitle));
+ coerce_it((void*)&(pOpt->pzExplain));
+ coerce_it((void*)&(pOpt->pzDetail));
+ coerce_it((void*)&(pOpt->pzPackager));
+ coerce_it((void*)&(pOpt->pzShortUsage));
+ option_usage_text.field_ct = 0;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++)
+ coerce_it((void*)&(pOD->pzText));
+ }
+
+ if ((pOpt->fOptSet & OPTPROC_NXLAT_OPT_CFG) == 0) {
+ tOptDesc * pOD = pOpt->pOptDesc;
+ int ix;
+
+ for (ix = pOpt->optCt; ix > 0; ix--, pOD++) {
+ coerce_it((void*)&(pOD->pz_Name));
+ coerce_it((void*)&(pOD->pz_DisableName));
+ coerce_it((void*)&(pOD->pz_DisablePfx));
+ }
+ /* prevent re-translation */
+ gnutls_servOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT;
+ }
+}
+
+#endif /* ENABLE_NLS */
+
+#ifdef __cplusplus
+}
+#endif
+/* serv-args.c ends here */