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/ndr_srvsvc.h"
27 Here are common server info functions used by some dcerpc server interfaces
30 /* This hardcoded value should go into a ldb database! */
31 uint32_t dcesrv_common_get_count_of_shares(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
33 /* what's about int -> uint32_t overflow */
34 return lp_numservices();
37 const char *dcesrv_common_get_share_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
39 return talloc_strdup(mem_ctx, lp_servicename(snum));
42 const char *dcesrv_common_get_share_comment(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
44 return talloc_strdup(mem_ctx, lp_comment(snum));
47 /* This hardcoded value should go into a ldb database! */
48 uint32_t dcesrv_common_get_share_permissions(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
53 /* This hardcoded value should go into a ldb database! */
54 uint32_t dcesrv_common_get_share_max_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
56 return lp_max_connections(snum);
59 /* This hardcoded value should go into a ldb database! */
60 uint32_t dcesrv_common_get_share_current_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
65 /* This hardcoded value should go into a ldb database! */
66 uint32_t dcesrv_common_get_share_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
68 /* for disk share 0x00000000
69 * for print share 0x00000001
70 * for IPC$ share 0x00000003
72 * administrative shares:
73 * ADMIN$, IPC$, C$, D$, E$ ... are type |= 0x80000000
74 * this ones are hidden in NetShareEnum, but shown in NetShareEnumAll
76 uint32_t share_type = 0;
78 if (!lp_browseable(snum)) {
79 share_type |= STYPE_HIDDEN;
82 if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
83 share_type |= STYPE_IPC;
87 if (lp_print_ok(snum)) {
88 share_type |= STYPE_PRINTQ;
92 share_type |= STYPE_DISKTREE;
97 /* This hardcoded value should go into a ldb database! */
98 const char *dcesrv_common_get_share_path(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
100 if (strcasecmp(lp_fstype(snum), "IPC") == 0) {
101 return talloc_strdup(mem_ctx, "");
103 return talloc_strdup(mem_ctx, "C:\\");
106 /* This hardcoded value should go into a ldb database! */
107 const char *dcesrv_common_get_share_password(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
112 /* This hardcoded value should go into a ldb database! */
113 uint32_t dcesrv_common_get_share_csc_policy(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
118 /* This hardcoded value should go into a ldb database! */
119 uint32_t dcesrv_common_get_share_dfs_flags(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
124 /* This hardcoded value should go into a ldb database! */
125 uint32_t dcesrv_common_get_share_unknown(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)
130 /* This hardcoded value should go into a ldb database! */
131 struct security_descriptor *dcesrv_common_get_security_descriptor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, int snum)