lib/param: Merge "Printing Options" section from source3/param
[Samba/gebeck_regimport.git] / lib / param / loadparm.c
blob14fcdbf0498b3e4dcab27b499d05fd0c87afaf90
1 /*
2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
6 Largely re-written by Andrew Tridgell, September 1994
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough (jmcd@us.ibm.com) 2003.
12 Copyright (C) James Myers 2003 <myersjj@samba.org>
13 Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
14 Copyright (C) Andrew Bartlett 2011-2012
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/>.
31 * Load parameters.
33 * This module provides suitable callback functions for the params
34 * module. It builds the internal table of service details which is
35 * then used by the rest of the server.
37 * To add a parameter:
39 * 1) add it to the global or service structure definition
40 * 2) add it to the parm_table
41 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
42 * 4) If it's a global then initialise it in init_globals. If a local
43 * (ie. service) parameter then initialise it in the sDefault structure
46 * Notes:
47 * The configuration file is processed sequentially for speed. It is NOT
48 * accessed randomly as happens in 'real' Windows. For this reason, there
49 * is a fair bit of sequence-dependent code here - ie., code which assumes
50 * that certain things happen before others. In particular, the code which
51 * happens at the boundary between sections is delicately poised, so be
52 * careful!
56 #include "includes.h"
57 #include "version.h"
58 #include "dynconfig/dynconfig.h"
59 #include "system/time.h"
60 #include "system/locale.h"
61 #include "system/network.h" /* needed for TCP_NODELAY */
62 #include "../lib/util/dlinklist.h"
63 #include "lib/param/param.h"
64 #include "lib/param/loadparm.h"
65 #include "auth/gensec/gensec.h"
66 #include "lib/param/s3_param.h"
67 #include "lib/util/bitmap.h"
68 #include "libcli/smb/smb_constants.h"
69 #include "source4/dns_server/dns_update.h"
71 #define standard_sub_basic talloc_strdup
73 static bool do_parameter(const char *, const char *, void *);
74 static bool defaults_saved = false;
76 #define LOADPARM_EXTRA_GLOBALS \
77 struct parmlist_entry *param_opt; \
78 char *szRealm; \
79 char *szConfigFile; \
80 char *szPrintcapname; \
81 int CupsEncrypt; \
82 int iPreferredMaster; \
83 char *szLdapMachineSuffix; \
84 char *szLdapUserSuffix; \
85 char *szLdapIdmapSuffix; \
86 char *szLdapGroupSuffix; \
87 char *szUsershareTemplateShare; \
88 char *szIdmapUID; \
89 char *szIdmapGID; \
90 int winbindMaxDomainConnections; \
91 char *tls_keyfile; \
92 char *tls_certfile; \
93 char *tls_cafile; \
94 char *tls_crlfile; \
95 char *tls_dhpfile; \
96 char *loglevel; \
97 char *panic_action;
99 #include "lib/param/param_global.h"
101 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
103 /* we don't need a special handler for "dos charset" and "unix charset" */
104 #define handle_dos_charset NULL
105 #define handle_charset NULL
107 /* these are parameter handlers which are not needed in the
108 * non-source3 code
110 #define handle_netbios_aliases NULL
111 #define handle_debug_list NULL
112 #define handle_printing NULL
113 #define handle_ldap_debug_level NULL
114 #define handle_idmap_backend NULL
115 #define handle_idmap_uid NULL
116 #define handle_idmap_gid NULL
118 #ifndef N_
119 #define N_(x) x
120 #endif
122 /* prototypes for the special type handlers */
123 static bool handle_include(struct loadparm_context *lp_ctx, int unused,
124 const char *pszParmValue, char **ptr);
125 static bool handle_realm(struct loadparm_context *lp_ctx, int unused,
126 const char *pszParmValue, char **ptr);
127 static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
128 const char *pszParmValue, char **ptr);
129 static bool handle_debuglevel(struct loadparm_context *lp_ctx, int unused,
130 const char *pszParmValue, char **ptr);
131 static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
132 const char *pszParmValue, char **ptr);
134 #include "lib/param/param_table.c"
136 #define GLOBAL_VAR(name) offsetof(struct loadparm_global, name)
137 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
139 static struct parm_struct parm_table[] = {
141 .label = "server role",
142 .type = P_ENUM,
143 .p_class = P_GLOBAL,
144 .offset = GLOBAL_VAR(server_role),
145 .special = NULL,
146 .enum_list = enum_server_role
149 .label = "dos charset",
150 .type = P_STRING,
151 .p_class = P_GLOBAL,
152 .offset = GLOBAL_VAR(dos_charset),
153 .special = NULL,
154 .enum_list = NULL
157 .label = "unix charset",
158 .type = P_STRING,
159 .p_class = P_GLOBAL,
160 .offset = GLOBAL_VAR(unix_charset),
161 .special = NULL,
162 .enum_list = NULL
165 .label = "comment",
166 .type = P_STRING,
167 .p_class = P_LOCAL,
168 .offset = LOCAL_VAR(comment),
169 .special = NULL,
170 .enum_list = NULL,
171 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
174 .label = "path",
175 .type = P_STRING,
176 .p_class = P_LOCAL,
177 .offset = LOCAL_VAR(szPath),
178 .special = NULL,
179 .enum_list = NULL,
180 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
183 .label = "directory",
184 .type = P_STRING,
185 .p_class = P_LOCAL,
186 .offset = LOCAL_VAR(szPath),
187 .special = NULL,
188 .enum_list = NULL,
189 .flags = FLAG_HIDE,
192 .label = "workgroup",
193 .type = P_USTRING,
194 .p_class = P_GLOBAL,
195 .offset = GLOBAL_VAR(szWorkgroup),
196 .special = NULL,
197 .enum_list = NULL,
198 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
201 .label = "realm",
202 .type = P_STRING,
203 .p_class = P_GLOBAL,
204 .offset = GLOBAL_VAR(szRealm),
205 .special = handle_realm,
206 .enum_list = NULL,
207 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
210 .label = "netbios name",
211 .type = P_USTRING,
212 .p_class = P_GLOBAL,
213 .offset = GLOBAL_VAR(szNetbiosName),
214 .special = NULL,
215 .enum_list = NULL,
216 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
219 .label = "netbios aliases",
220 .type = P_LIST,
221 .p_class = P_GLOBAL,
222 .offset = GLOBAL_VAR(szNetbiosAliases),
223 .special = NULL,
224 .enum_list = NULL
227 .label = "netbios scope",
228 .type = P_USTRING,
229 .p_class = P_GLOBAL,
230 .offset = GLOBAL_VAR(szNetbiosScope),
231 .special = NULL,
232 .enum_list = NULL,
233 .flags = FLAG_ADVANCED,
236 .label = "server string",
237 .type = P_STRING,
238 .p_class = P_GLOBAL,
239 .offset = GLOBAL_VAR(szServerString),
240 .special = NULL,
241 .enum_list = NULL,
242 .flags = FLAG_BASIC | FLAG_ADVANCED,
245 .label = "interfaces",
246 .type = P_LIST,
247 .p_class = P_GLOBAL,
248 .offset = GLOBAL_VAR(szInterfaces),
249 .special = NULL,
250 .enum_list = NULL,
251 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
254 .label = "bind interfaces only",
255 .type = P_BOOL,
256 .p_class = P_GLOBAL,
257 .offset = GLOBAL_VAR(bBindInterfacesOnly),
258 .special = NULL,
259 .enum_list = NULL,
260 .flags = FLAG_ADVANCED | FLAG_WIZARD,
263 .label = "passdb backend",
264 .type = P_STRING,
265 .p_class = P_GLOBAL,
266 .offset = GLOBAL_VAR(passdb_backend),
267 .special = NULL,
268 .enum_list = NULL
272 .label = "security",
273 .type = P_ENUM,
274 .p_class = P_GLOBAL,
275 .offset = GLOBAL_VAR(security),
276 .special = NULL,
277 .enum_list = enum_security
280 .label = "encrypt passwords",
281 .type = P_BOOL,
282 .p_class = P_GLOBAL,
283 .offset = GLOBAL_VAR(bEncryptPasswords),
284 .special = NULL,
285 .enum_list = NULL
288 .label = "null passwords",
289 .type = P_BOOL,
290 .p_class = P_GLOBAL,
291 .offset = GLOBAL_VAR(bNullPasswords),
292 .special = NULL,
293 .enum_list = NULL,
294 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
297 .label = "obey pam restrictions",
298 .type = P_BOOL,
299 .p_class = P_GLOBAL,
300 .offset = GLOBAL_VAR(bObeyPamRestrictions),
301 .special = NULL,
302 .enum_list = NULL,
303 .flags = FLAG_ADVANCED,
306 .label = "password server",
307 .type = P_STRING,
308 .p_class = P_GLOBAL,
309 .offset = GLOBAL_VAR(szPasswordServer),
310 .special = NULL,
311 .enum_list = NULL
314 .label = "private dir",
315 .type = P_STRING,
316 .p_class = P_GLOBAL,
317 .offset = GLOBAL_VAR(szPrivateDir),
318 .special = NULL,
319 .enum_list = NULL
322 .label = "passwd chat",
323 .type = P_STRING,
324 .p_class = P_GLOBAL,
325 .offset = GLOBAL_VAR(szPasswdChat),
326 .special = NULL,
327 .enum_list = NULL
330 .label = "password level",
331 .type = P_INTEGER,
332 .p_class = P_GLOBAL,
333 .offset = GLOBAL_VAR(pwordlevel),
334 .special = NULL,
335 .enum_list = NULL
338 .label = "lanman auth",
339 .type = P_BOOL,
340 .p_class = P_GLOBAL,
341 .offset = GLOBAL_VAR(bLanmanAuth),
342 .special = NULL,
343 .enum_list = NULL,
344 .flags = FLAG_ADVANCED,
347 .label = "ntlm auth",
348 .type = P_BOOL,
349 .p_class = P_GLOBAL,
350 .offset = GLOBAL_VAR(bNTLMAuth),
351 .special = NULL,
352 .enum_list = NULL,
353 .flags = FLAG_ADVANCED,
356 .label = "client NTLMv2 auth",
357 .type = P_BOOL,
358 .p_class = P_GLOBAL,
359 .offset = GLOBAL_VAR(bClientNTLMv2Auth),
360 .special = NULL,
361 .enum_list = NULL,
362 .flags = FLAG_ADVANCED,
365 .label = "client lanman auth",
366 .type = P_BOOL,
367 .p_class = P_GLOBAL,
368 .offset = GLOBAL_VAR(bClientLanManAuth),
369 .special = NULL,
370 .enum_list = NULL,
371 .flags = FLAG_ADVANCED,
374 .label = "client plaintext auth",
375 .type = P_BOOL,
376 .p_class = P_GLOBAL,
377 .offset = GLOBAL_VAR(bClientPlaintextAuth),
378 .special = NULL,
379 .enum_list = NULL,
380 .flags = FLAG_ADVANCED,
383 .label = "client use spnego principal",
384 .type = P_BOOL,
385 .p_class = P_GLOBAL,
386 .offset = GLOBAL_VAR(client_use_spnego_principal),
387 .special = NULL,
388 .enum_list = NULL
392 .label = "read only",
393 .type = P_BOOL,
394 .p_class = P_LOCAL,
395 .offset = LOCAL_VAR(bRead_only),
396 .special = NULL,
397 .enum_list = NULL
401 .label = "create mask",
402 .type = P_OCTAL,
403 .p_class = P_LOCAL,
404 .offset = LOCAL_VAR(iCreate_mask),
405 .special = NULL,
406 .enum_list = NULL
409 .label = "force create mode",
410 .type = P_OCTAL,
411 .p_class = P_LOCAL,
412 .offset = LOCAL_VAR(iCreate_force_mode),
413 .special = NULL,
414 .enum_list = NULL
417 .label = "directory mask",
418 .type = P_OCTAL,
419 .p_class = P_LOCAL,
420 .offset = LOCAL_VAR(iDir_mask),
421 .special = NULL,
422 .enum_list = NULL
425 .label = "force directory mode",
426 .type = P_OCTAL,
427 .p_class = P_LOCAL,
428 .offset = LOCAL_VAR(iDir_force_mode),
429 .special = NULL,
430 .enum_list = NULL
434 .label = "hosts allow",
435 .type = P_LIST,
436 .p_class = P_LOCAL,
437 .offset = LOCAL_VAR(szHostsallow),
438 .special = NULL,
439 .enum_list = NULL
442 .label = "hosts deny",
443 .type = P_LIST,
444 .p_class = P_LOCAL,
445 .offset = LOCAL_VAR(szHostsdeny),
446 .special = NULL,
447 .enum_list = NULL
451 .label = "log level",
452 .type = P_STRING,
453 .p_class = P_GLOBAL,
454 .offset = GLOBAL_VAR(loglevel),
455 .special = handle_debuglevel,
456 .enum_list = NULL
459 .label = "debuglevel",
460 .type = P_STRING,
461 .p_class = P_GLOBAL,
462 .offset = GLOBAL_VAR(loglevel),
463 .special = handle_debuglevel,
464 .enum_list = NULL
467 .label = "log file",
468 .type = P_STRING,
469 .p_class = P_GLOBAL,
470 .offset = GLOBAL_VAR(logfile),
471 .special = handle_logfile,
472 .enum_list = NULL,
473 .flags = FLAG_ADVANCED,
477 .label = "smb ports",
478 .type = P_LIST,
479 .p_class = P_GLOBAL,
480 .offset = GLOBAL_VAR(smb_ports),
481 .special = NULL,
482 .enum_list = NULL
485 .label = "nbt port",
486 .type = P_INTEGER,
487 .p_class = P_GLOBAL,
488 .offset = GLOBAL_VAR(nbt_port),
489 .special = NULL,
490 .enum_list = NULL
493 .label = "dgram port",
494 .type = P_INTEGER,
495 .p_class = P_GLOBAL,
496 .offset = GLOBAL_VAR(dgram_port),
497 .special = NULL,
498 .enum_list = NULL
501 .label = "cldap port",
502 .type = P_INTEGER,
503 .p_class = P_GLOBAL,
504 .offset = GLOBAL_VAR(cldap_port),
505 .special = NULL,
506 .enum_list = NULL
509 .label = "krb5 port",
510 .type = P_INTEGER,
511 .p_class = P_GLOBAL,
512 .offset = GLOBAL_VAR(krb5_port),
513 .special = NULL,
514 .enum_list = NULL
517 .label = "kpasswd port",
518 .type = P_INTEGER,
519 .p_class = P_GLOBAL,
520 .offset = GLOBAL_VAR(kpasswd_port),
521 .special = NULL,
522 .enum_list = NULL
525 .label = "web port",
526 .type = P_INTEGER,
527 .p_class = P_GLOBAL,
528 .offset = GLOBAL_VAR(web_port),
529 .special = NULL,
530 .enum_list = NULL
533 .label = "large readwrite",
534 .type = P_BOOL,
535 .p_class = P_GLOBAL,
536 .offset = GLOBAL_VAR(bLargeReadwrite),
537 .special = NULL,
538 .enum_list = NULL,
539 .flags = FLAG_ADVANCED,
542 .label = "server max protocol",
543 .type = P_ENUM,
544 .p_class = P_GLOBAL,
545 .offset = GLOBAL_VAR(srv_maxprotocol),
546 .special = NULL,
547 .enum_list = enum_protocol,
548 .flags = FLAG_ADVANCED,
551 .label = "max protocol",
552 .type = P_ENUM,
553 .p_class = P_GLOBAL,
554 .offset = GLOBAL_VAR(srv_maxprotocol),
555 .special = NULL,
556 .enum_list = enum_protocol,
557 .flags = FLAG_ADVANCED,
560 .label = "protocol",
561 .type = P_ENUM,
562 .p_class = P_GLOBAL,
563 .offset = GLOBAL_VAR(srv_maxprotocol),
564 .special = NULL,
565 .enum_list = enum_protocol,
566 .flags = FLAG_ADVANCED,
569 .label = "server min protocol",
570 .type = P_ENUM,
571 .p_class = P_GLOBAL,
572 .offset = GLOBAL_VAR(srv_minprotocol),
573 .special = NULL,
574 .enum_list = enum_protocol,
575 .flags = FLAG_ADVANCED,
578 .label = "min protocol",
579 .type = P_ENUM,
580 .p_class = P_GLOBAL,
581 .offset = GLOBAL_VAR(srv_minprotocol),
582 .special = NULL,
583 .enum_list = enum_protocol,
584 .flags = FLAG_ADVANCED,
587 .label = "client max protocol",
588 .type = P_ENUM,
589 .p_class = P_GLOBAL,
590 .offset = GLOBAL_VAR(cli_maxprotocol),
591 .special = NULL,
592 .enum_list = enum_protocol
595 .label = "client min protocol",
596 .type = P_ENUM,
597 .p_class = P_GLOBAL,
598 .offset = GLOBAL_VAR(cli_minprotocol),
599 .special = NULL,
600 .enum_list = enum_protocol
603 .label = "unicode",
604 .type = P_BOOL,
605 .p_class = P_GLOBAL,
606 .offset = GLOBAL_VAR(bUnicode),
607 .special = NULL,
608 .enum_list = NULL
611 .label = "read raw",
612 .type = P_BOOL,
613 .p_class = P_GLOBAL,
614 .offset = GLOBAL_VAR(bReadRaw),
615 .special = NULL,
616 .enum_list = NULL
619 .label = "write raw",
620 .type = P_BOOL,
621 .p_class = P_GLOBAL,
622 .offset = GLOBAL_VAR(bWriteRaw),
623 .special = NULL,
624 .enum_list = NULL
627 .label = "disable netbios",
628 .type = P_BOOL,
629 .p_class = P_GLOBAL,
630 .offset = GLOBAL_VAR(bDisableNetbios),
631 .special = NULL,
632 .enum_list = NULL
636 .label = "nt status support",
637 .type = P_BOOL,
638 .p_class = P_GLOBAL,
639 .offset = GLOBAL_VAR(bNTStatusSupport),
640 .special = NULL,
641 .enum_list = NULL
645 .label = "max mux",
646 .type = P_INTEGER,
647 .p_class = P_GLOBAL,
648 .offset = GLOBAL_VAR(max_mux),
649 .special = NULL,
650 .enum_list = NULL,
651 .flags = FLAG_ADVANCED,
654 .label = "max xmit",
655 .type = P_BYTES,
656 .p_class = P_GLOBAL,
657 .offset = GLOBAL_VAR(max_xmit),
658 .special = NULL,
659 .enum_list = NULL,
660 .flags = FLAG_ADVANCED,
664 .label = "name resolve order",
665 .type = P_LIST,
666 .p_class = P_GLOBAL,
667 .offset = GLOBAL_VAR(szNameResolveOrder),
668 .special = NULL,
669 .enum_list = NULL
672 .label = "max wins ttl",
673 .type = P_INTEGER,
674 .p_class = P_GLOBAL,
675 .offset = GLOBAL_VAR(max_wins_ttl),
676 .special = NULL,
677 .enum_list = NULL,
678 .flags = FLAG_ADVANCED,
681 .label = "min wins ttl",
682 .type = P_INTEGER,
683 .p_class = P_GLOBAL,
684 .offset = GLOBAL_VAR(min_wins_ttl),
685 .special = NULL,
686 .enum_list = NULL,
687 .flags = FLAG_ADVANCED,
690 .label = "time server",
691 .type = P_BOOL,
692 .p_class = P_GLOBAL,
693 .offset = GLOBAL_VAR(bTimeServer),
694 .special = NULL,
695 .enum_list = NULL,
696 .flags = FLAG_ADVANCED,
699 .label = "unix extensions",
700 .type = P_BOOL,
701 .p_class = P_GLOBAL,
702 .offset = GLOBAL_VAR(bUnixExtensions),
703 .special = NULL,
704 .enum_list = NULL,
705 .flags = FLAG_ADVANCED,
708 .label = "use spnego",
709 .type = P_BOOL,
710 .p_class = P_GLOBAL,
711 .offset = GLOBAL_VAR(bUseSpnego),
712 .special = NULL,
713 .enum_list = NULL
716 .label = "server signing",
717 .type = P_ENUM,
718 .p_class = P_GLOBAL,
719 .offset = GLOBAL_VAR(server_signing),
720 .special = NULL,
721 .enum_list = enum_smb_signing_vals,
722 .flags = FLAG_ADVANCED,
725 .label = "client signing",
726 .type = P_ENUM,
727 .p_class = P_GLOBAL,
728 .offset = GLOBAL_VAR(client_signing),
729 .special = NULL,
730 .enum_list = enum_smb_signing_vals
733 .label = "rpc big endian",
734 .type = P_BOOL,
735 .p_class = P_GLOBAL,
736 .offset = GLOBAL_VAR(bRpcBigEndian),
737 .special = NULL,
738 .enum_list = NULL
742 .label = "max connections",
743 .type = P_INTEGER,
744 .p_class = P_LOCAL,
745 .offset = LOCAL_VAR(iMaxConnections),
746 .special = NULL,
747 .enum_list = NULL,
748 .flags = FLAG_ADVANCED | FLAG_SHARE,
751 .label = "paranoid server security",
752 .type = P_BOOL,
753 .p_class = P_GLOBAL,
754 .offset = GLOBAL_VAR(paranoid_server_security),
755 .special = NULL,
756 .enum_list = NULL
759 .label = "socket options",
760 .type = P_STRING,
761 .p_class = P_GLOBAL,
762 .offset = GLOBAL_VAR(socket_options),
763 .special = NULL,
764 .enum_list = NULL
768 .label = "strict sync",
769 .type = P_BOOL,
770 .p_class = P_LOCAL,
771 .offset = LOCAL_VAR(bStrictSync),
772 .special = NULL,
773 .enum_list = NULL
776 .label = "use mmap",
777 .type = P_BOOL,
778 .p_class = P_GLOBAL,
779 .offset = GLOBAL_VAR(bUseMmap),
780 .special = NULL,
781 .enum_list = NULL,
782 .flags = FLAG_ADVANCED,
785 {N_("Printing Options"), P_SEP, P_SEPARATOR},
788 .label = "max reported print jobs",
789 .type = P_INTEGER,
790 .p_class = P_LOCAL,
791 .offset = LOCAL_VAR(iMaxReportedPrintJobs),
792 .special = NULL,
793 .enum_list = NULL,
794 .flags = FLAG_ADVANCED | FLAG_PRINT,
797 .label = "max print jobs",
798 .type = P_INTEGER,
799 .p_class = P_LOCAL,
800 .offset = LOCAL_VAR(iMaxPrintJobs),
801 .special = NULL,
802 .enum_list = NULL,
803 .flags = FLAG_ADVANCED | FLAG_PRINT,
806 .label = "load printers",
807 .type = P_BOOL,
808 .p_class = P_GLOBAL,
809 .offset = GLOBAL_VAR(bLoadPrinters),
810 .special = NULL,
811 .enum_list = NULL,
812 .flags = FLAG_ADVANCED | FLAG_PRINT,
815 .label = "printcap cache time",
816 .type = P_INTEGER,
817 .p_class = P_GLOBAL,
818 .offset = GLOBAL_VAR(PrintcapCacheTime),
819 .special = NULL,
820 .enum_list = NULL,
821 .flags = FLAG_ADVANCED | FLAG_PRINT,
824 .label = "printcap name",
825 .type = P_STRING,
826 .p_class = P_GLOBAL,
827 .offset = GLOBAL_VAR(szPrintcapname),
828 .special = NULL,
829 .enum_list = NULL,
830 .flags = FLAG_ADVANCED | FLAG_PRINT,
833 .label = "printcap",
834 .type = P_STRING,
835 .p_class = P_GLOBAL,
836 .offset = GLOBAL_VAR(szPrintcapname),
837 .special = NULL,
838 .enum_list = NULL,
839 .flags = FLAG_HIDE,
842 .label = "printable",
843 .type = P_BOOL,
844 .p_class = P_LOCAL,
845 .offset = LOCAL_VAR(bPrint_ok),
846 .special = NULL,
847 .enum_list = NULL,
848 .flags = FLAG_ADVANCED | FLAG_PRINT,
851 .label = "print notify backchannel",
852 .type = P_BOOL,
853 .p_class = P_LOCAL,
854 .offset = LOCAL_VAR(bPrintNotifyBackchannel),
855 .special = NULL,
856 .enum_list = NULL,
857 .flags = FLAG_ADVANCED,
860 .label = "print ok",
861 .type = P_BOOL,
862 .p_class = P_LOCAL,
863 .offset = LOCAL_VAR(bPrint_ok),
864 .special = NULL,
865 .enum_list = NULL,
866 .flags = FLAG_HIDE,
869 .label = "printing",
870 .type = P_ENUM,
871 .p_class = P_LOCAL,
872 .offset = LOCAL_VAR(iPrinting),
873 .special = handle_printing,
874 .enum_list = enum_printing,
875 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
878 .label = "cups options",
879 .type = P_STRING,
880 .p_class = P_LOCAL,
881 .offset = LOCAL_VAR(szCupsOptions),
882 .special = NULL,
883 .enum_list = NULL,
884 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
887 .label = "cups server",
888 .type = P_STRING,
889 .p_class = P_GLOBAL,
890 .offset = GLOBAL_VAR(szCupsServer),
891 .special = NULL,
892 .enum_list = NULL,
893 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
896 .label = "cups encrypt",
897 .type = P_ENUM,
898 .p_class = P_GLOBAL,
899 .offset = GLOBAL_VAR(CupsEncrypt),
900 .special = NULL,
901 .enum_list = enum_bool_auto,
902 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
906 .label = "cups connection timeout",
907 .type = P_INTEGER,
908 .p_class = P_GLOBAL,
909 .offset = GLOBAL_VAR(cups_connection_timeout),
910 .special = NULL,
911 .enum_list = NULL,
912 .flags = FLAG_ADVANCED,
915 .label = "iprint server",
916 .type = P_STRING,
917 .p_class = P_GLOBAL,
918 .offset = GLOBAL_VAR(szIPrintServer),
919 .special = NULL,
920 .enum_list = NULL,
921 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
924 .label = "print command",
925 .type = P_STRING,
926 .p_class = P_LOCAL,
927 .offset = LOCAL_VAR(szPrintcommand),
928 .special = NULL,
929 .enum_list = NULL,
930 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
933 .label = "disable spoolss",
934 .type = P_BOOL,
935 .p_class = P_GLOBAL,
936 .offset = GLOBAL_VAR(bDisableSpoolss),
937 .special = NULL,
938 .enum_list = NULL,
939 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
942 .label = "enable spoolss",
943 .type = P_BOOLREV,
944 .p_class = P_GLOBAL,
945 .offset = GLOBAL_VAR(bDisableSpoolss),
946 .special = NULL,
947 .enum_list = NULL,
948 .flags = FLAG_HIDE,
951 .label = "lpq command",
952 .type = P_STRING,
953 .p_class = P_LOCAL,
954 .offset = LOCAL_VAR(szLpqcommand),
955 .special = NULL,
956 .enum_list = NULL,
957 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
960 .label = "lprm command",
961 .type = P_STRING,
962 .p_class = P_LOCAL,
963 .offset = LOCAL_VAR(szLprmcommand),
964 .special = NULL,
965 .enum_list = NULL,
966 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
969 .label = "lppause command",
970 .type = P_STRING,
971 .p_class = P_LOCAL,
972 .offset = LOCAL_VAR(szLppausecommand),
973 .special = NULL,
974 .enum_list = NULL,
975 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
978 .label = "lpresume command",
979 .type = P_STRING,
980 .p_class = P_LOCAL,
981 .offset = LOCAL_VAR(szLpresumecommand),
982 .special = NULL,
983 .enum_list = NULL,
984 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
987 .label = "queuepause command",
988 .type = P_STRING,
989 .p_class = P_LOCAL,
990 .offset = LOCAL_VAR(szQueuepausecommand),
991 .special = NULL,
992 .enum_list = NULL,
993 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
996 .label = "queueresume command",
997 .type = P_STRING,
998 .p_class = P_LOCAL,
999 .offset = LOCAL_VAR(szQueueresumecommand),
1000 .special = NULL,
1001 .enum_list = NULL,
1002 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
1005 .label = "addport command",
1006 .type = P_STRING,
1007 .p_class = P_GLOBAL,
1008 .offset = GLOBAL_VAR(szAddPortCommand),
1009 .special = NULL,
1010 .enum_list = NULL,
1011 .flags = FLAG_ADVANCED,
1014 .label = "enumports command",
1015 .type = P_STRING,
1016 .p_class = P_GLOBAL,
1017 .offset = GLOBAL_VAR(szEnumPortsCommand),
1018 .special = NULL,
1019 .enum_list = NULL,
1020 .flags = FLAG_ADVANCED,
1023 .label = "addprinter command",
1024 .type = P_STRING,
1025 .p_class = P_GLOBAL,
1026 .offset = GLOBAL_VAR(szAddPrinterCommand),
1027 .special = NULL,
1028 .enum_list = NULL,
1029 .flags = FLAG_ADVANCED,
1032 .label = "deleteprinter command",
1033 .type = P_STRING,
1034 .p_class = P_GLOBAL,
1035 .offset = GLOBAL_VAR(szDeletePrinterCommand),
1036 .special = NULL,
1037 .enum_list = NULL,
1038 .flags = FLAG_ADVANCED,
1041 .label = "show add printer wizard",
1042 .type = P_BOOL,
1043 .p_class = P_GLOBAL,
1044 .offset = GLOBAL_VAR(bMsAddPrinterWizard),
1045 .special = NULL,
1046 .enum_list = NULL,
1047 .flags = FLAG_ADVANCED,
1050 .label = "os2 driver map",
1051 .type = P_STRING,
1052 .p_class = P_GLOBAL,
1053 .offset = GLOBAL_VAR(szOs2DriverMap),
1054 .special = NULL,
1055 .enum_list = NULL,
1056 .flags = FLAG_ADVANCED,
1060 .label = "printer name",
1061 .type = P_STRING,
1062 .p_class = P_LOCAL,
1063 .offset = LOCAL_VAR(szPrintername),
1064 .special = NULL,
1065 .enum_list = NULL,
1066 .flags = FLAG_ADVANCED | FLAG_PRINT,
1069 .label = "printer",
1070 .type = P_STRING,
1071 .p_class = P_LOCAL,
1072 .offset = LOCAL_VAR(szPrintername),
1073 .special = NULL,
1074 .enum_list = NULL,
1075 .flags = FLAG_HIDE,
1078 .label = "use client driver",
1079 .type = P_BOOL,
1080 .p_class = P_LOCAL,
1081 .offset = LOCAL_VAR(bUseClientDriver),
1082 .special = NULL,
1083 .enum_list = NULL,
1084 .flags = FLAG_ADVANCED | FLAG_PRINT,
1087 .label = "default devmode",
1088 .type = P_BOOL,
1089 .p_class = P_LOCAL,
1090 .offset = LOCAL_VAR(bDefaultDevmode),
1091 .special = NULL,
1092 .enum_list = NULL,
1093 .flags = FLAG_ADVANCED | FLAG_PRINT,
1096 .label = "force printername",
1097 .type = P_BOOL,
1098 .p_class = P_LOCAL,
1099 .offset = LOCAL_VAR(bForcePrintername),
1100 .special = NULL,
1101 .enum_list = NULL,
1102 .flags = FLAG_ADVANCED | FLAG_PRINT,
1105 .label = "printjob username",
1106 .type = P_STRING,
1107 .p_class = P_LOCAL,
1108 .offset = LOCAL_VAR(szPrintjobUsername),
1109 .special = NULL,
1110 .enum_list = NULL,
1111 .flags = FLAG_ADVANCED | FLAG_PRINT,
1114 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
1117 .label = "mangling method",
1118 .type = P_STRING,
1119 .p_class = P_GLOBAL,
1120 .offset = GLOBAL_VAR(szManglingMethod),
1121 .special = NULL,
1122 .enum_list = NULL,
1123 .flags = FLAG_ADVANCED,
1126 .label = "mangle prefix",
1127 .type = P_INTEGER,
1128 .p_class = P_GLOBAL,
1129 .offset = GLOBAL_VAR(mangle_prefix),
1130 .special = NULL,
1131 .enum_list = NULL,
1132 .flags = FLAG_ADVANCED,
1136 .label = "default case",
1137 .type = P_ENUM,
1138 .p_class = P_LOCAL,
1139 .offset = LOCAL_VAR(iDefaultCase),
1140 .special = NULL,
1141 .enum_list = enum_case,
1142 .flags = FLAG_ADVANCED | FLAG_SHARE,
1145 .label = "case sensitive",
1146 .type = P_ENUM,
1147 .p_class = P_LOCAL,
1148 .offset = LOCAL_VAR(iCaseSensitive),
1149 .special = NULL,
1150 .enum_list = enum_bool_auto,
1151 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1154 .label = "casesignames",
1155 .type = P_ENUM,
1156 .p_class = P_LOCAL,
1157 .offset = LOCAL_VAR(iCaseSensitive),
1158 .special = NULL,
1159 .enum_list = enum_bool_auto,
1160 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
1163 .label = "preserve case",
1164 .type = P_BOOL,
1165 .p_class = P_LOCAL,
1166 .offset = LOCAL_VAR(bCasePreserve),
1167 .special = NULL,
1168 .enum_list = NULL,
1169 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1172 .label = "short preserve case",
1173 .type = P_BOOL,
1174 .p_class = P_LOCAL,
1175 .offset = LOCAL_VAR(bShortCasePreserve),
1176 .special = NULL,
1177 .enum_list = NULL,
1178 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1181 .label = "mangling char",
1182 .type = P_CHAR,
1183 .p_class = P_LOCAL,
1184 .offset = LOCAL_VAR(magic_char),
1185 .special = NULL,
1186 .enum_list = NULL,
1187 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1190 .label = "hide dot files",
1191 .type = P_BOOL,
1192 .p_class = P_LOCAL,
1193 .offset = LOCAL_VAR(bHideDotFiles),
1194 .special = NULL,
1195 .enum_list = NULL,
1196 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1199 .label = "hide special files",
1200 .type = P_BOOL,
1201 .p_class = P_LOCAL,
1202 .offset = LOCAL_VAR(bHideSpecialFiles),
1203 .special = NULL,
1204 .enum_list = NULL,
1205 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1208 .label = "hide unreadable",
1209 .type = P_BOOL,
1210 .p_class = P_LOCAL,
1211 .offset = LOCAL_VAR(bHideUnReadable),
1212 .special = NULL,
1213 .enum_list = NULL,
1214 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1217 .label = "hide unwriteable files",
1218 .type = P_BOOL,
1219 .p_class = P_LOCAL,
1220 .offset = LOCAL_VAR(bHideUnWriteableFiles),
1221 .special = NULL,
1222 .enum_list = NULL,
1223 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1226 .label = "delete veto files",
1227 .type = P_BOOL,
1228 .p_class = P_LOCAL,
1229 .offset = LOCAL_VAR(bDeleteVetoFiles),
1230 .special = NULL,
1231 .enum_list = NULL,
1232 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1235 .label = "veto files",
1236 .type = P_STRING,
1237 .p_class = P_LOCAL,
1238 .offset = LOCAL_VAR(szVetoFiles),
1239 .special = NULL,
1240 .enum_list = NULL,
1241 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1244 .label = "hide files",
1245 .type = P_STRING,
1246 .p_class = P_LOCAL,
1247 .offset = LOCAL_VAR(szHideFiles),
1248 .special = NULL,
1249 .enum_list = NULL,
1250 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1253 .label = "veto oplock files",
1254 .type = P_STRING,
1255 .p_class = P_LOCAL,
1256 .offset = LOCAL_VAR(szVetoOplockFiles),
1257 .special = NULL,
1258 .enum_list = NULL,
1259 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1262 .label = "map archive",
1263 .type = P_BOOL,
1264 .p_class = P_LOCAL,
1265 .offset = LOCAL_VAR(bMap_archive),
1266 .special = NULL,
1267 .enum_list = NULL,
1268 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1271 .label = "map hidden",
1272 .type = P_BOOL,
1273 .p_class = P_LOCAL,
1274 .offset = LOCAL_VAR(bMap_hidden),
1275 .special = NULL,
1276 .enum_list = NULL,
1277 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1280 .label = "map system",
1281 .type = P_BOOL,
1282 .p_class = P_LOCAL,
1283 .offset = LOCAL_VAR(bMap_system),
1284 .special = NULL,
1285 .enum_list = NULL,
1286 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1289 .label = "map readonly",
1290 .type = P_ENUM,
1291 .p_class = P_LOCAL,
1292 .offset = LOCAL_VAR(iMap_readonly),
1293 .special = NULL,
1294 .enum_list = enum_map_readonly,
1295 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1298 .label = "mangled names",
1299 .type = P_BOOL,
1300 .p_class = P_LOCAL,
1301 .offset = LOCAL_VAR(bMangledNames),
1302 .special = NULL,
1303 .enum_list = NULL,
1304 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1307 .label = "max stat cache size",
1308 .type = P_INTEGER,
1309 .p_class = P_GLOBAL,
1310 .offset = GLOBAL_VAR(iMaxStatCacheSize),
1311 .special = NULL,
1312 .enum_list = NULL,
1313 .flags = FLAG_ADVANCED,
1316 .label = "stat cache",
1317 .type = P_BOOL,
1318 .p_class = P_GLOBAL,
1319 .offset = GLOBAL_VAR(bStatCache),
1320 .special = NULL,
1321 .enum_list = NULL,
1322 .flags = FLAG_ADVANCED,
1325 .label = "store dos attributes",
1326 .type = P_BOOL,
1327 .p_class = P_LOCAL,
1328 .offset = LOCAL_VAR(bStoreDosAttributes),
1329 .special = NULL,
1330 .enum_list = NULL,
1331 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1334 .label = "dmapi support",
1335 .type = P_BOOL,
1336 .p_class = P_LOCAL,
1337 .offset = LOCAL_VAR(bDmapiSupport),
1338 .special = NULL,
1339 .enum_list = NULL,
1340 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1344 {N_("Domain Options"), P_SEP, P_SEPARATOR},
1347 .label = "machine password timeout",
1348 .type = P_INTEGER,
1349 .p_class = P_GLOBAL,
1350 .offset = GLOBAL_VAR(machine_password_timeout),
1351 .special = NULL,
1352 .enum_list = NULL,
1353 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1356 {N_("Logon Options"), P_SEP, P_SEPARATOR},
1359 .label = "add user script",
1360 .type = P_STRING,
1361 .p_class = P_GLOBAL,
1362 .offset = GLOBAL_VAR(szAddUserScript),
1363 .special = NULL,
1364 .enum_list = NULL,
1365 .flags = FLAG_ADVANCED,
1368 .label = "rename user script",
1369 .type = P_STRING,
1370 .p_class = P_GLOBAL,
1371 .offset = GLOBAL_VAR(szRenameUserScript),
1372 .special = NULL,
1373 .enum_list = NULL,
1374 .flags = FLAG_ADVANCED,
1377 .label = "delete user script",
1378 .type = P_STRING,
1379 .p_class = P_GLOBAL,
1380 .offset = GLOBAL_VAR(szDelUserScript),
1381 .special = NULL,
1382 .enum_list = NULL,
1383 .flags = FLAG_ADVANCED,
1386 .label = "add group script",
1387 .type = P_STRING,
1388 .p_class = P_GLOBAL,
1389 .offset = GLOBAL_VAR(szAddGroupScript),
1390 .special = NULL,
1391 .enum_list = NULL,
1392 .flags = FLAG_ADVANCED,
1395 .label = "delete group script",
1396 .type = P_STRING,
1397 .p_class = P_GLOBAL,
1398 .offset = GLOBAL_VAR(szDelGroupScript),
1399 .special = NULL,
1400 .enum_list = NULL,
1401 .flags = FLAG_ADVANCED,
1404 .label = "add user to group script",
1405 .type = P_STRING,
1406 .p_class = P_GLOBAL,
1407 .offset = GLOBAL_VAR(szAddUserToGroupScript),
1408 .special = NULL,
1409 .enum_list = NULL,
1410 .flags = FLAG_ADVANCED,
1413 .label = "delete user from group script",
1414 .type = P_STRING,
1415 .p_class = P_GLOBAL,
1416 .offset = GLOBAL_VAR(szDelUserFromGroupScript),
1417 .special = NULL,
1418 .enum_list = NULL,
1419 .flags = FLAG_ADVANCED,
1422 .label = "set primary group script",
1423 .type = P_STRING,
1424 .p_class = P_GLOBAL,
1425 .offset = GLOBAL_VAR(szSetPrimaryGroupScript),
1426 .special = NULL,
1427 .enum_list = NULL,
1428 .flags = FLAG_ADVANCED,
1431 .label = "add machine script",
1432 .type = P_STRING,
1433 .p_class = P_GLOBAL,
1434 .offset = GLOBAL_VAR(szAddMachineScript),
1435 .special = NULL,
1436 .enum_list = NULL,
1437 .flags = FLAG_ADVANCED,
1440 .label = "shutdown script",
1441 .type = P_STRING,
1442 .p_class = P_GLOBAL,
1443 .offset = GLOBAL_VAR(szShutdownScript),
1444 .special = NULL,
1445 .enum_list = NULL,
1446 .flags = FLAG_ADVANCED,
1449 .label = "abort shutdown script",
1450 .type = P_STRING,
1451 .p_class = P_GLOBAL,
1452 .offset = GLOBAL_VAR(szAbortShutdownScript),
1453 .special = NULL,
1454 .enum_list = NULL,
1455 .flags = FLAG_ADVANCED,
1458 .label = "username map script",
1459 .type = P_STRING,
1460 .p_class = P_GLOBAL,
1461 .offset = GLOBAL_VAR(szUsernameMapScript),
1462 .special = NULL,
1463 .enum_list = NULL,
1464 .flags = FLAG_ADVANCED,
1467 .label = "username map cache time",
1468 .type = P_INTEGER,
1469 .p_class = P_GLOBAL,
1470 .offset = GLOBAL_VAR(iUsernameMapCacheTime),
1471 .special = NULL,
1472 .enum_list = NULL,
1473 .flags = FLAG_ADVANCED,
1476 .label = "logon script",
1477 .type = P_STRING,
1478 .p_class = P_GLOBAL,
1479 .offset = GLOBAL_VAR(szLogonScript),
1480 .special = NULL,
1481 .enum_list = NULL,
1482 .flags = FLAG_ADVANCED,
1485 .label = "logon path",
1486 .type = P_STRING,
1487 .p_class = P_GLOBAL,
1488 .offset = GLOBAL_VAR(szLogonPath),
1489 .special = NULL,
1490 .enum_list = NULL,
1491 .flags = FLAG_ADVANCED,
1494 .label = "logon drive",
1495 .type = P_STRING,
1496 .p_class = P_GLOBAL,
1497 .offset = GLOBAL_VAR(szLogonDrive),
1498 .special = NULL,
1499 .enum_list = NULL,
1500 .flags = FLAG_ADVANCED,
1503 .label = "logon home",
1504 .type = P_STRING,
1505 .p_class = P_GLOBAL,
1506 .offset = GLOBAL_VAR(szLogonHome),
1507 .special = NULL,
1508 .enum_list = NULL,
1509 .flags = FLAG_ADVANCED,
1512 .label = "domain logons",
1513 .type = P_BOOL,
1514 .p_class = P_GLOBAL,
1515 .offset = GLOBAL_VAR(bDomainLogons),
1516 .special = NULL,
1517 .enum_list = NULL,
1518 .flags = FLAG_ADVANCED,
1522 .label = "init logon delayed hosts",
1523 .type = P_LIST,
1524 .p_class = P_GLOBAL,
1525 .offset = GLOBAL_VAR(szInitLogonDelayedHosts),
1526 .special = NULL,
1527 .enum_list = NULL,
1528 .flags = FLAG_ADVANCED,
1532 .label = "init logon delay",
1533 .type = P_INTEGER,
1534 .p_class = P_GLOBAL,
1535 .offset = GLOBAL_VAR(InitLogonDelay),
1536 .special = NULL,
1537 .enum_list = NULL,
1538 .flags = FLAG_ADVANCED,
1542 {N_("Browse Options"), P_SEP, P_SEPARATOR},
1545 .label = "os level",
1546 .type = P_INTEGER,
1547 .p_class = P_GLOBAL,
1548 .offset = GLOBAL_VAR(os_level),
1549 .special = NULL,
1550 .enum_list = NULL,
1551 .flags = FLAG_BASIC | FLAG_ADVANCED,
1554 .label = "lm announce",
1555 .type = P_ENUM,
1556 .p_class = P_GLOBAL,
1557 .offset = GLOBAL_VAR(lm_announce),
1558 .special = NULL,
1559 .enum_list = enum_bool_auto,
1560 .flags = FLAG_ADVANCED,
1563 .label = "lm interval",
1564 .type = P_INTEGER,
1565 .p_class = P_GLOBAL,
1566 .offset = GLOBAL_VAR(lm_interval),
1567 .special = NULL,
1568 .enum_list = NULL,
1569 .flags = FLAG_ADVANCED,
1572 .label = "preferred master",
1573 .type = P_ENUM,
1574 .p_class = P_GLOBAL,
1575 .offset = GLOBAL_VAR(iPreferredMaster),
1576 .special = NULL,
1577 .enum_list = enum_bool_auto,
1578 .flags = FLAG_BASIC | FLAG_ADVANCED,
1581 .label = "prefered master",
1582 .type = P_ENUM,
1583 .p_class = P_GLOBAL,
1584 .offset = GLOBAL_VAR(iPreferredMaster),
1585 .special = NULL,
1586 .enum_list = enum_bool_auto,
1587 .flags = FLAG_HIDE,
1590 .label = "local master",
1591 .type = P_BOOL,
1592 .p_class = P_GLOBAL,
1593 .offset = GLOBAL_VAR(bLocalMaster),
1594 .special = NULL,
1595 .enum_list = NULL,
1596 .flags = FLAG_BASIC | FLAG_ADVANCED,
1599 .label = "domain master",
1600 .type = P_ENUM,
1601 .p_class = P_GLOBAL,
1602 .offset = GLOBAL_VAR(domain_master),
1603 .special = NULL,
1604 .enum_list = enum_bool_auto,
1605 .flags = FLAG_BASIC | FLAG_ADVANCED,
1608 .label = "browse list",
1609 .type = P_BOOL,
1610 .p_class = P_GLOBAL,
1611 .offset = GLOBAL_VAR(bBrowseList),
1612 .special = NULL,
1613 .enum_list = NULL,
1614 .flags = FLAG_ADVANCED,
1617 .label = "browseable",
1618 .type = P_BOOL,
1619 .p_class = P_LOCAL,
1620 .offset = LOCAL_VAR(bBrowseable),
1621 .special = NULL,
1622 .enum_list = NULL,
1623 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1626 .label = "browsable",
1627 .type = P_BOOL,
1628 .p_class = P_LOCAL,
1629 .offset = LOCAL_VAR(bBrowseable),
1630 .special = NULL,
1631 .enum_list = NULL,
1632 .flags = FLAG_HIDE,
1635 .label = "access based share enum",
1636 .type = P_BOOL,
1637 .p_class = P_LOCAL,
1638 .offset = LOCAL_VAR(bAccessBasedShareEnum),
1639 .special = NULL,
1640 .enum_list = NULL,
1641 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
1644 .label = "enhanced browsing",
1645 .type = P_BOOL,
1646 .p_class = P_GLOBAL,
1647 .offset = GLOBAL_VAR(enhanced_browsing),
1648 .special = NULL,
1649 .enum_list = NULL,
1650 .flags = FLAG_ADVANCED,
1653 {N_("WINS Options"), P_SEP, P_SEPARATOR},
1656 .label = "dns proxy",
1657 .type = P_BOOL,
1658 .p_class = P_GLOBAL,
1659 .offset = GLOBAL_VAR(bWINSdnsProxy),
1660 .special = NULL,
1661 .enum_list = NULL,
1662 .flags = FLAG_ADVANCED,
1665 .label = "wins proxy",
1666 .type = P_BOOL,
1667 .p_class = P_GLOBAL,
1668 .offset = GLOBAL_VAR(bWINSproxy),
1669 .special = NULL,
1670 .enum_list = NULL,
1671 .flags = FLAG_ADVANCED,
1674 .label = "wins server",
1675 .type = P_LIST,
1676 .p_class = P_GLOBAL,
1677 .offset = GLOBAL_VAR(szWINSservers),
1678 .special = NULL,
1679 .enum_list = NULL,
1680 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1683 .label = "wins support",
1684 .type = P_BOOL,
1685 .p_class = P_GLOBAL,
1686 .offset = GLOBAL_VAR(bWINSsupport),
1687 .special = NULL,
1688 .enum_list = NULL,
1689 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1692 .label = "wins hook",
1693 .type = P_STRING,
1694 .p_class = P_GLOBAL,
1695 .offset = GLOBAL_VAR(szWINSHook),
1696 .special = NULL,
1697 .enum_list = NULL,
1698 .flags = FLAG_ADVANCED,
1701 {N_("Locking Options"), P_SEP, P_SEPARATOR},
1704 .label = "blocking locks",
1705 .type = P_BOOL,
1706 .p_class = P_LOCAL,
1707 .offset = LOCAL_VAR(bBlockingLocks),
1708 .special = NULL,
1709 .enum_list = NULL,
1710 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1713 .label = "csc policy",
1714 .type = P_ENUM,
1715 .p_class = P_LOCAL,
1716 .offset = LOCAL_VAR(iCSCPolicy),
1717 .special = NULL,
1718 .enum_list = enum_csc_policy,
1719 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1722 .label = "fake oplocks",
1723 .type = P_BOOL,
1724 .p_class = P_LOCAL,
1725 .offset = LOCAL_VAR(bFakeOplocks),
1726 .special = NULL,
1727 .enum_list = NULL,
1728 .flags = FLAG_ADVANCED | FLAG_SHARE,
1731 .label = "kernel oplocks",
1732 .type = P_BOOL,
1733 .p_class = P_LOCAL,
1734 .offset = LOCAL_VAR(bKernelOplocks),
1735 .special = NULL,
1736 .enum_list = NULL,
1737 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1740 .label = "locking",
1741 .type = P_BOOL,
1742 .p_class = P_LOCAL,
1743 .offset = LOCAL_VAR(bLocking),
1744 .special = NULL,
1745 .enum_list = NULL,
1746 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1749 .label = "lock spin time",
1750 .type = P_INTEGER,
1751 .p_class = P_GLOBAL,
1752 .offset = GLOBAL_VAR(iLockSpinTime),
1753 .special = NULL,
1754 .enum_list = NULL,
1755 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1758 .label = "oplocks",
1759 .type = P_BOOL,
1760 .p_class = P_LOCAL,
1761 .offset = LOCAL_VAR(bOpLocks),
1762 .special = NULL,
1763 .enum_list = NULL,
1764 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1767 .label = "level2 oplocks",
1768 .type = P_BOOL,
1769 .p_class = P_LOCAL,
1770 .offset = LOCAL_VAR(bLevel2OpLocks),
1771 .special = NULL,
1772 .enum_list = NULL,
1773 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1776 .label = "oplock break wait time",
1777 .type = P_INTEGER,
1778 .p_class = P_GLOBAL,
1779 .offset = GLOBAL_VAR(oplock_break_wait_time),
1780 .special = NULL,
1781 .enum_list = NULL,
1782 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1785 .label = "oplock contention limit",
1786 .type = P_INTEGER,
1787 .p_class = P_LOCAL,
1788 .offset = LOCAL_VAR(iOplockContentionLimit),
1789 .special = NULL,
1790 .enum_list = NULL,
1791 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1794 .label = "posix locking",
1795 .type = P_BOOL,
1796 .p_class = P_LOCAL,
1797 .offset = LOCAL_VAR(bPosixLocking),
1798 .special = NULL,
1799 .enum_list = NULL,
1800 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1803 .label = "strict locking",
1804 .type = P_ENUM,
1805 .p_class = P_LOCAL,
1806 .offset = LOCAL_VAR(iStrictLocking),
1807 .special = NULL,
1808 .enum_list = enum_bool_auto,
1809 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1812 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
1815 .label = "ldap admin dn",
1816 .type = P_STRING,
1817 .p_class = P_GLOBAL,
1818 .offset = GLOBAL_VAR(szLdapAdminDn),
1819 .special = NULL,
1820 .enum_list = NULL,
1821 .flags = FLAG_ADVANCED,
1824 .label = "ldap delete dn",
1825 .type = P_BOOL,
1826 .p_class = P_GLOBAL,
1827 .offset = GLOBAL_VAR(ldap_delete_dn),
1828 .special = NULL,
1829 .enum_list = NULL,
1830 .flags = FLAG_ADVANCED,
1833 .label = "ldap group suffix",
1834 .type = P_STRING,
1835 .p_class = P_GLOBAL,
1836 .offset = GLOBAL_VAR(szLdapGroupSuffix),
1837 .special = NULL,
1838 .enum_list = NULL,
1839 .flags = FLAG_ADVANCED,
1842 .label = "ldap idmap suffix",
1843 .type = P_STRING,
1844 .p_class = P_GLOBAL,
1845 .offset = GLOBAL_VAR(szLdapIdmapSuffix),
1846 .special = NULL,
1847 .enum_list = NULL,
1848 .flags = FLAG_ADVANCED,
1851 .label = "ldap machine suffix",
1852 .type = P_STRING,
1853 .p_class = P_GLOBAL,
1854 .offset = GLOBAL_VAR(szLdapMachineSuffix),
1855 .special = NULL,
1856 .enum_list = NULL,
1857 .flags = FLAG_ADVANCED,
1860 .label = "ldap passwd sync",
1861 .type = P_ENUM,
1862 .p_class = P_GLOBAL,
1863 .offset = GLOBAL_VAR(ldap_passwd_sync),
1864 .special = NULL,
1865 .enum_list = enum_ldap_passwd_sync,
1866 .flags = FLAG_ADVANCED,
1869 .label = "ldap password sync",
1870 .type = P_ENUM,
1871 .p_class = P_GLOBAL,
1872 .offset = GLOBAL_VAR(ldap_passwd_sync),
1873 .special = NULL,
1874 .enum_list = enum_ldap_passwd_sync,
1875 .flags = FLAG_HIDE,
1878 .label = "ldap replication sleep",
1879 .type = P_INTEGER,
1880 .p_class = P_GLOBAL,
1881 .offset = GLOBAL_VAR(ldap_replication_sleep),
1882 .special = NULL,
1883 .enum_list = NULL,
1884 .flags = FLAG_ADVANCED,
1887 .label = "ldap suffix",
1888 .type = P_STRING,
1889 .p_class = P_GLOBAL,
1890 .offset = GLOBAL_VAR(szLdapSuffix),
1891 .special = NULL,
1892 .enum_list = NULL,
1893 .flags = FLAG_ADVANCED,
1896 .label = "ldap ssl",
1897 .type = P_ENUM,
1898 .p_class = P_GLOBAL,
1899 .offset = GLOBAL_VAR(ldap_ssl),
1900 .special = NULL,
1901 .enum_list = enum_ldap_ssl,
1902 .flags = FLAG_ADVANCED,
1905 .label = "ldap ssl ads",
1906 .type = P_BOOL,
1907 .p_class = P_GLOBAL,
1908 .offset = GLOBAL_VAR(ldap_ssl_ads),
1909 .special = NULL,
1910 .enum_list = NULL,
1911 .flags = FLAG_ADVANCED,
1914 .label = "ldap deref",
1915 .type = P_ENUM,
1916 .p_class = P_GLOBAL,
1917 .offset = GLOBAL_VAR(ldap_deref),
1918 .special = NULL,
1919 .enum_list = enum_ldap_deref,
1920 .flags = FLAG_ADVANCED,
1923 .label = "ldap follow referral",
1924 .type = P_ENUM,
1925 .p_class = P_GLOBAL,
1926 .offset = GLOBAL_VAR(ldap_follow_referral),
1927 .special = NULL,
1928 .enum_list = enum_bool_auto,
1929 .flags = FLAG_ADVANCED,
1932 .label = "ldap timeout",
1933 .type = P_INTEGER,
1934 .p_class = P_GLOBAL,
1935 .offset = GLOBAL_VAR(ldap_timeout),
1936 .special = NULL,
1937 .enum_list = NULL,
1938 .flags = FLAG_ADVANCED,
1941 .label = "ldap connection timeout",
1942 .type = P_INTEGER,
1943 .p_class = P_GLOBAL,
1944 .offset = GLOBAL_VAR(ldap_connection_timeout),
1945 .special = NULL,
1946 .enum_list = NULL,
1947 .flags = FLAG_ADVANCED,
1950 .label = "ldap page size",
1951 .type = P_INTEGER,
1952 .p_class = P_GLOBAL,
1953 .offset = GLOBAL_VAR(ldap_page_size),
1954 .special = NULL,
1955 .enum_list = NULL,
1956 .flags = FLAG_ADVANCED,
1959 .label = "ldap user suffix",
1960 .type = P_STRING,
1961 .p_class = P_GLOBAL,
1962 .offset = GLOBAL_VAR(szLdapUserSuffix),
1963 .special = NULL,
1964 .enum_list = NULL,
1965 .flags = FLAG_ADVANCED,
1968 .label = "ldap debug level",
1969 .type = P_INTEGER,
1970 .p_class = P_GLOBAL,
1971 .offset = GLOBAL_VAR(ldap_debug_level),
1972 .special = handle_ldap_debug_level,
1973 .enum_list = NULL,
1974 .flags = FLAG_ADVANCED,
1977 .label = "ldap debug threshold",
1978 .type = P_INTEGER,
1979 .p_class = P_GLOBAL,
1980 .offset = GLOBAL_VAR(ldap_debug_threshold),
1981 .special = NULL,
1982 .enum_list = NULL,
1983 .flags = FLAG_ADVANCED,
1986 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
1989 .label = "eventlog list",
1990 .type = P_LIST,
1991 .p_class = P_GLOBAL,
1992 .offset = GLOBAL_VAR(szEventLogs),
1993 .special = NULL,
1994 .enum_list = NULL,
1995 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1998 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
2001 .label = "add share command",
2002 .type = P_STRING,
2003 .p_class = P_GLOBAL,
2004 .offset = GLOBAL_VAR(szAddShareCommand),
2005 .special = NULL,
2006 .enum_list = NULL,
2007 .flags = FLAG_ADVANCED,
2010 .label = "change share command",
2011 .type = P_STRING,
2012 .p_class = P_GLOBAL,
2013 .offset = GLOBAL_VAR(szChangeShareCommand),
2014 .special = NULL,
2015 .enum_list = NULL,
2016 .flags = FLAG_ADVANCED,
2019 .label = "delete share command",
2020 .type = P_STRING,
2021 .p_class = P_GLOBAL,
2022 .offset = GLOBAL_VAR(szDeleteShareCommand),
2023 .special = NULL,
2024 .enum_list = NULL,
2025 .flags = FLAG_ADVANCED,
2028 .label = "config file",
2029 .type = P_STRING,
2030 .p_class = P_GLOBAL,
2031 .offset = GLOBAL_VAR(szConfigFile),
2032 .special = NULL,
2033 .enum_list = NULL,
2034 .flags = FLAG_HIDE|FLAG_META,
2037 .label = "preload",
2038 .type = P_STRING,
2039 .p_class = P_GLOBAL,
2040 .offset = GLOBAL_VAR(szAutoServices),
2041 .special = NULL,
2042 .enum_list = NULL,
2043 .flags = FLAG_ADVANCED,
2046 .label = "auto services",
2047 .type = P_STRING,
2048 .p_class = P_GLOBAL,
2049 .offset = GLOBAL_VAR(szAutoServices),
2050 .special = NULL,
2051 .enum_list = NULL,
2052 .flags = FLAG_ADVANCED,
2055 .label = "lock directory",
2056 .type = P_STRING,
2057 .p_class = P_GLOBAL,
2058 .offset = GLOBAL_VAR(szLockDir),
2059 .special = NULL,
2060 .enum_list = NULL,
2061 .flags = FLAG_ADVANCED,
2064 .label = "lock dir",
2065 .type = P_STRING,
2066 .p_class = P_GLOBAL,
2067 .offset = GLOBAL_VAR(szLockDir),
2068 .special = NULL,
2069 .enum_list = NULL,
2070 .flags = FLAG_HIDE,
2073 .label = "state directory",
2074 .type = P_STRING,
2075 .p_class = P_GLOBAL,
2076 .offset = GLOBAL_VAR(szStateDir),
2077 .special = NULL,
2078 .enum_list = NULL,
2079 .flags = FLAG_ADVANCED,
2082 .label = "cache directory",
2083 .type = P_STRING,
2084 .p_class = P_GLOBAL,
2085 .offset = GLOBAL_VAR(szCacheDir),
2086 .special = NULL,
2087 .enum_list = NULL,
2088 .flags = FLAG_ADVANCED,
2091 .label = "pid directory",
2092 .type = P_STRING,
2093 .p_class = P_GLOBAL,
2094 .offset = GLOBAL_VAR(szPidDir),
2095 .special = NULL,
2096 .enum_list = NULL,
2097 .flags = FLAG_ADVANCED,
2100 .label = "ntp signd socket directory",
2101 .type = P_STRING,
2102 .p_class = P_GLOBAL,
2103 .offset = GLOBAL_VAR(szNTPSignDSocketDirectory),
2104 .special = NULL,
2105 .enum_list = NULL,
2106 .flags = FLAG_ADVANCED,
2109 #ifdef WITH_UTMP
2111 .label = "utmp directory",
2112 .type = P_STRING,
2113 .p_class = P_GLOBAL,
2114 .offset = GLOBAL_VAR(szUtmpDir),
2115 .special = NULL,
2116 .enum_list = NULL,
2117 .flags = FLAG_ADVANCED,
2120 .label = "wtmp directory",
2121 .type = P_STRING,
2122 .p_class = P_GLOBAL,
2123 .offset = GLOBAL_VAR(szWtmpDir),
2124 .special = NULL,
2125 .enum_list = NULL,
2126 .flags = FLAG_ADVANCED,
2129 .label = "utmp",
2130 .type = P_BOOL,
2131 .p_class = P_GLOBAL,
2132 .offset = GLOBAL_VAR(bUtmp),
2133 .special = NULL,
2134 .enum_list = NULL,
2135 .flags = FLAG_ADVANCED,
2137 #endif
2139 .label = "default service",
2140 .type = P_STRING,
2141 .p_class = P_GLOBAL,
2142 .offset = GLOBAL_VAR(szDefaultService),
2143 .special = NULL,
2144 .enum_list = NULL,
2145 .flags = FLAG_ADVANCED,
2148 .label = "default",
2149 .type = P_STRING,
2150 .p_class = P_GLOBAL,
2151 .offset = GLOBAL_VAR(szDefaultService),
2152 .special = NULL,
2153 .enum_list = NULL,
2154 .flags = FLAG_ADVANCED,
2157 .label = "message command",
2158 .type = P_STRING,
2159 .p_class = P_GLOBAL,
2160 .offset = GLOBAL_VAR(szMsgCommand),
2161 .special = NULL,
2162 .enum_list = NULL,
2163 .flags = FLAG_ADVANCED,
2166 .label = "dfree cache time",
2167 .type = P_INTEGER,
2168 .p_class = P_LOCAL,
2169 .offset = LOCAL_VAR(iDfreeCacheTime),
2170 .special = NULL,
2171 .enum_list = NULL,
2172 .flags = FLAG_ADVANCED,
2175 .label = "dfree command",
2176 .type = P_STRING,
2177 .p_class = P_LOCAL,
2178 .offset = LOCAL_VAR(szDfree),
2179 .special = NULL,
2180 .enum_list = NULL,
2181 .flags = FLAG_ADVANCED,
2184 .label = "get quota command",
2185 .type = P_STRING,
2186 .p_class = P_GLOBAL,
2187 .offset = GLOBAL_VAR(szGetQuota),
2188 .special = NULL,
2189 .enum_list = NULL,
2190 .flags = FLAG_ADVANCED,
2193 .label = "set quota command",
2194 .type = P_STRING,
2195 .p_class = P_GLOBAL,
2196 .offset = GLOBAL_VAR(szSetQuota),
2197 .special = NULL,
2198 .enum_list = NULL,
2199 .flags = FLAG_ADVANCED,
2202 .label = "remote announce",
2203 .type = P_STRING,
2204 .p_class = P_GLOBAL,
2205 .offset = GLOBAL_VAR(szRemoteAnnounce),
2206 .special = NULL,
2207 .enum_list = NULL,
2208 .flags = FLAG_ADVANCED,
2211 .label = "remote browse sync",
2212 .type = P_STRING,
2213 .p_class = P_GLOBAL,
2214 .offset = GLOBAL_VAR(szRemoteBrowseSync),
2215 .special = NULL,
2216 .enum_list = NULL,
2217 .flags = FLAG_ADVANCED,
2220 .label = "socket address",
2221 .type = P_STRING,
2222 .p_class = P_GLOBAL,
2223 .offset = GLOBAL_VAR(szSocketAddress),
2224 .special = NULL,
2225 .enum_list = NULL,
2226 .flags = FLAG_ADVANCED,
2229 .label = "nmbd bind explicit broadcast",
2230 .type = P_BOOL,
2231 .p_class = P_GLOBAL,
2232 .offset = GLOBAL_VAR(bNmbdBindExplicitBroadcast),
2233 .special = NULL,
2234 .enum_list = NULL,
2235 .flags = FLAG_ADVANCED,
2238 .label = "homedir map",
2239 .type = P_STRING,
2240 .p_class = P_GLOBAL,
2241 .offset = GLOBAL_VAR(szNISHomeMapName),
2242 .special = NULL,
2243 .enum_list = NULL,
2244 .flags = FLAG_ADVANCED,
2247 .label = "afs username map",
2248 .type = P_STRING,
2249 .p_class = P_GLOBAL,
2250 .offset = GLOBAL_VAR(szAfsUsernameMap),
2251 .special = NULL,
2252 .enum_list = NULL,
2253 .flags = FLAG_ADVANCED,
2256 .label = "afs token lifetime",
2257 .type = P_INTEGER,
2258 .p_class = P_GLOBAL,
2259 .offset = GLOBAL_VAR(iAfsTokenLifetime),
2260 .special = NULL,
2261 .enum_list = NULL,
2262 .flags = FLAG_ADVANCED,
2265 .label = "log nt token command",
2266 .type = P_STRING,
2267 .p_class = P_GLOBAL,
2268 .offset = GLOBAL_VAR(szLogNtTokenCommand),
2269 .special = NULL,
2270 .enum_list = NULL,
2271 .flags = FLAG_ADVANCED,
2274 .label = "NIS homedir",
2275 .type = P_BOOL,
2276 .p_class = P_GLOBAL,
2277 .offset = GLOBAL_VAR(bNISHomeMap),
2278 .special = NULL,
2279 .enum_list = NULL,
2280 .flags = FLAG_ADVANCED,
2283 .label = "-valid",
2284 .type = P_BOOL,
2285 .p_class = P_LOCAL,
2286 .offset = LOCAL_VAR(valid),
2287 .special = NULL,
2288 .enum_list = NULL,
2289 .flags = FLAG_HIDE,
2292 .label = "copy",
2293 .type = P_STRING,
2294 .p_class = P_LOCAL,
2295 .offset = LOCAL_VAR(szCopy),
2296 .special = handle_copy,
2297 .enum_list = NULL,
2298 .flags = FLAG_HIDE,
2301 .label = "include",
2302 .type = P_STRING,
2303 .p_class = P_LOCAL,
2304 .offset = LOCAL_VAR(szInclude),
2305 .special = handle_include,
2306 .enum_list = NULL,
2307 .flags = FLAG_HIDE|FLAG_META,
2310 .label = "preexec",
2311 .type = P_STRING,
2312 .p_class = P_LOCAL,
2313 .offset = LOCAL_VAR(szPreExec),
2314 .special = NULL,
2315 .enum_list = NULL,
2316 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
2319 .label = "exec",
2320 .type = P_STRING,
2321 .p_class = P_LOCAL,
2322 .offset = LOCAL_VAR(szPreExec),
2323 .special = NULL,
2324 .enum_list = NULL,
2325 .flags = FLAG_ADVANCED,
2328 .label = "preexec close",
2329 .type = P_BOOL,
2330 .p_class = P_LOCAL,
2331 .offset = LOCAL_VAR(bPreexecClose),
2332 .special = NULL,
2333 .enum_list = NULL,
2334 .flags = FLAG_ADVANCED | FLAG_SHARE,
2337 .label = "postexec",
2338 .type = P_STRING,
2339 .p_class = P_LOCAL,
2340 .offset = LOCAL_VAR(szPostExec),
2341 .special = NULL,
2342 .enum_list = NULL,
2343 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
2346 .label = "root preexec",
2347 .type = P_STRING,
2348 .p_class = P_LOCAL,
2349 .offset = LOCAL_VAR(szRootPreExec),
2350 .special = NULL,
2351 .enum_list = NULL,
2352 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
2355 .label = "root preexec close",
2356 .type = P_BOOL,
2357 .p_class = P_LOCAL,
2358 .offset = LOCAL_VAR(bRootpreexecClose),
2359 .special = NULL,
2360 .enum_list = NULL,
2361 .flags = FLAG_ADVANCED | FLAG_SHARE,
2364 .label = "root postexec",
2365 .type = P_STRING,
2366 .p_class = P_LOCAL,
2367 .offset = LOCAL_VAR(szRootPostExec),
2368 .special = NULL,
2369 .enum_list = NULL,
2370 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
2373 .label = "available",
2374 .type = P_BOOL,
2375 .p_class = P_LOCAL,
2376 .offset = LOCAL_VAR(bAvailable),
2377 .special = NULL,
2378 .enum_list = NULL,
2379 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
2382 .label = "registry shares",
2383 .type = P_BOOL,
2384 .p_class = P_GLOBAL,
2385 .offset = GLOBAL_VAR(bRegistryShares),
2386 .special = NULL,
2387 .enum_list = NULL,
2388 .flags = FLAG_ADVANCED,
2391 .label = "usershare allow guests",
2392 .type = P_BOOL,
2393 .p_class = P_GLOBAL,
2394 .offset = GLOBAL_VAR(bUsershareAllowGuests),
2395 .special = NULL,
2396 .enum_list = NULL,
2397 .flags = FLAG_ADVANCED,
2400 .label = "usershare max shares",
2401 .type = P_INTEGER,
2402 .p_class = P_GLOBAL,
2403 .offset = GLOBAL_VAR(iUsershareMaxShares),
2404 .special = NULL,
2405 .enum_list = NULL,
2406 .flags = FLAG_ADVANCED,
2409 .label = "usershare owner only",
2410 .type = P_BOOL,
2411 .p_class = P_GLOBAL,
2412 .offset = GLOBAL_VAR(bUsershareOwnerOnly),
2413 .special = NULL,
2414 .enum_list = NULL,
2415 .flags = FLAG_ADVANCED,
2418 .label = "usershare path",
2419 .type = P_STRING,
2420 .p_class = P_GLOBAL,
2421 .offset = GLOBAL_VAR(szUsersharePath),
2422 .special = NULL,
2423 .enum_list = NULL,
2424 .flags = FLAG_ADVANCED,
2427 .label = "usershare prefix allow list",
2428 .type = P_LIST,
2429 .p_class = P_GLOBAL,
2430 .offset = GLOBAL_VAR(szUsersharePrefixAllowList),
2431 .special = NULL,
2432 .enum_list = NULL,
2433 .flags = FLAG_ADVANCED,
2436 .label = "usershare prefix deny list",
2437 .type = P_LIST,
2438 .p_class = P_GLOBAL,
2439 .offset = GLOBAL_VAR(szUsersharePrefixDenyList),
2440 .special = NULL,
2441 .enum_list = NULL,
2442 .flags = FLAG_ADVANCED,
2445 .label = "usershare template share",
2446 .type = P_STRING,
2447 .p_class = P_GLOBAL,
2448 .offset = GLOBAL_VAR(szUsershareTemplateShare),
2449 .special = NULL,
2450 .enum_list = NULL,
2451 .flags = FLAG_ADVANCED,
2454 .label = "volume",
2455 .type = P_STRING,
2456 .p_class = P_LOCAL,
2457 .offset = LOCAL_VAR(volume),
2458 .special = NULL,
2459 .enum_list = NULL,
2460 .flags = FLAG_ADVANCED | FLAG_SHARE,
2463 .label = "fstype",
2464 .type = P_STRING,
2465 .p_class = P_LOCAL,
2466 .offset = LOCAL_VAR(fstype),
2467 .special = NULL,
2468 .enum_list = NULL,
2469 .flags = FLAG_ADVANCED | FLAG_SHARE,
2472 .label = "set directory",
2473 .type = P_BOOLREV,
2474 .p_class = P_LOCAL,
2475 .offset = LOCAL_VAR(bNo_set_dir),
2476 .special = NULL,
2477 .enum_list = NULL,
2478 .flags = FLAG_ADVANCED | FLAG_SHARE,
2481 .label = "allow insecure wide links",
2482 .type = P_BOOL,
2483 .p_class = P_GLOBAL,
2484 .offset = GLOBAL_VAR(bAllowInsecureWidelinks),
2485 .special = NULL,
2486 .enum_list = NULL,
2487 .flags = FLAG_ADVANCED,
2490 .label = "wide links",
2491 .type = P_BOOL,
2492 .p_class = P_LOCAL,
2493 .offset = LOCAL_VAR(bWidelinks),
2494 .special = NULL,
2495 .enum_list = NULL,
2496 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2499 .label = "follow symlinks",
2500 .type = P_BOOL,
2501 .p_class = P_LOCAL,
2502 .offset = LOCAL_VAR(bSymlinks),
2503 .special = NULL,
2504 .enum_list = NULL,
2505 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2508 .label = "dont descend",
2509 .type = P_STRING,
2510 .p_class = P_LOCAL,
2511 .offset = LOCAL_VAR(szDontdescend),
2512 .special = NULL,
2513 .enum_list = NULL,
2514 .flags = FLAG_ADVANCED | FLAG_SHARE,
2517 .label = "magic script",
2518 .type = P_STRING,
2519 .p_class = P_LOCAL,
2520 .offset = LOCAL_VAR(szMagicScript),
2521 .special = NULL,
2522 .enum_list = NULL,
2523 .flags = FLAG_ADVANCED | FLAG_SHARE,
2526 .label = "magic output",
2527 .type = P_STRING,
2528 .p_class = P_LOCAL,
2529 .offset = LOCAL_VAR(szMagicOutput),
2530 .special = NULL,
2531 .enum_list = NULL,
2532 .flags = FLAG_ADVANCED | FLAG_SHARE,
2535 .label = "delete readonly",
2536 .type = P_BOOL,
2537 .p_class = P_LOCAL,
2538 .offset = LOCAL_VAR(bDeleteReadonly),
2539 .special = NULL,
2540 .enum_list = NULL,
2541 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2544 .label = "dos filemode",
2545 .type = P_BOOL,
2546 .p_class = P_LOCAL,
2547 .offset = LOCAL_VAR(bDosFilemode),
2548 .special = NULL,
2549 .enum_list = NULL,
2550 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2553 .label = "dos filetimes",
2554 .type = P_BOOL,
2555 .p_class = P_LOCAL,
2556 .offset = LOCAL_VAR(bDosFiletimes),
2557 .special = NULL,
2558 .enum_list = NULL,
2559 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2562 .label = "dos filetime resolution",
2563 .type = P_BOOL,
2564 .p_class = P_LOCAL,
2565 .offset = LOCAL_VAR(bDosFiletimeResolution),
2566 .special = NULL,
2567 .enum_list = NULL,
2568 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2571 .label = "fake directory create times",
2572 .type = P_BOOL,
2573 .p_class = P_LOCAL,
2574 .offset = LOCAL_VAR(bFakeDirCreateTimes),
2575 .special = NULL,
2576 .enum_list = NULL,
2577 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2580 .label = "async smb echo handler",
2581 .type = P_BOOL,
2582 .p_class = P_GLOBAL,
2583 .offset = GLOBAL_VAR(bAsyncSMBEchoHandler),
2584 .special = NULL,
2585 .enum_list = NULL,
2586 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2589 .label = "panic action",
2590 .type = P_STRING,
2591 .p_class = P_GLOBAL,
2592 .offset = GLOBAL_VAR(szPanicAction),
2593 .special = NULL,
2594 .enum_list = NULL,
2595 .flags = FLAG_ADVANCED,
2598 .label = "perfcount module",
2599 .type = P_STRING,
2600 .p_class = P_GLOBAL,
2601 .offset = GLOBAL_VAR(szSMBPerfcountModule),
2602 .special = NULL,
2603 .enum_list = NULL,
2604 .flags = FLAG_ADVANCED,
2607 {N_("VFS module options"), P_SEP, P_SEPARATOR},
2610 .label = "vfs objects",
2611 .type = P_LIST,
2612 .p_class = P_LOCAL,
2613 .offset = LOCAL_VAR(szVfsObjects),
2614 .special = NULL,
2615 .enum_list = NULL,
2616 .flags = FLAG_ADVANCED | FLAG_SHARE,
2619 .label = "vfs object",
2620 .type = P_LIST,
2621 .p_class = P_LOCAL,
2622 .offset = LOCAL_VAR(szVfsObjects),
2623 .special = NULL,
2624 .enum_list = NULL,
2625 .flags = FLAG_HIDE,
2629 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
2632 .label = "msdfs root",
2633 .type = P_BOOL,
2634 .p_class = P_LOCAL,
2635 .offset = LOCAL_VAR(bMSDfsRoot),
2636 .special = NULL,
2637 .enum_list = NULL,
2638 .flags = FLAG_ADVANCED | FLAG_SHARE,
2641 .label = "msdfs proxy",
2642 .type = P_STRING,
2643 .p_class = P_LOCAL,
2644 .offset = LOCAL_VAR(szMSDfsProxy),
2645 .special = NULL,
2646 .enum_list = NULL,
2647 .flags = FLAG_ADVANCED | FLAG_SHARE,
2650 .label = "host msdfs",
2651 .type = P_BOOL,
2652 .p_class = P_GLOBAL,
2653 .offset = GLOBAL_VAR(bHostMSDfs),
2654 .special = NULL,
2655 .enum_list = NULL,
2656 .flags = FLAG_ADVANCED,
2659 {N_("Winbind options"), P_SEP, P_SEPARATOR},
2662 .label = "passdb expand explicit",
2663 .type = P_BOOL,
2664 .p_class = P_GLOBAL,
2665 .offset = GLOBAL_VAR(bPassdbExpandExplicit),
2666 .special = NULL,
2667 .enum_list = NULL,
2668 .flags = FLAG_ADVANCED,
2671 .label = "idmap backend",
2672 .type = P_STRING,
2673 .p_class = P_GLOBAL,
2674 .offset = GLOBAL_VAR(szIdmapBackend),
2675 .special = handle_idmap_backend,
2676 .enum_list = NULL,
2677 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
2680 .label = "idmap cache time",
2681 .type = P_INTEGER,
2682 .p_class = P_GLOBAL,
2683 .offset = GLOBAL_VAR(iIdmapCacheTime),
2684 .special = NULL,
2685 .enum_list = NULL,
2686 .flags = FLAG_ADVANCED,
2689 .label = "idmap negative cache time",
2690 .type = P_INTEGER,
2691 .p_class = P_GLOBAL,
2692 .offset = GLOBAL_VAR(iIdmapNegativeCacheTime),
2693 .special = NULL,
2694 .enum_list = NULL,
2695 .flags = FLAG_ADVANCED,
2698 .label = "idmap uid",
2699 .type = P_STRING,
2700 .p_class = P_GLOBAL,
2701 .offset = GLOBAL_VAR(szIdmapUID),
2702 .special = handle_idmap_uid,
2703 .enum_list = NULL,
2704 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
2707 .label = "winbind uid",
2708 .type = P_STRING,
2709 .p_class = P_GLOBAL,
2710 .offset = GLOBAL_VAR(szIdmapUID),
2711 .special = handle_idmap_uid,
2712 .enum_list = NULL,
2713 .flags = FLAG_HIDE,
2716 .label = "idmap gid",
2717 .type = P_STRING,
2718 .p_class = P_GLOBAL,
2719 .offset = GLOBAL_VAR(szIdmapGID),
2720 .special = handle_idmap_gid,
2721 .enum_list = NULL,
2722 .flags = FLAG_ADVANCED | FLAG_DEPRECATED,
2725 .label = "winbind gid",
2726 .type = P_STRING,
2727 .p_class = P_GLOBAL,
2728 .offset = GLOBAL_VAR(szIdmapGID),
2729 .special = handle_idmap_gid,
2730 .enum_list = NULL,
2731 .flags = FLAG_HIDE,
2734 .label = "template homedir",
2735 .type = P_STRING,
2736 .p_class = P_GLOBAL,
2737 .offset = GLOBAL_VAR(szTemplateHomedir),
2738 .special = NULL,
2739 .enum_list = NULL,
2740 .flags = FLAG_ADVANCED,
2743 .label = "template shell",
2744 .type = P_STRING,
2745 .p_class = P_GLOBAL,
2746 .offset = GLOBAL_VAR(szTemplateShell),
2747 .special = NULL,
2748 .enum_list = NULL,
2749 .flags = FLAG_ADVANCED,
2752 .label = "winbind separator",
2753 .type = P_STRING,
2754 .p_class = P_GLOBAL,
2755 .offset = GLOBAL_VAR(szWinbindSeparator),
2756 .special = NULL,
2757 .enum_list = NULL,
2758 .flags = FLAG_ADVANCED,
2761 .label = "winbind cache time",
2762 .type = P_INTEGER,
2763 .p_class = P_GLOBAL,
2764 .offset = GLOBAL_VAR(winbind_cache_time),
2765 .special = NULL,
2766 .enum_list = NULL,
2767 .flags = FLAG_ADVANCED,
2770 .label = "winbind reconnect delay",
2771 .type = P_INTEGER,
2772 .p_class = P_GLOBAL,
2773 .offset = GLOBAL_VAR(winbind_reconnect_delay),
2774 .special = NULL,
2775 .enum_list = NULL,
2776 .flags = FLAG_ADVANCED,
2779 .label = "winbind max clients",
2780 .type = P_INTEGER,
2781 .p_class = P_GLOBAL,
2782 .offset = GLOBAL_VAR(winbind_max_clients),
2783 .special = NULL,
2784 .enum_list = NULL,
2785 .flags = FLAG_ADVANCED,
2788 .label = "winbind enum users",
2789 .type = P_BOOL,
2790 .p_class = P_GLOBAL,
2791 .offset = GLOBAL_VAR(bWinbindEnumUsers),
2792 .special = NULL,
2793 .enum_list = NULL,
2794 .flags = FLAG_ADVANCED,
2797 .label = "winbind enum groups",
2798 .type = P_BOOL,
2799 .p_class = P_GLOBAL,
2800 .offset = GLOBAL_VAR(bWinbindEnumGroups),
2801 .special = NULL,
2802 .enum_list = NULL,
2803 .flags = FLAG_ADVANCED,
2806 .label = "winbind use default domain",
2807 .type = P_BOOL,
2808 .p_class = P_GLOBAL,
2809 .offset = GLOBAL_VAR(bWinbindUseDefaultDomain),
2810 .special = NULL,
2811 .enum_list = NULL,
2812 .flags = FLAG_ADVANCED,
2815 .label = "winbind trusted domains only",
2816 .type = P_BOOL,
2817 .p_class = P_GLOBAL,
2818 .offset = GLOBAL_VAR(bWinbindTrustedDomainsOnly),
2819 .special = NULL,
2820 .enum_list = NULL,
2821 .flags = FLAG_ADVANCED,
2824 .label = "winbind nested groups",
2825 .type = P_BOOL,
2826 .p_class = P_GLOBAL,
2827 .offset = GLOBAL_VAR(bWinbindNestedGroups),
2828 .special = NULL,
2829 .enum_list = NULL,
2830 .flags = FLAG_ADVANCED,
2833 .label = "winbind expand groups",
2834 .type = P_INTEGER,
2835 .p_class = P_GLOBAL,
2836 .offset = GLOBAL_VAR(winbind_expand_groups),
2837 .special = NULL,
2838 .enum_list = NULL,
2839 .flags = FLAG_ADVANCED,
2842 .label = "winbind nss info",
2843 .type = P_LIST,
2844 .p_class = P_GLOBAL,
2845 .offset = GLOBAL_VAR(szWinbindNssInfo),
2846 .special = NULL,
2847 .enum_list = NULL,
2848 .flags = FLAG_ADVANCED,
2851 .label = "winbind refresh tickets",
2852 .type = P_BOOL,
2853 .p_class = P_GLOBAL,
2854 .offset = GLOBAL_VAR(bWinbindRefreshTickets),
2855 .special = NULL,
2856 .enum_list = NULL,
2857 .flags = FLAG_ADVANCED,
2860 .label = "winbind offline logon",
2861 .type = P_BOOL,
2862 .p_class = P_GLOBAL,
2863 .offset = GLOBAL_VAR(bWinbindOfflineLogon),
2864 .special = NULL,
2865 .enum_list = NULL,
2866 .flags = FLAG_ADVANCED,
2869 .label = "winbind normalize names",
2870 .type = P_BOOL,
2871 .p_class = P_GLOBAL,
2872 .offset = GLOBAL_VAR(bWinbindNormalizeNames),
2873 .special = NULL,
2874 .enum_list = NULL,
2875 .flags = FLAG_ADVANCED,
2878 .label = "winbind rpc only",
2879 .type = P_BOOL,
2880 .p_class = P_GLOBAL,
2881 .offset = GLOBAL_VAR(bWinbindRpcOnly),
2882 .special = NULL,
2883 .enum_list = NULL,
2884 .flags = FLAG_ADVANCED,
2887 .label = "create krb5 conf",
2888 .type = P_BOOL,
2889 .p_class = P_GLOBAL,
2890 .offset = GLOBAL_VAR(bCreateKrb5Conf),
2891 .special = NULL,
2892 .enum_list = NULL,
2893 .flags = FLAG_ADVANCED,
2896 .label = "ncalrpc dir",
2897 .type = P_STRING,
2898 .p_class = P_GLOBAL,
2899 .offset = GLOBAL_VAR(ncalrpc_dir),
2900 .special = NULL,
2901 .enum_list = NULL,
2902 .flags = FLAG_ADVANCED,
2905 .label = "winbind max domain connections",
2906 .type = P_INTEGER,
2907 .p_class = P_GLOBAL,
2908 .offset = GLOBAL_VAR(winbindMaxDomainConnections),
2909 .special = NULL,
2910 .enum_list = NULL,
2911 .flags = FLAG_ADVANCED,
2914 .label = "winbindd socket directory",
2915 .type = P_STRING,
2916 .p_class = P_GLOBAL,
2917 .offset = GLOBAL_VAR(szWinbinddSocketDirectory),
2918 .special = NULL,
2919 .enum_list = NULL,
2920 .flags = FLAG_ADVANCED,
2923 .label = "winbindd privileged socket directory",
2924 .type = P_STRING,
2925 .p_class = P_GLOBAL,
2926 .offset = GLOBAL_VAR(szWinbinddPrivilegedSocketDirectory),
2927 .special = NULL,
2928 .enum_list = NULL,
2929 .flags = FLAG_ADVANCED,
2932 .label = "winbind sealed pipes",
2933 .type = P_BOOL,
2934 .p_class = P_GLOBAL,
2935 .offset = GLOBAL_VAR(bWinbindSealedPipes),
2936 .special = NULL,
2937 .enum_list = NULL,
2938 .flags = FLAG_ADVANCED,
2941 {N_("DNS options"), P_SEP, P_SEPARATOR},
2943 .label = "allow dns updates",
2944 .type = P_ENUM,
2945 .p_class = P_GLOBAL,
2946 .offset = GLOBAL_VAR(allow_dns_updates),
2947 .special = NULL,
2948 .enum_list = enum_dns_update_settings,
2949 .flags = FLAG_ADVANCED,
2952 .label = "dns forwarder",
2953 .type = P_STRING,
2954 .p_class = P_GLOBAL,
2955 .offset = GLOBAL_VAR(dns_forwarder),
2956 .special = NULL,
2957 .enum_list = NULL,
2958 .flags = FLAG_ADVANCED,
2961 .label = "dns recursive queries",
2962 .type = P_BOOL,
2963 .p_class = P_GLOBAL,
2964 .offset = GLOBAL_VAR(dns_recursive_queries),
2965 .special = NULL,
2966 .enum_list = NULL
2969 .label = "dns update command",
2970 .type = P_CMDLIST,
2971 .p_class = P_GLOBAL,
2972 .offset = GLOBAL_VAR(szDNSUpdateCommand),
2973 .special = NULL,
2974 .enum_list = NULL,
2975 .flags = FLAG_ADVANCED,
2978 .label = "nsupdate command",
2979 .type = P_CMDLIST,
2980 .p_class = P_GLOBAL,
2981 .offset = GLOBAL_VAR(szNSUpdateCommand),
2982 .special = NULL,
2983 .enum_list = NULL,
2984 .flags = FLAG_ADVANCED,
2987 .label = "rndc command",
2988 .type = P_CMDLIST,
2989 .p_class = P_GLOBAL,
2990 .offset = GLOBAL_VAR(szRNDCCommand),
2991 .special = NULL,
2992 .enum_list = NULL,
2993 .flags = FLAG_ADVANCED,
2996 .label = "multicast dns register",
2997 .type = P_BOOL,
2998 .p_class = P_GLOBAL,
2999 .offset = GLOBAL_VAR(bMulticastDnsRegister),
3000 .special = NULL,
3001 .enum_list = NULL,
3002 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3005 {N_("AD DC options"), P_SEP, P_SEPARATOR},
3008 .label = "samba kcc command",
3009 .type = P_CMDLIST,
3010 .p_class = P_GLOBAL,
3011 .offset = GLOBAL_VAR(szSambaKCCCommand),
3012 .special = NULL,
3013 .enum_list = NULL,
3014 .flags = FLAG_ADVANCED,
3017 .label = "server services",
3018 .type = P_LIST,
3019 .p_class = P_GLOBAL,
3020 .offset = GLOBAL_VAR(server_services),
3021 .special = NULL,
3022 .enum_list = NULL
3025 .label = "dcerpc endpoint servers",
3026 .type = P_LIST,
3027 .p_class = P_GLOBAL,
3028 .offset = GLOBAL_VAR(dcerpc_ep_servers),
3029 .special = NULL,
3030 .enum_list = NULL
3033 .label = "spn update command",
3034 .type = P_CMDLIST,
3035 .p_class = P_GLOBAL,
3036 .offset = GLOBAL_VAR(szSPNUpdateCommand),
3037 .special = NULL,
3038 .enum_list = NULL,
3039 .flags = FLAG_ADVANCED,
3042 .label = "share backend",
3043 .type = P_STRING,
3044 .p_class = P_GLOBAL,
3045 .offset = GLOBAL_VAR(szShareBackend),
3046 .special = NULL,
3047 .enum_list = NULL
3050 .label = "ntvfs handler",
3051 .type = P_LIST,
3052 .p_class = P_LOCAL,
3053 .offset = LOCAL_VAR(ntvfs_handler),
3054 .special = NULL,
3055 .enum_list = NULL
3058 {N_("TLS options"), P_SEP, P_SEPARATOR},
3061 .label = "tls enabled",
3062 .type = P_BOOL,
3063 .p_class = P_GLOBAL,
3064 .offset = GLOBAL_VAR(tls_enabled),
3065 .special = NULL,
3066 .enum_list = NULL
3069 .label = "tls keyfile",
3070 .type = P_STRING,
3071 .p_class = P_GLOBAL,
3072 .offset = GLOBAL_VAR(tls_keyfile),
3073 .special = NULL,
3074 .enum_list = NULL
3077 .label = "tls certfile",
3078 .type = P_STRING,
3079 .p_class = P_GLOBAL,
3080 .offset = GLOBAL_VAR(tls_certfile),
3081 .special = NULL,
3082 .enum_list = NULL
3085 .label = "tls cafile",
3086 .type = P_STRING,
3087 .p_class = P_GLOBAL,
3088 .offset = GLOBAL_VAR(tls_cafile),
3089 .special = NULL,
3090 .enum_list = NULL
3093 .label = "tls crlfile",
3094 .type = P_STRING,
3095 .p_class = P_GLOBAL,
3096 .offset = GLOBAL_VAR(tls_crlfile),
3097 .special = NULL,
3098 .enum_list = NULL
3101 .label = "tls dh params file",
3102 .type = P_STRING,
3103 .p_class = P_GLOBAL,
3104 .offset = GLOBAL_VAR(tls_dhpfile),
3105 .special = NULL,
3106 .enum_list = NULL
3109 {NULL, P_BOOL, P_NONE, 0, NULL, NULL, 0}
3113 /* local variables */
3114 struct loadparm_context {
3115 const char *szConfigFile;
3116 struct loadparm_global *globals;
3117 struct loadparm_service **services;
3118 struct loadparm_service *sDefault;
3119 struct smb_iconv_handle *iconv_handle;
3120 int iNumServices;
3121 struct loadparm_service *currentService;
3122 bool bInGlobalSection;
3123 struct file_lists {
3124 struct file_lists *next;
3125 char *name;
3126 char *subfname;
3127 time_t modtime;
3128 } *file_lists;
3129 unsigned int flags[NUMPARAMETERS];
3130 bool loaded;
3131 bool refuse_free;
3132 bool global; /* Is this the global context, which may set
3133 * global variables such as debug level etc? */
3134 const struct loadparm_s3_helpers *s3_fns;
3138 struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
3140 if (lp_ctx->s3_fns) {
3141 return lp_ctx->s3_fns->get_default_loadparm_service();
3143 return lp_ctx->sDefault;
3147 * Convenience routine to grab string parameters into temporary memory
3148 * and run standard_sub_basic on them.
3150 * The buffers can be written to by
3151 * callers without affecting the source string.
3154 static const char *lp_string(const char *s)
3156 #if 0 /* until REWRITE done to make thread-safe */
3157 size_t len = s ? strlen(s) : 0;
3158 char *ret;
3159 #endif
3161 /* The follow debug is useful for tracking down memory problems
3162 especially if you have an inner loop that is calling a lp_*()
3163 function that returns a string. Perhaps this debug should be
3164 present all the time? */
3166 #if 0
3167 DEBUG(10, ("lp_string(%s)\n", s));
3168 #endif
3170 #if 0 /* until REWRITE done to make thread-safe */
3171 if (!lp_talloc)
3172 lp_talloc = talloc_init("lp_talloc");
3174 ret = talloc_array(lp_talloc, char, len + 100); /* leave room for substitution */
3176 if (!ret)
3177 return NULL;
3179 if (!s)
3180 *ret = 0;
3181 else
3182 strlcpy(ret, s, len);
3184 if (trim_string(ret, "\"", "\"")) {
3185 if (strchr(ret,'"') != NULL)
3186 strlcpy(ret, s, len);
3189 standard_sub_basic(ret,len+100);
3190 return (ret);
3191 #endif
3192 return s;
3196 In this section all the functions that are used to access the
3197 parameters from the rest of the program are defined
3201 * the creation of separate lpcfg_*() and lp_*() functions is to allow
3202 * for code compatibility between existing Samba4 and Samba3 code.
3205 /* this global context supports the lp_*() function varients */
3206 static struct loadparm_context *global_loadparm_context;
3208 #define lpcfg_default_service global_loadparm_context->sDefault
3209 #define lpcfg_global_service(i) global_loadparm_context->services[i]
3211 #define FN_GLOBAL_STRING(fn_name,var_name) \
3212 _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
3213 if (lp_ctx == NULL) return NULL; \
3214 if (lp_ctx->s3_fns) { \
3215 SMB_ASSERT(lp_ctx->s3_fns->fn_name); \
3216 return lp_ctx->s3_fns->fn_name(); \
3218 return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \
3221 #define FN_GLOBAL_CONST_STRING(fn_name,var_name) \
3222 _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\
3223 if (lp_ctx == NULL) return NULL; \
3224 if (lp_ctx->s3_fns) { \
3225 SMB_ASSERT(lp_ctx->s3_fns->fn_name); \
3226 return lp_ctx->s3_fns->fn_name(); \
3228 return lp_ctx->globals->var_name ? lp_string(lp_ctx->globals->var_name) : ""; \
3231 #define FN_GLOBAL_LIST(fn_name,var_name) \
3232 _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
3233 if (lp_ctx == NULL) return NULL; \
3234 if (lp_ctx->s3_fns) { \
3235 SMB_ASSERT(lp_ctx->s3_fns->fn_name); \
3236 return lp_ctx->s3_fns->fn_name(); \
3238 return lp_ctx->globals->var_name; \
3241 #define FN_GLOBAL_BOOL(fn_name,var_name) \
3242 _PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) {\
3243 if (lp_ctx == NULL) return false; \
3244 if (lp_ctx->s3_fns) { \
3245 SMB_ASSERT(lp_ctx->s3_fns->fn_name); \
3246 return lp_ctx->s3_fns->fn_name(); \
3248 return lp_ctx->globals->var_name; \
3251 #define FN_GLOBAL_INTEGER(fn_name,var_name) \
3252 _PUBLIC_ int lpcfg_ ## fn_name(struct loadparm_context *lp_ctx) { \
3253 if (lp_ctx->s3_fns) { \
3254 SMB_ASSERT(lp_ctx->s3_fns->fn_name); \
3255 return lp_ctx->s3_fns->fn_name(); \
3257 return lp_ctx->globals->var_name; \
3260 /* Local parameters don't need the ->s3_fns because the struct
3261 * loadparm_service is shared and lpcfg_service() checks the ->s3_fns
3262 * hook */
3263 #define FN_LOCAL_STRING(fn_name,val) \
3264 _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
3265 struct loadparm_service *sDefault) { \
3266 return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val))); \
3269 #define FN_LOCAL_CONST_STRING(fn_name,val) FN_LOCAL_STRING(fn_name, val)
3271 #define FN_LOCAL_LIST(fn_name,val) \
3272 _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_service *service, \
3273 struct loadparm_service *sDefault) {\
3274 return(const char **)(service != NULL && service->val != NULL? service->val : sDefault->val); \
3277 #define FN_LOCAL_PARM_BOOL(fn_name, val) FN_LOCAL_BOOL(fn_name, val)
3279 #define FN_LOCAL_BOOL(fn_name,val) \
3280 _PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_service *service, \
3281 struct loadparm_service *sDefault) { \
3282 return((service != NULL)? service->val : sDefault->val); \
3285 #define FN_LOCAL_INTEGER(fn_name,val) \
3286 _PUBLIC_ int lpcfg_ ## fn_name(struct loadparm_service *service, \
3287 struct loadparm_service *sDefault) { \
3288 return((service != NULL)? service->val : sDefault->val); \
3291 #define FN_LOCAL_PARM_INTEGER(fn_name, val) FN_LOCAL_INTEGER(fn_name, val)
3293 #define FN_LOCAL_PARM_CHAR(fn_name, val) FN_LOCAL_CHAR(fn_name, val)
3295 #define FN_LOCAL_CHAR(fn_name,val) \
3296 _PUBLIC_ char lpcfg_ ## fn_name(struct loadparm_service *service, \
3297 struct loadparm_service *sDefault) { \
3298 return((service != NULL)? service->val : sDefault->val); \
3301 #include "lib/param/param_functions.c"
3303 /* These functions remain only in lib/param for now */
3304 FN_GLOBAL_BOOL(readraw, bReadRaw)
3305 FN_GLOBAL_BOOL(writeraw, bWriteRaw)
3306 FN_GLOBAL_STRING(cachedir, szCacheDir)
3307 FN_GLOBAL_STRING(socket_address, szSocketAddress)
3308 FN_GLOBAL_STRING(statedir, szStateDir)
3310 /* local prototypes */
3311 static int map_parameter(const char *pszParmName);
3312 static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx,
3313 const char *pszServiceName);
3314 static void copy_service(struct loadparm_service *pserviceDest,
3315 struct loadparm_service *pserviceSource,
3316 struct bitmap *pcopymapDest);
3317 static bool lpcfg_service_ok(struct loadparm_service *service);
3318 static bool do_section(const char *pszSectionName, void *);
3319 static void init_copymap(struct loadparm_service *pservice);
3321 /* This is a helper function for parametrical options support. */
3322 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
3323 /* Actual parametrical functions are quite simple */
3324 const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
3325 struct loadparm_service *service,
3326 const char *type, const char *option)
3328 char *vfskey_tmp = NULL;
3329 char *vfskey = NULL;
3330 struct parmlist_entry *data;
3332 if (lp_ctx == NULL)
3333 return NULL;
3335 if (lp_ctx->s3_fns) {
3336 return lp_ctx->s3_fns->get_parametric(service, type, option);
3339 data = (service == NULL ? lp_ctx->globals->param_opt : service->param_opt);
3341 vfskey_tmp = talloc_asprintf(NULL, "%s:%s", type, option);
3342 if (vfskey_tmp == NULL) return NULL;
3343 vfskey = strlower_talloc(NULL, vfskey_tmp);
3344 talloc_free(vfskey_tmp);
3346 while (data) {
3347 if (strcmp(data->key, vfskey) == 0) {
3348 talloc_free(vfskey);
3349 return data->value;
3351 data = data->next;
3354 if (service != NULL) {
3355 /* Try to fetch the same option but from globals */
3356 /* but only if we are not already working with globals */
3357 for (data = lp_ctx->globals->param_opt; data;
3358 data = data->next) {
3359 if (strcmp(data->key, vfskey) == 0) {
3360 talloc_free(vfskey);
3361 return data->value;
3366 talloc_free(vfskey);
3368 return NULL;
3373 * convenience routine to return int parameters.
3375 static int lp_int(const char *s)
3378 if (!s) {
3379 DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
3380 return -1;
3383 return strtol(s, NULL, 0);
3387 * convenience routine to return unsigned long parameters.
3389 static unsigned long lp_ulong(const char *s)
3392 if (!s) {
3393 DEBUG(0,("lp_ulong(%s): is called with NULL!\n",s));
3394 return -1;
3397 return strtoul(s, NULL, 0);
3401 * convenience routine to return unsigned long parameters.
3403 static long lp_long(const char *s)
3406 if (!s) {
3407 DEBUG(0,("lp_long(%s): is called with NULL!\n",s));
3408 return -1;
3411 return strtol(s, NULL, 0);
3415 * convenience routine to return unsigned long parameters.
3417 static double lp_double(const char *s)
3420 if (!s) {
3421 DEBUG(0,("lp_double(%s): is called with NULL!\n",s));
3422 return -1;
3425 return strtod(s, NULL);
3429 * convenience routine to return boolean parameters.
3431 static bool lp_bool(const char *s)
3433 bool ret = false;
3435 if (!s) {
3436 DEBUG(0,("lp_bool(%s): is called with NULL!\n",s));
3437 return false;
3440 if (!set_boolean(s, &ret)) {
3441 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
3442 return false;
3445 return ret;
3450 * Return parametric option from a given service. Type is a part of option before ':'
3451 * Parametric option has following syntax: 'Type: option = value'
3452 * Returned value is allocated in 'lp_talloc' context
3455 const char *lpcfg_parm_string(struct loadparm_context *lp_ctx,
3456 struct loadparm_service *service, const char *type,
3457 const char *option)
3459 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3461 if (value)
3462 return lp_string(value);
3464 return NULL;
3468 * Return parametric option from a given service. Type is a part of option before ':'
3469 * Parametric option has following syntax: 'Type: option = value'
3470 * Returned value is allocated in 'lp_talloc' context
3473 const char **lpcfg_parm_string_list(TALLOC_CTX *mem_ctx,
3474 struct loadparm_context *lp_ctx,
3475 struct loadparm_service *service,
3476 const char *type,
3477 const char *option, const char *separator)
3479 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3481 if (value != NULL)
3482 return (const char **)str_list_make(mem_ctx, value, separator);
3484 return NULL;
3488 * Return parametric option from a given service. Type is a part of option before ':'
3489 * Parametric option has following syntax: 'Type: option = value'
3492 int lpcfg_parm_int(struct loadparm_context *lp_ctx,
3493 struct loadparm_service *service, const char *type,
3494 const char *option, int default_v)
3496 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3498 if (value)
3499 return lp_int(value);
3501 return default_v;
3505 * Return parametric option from a given service. Type is a part of
3506 * option before ':'.
3507 * Parametric option has following syntax: 'Type: option = value'.
3510 int lpcfg_parm_bytes(struct loadparm_context *lp_ctx,
3511 struct loadparm_service *service, const char *type,
3512 const char *option, int default_v)
3514 uint64_t bval;
3516 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3518 if (value && conv_str_size_error(value, &bval)) {
3519 if (bval <= INT_MAX) {
3520 return (int)bval;
3524 return default_v;
3528 * Return parametric option from a given service.
3529 * Type is a part of option before ':'
3530 * Parametric option has following syntax: 'Type: option = value'
3532 unsigned long lpcfg_parm_ulong(struct loadparm_context *lp_ctx,
3533 struct loadparm_service *service, const char *type,
3534 const char *option, unsigned long default_v)
3536 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3538 if (value)
3539 return lp_ulong(value);
3541 return default_v;
3544 long lpcfg_parm_long(struct loadparm_context *lp_ctx,
3545 struct loadparm_service *service, const char *type,
3546 const char *option, long default_v)
3548 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3550 if (value)
3551 return lp_long(value);
3553 return default_v;
3556 double lpcfg_parm_double(struct loadparm_context *lp_ctx,
3557 struct loadparm_service *service, const char *type,
3558 const char *option, double default_v)
3560 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3562 if (value != NULL)
3563 return lp_double(value);
3565 return default_v;
3569 * Return parametric option from a given service. Type is a part of option before ':'
3570 * Parametric option has following syntax: 'Type: option = value'
3573 bool lpcfg_parm_bool(struct loadparm_context *lp_ctx,
3574 struct loadparm_service *service, const char *type,
3575 const char *option, bool default_v)
3577 const char *value = lpcfg_get_parametric(lp_ctx, service, type, option);
3579 if (value != NULL)
3580 return lp_bool(value);
3582 return default_v;
3587 * Initialise a service to the defaults.
3590 static struct loadparm_service *init_service(TALLOC_CTX *mem_ctx, struct loadparm_service *sDefault)
3592 struct loadparm_service *pservice =
3593 talloc_zero(mem_ctx, struct loadparm_service);
3594 copy_service(pservice, sDefault, NULL);
3595 return pservice;
3599 * Set a string value, deallocating any existing space, and allocing the space
3600 * for the string
3602 static bool lpcfg_string_set(TALLOC_CTX *mem_ctx, char **dest, const char *src)
3604 talloc_free(*dest);
3606 if (src == NULL)
3607 src = "";
3609 *dest = talloc_strdup(mem_ctx, src);
3610 if ((*dest) == NULL) {
3611 DEBUG(0,("Out of memory in string_set\n"));
3612 return false;
3615 return true;
3619 * Set a string value, deallocating any existing space, and allocing the space
3620 * for the string
3622 static bool lpcfg_string_set_upper(TALLOC_CTX *mem_ctx, char **dest, const char *src)
3624 talloc_free(*dest);
3626 if (src == NULL)
3627 src = "";
3629 *dest = strupper_talloc(mem_ctx, src);
3630 if ((*dest) == NULL) {
3631 DEBUG(0,("Out of memory in string_set_upper\n"));
3632 return false;
3635 return true;
3641 * Add a new service to the services array initialising it with the given
3642 * service.
3645 struct loadparm_service *lpcfg_add_service(struct loadparm_context *lp_ctx,
3646 const struct loadparm_service *pservice,
3647 const char *name)
3649 int i;
3650 struct loadparm_service tservice;
3651 int num_to_alloc = lp_ctx->iNumServices + 1;
3652 struct parmlist_entry *data, *pdata;
3654 if (pservice == NULL) {
3655 pservice = lp_ctx->sDefault;
3658 tservice = *pservice;
3660 /* it might already exist */
3661 if (name) {
3662 struct loadparm_service *service = getservicebyname(lp_ctx,
3663 name);
3664 if (service != NULL) {
3665 /* Clean all parametric options for service */
3666 /* They will be added during parsing again */
3667 data = service->param_opt;
3668 while (data) {
3669 pdata = data->next;
3670 talloc_free(data);
3671 data = pdata;
3673 service->param_opt = NULL;
3674 return service;
3678 /* find an invalid one */
3679 for (i = 0; i < lp_ctx->iNumServices; i++)
3680 if (lp_ctx->services[i] == NULL)
3681 break;
3683 /* if not, then create one */
3684 if (i == lp_ctx->iNumServices) {
3685 struct loadparm_service **tsp;
3687 tsp = talloc_realloc(lp_ctx, lp_ctx->services, struct loadparm_service *, num_to_alloc);
3689 if (!tsp) {
3690 DEBUG(0,("lpcfg_add_service: failed to enlarge services!\n"));
3691 return NULL;
3692 } else {
3693 lp_ctx->services = tsp;
3694 lp_ctx->services[lp_ctx->iNumServices] = NULL;
3697 lp_ctx->iNumServices++;
3700 lp_ctx->services[i] = init_service(lp_ctx->services, lp_ctx->sDefault);
3701 if (lp_ctx->services[i] == NULL) {
3702 DEBUG(0,("lpcfg_add_service: out of memory!\n"));
3703 return NULL;
3705 copy_service(lp_ctx->services[i], &tservice, NULL);
3706 if (name != NULL)
3707 lpcfg_string_set(lp_ctx->services[i], &lp_ctx->services[i]->szService, name);
3708 return lp_ctx->services[i];
3712 * Add a new home service, with the specified home directory, defaults coming
3713 * from service ifrom.
3716 bool lpcfg_add_home(struct loadparm_context *lp_ctx,
3717 const char *pszHomename,
3718 struct loadparm_service *default_service,
3719 const char *user, const char *pszHomedir)
3721 struct loadparm_service *service;
3723 service = lpcfg_add_service(lp_ctx, default_service, pszHomename);
3725 if (service == NULL)
3726 return false;
3728 if (!(*(default_service->szPath))
3729 || strequal(default_service->szPath, lp_ctx->sDefault->szPath)) {
3730 service->szPath = talloc_strdup(service, pszHomedir);
3731 } else {
3732 service->szPath = string_sub_talloc(service, lpcfg_pathname(default_service, lp_ctx->sDefault), "%H", pszHomedir);
3735 if (!(*(service->comment))) {
3736 service->comment = talloc_asprintf(service, "Home directory of %s", user);
3738 service->bAvailable = default_service->bAvailable;
3739 service->bBrowseable = default_service->bBrowseable;
3741 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n",
3742 pszHomename, user, service->szPath));
3744 return true;
3748 * Add a new printer service, with defaults coming from service iFrom.
3751 bool lpcfg_add_printer(struct loadparm_context *lp_ctx,
3752 const char *pszPrintername,
3753 struct loadparm_service *default_service)
3755 const char *comment = "From Printcap";
3756 struct loadparm_service *service;
3757 service = lpcfg_add_service(lp_ctx, default_service, pszPrintername);
3759 if (service == NULL)
3760 return false;
3762 /* note that we do NOT default the availability flag to True - */
3763 /* we take it from the default service passed. This allows all */
3764 /* dynamic printers to be disabled by disabling the [printers] */
3765 /* entry (if/when the 'available' keyword is implemented!). */
3767 /* the printer name is set to the service name. */
3768 lpcfg_string_set(service, &service->szPrintername, pszPrintername);
3769 lpcfg_string_set(service, &service->comment, comment);
3770 service->bBrowseable = default_service->bBrowseable;
3771 /* Printers cannot be read_only. */
3772 service->bRead_only = false;
3773 /* Printer services must be printable. */
3774 service->bPrint_ok = true;
3776 DEBUG(3, ("adding printer service %s\n", pszPrintername));
3778 return true;
3782 * Map a parameter's string representation to something we can use.
3783 * Returns False if the parameter string is not recognised, else TRUE.
3786 static int map_parameter(const char *pszParmName)
3788 int iIndex;
3790 if (*pszParmName == '-')
3791 return -1;
3793 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
3794 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
3795 return iIndex;
3797 /* Warn only if it isn't parametric option */
3798 if (strchr(pszParmName, ':') == NULL)
3799 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
3800 /* We do return 'fail' for parametric options as well because they are
3801 stored in different storage
3803 return -1;
3808 return the parameter structure for a parameter
3810 struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name)
3812 int parmnum;
3814 if (lp_ctx->s3_fns) {
3815 return lp_ctx->s3_fns->get_parm_struct(name);
3818 parmnum = map_parameter(name);
3819 if (parmnum == -1) return NULL;
3820 return &parm_table[parmnum];
3824 return the parameter pointer for a parameter
3826 void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
3827 struct loadparm_service *service, struct parm_struct *parm)
3829 if (lp_ctx->s3_fns) {
3830 return lp_ctx->s3_fns->get_parm_ptr(service, parm);
3833 if (service == NULL) {
3834 if (parm->p_class == P_LOCAL)
3835 return ((char *)lp_ctx->sDefault)+parm->offset;
3836 else if (parm->p_class == P_GLOBAL)
3837 return ((char *)lp_ctx->globals)+parm->offset;
3838 else return NULL;
3839 } else {
3840 return ((char *)service) + parm->offset;
3845 return the parameter pointer for a parameter
3847 bool lpcfg_parm_is_cmdline(struct loadparm_context *lp_ctx, const char *name)
3849 int parmnum;
3851 if (lp_ctx->s3_fns) {
3852 struct parm_struct *parm = lp_ctx->s3_fns->get_parm_struct(name);
3853 if (parm) {
3854 return parm->flags & FLAG_CMDLINE;
3856 return false;
3859 parmnum = map_parameter(name);
3860 if (parmnum == -1) return false;
3862 return lp_ctx->flags[parmnum] & FLAG_CMDLINE;
3866 * Find a service by name. Otherwise works like get_service.
3869 static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx,
3870 const char *pszServiceName)
3872 int iService;
3874 if (lp_ctx->s3_fns) {
3875 return lp_ctx->s3_fns->get_service(pszServiceName);
3878 for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--)
3879 if (lp_ctx->services[iService] != NULL &&
3880 strwicmp(lp_ctx->services[iService]->szService, pszServiceName) == 0) {
3881 return lp_ctx->services[iService];
3884 return NULL;
3888 * Copy a service structure to another.
3889 * If pcopymapDest is NULL then copy all fields
3892 static void copy_service(struct loadparm_service *pserviceDest,
3893 struct loadparm_service *pserviceSource,
3894 struct bitmap *pcopymapDest)
3896 int i;
3897 bool bcopyall = (pcopymapDest == NULL);
3898 struct parmlist_entry *data, *pdata, *paramo;
3899 bool not_added;
3901 for (i = 0; parm_table[i].label; i++)
3902 if (parm_table[i].p_class == P_LOCAL &&
3903 (bcopyall || bitmap_query(pcopymapDest, i))) {
3904 void *src_ptr =
3905 ((char *)pserviceSource) + parm_table[i].offset;
3906 void *dest_ptr =
3907 ((char *)pserviceDest) + parm_table[i].offset;
3909 switch (parm_table[i].type) {
3910 case P_BOOL:
3911 *(bool *)dest_ptr = *(bool *)src_ptr;
3912 break;
3914 case P_INTEGER:
3915 case P_BYTES:
3916 case P_OCTAL:
3917 case P_ENUM:
3918 *(int *)dest_ptr = *(int *)src_ptr;
3919 break;
3921 case P_STRING:
3922 lpcfg_string_set(pserviceDest,
3923 (char **)dest_ptr,
3924 *(char **)src_ptr);
3925 break;
3927 case P_USTRING:
3928 lpcfg_string_set_upper(pserviceDest,
3929 (char **)dest_ptr,
3930 *(char **)src_ptr);
3931 break;
3932 case P_LIST:
3933 *(const char ***)dest_ptr = (const char **)str_list_copy(pserviceDest,
3934 *(const char ***)src_ptr);
3935 break;
3936 default:
3937 break;
3941 if (bcopyall) {
3942 init_copymap(pserviceDest);
3943 if (pserviceSource->copymap)
3944 bitmap_copy(pserviceDest->copymap,
3945 pserviceSource->copymap);
3948 data = pserviceSource->param_opt;
3949 while (data) {
3950 not_added = true;
3951 pdata = pserviceDest->param_opt;
3952 /* Traverse destination */
3953 while (pdata) {
3954 /* If we already have same option, override it */
3955 if (strcmp(pdata->key, data->key) == 0) {
3956 talloc_free(pdata->value);
3957 pdata->value = talloc_strdup(pdata,
3958 data->value);
3959 not_added = false;
3960 break;
3962 pdata = pdata->next;
3964 if (not_added) {
3965 paramo = talloc_zero(pserviceDest, struct parmlist_entry);
3966 if (paramo == NULL)
3967 smb_panic("OOM");
3968 paramo->key = talloc_strdup(paramo, data->key);
3969 paramo->value = talloc_strdup(paramo, data->value);
3970 DLIST_ADD(pserviceDest->param_opt, paramo);
3972 data = data->next;
3977 * Check a service for consistency. Return False if the service is in any way
3978 * incomplete or faulty, else True.
3980 static bool lpcfg_service_ok(struct loadparm_service *service)
3982 bool bRetval;
3984 bRetval = true;
3985 if (service->szService[0] == '\0') {
3986 DEBUG(0, ("The following message indicates an internal error:\n"));
3987 DEBUG(0, ("No service name in service entry.\n"));
3988 bRetval = false;
3991 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
3992 /* I can't see why you'd want a non-printable printer service... */
3993 if (strwicmp(service->szService, PRINTERS_NAME) == 0) {
3994 if (!service->bPrint_ok) {
3995 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
3996 service->szService));
3997 service->bPrint_ok = true;
3999 /* [printers] service must also be non-browsable. */
4000 if (service->bBrowseable)
4001 service->bBrowseable = false;
4004 /* If a service is flagged unavailable, log the fact at level 0. */
4005 if (!service->bAvailable)
4006 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
4007 service->szService));
4009 return bRetval;
4013 /*******************************************************************
4014 Keep a linked list of all config files so we know when one has changed
4015 it's date and needs to be reloaded.
4016 ********************************************************************/
4018 static void add_to_file_list(struct loadparm_context *lp_ctx,
4019 const char *fname, const char *subfname)
4021 struct file_lists *f = lp_ctx->file_lists;
4023 while (f) {
4024 if (f->name && !strcmp(f->name, fname))
4025 break;
4026 f = f->next;
4029 if (!f) {
4030 f = talloc(lp_ctx, struct file_lists);
4031 if (!f)
4032 return;
4033 f->next = lp_ctx->file_lists;
4034 f->name = talloc_strdup(f, fname);
4035 if (!f->name) {
4036 talloc_free(f);
4037 return;
4039 f->subfname = talloc_strdup(f, subfname);
4040 if (!f->subfname) {
4041 talloc_free(f);
4042 return;
4044 lp_ctx->file_lists = f;
4045 f->modtime = file_modtime(subfname);
4046 } else {
4047 time_t t = file_modtime(subfname);
4048 if (t)
4049 f->modtime = t;
4053 /*******************************************************************
4054 Check if a config file has changed date.
4055 ********************************************************************/
4056 bool lpcfg_file_list_changed(struct loadparm_context *lp_ctx)
4058 struct file_lists *f;
4059 DEBUG(6, ("lp_file_list_changed()\n"));
4061 for (f = lp_ctx->file_lists; f != NULL; f = f->next) {
4062 char *n2;
4063 time_t mod_time;
4065 n2 = standard_sub_basic(lp_ctx, f->name);
4067 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
4068 f->name, n2, ctime(&f->modtime)));
4070 mod_time = file_modtime(n2);
4072 if (mod_time && ((f->modtime != mod_time) || (f->subfname == NULL) || (strcmp(n2, f->subfname) != 0))) {
4073 DEBUGADD(6, ("file %s modified: %s\n", n2,
4074 ctime(&mod_time)));
4075 f->modtime = mod_time;
4076 talloc_free(f->subfname);
4077 f->subfname = talloc_strdup(f, n2);
4078 return true;
4081 return false;
4084 /***************************************************************************
4085 Handle the "realm" parameter
4086 ***************************************************************************/
4088 static bool handle_realm(struct loadparm_context *lp_ctx, int unused,
4089 const char *pszParmValue, char **ptr)
4091 lpcfg_string_set(lp_ctx, ptr, pszParmValue);
4093 talloc_free(lp_ctx->globals->szRealm_upper);
4094 talloc_free(lp_ctx->globals->szRealm_lower);
4096 lp_ctx->globals->szRealm_upper = strupper_talloc(lp_ctx, pszParmValue);
4097 lp_ctx->globals->szRealm_lower = strlower_talloc(lp_ctx, pszParmValue);
4099 return true;
4102 /***************************************************************************
4103 Handle the include operation.
4104 ***************************************************************************/
4106 static bool handle_include(struct loadparm_context *lp_ctx, int unused,
4107 const char *pszParmValue, char **ptr)
4109 char *fname = standard_sub_basic(lp_ctx, pszParmValue);
4111 add_to_file_list(lp_ctx, pszParmValue, fname);
4113 lpcfg_string_set(lp_ctx, ptr, fname);
4115 if (file_exist(fname))
4116 return pm_process(fname, do_section, do_parameter, lp_ctx);
4118 DEBUG(2, ("Can't find include file %s\n", fname));
4120 return false;
4123 /***************************************************************************
4124 Handle the interpretation of the copy parameter.
4125 ***************************************************************************/
4127 static bool handle_copy(struct loadparm_context *lp_ctx, int unused,
4128 const char *pszParmValue, char **ptr)
4130 bool bRetval;
4131 struct loadparm_service *serviceTemp;
4133 lpcfg_string_set(lp_ctx, ptr, pszParmValue);
4135 bRetval = false;
4137 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
4139 if ((serviceTemp = getservicebyname(lp_ctx, pszParmValue)) != NULL) {
4140 if (serviceTemp == lp_ctx->currentService) {
4141 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
4142 } else {
4143 copy_service(lp_ctx->currentService,
4144 serviceTemp,
4145 lp_ctx->currentService->copymap);
4146 bRetval = true;
4148 } else {
4149 DEBUG(0, ("Unable to copy service - source not found: %s\n",
4150 pszParmValue));
4151 bRetval = false;
4154 return bRetval;
4157 static bool handle_debuglevel(struct loadparm_context *lp_ctx, int unused,
4158 const char *pszParmValue, char **ptr)
4161 lpcfg_string_set(lp_ctx, ptr, pszParmValue);
4162 if (lp_ctx->global) {
4163 return debug_parse_levels(pszParmValue);
4165 return true;
4168 static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
4169 const char *pszParmValue, char **ptr)
4171 debug_set_logfile(pszParmValue);
4172 if (lp_ctx->global) {
4173 lpcfg_string_set(lp_ctx, ptr, pszParmValue);
4175 return true;
4178 /***************************************************************************
4179 Initialise a copymap.
4180 ***************************************************************************/
4182 static void init_copymap(struct loadparm_service *pservice)
4184 int i;
4186 TALLOC_FREE(pservice->copymap);
4188 pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
4189 if (!pservice->copymap)
4190 DEBUG(0,
4191 ("Couldn't allocate copymap!! (size %d)\n",
4192 (int)NUMPARAMETERS));
4193 else
4194 for (i = 0; i < NUMPARAMETERS; i++)
4195 bitmap_set(pservice->copymap, i);
4199 * Process a parametric option
4201 static bool lp_do_parameter_parametric(struct loadparm_context *lp_ctx,
4202 struct loadparm_service *service,
4203 const char *pszParmName,
4204 const char *pszParmValue, int flags)
4206 struct parmlist_entry *paramo, *data;
4207 char *name;
4208 TALLOC_CTX *mem_ctx;
4210 while (isspace((unsigned char)*pszParmName)) {
4211 pszParmName++;
4214 name = strlower_talloc(lp_ctx, pszParmName);
4215 if (!name) return false;
4217 if (service == NULL) {
4218 data = lp_ctx->globals->param_opt;
4219 mem_ctx = lp_ctx->globals;
4220 } else {
4221 data = service->param_opt;
4222 mem_ctx = service;
4225 /* Traverse destination */
4226 for (paramo=data; paramo; paramo=paramo->next) {
4227 /* If we already have the option set, override it unless
4228 it was a command line option and the new one isn't */
4229 if (strcmp(paramo->key, name) == 0) {
4230 if ((paramo->priority & FLAG_CMDLINE) &&
4231 !(flags & FLAG_CMDLINE)) {
4232 talloc_free(name);
4233 return true;
4236 talloc_free(paramo->value);
4237 paramo->value = talloc_strdup(paramo, pszParmValue);
4238 paramo->priority = flags;
4239 talloc_free(name);
4240 return true;
4244 paramo = talloc_zero(mem_ctx, struct parmlist_entry);
4245 if (!paramo)
4246 smb_panic("OOM");
4247 paramo->key = talloc_strdup(paramo, name);
4248 paramo->value = talloc_strdup(paramo, pszParmValue);
4249 paramo->priority = flags;
4250 if (service == NULL) {
4251 DLIST_ADD(lp_ctx->globals->param_opt, paramo);
4252 } else {
4253 DLIST_ADD(service->param_opt, paramo);
4256 talloc_free(name);
4258 return true;
4261 static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
4262 const char *pszParmName, const char *pszParmValue,
4263 struct loadparm_context *lp_ctx, bool on_globals)
4265 int i;
4266 /* if it is a special case then go ahead */
4267 if (parm_table[parmnum].special) {
4268 bool ret;
4269 ret = parm_table[parmnum].special(lp_ctx, -1, pszParmValue,
4270 (char **)parm_ptr);
4271 if (!ret) {
4272 return false;
4274 goto mark_non_default;
4277 /* now switch on the type of variable it is */
4278 switch (parm_table[parmnum].type)
4280 case P_BOOL: {
4281 bool b;
4282 if (!set_boolean(pszParmValue, &b)) {
4283 DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
4284 return false;
4286 *(bool *)parm_ptr = b;
4288 break;
4290 case P_BOOLREV: {
4291 bool b;
4292 if (!set_boolean(pszParmValue, &b)) {
4293 DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
4294 return false;
4296 *(bool *)parm_ptr = !b;
4298 break;
4300 case P_INTEGER:
4301 *(int *)parm_ptr = atoi(pszParmValue);
4302 break;
4304 case P_CHAR:
4305 *(char *)parm_ptr = *pszParmValue;
4306 break;
4308 case P_OCTAL:
4309 *(int *)parm_ptr = strtol(pszParmValue, NULL, 8);
4310 break;
4312 case P_BYTES:
4314 uint64_t val;
4315 if (conv_str_size_error(pszParmValue, &val)) {
4316 if (val <= INT_MAX) {
4317 *(int *)parm_ptr = (int)val;
4318 break;
4322 DEBUG(0,("lp_do_parameter(%s): value is not "
4323 "a valid size specifier!\n", pszParmValue));
4324 return false;
4327 case P_CMDLIST:
4328 *(const char ***)parm_ptr = (const char **)str_list_make(mem_ctx,
4329 pszParmValue, NULL);
4330 break;
4331 case P_LIST:
4333 char **new_list = str_list_make(mem_ctx,
4334 pszParmValue, NULL);
4335 for (i=0; new_list[i]; i++) {
4336 if (new_list[i][0] == '+' && new_list[i][1]) {
4337 if (!str_list_check(*(const char ***)parm_ptr,
4338 &new_list[i][1])) {
4339 *(const char ***)parm_ptr = str_list_add(*(const char ***)parm_ptr,
4340 &new_list[i][1]);
4342 } else if (new_list[i][0] == '-' && new_list[i][1]) {
4343 str_list_remove(*(const char ***)parm_ptr,
4344 &new_list[i][1]);
4345 } else {
4346 if (i != 0) {
4347 DEBUG(0, ("Unsupported list syntax for: %s = %s\n",
4348 pszParmName, pszParmValue));
4349 return false;
4351 *(const char ***)parm_ptr = (const char **) new_list;
4352 break;
4355 break;
4357 case P_STRING:
4358 lpcfg_string_set(mem_ctx, (char **)parm_ptr, pszParmValue);
4359 break;
4361 case P_USTRING:
4362 lpcfg_string_set_upper(mem_ctx, (char **)parm_ptr, pszParmValue);
4363 break;
4365 case P_ENUM:
4366 for (i = 0; parm_table[parmnum].enum_list[i].name; i++) {
4367 if (strequal
4368 (pszParmValue,
4369 parm_table[parmnum].enum_list[i].name)) {
4370 *(int *)parm_ptr =
4371 parm_table[parmnum].
4372 enum_list[i].value;
4373 break;
4376 if (!parm_table[parmnum].enum_list[i].name) {
4377 DEBUG(0,("Unknown enumerated value '%s' for '%s'\n",
4378 pszParmValue, pszParmName));
4379 return false;
4381 break;
4383 case P_SEP:
4384 break;
4387 mark_non_default:
4388 if (on_globals && (lp_ctx->flags[parmnum] & FLAG_DEFAULT)) {
4389 lp_ctx->flags[parmnum] &= ~FLAG_DEFAULT;
4390 /* we have to also unset FLAG_DEFAULT on aliases */
4391 for (i=parmnum-1;i>=0 && parm_table[i].offset == parm_table[parmnum].offset;i--) {
4392 lp_ctx->flags[i] &= ~FLAG_DEFAULT;
4394 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].offset == parm_table[parmnum].offset;i++) {
4395 lp_ctx->flags[i] &= ~FLAG_DEFAULT;
4398 return true;
4402 bool lpcfg_do_global_parameter(struct loadparm_context *lp_ctx,
4403 const char *pszParmName, const char *pszParmValue)
4405 int parmnum = map_parameter(pszParmName);
4406 void *parm_ptr;
4408 if (parmnum < 0) {
4409 if (strchr(pszParmName, ':')) {
4410 return lp_do_parameter_parametric(lp_ctx, NULL, pszParmName, pszParmValue, 0);
4412 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
4413 return true;
4416 /* if the flag has been set on the command line, then don't allow override,
4417 but don't report an error */
4418 if (lp_ctx->flags[parmnum] & FLAG_CMDLINE) {
4419 return true;
4422 parm_ptr = lpcfg_parm_ptr(lp_ctx, NULL, &parm_table[parmnum]);
4424 return set_variable(lp_ctx->globals, parmnum, parm_ptr,
4425 pszParmName, pszParmValue, lp_ctx, true);
4428 bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
4429 struct loadparm_service *service,
4430 const char *pszParmName, const char *pszParmValue)
4432 void *parm_ptr;
4433 int i;
4434 int parmnum = map_parameter(pszParmName);
4436 if (parmnum < 0) {
4437 if (strchr(pszParmName, ':')) {
4438 return lp_do_parameter_parametric(lp_ctx, service, pszParmName, pszParmValue, 0);
4440 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
4441 return true;
4444 /* if the flag has been set on the command line, then don't allow override,
4445 but don't report an error */
4446 if (lp_ctx->flags[parmnum] & FLAG_CMDLINE) {
4447 return true;
4450 if (parm_table[parmnum].p_class == P_GLOBAL) {
4451 DEBUG(0,
4452 ("Global parameter %s found in service section!\n",
4453 pszParmName));
4454 return true;
4456 parm_ptr = ((char *)service) + parm_table[parmnum].offset;
4458 if (!service->copymap)
4459 init_copymap(service);
4461 /* this handles the aliases - set the copymap for other
4462 * entries with the same data pointer */
4463 for (i = 0; parm_table[i].label; i++)
4464 if (parm_table[i].offset == parm_table[parmnum].offset &&
4465 parm_table[i].p_class == parm_table[parmnum].p_class)
4466 bitmap_clear(service->copymap, i);
4468 return set_variable(service, parmnum, parm_ptr, pszParmName,
4469 pszParmValue, lp_ctx, false);
4473 * Process a parameter.
4476 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
4477 void *userdata)
4479 struct loadparm_context *lp_ctx = (struct loadparm_context *)userdata;
4481 if (lp_ctx->bInGlobalSection)
4482 return lpcfg_do_global_parameter(lp_ctx, pszParmName,
4483 pszParmValue);
4484 else
4485 return lpcfg_do_service_parameter(lp_ctx, lp_ctx->currentService,
4486 pszParmName, pszParmValue);
4490 variable argument do parameter
4492 bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx, const char *pszParmName, const char *fmt, ...) PRINTF_ATTRIBUTE(3, 4);
4493 bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
4494 const char *pszParmName, const char *fmt, ...)
4496 char *s;
4497 bool ret;
4498 va_list ap;
4500 va_start(ap, fmt);
4501 s = talloc_vasprintf(NULL, fmt, ap);
4502 va_end(ap);
4503 ret = lpcfg_do_global_parameter(lp_ctx, pszParmName, s);
4504 talloc_free(s);
4505 return ret;
4510 set a parameter from the commandline - this is called from command line parameter
4511 parsing code. It sets the parameter then marks the parameter as unable to be modified
4512 by smb.conf processing
4514 bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
4515 const char *pszParmValue)
4517 int parmnum;
4518 int i;
4520 if (lp_ctx->s3_fns) {
4521 return lp_ctx->s3_fns->set_cmdline(pszParmName, pszParmValue);
4524 parmnum = map_parameter(pszParmName);
4526 while (isspace((unsigned char)*pszParmValue)) pszParmValue++;
4529 if (parmnum < 0 && strchr(pszParmName, ':')) {
4530 /* set a parametric option */
4531 return lp_do_parameter_parametric(lp_ctx, NULL, pszParmName,
4532 pszParmValue, FLAG_CMDLINE);
4535 if (parmnum < 0) {
4536 DEBUG(0,("Unknown option '%s'\n", pszParmName));
4537 return false;
4540 /* reset the CMDLINE flag in case this has been called before */
4541 lp_ctx->flags[parmnum] &= ~FLAG_CMDLINE;
4543 if (!lpcfg_do_global_parameter(lp_ctx, pszParmName, pszParmValue)) {
4544 return false;
4547 lp_ctx->flags[parmnum] |= FLAG_CMDLINE;
4549 /* we have to also set FLAG_CMDLINE on aliases */
4550 for (i=parmnum-1;i>=0 && parm_table[i].offset == parm_table[parmnum].offset;i--) {
4551 lp_ctx->flags[i] |= FLAG_CMDLINE;
4553 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].offset == parm_table[parmnum].offset;i++) {
4554 lp_ctx->flags[i] |= FLAG_CMDLINE;
4557 return true;
4561 set a option from the commandline in 'a=b' format. Use to support --option
4563 bool lpcfg_set_option(struct loadparm_context *lp_ctx, const char *option)
4565 char *p, *s;
4566 bool ret;
4568 s = talloc_strdup(NULL, option);
4569 if (!s) {
4570 return false;
4573 p = strchr(s, '=');
4574 if (!p) {
4575 talloc_free(s);
4576 return false;
4579 *p = 0;
4581 ret = lpcfg_set_cmdline(lp_ctx, s, p+1);
4582 talloc_free(s);
4583 return ret;
4587 #define BOOLSTR(b) ((b) ? "Yes" : "No")
4590 * Print a parameter of the specified type.
4593 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
4595 /* For the seperation of lists values that we print below */
4596 const char *list_sep = ", ";
4597 int i;
4598 switch (p->type)
4600 case P_ENUM:
4601 for (i = 0; p->enum_list[i].name; i++) {
4602 if (*(int *)ptr == p->enum_list[i].value) {
4603 fprintf(f, "%s",
4604 p->enum_list[i].name);
4605 break;
4608 break;
4610 case P_BOOL:
4611 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
4612 break;
4614 case P_BOOLREV:
4615 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
4616 break;
4618 case P_INTEGER:
4619 case P_BYTES:
4620 fprintf(f, "%d", *(int *)ptr);
4621 break;
4623 case P_CHAR:
4624 fprintf(f, "%c", *(char *)ptr);
4625 break;
4627 case P_OCTAL: {
4628 int val = *(int *)ptr;
4629 if (val == -1) {
4630 fprintf(f, "-1");
4631 } else {
4632 fprintf(f, "0%o", val);
4634 break;
4637 case P_CMDLIST:
4638 list_sep = " ";
4639 /* fall through */
4640 case P_LIST:
4641 if ((char ***)ptr && *(char ***)ptr) {
4642 char **list = *(char ***)ptr;
4643 for (; *list; list++) {
4644 /* surround strings with whitespace in double quotes */
4645 if (*(list+1) == NULL) {
4646 /* last item, no extra separator */
4647 list_sep = "";
4649 if ( strchr_m( *list, ' ' ) ) {
4650 fprintf(f, "\"%s\"%s", *list, list_sep);
4651 } else {
4652 fprintf(f, "%s%s", *list, list_sep);
4656 break;
4658 case P_STRING:
4659 case P_USTRING:
4660 if (*(char **)ptr) {
4661 fprintf(f, "%s", *(char **)ptr);
4663 break;
4664 case P_SEP:
4665 break;
4670 * Check if two parameters are equal.
4673 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
4675 switch (type) {
4676 case P_BOOL:
4677 case P_BOOLREV:
4678 return (*((bool *)ptr1) == *((bool *)ptr2));
4680 case P_INTEGER:
4681 case P_ENUM:
4682 case P_OCTAL:
4683 case P_BYTES:
4684 return (*((int *)ptr1) == *((int *)ptr2));
4686 case P_CHAR:
4687 return (*((char *)ptr1) == *((char *)ptr2));
4689 case P_LIST:
4690 case P_CMDLIST:
4691 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
4693 case P_STRING:
4694 case P_USTRING:
4696 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
4697 if (p1 && !*p1)
4698 p1 = NULL;
4699 if (p2 && !*p2)
4700 p2 = NULL;
4701 return (p1 == p2 || strequal(p1, p2));
4703 case P_SEP:
4704 break;
4706 return false;
4710 * Process a new section (service).
4712 * At this stage all sections are services.
4713 * Later we'll have special sections that permit server parameters to be set.
4714 * Returns True on success, False on failure.
4717 static bool do_section(const char *pszSectionName, void *userdata)
4719 struct loadparm_context *lp_ctx = (struct loadparm_context *)userdata;
4720 bool bRetval;
4721 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
4722 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
4723 bRetval = false;
4725 /* if we've just struck a global section, note the fact. */
4726 lp_ctx->bInGlobalSection = isglobal;
4728 /* check for multiple global sections */
4729 if (lp_ctx->bInGlobalSection) {
4730 DEBUG(4, ("Processing section \"[%s]\"\n", pszSectionName));
4731 return true;
4734 /* if we have a current service, tidy it up before moving on */
4735 bRetval = true;
4737 if (lp_ctx->currentService != NULL)
4738 bRetval = lpcfg_service_ok(lp_ctx->currentService);
4740 /* if all is still well, move to the next record in the services array */
4741 if (bRetval) {
4742 /* We put this here to avoid an odd message order if messages are */
4743 /* issued by the post-processing of a previous section. */
4744 DEBUG(4, ("Processing section \"[%s]\"\n", pszSectionName));
4746 if ((lp_ctx->currentService = lpcfg_add_service(lp_ctx, lp_ctx->sDefault,
4747 pszSectionName))
4748 == NULL) {
4749 DEBUG(0, ("Failed to add a new service\n"));
4750 return false;
4754 return bRetval;
4759 * Determine if a particular base parameter is currently set to the default value.
4762 static bool is_default(struct loadparm_service *sDefault, int i)
4764 void *def_ptr = ((char *)sDefault) + parm_table[i].offset;
4765 if (!defaults_saved)
4766 return false;
4767 switch (parm_table[i].type) {
4768 case P_CMDLIST:
4769 case P_LIST:
4770 return str_list_equal((const char **)parm_table[i].def.lvalue,
4771 (const char **)def_ptr);
4772 case P_STRING:
4773 case P_USTRING:
4774 return strequal(parm_table[i].def.svalue,
4775 *(char **)def_ptr);
4776 case P_BOOL:
4777 case P_BOOLREV:
4778 return parm_table[i].def.bvalue ==
4779 *(bool *)def_ptr;
4780 case P_INTEGER:
4781 case P_CHAR:
4782 case P_OCTAL:
4783 case P_BYTES:
4784 case P_ENUM:
4785 return parm_table[i].def.ivalue ==
4786 *(int *)def_ptr;
4787 case P_SEP:
4788 break;
4790 return false;
4794 *Display the contents of the global structure.
4797 static void dump_globals(struct loadparm_context *lp_ctx, FILE *f,
4798 bool show_defaults)
4800 int i;
4801 struct parmlist_entry *data;
4803 fprintf(f, "# Global parameters\n[global]\n");
4805 for (i = 0; parm_table[i].label; i++)
4806 if (parm_table[i].p_class == P_GLOBAL &&
4807 (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset))) {
4808 if (!show_defaults && (lp_ctx->flags[i] & FLAG_DEFAULT))
4809 continue;
4810 fprintf(f, "\t%s = ", parm_table[i].label);
4811 print_parameter(&parm_table[i], lpcfg_parm_ptr(lp_ctx, NULL, &parm_table[i]), f);
4812 fprintf(f, "\n");
4814 if (lp_ctx->globals->param_opt != NULL) {
4815 for (data = lp_ctx->globals->param_opt; data;
4816 data = data->next) {
4817 if (!show_defaults && (data->priority & FLAG_DEFAULT)) {
4818 continue;
4820 fprintf(f, "\t%s = %s\n", data->key, data->value);
4827 * Display the contents of a single services record.
4830 static void dump_a_service(struct loadparm_service * pService, struct loadparm_service *sDefault, FILE * f,
4831 unsigned int *flags)
4833 int i;
4834 struct parmlist_entry *data;
4836 if (pService != sDefault)
4837 fprintf(f, "\n[%s]\n", pService->szService);
4839 for (i = 0; parm_table[i].label; i++) {
4840 if (parm_table[i].p_class == P_LOCAL &&
4841 (*parm_table[i].label != '-') &&
4842 (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset)))
4844 if (pService == sDefault) {
4845 if (flags && (flags[i] & FLAG_DEFAULT)) {
4846 continue;
4848 if (defaults_saved) {
4849 if (is_default(sDefault, i)) {
4850 continue;
4853 } else {
4854 if (equal_parameter(parm_table[i].type,
4855 ((char *)pService) +
4856 parm_table[i].offset,
4857 ((char *)sDefault) +
4858 parm_table[i].offset))
4859 continue;
4862 fprintf(f, "\t%s = ", parm_table[i].label);
4863 print_parameter(&parm_table[i],
4864 ((char *)pService) + parm_table[i].offset, f);
4865 fprintf(f, "\n");
4868 if (pService->param_opt != NULL) {
4869 for (data = pService->param_opt; data; data = data->next) {
4870 fprintf(f, "\t%s = %s\n", data->key, data->value);
4875 bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
4876 struct loadparm_service *service,
4877 const char *parm_name, FILE * f)
4879 struct parm_struct *parm;
4880 void *ptr;
4882 parm = lpcfg_parm_struct(lp_ctx, parm_name);
4883 if (!parm) {
4884 return false;
4887 ptr = lpcfg_parm_ptr(lp_ctx, service,parm);
4889 print_parameter(parm, ptr, f);
4890 fprintf(f, "\n");
4891 return true;
4895 * Return info about the next parameter in a service.
4896 * snum==-1 gives the globals.
4897 * Return NULL when out of parameters.
4901 struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int snum, int *i,
4902 int allparameters)
4904 if (snum == -1) {
4905 /* do the globals */
4906 for (; parm_table[*i].label; (*i)++) {
4907 if ((*parm_table[*i].label == '-'))
4908 continue;
4910 if ((*i) > 0
4911 && (parm_table[*i].offset ==
4912 parm_table[(*i) - 1].offset)
4913 && (parm_table[*i].p_class ==
4914 parm_table[(*i) - 1].p_class))
4915 continue;
4917 return &parm_table[(*i)++];
4919 } else {
4920 struct loadparm_service *pService = lp_ctx->services[snum];
4922 for (; parm_table[*i].label; (*i)++) {
4923 if (parm_table[*i].p_class == P_LOCAL &&
4924 (*parm_table[*i].label != '-') &&
4925 ((*i) == 0 ||
4926 (parm_table[*i].offset !=
4927 parm_table[(*i) - 1].offset)))
4929 if (allparameters ||
4930 !equal_parameter(parm_table[*i].type,
4931 ((char *)pService) +
4932 parm_table[*i].offset,
4933 ((char *)lp_ctx->sDefault) +
4934 parm_table[*i].offset))
4936 return &parm_table[(*i)++];
4942 return NULL;
4947 * Auto-load some home services.
4949 static void lpcfg_add_auto_services(struct loadparm_context *lp_ctx,
4950 const char *str)
4952 return;
4957 * Unload unused services.
4960 void lpcfg_killunused(struct loadparm_context *lp_ctx,
4961 struct smbsrv_connection *smb,
4962 bool (*snumused) (struct smbsrv_connection *, int))
4964 int i;
4965 for (i = 0; i < lp_ctx->iNumServices; i++) {
4966 if (lp_ctx->services[i] == NULL)
4967 continue;
4969 if (!snumused || !snumused(smb, i)) {
4970 talloc_free(lp_ctx->services[i]);
4971 lp_ctx->services[i] = NULL;
4977 static int lpcfg_destructor(struct loadparm_context *lp_ctx)
4979 struct parmlist_entry *data;
4981 if (lp_ctx->refuse_free) {
4982 /* someone is trying to free the
4983 global_loadparm_context.
4984 We can't allow that. */
4985 return -1;
4988 if (lp_ctx->globals->param_opt != NULL) {
4989 struct parmlist_entry *next;
4990 for (data = lp_ctx->globals->param_opt; data; data=next) {
4991 next = data->next;
4992 if (data->priority & FLAG_CMDLINE) continue;
4993 DLIST_REMOVE(lp_ctx->globals->param_opt, data);
4994 talloc_free(data);
4998 return 0;
5002 * Initialise the global parameter structure.
5004 * Note that most callers should use loadparm_init_global() instead
5006 struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
5008 int i;
5009 char *myname;
5010 struct loadparm_context *lp_ctx;
5011 struct parmlist_entry *parm;
5012 char *logfile;
5014 lp_ctx = talloc_zero(mem_ctx, struct loadparm_context);
5015 if (lp_ctx == NULL)
5016 return NULL;
5018 talloc_set_destructor(lp_ctx, lpcfg_destructor);
5019 lp_ctx->bInGlobalSection = true;
5020 lp_ctx->globals = talloc_zero(lp_ctx, struct loadparm_global);
5021 lp_ctx->sDefault = talloc_zero(lp_ctx, struct loadparm_service);
5023 lp_ctx->sDefault->iMaxPrintJobs = 1000;
5024 lp_ctx->sDefault->bAvailable = true;
5025 lp_ctx->sDefault->bBrowseable = true;
5026 lp_ctx->sDefault->bRead_only = true;
5027 lp_ctx->sDefault->bMap_archive = true;
5028 lp_ctx->sDefault->iStrictLocking = true;
5029 lp_ctx->sDefault->bOpLocks = true;
5030 lp_ctx->sDefault->iCreate_mask = 0744;
5031 lp_ctx->sDefault->iCreate_force_mode = 0000;
5032 lp_ctx->sDefault->iDir_mask = 0755;
5033 lp_ctx->sDefault->iDir_force_mode = 0000;
5035 DEBUG(3, ("Initialising global parameters\n"));
5037 for (i = 0; parm_table[i].label; i++) {
5038 if ((parm_table[i].type == P_STRING ||
5039 parm_table[i].type == P_USTRING) &&
5040 !(lp_ctx->flags[i] & FLAG_CMDLINE)) {
5041 char **r;
5042 if (parm_table[i].p_class == P_LOCAL) {
5043 r = (char **)(((char *)lp_ctx->sDefault) + parm_table[i].offset);
5044 } else {
5045 r = (char **)(((char *)lp_ctx->globals) + parm_table[i].offset);
5047 *r = talloc_strdup(lp_ctx, "");
5051 logfile = talloc_asprintf(lp_ctx, "%s/log.samba", dyn_LOGFILEBASE);
5052 lpcfg_do_global_parameter(lp_ctx, "log file", logfile);
5053 talloc_free(logfile);
5055 lpcfg_do_global_parameter(lp_ctx, "log level", "0");
5057 lpcfg_do_global_parameter(lp_ctx, "share backend", "classic");
5059 lpcfg_do_global_parameter(lp_ctx, "server role", "auto");
5060 lpcfg_do_global_parameter(lp_ctx, "domain logons", "No");
5061 lpcfg_do_global_parameter(lp_ctx, "domain master", "Auto");
5063 /* options that can be set on the command line must be initialised via
5064 the slower lpcfg_do_global_parameter() to ensure that FLAG_CMDLINE is obeyed */
5065 #ifdef TCP_NODELAY
5066 lpcfg_do_global_parameter(lp_ctx, "socket options", "TCP_NODELAY");
5067 #endif
5068 lpcfg_do_global_parameter(lp_ctx, "workgroup", DEFAULT_WORKGROUP);
5069 myname = get_myname(lp_ctx);
5070 lpcfg_do_global_parameter(lp_ctx, "netbios name", myname);
5071 talloc_free(myname);
5072 lpcfg_do_global_parameter(lp_ctx, "name resolve order", "wins host bcast");
5074 lpcfg_do_global_parameter(lp_ctx, "fstype", "NTFS");
5076 lpcfg_do_global_parameter(lp_ctx, "ntvfs handler", "unixuid default");
5077 lpcfg_do_global_parameter(lp_ctx, "max connections", "-1");
5079 lpcfg_do_global_parameter(lp_ctx, "dcerpc endpoint servers", "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver");
5080 lpcfg_do_global_parameter(lp_ctx, "server services", "s3fs rpc nbt wrepl ldap cldap kdc drepl winbind ntp_signd kcc dnsupdate");
5081 /* the winbind method for domain controllers is for both RODC
5082 auth forwarding and for trusted domains */
5083 lpcfg_do_global_parameter(lp_ctx, "private dir", dyn_PRIVATE_DIR);
5084 lpcfg_do_global_parameter(lp_ctx, "registry:HKEY_LOCAL_MACHINE", "hklm.ldb");
5086 /* This hive should be dynamically generated by Samba using
5087 data from the sam, but for the moment leave it in a tdb to
5088 keep regedt32 from popping up an annoying dialog. */
5089 lpcfg_do_global_parameter(lp_ctx, "registry:HKEY_USERS", "hku.ldb");
5091 /* using UTF8 by default allows us to support all chars */
5092 lpcfg_do_global_parameter(lp_ctx, "unix charset", "UTF8");
5094 /* Use codepage 850 as a default for the dos character set */
5095 lpcfg_do_global_parameter(lp_ctx, "dos charset", "CP850");
5098 * Allow the default PASSWD_CHAT to be overridden in local.h.
5100 lpcfg_do_global_parameter(lp_ctx, "passwd chat", DEFAULT_PASSWD_CHAT);
5102 lpcfg_do_global_parameter(lp_ctx, "pid directory", dyn_PIDDIR);
5103 lpcfg_do_global_parameter(lp_ctx, "lock dir", dyn_LOCKDIR);
5104 lpcfg_do_global_parameter(lp_ctx, "state directory", dyn_STATEDIR);
5105 lpcfg_do_global_parameter(lp_ctx, "cache directory", dyn_CACHEDIR);
5106 lpcfg_do_global_parameter(lp_ctx, "ncalrpc dir", dyn_NCALRPCDIR);
5108 lpcfg_do_global_parameter(lp_ctx, "socket address", "");
5109 lpcfg_do_global_parameter_var(lp_ctx, "server string",
5110 "Samba %s", SAMBA_VERSION_STRING);
5112 lpcfg_do_global_parameter(lp_ctx, "password server", "*");
5114 lpcfg_do_global_parameter(lp_ctx, "max mux", "50");
5115 lpcfg_do_global_parameter(lp_ctx, "max xmit", "12288");
5116 lpcfg_do_global_parameter(lp_ctx, "host msdfs", "true");
5118 lpcfg_do_global_parameter(lp_ctx, "password level", "0");
5119 lpcfg_do_global_parameter(lp_ctx, "LargeReadwrite", "True");
5120 lpcfg_do_global_parameter(lp_ctx, "server min protocol", "CORE");
5121 lpcfg_do_global_parameter(lp_ctx, "server max protocol", "NT1");
5122 lpcfg_do_global_parameter(lp_ctx, "client min protocol", "CORE");
5123 lpcfg_do_global_parameter(lp_ctx, "client max protocol", "NT1");
5124 lpcfg_do_global_parameter(lp_ctx, "security", "AUTO");
5125 lpcfg_do_global_parameter(lp_ctx, "paranoid server security", "True");
5126 lpcfg_do_global_parameter(lp_ctx, "EncryptPasswords", "True");
5127 lpcfg_do_global_parameter(lp_ctx, "ReadRaw", "True");
5128 lpcfg_do_global_parameter(lp_ctx, "WriteRaw", "True");
5129 lpcfg_do_global_parameter(lp_ctx, "NullPasswords", "False");
5130 lpcfg_do_global_parameter(lp_ctx, "ObeyPamRestrictions", "False");
5132 lpcfg_do_global_parameter(lp_ctx, "TimeServer", "False");
5133 lpcfg_do_global_parameter(lp_ctx, "BindInterfacesOnly", "False");
5134 lpcfg_do_global_parameter(lp_ctx, "Unicode", "True");
5135 lpcfg_do_global_parameter(lp_ctx, "ClientLanManAuth", "False");
5136 lpcfg_do_global_parameter(lp_ctx, "ClientNTLMv2Auth", "True");
5137 lpcfg_do_global_parameter(lp_ctx, "LanmanAuth", "False");
5138 lpcfg_do_global_parameter(lp_ctx, "NTLMAuth", "True");
5139 lpcfg_do_global_parameter(lp_ctx, "client use spnego principal", "False");
5141 lpcfg_do_global_parameter(lp_ctx, "UnixExtensions", "False");
5143 lpcfg_do_global_parameter(lp_ctx, "PreferredMaster", "Auto");
5144 lpcfg_do_global_parameter(lp_ctx, "LocalMaster", "True");
5146 lpcfg_do_global_parameter(lp_ctx, "wins support", "False");
5147 lpcfg_do_global_parameter(lp_ctx, "dns proxy", "True");
5149 lpcfg_do_global_parameter(lp_ctx, "winbind separator", "\\");
5150 lpcfg_do_global_parameter(lp_ctx, "winbind sealed pipes", "True");
5151 lpcfg_do_global_parameter(lp_ctx, "winbindd socket directory", dyn_WINBINDD_SOCKET_DIR);
5152 #if _SAMBA_BUILD_ >= 4
5153 lpcfg_do_global_parameter(lp_ctx, "winbindd privileged socket directory", dyn_WINBINDD_PRIVILEGED_SOCKET_DIR);
5154 lpcfg_do_global_parameter(lp_ctx, "ntp signd socket directory", dyn_NTP_SIGND_SOCKET_DIR);
5155 lpcfg_do_global_parameter_var(lp_ctx, "dns update command", "%s/samba_dnsupdate", dyn_SCRIPTSBINDIR);
5156 lpcfg_do_global_parameter_var(lp_ctx, "spn update command", "%s/samba_spnupdate", dyn_SCRIPTSBINDIR);
5157 lpcfg_do_global_parameter_var(lp_ctx, "samba kcc command",
5158 "%s/samba_kcc", dyn_SCRIPTSBINDIR);
5159 #endif
5160 lpcfg_do_global_parameter(lp_ctx, "template shell", "/bin/false");
5161 lpcfg_do_global_parameter(lp_ctx, "template homedir", "/home/%WORKGROUP%/%ACCOUNTNAME%");
5163 lpcfg_do_global_parameter(lp_ctx, "client signing", "default");
5164 lpcfg_do_global_parameter(lp_ctx, "server signing", "default");
5166 lpcfg_do_global_parameter(lp_ctx, "use spnego", "True");
5168 lpcfg_do_global_parameter(lp_ctx, "use mmap", "True");
5170 lpcfg_do_global_parameter(lp_ctx, "smb ports", "445 139");
5171 lpcfg_do_global_parameter(lp_ctx, "nbt port", "137");
5172 lpcfg_do_global_parameter(lp_ctx, "dgram port", "138");
5173 lpcfg_do_global_parameter(lp_ctx, "cldap port", "389");
5174 lpcfg_do_global_parameter(lp_ctx, "krb5 port", "88");
5175 lpcfg_do_global_parameter(lp_ctx, "kpasswd port", "464");
5176 lpcfg_do_global_parameter(lp_ctx, "web port", "901");
5178 lpcfg_do_global_parameter(lp_ctx, "nt status support", "True");
5180 lpcfg_do_global_parameter(lp_ctx, "max wins ttl", "518400"); /* 6 days */
5181 lpcfg_do_global_parameter(lp_ctx, "min wins ttl", "10");
5183 lpcfg_do_global_parameter(lp_ctx, "tls enabled", "True");
5184 lpcfg_do_global_parameter(lp_ctx, "tls keyfile", "tls/key.pem");
5185 lpcfg_do_global_parameter(lp_ctx, "tls certfile", "tls/cert.pem");
5186 lpcfg_do_global_parameter(lp_ctx, "tls cafile", "tls/ca.pem");
5187 lpcfg_do_global_parameter(lp_ctx, "prefork children:smb", "4");
5189 lpcfg_do_global_parameter(lp_ctx, "rndc command", "/usr/sbin/rndc");
5190 lpcfg_do_global_parameter(lp_ctx, "nsupdate command", "/usr/bin/nsupdate -g");
5192 lpcfg_do_global_parameter(lp_ctx, "allow dns updates", "False");
5193 lpcfg_do_global_parameter(lp_ctx, "dns recursive queries", "False");
5194 lpcfg_do_global_parameter(lp_ctx, "dns forwarder", "");
5196 for (i = 0; parm_table[i].label; i++) {
5197 if (!(lp_ctx->flags[i] & FLAG_CMDLINE)) {
5198 lp_ctx->flags[i] |= FLAG_DEFAULT;
5202 for (parm=lp_ctx->globals->param_opt; parm; parm=parm->next) {
5203 if (!(parm->priority & FLAG_CMDLINE)) {
5204 parm->priority |= FLAG_DEFAULT;
5208 return lp_ctx;
5212 * Initialise the global parameter structure.
5214 struct loadparm_context *loadparm_init_global(bool load_default)
5216 if (global_loadparm_context == NULL) {
5217 global_loadparm_context = loadparm_init(NULL);
5219 if (global_loadparm_context == NULL) {
5220 return NULL;
5222 global_loadparm_context->global = true;
5223 if (load_default && !global_loadparm_context->loaded) {
5224 lpcfg_load_default(global_loadparm_context);
5226 global_loadparm_context->refuse_free = true;
5227 return global_loadparm_context;
5231 * Initialise the global parameter structure.
5233 struct loadparm_context *loadparm_init_s3(TALLOC_CTX *mem_ctx,
5234 const struct loadparm_s3_helpers *s3_fns)
5236 struct loadparm_context *loadparm_context = talloc_zero(mem_ctx, struct loadparm_context);
5237 if (!loadparm_context) {
5238 return NULL;
5240 loadparm_context->s3_fns = s3_fns;
5241 return loadparm_context;
5244 const char *lpcfg_configfile(struct loadparm_context *lp_ctx)
5246 return lp_ctx->szConfigFile;
5249 const char *lp_default_path(void)
5251 if (getenv("SMB_CONF_PATH"))
5252 return getenv("SMB_CONF_PATH");
5253 else
5254 return dyn_CONFIGFILE;
5258 * Update the internal state of a loadparm context after settings
5259 * have changed.
5261 static bool lpcfg_update(struct loadparm_context *lp_ctx)
5263 struct debug_settings settings;
5264 lpcfg_add_auto_services(lp_ctx, lpcfg_auto_services(lp_ctx));
5266 if (!lp_ctx->globals->szWINSservers && lp_ctx->globals->bWINSsupport) {
5267 lpcfg_do_global_parameter(lp_ctx, "wins server", "127.0.0.1");
5270 if (!lp_ctx->global) {
5271 return true;
5274 panic_action = lp_ctx->globals->panic_action;
5276 reload_charcnv(lp_ctx);
5278 ZERO_STRUCT(settings);
5279 /* Add any more debug-related smb.conf parameters created in
5280 * future here */
5281 settings.timestamp_logs = true;
5282 debug_set_settings(&settings);
5284 /* FIXME: This is a bit of a hack, but we can't use a global, since
5285 * not everything that uses lp also uses the socket library */
5286 if (lpcfg_parm_bool(lp_ctx, NULL, "socket", "testnonblock", false)) {
5287 setenv("SOCKET_TESTNONBLOCK", "1", 1);
5288 } else {
5289 unsetenv("SOCKET_TESTNONBLOCK");
5292 return true;
5295 bool lpcfg_load_default(struct loadparm_context *lp_ctx)
5297 const char *path;
5299 path = lp_default_path();
5301 if (!file_exist(path)) {
5302 /* We allow the default smb.conf file to not exist,
5303 * basically the equivalent of an empty file. */
5304 return lpcfg_update(lp_ctx);
5307 return lpcfg_load(lp_ctx, path);
5311 * Load the services array from the services file.
5313 * Return True on success, False on failure.
5315 bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename)
5317 char *n2;
5318 bool bRetval;
5320 filename = talloc_strdup(lp_ctx, filename);
5322 lp_ctx->szConfigFile = filename;
5324 if (lp_ctx->s3_fns) {
5325 return lp_ctx->s3_fns->load(filename);
5328 lp_ctx->bInGlobalSection = true;
5329 n2 = standard_sub_basic(lp_ctx, lp_ctx->szConfigFile);
5330 DEBUG(2, ("lpcfg_load: refreshing parameters from %s\n", n2));
5332 add_to_file_list(lp_ctx, lp_ctx->szConfigFile, n2);
5334 /* We get sections first, so have to start 'behind' to make up */
5335 lp_ctx->currentService = NULL;
5336 bRetval = pm_process(n2, do_section, do_parameter, lp_ctx);
5338 /* finish up the last section */
5339 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
5340 if (bRetval)
5341 if (lp_ctx->currentService != NULL)
5342 bRetval = lpcfg_service_ok(lp_ctx->currentService);
5344 bRetval = bRetval && lpcfg_update(lp_ctx);
5346 /* we do this unconditionally, so that it happens even
5347 for a missing smb.conf */
5348 reload_charcnv(lp_ctx);
5350 if (bRetval == true) {
5351 /* set this up so that any child python tasks will
5352 find the right smb.conf */
5353 setenv("SMB_CONF_PATH", filename, 1);
5355 /* set the context used by the lp_*() function
5356 varients */
5357 global_loadparm_context = lp_ctx;
5358 lp_ctx->loaded = true;
5361 return bRetval;
5365 * Return the max number of services.
5368 int lpcfg_numservices(struct loadparm_context *lp_ctx)
5370 if (lp_ctx->s3_fns) {
5371 return lp_ctx->s3_fns->get_numservices();
5374 return lp_ctx->iNumServices;
5378 * Display the contents of the services array in human-readable form.
5381 void lpcfg_dump(struct loadparm_context *lp_ctx, FILE *f, bool show_defaults,
5382 int maxtoprint)
5384 int iService;
5386 if (lp_ctx->s3_fns) {
5387 lp_ctx->s3_fns->dump(f, show_defaults, maxtoprint);
5388 return;
5391 defaults_saved = !show_defaults;
5393 dump_globals(lp_ctx, f, show_defaults);
5395 dump_a_service(lp_ctx->sDefault, lp_ctx->sDefault, f, lp_ctx->flags);
5397 for (iService = 0; iService < maxtoprint; iService++)
5398 lpcfg_dump_one(f, show_defaults, lp_ctx->services[iService], lp_ctx->sDefault);
5402 * Display the contents of one service in human-readable form.
5404 void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *service, struct loadparm_service *sDefault)
5406 if (service != NULL) {
5407 if (service->szService[0] == '\0')
5408 return;
5409 dump_a_service(service, sDefault, f, NULL);
5413 struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
5414 int snum)
5416 if (lp_ctx->s3_fns) {
5417 return lp_ctx->s3_fns->get_servicebynum(snum);
5420 return lp_ctx->services[snum];
5423 struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
5424 const char *service_name)
5426 int iService;
5427 char *serviceName;
5429 if (lp_ctx->s3_fns) {
5430 return lp_ctx->s3_fns->get_service(service_name);
5433 for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--) {
5434 if (lp_ctx->services[iService] &&
5435 lp_ctx->services[iService]->szService) {
5437 * The substitution here is used to support %U is
5438 * service names
5440 serviceName = standard_sub_basic(
5441 lp_ctx->services[iService],
5442 lp_ctx->services[iService]->szService);
5443 if (strequal(serviceName, service_name)) {
5444 talloc_free(serviceName);
5445 return lp_ctx->services[iService];
5447 talloc_free(serviceName);
5451 DEBUG(7,("lpcfg_servicenumber: couldn't find %s\n", service_name));
5452 return NULL;
5455 const char *lpcfg_servicename(const struct loadparm_service *service)
5457 return lp_string((const char *)service->szService);
5461 * A useful volume label function.
5463 const char *lpcfg_volume_label(struct loadparm_service *service, struct loadparm_service *sDefault)
5465 const char *ret;
5466 ret = lp_string((const char *)((service != NULL && service->volume != NULL) ?
5467 service->volume : sDefault->volume));
5468 if (!*ret)
5469 return lpcfg_servicename(service);
5470 return ret;
5474 * If we are PDC then prefer us as DMB
5476 const char *lpcfg_printername(struct loadparm_service *service, struct loadparm_service *sDefault)
5478 const char *ret;
5479 ret = lp_string((const char *)((service != NULL && service->szPrintername != NULL) ?
5480 service->szPrintername : sDefault->szPrintername));
5481 if (ret == NULL || (ret != NULL && *ret == '\0'))
5482 ret = lpcfg_servicename(service);
5484 return ret;
5489 * Return the max print jobs per queue.
5491 int lpcfg_maxprintjobs(struct loadparm_service *service, struct loadparm_service *sDefault)
5493 int maxjobs = (service != NULL) ? service->iMaxPrintJobs : sDefault->iMaxPrintJobs;
5494 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
5495 maxjobs = PRINT_MAX_JOBID - 1;
5497 return maxjobs;
5500 struct smb_iconv_handle *lpcfg_iconv_handle(struct loadparm_context *lp_ctx)
5502 if (lp_ctx == NULL) {
5503 return get_iconv_handle();
5505 return lp_ctx->iconv_handle;
5508 _PUBLIC_ void reload_charcnv(struct loadparm_context *lp_ctx)
5510 struct smb_iconv_handle *old_ic = lp_ctx->iconv_handle;
5511 if (!lp_ctx->global) {
5512 return;
5515 if (old_ic == NULL) {
5516 old_ic = global_iconv_handle;
5518 lp_ctx->iconv_handle = smb_iconv_handle_reinit_lp(lp_ctx, lp_ctx, old_ic);
5519 global_iconv_handle = lp_ctx->iconv_handle;
5522 _PUBLIC_ char *lpcfg_tls_keyfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5524 return lpcfg_private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_keyfile);
5527 _PUBLIC_ char *lpcfg_tls_certfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5529 return lpcfg_private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_certfile);
5532 _PUBLIC_ char *lpcfg_tls_cafile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5534 return lpcfg_private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_cafile);
5537 _PUBLIC_ char *lpcfg_tls_crlfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5539 return lpcfg_private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_crlfile);
5542 _PUBLIC_ char *lpcfg_tls_dhpfile(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5544 return lpcfg_private_path(mem_ctx, lp_ctx, lp_ctx->globals->tls_dhpfile);
5547 struct gensec_settings *lpcfg_gensec_settings(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
5549 struct gensec_settings *settings = talloc_zero(mem_ctx, struct gensec_settings);
5550 if (settings == NULL)
5551 return NULL;
5552 SMB_ASSERT(lp_ctx != NULL);
5553 settings->lp_ctx = talloc_reference(settings, lp_ctx);
5554 settings->target_hostname = lpcfg_parm_string(lp_ctx, NULL, "gensec", "target_hostname");
5555 return settings;
5558 int lpcfg_server_role(struct loadparm_context *lp_ctx)
5560 int domain_master = lpcfg__domain_master(lp_ctx);
5562 return lp_find_server_role(lpcfg__server_role(lp_ctx),
5563 lpcfg__security(lp_ctx),
5564 lpcfg__domain_logons(lp_ctx),
5565 (domain_master == true) ||
5566 (domain_master == Auto));
5569 int lpcfg_security(struct loadparm_context *lp_ctx)
5571 return lp_find_security(lpcfg__server_role(lp_ctx),
5572 lpcfg__security(lp_ctx));