X-Git-Url: http://git.indexdata.com/?p=yaz-moved-to-github.git;a=blobdiff_plain;f=client%2Fclient.c;h=cacc274162d5bea10913edd4a88dc2f9affe0b9c;hp=7dd97d9053b49f285841b78506eaac9f27223b77;hb=8dc67a9430644549801c18ec7e3a725e5a4ef782;hpb=a1d6c3e37313363550600ebcf45ec41ff9f1410b diff --git a/client/client.c b/client/client.c index 7dd97d9..cacc274 100644 --- a/client/client.c +++ b/client/client.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2004, Index Data * See the file LICENSE for details. * - * $Id: client.c,v 1.236 2004-03-17 10:59:41 adam Exp $ + * $Id: client.c,v 1.239 2004-04-28 12:10:51 adam Exp $ */ #include @@ -16,6 +16,14 @@ #include #endif +#if HAVE_OPENSSL_SSL_H +#include +#include +#include +#include +#include +#endif + #include #include @@ -529,6 +537,9 @@ int session_connect(const char *arg) void *add; char type_and_host[101]; const char *basep = 0; +#if HAVE_OPENSSL_SSL_H + SSL *ssl; +#endif if (conn) { cs_close (conn); @@ -586,6 +597,31 @@ int session_connect(const char *arg) return 0; } printf("OK.\n"); +#if HAVE_OPENSSL_SSL_H + if ((ssl = (SSL *) cs_get_ssl(conn))) + { + X509 *server_cert = SSL_get_peer_certificate (ssl); + char *str; + if (server_cert) + { + printf ("Server certificate:\n"); + + str = X509_NAME_oneline (X509_get_subject_name (server_cert),0,0); + if (str) + { + printf ("\t subject: %s\n", str); + free (str); + } + str = X509_NAME_oneline (X509_get_issuer_name (server_cert),0,0); + if (str) + { + printf ("\t issuer: %s\n", str); + free (str); + } + X509_free (server_cert); + } + } +#endif if (basep && *basep) set_base (basep); if (protocol == PROTO_Z3950) @@ -741,16 +777,16 @@ static void display_record(Z_External *r) } } } - if (ent && ent->oclass != CLASS_RECSYN) - return; if (ent && ent->value == VAL_SOIF) print_record((const unsigned char *) r->u.octet_aligned->buf, r->u.octet_aligned->len); else if (r->which == Z_External_octet) { const char *octet_buf = (char*)r->u.octet_aligned->buf; - if (ent->value == VAL_TEXT_XML || ent->value == VAL_APPLICATION_XML || - ent->value == VAL_HTML) + if (ent->oclass == CLASS_RECSYN && + (ent->value == VAL_TEXT_XML || + ent->value == VAL_APPLICATION_XML || + ent->value == VAL_HTML)) { print_record((const unsigned char *) octet_buf, r->u.octet_aligned->len);