summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Josefsson <simon@josefsson.org>2012-01-24 14:48:20 +0100
committerSimon Josefsson <simon@josefsson.org>2012-01-24 14:57:19 +0100
commit94138b8e4fe7edf901bc239f9b5dbe14aea68dc6 (patch)
tree691b6fb4645cd563dd8ce90ab1c5fd86704f36b9
parent836c75deeaa0b1d046e3162ca206096298da463d (diff)
downloadgnutls-94138b8e4fe7edf901bc239f9b5dbe14aea68dc6.tar.gz
Move libopts/ to src/libopts/. Drop gaa remains.
-rw-r--r--Makefile.am10
-rw-r--r--configure.ac22
-rw-r--r--libopts/Makefile.am29
-rw-r--r--src/Makefile.am7
-rw-r--r--src/cli-gaa.c1350
-rw-r--r--src/cli-gaa.h91
-rw-r--r--src/libopts/COPYING.gplv3 (renamed from libopts/COPYING.gplv3)0
-rw-r--r--src/libopts/COPYING.lgplv3 (renamed from libopts/COPYING.lgplv3)0
-rw-r--r--src/libopts/COPYING.mbsd (renamed from libopts/COPYING.mbsd)0
-rw-r--r--src/libopts/MakeDefs.inc (renamed from libopts/MakeDefs.inc)0
-rw-r--r--src/libopts/Makefile.am29
-rw-r--r--src/libopts/README (renamed from libopts/README)0
-rw-r--r--src/libopts/ag-char-map.h (renamed from libopts/ag-char-map.h)0
-rw-r--r--src/libopts/autoopts.c (renamed from libopts/autoopts.c)0
-rw-r--r--src/libopts/autoopts.h (renamed from libopts/autoopts.h)0
-rw-r--r--src/libopts/autoopts/options.h (renamed from libopts/autoopts/options.h)0
-rw-r--r--src/libopts/autoopts/project.h (renamed from libopts/autoopts/project.h)0
-rw-r--r--src/libopts/autoopts/usage-txt.h (renamed from libopts/autoopts/usage-txt.h)0
-rw-r--r--src/libopts/boolean.c (renamed from libopts/boolean.c)0
-rw-r--r--src/libopts/check.c (renamed from libopts/check.c)0
-rw-r--r--src/libopts/compat/compat.h (renamed from libopts/compat/compat.h)0
-rw-r--r--src/libopts/compat/pathfind.c (renamed from libopts/compat/pathfind.c)0
-rw-r--r--src/libopts/compat/snprintf.c (renamed from libopts/compat/snprintf.c)0
-rw-r--r--src/libopts/compat/strchr.c (renamed from libopts/compat/strchr.c)0
-rw-r--r--src/libopts/compat/strdup.c (renamed from libopts/compat/strdup.c)0
-rw-r--r--src/libopts/compat/windows-config.h (renamed from libopts/compat/windows-config.h)0
-rw-r--r--src/libopts/configfile.c (renamed from libopts/configfile.c)0
-rw-r--r--src/libopts/cook.c (renamed from libopts/cook.c)0
-rw-r--r--src/libopts/enum.c (renamed from libopts/enum.c)0
-rw-r--r--src/libopts/env.c (renamed from libopts/env.c)0
-rw-r--r--src/libopts/file.c (renamed from libopts/file.c)0
-rw-r--r--src/libopts/find.c (renamed from libopts/find.c)0
-rw-r--r--src/libopts/genshell.c (renamed from libopts/genshell.c)0
-rw-r--r--src/libopts/genshell.h (renamed from libopts/genshell.h)0
-rw-r--r--src/libopts/libopts.c (renamed from libopts/libopts.c)0
-rw-r--r--src/libopts/load.c (renamed from libopts/load.c)0
-rw-r--r--src/libopts/m4/libopts.m4 (renamed from m4/libopts.m4)0
-rw-r--r--src/libopts/m4/liboptschk.m4 (renamed from m4/liboptschk.m4)0
-rw-r--r--src/libopts/makeshell.c (renamed from libopts/makeshell.c)0
-rw-r--r--src/libopts/nested.c (renamed from libopts/nested.c)0
-rw-r--r--src/libopts/numeric.c (renamed from libopts/numeric.c)0
-rw-r--r--src/libopts/parse-duration.c (renamed from libopts/parse-duration.c)0
-rw-r--r--src/libopts/parse-duration.h (renamed from libopts/parse-duration.h)0
-rw-r--r--src/libopts/pgusage.c (renamed from libopts/pgusage.c)0
-rw-r--r--src/libopts/proto.h (renamed from libopts/proto.h)0
-rw-r--r--src/libopts/putshell.c (renamed from libopts/putshell.c)0
-rw-r--r--src/libopts/reset.c (renamed from libopts/reset.c)0
-rw-r--r--src/libopts/restore.c (renamed from libopts/restore.c)0
-rw-r--r--src/libopts/save.c (renamed from libopts/save.c)0
-rw-r--r--src/libopts/sort.c (renamed from libopts/sort.c)0
-rw-r--r--src/libopts/stack.c (renamed from libopts/stack.c)0
-rw-r--r--src/libopts/streqvcmp.c (renamed from libopts/streqvcmp.c)0
-rw-r--r--src/libopts/text_mmap.c (renamed from libopts/text_mmap.c)0
-rw-r--r--src/libopts/time.c (renamed from libopts/time.c)0
-rw-r--r--src/libopts/tokenize.c (renamed from libopts/tokenize.c)0
-rw-r--r--src/libopts/usage.c (renamed from libopts/usage.c)0
-rw-r--r--src/libopts/value-type.c (renamed from libopts/value-type.c)0
-rw-r--r--src/libopts/value-type.h (renamed from libopts/value-type.h)0
-rw-r--r--src/libopts/version.c (renamed from libopts/version.c)0
-rw-r--r--src/libopts/xat-attribute.c (renamed from libopts/xat-attribute.c)0
-rw-r--r--src/libopts/xat-attribute.h (renamed from libopts/xat-attribute.h)0
-rw-r--r--src/srptool-gaa.c910
-rw-r--r--src/srptool-gaa.h47
63 files changed, 42 insertions, 2453 deletions
diff --git a/Makefile.am b/Makefile.am
index d63830d82a..06fdb1d09b 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -21,19 +21,13 @@
DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --disable-valgrind-tests
-SUBDIRS = gl lib extra po
-
-if NEED_LIBOPTS
-SUBDIRS += libopts
-endif
-
-SUBDIRS += src doc tests
+SUBDIRS = gl lib extra po src doc tests
if HAVE_GUILE
SUBDIRS += guile
endif
-ACLOCAL_AMFLAGS = -I m4 -I gl/m4
+ACLOCAL_AMFLAGS = -I m4 -I gl/m4 -I src/libopts/m4
EXTRA_DIST = cfg.mk maint.mk .clcopying
diff --git a/configure.ac b/configure.ac
index 3780cde754..0a31ae09f6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -148,7 +148,7 @@ fi
AM_CONDITIONAL(ENABLE_PKCS11, test "$with_p11_kit" != "no")
dnl Checks for programs in src/
-LIBOPTS_CHECK([libopts])
+LIBOPTS_CHECK([src/libopts])
dnl Check for libcfg+
SAVED_LIBS=$LIBS
@@ -291,16 +291,6 @@ dnl Programs for compilation or development
AC_PROG_LN_S
AC_LIBTOOL_WIN32_DLL
AC_PROG_LIBTOOL
-AC_PATH_PROG([GAA], [gaa])
-if test "x$GAA" = "x"; then
- AC_MSG_WARN([[***
-*** GAA was not found. It is only needed if you wish to modify
-*** the source code or command-line description files. In this case,
-*** you may want to get it from http://gaa.sourceforge.net/ and
-*** read doc/README.gaa.
-***]])
-fi
-
dnl Guile bindings.
opt_guile_bindings=yes
@@ -481,20 +471,20 @@ AC_CONFIG_FILES([
po/Makefile.in
src/Makefile
src/certtool-args.def
- src/ocsptool-args.def
src/cli-args.def
- src/serv-args.def
src/cli-debug-args.def
- src/srptool-args.def
+ src/crywrap/Makefile
+ src/ocsptool-args.def
src/p11tool-args.def
src/psk-args.def
- src/crywrap/Makefile
+ src/serv-args.def
+ src/srptool-args.def
tests/Makefile
+ tests/cert-tests/Makefile
tests/dsa/Makefile
tests/ecdsa/Makefile
tests/key-id/Makefile
tests/openpgp-certs/Makefile
- tests/cert-tests/Makefile
tests/pkcs1-padding/Makefile
tests/pkcs12-decode/Makefile
tests/pkcs8-decode/Makefile
diff --git a/libopts/Makefile.am b/libopts/Makefile.am
deleted file mode 100644
index 4b3394166d..0000000000
--- a/libopts/Makefile.am
+++ /dev/null
@@ -1,29 +0,0 @@
-## LIBOPTS Makefile
-MAINTAINERCLEANFILES = Makefile.in
-if INSTALL_LIBOPTS
-lib_LTLIBRARIES = libopts.la
-else
-noinst_LTLIBRARIES = libopts.la
-endif
-libopts_la_SOURCES = libopts.c
-libopts_la_CPPFLAGS = -I$(top_srcdir)
-libopts_la_LDFLAGS = -version-info 36:1:11
-EXTRA_DIST = \
- ag-char-map.h autoopts/usage-txt.h autoopts/options.h \
- autoopts/project.h autoopts.c autoopts.h \
- boolean.c check.c compat/strchr.c \
- compat/strdup.c compat/snprintf.c compat/pathfind.c \
- compat/compat.h compat/windows-config.h configfile.c \
- cook.c COPYING.gplv3 COPYING.lgplv3 \
- COPYING.mbsd enum.c env.c \
- file.c find.c genshell.c \
- genshell.h load.c m4/libopts.m4 \
- m4/liboptschk.m4 MakeDefs.inc makeshell.c \
- nested.c numeric.c parse-duration.c \
- parse-duration.h pgusage.c proto.h \
- putshell.c README reset.c \
- restore.c save.c sort.c \
- stack.c streqvcmp.c text_mmap.c \
- time.c tokenize.c usage.c \
- value-type.c value-type.h version.c \
- xat-attribute.c xat-attribute.h
diff --git a/src/Makefile.am b/src/Makefile.am
index 6f1e4c9ca7..e26a567a44 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -17,8 +17,12 @@
# along with this file; if not, write to the Free Software Foundation,
# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+SUBDIRS =
if ENABLE_CRYWRAP
-SUBDIRS = crywrap
+SUBDIRS += crywrap
+endif
+if NEED_LIBOPTS
+SUBDIRS += $(LIBOPTS_DIR)
endif
AM_CFLAGS = $(WARN_CFLAGS) $(WERROR_CFLAGS)
@@ -119,7 +123,6 @@ libcmd_certtool_la_LIBADD += ../gl/libgnu.la $(INET_PTON_LIB)
# p11 tool
if ENABLE_PKCS11
-p11tool_gaa_CFLAGS =
p11tool_SOURCES = p11tool-args.def p11tool.c pkcs11.c certtool-common.c p11tool.h $(PKCS11_SRCS)
p11tool_LDADD = ../lib/libgnutls.la $(LIBOPTS_LDADD)
p11tool_LDADD += libcmd-p11tool.la ../gl/libgnu.la
diff --git a/src/cli-gaa.c b/src/cli-gaa.c
deleted file mode 100644
index dd84b9a2ae..0000000000
--- a/src/cli-gaa.c
+++ /dev/null
@@ -1,1350 +0,0 @@
-/* File generated by GAA 1.6.6
- */
-#define GAA_NO_WIN32
-#line 1 "cli.gaa"
-
-
-/* C declarations */
-
-#include <config.h>
-#include <common.h>
-#include <benchmark.h>
-
-void cli_version(void);
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef GAA_NO_WIN32
-#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WINDOWS)
-#define GAA_WIN32
-#endif
-#endif
-
-static void* gaa_malloc( size_t size) {
-void* ret;
- ret = malloc(size);
- if (ret==NULL) {
- fprintf(stderr, "gaa: could not allocate memory");
- exit(1);
- }
- return ret;
-}
-
-static void __gaa_helpsingle(char short_name, char *name,
- char *arg_desc, char *opt_help)
-{
- int col1, col3, col4, tabsize = 3, curr;
- int i;
-
- col1 = 5; /* Default values */
- col3 = 30;
- col4 = 70;
-
- curr = 0;
- for(i = 0; i < col1; i++)
- {
- printf(" ");
- curr++;
- }
- if(short_name)
- {
- if(name && *name)
- {
- printf("-%c, ", short_name);
- curr += 4;
- }
- else
- {
- printf("-%c ", short_name);
- curr += 3;
- }
- }
- if(name && *name)
- {
- printf("--%s ", name);
- curr += 3 + strlen(name);
- }
- if(arg_desc && *arg_desc)
- {
- printf("%s ", arg_desc);
- curr += 1 + strlen(arg_desc);
- }
- if(curr >= col3)
- {
- printf("\n");
- curr = 0;
- }
- if(opt_help) /* let's print the option's help body */
- {
- const char *str = opt_help;
- while(*str)
- {
- while(curr < col3)
- {
- printf(" ");
- curr++;
- }
- switch(*str)
- {
- case '\n':
- printf("\n");
- curr = 0;
- break;
- case '\t':
- do
- {
- printf(" ");
- curr++;
- }
- while((curr - col3) % tabsize != 0 && curr < col4);
- case ' ':
- if(*str == ' ')
- {
- curr++;
- printf(" ");
- }
- for(i = 1; str[i] && str[i] != ' ' && str[i] != '\n'
- && str[i] != '\t'; i++);
- if(curr + i - 1 >= col4)
- curr = col4;
- break;
- default:
- printf("%c", *str);
- curr++;
- }
- if(curr >= col4)
- {
- printf("\n");
- curr = 0;
- }
- str++;
- }
- }
- printf("\n");
-}
-
-void gaa_help(void)
-{
- printf("GnuTLS test client\nUsage: gnutls-cli [options] hostname\n\n\n");
- __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
- __gaa_helpsingle('r', "resume", "", "Connect, establish a session. Connect again and resume this session.");
- __gaa_helpsingle('e', "rehandshake", "", "Connect, establish a session and rehandshake immediately.");
- __gaa_helpsingle(0, "noticket", "", "Doesn't accept session tickets.");
- __gaa_helpsingle('s', "starttls", "", "Connect, establish a plain session and start TLS when EOF or a SIGALRM is received.");
- __gaa_helpsingle('u', "udp", "", "Use DTLS (datagram TLS) over UDP.");
- __gaa_helpsingle(0, "mtu", "integer ", "Set MTU for datagram TLS.");
- __gaa_helpsingle(0, "crlf", "", "Send CR LF instead of LF.");
- __gaa_helpsingle(0, "x509fmtder", "", "Use DER format for certificates to read from.");
- __gaa_helpsingle('f', "fingerprint", "", "Send the openpgp fingerprint, instead of the key.");
- __gaa_helpsingle(0, "disable-extensions", "", "Disable all the TLS extensions.");
- __gaa_helpsingle(0, "print-cert", "", "Print the certificate in PEM format.");
- __gaa_helpsingle(0, "recordsize", "integer ", "The maximum record size to advertize.");
- __gaa_helpsingle('V', "verbose", "", "More verbose output.");
- __gaa_helpsingle(0, "priority", "PRIORITY STRING ", "Priorities string.");
- __gaa_helpsingle(0, "x509cafile", "FILE ", "Certificate file or PKCS #11 URL to use.");
- __gaa_helpsingle(0, "x509crlfile", "FILE ", "CRL file to use.");
- __gaa_helpsingle(0, "pgpkeyfile", "FILE ", "PGP Key file to use.");
- __gaa_helpsingle(0, "pgpkeyring", "FILE ", "PGP Key ring file to use.");
- __gaa_helpsingle(0, "pgpcertfile", "FILE ", "PGP Public Key (certificate) file to use.");
- __gaa_helpsingle(0, "pgpsubkey", "HEX|auto ", "PGP subkey to use.");
- __gaa_helpsingle(0, "x509keyfile", "FILE ", "X.509 key file or PKCS #11 URL to use.");
- __gaa_helpsingle(0, "x509certfile", "FILE ", "X.509 Certificate file or PKCS #11 URL to use.");
- __gaa_helpsingle(0, "srpusername", "NAME ", "SRP username to use.");
- __gaa_helpsingle(0, "srppasswd", "PASSWD ", "SRP password to use.");
- __gaa_helpsingle(0, "pskusername", "NAME ", "PSK username to use.");
- __gaa_helpsingle(0, "pskkey", "KEY ", "PSK key (in hex) to use.");
- __gaa_helpsingle('p', "port", "PORT ", "The port to connect to.");
- __gaa_helpsingle(0, "insecure", "", "Don't abort program if server certificate can't be validated.");
- __gaa_helpsingle(0, "benchmark-ciphers", "", "Benchmark individual ciphers.");
- __gaa_helpsingle(0, "benchmark-soft-ciphers", "", "Benchmark individual software ciphers.");
- __gaa_helpsingle(0, "benchmark-tls", "", "Benchmark ciphers and key exchange methods in TLS.");
- __gaa_helpsingle('l', "list", "", "Print a list of the supported algorithms and modes. If a priority string is given then only the ciphersuites enabled by the priority are shown.");
- __gaa_helpsingle('h', "help", "", "prints this help");
- __gaa_helpsingle('v', "version", "", "prints the program's version number");
-
-#line 100 "gaa.skel"
-}
-/* Copy of C area */
-
-#line 104 "gaa.skel"
-/* GAA HEADER */
-#ifndef GAA_HEADER_POKY
-#define GAA_HEADER_POKY
-
-typedef struct _gaainfo gaainfo;
-
-struct _gaainfo
-{
-#line 111 "cli.gaa"
- char *rest_args;
-#line 99 "cli.gaa"
- int insecure;
-#line 96 "cli.gaa"
- char *port;
-#line 93 "cli.gaa"
- char *psk_key;
-#line 90 "cli.gaa"
- char *psk_username;
-#line 87 "cli.gaa"
- char *srp_passwd;
-#line 84 "cli.gaa"
- char *srp_username;
-#line 81 "cli.gaa"
- char *x509_certfile;
-#line 78 "cli.gaa"
- char *x509_keyfile;
-#line 75 "cli.gaa"
- char *pgp_subkey;
-#line 72 "cli.gaa"
- char *pgp_certfile;
-#line 69 "cli.gaa"
- char *pgp_keyring;
-#line 66 "cli.gaa"
- char *pgp_keyfile;
-#line 63 "cli.gaa"
- char *x509_crlfile;
-#line 60 "cli.gaa"
- char *x509_cafile;
-#line 57 "cli.gaa"
- char *priorities;
-#line 54 "cli.gaa"
- int verbose;
-#line 51 "cli.gaa"
- int record_size;
-#line 48 "cli.gaa"
- int print_cert;
-#line 45 "cli.gaa"
- int disable_extensions;
-#line 42 "cli.gaa"
- int fingerprint;
-#line 39 "cli.gaa"
- int fmtder;
-#line 36 "cli.gaa"
- int crlf;
-#line 33 "cli.gaa"
- int mtu;
-#line 30 "cli.gaa"
- int udp;
-#line 27 "cli.gaa"
- int starttls;
-#line 24 "cli.gaa"
- int noticket;
-#line 21 "cli.gaa"
- int rehandshake;
-#line 18 "cli.gaa"
- int resume;
-#line 15 "cli.gaa"
- int debug;
-
-#line 114 "gaa.skel"
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- int gaa(int argc, char *argv[], gaainfo *gaaval);
-
- void gaa_help(void);
-
- int gaa_file(const char *name, gaainfo *gaaval);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
-#line 135 "gaa.skel"
-
-/* C declarations */
-
-#define GAAERROR(x) \
-{ \
-gaa_error = 1; \
-return x; \
-}
-
-static char *gaa_current_option;
-static int gaa_error = 0;
-
-/* Generated by gaa */
-
-#include <string.h>
-#include <stdlib.h>
-
-
-#define GAA_OK -1
-
-#define GAA_ERROR_NOMATCH 0
-#define GAA_ERROR_NOTENOUGH_ARGS 1
-#define GAA_ERROR_INVALID_ARG 2
-#define GAA_ERROR_UNKNOWN 3
-
-#define GAA_NOT_AN_OPTION 0
-#define GAA_WORD_OPTION 1
-#define GAA_LETTER_OPTION 2
-#define GAA_MULTIPLE_OPTION 3
-
-#define GAA_REST 0
-#define GAA_NB_OPTION 35
-#define GAAOPTID_version 1
-#define GAAOPTID_help 2
-#define GAAOPTID_list 3
-#define GAAOPTID_benchmark_tls 4
-#define GAAOPTID_benchmark_soft_ciphers 5
-#define GAAOPTID_benchmark_ciphers 6
-#define GAAOPTID_insecure 7
-#define GAAOPTID_port 8
-#define GAAOPTID_pskkey 9
-#define GAAOPTID_pskusername 10
-#define GAAOPTID_srppasswd 11
-#define GAAOPTID_srpusername 12
-#define GAAOPTID_x509certfile 13
-#define GAAOPTID_x509keyfile 14
-#define GAAOPTID_pgpsubkey 15
-#define GAAOPTID_pgpcertfile 16
-#define GAAOPTID_pgpkeyring 17
-#define GAAOPTID_pgpkeyfile 18
-#define GAAOPTID_x509crlfile 19
-#define GAAOPTID_x509cafile 20
-#define GAAOPTID_priority 21
-#define GAAOPTID_verbose 22
-#define GAAOPTID_recordsize 23
-#define GAAOPTID_print_cert 24
-#define GAAOPTID_disable_extensions 25
-#define GAAOPTID_fingerprint 26
-#define GAAOPTID_x509fmtder 27
-#define GAAOPTID_crlf 28
-#define GAAOPTID_mtu 29
-#define GAAOPTID_udp 30
-#define GAAOPTID_starttls 31
-#define GAAOPTID_noticket 32
-#define GAAOPTID_rehandshake 33
-#define GAAOPTID_resume 34
-#define GAAOPTID_debug 35
-
-#line 168 "gaa.skel"
-
-#define GAA_CHECK1STR(a,b) \
-if(a[0] == str[0]) \
-{ \
- gaa_current_option = a; \
- return b; \
-}
-
-#define GAA_CHECKSTR(a,b) \
-if(strcmp(a,str) == 0) \
-{ \
- gaa_current_option = a; \
- return b; \
-}
-
-#define GAA_TESTMOREARGS \
-if(!OK) \
-{ \
-while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
- gaa_index++; \
-if(gaa_last_non_option == gaa_index) \
- return GAA_ERROR_NOTENOUGH_ARGS; \
-}
-
-#define GAA_TESTMOREOPTIONALARGS \
-if(!OK) \
-{ \
-while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
- gaa_index++; \
-if(gaa_last_non_option == gaa_index) \
- OK = 1; \
-}
-
-#define GAA_FILL_2ARGS(target, func) \
-target = func(GAAargv[gaa_index]); \
-gaa_arg_used[gaa_index] = 1; \
-if(gaa_error == 1) \
-{ \
- gaa_error = 0; \
- return GAA_ERROR_INVALID_ARG; \
-}
-
-
-
-#define GAA_FILL(target, func, num) \
-if(!OK) \
-{ \
-target = func(GAAargv[gaa_index]); \
-gaa_arg_used[gaa_index] = 1; \
-if(gaa_error == 1) \
-{ \
- gaa_error = 0; \
- return GAA_ERROR_INVALID_ARG; \
-} \
-num = 1; \
-} \
-else \
-{ \
-num = 0; \
-}
-
-#define GAA_LIST_FILL(target, func, type ,num) \
-if(!OK) \
-{ \
-num = 0; \
-target = NULL; \
-if ( gaa_last_non_option - gaa_index > 0) \
- target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
-for(; gaa_index < gaa_last_non_option; gaa_index++) \
-{ \
- if(gaa_arg_used[gaa_index] == 0) \
- { \
- GAA_FILL_2ARGS(target[num], func); \
- num++; \
- } \
-} \
-if(num == 0) \
- return GAA_ERROR_NOTENOUGH_ARGS; \
-}
-
-#define GAA_OPTIONALLIST_FILL(target, func, type ,num) \
-if(!OK) \
-{ \
-num = 0; \
-target = NULL; \
-if ( gaa_last_non_option - gaa_index > 0) \
- target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
-for(; gaa_index < gaa_last_non_option; gaa_index++) \
-{ \
- if(gaa_arg_used[gaa_index] == 0) \
- { \
- GAA_FILL_2ARGS(target[num], func); \
- num++; \
- } \
-} \
-}
-
-#define GAA_OBLIGAT(str) \
-k = 0; \
-for(i = 0; i < strlen(str); i++) \
-{ \
- j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
- if(j == GAA_ERROR_NOMATCH) \
- { \
- printf("Error: invalid 'obligat' set\n"); \
- exit(-1); \
- } \
- if(opt_list[j] == 1) \
- k = 1; \
-} \
-if(k == 0) \
-{ \
- if(strlen(str) == 1) \
- printf("You must give the -%s option\n", str); \
- else \
- printf("You must give at least one option of '%s'\n", str); \
- return 0; \
-}
-
-#define GAA_INCOMP(str) \
-k = 0; \
-for(i = 0; i < strlen(str); i++) \
-{ \
- j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
- if(j == GAA_ERROR_NOMATCH) \
- { \
- printf("Error: invalid 'obligat' set\n"); \
- exit(-1); \
- } \
- if(opt_list[j] == 1) \
- k++; \
-} \
-if(k > 1) \
-{ \
- printf("The options '%s' are incompatible\n", str); \
- return 0; \
-}
-
-
-static char **GAAargv;
-static int GAAargc;
-static char *gaa_arg_used;
-static int gaa_processing_file = 0;
-static int inited = 0;
-
-static int gaa_getint(char *arg)
-{
- int tmp;
- char a;
- if(sscanf(arg, "%d%c", &tmp, &a) < 1)
- {
- printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return tmp;
-}
-
-static char gaa_getchar(char *arg)
-{
- if(strlen(arg) != 1)
- {
- printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return arg[0];
-}
-
-static char* gaa_getstr(char *arg)
-{
- return arg;
-}
-static float gaa_getfloat(char *arg)
-{
- float tmp;
- char a;
- if(sscanf(arg, "%f%c", &tmp, &a) < 1)
- {
- printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return tmp;
-}
-/* option structures */
-
-struct GAAOPTION_port
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pskkey
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pskusername
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_srppasswd
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_srpusername
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_x509certfile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_x509keyfile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pgpsubkey
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pgpcertfile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pgpkeyring
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_pgpkeyfile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_x509crlfile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_x509cafile
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_priority
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_recordsize
-{
- int arg1;
- int size1;
-};
-
-struct GAAOPTION_mtu
-{
- int arg1;
- int size1;
-};
-
-struct GAAOPTION_debug
-{
- int arg1;
- int size1;
-};
-#define GAA_REST_EXISTS
-
-struct GAAREST
-{
- char* arg1;
- int size1;
-};
-
-#line 349 "gaa.skel"
-static int gaa_is_an_argument(char *str)
-{
-#ifdef GAA_WIN32
- if(str[0] == '/' && str[1] != 0)
- return GAA_MULTIPLE_OPTION;
-#endif
- if(str[0] != '-')
- return GAA_NOT_AN_OPTION;
- if(str[1] == 0)
- return GAA_NOT_AN_OPTION;
- if(str[1] == '-')
- {
- if(str[2] != 0)
- return GAA_WORD_OPTION;
- else
- return GAA_NOT_AN_OPTION;
- }
- if(str[2] == 0)
- return GAA_LETTER_OPTION;
- else
- return GAA_MULTIPLE_OPTION;
-}
-
-static int gaa_get_option_num(char *str, int status)
-{
- switch(status)
- {
- case GAA_LETTER_OPTION:
- GAA_CHECK1STR("p", GAAOPTID_port);
- GAA_CHECK1STR("", GAAOPTID_pskkey);
- GAA_CHECK1STR("", GAAOPTID_pskusername);
- GAA_CHECK1STR("", GAAOPTID_srppasswd);
- GAA_CHECK1STR("", GAAOPTID_srpusername);
- GAA_CHECK1STR("", GAAOPTID_x509certfile);
- GAA_CHECK1STR("", GAAOPTID_x509keyfile);
- GAA_CHECK1STR("", GAAOPTID_pgpsubkey);
- GAA_CHECK1STR("", GAAOPTID_pgpcertfile);
- GAA_CHECK1STR("", GAAOPTID_pgpkeyring);
- GAA_CHECK1STR("", GAAOPTID_pgpkeyfile);
- GAA_CHECK1STR("", GAAOPTID_x509crlfile);
- GAA_CHECK1STR("", GAAOPTID_x509cafile);
- GAA_CHECK1STR("", GAAOPTID_priority);
- GAA_CHECK1STR("", GAAOPTID_recordsize);
- GAA_CHECK1STR("", GAAOPTID_mtu);
- GAA_CHECK1STR("d", GAAOPTID_debug);
- case GAA_MULTIPLE_OPTION:
-#line 375 "gaa.skel"
- GAA_CHECK1STR("v", GAAOPTID_version);
- GAA_CHECK1STR("h", GAAOPTID_help);
- GAA_CHECK1STR("l", GAAOPTID_list);
- GAA_CHECK1STR("", GAAOPTID_benchmark_tls);
- GAA_CHECK1STR("", GAAOPTID_benchmark_soft_ciphers);
- GAA_CHECK1STR("", GAAOPTID_benchmark_ciphers);
- GAA_CHECK1STR("", GAAOPTID_insecure);
- GAA_CHECK1STR("V", GAAOPTID_verbose);
- GAA_CHECK1STR("", GAAOPTID_print_cert);
- GAA_CHECK1STR("", GAAOPTID_disable_extensions);
- GAA_CHECK1STR("f", GAAOPTID_fingerprint);
- GAA_CHECK1STR("", GAAOPTID_x509fmtder);
- GAA_CHECK1STR("", GAAOPTID_crlf);
- GAA_CHECK1STR("u", GAAOPTID_udp);
- GAA_CHECK1STR("s", GAAOPTID_starttls);
- GAA_CHECK1STR("", GAAOPTID_noticket);
- GAA_CHECK1STR("e", GAAOPTID_rehandshake);
- GAA_CHECK1STR("r", GAAOPTID_resume);
-
-#line 277 "gaa.skel"
- break;
- case GAA_WORD_OPTION:
- GAA_CHECKSTR("version", GAAOPTID_version);
- GAA_CHECKSTR("help", GAAOPTID_help);
- GAA_CHECKSTR("list", GAAOPTID_list);
- GAA_CHECKSTR("benchmark-tls", GAAOPTID_benchmark_tls);
- GAA_CHECKSTR("benchmark-soft-ciphers", GAAOPTID_benchmark_soft_ciphers);
- GAA_CHECKSTR("benchmark-ciphers", GAAOPTID_benchmark_ciphers);
- GAA_CHECKSTR("insecure", GAAOPTID_insecure);
- GAA_CHECKSTR("port", GAAOPTID_port);
- GAA_CHECKSTR("pskkey", GAAOPTID_pskkey);
- GAA_CHECKSTR("pskusername", GAAOPTID_pskusername);
- GAA_CHECKSTR("srppasswd", GAAOPTID_srppasswd);
- GAA_CHECKSTR("srpusername", GAAOPTID_srpusername);
- GAA_CHECKSTR("x509certfile", GAAOPTID_x509certfile);
- GAA_CHECKSTR("x509keyfile", GAAOPTID_x509keyfile);
- GAA_CHECKSTR("pgpsubkey", GAAOPTID_pgpsubkey);
- GAA_CHECKSTR("pgpcertfile", GAAOPTID_pgpcertfile);
- GAA_CHECKSTR("pgpkeyring", GAAOPTID_pgpkeyring);
- GAA_CHECKSTR("pgpkeyfile", GAAOPTID_pgpkeyfile);
- GAA_CHECKSTR("x509crlfile", GAAOPTID_x509crlfile);
- GAA_CHECKSTR("x509cafile", GAAOPTID_x509cafile);
- GAA_CHECKSTR("priority", GAAOPTID_priority);
- GAA_CHECKSTR("verbose", GAAOPTID_verbose);
- GAA_CHECKSTR("recordsize", GAAOPTID_recordsize);
- GAA_CHECKSTR("print-cert", GAAOPTID_print_cert);
- GAA_CHECKSTR("disable-extensions", GAAOPTID_disable_extensions);
- GAA_CHECKSTR("fingerprint", GAAOPTID_fingerprint);
- GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder);
- GAA_CHECKSTR("crlf", GAAOPTID_crlf);
- GAA_CHECKSTR("mtu", GAAOPTID_mtu);
- GAA_CHECKSTR("udp", GAAOPTID_udp);
- GAA_CHECKSTR("starttls", GAAOPTID_starttls);
- GAA_CHECKSTR("noticket", GAAOPTID_noticket);
- GAA_CHECKSTR("rehandshake", GAAOPTID_rehandshake);
- GAA_CHECKSTR("resume", GAAOPTID_resume);
- GAA_CHECKSTR("debug", GAAOPTID_debug);
-
-#line 281 "gaa.skel"
- break;
- default: break;
- }
- return GAA_ERROR_NOMATCH;
-}
-
-static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
-{
- int OK = 0;
- int gaa_last_non_option;
- struct GAAOPTION_port GAATMP_port;
- struct GAAOPTION_pskkey GAATMP_pskkey;
- struct GAAOPTION_pskusername GAATMP_pskusername;
- struct GAAOPTION_srppasswd GAATMP_srppasswd;
- struct GAAOPTION_srpusername GAATMP_srpusername;
- struct GAAOPTION_x509certfile GAATMP_x509certfile;
- struct GAAOPTION_x509keyfile GAATMP_x509keyfile;
- struct GAAOPTION_pgpsubkey GAATMP_pgpsubkey;
- struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile;
- struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring;
- struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile;
- struct GAAOPTION_x509crlfile GAATMP_x509crlfile;
- struct GAAOPTION_x509cafile GAATMP_x509cafile;
- struct GAAOPTION_priority GAATMP_priority;
- struct GAAOPTION_recordsize GAATMP_recordsize;
- struct GAAOPTION_mtu GAATMP_mtu;
- struct GAAOPTION_debug GAATMP_debug;
-
-#line 393 "gaa.skel"
-#ifdef GAA_REST_EXISTS
- struct GAAREST GAAREST_tmp;
-#endif
-
- opt_list[gaa_num] = 1;
-
- for(gaa_last_non_option = gaa_index;
- (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION);
- gaa_last_non_option++);
-
- if(gaa_num == GAA_REST)
- {
- gaa_index = 1;
- gaa_last_non_option = GAAargc;
- }
-
- switch(gaa_num)
- {
- case GAAOPTID_version:
- OK = 0;
-#line 109 "cli.gaa"
-{ cli_version(); exit(0); ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_help:
- OK = 0;
-#line 107 "cli.gaa"
-{ gaa_help(); exit(0); ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_list:
- OK = 0;
-#line 106 "cli.gaa"
-{ print_list(gaaval->priorities, gaaval->verbose); exit(0); ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_benchmark_tls:
- OK = 0;
-#line 104 "cli.gaa"
-{ benchmark_tls(gaaval->debug); exit(0) ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_benchmark_soft_ciphers:
- OK = 0;
-#line 103 "cli.gaa"
-{ benchmark_cipher(0, gaaval->debug); exit(0) ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_benchmark_ciphers:
- OK = 0;
-#line 102 "cli.gaa"
-{ benchmark_cipher(1, gaaval->debug); exit(0) ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_insecure:
- OK = 0;
-#line 100 "cli.gaa"
-{ gaaval->insecure = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_port:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_port.arg1, gaa_getstr, GAATMP_port.size1);
- gaa_index++;
-#line 97 "cli.gaa"
-{ gaaval->port = GAATMP_port.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pskkey:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pskkey.arg1, gaa_getstr, GAATMP_pskkey.size1);
- gaa_index++;
-#line 94 "cli.gaa"
-{ gaaval->psk_key = GAATMP_pskkey.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pskusername:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pskusername.arg1, gaa_getstr, GAATMP_pskusername.size1);
- gaa_index++;
-#line 91 "cli.gaa"
-{ gaaval->psk_username = GAATMP_pskusername.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_srppasswd:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1);
- gaa_index++;
-#line 88 "cli.gaa"
-{ gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_srpusername:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_srpusername.arg1, gaa_getstr, GAATMP_srpusername.size1);
- gaa_index++;
-#line 85 "cli.gaa"
-{ gaaval->srp_username = GAATMP_srpusername.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_x509certfile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1);
- gaa_index++;
-#line 82 "cli.gaa"
-{ gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_x509keyfile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1);
- gaa_index++;
-#line 79 "cli.gaa"
-{ gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pgpsubkey:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpsubkey.arg1, gaa_getstr, GAATMP_pgpsubkey.size1);
- gaa_index++;
-#line 76 "cli.gaa"
-{ gaaval->pgp_subkey = GAATMP_pgpsubkey.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pgpcertfile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1);
- gaa_index++;
-#line 73 "cli.gaa"
-{ gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pgpkeyring:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1);
- gaa_index++;
-#line 70 "cli.gaa"
-{ gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_pgpkeyfile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1);
- gaa_index++;
-#line 67 "cli.gaa"
-{ gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_x509crlfile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1);
- gaa_index++;
-#line 64 "cli.gaa"
-{ gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_x509cafile:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1);
- gaa_index++;
-#line 61 "cli.gaa"
-{ gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_priority:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_priority.arg1, gaa_getstr, GAATMP_priority.size1);
- gaa_index++;
-#line 58 "cli.gaa"
-{ gaaval->priorities = GAATMP_priority.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_verbose:
- OK = 0;
-#line 55 "cli.gaa"
-{ gaaval->verbose = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_recordsize:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_recordsize.arg1, gaa_getint, GAATMP_recordsize.size1);
- gaa_index++;
-#line 52 "cli.gaa"
-{ gaaval->record_size = GAATMP_recordsize.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_print_cert:
- OK = 0;
-#line 49 "cli.gaa"
-{ gaaval->print_cert = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_disable_extensions:
- OK = 0;
-#line 46 "cli.gaa"
-{ gaaval->disable_extensions = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_fingerprint:
- OK = 0;
-#line 43 "cli.gaa"
-{ gaaval->fingerprint = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_x509fmtder:
- OK = 0;
-#line 40 "cli.gaa"
-{ gaaval->fmtder = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_crlf:
- OK = 0;
-#line 37 "cli.gaa"
-{ gaaval->crlf = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_mtu:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_mtu.arg1, gaa_getint, GAATMP_mtu.size1);
- gaa_index++;
-#line 34 "cli.gaa"
-{ gaaval->mtu = GAATMP_mtu.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_udp:
- OK = 0;
-#line 31 "cli.gaa"
-{ gaaval->udp = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_starttls:
- OK = 0;
-#line 28 "cli.gaa"
-{ gaaval->starttls = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_noticket:
- OK = 0;
-#line 25 "cli.gaa"
-{ gaaval->noticket = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_rehandshake:
- OK = 0;
-#line 22 "cli.gaa"
-{ gaaval->rehandshake = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_resume:
- OK = 0;
-#line 19 "cli.gaa"
-{ gaaval->resume = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_debug:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
- gaa_index++;
-#line 16 "cli.gaa"
-{ gaaval->debug = GAATMP_debug.arg1 ;};
-
- return GAA_OK;
- break;
- case GAA_REST:
- GAA_TESTMOREARGS;
- GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1);
- gaa_index++;
-#line 112 "cli.gaa"
-{ gaaval->rest_args = GAAREST_tmp.arg1; ;};
-
- return GAA_OK;
- break;
-
-#line 413 "gaa.skel"
- default: break;
- }
- return GAA_ERROR_UNKNOWN;
-}
-
-int gaa(int argc, char **argv, gaainfo *gaaval)
-{
- int tmp1, tmp2;
- int i, j;
- char *opt_list;
-
- GAAargv = argv;
- GAAargc = argc;
-
- opt_list = (char*) gaa_malloc(GAA_NB_OPTION + 1);
-
- for(i = 0; i < GAA_NB_OPTION + 1; i++)
- opt_list[i] = 0;
- /* initialization */
- if(inited == 0)
- {
-
-#line 114 "cli.gaa"
-{ gaaval->resume=0; gaaval->noticket=0; gaaval->port="443"; gaaval->rest_args=NULL;
- gaaval->record_size=0;
- gaaval->fingerprint=0; gaaval->pgp_keyring=NULL; gaaval->x509_crlfile = NULL;
- gaaval->x509_cafile = NULL; gaaval->pgp_keyfile=NULL; gaaval->pgp_certfile=NULL; gaaval->disable_extensions = 0;
- gaaval->x509_keyfile=NULL; gaaval->x509_certfile=NULL; gaaval->crlf = 0;
- gaaval->srp_username=NULL; gaaval->srp_passwd=NULL; gaaval->fmtder = 0; gaaval->starttls =0;
- gaaval->debug = 0; gaaval->print_cert = 0; gaaval->verbose = 0; gaaval->psk_key = NULL;
- gaaval->psk_username = NULL; gaaval->priorities = NULL; gaaval->mtu = 1300;
- gaaval->pgp_subkey = NULL; gaaval->rehandshake = 0; gaaval->udp = 0; ;};
-
- }
- inited = 1;
-#line 438 "gaa.skel"
- gaa_arg_used = NULL;
-
- if (argc > 0) {
- gaa_arg_used = gaa_malloc(argc * sizeof(char));
- }
-
- for(i = 1; i < argc; i++)
- gaa_arg_used[i] = 0;
- for(i = 1; i < argc; i++)
- {
- if(gaa_arg_used[i] == 0)
- {
- j = 0;
- tmp1 = gaa_is_an_argument(GAAargv[i]);
- switch(tmp1)
- {
- case GAA_WORD_OPTION:
- j++;
- case GAA_LETTER_OPTION:
- j++;
- tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
- if(tmp2 == GAA_ERROR_NOMATCH)
- {
- printf("Invalid option '%s'\n", argv[i]+j);
- return 0;
- }
- switch(gaa_try(tmp2, i+1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- gaa_arg_used[i] = 1;
- break;
- case GAA_MULTIPLE_OPTION:
- for(j = 1; j < strlen(argv[i]); j++)
- {
- tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
- if(tmp2 == GAA_ERROR_NOMATCH)
- {
- printf("Invalid option '%c'\n", *(argv[i]+j));
- return 0;
- }
- switch(gaa_try(tmp2, i+1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- }
- gaa_arg_used[i] = 1;
- break;
- default: break;
- }
- }
- }
-if(gaa_processing_file == 0)
-{
-
-#line 507 "gaa.skel"
-#ifdef GAA_REST_EXISTS
- switch(gaa_try(GAA_REST, 1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("Rest: not enough arguments\n");
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
-#endif
-}
- for(i = 1; i < argc; i++)
- {
- if(gaa_arg_used[i] == 0)
- {
- printf("Too many arguments\n");
- return 0;
- }
- }
- free(gaa_arg_used);
- free(opt_list);
- return -1;
-}
-
-struct gaastrnode
-{
- char *str;
- struct gaastrnode *next;
-};
-
-typedef struct gaastrnode gaa_str_node;
-
-static int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc)
-{
- int pos_ini;
- int a;
- int i = 0, len = 0, newline = 0;
-
- if(argc == 1) {
- newline = 1;
- len = 2;
- }
-
- a = fgetc( file);
- if (a == EOF) return 0;
-
- while(a == ' ' || a == 9 || a == '\n')
- {
- if(a == '\n')
- {
- newline=1;
- len = 2;
- }
- a = fgetc( file);
- if (a == EOF) return 0;
- }
-
- pos_ini = ftell(file) - 1;
-
- while(a != ' ' && a != 9 && a != '\n')
- {
-
- len++;
- a = fgetc( file);
- if(a==EOF) return 0;
- }
-
- len += 1;
- tmp_str->str = gaa_malloc((len) * sizeof(char));
-
- if(newline == 1)
- {
- tmp_str->str[0] = '-';
- tmp_str->str[1] = '-';
- i = 2;
- }
- else
- {
- i = 0;
- }
-
- fseek(file,pos_ini, SEEK_SET);
- do
- {
- a = fgetc( file);
-
- if (a == EOF) {
- i+=2;
- break;
- }
- tmp_str->str[i] = a;
- i++;
- }
- while(a != ' ' && a != 9 && a != '\n' && i < len);
-
- tmp_str->str[i - 1] = 0;
-
- fseek(file,- 1, SEEK_CUR);
-/* printf("%d\n", ftell(file)); */
-
- return -1;
-}
-
-int gaa_file(const char *name, gaainfo *gaaval)
-{
- gaa_str_node *first_str, **tmp_str, *tmp_str2;
- int rval, i;
- char **argv;
- int argc = 0;
- FILE *file;
-
- gaa_processing_file = 1;
-
- if((file = fopen(name, "r")) == NULL)
- {
- printf("Couldn't open '%s' configuration file for reading\n", name);
- return 1;
- }
-
- tmp_str = &first_str;
- do
- {
- argc++;
- *tmp_str = gaa_malloc(sizeof(gaa_str_node));
-
- (*tmp_str)->str = NULL;
- (*tmp_str)->next = NULL;
-
- rval = gaa_internal_get_next_str(file, *tmp_str, argc);
- tmp_str = &((*tmp_str)->next);
- }
- while(rval == -1);
-
- if(rval == 1)
- return 0;
-
- argv = gaa_malloc((1 + argc) * sizeof(char*));
-
- tmp_str2 = first_str;
- argv[0] = "cfg";
- for(i = 1; i < argc; i++)
- {
- argv[i] = tmp_str2->str;
- tmp_str2 = tmp_str2->next;
- }
-
- rval = gaa(argc, argv, gaaval);
- gaa_processing_file = 0;
- return rval;
-}
diff --git a/src/cli-gaa.h b/src/cli-gaa.h
deleted file mode 100644
index 2a44d2d4c7..0000000000
--- a/src/cli-gaa.h
+++ /dev/null
@@ -1,91 +0,0 @@
-
-#line 104 "gaa.skel"
-/* GAA HEADER */
-#ifndef GAA_HEADER_POKY
-#define GAA_HEADER_POKY
-
-typedef struct _gaainfo gaainfo;
-
-struct _gaainfo
-{
-#line 111 "cli.gaa"
- char *rest_args;
-#line 99 "cli.gaa"
- int insecure;
-#line 96 "cli.gaa"
- char *port;
-#line 93 "cli.gaa"
- char *psk_key;
-#line 90 "cli.gaa"
- char *psk_username;
-#line 87 "cli.gaa"
- char *srp_passwd;
-#line 84 "cli.gaa"
- char *srp_username;
-#line 81 "cli.gaa"
- char *x509_certfile;
-#line 78 "cli.gaa"
- char *x509_keyfile;
-#line 75 "cli.gaa"
- char *pgp_subkey;
-#line 72 "cli.gaa"
- char *pgp_certfile;
-#line 69 "cli.gaa"
- char *pgp_keyring;
-#line 66 "cli.gaa"
- char *pgp_keyfile;
-#line 63 "cli.gaa"
- char *x509_crlfile;
-#line 60 "cli.gaa"
- char *x509_cafile;
-#line 57 "cli.gaa"
- char *priorities;
-#line 54 "cli.gaa"
- int verbose;
-#line 51 "cli.gaa"
- int record_size;
-#line 48 "cli.gaa"
- int print_cert;
-#line 45 "cli.gaa"
- int disable_extensions;
-#line 42 "cli.gaa"
- int fingerprint;
-#line 39 "cli.gaa"
- int fmtder;
-#line 36 "cli.gaa"
- int crlf;
-#line 33 "cli.gaa"
- int mtu;
-#line 30 "cli.gaa"
- int udp;
-#line 27 "cli.gaa"
- int starttls;
-#line 24 "cli.gaa"
- int noticket;
-#line 21 "cli.gaa"
- int rehandshake;
-#line 18 "cli.gaa"
- int resume;
-#line 15 "cli.gaa"
- int debug;
-
-#line 114 "gaa.skel"
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- int gaa(int argc, char *argv[], gaainfo *gaaval);
-
- void gaa_help(void);
-
- int gaa_file(const char *name, gaainfo *gaaval);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
diff --git a/libopts/COPYING.gplv3 b/src/libopts/COPYING.gplv3
index 6c1b848d6b..6c1b848d6b 100644
--- a/libopts/COPYING.gplv3
+++ b/src/libopts/COPYING.gplv3
diff --git a/libopts/COPYING.lgplv3 b/src/libopts/COPYING.lgplv3
index c7759a01b2..c7759a01b2 100644
--- a/libopts/COPYING.lgplv3
+++ b/src/libopts/COPYING.lgplv3
diff --git a/libopts/COPYING.mbsd b/src/libopts/COPYING.mbsd
index 8a70427190..8a70427190 100644
--- a/libopts/COPYING.mbsd
+++ b/src/libopts/COPYING.mbsd
diff --git a/libopts/MakeDefs.inc b/src/libopts/MakeDefs.inc
index e69de29bb2..e69de29bb2 100644
--- a/libopts/MakeDefs.inc
+++ b/src/libopts/MakeDefs.inc
diff --git a/src/libopts/Makefile.am b/src/libopts/Makefile.am
new file mode 100644
index 0000000000..84595b0d67
--- /dev/null
+++ b/src/libopts/Makefile.am
@@ -0,0 +1,29 @@
+## LIBOPTS Makefile
+MAINTAINERCLEANFILES = Makefile.in
+if INSTALL_LIBOPTS
+lib_LTLIBRARIES = libopts.la
+else
+noinst_LTLIBRARIES = libopts.la
+endif
+libopts_la_SOURCES = libopts.c
+libopts_la_CPPFLAGS = -I$(top_srcdir)
+libopts_la_LDFLAGS = -version-info 36:1:11
+EXTRA_DIST = \
+ COPYING.gplv3 COPYING.lgplv3 COPYING.mbsd \
+ MakeDefs.inc README ag-char-map.h \
+ autoopts/project.h autoopts/options.h autoopts/usage-txt.h \
+ autoopts.c autoopts.h boolean.c \
+ check.c compat/pathfind.c compat/strchr.c \
+ compat/windows-config.h compat/snprintf.c compat/compat.h \
+ compat/strdup.c configfile.c cook.c \
+ enum.c env.c file.c \
+ find.c genshell.c genshell.h \
+ load.c m4/liboptschk.m4 m4/libopts.m4 \
+ makeshell.c nested.c numeric.c \
+ parse-duration.c parse-duration.h pgusage.c \
+ proto.h putshell.c reset.c \
+ restore.c save.c sort.c \
+ stack.c streqvcmp.c text_mmap.c \
+ time.c tokenize.c usage.c \
+ value-type.c value-type.h version.c \
+ xat-attribute.c xat-attribute.h
diff --git a/libopts/README b/src/libopts/README
index afa5409874..afa5409874 100644
--- a/libopts/README
+++ b/src/libopts/README
diff --git a/libopts/ag-char-map.h b/src/libopts/ag-char-map.h
index 0fb9794d41..0fb9794d41 100644
--- a/libopts/ag-char-map.h
+++ b/src/libopts/ag-char-map.h
diff --git a/libopts/autoopts.c b/src/libopts/autoopts.c
index c1129f2a01..c1129f2a01 100644
--- a/libopts/autoopts.c
+++ b/src/libopts/autoopts.c
diff --git a/libopts/autoopts.h b/src/libopts/autoopts.h
index 831a52b188..831a52b188 100644
--- a/libopts/autoopts.h
+++ b/src/libopts/autoopts.h
diff --git a/libopts/autoopts/options.h b/src/libopts/autoopts/options.h
index 1e59faa61b..1e59faa61b 100644
--- a/libopts/autoopts/options.h
+++ b/src/libopts/autoopts/options.h
diff --git a/libopts/autoopts/project.h b/src/libopts/autoopts/project.h
index b01affbc19..b01affbc19 100644
--- a/libopts/autoopts/project.h
+++ b/src/libopts/autoopts/project.h
diff --git a/libopts/autoopts/usage-txt.h b/src/libopts/autoopts/usage-txt.h
index 20492a4666..20492a4666 100644
--- a/libopts/autoopts/usage-txt.h
+++ b/src/libopts/autoopts/usage-txt.h
diff --git a/libopts/boolean.c b/src/libopts/boolean.c
index 8079231105..8079231105 100644
--- a/libopts/boolean.c
+++ b/src/libopts/boolean.c
diff --git a/libopts/check.c b/src/libopts/check.c
index b4355b4557..b4355b4557 100644
--- a/libopts/check.c
+++ b/src/libopts/check.c
diff --git a/libopts/compat/compat.h b/src/libopts/compat/compat.h
index 230aef9cb3..230aef9cb3 100644
--- a/libopts/compat/compat.h
+++ b/src/libopts/compat/compat.h
diff --git a/libopts/compat/pathfind.c b/src/libopts/compat/pathfind.c
index 2d5b27d913..2d5b27d913 100644
--- a/libopts/compat/pathfind.c
+++ b/src/libopts/compat/pathfind.c
diff --git a/libopts/compat/snprintf.c b/src/libopts/compat/snprintf.c
index fc91d63a9c..fc91d63a9c 100644
--- a/libopts/compat/snprintf.c
+++ b/src/libopts/compat/snprintf.c
diff --git a/libopts/compat/strchr.c b/src/libopts/compat/strchr.c
index 413f999ff9..413f999ff9 100644
--- a/libopts/compat/strchr.c
+++ b/src/libopts/compat/strchr.c
diff --git a/libopts/compat/strdup.c b/src/libopts/compat/strdup.c
index e2933a8afd..e2933a8afd 100644
--- a/libopts/compat/strdup.c
+++ b/src/libopts/compat/strdup.c
diff --git a/libopts/compat/windows-config.h b/src/libopts/compat/windows-config.h
index 360af1098c..360af1098c 100644
--- a/libopts/compat/windows-config.h
+++ b/src/libopts/compat/windows-config.h
diff --git a/libopts/configfile.c b/src/libopts/configfile.c
index 758ce272da..758ce272da 100644
--- a/libopts/configfile.c
+++ b/src/libopts/configfile.c
diff --git a/libopts/cook.c b/src/libopts/cook.c
index 811ce59308..811ce59308 100644
--- a/libopts/cook.c
+++ b/src/libopts/cook.c
diff --git a/libopts/enum.c b/src/libopts/enum.c
index a79a32e5d3..a79a32e5d3 100644
--- a/libopts/enum.c
+++ b/src/libopts/enum.c
diff --git a/libopts/env.c b/src/libopts/env.c
index c8e9154af4..c8e9154af4 100644
--- a/libopts/env.c
+++ b/src/libopts/env.c
diff --git a/libopts/file.c b/src/libopts/file.c
index 23994748ca..23994748ca 100644
--- a/libopts/file.c
+++ b/src/libopts/file.c
diff --git a/libopts/find.c b/src/libopts/find.c
index 7a9ba175c1..7a9ba175c1 100644
--- a/libopts/find.c
+++ b/src/libopts/find.c
diff --git a/libopts/genshell.c b/src/libopts/genshell.c
index 230b13de62..230b13de62 100644
--- a/libopts/genshell.c
+++ b/src/libopts/genshell.c
diff --git a/libopts/genshell.h b/src/libopts/genshell.h
index 2718bbf7cf..2718bbf7cf 100644
--- a/libopts/genshell.h
+++ b/src/libopts/genshell.h
diff --git a/libopts/libopts.c b/src/libopts/libopts.c
index ca256eb7ef..ca256eb7ef 100644
--- a/libopts/libopts.c
+++ b/src/libopts/libopts.c
diff --git a/libopts/load.c b/src/libopts/load.c
index e4f231d4b7..e4f231d4b7 100644
--- a/libopts/load.c
+++ b/src/libopts/load.c
diff --git a/m4/libopts.m4 b/src/libopts/m4/libopts.m4
index b18e86da3e..b18e86da3e 100644
--- a/m4/libopts.m4
+++ b/src/libopts/m4/libopts.m4
diff --git a/m4/liboptschk.m4 b/src/libopts/m4/liboptschk.m4
index 48e4ceb7a1..48e4ceb7a1 100644
--- a/m4/liboptschk.m4
+++ b/src/libopts/m4/liboptschk.m4
diff --git a/libopts/makeshell.c b/src/libopts/makeshell.c
index 7b9b6cdde1..7b9b6cdde1 100644
--- a/libopts/makeshell.c
+++ b/src/libopts/makeshell.c
diff --git a/libopts/nested.c b/src/libopts/nested.c
index f9f7e7ae7b..f9f7e7ae7b 100644
--- a/libopts/nested.c
+++ b/src/libopts/nested.c
diff --git a/libopts/numeric.c b/src/libopts/numeric.c
index ff6b2a50f2..ff6b2a50f2 100644
--- a/libopts/numeric.c
+++ b/src/libopts/numeric.c
diff --git a/libopts/parse-duration.c b/src/libopts/parse-duration.c
index 0a8c4ada84..0a8c4ada84 100644
--- a/libopts/parse-duration.c
+++ b/src/libopts/parse-duration.c
diff --git a/libopts/parse-duration.h b/src/libopts/parse-duration.h
index 9fd2a364cd..9fd2a364cd 100644
--- a/libopts/parse-duration.h
+++ b/src/libopts/parse-duration.h
diff --git a/libopts/pgusage.c b/src/libopts/pgusage.c
index 2e2194867e..2e2194867e 100644
--- a/libopts/pgusage.c
+++ b/src/libopts/pgusage.c
diff --git a/libopts/proto.h b/src/libopts/proto.h
index 48746f19f6..48746f19f6 100644
--- a/libopts/proto.h
+++ b/src/libopts/proto.h
diff --git a/libopts/putshell.c b/src/libopts/putshell.c
index f15284f6b9..f15284f6b9 100644
--- a/libopts/putshell.c
+++ b/src/libopts/putshell.c
diff --git a/libopts/reset.c b/src/libopts/reset.c
index 59850fe76f..59850fe76f 100644
--- a/libopts/reset.c
+++ b/src/libopts/reset.c
diff --git a/libopts/restore.c b/src/libopts/restore.c
index f55f3d2499..f55f3d2499 100644
--- a/libopts/restore.c
+++ b/src/libopts/restore.c
diff --git a/libopts/save.c b/src/libopts/save.c
index 9c36bc83fd..9c36bc83fd 100644
--- a/libopts/save.c
+++ b/src/libopts/save.c
diff --git a/libopts/sort.c b/src/libopts/sort.c
index 89d716a9bb..89d716a9bb 100644
--- a/libopts/sort.c
+++ b/src/libopts/sort.c
diff --git a/libopts/stack.c b/src/libopts/stack.c
index d930772b7d..d930772b7d 100644
--- a/libopts/stack.c
+++ b/src/libopts/stack.c
diff --git a/libopts/streqvcmp.c b/src/libopts/streqvcmp.c
index d2cb65de63..d2cb65de63 100644
--- a/libopts/streqvcmp.c
+++ b/src/libopts/streqvcmp.c
diff --git a/libopts/text_mmap.c b/src/libopts/text_mmap.c
index 4a7a9df28b..4a7a9df28b 100644
--- a/libopts/text_mmap.c
+++ b/src/libopts/text_mmap.c
diff --git a/libopts/time.c b/src/libopts/time.c
index 656c78d601..656c78d601 100644
--- a/libopts/time.c
+++ b/src/libopts/time.c
diff --git a/libopts/tokenize.c b/src/libopts/tokenize.c
index 4ca1245cf0..4ca1245cf0 100644
--- a/libopts/tokenize.c
+++ b/src/libopts/tokenize.c
diff --git a/libopts/usage.c b/src/libopts/usage.c
index e2751cb6e7..e2751cb6e7 100644
--- a/libopts/usage.c
+++ b/src/libopts/usage.c
diff --git a/libopts/value-type.c b/src/libopts/value-type.c
index ff98c0a1ed..ff98c0a1ed 100644
--- a/libopts/value-type.c
+++ b/src/libopts/value-type.c
diff --git a/libopts/value-type.h b/src/libopts/value-type.h
index 28ee23ed51..28ee23ed51 100644
--- a/libopts/value-type.h
+++ b/src/libopts/value-type.h
diff --git a/libopts/version.c b/src/libopts/version.c
index 1ebf93f26f..1ebf93f26f 100644
--- a/libopts/version.c
+++ b/src/libopts/version.c
diff --git a/libopts/xat-attribute.c b/src/libopts/xat-attribute.c
index db47531240..db47531240 100644
--- a/libopts/xat-attribute.c
+++ b/src/libopts/xat-attribute.c
diff --git a/libopts/xat-attribute.h b/src/libopts/xat-attribute.h
index cbcf6e5ac4..cbcf6e5ac4 100644
--- a/libopts/xat-attribute.h
+++ b/src/libopts/xat-attribute.h
diff --git a/src/srptool-gaa.c b/src/srptool-gaa.c
deleted file mode 100644
index f396335b5a..0000000000
--- a/src/srptool-gaa.c
+++ /dev/null
@@ -1,910 +0,0 @@
-/* File generated by GAA 1.6.6
- */
-#define GAA_NO_WIN32
-#line 1 "srptool.gaa"
-
-
-/* C declarations */
-
-#include <config.h>
-#ifdef _WIN32
-# include <io.h>
-#endif
-
-void srptool_version(void);
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-
-#ifndef GAA_NO_WIN32
-#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WINDOWS)
-#define GAA_WIN32
-#endif
-#endif
-
-static void* gaa_malloc( size_t size) {
-void* ret;
- ret = malloc(size);
- if (ret==NULL) {
- fprintf(stderr, "gaa: could not allocate memory");
- exit(1);
- }
- return ret;
-}
-
-static void __gaa_helpsingle(char short_name, char *name,
- char *arg_desc, char *opt_help)
-{
- int col1, col3, col4, tabsize = 3, curr;
- int i;
-
- col1 = 5; /* Default values */
- col3 = 30;
- col4 = 70;
-
- curr = 0;
- for(i = 0; i < col1; i++)
- {
- printf(" ");
- curr++;
- }
- if(short_name)
- {
- if(name && *name)
- {
- printf("-%c, ", short_name);
- curr += 4;
- }
- else
- {
- printf("-%c ", short_name);
- curr += 3;
- }
- }
- if(name && *name)
- {
- printf("--%s ", name);
- curr += 3 + strlen(name);
- }
- if(arg_desc && *arg_desc)
- {
- printf("%s ", arg_desc);
- curr += 1 + strlen(arg_desc);
- }
- if(curr >= col3)
- {
- printf("\n");
- curr = 0;
- }
- if(opt_help) /* let's print the option's help body */
- {
- const char *str = opt_help;
- while(*str)
- {
- while(curr < col3)
- {
- printf(" ");
- curr++;
- }
- switch(*str)
- {
- case '\n':
- printf("\n");
- curr = 0;
- break;
- case '\t':
- do
- {
- printf(" ");
- curr++;
- }
- while((curr - col3) % tabsize != 0 && curr < col4);
- case ' ':
- if(*str == ' ')
- {
- curr++;
- printf(" ");
- }
- for(i = 1; str[i] && str[i] != ' ' && str[i] != '\n'
- && str[i] != '\t'; i++);
- if(curr + i - 1 >= col4)
- curr = col4;
- break;
- default:
- printf("%c", *str);
- curr++;
- }
- if(curr >= col4)
- {
- printf("\n");
- curr = 0;
- }
- str++;
- }
- }
- printf("\n");
-}
-
-void gaa_help(void)
-{
- printf("Srptool help\nUsage : srptool [options]\n");
- __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
- __gaa_helpsingle('u', "username", "username ", "specify username.");
- __gaa_helpsingle('p', "passwd", "FILE ", "specify a password file.");
- __gaa_helpsingle('i', "index", "INDEX ", "specify the index of the group parameters in tpasswd.conf to use.");
- __gaa_helpsingle('s', "salt", "SALT ", "specify salt size for crypt algorithm.");
- __gaa_helpsingle(0, "verify", "", "just verify password.");
- __gaa_helpsingle('c', "passwd-conf", "FILE ", "specify a password conf file.");
- __gaa_helpsingle(0, "create-conf", "FILE ", "Generate a tpasswd.conf file.");
- __gaa_helpsingle('v', "version", "", "prints the program's version number");
- __gaa_helpsingle('h', "help", "", "shows this help text");
-
-#line 100 "gaa.skel"
-}
-/* Copy of C area */
-
-#line 104 "gaa.skel"
-/* GAA HEADER */
-#ifndef GAA_HEADER_POKY
-#define GAA_HEADER_POKY
-
-typedef struct _gaainfo gaainfo;
-
-struct _gaainfo
-{
-#line 37 "srptool.gaa"
- char *create_conf;
-#line 34 "srptool.gaa"
- char *passwd_conf;
-#line 31 "srptool.gaa"
- int verify;
-#line 28 "srptool.gaa"
- int salt;
-#line 25 "srptool.gaa"
- int index;
-#line 22 "srptool.gaa"
- char *passwd;
-#line 19 "srptool.gaa"
- char *username;
-#line 16 "srptool.gaa"
- int debug;
-
-#line 114 "gaa.skel"
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- int gaa(int argc, char *argv[], gaainfo *gaaval);
-
- void gaa_help(void);
-
- int gaa_file(const char *name, gaainfo *gaaval);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif
-
-#line 135 "gaa.skel"
-
-/* C declarations */
-
-#define GAAERROR(x) \
-{ \
-gaa_error = 1; \
-return x; \
-}
-
-static char *gaa_current_option;
-static int gaa_error = 0;
-
-/* Generated by gaa */
-
-#include <string.h>
-#include <stdlib.h>
-
-
-#define GAA_OK -1
-
-#define GAA_ERROR_NOMATCH 0
-#define GAA_ERROR_NOTENOUGH_ARGS 1
-#define GAA_ERROR_INVALID_ARG 2
-#define GAA_ERROR_UNKNOWN 3
-
-#define GAA_NOT_AN_OPTION 0
-#define GAA_WORD_OPTION 1
-#define GAA_LETTER_OPTION 2
-#define GAA_MULTIPLE_OPTION 3
-
-#define GAA_REST 0
-#define GAA_NB_OPTION 10
-#define GAAOPTID_help 1
-#define GAAOPTID_version 2
-#define GAAOPTID_create_conf 3
-#define GAAOPTID_passwd_conf 4
-#define GAAOPTID_verify 5
-#define GAAOPTID_salt 6
-#define GAAOPTID_index 7
-#define GAAOPTID_passwd 8
-#define GAAOPTID_username 9
-#define GAAOPTID_debug 10
-
-#line 168 "gaa.skel"
-
-#define GAA_CHECK1STR(a,b) \
-if(a[0] == str[0]) \
-{ \
- gaa_current_option = a; \
- return b; \
-}
-
-#define GAA_CHECKSTR(a,b) \
-if(strcmp(a,str) == 0) \
-{ \
- gaa_current_option = a; \
- return b; \
-}
-
-#define GAA_TESTMOREARGS \
-if(!OK) \
-{ \
-while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
- gaa_index++; \
-if(gaa_last_non_option == gaa_index) \
- return GAA_ERROR_NOTENOUGH_ARGS; \
-}
-
-#define GAA_TESTMOREOPTIONALARGS \
-if(!OK) \
-{ \
-while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
- gaa_index++; \
-if(gaa_last_non_option == gaa_index) \
- OK = 1; \
-}
-
-#define GAA_FILL_2ARGS(target, func) \
-target = func(GAAargv[gaa_index]); \
-gaa_arg_used[gaa_index] = 1; \
-if(gaa_error == 1) \
-{ \
- gaa_error = 0; \
- return GAA_ERROR_INVALID_ARG; \
-}
-
-
-
-#define GAA_FILL(target, func, num) \
-if(!OK) \
-{ \
-target = func(GAAargv[gaa_index]); \
-gaa_arg_used[gaa_index] = 1; \
-if(gaa_error == 1) \
-{ \
- gaa_error = 0; \
- return GAA_ERROR_INVALID_ARG; \
-} \
-num = 1; \
-} \
-else \
-{ \
-num = 0; \
-}
-
-#define GAA_LIST_FILL(target, func, type ,num) \
-if(!OK) \
-{ \
-num = 0; \
-target = NULL; \
-if ( gaa_last_non_option - gaa_index > 0) \
- target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
-for(; gaa_index < gaa_last_non_option; gaa_index++) \
-{ \
- if(gaa_arg_used[gaa_index] == 0) \
- { \
- GAA_FILL_2ARGS(target[num], func); \
- num++; \
- } \
-} \
-if(num == 0) \
- return GAA_ERROR_NOTENOUGH_ARGS; \
-}
-
-#define GAA_OPTIONALLIST_FILL(target, func, type ,num) \
-if(!OK) \
-{ \
-num = 0; \
-target = NULL; \
-if ( gaa_last_non_option - gaa_index > 0) \
- target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
-for(; gaa_index < gaa_last_non_option; gaa_index++) \
-{ \
- if(gaa_arg_used[gaa_index] == 0) \
- { \
- GAA_FILL_2ARGS(target[num], func); \
- num++; \
- } \
-} \
-}
-
-#define GAA_OBLIGAT(str) \
-k = 0; \
-for(i = 0; i < strlen(str); i++) \
-{ \
- j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
- if(j == GAA_ERROR_NOMATCH) \
- { \
- printf("Error: invalid 'obligat' set\n"); \
- exit(-1); \
- } \
- if(opt_list[j] == 1) \
- k = 1; \
-} \
-if(k == 0) \
-{ \
- if(strlen(str) == 1) \
- printf("You must give the -%s option\n", str); \
- else \
- printf("You must give at least one option of '%s'\n", str); \
- return 0; \
-}
-
-#define GAA_INCOMP(str) \
-k = 0; \
-for(i = 0; i < strlen(str); i++) \
-{ \
- j = gaa_get_option_num(str + i, GAA_LETTER_OPTION); \
- if(j == GAA_ERROR_NOMATCH) \
- { \
- printf("Error: invalid 'obligat' set\n"); \
- exit(-1); \
- } \
- if(opt_list[j] == 1) \
- k++; \
-} \
-if(k > 1) \
-{ \
- printf("The options '%s' are incompatible\n", str); \
- return 0; \
-}
-
-
-static char **GAAargv;
-static int GAAargc;
-static char *gaa_arg_used;
-static int gaa_processing_file = 0;
-static int inited = 0;
-
-static int gaa_getint(char *arg)
-{
- int tmp;
- char a;
- if(sscanf(arg, "%d%c", &tmp, &a) < 1)
- {
- printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return tmp;
-}
-
-static char gaa_getchar(char *arg)
-{
- if(strlen(arg) != 1)
- {
- printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return arg[0];
-}
-
-static char* gaa_getstr(char *arg)
-{
- return arg;
-}
-static float gaa_getfloat(char *arg)
-{
- float tmp;
- char a;
- if(sscanf(arg, "%f%c", &tmp, &a) < 1)
- {
- printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg);
- GAAERROR(-1);
- }
- return tmp;
-}
-/* option structures */
-
-struct GAAOPTION_create_conf
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_passwd_conf
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_salt
-{
- int arg1;
- int size1;
-};
-
-struct GAAOPTION_index
-{
- int arg1;
- int size1;
-};
-
-struct GAAOPTION_passwd
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_username
-{
- char* arg1;
- int size1;
-};
-
-struct GAAOPTION_debug
-{
- int arg1;
- int size1;
-};
-
-#line 349 "gaa.skel"
-static int gaa_is_an_argument(char *str)
-{
-#ifdef GAA_WIN32
- if(str[0] == '/' && str[1] != 0)
- return GAA_MULTIPLE_OPTION;
-#endif
- if(str[0] != '-')
- return GAA_NOT_AN_OPTION;
- if(str[1] == 0)
- return GAA_NOT_AN_OPTION;
- if(str[1] == '-')
- {
- if(str[2] != 0)
- return GAA_WORD_OPTION;
- else
- return GAA_NOT_AN_OPTION;
- }
- if(str[2] == 0)
- return GAA_LETTER_OPTION;
- else
- return GAA_MULTIPLE_OPTION;
-}
-
-static int gaa_get_option_num(char *str, int status)
-{
- switch(status)
- {
- case GAA_LETTER_OPTION:
- GAA_CHECK1STR("", GAAOPTID_create_conf);
- GAA_CHECK1STR("c", GAAOPTID_passwd_conf);
- GAA_CHECK1STR("s", GAAOPTID_salt);
- GAA_CHECK1STR("i", GAAOPTID_index);
- GAA_CHECK1STR("p", GAAOPTID_passwd);
- GAA_CHECK1STR("u", GAAOPTID_username);
- GAA_CHECK1STR("d", GAAOPTID_debug);
- case GAA_MULTIPLE_OPTION:
-#line 375 "gaa.skel"
- GAA_CHECK1STR("h", GAAOPTID_help);
- GAA_CHECK1STR("v", GAAOPTID_version);
- GAA_CHECK1STR("", GAAOPTID_verify);
-
-#line 277 "gaa.skel"
- break;
- case GAA_WORD_OPTION:
- GAA_CHECKSTR("help", GAAOPTID_help);
- GAA_CHECKSTR("version", GAAOPTID_version);
- GAA_CHECKSTR("create-conf", GAAOPTID_create_conf);
- GAA_CHECKSTR("passwd-conf", GAAOPTID_passwd_conf);
- GAA_CHECKSTR("verify", GAAOPTID_verify);
- GAA_CHECKSTR("salt", GAAOPTID_salt);
- GAA_CHECKSTR("index", GAAOPTID_index);
- GAA_CHECKSTR("passwd", GAAOPTID_passwd);
- GAA_CHECKSTR("username", GAAOPTID_username);
- GAA_CHECKSTR("debug", GAAOPTID_debug);
-
-#line 281 "gaa.skel"
- break;
- default: break;
- }
- return GAA_ERROR_NOMATCH;
-}
-
-static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
-{
- int OK = 0;
- int gaa_last_non_option;
- struct GAAOPTION_create_conf GAATMP_create_conf;
- struct GAAOPTION_passwd_conf GAATMP_passwd_conf;
- struct GAAOPTION_salt GAATMP_salt;
- struct GAAOPTION_index GAATMP_index;
- struct GAAOPTION_passwd GAATMP_passwd;
- struct GAAOPTION_username GAATMP_username;
- struct GAAOPTION_debug GAATMP_debug;
-
-#line 393 "gaa.skel"
-#ifdef GAA_REST_EXISTS
- struct GAAREST GAAREST_tmp;
-#endif
-
- opt_list[gaa_num] = 1;
-
- for(gaa_last_non_option = gaa_index;
- (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION);
- gaa_last_non_option++);
-
- if(gaa_num == GAA_REST)
- {
- gaa_index = 1;
- gaa_last_non_option = GAAargc;
- }
-
- switch(gaa_num)
- {
- case GAAOPTID_help:
- OK = 0;
-#line 41 "srptool.gaa"
-{ gaa_help(); exit(0); ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_version:
- OK = 0;
-#line 40 "srptool.gaa"
-{ srptool_version(); exit(0); ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_create_conf:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_create_conf.arg1, gaa_getstr, GAATMP_create_conf.size1);
- gaa_index++;
-#line 38 "srptool.gaa"
-{ gaaval->create_conf = GAATMP_create_conf.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_passwd_conf:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_passwd_conf.arg1, gaa_getstr, GAATMP_passwd_conf.size1);
- gaa_index++;
-#line 35 "srptool.gaa"
-{ gaaval->passwd_conf = GAATMP_passwd_conf.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_verify:
- OK = 0;
-#line 32 "srptool.gaa"
-{ gaaval->verify = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_salt:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_salt.arg1, gaa_getint, GAATMP_salt.size1);
- gaa_index++;
-#line 29 "srptool.gaa"
-{ gaaval->salt = GAATMP_salt.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_index:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_index.arg1, gaa_getint, GAATMP_index.size1);
- gaa_index++;
-#line 26 "srptool.gaa"
-{ gaaval->index = GAATMP_index.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_passwd:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_passwd.arg1, gaa_getstr, GAATMP_passwd.size1);
- gaa_index++;
-#line 23 "srptool.gaa"
-{ gaaval->passwd = GAATMP_passwd.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_username:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_username.arg1, gaa_getstr, GAATMP_username.size1);
- gaa_index++;
-#line 20 "srptool.gaa"
-{ gaaval->username = GAATMP_username.arg1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_debug:
- OK = 0;
- GAA_TESTMOREARGS;
- GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
- gaa_index++;
-#line 17 "srptool.gaa"
-{ gaaval->debug = GAATMP_debug.arg1 ;};
-
- return GAA_OK;
- break;
-
-#line 413 "gaa.skel"
- default: break;
- }
- return GAA_ERROR_UNKNOWN;
-}
-
-int gaa(int argc, char **argv, gaainfo *gaaval)
-{
- int tmp1, tmp2;
- int i, j;
- char *opt_list;
-
- GAAargv = argv;
- GAAargc = argc;
-
- opt_list = (char*) gaa_malloc(GAA_NB_OPTION + 1);
-
- for(i = 0; i < GAA_NB_OPTION + 1; i++)
- opt_list[i] = 0;
- /* initialization */
- if(inited == 0)
- {
-
-#line 43 "srptool.gaa"
-{ gaaval->username=NULL; gaaval->passwd=NULL; gaaval->salt=0;
- gaaval->create_conf=NULL; gaaval->passwd_conf=NULL; gaaval->verify = 0;
- gaaval->index = 1; gaaval->debug = 0; ;};
-
- }
- inited = 1;
-#line 438 "gaa.skel"
- gaa_arg_used = NULL;
-
- if (argc > 0) {
- gaa_arg_used = gaa_malloc(argc * sizeof(char));
- }
-
- for(i = 1; i < argc; i++)
- gaa_arg_used[i] = 0;
- for(i = 1; i < argc; i++)
- {
- if(gaa_arg_used[i] == 0)
- {
- j = 0;
- tmp1 = gaa_is_an_argument(GAAargv[i]);
- switch(tmp1)
- {
- case GAA_WORD_OPTION:
- j++;
- case GAA_LETTER_OPTION:
- j++;
- tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
- if(tmp2 == GAA_ERROR_NOMATCH)
- {
- printf("Invalid option '%s'\n", argv[i]+j);
- return 0;
- }
- switch(gaa_try(tmp2, i+1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- gaa_arg_used[i] = 1;
- break;
- case GAA_MULTIPLE_OPTION:
- for(j = 1; j < strlen(argv[i]); j++)
- {
- tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
- if(tmp2 == GAA_ERROR_NOMATCH)
- {
- printf("Invalid option '%c'\n", *(argv[i]+j));
- return 0;
- }
- switch(gaa_try(tmp2, i+1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("'%s': not enough arguments\n",gaa_current_option);
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
- }
- gaa_arg_used[i] = 1;
- break;
- default: break;
- }
- }
- }
-if(gaa_processing_file == 0)
-{
-
-#line 507 "gaa.skel"
-#ifdef GAA_REST_EXISTS
- switch(gaa_try(GAA_REST, 1, gaaval, opt_list))
- {
- case GAA_ERROR_NOTENOUGH_ARGS:
- printf("Rest: not enough arguments\n");
- return 0;
- case GAA_ERROR_INVALID_ARG:
- printf("Invalid arguments\n");
- return 0;
- case GAA_OK:
- break;
- default:
- printf("Unknown error\n");
- }
-#endif
-}
- for(i = 1; i < argc; i++)
- {
- if(gaa_arg_used[i] == 0)
- {
- printf("Too many arguments\n");
- return 0;
- }
- }
- free(gaa_arg_used);
- free(opt_list);
- return -1;
-}
-
-struct gaastrnode
-{
- char *str;
- struct gaastrnode *next;
-};
-
-typedef struct gaastrnode gaa_str_node;
-
-static int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc)
-{
- int pos_ini;
- int a;
- int i = 0, len = 0, newline = 0;
-
- if(argc == 1) {
- newline = 1;
- len = 2;
- }
-
- a = fgetc( file);
- if (a == EOF) return 0;
-
- while(a == ' ' || a == 9 || a == '\n')
- {
- if(a == '\n')
- {
- newline=1;
- len = 2;
- }
- a = fgetc( file);
- if (a == EOF) return 0;
- }
-
- pos_ini = ftell(file) - 1;
-
- while(a != ' ' && a != 9 && a != '\n')
- {
-
- len++;
- a = fgetc( file);
- if(a==EOF) return 0; //a = ' ';
- }
-
- len += 1;
- tmp_str->str = gaa_malloc((len) * sizeof(char));
-
- if(newline == 1)
- {
- tmp_str->str[0] = '-';
- tmp_str->str[1] = '-';
- i = 2;
- }
- else
- {
- i = 0;
- }
-
- fseek(file,pos_ini, SEEK_SET);
- do
- {
- a = fgetc( file);
-
- if (a == EOF) {
- i+=2;
- break;
- }
- tmp_str->str[i] = a;
- i++;
- }
- while(a != ' ' && a != 9 && a != '\n' && i < len);
-
- tmp_str->str[i - 1] = 0;
-
- fseek(file,- 1, SEEK_CUR);
-/* printf("%d\n", ftell(file)); */
-
- return -1;
-}
-
-int gaa_file(const char *name, gaainfo *gaaval)
-{
- gaa_str_node *first_str, **tmp_str, *tmp_str2;
- int rval, i;
- char **argv;
- int argc = 0;
- FILE *file;
-
- gaa_processing_file = 1;
-
- if((file = fopen(name, "r")) == NULL)
- {
- printf("Couldn't open '%s' configuration file for reading\n", name);
- return 1;
- }
-
- tmp_str = &first_str;
- do
- {
- argc++;
- *tmp_str = gaa_malloc(sizeof(gaa_str_node));
-
- (*tmp_str)->str = NULL;
- (*tmp_str)->next = NULL;
-
- rval = gaa_internal_get_next_str(file, *tmp_str, argc);
- tmp_str = &((*tmp_str)->next);
- }
- while(rval == -1);
-
- if(rval == 1)
- return 0;
-
- argv = gaa_malloc((1 + argc) * sizeof(char*));
-
- tmp_str2 = first_str;
- argv[0] = "cfg";
- for(i = 1; i < argc; i++)
- {
- argv[i] = tmp_str2->str;
- tmp_str2 = tmp_str2->next;
- }
-
- rval = gaa(argc, argv, gaaval);
- gaa_processing_file = 0;
- return rval;
-}
diff --git a/src/srptool-gaa.h b/src/srptool-gaa.h
deleted file mode 100644
index 585238dd06..0000000000
--- a/src/srptool-gaa.h
+++ /dev/null
@@ -1,47 +0,0 @@
-
-#line 104 "gaa.skel"
-/* GAA HEADER */
-#ifndef GAA_HEADER_POKY
-#define GAA_HEADER_POKY
-
-typedef struct _gaainfo gaainfo;
-
-struct _gaainfo
-{
-#line 37 "srptool.gaa"
- char *create_conf;
-#line 34 "srptool.gaa"
- char *passwd_conf;
-#line 31 "srptool.gaa"
- int verify;
-#line 28 "srptool.gaa"
- int salt;
-#line 25 "srptool.gaa"
- int index;
-#line 22 "srptool.gaa"
- char *passwd;
-#line 19 "srptool.gaa"
- char *username;
-#line 16 "srptool.gaa"
- int debug;
-
-#line 114 "gaa.skel"
-};
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif
-
- int gaa(int argc, char *argv[], gaainfo *gaaval);
-
- void gaa_help(void);
-
- int gaa_file(const char *name, gaainfo *gaaval);
-
-#ifdef __cplusplus
-}
-#endif
-
-
-#endif