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/apps.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/apps.c')
-rw-r--r-- | apps/apps.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/apps/apps.c b/apps/apps.c index 216bc797df..c66b89cff4 100644 --- a/apps/apps.c +++ b/apps/apps.c @@ -149,20 +149,30 @@ int ctx_set_ctlog_list_file(SSL_CTX *ctx, const char *path) #endif -int dump_cert_text(BIO *out, X509 *x) +static unsigned long nmflag = 0; +static char nmflag_set = 0; + +int set_nameopt(const char *arg) { - char *p; + int ret = set_name_ex(&nmflag, arg); + + if (ret) + nmflag_set = 1; + + return ret; +} - p = X509_NAME_oneline(X509_get_subject_name(x), NULL, 0); - BIO_puts(out, "subject="); - BIO_puts(out, p); - OPENSSL_free(p); +unsigned long get_nameopt(void) +{ + return (nmflag_set) ? nmflag : XN_FLAG_ONELINE; +} - p = X509_NAME_oneline(X509_get_issuer_name(x), NULL, 0); - BIO_puts(out, "\nissuer="); - BIO_puts(out, p); +int dump_cert_text(BIO *out, X509 *x) +{ + print_name(out, "subject=", X509_get_subject_name(x), get_nameopt()); + BIO_puts(out, "\n"); + print_name(out, "issuer=", X509_get_issuer_name(x), get_nameopt()); BIO_puts(out, "\n"); - OPENSSL_free(p); return 0; } |