diff options
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; } |