]> git.ipfire.org Git - thirdparty/gnutls.git/commitdiff
Revert "We now ignore received packets with unknown content types"
authorSystem User <nmav@crystal.(none)>
Thu, 6 Dec 2007 20:50:48 +0000 (22:50 +0200)
committerSystem User <nmav@crystal.(none)>
Thu, 6 Dec 2007 20:50:48 +0000 (22:50 +0200)
This reverts commit 4a19fd59da474b3de977a925fd91578db7e3d4a1.

NEWS
lib/gnutls_record.c

diff --git a/NEWS b/NEWS
index e0039aa8655c4d71b2bf93b0ebdb0b667810f397..63358b9b6ca48e522290624fe9311f5b481ddb16 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -20,9 +20,6 @@ gnutls_x509_crt_get_subject_alt_name2: ADD.
 
 ** PKCS #8 parser can now encode/decode DSA keys.
 
-** We now ignore received packets with unknown content types
-to follow the TLS spec.
-
 ** Updated gnutls_set_default_priority2() now renamed to
 gnutls_priority_set() and gnutls_priority_set_direct() which
 accept a string to indicate preferences of ciphersuite parameters.
index edc4dd14093a1800a91bdd138cb1f2f95f42668d..d4ff531078d6242feed833412898116c16046d73 100644 (file)
@@ -489,6 +489,25 @@ _gnutls_send_change_cipher_spec (gnutls_session_t session, int again)
     }
 }
 
+inline static int
+check_recv_type (content_type_t recv_type)
+{
+  switch (recv_type)
+    {
+    case GNUTLS_CHANGE_CIPHER_SPEC:
+    case GNUTLS_ALERT:
+    case GNUTLS_HANDSHAKE:
+    case GNUTLS_APPLICATION_DATA:
+    case GNUTLS_INNER_APPLICATION:
+      return 0;
+    default:
+      gnutls_assert ();
+      return GNUTLS_E_UNSUPPORTED_VERSION_PACKET;
+    }
+
+}
+
+
 /* Checks if there are pending data in the record buffers. If there are
  * then it copies the data.
  */
@@ -747,14 +766,13 @@ record_check_type (gnutls_session_t session,
          return GNUTLS_E_UNEXPECTED_PACKET;
          break;
        default:
-         /* an unknown content type was received. Just ignore it. */
+
          _gnutls_record_log
            ("REC[%x]: Received Unknown packet %d expecting %d\n",
             session, recv_type, type);
 
          gnutls_assert ();
-         /* call again to receive actual data */
-         return GNUTLS_E_AGAIN;
+         return GNUTLS_E_INTERNAL_ERROR;
        }
     }
 
@@ -898,10 +916,14 @@ begin:
       return ret;
     }
 
-/* Here we no longer check if the Type of the received packet is
- * ok. According to TLS 1.0 we should just ignore unknown content types.
- * So we proceed as normal.
+/* Here we check if the Type of the received packet is
+ * ok. 
  */
+  if ((ret = check_recv_type (recv_type)) < 0)
+    {
+      gnutls_assert ();
+      return ret;
+    }
 
 /* Here we check if the advertized version is the one we
  * negotiated in the handshake.
@@ -1013,8 +1035,6 @@ begin:
       return GNUTLS_E_RECORD_LIMIT_REACHED;
     }
 
-  /* Check if the received type is the one we expect.
-   */
   ret =
     record_check_type (session, recv_type, type, htype, tmp.data,
                       decrypted_length);