From: Volker Lendecke Date: Tue, 24 Feb 2026 11:02:51 +0000 (+0100) Subject: dsdb: Simplify samdb_cn_to_lDAPDisplayName() X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=954fe55c013d66ece295ebabffac8bceea593088;p=thirdparty%2Fsamba.git dsdb: Simplify samdb_cn_to_lDAPDisplayName() Use GUID_buf_string(), dom_sid_str_buf() and talloc_asprintf_addbuf() Signed-off-by: Volker Lendecke Reviewed-by: Martin Schwenke --- diff --git a/source4/dsdb/common/util.c b/source4/dsdb/common/util.c index 18a4a3eba3d..5f634d152af 100644 --- a/source4/dsdb/common/util.c +++ b/source4/dsdb/common/util.c @@ -4110,16 +4110,8 @@ const char *samdb_cn_to_lDAPDisplayName(TALLOC_CTX *mem_ctx, const char *cn) tokens[i][0] = toupper(tokens[i][0]); ret = talloc_strdup(mem_ctx, tokens[0]); - if (ret == NULL) { - talloc_free(tokens); - return NULL; - } for (i = 1; tokens[i] != NULL; i++) { - ret = talloc_asprintf_append_buffer(ret, "%s", tokens[i]); - if (ret == NULL) { - talloc_free(tokens); - return NULL; - } + talloc_asprintf_addbuf(&ret, "%s", tokens[i]); } talloc_free(tokens);