summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2002-12-20 01:35:21 +0000
committerTim Potter <tpot@samba.org>2002-12-20 01:35:21 +0000
commit8e5c9b04315de10eed4cb7839eff5cc8c2d0c2c7 (patch)
treebec3d4414c7694bbef7d843293ce8c2835c2c95a /source3
parentd4f08a480274c0599a561d205bfbdabb505c648f (diff)
downloadsamba-8e5c9b04315de10eed4cb7839eff5cc8c2d0c2c7.tar.gz
samba-8e5c9b04315de10eed4cb7839eff5cc8c2d0c2c7.tar.bz2
samba-8e5c9b04315de10eed4cb7839eff5cc8c2d0c2c7.zip
Merge from HEAD:
>Fix fnum leak under error condition in cacl_dump. (This used to be commit cd11f10e841fd53538164f283dc81232ff36638a)
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;
}
/*****************************************************