diff options
author | Gregor Beck <gbeck@sernet.de> | 2011-06-14 13:56:22 +0200 |
---|---|---|
committer | Michael Adam <obnox@samba.org> | 2011-10-12 03:49:05 +0200 |
commit | 858e4cb1b605d37cc5b585d7292049c774f53ceb (patch) | |
tree | 5219623583b05e106f16a7e9cdd035c21a8a6469 | |
parent | 724b48bc084100de54813685e656d510c17880f9 (diff) | |
download | samba-858e4cb1b605d37cc5b585d7292049c774f53ceb.tar.gz samba-858e4cb1b605d37cc5b585d7292049c774f53ceb.tar.bz2 samba-858e4cb1b605d37cc5b585d7292049c774f53ceb.zip |
s3:smbcacls fix possible SEGFAULT
sddl_encode returns NULL on failure
Signed-off-by: Michael Adam <obnox@samba.org>
-rw-r--r-- | source3/utils/smbcacls.c | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c index f6b2ba65aa..bb7746e6b0 100644 --- a/source3/utils/smbcacls.c +++ b/source3/utils/smbcacls.c @@ -894,25 +894,29 @@ dump the acls for a file *******************************************************/ static int cacl_dump(struct cli_state *cli, const char *filename) { - int result = EXIT_FAILED; struct security_descriptor *sd; - if (test_args) + if (test_args) { return EXIT_OK; + } sd = get_secdesc(cli, filename); + if (sd == NULL) { + return EXIT_FAILED; + } - if (sd) { - if (sddl) { - printf("%s\n", sddl_encode(talloc_tos(), sd, - get_domain_sid(cli))); - } else { - sec_desc_print(cli, stdout, sd); + if (sddl) { + char *str = sddl_encode(talloc_tos(), sd, get_domain_sid(cli)); + if (str == NULL) { + return EXIT_FAILED; } - result = EXIT_OK; + printf("%s\n", str); + TALLOC_FREE(str); + } else { + sec_desc_print(cli, stdout, sd); } - return result; + return EXIT_OK; } /***************************************************** |