summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNikos Mavrogiannopoulos <nmav@crystal.(none)>2007-10-07 10:26:18 +0300
committerNikos Mavrogiannopoulos <nmav@crystal.(none)>2007-10-07 10:26:18 +0300
commitfb62e24be7bc2c40136ede7d54db2960b1a880a6 (patch)
tree647fdf90f3f1d5c450dac2ba89ea61ce4d1466b1 /src
parent96183cb39b38e7f5cf0b58929ef5868ed5639096 (diff)
downloadgnutls-fb62e24be7bc2c40136ede7d54db2960b1a880a6.tar.gz
Removed all the xml functions and stubs, as well as references in the
documentation.
Diffstat (limited to 'src')
-rw-r--r--src/certtool-gaa.c111
-rw-r--r--src/certtool-gaa.h16
-rw-r--r--src/certtool.c15
-rw-r--r--src/certtool.gaa5
-rw-r--r--src/cli-gaa.c163
-rw-r--r--src/cli-gaa.h68
-rw-r--r--src/cli.c242
-rw-r--r--src/cli.gaa5
-rw-r--r--src/common.c235
9 files changed, 385 insertions, 475 deletions
diff --git a/src/certtool-gaa.c b/src/certtool-gaa.c
index fa2774fe0a..2f2266e577 100644
--- a/src/certtool-gaa.c
+++ b/src/certtool-gaa.c
@@ -159,7 +159,6 @@ void gaa_help(void)
__gaa_helpsingle(0, "hash", "STR ", "Hash algorithm to use for signing (MD5,SHA1,RMD160,SHA256,SHA384,SHA512).");
__gaa_helpsingle(0, "export-ciphers", "", "Use weak encryption algorithms.");
__gaa_helpsingle(0, "inder", "", "Use DER format for input certificates and private keys.");
- __gaa_helpsingle(0, "xml", "", "Use XML format for output certificates.");
__gaa_helpsingle(0, "outder", "", "Use DER format for output certificates and private keys.");
__gaa_helpsingle(0, "bits", "BITS ", "specify the number of bits for key generation.");
__gaa_helpsingle(0, "quick-random", "", "Use /dev/urandom for all operation, reducing the quality of randomness used.");
@@ -183,22 +182,20 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 110 "certtool.gaa"
+#line 107 "certtool.gaa"
int debug;
-#line 106 "certtool.gaa"
- char *template;
#line 103 "certtool.gaa"
- char *infile;
+ char *template;
#line 100 "certtool.gaa"
- char *outfile;
+ char *infile;
#line 97 "certtool.gaa"
- int quick_random;
+ char *outfile;
#line 94 "certtool.gaa"
- int bits;
+ int quick_random;
#line 91 "certtool.gaa"
- int outcert_format;
+ int bits;
#line 88 "certtool.gaa"
- int xml;
+ int outcert_format;
#line 85 "certtool.gaa"
int incert_format;
#line 82 "certtool.gaa"
@@ -279,7 +276,7 @@ static int gaa_error = 0;
#define GAA_MULTIPLE_OPTION 3
#define GAA_REST 0
-#define GAA_NB_OPTION 40
+#define GAA_NB_OPTION 39
#define GAAOPTID_version 1
#define GAAOPTID_help 2
#define GAAOPTID_debug 3
@@ -289,37 +286,36 @@ static int gaa_error = 0;
#define GAAOPTID_quick_random 7
#define GAAOPTID_bits 8
#define GAAOPTID_outder 9
-#define GAAOPTID_xml 10
-#define GAAOPTID_inder 11
-#define GAAOPTID_export_ciphers 12
-#define GAAOPTID_hash 13
-#define GAAOPTID_dsa 14
-#define GAAOPTID_pkcs8 15
-#define GAAOPTID_to_p12 16
-#define GAAOPTID_fix_key 17
-#define GAAOPTID_key_info 18
-#define GAAOPTID_smime_to_p7 19
-#define GAAOPTID_p7_info 20
-#define GAAOPTID_p12_info 21
-#define GAAOPTID_crl_info 22
-#define GAAOPTID_certificate_info 23
-#define GAAOPTID_password 24
-#define GAAOPTID_load_ca_certificate 25
-#define GAAOPTID_load_ca_privkey 26
-#define GAAOPTID_load_certificate 27
-#define GAAOPTID_load_request 28
-#define GAAOPTID_load_privkey 29
-#define GAAOPTID_get_dh_params 30
-#define GAAOPTID_generate_dh_params 31
-#define GAAOPTID_verify_crl 32
-#define GAAOPTID_verify_chain 33
-#define GAAOPTID_generate_request 34
-#define GAAOPTID_generate_privkey 35
-#define GAAOPTID_update_certificate 36
-#define GAAOPTID_generate_crl 37
-#define GAAOPTID_generate_proxy 38
-#define GAAOPTID_generate_certificate 39
-#define GAAOPTID_generate_self_signed 40
+#define GAAOPTID_inder 10
+#define GAAOPTID_export_ciphers 11
+#define GAAOPTID_hash 12
+#define GAAOPTID_dsa 13
+#define GAAOPTID_pkcs8 14
+#define GAAOPTID_to_p12 15
+#define GAAOPTID_fix_key 16
+#define GAAOPTID_key_info 17
+#define GAAOPTID_smime_to_p7 18
+#define GAAOPTID_p7_info 19
+#define GAAOPTID_p12_info 20
+#define GAAOPTID_crl_info 21
+#define GAAOPTID_certificate_info 22
+#define GAAOPTID_password 23
+#define GAAOPTID_load_ca_certificate 24
+#define GAAOPTID_load_ca_privkey 25
+#define GAAOPTID_load_certificate 26
+#define GAAOPTID_load_request 27
+#define GAAOPTID_load_privkey 28
+#define GAAOPTID_get_dh_params 29
+#define GAAOPTID_generate_dh_params 30
+#define GAAOPTID_verify_crl 31
+#define GAAOPTID_verify_chain 32
+#define GAAOPTID_generate_request 33
+#define GAAOPTID_generate_privkey 34
+#define GAAOPTID_update_certificate 35
+#define GAAOPTID_generate_crl 36
+#define GAAOPTID_generate_proxy 37
+#define GAAOPTID_generate_certificate 38
+#define GAAOPTID_generate_self_signed 39
#line 168 "gaa.skel"
@@ -625,7 +621,6 @@ static int gaa_get_option_num(char *str, int status)
GAA_CHECK1STR("h", GAAOPTID_help);
GAA_CHECK1STR("", GAAOPTID_quick_random);
GAA_CHECK1STR("", GAAOPTID_outder);
- GAA_CHECK1STR("", GAAOPTID_xml);
GAA_CHECK1STR("", GAAOPTID_inder);
GAA_CHECK1STR("", GAAOPTID_export_ciphers);
GAA_CHECK1STR("", GAAOPTID_dsa);
@@ -662,7 +657,6 @@ static int gaa_get_option_num(char *str, int status)
GAA_CHECKSTR("quick-random", GAAOPTID_quick_random);
GAA_CHECKSTR("bits", GAAOPTID_bits);
GAA_CHECKSTR("outder", GAAOPTID_outder);
- GAA_CHECKSTR("xml", GAAOPTID_xml);
GAA_CHECKSTR("inder", GAAOPTID_inder);
GAA_CHECKSTR("export-ciphers", GAAOPTID_export_ciphers);
GAA_CHECKSTR("hash", GAAOPTID_hash);
@@ -739,14 +733,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
{
case GAAOPTID_version:
OK = 0;
-#line 115 "certtool.gaa"
+#line 112 "certtool.gaa"
{ certtool_version(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_help:
OK = 0;
-#line 113 "certtool.gaa"
+#line 110 "certtool.gaa"
{ gaa_help(); exit(0); ;};
return GAA_OK;
@@ -756,7 +750,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_debug.arg1, gaa_getint, GAATMP_debug.size1);
gaa_index++;
-#line 111 "certtool.gaa"
+#line 108 "certtool.gaa"
{ gaaval->debug = GAATMP_debug.arg1 ;};
return GAA_OK;
@@ -766,7 +760,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_template.arg1, gaa_getstr, GAATMP_template.size1);
gaa_index++;
-#line 107 "certtool.gaa"
+#line 104 "certtool.gaa"
{ gaaval->template = GAATMP_template.arg1 ;};
return GAA_OK;
@@ -776,7 +770,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_infile.arg1, gaa_getstr, GAATMP_infile.size1);
gaa_index++;
-#line 104 "certtool.gaa"
+#line 101 "certtool.gaa"
{ gaaval->infile = GAATMP_infile.arg1 ;};
return GAA_OK;
@@ -786,14 +780,14 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_outfile.arg1, gaa_getstr, GAATMP_outfile.size1);
gaa_index++;
-#line 101 "certtool.gaa"
+#line 98 "certtool.gaa"
{ gaaval->outfile = GAATMP_outfile.arg1 ;};
return GAA_OK;
break;
case GAAOPTID_quick_random:
OK = 0;
-#line 98 "certtool.gaa"
+#line 95 "certtool.gaa"
{ gaaval->quick_random = 1; ;};
return GAA_OK;
@@ -803,22 +797,15 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_bits.arg1, gaa_getint, GAATMP_bits.size1);
gaa_index++;
-#line 95 "certtool.gaa"
+#line 92 "certtool.gaa"
{ gaaval->bits = GAATMP_bits.arg1 ;};
return GAA_OK;
break;
case GAAOPTID_outder:
OK = 0;
-#line 92 "certtool.gaa"
-{ gaaval->outcert_format=1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_xml:
- OK = 0;
#line 89 "certtool.gaa"
-{ gaaval->xml=1 ;};
+{ gaaval->outcert_format=1 ;};
return GAA_OK;
break;
@@ -1077,11 +1064,11 @@ int gaa(int argc, char **argv, gaainfo *gaaval)
if(inited == 0)
{
-#line 117 "certtool.gaa"
+#line 114 "certtool.gaa"
{ gaaval->bits = 1024; gaaval->pkcs8 = 0; gaaval->privkey = NULL; gaaval->ca=NULL; gaaval->ca_privkey = NULL;
gaaval->debug=1; gaaval->request = NULL; gaaval->infile = NULL; gaaval->outfile = NULL; gaaval->cert = NULL;
gaaval->incert_format = 0; gaaval->outcert_format = 0; gaaval->action=-1; gaaval->pass = NULL;
- gaaval->export = 0; gaaval->template = NULL; gaaval->xml = 0; gaaval->hash=NULL; gaaval->fix_key = 0; gaaval->quick_random=0; ;};
+ gaaval->export = 0; gaaval->template = NULL; gaaval->hash=NULL; gaaval->fix_key = 0; gaaval->quick_random=0; ;};
}
inited = 1;
diff --git a/src/certtool-gaa.h b/src/certtool-gaa.h
index 89c4a58f34..891360ef98 100644
--- a/src/certtool-gaa.h
+++ b/src/certtool-gaa.h
@@ -8,22 +8,20 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 110 "certtool.gaa"
+#line 107 "certtool.gaa"
int debug;
-#line 106 "certtool.gaa"
- char *template;
#line 103 "certtool.gaa"
- char *infile;
+ char *template;
#line 100 "certtool.gaa"
- char *outfile;
+ char *infile;
#line 97 "certtool.gaa"
- int quick_random;
+ char *outfile;
#line 94 "certtool.gaa"
- int bits;
+ int quick_random;
#line 91 "certtool.gaa"
- int outcert_format;
+ int bits;
#line 88 "certtool.gaa"
- int xml;
+ int outcert_format;
#line 85 "certtool.gaa"
int incert_format;
#line 82 "certtool.gaa"
diff --git a/src/certtool.c b/src/certtool.c
index e637c1f14d..0ecfca88e2 100644
--- a/src/certtool.c
+++ b/src/certtool.c
@@ -926,8 +926,6 @@ certificate_info (void)
if (info.outcert_format == GNUTLS_X509_FMT_PEM)
print_certificate_info (crt[i], outfile, 1);
- if (!info.xml)
- {
size = sizeof (buffer);
ret = gnutls_x509_crt_export (crt[i], info.outcert_format, buffer,
&size);
@@ -935,19 +933,6 @@ certificate_info (void)
error (EXIT_FAILURE, 0, "Export error: %s",
gnutls_strerror (ret));
fwrite (buffer, 1, size, outfile);
- }
- else
- {
- gnutls_datum_t xml;
-
- ret = gnutls_x509_crt_to_xml (crt[i], &xml, GNUTLS_XML_SHOW_ALL);
- if (ret < 0)
- error (EXIT_FAILURE, 0, "XML encoding error: %s",
- gnutls_strerror (ret));
-
- fprintf (outfile, "\n%s\n", xml.data);
- gnutls_free (xml.data);
- }
}
}
diff --git a/src/certtool.gaa b/src/certtool.gaa
index dd1d941239..828b3253f3 100644
--- a/src/certtool.gaa
+++ b/src/certtool.gaa
@@ -85,9 +85,6 @@ option (export-ciphers) { $export=1 } "Use weak encryption algorithms."
#int incert_format;
option (inder) { $incert_format=1 } "Use DER format for input certificates and private keys."
-#int xml;
-option (xml) { $xml=1 } "Use XML format for output certificates."
-
#int outcert_format;
option (outder) { $outcert_format=1 } "Use DER format for output certificates and private keys."
@@ -117,5 +114,5 @@ option (v, version) { certtool_version(); exit(0); } "shows the program's versio
init { $bits = 1024; $pkcs8 = 0; $privkey = NULL; $ca=NULL; $ca_privkey = NULL;
$debug=1; $request = NULL; $infile = NULL; $outfile = NULL; $cert = NULL;
$incert_format = 0; $outcert_format = 0; $action=-1; $pass = NULL;
- $export = 0; $template = NULL; $xml = 0; $hash=NULL; $fix_key = 0; $quick_random=0; }
+ $export = 0; $template = NULL; $hash=NULL; $fix_key = 0; $quick_random=0; }
diff --git a/src/cli-gaa.c b/src/cli-gaa.c
index 24ccb9210c..990168818f 100644
--- a/src/cli-gaa.c
+++ b/src/cli-gaa.c
@@ -134,7 +134,6 @@ void gaa_help(void)
__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, "xml", "", "Print the certificate information in XML format.");
__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.");
@@ -179,74 +178,72 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 128 "cli.gaa"
+#line 125 "cli.gaa"
char *rest_args;
-#line 119 "cli.gaa"
- int insecure;
#line 116 "cli.gaa"
- char *port;
+ int insecure;
#line 113 "cli.gaa"
- char *opaque_prf_input;
+ char *port;
#line 110 "cli.gaa"
- char *authz_saml_assertion;
+ char *opaque_prf_input;
#line 107 "cli.gaa"
- char *authz_x509_attr_cert;
+ char *authz_saml_assertion;
#line 104 "cli.gaa"
- char *psk_key;
+ char *authz_x509_attr_cert;
#line 101 "cli.gaa"
- char *psk_username;
+ char *psk_key;
#line 98 "cli.gaa"
- char *srp_passwd;
+ char *psk_username;
#line 95 "cli.gaa"
- char *srp_username;
+ char *srp_passwd;
#line 92 "cli.gaa"
- char *x509_certfile;
+ char *srp_username;
#line 89 "cli.gaa"
- char *x509_keyfile;
+ char *x509_certfile;
#line 86 "cli.gaa"
- char *pgp_certfile;
+ char *x509_keyfile;
#line 83 "cli.gaa"
- char *pgp_trustdb;
+ char *pgp_certfile;
#line 80 "cli.gaa"
- char *pgp_keyring;
+ char *pgp_trustdb;
#line 77 "cli.gaa"
- char *pgp_keyfile;
+ char *pgp_keyring;
#line 74 "cli.gaa"
- char *x509_crlfile;
+ char *pgp_keyfile;
#line 71 "cli.gaa"
- char *x509_cafile;
+ char *x509_crlfile;
#line 68 "cli.gaa"
+ char *x509_cafile;
+#line 65 "cli.gaa"
char **ctype;
-#line 67 "cli.gaa"
- int nctype;
#line 64 "cli.gaa"
+ int nctype;
+#line 61 "cli.gaa"
char **kx;
-#line 63 "cli.gaa"
- int nkx;
#line 60 "cli.gaa"
+ int nkx;
+#line 57 "cli.gaa"
char **macs;
-#line 59 "cli.gaa"
- int nmacs;
#line 56 "cli.gaa"
+ int nmacs;
+#line 53 "cli.gaa"
char **comp;
-#line 55 "cli.gaa"
- int ncomp;
#line 52 "cli.gaa"
+ int ncomp;
+#line 49 "cli.gaa"
char **proto;
-#line 51 "cli.gaa"
- int nproto;
#line 48 "cli.gaa"
+ int nproto;
+#line 45 "cli.gaa"
char **ciphers;
-#line 47 "cli.gaa"
- int nciphers;
#line 44 "cli.gaa"
- int verbose;
+ int nciphers;
#line 41 "cli.gaa"
- int record_size;
+ int verbose;
#line 38 "cli.gaa"
- int print_cert;
+ int record_size;
#line 35 "cli.gaa"
- int xml;
+ int print_cert;
#line 32 "cli.gaa"
int disable_extensions;
#line 29 "cli.gaa"
@@ -315,7 +312,7 @@ static int gaa_error = 0;
#define GAA_MULTIPLE_OPTION 3
#define GAA_REST 0
-#define GAA_NB_OPTION 38
+#define GAA_NB_OPTION 37
#define GAAOPTID_copyright 1
#define GAAOPTID_version 2
#define GAAOPTID_help 3
@@ -346,14 +343,13 @@ static int gaa_error = 0;
#define GAAOPTID_verbose 28
#define GAAOPTID_recordsize 29
#define GAAOPTID_print_cert 30
-#define GAAOPTID_xml 31
-#define GAAOPTID_disable_extensions 32
-#define GAAOPTID_fingerprint 33
-#define GAAOPTID_x509fmtder 34
-#define GAAOPTID_crlf 35
-#define GAAOPTID_starttls 36
-#define GAAOPTID_resume 37
-#define GAAOPTID_debug 38
+#define GAAOPTID_disable_extensions 31
+#define GAAOPTID_fingerprint 32
+#define GAAOPTID_x509fmtder 33
+#define GAAOPTID_crlf 34
+#define GAAOPTID_starttls 35
+#define GAAOPTID_resume 36
+#define GAAOPTID_debug 37
#line 168 "gaa.skel"
@@ -753,7 +749,6 @@ static int gaa_get_option_num(char *str, int status)
GAA_CHECK1STR("", GAAOPTID_insecure);
GAA_CHECK1STR("V", GAAOPTID_verbose);
GAA_CHECK1STR("", GAAOPTID_print_cert);
- GAA_CHECK1STR("", GAAOPTID_xml);
GAA_CHECK1STR("", GAAOPTID_disable_extensions);
GAA_CHECK1STR("f", GAAOPTID_fingerprint);
GAA_CHECK1STR("", GAAOPTID_x509fmtder);
@@ -794,7 +789,6 @@ static int gaa_get_option_num(char *str, int status)
GAA_CHECKSTR("verbose", GAAOPTID_verbose);
GAA_CHECKSTR("recordsize", GAAOPTID_recordsize);
GAA_CHECKSTR("print-cert", GAAOPTID_print_cert);
- GAA_CHECKSTR("xml", GAAOPTID_xml);
GAA_CHECKSTR("disable-extensions", GAAOPTID_disable_extensions);
GAA_CHECKSTR("fingerprint", GAAOPTID_fingerprint);
GAA_CHECKSTR("x509fmtder", GAAOPTID_x509fmtder);
@@ -860,35 +854,35 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
{
case GAAOPTID_copyright:
OK = 0;
-#line 126 "cli.gaa"
+#line 123 "cli.gaa"
{ print_license(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_version:
OK = 0;
-#line 125 "cli.gaa"
+#line 122 "cli.gaa"
{ cli_version(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_help:
OK = 0;
-#line 123 "cli.gaa"
+#line 120 "cli.gaa"
{ gaa_help(); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_list:
OK = 0;
-#line 122 "cli.gaa"
+#line 119 "cli.gaa"
{ print_list(gaaval->verbose); exit(0); ;};
return GAA_OK;
break;
case GAAOPTID_insecure:
OK = 0;
-#line 120 "cli.gaa"
+#line 117 "cli.gaa"
{ gaaval->insecure = 1 ;};
return GAA_OK;
@@ -898,7 +892,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_port.arg1, gaa_getstr, GAATMP_port.size1);
gaa_index++;
-#line 117 "cli.gaa"
+#line 114 "cli.gaa"
{ gaaval->port = GAATMP_port.arg1 ;};
return GAA_OK;
@@ -908,7 +902,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_opaque_prf_input.arg1, gaa_getstr, GAATMP_opaque_prf_input.size1);
gaa_index++;
-#line 114 "cli.gaa"
+#line 111 "cli.gaa"
{ gaaval->opaque_prf_input = GAATMP_opaque_prf_input.arg1 ;};
return GAA_OK;
@@ -918,7 +912,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_authz_saml_assertion.arg1, gaa_getstr, GAATMP_authz_saml_assertion.size1);
gaa_index++;
-#line 111 "cli.gaa"
+#line 108 "cli.gaa"
{ gaaval->authz_saml_assertion = GAATMP_authz_saml_assertion.arg1 ;};
return GAA_OK;
@@ -928,7 +922,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_authz_x509_attr_cert.arg1, gaa_getstr, GAATMP_authz_x509_attr_cert.size1);
gaa_index++;
-#line 108 "cli.gaa"
+#line 105 "cli.gaa"
{ gaaval->authz_x509_attr_cert = GAATMP_authz_x509_attr_cert.arg1 ;};
return GAA_OK;
@@ -938,7 +932,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pskkey.arg1, gaa_getstr, GAATMP_pskkey.size1);
gaa_index++;
-#line 105 "cli.gaa"
+#line 102 "cli.gaa"
{ gaaval->psk_key = GAATMP_pskkey.arg1 ;};
return GAA_OK;
@@ -948,7 +942,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_pskusername.arg1, gaa_getstr, GAATMP_pskusername.size1);
gaa_index++;
-#line 102 "cli.gaa"
+#line 99 "cli.gaa"
{ gaaval->psk_username = GAATMP_pskusername.arg1 ;};
return GAA_OK;
@@ -958,7 +952,7 @@ static 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 99 "cli.gaa"
+#line 96 "cli.gaa"
{ gaaval->srp_passwd = GAATMP_srppasswd.arg1 ;};
return GAA_OK;
@@ -968,7 +962,7 @@ static 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 96 "cli.gaa"
+#line 93 "cli.gaa"
{ gaaval->srp_username = GAATMP_srpusername.arg1 ;};
return GAA_OK;
@@ -978,7 +972,7 @@ static 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 93 "cli.gaa"
+#line 90 "cli.gaa"
{ gaaval->x509_certfile = GAATMP_x509certfile.arg1 ;};
return GAA_OK;
@@ -988,7 +982,7 @@ static 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 90 "cli.gaa"
+#line 87 "cli.gaa"
{ gaaval->x509_keyfile = GAATMP_x509keyfile.arg1 ;};
return GAA_OK;
@@ -998,7 +992,7 @@ static 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 87 "cli.gaa"
+#line 84 "cli.gaa"
{ gaaval->pgp_certfile = GAATMP_pgpcertfile.arg1 ;};
return GAA_OK;
@@ -1008,7 +1002,7 @@ static 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 84 "cli.gaa"
+#line 81 "cli.gaa"
{ gaaval->pgp_trustdb = GAATMP_pgptrustdb.arg1 ;};
return GAA_OK;
@@ -1018,7 +1012,7 @@ static 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 81 "cli.gaa"
+#line 78 "cli.gaa"
{ gaaval->pgp_keyring = GAATMP_pgpkeyring.arg1 ;};
return GAA_OK;
@@ -1028,7 +1022,7 @@ static 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 78 "cli.gaa"
+#line 75 "cli.gaa"
{ gaaval->pgp_keyfile = GAATMP_pgpkeyfile.arg1 ;};
return GAA_OK;
@@ -1038,7 +1032,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAATMP_x509crlfile.arg1, gaa_getstr, GAATMP_x509crlfile.size1);
gaa_index++;
-#line 75 "cli.gaa"
+#line 72 "cli.gaa"
{ gaaval->x509_crlfile = GAATMP_x509crlfile.arg1 ;};
return GAA_OK;
@@ -1048,7 +1042,7 @@ static 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 72 "cli.gaa"
+#line 69 "cli.gaa"
{ gaaval->x509_cafile = GAATMP_x509cafile.arg1 ;};
return GAA_OK;
@@ -1056,7 +1050,7 @@ static 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 69 "cli.gaa"
+#line 66 "cli.gaa"
{ gaaval->ctype = GAATMP_ctypes.arg1; gaaval->nctype = GAATMP_ctypes.size1 ;};
return GAA_OK;
@@ -1064,7 +1058,7 @@ static 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 65 "cli.gaa"
+#line 62 "cli.gaa"
{ gaaval->kx = GAATMP_kx.arg1; gaaval->nkx = GAATMP_kx.size1 ;};
return GAA_OK;
@@ -1072,7 +1066,7 @@ static 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 61 "cli.gaa"
+#line 58 "cli.gaa"
{ gaaval->macs = GAATMP_macs.arg1; gaaval->nmacs = GAATMP_macs.size1 ;};
return GAA_OK;
@@ -1080,7 +1074,7 @@ static 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 57 "cli.gaa"
+#line 54 "cli.gaa"
{ gaaval->comp = GAATMP_comp.arg1; gaaval->ncomp = GAATMP_comp.size1 ;};
return GAA_OK;
@@ -1088,7 +1082,7 @@ static 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 53 "cli.gaa"
+#line 50 "cli.gaa"
{ gaaval->proto = GAATMP_protocols.arg1; gaaval->nproto = GAATMP_protocols.size1 ;};
return GAA_OK;
@@ -1096,14 +1090,14 @@ static 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 49 "cli.gaa"
+#line 46 "cli.gaa"
{ gaaval->ciphers = GAATMP_ciphers.arg1; gaaval->nciphers = GAATMP_ciphers.size1 ;};
return GAA_OK;
break;
case GAAOPTID_verbose:
OK = 0;
-#line 45 "cli.gaa"
+#line 42 "cli.gaa"
{ gaaval->verbose = 1 ;};
return GAA_OK;
@@ -1113,22 +1107,15 @@ static 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 42 "cli.gaa"
+#line 39 "cli.gaa"
{ gaaval->record_size = GAATMP_recordsize.arg1 ;};
return GAA_OK;
break;
case GAAOPTID_print_cert:
OK = 0;
-#line 39 "cli.gaa"
-{ gaaval->print_cert = 1 ;};
-
- return GAA_OK;
- break;
- case GAAOPTID_xml:
- OK = 0;
#line 36 "cli.gaa"
-{ gaaval->xml = 1 ;};
+{ gaaval->print_cert = 1 ;};
return GAA_OK;
break;
@@ -1188,7 +1175,7 @@ static int gaa_try(int gaa_num, int gaa_index, gaainfo *gaaval, char *opt_list)
GAA_TESTMOREARGS;
GAA_FILL(GAAREST_tmp.arg1, gaa_getstr, GAAREST_tmp.size1);
gaa_index++;
-#line 129 "cli.gaa"
+#line 126 "cli.gaa"
{ gaaval->rest_args = GAAREST_tmp.arg1; ;};
return GAA_OK;
@@ -1217,13 +1204,13 @@ int gaa(int argc, char **argv, gaainfo *gaaval)
if(inited == 0)
{
-#line 131 "cli.gaa"
+#line 128 "cli.gaa"
{ gaaval->resume=0; gaaval->port="443"; gaaval->rest_args=NULL; 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_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->xml = 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;
@@ -1376,7 +1363,7 @@ static int gaa_internal_get_next_str(FILE *file, gaa_str_node *tmp_str, int argc
len++;
a = fgetc( file);
- if(a==EOF) return 0; /* a = ' '; */
+ if(a==EOF) return 0; //a = ' ';
}
len += 1;
diff --git a/src/cli-gaa.h b/src/cli-gaa.h
index 1548cc0ece..87fb4facff 100644
--- a/src/cli-gaa.h
+++ b/src/cli-gaa.h
@@ -8,74 +8,72 @@ typedef struct _gaainfo gaainfo;
struct _gaainfo
{
-#line 128 "cli.gaa"
+#line 125 "cli.gaa"
char *rest_args;
-#line 119 "cli.gaa"
- int insecure;
#line 116 "cli.gaa"
- char *port;
+ int insecure;
#line 113 "cli.gaa"
- char *opaque_prf_input;
+ char *port;
#line 110 "cli.gaa"
- char *authz_saml_assertion;
+ char *opaque_prf_input;
#line 107 "cli.gaa"
- char *authz_x509_attr_cert;
+ char *authz_saml_assertion;
#line 104 "cli.gaa"
- char *psk_key;
+ char *authz_x509_attr_cert;
#line 101 "cli.gaa"
- char *psk_username;
+ char *psk_key;
#line 98 "cli.gaa"
- char *srp_passwd;
+ char *psk_username;
#line 95 "cli.gaa"
- char *srp_username;
+ char *srp_passwd;
#line 92 "cli.gaa"
- char *x509_certfile;
+ char *srp_username;
#line 89 "cli.gaa"
- char *x509_keyfile;
+ char *x509_certfile;
#line 86 "cli.gaa"
- char *pgp_certfile;
+ char *x509_keyfile;
#line 83 "cli.gaa"
- char *pgp_trustdb;
+ char *pgp_certfile;
#line 80 "cli.gaa"
- char *pgp_keyring;
+ char *pgp_trustdb;
#line 77 "cli.gaa"
- char *pgp_keyfile;
+ char *pgp_keyring;
#line 74 "cli.gaa"
- char *x509_crlfile;
+ char *pgp_keyfile;
#line 71 "cli.gaa"
- char *x509_cafile;
+ char *x509_crlfile;
#line 68 "cli.gaa"
+ char *x509_cafile;
+#line 65 "cli.gaa"
char **ctype;
-#line 67 "cli.gaa"
- int nctype;
#line 64 "cli.gaa"
+ int nctype;
+#line 61 "cli.gaa"
char **kx;
-#line 63 "cli.gaa"
- int nkx;
#line 60 "cli.gaa"
+ int nkx;
+#line 57 "cli.gaa"
char **macs;
-#line 59 "cli.gaa"
- int nmacs;
#line 56 "cli.gaa"
+ int nmacs;
+#line 53 "cli.gaa"
char **comp;
-#line 55 "cli.gaa"
- int ncomp;
#line 52 "cli.gaa"
+ int ncomp;
+#line 49 "cli.gaa"
char **proto;
-#line 51 "cli.gaa"
- int nproto;
#line 48 "cli.gaa"
+ int nproto;
+#line 45 "cli.gaa"
char **ciphers;
-#line 47 "cli.gaa"
- int nciphers;
#line 44 "cli.gaa"
- int verbose;
+ int nciphers;
#line 41 "cli.gaa"
- int record_size;
+ int verbose;
#line 38 "cli.gaa"
- int print_cert;
+ int record_size;
#line 35 "cli.gaa"
- int xml;
+ int print_cert;
#line 32 "cli.gaa"
int disable_extensions;
#line 29 "cli.gaa"
diff --git a/src/cli.c b/src/cli.c
index 313bf9e344..b0ce847071 100644
--- a/src/cli.c
+++ b/src/cli.c
@@ -66,7 +66,6 @@ int record_max_size;
int fingerprint;
int crlf;
int verbose = 0;
-extern int xml;
extern int print_cert;
char *srp_passwd = NULL;
@@ -122,18 +121,19 @@ typedef struct
int secure;
char *hostname;
char *ip;
- char* service;
+ char *service;
struct addrinfo *ptr;
struct addrinfo *addr_info;
} socket_st;
-ssize_t socket_recv (const socket_st *socket, void *buffer, int buffer_size);
-ssize_t socket_send (const socket_st *socket, const void *buffer, int buffer_size);
-void socket_open( socket_st* hd, const char* hostname, const char* service);
-void socket_connect( const socket_st* hd);
+ssize_t socket_recv (const socket_st * socket, void *buffer, int buffer_size);
+ssize_t socket_send (const socket_st * socket, const void *buffer,
+ int buffer_size);
+void socket_open (socket_st * hd, const char *hostname, const char *service);
+void socket_connect (const socket_st * hd);
void socket_bye (socket_st * socket);
-static void check_rehandshake (socket_st *socket, int ret);
+static void check_rehandshake (socket_st * socket, int ret);
static int do_handshake (socket_st * socket);
static void init_global_tls_stuff (void);
@@ -386,8 +386,7 @@ cert_callback (gnutls_session_t session,
int
authz_send_callback (gnutls_session_t session,
- const int *client_formats,
- const int *server_formats)
+ const int *client_formats, const int *server_formats)
{
size_t i;
int ret;
@@ -440,9 +439,8 @@ authz_send_callback (gnutls_session_t session,
int
authz_recv_callback (gnutls_session_t session,
const int *authz_formats,
- gnutls_datum_t *infos,
- const int *hashtypes,
- gnutls_datum_t *hash)
+ gnutls_datum_t * infos,
+ const int *hashtypes, gnutls_datum_t * hash)
{
size_t i, j;
@@ -550,7 +548,7 @@ static void gaa_parser (int argc, char **argv);
/* Returns zero if the error code was successfully handled.
*/
static int
-handle_error (socket_st *hd, int err)
+handle_error (socket_st * hd, int err)
{
int alert, ret;
const char *err_type, *str;
@@ -655,8 +653,8 @@ main (int argc, char **argv)
init_global_tls_stuff ();
- socket_open( &hd, hostname, service);
- socket_connect( &hd);
+ socket_open (&hd, hostname, service);
+ socket_connect (&hd);
hd.session = init_tls_session (hostname);
if (starttls)
@@ -713,8 +711,8 @@ main (int argc, char **argv)
printf
("\n\n- Connecting again- trying to resume previous session\n");
- socket_open( &hd, hostname, service);
- socket_connect(&hd);
+ socket_open (&hd, hostname, service);
+ socket_connect (&hd);
}
else
{
@@ -877,7 +875,6 @@ gaa_parser (int argc, char **argv)
verbose = info.verbose;
disable_extensions = info.disable_extensions;
- xml = info.xml;
print_cert = info.print_cert;
starttls = info.starttls;
resume = info.resume;
@@ -937,7 +934,7 @@ cli_version (void)
static void
-check_rehandshake (socket_st *socket, int ret)
+check_rehandshake (socket_st * socket, int ret)
{
if (socket->secure && ret == GNUTLS_E_REHANDSHAKE)
{
@@ -1132,143 +1129,148 @@ init_global_tls_stuff (void)
*/
ssize_t
- socket_recv (const socket_st* socket, void *buffer, int buffer_size)
+socket_recv (const socket_st * socket, void *buffer, int buffer_size)
{
- int ret;
+ int ret;
- if (socket->secure)
- do
- {
- ret = gnutls_record_recv (socket->session, buffer, buffer_size);
- }
+ if (socket->secure)
+ do
+ {
+ ret = gnutls_record_recv (socket->session, buffer, buffer_size);
+ }
while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN);
- else
- do
- {
- ret = recv (socket->fd, buffer, buffer_size, 0);
- }
+ else
+ do
+ {
+ ret = recv (socket->fd, buffer, buffer_size, 0);
+ }
while (ret == -1 && errno == EINTR);
- return ret;
+ return ret;
}
ssize_t
- socket_send (const socket_st *socket, const void *buffer, int buffer_size)
+socket_send (const socket_st * socket, const void *buffer, int buffer_size)
{
- int ret;
+ int ret;
- if (socket->secure)
- do
- {
- ret = gnutls_record_send (socket->session, buffer, buffer_size);
- }
+ if (socket->secure)
+ do
+ {
+ ret = gnutls_record_send (socket->session, buffer, buffer_size);
+ }
while (ret == GNUTLS_E_AGAIN || ret == GNUTLS_E_INTERRUPTED);
- else
- do
- {
- ret = send (socket->fd, buffer, buffer_size, 0);
- }
+ else
+ do
+ {
+ ret = send (socket->fd, buffer, buffer_size, 0);
+ }
while (ret == -1 && errno == EINTR);
- if (ret > 0 && ret != buffer_size && verbose)
- fprintf (stderr,
- "*** Only sent %d bytes instead of %d.\n", ret, buffer_size);
+ if (ret > 0 && ret != buffer_size && verbose)
+ fprintf (stderr,
+ "*** Only sent %d bytes instead of %d.\n", ret, buffer_size);
- return ret;
+ return ret;
}
void
- socket_bye (socket_st * socket)
+socket_bye (socket_st * socket)
{
- int ret;
- if (socket->secure)
+ int ret;
+ if (socket->secure)
{
- do
- ret = gnutls_bye (socket->session, GNUTLS_SHUT_RDWR);
- while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN);
- if (ret < 0)
- fprintf (stderr, "*** gnutls_bye() error: %s\n",
- gnutls_strerror (ret));
- gnutls_deinit (socket->session);
- socket->session = NULL;
+ do
+ ret = gnutls_bye (socket->session, GNUTLS_SHUT_RDWR);
+ while (ret == GNUTLS_E_INTERRUPTED || ret == GNUTLS_E_AGAIN);
+ if (ret < 0)
+ fprintf (stderr, "*** gnutls_bye() error: %s\n",
+ gnutls_strerror (ret));
+ gnutls_deinit (socket->session);
+ socket->session = NULL;
}
- freeaddrinfo( socket->addr_info);
- socket->addr_info = socket->ptr = NULL;
-
- free( socket->ip);
- free( socket->hostname);
- free( socket->service);
-
- shutdown (socket->fd, SHUT_RDWR); /* no more receptions */
- close (socket->fd);
-
- socket->fd = -1;
- socket->secure = 0;
+ freeaddrinfo (socket->addr_info);
+ socket->addr_info = socket->ptr = NULL;
+
+ free (socket->ip);
+ free (socket->hostname);
+ free (socket->service);
+
+ shutdown (socket->fd, SHUT_RDWR); /* no more receptions */
+ close (socket->fd);
+
+ socket->fd = -1;
+ socket->secure = 0;
}
-void socket_connect( const socket_st* hd)
+void
+socket_connect (const socket_st * hd)
{
- int err;
+ int err;
- printf ("Connecting to '%s:%s'...\n", hd->ip, hd->service);
+ printf ("Connecting to '%s:%s'...\n", hd->ip, hd->service);
- err = connect (hd->fd, hd->ptr->ai_addr, hd->ptr->ai_addrlen);
- if (err < 0)
+ err = connect (hd->fd, hd->ptr->ai_addr, hd->ptr->ai_addrlen);
+ if (err < 0)
{
- fprintf (stderr, "Cannot connect to %s:%s: %s\n", hd->hostname, hd->service,
- strerror (errno));
- exit (1);
+ fprintf (stderr, "Cannot connect to %s:%s: %s\n", hd->hostname,
+ hd->service, strerror (errno));
+ exit (1);
}
}
-void socket_open( socket_st* hd, const char* hostname, const char* service)
+void
+socket_open (socket_st * hd, const char *hostname, const char *service)
{
- struct addrinfo hints, *res, *ptr;
- int sd, err;
- char buffer[MAX_BUF + 1];
- char portname[16] = { 0 };
-
- printf ("Resolving '%s'...\n", hostname);
- /* get server name */
- memset (&hints, 0, sizeof (hints));
- hints.ai_socktype = SOCK_STREAM;
- if ((err = getaddrinfo (hostname, service, &hints, &res)))
+ struct addrinfo hints, *res, *ptr;
+ int sd, err;
+ char buffer[MAX_BUF + 1];
+ char portname[16] = { 0 };
+
+ printf ("Resolving '%s'...\n", hostname);
+ /* get server name */
+ memset (&hints, 0, sizeof (hints));
+ hints.ai_socktype = SOCK_STREAM;
+ if ((err = getaddrinfo (hostname, service, &hints, &res)))
{
- fprintf (stderr, "Cannot resolve %s:%s: %s\n", hostname, service,
- gai_strerror (err));
- exit (1);
+ fprintf (stderr, "Cannot resolve %s:%s: %s\n", hostname, service,
+ gai_strerror (err));
+ exit (1);
}
- sd = -1;
- for (ptr = res; ptr != NULL; ptr = ptr->ai_next)
+ sd = -1;
+ for (ptr = res; ptr != NULL; ptr = ptr->ai_next)
{
- sd = socket (ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
- if (sd == -1) continue;
-
- if ((err = getnameinfo (ptr->ai_addr, ptr->ai_addrlen, buffer, MAX_BUF,
- portname, sizeof (portname), NI_NUMERICHOST|NI_NUMERICSERV)) != 0)
- {
- fprintf (stderr, "getnameinfo(): %s\n", gai_strerror (err));
- freeaddrinfo (res);
- exit (1);
- }
-
- break;
+ sd = socket (ptr->ai_family, ptr->ai_socktype, ptr->ai_protocol);
+ if (sd == -1)
+ continue;
+
+ if ((err = getnameinfo (ptr->ai_addr, ptr->ai_addrlen, buffer, MAX_BUF,
+ portname, sizeof (portname),
+ NI_NUMERICHOST | NI_NUMERICSERV)) != 0)
+ {
+ fprintf (stderr, "getnameinfo(): %s\n", gai_strerror (err));
+ freeaddrinfo (res);
+ exit (1);
+ }
+
+ break;
}
- if (sd==-1) {
- fprintf (stderr, "socket(): %s\n", strerror (errno));
- exit (1);
+ if (sd == -1)
+ {
+ fprintf (stderr, "socket(): %s\n", strerror (errno));
+ exit (1);
}
-
- hd->secure = 0;
- hd->fd = sd;
- hd->hostname = strdup(hostname);
- hd->ip = strdup(buffer);
- hd->service = strdup(portname);
- hd->ptr = ptr;
- hd->addr_info = res;
-
- return;
+
+ hd->secure = 0;
+ hd->fd = sd;
+ hd->hostname = strdup (hostname);
+ hd->ip = strdup (buffer);
+ hd->service = strdup (portname);
+ hd->ptr = ptr;
+ hd->addr_info = res;
+
+ return;
}
diff --git a/src/cli.gaa b/src/cli.gaa
index 560cab21fc..e22863e60c 100644
--- a/src/cli.gaa
+++ b/src/cli.gaa
@@ -32,9 +32,6 @@ option (f, fingerprint) { $fingerprint = 1 } "Send the openpgp fingerprint, inst
#int disable_extensions;
option ( disable-extensions) { $disable_extensions = 1 } "Disable all the TLS extensions."
-#int xml;
-option (xml) { $xml = 1 } "Print the certificate information in XML format."
-
#int print_cert;
option (print-cert) { $print_cert = 1 } "Print the certificate in PEM format."
@@ -133,7 +130,7 @@ init { $resume=0; $port="443"; $rest_args=NULL; $ciphers=NULL;
$nkx=0; $ncomp=0; $nmacs=0; $nctype = 0; $record_size=0;
$fingerprint=0; $pgp_trustdb=NULL; $pgp_keyring=NULL; $x509_crlfile = NULL;
$x509_cafile = NULL; $pgp_keyfile=NULL; $pgp_certfile=NULL; $disable_extensions = 0;
- $x509_keyfile=NULL; $x509_certfile=NULL; $crlf = 0; $xml = 0;
+ $x509_keyfile=NULL; $x509_certfile=NULL; $crlf = 0;
$srp_username=NULL; $srp_passwd=NULL; $fmtder = 0; $starttls =0;
$debug = 0; $print_cert = 0; $verbose = 0; $psk_key = NULL;
$psk_username = NULL;
diff --git a/src/common.c b/src/common.c
index 3ec841d270..961c229374 100644
--- a/src/common.c
+++ b/src/common.c
@@ -34,7 +34,6 @@
#define SU(x) (x!=NULL?x:"Unknown")
-int xml = 0;
int print_cert;
extern int verbose;
@@ -88,7 +87,7 @@ print_x509_info (gnutls_session_t session, const char *hostname)
{
gnutls_x509_crt_t crt;
const gnutls_datum_t *cert_list;
- size_t cert_list_size = 0;
+ unsigned int cert_list_size = 0;
int ret;
char digest[20];
char serial[40];
@@ -165,132 +164,111 @@ print_x509_info (gnutls_session_t session, const char *hostname)
}
- if (xml)
- {
-#ifdef ENABLE_PKI
- gnutls_datum_t xml_data;
+ expiret = gnutls_x509_crt_get_expiration_time (crt);
+ activet = gnutls_x509_crt_get_activation_time (crt);
- ret = gnutls_x509_crt_to_xml (crt, &xml_data, 0);
- if (ret < 0)
- {
- fprintf (stderr, "XML encoding error: %s\n",
- gnutls_strerror (ret));
- return;
- }
+ printf (" # valid since: %s", my_ctime (&activet));
+ printf (" # expires at: %s", my_ctime (&expiret));
- printf ("%s", xml_data.data);
- gnutls_free (xml_data.data);
-#endif
+
+ /* Print the serial number of the certificate.
+ */
+ if (verbose
+ && gnutls_x509_crt_get_serial (crt, serial, &serial_size) >= 0)
+ {
+ print = raw_to_string (serial, serial_size);
+ if (print != NULL)
+ printf (" # serial number: %s\n", print);
+ }
+
+ /* Print the fingerprint of the certificate
+ */
+ digest_size = sizeof (digest);
+ if ((ret =
+ gnutls_x509_crt_get_fingerprint (crt,
+ GNUTLS_DIG_MD5,
+ digest, &digest_size)) < 0)
+ {
+ fprintf (stderr,
+ "Error in fingerprint calculation: %s\n",
+ gnutls_strerror (ret));
}
else
{
+ print = raw_to_string (digest, digest_size);
+ if (print != NULL)
+ printf (" # fingerprint: %s\n", print);
+ }
- expiret = gnutls_x509_crt_get_expiration_time (crt);
- activet = gnutls_x509_crt_get_activation_time (crt);
-
- printf (" # valid since: %s", my_ctime (&activet));
- printf (" # expires at: %s", my_ctime (&expiret));
-
+ /* Print the version of the X.509
+ * certificate.
+ */
+ if (verbose)
+ {
+ printf (" # version: #%d\n", gnutls_x509_crt_get_version (crt));
- /* Print the serial number of the certificate.
- */
- if (verbose
- && gnutls_x509_crt_get_serial (crt, serial, &serial_size) >= 0)
- {
- print = raw_to_string (serial, serial_size);
- if (print != NULL)
- printf (" # serial number: %s\n", print);
- }
+ bits = 0;
+ algo = gnutls_x509_crt_get_pk_algorithm (crt, &bits);
+ printf (" # public key algorithm: ");
- /* Print the fingerprint of the certificate
- */
- digest_size = sizeof (digest);
- if ((ret =
- gnutls_x509_crt_get_fingerprint (crt,
- GNUTLS_DIG_MD5,
- digest, &digest_size)) < 0)
- {
- fprintf (stderr,
- "Error in fingerprint calculation: %s\n",
- gnutls_strerror (ret));
- }
- else
- {
- print = raw_to_string (digest, digest_size);
- if (print != NULL)
- printf (" # fingerprint: %s\n", print);
- }
+ cstr = SU (gnutls_pk_algorithm_get_name (algo));
+ printf ("%s (%d bits)\n", cstr, bits);
- /* Print the version of the X.509
- * certificate.
- */
- if (verbose)
+#ifdef ENABLE_PKI
+ if (algo == GNUTLS_PK_RSA)
{
- printf (" # version: #%d\n", gnutls_x509_crt_get_version (crt));
-
- bits = 0;
- algo = gnutls_x509_crt_get_pk_algorithm (crt, &bits);
- printf (" # public key algorithm: ");
-
- cstr = SU (gnutls_pk_algorithm_get_name (algo));
- printf ("%s (%d bits)\n", cstr, bits);
+ gnutls_datum_t e, m;
-#ifdef ENABLE_PKI
- if (algo == GNUTLS_PK_RSA)
+ ret = gnutls_x509_crt_get_pk_rsa_raw (crt, &m, &e);
+ if (ret >= 0)
{
- gnutls_datum_t e, m;
-
- ret = gnutls_x509_crt_get_pk_rsa_raw (crt, &m, &e);
- if (ret >= 0)
- {
- print = SU (raw_to_string (e.data, e.size));
- printf (" # e [%d bits]: %s\n", e.size * 8, print);
+ print = SU (raw_to_string (e.data, e.size));
+ printf (" # e [%d bits]: %s\n", e.size * 8, print);
- print = SU (raw_to_string (m.data, m.size));
- printf (" # m [%d bits]: %s\n", m.size * 8, print);
+ print = SU (raw_to_string (m.data, m.size));
+ printf (" # m [%d bits]: %s\n", m.size * 8, print);
- gnutls_free (e.data);
- gnutls_free (m.data);
- }
+ gnutls_free (e.data);
+ gnutls_free (m.data);
}
- else if (algo == GNUTLS_PK_DSA)
- {
- gnutls_datum_t p, q, g, y;
+ }
+ else if (algo == GNUTLS_PK_DSA)
+ {
+ gnutls_datum_t p, q, g, y;
- ret = gnutls_x509_crt_get_pk_dsa_raw (crt, &p, &q, &g, &y);
- if (ret >= 0)
- {
- print = SU (raw_to_string (p.data, p.size));
- printf (" # p [%d bits]: %s\n", p.size * 8, print);
+ ret = gnutls_x509_crt_get_pk_dsa_raw (crt, &p, &q, &g, &y);
+ if (ret >= 0)
+ {
+ print = SU (raw_to_string (p.data, p.size));
+ printf (" # p [%d bits]: %s\n", p.size * 8, print);
- print = SU (raw_to_string (q.data, q.size));
- printf (" # q [%d bits]: %s\n", q.size * 8, print);
+ print = SU (raw_to_string (q.data, q.size));
+ printf (" # q [%d bits]: %s\n", q.size * 8, print);
- print = SU (raw_to_string (g.data, g.size));
- printf (" # g [%d bits]: %s\n", g.size * 8, print);
+ print = SU (raw_to_string (g.data, g.size));
+ printf (" # g [%d bits]: %s\n", g.size * 8, print);
- print = SU (raw_to_string (y.data, y.size));
- printf (" # y [%d bits]: %s\n", y.size * 8, print);
+ print = SU (raw_to_string (y.data, y.size));
+ printf (" # y [%d bits]: %s\n", y.size * 8, print);
- gnutls_free (p.data);
- gnutls_free (q.data);
- gnutls_free (g.data);
- gnutls_free (y.data);
- }
+ gnutls_free (p.data);
+ gnutls_free (q.data);
+ gnutls_free (g.data);
+ gnutls_free (y.data);
}
-#endif
}
+#endif
+ }
- dn_size = sizeof (dn);
- ret = gnutls_x509_crt_get_dn (crt, dn, &dn_size);
- if (ret >= 0)
- printf (" # Subject's DN: %s\n", dn);
+ dn_size = sizeof (dn);
+ ret = gnutls_x509_crt_get_dn (crt, dn, &dn_size);
+ if (ret >= 0)
+ printf (" # Subject's DN: %s\n", dn);
- dn_size = sizeof (dn);
- ret = gnutls_x509_crt_get_issuer_dn (crt, dn, &dn_size);
- if (ret >= 0)
- printf (" # Issuer's DN: %s\n", dn);
- }
+ dn_size = sizeof (dn);
+ ret = gnutls_x509_crt_get_issuer_dn (crt, dn, &dn_size);
+ if (ret >= 0)
+ printf (" # Issuer's DN: %s\n", dn);
gnutls_x509_crt_deinit (crt);
@@ -372,24 +350,6 @@ print_openpgp_info (gnutls_session_t session, const char *hostname)
}
}
- if (xml)
- {
- gnutls_datum_t xml_data;
-
- ret = gnutls_openpgp_key_to_xml (crt, &xml_data, 0);
- if (ret < 0)
- {
- fprintf (stderr, "XML encoding error: %s\n",
- gnutls_strerror (ret));
- return;
- }
-
- printf ("%s", xml_data.data);
- gnutls_free (xml_data.data);
-
- return;
- }
-
activet = gnutls_openpgp_key_get_creation_time (crt);
expiret = gnutls_openpgp_key_get_expiration_time (crt);
@@ -576,8 +536,8 @@ void
print_cert_info (gnutls_session_t session, const char *hostname)
{
- if (gnutls_certificate_client_get_request_status( session) != 0)
- printf("- Server has requested a certificate.\n");
+ if (gnutls_certificate_client_get_request_status (session) != 0)
+ printf ("- Server has requested a certificate.\n");
printf ("- Certificate type: ");
switch (gnutls_certificate_type_get (session))
@@ -618,19 +578,18 @@ print_list (int verbose)
if (verbose)
printf ("\tKey exchange: %s\n\tCipher: %s\n\tMAC: %s\n\n",
gnutls_kx_get_name (kx),
- gnutls_cipher_get_name (cipher),
- gnutls_mac_get_name (mac));
+ gnutls_cipher_get_name (cipher), gnutls_mac_get_name (mac));
}
}
{
- const gnutls_certificate_type_t *p = gnutls_certificate_type_list();
+ const gnutls_certificate_type_t *p = gnutls_certificate_type_list ();
printf ("Certificate types: ");
for (; *p; p++)
{
printf ("%s", gnutls_certificate_type_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");
@@ -638,13 +597,13 @@ print_list (int verbose)
}
{
- const gnutls_protocol_t *p = gnutls_protocol_list();
+ const gnutls_protocol_t *p = gnutls_protocol_list ();
printf ("Protocols: ");
for (; *p; p++)
{
printf ("%s", gnutls_protocol_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");
@@ -652,13 +611,13 @@ print_list (int verbose)
}
{
- const gnutls_cipher_algorithm_t *p = gnutls_cipher_list();
+ const gnutls_cipher_algorithm_t *p = gnutls_cipher_list ();
printf ("Ciphers: ");
for (; *p; p++)
{
printf ("%s", gnutls_cipher_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");
@@ -666,13 +625,13 @@ print_list (int verbose)
}
{
- const gnutls_mac_algorithm_t *p = gnutls_mac_list();
+ const gnutls_mac_algorithm_t *p = gnutls_mac_list ();
printf ("MACs: ");
for (; *p; p++)
{
printf ("%s", gnutls_mac_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");
@@ -680,13 +639,13 @@ print_list (int verbose)
}
{
- const gnutls_kx_algorithm_t *p = gnutls_kx_list();
+ const gnutls_kx_algorithm_t *p = gnutls_kx_list ();
printf ("Key exchange algorithms: ");
for (; *p; p++)
{
printf ("%s", gnutls_kx_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");
@@ -694,13 +653,13 @@ print_list (int verbose)
}
{
- const gnutls_compression_method_t *p = gnutls_compression_list();
+ const gnutls_compression_method_t *p = gnutls_compression_list ();
printf ("Compression: ");
for (; *p; p++)
{
printf ("%s", gnutls_compression_get_name (*p));
- if (*(p+1))
+ if (*(p + 1))
printf (", ");
else
printf ("\n");