summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGünther Deschner <gd@samba.org>2008-09-10 10:34:13 +0200
committerGünther Deschner <gd@samba.org>2008-09-11 14:38:12 +0200
commitfd3d130d25a7c30fe003abe01fc18d8f754a466f (patch)
tree29de0e698389e0707c90ee36dcec6ad90ef74292
parentfd66b72fd017013c83d36f5219192716eb17cacb (diff)
downloadsamba-fd3d130d25a7c30fe003abe01fc18d8f754a466f.tar.gz
net: use netapi for NetFileClose.
Guenther
-rw-r--r--source/utils/net_rpc.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/source/utils/net_rpc.c b/source/utils/net_rpc.c
index 37e0e2ab183..c584b54e9e9 100644
--- a/source/utils/net_rpc.c
+++ b/source/utils/net_rpc.c
@@ -4722,36 +4722,6 @@ static int rpc_file_usage(struct net_context *c, int argc, const char **argv)
/**
* Close a file on a remote RPC server.
*
- * All parameters are provided by the run_rpc_command function, except for
- * argc, argv which are passed through.
- *
- * @param c A net_context structure.
- * @param domain_sid The domain sid acquired from the remote server.
- * @param cli A cli_state connected to the server.
- * @param mem_ctx Talloc context, destroyed on completion of the function.
- * @param argc Standard main() style argc.
- * @param argv Standard main() style argv. Initial components are already
- * stripped.
- *
- * @return Normal NTSTATUS return.
- **/
-static NTSTATUS rpc_file_close_internals(struct net_context *c,
- const DOM_SID *domain_sid,
- const char *domain_name,
- struct cli_state *cli,
- struct rpc_pipe_client *pipe_hnd,
- TALLOC_CTX *mem_ctx,
- int argc,
- const char **argv)
-{
- return rpccli_srvsvc_NetFileClose(pipe_hnd, mem_ctx,
- pipe_hnd->desthost,
- atoi(argv[0]), NULL);
-}
-
-/**
- * Close a file on a remote RPC server.
- *
* @param argc Standard main() style argc.
* @param argv Standard main() style argv. Initial components are already
* stripped.
@@ -4764,9 +4734,7 @@ static int rpc_file_close(struct net_context *c, int argc, const char **argv)
return rpc_file_usage(c, argc, argv);
}
- return run_rpc_command(c, NULL, &ndr_table_srvsvc.syntax_id, 0,
- rpc_file_close_internals,
- argc, argv);
+ return NetFileClose(c->opt_host, atoi(argv[0]));
}
/**
@@ -4881,6 +4849,8 @@ static int rpc_file_user(struct net_context *c, int argc, const char **argv)
int net_rpc_file(struct net_context *c, int argc, const char **argv)
{
+ NET_API_STATUS status;
+
struct functable func[] = {
{
"close",
@@ -4911,6 +4881,16 @@ int net_rpc_file(struct net_context *c, int argc, const char **argv)
{NULL, NULL, 0, NULL, NULL}
};
+ status = libnetapi_init(&c->netapi_ctx);
+ if (status != 0) {
+ return -1;
+ }
+ libnetapi_set_username(c->netapi_ctx, c->opt_user_name);
+ libnetapi_set_password(c->netapi_ctx, c->opt_password);
+ if (c->opt_kerberos) {
+ libnetapi_set_use_kerberos(c->netapi_ctx);
+ }
+
if (argc == 0) {
if (c->display_usage) {
d_printf("Usage:\n");