summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-12-15 23:24:08 +0000
committerTim Potter <tpot@samba.org>2002-12-15 23:24:08 +0000
commit099c284c47e82e594e7d50b3c9744d6be229d16d (patch)
tree7d61fbebfe4788ce05277dbeae788c8e91a38b3e /source3
parent2e41b42d5a4bfbaec88658b39eca603880ee97ee (diff)
downloadsamba-099c284c47e82e594e7d50b3c9744d6be229d16d.tar.gz
samba-099c284c47e82e594e7d50b3c9744d6be229d16d.tar.bz2
samba-099c284c47e82e594e7d50b3c9744d6be229d16d.zip
Fix fnum leak under error condition in cacl_dump.
(This used to be commit ab337572b82a0b40b56f055cdbb2f5864ef10c87)
Diffstat (limited to 'source3')
-rw-r--r--source3/utils/smbcacls.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 1d681a07f7..043aa689cc 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -443,29 +443,36 @@ dump the acls for a file
*******************************************************/
static int cacl_dump(struct cli_state *cli, char *filename)
{
- int fnum;
+ int result = EXIT_FAILED;
+ int fnum = -1;
SEC_DESC *sd;
- if (test_args) return EXIT_OK;
+ if (test_args)
+ return EXIT_OK;
fnum = cli_nt_create(cli, filename, CREATE_ACCESS_READ);
+
if (fnum == -1) {
printf("Failed to open %s: %s\n", filename, cli_errstr(cli));
- return EXIT_FAILED;
+ goto done;
}
sd = cli_query_secdesc(cli, fnum, ctx);
if (!sd) {
printf("ERROR: secdesc query failed: %s\n", cli_errstr(cli));
- return EXIT_FAILED;
+ goto done;
}
sec_desc_print(stdout, sd);
- cli_close(cli, fnum);
+ result = EXIT_OK;
- return EXIT_OK;
+done:
+ if (fnum != -1)
+ cli_close(cli, fnum);
+
+ return result;
}
/*****************************************************