summaryrefslogtreecommitdiff
path: root/src/cli-gaa.c
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@gnutls.org>2002-10-07 13:38:56 +0000
committerNikos Mavrogiannopoulos <nmav@gnutls.org>2002-10-07 13:38:56 +0000
commit2527a7991229bd084c5d43f6d94216f736915706 (patch)
treeb946570b8db454273e2e1afc51f9c3ed8f57a14d /src/cli-gaa.c
parent857a4dd103f48d90d419da37ce4812512bba904b (diff)
downloadgnutls-2527a7991229bd084c5d43f6d94216f736915706.tar.gz
Changes in gnutls-cli, to allow testing of starttls implementations.
Diffstat (limited to 'src/cli-gaa.c')
-rw-r--r--src/cli-gaa.c127
1 files changed, 70 insertions, 57 deletions
diff --git a/src/cli-gaa.c b/src/cli-gaa.c
index 33136f98e5..114dbded8c 100644
--- a/src/cli-gaa.c
+++ b/src/cli-gaa.c
@@ -128,6 +128,7 @@ void gaa_help(void)
{
printf("GNU TLS test client\nUsage: gnutls-cli [options] hostname\n\n\n");
__gaa_helpsingle('r', "resume", "", "Connect, establish a session. Connect again and resume this session.");
+ __gaa_helpsingle('s', "starttls", "", "Connect, establish a plain session and start TLS when EOF is sent.");
__gaa_helpsingle(0, "crlf", "", "Send CR LF instead of LF.");
__gaa_helpsingle(0, "x509fmtder", "", "Use DER format for certificates");
__gaa_helpsingle('f', "fingerprint", "", "Send the openpgp fingerprint, instead of the key.");
@@ -166,62 +167,64 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 92 "cli.gaa"
+#line 95 "cli.gaa"
char **rest_args;
-#line 91 "cli.gaa"
+#line 94 "cli.gaa"
int nrest_args;
-#line 81 "cli.gaa"
+#line 84 "cli.gaa"
char *srp_passwd;
-#line 78 "cli.gaa"
+#line 81 "cli.gaa"
char *srp_username;
-#line 75 "cli.gaa"
+#line 78 "cli.gaa"
char *x509_certfile;
-#line 72 "cli.gaa"
+#line 75 "cli.gaa"
char *x509_keyfile;
-#line 69 "cli.gaa"
+#line 72 "cli.gaa"
char *pgp_certfile;
-#line 66 "cli.gaa"
+#line 69 "cli.gaa"
char *pgp_trustdb;
-#line 63 "cli.gaa"
+#line 66 "cli.gaa"
char *pgp_keyring;
-#line 60 "cli.gaa"
+#line 63 "cli.gaa"
char *pgp_keyfile;
-#line 57 "cli.gaa"
+#line 60 "cli.gaa"
char *x509_cafile;
-#line 54 "cli.gaa"
+#line 57 "cli.gaa"
char **ctype;
-#line 53 "cli.gaa"
+#line 56 "cli.gaa"
int nctype;
-#line 50 "cli.gaa"
+#line 53 "cli.gaa"
char **kx;
-#line 49 "cli.gaa"
+#line 52 "cli.gaa"
int nkx;
-#line 46 "cli.gaa"
+#line 49 "cli.gaa"
char **macs;
-#line 45 "cli.gaa"
+#line 48 "cli.gaa"
int nmacs;
-#line 42 "cli.gaa"
+#line 45 "cli.gaa"
char **comp;
-#line 41 "cli.gaa"
+#line 44 "cli.gaa"
int ncomp;
-#line 38 "cli.gaa"
+#line 41 "cli.gaa"
char **proto;
-#line 37 "cli.gaa"
+#line 40 "cli.gaa"
int nproto;
-#line 34 "cli.gaa"
+#line 37 "cli.gaa"
char **ciphers;
-#line 33 "cli.gaa"
+#line 36 "cli.gaa"
int nciphers;
-#line 29 "cli.gaa"
+#line 32 "cli.gaa"
int record_size;
-#line 26 "cli.gaa"
+#line 29 "cli.gaa"
int port;
-#line 23 "cli.gaa"
+#line 26 "cli.gaa"
int fingerprint;
-#line 20 "cli.gaa"
+#line 23 "cli.gaa"
int fmtder;
-#line 17 "cli.gaa"
+#line 20 "cli.gaa"
int crlf;
+#line 17 "cli.gaa"
+ int starttls;
#line 14 "cli.gaa"
int resume;
@@ -278,7 +281,7 @@ int gaa_error = 0;
#define GAA_MULTIPLE_OPTION 3
#define GAA_REST 0
-#define GAA_NB_OPTION 25
+#define GAA_NB_OPTION 26
#define GAAOPTID_copyright 1
#define GAAOPTID_version 2
#define GAAOPTID_help 3
@@ -303,7 +306,8 @@ int gaa_error = 0;
#define GAAOPTID_fingerprint 22
#define GAAOPTID_x509fmtder 23
#define GAAOPTID_crlf 24
-#define GAAOPTID_resume 25
+#define GAAOPTID_starttls 25
+#define GAAOPTID_resume 26
#line 168 "gaa.skel"
@@ -654,6 +658,7 @@ int gaa_get_option_num(char *str, int status)
GAA_CHECK1STR("f", GAAOPTID_fingerprint);
GAA_CHECK1STR("", GAAOPTID_x509fmtder);
GAA_CHECK1STR("", GAAOPTID_crlf);
+ GAA_CHECK1STR("s", GAAOPTID_starttls);
GAA_CHECK1STR("r", GAAOPTID_resume);
#line 277 "gaa.skel"
@@ -683,6 +688,7 @@ int gaa_get_option_num(char *str, int status)
GAA_CHECKSTR("fingerprint", GAAOPTID_fingerprint);
GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder);
GAA_CHECKSTR("crlf", GAAOPTID_crlf);
+ GAA_CHECKSTR("starttls", GAAOPTID_starttls);
GAA_CHECKSTR("resume", GAAOPTID_resume);
#line 281 "gaa.skel"
@@ -735,28 +741,28 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
{
case GAAOPTID_copyright:
OK = 0;
-#line 89 "cli.gaa"
+#line 92 "cli.gaa"
{ print_license(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_version:
OK = 0;
-#line 88 "cli.gaa"
+#line 91 "cli.gaa"
{ cli_version(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_help:
OK = 0;
-#line 86 "cli.gaa"
+#line 89 "cli.gaa"
{ gaa_help(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_list:
OK = 0;
-#line 85 "cli.gaa"
+#line 88 "cli.gaa"
{ print_list(); exit(0); ;};
return GAA_OK;
@@ -766,7 +772,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_srppasswd.arg1, gaa_getstr, GAATMP_srppasswd.size1);
gaa_index++;
-#line 82 "cli.gaa"
+#line 85 "cli.gaa"
{ gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;};
return GAA_OK;
@@ -776,7 +782,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_srpusername.arg1, gaa_getstr, GAATMP_srpusername.size1);
gaa_index++;
-#line 79 "cli.gaa"
+#line 82 "cli.gaa"
{ gaaval->srp_username = GAATMP_srpusername.arg1 ;};
return GAA_OK;
@@ -786,7 +792,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_x509certfile.arg1, gaa_getstr, GAATMP_x509certfile.size1);
gaa_index++;
-#line 76 "cli.gaa"
+#line 79 "cli.gaa"
{ gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;};
return GAA_OK;
@@ -796,7 +802,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_x509keyfile.arg1, gaa_getstr, GAATMP_x509keyfile.size1);
gaa_index++;
-#line 73 "cli.gaa"
+#line 76 "cli.gaa"
{ gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;};
return GAA_OK;
@@ -806,7 +812,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pgpcertfile.arg1, gaa_getstr, GAATMP_pgpcertfile.size1);
gaa_index++;
-#line 70 "cli.gaa"
+#line 73 "cli.gaa"
{ gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;};
return GAA_OK;
@@ -816,7 +822,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pgptrustdb.arg1, gaa_getstr, GAATMP_pgptrustdb.size1);
gaa_index++;
-#line 67 "cli.gaa"
+#line 70 "cli.gaa"
{ gaaval->pgp_trustdb = GAATMP_pgptrustdb.arg1 ;};
return GAA_OK;
@@ -826,7 +832,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pgpkeyring.arg1, gaa_getstr, GAATMP_pgpkeyring.size1);
gaa_index++;
-#line 64 "cli.gaa"
+#line 67 "cli.gaa"
{ gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;};
return GAA_OK;
@@ -836,7 +842,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pgpkeyfile.arg1, gaa_getstr, GAATMP_pgpkeyfile.size1);
gaa_index++;
-#line 61 "cli.gaa"
+#line 64 "cli.gaa"
{ gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;};
return GAA_OK;
@@ -846,7 +852,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_x509cafile.arg1, gaa_getstr, GAATMP_x509cafile.size1);
gaa_index++;
-#line 58 "cli.gaa"
+#line 61 "cli.gaa"
{ gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;};
return GAA_OK;
@@ -854,7 +860,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_ctypes:
OK = 0;
GAA_LIST_FILL(GAATMP_ctypes.arg1, gaa_getstr, char*, GAATMP_ctypes.size1);
-#line 55 "cli.gaa"
+#line 58 "cli.gaa"
{ gaaval->ctype = GAATMP_ctypes.arg1; gaaval->nctype = GAATMP_ctypes.size1 ;};
return GAA_OK;
@@ -862,7 +868,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_kx:
OK = 0;
GAA_LIST_FILL(GAATMP_kx.arg1, gaa_getstr, char*, GAATMP_kx.size1);
-#line 51 "cli.gaa"
+#line 54 "cli.gaa"
{ gaaval->kx = GAATMP_kx.arg1; gaaval->nkx = GAATMP_kx.size1 ;};
return GAA_OK;
@@ -870,7 +876,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_macs:
OK = 0;
GAA_LIST_FILL(GAATMP_macs.arg1, gaa_getstr, char*, GAATMP_macs.size1);
-#line 47 "cli.gaa"
+#line 50 "cli.gaa"
{ gaaval->macs = GAATMP_macs.arg1; gaaval->nmacs = GAATMP_macs.size1 ;};
return GAA_OK;
@@ -878,7 +884,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_comp:
OK = 0;
GAA_LIST_FILL(GAATMP_comp.arg1, gaa_getstr, char*, GAATMP_comp.size1);
-#line 43 "cli.gaa"
+#line 46 "cli.gaa"
{ gaaval->comp = GAATMP_comp.arg1; gaaval->ncomp = GAATMP_comp.size1 ;};
return GAA_OK;
@@ -886,7 +892,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_protocols:
OK = 0;
GAA_LIST_FILL(GAATMP_protocols.arg1, gaa_getstr, char*, GAATMP_protocols.size1);
-#line 39 "cli.gaa"
+#line 42 "cli.gaa"
{ gaaval->proto = GAATMP_protocols.arg1; gaaval->nproto = GAATMP_protocols.size1 ;};
return GAA_OK;
@@ -894,7 +900,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
case GAAOPTID_ciphers:
OK = 0;
GAA_LIST_FILL(GAATMP_ciphers.arg1, gaa_getstr, char*, GAATMP_ciphers.size1);
-#line 35 "cli.gaa"
+#line 38 "cli.gaa"
{ gaaval->ciphers = GAATMP_ciphers.arg1; gaaval->nciphers = GAATMP_ciphers.size1 ;};
return GAA_OK;
@@ -904,7 +910,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_recordsize.arg1, gaa_getint, GAATMP_recordsize.size1);
gaa_index++;
-#line 30 "cli.gaa"
+#line 33 "cli.gaa"
{ gaaval->record_size = GAATMP_recordsize.arg1 ;};
return GAA_OK;
@@ -914,32 +920,39 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_port.arg1, gaa_getint, GAATMP_port.size1);
gaa_index++;
-#line 27 "cli.gaa"
+#line 30 "cli.gaa"
{ gaaval->port = GAATMP_port.arg1 ;};
return GAA_OK;
break;
case GAAOPTID_fingerprint:
OK = 0;
-#line 24 "cli.gaa"
+#line 27 "cli.gaa"
{ gaaval->fingerprint = 1 ;};
return GAA_OK;
break;
case GAAOPTID_x509fmtder:
OK = 0;
-#line 21 "cli.gaa"
+#line 24 "cli.gaa"
{ gaaval->fmtder = 1 ;};
return GAA_OK;
break;
case GAAOPTID_crlf:
OK = 0;
-#line 18 "cli.gaa"
+#line 21 "cli.gaa"
{ gaaval->crlf = 1 ;};
return GAA_OK;
break;
+ case GAAOPTID_starttls:
+ OK = 0;
+#line 18 "cli.gaa"
+{ gaaval->starttls = 1 ;};
+
+ return GAA_OK;
+ break;
case GAAOPTID_resume:
OK = 0;
#line 15 "cli.gaa"
@@ -949,7 +962,7 @@ int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
break;
case GAA_REST:
GAA_LIST_FILL(GAAREST_tmp.arg1, gaa_getstr, char*, GAAREST_tmp.size1);
-#line 93 "cli.gaa"
+#line 96 "cli.gaa"
{ gaaval->rest_args = GAAREST_tmp.arg1; gaaval->nrest_args = GAAREST_tmp.size1 ;};
return GAA_OK;
@@ -978,14 +991,14 @@ int gaa(int argc, char **argv, gaainfo *gaaval)
if(inited == 0)
{
-#line 95 "cli.gaa"
+#line 98 "cli.gaa"
{ gaaval->resume=0; gaaval->port=443; gaaval->rest_args=NULL; gaaval->nrest_args=0; gaaval->ciphers=NULL;
gaaval->kx=NULL; gaaval->comp=NULL; gaaval->macs=NULL; gaaval->ctype=NULL; gaaval->nciphers=0;
gaaval->nkx=0; gaaval->ncomp=0; gaaval->nmacs=0; gaaval->nctype = 0; gaaval->record_size=0;
gaaval->fingerprint=0; gaaval->pgp_trustdb=NULL; gaaval->pgp_keyring=NULL;
gaaval->x509_cafile = NULL; gaaval->pgp_keyfile=NULL; gaaval->pgp_certfile=NULL;
gaaval->x509_keyfile=NULL; gaaval->x509_certfile=NULL; gaaval->crlf = 0;
- gaaval->srp_username=NULL; gaaval->srp_passwd=NULL; gaaval->fmtder = 0; ;};
+ gaaval->srp_username=NULL; gaaval->srp_passwd=NULL; gaaval->fmtder = 0; gaaval->starttls =0; ;};
}
inited = 1;