s4:rpc_server/lsa: only return collision_info if filled in lsaRSetForestTrustInformat...
[Samba.git] / lib / param / loadparm.h
blob4d5c54e0d42cd03efbfa54a528fc3c5374422646
1 /*
2 Unix SMB/CIFS implementation.
4 type definitions for loadparm
6 Copyright (C) Karl Auer 1993-1998
8 Largely re-written by Andrew Tridgell, September 1994
10 Copyright (C) Simo Sorce 2001
11 Copyright (C) Alexander Bokovoy 2002
12 Copyright (C) Stefan (metze) Metzmacher 2002
13 Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
14 Copyright (C) James Myers 2003 <myersjj@samba.org>
16 This program is free software; you can redistribute it and/or modify
17 it under the terms of the GNU General Public License as published by
18 the Free Software Foundation; either version 3 of the License, or
19 (at your option) any later version.
21 This program is distributed in the hope that it will be useful,
22 but WITHOUT ANY WARRANTY; without even the implied warranty of
23 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
24 GNU General Public License for more details.
26 You should have received a copy of the GNU General Public License
27 along with this program. If not, see <http://www.gnu.org/licenses/>.
30 #ifndef _LOADPARM_H
31 #define _LOADPARM_H
33 #include <talloc.h>
34 #include "../lib/util/parmlist.h"
36 /* the following are used by loadparm for option lists */
37 typedef enum {
38 P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
39 P_STRING,P_USTRING,P_ENUM,P_BYTES,P_CMDLIST,P_SEP
40 } parm_type;
42 typedef enum {
43 P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
44 } parm_class;
46 struct enum_list {
47 int value;
48 const char *name;
51 struct loadparm_service;
52 struct loadparm_context {
53 const char *szConfigFile;
54 struct loadparm_global *globals;
55 struct loadparm_service **services;
56 struct loadparm_service *sDefault;
57 struct smb_iconv_handle *iconv_handle;
58 int iNumServices;
59 struct loadparm_service *currentService;
60 bool bInGlobalSection;
61 struct file_lists *file_lists;
62 unsigned int *flags;
63 bool loaded;
64 bool refuse_free;
65 bool global; /* Is this the global context, which may set
66 * global variables such as debug level etc? */
67 const struct loadparm_s3_helpers *s3_fns;
70 struct parm_struct {
71 const char *label;
72 parm_type type;
73 parm_class p_class;
74 offset_t offset;
75 bool (*special)(struct loadparm_context *lpcfg_ctx,
76 struct loadparm_service *, const char *, char **);
77 const struct enum_list *enum_list;
78 unsigned flags;
79 union {
80 bool bvalue;
81 int ivalue;
82 char *svalue;
83 char cvalue;
84 char **lvalue;
85 } def;
88 extern struct parm_struct parm_table[];
90 struct file_lists {
91 struct file_lists *next;
92 char *name;
93 char *subfname;
94 time_t modtime;
97 /* The following flags are used in SWAT */
98 #define FLAG_BASIC 0x0001 /* Display only in BASIC view */
99 #define FLAG_SHARE 0x0002 /* file sharing options */
100 #define FLAG_PRINT 0x0004 /* printing options */
101 #define FLAG_GLOBAL 0x0008 /* local options that should be globally settable in SWAT */
102 #define FLAG_WIZARD 0x0010 /* Parameters that the wizard will operate on */
103 #define FLAG_ADVANCED 0x0020 /* Parameters that will be visible in advanced view */
104 #define FLAG_DEVELOPER 0x0040 /* No longer used */
105 #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
106 #define FLAG_HIDE 0x2000 /* options that should be hidden in SWAT */
107 #define FLAG_META 0x8000 /* A meta directive - not a real parameter */
108 #define FLAG_CMDLINE 0x10000 /* option has been overridden */
109 #define FLAG_DEFAULT 0x20000 /* this option was a default */
111 /* This defines the section name in the configuration file that will
112 refer to the special "printers" service */
113 #ifndef PRINTERS_NAME
114 #define PRINTERS_NAME "printers"
115 #endif
117 /* This defines the section name in the configuration file that will
118 refer to the special "homes" service */
119 #ifndef HOMES_NAME
120 #define HOMES_NAME "homes"
121 #endif
123 /* This defines the section name in the configuration file that will contain */
124 /* global parameters - that is, parameters relating to the whole server, not */
125 /* just services. This name is then reserved, and may not be used as a */
126 /* a service name. It will default to "global" if not defined here. */
127 #ifndef GLOBAL_NAME
128 #define GLOBAL_NAME "global"
129 #define GLOBAL_NAME2 "globals"
130 #endif
132 /* The default workgroup - usually overridden in smb.conf */
133 #ifndef DEFAULT_WORKGROUP
134 #define DEFAULT_WORKGROUP "WORKGROUP"
135 #endif
137 /* types of configuration backends for loadparm */
138 #define CONFIG_BACKEND_FILE 0
139 #define CONFIG_BACKEND_REGISTRY 1
142 Do you want session setups at user level security with a invalid
143 password to be rejected or allowed in as guest? WinNT rejects them
144 but it can be a pain as it means "net view" needs to use a password
146 You have 3 choices in the setting of map_to_guest:
148 "NEVER_MAP_TO_GUEST" means session setups with an invalid password
149 are rejected. This is the default.
151 "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password
152 are rejected, unless the username does not exist, in which case it
153 is treated as a guest login
155 "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password
156 are treated as a guest login
158 Note that map_to_guest only has an effect in user or server
159 level security.
162 #define NEVER_MAP_TO_GUEST 0
163 #define MAP_TO_GUEST_ON_BAD_USER 1
164 #define MAP_TO_GUEST_ON_BAD_PASSWORD 2
165 #define MAP_TO_GUEST_ON_BAD_UID 3
168 * This should be under the HAVE_KRB5 flag but since they're used
169 * in lp_kerberos_method(), they ned to be always available
170 * If you add any entries to KERBEROS_VERIFY defines, please modify USE.*KEYTAB macros
171 * so they remain accurate.
174 #define KERBEROS_VERIFY_SECRETS 0
175 #define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
176 #define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
177 #define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
179 /* ACL compatibility */
180 enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
182 /* printing types */
183 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
184 PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ,
185 PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2,PRINT_IPRINT
186 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
187 ,PRINT_TEST,PRINT_VLP
188 #endif /* DEVELOPER */
194 /* ads auth control flags */
195 #define ADS_AUTH_DISABLE_KERBEROS 0x0001
196 #define ADS_AUTH_NO_BIND 0x0002
197 #define ADS_AUTH_ANON_BIND 0x0004
198 #define ADS_AUTH_SIMPLE_BIND 0x0008
199 #define ADS_AUTH_ALLOW_NTLMSSP 0x0010
200 #define ADS_AUTH_SASL_SIGN 0x0020
201 #define ADS_AUTH_SASL_SEAL 0x0040
202 #define ADS_AUTH_SASL_FORCE 0x0080
203 #define ADS_AUTH_USER_CREDS 0x0100
205 /* DNS update settings */
206 enum dns_update_settings {DNS_UPDATE_OFF, DNS_UPDATE_ON, DNS_UPDATE_SIGNED};
208 /* LDAP SSL options */
209 enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};
211 /* LDAP PASSWD SYNC methods */
212 enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
214 /* map readonly options */
215 enum mapreadonly_options {MAP_READONLY_NO, MAP_READONLY_YES, MAP_READONLY_PERMISSIONS};
217 /* case handling */
218 enum case_handling {CASE_LOWER,CASE_UPPER};
221 * Default passwd chat script.
223 #ifndef DEFAULT_PASSWD_CHAT
224 #define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
225 #endif
227 /* Max number of jobs per print queue. */
228 #ifndef PRINT_MAX_JOBID
229 #define PRINT_MAX_JOBID 10000
230 #endif
232 /* the default guest account - allow override via CFLAGS */
233 #ifndef GUEST_ACCOUNT
234 #define GUEST_ACCOUNT "nobody"
235 #endif
237 /* SMB2 defaults */
238 #define DEFAULT_SMB2_MAX_READ (8*1024*1024)
239 #define DEFAULT_SMB2_MAX_WRITE (8*1024*1024)
240 #define DEFAULT_SMB2_MAX_TRANSACT (8*1024*1024)
241 #define DEFAULT_SMB2_MAX_CREDITS 8192
243 #define LOADPARM_EXTRA_LOCALS \
244 bool valid; \
245 int usershare; \
246 struct timespec usershare_last_mod; \
247 int iMaxPrintJobs; \
248 char *szCopy; \
249 char *szService; \
250 char *szInclude; \
251 bool bWidelinks; \
252 bool bAvailable; \
253 struct parmlist_entry *param_opt; \
254 struct bitmap *copymap; \
255 char dummy[3]; /* for alignment */
257 #include "lib/param/param_local.h"
259 #define LOADPARM_EXTRA_GLOBALS \
260 struct parmlist_entry *param_opt; \
261 char *realm_original; \
262 int iminreceivefile; \
263 char *szPrintcapname; \
264 int CupsEncrypt; \
265 int iPreferredMaster; \
266 char *szLdapMachineSuffix; \
267 char *szLdapUserSuffix; \
268 char *szLdapIdmapSuffix; \
269 char *szLdapGroupSuffix; \
270 char *szIdmapUID; \
271 char *szIdmapGID; \
272 char *szIdmapBackend; \
273 int winbindMaxDomainConnections; \
274 int ismb2_max_credits;
276 const char* server_role_str(uint32_t role);
277 int lp_find_server_role(int server_role, int security, int domain_logons, int domain_master);
278 int lp_find_security(int server_role, int security);
279 bool lp_is_security_and_server_role_valid(int server_role, int security);
281 struct loadparm_global * get_globals(void);
282 unsigned int * get_flags(void);
283 char * lp_string(TALLOC_CTX *, const char *);
284 int getservicebyname(const char *, struct loadparm_service *);
285 bool lp_include(struct loadparm_context *, struct loadparm_service *,
286 const char *, char **);
287 bool lp_do_section(const char *pszSectionName, void *userdata);
288 bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
290 int num_parameters(void);
292 #endif /* _LOADPARM_H */