2 Unix SMB/CIFS implementation.
4 common server 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"
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 _PUBLIC_ enum srvsvc_PlatformId dcesrv_common_get_platform_id(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
34 enum srvsvc_PlatformId id;
36 id = lp_parm_int(-1, "server_info", "platform_id", PLATFORM_ID_NT);
41 _PUBLIC_ const char *dcesrv_common_get_server_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx, const char *server_unc)
43 const char *p = server_unc;
45 /* if there's no string return our NETBIOS name */
47 return talloc_strdup(mem_ctx, lp_netbios_name());
50 /* if there're '\\\\' in front remove them otherwise just pass the string */
51 if (p[0] == '\\' && p[1] == '\\') {
55 return talloc_strdup(mem_ctx, p);
58 const char *dcesrv_common_get_domain_name(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
60 return talloc_strdup(mem_ctx, lp_workgroup());
63 /* This hardcoded value should go into a ldb database! */
64 _PUBLIC_ uint32_t dcesrv_common_get_version_major(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
66 return lp_parm_int(-1, "server_info", "version_major", 5);
69 /* This hardcoded value should go into a ldb database! */
70 _PUBLIC_ uint32_t dcesrv_common_get_version_minor(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
72 return lp_parm_int(-1, "server_info", "version_minor", 2);
75 /* This hardcoded value should go into a ldb database! */
76 _PUBLIC_ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
78 return lp_parm_int(-1, "server_info", "version_build", 3790);
81 /* This hardcoded value should go into a ldb database! */
82 _PUBLIC_ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
84 return lp_default_server_announce();
87 /* This hardcoded value should go into a ldb database! */
88 _PUBLIC_ const char *dcesrv_common_get_lan_root(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
90 return talloc_strdup(mem_ctx, "");
93 /* This hardcoded value should go into a ldb database! */
94 _PUBLIC_ uint32_t dcesrv_common_get_users(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
99 /* This hardcoded value should go into a ldb database! */
100 _PUBLIC_ uint32_t dcesrv_common_get_disc(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
105 /* This hardcoded value should go into a ldb database! */
106 _PUBLIC_ uint32_t dcesrv_common_get_hidden(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
111 /* This hardcoded value should go into a ldb database! */
112 _PUBLIC_ uint32_t dcesrv_common_get_announce(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
117 /* This hardcoded value should go into a ldb database! */
118 _PUBLIC_ uint32_t dcesrv_common_get_anndelta(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
123 /* This hardcoded value should go into a ldb database! */
124 _PUBLIC_ uint32_t dcesrv_common_get_licenses(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
129 /* This hardcoded value should go into a ldb database! */
130 _PUBLIC_ const char *dcesrv_common_get_userpath(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
132 return talloc_strdup(mem_ctx, "c:\\");
135 #define INVALID_SHARE_NAME_CHARS " \"*+,./:;<=>?[\\]|"
137 _PUBLIC_ bool dcesrv_common_validate_share_name(TALLOC_CTX *mem_ctx, const char *share_name)
139 if (strpbrk(share_name, INVALID_SHARE_NAME_CHARS)) {