• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt/router/samba-3.5.8/source4/rpc_server/common/
1/*
2   Unix SMB/CIFS implementation.
3
4   common share info functions
5
6   Copyright (C) Stefan (metze) Metzmacher 2004
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 3 of the License, or
11   (at your option) any later version.
12
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17
18   You should have received a copy of the GNU General Public License
19   along with this program.  If not, see <http://www.gnu.org/licenses/>.
20*/
21
22#include "includes.h"
23#include "param/share.h"
24#include "librpc/gen_ndr/srvsvc.h"
25#include "rpc_server/dcerpc_server.h"
26
27/*
28    Here are common server info functions used by some dcerpc server interfaces
29*/
30
31/* This hardcoded value should go into a ldb database! */
32uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
33{
34	return 0;
35}
36
37/* This hardcoded value should go into a ldb database! */
38uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
39{
40	return 1;
41}
42
43/* This hardcoded value should go into a ldb database! */
44enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
45{
46	/* for disk share	0x00000000
47	 * for print share	0x00000001
48	 * for IPC$ share	0x00000003
49	 *
50	 * administrative shares:
51	 * ADMIN$, IPC$, C$, D$, E$ ...  are type |= 0x80000000
52	 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
53	 */
54	enum srvsvc_ShareType share_type = 0;
55	const char *sharetype;
56
57	if (!share_bool_option(scfg, SHARE_BROWSEABLE, SHARE_BROWSEABLE_DEFAULT)) {
58		share_type |= STYPE_HIDDEN;
59	}
60
61	sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
62	if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
63		share_type |= STYPE_IPC;
64		return share_type;
65	}
66
67	if (sharetype && strcasecmp(sharetype, "PRINTER") == 0) {
68		share_type |= STYPE_PRINTQ;
69		return share_type;
70	}
71
72	share_type |= STYPE_DISKTREE;
73
74	return share_type;
75}
76
77/* This hardcoded value should go into a ldb database! */
78const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
79{
80	const char *sharetype;
81	char *p;
82
83	sharetype = share_string_option(scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
84
85	if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
86		return talloc_strdup(mem_ctx, "");
87	}
88
89	p = talloc_strdup(mem_ctx, share_string_option(scfg, SHARE_PATH, ""));
90	if (!p) {
91		return NULL;
92	}
93	if (p[0] == '\0') {
94		return p;
95	}
96	all_string_sub(p, "/", "\\", 0);
97
98	return talloc_asprintf(mem_ctx, "C:%s", p);
99}
100
101/* This hardcoded value should go into a ldb database! */
102uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
103{
104	return 0;
105}
106
107/* This hardcoded value should go into a ldb database! */
108struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
109{
110	return NULL;
111}
112