CVE-2023-0614 ldb: Add function to add distinguishedName to message
authorJoseph Sutton <josephsutton@catalyst.net.nz>
Fri, 3 Mar 2023 04:27:38 +0000 (17:27 +1300)
committerJule Anger <janger@samba.org>
Mon, 20 Mar 2023 09:03:38 +0000 (10:03 +0100)
BUG: https://bugzilla.samba.org/show_bug.cgi?id=15270

Signed-off-by: Joseph Sutton <josephsutton@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
[abartlet@samba.org Adapted to conflict from lack of new
ldb_ascii_toupper() in ldb_private.h]

lib/ldb/common/ldb_pack.c
lib/ldb/include/ldb_private.h

index 028d96a619ad1e5b5af0f61cff64b8e3712caad2..b0b0d64a5ba4423bb1960678dd7d7c8363d6186c 100644 (file)
@@ -1098,7 +1098,7 @@ int ldb_unpack_data(struct ldb_context *ldb,
 /*
   add the special distinguishedName element
 */
-static int msg_add_distinguished_name(struct ldb_message *msg)
+int ldb_msg_add_distinguished_name(struct ldb_message *msg)
 {
        const char *dn_attr = "distinguishedName";
        char *dn = NULL;
@@ -1158,7 +1158,7 @@ int ldb_filter_attrs(struct ldb_context *ldb,
 
        /* Shortcuts for the simple cases */
        } else if (add_dn && i == 1) {
-               if (msg_add_distinguished_name(filtered_msg) != 0) {
+               if (ldb_msg_add_distinguished_name(filtered_msg) != 0) {
                        goto failed;
                }
                return 0;
@@ -1238,7 +1238,7 @@ int ldb_filter_attrs(struct ldb_context *ldb,
        filtered_msg->num_elements = num_elements;
 
        if (add_dn) {
-               if (msg_add_distinguished_name(filtered_msg) != 0) {
+               if (ldb_msg_add_distinguished_name(filtered_msg) != 0) {
                        goto failed;
                }
        }
index 338e71def6da99239b6036ff716ba0d655448447..ca43817d07aeb9eef0a11739e25771bdd91c7c1f 100644 (file)
@@ -320,4 +320,9 @@ int ldb_match_message(struct ldb_context *ldb,
 /* Reallocate elements to drop any excess capacity. */
 void ldb_msg_shrink_to_fit(struct ldb_message *msg);
 
+/*
+  add the special distinguishedName element
+*/
+int ldb_msg_add_distinguished_name(struct ldb_message *msg);
+
 #endif