source: trunk/server/source3/lib/netapi/file.c@ 953

Last change on this file since 953 was 745, checked in by Silvan Scherrer, 13 years ago

Samba Server: updated trunk to 3.6.0

File size: 7.0 KB
Line 
1/*
2 * Unix SMB/CIFS implementation.
3 * NetApi File Support
4 * Copyright (C) Guenther Deschner 2008
5 *
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.
10 *
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.
15 *
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/>.
18 */
19
20#include "includes.h"
21
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"
26#include "../librpc/gen_ndr/ndr_srvsvc_c.h"
27
28/****************************************************************
29****************************************************************/
30
31WERROR NetFileClose_r(struct libnetapi_ctx *ctx,
32 struct NetFileClose *r)
33{
34 WERROR werr;
35 NTSTATUS status;
36 struct dcerpc_binding_handle *b;
37
38 werr = libnetapi_get_binding_handle(ctx, r->in.server_name,
39 &ndr_table_srvsvc.syntax_id,
40 &b);
41 if (!W_ERROR_IS_OK(werr)) {
42 goto done;
43 }
44
45 status = dcerpc_srvsvc_NetFileClose(b, talloc_tos(),
46 r->in.server_name,
47 r->in.fileid,
48 &werr);
49 if (!NT_STATUS_IS_OK(status)) {
50 werr = ntstatus_to_werror(status);
51 goto done;
52 }
53
54 done:
55 return werr;
56}
57
58/****************************************************************
59****************************************************************/
60
61WERROR NetFileClose_l(struct libnetapi_ctx *ctx,
62 struct NetFileClose *r)
63{
64 LIBNETAPI_REDIRECT_TO_LOCALHOST(ctx, r, NetFileClose);
65}
66
67/****************************************************************
68****************************************************************/
69
70static NTSTATUS map_srvsvc_FileInfo_to_FILE_INFO_buffer(TALLOC_CTX *mem_ctx,
71 uint32_t level,
72 union srvsvc_NetFileInfo *info,
73 uint8_t **buffer,
74 uint32_t *num_entries)
75{
76 struct FILE_INFO_2 i2;
77 struct FILE_INFO_3 i3;
78
79 switch (level) {
80 case 2:
81 i2.fi2_id = info->info2->fid;