X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=apps%2Fs_server.c;h=8883994f8f7622d114f66d40416b5749cb0f07dd;hp=961c738a15178a43f9cc98975a3e9ef51809987a;hb=0d68367a1279a369146661f4857816b2044116b4;hpb=3ee1eac27a2e3120fbdc60e12db091c082b8de21 diff --git a/apps/s_server.c b/apps/s_server.c index 961c738a15..8883994f8f 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -67,7 +67,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context); static void close_accept_socket(void); static int init_ssl_connection(SSL *s); static void print_stats(BIO *bp, SSL_CTX *ctx); -static int generate_session_id(const SSL *ssl, unsigned char *id, +static int generate_session_id(SSL *ssl, unsigned char *id, unsigned int *id_len); static void init_session_cache_ctx(SSL_CTX *sctx); static void free_sessions(void); @@ -459,9 +459,17 @@ static int ssl_servername_cb(SSL *s, int *ad, void *arg) { tlsextctx *p = (tlsextctx *) arg; const char *servername = SSL_get_servername(s, TLSEXT_NAMETYPE_host_name); - if (servername != NULL && p->biodebug != NULL) - BIO_printf(p->biodebug, "Hostname in TLS extension: \"%s\"\n", - servername); + + if (servername != NULL && p->biodebug != NULL) { + const char *cp = servername; + unsigned char uc; + + BIO_printf(p->biodebug, "Hostname in TLS extension: \""); + while ((uc = *cp++) != 0) + BIO_printf(p->biodebug, + isascii(uc) && isprint(uc) ? "%c" : "\\x%02x", uc); + BIO_printf(p->biodebug, "\"\n"); + } if (p->servername == NULL) return SSL_TLSEXT_ERR_NOACK; @@ -3113,9 +3121,10 @@ static int www_body(int s, int stype, int prot, unsigned char *context) PEM_write_bio_X509(io, peer); X509_free(peer); peer = NULL; - } else + } else { BIO_puts(io, "no client certificate available\n"); - BIO_puts(io, "\r\n\r\n"); + } + BIO_puts(io, "\r\n\r\n"); break; } else if ((www == 2 || www == 3) && (strncmp("GET /", buf, 5) == 0)) { @@ -3412,7 +3421,7 @@ static int rev_body(int s, int stype, int prot, unsigned char *context) } #define MAX_SESSION_ID_ATTEMPTS 10 -static int generate_session_id(const SSL *ssl, unsigned char *id, +static int generate_session_id(SSL *ssl, unsigned char *id, unsigned int *id_len) { unsigned int count = 0;