param: Move LOADPARM_EXTRA_GLOBALS to lib/param/loadparm.h to be shared between loadparms
[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 "../lib/util/parmlist.h"
34
35 /* the following are used by loadparm for option lists */
36 typedef enum {
37         P_BOOL,P_BOOLREV,P_CHAR,P_INTEGER,P_OCTAL,P_LIST,
38         P_STRING,P_USTRING,P_ENUM,P_BYTES,P_CMDLIST,P_SEP
39 } parm_type;
40
41 typedef enum {
42         P_LOCAL,P_GLOBAL,P_SEPARATOR,P_NONE
43 } parm_class;
44
45 struct enum_list {
46         int value;
47         const char *name;
48 };
49
50 struct loadparm_service;
51 struct loadparm_context;
52
53 struct parm_struct {
54         const char *label;
55         parm_type type;
56         parm_class p_class;
57         offset_t offset;
58         bool (*special)(struct loadparm_context *lpcfg_ctx,
59                         int snum, const char *, char **);
60         const struct enum_list *enum_list;
61         unsigned flags;
62         union {
63                 bool bvalue;
64                 int ivalue;
65                 char *svalue;
66                 char cvalue;
67                 char **lvalue;
68         } def;
69 };
70
71 /* The following flags are used in SWAT */
72 #define FLAG_BASIC      0x0001 /* Display only in BASIC view */
73 #define FLAG_SHARE      0x0002 /* file sharing options */
74 #define FLAG_PRINT      0x0004 /* printing options */
75 #define FLAG_GLOBAL     0x0008 /* local options that should be globally settable in SWAT */
76 #define FLAG_WIZARD     0x0010 /* Parameters that the wizard will operate on */
77 #define FLAG_ADVANCED   0x0020 /* Parameters that will be visible in advanced view */
78 #define FLAG_DEVELOPER  0x0040 /* No longer used */
79 #define FLAG_DEPRECATED 0x1000 /* options that should no longer be used */
80 #define FLAG_HIDE       0x2000 /* options that should be hidden in SWAT */
81 #define FLAG_META       0x8000 /* A meta directive - not a real parameter */
82 #define FLAG_CMDLINE    0x10000 /* option has been overridden */
83 #define FLAG_DEFAULT    0x20000 /* this option was a default */
84
85 /* This defines the section name in the configuration file that will
86    refer to the special "printers" service */
87 #ifndef PRINTERS_NAME
88 #define PRINTERS_NAME "printers"
89 #endif
90
91 /* This defines the section name in the configuration file that will
92    refer to the special "homes" service */
93 #ifndef HOMES_NAME
94 #define HOMES_NAME "homes"
95 #endif
96
97 /* This defines the section name in the configuration file that will contain */
98 /* global parameters - that is, parameters relating to the whole server, not */
99 /* just services. This name is then reserved, and may not be used as a       */
100 /* a service name. It will default to "global" if not defined here.          */
101 #ifndef GLOBAL_NAME
102 #define GLOBAL_NAME "global"
103 #define GLOBAL_NAME2 "globals"
104 #endif
105
106 /* The default workgroup - usually overridden in smb.conf */
107 #ifndef DEFAULT_WORKGROUP
108 #define DEFAULT_WORKGROUP "WORKGROUP"
109 #endif
110
111 /* types of configuration backends for loadparm */
112 #define CONFIG_BACKEND_FILE 0
113 #define CONFIG_BACKEND_REGISTRY 1
114
115 /*
116    Do you want session setups at user level security with a invalid
117    password to be rejected or allowed in as guest? WinNT rejects them
118    but it can be a pain as it means "net view" needs to use a password
119
120    You have 3 choices in the setting of map_to_guest:
121
122    "NEVER_MAP_TO_GUEST" means session setups with an invalid password
123    are rejected. This is the default.
124
125    "MAP_TO_GUEST_ON_BAD_USER" means session setups with an invalid password
126    are rejected, unless the username does not exist, in which case it
127    is treated as a guest login
128
129    "MAP_TO_GUEST_ON_BAD_PASSWORD" means session setups with an invalid password
130    are treated as a guest login
131
132    Note that map_to_guest only has an effect in user or server
133    level security.
134 */
135
136 #define NEVER_MAP_TO_GUEST              0
137 #define MAP_TO_GUEST_ON_BAD_USER        1
138 #define MAP_TO_GUEST_ON_BAD_PASSWORD    2
139 #define MAP_TO_GUEST_ON_BAD_UID         3
140
141 /*
142  * This should be under the HAVE_KRB5 flag but since they're used
143  * in lp_kerberos_method(), they ned to be always available
144  * If you add any entries to KERBEROS_VERIFY defines, please modify USE.*KEYTAB macros
145  * so they remain accurate.
146  */
147
148 #define KERBEROS_VERIFY_SECRETS 0
149 #define KERBEROS_VERIFY_SYSTEM_KEYTAB 1
150 #define KERBEROS_VERIFY_DEDICATED_KEYTAB 2
151 #define KERBEROS_VERIFY_SECRETS_AND_KEYTAB 3
152
153 /* ACL compatibility */
154 enum acl_compatibility {ACL_COMPAT_AUTO, ACL_COMPAT_WINNT, ACL_COMPAT_WIN2K};
155
156 /* printing types */
157 enum printing_types {PRINT_BSD,PRINT_SYSV,PRINT_AIX,PRINT_HPUX,
158                      PRINT_QNX,PRINT_PLP,PRINT_LPRNG,PRINT_SOFTQ,
159                      PRINT_CUPS,PRINT_LPRNT,PRINT_LPROS2,PRINT_IPRINT
160 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
161 ,PRINT_TEST,PRINT_VLP
162 #endif /* DEVELOPER */
163 };
164
165
166
167
168 /* ads auth control flags */
169 #define ADS_AUTH_DISABLE_KERBEROS 0x0001
170 #define ADS_AUTH_NO_BIND          0x0002
171 #define ADS_AUTH_ANON_BIND        0x0004
172 #define ADS_AUTH_SIMPLE_BIND      0x0008
173 #define ADS_AUTH_ALLOW_NTLMSSP    0x0010
174 #define ADS_AUTH_SASL_SIGN        0x0020
175 #define ADS_AUTH_SASL_SEAL        0x0040
176 #define ADS_AUTH_SASL_FORCE       0x0080
177 #define ADS_AUTH_USER_CREDS       0x0100
178
179 /* DNS update settings */
180 enum dns_update_settings {DNS_UPDATE_OFF, DNS_UPDATE_ON, DNS_UPDATE_SIGNED};
181
182 /* LDAP SSL options */
183 enum ldap_ssl_types {LDAP_SSL_OFF, LDAP_SSL_START_TLS};
184
185 /* LDAP PASSWD SYNC methods */
186 enum ldap_passwd_sync_types {LDAP_PASSWD_SYNC_ON, LDAP_PASSWD_SYNC_OFF, LDAP_PASSWD_SYNC_ONLY};
187
188 /* map readonly options */
189 enum mapreadonly_options {MAP_READONLY_NO, MAP_READONLY_YES, MAP_READONLY_PERMISSIONS};
190
191 /* case handling */
192 enum case_handling {CASE_LOWER,CASE_UPPER};
193
194 /*
195  * Default passwd chat script.
196  */
197 #ifndef DEFAULT_PASSWD_CHAT
198 #define DEFAULT_PASSWD_CHAT "*new*password* %n\\n *new*password* %n\\n *changed*"
199 #endif
200
201 /* Max number of jobs per print queue. */
202 #ifndef PRINT_MAX_JOBID
203 #define PRINT_MAX_JOBID 10000
204 #endif
205
206 /* the default guest account - allow override via CFLAGS */
207 #ifndef GUEST_ACCOUNT
208 #define GUEST_ACCOUNT "nobody"
209 #endif
210
211 /* SMB2 defaults */
212 #define DEFAULT_SMB2_MAX_READ (1024*1024)
213 #define DEFAULT_SMB2_MAX_WRITE (1024*1024)
214 #define DEFAULT_SMB2_MAX_TRANSACT (1024*1024)
215 #define DEFAULT_SMB2_MAX_CREDITS 8192
216
217 #define LOADPARM_EXTRA_LOCALS                                           \
218         bool valid;                                                     \
219         int usershare;                                                  \
220         struct timespec usershare_last_mod;                             \
221         int iMaxPrintJobs;                                              \
222         char *szCopy;                                                   \
223         char *szService;                                                \
224         char *szInclude;                                                \
225         bool bWidelinks;                                                \
226         bool bAvailable;                                                        \
227         struct parmlist_entry *param_opt;                               \
228         struct bitmap *copymap;                                         \
229         char dummy[3];          /* for alignment */
230
231 #include "lib/param/param_local.h"
232
233 #define LOADPARM_EXTRA_GLOBALS \
234         struct parmlist_entry *param_opt;                               \
235         char *realm_original;                                           \
236         int iminreceivefile;                                            \
237         char *szPrintcapname;                                           \
238         int CupsEncrypt;                                                \
239         int  iPreferredMaster;                                          \
240         char *szLdapMachineSuffix;                                      \
241         char *szLdapUserSuffix;                                         \
242         char *szLdapIdmapSuffix;                                        \
243         char *szLdapGroupSuffix;                                        \
244         char *szIdmapUID;                                               \
245         char *szIdmapGID;                                               \
246         char *szIdmapBackend;                                           \
247         int winbindMaxDomainConnections;                                \
248         int ismb2_max_credits;
249
250 const char* server_role_str(uint32_t role);
251 int lp_find_server_role(int server_role, int security, int domain_logons, int domain_master);
252 int lp_find_security(int server_role, int security);
253 bool lp_is_security_and_server_role_valid(int server_role, int security);
254
255 /**
256  * Check if two parameters are equal.
257  */
258
259 bool lpcfg_equal_parameter(parm_type type, void *ptr1, void *ptr2);
260
261 #endif /* _LOADPARM_H */