]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Fixed a bug where 'server name' extension was always sent.
authorNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 Feb 2004 21:04:48 +0000 (21:04 +0000)
committerNikos Mavrogiannopoulos <nmav@gnutls.org>
Tue, 10 Feb 2004 21:04:48 +0000 (21:04 +0000)
NEWS
doc/tex/compression.tex
lib/ext_server_name.c
lib/gnutls.h.in.in
lib/gnutls_extensions.c
src/cli.c
src/common.c

diff --git a/NEWS b/NEWS
index acc241ea279cb7dac51f2022175af77f0f161d61..3a012da9431b0023d944e0b844368d8cf8949177 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -1,5 +1,6 @@
 Version 1.1.6
 - Several bug fixes, by Arne Thomassen.
+- Fixed a bug where 'server name' extension was always sent.
 
 Version 1.1.5 (06/01/2004)
 - Added the gnutls_sign_algorithm type.
index 6c16e4d9d6e6b9351155da0ae104dd387e48d780..cd057e027d305d82206f42c16bfa86a827f50264 100644 (file)
@@ -2,7 +2,7 @@
 \index{Compression algorithms}
 The TLS' record layer also supports compression. The algorithms
 implemented in \gnutls{} can be found in figure \ref{fig:compression}.
-All the algorithms except for ZLIB which is referenced in \cite{TLSCOMP}, should be 
+All the algorithms except for DEFLATE which is referenced in \cite{TLSCOMP}, should be 
 considered as \gnutls' extensions\footnote{You should use \printfunc{gnutls_handshake_set_private_extensions}{gnutls\_handshake\_set\_private\_extensions}
 to enable private extensions.}, and
 should be advertised only when the peer is known to have a compliant client,
@@ -23,7 +23,7 @@ the paper \cite{TLSCOMP}.
 \begin{tabular}{|l|p{9cm}|}
 
 \hline
-ZLIB & ZLIB compression, using the deflate algorithm.
+DEFLATE & Zlib compression, using the deflate algorithm.
 \\
 \hline
 LZO & LZO is a very fast compression algorithm. This algorithm is only
index da278969eb0fae9e8cae1e61f660000db4576f82..e0cd9d5ccbfec7e4be418da6376cc350187b7efa 100644 (file)
@@ -126,7 +126,11 @@ int _gnutls_server_name_send_params(gnutls_session session, opaque * data,
     */
    if (session->security_parameters.entity == GNUTLS_CLIENT) {
 
-      /* uint16 */
+      if (session->security_parameters.extensions.server_names_size == 0)
+          return 0;
+
+      /* uint16 
+       */
       total_size = 2;
       for (i = 0;
           i < session->security_parameters.extensions.server_names_size;
index 5ff1627adb78346e3874f561e45be70ba18adb25..e4183ee1038fccd3b9f1c75573645e7652031882 100644 (file)
@@ -87,8 +87,9 @@ typedef enum gnutls_digest_algorithm { GNUTLS_DIG_NULL=1, GNUTLS_DIG_MD5,
  */
 #define GNUTLS_MAX_ALGORITHM_NUM 16
 
+#define GNUTLS_COMP_ZLIB GNUTLS_COMP_DEFLATE
 typedef enum gnutls_compression_method { GNUTLS_COMP_NULL=1, 
-       GNUTLS_COMP_ZLIB
+       GNUTLS_COMP_DEFLATE
        GNUTLS_COMP_LZO /* only available if gnutls-extra has been initialized 
                          */
 } gnutls_compression_method;
index d13e89cd86e36d6580e3a993052bb9ab5dd8b99b..40e55249c02968a093cbc5254b02b02ab9a30103 100644 (file)
@@ -202,9 +202,11 @@ ext_send_func ext_send;
                                return GNUTLS_E_MEMORY_ERROR;
                        }
 
+fprintf(stderr, "Data type: [%d]\n", next);
                        /* write extension type */
                        _gnutls_write_uint16( next, &(*data)[pos]);
                        pos+=2;
+fprintf(stderr, "Data size: %d\n", size);
                        
                        /* write size */
                        _gnutls_write_uint16( size, &(*data)[pos]);
@@ -231,6 +233,7 @@ ext_send_func ext_send;
        pos-=2; /* remove the size of the size header! */
 
        _gnutls_write_uint16( pos, (*data));
+fprintf(stderr, "Total size: %d\n", pos);
 
        if (size==2) { /* empty */
                size = 0;
index 52a43cb71b50d7cc7378538881a61a21e62d7d3c..560faf9d2bb7266c8a6cb6712406b8aff03110c0 100644 (file)
--- a/src/cli.c
+++ b/src/cli.c
@@ -74,7 +74,7 @@ static gnutls_srp_client_credentials srp_cred;
 static gnutls_anon_client_credentials anon_cred;
 static gnutls_certificate_credentials xcred;
 
-int protocol_priority[PRI_MAX] = { GNUTLS_TLS1_1, GNUTLS_TLS1, GNUTLS_SSL3, 0 };
+int protocol_priority[PRI_MAX] = { GNUTLS_TLS1_1, GNUTLS_TLS1_0, GNUTLS_SSL3, 0 };
 int kx_priority[PRI_MAX] =
     { GNUTLS_KX_RSA, GNUTLS_KX_DHE_DSS, GNUTLS_KX_DHE_RSA, GNUTLS_KX_SRP,
        /* Do not use anonymous authentication, unless you know what that means */
@@ -158,19 +158,19 @@ static gnutls_session init_tls_session(const char *hostname)
 
        /* allow the use of private ciphersuites.
         */
-       if (disable_extensions == 0)
+       if (disable_extensions == 0) {
                gnutls_handshake_set_private_extensions(session, 1);
-
-       if (disable_extensions == 0)
                gnutls_server_name_set(session, GNUTLS_NAME_DNS, hostname,
                                       strlen(hostname));
+               gnutls_certificate_type_set_priority(session, cert_type_priority);
+       }
 
        gnutls_cipher_set_priority(session, cipher_priority);
        gnutls_compression_set_priority(session, comp_priority);
        gnutls_kx_set_priority(session, kx_priority);
        gnutls_protocol_set_priority(session, protocol_priority);
        gnutls_mac_set_priority(session, mac_priority);
-       gnutls_certificate_type_set_priority(session, cert_type_priority);
+
 
        gnutls_dh_set_prime_bits(session, 512);
 
index a73fa2632917936abc65e80b47255a05b35fdc56..be5a3a451ae451e901f4151d08d85065a075b8ce 100644 (file)
@@ -548,8 +548,8 @@ void parse_protocols(char **protocols, int protocols_size,
                                protocol_priority[j++] = GNUTLS_SSL3;
                        else if (strncasecmp(protocols[i], "TLS1.1", 6) == 0)
                                protocol_priority[j++] = GNUTLS_TLS1_1;
-                       else if (strncasecmp(protocols[i], "TLS", 6) == 0)
-                               protocol_priority[j++] = GNUTLS_TLS1;
+                       else if (strncasecmp(protocols[i], "TLS", 3) == 0)
+                               protocol_priority[j++] = GNUTLS_TLS1_0;
                        else fprintf(stderr, "Unknown protocol: '%s'\n", protocols[i]);
                }
                protocol_priority[j] = 0;