From: Douglas Bagnall Date: Tue, 31 Oct 2023 21:46:20 +0000 (+1300) Subject: libcli/security: conditional ace err messages don't hardcode offset X-Git-Tag: talloc-2.4.2~901 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=ffa08426e0e95e7a1e013ae9164b39072160ff4f;p=thirdparty%2Fsamba.git libcli/security: conditional ace err messages don't hardcode offset 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 Reviewed-by: Andrew Bartlett --- diff --git a/libcli/security/sddl_conditional_ace.c b/libcli/security/sddl_conditional_ace.c index 82fa266e8b8..2a86cd34e7f 100644 --- a/libcli/security/sddl_conditional_ace.c +++ b/libcli/security/sddl_conditional_ace.c @@ -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) {