s3-shadow-copy2: Add more debugs
[Samba.git] / source4 / rpc_server / common / share_info.c
blob34330b92ca10fe65dbc196b339b5a66ef09acbaf
1 /*
2 Unix SMB/CIFS implementation.
4 common share info functions
6 Copyright (C) Stefan (metze) Metzmacher 2004
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.
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.
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/>.
22 #include "includes.h"
23 #include "param/share.h"
24 #include "librpc/gen_ndr/srvsvc.h"
25 #include "rpc_server/dcerpc_server.h"
26 #include "rpc_server/common/share.h"
28 /*
29 Here are common server info functions used by some dcerpc server interfaces
32 /* This hardcoded value should go into a ldb database! */
33 uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
35 return 0;
38 /* This hardcoded value should go into a ldb database! */
39 uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
41 return 1;
44 /* This hardcoded value should go into a ldb database! */
45 enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
47 /* for disk share 0x00000000
48 * for print share 0x00000001
49 * for IPC$ share 0x00000003
51 * administrative shares:
52 * ADMIN$, IPC$, C$, D$, E$ ... are type |= 0x80000000
53 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
55 enum srvsvc_ShareType share_type = 0;
56 char *sharetype;
58 if (!share_bool_option(scfg, SHARE_BROWSEABLE, SHARE_BROWSEABLE_DEFAULT)) {
59 share_type |= STYPE_HIDDEN;
62 sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
63 if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
64 share_type |= STYPE_IPC;
65 TALLOC_FREE(sharetype);
66 return share_type;
69 if (sharetype && strcasecmp(sharetype, "PRINTER") == 0) {
70 share_type |= STYPE_PRINTQ;
71 TALLOC_FREE(sharetype);
72 return share_type;
75 TALLOC_FREE(sharetype);
76 share_type |= STYPE_DISKTREE;
78 return share_type;
81 /* This hardcoded value should go into a ldb database! */
82 const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
84 char *sharetype;
85 char *p;
86 char *path;
88 sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
90 if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
91 TALLOC_FREE(sharetype);
92 return talloc_strdup(mem_ctx, "");
95 TALLOC_FREE(sharetype);
97 p = share_string_option(mem_ctx, scfg, SHARE_PATH, "");
98 if (!p) {
99 return NULL;
101 if (p[0] == '\0') {
102 return p;
104 all_string_sub(p, "/", "\\", 0);
106 path = talloc_asprintf(mem_ctx, "C:%s", p);
107 TALLOC_FREE(p);
108 return path;
111 /* This hardcoded value should go into a ldb database! */
112 uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
114 return 0;
117 /* This hardcoded value should go into a ldb database! */
118 struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
120 return NULL;