diff options
author | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-01-21 12:27:13 +0100 |
---|---|---|
committer | Nikos Mavrogiannopoulos <nmav@gnutls.org> | 2012-01-21 12:27:13 +0100 |
commit | 217daa4c01f79fc11720414e7083c785e40fef3b (patch) | |
tree | 79cd2a3050fcf413b96d6c3494c1d0008a7a712f | |
parent | 641a228f999ab7dae38245a7e4ccf74794fe7069 (diff) | |
download | gnutls-217daa4c01f79fc11720414e7083c785e40fef3b.tar.gz |
Removed all auto-generated files.
-rw-r--r-- | .gitignore | 10 | ||||
-rw-r--r-- | src/cli-args.c | 1288 | ||||
-rw-r--r-- | src/cli-args.h | 250 | ||||
-rw-r--r-- | src/cli-debug-args.c | 480 | ||||
-rw-r--r-- | src/cli-debug-args.h | 188 | ||||
-rw-r--r-- | src/psk-args.c | 502 | ||||
-rw-r--r-- | src/psk-args.h | 190 | ||||
-rw-r--r-- | src/serv-args.c | 1381 | ||||
-rw-r--r-- | src/serv-args.h | 248 | ||||
-rw-r--r-- | src/srptool-args.c | 561 | ||||
-rw-r--r-- | src/srptool-args.h | 198 |
11 files changed, 10 insertions, 5286 deletions
diff --git a/.gitignore b/.gitignore index 6a73e0bbaf..2736b243b0 100644 --- a/.gitignore +++ b/.gitignore @@ -565,3 +565,13 @@ doc/examples/ex-serv-x509 tests/slow/cipher-test libopts/libopts.la src/serv-args.def +src/cli-args.c +src/cli-args.h +src/cli-debug-args.c +src/cli-debug-args.h +src/psk-args.c +src/psk-args.h +src/serv-args.c +src/serv-args.h +src/srptool-args.c +src/srptool-args.h diff --git a/src/cli-args.c b/src/cli-args.c deleted file mode 100644 index ad9d1625b8..0000000000 --- a/src/cli-args.c +++ /dev/null @@ -1,1288 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (cli-args.c) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:16 AM by AutoGen 5.12 - * From the definitions cli-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-cli 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-cli 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-cli 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 "cli-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[278] = -"gnutls-cli 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[609] = -"gnutls-cli 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-cli 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)) - -/* - * Resume option description: - */ -static char const zResumeText[] = - "Connect, establish a session. Connect again and resume this session"; -static char const zResume_NAME[] = "RESUME"; -static char const zResume_Name[] = "resume"; -#define RESUME_FLAGS (OPTST_DISABLED) - -/* - * Rehandshake option description: - */ -static char const zRehandshakeText[] = - "Connect, establish a session and rehandshake immediately"; -static char const zRehandshake_NAME[] = "REHANDSHAKE"; -static char const zRehandshake_Name[] = "rehandshake"; -#define REHANDSHAKE_FLAGS (OPTST_DISABLED) - -/* - * 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) - -/* - * Starttls option description: - */ -static char const zStarttlsText[] = - "Connect, establish a plain session and start TLS when EOF or a SIGALRM is received"; -static char const zStarttls_NAME[] = "STARTTLS"; -static char const zStarttls_Name[] = "starttls"; -#define STARTTLS_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)) - -/* - * Crlf option description: - */ -static char const zCrlfText[] = - "Send CR LF instead of LF"; -static char const zCrlf_NAME[] = "CRLF"; -static char const zCrlf_Name[] = "crlf"; -#define CRLF_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) - -/* - * Fingerprint option description: - */ -static char const zFingerprintText[] = - "Send the openpgp fingerprint, instead of the key"; -static char const zFingerprint_NAME[] = "FINGERPRINT"; -static char const zFingerprint_Name[] = "fingerprint"; -#define FINGERPRINT_FLAGS (OPTST_DISABLED) - -/* - * Disable_Extensions option description: - */ -static char const zDisable_ExtensionsText[] = - "Disable all the TLS extensions"; -static char const zDisable_Extensions_NAME[] = "DISABLE_EXTENSIONS"; -static char const zDisable_Extensions_Name[] = "disable-extensions"; -#define DISABLE_EXTENSIONS_FLAGS (OPTST_DISABLED) - -/* - * Print_Cert option description: - */ -static char const zPrint_CertText[] = - "Print peer's certificate in PEM format"; -static char const zPrint_Cert_NAME[] = "PRINT_CERT"; -static char const zPrint_Cert_Name[] = "print-cert"; -#define PRINT_CERT_FLAGS (OPTST_DISABLED) - -/* - * Recordsize option description: - */ -static char const zRecordsizeText[] = - "The maximum record size to advertize"; -static char const zRecordsize_NAME[] = "RECORDSIZE"; -static char const zRecordsize_Name[] = "recordsize"; -#define RECORDSIZE_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) - -/* - * Verbose option description: - */ -static char const zVerboseText[] = - "More verbose output"; -static char const zVerbose_NAME[] = "VERBOSE"; -static char const zVerbose_Name[] = "verbose"; -#define VERBOSE_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)) - -/* - * 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)) - -/* - * 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)) - -/* - * Srpusername option description: - */ -static char const zSrpusernameText[] = - "SRP username to use"; -static char const zSrpusername_NAME[] = "SRPUSERNAME"; -static char const zSrpusername_Name[] = "srpusername"; -#define SRPUSERNAME_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Srppasswd option description: - */ -static char const zSrppasswdText[] = - "SRP password to use"; -static char const zSrppasswd_NAME[] = "SRPPASSWD"; -static char const zSrppasswd_Name[] = "srppasswd"; -#define SRPPASSWD_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Pskusername option description: - */ -static char const zPskusernameText[] = - "PSK username to use"; -static char const zPskusername_NAME[] = "PSKUSERNAME"; -static char const zPskusername_Name[] = "pskusername"; -#define PSKUSERNAME_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Pskkey option description: - */ -static char const zPskkeyText[] = - "PSK key (in hex) to use"; -static char const zPskkey_NAME[] = "PSKKEY"; -static char const zPskkey_Name[] = "pskkey"; -#define PSKKEY_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_STRING)) - -/* - * Insecure option description: - */ -static char const zInsecureText[] = - "Don't abort program if server certificate can't be validated"; -static char const zInsecure_NAME[] = "INSECURE"; -static char const zInsecure_Name[] = "insecure"; -#define INSECURE_FLAGS (OPTST_DISABLED) - -/* - * Benchmark_Ciphers option description: - */ -static char const zBenchmark_CiphersText[] = - "Benchmark individual ciphers"; -static char const zBenchmark_Ciphers_NAME[] = "BENCHMARK_CIPHERS"; -static char const zBenchmark_Ciphers_Name[] = "benchmark-ciphers"; -#define BENCHMARK_CIPHERS_FLAGS (OPTST_DISABLED) - -/* - * Benchmark_Soft_Ciphers option description: - */ -static char const zBenchmark_Soft_CiphersText[] = - "Benchmark individual software ciphers (no hw acceleration)"; -static char const zBenchmark_Soft_Ciphers_NAME[] = "BENCHMARK_SOFT_CIPHERS"; -static char const zBenchmark_Soft_Ciphers_Name[]= "benchmark-soft-ciphers"; -#define BENCHMARK_SOFT_CIPHERS_FLAGS (OPTST_DISABLED) - -/* - * Benchmark_Tls option description: - */ -static char const zBenchmark_TlsText[] = - "Benchmark ciphers and key exchange methods in TLS"; -static char const zBenchmark_Tls_NAME[] = "BENCHMARK_TLS"; -static char const zBenchmark_Tls_Name[] = "benchmark-tls"; -#define BENCHMARK_TLS_FLAGS (OPTST_DISABLED) - -/* - * 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, doOptMtu, doOptPgpcertfile, - doOptPgpkeyfile, doOptPgpkeyring, doOptRecordsize, - doOptX509cafile, doOptX509certfile, doOptX509crlfile, - doOptX509keyfile, doUsageOpt; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Define the Gnutls_Cli 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_RESUME, - /* equiv idx, value */ 1, VALUE_OPT_RESUME, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ RESUME_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zResumeText, zResume_NAME, zResume_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 2, VALUE_OPT_REHANDSHAKE, - /* equiv idx, value */ 2, VALUE_OPT_REHANDSHAKE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ REHANDSHAKE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zRehandshakeText, zRehandshake_NAME, zRehandshake_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 3, VALUE_OPT_NOTICKET, - /* equiv idx, value */ 3, 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 */ 4, VALUE_OPT_STARTTLS, - /* equiv idx, value */ 4, VALUE_OPT_STARTTLS, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ STARTTLS_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zStarttlsText, zStarttls_NAME, zStarttls_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 5, VALUE_OPT_UDP, - /* equiv idx, value */ 5, 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 */ 6, VALUE_OPT_MTU, - /* equiv idx, value */ 6, 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 */ 7, VALUE_OPT_CRLF, - /* equiv idx, value */ 7, VALUE_OPT_CRLF, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ CRLF_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zCrlfText, zCrlf_NAME, zCrlf_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 8, VALUE_OPT_X509FMTDER, - /* equiv idx, value */ 8, 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 */ 9, VALUE_OPT_FINGERPRINT, - /* equiv idx, value */ 9, VALUE_OPT_FINGERPRINT, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ FINGERPRINT_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zFingerprintText, zFingerprint_NAME, zFingerprint_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 10, VALUE_OPT_DISABLE_EXTENSIONS, - /* equiv idx, value */ 10, VALUE_OPT_DISABLE_EXTENSIONS, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ DISABLE_EXTENSIONS_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zDisable_ExtensionsText, zDisable_Extensions_NAME, zDisable_Extensions_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 11, VALUE_OPT_PRINT_CERT, - /* equiv idx, value */ 11, VALUE_OPT_PRINT_CERT, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PRINT_CERT_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPrint_CertText, zPrint_Cert_NAME, zPrint_Cert_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 12, VALUE_OPT_RECORDSIZE, - /* equiv idx, value */ 12, VALUE_OPT_RECORDSIZE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ RECORDSIZE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ doOptRecordsize, - /* desc, NAME, name */ zRecordsizeText, zRecordsize_NAME, zRecordsize_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 13, VALUE_OPT_VERBOSE, - /* equiv idx, value */ 13, VALUE_OPT_VERBOSE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ VERBOSE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 14, VALUE_OPT_PRIORITY, - /* equiv idx, value */ 14, 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 */ 15, VALUE_OPT_X509CAFILE, - /* equiv idx, value */ 15, 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 */ 16, VALUE_OPT_X509CRLFILE, - /* equiv idx, value */ 16, 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 */ 17, VALUE_OPT_PGPKEYFILE, - /* equiv idx, value */ 17, 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 */ 18, VALUE_OPT_PGPKEYRING, - /* equiv idx, value */ 18, 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 */ 19, VALUE_OPT_PGPCERTFILE, - /* equiv idx, value */ 19, 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 */ 20, VALUE_OPT_X509KEYFILE, - /* equiv idx, value */ 20, 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 */ 21, VALUE_OPT_X509CERTFILE, - /* equiv idx, value */ 21, 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 */ 22, VALUE_OPT_PGPSUBKEY, - /* equiv idx, value */ 22, 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 */ 23, VALUE_OPT_SRPUSERNAME, - /* equiv idx, value */ 23, VALUE_OPT_SRPUSERNAME, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ SRPUSERNAME_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zSrpusernameText, zSrpusername_NAME, zSrpusername_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 24, VALUE_OPT_SRPPASSWD, - /* equiv idx, value */ 24, 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 */ NULL, - /* desc, NAME, name */ zSrppasswdText, zSrppasswd_NAME, zSrppasswd_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 25, VALUE_OPT_PSKUSERNAME, - /* equiv idx, value */ 25, VALUE_OPT_PSKUSERNAME, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PSKUSERNAME_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPskusernameText, zPskusername_NAME, zPskusername_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 26, VALUE_OPT_PSKKEY, - /* equiv idx, value */ 26, VALUE_OPT_PSKKEY, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PSKKEY_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPskkeyText, zPskkey_NAME, zPskkey_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 27, VALUE_OPT_PORT, - /* equiv idx, value */ 27, 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 */ NULL, - /* desc, NAME, name */ zPortText, zPort_NAME, zPort_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 28, VALUE_OPT_INSECURE, - /* equiv idx, value */ 28, VALUE_OPT_INSECURE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ INSECURE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zInsecureText, zInsecure_NAME, zInsecure_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 29, VALUE_OPT_BENCHMARK_CIPHERS, - /* equiv idx, value */ 29, VALUE_OPT_BENCHMARK_CIPHERS, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ BENCHMARK_CIPHERS_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zBenchmark_CiphersText, zBenchmark_Ciphers_NAME, zBenchmark_Ciphers_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 30, VALUE_OPT_BENCHMARK_SOFT_CIPHERS, - /* equiv idx, value */ 30, VALUE_OPT_BENCHMARK_SOFT_CIPHERS, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ BENCHMARK_SOFT_CIPHERS_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zBenchmark_Soft_CiphersText, zBenchmark_Soft_Ciphers_NAME, zBenchmark_Soft_Ciphers_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 31, VALUE_OPT_BENCHMARK_TLS, - /* equiv idx, value */ 31, VALUE_OPT_BENCHMARK_TLS, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ BENCHMARK_TLS_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zBenchmark_TlsText, zBenchmark_Tls_NAME, zBenchmark_Tls_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 32, VALUE_OPT_LIST, - /* equiv idx, value */ 32, 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_Cli Option Environment - */ -static char const zPROGNAME[11] = "GNUTLS_CLI"; -static char const zUsageTitle[100] = -"gnutls-cli - GnuTLS client - 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[195] = "\n\ -Simple client program to set up a TLS connection to some other computer.\n\ -It sets up a TLS connection and forwards data from the standard input\n\ -to the secured socket and vice versa.\n"; -static char const zFullVersion[] = GNUTLS_CLI_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_cli_full_usage NULL -static char const gnutls_cli_short_usage[] = - "Usage: gnutls-cli [options] hostname\n\ -gnutls-cli --help for usage instructions.\n"; - -#ifndef PKGDATADIR -# define PKGDATADIR "" -#endif - -#ifndef WITH_PACKAGER -# define gnutls_cli_packager_info NULL -#else -static char const gnutls_cli_packager_info[] = - "Packaged by " WITH_PACKAGER - -# ifdef WITH_PACKAGER_VERSION - " ("WITH_PACKAGER_VERSION")" -# endif - -# ifdef WITH_PACKAGER_BUG_REPORTS - "\nReport gnutls_cli bugs to " WITH_PACKAGER_BUG_REPORTS -# endif - "\n"; -#endif - -tOptions gnutls_cliOptions = { - 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 */ - }, - 36 /* full option count */, 33 /* user option count */, - gnutls_cli_full_usage, gnutls_cli_short_usage, - NULL, NULL, - PKGDATADIR, gnutls_cli_packager_info -}; - -/* - * Create the static procedure(s) declared above. - */ -static void -doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) -{ - (void)pOptions; - USAGE(GNUTLS_CLI_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 recordsize option. - */ -static void -doOptRecordsize(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static const struct {long const rmin, rmax;} rng[1] = { - { 0, 4096 } }; - 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 x509cafile option. - */ -static void -doOptX509cafile(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static teOptFileType const type = - FTYPE_MODE_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_CLI_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_cliOptions; - - /* - * 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_cliOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; - } -} - -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -/* cli-args.c ends here */ diff --git a/src/cli-args.h b/src/cli-args.h deleted file mode 100644 index 1540c63437..0000000000 --- a/src/cli-args.h +++ /dev/null @@ -1,250 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (cli-args.h) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:16 AM by AutoGen 5.12 - * From the definitions cli-args.def - * and the template file options - * - * Generated from AutoOpts 35:0:10 templates. - * - * AutoOpts is a copyrighted work. This header file is not encumbered - * by AutoOpts licensing, but is provided under the licensing terms chosen - * by the gnutls-cli 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-cli 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-cli 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/>. - */ -/* - * This file contains the programmatic interface to the Automated - * Options generated for the gnutls-cli program. - * These macros are documented in the AutoGen info file in the - * "AutoOpts" chapter. Please refer to that doc for usage help. - */ -#ifndef AUTOOPTS_CLI_ARGS_H_GUARD -#define AUTOOPTS_CLI_ARGS_H_GUARD 1 -#include "config.h" -#include <autoopts/options.h> - -/* - * Ensure that the library used for compiling this generated header is at - * least as new as the version current when the header template was released - * (not counting patch version increments). Also ensure that the oldest - * tolerable version is at least as old as what was current when the header - * template was released. - */ -#define AO_TEMPLATE_VERSION 143360 -#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ - || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) -# error option template version mismatches autoopts/options.h header - Choke Me. -#endif - -/* - * Enumeration of each option: - */ -typedef enum { - INDEX_OPT_DEBUG = 0, - INDEX_OPT_RESUME = 1, - INDEX_OPT_REHANDSHAKE = 2, - INDEX_OPT_NOTICKET = 3, - INDEX_OPT_STARTTLS = 4, - INDEX_OPT_UDP = 5, - INDEX_OPT_MTU = 6, - INDEX_OPT_CRLF = 7, - INDEX_OPT_X509FMTDER = 8, - INDEX_OPT_FINGERPRINT = 9, - INDEX_OPT_DISABLE_EXTENSIONS = 10, - INDEX_OPT_PRINT_CERT = 11, - INDEX_OPT_RECORDSIZE = 12, - INDEX_OPT_VERBOSE = 13, - INDEX_OPT_PRIORITY = 14, - INDEX_OPT_X509CAFILE = 15, - INDEX_OPT_X509CRLFILE = 16, - INDEX_OPT_PGPKEYFILE = 17, - INDEX_OPT_PGPKEYRING = 18, - INDEX_OPT_PGPCERTFILE = 19, - INDEX_OPT_X509KEYFILE = 20, - INDEX_OPT_X509CERTFILE = 21, - INDEX_OPT_PGPSUBKEY = 22, - INDEX_OPT_SRPUSERNAME = 23, - INDEX_OPT_SRPPASSWD = 24, - INDEX_OPT_PSKUSERNAME = 25, - INDEX_OPT_PSKKEY = 26, - INDEX_OPT_PORT = 27, - INDEX_OPT_INSECURE = 28, - INDEX_OPT_BENCHMARK_CIPHERS = 29, - INDEX_OPT_BENCHMARK_SOFT_CIPHERS = 30, - INDEX_OPT_BENCHMARK_TLS = 31, - INDEX_OPT_LIST = 32, - INDEX_OPT_VERSION = 33, - INDEX_OPT_HELP = 34, - INDEX_OPT_MORE_HELP = 35 -} teOptIndex; - -#define OPTION_CT 36 -#define GNUTLS_CLI_VERSION "3.0.12" -#define GNUTLS_CLI_FULL_VERSION "gnutls-cli 3.0.12" - -/* - * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT(DEBUG) - */ -#define DESC(n) (gnutls_cliOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) - -/* * * * * * - * - * Enumeration of gnutls-cli exit codes - */ -typedef enum { - GNUTLS_CLI_EXIT_SUCCESS = 0, - GNUTLS_CLI_EXIT_FAILURE = 1 -} gnutls_cli_exit_code_t; -/* * * * * * - * - * Interface defines for specific options. - */ -#define VALUE_OPT_DEBUG 'd' - -#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) -#define VALUE_OPT_RESUME 'r' -#define VALUE_OPT_REHANDSHAKE 'e' -#define VALUE_OPT_NOTICKET 3 -#define VALUE_OPT_STARTTLS 's' -#define VALUE_OPT_UDP 'u' -#define VALUE_OPT_MTU 6 - -#define OPT_VALUE_MTU (DESC(MTU).optArg.argInt) -#define VALUE_OPT_CRLF 7 -#define VALUE_OPT_X509FMTDER 8 -#define VALUE_OPT_FINGERPRINT 'f' -#define VALUE_OPT_DISABLE_EXTENSIONS 10 -#define VALUE_OPT_PRINT_CERT 11 -#define VALUE_OPT_RECORDSIZE 12 - -#define OPT_VALUE_RECORDSIZE (DESC(RECORDSIZE).optArg.argInt) -#define VALUE_OPT_VERBOSE 'V' -#define VALUE_OPT_PRIORITY 14 -#define VALUE_OPT_X509CAFILE 15 -#define VALUE_OPT_X509CRLFILE 16 -#define VALUE_OPT_PGPKEYFILE 17 -#define VALUE_OPT_PGPKEYRING 18 -#define VALUE_OPT_PGPCERTFILE 19 -#define VALUE_OPT_X509KEYFILE 20 -#define VALUE_OPT_X509CERTFILE 21 -#define VALUE_OPT_PGPSUBKEY 22 -#define VALUE_OPT_SRPUSERNAME 23 -#define VALUE_OPT_SRPPASSWD 24 -#define VALUE_OPT_PSKUSERNAME 25 -#define VALUE_OPT_PSKKEY 26 -#define VALUE_OPT_PORT 'p' -#define VALUE_OPT_INSECURE 28 -#define VALUE_OPT_BENCHMARK_CIPHERS 29 -#define VALUE_OPT_BENCHMARK_SOFT_CIPHERS 30 -#define VALUE_OPT_BENCHMARK_TLS 31 -#define VALUE_OPT_LIST 'l' -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' -#define VALUE_OPT_VERSION 'v' -/* - * Interface defines not associated with particular options - */ -#define ERRSKIP_OPTERR STMTS(gnutls_cliOptions.fOptSet &= ~OPTPROC_ERRSTOP) -#define ERRSTOP_OPTERR STMTS(gnutls_cliOptions.fOptSet |= OPTPROC_ERRSTOP) -#define RESTART_OPT(n) STMTS( \ - gnutls_cliOptions.curOptIdx = (n); \ - gnutls_cliOptions.pzCurOpt = NULL) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*gnutls_cliOptions.pUsageProc)(&gnutls_cliOptions, c) -/* extracted from opthead.tlib near line 451 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* * * * * * - * - * Globals exported from the GnuTLS client option definitions - */ -#include <gettext.h> - -/* * * * * * - * - * Declare the gnutls-cli option descriptor. - */ -extern tOptions gnutls_cliOptions; - -#if defined(ENABLE_NLS) -# ifndef _ -# include <stdio.h> -static inline char* aoGetsText(char const* pz) { - if (pz == NULL) return NULL; - return (char*)gettext(pz); -} -# define _(s) aoGetsText(s) -# endif /* _() */ - -# define OPT_NO_XLAT_CFG_NAMES STMTS(gnutls_cliOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT_CFG;) -# define OPT_NO_XLAT_OPT_NAMES STMTS(gnutls_cliOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) - -# define OPT_XLAT_CFG_NAMES STMTS(gnutls_cliOptions.fOptSet &= \ - ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) -# define OPT_XLAT_OPT_NAMES STMTS(gnutls_cliOptions.fOptSet &= \ - ~OPTPROC_NXLAT_OPT;) - -#else /* ENABLE_NLS */ -# define OPT_NO_XLAT_CFG_NAMES -# define OPT_NO_XLAT_OPT_NAMES - -# define OPT_XLAT_CFG_NAMES -# define OPT_XLAT_OPT_NAMES - -# ifndef _ -# define _(_s) _s -# endif -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -#endif /* AUTOOPTS_CLI_ARGS_H_GUARD */ -/* cli-args.h ends here */ diff --git a/src/cli-debug-args.c b/src/cli-debug-args.c deleted file mode 100644 index 3d0568bef9..0000000000 --- a/src/cli-debug-args.c +++ /dev/null @@ -1,480 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (cli-debug-args.c) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:18 AM by AutoGen 5.12 - * From the definitions cli-debug-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-cli-debug 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-cli-debug 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-cli-debug 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 "cli-debug-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[284] = -"gnutls-cli-debug 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[621] = -"gnutls-cli-debug is free software: you can redistribute it and/or modify\n\ -it under the terms of the GNU General Public License as published by\n\ -the Free Software Foundation, either version 3 of the License, or (at\n\ -your option) any later version.\n\n\ -gnutls-cli-debug is distributed in the hope that it will be useful, but\n\ -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY\n\ -or 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)) - -/* - * Verbose option description: - */ -static char const zVerboseText[] = - "More verbose output"; -static char const zVerbose_NAME[] = "VERBOSE"; -static char const zVerbose_Name[] = "verbose"; -#define VERBOSE_FLAGS (OPTST_DISABLED) - -/* - * 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)) - -/* - * 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, doOptPort, doUsageOpt; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Define the Gnutls_Cli_Debug 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_VERBOSE, - /* equiv idx, value */ 1, VALUE_OPT_VERBOSE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, NOLIMIT, 0, - /* opt state flags */ VERBOSE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zVerboseText, zVerbose_NAME, zVerbose_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 2, VALUE_OPT_PORT, - /* equiv idx, value */ 2, 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 */ doOptPort, - /* desc, NAME, name */ zPortText, zPort_NAME, zPort_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_Cli_Debug Option Environment - */ -static char const zPROGNAME[17] = "GNUTLS_CLI_DEBUG"; -static char const zUsageTitle[112] = -"gnutls-cli-debug - GnuTLS debug client - 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[171] = "\n\ -TLS debug client. It sets up multiple TLS connections to a server and\n\ -queries its capabilities. Can be used to check for servers with special\n\ -needs or bugs.\n"; -static char const zFullVersion[] = GNUTLS_CLI_DEBUG_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_cli_debug_full_usage NULL -static char const gnutls_cli_debug_short_usage[] = - "Usage: gnutls-cli-debug [options] hostname\n\ -gnutls-cli --help for usage instructions.\n"; - -#ifndef PKGDATADIR -# define PKGDATADIR "" -#endif - -#ifndef WITH_PACKAGER -# define gnutls_cli_debug_packager_info NULL -#else -static char const gnutls_cli_debug_packager_info[] = - "Packaged by " WITH_PACKAGER - -# ifdef WITH_PACKAGER_VERSION - " ("WITH_PACKAGER_VERSION")" -# endif - -# ifdef WITH_PACKAGER_BUG_REPORTS - "\nReport gnutls_cli_debug bugs to " WITH_PACKAGER_BUG_REPORTS -# endif - "\n"; -#endif - -tOptions gnutls_cli_debugOptions = { - 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 */ - }, - 6 /* full option count */, 3 /* user option count */, - gnutls_cli_debug_full_usage, gnutls_cli_debug_short_usage, - NULL, NULL, - PKGDATADIR, gnutls_cli_debug_packager_info -}; - -/* - * Create the static procedure(s) declared above. - */ -static void -doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) -{ - (void)pOptions; - USAGE(GNUTLS_CLI_DEBUG_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 port option. - */ -static void -doOptPort(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static const struct {long const rmin, rmax;} rng[1] = { - { 0 , 65536 } }; - 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); -} -/* 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_CLI_DEBUG_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_cli_debugOptions; - - /* - * 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_cli_debugOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; - } -} - -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -/* cli-debug-args.c ends here */ diff --git a/src/cli-debug-args.h b/src/cli-debug-args.h deleted file mode 100644 index 537d1b22f6..0000000000 --- a/src/cli-debug-args.h +++ /dev/null @@ -1,188 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (cli-debug-args.h) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:18 AM by AutoGen 5.12 - * From the definitions cli-debug-args.def - * and the template file options - * - * Generated from AutoOpts 35:0:10 templates. - * - * AutoOpts is a copyrighted work. This header file is not encumbered - * by AutoOpts licensing, but is provided under the licensing terms chosen - * by the gnutls-cli-debug 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-cli-debug 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-cli-debug 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/>. - */ -/* - * This file contains the programmatic interface to the Automated - * Options generated for the gnutls-cli-debug program. - * These macros are documented in the AutoGen info file in the - * "AutoOpts" chapter. Please refer to that doc for usage help. - */ -#ifndef AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD -#define AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD 1 -#include "config.h" -#include <autoopts/options.h> - -/* - * Ensure that the library used for compiling this generated header is at - * least as new as the version current when the header template was released - * (not counting patch version increments). Also ensure that the oldest - * tolerable version is at least as old as what was current when the header - * template was released. - */ -#define AO_TEMPLATE_VERSION 143360 -#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ - || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) -# error option template version mismatches autoopts/options.h header - Choke Me. -#endif - -/* - * Enumeration of each option: - */ -typedef enum { - INDEX_OPT_DEBUG = 0, - INDEX_OPT_VERBOSE = 1, - INDEX_OPT_PORT = 2, - INDEX_OPT_VERSION = 3, - INDEX_OPT_HELP = 4, - INDEX_OPT_MORE_HELP = 5 -} teOptIndex; - -#define OPTION_CT 6 -#define GNUTLS_CLI_DEBUG_VERSION "3.0.12" -#define GNUTLS_CLI_DEBUG_FULL_VERSION "gnutls-cli-debug 3.0.12" - -/* - * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT(DEBUG) - */ -#define DESC(n) (gnutls_cli_debugOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) - -/* * * * * * - * - * Enumeration of gnutls-cli-debug exit codes - */ -typedef enum { - GNUTLS_CLI_DEBUG_EXIT_SUCCESS = 0, - GNUTLS_CLI_DEBUG_EXIT_FAILURE = 1 -} gnutls_cli_debug_exit_code_t; -/* * * * * * - * - * Interface defines for specific options. - */ -#define VALUE_OPT_DEBUG 'd' - -#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) -#define VALUE_OPT_VERBOSE 'V' -#define VALUE_OPT_PORT 'p' - -#define OPT_VALUE_PORT (DESC(PORT).optArg.argInt) -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' -#define VALUE_OPT_VERSION 'v' -/* - * Interface defines not associated with particular options - */ -#define ERRSKIP_OPTERR STMTS(gnutls_cli_debugOptions.fOptSet &= ~OPTPROC_ERRSTOP) -#define ERRSTOP_OPTERR STMTS(gnutls_cli_debugOptions.fOptSet |= OPTPROC_ERRSTOP) -#define RESTART_OPT(n) STMTS( \ - gnutls_cli_debugOptions.curOptIdx = (n); \ - gnutls_cli_debugOptions.pzCurOpt = NULL) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*gnutls_cli_debugOptions.pUsageProc)(&gnutls_cli_debugOptions, c) -/* extracted from opthead.tlib near line 451 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* * * * * * - * - * Globals exported from the GnuTLS debug client option definitions - */ -#include <gettext.h> - -/* * * * * * - * - * Declare the gnutls-cli-debug option descriptor. - */ -extern tOptions gnutls_cli_debugOptions; - -#if defined(ENABLE_NLS) -# ifndef _ -# include <stdio.h> -static inline char* aoGetsText(char const* pz) { - if (pz == NULL) return NULL; - return (char*)gettext(pz); -} -# define _(s) aoGetsText(s) -# endif /* _() */ - -# define OPT_NO_XLAT_CFG_NAMES STMTS(gnutls_cli_debugOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT_CFG;) -# define OPT_NO_XLAT_OPT_NAMES STMTS(gnutls_cli_debugOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) - -# define OPT_XLAT_CFG_NAMES STMTS(gnutls_cli_debugOptions.fOptSet &= \ - ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) -# define OPT_XLAT_OPT_NAMES STMTS(gnutls_cli_debugOptions.fOptSet &= \ - ~OPTPROC_NXLAT_OPT;) - -#else /* ENABLE_NLS */ -# define OPT_NO_XLAT_CFG_NAMES -# define OPT_NO_XLAT_OPT_NAMES - -# define OPT_XLAT_CFG_NAMES -# define OPT_XLAT_OPT_NAMES - -# ifndef _ -# define _(_s) _s -# endif -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -#endif /* AUTOOPTS_CLI_DEBUG_ARGS_H_GUARD */ -/* cli-debug-args.h ends here */ diff --git a/src/psk-args.c b/src/psk-args.c deleted file mode 100644 index b5941534ca..0000000000 --- a/src/psk-args.c +++ /dev/null @@ -1,502 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (psk-args.c) - * - * It has been AutoGen-ed January 21, 2012 at 11:33:02 AM by AutoGen 5.12 - * From the definitions psk-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 psktool 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>psktool 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. - * - * psktool 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 "psk-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[275] = -"psktool 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[603] = -"psktool is free software: you can redistribute it and/or modify it under\n\ -the terms of the GNU General Public License as published by the Free\n\ -Software Foundation, either version 3 of the License, or (at your option)\n\ -any later version.\n\n\ -psktool 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)) - -/* - * Keysize option description: - */ -static char const zKeysizeText[] = - "specify the key size in bytes"; -static char const zKeysize_NAME[] = "KEYSIZE"; -static char const zKeysize_Name[] = "keysize"; -#define KEYSIZE_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) - -/* - * Username option description: - */ -static char const zUsernameText[] = - "specify a username"; -static char const zUsername_NAME[] = "USERNAME"; -static char const zUsername_Name[] = "username"; -#define USERNAME_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Passwd option description: - */ -static char const zPasswdText[] = - "specify a password file."; -static char const zPasswd_NAME[] = "PASSWD"; -static char const zPasswd_Name[] = "passwd"; -#define PASSWD_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, doOptKeysize, doUsageOpt; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Define the Psktool 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_KEYSIZE, - /* equiv idx, value */ 1, VALUE_OPT_KEYSIZE, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ KEYSIZE_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ doOptKeysize, - /* desc, NAME, name */ zKeysizeText, zKeysize_NAME, zKeysize_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 2, VALUE_OPT_USERNAME, - /* equiv idx, value */ 2, VALUE_OPT_USERNAME, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ USERNAME_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zUsernameText, zUsername_NAME, zUsername_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 3, VALUE_OPT_PASSWD, - /* equiv idx, value */ 3, VALUE_OPT_PASSWD, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PASSWD_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPasswdText, zPasswd_NAME, zPasswd_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 Psktool Option Environment - */ -static char const zPROGNAME[8] = "PSKTOOL"; -static char const zUsageTitle[99] = -"psktool - GnuTLS PSK tool - 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[126] = "\n\ -Program that generates random keys for use with TLS-PSK. The keys are\n\ -stored in hexadecimal format in a key file.\n"; -static char const zFullVersion[] = PSKTOOL_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 psktool_full_usage NULL -static char const psktool_short_usage[] = - "psktool [options]\n\ -psktool --help for usage instructions.\n"; - -#ifndef PKGDATADIR -# define PKGDATADIR "" -#endif - -#ifndef WITH_PACKAGER -# define psktool_packager_info NULL -#else -static char const psktool_packager_info[] = - "Packaged by " WITH_PACKAGER - -# ifdef WITH_PACKAGER_VERSION - " ("WITH_PACKAGER_VERSION")" -# endif - -# ifdef WITH_PACKAGER_BUG_REPORTS - "\nReport psktool bugs to " WITH_PACKAGER_BUG_REPORTS -# endif - "\n"; -#endif - -tOptions psktoolOptions = { - 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 */ - }, - 7 /* full option count */, 4 /* user option count */, - psktool_full_usage, psktool_short_usage, - NULL, NULL, - PKGDATADIR, psktool_packager_info -}; - -/* - * Create the static procedure(s) declared above. - */ -static void -doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) -{ - (void)pOptions; - USAGE(PSKTOOL_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 keysize option. - */ -static void -doOptKeysize(tOptions* pOptions, tOptDesc* pOptDesc) -{ - static const struct {long const rmin, rmax;} rng[1] = { - { 0 , 512 } }; - 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); -} -/* 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(PSKTOOL_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 = &psktoolOptions; - - /* - * 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 */ - psktoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; - } -} - -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -/* psk-args.c ends here */ diff --git a/src/psk-args.h b/src/psk-args.h deleted file mode 100644 index c9d4d90eaa..0000000000 --- a/src/psk-args.h +++ /dev/null @@ -1,190 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (psk-args.h) - * - * It has been AutoGen-ed January 21, 2012 at 11:33:02 AM by AutoGen 5.12 - * From the definitions psk-args.def - * and the template file options - * - * Generated from AutoOpts 35:0:10 templates. - * - * AutoOpts is a copyrighted work. This header file is not encumbered - * by AutoOpts licensing, but is provided under the licensing terms chosen - * by the psktool 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>psktool 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. - * - * psktool 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/>. - */ -/* - * This file contains the programmatic interface to the Automated - * Options generated for the psktool program. - * These macros are documented in the AutoGen info file in the - * "AutoOpts" chapter. Please refer to that doc for usage help. - */ -#ifndef AUTOOPTS_PSK_ARGS_H_GUARD -#define AUTOOPTS_PSK_ARGS_H_GUARD 1 -#include "config.h" -#include <autoopts/options.h> - -/* - * Ensure that the library used for compiling this generated header is at - * least as new as the version current when the header template was released - * (not counting patch version increments). Also ensure that the oldest - * tolerable version is at least as old as what was current when the header - * template was released. - */ -#define AO_TEMPLATE_VERSION 143360 -#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ - || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) -# error option template version mismatches autoopts/options.h header - Choke Me. -#endif - -/* - * Enumeration of each option: - */ -typedef enum { - INDEX_OPT_DEBUG = 0, - INDEX_OPT_KEYSIZE = 1, - INDEX_OPT_USERNAME = 2, - INDEX_OPT_PASSWD = 3, - INDEX_OPT_VERSION = 4, - INDEX_OPT_HELP = 5, - INDEX_OPT_MORE_HELP = 6 -} teOptIndex; - -#define OPTION_CT 7 -#define PSKTOOL_VERSION "3.0.12" -#define PSKTOOL_FULL_VERSION "psktool 3.0.12" - -/* - * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT(DEBUG) - */ -#define DESC(n) (psktoolOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) - -/* * * * * * - * - * Enumeration of psktool exit codes - */ -typedef enum { - PSKTOOL_EXIT_SUCCESS = 0, - PSKTOOL_EXIT_FAILURE = 1 -} psktool_exit_code_t; -/* * * * * * - * - * Interface defines for specific options. - */ -#define VALUE_OPT_DEBUG 'd' - -#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) -#define VALUE_OPT_KEYSIZE 's' - -#define OPT_VALUE_KEYSIZE (DESC(KEYSIZE).optArg.argInt) -#define VALUE_OPT_USERNAME 'u' -#define VALUE_OPT_PASSWD 'p' -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' -#define VALUE_OPT_VERSION 'v' -/* - * Interface defines not associated with particular options - */ -#define ERRSKIP_OPTERR STMTS(psktoolOptions.fOptSet &= ~OPTPROC_ERRSTOP) -#define ERRSTOP_OPTERR STMTS(psktoolOptions.fOptSet |= OPTPROC_ERRSTOP) -#define RESTART_OPT(n) STMTS( \ - psktoolOptions.curOptIdx = (n); \ - psktoolOptions.pzCurOpt = NULL) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*psktoolOptions.pUsageProc)(&psktoolOptions, c) -/* extracted from opthead.tlib near line 451 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* * * * * * - * - * Globals exported from the GnuTLS PSK tool option definitions - */ -#include <gettext.h> - -/* * * * * * - * - * Declare the psktool option descriptor. - */ -extern tOptions psktoolOptions; - -#if defined(ENABLE_NLS) -# ifndef _ -# include <stdio.h> -static inline char* aoGetsText(char const* pz) { - if (pz == NULL) return NULL; - return (char*)gettext(pz); -} -# define _(s) aoGetsText(s) -# endif /* _() */ - -# define OPT_NO_XLAT_CFG_NAMES STMTS(psktoolOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT_CFG;) -# define OPT_NO_XLAT_OPT_NAMES STMTS(psktoolOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) - -# define OPT_XLAT_CFG_NAMES STMTS(psktoolOptions.fOptSet &= \ - ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) -# define OPT_XLAT_OPT_NAMES STMTS(psktoolOptions.fOptSet &= \ - ~OPTPROC_NXLAT_OPT;) - -#else /* ENABLE_NLS */ -# define OPT_NO_XLAT_CFG_NAMES -# define OPT_NO_XLAT_OPT_NAMES - -# define OPT_XLAT_CFG_NAMES -# define OPT_XLAT_OPT_NAMES - -# ifndef _ -# define _(_s) _s -# endif -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -#endif /* AUTOOPTS_PSK_ARGS_H_GUARD */ -/* psk-args.h ends here */ diff --git a/src/serv-args.c b/src/serv-args.c deleted file mode 100644 index 2fc66a781f..0000000000 --- a/src/serv-args.c +++ /dev/null @@ -1,1381 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (serv-args.c) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:09 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[100] = -"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_NO_ARGS - + 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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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_MUST_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 */ diff --git a/src/serv-args.h b/src/serv-args.h deleted file mode 100644 index a8c1a23156..0000000000 --- a/src/serv-args.h +++ /dev/null @@ -1,248 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (serv-args.h) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:09 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 header 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/>. - */ -/* - * This file contains the programmatic interface to the Automated - * Options generated for the gnutls-serv program. - * These macros are documented in the AutoGen info file in the - * "AutoOpts" chapter. Please refer to that doc for usage help. - */ -#ifndef AUTOOPTS_SERV_ARGS_H_GUARD -#define AUTOOPTS_SERV_ARGS_H_GUARD 1 -#include "config.h" -#include <autoopts/options.h> - -/* - * Ensure that the library used for compiling this generated header is at - * least as new as the version current when the header template was released - * (not counting patch version increments). Also ensure that the oldest - * tolerable version is at least as old as what was current when the header - * template was released. - */ -#define AO_TEMPLATE_VERSION 143360 -#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ - || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) -# error option template version mismatches autoopts/options.h header - Choke Me. -#endif - -/* - * Enumeration of each option: - */ -typedef enum { - INDEX_OPT_DEBUG = 0, - INDEX_OPT_NOTICKET = 1, - INDEX_OPT_GENERATE = 2, - INDEX_OPT_QUIET = 3, - INDEX_OPT_NODB = 4, - INDEX_OPT_HTTP = 5, - INDEX_OPT_ECHO = 6, - INDEX_OPT_UDP = 7, - INDEX_OPT_MTU = 8, - INDEX_OPT_DISABLE_CLIENT_CERT = 9, - INDEX_OPT_REQUIRE_CLIENT_CERT = 10, - INDEX_OPT_X509FMTDER = 11, - INDEX_OPT_PRIORITY = 12, - INDEX_OPT_DHPARAMS = 13, - INDEX_OPT_X509CAFILE = 14, - INDEX_OPT_X509CRLFILE = 15, - INDEX_OPT_PGPKEYFILE = 16, - INDEX_OPT_PGPKEYRING = 17, - INDEX_OPT_PGPCERTFILE = 18, - INDEX_OPT_X509KEYFILE = 19, - INDEX_OPT_X509CERTFILE = 20, - INDEX_OPT_X509DSAKEYFILE = 21, - INDEX_OPT_X509DSACERTFILE = 22, - INDEX_OPT_X509ECCKEYFILE = 23, - INDEX_OPT_X509ECCCERTFILE = 24, - INDEX_OPT_PGPSUBKEY = 25, - INDEX_OPT_SRPPASSWD = 26, - INDEX_OPT_SRPPASSWDCONF = 27, - INDEX_OPT_PSKPASSWD = 28, - INDEX_OPT_PSKHINT = 29, - INDEX_OPT_PORT = 30, - INDEX_OPT_LIST = 31, - INDEX_OPT_VERSION = 32, - INDEX_OPT_HELP = 33, - INDEX_OPT_MORE_HELP = 34 -} teOptIndex; - -#define OPTION_CT 35 -#define GNUTLS_SERV_VERSION "3.0.12" -#define GNUTLS_SERV_FULL_VERSION "gnutls-serv 3.0.12" - -/* - * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT(DEBUG) - */ -#define DESC(n) (gnutls_servOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) - -/* * * * * * - * - * Enumeration of gnutls-serv exit codes - */ -typedef enum { - GNUTLS_SERV_EXIT_SUCCESS = 0, - GNUTLS_SERV_EXIT_FAILURE = 1 -} gnutls_serv_exit_code_t; -/* * * * * * - * - * Interface defines for specific options. - */ -#define VALUE_OPT_DEBUG 'd' - -#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) -#define VALUE_OPT_NOTICKET 1 -#define VALUE_OPT_GENERATE 'g' -#define VALUE_OPT_QUIET 'q' -#define VALUE_OPT_NODB 4 -#define VALUE_OPT_HTTP 5 -#define VALUE_OPT_ECHO 6 -#define VALUE_OPT_UDP 'u' -#define VALUE_OPT_MTU 8 - -#define OPT_VALUE_MTU (DESC(MTU).optArg.argInt) -#define VALUE_OPT_DISABLE_CLIENT_CERT 'a' -#define VALUE_OPT_REQUIRE_CLIENT_CERT 'r' -#define VALUE_OPT_X509FMTDER 11 -#define VALUE_OPT_PRIORITY 12 -#define VALUE_OPT_DHPARAMS 13 -#define VALUE_OPT_X509CAFILE 14 -#define VALUE_OPT_X509CRLFILE 15 -#define VALUE_OPT_PGPKEYFILE 16 -#define VALUE_OPT_PGPKEYRING 17 -#define VALUE_OPT_PGPCERTFILE 18 -#define VALUE_OPT_X509KEYFILE 19 -#define VALUE_OPT_X509CERTFILE 20 -#define VALUE_OPT_X509DSAKEYFILE 21 -#define VALUE_OPT_X509DSACERTFILE 22 -#define VALUE_OPT_X509ECCKEYFILE 23 -#define VALUE_OPT_X509ECCCERTFILE 24 -#define VALUE_OPT_PGPSUBKEY 25 -#define VALUE_OPT_SRPPASSWD 26 -#define VALUE_OPT_SRPPASSWDCONF 27 -#define VALUE_OPT_PSKPASSWD 28 -#define VALUE_OPT_PSKHINT 29 -#define VALUE_OPT_PORT 'p' - -#define OPT_VALUE_PORT (DESC(PORT).optArg.argInt) -#define VALUE_OPT_LIST 'l' -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' -#define VALUE_OPT_VERSION 'v' -/* - * Interface defines not associated with particular options - */ -#define ERRSKIP_OPTERR STMTS(gnutls_servOptions.fOptSet &= ~OPTPROC_ERRSTOP) -#define ERRSTOP_OPTERR STMTS(gnutls_servOptions.fOptSet |= OPTPROC_ERRSTOP) -#define RESTART_OPT(n) STMTS( \ - gnutls_servOptions.curOptIdx = (n); \ - gnutls_servOptions.pzCurOpt = NULL) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*gnutls_servOptions.pUsageProc)(&gnutls_servOptions, c) -/* extracted from opthead.tlib near line 451 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* * * * * * - * - * Globals exported from the GnuTLS server option definitions - */ -#include <gettext.h> - -/* * * * * * - * - * Declare the gnutls-serv option descriptor. - */ -extern tOptions gnutls_servOptions; - -#if defined(ENABLE_NLS) -# ifndef _ -# include <stdio.h> -static inline char* aoGetsText(char const* pz) { - if (pz == NULL) return NULL; - return (char*)gettext(pz); -} -# define _(s) aoGetsText(s) -# endif /* _() */ - -# define OPT_NO_XLAT_CFG_NAMES STMTS(gnutls_servOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT_CFG;) -# define OPT_NO_XLAT_OPT_NAMES STMTS(gnutls_servOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) - -# define OPT_XLAT_CFG_NAMES STMTS(gnutls_servOptions.fOptSet &= \ - ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) -# define OPT_XLAT_OPT_NAMES STMTS(gnutls_servOptions.fOptSet &= \ - ~OPTPROC_NXLAT_OPT;) - -#else /* ENABLE_NLS */ -# define OPT_NO_XLAT_CFG_NAMES -# define OPT_NO_XLAT_OPT_NAMES - -# define OPT_XLAT_CFG_NAMES -# define OPT_XLAT_OPT_NAMES - -# ifndef _ -# define _(_s) _s -# endif -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -#endif /* AUTOOPTS_SERV_ARGS_H_GUARD */ -/* serv-args.h ends here */ diff --git a/src/srptool-args.c b/src/srptool-args.c deleted file mode 100644 index 86780d4bde..0000000000 --- a/src/srptool-args.c +++ /dev/null @@ -1,561 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (srptool-args.c) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:11 AM by AutoGen 5.12 - * From the definitions srptool-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 srptool 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>srptool 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. - * - * srptool 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 "srptool-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[275] = -"srptool 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[603] = -"srptool is free software: you can redistribute it and/or modify it under\n\ -the terms of the GNU General Public License as published by the Free\n\ -Software Foundation, either version 3 of the License, or (at your option)\n\ -any later version.\n\n\ -srptool 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)) - -/* - * Index option description: - */ -static char const zIndexText[] = - "specify the index of the group parameters in tpasswd.conf to use."; -static char const zIndex_NAME[] = "INDEX"; -static char const zIndex_Name[] = "index"; -#define INDEX_FLAGS (OPTST_DISABLED) - -/* - * Username option description: - */ -static char const zUsernameText[] = - "specify a username"; -static char const zUsername_NAME[] = "USERNAME"; -static char const zUsername_Name[] = "username"; -#define USERNAME_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Passwd option description: - */ -static char const zPasswdText[] = - "specify a password file."; -static char const zPasswd_NAME[] = "PASSWD"; -static char const zPasswd_Name[] = "passwd"; -#define PASSWD_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_STRING)) - -/* - * Salt option description: - */ -static char const zSaltText[] = - "specify salt size for crypt algorithm."; -static char const zSalt_NAME[] = "SALT"; -static char const zSalt_Name[] = "salt"; -#define SALT_FLAGS (OPTST_DISABLED \ - | OPTST_SET_ARGTYPE(OPARG_TYPE_NUMERIC)) - -/* - * Verify option description: - */ -static char const zVerifyText[] = - "just verify the password."; -static char const zVerify_NAME[] = "VERIFY"; -static char const zVerify_Name[] = "verify"; -#define VERIFY_FLAGS (OPTST_DISABLED) - -/* - * Passwd_Conf option description: - */ -static char const zPasswd_ConfText[] = - "specify a password conf file."; -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_STRING)) - -/* - * Create_Conf option description: - */ -static char const zCreate_ConfText[] = - "Generate a password configuration file."; -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_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, doUsageOpt; - -/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * - * - * Define the Srptool 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_INDEX, - /* equiv idx, value */ 1, VALUE_OPT_INDEX, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ INDEX_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zIndexText, zIndex_NAME, zIndex_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 2, VALUE_OPT_USERNAME, - /* equiv idx, value */ 2, VALUE_OPT_USERNAME, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ USERNAME_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zUsernameText, zUsername_NAME, zUsername_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 3, VALUE_OPT_PASSWD, - /* equiv idx, value */ 3, VALUE_OPT_PASSWD, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PASSWD_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPasswdText, zPasswd_NAME, zPasswd_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 4, VALUE_OPT_SALT, - /* equiv idx, value */ 4, VALUE_OPT_SALT, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ SALT_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ optionNumericVal, - /* desc, NAME, name */ zSaltText, zSalt_NAME, zSalt_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 5, VALUE_OPT_VERIFY, - /* equiv idx, value */ 5, VALUE_OPT_VERIFY, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ VERIFY_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zVerifyText, zVerify_NAME, zVerify_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 6, VALUE_OPT_PASSWD_CONF, - /* equiv idx, value */ 6, VALUE_OPT_PASSWD_CONF, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ PASSWD_CONF_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zPasswd_ConfText, zPasswd_Conf_NAME, zPasswd_Conf_Name, - /* disablement strs */ NULL, NULL }, - - { /* entry idx, value */ 7, VALUE_OPT_CREATE_CONF, - /* equiv idx, value */ 7, VALUE_OPT_CREATE_CONF, - /* equivalenced to */ NO_EQUIVALENT, - /* min, max, act ct */ 0, 1, 0, - /* opt state flags */ CREATE_CONF_FLAGS, 0, - /* last opt argumnt */ { NULL }, - /* arg list/cookie */ NULL, - /* must/cannot opts */ NULL, NULL, - /* option proc */ NULL, - /* desc, NAME, name */ zCreate_ConfText, zCreate_Conf_NAME, zCreate_Conf_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 Srptool Option Environment - */ -static char const zPROGNAME[8] = "SRPTOOL"; -static char const zUsageTitle[99] = -"srptool - GnuTLS SRP tool - 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[473] = "\n\ -Simple program that emulates the programs in the Stanford SRP (Secure\n\ -Remote Password) libraries using GnuTLS. It is intended for use in\n\ -places where you don't expect SRP authentication to be the used for\n\ -system users.\n\n\ -In brief, to use SRP you need to create two files. These are the\n\ -password file that holds the users and the verifiers associated with\n\ -them and the configuration file to hold the group parameters (called\n\ -tpasswd.conf).\n"; -static char const zFullVersion[] = SRPTOOL_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 srptool_full_usage NULL -static char const srptool_short_usage[] = - "srptool [options]\n\ -srptool --help for usage instructions.\n"; - -#ifndef PKGDATADIR -# define PKGDATADIR "" -#endif - -#ifndef WITH_PACKAGER -# define srptool_packager_info NULL -#else -static char const srptool_packager_info[] = - "Packaged by " WITH_PACKAGER - -# ifdef WITH_PACKAGER_VERSION - " ("WITH_PACKAGER_VERSION")" -# endif - -# ifdef WITH_PACKAGER_BUG_REPORTS - "\nReport srptool bugs to " WITH_PACKAGER_BUG_REPORTS -# endif - "\n"; -#endif - -tOptions srptoolOptions = { - 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 */ - }, - 11 /* full option count */, 8 /* user option count */, - srptool_full_usage, srptool_short_usage, - NULL, NULL, - PKGDATADIR, srptool_packager_info -}; - -/* - * Create the static procedure(s) declared above. - */ -static void -doUsageOpt(tOptions * pOptions, tOptDesc * pOptDesc) -{ - (void)pOptions; - USAGE(SRPTOOL_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); -} -/* 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(SRPTOOL_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 = &srptoolOptions; - - /* - * 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 */ - srptoolOptions.fOptSet |= OPTPROC_NXLAT_OPT_CFG | OPTPROC_NXLAT_OPT; - } -} - -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -/* srptool-args.c ends here */ diff --git a/src/srptool-args.h b/src/srptool-args.h deleted file mode 100644 index b1309bb4f9..0000000000 --- a/src/srptool-args.h +++ /dev/null @@ -1,198 +0,0 @@ -/* -*- buffer-read-only: t -*- vi: set ro: - * - * DO NOT EDIT THIS FILE (srptool-args.h) - * - * It has been AutoGen-ed January 21, 2012 at 11:30:11 AM by AutoGen 5.12 - * From the definitions srptool-args.def - * and the template file options - * - * Generated from AutoOpts 35:0:10 templates. - * - * AutoOpts is a copyrighted work. This header file is not encumbered - * by AutoOpts licensing, but is provided under the licensing terms chosen - * by the srptool 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>srptool 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. - * - * srptool 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/>. - */ -/* - * This file contains the programmatic interface to the Automated - * Options generated for the srptool program. - * These macros are documented in the AutoGen info file in the - * "AutoOpts" chapter. Please refer to that doc for usage help. - */ -#ifndef AUTOOPTS_SRPTOOL_ARGS_H_GUARD -#define AUTOOPTS_SRPTOOL_ARGS_H_GUARD 1 -#include "config.h" -#include <autoopts/options.h> - -/* - * Ensure that the library used for compiling this generated header is at - * least as new as the version current when the header template was released - * (not counting patch version increments). Also ensure that the oldest - * tolerable version is at least as old as what was current when the header - * template was released. - */ -#define AO_TEMPLATE_VERSION 143360 -#if (AO_TEMPLATE_VERSION < OPTIONS_MINIMUM_VERSION) \ - || (AO_TEMPLATE_VERSION > OPTIONS_STRUCT_VERSION) -# error option template version mismatches autoopts/options.h header - Choke Me. -#endif - -/* - * Enumeration of each option: - */ -typedef enum { - INDEX_OPT_DEBUG = 0, - INDEX_OPT_INDEX = 1, - INDEX_OPT_USERNAME = 2, - INDEX_OPT_PASSWD = 3, - INDEX_OPT_SALT = 4, - INDEX_OPT_VERIFY = 5, - INDEX_OPT_PASSWD_CONF = 6, - INDEX_OPT_CREATE_CONF = 7, - INDEX_OPT_VERSION = 8, - INDEX_OPT_HELP = 9, - INDEX_OPT_MORE_HELP = 10 -} teOptIndex; - -#define OPTION_CT 11 -#define SRPTOOL_VERSION "3.0.12" -#define SRPTOOL_FULL_VERSION "srptool 3.0.12" - -/* - * Interface defines for all options. Replace "n" with the UPPER_CASED - * option name (as in the teOptIndex enumeration above). - * e.g. HAVE_OPT(DEBUG) - */ -#define DESC(n) (srptoolOptions.pOptDesc[INDEX_OPT_## n]) -#define HAVE_OPT(n) (! UNUSED_OPT(& DESC(n))) -#define OPT_ARG(n) (DESC(n).optArg.argString) -#define STATE_OPT(n) (DESC(n).fOptState & OPTST_SET_MASK) -#define COUNT_OPT(n) (DESC(n).optOccCt) -#define ISSEL_OPT(n) (SELECTED_OPT(&DESC(n))) -#define ISUNUSED_OPT(n) (UNUSED_OPT(& DESC(n))) -#define ENABLED_OPT(n) (! DISABLED_OPT(& DESC(n))) -#define STACKCT_OPT(n) (((tArgList*)(DESC(n).optCookie))->useCt) -#define STACKLST_OPT(n) (((tArgList*)(DESC(n).optCookie))->apzArgs) -#define CLEAR_OPT(n) STMTS( \ - DESC(n).fOptState &= OPTST_PERSISTENT_MASK; \ - if ((DESC(n).fOptState & OPTST_INITENABLED) == 0) \ - DESC(n).fOptState |= OPTST_DISABLED; \ - DESC(n).optCookie = NULL ) - -/* * * * * * - * - * Enumeration of srptool exit codes - */ -typedef enum { - SRPTOOL_EXIT_SUCCESS = 0, - SRPTOOL_EXIT_FAILURE = 1 -} srptool_exit_code_t; -/* * * * * * - * - * Interface defines for specific options. - */ -#define VALUE_OPT_DEBUG 'd' - -#define OPT_VALUE_DEBUG (DESC(DEBUG).optArg.argInt) -#define VALUE_OPT_INDEX 'i' -#define VALUE_OPT_USERNAME 'u' -#define VALUE_OPT_PASSWD 'p' -#define VALUE_OPT_SALT 's' - -#define OPT_VALUE_SALT (DESC(SALT).optArg.argInt) -#define VALUE_OPT_VERIFY 5 -#define VALUE_OPT_PASSWD_CONF 'v' -#define VALUE_OPT_CREATE_CONF 7 -#define VALUE_OPT_HELP '?' -#define VALUE_OPT_MORE_HELP '!' -#define VALUE_OPT_VERSION 'v' -/* - * Interface defines not associated with particular options - */ -#define ERRSKIP_OPTERR STMTS(srptoolOptions.fOptSet &= ~OPTPROC_ERRSTOP) -#define ERRSTOP_OPTERR STMTS(srptoolOptions.fOptSet |= OPTPROC_ERRSTOP) -#define RESTART_OPT(n) STMTS( \ - srptoolOptions.curOptIdx = (n); \ - srptoolOptions.pzCurOpt = NULL) -#define START_OPT RESTART_OPT(1) -#define USAGE(c) (*srptoolOptions.pUsageProc)(&srptoolOptions, c) -/* extracted from opthead.tlib near line 451 */ - -#ifdef __cplusplus -extern "C" { -#endif - -/* * * * * * - * - * Globals exported from the GnuTLS SRP tool option definitions - */ -#include <gettext.h> - -/* * * * * * - * - * Declare the srptool option descriptor. - */ -extern tOptions srptoolOptions; - -#if defined(ENABLE_NLS) -# ifndef _ -# include <stdio.h> -static inline char* aoGetsText(char const* pz) { - if (pz == NULL) return NULL; - return (char*)gettext(pz); -} -# define _(s) aoGetsText(s) -# endif /* _() */ - -# define OPT_NO_XLAT_CFG_NAMES STMTS(srptoolOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT_CFG;) -# define OPT_NO_XLAT_OPT_NAMES STMTS(srptoolOptions.fOptSet |= \ - OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG;) - -# define OPT_XLAT_CFG_NAMES STMTS(srptoolOptions.fOptSet &= \ - ~(OPTPROC_NXLAT_OPT|OPTPROC_NXLAT_OPT_CFG);) -# define OPT_XLAT_OPT_NAMES STMTS(srptoolOptions.fOptSet &= \ - ~OPTPROC_NXLAT_OPT;) - -#else /* ENABLE_NLS */ -# define OPT_NO_XLAT_CFG_NAMES -# define OPT_NO_XLAT_OPT_NAMES - -# define OPT_XLAT_CFG_NAMES -# define OPT_XLAT_OPT_NAMES - -# ifndef _ -# define _(_s) _s -# endif -#endif /* ENABLE_NLS */ - -#ifdef __cplusplus -} -#endif -#endif /* AUTOOPTS_SRPTOOL_ARGS_H_GUARD */ -/* srptool-args.h ends here */ |