diff options
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r-- | ssl/ssl_lib.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c index afe7162ab7..841d75d585 100644 --- a/ssl/ssl_lib.c +++ b/ssl/ssl_lib.c @@ -58,7 +58,7 @@ * [including the GNU Public Licence.] */ /* ==================================================================== - * Copyright (c) 1998-2001 The OpenSSL Project. All rights reserved. + * Copyright (c) 1998-2006 The OpenSSL Project. All rights reserved. * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -1315,27 +1315,30 @@ err: return(NULL); } + #ifndef OPENSSL_TLSEXT -/** return a servername extension value if provided in CLIENT HELLO - * or NULL. - * For the moment, only hostname types are supported. +/** return a servername extension value if provided in Client Hello, or NULL. + * So far, only host_name types are defined (RFC 3546). */ -const char *SSL_get_servername(const SSL *s, const int type) { - - if (type != TLSEXT_TYPE_SERVER_host) +const char *SSL_get_servername(const SSL *s, const int type) + { + if (type != TLSEXT_NAMETYPE_host_name) return NULL; - return s->session /*&&s->session->tlsext_hostname*/?s->session->tlsext_hostname:s->tlsext_hostname; -} - -int SSL_get_servername_type(const SSL *s) { + /* XXX cf. SSL_CTRL_GET_TLSEXT_HOSTNAME case in ssl3_ctrl (s3_lib.c) */ + return s->session /*&&s->session->tlsext_hostname*/ ? + s->session->tlsext_hostname : + s->tlsext_hostname; + } - if (s->session &&s->session->tlsext_hostname ?s->session->tlsext_hostname:s->tlsext_hostname) - return TLSEXT_TYPE_SERVER_host; +int SSL_get_servername_type(const SSL *s) + { + if (s->session &&s->session->tlsext_hostname ? s->session->tlsext_hostname : s->tlsext_hostname) + return TLSEXT_NAMETYPE_host_name; return -1; -} - + } #endif + unsigned long SSL_SESSION_hash(const SSL_SESSION *a) { unsigned long l; @@ -1488,7 +1491,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth) ret->max_send_fragment = SSL3_RT_MAX_PLAIN_LENGTH; #ifndef OPENSSL_NO_TLSEXT - ret->tlsext_servername_callback = NULL; + ret->tlsext_servername_callback = 0; ret->tlsext_servername_arg = NULL; #endif return(ret); @@ -2442,7 +2445,6 @@ SSL_CTX *SSL_get_SSL_CTX(const SSL *ssl) SSL_CTX *SSL_set_SSL_CTX(SSL *ssl, SSL_CTX* ctx) { - if (ssl->cert != NULL) ssl_cert_free(ssl->cert); ssl->cert = ssl_cert_dup(ctx->cert); |