summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoseph Sutton <josephsutton@catalyst.net.nz>2023-03-03 17:27:38 +1300
committerJule Anger <janger@samba.org>2023-03-20 10:03:50 +0100
commitd2244ec1d3ee414d53d031fa4d846782b5ce9a1a (patch)
tree21abdb3b99a3c688247d91359c4bcc461ddee3e5
parent15723d6ff5eaa7f8e7e2803ffeab97f36289f2fe (diff)
downloadsamba-d2244ec1d3ee414d53d031fa4d846782b5ce9a1a.tar.gz
CVE-2023-0614 ldb: Add function to add distinguishedName to message
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>
-rw-r--r--lib/ldb/common/ldb_pack.c6
-rw-r--r--lib/ldb/include/ldb_private.h5
2 files changed, 8 insertions, 3 deletions
diff --git a/lib/ldb/common/ldb_pack.c b/lib/ldb/common/ldb_pack.c
index 028d96a619a..b0b0d64a5ba 100644
--- a/lib/ldb/common/ldb_pack.c
+++ b/lib/ldb/common/ldb_pack.c
@@ -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;
}
}
diff --git a/lib/ldb/include/ldb_private.h b/lib/ldb/include/ldb_private.h
index f6f47c28cf3..c6cff44942a 100644
--- a/lib/ldb/include/ldb_private.h
+++ b/lib/ldb/include/ldb_private.h
@@ -320,6 +320,11 @@ 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);
+
/**
* @brief Convert a character to uppercase with ASCII precedence.
*