param: rename bWidelinks -> wide_links
[sfrench/samba-autobuild/.git] / lib / param / loadparm.h
1 /*
2    Unix SMB/CIFS implementation.
3
4    type definitions for loadparm
5
6    Copyright (C) Karl Auer 1993-1998
7
8    Largely re-written by Andrew Tridgell, September 1994
9
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>
15
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.
20
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.
25
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/>.
28 */
29
30 #ifndef _LOADPARM_H
31 #define _LOADPARM_H
32
33 #include <talloc.h>
34 #include "../lib/util/parmlist.h"
35
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
40 } parm_type;
41
42 typedef enum {
43         P_LOCAL,P_GLOBAL,P_NONE
44 } parm_class;
45
46 struct enum_list {
47         int value;
48         const char *name;
49 };
50
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;
68 };
69
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;
86 };
87
88 extern struct parm_struct parm_table[];
89
90 struct file_lists {
91         struct file_lists *next;
92         char *name;
93         char *subfname;
94         time_t modtime;
95 };
96
97 #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
98 #define FLAG_SYNONYM    0x2000 /* options that is a synonym of another option */
99 #define FLAG_CMDLINE    0x10000 /* option has been overridden */
100 #define FLAG_DEFAULT    0x20000 /* this option was a default */
101
102 /* This defines the section name in the configuration file that will
103    refer to the special "printers" service */
104 #ifndef PRINTERS_NAME
105 #define PRINTERS_NAME "printers"
106 #endif
107
108 /* This defines the section name in the configuration file that will
109    refer to the special "homes" service */
110 #ifndef HOMES_NAME
111 #define HOMES_NAME "homes"
112 #endif
113
114 /* This defines the section name in the configuration file that will contain */
115 /* global parameters - that is, parameters relating to the whole server, not */
116 /* just services. This name is then reserved, and may not be used as a       */
117 /* a service name. It will default to "global" if not defined here.          */
118 #ifndef GLOBAL_NAME
119 #define GLOBAL_NAME "global"
120 #define GLOBAL_NAME2 "globals"
121 #endif
122
123 /* The default workgroup - usually overridden in smb.conf */
124 #ifndef DEFAULT_WORKGROUP
125 #define DEFAULT_WORKGROUP "WORKGROUP"
126 #endif
127
128 /* types of configuration backends for loadparm */
129 #define CONFIG_BACKEND_FILE 0
130 #define CONFIG_BACKEND_REGISTRY 1
131
132 /*
133    Do you want session setups at user level security with a invalid
134    password to be rejected or allowed in as guest? WinNT rejects them
135    but it can be a pain as it means "net view" needs to use a password
136
137    You have 3 choices in the setting of map_to_guest:
138
139    "NEVER_MAP_TO_GUEST" means session setups with an invalid password
140    are rejected. This is the default.
141
142    "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password
143    are rejected, unless the username does not exist, in which case it
144    is treated as a guest login
145
146    "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password
147    are treated as a guest login
148
149    Note that map_to_guest only has an effect in user or server
150    level security.
151 */
152
153 #define NEVER_MAP_TO_GUEST              0
154 #define MAP_TO_GUEST_ON_BAD_USER        1
155 #define MAP_TO_GUEST_ON_BAD_PASSWORD    2
156 #define MAP_TO_GUEST_ON_BAD_UID         3
157
158 /*
159  * This should be under the HAVE_KRB5 flag but since they're used
160  * in lp_kerberos_method(), they ned to be always available
161  * If you add any entries to KERBEROS_VERIFY defines, please modify USE.*KEYTAB macros
162  * so they remain accurate.
163  */
164
165 #define KERBEROS_VERIFY_SECRETS 0
166 #define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
167 #define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
168 #define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
169
170 /* ACL compatibility */
171 enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
172
173 /* printing types */
174 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
175                      PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ,
176                      PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2,PRINT_IPRINT
177 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
178 ,PRINT_TEST,PRINT_VLP
179 #endif /* DEVELOPER */
180 };
181
182
183
184
185 /* ads auth control flags */
186 #define ADS_AUTH_DISABLE_KERBEROS 0x0001
187 #define ADS_AUTH_NO_BIND          0x0002
188 #define ADS_AUTH_ANON_BIND        0x0004
189 #define ADS_AUTH_SIMPLE_BIND      0x0008
190 #define ADS_AUTH_ALLOW_NTLMSSP    0x0010
191 #define ADS_AUTH_SASL_SIGN        0x0020
192 #define ADS_AUTH_SASL_SEAL        0x0040
193 #define ADS_AUTH_SASL_FORCE       0x0080
194 #define ADS_AUTH_USER_CREDS       0x0100
195
196 /* DNS update settings */
197 enum dns_update_settings {DNS_UPDATE_OFF, DNS_UPDATE_ON, DNS_UPDATE_SIGNED};
198
199 /* LDAP SSL options */
200 enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};
201
202 /* LDAP PASSWD SYNC methods */
203 enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
204
205 /* map readonly options */
206 enum mapreadonly_options {MAP_READONLY_NO, MAP_READONLY_YES, MAP_READONLY_PERMISSIONS};
207
208 /* case handling */
209 enum case_handling {CASE_LOWER,CASE_UPPER};
210
211 /*
212  * Default passwd chat script.
213  */
214 #ifndef DEFAULT_PASSWD_CHAT
215 #define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
216 #endif
217
218 /* Max number of jobs per print queue. */
219 #ifndef PRINT_MAX_JOBID
220 #define PRINT_MAX_JOBID 10000
221 #endif
222
223 /* the default guest account - allow override via CFLAGS */
224 #ifndef GUEST_ACCOUNT
225 #define GUEST_ACCOUNT "nobody"
226 #endif
227
228 /* SMB2 defaults */
229 #define DEFAULT_SMB2_MAX_READ (8*1024*1024)
230 #define DEFAULT_SMB2_MAX_WRITE (8*1024*1024)
231 #define DEFAULT_SMB2_MAX_TRANSACT (8*1024*1024)
232 #define DEFAULT_SMB2_MAX_CREDITS 8192
233
234 #define LOADPARM_EXTRA_LOCALS                                           \
235         bool valid;                                                     \
236         int usershare;                                                  \
237         struct timespec usershare_last_mod;                             \
238         char *szCopy;                                                   \
239         char *szService;                                                \
240         char *szInclude;                                                \
241         bool wide_links;                                                \
242         bool bAvailable;                                                        \
243         struct parmlist_entry *param_opt;                               \
244         struct bitmap *copymap;                                         \
245         char dummy[3];          /* for alignment */
246
247 #include "lib/param/param_local.h"
248
249 #define LOADPARM_EXTRA_GLOBALS \
250         struct parmlist_entry *param_opt;                               \
251         char *realm_original;                                           \
252         int CupsEncrypt;                                                \
253         char *szIdmapUID;                                               \
254         char *szIdmapGID;                                               \
255         char *szIdmapBackend;                                           \
256         int winbindMaxDomainConnections;
257
258 const char* server_role_str(uint32_t role);
259 int lp_find_server_role(int server_role, int security, int domain_logons, int domain_master);
260 int lp_find_security(int server_role, int security);
261 bool lp_is_security_and_server_role_valid(int server_role, int security);
262
263 struct loadparm_global * get_globals(void);
264 unsigned int * get_flags(void);
265 char * lp_string(TALLOC_CTX *, const char *);
266 int getservicebyname(const char *, struct loadparm_service *);
267 bool lp_include(struct loadparm_context *, struct loadparm_service *,
268                 const char *, char **);
269 bool lp_do_section(const char *pszSectionName, void *userdata);
270 bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue);
271
272 int num_parameters(void);
273
274 #endif /* _LOADPARM_H */