diff options
author | Dmitry Belyavskiy <beldmit@gmail.com> | 2017-04-25 12:25:42 -0400 |
---|---|---|
committer | Rich Salz <rsalz@openssl.org> | 2017-04-25 12:37:17 -0400 |
commit | b5c4209be9162d4ceafb9aef833ca94ffa1cc5c9 (patch) | |
tree | 02dcc8e0d8a5368b0c7aa6780f7998c1d45f5f7d /apps/s_cb.c | |
parent | 645c694d85c8f48c74e7db8730ead874656c781e (diff) |
Switch command-line utils to new nameopt API.
The CA names should be printed according to user's decision
print_name instead of set of BIO_printf
dump_cert_text instead of set of BIO_printf
Testing cyrillic output of X509_CRL_print_ex
Write and use X509_CRL_print_ex
Reduce usage of X509_NAME_online
Using X509_REQ_print_ex instead of X509_REQ_print
Fix nameopt processing.
Make dump_cert_text nameopt-friendly
Move nameopt getter/setter to apps/apps.c
Reviewed-by: Rich Salz <rsalz@openssl.org>
Reviewed-by: Richard Levitte <levitte@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/3262)
Diffstat (limited to 'apps/s_cb.c')
-rw-r--r-- | apps/s_cb.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c index 1b68164485..edbc2b85c2 100644 --- a/apps/s_cb.c +++ b/apps/s_cb.c @@ -33,12 +33,6 @@ static unsigned char cookie_secret[COOKIE_SECRET_LENGTH]; static int cookie_initialized = 0; #endif static BIO *bio_keylog = NULL; -static unsigned long nmflag = XN_FLAG_ONELINE; - -int set_nameopt(const char *arg) -{ - return set_name_ex(&nmflag, arg); -} static const char *lookup(int val, const STRINT_PAIR* list, const char* def) { @@ -62,7 +56,7 @@ int verify_callback(int ok, X509_STORE_CTX *ctx) if (err_cert) { X509_NAME_print_ex(bio_err, X509_get_subject_name(err_cert), - 0, nmflag); + 0, get_nameopt()); BIO_puts(bio_err, "\n"); } else BIO_puts(bio_err, "<no cert>\n"); @@ -83,7 +77,7 @@ int verify_callback(int ok, X509_STORE_CTX *ctx) case X509_V_ERR_UNABLE_TO_GET_ISSUER_CERT: BIO_puts(bio_err, "issuer= "); X509_NAME_print_ex(bio_err, X509_get_issuer_name(err_cert), - 0, nmflag); + 0, get_nameopt()); BIO_puts(bio_err, "\n"); break; case X509_V_ERR_CERT_NOT_YET_VALID: @@ -836,7 +830,7 @@ static int set_cert_cb(SSL *ssl, void *arg) rv = SSL_check_chain(ssl, exc->cert, exc->key, exc->chain); BIO_printf(bio_err, "Checking cert chain %d:\nSubject: ", i); X509_NAME_print_ex(bio_err, X509_get_subject_name(exc->cert), 0, - nmflag); + get_nameopt()); BIO_puts(bio_err, "\n"); print_chain_flags(ssl, rv); if (rv & CERT_PKEY_VALID) { @@ -1125,7 +1119,7 @@ void print_ssl_summary(SSL *s) BIO_puts(bio_err, "Peer certificate: "); X509_NAME_print_ex(bio_err, X509_get_subject_name(peer), - 0, nmflag); + 0, get_nameopt()); BIO_puts(bio_err, "\n"); if (SSL_get_peer_signature_nid(s, &nid)) BIO_printf(bio_err, "Hash used: %s\n", OBJ_nid2sn(nid)); @@ -1440,7 +1434,7 @@ void print_ca_names(BIO *bio, SSL *s) BIO_printf(bio, "---\nAcceptable %s certificate CA names\n",cs); for (i = 0; i < sk_X509_NAME_num(sk); i++) { - X509_NAME_print_ex(bio, sk_X509_NAME_value(sk, i), 0, XN_FLAG_ONELINE); + X509_NAME_print_ex(bio, sk_X509_NAME_value(sk, i), 0, get_nameopt()); BIO_write(bio, "\n", 1); } } |