summaryrefslogtreecommitdiff
path: root/source3/rpcclient/cmd_srvsvc.c
diff options
context:
space:
mode:
authorTim Potter <tpot@samba.org>2001-10-12 05:56:23 +0000
committerTim Potter <tpot@samba.org>2001-10-12 05:56:23 +0000
commit439c7e0ca2ceb866cac4f0fbed65e157aa12482d (patch)
tree485198a7c227c05736986cdcaf82e42ec016e296 /source3/rpcclient/cmd_srvsvc.c
parentd726eb216ad431d2bbd4ee07f4098b72446cdca2 (diff)
downloadsamba-439c7e0ca2ceb866cac4f0fbed65e157aa12482d.tar.gz
samba-439c7e0ca2ceb866cac4f0fbed65e157aa12482d.tar.bz2
samba-439c7e0ca2ceb866cac4f0fbed65e157aa12482d.zip
Some old stuff hanging around since the CIFS conference. Big cleanup of
rpcclient code. Refactored cmd_* functions to move common mem_ctx and pipe opening stuff up one level. Moved rpcclient.h into rpcclient directory and out of includes/smb.h (This used to be commit a40facba9651f9fb1dcc9e143f92ca298a324312)
Diffstat (limited to 'source3/rpcclient/cmd_srvsvc.c')
-rw-r--r--source3/rpcclient/cmd_srvsvc.c24
1 files changed, 6 insertions, 18 deletions
diff --git a/source3/rpcclient/cmd_srvsvc.c b/source3/rpcclient/cmd_srvsvc.c
index 9e5b2054ee..f4ff11adf1 100644
--- a/source3/rpcclient/cmd_srvsvc.c
+++ b/source3/rpcclient/cmd_srvsvc.c
@@ -23,6 +23,7 @@
*/
#include "includes.h"
+#include "rpcclient.h"
/* Display server query info */
@@ -180,12 +181,12 @@ static void display_srv_info_102(SRV_INFO_102 *sv102)
/* Server query info */
-static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
- char **argv)
+static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli,
+ TALLOC_CTX *mem_ctx,
+ int argc, char **argv)
{
uint32 info_level = 101;
SRV_INFO_CTR ctr;
- TALLOC_CTX *mem_ctx;
NTSTATUS result = NT_STATUS_UNSUCCESSFUL;
if (argc > 2) {
@@ -196,20 +197,9 @@ static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
if (argc == 2)
info_level = atoi(argv[1]);
- if (!(mem_ctx = talloc_init())) {
- DEBUG(0,("cmd_srvsvc_srv_query_info: talloc_init failed\n"));
- return result;
- }
-
- /* Initialise RPC connection */
-
- if (!cli_nt_session_open (cli, PIPE_SRVSVC)) {
- DEBUG(0, ("Could not initialize srvsvc pipe!\n"));
- goto done;
- }
-
result = cli_srvsvc_net_srv_get_info(cli, mem_ctx, info_level,
&ctr);
+
if (!NT_STATUS_IS_OK(result)) {
goto done;
}
@@ -229,8 +219,6 @@ static NTSTATUS cmd_srvsvc_srv_query_info(struct cli_state *cli, int argc,
}
done:
- talloc_destroy(mem_ctx);
-
return result;
}
@@ -240,7 +228,7 @@ struct cmd_set srvsvc_commands[] = {
{ "SRVSVC" },
- { "srvinfo", cmd_srvsvc_srv_query_info, "Server query info", "" },
+ { "srvinfo", cmd_srvsvc_srv_query_info, PIPE_SRVSVC, "Server query info", "" },
{ NULL }
};