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