summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_dfs.c
diff options
context:
space:
mode:
authorSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
committerSimo Sorce <idra@samba.org>2001-08-10 09:52:10 +0000
commitacc149c427e780b35ebe3028722ed0c42c4c3854 (patch)
tree064b2307dac4fbaa23c1fdab0d900b63faf04737 /source3/rpcclient/cmd_dfs.c
parent5c47841335059ace57dfbf03e35872504d86b447 (diff)
downloadsamba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.gz
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.tar.bz2
samba-acc149c427e780b35ebe3028722ed0c42c4c3854.zip
- avoid possible mem leaks in rpcclient/cmd_*.c (talloc_destroy not performed)
- ported two rpc back from TNG (WINREG: shutdown and abort shutdown) - some optimizations and changed some DEBUG statement in loadparm.c - changed rpcclient a bit moved from non reentrant next_token_nr to next_token - in cmd_reg.c not sure if getopt will work ok on all platforms only setting optind=0 (This used to be commit fd54412ce9c3504a547e232602d6129e08dd9d4d)
Diffstat (limited to 'source3/rpcclient/cmd_dfs.c')
-rw-r--r--source3/rpcclient/cmd_dfs.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/source3/rpcclient/cmd_dfs.c b/source3/rpcclient/cmd_dfs.c
index b4914f665c..8059f42f2f 100644
--- a/source3/rpcclient/cmd_dfs.c
+++ b/source3/rpcclient/cmd_dfs.c
@@ -47,7 +47,8 @@ static uint32 cmd_dfs_exist(struct cli_state *cli, int argc, char **argv)
if (!cli_nt_session_open (cli, PIPE_NETDFS)) {
DEBUG(0, ("Could not initialize netdfs pipe!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
result = cli_dfs_exist(cli, mem_ctx, &dfs_exists);
@@ -57,6 +58,8 @@ static uint32 cmd_dfs_exist(struct cli_state *cli, int argc, char **argv)
cli_nt_session_close(cli);
+done:
+ talloc_destroy(mem_ctx);
return result;
}
@@ -87,7 +90,8 @@ static uint32 cmd_dfs_add(struct cli_state *cli, int argc, char **argv)
if (!cli_nt_session_open (cli, PIPE_NETDFS)) {
DEBUG(0, ("Could not initialize netdfs pipe!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
result = cli_dfs_add(cli, mem_ctx, entrypath, servername,
@@ -95,6 +99,8 @@ static uint32 cmd_dfs_add(struct cli_state *cli, int argc, char **argv)
cli_nt_session_close(cli);
+done:
+ talloc_destroy(mem_ctx);
return result;
}
@@ -122,7 +128,8 @@ static uint32 cmd_dfs_remove(struct cli_state *cli, int argc, char **argv)
if (!cli_nt_session_open (cli, PIPE_NETDFS)) {
DEBUG(0, ("Could not initialize netdfs pipe!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
result = cli_dfs_remove(cli, mem_ctx, entrypath, servername,
@@ -130,6 +137,8 @@ static uint32 cmd_dfs_remove(struct cli_state *cli, int argc, char **argv)
cli_nt_session_close(cli);
+done:
+ talloc_destroy(mem_ctx);
return result;
}
@@ -236,24 +245,23 @@ static uint32 cmd_dfs_enum(struct cli_state *cli, int argc, char **argv)
if (!cli_nt_session_open (cli, PIPE_NETDFS)) {
DEBUG(0, ("Could not initialize netdfs pipe!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
/* Call RPC function */
if ((result = cli_dfs_enum(cli, mem_ctx, info_level, &ctr))
- != NT_STATUS_NOPROBLEMO) {
- goto done;
+ == NT_STATUS_NOPROBLEMO) {
+
+ /* Print results */
+ display_dfs_info_ctr(&ctr);
}
- /* Print results */
-
- display_dfs_info_ctr(&ctr);
-
- done:
-
cli_nt_session_close(cli);
+done:
+ talloc_destroy(mem_ctx);
return result;
}
@@ -286,25 +294,25 @@ static uint32 cmd_dfs_getinfo(struct cli_state *cli, int argc, char **argv)
if (!cli_nt_session_open (cli, PIPE_NETDFS)) {
DEBUG(0, ("Could not initialize netdfs pipe!\n"));
- return NT_STATUS_UNSUCCESSFUL;
+ result = NT_STATUS_UNSUCCESSFUL;
+ goto done;
}
/* Call RPC function */
if ((result = cli_dfs_get_info(cli, mem_ctx, entrypath, servername,
sharename, info_level, &ctr))
- != NT_STATUS_NOPROBLEMO) {
- goto done;
- }
+ == NT_STATUS_NOPROBLEMO) {
- /* Print results */
+ /* Print results */
- display_dfs_info_ctr(&ctr);
-
- done:
+ display_dfs_info_ctr(&ctr);
+ }
cli_nt_session_close(cli);
+done:
+ talloc_destroy(mem_ctx);
return result;
}