summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/include/proto.h2
-rw-r--r--source3/libsmb/clisecdesc.c13
-rw-r--r--source3/utils/smbcacls.c13
3 files changed, 5 insertions, 23 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index 35d2793e9b..d231ca06e4 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1127,7 +1127,7 @@ ssize_t cli_smbwrite(struct cli_state *cli,
/*The following definitions come from libsmb/clisecdesc.c */
-SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd);
+SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd, TALLOC_CTX *mem_ctx);
BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd);
/*The following definitions come from libsmb/clistr.c */
diff --git a/source3/libsmb/clisecdesc.c b/source3/libsmb/clisecdesc.c
index 6824a0edf4..69c7d5f73f 100644
--- a/source3/libsmb/clisecdesc.c
+++ b/source3/libsmb/clisecdesc.c
@@ -28,12 +28,11 @@
/****************************************************************************
query the security descriptor for a open file
****************************************************************************/
-SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
+SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd, TALLOC_CTX *mem_ctx)
{
char param[8];
char *rparam=NULL, *rdata=NULL;
int rparam_count=0, rdata_count=0;
- TALLOC_CTX *mem_ctx=NULL;
prs_struct pd;
SEC_DESC *psd = NULL;
@@ -58,11 +57,6 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
goto cleanup;
}
- if ((mem_ctx = talloc_init()) == NULL) {
- DEBUG(0,("talloc_init failed.\n"));
- goto cleanup;
- }
-
prs_init(&pd, rdata_count, mem_ctx, UNMARSHALL);
prs_append_data(&pd, rdata, rdata_count);
pd.data_offset = 0;
@@ -74,7 +68,6 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
cleanup:
- talloc_destroy(mem_ctx);
safe_free(rparam);
safe_free(rdata);
@@ -82,9 +75,6 @@ SEC_DESC *cli_query_secdesc(struct cli_state *cli,int fd)
return psd;
}
-
-
-
/****************************************************************************
set the security descriptor for a open file
****************************************************************************/
@@ -143,4 +133,3 @@ BOOL cli_set_secdesc(struct cli_state *cli,int fd, SEC_DESC *sd)
prs_mem_free(&pd);
return ret;
}
-
diff --git a/source3/utils/smbcacls.c b/source3/utils/smbcacls.c
index 66b15ea1ac..7b459a32ed 100644
--- a/source3/utils/smbcacls.c
+++ b/source3/utils/smbcacls.c
@@ -127,10 +127,6 @@ static void SidToString(fstring str, DOM_SID *sid)
/* Converted OK */
fstrcpy(str, names[0]);
-
- safe_free(names[0]);
- safe_free(names);
- safe_free(types);
}
/* convert a string to a SID, either numeric or username/group */
@@ -154,9 +150,6 @@ static BOOL StringToSid(DOM_SID *sid, char *str)
sid_copy(sid, &sids[0]);
- safe_free(sids);
- safe_free(types);
-
done:
return result;
@@ -458,7 +451,7 @@ static int cacl_dump(struct cli_state *cli, char *filename)
return EXIT_FAILED;
}
- sd = cli_query_secdesc(cli, fnum);
+ sd = cli_query_secdesc(cli, fnum, ctx);
if (!sd) {
printf("ERROR: secdesc query failed: %s\n", cli_errstr(cli));
@@ -495,7 +488,7 @@ static int owner_set(struct cli_state *cli, enum chown_mode change_mode,
if (!StringToSid(&sid, new_username))
return EXIT_PARSE_ERROR;
- old = cli_query_secdesc(cli, fnum);
+ old = cli_query_secdesc(cli, fnum, ctx);
cli_close(cli, fnum);
@@ -589,7 +582,7 @@ static int cacl_set(struct cli_state *cli, char *filename,
return EXIT_FAILED;
}
- old = cli_query_secdesc(cli, fnum);
+ old = cli_query_secdesc(cli, fnum, ctx);
if (!old) {
printf("calc_set: Failed to query old descriptor\n");