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 2 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, write to the Free Software
20 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
24 #include "librpc/gen_ndr/srvsvc.h"
25 #include "rpc_server/dcerpc_server.h"
28 Here are common server info functions used by some dcerpc server interfaces
31 /* This hardcoded value should go into a ldb database! */
32 uint32_t dcesrv_common_get_count_of_shares(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
34 /* what's about int -> uint32_t overflow */
35 return lp_numservices();
38 const char *dcesrv_common_get_share_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
40 return talloc_strdup(mem_ctx, lp_servicename(snum));
43 const char *dcesrv_common_get_share_comment(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
45 return talloc_strdup(mem_ctx, lp_comment(snum));
48 /* This hardcoded value should go into a ldb database! */
49 uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
54 /* This hardcoded value should go into a ldb database! */
55 uint32_t dcesrv_common_get_share_max_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
57 return lp_max_connections(snum);
60 /* This hardcoded value should go into a ldb database! */
61 uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
66 /* This hardcoded value should go into a ldb database! */
67 enum srvsvc_ShareType dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
69 /* for disk share 0x00000000
70 * for print share 0x00000001
71 * for IPC$ share 0x00000003
73 * administrative shares:
74 * ADMIN$, IPC$, C$, D$, E$ ... are type |= 0x80000000
75 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
77 enum srvsvc_ShareType share_type = 0;
79 if (!lp_browseable(snum)) {
80 share_type |= STYPE_HIDDEN;
83 if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
84 share_type |= STYPE_IPC;
88 if (lp_print_ok(snum)) {
89 share_type |= STYPE_PRINTQ;
93 share_type |= STYPE_DISKTREE;
98 /* This hardcoded value should go into a ldb database! */
99 const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
101 if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
102 return talloc_strdup(mem_ctx, "");
104 return talloc_strdup(mem_ctx, "C:\\");
107 /* This hardcoded value should go into a ldb database! */
108 const char *dcesrv_common_get_share_password(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
113 /* This hardcoded value should go into a ldb database! */
114 uint32_t dcesrv_common_get_share_csc_policy(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
119 /* This hardcoded value should go into a ldb database! */
120 uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
125 /* This hardcoded value should go into a ldb database! */
126 uint32_t dcesrv_common_get_share_unknown(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
131 /* This hardcoded value should go into a ldb database! */
132 struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)