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
commite10a7af3c652ecd4c3213b5251e188538d0d41d3 (patch)
tree5f52a01c3f6fc6c3fdefb082d2b63d3cd64b7cae
parent898a69ea0c9000e8ecb91902e4d4662a4decf741 (diff)
downloadsamba-e10a7af3c652ecd4c3213b5251e188538d0d41d3.tar.gz
samba-e10a7af3c652ecd4c3213b5251e188538d0d41d3.tar.bz2
samba-e10a7af3c652ecd4c3213b5251e188538d0d41d3.zip
net: use netapi for NetFileClose.
Guenther (This used to be commit fd3d130d25a7c30fe003abe01fc18d8f754a466f)
-rw-r--r--source3/utils/net_rpc.c46
1 files changed, 13 insertions, 33 deletions
diff --git a/source3/utils/net_rpc.c b/source3/utils/net_rpc.c
index 37e0e2ab18..c584b54e9e 100644
--- a/source3/utils/net_rpc.c
+++ b/source3/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");