s4:auth: Fix code spelling
[Samba.git] / source4 / rpc_server / common / share_info.c
blobd7ed5ee42415da0a15171db2eed4e50d582d4651
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 #undef strcasecmp
30 /*
31 Here are common server info functions used by some dcerpc server interfaces
34 /* This hardcoded value should go into a ldb database! */
35 uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
37 return 0;
40 /* This hardcoded value should go into a ldb database! */
41 uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
43 return 1;
46 /* This hardcoded value should go into a ldb database! */
47 enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
49 /* for disk share 0x00000000
50 * for print share 0x00000001
51 * for IPC$ share 0x00000003
53 * administrative shares:
54 * ADMIN$, IPC$, C$, D$, E$ ... are type |= 0x80000000
55 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
57 enum srvsvc_ShareType share_type = 0;
58 char *sharetype;
60 if (!share_bool_option(scfg, SHARE_BROWSEABLE, SHARE_BROWSEABLE_DEFAULT)) {
61 share_type |= STYPE_HIDDEN;
64 sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
65 if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
66 share_type |= STYPE_IPC;
67 TALLOC_FREE(sharetype);
68 return share_type;
71 if (sharetype && strcasecmp(sharetype, "PRINTER") == 0) {
72 share_type |= STYPE_PRINTQ;
73 TALLOC_FREE(sharetype);
74 return share_type;
77 TALLOC_FREE(sharetype);
78 share_type |= STYPE_DISKTREE;
80 return share_type;
83 /* This hardcoded value should go into a ldb database! */
84 const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
86 char *sharetype;
87 char *p;
88 char *path;
90 sharetype = share_string_option(mem_ctx, scfg, SHARE_TYPE, SHARE_TYPE_DEFAULT);
92 if (sharetype && strcasecmp(sharetype, "IPC") == 0) {
93 TALLOC_FREE(sharetype);
94 return talloc_strdup(mem_ctx, "");
97 TALLOC_FREE(sharetype);
99 p = share_string_option(mem_ctx, scfg, SHARE_PATH, "");
100 if (!p) {
101 return NULL;
103 if (p[0] == '\0') {
104 return p;
106 all_string_sub(p, "/", "\\", 0);
108 path = talloc_asprintf(mem_ctx, "C:%s", p);
109 TALLOC_FREE(p);
110 return path;
113 /* This hardcoded value should go into a ldb database! */
114 uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
116 return 0;
119 /* This hardcoded value should go into a ldb database! */
120 struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, struct share_config *scfg)
122 return NULL;