source: trunk/server/source4/ntvfs/ipc/rap_server.c

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

Samba Server: updated trunk to 3.6.0

File size: 2.8 KB
Line 
1/*
2 Unix SMB/CIFS implementation.
3 RAP handlers
4
5 Copyright (C) Volker Lendecke 2004
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
11
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
16
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
19*/
20
21#include "includes.h"
22#include "param/share.h"
23#include "../librpc/gen_ndr/rap.h"
24#include "libcli/raw/interfaces.h"
25#include "librpc/gen_ndr/srvsvc.h"
26#include "librpc/gen_ndr/dcerpc.h"
27#include "rpc_server/common/common.h"
28#include "rpc_server/common/share.h"
29#include "param/param.h"
30#include "ntvfs/ipc/ipc.h"
31#include "ntvfs/ipc/proto.h"
32
33/* At this moment these are just dummy functions, but you might get the
34 * idea. */
35
36NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
37 struct tevent_context *event_ctx,
38 struct loadparm_context *lp_ctx,
39 struct rap_NetShareEnum *r)
40{
41 NTSTATUS nterr;
42 const char **snames;
43 struct share_context *sctx;
44 struct share_config *scfg;
45 int i, j, count;
46
47 r->out.status = 0;
48 r->out.available = 0;
49 r->out.info = NULL;
50
51 nterr = share_get_context_by_name(mem_ctx, lpcfg_share_backend(lp_ctx), event_ctx, lp_ctx, &sctx);
52 if (!NT_STATUS_IS_OK(nterr)) {
53 return nterr;
54 }
55
56 nterr = share_list_all(mem_ctx, sctx, &count, &snames);
57 if (!NT_STATUS_IS_OK(nterr)) {
58 return nterr;
59 }
60
61 r->out.available = count;
62 r->out.info = talloc_array(mem_ctx,
63 union rap_share_info, r->out.available);
64
65 for (i = 0, j = 0; i < r->out.available; i++) {
66 if (!NT_STATUS_IS_OK(share_get_config(mem_ctx, sctx, snames[i], &scfg))) {
67 DEBUG(3, ("WARNING: Service [%s] disappeared after enumeration!\n", snames[i]));
68 continue;
69 }
70 strncpy((char *)r->out.info[j].info1.share_name,
71 snames[i],
72 sizeof(r->out.info[0].info1.share_name));
73 r->out.info[i].info1.reserved1 = 0;
74 r->out.info[i].info1.share_type = dcesrv_common_get_share_type(mem_ctx, NULL, scfg);
75 r->out.info[i].info1.comment = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_COMMENT, ""));
76 talloc_free(scfg);
77 j++;
78 }
79 r->out.available = j;
80
81 return NT_STATUS_OK;
82}
83
84NTSTATUS rap_netserverenum2(TALLOC_CTX *mem_ctx,
85 struct loadparm_context *lp_ctx,
86 struct rap_NetServerEnum2 *r)
87{
88 r->out.status = 0;
89 r->out.available = 0;
90 return NT_STATUS_OK;
91}
Note: See TracBrowser for help on using the repository browser.