Bug Summary

File:src/cli-gaa.c
Location:line 1059, column 2
Description:Value stored to 'OK' is never read

Annotated Source Code

1/* File generated by GAA 1.6.6
2 */
3#define GAA_NO_WIN32
4#line 1 "cli.gaa"
5
6
7/* C declarations */
8
9#include <config.h>
10#include <common.h>
11#include <benchmark.h>
12
13void cli_version(void);
14
15#include <stdio.h>
16#include <string.h>
17#include <stdlib.h>
18
19#ifndef GAA_NO_WIN32
20#if defined(_WIN32) || defined(__WIN32__) || defined(WIN32) || defined(WINDOWS)
21#define GAA_WIN32
22#endif
23#endif
24
25static void* gaa_malloc( size_t size) {
26void* ret;
27 ret = malloc(size);
28 if (ret==NULL((void*)0)) {
29 fprintf(stderrstderr, "gaa: could not allocate memory");
30 exit(1);
31 }
32 return ret;
33}
34
35static void __gaa_helpsingle(char short_name, char *name,
36 char *arg_desc, char *opt_help)
37{
38 int col1, col3, col4, tabsize = 3, curr;
39 int i;
40
41 col1 = 5; /* Default values */
42 col3 = 30;
43 col4 = 70;
44
45 curr = 0;
46 for(i = 0; i < col1; i++)
47 {
48 printf(" ");
49 curr++;
50 }
51 if(short_name)
52 {
53 if(name && *name)
54 {
55 printf("-%c, ", short_name);
56 curr += 4;
57 }
58 else
59 {
60 printf("-%c ", short_name);
61 curr += 3;
62 }
63 }
64 if(name && *name)
65 {
66 printf("--%s ", name);
67 curr += 3 + strlen(name);
68 }
69 if(arg_desc && *arg_desc)
70 {
71 printf("%s ", arg_desc);
72 curr += 1 + strlen(arg_desc);
73 }
74 if(curr >= col3)
75 {
76 printf("\n");
77 curr = 0;
78 }
79 if(opt_help) /* let's print the option's help body */
80 {
81 const char *str = opt_help;
82 while(*str)
83 {
84 while(curr < col3)
85 {
86 printf(" ");
87 curr++;
88 }
89 switch(*str)
90 {
91 case '\n':
92 printf("\n");
93 curr = 0;
94 break;
95 case '\t':
96 do
97 {
98 printf(" ");
99 curr++;
100 }
101 while((curr - col3) % tabsize != 0 && curr < col4);
102 case ' ':
103 if(*str == ' ')
104 {
105 curr++;
106 printf(" ");
107 }
108 for(i = 1; str[i] && str[i] != ' ' && str[i] != '\n'
109 && str[i] != '\t'; i++);
110 if(curr + i - 1 >= col4)
111 curr = col4;
112 break;
113 default:
114 printf("%c", *str);
115 curr++;
116 }
117 if(curr >= col4)
118 {
119 printf("\n");
120 curr = 0;
121 }
122 str++;
123 }
124 }
125 printf("\n");
126}
127
128void gaa_help(void)
129{
130 printf("GnuTLS test client\nUsage: gnutls-cli [options] hostname\n\n\n");
131 __gaa_helpsingle('d', "debug", "integer ", "Enable debugging");
132 __gaa_helpsingle('r', "resume", "", "Connect, establish a session. Connect again and resume this session.");
133 __gaa_helpsingle('e', "rehandshake", "", "Connect, establish a session and rehandshake immediately.");
134 __gaa_helpsingle(0, "noticket", "", "Doesn't accept session tickets.");
135 __gaa_helpsingle('s', "starttls", "", "Connect, establish a plain session and start TLS when EOF or a SIGALRM is received.");
136 __gaa_helpsingle('u', "udp", "", "Use DTLS (datagram TLS) over UDP.");
137 __gaa_helpsingle(0, "mtu", "integer ", "Set MTU for datagram TLS.");
138 __gaa_helpsingle(0, "crlf", "", "Send CR LF instead of LF.");
139 __gaa_helpsingle(0, "x509fmtder", "", "Use DER format for certificates to read from.");
140 __gaa_helpsingle('f', "fingerprint", "", "Send the openpgp fingerprint, instead of the key.");
141 __gaa_helpsingle(0, "disable-extensions", "", "Disable all the TLS extensions.");
142 __gaa_helpsingle(0, "print-cert", "", "Print the certificate in PEM format.");
143 __gaa_helpsingle(0, "recordsize", "integer ", "The maximum record size to advertize.");
144 __gaa_helpsingle('V', "verbose", "", "More verbose output.");
145 __gaa_helpsingle(0, "priority", "PRIORITY STRING ", "Priorities string.");
146 __gaa_helpsingle(0, "x509cafile", "FILE ", "Certificate file or PKCS #11 URL to use.");
147 __gaa_helpsingle(0, "x509crlfile", "FILE ", "CRL file to use.");
148 __gaa_helpsingle(0, "pgpkeyfile", "FILE ", "PGP Key file to use.");
149 __gaa_helpsingle(0, "pgpkeyring", "FILE ", "PGP Key ring file to use.");
150 __gaa_helpsingle(0, "pgpcertfile", "FILE ", "PGP Public Key (certificate) file to use.");
151 __gaa_helpsingle(0, "pgpsubkey", "HEX|auto ", "PGP subkey to use.");
152 __gaa_helpsingle(0, "x509keyfile", "FILE ", "X.509 key file or PKCS #11 URL to use.");
153 __gaa_helpsingle(0, "x509certfile", "FILE ", "X.509 Certificate file or PKCS #11 URL to use.");
154 __gaa_helpsingle(0, "srpusername", "NAME ", "SRP username to use.");
155 __gaa_helpsingle(0, "srppasswd", "PASSWD ", "SRP password to use.");
156 __gaa_helpsingle(0, "pskusername", "NAME ", "PSK username to use.");
157 __gaa_helpsingle(0, "pskkey", "KEY ", "PSK key (in hex) to use.");
158 __gaa_helpsingle('p', "port", "PORT ", "The port to connect to.");
159 __gaa_helpsingle(0, "insecure", "", "Don't abort program if server certificate can't be validated.");
160 __gaa_helpsingle(0, "benchmark-ciphers", "", "Benchmark individual ciphers.");
161 __gaa_helpsingle(0, "benchmark-soft-ciphers", "", "Benchmark individual software ciphers.");
162 __gaa_helpsingle(0, "benchmark-tls", "", "Benchmark ciphers and key exchange methods in TLS.");
163 __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.");
164 __gaa_helpsingle('h', "help", "", "prints this help");
165 __gaa_helpsingle('v', "version", "", "prints the program's version number");
166
167#line 100 "gaa.skel"
168}
169/* Copy of C area */
170
171#line 104 "gaa.skel"
172/* GAA HEADER */
173#ifndef GAA_HEADER_POKY
174#define GAA_HEADER_POKY
175
176typedef struct _gaainfo gaainfo;
177
178struct _gaainfo
179{
180#line 111 "cli.gaa"
181 char *rest_args;
182#line 99 "cli.gaa"
183 int insecure;
184#line 96 "cli.gaa"
185 char *port;
186#line 93 "cli.gaa"
187 char *psk_key;
188#line 90 "cli.gaa"
189 char *psk_username;
190#line 87 "cli.gaa"
191 char *srp_passwd;
192#line 84 "cli.gaa"
193 char *srp_username;
194#line 81 "cli.gaa"
195 char *x509_certfile;
196#line 78 "cli.gaa"
197 char *x509_keyfile;
198#line 75 "cli.gaa"
199 char *pgp_subkey;
200#line 72 "cli.gaa"
201 char *pgp_certfile;
202#line 69 "cli.gaa"
203 char *pgp_keyring;
204#line 66 "cli.gaa"
205 char *pgp_keyfile;
206#line 63 "cli.gaa"
207 char *x509_crlfile;
208#line 60 "cli.gaa"
209 char *x509_cafile;
210#line 57 "cli.gaa"
211 char *priorities;
212#line 54 "cli.gaa"
213 int verbose;
214#line 51 "cli.gaa"
215 int record_size;
216#line 48 "cli.gaa"
217 int print_cert;
218#line 45 "cli.gaa"
219 int disable_extensions;
220#line 42 "cli.gaa"
221 int fingerprint;
222#line 39 "cli.gaa"
223 int fmtder;
224#line 36 "cli.gaa"
225 int crlf;
226#line 33 "cli.gaa"
227 int mtu;
228#line 30 "cli.gaa"
229 int udp;
230#line 27 "cli.gaa"
231 int starttls;
232#line 24 "cli.gaa"
233 int noticket;
234#line 21 "cli.gaa"
235 int rehandshake;
236#line 18 "cli.gaa"
237 int resume;
238#line 15 "cli.gaa"
239 int debug;
240
241#line 114 "gaa.skel"
242};
243
244#ifdef __cplusplus
245extern "C"
246{
247#endif
248
249 int gaa(int argc, char *argv[], gaainfo *gaaval);
250
251 void gaa_help(void);
252
253 int gaa_file(const char *name, gaainfo *gaaval);
254
255#ifdef __cplusplus
256}
257#endif
258
259
260#endif
261
262#line 135 "gaa.skel"
263
264/* C declarations */
265
266#define GAAERROR(x){ gaa_error = 1; return x; } \
267{ \
268gaa_error = 1; \
269return x; \
270}
271
272static char *gaa_current_option;
273static int gaa_error = 0;
274
275/* Generated by gaa */
276
277#include <string.h>
278#include <stdlib.h>
279
280
281#define GAA_OK-1 -1
282
283#define GAA_ERROR_NOMATCH0 0
284#define GAA_ERROR_NOTENOUGH_ARGS1 1
285#define GAA_ERROR_INVALID_ARG2 2
286#define GAA_ERROR_UNKNOWN3 3
287
288#define GAA_NOT_AN_OPTION0 0
289#define GAA_WORD_OPTION1 1
290#define GAA_LETTER_OPTION2 2
291#define GAA_MULTIPLE_OPTION3 3
292
293#define GAA_REST0 0
294#define GAA_NB_OPTION35 35
295#define GAAOPTID_version1 1
296#define GAAOPTID_help2 2
297#define GAAOPTID_list3 3
298#define GAAOPTID_benchmark_tls4 4
299#define GAAOPTID_benchmark_soft_ciphers5 5
300#define GAAOPTID_benchmark_ciphers6 6
301#define GAAOPTID_insecure7 7
302#define GAAOPTID_port8 8
303#define GAAOPTID_pskkey9 9
304#define GAAOPTID_pskusername10 10
305#define GAAOPTID_srppasswd11 11
306#define GAAOPTID_srpusername12 12
307#define GAAOPTID_x509certfile13 13
308#define GAAOPTID_x509keyfile14 14
309#define GAAOPTID_pgpsubkey15 15
310#define GAAOPTID_pgpcertfile16 16
311#define GAAOPTID_pgpkeyring17 17
312#define GAAOPTID_pgpkeyfile18 18
313#define GAAOPTID_x509crlfile19 19
314#define GAAOPTID_x509cafile20 20
315#define GAAOPTID_priority21 21
316#define GAAOPTID_verbose22 22
317#define GAAOPTID_recordsize23 23
318#define GAAOPTID_print_cert24 24
319#define GAAOPTID_disable_extensions25 25
320#define GAAOPTID_fingerprint26 26
321#define GAAOPTID_x509fmtder27 27
322#define GAAOPTID_crlf28 28
323#define GAAOPTID_mtu29 29
324#define GAAOPTID_udp30 30
325#define GAAOPTID_starttls31 31
326#define GAAOPTID_noticket32 32
327#define GAAOPTID_rehandshake33 33
328#define GAAOPTID_resume34 34
329#define GAAOPTID_debug35 35
330
331#line 168 "gaa.skel"
332
333#define GAA_CHECK1STR(a,b)if(a[0] == str[0]) { gaa_current_option = a; return b; } \
334if(a[0] == str[0]) \
335{ \
336 gaa_current_option = a; \
337 return b; \
338}
339
340#define GAA_CHECKSTR(a,b)if(strcmp(a,str) == 0) { gaa_current_option = a; return b; } \
341if(strcmp(a,str) == 0) \
342{ \
343 gaa_current_option = a; \
344 return b; \
345}
346
347#define GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
\
348if(!OK) \
349{ \
350while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
351 gaa_index++; \
352if(gaa_last_non_option == gaa_index) \
353 return GAA_ERROR_NOTENOUGH_ARGS1; \
354}
355
356#define GAA_TESTMOREOPTIONALARGSif(!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; }
\
357if(!OK) \
358{ \
359while((gaa_last_non_option != gaa_index) && (gaa_arg_used[gaa_index] == 1)) \
360 gaa_index++; \
361if(gaa_last_non_option == gaa_index) \
362 OK = 1; \
363}
364
365#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 2; }
\
366target = func(GAAargv[gaa_index]); \
367gaa_arg_used[gaa_index] = 1; \
368if(gaa_error == 1) \
369{ \
370 gaa_error = 0; \
371 return GAA_ERROR_INVALID_ARG2; \
372}
373
374
375
376#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 2; } num = 1
; } else { num = 0; }
\
377if(!OK) \
378{ \
379target = func(GAAargv[gaa_index]); \
380gaa_arg_used[gaa_index] = 1; \
381if(gaa_error == 1) \
382{ \
383 gaa_error = 0; \
384 return GAA_ERROR_INVALID_ARG2; \
385} \
386num = 1; \
387} \
388else \
389{ \
390num = 0; \
391}
392
393#define GAA_LIST_FILL(target, func, type ,num)if(!OK) { num = 0; target = ((void*)0); 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) { target[num
] = func(GAAargv[gaa_index]); gaa_arg_used[gaa_index] = 1; if
(gaa_error == 1) { gaa_error = 0; return 2; }; num++; } } if(
num == 0) return 1; }
\
394if(!OK) \
395{ \
396num = 0; \
397target = NULL((void*)0); \
398if ( gaa_last_non_option - gaa_index > 0) \
399 target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
400for(; gaa_index < gaa_last_non_option; gaa_index++) \
401{ \
402 if(gaa_arg_used[gaa_index] == 0) \
403 { \
404 GAA_FILL_2ARGS(target[num], func)target[num] = func(GAAargv[gaa_index]); gaa_arg_used[gaa_index
] = 1; if(gaa_error == 1) { gaa_error = 0; return 2; }
; \
405 num++; \
406 } \
407} \
408if(num == 0) \
409 return GAA_ERROR_NOTENOUGH_ARGS1; \
410}
411
412#define GAA_OPTIONALLIST_FILL(target, func, type ,num)if(!OK) { num = 0; target = ((void*)0); 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) { target[num
] = func(GAAargv[gaa_index]); gaa_arg_used[gaa_index] = 1; if
(gaa_error == 1) { gaa_error = 0; return 2; }; num++; } } }
\
413if(!OK) \
414{ \
415num = 0; \
416target = NULL((void*)0); \
417if ( gaa_last_non_option - gaa_index > 0) \
418 target = gaa_malloc((gaa_last_non_option - gaa_index) * sizeof(type));\
419for(; gaa_index < gaa_last_non_option; gaa_index++) \
420{ \
421 if(gaa_arg_used[gaa_index] == 0) \
422 { \
423 GAA_FILL_2ARGS(target[num], func)target[num] = func(GAAargv[gaa_index]); gaa_arg_used[gaa_index
] = 1; if(gaa_error == 1) { gaa_error = 0; return 2; }
; \
424 num++; \
425 } \
426} \
427}
428
429#define GAA_OBLIGAT(str)k = 0; for(i = 0; i < strlen(str); i++) { j = gaa_get_option_num
(str + i, 2); if(j == 0) { 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; }
\
430k = 0; \
431for(i = 0; i < strlen(str); i++) \
432{ \
433 j = gaa_get_option_num(str + i, GAA_LETTER_OPTION2); \
434 if(j == GAA_ERROR_NOMATCH0) \
435 { \
436 printf("Error: invalid 'obligat' set\n"); \
437 exit(-1); \
438 } \
439 if(opt_list[j] == 1) \
440 k = 1; \
441} \
442if(k == 0) \
443{ \
444 if(strlen(str) == 1) \
445 printf("You must give the -%s option\n", str); \
446 else \
447 printf("You must give at least one option of '%s'\n", str); \
448 return 0; \
449}
450
451#define GAA_INCOMP(str)k = 0; for(i = 0; i < strlen(str); i++) { j = gaa_get_option_num
(str + i, 2); if(j == 0) { 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; }
\
452k = 0; \
453for(i = 0; i < strlen(str); i++) \
454{ \
455 j = gaa_get_option_num(str + i, GAA_LETTER_OPTION2); \
456 if(j == GAA_ERROR_NOMATCH0) \
457 { \
458 printf("Error: invalid 'obligat' set\n"); \
459 exit(-1); \
460 } \
461 if(opt_list[j] == 1) \
462 k++; \
463} \
464if(k > 1) \
465{ \
466 printf("The options '%s' are incompatible\n", str); \
467 return 0; \
468}
469
470
471static char **GAAargv;
472static int GAAargc;
473static char *gaa_arg_used;
474static int gaa_processing_file = 0;
475static int inited = 0;
476
477static int gaa_getint(char *arg)
478{
479 int tmp;
480 char a;
481 if(sscanf(arg, "%d%c", &tmp, &a) < 1)
482 {
483 printf("Option %s: '%s' isn't an integer\n", gaa_current_option, arg);
484 GAAERROR(-1){ gaa_error = 1; return -1; };
485 }
486 return tmp;
487}
488
489static char gaa_getchar(char *arg)
490{
491 if(strlen(arg) != 1)
492 {
493 printf("Option %s: '%s' isn't an character\n", gaa_current_option, arg);
494 GAAERROR(-1){ gaa_error = 1; return -1; };
495 }
496 return arg[0];
497}
498
499static char* gaa_getstr(char *arg)
500{
501 return arg;
502}
503static float gaa_getfloat(char *arg)
504{
505 float tmp;
506 char a;
507 if(sscanf(arg, "%f%c", &tmp, &a) < 1)
508 {
509 printf("Option %s: '%s' isn't a float number\n", gaa_current_option, arg);
510 GAAERROR(-1){ gaa_error = 1; return -1; };
511 }
512 return tmp;
513}
514/* option structures */
515
516struct GAAOPTION_port
517{
518 char* arg1;
519 int size1;
520};
521
522struct GAAOPTION_pskkey
523{
524 char* arg1;
525 int size1;
526};
527
528struct GAAOPTION_pskusername
529{
530 char* arg1;
531 int size1;
532};
533
534struct GAAOPTION_srppasswd
535{
536 char* arg1;
537 int size1;
538};
539
540struct GAAOPTION_srpusername
541{
542 char* arg1;
543 int size1;
544};
545
546struct GAAOPTION_x509certfile
547{
548 char* arg1;
549 int size1;
550};
551
552struct GAAOPTION_x509keyfile
553{
554 char* arg1;
555 int size1;
556};
557
558struct GAAOPTION_pgpsubkey
559{
560 char* arg1;
561 int size1;
562};
563
564struct GAAOPTION_pgpcertfile
565{
566 char* arg1;
567 int size1;
568};
569
570struct GAAOPTION_pgpkeyring
571{
572 char* arg1;
573 int size1;
574};
575
576struct GAAOPTION_pgpkeyfile
577{
578 char* arg1;
579 int size1;
580};
581
582struct GAAOPTION_x509crlfile
583{
584 char* arg1;
585 int size1;
586};
587
588struct GAAOPTION_x509cafile
589{
590 char* arg1;
591 int size1;
592};
593
594struct GAAOPTION_priority
595{
596 char* arg1;
597 int size1;
598};
599
600struct GAAOPTION_recordsize
601{
602 int arg1;
603 int size1;
604};
605
606struct GAAOPTION_mtu
607{
608 int arg1;
609 int size1;
610};
611
612struct GAAOPTION_debug
613{
614 int arg1;
615 int size1;
616};
617#define GAA_REST_EXISTS
618
619struct GAAREST
620{
621 char* arg1;
622 int size1;
623};
624
625#line 349 "gaa.skel"
626static int gaa_is_an_argument(char *str)
627{
628#ifdef GAA_WIN32
629 if(str[0] == '/' && str[1] != 0)
630 return GAA_MULTIPLE_OPTION3;
631#endif
632 if(str[0] != '-')
633 return GAA_NOT_AN_OPTION0;
634 if(str[1] == 0)
635 return GAA_NOT_AN_OPTION0;
636 if(str[1] == '-')
637 {
638 if(str[2] != 0)
639 return GAA_WORD_OPTION1;
640 else
641 return GAA_NOT_AN_OPTION0;
642 }
643 if(str[2] == 0)
644 return GAA_LETTER_OPTION2;
645 else
646 return GAA_MULTIPLE_OPTION3;
647}
648
649static int gaa_get_option_num(char *str, int status)
650{
651 switch(status)
652 {
653 case GAA_LETTER_OPTION2:
654 GAA_CHECK1STR("p", GAAOPTID_port)if("p"[0] == str[0]) { gaa_current_option = "p"; return 8; };
655 GAA_CHECK1STR("", GAAOPTID_pskkey)if(""[0] == str[0]) { gaa_current_option = ""; return 9; };
656 GAA_CHECK1STR("", GAAOPTID_pskusername)if(""[0] == str[0]) { gaa_current_option = ""; return 10; };
657 GAA_CHECK1STR("", GAAOPTID_srppasswd)if(""[0] == str[0]) { gaa_current_option = ""; return 11; };
658 GAA_CHECK1STR("", GAAOPTID_srpusername)if(""[0] == str[0]) { gaa_current_option = ""; return 12; };
659 GAA_CHECK1STR("", GAAOPTID_x509certfile)if(""[0] == str[0]) { gaa_current_option = ""; return 13; };
660 GAA_CHECK1STR("", GAAOPTID_x509keyfile)if(""[0] == str[0]) { gaa_current_option = ""; return 14; };
661 GAA_CHECK1STR("", GAAOPTID_pgpsubkey)if(""[0] == str[0]) { gaa_current_option = ""; return 15; };
662 GAA_CHECK1STR("", GAAOPTID_pgpcertfile)if(""[0] == str[0]) { gaa_current_option = ""; return 16; };
663 GAA_CHECK1STR("", GAAOPTID_pgpkeyring)if(""[0] == str[0]) { gaa_current_option = ""; return 17; };
664 GAA_CHECK1STR("", GAAOPTID_pgpkeyfile)if(""[0] == str[0]) { gaa_current_option = ""; return 18; };
665 GAA_CHECK1STR("", GAAOPTID_x509crlfile)if(""[0] == str[0]) { gaa_current_option = ""; return 19; };
666 GAA_CHECK1STR("", GAAOPTID_x509cafile)if(""[0] == str[0]) { gaa_current_option = ""; return 20; };
667 GAA_CHECK1STR("", GAAOPTID_priority)if(""[0] == str[0]) { gaa_current_option = ""; return 21; };
668 GAA_CHECK1STR("", GAAOPTID_recordsize)if(""[0] == str[0]) { gaa_current_option = ""; return 23; };
669 GAA_CHECK1STR("", GAAOPTID_mtu)if(""[0] == str[0]) { gaa_current_option = ""; return 29; };
670 GAA_CHECK1STR("d", GAAOPTID_debug)if("d"[0] == str[0]) { gaa_current_option = "d"; return 35; };
671 case GAA_MULTIPLE_OPTION3:
672#line 375 "gaa.skel"
673 GAA_CHECK1STR("v", GAAOPTID_version)if("v"[0] == str[0]) { gaa_current_option = "v"; return 1; };
674 GAA_CHECK1STR("h", GAAOPTID_help)if("h"[0] == str[0]) { gaa_current_option = "h"; return 2; };
675 GAA_CHECK1STR("l", GAAOPTID_list)if("l"[0] == str[0]) { gaa_current_option = "l"; return 3; };
676 GAA_CHECK1STR("", GAAOPTID_benchmark_tls)if(""[0] == str[0]) { gaa_current_option = ""; return 4; };
677 GAA_CHECK1STR("", GAAOPTID_benchmark_soft_ciphers)if(""[0] == str[0]) { gaa_current_option = ""; return 5; };
678 GAA_CHECK1STR("", GAAOPTID_benchmark_ciphers)if(""[0] == str[0]) { gaa_current_option = ""; return 6; };
679 GAA_CHECK1STR("", GAAOPTID_insecure)if(""[0] == str[0]) { gaa_current_option = ""; return 7; };
680 GAA_CHECK1STR("V", GAAOPTID_verbose)if("V"[0] == str[0]) { gaa_current_option = "V"; return 22; };
681 GAA_CHECK1STR("", GAAOPTID_print_cert)if(""[0] == str[0]) { gaa_current_option = ""; return 24; };
682 GAA_CHECK1STR("", GAAOPTID_disable_extensions)if(""[0] == str[0]) { gaa_current_option = ""; return 25; };
683 GAA_CHECK1STR("f", GAAOPTID_fingerprint)if("f"[0] == str[0]) { gaa_current_option = "f"; return 26; };
684 GAA_CHECK1STR("", GAAOPTID_x509fmtder)if(""[0] == str[0]) { gaa_current_option = ""; return 27; };
685 GAA_CHECK1STR("", GAAOPTID_crlf)if(""[0] == str[0]) { gaa_current_option = ""; return 28; };
686 GAA_CHECK1STR("u", GAAOPTID_udp)if("u"[0] == str[0]) { gaa_current_option = "u"; return 30; };
687 GAA_CHECK1STR("s", GAAOPTID_starttls)if("s"[0] == str[0]) { gaa_current_option = "s"; return 31; };
688 GAA_CHECK1STR("", GAAOPTID_noticket)if(""[0] == str[0]) { gaa_current_option = ""; return 32; };
689 GAA_CHECK1STR("e", GAAOPTID_rehandshake)if("e"[0] == str[0]) { gaa_current_option = "e"; return 33; };
690 GAA_CHECK1STR("r", GAAOPTID_resume)if("r"[0] == str[0]) { gaa_current_option = "r"; return 34; };
691
692#line 277 "gaa.skel"
693 break;
694 case GAA_WORD_OPTION1:
695 GAA_CHECKSTR("version", GAAOPTID_version)if(strcmp("version",str) == 0) { gaa_current_option = "version"
; return 1; }
;
696 GAA_CHECKSTR("help", GAAOPTID_help)if(strcmp("help",str) == 0) { gaa_current_option = "help"; return
2; }
;
697 GAA_CHECKSTR("list", GAAOPTID_list)if(strcmp("list",str) == 0) { gaa_current_option = "list"; return
3; }
;
698 GAA_CHECKSTR("benchmark-tls", GAAOPTID_benchmark_tls)if(strcmp("benchmark-tls",str) == 0) { gaa_current_option = "benchmark-tls"
; return 4; }
;
699 GAA_CHECKSTR("benchmark-soft-ciphers", GAAOPTID_benchmark_soft_ciphers)if(strcmp("benchmark-soft-ciphers",str) == 0) { gaa_current_option
= "benchmark-soft-ciphers"; return 5; }
;
700 GAA_CHECKSTR("benchmark-ciphers", GAAOPTID_benchmark_ciphers)if(strcmp("benchmark-ciphers",str) == 0) { gaa_current_option
= "benchmark-ciphers"; return 6; }
;
701 GAA_CHECKSTR("insecure", GAAOPTID_insecure)if(strcmp("insecure",str) == 0) { gaa_current_option = "insecure"
; return 7; }
;
702 GAA_CHECKSTR("port", GAAOPTID_port)if(strcmp("port",str) == 0) { gaa_current_option = "port"; return
8; }
;
703 GAA_CHECKSTR("pskkey", GAAOPTID_pskkey)if(strcmp("pskkey",str) == 0) { gaa_current_option = "pskkey"
; return 9; }
;
704 GAA_CHECKSTR("pskusername", GAAOPTID_pskusername)if(strcmp("pskusername",str) == 0) { gaa_current_option = "pskusername"
; return 10; }
;
705 GAA_CHECKSTR("srppasswd", GAAOPTID_srppasswd)if(strcmp("srppasswd",str) == 0) { gaa_current_option = "srppasswd"
; return 11; }
;
706 GAA_CHECKSTR("srpusername", GAAOPTID_srpusername)if(strcmp("srpusername",str) == 0) { gaa_current_option = "srpusername"
; return 12; }
;
707 GAA_CHECKSTR("x509certfile", GAAOPTID_x509certfile)if(strcmp("x509certfile",str) == 0) { gaa_current_option = "x509certfile"
; return 13; }
;
708 GAA_CHECKSTR("x509keyfile", GAAOPTID_x509keyfile)if(strcmp("x509keyfile",str) == 0) { gaa_current_option = "x509keyfile"
; return 14; }
;
709 GAA_CHECKSTR("pgpsubkey", GAAOPTID_pgpsubkey)if(strcmp("pgpsubkey",str) == 0) { gaa_current_option = "pgpsubkey"
; return 15; }
;
710 GAA_CHECKSTR("pgpcertfile", GAAOPTID_pgpcertfile)if(strcmp("pgpcertfile",str) == 0) { gaa_current_option = "pgpcertfile"
; return 16; }
;
711 GAA_CHECKSTR("pgpkeyring", GAAOPTID_pgpkeyring)if(strcmp("pgpkeyring",str) == 0) { gaa_current_option = "pgpkeyring"
; return 17; }
;
712 GAA_CHECKSTR("pgpkeyfile", GAAOPTID_pgpkeyfile)if(strcmp("pgpkeyfile",str) == 0) { gaa_current_option = "pgpkeyfile"
; return 18; }
;
713 GAA_CHECKSTR("x509crlfile", GAAOPTID_x509crlfile)if(strcmp("x509crlfile",str) == 0) { gaa_current_option = "x509crlfile"
; return 19; }
;
714 GAA_CHECKSTR("x509cafile", GAAOPTID_x509cafile)if(strcmp("x509cafile",str) == 0) { gaa_current_option = "x509cafile"
; return 20; }
;
715 GAA_CHECKSTR("priority", GAAOPTID_priority)if(strcmp("priority",str) == 0) { gaa_current_option = "priority"
; return 21; }
;
716 GAA_CHECKSTR("verbose", GAAOPTID_verbose)if(strcmp("verbose",str) == 0) { gaa_current_option = "verbose"
; return 22; }
;
717 GAA_CHECKSTR("recordsize", GAAOPTID_recordsize)if(strcmp("recordsize",str) == 0) { gaa_current_option = "recordsize"
; return 23; }
;
718 GAA_CHECKSTR("print-cert", GAAOPTID_print_cert)if(strcmp("print-cert",str) == 0) { gaa_current_option = "print-cert"
; return 24; }
;
719 GAA_CHECKSTR("disable-extensions", GAAOPTID_disable_extensions)if(strcmp("disable-extensions",str) == 0) { gaa_current_option
= "disable-extensions"; return 25; }
;
720 GAA_CHECKSTR("fingerprint", GAAOPTID_fingerprint)if(strcmp("fingerprint",str) == 0) { gaa_current_option = "fingerprint"
; return 26; }
;
721 GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder)if(strcmp("x509fmtder",str) == 0) { gaa_current_option = "x509fmtder"
; return 27; }
;
722 GAA_CHECKSTR("crlf", GAAOPTID_crlf)if(strcmp("crlf",str) == 0) { gaa_current_option = "crlf"; return
28; }
;
723 GAA_CHECKSTR("mtu", GAAOPTID_mtu)if(strcmp("mtu",str) == 0) { gaa_current_option = "mtu"; return
29; }
;
724 GAA_CHECKSTR("udp", GAAOPTID_udp)if(strcmp("udp",str) == 0) { gaa_current_option = "udp"; return
30; }
;
725 GAA_CHECKSTR("starttls", GAAOPTID_starttls)if(strcmp("starttls",str) == 0) { gaa_current_option = "starttls"
; return 31; }
;
726 GAA_CHECKSTR("noticket", GAAOPTID_noticket)if(strcmp("noticket",str) == 0) { gaa_current_option = "noticket"
; return 32; }
;
727 GAA_CHECKSTR("rehandshake", GAAOPTID_rehandshake)if(strcmp("rehandshake",str) == 0) { gaa_current_option = "rehandshake"
; return 33; }
;
728 GAA_CHECKSTR("resume", GAAOPTID_resume)if(strcmp("resume",str) == 0) { gaa_current_option = "resume"
; return 34; }
;
729 GAA_CHECKSTR("debug", GAAOPTID_debug)if(strcmp("debug",str) == 0) { gaa_current_option = "debug"; return
35; }
;
730
731#line 281 "gaa.skel"
732 break;
733 default: break;
734 }
735 return GAA_ERROR_NOMATCH0;
736}
737
738static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
739{
740 int OK = 0;
741 int gaa_last_non_option;
742 struct GAAOPTION_port GAATMP_port;
743 struct GAAOPTION_pskkey GAATMP_pskkey;
744 struct GAAOPTION_pskusername GAATMP_pskusername;
745 struct GAAOPTION_srppasswd GAATMP_srppasswd;
746 struct GAAOPTION_srpusername GAATMP_srpusername;
747 struct GAAOPTION_x509certfile GAATMP_x509certfile;
748 struct GAAOPTION_x509keyfile GAATMP_x509keyfile;
749 struct GAAOPTION_pgpsubkey GAATMP_pgpsubkey;
750 struct GAAOPTION_pgpcertfile GAATMP_pgpcertfile;
751 struct GAAOPTION_pgpkeyring GAATMP_pgpkeyring;
752 struct GAAOPTION_pgpkeyfile GAATMP_pgpkeyfile;
753 struct GAAOPTION_x509crlfile GAATMP_x509crlfile;
754 struct GAAOPTION_x509cafile GAATMP_x509cafile;
755 struct GAAOPTION_priority GAATMP_priority;
756 struct GAAOPTION_recordsize GAATMP_recordsize;
757 struct GAAOPTION_mtu GAATMP_mtu;
758 struct GAAOPTION_debug GAATMP_debug;
759
760#line 393 "gaa.skel"
761#ifdef GAA_REST_EXISTS
762 struct GAAREST GAAREST_tmp;
763#endif
764
765 opt_list[gaa_num] = 1;
766
767 for(gaa_last_non_option = gaa_index;
768 (gaa_last_non_option != GAAargc) && (gaa_is_an_argument(GAAargv[gaa_last_non_option]) == GAA_NOT_AN_OPTION0);
769 gaa_last_non_option++);
770
771 if(gaa_num == GAA_REST0)
772 {
773 gaa_index = 1;
774 gaa_last_non_option = GAAargc;
775 }
776
777 switch(gaa_num)
778 {
779 case GAAOPTID_version1:
780 OK = 0;
781#line 109 "cli.gaa"
782{ cli_version(); exit(0); ;};
783
784 return GAA_OK-1;
785 break;
786 case GAAOPTID_help2:
787 OK = 0;
788#line 107 "cli.gaa"
789{ gaa_help(); exit(0); ;};
790
791 return GAA_OK-1;
792 break;
793 case GAAOPTID_list3:
794 OK = 0;
795#line 106 "cli.gaa"
796{ print_list(gaaval->priorities, gaaval->verbose); exit(0); ;};
797
798 return GAA_OK-1;
799 break;
800 case GAAOPTID_benchmark_tls4:
801 OK = 0;
802#line 104 "cli.gaa"
803{ benchmark_tls(gaaval->debug); exit(0) ;};
804
805 return GAA_OK-1;
806 break;
807 case GAAOPTID_benchmark_soft_ciphers5:
808 OK = 0;
809#line 103 "cli.gaa"
810{ benchmark_cipher(0, gaaval->debug); exit(0) ;};
811
812 return GAA_OK-1;
813 break;
814 case GAAOPTID_benchmark_ciphers6:
815 OK = 0;
816#line 102 "cli.gaa"
817{ benchmark_cipher(1, gaaval->debug); exit(0) ;};
818
819 return GAA_OK-1;
820 break;
821 case GAAOPTID_insecure7:
822 OK = 0;
823#line 100 "cli.gaa"
824{ gaaval->insecure = 1 ;};
825
826 return GAA_OK-1;
827 break;
828 case GAAOPTID_port8:
829 OK = 0;
830 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
831 GAA_FILL(GAATMP_port.arg1, gaa_getstr, GAATMP_port.size1)if(!OK) { GAATMP_port.arg1 = gaa_getstr(GAAargv[gaa_index]); gaa_arg_used
[gaa_index] = 1; if(gaa_error == 1) { gaa_error = 0; return 2
; } GAATMP_port.size1 = 1; } else { GAATMP_port.size1 = 0; }
;
832 gaa_index++;
833#line 97 "cli.gaa"
834{ gaaval->port = GAATMP_port.arg1 ;};
835
836 return GAA_OK-1;
837 break;
838 case GAAOPTID_pskkey9:
839 OK = 0;
840 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
841 GAA_FILL(GAATMP_pskkey.arg1, gaa_getstr, GAATMP_pskkey.size1)if(!OK) { GAATMP_pskkey.arg1 = gaa_getstr(GAAargv[gaa_index])
; gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pskkey.size1 = 1; } else { GAATMP_pskkey
.size1 = 0; }
;
842 gaa_index++;
843#line 94 "cli.gaa"
844{ gaaval->psk_key = GAATMP_pskkey.arg1 ;};
845
846 return GAA_OK-1;
847 break;
848 case GAAOPTID_pskusername10:
849 OK = 0;
850 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
851 GAA_FILL(GAATMP_pskusername.arg1, gaa_getstr, GAATMP_pskusername.size1)if(!OK) { GAATMP_pskusername.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pskusername.size1 = 1; } else { GAATMP_pskusername
.size1 = 0; }
;
852 gaa_index++;
853#line 91 "cli.gaa"
854{ gaaval->psk_username = GAATMP_pskusername.arg1 ;};
855
856 return GAA_OK-1;
857 break;
858 case GAAOPTID_srppasswd11:
859 OK = 0;
860 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
861 GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1)if(!OK) { GAATMP_srppasswd.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_srppasswd.size1 = 1; } else { GAATMP_srppasswd
.size1 = 0; }
;
862 gaa_index++;
863#line 88 "cli.gaa"
864{ gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;};
865
866 return GAA_OK-1;
867 break;
868 case GAAOPTID_srpusername12:
869 OK = 0;
870 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
871 GAA_FILL(GAATMP_srpusername.arg1, gaa_getstr, GAATMP_srpusername.size1)if(!OK) { GAATMP_srpusername.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_srpusername.size1 = 1; } else { GAATMP_srpusername
.size1 = 0; }
;
872 gaa_index++;
873#line 85 "cli.gaa"
874{ gaaval->srp_username = GAATMP_srpusername.arg1 ;};
875
876 return GAA_OK-1;
877 break;
878 case GAAOPTID_x509certfile13:
879 OK = 0;
880 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
881 GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1)if(!OK) { GAATMP_x509certfile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_x509certfile.size1 = 1; } else { GAATMP_x509certfile
.size1 = 0; }
;
882 gaa_index++;
883#line 82 "cli.gaa"
884{ gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;};
885
886 return GAA_OK-1;
887 break;
888 case GAAOPTID_x509keyfile14:
889 OK = 0;
890 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
891 GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1)if(!OK) { GAATMP_x509keyfile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_x509keyfile.size1 = 1; } else { GAATMP_x509keyfile
.size1 = 0; }
;
892 gaa_index++;
893#line 79 "cli.gaa"
894{ gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;};
895
896 return GAA_OK-1;
897 break;
898 case GAAOPTID_pgpsubkey15:
899 OK = 0;
900 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
901 GAA_FILL(GAATMP_pgpsubkey.arg1, gaa_getstr, GAATMP_pgpsubkey.size1)if(!OK) { GAATMP_pgpsubkey.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pgpsubkey.size1 = 1; } else { GAATMP_pgpsubkey
.size1 = 0; }
;
902 gaa_index++;
903#line 76 "cli.gaa"
904{ gaaval->pgp_subkey = GAATMP_pgpsubkey.arg1 ;};
905
906 return GAA_OK-1;
907 break;
908 case GAAOPTID_pgpcertfile16:
909 OK = 0;
910 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
911 GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1)if(!OK) { GAATMP_pgpcertfile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pgpcertfile.size1 = 1; } else { GAATMP_pgpcertfile
.size1 = 0; }
;
912 gaa_index++;
913#line 73 "cli.gaa"
914{ gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;};
915
916 return GAA_OK-1;
917 break;
918 case GAAOPTID_pgpkeyring17:
919 OK = 0;
920 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
921 GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1)if(!OK) { GAATMP_pgpkeyring.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pgpkeyring.size1 = 1; } else { GAATMP_pgpkeyring
.size1 = 0; }
;
922 gaa_index++;
923#line 70 "cli.gaa"
924{ gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;};
925
926 return GAA_OK-1;
927 break;
928 case GAAOPTID_pgpkeyfile18:
929 OK = 0;
930 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
931 GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1)if(!OK) { GAATMP_pgpkeyfile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_pgpkeyfile.size1 = 1; } else { GAATMP_pgpkeyfile
.size1 = 0; }
;
932 gaa_index++;
933#line 67 "cli.gaa"
934{ gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;};
935
936 return GAA_OK-1;
937 break;
938 case GAAOPTID_x509crlfile19:
939 OK = 0;
940 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
941 GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1)if(!OK) { GAATMP_x509crlfile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_x509crlfile.size1 = 1; } else { GAATMP_x509crlfile
.size1 = 0; }
;
942 gaa_index++;
943#line 64 "cli.gaa"
944{ gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;};
945
946 return GAA_OK-1;
947 break;
948 case GAAOPTID_x509cafile20:
949 OK = 0;
950 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
951 GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1)if(!OK) { GAATMP_x509cafile.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_x509cafile.size1 = 1; } else { GAATMP_x509cafile
.size1 = 0; }
;
952 gaa_index++;
953#line 61 "cli.gaa"
954{ gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;};
955
956 return GAA_OK-1;
957 break;
958 case GAAOPTID_priority21:
959 OK = 0;
960 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
961 GAA_FILL(GAATMP_priority.arg1, gaa_getstr, GAATMP_priority.size1)if(!OK) { GAATMP_priority.arg1 = gaa_getstr(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_priority.size1 = 1; } else { GAATMP_priority
.size1 = 0; }
;
962 gaa_index++;
963#line 58 "cli.gaa"
964{ gaaval->priorities = GAATMP_priority.arg1 ;};
965
966 return GAA_OK-1;
967 break;
968 case GAAOPTID_verbose22:
969 OK = 0;
970#line 55 "cli.gaa"
971{ gaaval->verbose = 1 ;};
972
973 return GAA_OK-1;
974 break;
975 case GAAOPTID_recordsize23:
976 OK = 0;
977 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
978 GAA_FILL(GAATMP_recordsize.arg1, gaa_getint, GAATMP_recordsize.size1)if(!OK) { GAATMP_recordsize.arg1 = gaa_getint(GAAargv[gaa_index
]); gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error
= 0; return 2; } GAATMP_recordsize.size1 = 1; } else { GAATMP_recordsize
.size1 = 0; }
;
979 gaa_index++;
980#line 52 "cli.gaa"
981{ gaaval->record_size = GAATMP_recordsize.arg1 ;};
982
983 return GAA_OK-1;
984 break;
985 case GAAOPTID_print_cert24:
986 OK = 0;
987#line 49 "cli.gaa"
988{ gaaval->print_cert = 1 ;};
989
990 return GAA_OK-1;
991 break;
992 case GAAOPTID_disable_extensions25:
993 OK = 0;
994#line 46 "cli.gaa"
995{ gaaval->disable_extensions = 1 ;};
996
997 return GAA_OK-1;
998 break;
999 case GAAOPTID_fingerprint26:
1000 OK = 0;
1001#line 43 "cli.gaa"
1002{ gaaval->fingerprint = 1 ;};
1003
1004 return GAA_OK-1;
1005 break;
1006 case GAAOPTID_x509fmtder27:
1007 OK = 0;
1008#line 40 "cli.gaa"
1009{ gaaval->fmtder = 1 ;};
1010
1011 return GAA_OK-1;
1012 break;
1013 case GAAOPTID_crlf28:
1014 OK = 0;
1015#line 37 "cli.gaa"
1016{ gaaval->crlf = 1 ;};
1017
1018 return GAA_OK-1;
1019 break;
1020 case GAAOPTID_mtu29:
1021 OK = 0;
1022 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
1023 GAA_FILL(GAATMP_mtu.arg1, gaa_getint, GAATMP_mtu.size1)if(!OK) { GAATMP_mtu.arg1 = gaa_getint(GAAargv[gaa_index]); gaa_arg_used
[gaa_index] = 1; if(gaa_error == 1) { gaa_error = 0; return 2
; } GAATMP_mtu.size1 = 1; } else { GAATMP_mtu.size1 = 0; }
;
1024 gaa_index++;
1025#line 34 "cli.gaa"
1026{ gaaval->mtu = GAATMP_mtu.arg1 ;};
1027
1028 return GAA_OK-1;
1029 break;
1030 case GAAOPTID_udp30:
1031 OK = 0;
1032#line 31 "cli.gaa"
1033{ gaaval->udp = 1 ;};
1034
1035 return GAA_OK-1;
1036 break;
1037 case GAAOPTID_starttls31:
1038 OK = 0;
1039#line 28 "cli.gaa"
1040{ gaaval->starttls = 1 ;};
1041
1042 return GAA_OK-1;
1043 break;
1044 case GAAOPTID_noticket32:
1045 OK = 0;
1046#line 25 "cli.gaa"
1047{ gaaval->noticket = 1 ;};
1048
1049 return GAA_OK-1;
1050 break;
1051 case GAAOPTID_rehandshake33:
1052 OK = 0;
1053#line 22 "cli.gaa"
1054{ gaaval->rehandshake = 1 ;};
1055
1056 return GAA_OK-1;
1057 break;
1058 case GAAOPTID_resume34:
1059 OK = 0;
Value stored to 'OK' is never read
1060#line 19 "cli.gaa"
1061{ gaaval->resume = 1 ;};
1062
1063 return GAA_OK-1;
1064 break;
1065 case GAAOPTID_debug35:
1066 OK = 0;
1067 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
1068 GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1)if(!OK) { GAATMP_debug.arg1 = gaa_getint(GAAargv[gaa_index]);
gaa_arg_used[gaa_index] = 1; if(gaa_error == 1) { gaa_error =
0; return 2; } GAATMP_debug.size1 = 1; } else { GAATMP_debug
.size1 = 0; }
;
1069 gaa_index++;
1070#line 16 "cli.gaa"
1071{ gaaval->debug = GAATMP_debug.arg1 ;};
1072
1073 return GAA_OK-1;
1074 break;
1075 case GAA_REST0:
1076 GAA_TESTMOREARGSif(!OK) { while((gaa_last_non_option != gaa_index) &&
(gaa_arg_used[gaa_index] == 1)) gaa_index++; if(gaa_last_non_option
== gaa_index) return 1; }
;
1077 GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1)if(!OK) { GAAREST_tmp.arg1 = gaa_getstr(GAAargv[gaa_index]); gaa_arg_used
[gaa_index] = 1; if(gaa_error == 1) { gaa_error = 0; return 2
; } GAAREST_tmp.size1 = 1; } else { GAAREST_tmp.size1 = 0; }
;
1078 gaa_index++;
1079#line 112 "cli.gaa"
1080{ gaaval->rest_args = GAAREST_tmp.arg1; ;};
1081
1082 return GAA_OK-1;
1083 break;
1084
1085#line 413 "gaa.skel"
1086 default: break;
1087 }
1088 return GAA_ERROR_UNKNOWN3;
1089}
1090
1091int gaa(int argc, char **argv, gaainfo *gaaval)
1092{
1093 int tmp1, tmp2;
1094 int i, j;
1095 char *opt_list;
1096
1097 GAAargv = argv;
1098 GAAargc = argc;
1099
1100 opt_list = (char*) gaa_malloc(GAA_NB_OPTION35 + 1);
1101
1102 for(i = 0; i < GAA_NB_OPTION35 + 1; i++)
1103 opt_list[i] = 0;
1104 /* initialization */
1105 if(inited == 0)
1106 {
1107
1108#line 114 "cli.gaa"
1109{ gaaval->resume=0; gaaval->noticket=0; gaaval->port="443"; gaaval->rest_args=NULL((void*)0);
1110 gaaval->record_size=0;
1111 gaaval->fingerprint=0; gaaval->pgp_keyring=NULL((void*)0); gaaval->x509_crlfile = NULL((void*)0);
1112 gaaval->x509_cafile = NULL((void*)0); gaaval->pgp_keyfile=NULL((void*)0); gaaval->pgp_certfile=NULL((void*)0); gaaval->disable_extensions = 0;
1113 gaaval->x509_keyfile=NULL((void*)0); gaaval->x509_certfile=NULL((void*)0); gaaval->crlf = 0;
1114 gaaval->srp_username=NULL((void*)0); gaaval->srp_passwd=NULL((void*)0); gaaval->fmtder = 0; gaaval->starttls =0;
1115 gaaval->debug = 0; gaaval->print_cert = 0; gaaval->verbose = 0; gaaval->psk_key = NULL((void*)0);
1116 gaaval->psk_username = NULL((void*)0); gaaval->priorities = NULL((void*)0); gaaval->mtu = 1300;
1117 gaaval->pgp_subkey = NULL((void*)0); gaaval->rehandshake = 0; gaaval->udp = 0; ;};
1118
1119 }
1120 inited = 1;
1121#line 438 "gaa.skel"
1122 gaa_arg_used = NULL((void*)0);
1123
1124 if (argc > 0) {
1125 gaa_arg_used = gaa_malloc(argc * sizeof(char));
1126 }
1127
1128 for(i = 1; i < argc; i++)
1129 gaa_arg_used[i] = 0;
1130 for(i = 1; i < argc; i++)
1131 {
1132 if(gaa_arg_used[i] == 0)
1133 {
1134 j = 0;
1135 tmp1 = gaa_is_an_argument(GAAargv[i]);
1136 switch(tmp1)
1137 {
1138 case GAA_WORD_OPTION1:
1139 j++;
1140 case GAA_LETTER_OPTION2:
1141 j++;
1142 tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
1143 if(tmp2 == GAA_ERROR_NOMATCH0)
1144 {
1145 printf("Invalid option '%s'\n", argv[i]+j);
1146 return 0;
1147 }
1148 switch(gaa_try(tmp2, i+1, gaaval, opt_list))
1149 {
1150 case GAA_ERROR_NOTENOUGH_ARGS1:
1151 printf("'%s': not enough arguments\n",gaa_current_option);
1152 return 0;
1153 case GAA_ERROR_INVALID_ARG2:
1154 printf("Invalid arguments\n");
1155 return 0;
1156 case GAA_OK-1:
1157 break;
1158 default:
1159 printf("Unknown error\n");
1160 }
1161 gaa_arg_used[i] = 1;
1162 break;
1163 case GAA_MULTIPLE_OPTION3:
1164 for(j = 1; j < strlen(argv[i]); j++)
1165 {
1166 tmp2 = gaa_get_option_num(argv[i]+j, tmp1);
1167 if(tmp2 == GAA_ERROR_NOMATCH0)
1168 {
1169 printf("Invalid option '%c'\n", *(argv[i]+j));
1170 return 0;
1171 }
1172 switch(gaa_try(tmp2, i+1, gaaval, opt_list))
1173 {
1174 case GAA_ERROR_NOTENOUGH_ARGS1:
1175 printf("'%s': not enough arguments\n",gaa_current_option);
1176 return 0;
1177 case GAA_ERROR_INVALID_ARG2:
1178 printf("Invalid arguments\n");
1179 return 0;
1180 case GAA_OK-1:
1181 break;
1182 default:
1183 printf("Unknown error\n");
1184 }
1185 }
1186 gaa_arg_used[i] = 1;
1187 break;
1188 default: break;
1189 }
1190 }
1191 }
1192if(gaa_processing_file == 0)
1193{
1194
1195#line 507 "gaa.skel"
1196#ifdef GAA_REST_EXISTS
1197 switch(gaa_try(GAA_REST0, 1, gaaval, opt_list))
1198 {
1199 case GAA_ERROR_NOTENOUGH_ARGS1:
1200 printf("Rest: not enough arguments\n");
1201 return 0;
1202 case GAA_ERROR_INVALID_ARG2:
1203 printf("Invalid arguments\n");
1204 return 0;
1205 case GAA_OK-1:
1206 break;
1207 default:
1208 printf("Unknown error\n");
1209 }
1210#endif
1211}
1212 for(i = 1; i < argc; i++)
1213 {
1214 if(gaa_arg_used[i] == 0)
1215 {
1216 printf("Too many arguments\n");
1217 return 0;
1218 }
1219 }
1220 free(gaa_arg_used);
1221 free(opt_list);
1222 return -1;
1223}
1224
1225struct gaastrnode
1226{
1227 char *str;
1228 struct gaastrnode *next;
1229};
1230
1231typedef struct gaastrnode gaa_str_node;
1232
1233static int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc)
1234{
1235 int pos_ini;
1236 int a;
1237 int i = 0, len = 0, newline = 0;
1238
1239 if(argc == 1) {
1240 newline = 1;
1241 len = 2;
1242 }
1243
1244 a = fgetc( file);
1245 if (a == EOF(-1)) return 0;
1246
1247 while(a == ' ' || a == 9 || a == '\n')
1248 {
1249 if(a == '\n')
1250 {
1251 newline=1;
1252 len = 2;
1253 }
1254 a = fgetc( file);
1255 if (a == EOF(-1)) return 0;
1256 }
1257
1258 pos_ini = ftell(file) - 1;
1259
1260 while(a != ' ' && a != 9 && a != '\n')
1261 {
1262
1263 len++;
1264 a = fgetc( file);
1265 if(a==EOF(-1)) return 0;
1266 }
1267
1268 len += 1;
1269 tmp_str->str = gaa_malloc((len) * sizeof(char));
1270
1271 if(newline == 1)
1272 {
1273 tmp_str->str[0] = '-';
1274 tmp_str->str[1] = '-';
1275 i = 2;
1276 }
1277 else
1278 {
1279 i = 0;
1280 }
1281
1282 fseek(file,pos_ini, SEEK_SET0);
1283 do
1284 {
1285 a = fgetc( file);
1286
1287 if (a == EOF(-1)) {
1288 i+=2;
1289 break;
1290 }
1291 tmp_str->str[i] = a;
1292 i++;
1293 }
1294 while(a != ' ' && a != 9 && a != '\n' && i < len);
1295
1296 tmp_str->str[i - 1] = 0;
1297
1298 fseek(file,- 1, SEEK_CUR1);
1299/* printf("%d\n", ftell(file)); */
1300
1301 return -1;
1302}
1303
1304int gaa_file(const char *name, gaainfo *gaaval)
1305{
1306 gaa_str_node *first_str, **tmp_str, *tmp_str2;
1307 int rval, i;
1308 char **argv;
1309 int argc = 0;
1310 FILE *file;
1311
1312 gaa_processing_file = 1;
1313
1314 if((file = fopen(name, "r")) == NULL((void*)0))
1315 {
1316 printf("Couldn't open '%s' configuration file for reading\n", name);
1317 return 1;
1318 }
1319
1320 tmp_str = &first_str;
1321 do
1322 {
1323 argc++;
1324 *tmp_str = gaa_malloc(sizeof(gaa_str_node));
1325
1326 (*tmp_str)->str = NULL((void*)0);
1327 (*tmp_str)->next = NULL((void*)0);
1328
1329 rval = gaa_internal_get_next_str(file, *tmp_str, argc);
1330 tmp_str = &((*tmp_str)->next);
1331 }
1332 while(rval == -1);
1333
1334 if(rval == 1)
1335 return 0;
1336
1337 argv = gaa_malloc((1 + argc) * sizeof(char*));
1338
1339 tmp_str2 = first_str;
1340 argv[0] = "cfg";
1341 for(i = 1; i < argc; i++)
1342 {
1343 argv[i] = tmp_str2->str;
1344 tmp_str2 = tmp_str2->next;
1345 }
1346
1347 rval = gaa(argc, argv, gaaval);
1348 gaa_processing_file = 0;
1349 return rval;
1350}