]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
libcli/security: conditional ace err messages don't hardcode offset
authorDouglas Bagnall <douglas.bagnall@catalyst.net.nz>
Tue, 31 Oct 2023 21:46:20 +0000 (10:46 +1300)
committerAndrew Bartlett <abartlet@samba.org>
Wed, 1 Nov 2023 20:10:46 +0000 (20:10 +0000)
Usually the conditions are embedded in part of some SDDL, and the
offset from the beginning of the condtions is a bit useless and
confusing. Callers of sddl_decode_err_msg get the offset from the
beginning of the SDDL which is a different and more useful number.

Signed-off-by: Douglas Bagnall <douglas.bagnall@catalyst.net.nz>
Reviewed-by: Andrew Bartlett <abartlet@samba.org>
libcli/security/sddl_conditional_ace.c

index 82fa266e8b83cd3aee4df5453005ab4371165dae..2a86cd34e7f842e2677d1d5a684754a3ecb4da2e 100644 (file)
@@ -1268,7 +1268,6 @@ static void comp_error(struct ace_condition_sddl_compiler_context *comp,
        if (msg == NULL) {
                goto fail;
        }
-       comp->message_offset = comp->offset;
 
        if (comp->message == NULL) {
                /*
@@ -1276,13 +1275,8 @@ static void comp_error(struct ace_condition_sddl_compiler_context *comp,
                 *
                 * This is the common case.
                 */
-               comp->message = talloc_asprintf(comp->mem_ctx,
-                                               "%"PRIu32": %s",
-                                               comp->offset, msg);
-               TALLOC_FREE(msg);
-               if (comp->message == NULL) {
-                       goto fail;
-               }
+               comp->message_offset = comp->offset;
+               comp->message = msg;
                return;
        }
        /*
@@ -1290,8 +1284,8 @@ static void comp_error(struct ace_condition_sddl_compiler_context *comp,
         * This is unlikely to happen.
         */
        comp->message = talloc_asprintf(comp->mem_ctx,
-                                       "%s AND THEN %"PRIu32": %s",
-                                       comp->message, comp->offset,
+                                       "%s AND THEN %s",
+                                       comp->message,
                                        msg);
        TALLOC_FREE(msg);
        if (comp->message == NULL) {