diff options
author | Dr. Stephen Henson <steve@openssl.org> | 2017-03-31 17:04:28 +0100 |
---|---|---|
committer | Dr. Stephen Henson <steve@openssl.org> | 2017-04-03 23:47:22 +0100 |
commit | 5969a2dd2cce3ee4f35cc256256d9c8119080e98 (patch) | |
tree | 94d7f3aadeabc1567bcd3663c2629d1d134cbd88 /apps/s_client.c | |
parent | 9784ec04745a8c8ecbf5610c0a2f5540e1e0f2cd (diff) |
Print CA names in s_server, add -requestCAfile to s_client
Reviewed-by: Rich Salz <rsalz@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3015)
Diffstat (limited to 'apps/s_client.c')
-rw-r--r-- | apps/s_client.c | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/apps/s_client.c b/apps/s_client.c index 8e1a5dda0c..9267393582 100644 --- a/apps/s_client.c +++ b/apps/s_client.c @@ -588,7 +588,7 @@ const OPTIONS s_client_options[] = { {"no-CApath", OPT_NOCAPATH, '-', "Do not load certificates from the default certificates directory"}, {"requestCAfile", OPT_REQCAFILE, '<', - "PEM format file of CA names sent to server"}, + "PEM format file of CA names to send to the server"}, {"dane_tlsa_domain", OPT_DANE_TLSA_DOMAIN, 's', "DANE TLSA base domain"}, {"dane_tlsa_rrdata", OPT_DANE_TLSA_RRDATA, 's', "DANE TLSA rrdata presentation form"}, @@ -1585,6 +1585,7 @@ int s_client_main(int argc, char **argv) } if (ReqCAfile != NULL) { STACK_OF(X509_NAME) *nm = sk_X509_NAME_new_null(); + if (nm == NULL || !SSL_add_file_cert_subjects_to_stack(nm, ReqCAfile)) { sk_X509_NAME_pop_free(nm, X509_NAME_free); BIO_printf(bio_err, "Error loading CA names\n"); @@ -2820,9 +2821,7 @@ static void print_stuff(BIO *bio, SSL *s, int full) X509 *peer = NULL; char buf[BUFSIZ]; STACK_OF(X509) *sk; - STACK_OF(X509_NAME) *sk2; const SSL_CIPHER *c; - X509_NAME *xn; int i; #ifndef OPENSSL_NO_COMP const COMP_METHOD *comp, *expansion; @@ -2864,21 +2863,10 @@ static void print_stuff(BIO *bio, SSL *s, int full) BIO_printf(bio, "subject=%s\n", buf); X509_NAME_oneline(X509_get_issuer_name(peer), buf, sizeof buf); BIO_printf(bio, "issuer=%s\n", buf); - } else - BIO_printf(bio, "no peer certificate available\n"); - - sk2 = SSL_get_client_CA_list(s); - if ((sk2 != NULL) && (sk_X509_NAME_num(sk2) > 0)) { - BIO_printf(bio, "---\nAcceptable client certificate CA names\n"); - for (i = 0; i < sk_X509_NAME_num(sk2); i++) { - xn = sk_X509_NAME_value(sk2, i); - X509_NAME_oneline(xn, buf, sizeof(buf)); - BIO_write(bio, buf, strlen(buf)); - BIO_write(bio, "\n", 1); - } } else { - BIO_printf(bio, "---\nNo client certificate CA names sent\n"); + BIO_printf(bio, "no peer certificate available\n"); } + print_ca_names(bio, s); ssl_print_sigalgs(bio, s); ssl_print_tmp_key(bio, s); |