From: Christof Schmitt Date: Fri, 24 Apr 2015 16:51:28 +0000 (-0700) Subject: sharesec: Print ACEs in similar format as expected in input X-Git-Tag: tdb-1.3.5~22 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=cea50454129b1a10d1350dde2f6440c249f89c85;p=thirdparty%2Fsamba.git sharesec: Print ACEs in similar format as expected in input BUG: https://bugzilla.samba.org/show_bug.cgi?id=11237 Signed-off-by: Christof Schmitt Reviewed-by: Jeremy Allison --- diff --git a/source3/utils/sharesec.c b/source3/utils/sharesec.c index 132ca7ecc10..44cab17cd7c 100644 --- a/source3/utils/sharesec.c +++ b/source3/utils/sharesec.c @@ -21,12 +21,13 @@ * along with this program; if not, see . */ +struct cli_state; #include "includes.h" #include "popt_common.h" #include "../libcli/security/security.h" -#include "../librpc/gen_ndr/ndr_security.h" #include "passdb/machine_sid.h" +#include "util_sd.h" static TALLOC_CTX *ctx; @@ -334,7 +335,6 @@ static int change_share_sec(TALLOC_CTX *mem_ctx, const char *sharename, char *th struct security_descriptor *old = NULL; size_t sd_size = 0; uint32 i, j; - char *sd_str; if (mode != SMB_ACL_SET && mode != SMB_SD_DELETE) { if (!(old = get_share_security( mem_ctx, sharename, &sd_size )) ) { @@ -355,11 +355,7 @@ static int change_share_sec(TALLOC_CTX *mem_ctx, const char *sharename, char *th /* should not happen */ return 0; case SMB_ACL_VIEW: - sd_str = ndr_print_struct_string(mem_ctx, - (ndr_print_fn_t)ndr_print_security_descriptor, - "", old); - fprintf(stdout, "%s\n", sd_str); - talloc_free(sd_str); + sec_desc_print(NULL, stdout, old, true); return 0; case SMB_ACL_DELETE: for (i=0;sd->dacl && idacl->num_aces;i++) { @@ -379,11 +375,9 @@ static int change_share_sec(TALLOC_CTX *mem_ctx, const char *sharename, char *th } if (!found) { - sd_str = ndr_print_struct_string(mem_ctx, - (ndr_print_fn_t)ndr_print_security_ace, - "", &sd->dacl->aces[i]); - printf("ACL for ACE: %s not found\n", sd_str); - talloc_free(sd_str); + printf("ACL for ACE:"); + print_ace(NULL, stdout, &sd->dacl->aces[i], true); + printf(" not found\n"); } } break; diff --git a/source3/wscript_build b/source3/wscript_build index 36eb1b79294..ef4c986bca6 100755 --- a/source3/wscript_build +++ b/source3/wscript_build @@ -1365,9 +1365,11 @@ bld.SAMBA3_BINARY('eventlogadm', LIBEVENTLOG''') bld.SAMBA3_BINARY('sharesec', - source='utils/sharesec.c', + source='utils/sharesec.c lib/util_sd.c', deps=''' talloc + msrpc3 + libcli_lsa3 popt_samba3''') bld.SAMBA3_BINARY('pdbtest',