netapi: implement NetFileClose_r.
[Samba.git] / source / lib / netapi / file.c
blobc0edb8e0628bfc6e12b45a5007ddfe80a1105ae5
1 /*
2 * Unix SMB/CIFS implementation.
3 * NetApi File Support
4 * Copyright (C) Guenther Deschner 2008
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, see <http://www.gnu.org/licenses/>.
20 #include "includes.h"
22 #include "librpc/gen_ndr/libnetapi.h"
23 #include "lib/netapi/netapi.h"
24 #include "lib/netapi/netapi_private.h"
25 #include "lib/netapi/libnetapi.h"
27 /****************************************************************
28 ****************************************************************/
30 WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
31 struct NetFileClose *r)
33 WERROR werr;
34 NTSTATUS status;
35 struct cli_state *cli = NULL;
36 struct rpc_pipe_client *pipe_cli = NULL;
38 werr = libnetapi_open_pipe(ctx, r->in.server_name,
39 &ndr_table_srvsvc.syntax_id,
40 &cli,
41 &pipe_cli);
42 if (!W_ERROR_IS_OK(werr)) {
43 goto done;
46 status = rpccli_srvsvc_NetFileClose(pipe_cli, ctx,
47 r->in.server_name,
48 r->in.fileid,
49 &werr);
50 if (!W_ERROR_IS_OK(werr)) {
51 goto done;
54 done:
55 if (!cli) {
56 return werr;
59 return werr;
62 /****************************************************************
63 ****************************************************************/
65 WERROR NetFileClose_l(struct libnetapi_ctx *ctx,
66 struct NetFileClose *r)
68 LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetFileClose);