]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
dsdb: Simplify samdb_cn_to_lDAPDisplayName()
authorVolker Lendecke <vl@samba.org>
Tue, 24 Feb 2026 11:02:51 +0000 (12:02 +0100)
committerVolker Lendecke <vl@samba.org>
Wed, 25 Feb 2026 12:33:39 +0000 (12:33 +0000)
Use GUID_buf_string(), dom_sid_str_buf() and talloc_asprintf_addbuf()

Signed-off-by: Volker Lendecke <vl@samba.org>
Reviewed-by: Martin Schwenke <martin@meltin.net>
source4/dsdb/common/util.c

index 18a4a3eba3d6e30ddef487301080e7d463c4bda1..5f634d152af01c0a96128beacb1b7b48ed88f295 100644 (file)
@@ -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);