amoralej / rpms / 389-ds-base

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

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

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