hc
2023-02-13 e440ec23c5a540cdd3f7464e8779219be6fd3d95
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
openldap CVE-2015-3276
 
the patch comes from:
https://bugzilla.redhat.com/show_bug.cgi?id=1238322
https://bugzilla.redhat.com/attachment.cgi?id=1055640
 
The nss_parse_ciphers function in libraries/libldap/tls_m.c in
OpenLDAP does not properly parse OpenSSL-style multi-keyword mode
cipher strings, which might cause a weaker than intended cipher to
be used and allow remote attackers to have unspecified impact via
unknown vectors.
 
Upstream-Status: Pending
 
CVE: CVE-2015-3276
 
Signed-off-by: Li Wang <li.wang@windriver.com>
---
 libraries/libldap/tls_m.c |   27 ++++++++++++++++-----------
 1 file changed, 16 insertions(+), 11 deletions(-)
 
--- a/libraries/libldap/tls_m.c
+++ b/libraries/libldap/tls_m.c
@@ -620,18 +620,23 @@ nss_parse_ciphers(const char *cipherstr,
              */
             if (mask || strength || protocol) {
                 for (i=0; i<ciphernum; i++) {
-                    if (((ciphers_def[i].attr & mask) ||
-                         (ciphers_def[i].strength & strength) ||
-                         (ciphers_def[i].version & protocol)) &&
-                        (cipher_list[i] != -1)) {
-                        /* Enable the NULL ciphers only if explicity
-                         * requested */
-                        if (ciphers_def[i].attr & SSL_eNULL) {
-                            if (mask & SSL_eNULL)
-                                cipher_list[i] = action;
-                        } else
+                    /* if more than one mask is provided
+                     * then AND logic applies (to match openssl)
+                     */
+                    if ( cipher_list[i] == -1) )
+                        continue;
+                    if ( mask && ! (ciphers_def[i].attr & mask) )
+                        continue;
+                    if ( strength && ! (ciphers_def[i].strength & strength) )
+                        continue;
+                    if ( protocol && ! (ciphers_def[i].version & protocol) )
+                        continue;
+                    /* Enable the NULL ciphers only if explicity requested */
+                    if (ciphers_def[i].attr & SSL_eNULL) {
+                        if (mask & SSL_eNULL)
                             cipher_list[i] = action;
-                    }
+                    } else
+                        cipher_list[i] = action;
                 }
             } else {
                 for (i=0; i<ciphernum; i++) {