andykimpe / rpms / 389-ds-base

Forked from rpms/389-ds-base 5 months ago
Clone

Blame SOURCES/0035-Ticket-49377-Incoming-BER-too-large-with-TLS-on-plai.patch

081b2d
From 40811ab7571ddf0a6905b3b019229bdb555bd04d Mon Sep 17 00:00:00 2001
081b2d
From: William Brown <firstyear@redhat.com>
081b2d
Date: Tue, 7 Nov 2017 12:42:11 +1000
081b2d
Subject: [PATCH] Ticket 49377 - Incoming BER too large with TLS on plain port
081b2d
081b2d
Bug Description:  When doing TLS to a plain port, a message of
081b2d
"ber element 3 bytes too large for max ber" when max ber > 3.
081b2d
081b2d
Fix Description:  When ber_len < maxber, report that the request
081b2d
may be misformed instead of "oversize" instead. This can lead
081b2d
to a better diagnosis.
081b2d
081b2d
https://pagure.io/389-ds-base/issue/49377
081b2d
081b2d
Author: wibrown
081b2d
081b2d
Review by: mreynolds (thanks!)
081b2d
081b2d
Cherry picked from commit b3629af054760d9421a41d63b8b8ed513bb6944d
081b2d
---
081b2d
 ldap/servers/slapd/connection.c | 7 +++++++
081b2d
 1 file changed, 7 insertions(+)
081b2d
081b2d
diff --git a/ldap/servers/slapd/connection.c b/ldap/servers/slapd/connection.c
081b2d
index 3f19b9765..8ef115691 100644
081b2d
--- a/ldap/servers/slapd/connection.c
081b2d
+++ b/ldap/servers/slapd/connection.c
081b2d
@@ -2176,6 +2176,13 @@ log_ber_too_big_error(const Connection *conn, ber_len_t ber_len, ber_len_t maxbe
081b2d
                       " is %" BERLEN_T " bytes. Change the nsslapd-maxbersize attribute in"
081b2d
                       " cn=config to increase.\n",
081b2d
                       conn->c_connid, conn->c_sd, maxbersize);
081b2d
+    } else if (ber_len < maxbersize) {
081b2d
+        /* This means the request was misformed, not too large. */
081b2d
+        slapi_log_err(SLAPI_LOG_ERR, "log_ber_too_big_error",
081b2d
+                      "conn=%" PRIu64 " fd=%d Incoming BER Element may be misformed. "
081b2d
+                      "This may indicate an attempt to use TLS on a plaintext port, "
081b2d
+                      "IE ldaps://localhost:389. Check your client LDAP_URI settings.\n",
081b2d
+                      conn->c_connid, conn->c_sd);
081b2d
     } else {
081b2d
         slapi_log_err(SLAPI_LOG_ERR, "log_ber_too_big_error",
081b2d
                       "conn=%" PRIu64 " fd=%d Incoming BER Element was %" BERLEN_T " bytes, max allowable"
081b2d
-- 
081b2d
2.13.6
081b2d