s3:passdb Fix memory leak
[Samba/gebeck_regimport.git] / source3 / param / loadparm.c
blobba9d816429a1e3ab4e4e0e6cbd27e4557350d870
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) Michael Adam 2008
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
29 * Load parameters.
31 * This module provides suitable callback functions for the params
32 * module. It builds the internal table of service details which is
33 * then used by the rest of the server.
35 * To add a parameter:
37 * 1) add it to the global or service structure definition
38 * 2) add it to the parm_table
39 * 3) add it to the list of available functions (eg: using FN_GLOBAL_STRING())
40 * 4) If it's a global then initialise it in init_globals. If a local
41 * (ie. service) parameter then initialise it in the sDefault structure
44 * Notes:
45 * The configuration file is processed sequentially for speed. It is NOT
46 * accessed randomly as happens in 'real' Windows. For this reason, there
47 * is a fair bit of sequence-dependent code here - ie., code which assumes
48 * that certain things happen before others. In particular, the code which
49 * happens at the boundary between sections is delicately poised, so be
50 * careful!
54 #include "includes.h"
55 #include "printing.h"
56 #include "lib/smbconf/smbconf.h"
57 #include "lib/smbconf/smbconf_init.h"
58 #include "lib/smbconf/smbconf_reg.h"
60 #ifdef HAVE_SYS_SYSCTL_H
61 #include <sys/sysctl.h>
62 #endif
64 #ifdef HAVE_HTTPCONNECTENCRYPT
65 #include <cups/http.h>
66 #endif
68 bool bLoaded = False;
70 extern userdom_struct current_user_info;
72 #ifndef GLOBAL_NAME
73 #define GLOBAL_NAME "global"
74 #endif
76 #ifndef PRINTERS_NAME
77 #define PRINTERS_NAME "printers"
78 #endif
80 #ifndef HOMES_NAME
81 #define HOMES_NAME "homes"
82 #endif
84 /* the special value for the include parameter
85 * to be interpreted not as a file name but to
86 * trigger loading of the global smb.conf options
87 * from registry. */
88 #ifndef INCLUDE_REGISTRY_NAME
89 #define INCLUDE_REGISTRY_NAME "registry"
90 #endif
92 static bool in_client = False; /* Not in the client by default */
93 static struct smbconf_csn conf_last_csn;
95 #define CONFIG_BACKEND_FILE 0
96 #define CONFIG_BACKEND_REGISTRY 1
98 static int config_backend = CONFIG_BACKEND_FILE;
100 /* some helpful bits */
101 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
102 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
104 #define USERSHARE_VALID 1
105 #define USERSHARE_PENDING_DELETE 2
107 static bool defaults_saved = False;
109 struct param_opt_struct {
110 struct param_opt_struct *prev, *next;
111 char *key;
112 char *value;
113 char **list;
117 * This structure describes global (ie., server-wide) parameters.
119 struct global {
120 int ConfigBackend;
121 char *smb_ports;
122 char *dos_charset;
123 char *unix_charset;
124 char *display_charset;
125 char *szPrintcapname;
126 char *szAddPortCommand;
127 char *szEnumPortsCommand;
128 char *szAddPrinterCommand;
129 char *szDeletePrinterCommand;
130 char *szOs2DriverMap;
131 char *szLockDir;
132 char *szStateDir;
133 char *szCacheDir;
134 char *szPidDir;
135 char *szRootdir;
136 char *szDefaultService;
137 char *szGetQuota;
138 char *szSetQuota;
139 char *szMsgCommand;
140 char *szServerString;
141 char *szAutoServices;
142 char *szPasswdProgram;
143 char *szPasswdChat;
144 char *szLogFile;
145 char *szConfigFile;
146 char *szSMBPasswdFile;
147 char *szPrivateDir;
148 char *szPassdbBackend;
149 char **szPreloadModules;
150 char *szPasswordServer;
151 char *szSocketOptions;
152 char *szRealm;
153 char *szAfsUsernameMap;
154 int iAfsTokenLifetime;
155 char *szLogNtTokenCommand;
156 char *szUsernameMap;
157 char *szLogonScript;
158 char *szLogonPath;
159 char *szLogonDrive;
160 char *szLogonHome;
161 char **szWINSservers;
162 char **szInterfaces;
163 char *szRemoteAnnounce;
164 char *szRemoteBrowseSync;
165 char *szSocketAddress;
166 bool bNmbdBindExplicitBroadcast;
167 char *szNISHomeMapName;
168 char *szAnnounceVersion; /* This is initialised in init_globals */
169 char *szWorkgroup;
170 char *szNetbiosName;
171 char **szNetbiosAliases;
172 char *szNetbiosScope;
173 char *szNameResolveOrder;
174 char *szPanicAction;
175 char *szAddUserScript;
176 char *szRenameUserScript;
177 char *szDelUserScript;
178 char *szAddGroupScript;
179 char *szDelGroupScript;
180 char *szAddUserToGroupScript;
181 char *szDelUserFromGroupScript;
182 char *szSetPrimaryGroupScript;
183 char *szAddMachineScript;
184 char *szShutdownScript;
185 char *szAbortShutdownScript;
186 char *szUsernameMapScript;
187 int iUsernameMapCacheTime;
188 char *szCheckPasswordScript;
189 char *szWINSHook;
190 char *szUtmpDir;
191 char *szWtmpDir;
192 bool bUtmp;
193 char *szIdmapUID;
194 char *szIdmapGID;
195 bool bPassdbExpandExplicit;
196 int AlgorithmicRidBase;
197 char *szTemplateHomedir;
198 char *szTemplateShell;
199 char *szWinbindSeparator;
200 bool bWinbindEnumUsers;
201 bool bWinbindEnumGroups;
202 bool bWinbindUseDefaultDomain;
203 bool bWinbindTrustedDomainsOnly;
204 bool bWinbindNestedGroups;
205 int winbind_expand_groups;
206 bool bWinbindRefreshTickets;
207 bool bWinbindOfflineLogon;
208 bool bWinbindNormalizeNames;
209 bool bWinbindRpcOnly;
210 bool bCreateKrb5Conf;
211 char *szIdmapBackend;
212 char *szIdmapAllocBackend;
213 char *szAddShareCommand;
214 char *szChangeShareCommand;
215 char *szDeleteShareCommand;
216 char **szEventLogs;
217 char *szGuestaccount;
218 char *szManglingMethod;
219 char **szServicesList;
220 char *szUsersharePath;
221 char *szUsershareTemplateShare;
222 char **szUsersharePrefixAllowList;
223 char **szUsersharePrefixDenyList;
224 int mangle_prefix;
225 int max_log_size;
226 char *szLogLevel;
227 int max_xmit;
228 int max_mux;
229 int max_open_files;
230 int open_files_db_hash_size;
231 int pwordlevel;
232 int unamelevel;
233 int deadtime;
234 bool getwd_cache;
235 int maxprotocol;
236 int minprotocol;
237 int security;
238 char **AuthMethods;
239 bool paranoid_server_security;
240 int maxdisksize;
241 int lpqcachetime;
242 int iMaxSmbdProcesses;
243 bool bDisableSpoolss;
244 int syslog;
245 int os_level;
246 bool enhanced_browsing;
247 int max_ttl;
248 int max_wins_ttl;
249 int min_wins_ttl;
250 int lm_announce;
251 int lm_interval;
252 int announce_as; /* This is initialised in init_globals */
253 int machine_password_timeout;
254 int map_to_guest;
255 int oplock_break_wait_time;
256 int winbind_cache_time;
257 int winbind_reconnect_delay;
258 int winbind_max_idle_children;
259 char **szWinbindNssInfo;
260 int iLockSpinTime;
261 char *szLdapMachineSuffix;
262 char *szLdapUserSuffix;
263 char *szLdapIdmapSuffix;
264 char *szLdapGroupSuffix;
265 int ldap_ssl;
266 bool ldap_ssl_ads;
267 int ldap_deref;
268 int ldap_follow_referral;
269 char *szLdapSuffix;
270 char *szLdapAdminDn;
271 int ldap_debug_level;
272 int ldap_debug_threshold;
273 int iAclCompat;
274 char *szCupsServer;
275 int CupsEncrypt;
276 char *szIPrintServer;
277 char *ctdbdSocket;
278 char **szClusterAddresses;
279 bool clustering;
280 int ctdb_timeout;
281 int ctdb_locktime_warn_threshold;
282 int ldap_passwd_sync;
283 int ldap_replication_sleep;
284 int ldap_timeout; /* This is initialised in init_globals */
285 int ldap_connection_timeout;
286 int ldap_page_size;
287 bool ldap_delete_dn;
288 bool bMsAddPrinterWizard;
289 bool bDNSproxy;
290 bool bWINSsupport;
291 bool bWINSproxy;
292 bool bLocalMaster;
293 int iPreferredMaster;
294 int iDomainMaster;
295 bool bDomainLogons;
296 char **szInitLogonDelayedHosts;
297 int InitLogonDelay;
298 bool bEncryptPasswords;
299 bool bUpdateEncrypt;
300 int clientSchannel;
301 int serverSchannel;
302 bool bNullPasswords;
303 bool bObeyPamRestrictions;
304 bool bLoadPrinters;
305 int PrintcapCacheTime;
306 bool bLargeReadwrite;
307 bool bReadRaw;
308 bool bWriteRaw;
309 bool bSyslogOnly;
310 bool bBrowseList;
311 bool bNISHomeMap;
312 bool bTimeServer;
313 bool bBindInterfacesOnly;
314 bool bPamPasswordChange;
315 bool bUnixPasswdSync;
316 bool bPasswdChatDebug;
317 int iPasswdChatTimeout;
318 bool bTimestampLogs;
319 bool bNTSmbSupport;
320 bool bNTPipeSupport;
321 bool bNTStatusSupport;
322 bool bStatCache;
323 int iMaxStatCacheSize;
324 bool bKernelOplocks;
325 bool bAllowTrustedDomains;
326 bool bLanmanAuth;
327 bool bNTLMAuth;
328 bool bUseSpnego;
329 bool bClientLanManAuth;
330 bool bClientNTLMv2Auth;
331 bool bClientPlaintextAuth;
332 bool bClientUseSpnego;
333 bool bDebugPrefixTimestamp;
334 bool bDebugHiresTimestamp;
335 bool bDebugPid;
336 bool bDebugUid;
337 bool bDebugClass;
338 bool bEnableCoreFiles;
339 bool bHostMSDfs;
340 bool bUseMmap;
341 bool bHostnameLookups;
342 bool bUnixExtensions;
343 bool bDisableNetbios;
344 char * szDedicatedKeytabFile;
345 int iKerberosMethod;
346 bool bDeferSharingViolations;
347 bool bEnablePrivileges;
348 bool bASUSupport;
349 bool bUsershareOwnerOnly;
350 bool bUsershareAllowGuests;
351 bool bRegistryShares;
352 int restrict_anonymous;
353 int name_cache_timeout;
354 int client_signing;
355 int server_signing;
356 int client_ldap_sasl_wrapping;
357 int iUsershareMaxShares;
358 int iIdmapCacheTime;
359 int iIdmapNegativeCacheTime;
360 bool bResetOnZeroVC;
361 bool bLogWriteableFilesOnExit;
362 int iKeepalive;
363 int iminreceivefile;
364 struct param_opt_struct *param_opt;
365 int cups_connection_timeout;
366 char *szSMBPerfcountModule;
367 bool bMapUntrustedToDomain;
368 bool bAsyncSMBEchoHandler;
369 int ismb2_max_read;
370 int ismb2_max_write;
371 int ismb2_max_trans;
374 static struct global Globals;
377 * This structure describes a single service.
379 struct service {
380 bool valid;
381 bool autoloaded;
382 int usershare;
383 struct timespec usershare_last_mod;
384 char *szService;
385 char *szPath;
386 char *szUsername;
387 char **szInvalidUsers;
388 char **szValidUsers;
389 char **szAdminUsers;
390 char *szCopy;
391 char *szInclude;
392 char *szPreExec;
393 char *szPostExec;
394 char *szRootPreExec;
395 char *szRootPostExec;
396 char *szCupsOptions;
397 char *szPrintcommand;
398 char *szLpqcommand;
399 char *szLprmcommand;
400 char *szLppausecommand;
401 char *szLpresumecommand;
402 char *szQueuepausecommand;
403 char *szQueueresumecommand;
404 char *szPrintername;
405 char *szPrintjobUsername;
406 char *szDontdescend;
407 char **szHostsallow;
408 char **szHostsdeny;
409 char *szMagicScript;
410 char *szMagicOutput;
411 char *szVetoFiles;
412 char *szHideFiles;
413 char *szVetoOplockFiles;
414 char *comment;
415 char *force_user;
416 char *force_group;
417 char **readlist;
418 char **writelist;
419 char **printer_admin;
420 char *volume;
421 char *fstype;
422 char **szVfsObjects;
423 char *szMSDfsProxy;
424 char *szAioWriteBehind;
425 char *szDfree;
426 int iMinPrintSpace;
427 int iMaxPrintJobs;
428 int iMaxReportedPrintJobs;
429 int iWriteCacheSize;
430 int iCreate_mask;
431 int iCreate_force_mode;
432 int iSecurity_mask;
433 int iSecurity_force_mode;
434 int iDir_mask;
435 int iDir_force_mode;
436 int iDir_Security_mask;
437 int iDir_Security_force_mode;
438 int iMaxConnections;
439 int iDefaultCase;
440 int iPrinting;
441 int iOplockContentionLimit;
442 int iCSCPolicy;
443 int iBlock_size;
444 int iDfreeCacheTime;
445 bool bPreexecClose;
446 bool bRootpreexecClose;
447 int iCaseSensitive;
448 bool bCasePreserve;
449 bool bShortCasePreserve;
450 bool bHideDotFiles;
451 bool bHideSpecialFiles;
452 bool bHideUnReadable;
453 bool bHideUnWriteableFiles;
454 bool bBrowseable;
455 bool bAccessBasedShareEnum;
456 bool bAvailable;
457 bool bRead_only;
458 bool bNo_set_dir;
459 bool bGuest_only;
460 bool bAdministrative_share;
461 bool bGuest_ok;
462 bool bPrint_ok;
463 bool bMap_system;
464 bool bMap_hidden;
465 bool bMap_archive;
466 bool bStoreDosAttributes;
467 bool bDmapiSupport;
468 bool bLocking;
469 int iStrictLocking;
470 bool bPosixLocking;
471 bool bShareModes;
472 bool bOpLocks;
473 bool bLevel2OpLocks;
474 bool bOnlyUser;
475 bool bMangledNames;
476 bool bWidelinks;
477 bool bSymlinks;
478 bool bSyncAlways;
479 bool bStrictAllocate;
480 bool bStrictSync;
481 char magic_char;
482 struct bitmap *copymap;
483 bool bDeleteReadonly;
484 bool bFakeOplocks;
485 bool bDeleteVetoFiles;
486 bool bDosFilemode;
487 bool bDosFiletimes;
488 bool bDosFiletimeResolution;
489 bool bFakeDirCreateTimes;
490 bool bBlockingLocks;
491 bool bInheritPerms;
492 bool bInheritACLS;
493 bool bInheritOwner;
494 bool bMSDfsRoot;
495 bool bUseClientDriver;
496 bool bDefaultDevmode;
497 bool bForcePrintername;
498 bool bNTAclSupport;
499 bool bForceUnknownAclUser;
500 bool bUseSendfile;
501 bool bProfileAcls;
502 bool bMap_acl_inherit;
503 bool bAfs_Share;
504 bool bEASupport;
505 bool bAclCheckPermissions;
506 bool bAclMapFullControl;
507 bool bAclGroupControl;
508 bool bChangeNotify;
509 bool bKernelChangeNotify;
510 int iallocation_roundup_size;
511 int iAioReadSize;
512 int iAioWriteSize;
513 int iMap_readonly;
514 int iDirectoryNameCacheSize;
515 int ismb_encrypt;
516 struct param_opt_struct *param_opt;
518 char dummy[3]; /* for alignment */
522 /* This is a default service used to prime a services structure */
523 static struct service sDefault = {
524 True, /* valid */
525 False, /* not autoloaded */
526 0, /* not a usershare */
527 {0, }, /* No last mod time */
528 NULL, /* szService */
529 NULL, /* szPath */
530 NULL, /* szUsername */
531 NULL, /* szInvalidUsers */
532 NULL, /* szValidUsers */
533 NULL, /* szAdminUsers */
534 NULL, /* szCopy */
535 NULL, /* szInclude */
536 NULL, /* szPreExec */
537 NULL, /* szPostExec */
538 NULL, /* szRootPreExec */
539 NULL, /* szRootPostExec */
540 NULL, /* szCupsOptions */
541 NULL, /* szPrintcommand */
542 NULL, /* szLpqcommand */
543 NULL, /* szLprmcommand */
544 NULL, /* szLppausecommand */
545 NULL, /* szLpresumecommand */
546 NULL, /* szQueuepausecommand */
547 NULL, /* szQueueresumecommand */
548 NULL, /* szPrintername */
549 NULL, /* szPrintjobUsername */
550 NULL, /* szDontdescend */
551 NULL, /* szHostsallow */
552 NULL, /* szHostsdeny */
553 NULL, /* szMagicScript */
554 NULL, /* szMagicOutput */
555 NULL, /* szVetoFiles */
556 NULL, /* szHideFiles */
557 NULL, /* szVetoOplockFiles */
558 NULL, /* comment */
559 NULL, /* force user */
560 NULL, /* force group */
561 NULL, /* readlist */
562 NULL, /* writelist */
563 NULL, /* printer admin */
564 NULL, /* volume */
565 NULL, /* fstype */
566 NULL, /* vfs objects */
567 NULL, /* szMSDfsProxy */
568 NULL, /* szAioWriteBehind */
569 NULL, /* szDfree */
570 0, /* iMinPrintSpace */
571 1000, /* iMaxPrintJobs */
572 0, /* iMaxReportedPrintJobs */
573 0, /* iWriteCacheSize */
574 0744, /* iCreate_mask */
575 0000, /* iCreate_force_mode */
576 0777, /* iSecurity_mask */
577 0, /* iSecurity_force_mode */
578 0755, /* iDir_mask */
579 0000, /* iDir_force_mode */
580 0777, /* iDir_Security_mask */
581 0, /* iDir_Security_force_mode */
582 0, /* iMaxConnections */
583 CASE_LOWER, /* iDefaultCase */
584 DEFAULT_PRINTING, /* iPrinting */
585 2, /* iOplockContentionLimit */
586 0, /* iCSCPolicy */
587 1024, /* iBlock_size */
588 0, /* iDfreeCacheTime */
589 False, /* bPreexecClose */
590 False, /* bRootpreexecClose */
591 Auto, /* case sensitive */
592 True, /* case preserve */
593 True, /* short case preserve */
594 True, /* bHideDotFiles */
595 False, /* bHideSpecialFiles */
596 False, /* bHideUnReadable */
597 False, /* bHideUnWriteableFiles */
598 True, /* bBrowseable */
599 False, /* bAccessBasedShareEnum */
600 True, /* bAvailable */
601 True, /* bRead_only */
602 True, /* bNo_set_dir */
603 False, /* bGuest_only */
604 False, /* bAdministrative_share */
605 False, /* bGuest_ok */
606 False, /* bPrint_ok */
607 False, /* bMap_system */
608 False, /* bMap_hidden */
609 True, /* bMap_archive */
610 False, /* bStoreDosAttributes */
611 False, /* bDmapiSupport */
612 True, /* bLocking */
613 Auto, /* iStrictLocking */
614 True, /* bPosixLocking */
615 True, /* bShareModes */
616 True, /* bOpLocks */
617 True, /* bLevel2OpLocks */
618 False, /* bOnlyUser */
619 True, /* bMangledNames */
620 false, /* bWidelinks */
621 True, /* bSymlinks */
622 False, /* bSyncAlways */
623 False, /* bStrictAllocate */
624 False, /* bStrictSync */
625 '~', /* magic char */
626 NULL, /* copymap */
627 False, /* bDeleteReadonly */
628 False, /* bFakeOplocks */
629 False, /* bDeleteVetoFiles */
630 False, /* bDosFilemode */
631 True, /* bDosFiletimes */
632 False, /* bDosFiletimeResolution */
633 False, /* bFakeDirCreateTimes */
634 True, /* bBlockingLocks */
635 False, /* bInheritPerms */
636 False, /* bInheritACLS */
637 False, /* bInheritOwner */
638 False, /* bMSDfsRoot */
639 False, /* bUseClientDriver */
640 True, /* bDefaultDevmode */
641 False, /* bForcePrintername */
642 True, /* bNTAclSupport */
643 False, /* bForceUnknownAclUser */
644 False, /* bUseSendfile */
645 False, /* bProfileAcls */
646 False, /* bMap_acl_inherit */
647 False, /* bAfs_Share */
648 False, /* bEASupport */
649 True, /* bAclCheckPermissions */
650 True, /* bAclMapFullControl */
651 False, /* bAclGroupControl */
652 True, /* bChangeNotify */
653 True, /* bKernelChangeNotify */
654 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
655 0, /* iAioReadSize */
656 0, /* iAioWriteSize */
657 MAP_READONLY_YES, /* iMap_readonly */
658 #ifdef BROKEN_DIRECTORY_HANDLING
659 0, /* iDirectoryNameCacheSize */
660 #else
661 100, /* iDirectoryNameCacheSize */
662 #endif
663 Auto, /* ismb_encrypt */
664 NULL, /* Parametric options */
666 "" /* dummy */
669 /* local variables */
670 static struct service **ServicePtrs = NULL;
671 static int iNumServices = 0;
672 static int iServiceIndex = 0;
673 static struct db_context *ServiceHash;
674 static int *invalid_services = NULL;
675 static int num_invalid_services = 0;
676 static bool bInGlobalSection = True;
677 static bool bGlobalOnly = False;
678 static int server_role;
679 static int default_server_announce;
681 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
683 /* prototypes for the special type handlers */
684 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
685 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
686 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
687 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
688 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
689 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
690 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
691 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
692 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
693 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
694 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
695 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
697 static void set_server_role(void);
698 static void set_default_server_announce_type(void);
699 static void set_allowed_client_auth(void);
701 static void *lp_local_ptr(struct service *service, void *ptr);
703 static void add_to_file_list(const char *fname, const char *subfname);
705 static const struct enum_list enum_protocol[] = {
706 {PROTOCOL_SMB2, "SMB2"},
707 {PROTOCOL_NT1, "NT1"},
708 {PROTOCOL_LANMAN2, "LANMAN2"},
709 {PROTOCOL_LANMAN1, "LANMAN1"},
710 {PROTOCOL_CORE, "CORE"},
711 {PROTOCOL_COREPLUS, "COREPLUS"},
712 {PROTOCOL_COREPLUS, "CORE+"},
713 {-1, NULL}
716 static const struct enum_list enum_security[] = {
717 {SEC_SHARE, "SHARE"},
718 {SEC_USER, "USER"},
719 {SEC_SERVER, "SERVER"},
720 {SEC_DOMAIN, "DOMAIN"},
721 #ifdef HAVE_ADS
722 {SEC_ADS, "ADS"},
723 #endif
724 {-1, NULL}
727 static const struct enum_list enum_printing[] = {
728 {PRINT_SYSV, "sysv"},
729 {PRINT_AIX, "aix"},
730 {PRINT_HPUX, "hpux"},
731 {PRINT_BSD, "bsd"},
732 {PRINT_QNX, "qnx"},
733 {PRINT_PLP, "plp"},
734 {PRINT_LPRNG, "lprng"},
735 {PRINT_CUPS, "cups"},
736 {PRINT_IPRINT, "iprint"},
737 {PRINT_LPRNT, "nt"},
738 {PRINT_LPROS2, "os2"},
739 #ifdef DEVELOPER
740 {PRINT_TEST, "test"},
741 {PRINT_VLP, "vlp"},
742 #endif /* DEVELOPER */
743 {-1, NULL}
746 static const struct enum_list enum_ldap_sasl_wrapping[] = {
747 {0, "plain"},
748 {ADS_AUTH_SASL_SIGN, "sign"},
749 {ADS_AUTH_SASL_SEAL, "seal"},
750 {-1, NULL}
753 static const struct enum_list enum_ldap_ssl[] = {
754 {LDAP_SSL_OFF, "no"},
755 {LDAP_SSL_OFF, "off"},
756 {LDAP_SSL_START_TLS, "start tls"},
757 {LDAP_SSL_START_TLS, "start_tls"},
758 {-1, NULL}
761 /* LDAP Dereferencing Alias types */
762 #define SAMBA_LDAP_DEREF_NEVER 0
763 #define SAMBA_LDAP_DEREF_SEARCHING 1
764 #define SAMBA_LDAP_DEREF_FINDING 2
765 #define SAMBA_LDAP_DEREF_ALWAYS 3
767 static const struct enum_list enum_ldap_deref[] = {
768 {SAMBA_LDAP_DEREF_NEVER, "never"},
769 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
770 {SAMBA_LDAP_DEREF_FINDING, "finding"},
771 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
772 {-1, "auto"}
775 static const struct enum_list enum_ldap_passwd_sync[] = {
776 {LDAP_PASSWD_SYNC_OFF, "no"},
777 {LDAP_PASSWD_SYNC_OFF, "off"},
778 {LDAP_PASSWD_SYNC_ON, "yes"},
779 {LDAP_PASSWD_SYNC_ON, "on"},
780 {LDAP_PASSWD_SYNC_ONLY, "only"},
781 {-1, NULL}
784 /* Types of machine we can announce as. */
785 #define ANNOUNCE_AS_NT_SERVER 1
786 #define ANNOUNCE_AS_WIN95 2
787 #define ANNOUNCE_AS_WFW 3
788 #define ANNOUNCE_AS_NT_WORKSTATION 4
790 static const struct enum_list enum_announce_as[] = {
791 {ANNOUNCE_AS_NT_SERVER, "NT"},
792 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
793 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
794 {ANNOUNCE_AS_WIN95, "win95"},
795 {ANNOUNCE_AS_WFW, "WfW"},
796 {-1, NULL}
799 static const struct enum_list enum_map_readonly[] = {
800 {MAP_READONLY_NO, "no"},
801 {MAP_READONLY_NO, "false"},
802 {MAP_READONLY_NO, "0"},
803 {MAP_READONLY_YES, "yes"},
804 {MAP_READONLY_YES, "true"},
805 {MAP_READONLY_YES, "1"},
806 {MAP_READONLY_PERMISSIONS, "permissions"},
807 {MAP_READONLY_PERMISSIONS, "perms"},
808 {-1, NULL}
811 static const struct enum_list enum_case[] = {
812 {CASE_LOWER, "lower"},
813 {CASE_UPPER, "upper"},
814 {-1, NULL}
819 static const struct enum_list enum_bool_auto[] = {
820 {False, "No"},
821 {False, "False"},
822 {False, "0"},
823 {True, "Yes"},
824 {True, "True"},
825 {True, "1"},
826 {Auto, "Auto"},
827 {-1, NULL}
830 static const struct enum_list enum_csc_policy[] = {
831 {CSC_POLICY_MANUAL, "manual"},
832 {CSC_POLICY_DOCUMENTS, "documents"},
833 {CSC_POLICY_PROGRAMS, "programs"},
834 {CSC_POLICY_DISABLE, "disable"},
835 {-1, NULL}
838 /* SMB signing types. */
839 static const struct enum_list enum_smb_signing_vals[] = {
840 {False, "No"},
841 {False, "False"},
842 {False, "0"},
843 {False, "Off"},
844 {False, "disabled"},
845 {True, "Yes"},
846 {True, "True"},
847 {True, "1"},
848 {True, "On"},
849 {True, "enabled"},
850 {Auto, "auto"},
851 {Required, "required"},
852 {Required, "mandatory"},
853 {Required, "force"},
854 {Required, "forced"},
855 {Required, "enforced"},
856 {-1, NULL}
859 /* ACL compatibility options. */
860 static const struct enum_list enum_acl_compat_vals[] = {
861 { ACL_COMPAT_AUTO, "auto" },
862 { ACL_COMPAT_WINNT, "winnt" },
863 { ACL_COMPAT_WIN2K, "win2k" },
864 { -1, NULL}
868 Do you want session setups at user level security with a invalid
869 password to be rejected or allowed in as guest? WinNT rejects them
870 but it can be a pain as it means "net view" needs to use a password
872 You have 3 choices in the setting of map_to_guest:
874 "Never" means session setups with an invalid password
875 are rejected. This is the default.
877 "Bad User" means session setups with an invalid password
878 are rejected, unless the username does not exist, in which case it
879 is treated as a guest login
881 "Bad Password" means session setups with an invalid password
882 are treated as a guest login
884 Note that map_to_guest only has an effect in user or server
885 level security.
888 static const struct enum_list enum_map_to_guest[] = {
889 {NEVER_MAP_TO_GUEST, "Never"},
890 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
891 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
892 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
893 {-1, NULL}
896 /* Config backend options */
898 static const struct enum_list enum_config_backend[] = {
899 {CONFIG_BACKEND_FILE, "file"},
900 {CONFIG_BACKEND_REGISTRY, "registry"},
901 {-1, NULL}
904 /* ADS kerberos ticket verification options */
906 static const struct enum_list enum_kerberos_method[] = {
907 {KERBEROS_VERIFY_SECRETS, "default"},
908 {KERBEROS_VERIFY_SECRETS, "secrets only"},
909 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
910 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
911 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
912 {-1, NULL}
915 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
917 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
918 * screen in SWAT. This is used to exclude parameters as well as to squash all
919 * parameters that have been duplicated by pseudonyms.
921 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
922 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
923 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
924 * respective views.
926 * NOTE2: Handling of duplicated (synonym) parameters:
927 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
928 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
929 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
930 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
933 static struct parm_struct parm_table[] = {
934 {N_("Base Options"), P_SEP, P_SEPARATOR},
937 .label = "dos charset",
938 .type = P_STRING,
939 .p_class = P_GLOBAL,
940 .ptr = &Globals.dos_charset,
941 .special = handle_charset,
942 .enum_list = NULL,
943 .flags = FLAG_ADVANCED
946 .label = "unix charset",
947 .type = P_STRING,
948 .p_class = P_GLOBAL,
949 .ptr = &Globals.unix_charset,
950 .special = handle_charset,
951 .enum_list = NULL,
952 .flags = FLAG_ADVANCED
955 .label = "display charset",
956 .type = P_STRING,
957 .p_class = P_GLOBAL,
958 .ptr = &Globals.display_charset,
959 .special = handle_charset,
960 .enum_list = NULL,
961 .flags = FLAG_ADVANCED
964 .label = "comment",
965 .type = P_STRING,
966 .p_class = P_LOCAL,
967 .ptr = &sDefault.comment,
968 .special = NULL,
969 .enum_list = NULL,
970 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
973 .label = "path",
974 .type = P_STRING,
975 .p_class = P_LOCAL,
976 .ptr = &sDefault.szPath,
977 .special = NULL,
978 .enum_list = NULL,
979 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
982 .label = "directory",
983 .type = P_STRING,
984 .p_class = P_LOCAL,
985 .ptr = &sDefault.szPath,
986 .special = NULL,
987 .enum_list = NULL,
988 .flags = FLAG_HIDE,
991 .label = "workgroup",
992 .type = P_USTRING,
993 .p_class = P_GLOBAL,
994 .ptr = &Globals.szWorkgroup,
995 .special = handle_workgroup,
996 .enum_list = NULL,
997 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
999 #ifdef WITH_ADS
1001 .label = "realm",
1002 .type = P_USTRING,
1003 .p_class = P_GLOBAL,
1004 .ptr = &Globals.szRealm,
1005 .special = NULL,
1006 .enum_list = NULL,
1007 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1009 #endif
1011 .label = "netbios name",
1012 .type = P_USTRING,
1013 .p_class = P_GLOBAL,
1014 .ptr = &Globals.szNetbiosName,
1015 .special = handle_netbios_name,
1016 .enum_list = NULL,
1017 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1020 .label = "netbios aliases",
1021 .type = P_LIST,
1022 .p_class = P_GLOBAL,
1023 .ptr = &Globals.szNetbiosAliases,
1024 .special = handle_netbios_aliases,
1025 .enum_list = NULL,
1026 .flags = FLAG_ADVANCED,
1029 .label = "netbios scope",
1030 .type = P_USTRING,
1031 .p_class = P_GLOBAL,
1032 .ptr = &Globals.szNetbiosScope,
1033 .special = handle_netbios_scope,
1034 .enum_list = NULL,
1035 .flags = FLAG_ADVANCED,
1038 .label = "server string",
1039 .type = P_STRING,
1040 .p_class = P_GLOBAL,
1041 .ptr = &Globals.szServerString,
1042 .special = NULL,
1043 .enum_list = NULL,
1044 .flags = FLAG_BASIC | FLAG_ADVANCED,
1047 .label = "interfaces",
1048 .type = P_LIST,
1049 .p_class = P_GLOBAL,
1050 .ptr = &Globals.szInterfaces,
1051 .special = NULL,
1052 .enum_list = NULL,
1053 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1056 .label = "bind interfaces only",
1057 .type = P_BOOL,
1058 .p_class = P_GLOBAL,
1059 .ptr = &Globals.bBindInterfacesOnly,
1060 .special = NULL,
1061 .enum_list = NULL,
1062 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1065 .label = "config backend",
1066 .type = P_ENUM,
1067 .p_class = P_GLOBAL,
1068 .ptr = &Globals.ConfigBackend,
1069 .special = NULL,
1070 .enum_list = enum_config_backend,
1071 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1074 {N_("Security Options"), P_SEP, P_SEPARATOR},
1077 .label = "security",
1078 .type = P_ENUM,
1079 .p_class = P_GLOBAL,
1080 .ptr = &Globals.security,
1081 .special = NULL,
1082 .enum_list = enum_security,
1083 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1086 .label = "auth methods",
1087 .type = P_LIST,
1088 .p_class = P_GLOBAL,
1089 .ptr = &Globals.AuthMethods,
1090 .special = NULL,
1091 .enum_list = NULL,
1092 .flags = FLAG_ADVANCED,
1095 .label = "encrypt passwords",
1096 .type = P_BOOL,
1097 .p_class = P_GLOBAL,
1098 .ptr = &Globals.bEncryptPasswords,
1099 .special = NULL,
1100 .enum_list = NULL,
1101 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1104 .label = "update encrypted",
1105 .type = P_BOOL,
1106 .p_class = P_GLOBAL,
1107 .ptr = &Globals.bUpdateEncrypt,
1108 .special = NULL,
1109 .enum_list = NULL,
1110 .flags = FLAG_ADVANCED,
1113 .label = "client schannel",
1114 .type = P_ENUM,
1115 .p_class = P_GLOBAL,
1116 .ptr = &Globals.clientSchannel,
1117 .special = NULL,
1118 .enum_list = enum_bool_auto,
1119 .flags = FLAG_BASIC | FLAG_ADVANCED,
1122 .label = "server schannel",
1123 .type = P_ENUM,
1124 .p_class = P_GLOBAL,
1125 .ptr = &Globals.serverSchannel,
1126 .special = NULL,
1127 .enum_list = enum_bool_auto,
1128 .flags = FLAG_BASIC | FLAG_ADVANCED,
1131 .label = "allow trusted domains",
1132 .type = P_BOOL,
1133 .p_class = P_GLOBAL,
1134 .ptr = &Globals.bAllowTrustedDomains,
1135 .special = NULL,
1136 .enum_list = NULL,
1137 .flags = FLAG_ADVANCED,
1140 .label = "map to guest",
1141 .type = P_ENUM,
1142 .p_class = P_GLOBAL,
1143 .ptr = &Globals.map_to_guest,
1144 .special = NULL,
1145 .enum_list = enum_map_to_guest,
1146 .flags = FLAG_ADVANCED,
1149 .label = "null passwords",
1150 .type = P_BOOL,
1151 .p_class = P_GLOBAL,
1152 .ptr = &Globals.bNullPasswords,
1153 .special = NULL,
1154 .enum_list = NULL,
1155 .flags = FLAG_ADVANCED,
1158 .label = "obey pam restrictions",
1159 .type = P_BOOL,
1160 .p_class = P_GLOBAL,
1161 .ptr = &Globals.bObeyPamRestrictions,
1162 .special = NULL,
1163 .enum_list = NULL,
1164 .flags = FLAG_ADVANCED,
1167 .label = "password server",
1168 .type = P_STRING,
1169 .p_class = P_GLOBAL,
1170 .ptr = &Globals.szPasswordServer,
1171 .special = NULL,
1172 .enum_list = NULL,
1173 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1176 .label = "smb passwd file",
1177 .type = P_STRING,
1178 .p_class = P_GLOBAL,
1179 .ptr = &Globals.szSMBPasswdFile,
1180 .special = NULL,
1181 .enum_list = NULL,
1182 .flags = FLAG_ADVANCED,
1185 .label = "private dir",
1186 .type = P_STRING,
1187 .p_class = P_GLOBAL,
1188 .ptr = &Globals.szPrivateDir,
1189 .special = NULL,
1190 .enum_list = NULL,
1191 .flags = FLAG_ADVANCED,
1194 .label = "passdb backend",
1195 .type = P_STRING,
1196 .p_class = P_GLOBAL,
1197 .ptr = &Globals.szPassdbBackend,
1198 .special = NULL,
1199 .enum_list = NULL,
1200 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1203 .label = "algorithmic rid base",
1204 .type = P_INTEGER,
1205 .p_class = P_GLOBAL,
1206 .ptr = &Globals.AlgorithmicRidBase,
1207 .special = NULL,
1208 .enum_list = NULL,
1209 .flags = FLAG_ADVANCED,
1212 .label = "root directory",
1213 .type = P_STRING,
1214 .p_class = P_GLOBAL,
1215 .ptr = &Globals.szRootdir,
1216 .special = NULL,
1217 .enum_list = NULL,
1218 .flags = FLAG_ADVANCED,
1221 .label = "root dir",
1222 .type = P_STRING,
1223 .p_class = P_GLOBAL,
1224 .ptr = &Globals.szRootdir,
1225 .special = NULL,
1226 .enum_list = NULL,
1227 .flags = FLAG_HIDE,
1230 .label = "root",
1231 .type = P_STRING,
1232 .p_class = P_GLOBAL,
1233 .ptr = &Globals.szRootdir,
1234 .special = NULL,
1235 .enum_list = NULL,
1236 .flags = FLAG_HIDE,
1239 .label = "guest account",
1240 .type = P_STRING,
1241 .p_class = P_GLOBAL,
1242 .ptr = &Globals.szGuestaccount,
1243 .special = NULL,
1244 .enum_list = NULL,
1245 .flags = FLAG_BASIC | FLAG_ADVANCED,
1248 .label = "enable privileges",
1249 .type = P_BOOL,
1250 .p_class = P_GLOBAL,
1251 .ptr = &Globals.bEnablePrivileges,
1252 .special = NULL,
1253 .enum_list = NULL,
1254 .flags = FLAG_ADVANCED,
1258 .label = "pam password change",
1259 .type = P_BOOL,
1260 .p_class = P_GLOBAL,
1261 .ptr = &Globals.bPamPasswordChange,
1262 .special = NULL,
1263 .enum_list = NULL,
1264 .flags = FLAG_ADVANCED,
1267 .label = "passwd program",
1268 .type = P_STRING,
1269 .p_class = P_GLOBAL,
1270 .ptr = &Globals.szPasswdProgram,
1271 .special = NULL,
1272 .enum_list = NULL,
1273 .flags = FLAG_ADVANCED,
1276 .label = "passwd chat",
1277 .type = P_STRING,
1278 .p_class = P_GLOBAL,
1279 .ptr = &Globals.szPasswdChat,
1280 .special = NULL,
1281 .enum_list = NULL,
1282 .flags = FLAG_ADVANCED,
1285 .label = "passwd chat debug",
1286 .type = P_BOOL,
1287 .p_class = P_GLOBAL,
1288 .ptr = &Globals.bPasswdChatDebug,
1289 .special = NULL,
1290 .enum_list = NULL,
1291 .flags = FLAG_ADVANCED,
1294 .label = "passwd chat timeout",
1295 .type = P_INTEGER,
1296 .p_class = P_GLOBAL,
1297 .ptr = &Globals.iPasswdChatTimeout,
1298 .special = NULL,
1299 .enum_list = NULL,
1300 .flags = FLAG_ADVANCED,
1303 .label = "check password script",
1304 .type = P_STRING,
1305 .p_class = P_GLOBAL,
1306 .ptr = &Globals.szCheckPasswordScript,
1307 .special = NULL,
1308 .enum_list = NULL,
1309 .flags = FLAG_ADVANCED,
1312 .label = "username map",
1313 .type = P_STRING,
1314 .p_class = P_GLOBAL,
1315 .ptr = &Globals.szUsernameMap,
1316 .special = NULL,
1317 .enum_list = NULL,
1318 .flags = FLAG_ADVANCED,
1321 .label = "password level",
1322 .type = P_INTEGER,
1323 .p_class = P_GLOBAL,
1324 .ptr = &Globals.pwordlevel,
1325 .special = NULL,
1326 .enum_list = NULL,
1327 .flags = FLAG_ADVANCED,
1330 .label = "username level",
1331 .type = P_INTEGER,
1332 .p_class = P_GLOBAL,
1333 .ptr = &Globals.unamelevel,
1334 .special = NULL,
1335 .enum_list = NULL,
1336 .flags = FLAG_ADVANCED,
1339 .label = "unix password sync",
1340 .type = P_BOOL,
1341 .p_class = P_GLOBAL,
1342 .ptr = &Globals.bUnixPasswdSync,
1343 .special = NULL,
1344 .enum_list = NULL,
1345 .flags = FLAG_ADVANCED,
1348 .label = "restrict anonymous",
1349 .type = P_INTEGER,
1350 .p_class = P_GLOBAL,
1351 .ptr = &Globals.restrict_anonymous,
1352 .special = NULL,
1353 .enum_list = NULL,
1354 .flags = FLAG_ADVANCED,
1357 .label = "lanman auth",
1358 .type = P_BOOL,
1359 .p_class = P_GLOBAL,
1360 .ptr = &Globals.bLanmanAuth,
1361 .special = NULL,
1362 .enum_list = NULL,
1363 .flags = FLAG_ADVANCED,
1366 .label = "ntlm auth",
1367 .type = P_BOOL,
1368 .p_class = P_GLOBAL,
1369 .ptr = &Globals.bNTLMAuth,
1370 .special = NULL,
1371 .enum_list = NULL,
1372 .flags = FLAG_ADVANCED,
1375 .label = "client NTLMv2 auth",
1376 .type = P_BOOL,
1377 .p_class = P_GLOBAL,
1378 .ptr = &Globals.bClientNTLMv2Auth,
1379 .special = NULL,
1380 .enum_list = NULL,
1381 .flags = FLAG_ADVANCED,
1384 .label = "client lanman auth",
1385 .type = P_BOOL,
1386 .p_class = P_GLOBAL,
1387 .ptr = &Globals.bClientLanManAuth,
1388 .special = NULL,
1389 .enum_list = NULL,
1390 .flags = FLAG_ADVANCED,
1393 .label = "client plaintext auth",
1394 .type = P_BOOL,
1395 .p_class = P_GLOBAL,
1396 .ptr = &Globals.bClientPlaintextAuth,
1397 .special = NULL,
1398 .enum_list = NULL,
1399 .flags = FLAG_ADVANCED,
1402 .label = "username",
1403 .type = P_STRING,
1404 .p_class = P_LOCAL,
1405 .ptr = &sDefault.szUsername,
1406 .special = NULL,
1407 .enum_list = NULL,
1408 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1411 .label = "user",
1412 .type = P_STRING,
1413 .p_class = P_LOCAL,
1414 .ptr = &sDefault.szUsername,
1415 .special = NULL,
1416 .enum_list = NULL,
1417 .flags = FLAG_HIDE,
1420 .label = "users",
1421 .type = P_STRING,
1422 .p_class = P_LOCAL,
1423 .ptr = &sDefault.szUsername,
1424 .special = NULL,
1425 .enum_list = NULL,
1426 .flags = FLAG_HIDE,
1429 .label = "invalid users",
1430 .type = P_LIST,
1431 .p_class = P_LOCAL,
1432 .ptr = &sDefault.szInvalidUsers,
1433 .special = NULL,
1434 .enum_list = NULL,
1435 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1438 .label = "valid users",
1439 .type = P_LIST,
1440 .p_class = P_LOCAL,
1441 .ptr = &sDefault.szValidUsers,
1442 .special = NULL,
1443 .enum_list = NULL,
1444 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1447 .label = "admin users",
1448 .type = P_LIST,
1449 .p_class = P_LOCAL,
1450 .ptr = &sDefault.szAdminUsers,
1451 .special = NULL,
1452 .enum_list = NULL,
1453 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1456 .label = "read list",
1457 .type = P_LIST,
1458 .p_class = P_LOCAL,
1459 .ptr = &sDefault.readlist,
1460 .special = NULL,
1461 .enum_list = NULL,
1462 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1465 .label = "write list",
1466 .type = P_LIST,
1467 .p_class = P_LOCAL,
1468 .ptr = &sDefault.writelist,
1469 .special = NULL,
1470 .enum_list = NULL,
1471 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1474 .label = "printer admin",
1475 .type = P_LIST,
1476 .p_class = P_LOCAL,
1477 .ptr = &sDefault.printer_admin,
1478 .special = NULL,
1479 .enum_list = NULL,
1480 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1483 .label = "force user",
1484 .type = P_STRING,
1485 .p_class = P_LOCAL,
1486 .ptr = &sDefault.force_user,
1487 .special = NULL,
1488 .enum_list = NULL,
1489 .flags = FLAG_ADVANCED | FLAG_SHARE,
1492 .label = "force group",
1493 .type = P_STRING,
1494 .p_class = P_LOCAL,
1495 .ptr = &sDefault.force_group,
1496 .special = NULL,
1497 .enum_list = NULL,
1498 .flags = FLAG_ADVANCED | FLAG_SHARE,
1501 .label = "group",
1502 .type = P_STRING,
1503 .p_class = P_LOCAL,
1504 .ptr = &sDefault.force_group,
1505 .special = NULL,
1506 .enum_list = NULL,
1507 .flags = FLAG_ADVANCED,
1510 .label = "read only",
1511 .type = P_BOOL,
1512 .p_class = P_LOCAL,
1513 .ptr = &sDefault.bRead_only,
1514 .special = NULL,
1515 .enum_list = NULL,
1516 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1519 .label = "write ok",
1520 .type = P_BOOLREV,
1521 .p_class = P_LOCAL,
1522 .ptr = &sDefault.bRead_only,
1523 .special = NULL,
1524 .enum_list = NULL,
1525 .flags = FLAG_HIDE,
1528 .label = "writeable",
1529 .type = P_BOOLREV,
1530 .p_class = P_LOCAL,
1531 .ptr = &sDefault.bRead_only,
1532 .special = NULL,
1533 .enum_list = NULL,
1534 .flags = FLAG_HIDE,
1537 .label = "writable",
1538 .type = P_BOOLREV,
1539 .p_class = P_LOCAL,
1540 .ptr = &sDefault.bRead_only,
1541 .special = NULL,
1542 .enum_list = NULL,
1543 .flags = FLAG_HIDE,
1546 .label = "acl check permissions",
1547 .type = P_BOOL,
1548 .p_class = P_LOCAL,
1549 .ptr = &sDefault.bAclCheckPermissions,
1550 .special = NULL,
1551 .enum_list = NULL,
1552 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1555 .label = "acl group control",
1556 .type = P_BOOL,
1557 .p_class = P_LOCAL,
1558 .ptr = &sDefault.bAclGroupControl,
1559 .special = NULL,
1560 .enum_list = NULL,
1561 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1564 .label = "acl map full control",
1565 .type = P_BOOL,
1566 .p_class = P_LOCAL,
1567 .ptr = &sDefault.bAclMapFullControl,
1568 .special = NULL,
1569 .enum_list = NULL,
1570 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1573 .label = "create mask",
1574 .type = P_OCTAL,
1575 .p_class = P_LOCAL,
1576 .ptr = &sDefault.iCreate_mask,
1577 .special = NULL,
1578 .enum_list = NULL,
1579 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1582 .label = "create mode",
1583 .type = P_OCTAL,
1584 .p_class = P_LOCAL,
1585 .ptr = &sDefault.iCreate_mask,
1586 .special = NULL,
1587 .enum_list = NULL,
1588 .flags = FLAG_HIDE,
1591 .label = "force create mode",
1592 .type = P_OCTAL,
1593 .p_class = P_LOCAL,
1594 .ptr = &sDefault.iCreate_force_mode,
1595 .special = NULL,
1596 .enum_list = NULL,
1597 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1600 .label = "security mask",
1601 .type = P_OCTAL,
1602 .p_class = P_LOCAL,
1603 .ptr = &sDefault.iSecurity_mask,
1604 .special = NULL,
1605 .enum_list = NULL,
1606 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1609 .label = "force security mode",
1610 .type = P_OCTAL,
1611 .p_class = P_LOCAL,
1612 .ptr = &sDefault.iSecurity_force_mode,
1613 .special = NULL,
1614 .enum_list = NULL,
1615 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1618 .label = "directory mask",
1619 .type = P_OCTAL,
1620 .p_class = P_LOCAL,
1621 .ptr = &sDefault.iDir_mask,
1622 .special = NULL,
1623 .enum_list = NULL,
1624 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1627 .label = "directory mode",
1628 .type = P_OCTAL,
1629 .p_class = P_LOCAL,
1630 .ptr = &sDefault.iDir_mask,
1631 .special = NULL,
1632 .enum_list = NULL,
1633 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1636 .label = "force directory mode",
1637 .type = P_OCTAL,
1638 .p_class = P_LOCAL,
1639 .ptr = &sDefault.iDir_force_mode,
1640 .special = NULL,
1641 .enum_list = NULL,
1642 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1645 .label = "directory security mask",
1646 .type = P_OCTAL,
1647 .p_class = P_LOCAL,
1648 .ptr = &sDefault.iDir_Security_mask,
1649 .special = NULL,
1650 .enum_list = NULL,
1651 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1654 .label = "force directory security mode",
1655 .type = P_OCTAL,
1656 .p_class = P_LOCAL,
1657 .ptr = &sDefault.iDir_Security_force_mode,
1658 .special = NULL,
1659 .enum_list = NULL,
1660 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1663 .label = "force unknown acl user",
1664 .type = P_BOOL,
1665 .p_class = P_LOCAL,
1666 .ptr = &sDefault.bForceUnknownAclUser,
1667 .special = NULL,
1668 .enum_list = NULL,
1669 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1672 .label = "inherit permissions",
1673 .type = P_BOOL,
1674 .p_class = P_LOCAL,
1675 .ptr = &sDefault.bInheritPerms,
1676 .special = NULL,
1677 .enum_list = NULL,
1678 .flags = FLAG_ADVANCED | FLAG_SHARE,
1681 .label = "inherit acls",
1682 .type = P_BOOL,
1683 .p_class = P_LOCAL,
1684 .ptr = &sDefault.bInheritACLS,
1685 .special = NULL,
1686 .enum_list = NULL,
1687 .flags = FLAG_ADVANCED | FLAG_SHARE,
1690 .label = "inherit owner",
1691 .type = P_BOOL,
1692 .p_class = P_LOCAL,
1693 .ptr = &sDefault.bInheritOwner,
1694 .special = NULL,
1695 .enum_list = NULL,
1696 .flags = FLAG_ADVANCED | FLAG_SHARE,
1699 .label = "guest only",
1700 .type = P_BOOL,
1701 .p_class = P_LOCAL,
1702 .ptr = &sDefault.bGuest_only,
1703 .special = NULL,
1704 .enum_list = NULL,
1705 .flags = FLAG_ADVANCED | FLAG_SHARE,
1708 .label = "only guest",
1709 .type = P_BOOL,
1710 .p_class = P_LOCAL,
1711 .ptr = &sDefault.bGuest_only,
1712 .special = NULL,
1713 .enum_list = NULL,
1714 .flags = FLAG_HIDE,
1717 .label = "administrative share",
1718 .type = P_BOOL,
1719 .p_class = P_LOCAL,
1720 .ptr = &sDefault.bAdministrative_share,
1721 .special = NULL,
1722 .enum_list = NULL,
1723 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1727 .label = "guest ok",
1728 .type = P_BOOL,
1729 .p_class = P_LOCAL,
1730 .ptr = &sDefault.bGuest_ok,
1731 .special = NULL,
1732 .enum_list = NULL,
1733 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1736 .label = "public",
1737 .type = P_BOOL,
1738 .p_class = P_LOCAL,
1739 .ptr = &sDefault.bGuest_ok,
1740 .special = NULL,
1741 .enum_list = NULL,
1742 .flags = FLAG_HIDE,
1745 .label = "only user",
1746 .type = P_BOOL,
1747 .p_class = P_LOCAL,
1748 .ptr = &sDefault.bOnlyUser,
1749 .special = NULL,
1750 .enum_list = NULL,
1751 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1754 .label = "hosts allow",
1755 .type = P_LIST,
1756 .p_class = P_LOCAL,
1757 .ptr = &sDefault.szHostsallow,
1758 .special = NULL,
1759 .enum_list = NULL,
1760 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1763 .label = "allow hosts",
1764 .type = P_LIST,
1765 .p_class = P_LOCAL,
1766 .ptr = &sDefault.szHostsallow,
1767 .special = NULL,
1768 .enum_list = NULL,
1769 .flags = FLAG_HIDE,
1772 .label = "hosts deny",
1773 .type = P_LIST,
1774 .p_class = P_LOCAL,
1775 .ptr = &sDefault.szHostsdeny,
1776 .special = NULL,
1777 .enum_list = NULL,
1778 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1781 .label = "deny hosts",
1782 .type = P_LIST,
1783 .p_class = P_LOCAL,
1784 .ptr = &sDefault.szHostsdeny,
1785 .special = NULL,
1786 .enum_list = NULL,
1787 .flags = FLAG_HIDE,
1790 .label = "preload modules",
1791 .type = P_LIST,
1792 .p_class = P_GLOBAL,
1793 .ptr = &Globals.szPreloadModules,
1794 .special = NULL,
1795 .enum_list = NULL,
1796 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1799 .label = "dedicated keytab file",
1800 .type = P_STRING,
1801 .p_class = P_GLOBAL,
1802 .ptr = &Globals.szDedicatedKeytabFile,
1803 .special = NULL,
1804 .enum_list = NULL,
1805 .flags = FLAG_ADVANCED,
1808 .label = "kerberos method",
1809 .type = P_ENUM,
1810 .p_class = P_GLOBAL,
1811 .ptr = &Globals.iKerberosMethod,
1812 .special = NULL,
1813 .enum_list = enum_kerberos_method,
1814 .flags = FLAG_ADVANCED,
1817 .label = "map untrusted to domain",
1818 .type = P_BOOL,
1819 .p_class = P_GLOBAL,
1820 .ptr = &Globals.bMapUntrustedToDomain,
1821 .special = NULL,
1822 .enum_list = NULL,
1823 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1827 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1830 .label = "log level",
1831 .type = P_STRING,
1832 .p_class = P_GLOBAL,
1833 .ptr = &Globals.szLogLevel,
1834 .special = handle_debug_list,
1835 .enum_list = NULL,
1836 .flags = FLAG_ADVANCED,
1839 .label = "debuglevel",
1840 .type = P_STRING,
1841 .p_class = P_GLOBAL,
1842 .ptr = &Globals.szLogLevel,
1843 .special = handle_debug_list,
1844 .enum_list = NULL,
1845 .flags = FLAG_HIDE,
1848 .label = "syslog",
1849 .type = P_INTEGER,
1850 .p_class = P_GLOBAL,
1851 .ptr = &Globals.syslog,
1852 .special = NULL,
1853 .enum_list = NULL,
1854 .flags = FLAG_ADVANCED,
1857 .label = "syslog only",
1858 .type = P_BOOL,
1859 .p_class = P_GLOBAL,
1860 .ptr = &Globals.bSyslogOnly,
1861 .special = NULL,
1862 .enum_list = NULL,
1863 .flags = FLAG_ADVANCED,
1866 .label = "log file",
1867 .type = P_STRING,
1868 .p_class = P_GLOBAL,
1869 .ptr = &Globals.szLogFile,
1870 .special = NULL,
1871 .enum_list = NULL,
1872 .flags = FLAG_ADVANCED,
1875 .label = "max log size",
1876 .type = P_INTEGER,
1877 .p_class = P_GLOBAL,
1878 .ptr = &Globals.max_log_size,
1879 .special = NULL,
1880 .enum_list = NULL,
1881 .flags = FLAG_ADVANCED,
1884 .label = "debug timestamp",
1885 .type = P_BOOL,
1886 .p_class = P_GLOBAL,
1887 .ptr = &Globals.bTimestampLogs,
1888 .special = NULL,
1889 .enum_list = NULL,
1890 .flags = FLAG_ADVANCED,
1893 .label = "timestamp logs",
1894 .type = P_BOOL,
1895 .p_class = P_GLOBAL,
1896 .ptr = &Globals.bTimestampLogs,
1897 .special = NULL,
1898 .enum_list = NULL,
1899 .flags = FLAG_ADVANCED,
1902 .label = "debug prefix timestamp",
1903 .type = P_BOOL,
1904 .p_class = P_GLOBAL,
1905 .ptr = &Globals.bDebugPrefixTimestamp,
1906 .special = NULL,
1907 .enum_list = NULL,
1908 .flags = FLAG_ADVANCED,
1911 .label = "debug hires timestamp",
1912 .type = P_BOOL,
1913 .p_class = P_GLOBAL,
1914 .ptr = &Globals.bDebugHiresTimestamp,
1915 .special = NULL,
1916 .enum_list = NULL,
1917 .flags = FLAG_ADVANCED,
1920 .label = "debug pid",
1921 .type = P_BOOL,
1922 .p_class = P_GLOBAL,
1923 .ptr = &Globals.bDebugPid,
1924 .special = NULL,
1925 .enum_list = NULL,
1926 .flags = FLAG_ADVANCED,
1929 .label = "debug uid",
1930 .type = P_BOOL,
1931 .p_class = P_GLOBAL,
1932 .ptr = &Globals.bDebugUid,
1933 .special = NULL,
1934 .enum_list = NULL,
1935 .flags = FLAG_ADVANCED,
1938 .label = "debug class",
1939 .type = P_BOOL,
1940 .p_class = P_GLOBAL,
1941 .ptr = &Globals.bDebugClass,
1942 .special = NULL,
1943 .enum_list = NULL,
1944 .flags = FLAG_ADVANCED,
1947 .label = "enable core files",
1948 .type = P_BOOL,
1949 .p_class = P_GLOBAL,
1950 .ptr = &Globals.bEnableCoreFiles,
1951 .special = NULL,
1952 .enum_list = NULL,
1953 .flags = FLAG_ADVANCED,
1956 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1959 .label = "allocation roundup size",
1960 .type = P_INTEGER,
1961 .p_class = P_LOCAL,
1962 .ptr = &sDefault.iallocation_roundup_size,
1963 .special = NULL,
1964 .enum_list = NULL,
1965 .flags = FLAG_ADVANCED,
1968 .label = "aio read size",
1969 .type = P_INTEGER,
1970 .p_class = P_LOCAL,
1971 .ptr = &sDefault.iAioReadSize,
1972 .special = NULL,
1973 .enum_list = NULL,
1974 .flags = FLAG_ADVANCED,
1977 .label = "aio write size",
1978 .type = P_INTEGER,
1979 .p_class = P_LOCAL,
1980 .ptr = &sDefault.iAioWriteSize,
1981 .special = NULL,
1982 .enum_list = NULL,
1983 .flags = FLAG_ADVANCED,
1986 .label = "aio write behind",
1987 .type = P_STRING,
1988 .p_class = P_LOCAL,
1989 .ptr = &sDefault.szAioWriteBehind,
1990 .special = NULL,
1991 .enum_list = NULL,
1992 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1995 .label = "smb ports",
1996 .type = P_STRING,
1997 .p_class = P_GLOBAL,
1998 .ptr = &Globals.smb_ports,
1999 .special = NULL,
2000 .enum_list = NULL,
2001 .flags = FLAG_ADVANCED,
2004 .label = "large readwrite",
2005 .type = P_BOOL,
2006 .p_class = P_GLOBAL,
2007 .ptr = &Globals.bLargeReadwrite,
2008 .special = NULL,
2009 .enum_list = NULL,
2010 .flags = FLAG_ADVANCED,
2013 .label = "max protocol",
2014 .type = P_ENUM,
2015 .p_class = P_GLOBAL,
2016 .ptr = &Globals.maxprotocol,
2017 .special = NULL,
2018 .enum_list = enum_protocol,
2019 .flags = FLAG_ADVANCED,
2022 .label = "protocol",
2023 .type = P_ENUM,
2024 .p_class = P_GLOBAL,
2025 .ptr = &Globals.maxprotocol,
2026 .special = NULL,
2027 .enum_list = enum_protocol,
2028 .flags = FLAG_ADVANCED,
2031 .label = "min protocol",
2032 .type = P_ENUM,
2033 .p_class = P_GLOBAL,
2034 .ptr = &Globals.minprotocol,
2035 .special = NULL,
2036 .enum_list = enum_protocol,
2037 .flags = FLAG_ADVANCED,
2040 .label = "min receivefile size",
2041 .type = P_INTEGER,
2042 .p_class = P_GLOBAL,
2043 .ptr = &Globals.iminreceivefile,
2044 .special = NULL,
2045 .enum_list = NULL,
2046 .flags = FLAG_ADVANCED,
2049 .label = "read raw",
2050 .type = P_BOOL,
2051 .p_class = P_GLOBAL,
2052 .ptr = &Globals.bReadRaw,
2053 .special = NULL,
2054 .enum_list = NULL,
2055 .flags = FLAG_ADVANCED,
2058 .label = "write raw",
2059 .type = P_BOOL,
2060 .p_class = P_GLOBAL,
2061 .ptr = &Globals.bWriteRaw,
2062 .special = NULL,
2063 .enum_list = NULL,
2064 .flags = FLAG_ADVANCED,
2067 .label = "disable netbios",
2068 .type = P_BOOL,
2069 .p_class = P_GLOBAL,
2070 .ptr = &Globals.bDisableNetbios,
2071 .special = NULL,
2072 .enum_list = NULL,
2073 .flags = FLAG_ADVANCED,
2076 .label = "reset on zero vc",
2077 .type = P_BOOL,
2078 .p_class = P_GLOBAL,
2079 .ptr = &Globals.bResetOnZeroVC,
2080 .special = NULL,
2081 .enum_list = NULL,
2082 .flags = FLAG_ADVANCED,
2085 .label = "log writeable files on exit",
2086 .type = P_BOOL,
2087 .p_class = P_GLOBAL,
2088 .ptr = &Globals.bLogWriteableFilesOnExit,
2089 .special = NULL,
2090 .enum_list = NULL,
2091 .flags = FLAG_ADVANCED,
2094 .label = "acl compatibility",
2095 .type = P_ENUM,
2096 .p_class = P_GLOBAL,
2097 .ptr = &Globals.iAclCompat,
2098 .special = NULL,
2099 .enum_list = enum_acl_compat_vals,
2100 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2103 .label = "defer sharing violations",
2104 .type = P_BOOL,
2105 .p_class = P_GLOBAL,
2106 .ptr = &Globals.bDeferSharingViolations,
2107 .special = NULL,
2108 .enum_list = NULL,
2109 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2112 .label = "ea support",
2113 .type = P_BOOL,
2114 .p_class = P_LOCAL,
2115 .ptr = &sDefault.bEASupport,
2116 .special = NULL,
2117 .enum_list = NULL,
2118 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2121 .label = "nt acl support",
2122 .type = P_BOOL,
2123 .p_class = P_LOCAL,
2124 .ptr = &sDefault.bNTAclSupport,
2125 .special = NULL,
2126 .enum_list = NULL,
2127 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2130 .label = "nt pipe support",
2131 .type = P_BOOL,
2132 .p_class = P_GLOBAL,
2133 .ptr = &Globals.bNTPipeSupport,
2134 .special = NULL,
2135 .enum_list = NULL,
2136 .flags = FLAG_ADVANCED,
2139 .label = "nt status support",
2140 .type = P_BOOL,
2141 .p_class = P_GLOBAL,
2142 .ptr = &Globals.bNTStatusSupport,
2143 .special = NULL,
2144 .enum_list = NULL,
2145 .flags = FLAG_ADVANCED,
2148 .label = "profile acls",
2149 .type = P_BOOL,
2150 .p_class = P_LOCAL,
2151 .ptr = &sDefault.bProfileAcls,
2152 .special = NULL,
2153 .enum_list = NULL,
2154 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2157 .label = "announce version",
2158 .type = P_STRING,
2159 .p_class = P_GLOBAL,
2160 .ptr = &Globals.szAnnounceVersion,
2161 .special = NULL,
2162 .enum_list = NULL,
2163 .flags = FLAG_ADVANCED,
2166 .label = "announce as",
2167 .type = P_ENUM,
2168 .p_class = P_GLOBAL,
2169 .ptr = &Globals.announce_as,
2170 .special = NULL,
2171 .enum_list = enum_announce_as,
2172 .flags = FLAG_ADVANCED,
2175 .label = "map acl inherit",
2176 .type = P_BOOL,
2177 .p_class = P_LOCAL,
2178 .ptr = &sDefault.bMap_acl_inherit,
2179 .special = NULL,
2180 .enum_list = NULL,
2181 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2184 .label = "afs share",
2185 .type = P_BOOL,
2186 .p_class = P_LOCAL,
2187 .ptr = &sDefault.bAfs_Share,
2188 .special = NULL,
2189 .enum_list = NULL,
2190 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2193 .label = "max mux",
2194 .type = P_INTEGER,
2195 .p_class = P_GLOBAL,
2196 .ptr = &Globals.max_mux,
2197 .special = NULL,
2198 .enum_list = NULL,
2199 .flags = FLAG_ADVANCED,
2202 .label = "max xmit",
2203 .type = P_INTEGER,
2204 .p_class = P_GLOBAL,
2205 .ptr = &Globals.max_xmit,
2206 .special = NULL,
2207 .enum_list = NULL,
2208 .flags = FLAG_ADVANCED,
2211 .label = "name resolve order",
2212 .type = P_STRING,
2213 .p_class = P_GLOBAL,
2214 .ptr = &Globals.szNameResolveOrder,
2215 .special = NULL,
2216 .enum_list = NULL,
2217 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2220 .label = "max ttl",
2221 .type = P_INTEGER,
2222 .p_class = P_GLOBAL,
2223 .ptr = &Globals.max_ttl,
2224 .special = NULL,
2225 .enum_list = NULL,
2226 .flags = FLAG_ADVANCED,
2229 .label = "max wins ttl",
2230 .type = P_INTEGER,
2231 .p_class = P_GLOBAL,
2232 .ptr = &Globals.max_wins_ttl,
2233 .special = NULL,
2234 .enum_list = NULL,
2235 .flags = FLAG_ADVANCED,
2238 .label = "min wins ttl",
2239 .type = P_INTEGER,
2240 .p_class = P_GLOBAL,
2241 .ptr = &Globals.min_wins_ttl,
2242 .special = NULL,
2243 .enum_list = NULL,
2244 .flags = FLAG_ADVANCED,
2247 .label = "time server",
2248 .type = P_BOOL,
2249 .p_class = P_GLOBAL,
2250 .ptr = &Globals.bTimeServer,
2251 .special = NULL,
2252 .enum_list = NULL,
2253 .flags = FLAG_ADVANCED,
2256 .label = "unix extensions",
2257 .type = P_BOOL,
2258 .p_class = P_GLOBAL,
2259 .ptr = &Globals.bUnixExtensions,
2260 .special = NULL,
2261 .enum_list = NULL,
2262 .flags = FLAG_ADVANCED,
2265 .label = "use spnego",
2266 .type = P_BOOL,
2267 .p_class = P_GLOBAL,
2268 .ptr = &Globals.bUseSpnego,
2269 .special = NULL,
2270 .enum_list = NULL,
2271 .flags = FLAG_ADVANCED,
2274 .label = "client signing",
2275 .type = P_ENUM,
2276 .p_class = P_GLOBAL,
2277 .ptr = &Globals.client_signing,
2278 .special = NULL,
2279 .enum_list = enum_smb_signing_vals,
2280 .flags = FLAG_ADVANCED,
2283 .label = "server signing",
2284 .type = P_ENUM,
2285 .p_class = P_GLOBAL,
2286 .ptr = &Globals.server_signing,
2287 .special = NULL,
2288 .enum_list = enum_smb_signing_vals,
2289 .flags = FLAG_ADVANCED,
2292 .label = "smb encrypt",
2293 .type = P_ENUM,
2294 .p_class = P_LOCAL,
2295 .ptr = &sDefault.ismb_encrypt,
2296 .special = NULL,
2297 .enum_list = enum_smb_signing_vals,
2298 .flags = FLAG_ADVANCED,
2301 .label = "client use spnego",
2302 .type = P_BOOL,
2303 .p_class = P_GLOBAL,
2304 .ptr = &Globals.bClientUseSpnego,
2305 .special = NULL,
2306 .enum_list = NULL,
2307 .flags = FLAG_ADVANCED,
2310 .label = "client ldap sasl wrapping",
2311 .type = P_ENUM,
2312 .p_class = P_GLOBAL,
2313 .ptr = &Globals.client_ldap_sasl_wrapping,
2314 .special = NULL,
2315 .enum_list = enum_ldap_sasl_wrapping,
2316 .flags = FLAG_ADVANCED,
2319 .label = "enable asu support",
2320 .type = P_BOOL,
2321 .p_class = P_GLOBAL,
2322 .ptr = &Globals.bASUSupport,
2323 .special = NULL,
2324 .enum_list = NULL,
2325 .flags = FLAG_ADVANCED,
2328 .label = "svcctl list",
2329 .type = P_LIST,
2330 .p_class = P_GLOBAL,
2331 .ptr = &Globals.szServicesList,
2332 .special = NULL,
2333 .enum_list = NULL,
2334 .flags = FLAG_ADVANCED,
2337 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2340 .label = "block size",
2341 .type = P_INTEGER,
2342 .p_class = P_LOCAL,
2343 .ptr = &sDefault.iBlock_size,
2344 .special = NULL,
2345 .enum_list = NULL,
2346 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2349 .label = "deadtime",
2350 .type = P_INTEGER,
2351 .p_class = P_GLOBAL,
2352 .ptr = &Globals.deadtime,
2353 .special = NULL,
2354 .enum_list = NULL,
2355 .flags = FLAG_ADVANCED,
2358 .label = "getwd cache",
2359 .type = P_BOOL,
2360 .p_class = P_GLOBAL,
2361 .ptr = &Globals.getwd_cache,
2362 .special = NULL,
2363 .enum_list = NULL,
2364 .flags = FLAG_ADVANCED,
2367 .label = "keepalive",
2368 .type = P_INTEGER,
2369 .p_class = P_GLOBAL,
2370 .ptr = &Globals.iKeepalive,
2371 .special = NULL,
2372 .enum_list = NULL,
2373 .flags = FLAG_ADVANCED,
2376 .label = "change notify",
2377 .type = P_BOOL,
2378 .p_class = P_LOCAL,
2379 .ptr = &sDefault.bChangeNotify,
2380 .special = NULL,
2381 .enum_list = NULL,
2382 .flags = FLAG_ADVANCED | FLAG_SHARE,
2385 .label = "directory name cache size",
2386 .type = P_INTEGER,
2387 .p_class = P_LOCAL,
2388 .ptr = &sDefault.iDirectoryNameCacheSize,
2389 .special = NULL,
2390 .enum_list = NULL,
2391 .flags = FLAG_ADVANCED | FLAG_SHARE,
2394 .label = "kernel change notify",
2395 .type = P_BOOL,
2396 .p_class = P_LOCAL,
2397 .ptr = &sDefault.bKernelChangeNotify,
2398 .special = NULL,
2399 .enum_list = NULL,
2400 .flags = FLAG_ADVANCED | FLAG_SHARE,
2403 .label = "lpq cache time",
2404 .type = P_INTEGER,
2405 .p_class = P_GLOBAL,
2406 .ptr = &Globals.lpqcachetime,
2407 .special = NULL,
2408 .enum_list = NULL,
2409 .flags = FLAG_ADVANCED,
2412 .label = "max smbd processes",
2413 .type = P_INTEGER,
2414 .p_class = P_GLOBAL,
2415 .ptr = &Globals.iMaxSmbdProcesses,
2416 .special = NULL,
2417 .enum_list = NULL,
2418 .flags = FLAG_ADVANCED,
2421 .label = "max connections",
2422 .type = P_INTEGER,
2423 .p_class = P_LOCAL,
2424 .ptr = &sDefault.iMaxConnections,
2425 .special = NULL,
2426 .enum_list = NULL,
2427 .flags = FLAG_ADVANCED | FLAG_SHARE,
2430 .label = "paranoid server security",
2431 .type = P_BOOL,
2432 .p_class = P_GLOBAL,
2433 .ptr = &Globals.paranoid_server_security,
2434 .special = NULL,
2435 .enum_list = NULL,
2436 .flags = FLAG_ADVANCED,
2439 .label = "max disk size",
2440 .type = P_INTEGER,
2441 .p_class = P_GLOBAL,
2442 .ptr = &Globals.maxdisksize,
2443 .special = NULL,
2444 .enum_list = NULL,
2445 .flags = FLAG_ADVANCED,
2448 .label = "max open files",
2449 .type = P_INTEGER,
2450 .p_class = P_GLOBAL,
2451 .ptr = &Globals.max_open_files,
2452 .special = NULL,
2453 .enum_list = NULL,
2454 .flags = FLAG_ADVANCED,
2457 .label = "min print space",
2458 .type = P_INTEGER,
2459 .p_class = P_LOCAL,
2460 .ptr = &sDefault.iMinPrintSpace,
2461 .special = NULL,
2462 .enum_list = NULL,
2463 .flags = FLAG_ADVANCED | FLAG_PRINT,
2466 .label = "socket options",
2467 .type = P_STRING,
2468 .p_class = P_GLOBAL,
2469 .ptr = &Globals.szSocketOptions,
2470 .special = NULL,
2471 .enum_list = NULL,
2472 .flags = FLAG_ADVANCED,
2475 .label = "strict allocate",
2476 .type = P_BOOL,
2477 .p_class = P_LOCAL,
2478 .ptr = &sDefault.bStrictAllocate,
2479 .special = NULL,
2480 .enum_list = NULL,
2481 .flags = FLAG_ADVANCED | FLAG_SHARE,
2484 .label = "strict sync",
2485 .type = P_BOOL,
2486 .p_class = P_LOCAL,
2487 .ptr = &sDefault.bStrictSync,
2488 .special = NULL,
2489 .enum_list = NULL,
2490 .flags = FLAG_ADVANCED | FLAG_SHARE,
2493 .label = "sync always",
2494 .type = P_BOOL,
2495 .p_class = P_LOCAL,
2496 .ptr = &sDefault.bSyncAlways,
2497 .special = NULL,
2498 .enum_list = NULL,
2499 .flags = FLAG_ADVANCED | FLAG_SHARE,
2502 .label = "use mmap",
2503 .type = P_BOOL,
2504 .p_class = P_GLOBAL,
2505 .ptr = &Globals.bUseMmap,
2506 .special = NULL,
2507 .enum_list = NULL,
2508 .flags = FLAG_ADVANCED,
2511 .label = "use sendfile",
2512 .type = P_BOOL,
2513 .p_class = P_LOCAL,
2514 .ptr = &sDefault.bUseSendfile,
2515 .special = NULL,
2516 .enum_list = NULL,
2517 .flags = FLAG_ADVANCED | FLAG_SHARE,
2520 .label = "hostname lookups",
2521 .type = P_BOOL,
2522 .p_class = P_GLOBAL,
2523 .ptr = &Globals.bHostnameLookups,
2524 .special = NULL,
2525 .enum_list = NULL,
2526 .flags = FLAG_ADVANCED,
2529 .label = "write cache size",
2530 .type = P_INTEGER,
2531 .p_class = P_LOCAL,
2532 .ptr = &sDefault.iWriteCacheSize,
2533 .special = NULL,
2534 .enum_list = NULL,
2535 .flags = FLAG_ADVANCED | FLAG_SHARE,
2538 .label = "name cache timeout",
2539 .type = P_INTEGER,
2540 .p_class = P_GLOBAL,
2541 .ptr = &Globals.name_cache_timeout,
2542 .special = NULL,
2543 .enum_list = NULL,
2544 .flags = FLAG_ADVANCED,
2547 .label = "ctdbd socket",
2548 .type = P_STRING,
2549 .p_class = P_GLOBAL,
2550 .ptr = &Globals.ctdbdSocket,
2551 .special = NULL,
2552 .enum_list = NULL,
2553 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2556 .label = "cluster addresses",
2557 .type = P_LIST,
2558 .p_class = P_GLOBAL,
2559 .ptr = &Globals.szClusterAddresses,
2560 .special = NULL,
2561 .enum_list = NULL,
2562 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2565 .label = "clustering",
2566 .type = P_BOOL,
2567 .p_class = P_GLOBAL,
2568 .ptr = &Globals.clustering,
2569 .special = NULL,
2570 .enum_list = NULL,
2571 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2574 .label = "ctdb timeout",
2575 .type = P_INTEGER,
2576 .p_class = P_GLOBAL,
2577 .ptr = &Globals.ctdb_timeout,
2578 .special = NULL,
2579 .enum_list = NULL,
2580 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2583 .label = "ctdb locktime warn threshold",
2584 .type = P_INTEGER,
2585 .p_class = P_GLOBAL,
2586 .ptr = &Globals.ctdb_locktime_warn_threshold,
2587 .special = NULL,
2588 .enum_list = NULL,
2589 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2592 .label = "smb2 max read",
2593 .type = P_INTEGER,
2594 .p_class = P_GLOBAL,
2595 .ptr = &Globals.ismb2_max_read,
2596 .special = NULL,
2597 .enum_list = NULL,
2598 .flags = FLAG_ADVANCED,
2601 .label = "smb2 max write",
2602 .type = P_INTEGER,
2603 .p_class = P_GLOBAL,
2604 .ptr = &Globals.ismb2_max_write,
2605 .special = NULL,
2606 .enum_list = NULL,
2607 .flags = FLAG_ADVANCED,
2610 .label = "smb2 max trans",
2611 .type = P_INTEGER,
2612 .p_class = P_GLOBAL,
2613 .ptr = &Globals.ismb2_max_trans,
2614 .special = NULL,
2615 .enum_list = NULL,
2616 .flags = FLAG_ADVANCED,
2619 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2622 .label = "max reported print jobs",
2623 .type = P_INTEGER,
2624 .p_class = P_LOCAL,
2625 .ptr = &sDefault.iMaxReportedPrintJobs,
2626 .special = NULL,
2627 .enum_list = NULL,
2628 .flags = FLAG_ADVANCED | FLAG_PRINT,
2631 .label = "max print jobs",
2632 .type = P_INTEGER,
2633 .p_class = P_LOCAL,
2634 .ptr = &sDefault.iMaxPrintJobs,
2635 .special = NULL,
2636 .enum_list = NULL,
2637 .flags = FLAG_ADVANCED | FLAG_PRINT,
2640 .label = "load printers",
2641 .type = P_BOOL,
2642 .p_class = P_GLOBAL,
2643 .ptr = &Globals.bLoadPrinters,
2644 .special = NULL,
2645 .enum_list = NULL,
2646 .flags = FLAG_ADVANCED | FLAG_PRINT,
2649 .label = "printcap cache time",
2650 .type = P_INTEGER,
2651 .p_class = P_GLOBAL,
2652 .ptr = &Globals.PrintcapCacheTime,
2653 .special = NULL,
2654 .enum_list = NULL,
2655 .flags = FLAG_ADVANCED | FLAG_PRINT,
2658 .label = "printcap name",
2659 .type = P_STRING,
2660 .p_class = P_GLOBAL,
2661 .ptr = &Globals.szPrintcapname,
2662 .special = NULL,
2663 .enum_list = NULL,
2664 .flags = FLAG_ADVANCED | FLAG_PRINT,
2667 .label = "printcap",
2668 .type = P_STRING,
2669 .p_class = P_GLOBAL,
2670 .ptr = &Globals.szPrintcapname,
2671 .special = NULL,
2672 .enum_list = NULL,
2673 .flags = FLAG_HIDE,
2676 .label = "printable",
2677 .type = P_BOOL,
2678 .p_class = P_LOCAL,
2679 .ptr = &sDefault.bPrint_ok,
2680 .special = NULL,
2681 .enum_list = NULL,
2682 .flags = FLAG_ADVANCED | FLAG_PRINT,
2685 .label = "print ok",
2686 .type = P_BOOL,
2687 .p_class = P_LOCAL,
2688 .ptr = &sDefault.bPrint_ok,
2689 .special = NULL,
2690 .enum_list = NULL,
2691 .flags = FLAG_HIDE,
2694 .label = "printing",
2695 .type = P_ENUM,
2696 .p_class = P_LOCAL,
2697 .ptr = &sDefault.iPrinting,
2698 .special = handle_printing,
2699 .enum_list = enum_printing,
2700 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2703 .label = "cups options",
2704 .type = P_STRING,
2705 .p_class = P_LOCAL,
2706 .ptr = &sDefault.szCupsOptions,
2707 .special = NULL,
2708 .enum_list = NULL,
2709 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2712 .label = "cups server",
2713 .type = P_STRING,
2714 .p_class = P_GLOBAL,
2715 .ptr = &Globals.szCupsServer,
2716 .special = NULL,
2717 .enum_list = NULL,
2718 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2721 .label = "cups encrypt",
2722 .type = P_ENUM,
2723 .p_class = P_GLOBAL,
2724 .ptr = &Globals.CupsEncrypt,
2725 .special = NULL,
2726 .enum_list = enum_bool_auto,
2727 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2731 .label = "cups connection timeout",
2732 .type = P_INTEGER,
2733 .p_class = P_GLOBAL,
2734 .ptr = &Globals.cups_connection_timeout,
2735 .special = NULL,
2736 .enum_list = NULL,
2737 .flags = FLAG_ADVANCED,
2740 .label = "iprint server",
2741 .type = P_STRING,
2742 .p_class = P_GLOBAL,
2743 .ptr = &Globals.szIPrintServer,
2744 .special = NULL,
2745 .enum_list = NULL,
2746 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2749 .label = "print command",
2750 .type = P_STRING,
2751 .p_class = P_LOCAL,
2752 .ptr = &sDefault.szPrintcommand,
2753 .special = NULL,
2754 .enum_list = NULL,
2755 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2758 .label = "disable spoolss",
2759 .type = P_BOOL,
2760 .p_class = P_GLOBAL,
2761 .ptr = &Globals.bDisableSpoolss,
2762 .special = NULL,
2763 .enum_list = NULL,
2764 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2767 .label = "enable spoolss",
2768 .type = P_BOOLREV,
2769 .p_class = P_GLOBAL,
2770 .ptr = &Globals.bDisableSpoolss,
2771 .special = NULL,
2772 .enum_list = NULL,
2773 .flags = FLAG_HIDE,
2776 .label = "lpq command",
2777 .type = P_STRING,
2778 .p_class = P_LOCAL,
2779 .ptr = &sDefault.szLpqcommand,
2780 .special = NULL,
2781 .enum_list = NULL,
2782 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2785 .label = "lprm command",
2786 .type = P_STRING,
2787 .p_class = P_LOCAL,
2788 .ptr = &sDefault.szLprmcommand,
2789 .special = NULL,
2790 .enum_list = NULL,
2791 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2794 .label = "lppause command",
2795 .type = P_STRING,
2796 .p_class = P_LOCAL,
2797 .ptr = &sDefault.szLppausecommand,
2798 .special = NULL,
2799 .enum_list = NULL,
2800 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2803 .label = "lpresume command",
2804 .type = P_STRING,
2805 .p_class = P_LOCAL,
2806 .ptr = &sDefault.szLpresumecommand,
2807 .special = NULL,
2808 .enum_list = NULL,
2809 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2812 .label = "queuepause command",
2813 .type = P_STRING,
2814 .p_class = P_LOCAL,
2815 .ptr = &sDefault.szQueuepausecommand,
2816 .special = NULL,
2817 .enum_list = NULL,
2818 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2821 .label = "queueresume command",
2822 .type = P_STRING,
2823 .p_class = P_LOCAL,
2824 .ptr = &sDefault.szQueueresumecommand,
2825 .special = NULL,
2826 .enum_list = NULL,
2827 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2830 .label = "addport command",
2831 .type = P_STRING,
2832 .p_class = P_GLOBAL,
2833 .ptr = &Globals.szAddPortCommand,
2834 .special = NULL,
2835 .enum_list = NULL,
2836 .flags = FLAG_ADVANCED,
2839 .label = "enumports command",
2840 .type = P_STRING,
2841 .p_class = P_GLOBAL,
2842 .ptr = &Globals.szEnumPortsCommand,
2843 .special = NULL,
2844 .enum_list = NULL,
2845 .flags = FLAG_ADVANCED,
2848 .label = "addprinter command",
2849 .type = P_STRING,
2850 .p_class = P_GLOBAL,
2851 .ptr = &Globals.szAddPrinterCommand,
2852 .special = NULL,
2853 .enum_list = NULL,
2854 .flags = FLAG_ADVANCED,
2857 .label = "deleteprinter command",
2858 .type = P_STRING,
2859 .p_class = P_GLOBAL,
2860 .ptr = &Globals.szDeletePrinterCommand,
2861 .special = NULL,
2862 .enum_list = NULL,
2863 .flags = FLAG_ADVANCED,
2866 .label = "show add printer wizard",
2867 .type = P_BOOL,
2868 .p_class = P_GLOBAL,
2869 .ptr = &Globals.bMsAddPrinterWizard,
2870 .special = NULL,
2871 .enum_list = NULL,
2872 .flags = FLAG_ADVANCED,
2875 .label = "os2 driver map",
2876 .type = P_STRING,
2877 .p_class = P_GLOBAL,
2878 .ptr = &Globals.szOs2DriverMap,
2879 .special = NULL,
2880 .enum_list = NULL,
2881 .flags = FLAG_ADVANCED,
2885 .label = "printer name",
2886 .type = P_STRING,
2887 .p_class = P_LOCAL,
2888 .ptr = &sDefault.szPrintername,
2889 .special = NULL,
2890 .enum_list = NULL,
2891 .flags = FLAG_ADVANCED | FLAG_PRINT,
2894 .label = "printer",
2895 .type = P_STRING,
2896 .p_class = P_LOCAL,
2897 .ptr = &sDefault.szPrintername,
2898 .special = NULL,
2899 .enum_list = NULL,
2900 .flags = FLAG_HIDE,
2903 .label = "use client driver",
2904 .type = P_BOOL,
2905 .p_class = P_LOCAL,
2906 .ptr = &sDefault.bUseClientDriver,
2907 .special = NULL,
2908 .enum_list = NULL,
2909 .flags = FLAG_ADVANCED | FLAG_PRINT,
2912 .label = "default devmode",
2913 .type = P_BOOL,
2914 .p_class = P_LOCAL,
2915 .ptr = &sDefault.bDefaultDevmode,
2916 .special = NULL,
2917 .enum_list = NULL,
2918 .flags = FLAG_ADVANCED | FLAG_PRINT,
2921 .label = "force printername",
2922 .type = P_BOOL,
2923 .p_class = P_LOCAL,
2924 .ptr = &sDefault.bForcePrintername,
2925 .special = NULL,
2926 .enum_list = NULL,
2927 .flags = FLAG_ADVANCED | FLAG_PRINT,
2930 .label = "printjob username",
2931 .type = P_STRING,
2932 .p_class = P_LOCAL,
2933 .ptr = &sDefault.szPrintjobUsername,
2934 .special = NULL,
2935 .enum_list = NULL,
2936 .flags = FLAG_ADVANCED | FLAG_PRINT,
2939 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2942 .label = "mangling method",
2943 .type = P_STRING,
2944 .p_class = P_GLOBAL,
2945 .ptr = &Globals.szManglingMethod,
2946 .special = NULL,
2947 .enum_list = NULL,
2948 .flags = FLAG_ADVANCED,
2951 .label = "mangle prefix",
2952 .type = P_INTEGER,
2953 .p_class = P_GLOBAL,
2954 .ptr = &Globals.mangle_prefix,
2955 .special = NULL,
2956 .enum_list = NULL,
2957 .flags = FLAG_ADVANCED,
2961 .label = "default case",
2962 .type = P_ENUM,
2963 .p_class = P_LOCAL,
2964 .ptr = &sDefault.iDefaultCase,
2965 .special = NULL,
2966 .enum_list = enum_case,
2967 .flags = FLAG_ADVANCED | FLAG_SHARE,
2970 .label = "case sensitive",
2971 .type = P_ENUM,
2972 .p_class = P_LOCAL,
2973 .ptr = &sDefault.iCaseSensitive,
2974 .special = NULL,
2975 .enum_list = enum_bool_auto,
2976 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2979 .label = "casesignames",
2980 .type = P_ENUM,
2981 .p_class = P_LOCAL,
2982 .ptr = &sDefault.iCaseSensitive,
2983 .special = NULL,
2984 .enum_list = enum_bool_auto,
2985 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2988 .label = "preserve case",
2989 .type = P_BOOL,
2990 .p_class = P_LOCAL,
2991 .ptr = &sDefault.bCasePreserve,
2992 .special = NULL,
2993 .enum_list = NULL,
2994 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2997 .label = "short preserve case",
2998 .type = P_BOOL,
2999 .p_class = P_LOCAL,
3000 .ptr = &sDefault.bShortCasePreserve,
3001 .special = NULL,
3002 .enum_list = NULL,
3003 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3006 .label = "mangling char",
3007 .type = P_CHAR,
3008 .p_class = P_LOCAL,
3009 .ptr = &sDefault.magic_char,
3010 .special = NULL,
3011 .enum_list = NULL,
3012 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3015 .label = "hide dot files",
3016 .type = P_BOOL,
3017 .p_class = P_LOCAL,
3018 .ptr = &sDefault.bHideDotFiles,
3019 .special = NULL,
3020 .enum_list = NULL,
3021 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3024 .label = "hide special files",
3025 .type = P_BOOL,
3026 .p_class = P_LOCAL,
3027 .ptr = &sDefault.bHideSpecialFiles,
3028 .special = NULL,
3029 .enum_list = NULL,
3030 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3033 .label = "hide unreadable",
3034 .type = P_BOOL,
3035 .p_class = P_LOCAL,
3036 .ptr = &sDefault.bHideUnReadable,
3037 .special = NULL,
3038 .enum_list = NULL,
3039 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3042 .label = "hide unwriteable files",
3043 .type = P_BOOL,
3044 .p_class = P_LOCAL,
3045 .ptr = &sDefault.bHideUnWriteableFiles,
3046 .special = NULL,
3047 .enum_list = NULL,
3048 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3051 .label = "delete veto files",
3052 .type = P_BOOL,
3053 .p_class = P_LOCAL,
3054 .ptr = &sDefault.bDeleteVetoFiles,
3055 .special = NULL,
3056 .enum_list = NULL,
3057 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3060 .label = "veto files",
3061 .type = P_STRING,
3062 .p_class = P_LOCAL,
3063 .ptr = &sDefault.szVetoFiles,
3064 .special = NULL,
3065 .enum_list = NULL,
3066 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3069 .label = "hide files",
3070 .type = P_STRING,
3071 .p_class = P_LOCAL,
3072 .ptr = &sDefault.szHideFiles,
3073 .special = NULL,
3074 .enum_list = NULL,
3075 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3078 .label = "veto oplock files",
3079 .type = P_STRING,
3080 .p_class = P_LOCAL,
3081 .ptr = &sDefault.szVetoOplockFiles,
3082 .special = NULL,
3083 .enum_list = NULL,
3084 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3087 .label = "map archive",
3088 .type = P_BOOL,
3089 .p_class = P_LOCAL,
3090 .ptr = &sDefault.bMap_archive,
3091 .special = NULL,
3092 .enum_list = NULL,
3093 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3096 .label = "map hidden",
3097 .type = P_BOOL,
3098 .p_class = P_LOCAL,
3099 .ptr = &sDefault.bMap_hidden,
3100 .special = NULL,
3101 .enum_list = NULL,
3102 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3105 .label = "map system",
3106 .type = P_BOOL,
3107 .p_class = P_LOCAL,
3108 .ptr = &sDefault.bMap_system,
3109 .special = NULL,
3110 .enum_list = NULL,
3111 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3114 .label = "map readonly",
3115 .type = P_ENUM,
3116 .p_class = P_LOCAL,
3117 .ptr = &sDefault.iMap_readonly,
3118 .special = NULL,
3119 .enum_list = enum_map_readonly,
3120 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3123 .label = "mangled names",
3124 .type = P_BOOL,
3125 .p_class = P_LOCAL,
3126 .ptr = &sDefault.bMangledNames,
3127 .special = NULL,
3128 .enum_list = NULL,
3129 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3132 .label = "max stat cache size",
3133 .type = P_INTEGER,
3134 .p_class = P_GLOBAL,
3135 .ptr = &Globals.iMaxStatCacheSize,
3136 .special = NULL,
3137 .enum_list = NULL,
3138 .flags = FLAG_ADVANCED,
3141 .label = "stat cache",
3142 .type = P_BOOL,
3143 .p_class = P_GLOBAL,
3144 .ptr = &Globals.bStatCache,
3145 .special = NULL,
3146 .enum_list = NULL,
3147 .flags = FLAG_ADVANCED,
3150 .label = "store dos attributes",
3151 .type = P_BOOL,
3152 .p_class = P_LOCAL,
3153 .ptr = &sDefault.bStoreDosAttributes,
3154 .special = NULL,
3155 .enum_list = NULL,
3156 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3159 .label = "dmapi support",
3160 .type = P_BOOL,
3161 .p_class = P_LOCAL,
3162 .ptr = &sDefault.bDmapiSupport,
3163 .special = NULL,
3164 .enum_list = NULL,
3165 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3169 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3172 .label = "machine password timeout",
3173 .type = P_INTEGER,
3174 .p_class = P_GLOBAL,
3175 .ptr = &Globals.machine_password_timeout,
3176 .special = NULL,
3177 .enum_list = NULL,
3178 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3181 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3184 .label = "add user script",
3185 .type = P_STRING,
3186 .p_class = P_GLOBAL,
3187 .ptr = &Globals.szAddUserScript,
3188 .special = NULL,
3189 .enum_list = NULL,
3190 .flags = FLAG_ADVANCED,
3193 .label = "rename user script",
3194 .type = P_STRING,
3195 .p_class = P_GLOBAL,
3196 .ptr = &Globals.szRenameUserScript,
3197 .special = NULL,
3198 .enum_list = NULL,
3199 .flags = FLAG_ADVANCED,
3202 .label = "delete user script",
3203 .type = P_STRING,
3204 .p_class = P_GLOBAL,
3205 .ptr = &Globals.szDelUserScript,
3206 .special = NULL,
3207 .enum_list = NULL,
3208 .flags = FLAG_ADVANCED,
3211 .label = "add group script",
3212 .type = P_STRING,
3213 .p_class = P_GLOBAL,
3214 .ptr = &Globals.szAddGroupScript,
3215 .special = NULL,
3216 .enum_list = NULL,
3217 .flags = FLAG_ADVANCED,
3220 .label = "delete group script",
3221 .type = P_STRING,
3222 .p_class = P_GLOBAL,
3223 .ptr = &Globals.szDelGroupScript,
3224 .special = NULL,
3225 .enum_list = NULL,
3226 .flags = FLAG_ADVANCED,
3229 .label = "add user to group script",
3230 .type = P_STRING,
3231 .p_class = P_GLOBAL,
3232 .ptr = &Globals.szAddUserToGroupScript,
3233 .special = NULL,
3234 .enum_list = NULL,
3235 .flags = FLAG_ADVANCED,
3238 .label = "delete user from group script",
3239 .type = P_STRING,
3240 .p_class = P_GLOBAL,
3241 .ptr = &Globals.szDelUserFromGroupScript,
3242 .special = NULL,
3243 .enum_list = NULL,
3244 .flags = FLAG_ADVANCED,
3247 .label = "set primary group script",
3248 .type = P_STRING,
3249 .p_class = P_GLOBAL,
3250 .ptr = &Globals.szSetPrimaryGroupScript,
3251 .special = NULL,
3252 .enum_list = NULL,
3253 .flags = FLAG_ADVANCED,
3256 .label = "add machine script",
3257 .type = P_STRING,
3258 .p_class = P_GLOBAL,
3259 .ptr = &Globals.szAddMachineScript,
3260 .special = NULL,
3261 .enum_list = NULL,
3262 .flags = FLAG_ADVANCED,
3265 .label = "shutdown script",
3266 .type = P_STRING,
3267 .p_class = P_GLOBAL,
3268 .ptr = &Globals.szShutdownScript,
3269 .special = NULL,
3270 .enum_list = NULL,
3271 .flags = FLAG_ADVANCED,
3274 .label = "abort shutdown script",
3275 .type = P_STRING,
3276 .p_class = P_GLOBAL,
3277 .ptr = &Globals.szAbortShutdownScript,
3278 .special = NULL,
3279 .enum_list = NULL,
3280 .flags = FLAG_ADVANCED,
3283 .label = "username map script",
3284 .type = P_STRING,
3285 .p_class = P_GLOBAL,
3286 .ptr = &Globals.szUsernameMapScript,
3287 .special = NULL,
3288 .enum_list = NULL,
3289 .flags = FLAG_ADVANCED,
3292 .label = "username map cache time",
3293 .type = P_INTEGER,
3294 .p_class = P_GLOBAL,
3295 .ptr = &Globals.iUsernameMapCacheTime,
3296 .special = NULL,
3297 .enum_list = NULL,
3298 .flags = FLAG_ADVANCED,
3301 .label = "logon script",
3302 .type = P_STRING,
3303 .p_class = P_GLOBAL,
3304 .ptr = &Globals.szLogonScript,
3305 .special = NULL,
3306 .enum_list = NULL,
3307 .flags = FLAG_ADVANCED,
3310 .label = "logon path",
3311 .type = P_STRING,
3312 .p_class = P_GLOBAL,
3313 .ptr = &Globals.szLogonPath,
3314 .special = NULL,
3315 .enum_list = NULL,
3316 .flags = FLAG_ADVANCED,
3319 .label = "logon drive",
3320 .type = P_STRING,
3321 .p_class = P_GLOBAL,
3322 .ptr = &Globals.szLogonDrive,
3323 .special = NULL,
3324 .enum_list = NULL,
3325 .flags = FLAG_ADVANCED,
3328 .label = "logon home",
3329 .type = P_STRING,
3330 .p_class = P_GLOBAL,
3331 .ptr = &Globals.szLogonHome,
3332 .special = NULL,
3333 .enum_list = NULL,
3334 .flags = FLAG_ADVANCED,
3337 .label = "domain logons",
3338 .type = P_BOOL,
3339 .p_class = P_GLOBAL,
3340 .ptr = &Globals.bDomainLogons,
3341 .special = NULL,
3342 .enum_list = NULL,
3343 .flags = FLAG_ADVANCED,
3347 .label = "init logon delayed hosts",
3348 .type = P_LIST,
3349 .p_class = P_GLOBAL,
3350 .ptr = &Globals.szInitLogonDelayedHosts,
3351 .special = NULL,
3352 .enum_list = NULL,
3353 .flags = FLAG_ADVANCED,
3357 .label = "init logon delay",
3358 .type = P_INTEGER,
3359 .p_class = P_GLOBAL,
3360 .ptr = &Globals.InitLogonDelay,
3361 .special = NULL,
3362 .enum_list = NULL,
3363 .flags = FLAG_ADVANCED,
3367 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3370 .label = "os level",
3371 .type = P_INTEGER,
3372 .p_class = P_GLOBAL,
3373 .ptr = &Globals.os_level,
3374 .special = NULL,
3375 .enum_list = NULL,
3376 .flags = FLAG_BASIC | FLAG_ADVANCED,
3379 .label = "lm announce",
3380 .type = P_ENUM,
3381 .p_class = P_GLOBAL,
3382 .ptr = &Globals.lm_announce,
3383 .special = NULL,
3384 .enum_list = enum_bool_auto,
3385 .flags = FLAG_ADVANCED,
3388 .label = "lm interval",
3389 .type = P_INTEGER,
3390 .p_class = P_GLOBAL,
3391 .ptr = &Globals.lm_interval,
3392 .special = NULL,
3393 .enum_list = NULL,
3394 .flags = FLAG_ADVANCED,
3397 .label = "preferred master",
3398 .type = P_ENUM,
3399 .p_class = P_GLOBAL,
3400 .ptr = &Globals.iPreferredMaster,
3401 .special = NULL,
3402 .enum_list = enum_bool_auto,
3403 .flags = FLAG_BASIC | FLAG_ADVANCED,
3406 .label = "prefered master",
3407 .type = P_ENUM,
3408 .p_class = P_GLOBAL,
3409 .ptr = &Globals.iPreferredMaster,
3410 .special = NULL,
3411 .enum_list = enum_bool_auto,
3412 .flags = FLAG_HIDE,
3415 .label = "local master",
3416 .type = P_BOOL,
3417 .p_class = P_GLOBAL,
3418 .ptr = &Globals.bLocalMaster,
3419 .special = NULL,
3420 .enum_list = NULL,
3421 .flags = FLAG_BASIC | FLAG_ADVANCED,
3424 .label = "domain master",
3425 .type = P_ENUM,
3426 .p_class = P_GLOBAL,
3427 .ptr = &Globals.iDomainMaster,
3428 .special = NULL,
3429 .enum_list = enum_bool_auto,
3430 .flags = FLAG_BASIC | FLAG_ADVANCED,
3433 .label = "browse list",
3434 .type = P_BOOL,
3435 .p_class = P_GLOBAL,
3436 .ptr = &Globals.bBrowseList,
3437 .special = NULL,
3438 .enum_list = NULL,
3439 .flags = FLAG_ADVANCED,
3442 .label = "browseable",
3443 .type = P_BOOL,
3444 .p_class = P_LOCAL,
3445 .ptr = &sDefault.bBrowseable,
3446 .special = NULL,
3447 .enum_list = NULL,
3448 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3451 .label = "browsable",
3452 .type = P_BOOL,
3453 .p_class = P_LOCAL,
3454 .ptr = &sDefault.bBrowseable,
3455 .special = NULL,
3456 .enum_list = NULL,
3457 .flags = FLAG_HIDE,
3460 .label = "access based share enum",
3461 .type = P_BOOL,
3462 .p_class = P_LOCAL,
3463 .ptr = &sDefault.bAccessBasedShareEnum,
3464 .special = NULL,
3465 .enum_list = NULL,
3466 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3469 .label = "enhanced browsing",
3470 .type = P_BOOL,
3471 .p_class = P_GLOBAL,
3472 .ptr = &Globals.enhanced_browsing,
3473 .special = NULL,
3474 .enum_list = NULL,
3475 .flags = FLAG_ADVANCED,
3478 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3481 .label = "dns proxy",
3482 .type = P_BOOL,
3483 .p_class = P_GLOBAL,
3484 .ptr = &Globals.bDNSproxy,
3485 .special = NULL,
3486 .enum_list = NULL,
3487 .flags = FLAG_ADVANCED,
3490 .label = "wins proxy",
3491 .type = P_BOOL,
3492 .p_class = P_GLOBAL,
3493 .ptr = &Globals.bWINSproxy,
3494 .special = NULL,
3495 .enum_list = NULL,
3496 .flags = FLAG_ADVANCED,
3499 .label = "wins server",
3500 .type = P_LIST,
3501 .p_class = P_GLOBAL,
3502 .ptr = &Globals.szWINSservers,
3503 .special = NULL,
3504 .enum_list = NULL,
3505 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3508 .label = "wins support",
3509 .type = P_BOOL,
3510 .p_class = P_GLOBAL,
3511 .ptr = &Globals.bWINSsupport,
3512 .special = NULL,
3513 .enum_list = NULL,
3514 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3517 .label = "wins hook",
3518 .type = P_STRING,
3519 .p_class = P_GLOBAL,
3520 .ptr = &Globals.szWINSHook,
3521 .special = NULL,
3522 .enum_list = NULL,
3523 .flags = FLAG_ADVANCED,
3526 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3529 .label = "blocking locks",
3530 .type = P_BOOL,
3531 .p_class = P_LOCAL,
3532 .ptr = &sDefault.bBlockingLocks,
3533 .special = NULL,
3534 .enum_list = NULL,
3535 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3538 .label = "csc policy",
3539 .type = P_ENUM,
3540 .p_class = P_LOCAL,
3541 .ptr = &sDefault.iCSCPolicy,
3542 .special = NULL,
3543 .enum_list = enum_csc_policy,
3544 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3547 .label = "fake oplocks",
3548 .type = P_BOOL,
3549 .p_class = P_LOCAL,
3550 .ptr = &sDefault.bFakeOplocks,
3551 .special = NULL,
3552 .enum_list = NULL,
3553 .flags = FLAG_ADVANCED | FLAG_SHARE,
3556 .label = "kernel oplocks",
3557 .type = P_BOOL,
3558 .p_class = P_GLOBAL,
3559 .ptr = &Globals.bKernelOplocks,
3560 .special = NULL,
3561 .enum_list = NULL,
3562 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3565 .label = "locking",
3566 .type = P_BOOL,
3567 .p_class = P_LOCAL,
3568 .ptr = &sDefault.bLocking,
3569 .special = NULL,
3570 .enum_list = NULL,
3571 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3574 .label = "lock spin time",
3575 .type = P_INTEGER,
3576 .p_class = P_GLOBAL,
3577 .ptr = &Globals.iLockSpinTime,
3578 .special = NULL,
3579 .enum_list = NULL,
3580 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3583 .label = "oplocks",
3584 .type = P_BOOL,
3585 .p_class = P_LOCAL,
3586 .ptr = &sDefault.bOpLocks,
3587 .special = NULL,
3588 .enum_list = NULL,
3589 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3592 .label = "level2 oplocks",
3593 .type = P_BOOL,
3594 .p_class = P_LOCAL,
3595 .ptr = &sDefault.bLevel2OpLocks,
3596 .special = NULL,
3597 .enum_list = NULL,
3598 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3601 .label = "oplock break wait time",
3602 .type = P_INTEGER,
3603 .p_class = P_GLOBAL,
3604 .ptr = &Globals.oplock_break_wait_time,
3605 .special = NULL,
3606 .enum_list = NULL,
3607 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3610 .label = "oplock contention limit",
3611 .type = P_INTEGER,
3612 .p_class = P_LOCAL,
3613 .ptr = &sDefault.iOplockContentionLimit,
3614 .special = NULL,
3615 .enum_list = NULL,
3616 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3619 .label = "posix locking",
3620 .type = P_BOOL,
3621 .p_class = P_LOCAL,
3622 .ptr = &sDefault.bPosixLocking,
3623 .special = NULL,
3624 .enum_list = NULL,
3625 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3628 .label = "strict locking",
3629 .type = P_ENUM,
3630 .p_class = P_LOCAL,
3631 .ptr = &sDefault.iStrictLocking,
3632 .special = NULL,
3633 .enum_list = enum_bool_auto,
3634 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3637 .label = "share modes",
3638 .type = P_BOOL,
3639 .p_class = P_LOCAL,
3640 .ptr = &sDefault.bShareModes,
3641 .special = NULL,
3642 .enum_list = NULL,
3643 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3646 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3649 .label = "ldap admin dn",
3650 .type = P_STRING,
3651 .p_class = P_GLOBAL,
3652 .ptr = &Globals.szLdapAdminDn,
3653 .special = NULL,
3654 .enum_list = NULL,
3655 .flags = FLAG_ADVANCED,
3658 .label = "ldap delete dn",
3659 .type = P_BOOL,
3660 .p_class = P_GLOBAL,
3661 .ptr = &Globals.ldap_delete_dn,
3662 .special = NULL,
3663 .enum_list = NULL,
3664 .flags = FLAG_ADVANCED,
3667 .label = "ldap group suffix",
3668 .type = P_STRING,
3669 .p_class = P_GLOBAL,
3670 .ptr = &Globals.szLdapGroupSuffix,
3671 .special = NULL,
3672 .enum_list = NULL,
3673 .flags = FLAG_ADVANCED,
3676 .label = "ldap idmap suffix",
3677 .type = P_STRING,
3678 .p_class = P_GLOBAL,
3679 .ptr = &Globals.szLdapIdmapSuffix,
3680 .special = NULL,
3681 .enum_list = NULL,
3682 .flags = FLAG_ADVANCED,
3685 .label = "ldap machine suffix",
3686 .type = P_STRING,
3687 .p_class = P_GLOBAL,
3688 .ptr = &Globals.szLdapMachineSuffix,
3689 .special = NULL,
3690 .enum_list = NULL,
3691 .flags = FLAG_ADVANCED,
3694 .label = "ldap passwd sync",
3695 .type = P_ENUM,
3696 .p_class = P_GLOBAL,
3697 .ptr = &Globals.ldap_passwd_sync,
3698 .special = NULL,
3699 .enum_list = enum_ldap_passwd_sync,
3700 .flags = FLAG_ADVANCED,
3703 .label = "ldap password sync",
3704 .type = P_ENUM,
3705 .p_class = P_GLOBAL,
3706 .ptr = &Globals.ldap_passwd_sync,
3707 .special = NULL,
3708 .enum_list = enum_ldap_passwd_sync,
3709 .flags = FLAG_HIDE,
3712 .label = "ldap replication sleep",
3713 .type = P_INTEGER,
3714 .p_class = P_GLOBAL,
3715 .ptr = &Globals.ldap_replication_sleep,
3716 .special = NULL,
3717 .enum_list = NULL,
3718 .flags = FLAG_ADVANCED,
3721 .label = "ldap suffix",
3722 .type = P_STRING,
3723 .p_class = P_GLOBAL,
3724 .ptr = &Globals.szLdapSuffix,
3725 .special = NULL,
3726 .enum_list = NULL,
3727 .flags = FLAG_ADVANCED,
3730 .label = "ldap ssl",
3731 .type = P_ENUM,
3732 .p_class = P_GLOBAL,
3733 .ptr = &Globals.ldap_ssl,
3734 .special = NULL,
3735 .enum_list = enum_ldap_ssl,
3736 .flags = FLAG_ADVANCED,
3739 .label = "ldap ssl ads",
3740 .type = P_BOOL,
3741 .p_class = P_GLOBAL,
3742 .ptr = &Globals.ldap_ssl_ads,
3743 .special = NULL,
3744 .enum_list = NULL,
3745 .flags = FLAG_ADVANCED,
3748 .label = "ldap deref",
3749 .type = P_ENUM,
3750 .p_class = P_GLOBAL,
3751 .ptr = &Globals.ldap_deref,
3752 .special = NULL,
3753 .enum_list = enum_ldap_deref,
3754 .flags = FLAG_ADVANCED,
3757 .label = "ldap follow referral",
3758 .type = P_ENUM,
3759 .p_class = P_GLOBAL,
3760 .ptr = &Globals.ldap_follow_referral,
3761 .special = NULL,
3762 .enum_list = enum_bool_auto,
3763 .flags = FLAG_ADVANCED,
3766 .label = "ldap timeout",
3767 .type = P_INTEGER,
3768 .p_class = P_GLOBAL,
3769 .ptr = &Globals.ldap_timeout,
3770 .special = NULL,
3771 .enum_list = NULL,
3772 .flags = FLAG_ADVANCED,
3775 .label = "ldap connection timeout",
3776 .type = P_INTEGER,
3777 .p_class = P_GLOBAL,
3778 .ptr = &Globals.ldap_connection_timeout,
3779 .special = NULL,
3780 .enum_list = NULL,
3781 .flags = FLAG_ADVANCED,
3784 .label = "ldap page size",
3785 .type = P_INTEGER,
3786 .p_class = P_GLOBAL,
3787 .ptr = &Globals.ldap_page_size,
3788 .special = NULL,
3789 .enum_list = NULL,
3790 .flags = FLAG_ADVANCED,
3793 .label = "ldap user suffix",
3794 .type = P_STRING,
3795 .p_class = P_GLOBAL,
3796 .ptr = &Globals.szLdapUserSuffix,
3797 .special = NULL,
3798 .enum_list = NULL,
3799 .flags = FLAG_ADVANCED,
3802 .label = "ldap debug level",
3803 .type = P_INTEGER,
3804 .p_class = P_GLOBAL,
3805 .ptr = &Globals.ldap_debug_level,
3806 .special = handle_ldap_debug_level,
3807 .enum_list = NULL,
3808 .flags = FLAG_ADVANCED,
3811 .label = "ldap debug threshold",
3812 .type = P_INTEGER,
3813 .p_class = P_GLOBAL,
3814 .ptr = &Globals.ldap_debug_threshold,
3815 .special = NULL,
3816 .enum_list = NULL,
3817 .flags = FLAG_ADVANCED,
3820 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3823 .label = "eventlog list",
3824 .type = P_LIST,
3825 .p_class = P_GLOBAL,
3826 .ptr = &Globals.szEventLogs,
3827 .special = NULL,
3828 .enum_list = NULL,
3829 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3832 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3835 .label = "add share command",
3836 .type = P_STRING,
3837 .p_class = P_GLOBAL,
3838 .ptr = &Globals.szAddShareCommand,
3839 .special = NULL,
3840 .enum_list = NULL,
3841 .flags = FLAG_ADVANCED,
3844 .label = "change share command",
3845 .type = P_STRING,
3846 .p_class = P_GLOBAL,
3847 .ptr = &Globals.szChangeShareCommand,
3848 .special = NULL,
3849 .enum_list = NULL,
3850 .flags = FLAG_ADVANCED,
3853 .label = "delete share command",
3854 .type = P_STRING,
3855 .p_class = P_GLOBAL,
3856 .ptr = &Globals.szDeleteShareCommand,
3857 .special = NULL,
3858 .enum_list = NULL,
3859 .flags = FLAG_ADVANCED,
3862 .label = "config file",
3863 .type = P_STRING,
3864 .p_class = P_GLOBAL,
3865 .ptr = &Globals.szConfigFile,
3866 .special = NULL,
3867 .enum_list = NULL,
3868 .flags = FLAG_HIDE|FLAG_META,
3871 .label = "preload",
3872 .type = P_STRING,
3873 .p_class = P_GLOBAL,
3874 .ptr = &Globals.szAutoServices,
3875 .special = NULL,
3876 .enum_list = NULL,
3877 .flags = FLAG_ADVANCED,
3880 .label = "auto services",
3881 .type = P_STRING,
3882 .p_class = P_GLOBAL,
3883 .ptr = &Globals.szAutoServices,
3884 .special = NULL,
3885 .enum_list = NULL,
3886 .flags = FLAG_ADVANCED,
3889 .label = "lock directory",
3890 .type = P_STRING,
3891 .p_class = P_GLOBAL,
3892 .ptr = &Globals.szLockDir,
3893 .special = NULL,
3894 .enum_list = NULL,
3895 .flags = FLAG_ADVANCED,
3898 .label = "lock dir",
3899 .type = P_STRING,
3900 .p_class = P_GLOBAL,
3901 .ptr = &Globals.szLockDir,
3902 .special = NULL,
3903 .enum_list = NULL,
3904 .flags = FLAG_HIDE,
3907 .label = "state directory",
3908 .type = P_STRING,
3909 .p_class = P_GLOBAL,
3910 .ptr = &Globals.szStateDir,
3911 .special = NULL,
3912 .enum_list = NULL,
3913 .flags = FLAG_ADVANCED,
3916 .label = "cache directory",
3917 .type = P_STRING,
3918 .p_class = P_GLOBAL,
3919 .ptr = &Globals.szCacheDir,
3920 .special = NULL,
3921 .enum_list = NULL,
3922 .flags = FLAG_ADVANCED,
3925 .label = "pid directory",
3926 .type = P_STRING,
3927 .p_class = P_GLOBAL,
3928 .ptr = &Globals.szPidDir,
3929 .special = NULL,
3930 .enum_list = NULL,
3931 .flags = FLAG_ADVANCED,
3933 #ifdef WITH_UTMP
3935 .label = "utmp directory",
3936 .type = P_STRING,
3937 .p_class = P_GLOBAL,
3938 .ptr = &Globals.szUtmpDir,
3939 .special = NULL,
3940 .enum_list = NULL,
3941 .flags = FLAG_ADVANCED,
3944 .label = "wtmp directory",
3945 .type = P_STRING,
3946 .p_class = P_GLOBAL,
3947 .ptr = &Globals.szWtmpDir,
3948 .special = NULL,
3949 .enum_list = NULL,
3950 .flags = FLAG_ADVANCED,
3953 .label = "utmp",
3954 .type = P_BOOL,
3955 .p_class = P_GLOBAL,
3956 .ptr = &Globals.bUtmp,
3957 .special = NULL,
3958 .enum_list = NULL,
3959 .flags = FLAG_ADVANCED,
3961 #endif
3963 .label = "default service",
3964 .type = P_STRING,
3965 .p_class = P_GLOBAL,
3966 .ptr = &Globals.szDefaultService,
3967 .special = NULL,
3968 .enum_list = NULL,
3969 .flags = FLAG_ADVANCED,
3972 .label = "default",
3973 .type = P_STRING,
3974 .p_class = P_GLOBAL,
3975 .ptr = &Globals.szDefaultService,
3976 .special = NULL,
3977 .enum_list = NULL,
3978 .flags = FLAG_ADVANCED,
3981 .label = "message command",
3982 .type = P_STRING,
3983 .p_class = P_GLOBAL,
3984 .ptr = &Globals.szMsgCommand,
3985 .special = NULL,
3986 .enum_list = NULL,
3987 .flags = FLAG_ADVANCED,
3990 .label = "dfree cache time",
3991 .type = P_INTEGER,
3992 .p_class = P_LOCAL,
3993 .ptr = &sDefault.iDfreeCacheTime,
3994 .special = NULL,
3995 .enum_list = NULL,
3996 .flags = FLAG_ADVANCED,
3999 .label = "dfree command",
4000 .type = P_STRING,
4001 .p_class = P_LOCAL,
4002 .ptr = &sDefault.szDfree,
4003 .special = NULL,
4004 .enum_list = NULL,
4005 .flags = FLAG_ADVANCED,
4008 .label = "get quota command",
4009 .type = P_STRING,
4010 .p_class = P_GLOBAL,
4011 .ptr = &Globals.szGetQuota,
4012 .special = NULL,
4013 .enum_list = NULL,
4014 .flags = FLAG_ADVANCED,
4017 .label = "set quota command",
4018 .type = P_STRING,
4019 .p_class = P_GLOBAL,
4020 .ptr = &Globals.szSetQuota,
4021 .special = NULL,
4022 .enum_list = NULL,
4023 .flags = FLAG_ADVANCED,
4026 .label = "remote announce",
4027 .type = P_STRING,
4028 .p_class = P_GLOBAL,
4029 .ptr = &Globals.szRemoteAnnounce,
4030 .special = NULL,
4031 .enum_list = NULL,
4032 .flags = FLAG_ADVANCED,
4035 .label = "remote browse sync",
4036 .type = P_STRING,
4037 .p_class = P_GLOBAL,
4038 .ptr = &Globals.szRemoteBrowseSync,
4039 .special = NULL,
4040 .enum_list = NULL,
4041 .flags = FLAG_ADVANCED,
4044 .label = "socket address",
4045 .type = P_STRING,
4046 .p_class = P_GLOBAL,
4047 .ptr = &Globals.szSocketAddress,
4048 .special = NULL,
4049 .enum_list = NULL,
4050 .flags = FLAG_ADVANCED,
4053 .label = "nmbd bind explicit broadcast",
4054 .type = P_BOOL,
4055 .p_class = P_GLOBAL,
4056 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4057 .special = NULL,
4058 .enum_list = NULL,
4059 .flags = FLAG_ADVANCED,
4062 .label = "homedir map",
4063 .type = P_STRING,
4064 .p_class = P_GLOBAL,
4065 .ptr = &Globals.szNISHomeMapName,
4066 .special = NULL,
4067 .enum_list = NULL,
4068 .flags = FLAG_ADVANCED,
4071 .label = "afs username map",
4072 .type = P_STRING,
4073 .p_class = P_GLOBAL,
4074 .ptr = &Globals.szAfsUsernameMap,
4075 .special = NULL,
4076 .enum_list = NULL,
4077 .flags = FLAG_ADVANCED,
4080 .label = "afs token lifetime",
4081 .type = P_INTEGER,
4082 .p_class = P_GLOBAL,
4083 .ptr = &Globals.iAfsTokenLifetime,
4084 .special = NULL,
4085 .enum_list = NULL,
4086 .flags = FLAG_ADVANCED,
4089 .label = "log nt token command",
4090 .type = P_STRING,
4091 .p_class = P_GLOBAL,
4092 .ptr = &Globals.szLogNtTokenCommand,
4093 .special = NULL,
4094 .enum_list = NULL,
4095 .flags = FLAG_ADVANCED,
4098 .label = "time offset",
4099 .type = P_INTEGER,
4100 .p_class = P_GLOBAL,
4101 .ptr = &extra_time_offset,
4102 .special = NULL,
4103 .enum_list = NULL,
4104 .flags = FLAG_ADVANCED,
4107 .label = "NIS homedir",
4108 .type = P_BOOL,
4109 .p_class = P_GLOBAL,
4110 .ptr = &Globals.bNISHomeMap,
4111 .special = NULL,
4112 .enum_list = NULL,
4113 .flags = FLAG_ADVANCED,
4116 .label = "-valid",
4117 .type = P_BOOL,
4118 .p_class = P_LOCAL,
4119 .ptr = &sDefault.valid,
4120 .special = NULL,
4121 .enum_list = NULL,
4122 .flags = FLAG_HIDE,
4125 .label = "copy",
4126 .type = P_STRING,
4127 .p_class = P_LOCAL,
4128 .ptr = &sDefault.szCopy,
4129 .special = handle_copy,
4130 .enum_list = NULL,
4131 .flags = FLAG_HIDE,
4134 .label = "include",
4135 .type = P_STRING,
4136 .p_class = P_LOCAL,
4137 .ptr = &sDefault.szInclude,
4138 .special = handle_include,
4139 .enum_list = NULL,
4140 .flags = FLAG_HIDE|FLAG_META,
4143 .label = "preexec",
4144 .type = P_STRING,
4145 .p_class = P_LOCAL,
4146 .ptr = &sDefault.szPreExec,
4147 .special = NULL,
4148 .enum_list = NULL,
4149 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4152 .label = "exec",
4153 .type = P_STRING,
4154 .p_class = P_LOCAL,
4155 .ptr = &sDefault.szPreExec,
4156 .special = NULL,
4157 .enum_list = NULL,
4158 .flags = FLAG_ADVANCED,
4161 .label = "preexec close",
4162 .type = P_BOOL,
4163 .p_class = P_LOCAL,
4164 .ptr = &sDefault.bPreexecClose,
4165 .special = NULL,
4166 .enum_list = NULL,
4167 .flags = FLAG_ADVANCED | FLAG_SHARE,
4170 .label = "postexec",
4171 .type = P_STRING,
4172 .p_class = P_LOCAL,
4173 .ptr = &sDefault.szPostExec,
4174 .special = NULL,
4175 .enum_list = NULL,
4176 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4179 .label = "root preexec",
4180 .type = P_STRING,
4181 .p_class = P_LOCAL,
4182 .ptr = &sDefault.szRootPreExec,
4183 .special = NULL,
4184 .enum_list = NULL,
4185 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4188 .label = "root preexec close",
4189 .type = P_BOOL,
4190 .p_class = P_LOCAL,
4191 .ptr = &sDefault.bRootpreexecClose,
4192 .special = NULL,
4193 .enum_list = NULL,
4194 .flags = FLAG_ADVANCED | FLAG_SHARE,
4197 .label = "root postexec",
4198 .type = P_STRING,
4199 .p_class = P_LOCAL,
4200 .ptr = &sDefault.szRootPostExec,
4201 .special = NULL,
4202 .enum_list = NULL,
4203 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4206 .label = "available",
4207 .type = P_BOOL,
4208 .p_class = P_LOCAL,
4209 .ptr = &sDefault.bAvailable,
4210 .special = NULL,
4211 .enum_list = NULL,
4212 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4215 .label = "registry shares",
4216 .type = P_BOOL,
4217 .p_class = P_GLOBAL,
4218 .ptr = &Globals.bRegistryShares,
4219 .special = NULL,
4220 .enum_list = NULL,
4221 .flags = FLAG_ADVANCED,
4224 .label = "usershare allow guests",
4225 .type = P_BOOL,
4226 .p_class = P_GLOBAL,
4227 .ptr = &Globals.bUsershareAllowGuests,
4228 .special = NULL,
4229 .enum_list = NULL,
4230 .flags = FLAG_ADVANCED,
4233 .label = "usershare max shares",
4234 .type = P_INTEGER,
4235 .p_class = P_GLOBAL,
4236 .ptr = &Globals.iUsershareMaxShares,
4237 .special = NULL,
4238 .enum_list = NULL,
4239 .flags = FLAG_ADVANCED,
4242 .label = "usershare owner only",
4243 .type = P_BOOL,
4244 .p_class = P_GLOBAL,
4245 .ptr = &Globals.bUsershareOwnerOnly,
4246 .special = NULL,
4247 .enum_list = NULL,
4248 .flags = FLAG_ADVANCED,
4251 .label = "usershare path",
4252 .type = P_STRING,
4253 .p_class = P_GLOBAL,
4254 .ptr = &Globals.szUsersharePath,
4255 .special = NULL,
4256 .enum_list = NULL,
4257 .flags = FLAG_ADVANCED,
4260 .label = "usershare prefix allow list",
4261 .type = P_LIST,
4262 .p_class = P_GLOBAL,
4263 .ptr = &Globals.szUsersharePrefixAllowList,
4264 .special = NULL,
4265 .enum_list = NULL,
4266 .flags = FLAG_ADVANCED,
4269 .label = "usershare prefix deny list",
4270 .type = P_LIST,
4271 .p_class = P_GLOBAL,
4272 .ptr = &Globals.szUsersharePrefixDenyList,
4273 .special = NULL,
4274 .enum_list = NULL,
4275 .flags = FLAG_ADVANCED,
4278 .label = "usershare template share",
4279 .type = P_STRING,
4280 .p_class = P_GLOBAL,
4281 .ptr = &Globals.szUsershareTemplateShare,
4282 .special = NULL,
4283 .enum_list = NULL,
4284 .flags = FLAG_ADVANCED,
4287 .label = "volume",
4288 .type = P_STRING,
4289 .p_class = P_LOCAL,
4290 .ptr = &sDefault.volume,
4291 .special = NULL,
4292 .enum_list = NULL,
4293 .flags = FLAG_ADVANCED | FLAG_SHARE,
4296 .label = "fstype",
4297 .type = P_STRING,
4298 .p_class = P_LOCAL,
4299 .ptr = &sDefault.fstype,
4300 .special = NULL,
4301 .enum_list = NULL,
4302 .flags = FLAG_ADVANCED | FLAG_SHARE,
4305 .label = "set directory",
4306 .type = P_BOOLREV,
4307 .p_class = P_LOCAL,
4308 .ptr = &sDefault.bNo_set_dir,
4309 .special = NULL,
4310 .enum_list = NULL,
4311 .flags = FLAG_ADVANCED | FLAG_SHARE,
4314 .label = "wide links",
4315 .type = P_BOOL,
4316 .p_class = P_LOCAL,
4317 .ptr = &sDefault.bWidelinks,
4318 .special = NULL,
4319 .enum_list = NULL,
4320 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4323 .label = "follow symlinks",
4324 .type = P_BOOL,
4325 .p_class = P_LOCAL,
4326 .ptr = &sDefault.bSymlinks,
4327 .special = NULL,
4328 .enum_list = NULL,
4329 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4332 .label = "dont descend",
4333 .type = P_STRING,
4334 .p_class = P_LOCAL,
4335 .ptr = &sDefault.szDontdescend,
4336 .special = NULL,
4337 .enum_list = NULL,
4338 .flags = FLAG_ADVANCED | FLAG_SHARE,
4341 .label = "magic script",
4342 .type = P_STRING,
4343 .p_class = P_LOCAL,
4344 .ptr = &sDefault.szMagicScript,
4345 .special = NULL,
4346 .enum_list = NULL,
4347 .flags = FLAG_ADVANCED | FLAG_SHARE,
4350 .label = "magic output",
4351 .type = P_STRING,
4352 .p_class = P_LOCAL,
4353 .ptr = &sDefault.szMagicOutput,
4354 .special = NULL,
4355 .enum_list = NULL,
4356 .flags = FLAG_ADVANCED | FLAG_SHARE,
4359 .label = "delete readonly",
4360 .type = P_BOOL,
4361 .p_class = P_LOCAL,
4362 .ptr = &sDefault.bDeleteReadonly,
4363 .special = NULL,
4364 .enum_list = NULL,
4365 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4368 .label = "dos filemode",
4369 .type = P_BOOL,
4370 .p_class = P_LOCAL,
4371 .ptr = &sDefault.bDosFilemode,
4372 .special = NULL,
4373 .enum_list = NULL,
4374 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4377 .label = "dos filetimes",
4378 .type = P_BOOL,
4379 .p_class = P_LOCAL,
4380 .ptr = &sDefault.bDosFiletimes,
4381 .special = NULL,
4382 .enum_list = NULL,
4383 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4386 .label = "dos filetime resolution",
4387 .type = P_BOOL,
4388 .p_class = P_LOCAL,
4389 .ptr = &sDefault.bDosFiletimeResolution,
4390 .special = NULL,
4391 .enum_list = NULL,
4392 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4395 .label = "fake directory create times",
4396 .type = P_BOOL,
4397 .p_class = P_LOCAL,
4398 .ptr = &sDefault.bFakeDirCreateTimes,
4399 .special = NULL,
4400 .enum_list = NULL,
4401 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4404 .label = "async smb echo handler",
4405 .type = P_BOOL,
4406 .p_class = P_GLOBAL,
4407 .ptr = &Globals.bAsyncSMBEchoHandler,
4408 .special = NULL,
4409 .enum_list = NULL,
4410 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4413 .label = "panic action",
4414 .type = P_STRING,
4415 .p_class = P_GLOBAL,
4416 .ptr = &Globals.szPanicAction,
4417 .special = NULL,
4418 .enum_list = NULL,
4419 .flags = FLAG_ADVANCED,
4422 .label = "perfcount module",
4423 .type = P_STRING,
4424 .p_class = P_GLOBAL,
4425 .ptr = &Globals.szSMBPerfcountModule,
4426 .special = NULL,
4427 .enum_list = NULL,
4428 .flags = FLAG_ADVANCED,
4431 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4434 .label = "vfs objects",
4435 .type = P_LIST,
4436 .p_class = P_LOCAL,
4437 .ptr = &sDefault.szVfsObjects,
4438 .special = NULL,
4439 .enum_list = NULL,
4440 .flags = FLAG_ADVANCED | FLAG_SHARE,
4443 .label = "vfs object",
4444 .type = P_LIST,
4445 .p_class = P_LOCAL,
4446 .ptr = &sDefault.szVfsObjects,
4447 .special = NULL,
4448 .enum_list = NULL,
4449 .flags = FLAG_HIDE,
4453 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4456 .label = "msdfs root",
4457 .type = P_BOOL,
4458 .p_class = P_LOCAL,
4459 .ptr = &sDefault.bMSDfsRoot,
4460 .special = NULL,
4461 .enum_list = NULL,
4462 .flags = FLAG_ADVANCED | FLAG_SHARE,
4465 .label = "msdfs proxy",
4466 .type = P_STRING,
4467 .p_class = P_LOCAL,
4468 .ptr = &sDefault.szMSDfsProxy,
4469 .special = NULL,
4470 .enum_list = NULL,
4471 .flags = FLAG_ADVANCED | FLAG_SHARE,
4474 .label = "host msdfs",
4475 .type = P_BOOL,
4476 .p_class = P_GLOBAL,
4477 .ptr = &Globals.bHostMSDfs,
4478 .special = NULL,
4479 .enum_list = NULL,
4480 .flags = FLAG_ADVANCED,
4483 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4486 .label = "passdb expand explicit",
4487 .type = P_BOOL,
4488 .p_class = P_GLOBAL,
4489 .ptr = &Globals.bPassdbExpandExplicit,
4490 .special = NULL,
4491 .enum_list = NULL,
4492 .flags = FLAG_ADVANCED,
4495 .label = "idmap backend",
4496 .type = P_STRING,
4497 .p_class = P_GLOBAL,
4498 .ptr = &Globals.szIdmapBackend,
4499 .special = NULL,
4500 .enum_list = NULL,
4501 .flags = FLAG_ADVANCED,
4504 .label = "idmap alloc backend",
4505 .type = P_STRING,
4506 .p_class = P_GLOBAL,
4507 .ptr = &Globals.szIdmapAllocBackend,
4508 .special = NULL,
4509 .enum_list = NULL,
4510 .flags = FLAG_ADVANCED,
4513 .label = "idmap cache time",
4514 .type = P_INTEGER,
4515 .p_class = P_GLOBAL,
4516 .ptr = &Globals.iIdmapCacheTime,
4517 .special = NULL,
4518 .enum_list = NULL,
4519 .flags = FLAG_ADVANCED,
4522 .label = "idmap negative cache time",
4523 .type = P_INTEGER,
4524 .p_class = P_GLOBAL,
4525 .ptr = &Globals.iIdmapNegativeCacheTime,
4526 .special = NULL,
4527 .enum_list = NULL,
4528 .flags = FLAG_ADVANCED,
4531 .label = "idmap uid",
4532 .type = P_STRING,
4533 .p_class = P_GLOBAL,
4534 .ptr = &Globals.szIdmapUID,
4535 .special = handle_idmap_uid,
4536 .enum_list = NULL,
4537 .flags = FLAG_ADVANCED,
4540 .label = "winbind uid",
4541 .type = P_STRING,
4542 .p_class = P_GLOBAL,
4543 .ptr = &Globals.szIdmapUID,
4544 .special = handle_idmap_uid,
4545 .enum_list = NULL,
4546 .flags = FLAG_HIDE,
4549 .label = "idmap gid",
4550 .type = P_STRING,
4551 .p_class = P_GLOBAL,
4552 .ptr = &Globals.szIdmapGID,
4553 .special = handle_idmap_gid,
4554 .enum_list = NULL,
4555 .flags = FLAG_ADVANCED,
4558 .label = "winbind gid",
4559 .type = P_STRING,
4560 .p_class = P_GLOBAL,
4561 .ptr = &Globals.szIdmapGID,
4562 .special = handle_idmap_gid,
4563 .enum_list = NULL,
4564 .flags = FLAG_HIDE,
4567 .label = "template homedir",
4568 .type = P_STRING,
4569 .p_class = P_GLOBAL,
4570 .ptr = &Globals.szTemplateHomedir,
4571 .special = NULL,
4572 .enum_list = NULL,
4573 .flags = FLAG_ADVANCED,
4576 .label = "template shell",
4577 .type = P_STRING,
4578 .p_class = P_GLOBAL,
4579 .ptr = &Globals.szTemplateShell,
4580 .special = NULL,
4581 .enum_list = NULL,
4582 .flags = FLAG_ADVANCED,
4585 .label = "winbind separator",
4586 .type = P_STRING,
4587 .p_class = P_GLOBAL,
4588 .ptr = &Globals.szWinbindSeparator,
4589 .special = NULL,
4590 .enum_list = NULL,
4591 .flags = FLAG_ADVANCED,
4594 .label = "winbind cache time",
4595 .type = P_INTEGER,
4596 .p_class = P_GLOBAL,
4597 .ptr = &Globals.winbind_cache_time,
4598 .special = NULL,
4599 .enum_list = NULL,
4600 .flags = FLAG_ADVANCED,
4603 .label = "winbind reconnect delay",
4604 .type = P_INTEGER,
4605 .p_class = P_GLOBAL,
4606 .ptr = &Globals.winbind_reconnect_delay,
4607 .special = NULL,
4608 .enum_list = NULL,
4609 .flags = FLAG_ADVANCED,
4612 .label = "winbind enum users",
4613 .type = P_BOOL,
4614 .p_class = P_GLOBAL,
4615 .ptr = &Globals.bWinbindEnumUsers,
4616 .special = NULL,
4617 .enum_list = NULL,
4618 .flags = FLAG_ADVANCED,
4621 .label = "winbind enum groups",
4622 .type = P_BOOL,
4623 .p_class = P_GLOBAL,
4624 .ptr = &Globals.bWinbindEnumGroups,
4625 .special = NULL,
4626 .enum_list = NULL,
4627 .flags = FLAG_ADVANCED,
4630 .label = "winbind use default domain",
4631 .type = P_BOOL,
4632 .p_class = P_GLOBAL,
4633 .ptr = &Globals.bWinbindUseDefaultDomain,
4634 .special = NULL,
4635 .enum_list = NULL,
4636 .flags = FLAG_ADVANCED,
4639 .label = "winbind trusted domains only",
4640 .type = P_BOOL,
4641 .p_class = P_GLOBAL,
4642 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4643 .special = NULL,
4644 .enum_list = NULL,
4645 .flags = FLAG_ADVANCED,
4648 .label = "winbind nested groups",
4649 .type = P_BOOL,
4650 .p_class = P_GLOBAL,
4651 .ptr = &Globals.bWinbindNestedGroups,
4652 .special = NULL,
4653 .enum_list = NULL,
4654 .flags = FLAG_ADVANCED,
4657 .label = "winbind expand groups",
4658 .type = P_INTEGER,
4659 .p_class = P_GLOBAL,
4660 .ptr = &Globals.winbind_expand_groups,
4661 .special = NULL,
4662 .enum_list = NULL,
4663 .flags = FLAG_ADVANCED,
4666 .label = "winbind nss info",
4667 .type = P_LIST,
4668 .p_class = P_GLOBAL,
4669 .ptr = &Globals.szWinbindNssInfo,
4670 .special = NULL,
4671 .enum_list = NULL,
4672 .flags = FLAG_ADVANCED,
4675 .label = "winbind refresh tickets",
4676 .type = P_BOOL,
4677 .p_class = P_GLOBAL,
4678 .ptr = &Globals.bWinbindRefreshTickets,
4679 .special = NULL,
4680 .enum_list = NULL,
4681 .flags = FLAG_ADVANCED,
4684 .label = "winbind offline logon",
4685 .type = P_BOOL,
4686 .p_class = P_GLOBAL,
4687 .ptr = &Globals.bWinbindOfflineLogon,
4688 .special = NULL,
4689 .enum_list = NULL,
4690 .flags = FLAG_ADVANCED,
4693 .label = "winbind normalize names",
4694 .type = P_BOOL,
4695 .p_class = P_GLOBAL,
4696 .ptr = &Globals.bWinbindNormalizeNames,
4697 .special = NULL,
4698 .enum_list = NULL,
4699 .flags = FLAG_ADVANCED,
4702 .label = "winbind rpc only",
4703 .type = P_BOOL,
4704 .p_class = P_GLOBAL,
4705 .ptr = &Globals.bWinbindRpcOnly,
4706 .special = NULL,
4707 .enum_list = NULL,
4708 .flags = FLAG_ADVANCED,
4711 .label = "create krb5 conf",
4712 .type = P_BOOL,
4713 .p_class = P_GLOBAL,
4714 .ptr = &Globals.bCreateKrb5Conf,
4715 .special = NULL,
4716 .enum_list = NULL,
4717 .flags = FLAG_ADVANCED,
4720 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4723 /***************************************************************************
4724 Initialise the sDefault parameter structure for the printer values.
4725 ***************************************************************************/
4727 static void init_printer_values(struct service *pService)
4729 /* choose defaults depending on the type of printing */
4730 switch (pService->iPrinting) {
4731 case PRINT_BSD:
4732 case PRINT_AIX:
4733 case PRINT_LPRNT:
4734 case PRINT_LPROS2:
4735 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4736 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4737 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4738 break;
4740 case PRINT_LPRNG:
4741 case PRINT_PLP:
4742 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4743 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4744 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4745 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4746 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4747 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4748 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4749 break;
4751 case PRINT_CUPS:
4752 case PRINT_IPRINT:
4753 #ifdef HAVE_CUPS
4754 /* set the lpq command to contain the destination printer
4755 name only. This is used by cups_queue_get() */
4756 string_set(&pService->szLpqcommand, "%p");
4757 string_set(&pService->szLprmcommand, "");
4758 string_set(&pService->szPrintcommand, "");
4759 string_set(&pService->szLppausecommand, "");
4760 string_set(&pService->szLpresumecommand, "");
4761 string_set(&pService->szQueuepausecommand, "");
4762 string_set(&pService->szQueueresumecommand, "");
4763 #else
4764 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4765 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4766 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4767 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4768 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4769 string_set(&pService->szQueuepausecommand, "disable '%p'");
4770 string_set(&pService->szQueueresumecommand, "enable '%p'");
4771 #endif /* HAVE_CUPS */
4772 break;
4774 case PRINT_SYSV:
4775 case PRINT_HPUX:
4776 string_set(&pService->szLpqcommand, "lpstat -o%p");
4777 string_set(&pService->szLprmcommand, "cancel %p-%j");
4778 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4779 string_set(&pService->szQueuepausecommand, "disable %p");
4780 string_set(&pService->szQueueresumecommand, "enable %p");
4781 #ifndef HPUX
4782 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4783 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4784 #endif /* HPUX */
4785 break;
4787 case PRINT_QNX:
4788 string_set(&pService->szLpqcommand, "lpq -P%p");
4789 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4790 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4791 break;
4793 #ifdef DEVELOPER
4794 case PRINT_TEST:
4795 case PRINT_VLP:
4796 string_set(&pService->szPrintcommand, "vlp print %p %s");
4797 string_set(&pService->szLpqcommand, "vlp lpq %p");
4798 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4799 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4800 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4801 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4802 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4803 break;
4804 #endif /* DEVELOPER */
4809 * Function to return the default value for the maximum number of open
4810 * file descriptors permitted. This function tries to consult the
4811 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4812 * the smaller of those.
4814 static int max_open_files(void)
4816 int sysctl_max = MAX_OPEN_FILES;
4817 int rlimit_max = MAX_OPEN_FILES;
4819 #ifdef HAVE_SYSCTLBYNAME
4821 size_t size = sizeof(sysctl_max);
4822 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4825 #endif
4827 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4829 struct rlimit rl;
4831 ZERO_STRUCT(rl);
4833 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4834 rlimit_max = rl.rlim_cur;
4836 #if defined(RLIM_INFINITY)
4837 if(rl.rlim_cur == RLIM_INFINITY)
4838 rlimit_max = MAX_OPEN_FILES;
4840 #endif
4841 #endif
4843 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4844 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4845 "minimum Windows limit (%d)\n",
4846 sysctl_max,
4847 MIN_OPEN_FILES_WINDOWS));
4848 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4851 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4852 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4853 "minimum Windows limit (%d)\n",
4854 rlimit_max,
4855 MIN_OPEN_FILES_WINDOWS));
4856 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4859 return MIN(sysctl_max, rlimit_max);
4863 * Common part of freeing allocated data for one parameter.
4865 static void free_one_parameter_common(void *parm_ptr,
4866 struct parm_struct parm)
4868 if ((parm.type == P_STRING) ||
4869 (parm.type == P_USTRING))
4871 string_free((char**)parm_ptr);
4872 } else if (parm.type == P_LIST) {
4873 TALLOC_FREE(*((char***)parm_ptr));
4878 * Free the allocated data for one parameter for a share
4879 * given as a service struct.
4881 static void free_one_parameter(struct service *service,
4882 struct parm_struct parm)
4884 void *parm_ptr;
4886 if (parm.p_class != P_LOCAL) {
4887 return;
4890 parm_ptr = lp_local_ptr(service, parm.ptr);
4892 free_one_parameter_common(parm_ptr, parm);
4896 * Free the allocated parameter data of a share given
4897 * as a service struct.
4899 static void free_parameters(struct service *service)
4901 uint32_t i;
4903 for (i=0; parm_table[i].label; i++) {
4904 free_one_parameter(service, parm_table[i]);
4909 * Free the allocated data for one parameter for a given share
4910 * specified by an snum.
4912 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4914 void *parm_ptr;
4916 if (parm.ptr == NULL) {
4917 return;
4920 if (snum < 0) {
4921 parm_ptr = parm.ptr;
4922 } else if (parm.p_class != P_LOCAL) {
4923 return;
4924 } else {
4925 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4928 free_one_parameter_common(parm_ptr, parm);
4932 * Free the allocated parameter data for a share specified
4933 * by an snum.
4935 static void free_parameters_by_snum(int snum)
4937 uint32_t i;
4939 for (i=0; parm_table[i].label; i++) {
4940 free_one_parameter_by_snum(snum, parm_table[i]);
4945 * Free the allocated global parameters.
4947 static void free_global_parameters(void)
4949 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4952 /***************************************************************************
4953 Initialise the global parameter structure.
4954 ***************************************************************************/
4956 static void init_globals(bool first_time_only)
4958 static bool done_init = False;
4959 char *s = NULL;
4960 int i;
4962 /* If requested to initialize only once and we've already done it... */
4963 if (first_time_only && done_init) {
4964 /* ... then we have nothing more to do */
4965 return;
4968 if (!done_init) {
4969 /* The logfile can be set before this is invoked. Free it if so. */
4970 if (Globals.szLogFile != NULL) {
4971 string_free(&Globals.szLogFile);
4972 Globals.szLogFile = NULL;
4974 done_init = True;
4975 } else {
4976 free_global_parameters();
4979 memset((void *)&Globals, '\0', sizeof(Globals));
4981 for (i = 0; parm_table[i].label; i++) {
4982 if ((parm_table[i].type == P_STRING ||
4983 parm_table[i].type == P_USTRING) &&
4984 parm_table[i].ptr)
4986 string_set((char **)parm_table[i].ptr, "");
4990 string_set(&sDefault.fstype, FSTYPE_STRING);
4991 string_set(&sDefault.szPrintjobUsername, "%U");
4993 init_printer_values(&sDefault);
4996 DEBUG(3, ("Initialising global parameters\n"));
4998 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
4999 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5001 /* use the new 'hash2' method by default, with a prefix of 1 */
5002 string_set(&Globals.szManglingMethod, "hash2");
5003 Globals.mangle_prefix = 1;
5005 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5007 /* using UTF8 by default allows us to support all chars */
5008 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5010 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5011 /* If the system supports nl_langinfo(), try to grab the value
5012 from the user's locale */
5013 string_set(&Globals.display_charset, "LOCALE");
5014 #else
5015 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
5016 #endif
5018 /* Use codepage 850 as a default for the dos character set */
5019 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5022 * Allow the default PASSWD_CHAT to be overridden in local.h.
5024 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5026 set_global_myname(myhostname());
5027 string_set(&Globals.szNetbiosName,global_myname());
5029 set_global_myworkgroup(WORKGROUP);
5030 string_set(&Globals.szWorkgroup, lp_workgroup());
5032 string_set(&Globals.szPasswdProgram, "");
5033 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5034 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5035 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5036 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5037 string_set(&Globals.szSocketAddress, "0.0.0.0");
5039 * By default support explicit binding to broadcast
5040 * addresses.
5042 Globals.bNmbdBindExplicitBroadcast = true;
5044 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5045 smb_panic("init_globals: ENOMEM");
5047 string_set(&Globals.szServerString, s);
5048 SAFE_FREE(s);
5049 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5050 DEFAULT_MINOR_VERSION) < 0) {
5051 smb_panic("init_globals: ENOMEM");
5053 string_set(&Globals.szAnnounceVersion, s);
5054 SAFE_FREE(s);
5055 #ifdef DEVELOPER
5056 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5057 #endif
5059 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5061 string_set(&Globals.szLogonDrive, "");
5062 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5063 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5064 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5066 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5067 string_set(&Globals.szPasswordServer, "*");
5069 Globals.AlgorithmicRidBase = BASE_RID;
5071 Globals.bLoadPrinters = True;
5072 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5074 Globals.ConfigBackend = config_backend;
5076 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5077 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5078 Globals.max_xmit = 0x4104;
5079 Globals.max_mux = 50; /* This is *needed* for profile support. */
5080 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5081 Globals.bDisableSpoolss = False;
5082 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5083 Globals.pwordlevel = 0;
5084 Globals.unamelevel = 0;
5085 Globals.deadtime = 0;
5086 Globals.getwd_cache = true;
5087 Globals.bLargeReadwrite = True;
5088 Globals.max_log_size = 5000;
5089 Globals.max_open_files = max_open_files();
5090 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5091 Globals.maxprotocol = PROTOCOL_NT1;
5092 Globals.minprotocol = PROTOCOL_CORE;
5093 Globals.security = SEC_USER;
5094 Globals.paranoid_server_security = True;
5095 Globals.bEncryptPasswords = True;
5096 Globals.bUpdateEncrypt = False;
5097 Globals.clientSchannel = Auto;
5098 Globals.serverSchannel = Auto;
5099 Globals.bReadRaw = True;
5100 Globals.bWriteRaw = True;
5101 Globals.bNullPasswords = False;
5102 Globals.bObeyPamRestrictions = False;
5103 Globals.syslog = 1;
5104 Globals.bSyslogOnly = False;
5105 Globals.bTimestampLogs = True;
5106 string_set(&Globals.szLogLevel, "0");
5107 Globals.bDebugPrefixTimestamp = False;
5108 Globals.bDebugHiresTimestamp = true;
5109 Globals.bDebugPid = False;
5110 Globals.bDebugUid = False;
5111 Globals.bDebugClass = False;
5112 Globals.bEnableCoreFiles = True;
5113 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5114 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5115 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5116 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5117 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5118 Globals.lm_interval = 60;
5119 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5120 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5121 Globals.bNISHomeMap = False;
5122 #ifdef WITH_NISPLUS_HOME
5123 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5124 #else
5125 string_set(&Globals.szNISHomeMapName, "auto.home");
5126 #endif
5127 #endif
5128 Globals.bTimeServer = False;
5129 Globals.bBindInterfacesOnly = False;
5130 Globals.bUnixPasswdSync = False;
5131 Globals.bPamPasswordChange = False;
5132 Globals.bPasswdChatDebug = False;
5133 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5134 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5135 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5136 Globals.bStatCache = True; /* use stat cache by default */
5137 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5138 Globals.restrict_anonymous = 0;
5139 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5140 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5141 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5142 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5143 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5144 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5146 Globals.map_to_guest = 0; /* By Default, "Never" */
5147 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5148 Globals.enhanced_browsing = true;
5149 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5150 #ifdef MMAP_BLACKLIST
5151 Globals.bUseMmap = False;
5152 #else
5153 Globals.bUseMmap = True;
5154 #endif
5155 Globals.bUnixExtensions = True;
5156 Globals.bResetOnZeroVC = False;
5157 Globals.bLogWriteableFilesOnExit = False;
5158 Globals.bCreateKrb5Conf = true;
5160 /* hostname lookups can be very expensive and are broken on
5161 a large number of sites (tridge) */
5162 Globals.bHostnameLookups = False;
5164 string_set(&Globals.szPassdbBackend, "tdbsam");
5165 string_set(&Globals.szLdapSuffix, "");
5166 string_set(&Globals.szLdapMachineSuffix, "");
5167 string_set(&Globals.szLdapUserSuffix, "");
5168 string_set(&Globals.szLdapGroupSuffix, "");
5169 string_set(&Globals.szLdapIdmapSuffix, "");
5171 string_set(&Globals.szLdapAdminDn, "");
5172 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5173 Globals.ldap_ssl_ads = False;
5174 Globals.ldap_deref = -1;
5175 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5176 Globals.ldap_delete_dn = False;
5177 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5178 Globals.ldap_follow_referral = Auto;
5179 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5180 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5181 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5183 Globals.ldap_debug_level = 0;
5184 Globals.ldap_debug_threshold = 10;
5186 /* This is what we tell the afs client. in reality we set the token
5187 * to never expire, though, when this runs out the afs client will
5188 * forget the token. Set to 0 to get NEVERDATE.*/
5189 Globals.iAfsTokenLifetime = 604800;
5190 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5192 /* these parameters are set to defaults that are more appropriate
5193 for the increasing samba install base:
5195 as a member of the workgroup, that will possibly become a
5196 _local_ master browser (lm = True). this is opposed to a forced
5197 local master browser startup (pm = True).
5199 doesn't provide WINS server service by default (wsupp = False),
5200 and doesn't provide domain master browser services by default, either.
5204 Globals.bMsAddPrinterWizard = True;
5205 Globals.os_level = 20;
5206 Globals.bLocalMaster = True;
5207 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5208 Globals.bDomainLogons = False;
5209 Globals.bBrowseList = True;
5210 Globals.bWINSsupport = False;
5211 Globals.bWINSproxy = False;
5213 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5214 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5216 Globals.bDNSproxy = True;
5218 /* this just means to use them if they exist */
5219 Globals.bKernelOplocks = True;
5221 Globals.bAllowTrustedDomains = True;
5222 string_set(&Globals.szIdmapBackend, "tdb");
5224 string_set(&Globals.szTemplateShell, "/bin/false");
5225 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5226 string_set(&Globals.szWinbindSeparator, "\\");
5228 string_set(&Globals.szCupsServer, "");
5229 string_set(&Globals.szIPrintServer, "");
5231 string_set(&Globals.ctdbdSocket, "");
5232 Globals.szClusterAddresses = NULL;
5233 Globals.clustering = False;
5234 Globals.ctdb_timeout = 0;
5235 Globals.ctdb_locktime_warn_threshold = 0;
5237 Globals.winbind_cache_time = 300; /* 5 minutes */
5238 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5239 Globals.bWinbindEnumUsers = False;
5240 Globals.bWinbindEnumGroups = False;
5241 Globals.bWinbindUseDefaultDomain = False;
5242 Globals.bWinbindTrustedDomainsOnly = False;
5243 Globals.bWinbindNestedGroups = True;
5244 Globals.winbind_expand_groups = 1;
5245 Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL);
5246 Globals.bWinbindRefreshTickets = False;
5247 Globals.bWinbindOfflineLogon = False;
5249 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5250 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5252 Globals.bPassdbExpandExplicit = False;
5254 Globals.name_cache_timeout = 660; /* In seconds */
5256 Globals.bUseSpnego = True;
5257 Globals.bClientUseSpnego = True;
5259 Globals.client_signing = Auto;
5260 Globals.server_signing = False;
5262 Globals.bDeferSharingViolations = True;
5263 string_set(&Globals.smb_ports, SMB_PORTS);
5265 Globals.bEnablePrivileges = True;
5266 Globals.bHostMSDfs = True;
5267 Globals.bASUSupport = False;
5269 /* User defined shares. */
5270 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5271 smb_panic("init_globals: ENOMEM");
5273 string_set(&Globals.szUsersharePath, s);
5274 SAFE_FREE(s);
5275 string_set(&Globals.szUsershareTemplateShare, "");
5276 Globals.iUsershareMaxShares = 0;
5277 /* By default disallow sharing of directories not owned by the sharer. */
5278 Globals.bUsershareOwnerOnly = True;
5279 /* By default disallow guest access to usershares. */
5280 Globals.bUsershareAllowGuests = False;
5282 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5284 /* By default no shares out of the registry */
5285 Globals.bRegistryShares = False;
5287 Globals.iminreceivefile = 0;
5289 Globals.bMapUntrustedToDomain = false;
5291 Globals.ismb2_max_read = 1024*1024;
5292 Globals.ismb2_max_write = 1024*1024;
5293 Globals.ismb2_max_trans = 1024*1024;
5296 /*******************************************************************
5297 Convenience routine to grab string parameters into temporary memory
5298 and run standard_sub_basic on them. The buffers can be written to by
5299 callers without affecting the source string.
5300 ********************************************************************/
5302 static char *lp_string(const char *s)
5304 char *ret;
5305 TALLOC_CTX *ctx = talloc_tos();
5307 /* The follow debug is useful for tracking down memory problems
5308 especially if you have an inner loop that is calling a lp_*()
5309 function that returns a string. Perhaps this debug should be
5310 present all the time? */
5312 #if 0
5313 DEBUG(10, ("lp_string(%s)\n", s));
5314 #endif
5315 if (!s) {
5316 return NULL;
5319 ret = talloc_sub_basic(ctx,
5320 get_current_username(),
5321 current_user_info.domain,
5323 if (trim_char(ret, '\"', '\"')) {
5324 if (strchr(ret,'\"') != NULL) {
5325 TALLOC_FREE(ret);
5326 ret = talloc_sub_basic(ctx,
5327 get_current_username(),
5328 current_user_info.domain,
5332 return ret;
5336 In this section all the functions that are used to access the
5337 parameters from the rest of the program are defined
5340 #define FN_GLOBAL_STRING(fn_name,ptr) \
5341 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5342 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5343 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5344 #define FN_GLOBAL_LIST(fn_name,ptr) \
5345 const char **fn_name(void) {return(*(const char ***)(ptr));}
5346 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5347 bool fn_name(void) {return(*(bool *)(ptr));}
5348 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5349 char fn_name(void) {return(*(char *)(ptr));}
5350 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5351 int fn_name(void) {return(*(int *)(ptr));}
5353 #define FN_LOCAL_STRING(fn_name,val) \
5354 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5355 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5356 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5357 #define FN_LOCAL_LIST(fn_name,val) \
5358 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5359 #define FN_LOCAL_BOOL(fn_name,val) \
5360 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5361 #define FN_LOCAL_INTEGER(fn_name,val) \
5362 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5364 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5365 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5366 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5367 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5368 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5369 char *fn_name(const struct share_params *p) {return(lp_string((LP_SNUM_OK(p->service) && ServicePtrs[(p->service)]->val) ? ServicePtrs[(p->service)]->val : sDefault.val));}
5370 #define FN_LOCAL_CHAR(fn_name,val) \
5371 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5373 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5374 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5375 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5376 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5377 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5378 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5379 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5380 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5381 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5382 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5383 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5384 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5385 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5386 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5387 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5388 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5389 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5390 * build process or in smb.conf, we use that value. Otherwise they
5391 * default to the value of lp_lockdir(). */
5392 char *lp_statedir(void) {
5393 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5394 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5395 return(lp_string(*(char **)(&Globals.szStateDir) ?
5396 *(char **)(&Globals.szStateDir) : ""));
5397 else
5398 return(lp_string(*(char **)(&Globals.szLockDir) ?
5399 *(char **)(&Globals.szLockDir) : ""));
5401 char *lp_cachedir(void) {
5402 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5403 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5404 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5405 *(char **)(&Globals.szCacheDir) : ""));
5406 else
5407 return(lp_string(*(char **)(&Globals.szLockDir) ?
5408 *(char **)(&Globals.szLockDir) : ""));
5410 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5411 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5412 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5413 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5414 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5415 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5416 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5417 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5418 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5419 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5420 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5421 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5422 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5423 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5424 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5425 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5426 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5427 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5428 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5429 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5430 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5431 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5432 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5433 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5434 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5435 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5436 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5437 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5438 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5439 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5440 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5441 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5442 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5443 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5444 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5445 * lp_passdb_backend() should be replace by the this macro again after
5446 * some releases.
5447 * */
5448 const char *lp_passdb_backend(void)
5450 char *delim, *quote;
5452 delim = strchr( Globals.szPassdbBackend, ' ');
5453 /* no space at all */
5454 if (delim == NULL) {
5455 goto out;
5458 quote = strchr(Globals.szPassdbBackend, '"');
5459 /* no quote char or non in the first part */
5460 if (quote == NULL || quote > delim) {
5461 *delim = '\0';
5462 goto warn;
5465 quote = strchr(quote+1, '"');
5466 if (quote == NULL) {
5467 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5468 goto out;
5469 } else if (*(quote+1) == '\0') {
5470 /* space, fitting quote char, and one backend only */
5471 goto out;
5472 } else {
5473 /* terminate string after the fitting quote char */
5474 *(quote+1) = '\0';
5477 warn:
5478 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5479 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5480 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5481 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5483 out:
5484 return Globals.szPassdbBackend;
5486 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5487 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5488 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5489 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5490 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5492 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5493 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5494 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5495 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5496 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5497 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5499 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5501 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5502 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5503 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5504 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
5506 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5508 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5509 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5510 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5511 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5512 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5513 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5514 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5515 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5516 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5517 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5518 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5519 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5520 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5521 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5522 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5523 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5525 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5526 FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
5527 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5528 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5529 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5530 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5532 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5533 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5534 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5535 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5536 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5537 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5538 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5539 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5540 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5541 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5542 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5543 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5544 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5545 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5546 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5547 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5548 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5549 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5550 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5551 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5553 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5555 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5556 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5557 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5558 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5559 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5560 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5561 &Globals.bLogWriteableFilesOnExit)
5562 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5563 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5564 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5565 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5566 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5567 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5568 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5569 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5570 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5571 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5572 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
5573 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5574 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
5575 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5576 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5577 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5578 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
5579 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5580 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5581 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5582 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5583 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5584 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5585 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5586 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5587 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5588 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5589 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5590 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5591 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5592 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5593 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5594 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5595 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5596 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5597 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5598 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5599 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5600 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5601 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5602 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5603 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5604 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5605 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5606 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5607 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5608 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5609 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5610 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5611 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5612 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5613 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5614 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5615 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5616 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5617 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5618 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5619 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5620 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5621 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5622 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5623 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5624 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5625 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5626 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5627 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5628 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5629 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5630 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5631 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5632 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5633 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5634 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5635 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5636 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5637 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5638 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5639 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5640 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5641 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5642 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5643 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5644 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5645 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5646 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5647 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5648 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5649 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5650 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5651 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5652 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5653 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5654 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5655 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5656 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5657 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
5658 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
5659 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
5661 FN_LOCAL_STRING(lp_preexec, szPreExec)
5662 FN_LOCAL_STRING(lp_postexec, szPostExec)
5663 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5664 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5665 FN_LOCAL_STRING(lp_servicename, szService)
5666 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5667 FN_LOCAL_STRING(lp_pathname, szPath)
5668 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5669 FN_LOCAL_STRING(lp_username, szUsername)
5670 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5671 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5672 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5673 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5674 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5675 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5676 int lp_cups_encrypt(void)
5678 int result = 0;
5679 #ifdef HAVE_HTTPCONNECTENCRYPT
5680 switch (Globals.CupsEncrypt) {
5681 case Auto:
5682 result = HTTP_ENCRYPT_REQUIRED;
5683 break;
5684 case True:
5685 result = HTTP_ENCRYPT_ALWAYS;
5686 break;
5687 case False:
5688 result = HTTP_ENCRYPT_NEVER;
5689 break;
5691 #endif
5692 return result;
5694 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5695 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5696 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5697 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5698 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5699 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5700 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5701 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5702 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5703 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5704 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5705 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5706 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5707 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5708 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5709 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5710 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5711 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5712 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5713 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5714 FN_LOCAL_STRING(lp_comment, comment)
5715 FN_LOCAL_STRING(lp_force_user, force_user)
5716 FN_LOCAL_STRING(lp_force_group, force_group)
5717 FN_LOCAL_LIST(lp_readlist, readlist)
5718 FN_LOCAL_LIST(lp_writelist, writelist)
5719 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5720 FN_LOCAL_STRING(lp_fstype, fstype)
5721 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5722 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5723 static FN_LOCAL_STRING(lp_volume, volume)
5724 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5725 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5726 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5727 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5728 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5729 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5730 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5731 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5732 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5733 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5734 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5735 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5736 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5737 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5738 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5739 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5740 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5741 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5742 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5743 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5744 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5745 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5746 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5747 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5748 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5749 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5750 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5751 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5752 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5753 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5754 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5755 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5756 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5757 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5758 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5759 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5760 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5761 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5762 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5763 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5764 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5765 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5766 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5767 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5768 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5769 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5770 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5771 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5772 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5773 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5774 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5775 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5776 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5777 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5778 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5779 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5780 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5781 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5782 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5783 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5784 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5785 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5786 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5787 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5788 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5789 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5790 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5791 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5792 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5793 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5794 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5795 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5796 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5797 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5798 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5799 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5800 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5801 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5802 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5803 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5804 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5805 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5806 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5807 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5808 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5809 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5810 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5811 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5812 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5813 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5814 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5815 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5816 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5817 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5818 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5819 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5820 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5821 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5822 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5824 /* local prototypes */
5826 static int map_parameter(const char *pszParmName);
5827 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5828 static const char *get_boolean(bool bool_value);
5829 static int getservicebyname(const char *pszServiceName,
5830 struct service *pserviceDest);
5831 static void copy_service(struct service *pserviceDest,
5832 struct service *pserviceSource,
5833 struct bitmap *pcopymapDest);
5834 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5835 void *userdata);
5836 static bool do_section(const char *pszSectionName, void *userdata);
5837 static void init_copymap(struct service *pservice);
5838 static bool hash_a_service(const char *name, int number);
5839 static void free_service_byindex(int iService);
5840 static void free_param_opts(struct param_opt_struct **popts);
5841 static void show_parameter(int parmIndex);
5842 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5845 * This is a helper function for parametrical options support. It returns a
5846 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5847 * parametrical functions are quite simple
5849 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5850 const char *option)
5852 bool global_section = False;
5853 char* param_key;
5854 struct param_opt_struct *data;
5856 if (snum >= iNumServices) return NULL;
5858 if (snum < 0) {
5859 data = Globals.param_opt;
5860 global_section = True;
5861 } else {
5862 data = ServicePtrs[snum]->param_opt;
5865 if (asprintf(&param_key, "%s:%s", type, option) == -1) {
5866 DEBUG(0,("asprintf failed!\n"));
5867 return NULL;
5870 while (data) {
5871 if (strwicmp(data->key, param_key) == 0) {
5872 string_free(&param_key);
5873 return data;
5875 data = data->next;
5878 if (!global_section) {
5879 /* Try to fetch the same option but from globals */
5880 /* but only if we are not already working with Globals */
5881 data = Globals.param_opt;
5882 while (data) {
5883 if (strwicmp(data->key, param_key) == 0) {
5884 string_free(&param_key);
5885 return data;
5887 data = data->next;
5891 string_free(&param_key);
5893 return NULL;
5897 #define MISSING_PARAMETER(name) \
5898 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5900 /*******************************************************************
5901 convenience routine to return int parameters.
5902 ********************************************************************/
5903 static int lp_int(const char *s)
5906 if (!s || !*s) {
5907 MISSING_PARAMETER(lp_int);
5908 return (-1);
5911 return (int)strtol(s, NULL, 0);
5914 /*******************************************************************
5915 convenience routine to return unsigned long parameters.
5916 ********************************************************************/
5917 static unsigned long lp_ulong(const char *s)
5920 if (!s || !*s) {
5921 MISSING_PARAMETER(lp_ulong);
5922 return (0);
5925 return strtoul(s, NULL, 0);
5928 /*******************************************************************
5929 convenience routine to return boolean parameters.
5930 ********************************************************************/
5931 static bool lp_bool(const char *s)
5933 bool ret = False;
5935 if (!s || !*s) {
5936 MISSING_PARAMETER(lp_bool);
5937 return False;
5940 if (!set_boolean(s, &ret)) {
5941 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5942 return False;
5945 return ret;
5948 /*******************************************************************
5949 convenience routine to return enum parameters.
5950 ********************************************************************/
5951 static int lp_enum(const char *s,const struct enum_list *_enum)
5953 int i;
5955 if (!s || !*s || !_enum) {
5956 MISSING_PARAMETER(lp_enum);
5957 return (-1);
5960 for (i=0; _enum[i].name; i++) {
5961 if (strequal(_enum[i].name,s))
5962 return _enum[i].value;
5965 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5966 return (-1);
5969 #undef MISSING_PARAMETER
5971 /* DO NOT USE lp_parm_string ANYMORE!!!!
5972 * use lp_parm_const_string or lp_parm_talloc_string
5974 * lp_parm_string is only used to let old modules find this symbol
5976 #undef lp_parm_string
5977 char *lp_parm_string(const char *servicename, const char *type, const char *option);
5978 char *lp_parm_string(const char *servicename, const char *type, const char *option)
5980 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
5983 /* Return parametric option from a given service. Type is a part of option before ':' */
5984 /* Parametric option has following syntax: 'Type: option = value' */
5985 /* the returned value is talloced on the talloc_tos() */
5986 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
5988 struct param_opt_struct *data = get_parametrics(snum, type, option);
5990 if (data == NULL||data->value==NULL) {
5991 if (def) {
5992 return lp_string(def);
5993 } else {
5994 return NULL;
5998 return lp_string(data->value);
6001 /* Return parametric option from a given service. Type is a part of option before ':' */
6002 /* Parametric option has following syntax: 'Type: option = value' */
6003 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6005 struct param_opt_struct *data = get_parametrics(snum, type, option);
6007 if (data == NULL||data->value==NULL)
6008 return def;
6010 return data->value;
6013 /* Return parametric option from a given service. Type is a part of option before ':' */
6014 /* Parametric option has following syntax: 'Type: option = value' */
6016 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6018 struct param_opt_struct *data = get_parametrics(snum, type, option);
6020 if (data == NULL||data->value==NULL)
6021 return (const char **)def;
6023 if (data->list==NULL) {
6024 data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL);
6027 return (const char **)data->list;
6030 /* Return parametric option from a given service. Type is a part of option before ':' */
6031 /* Parametric option has following syntax: 'Type: option = value' */
6033 int lp_parm_int(int snum, const char *type, const char *option, int def)
6035 struct param_opt_struct *data = get_parametrics(snum, type, option);
6037 if (data && data->value && *data->value)
6038 return lp_int(data->value);
6040 return def;
6043 /* Return parametric option from a given service. Type is a part of option before ':' */
6044 /* Parametric option has following syntax: 'Type: option = value' */
6046 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6048 struct param_opt_struct *data = get_parametrics(snum, type, option);
6050 if (data && data->value && *data->value)
6051 return lp_ulong(data->value);
6053 return def;
6056 /* Return parametric option from a given service. Type is a part of option before ':' */
6057 /* Parametric option has following syntax: 'Type: option = value' */
6059 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6061 struct param_opt_struct *data = get_parametrics(snum, type, option);
6063 if (data && data->value && *data->value)
6064 return lp_bool(data->value);
6066 return def;
6069 /* Return parametric option from a given service. Type is a part of option before ':' */
6070 /* Parametric option has following syntax: 'Type: option = value' */
6072 int lp_parm_enum(int snum, const char *type, const char *option,
6073 const struct enum_list *_enum, int def)
6075 struct param_opt_struct *data = get_parametrics(snum, type, option);
6077 if (data && data->value && *data->value && _enum)
6078 return lp_enum(data->value, _enum);
6080 return def;
6084 /***************************************************************************
6085 Initialise a service to the defaults.
6086 ***************************************************************************/
6088 static void init_service(struct service *pservice)
6090 memset((char *)pservice, '\0', sizeof(struct service));
6091 copy_service(pservice, &sDefault, NULL);
6096 * free a param_opts structure.
6097 * param_opts handling should be moved to talloc;
6098 * then this whole functions reduces to a TALLOC_FREE().
6101 static void free_param_opts(struct param_opt_struct **popts)
6103 struct param_opt_struct *opt, *next_opt;
6105 if (popts == NULL) {
6106 return;
6109 if (*popts != NULL) {
6110 DEBUG(5, ("Freeing parametrics:\n"));
6112 opt = *popts;
6113 while (opt != NULL) {
6114 string_free(&opt->key);
6115 string_free(&opt->value);
6116 TALLOC_FREE(opt->list);
6117 next_opt = opt->next;
6118 SAFE_FREE(opt);
6119 opt = next_opt;
6121 *popts = NULL;
6124 /***************************************************************************
6125 Free the dynamically allocated parts of a service struct.
6126 ***************************************************************************/
6128 static void free_service(struct service *pservice)
6130 if (!pservice)
6131 return;
6133 if (pservice->szService)
6134 DEBUG(5, ("free_service: Freeing service %s\n",
6135 pservice->szService));
6137 free_parameters(pservice);
6139 string_free(&pservice->szService);
6140 TALLOC_FREE(pservice->copymap);
6142 free_param_opts(&pservice->param_opt);
6144 ZERO_STRUCTP(pservice);
6148 /***************************************************************************
6149 remove a service indexed in the ServicePtrs array from the ServiceHash
6150 and free the dynamically allocated parts
6151 ***************************************************************************/
6153 static void free_service_byindex(int idx)
6155 if ( !LP_SNUM_OK(idx) )
6156 return;
6158 ServicePtrs[idx]->valid = False;
6159 invalid_services[num_invalid_services++] = idx;
6161 /* we have to cleanup the hash record */
6163 if (ServicePtrs[idx]->szService) {
6164 char *canon_name = canonicalize_servicename(
6165 talloc_tos(),
6166 ServicePtrs[idx]->szService );
6168 dbwrap_delete_bystring(ServiceHash, canon_name );
6169 TALLOC_FREE(canon_name);
6172 free_service(ServicePtrs[idx]);
6175 /***************************************************************************
6176 Add a new service to the services array initialising it with the given
6177 service.
6178 ***************************************************************************/
6180 static int add_a_service(const struct service *pservice, const char *name)
6182 int i;
6183 struct service tservice;
6184 int num_to_alloc = iNumServices + 1;
6186 tservice = *pservice;
6188 /* it might already exist */
6189 if (name) {
6190 i = getservicebyname(name, NULL);
6191 if (i >= 0) {
6192 /* Clean all parametric options for service */
6193 /* They will be added during parsing again */
6194 free_param_opts(&ServicePtrs[i]->param_opt);
6195 return (i);
6199 /* find an invalid one */
6200 i = iNumServices;
6201 if (num_invalid_services > 0) {
6202 i = invalid_services[--num_invalid_services];
6205 /* if not, then create one */
6206 if (i == iNumServices) {
6207 struct service **tsp;
6208 int *tinvalid;
6210 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6211 if (tsp == NULL) {
6212 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6213 return (-1);
6215 ServicePtrs = tsp;
6216 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6217 if (!ServicePtrs[iNumServices]) {
6218 DEBUG(0,("add_a_service: out of memory!\n"));
6219 return (-1);
6221 iNumServices++;
6223 /* enlarge invalid_services here for now... */
6224 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6225 num_to_alloc);
6226 if (tinvalid == NULL) {
6227 DEBUG(0,("add_a_service: failed to enlarge "
6228 "invalid_services!\n"));
6229 return (-1);
6231 invalid_services = tinvalid;
6232 } else {
6233 free_service_byindex(i);
6236 ServicePtrs[i]->valid = True;
6238 init_service(ServicePtrs[i]);
6239 copy_service(ServicePtrs[i], &tservice, NULL);
6240 if (name)
6241 string_set(&ServicePtrs[i]->szService, name);
6243 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6244 i, ServicePtrs[i]->szService));
6246 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6247 return (-1);
6250 return (i);
6253 /***************************************************************************
6254 Convert a string to uppercase and remove whitespaces.
6255 ***************************************************************************/
6257 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6259 char *result;
6261 if ( !src ) {
6262 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6263 return NULL;
6266 result = talloc_strdup(ctx, src);
6267 SMB_ASSERT(result != NULL);
6269 strlower_m(result);
6270 return result;
6273 /***************************************************************************
6274 Add a name/index pair for the services array to the hash table.
6275 ***************************************************************************/
6277 static bool hash_a_service(const char *name, int idx)
6279 char *canon_name;
6281 if ( !ServiceHash ) {
6282 DEBUG(10,("hash_a_service: creating servicehash\n"));
6283 ServiceHash = db_open_rbt(NULL);
6284 if ( !ServiceHash ) {
6285 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6286 return False;
6290 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6291 idx, name));
6293 canon_name = canonicalize_servicename(talloc_tos(), name );
6295 dbwrap_store_bystring(ServiceHash, canon_name,
6296 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6297 TDB_REPLACE);
6299 TALLOC_FREE(canon_name);
6301 return True;
6304 /***************************************************************************
6305 Add a new home service, with the specified home directory, defaults coming
6306 from service ifrom.
6307 ***************************************************************************/
6309 bool lp_add_home(const char *pszHomename, int iDefaultService,
6310 const char *user, const char *pszHomedir)
6312 int i;
6314 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6315 pszHomedir[0] == '\0') {
6316 return false;
6319 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6321 if (i < 0)
6322 return (False);
6324 if (!(*(ServicePtrs[iDefaultService]->szPath))
6325 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6326 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6329 if (!(*(ServicePtrs[i]->comment))) {
6330 char *comment = NULL;
6331 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6332 return false;
6334 string_set(&ServicePtrs[i]->comment, comment);
6335 SAFE_FREE(comment);
6338 /* set the browseable flag from the global default */
6340 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6341 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6343 ServicePtrs[i]->autoloaded = True;
6345 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6346 user, ServicePtrs[i]->szPath ));
6348 return (True);
6351 /***************************************************************************
6352 Add a new service, based on an old one.
6353 ***************************************************************************/
6355 int lp_add_service(const char *pszService, int iDefaultService)
6357 if (iDefaultService < 0) {
6358 return add_a_service(&sDefault, pszService);
6361 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6364 /***************************************************************************
6365 Add the IPC service.
6366 ***************************************************************************/
6368 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6370 char *comment = NULL;
6371 int i = add_a_service(&sDefault, ipc_name);
6373 if (i < 0)
6374 return (False);
6376 if (asprintf(&comment, "IPC Service (%s)",
6377 Globals.szServerString) < 0) {
6378 return (False);
6381 string_set(&ServicePtrs[i]->szPath, tmpdir());
6382 string_set(&ServicePtrs[i]->szUsername, "");
6383 string_set(&ServicePtrs[i]->comment, comment);
6384 string_set(&ServicePtrs[i]->fstype, "IPC");
6385 ServicePtrs[i]->iMaxConnections = 0;
6386 ServicePtrs[i]->bAvailable = True;
6387 ServicePtrs[i]->bRead_only = True;
6388 ServicePtrs[i]->bGuest_only = False;
6389 ServicePtrs[i]->bAdministrative_share = True;
6390 ServicePtrs[i]->bGuest_ok = guest_ok;
6391 ServicePtrs[i]->bPrint_ok = False;
6392 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6394 DEBUG(3, ("adding IPC service\n"));
6396 SAFE_FREE(comment);
6397 return (True);
6400 /***************************************************************************
6401 Add a new printer service, with defaults coming from service iFrom.
6402 ***************************************************************************/
6404 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6406 const char *comment = "From Printcap";
6407 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6409 if (i < 0)
6410 return (False);
6412 /* note that we do NOT default the availability flag to True - */
6413 /* we take it from the default service passed. This allows all */
6414 /* dynamic printers to be disabled by disabling the [printers] */
6415 /* entry (if/when the 'available' keyword is implemented!). */
6417 /* the printer name is set to the service name. */
6418 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6419 string_set(&ServicePtrs[i]->comment, comment);
6421 /* set the browseable flag from the gloabl default */
6422 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6424 /* Printers cannot be read_only. */
6425 ServicePtrs[i]->bRead_only = False;
6426 /* No share modes on printer services. */
6427 ServicePtrs[i]->bShareModes = False;
6428 /* No oplocks on printer services. */
6429 ServicePtrs[i]->bOpLocks = False;
6430 /* Printer services must be printable. */
6431 ServicePtrs[i]->bPrint_ok = True;
6433 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6435 return (True);
6439 /***************************************************************************
6440 Check whether the given parameter name is valid.
6441 Parametric options (names containing a colon) are considered valid.
6442 ***************************************************************************/
6444 bool lp_parameter_is_valid(const char *pszParmName)
6446 return ((map_parameter(pszParmName) != -1) ||
6447 (strchr(pszParmName, ':') != NULL));
6450 /***************************************************************************
6451 Check whether the given name is the name of a global parameter.
6452 Returns True for strings belonging to parameters of class
6453 P_GLOBAL, False for all other strings, also for parametric options
6454 and strings not belonging to any option.
6455 ***************************************************************************/
6457 bool lp_parameter_is_global(const char *pszParmName)
6459 int num = map_parameter(pszParmName);
6461 if (num >= 0) {
6462 return (parm_table[num].p_class == P_GLOBAL);
6465 return False;
6468 /**************************************************************************
6469 Check whether the given name is the canonical name of a parameter.
6470 Returns False if it is not a valid parameter Name.
6471 For parametric options, True is returned.
6472 **************************************************************************/
6474 bool lp_parameter_is_canonical(const char *parm_name)
6476 if (!lp_parameter_is_valid(parm_name)) {
6477 return False;
6480 return (map_parameter(parm_name) ==
6481 map_parameter_canonical(parm_name, NULL));
6484 /**************************************************************************
6485 Determine the canonical name for a parameter.
6486 Indicate when it is an inverse (boolean) synonym instead of a
6487 "usual" synonym.
6488 **************************************************************************/
6490 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6491 bool *inverse)
6493 int num;
6495 if (!lp_parameter_is_valid(parm_name)) {
6496 *canon_parm = NULL;
6497 return False;
6500 num = map_parameter_canonical(parm_name, inverse);
6501 if (num < 0) {
6502 /* parametric option */
6503 *canon_parm = parm_name;
6504 } else {
6505 *canon_parm = parm_table[num].label;
6508 return True;
6512 /**************************************************************************
6513 Determine the canonical name for a parameter.
6514 Turn the value given into the inverse boolean expression when
6515 the synonym is an invers boolean synonym.
6517 Return True if parm_name is a valid parameter name and
6518 in case it is an invers boolean synonym, if the val string could
6519 successfully be converted to the reverse bool.
6520 Return false in all other cases.
6521 **************************************************************************/
6523 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6524 const char *val,
6525 const char **canon_parm,
6526 const char **canon_val)
6528 int num;
6529 bool inverse;
6531 if (!lp_parameter_is_valid(parm_name)) {
6532 *canon_parm = NULL;
6533 *canon_val = NULL;
6534 return False;
6537 num = map_parameter_canonical(parm_name, &inverse);
6538 if (num < 0) {
6539 /* parametric option */
6540 *canon_parm = parm_name;
6541 *canon_val = val;
6542 } else {
6543 *canon_parm = parm_table[num].label;
6544 if (inverse) {
6545 if (!lp_invert_boolean(val, canon_val)) {
6546 *canon_val = NULL;
6547 return False;
6549 } else {
6550 *canon_val = val;
6554 return True;
6557 /***************************************************************************
6558 Map a parameter's string representation to something we can use.
6559 Returns False if the parameter string is not recognised, else TRUE.
6560 ***************************************************************************/
6562 static int map_parameter(const char *pszParmName)
6564 int iIndex;
6566 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6567 return (-1);
6569 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6570 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6571 return (iIndex);
6573 /* Warn only if it isn't parametric option */
6574 if (strchr(pszParmName, ':') == NULL)
6575 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6576 /* We do return 'fail' for parametric options as well because they are
6577 stored in different storage
6579 return (-1);
6582 /***************************************************************************
6583 Map a parameter's string representation to the index of the canonical
6584 form of the parameter (it might be a synonym).
6585 Returns -1 if the parameter string is not recognised.
6586 ***************************************************************************/
6588 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6590 int parm_num, canon_num;
6591 bool loc_inverse = False;
6593 parm_num = map_parameter(pszParmName);
6594 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6595 /* invalid, parametric or no canidate for synonyms ... */
6596 goto done;
6599 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6600 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6601 parm_num = canon_num;
6602 goto done;
6606 done:
6607 if (inverse != NULL) {
6608 *inverse = loc_inverse;
6610 return parm_num;
6613 /***************************************************************************
6614 return true if parameter number parm1 is a synonym of parameter
6615 number parm2 (parm2 being the principal name).
6616 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6617 False otherwise.
6618 ***************************************************************************/
6620 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6622 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6623 (parm_table[parm1].flags & FLAG_HIDE) &&
6624 !(parm_table[parm2].flags & FLAG_HIDE))
6626 if (inverse != NULL) {
6627 if ((parm_table[parm1].type == P_BOOLREV) &&
6628 (parm_table[parm2].type == P_BOOL))
6630 *inverse = True;
6631 } else {
6632 *inverse = False;
6635 return True;
6637 return False;
6640 /***************************************************************************
6641 Show one parameter's name, type, [values,] and flags.
6642 (helper functions for show_parameter_list)
6643 ***************************************************************************/
6645 static void show_parameter(int parmIndex)
6647 int enumIndex, flagIndex;
6648 int parmIndex2;
6649 bool hadFlag;
6650 bool hadSyn;
6651 bool inverse;
6652 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6653 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6654 "P_ENUM", "P_SEP"};
6655 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6656 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6657 FLAG_HIDE, FLAG_DOS_STRING};
6658 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6659 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6660 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6662 printf("%s=%s", parm_table[parmIndex].label,
6663 type[parm_table[parmIndex].type]);
6664 if (parm_table[parmIndex].type == P_ENUM) {
6665 printf(",");
6666 for (enumIndex=0;
6667 parm_table[parmIndex].enum_list[enumIndex].name;
6668 enumIndex++)
6670 printf("%s%s",
6671 enumIndex ? "|" : "",
6672 parm_table[parmIndex].enum_list[enumIndex].name);
6675 printf(",");
6676 hadFlag = False;
6677 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6678 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6679 printf("%s%s",
6680 hadFlag ? "|" : "",
6681 flag_names[flagIndex]);
6682 hadFlag = True;
6686 /* output synonyms */
6687 hadSyn = False;
6688 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6689 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6690 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6691 parm_table[parmIndex2].label);
6692 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6693 if (!hadSyn) {
6694 printf(" (synonyms: ");
6695 hadSyn = True;
6696 } else {
6697 printf(", ");
6699 printf("%s%s", parm_table[parmIndex2].label,
6700 inverse ? "[i]" : "");
6703 if (hadSyn) {
6704 printf(")");
6707 printf("\n");
6710 /***************************************************************************
6711 Show all parameter's name, type, [values,] and flags.
6712 ***************************************************************************/
6714 void show_parameter_list(void)
6716 int classIndex, parmIndex;
6717 const char *section_names[] = { "local", "global", NULL};
6719 for (classIndex=0; section_names[classIndex]; classIndex++) {
6720 printf("[%s]\n", section_names[classIndex]);
6721 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6722 if (parm_table[parmIndex].p_class == classIndex) {
6723 show_parameter(parmIndex);
6729 /***************************************************************************
6730 Check if a given string correctly represents a boolean value.
6731 ***************************************************************************/
6733 bool lp_string_is_valid_boolean(const char *parm_value)
6735 return set_boolean(parm_value, NULL);
6738 /***************************************************************************
6739 Get the standard string representation of a boolean value ("yes" or "no")
6740 ***************************************************************************/
6742 static const char *get_boolean(bool bool_value)
6744 static const char *yes_str = "yes";
6745 static const char *no_str = "no";
6747 return (bool_value ? yes_str : no_str);
6750 /***************************************************************************
6751 Provide the string of the negated boolean value associated to the boolean
6752 given as a string. Returns False if the passed string does not correctly
6753 represent a boolean.
6754 ***************************************************************************/
6756 bool lp_invert_boolean(const char *str, const char **inverse_str)
6758 bool val;
6760 if (!set_boolean(str, &val)) {
6761 return False;
6764 *inverse_str = get_boolean(!val);
6765 return True;
6768 /***************************************************************************
6769 Provide the canonical string representation of a boolean value given
6770 as a string. Return True on success, False if the string given does
6771 not correctly represent a boolean.
6772 ***************************************************************************/
6774 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6776 bool val;
6778 if (!set_boolean(str, &val)) {
6779 return False;
6782 *canon_str = get_boolean(val);
6783 return True;
6786 /***************************************************************************
6787 Find a service by name. Otherwise works like get_service.
6788 ***************************************************************************/
6790 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6792 int iService = -1;
6793 char *canon_name;
6794 TDB_DATA data;
6796 if (ServiceHash == NULL) {
6797 return -1;
6800 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6802 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6804 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6805 iService = *(int *)data.dptr;
6808 TALLOC_FREE(canon_name);
6810 if ((iService != -1) && (LP_SNUM_OK(iService))
6811 && (pserviceDest != NULL)) {
6812 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6815 return (iService);
6818 /***************************************************************************
6819 Copy a service structure to another.
6820 If pcopymapDest is NULL then copy all fields
6821 ***************************************************************************/
6824 * Add a parametric option to a param_opt_struct,
6825 * replacing old value, if already present.
6827 static void set_param_opt(struct param_opt_struct **opt_list,
6828 const char *opt_name,
6829 const char *opt_value)
6831 struct param_opt_struct *new_opt, *opt;
6832 bool not_added;
6834 if (opt_list == NULL) {
6835 return;
6838 opt = *opt_list;
6839 not_added = true;
6841 /* Traverse destination */
6842 while (opt) {
6843 /* If we already have same option, override it */
6844 if (strwicmp(opt->key, opt_name) == 0) {
6845 string_free(&opt->value);
6846 TALLOC_FREE(opt->list);
6847 opt->value = SMB_STRDUP(opt_value);
6848 not_added = false;
6849 break;
6851 opt = opt->next;
6853 if (not_added) {
6854 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6855 new_opt->key = SMB_STRDUP(opt_name);
6856 new_opt->value = SMB_STRDUP(opt_value);
6857 new_opt->list = NULL;
6858 DLIST_ADD(*opt_list, new_opt);
6862 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6863 struct bitmap *pcopymapDest)
6865 int i;
6866 bool bcopyall = (pcopymapDest == NULL);
6867 struct param_opt_struct *data;
6869 for (i = 0; parm_table[i].label; i++)
6870 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6871 (bcopyall || bitmap_query(pcopymapDest,i))) {
6872 void *def_ptr = parm_table[i].ptr;
6873 void *src_ptr =
6874 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6875 &sDefault);
6876 void *dest_ptr =
6877 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6878 &sDefault);
6880 switch (parm_table[i].type) {
6881 case P_BOOL:
6882 case P_BOOLREV:
6883 *(bool *)dest_ptr = *(bool *)src_ptr;
6884 break;
6886 case P_INTEGER:
6887 case P_ENUM:
6888 case P_OCTAL:
6889 *(int *)dest_ptr = *(int *)src_ptr;
6890 break;
6892 case P_CHAR:
6893 *(char *)dest_ptr = *(char *)src_ptr;
6894 break;
6896 case P_STRING:
6897 string_set((char **)dest_ptr,
6898 *(char **)src_ptr);
6899 break;
6901 case P_USTRING:
6902 string_set((char **)dest_ptr,
6903 *(char **)src_ptr);
6904 strupper_m(*(char **)dest_ptr);
6905 break;
6906 case P_LIST:
6907 TALLOC_FREE(*((char ***)dest_ptr));
6908 *((char ***)dest_ptr) = str_list_copy(NULL,
6909 *(const char ***)src_ptr);
6910 break;
6911 default:
6912 break;
6916 if (bcopyall) {
6917 init_copymap(pserviceDest);
6918 if (pserviceSource->copymap)
6919 bitmap_copy(pserviceDest->copymap,
6920 pserviceSource->copymap);
6923 data = pserviceSource->param_opt;
6924 while (data) {
6925 set_param_opt(&pserviceDest->param_opt, data->key, data->value);
6926 data = data->next;
6930 /***************************************************************************
6931 Check a service for consistency. Return False if the service is in any way
6932 incomplete or faulty, else True.
6933 ***************************************************************************/
6935 bool service_ok(int iService)
6937 bool bRetval;
6939 bRetval = True;
6940 if (ServicePtrs[iService]->szService[0] == '\0') {
6941 DEBUG(0, ("The following message indicates an internal error:\n"));
6942 DEBUG(0, ("No service name in service entry.\n"));
6943 bRetval = False;
6946 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6947 /* I can't see why you'd want a non-printable printer service... */
6948 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6949 if (!ServicePtrs[iService]->bPrint_ok) {
6950 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6951 ServicePtrs[iService]->szService));
6952 ServicePtrs[iService]->bPrint_ok = True;
6954 /* [printers] service must also be non-browsable. */
6955 if (ServicePtrs[iService]->bBrowseable)
6956 ServicePtrs[iService]->bBrowseable = False;
6959 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6960 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6961 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6963 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6964 ServicePtrs[iService]->szService));
6965 ServicePtrs[iService]->bAvailable = False;
6968 /* If a service is flagged unavailable, log the fact at level 1. */
6969 if (!ServicePtrs[iService]->bAvailable)
6970 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6971 ServicePtrs[iService]->szService));
6973 return (bRetval);
6976 static struct smbconf_ctx *lp_smbconf_ctx(void)
6978 WERROR werr;
6979 static struct smbconf_ctx *conf_ctx = NULL;
6981 if (conf_ctx == NULL) {
6982 werr = smbconf_init(NULL, &conf_ctx, "registry:");
6983 if (!W_ERROR_IS_OK(werr)) {
6984 DEBUG(1, ("error initializing registry configuration: "
6985 "%s\n", win_errstr(werr)));
6986 conf_ctx = NULL;
6990 return conf_ctx;
6993 static bool process_smbconf_service(struct smbconf_service *service)
6995 uint32_t count;
6996 bool ret;
6998 if (service == NULL) {
6999 return false;
7002 ret = do_section(service->name, NULL);
7003 if (ret != true) {
7004 return false;
7006 for (count = 0; count < service->num_params; count++) {
7007 ret = do_parameter(service->param_names[count],
7008 service->param_values[count],
7009 NULL);
7010 if (ret != true) {
7011 return false;
7014 if (iServiceIndex >= 0) {
7015 return service_ok(iServiceIndex);
7017 return true;
7021 * load a service from registry and activate it
7023 bool process_registry_service(const char *service_name)
7025 WERROR werr;
7026 struct smbconf_service *service = NULL;
7027 TALLOC_CTX *mem_ctx = talloc_stackframe();
7028 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7029 bool ret = false;
7031 if (conf_ctx == NULL) {
7032 goto done;
7035 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7037 if (!smbconf_share_exists(conf_ctx, service_name)) {
7039 * Registry does not contain data for this service (yet),
7040 * but make sure lp_load doesn't return false.
7042 ret = true;
7043 goto done;
7046 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7047 if (!W_ERROR_IS_OK(werr)) {
7048 goto done;
7051 ret = process_smbconf_service(service);
7052 if (!ret) {
7053 goto done;
7056 /* store the csn */
7057 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7059 done:
7060 TALLOC_FREE(mem_ctx);
7061 return ret;
7065 * process_registry_globals
7067 static bool process_registry_globals(void)
7069 bool ret;
7071 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7073 ret = do_parameter("registry shares", "yes", NULL);
7074 if (!ret) {
7075 return ret;
7078 return process_registry_service(GLOBAL_NAME);
7081 bool process_registry_shares(void)
7083 WERROR werr;
7084 uint32_t count;
7085 struct smbconf_service **service = NULL;
7086 uint32_t num_shares = 0;
7087 TALLOC_CTX *mem_ctx = talloc_stackframe();
7088 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7089 bool ret = false;
7091 if (conf_ctx == NULL) {
7092 goto done;
7095 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7096 if (!W_ERROR_IS_OK(werr)) {
7097 goto done;
7100 ret = true;
7102 for (count = 0; count < num_shares; count++) {
7103 if (strequal(service[count]->name, GLOBAL_NAME)) {
7104 continue;
7106 ret = process_smbconf_service(service[count]);
7107 if (!ret) {
7108 goto done;
7112 /* store the csn */
7113 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7115 done:
7116 TALLOC_FREE(mem_ctx);
7117 return ret;
7120 #define MAX_INCLUDE_DEPTH 100
7122 static uint8_t include_depth;
7124 static struct file_lists {
7125 struct file_lists *next;
7126 char *name;
7127 char *subfname;
7128 time_t modtime;
7129 } *file_lists = NULL;
7131 /*******************************************************************
7132 Keep a linked list of all config files so we know when one has changed
7133 it's date and needs to be reloaded.
7134 ********************************************************************/
7136 static void add_to_file_list(const char *fname, const char *subfname)
7138 struct file_lists *f = file_lists;
7140 while (f) {
7141 if (f->name && !strcmp(f->name, fname))
7142 break;
7143 f = f->next;
7146 if (!f) {
7147 f = SMB_MALLOC_P(struct file_lists);
7148 if (!f)
7149 return;
7150 f->next = file_lists;
7151 f->name = SMB_STRDUP(fname);
7152 if (!f->name) {
7153 SAFE_FREE(f);
7154 return;
7156 f->subfname = SMB_STRDUP(subfname);
7157 if (!f->subfname) {
7158 SAFE_FREE(f->name);
7159 SAFE_FREE(f);
7160 return;
7162 file_lists = f;
7163 f->modtime = file_modtime(subfname);
7164 } else {
7165 time_t t = file_modtime(subfname);
7166 if (t)
7167 f->modtime = t;
7169 return;
7173 * Free the file lists
7175 static void free_file_list(void)
7177 struct file_lists *f;
7178 struct file_lists *next;
7180 f = file_lists;
7181 while( f ) {
7182 next = f->next;
7183 SAFE_FREE( f->name );
7184 SAFE_FREE( f->subfname );
7185 SAFE_FREE( f );
7186 f = next;
7188 file_lists = NULL;
7193 * Utility function for outsiders to check if we're running on registry.
7195 bool lp_config_backend_is_registry(void)
7197 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7201 * Utility function to check if the config backend is FILE.
7203 bool lp_config_backend_is_file(void)
7205 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7208 /*******************************************************************
7209 Check if a config file has changed date.
7210 ********************************************************************/
7212 bool lp_file_list_changed(void)
7214 struct file_lists *f = file_lists;
7216 DEBUG(6, ("lp_file_list_changed()\n"));
7218 while (f) {
7219 time_t mod_time;
7221 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7222 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7224 if (conf_ctx == NULL) {
7225 return false;
7227 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7228 NULL))
7230 DEBUGADD(6, ("registry config changed\n"));
7231 return true;
7233 } else {
7234 char *n2 = NULL;
7235 n2 = talloc_sub_basic(talloc_tos(),
7236 get_current_username(),
7237 current_user_info.domain,
7238 f->name);
7239 if (!n2) {
7240 return false;
7242 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7243 f->name, n2, ctime(&f->modtime)));
7245 mod_time = file_modtime(n2);
7247 if (mod_time &&
7248 ((f->modtime != mod_time) ||
7249 (f->subfname == NULL) ||
7250 (strcmp(n2, f->subfname) != 0)))
7252 DEBUGADD(6,
7253 ("file %s modified: %s\n", n2,
7254 ctime(&mod_time)));
7255 f->modtime = mod_time;
7256 SAFE_FREE(f->subfname);
7257 f->subfname = SMB_STRDUP(n2);
7258 TALLOC_FREE(n2);
7259 return true;
7261 TALLOC_FREE(n2);
7263 f = f->next;
7265 return (False);
7269 /***************************************************************************
7270 Run standard_sub_basic on netbios name... needed because global_myname
7271 is not accessed through any lp_ macro.
7272 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7273 ***************************************************************************/
7275 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7277 bool ret;
7278 char *netbios_name = talloc_sub_basic(
7279 talloc_tos(), get_current_username(), current_user_info.domain,
7280 pszParmValue);
7282 ret = set_global_myname(netbios_name);
7283 TALLOC_FREE(netbios_name);
7284 string_set(&Globals.szNetbiosName,global_myname());
7286 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7287 global_myname()));
7289 return ret;
7292 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7294 if (strcmp(*ptr, pszParmValue) != 0) {
7295 string_set(ptr, pszParmValue);
7296 init_iconv();
7298 return True;
7303 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7305 bool ret;
7307 ret = set_global_myworkgroup(pszParmValue);
7308 string_set(&Globals.szWorkgroup,lp_workgroup());
7310 return ret;
7313 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7315 bool ret;
7317 ret = set_global_scope(pszParmValue);
7318 string_set(&Globals.szNetbiosScope,global_scope());
7320 return ret;
7323 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7325 TALLOC_FREE(Globals.szNetbiosAliases);
7326 Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL);
7327 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7330 /***************************************************************************
7331 Handle the include operation.
7332 ***************************************************************************/
7333 static bool bAllowIncludeRegistry = true;
7335 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7337 char *fname;
7339 if (include_depth >= MAX_INCLUDE_DEPTH) {
7340 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7341 include_depth));
7342 return false;
7345 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7346 if (!bAllowIncludeRegistry) {
7347 return true;
7349 if (bInGlobalSection) {
7350 bool ret;
7351 include_depth++;
7352 ret = process_registry_globals();
7353 include_depth--;
7354 return ret;
7355 } else {
7356 DEBUG(1, ("\"include = registry\" only effective "
7357 "in %s section\n", GLOBAL_NAME));
7358 return false;
7362 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7363 current_user_info.domain,
7364 pszParmValue);
7366 add_to_file_list(pszParmValue, fname);
7368 string_set(ptr, fname);
7370 if (file_exist(fname)) {
7371 bool ret;
7372 include_depth++;
7373 ret = pm_process(fname, do_section, do_parameter, NULL);
7374 include_depth--;
7375 TALLOC_FREE(fname);
7376 return ret;
7379 DEBUG(2, ("Can't find include file %s\n", fname));
7380 TALLOC_FREE(fname);
7381 return true;
7384 /***************************************************************************
7385 Handle the interpretation of the copy parameter.
7386 ***************************************************************************/
7388 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7390 bool bRetval;
7391 int iTemp;
7392 struct service serviceTemp;
7394 string_set(ptr, pszParmValue);
7396 init_service(&serviceTemp);
7398 bRetval = False;
7400 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7402 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7403 if (iTemp == iServiceIndex) {
7404 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7405 } else {
7406 copy_service(ServicePtrs[iServiceIndex],
7407 &serviceTemp,
7408 ServicePtrs[iServiceIndex]->copymap);
7409 bRetval = True;
7411 } else {
7412 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7413 bRetval = False;
7416 free_service(&serviceTemp);
7417 return (bRetval);
7420 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7422 Globals.ldap_debug_level = lp_int(pszParmValue);
7423 init_ldap_debugging();
7424 return true;
7427 /***************************************************************************
7428 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7429 parameters is:
7431 [global]
7433 idmap uid = 1000-1999
7434 idmap gid = 700-899
7436 We only do simple parsing checks here. The strings are parsed into useful
7437 structures in the idmap daemon code.
7439 ***************************************************************************/
7441 /* Some lp_ routines to return idmap [ug]id information */
7443 static uid_t idmap_uid_low, idmap_uid_high;
7444 static gid_t idmap_gid_low, idmap_gid_high;
7446 bool lp_idmap_uid(uid_t *low, uid_t *high)
7448 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7449 return False;
7451 if (low)
7452 *low = idmap_uid_low;
7454 if (high)
7455 *high = idmap_uid_high;
7457 return True;
7460 bool lp_idmap_gid(gid_t *low, gid_t *high)
7462 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7463 return False;
7465 if (low)
7466 *low = idmap_gid_low;
7468 if (high)
7469 *high = idmap_gid_high;
7471 return True;
7474 /* Do some simple checks on "idmap [ug]id" parameter values */
7476 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7478 uint32 low, high;
7480 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7481 return False;
7483 /* Parse OK */
7485 string_set(ptr, pszParmValue);
7487 idmap_uid_low = low;
7488 idmap_uid_high = high;
7490 return True;
7493 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7495 uint32 low, high;
7497 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7498 return False;
7500 /* Parse OK */
7502 string_set(ptr, pszParmValue);
7504 idmap_gid_low = low;
7505 idmap_gid_high = high;
7507 return True;
7510 /***************************************************************************
7511 Handle the DEBUG level list.
7512 ***************************************************************************/
7514 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7516 string_set(ptr, pszParmValueIn);
7517 return debug_parse_levels(pszParmValueIn);
7520 /***************************************************************************
7521 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7522 ***************************************************************************/
7524 static const char *append_ldap_suffix( const char *str )
7526 const char *suffix_string;
7529 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7530 Globals.szLdapSuffix );
7531 if ( !suffix_string ) {
7532 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7533 return "";
7536 return suffix_string;
7539 const char *lp_ldap_machine_suffix(void)
7541 if (Globals.szLdapMachineSuffix[0])
7542 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7544 return lp_string(Globals.szLdapSuffix);
7547 const char *lp_ldap_user_suffix(void)
7549 if (Globals.szLdapUserSuffix[0])
7550 return append_ldap_suffix(Globals.szLdapUserSuffix);
7552 return lp_string(Globals.szLdapSuffix);
7555 const char *lp_ldap_group_suffix(void)
7557 if (Globals.szLdapGroupSuffix[0])
7558 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7560 return lp_string(Globals.szLdapSuffix);
7563 const char *lp_ldap_idmap_suffix(void)
7565 if (Globals.szLdapIdmapSuffix[0])
7566 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7568 return lp_string(Globals.szLdapSuffix);
7571 /****************************************************************************
7572 set the value for a P_ENUM
7573 ***************************************************************************/
7575 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7576 int *ptr )
7578 int i;
7580 for (i = 0; parm->enum_list[i].name; i++) {
7581 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7582 *ptr = parm->enum_list[i].value;
7583 return;
7586 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7587 pszParmValue, parm->label));
7590 /***************************************************************************
7591 ***************************************************************************/
7593 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7595 static int parm_num = -1;
7596 struct service *s;
7598 if ( parm_num == -1 )
7599 parm_num = map_parameter( "printing" );
7601 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7603 if ( snum < 0 )
7604 s = &sDefault;
7605 else
7606 s = ServicePtrs[snum];
7608 init_printer_values( s );
7610 return True;
7614 /***************************************************************************
7615 Initialise a copymap.
7616 ***************************************************************************/
7618 static void init_copymap(struct service *pservice)
7620 int i;
7622 TALLOC_FREE(pservice->copymap);
7624 pservice->copymap = bitmap_talloc(talloc_autofree_context(),
7625 NUMPARAMETERS);
7626 if (!pservice->copymap)
7627 DEBUG(0,
7628 ("Couldn't allocate copymap!! (size %d)\n",
7629 (int)NUMPARAMETERS));
7630 else
7631 for (i = 0; i < NUMPARAMETERS; i++)
7632 bitmap_set(pservice->copymap, i);
7635 /***************************************************************************
7636 Return the local pointer to a parameter given a service struct and the
7637 pointer into the default structure.
7638 ***************************************************************************/
7640 static void *lp_local_ptr(struct service *service, void *ptr)
7642 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7645 /***************************************************************************
7646 Return the local pointer to a parameter given the service number and the
7647 pointer into the default structure.
7648 ***************************************************************************/
7650 void *lp_local_ptr_by_snum(int snum, void *ptr)
7652 return lp_local_ptr(ServicePtrs[snum], ptr);
7655 /***************************************************************************
7656 Process a parameter for a particular service number. If snum < 0
7657 then assume we are in the globals.
7658 ***************************************************************************/
7660 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7662 int parmnum, i;
7663 void *parm_ptr = NULL; /* where we are going to store the result */
7664 void *def_ptr = NULL;
7665 struct param_opt_struct **opt_list;
7667 parmnum = map_parameter(pszParmName);
7669 if (parmnum < 0) {
7670 if (strchr(pszParmName, ':') == NULL) {
7671 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7672 pszParmName));
7673 return (True);
7677 * We've got a parametric option
7680 opt_list = (snum < 0)
7681 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7682 set_param_opt(opt_list, pszParmName, pszParmValue);
7684 return (True);
7687 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7688 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7689 pszParmName));
7692 def_ptr = parm_table[parmnum].ptr;
7694 /* we might point at a service, the default service or a global */
7695 if (snum < 0) {
7696 parm_ptr = def_ptr;
7697 } else {
7698 if (parm_table[parmnum].p_class == P_GLOBAL) {
7699 DEBUG(0,
7700 ("Global parameter %s found in service section!\n",
7701 pszParmName));
7702 return (True);
7704 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7707 if (snum >= 0) {
7708 if (!ServicePtrs[snum]->copymap)
7709 init_copymap(ServicePtrs[snum]);
7711 /* this handles the aliases - set the copymap for other entries with
7712 the same data pointer */
7713 for (i = 0; parm_table[i].label; i++)
7714 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7715 bitmap_clear(ServicePtrs[snum]->copymap, i);
7718 /* if it is a special case then go ahead */
7719 if (parm_table[parmnum].special) {
7720 return parm_table[parmnum].special(snum, pszParmValue,
7721 (char **)parm_ptr);
7724 /* now switch on the type of variable it is */
7725 switch (parm_table[parmnum].type)
7727 case P_BOOL:
7728 *(bool *)parm_ptr = lp_bool(pszParmValue);
7729 break;
7731 case P_BOOLREV:
7732 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7733 break;
7735 case P_INTEGER:
7736 *(int *)parm_ptr = lp_int(pszParmValue);
7737 break;
7739 case P_CHAR:
7740 *(char *)parm_ptr = *pszParmValue;
7741 break;
7743 case P_OCTAL:
7744 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7745 if ( i != 1 ) {
7746 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7748 break;
7750 case P_LIST:
7751 TALLOC_FREE(*((char ***)parm_ptr));
7752 *(char ***)parm_ptr = str_list_make_v3(
7753 talloc_autofree_context(), pszParmValue, NULL);
7754 break;
7756 case P_STRING:
7757 string_set((char **)parm_ptr, pszParmValue);
7758 break;
7760 case P_USTRING:
7761 string_set((char **)parm_ptr, pszParmValue);
7762 strupper_m(*(char **)parm_ptr);
7763 break;
7765 case P_ENUM:
7766 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7767 break;
7768 case P_SEP:
7769 break;
7772 return (True);
7775 /***************************************************************************
7776 Process a parameter.
7777 ***************************************************************************/
7779 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7780 void *userdata)
7782 if (!bInGlobalSection && bGlobalOnly)
7783 return (True);
7785 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7787 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7788 pszParmName, pszParmValue));
7791 /***************************************************************************
7792 Print a parameter of the specified type.
7793 ***************************************************************************/
7795 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7797 int i;
7798 switch (p->type)
7800 case P_ENUM:
7801 for (i = 0; p->enum_list[i].name; i++) {
7802 if (*(int *)ptr == p->enum_list[i].value) {
7803 fprintf(f, "%s",
7804 p->enum_list[i].name);
7805 break;
7808 break;
7810 case P_BOOL:
7811 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7812 break;
7814 case P_BOOLREV:
7815 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7816 break;
7818 case P_INTEGER:
7819 fprintf(f, "%d", *(int *)ptr);
7820 break;
7822 case P_CHAR:
7823 fprintf(f, "%c", *(char *)ptr);
7824 break;
7826 case P_OCTAL: {
7827 char *o = octal_string(*(int *)ptr);
7828 fprintf(f, "%s", o);
7829 TALLOC_FREE(o);
7830 break;
7833 case P_LIST:
7834 if ((char ***)ptr && *(char ***)ptr) {
7835 char **list = *(char ***)ptr;
7836 for (; *list; list++) {
7837 /* surround strings with whitespace in double quotes */
7838 if ( strchr_m( *list, ' ' ) )
7839 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
7840 else
7841 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
7844 break;
7846 case P_STRING:
7847 case P_USTRING:
7848 if (*(char **)ptr) {
7849 fprintf(f, "%s", *(char **)ptr);
7851 break;
7852 case P_SEP:
7853 break;
7857 /***************************************************************************
7858 Check if two parameters are equal.
7859 ***************************************************************************/
7861 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
7863 switch (type) {
7864 case P_BOOL:
7865 case P_BOOLREV:
7866 return (*((bool *)ptr1) == *((bool *)ptr2));
7868 case P_INTEGER:
7869 case P_ENUM:
7870 case P_OCTAL:
7871 return (*((int *)ptr1) == *((int *)ptr2));
7873 case P_CHAR:
7874 return (*((char *)ptr1) == *((char *)ptr2));
7876 case P_LIST:
7877 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
7879 case P_STRING:
7880 case P_USTRING:
7882 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7883 if (p1 && !*p1)
7884 p1 = NULL;
7885 if (p2 && !*p2)
7886 p2 = NULL;
7887 return (p1 == p2 || strequal(p1, p2));
7889 case P_SEP:
7890 break;
7892 return (False);
7895 /***************************************************************************
7896 Initialize any local varients in the sDefault table.
7897 ***************************************************************************/
7899 void init_locals(void)
7901 /* None as yet. */
7904 /***************************************************************************
7905 Process a new section (service). At this stage all sections are services.
7906 Later we'll have special sections that permit server parameters to be set.
7907 Returns True on success, False on failure.
7908 ***************************************************************************/
7910 static bool do_section(const char *pszSectionName, void *userdata)
7912 bool bRetval;
7913 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7914 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7915 bRetval = False;
7917 /* if we were in a global section then do the local inits */
7918 if (bInGlobalSection && !isglobal)
7919 init_locals();
7921 /* if we've just struck a global section, note the fact. */
7922 bInGlobalSection = isglobal;
7924 /* check for multiple global sections */
7925 if (bInGlobalSection) {
7926 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7927 return (True);
7930 if (!bInGlobalSection && bGlobalOnly)
7931 return (True);
7933 /* if we have a current service, tidy it up before moving on */
7934 bRetval = True;
7936 if (iServiceIndex >= 0)
7937 bRetval = service_ok(iServiceIndex);
7939 /* if all is still well, move to the next record in the services array */
7940 if (bRetval) {
7941 /* We put this here to avoid an odd message order if messages are */
7942 /* issued by the post-processing of a previous section. */
7943 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7945 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
7946 < 0) {
7947 DEBUG(0, ("Failed to add a new service\n"));
7948 return (False);
7952 return (bRetval);
7956 /***************************************************************************
7957 Determine if a partcular base parameter is currentl set to the default value.
7958 ***************************************************************************/
7960 static bool is_default(int i)
7962 if (!defaults_saved)
7963 return False;
7964 switch (parm_table[i].type) {
7965 case P_LIST:
7966 return str_list_equal((const char **)parm_table[i].def.lvalue,
7967 *(const char ***)parm_table[i].ptr);
7968 case P_STRING:
7969 case P_USTRING:
7970 return strequal(parm_table[i].def.svalue,
7971 *(char **)parm_table[i].ptr);
7972 case P_BOOL:
7973 case P_BOOLREV:
7974 return parm_table[i].def.bvalue ==
7975 *(bool *)parm_table[i].ptr;
7976 case P_CHAR:
7977 return parm_table[i].def.cvalue ==
7978 *(char *)parm_table[i].ptr;
7979 case P_INTEGER:
7980 case P_OCTAL:
7981 case P_ENUM:
7982 return parm_table[i].def.ivalue ==
7983 *(int *)parm_table[i].ptr;
7984 case P_SEP:
7985 break;
7987 return False;
7990 /***************************************************************************
7991 Display the contents of the global structure.
7992 ***************************************************************************/
7994 static void dump_globals(FILE *f)
7996 int i;
7997 struct param_opt_struct *data;
7999 fprintf(f, "[global]\n");
8001 for (i = 0; parm_table[i].label; i++)
8002 if (parm_table[i].p_class == P_GLOBAL &&
8003 !(parm_table[i].flags & FLAG_META) &&
8004 parm_table[i].ptr &&
8005 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8006 if (defaults_saved && is_default(i))
8007 continue;
8008 fprintf(f, "\t%s = ", parm_table[i].label);
8009 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8010 fprintf(f, "\n");
8012 if (Globals.param_opt != NULL) {
8013 data = Globals.param_opt;
8014 while(data) {
8015 fprintf(f, "\t%s = %s\n", data->key, data->value);
8016 data = data->next;
8022 /***************************************************************************
8023 Return True if a local parameter is currently set to the global default.
8024 ***************************************************************************/
8026 bool lp_is_default(int snum, struct parm_struct *parm)
8028 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8030 return equal_parameter(parm->type,
8031 ((char *)ServicePtrs[snum]) + pdiff,
8032 ((char *)&sDefault) + pdiff);
8035 /***************************************************************************
8036 Display the contents of a single services record.
8037 ***************************************************************************/
8039 static void dump_a_service(struct service *pService, FILE * f)
8041 int i;
8042 struct param_opt_struct *data;
8044 if (pService != &sDefault)
8045 fprintf(f, "[%s]\n", pService->szService);
8047 for (i = 0; parm_table[i].label; i++) {
8049 if (parm_table[i].p_class == P_LOCAL &&
8050 !(parm_table[i].flags & FLAG_META) &&
8051 parm_table[i].ptr &&
8052 (*parm_table[i].label != '-') &&
8053 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8055 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8057 if (pService == &sDefault) {
8058 if (defaults_saved && is_default(i))
8059 continue;
8060 } else {
8061 if (equal_parameter(parm_table[i].type,
8062 ((char *)pService) +
8063 pdiff,
8064 ((char *)&sDefault) +
8065 pdiff))
8066 continue;
8069 fprintf(f, "\t%s = ", parm_table[i].label);
8070 print_parameter(&parm_table[i],
8071 ((char *)pService) + pdiff, f);
8072 fprintf(f, "\n");
8076 if (pService->param_opt != NULL) {
8077 data = pService->param_opt;
8078 while(data) {
8079 fprintf(f, "\t%s = %s\n", data->key, data->value);
8080 data = data->next;
8085 /***************************************************************************
8086 Display the contents of a parameter of a single services record.
8087 ***************************************************************************/
8089 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8091 int i;
8092 bool result = False;
8093 parm_class p_class;
8094 unsigned flag = 0;
8095 fstring local_parm_name;
8096 char *parm_opt;
8097 const char *parm_opt_value;
8099 /* check for parametrical option */
8100 fstrcpy( local_parm_name, parm_name);
8101 parm_opt = strchr( local_parm_name, ':');
8103 if (parm_opt) {
8104 *parm_opt = '\0';
8105 parm_opt++;
8106 if (strlen(parm_opt)) {
8107 parm_opt_value = lp_parm_const_string( snum,
8108 local_parm_name, parm_opt, NULL);
8109 if (parm_opt_value) {
8110 printf( "%s\n", parm_opt_value);
8111 result = True;
8114 return result;
8117 /* check for a key and print the value */
8118 if (isGlobal) {
8119 p_class = P_GLOBAL;
8120 flag = FLAG_GLOBAL;
8121 } else
8122 p_class = P_LOCAL;
8124 for (i = 0; parm_table[i].label; i++) {
8125 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8126 !(parm_table[i].flags & FLAG_META) &&
8127 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8128 parm_table[i].ptr &&
8129 (*parm_table[i].label != '-') &&
8130 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8132 void *ptr;
8134 if (isGlobal) {
8135 ptr = parm_table[i].ptr;
8136 } else {
8137 struct service *pService = ServicePtrs[snum];
8138 ptr = ((char *)pService) +
8139 PTR_DIFF(parm_table[i].ptr, &sDefault);
8142 print_parameter(&parm_table[i],
8143 ptr, f);
8144 fprintf(f, "\n");
8145 result = True;
8146 break;
8150 return result;
8153 /***************************************************************************
8154 Return info about the requested parameter (given as a string).
8155 Return NULL when the string is not a valid parameter name.
8156 ***************************************************************************/
8158 struct parm_struct *lp_get_parameter(const char *param_name)
8160 int num = map_parameter(param_name);
8162 if (num < 0) {
8163 return NULL;
8166 return &parm_table[num];
8169 /***************************************************************************
8170 Return info about the next parameter in a service.
8171 snum==GLOBAL_SECTION_SNUM gives the globals.
8172 Return NULL when out of parameters.
8173 ***************************************************************************/
8175 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8177 if (snum < 0) {
8178 /* do the globals */
8179 for (; parm_table[*i].label; (*i)++) {
8180 if (parm_table[*i].p_class == P_SEPARATOR)
8181 return &parm_table[(*i)++];
8183 if (!parm_table[*i].ptr
8184 || (*parm_table[*i].label == '-'))
8185 continue;
8187 if ((*i) > 0
8188 && (parm_table[*i].ptr ==
8189 parm_table[(*i) - 1].ptr))
8190 continue;
8192 if (is_default(*i) && !allparameters)
8193 continue;
8195 return &parm_table[(*i)++];
8197 } else {
8198 struct service *pService = ServicePtrs[snum];
8200 for (; parm_table[*i].label; (*i)++) {
8201 if (parm_table[*i].p_class == P_SEPARATOR)
8202 return &parm_table[(*i)++];
8204 if (parm_table[*i].p_class == P_LOCAL &&
8205 parm_table[*i].ptr &&
8206 (*parm_table[*i].label != '-') &&
8207 ((*i) == 0 ||
8208 (parm_table[*i].ptr !=
8209 parm_table[(*i) - 1].ptr)))
8211 int pdiff =
8212 PTR_DIFF(parm_table[*i].ptr,
8213 &sDefault);
8215 if (allparameters ||
8216 !equal_parameter(parm_table[*i].type,
8217 ((char *)pService) +
8218 pdiff,
8219 ((char *)&sDefault) +
8220 pdiff))
8222 return &parm_table[(*i)++];
8228 return NULL;
8232 #if 0
8233 /***************************************************************************
8234 Display the contents of a single copy structure.
8235 ***************************************************************************/
8236 static void dump_copy_map(bool *pcopymap)
8238 int i;
8239 if (!pcopymap)
8240 return;
8242 printf("\n\tNon-Copied parameters:\n");
8244 for (i = 0; parm_table[i].label; i++)
8245 if (parm_table[i].p_class == P_LOCAL &&
8246 parm_table[i].ptr && !pcopymap[i] &&
8247 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8249 printf("\t\t%s\n", parm_table[i].label);
8252 #endif
8254 /***************************************************************************
8255 Return TRUE if the passed service number is within range.
8256 ***************************************************************************/
8258 bool lp_snum_ok(int iService)
8260 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8263 /***************************************************************************
8264 Auto-load some home services.
8265 ***************************************************************************/
8267 static void lp_add_auto_services(char *str)
8269 char *s;
8270 char *p;
8271 int homes;
8272 char *saveptr;
8274 if (!str)
8275 return;
8277 s = SMB_STRDUP(str);
8278 if (!s)
8279 return;
8281 homes = lp_servicenumber(HOMES_NAME);
8283 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8284 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8285 char *home;
8287 if (lp_servicenumber(p) >= 0)
8288 continue;
8290 home = get_user_home_dir(talloc_tos(), p);
8292 if (home && home[0] && homes >= 0)
8293 lp_add_home(p, homes, p, home);
8295 TALLOC_FREE(home);
8297 SAFE_FREE(s);
8300 /***************************************************************************
8301 Auto-load one printer.
8302 ***************************************************************************/
8304 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
8306 int printers = lp_servicenumber(PRINTERS_NAME);
8307 int i;
8309 if (lp_servicenumber(name) < 0) {
8310 lp_add_printer(name, printers);
8311 if ((i = lp_servicenumber(name)) >= 0) {
8312 string_set(&ServicePtrs[i]->comment, comment);
8313 ServicePtrs[i]->autoloaded = True;
8318 /***************************************************************************
8319 Have we loaded a services file yet?
8320 ***************************************************************************/
8322 bool lp_loaded(void)
8324 return (bLoaded);
8327 /***************************************************************************
8328 Unload unused services.
8329 ***************************************************************************/
8331 void lp_killunused(bool (*snumused) (int))
8333 int i;
8334 for (i = 0; i < iNumServices; i++) {
8335 if (!VALID(i))
8336 continue;
8338 /* don't kill autoloaded or usershare services */
8339 if ( ServicePtrs[i]->autoloaded ||
8340 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8341 continue;
8344 if (!snumused || !snumused(i)) {
8345 free_service_byindex(i);
8351 * Kill all except autoloaded and usershare services - convenience wrapper
8353 void lp_kill_all_services(void)
8355 lp_killunused(NULL);
8358 /***************************************************************************
8359 Unload a service.
8360 ***************************************************************************/
8362 void lp_killservice(int iServiceIn)
8364 if (VALID(iServiceIn)) {
8365 free_service_byindex(iServiceIn);
8369 /***************************************************************************
8370 Save the curent values of all global and sDefault parameters into the
8371 defaults union. This allows swat and testparm to show only the
8372 changed (ie. non-default) parameters.
8373 ***************************************************************************/
8375 static void lp_save_defaults(void)
8377 int i;
8378 for (i = 0; parm_table[i].label; i++) {
8379 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8380 continue;
8381 switch (parm_table[i].type) {
8382 case P_LIST:
8383 parm_table[i].def.lvalue = str_list_copy(
8384 NULL, *(const char ***)parm_table[i].ptr);
8385 break;
8386 case P_STRING:
8387 case P_USTRING:
8388 if (parm_table[i].ptr) {
8389 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8390 } else {
8391 parm_table[i].def.svalue = NULL;
8393 break;
8394 case P_BOOL:
8395 case P_BOOLREV:
8396 parm_table[i].def.bvalue =
8397 *(bool *)parm_table[i].ptr;
8398 break;
8399 case P_CHAR:
8400 parm_table[i].def.cvalue =
8401 *(char *)parm_table[i].ptr;
8402 break;
8403 case P_INTEGER:
8404 case P_OCTAL:
8405 case P_ENUM:
8406 parm_table[i].def.ivalue =
8407 *(int *)parm_table[i].ptr;
8408 break;
8409 case P_SEP:
8410 break;
8413 defaults_saved = True;
8416 /*******************************************************************
8417 Set the server type we will announce as via nmbd.
8418 ********************************************************************/
8420 static const struct srv_role_tab {
8421 uint32 role;
8422 const char *role_str;
8423 } srv_role_tab [] = {
8424 { ROLE_STANDALONE, "ROLE_STANDALONE" },
8425 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
8426 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
8427 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
8428 { 0, NULL }
8431 const char* server_role_str(uint32 role)
8433 int i = 0;
8434 for (i=0; srv_role_tab[i].role_str; i++) {
8435 if (role == srv_role_tab[i].role) {
8436 return srv_role_tab[i].role_str;
8439 return NULL;
8442 static void set_server_role(void)
8444 server_role = ROLE_STANDALONE;
8446 switch (lp_security()) {
8447 case SEC_SHARE:
8448 if (lp_domain_logons())
8449 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8450 break;
8451 case SEC_SERVER:
8452 if (lp_domain_logons())
8453 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8454 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8455 server_role = ROLE_STANDALONE;
8456 break;
8457 case SEC_DOMAIN:
8458 if (lp_domain_logons()) {
8459 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8460 server_role = ROLE_DOMAIN_BDC;
8461 break;
8463 server_role = ROLE_DOMAIN_MEMBER;
8464 break;
8465 case SEC_ADS:
8466 if (lp_domain_logons()) {
8467 server_role = ROLE_DOMAIN_PDC;
8468 break;
8470 server_role = ROLE_DOMAIN_MEMBER;
8471 break;
8472 case SEC_USER:
8473 if (lp_domain_logons()) {
8475 if (Globals.iDomainMaster) /* auto or yes */
8476 server_role = ROLE_DOMAIN_PDC;
8477 else
8478 server_role = ROLE_DOMAIN_BDC;
8480 break;
8481 default:
8482 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8483 break;
8486 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
8489 /***********************************************************
8490 If we should send plaintext/LANMAN passwords in the clinet
8491 ************************************************************/
8493 static void set_allowed_client_auth(void)
8495 if (Globals.bClientNTLMv2Auth) {
8496 Globals.bClientLanManAuth = False;
8498 if (!Globals.bClientLanManAuth) {
8499 Globals.bClientPlaintextAuth = False;
8503 /***************************************************************************
8504 JRA.
8505 The following code allows smbd to read a user defined share file.
8506 Yes, this is my intent. Yes, I'm comfortable with that...
8508 THE FOLLOWING IS SECURITY CRITICAL CODE.
8510 It washes your clothes, it cleans your house, it guards you while you sleep...
8511 Do not f%^k with it....
8512 ***************************************************************************/
8514 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8516 /***************************************************************************
8517 Check allowed stat state of a usershare file.
8518 Ensure we print out who is dicking with us so the admin can
8519 get their sorry ass fired.
8520 ***************************************************************************/
8522 static bool check_usershare_stat(const char *fname,
8523 const SMB_STRUCT_STAT *psbuf)
8525 if (!S_ISREG(psbuf->st_ex_mode)) {
8526 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8527 "not a regular file\n",
8528 fname, (unsigned int)psbuf->st_ex_uid ));
8529 return False;
8532 /* Ensure this doesn't have the other write bit set. */
8533 if (psbuf->st_ex_mode & S_IWOTH) {
8534 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8535 "public write. Refusing to allow as a usershare file.\n",
8536 fname, (unsigned int)psbuf->st_ex_uid ));
8537 return False;
8540 /* Should be 10k or less. */
8541 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8542 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8543 "too large (%u) to be a user share file.\n",
8544 fname, (unsigned int)psbuf->st_ex_uid,
8545 (unsigned int)psbuf->st_ex_size ));
8546 return False;
8549 return True;
8552 /***************************************************************************
8553 Parse the contents of a usershare file.
8554 ***************************************************************************/
8556 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8557 SMB_STRUCT_STAT *psbuf,
8558 const char *servicename,
8559 int snum,
8560 char **lines,
8561 int numlines,
8562 char **pp_sharepath,
8563 char **pp_comment,
8564 char **pp_cp_servicename,
8565 struct security_descriptor **ppsd,
8566 bool *pallow_guest)
8568 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8569 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8570 int us_vers;
8571 SMB_STRUCT_DIR *dp;
8572 SMB_STRUCT_STAT sbuf;
8573 char *sharepath = NULL;
8574 char *comment = NULL;
8576 *pp_sharepath = NULL;
8577 *pp_comment = NULL;
8579 *pallow_guest = False;
8581 if (numlines < 4) {
8582 return USERSHARE_MALFORMED_FILE;
8585 if (strcmp(lines[0], "#VERSION 1") == 0) {
8586 us_vers = 1;
8587 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8588 us_vers = 2;
8589 if (numlines < 5) {
8590 return USERSHARE_MALFORMED_FILE;
8592 } else {
8593 return USERSHARE_BAD_VERSION;
8596 if (strncmp(lines[1], "path=", 5) != 0) {
8597 return USERSHARE_MALFORMED_PATH;
8600 sharepath = talloc_strdup(ctx, &lines[1][5]);
8601 if (!sharepath) {
8602 return USERSHARE_POSIX_ERR;
8604 trim_string(sharepath, " ", " ");
8606 if (strncmp(lines[2], "comment=", 8) != 0) {
8607 return USERSHARE_MALFORMED_COMMENT_DEF;
8610 comment = talloc_strdup(ctx, &lines[2][8]);
8611 if (!comment) {
8612 return USERSHARE_POSIX_ERR;
8614 trim_string(comment, " ", " ");
8615 trim_char(comment, '"', '"');
8617 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8618 return USERSHARE_MALFORMED_ACL_DEF;
8621 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8622 return USERSHARE_ACL_ERR;
8625 if (us_vers == 2) {
8626 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8627 return USERSHARE_MALFORMED_ACL_DEF;
8629 if (lines[4][9] == 'y') {
8630 *pallow_guest = True;
8633 /* Backwards compatible extension to file version #2. */
8634 if (numlines > 5) {
8635 if (strncmp(lines[5], "sharename=", 10) != 0) {
8636 return USERSHARE_MALFORMED_SHARENAME_DEF;
8638 if (!strequal(&lines[5][10], servicename)) {
8639 return USERSHARE_BAD_SHARENAME;
8641 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8642 if (!*pp_cp_servicename) {
8643 return USERSHARE_POSIX_ERR;
8648 if (*pp_cp_servicename == NULL) {
8649 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8650 if (!*pp_cp_servicename) {
8651 return USERSHARE_POSIX_ERR;
8655 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8656 /* Path didn't change, no checks needed. */
8657 *pp_sharepath = sharepath;
8658 *pp_comment = comment;
8659 return USERSHARE_OK;
8662 /* The path *must* be absolute. */
8663 if (sharepath[0] != '/') {
8664 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8665 servicename, sharepath));
8666 return USERSHARE_PATH_NOT_ABSOLUTE;
8669 /* If there is a usershare prefix deny list ensure one of these paths
8670 doesn't match the start of the user given path. */
8671 if (prefixdenylist) {
8672 int i;
8673 for ( i=0; prefixdenylist[i]; i++ ) {
8674 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8675 servicename, i, prefixdenylist[i], sharepath ));
8676 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8677 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8678 "usershare prefix deny list entries.\n",
8679 servicename, sharepath));
8680 return USERSHARE_PATH_IS_DENIED;
8685 /* If there is a usershare prefix allow list ensure one of these paths
8686 does match the start of the user given path. */
8688 if (prefixallowlist) {
8689 int i;
8690 for ( i=0; prefixallowlist[i]; i++ ) {
8691 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8692 servicename, i, prefixallowlist[i], sharepath ));
8693 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8694 break;
8697 if (prefixallowlist[i] == NULL) {
8698 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8699 "usershare prefix allow list entries.\n",
8700 servicename, sharepath));
8701 return USERSHARE_PATH_NOT_ALLOWED;
8705 /* Ensure this is pointing to a directory. */
8706 dp = sys_opendir(sharepath);
8708 if (!dp) {
8709 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8710 servicename, sharepath));
8711 return USERSHARE_PATH_NOT_DIRECTORY;
8714 /* Ensure the owner of the usershare file has permission to share
8715 this directory. */
8717 if (sys_stat(sharepath, &sbuf, false) == -1) {
8718 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8719 servicename, sharepath, strerror(errno) ));
8720 sys_closedir(dp);
8721 return USERSHARE_POSIX_ERR;
8724 sys_closedir(dp);
8726 if (!S_ISDIR(sbuf.st_ex_mode)) {
8727 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8728 servicename, sharepath ));
8729 return USERSHARE_PATH_NOT_DIRECTORY;
8732 /* Check if sharing is restricted to owner-only. */
8733 /* psbuf is the stat of the usershare definition file,
8734 sbuf is the stat of the target directory to be shared. */
8736 if (lp_usershare_owner_only()) {
8737 /* root can share anything. */
8738 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8739 return USERSHARE_PATH_NOT_ALLOWED;
8743 *pp_sharepath = sharepath;
8744 *pp_comment = comment;
8745 return USERSHARE_OK;
8748 /***************************************************************************
8749 Deal with a usershare file.
8750 Returns:
8751 >= 0 - snum
8752 -1 - Bad name, invalid contents.
8753 - service name already existed and not a usershare, problem
8754 with permissions to share directory etc.
8755 ***************************************************************************/
8757 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8759 SMB_STRUCT_STAT sbuf;
8760 SMB_STRUCT_STAT lsbuf;
8761 char *fname = NULL;
8762 char *sharepath = NULL;
8763 char *comment = NULL;
8764 char *cp_service_name = NULL;
8765 char **lines = NULL;
8766 int numlines = 0;
8767 int fd = -1;
8768 int iService = -1;
8769 TALLOC_CTX *ctx = talloc_stackframe();
8770 struct security_descriptor *psd = NULL;
8771 bool guest_ok = False;
8772 char *canon_name = NULL;
8773 bool added_service = false;
8774 int ret = -1;
8776 /* Ensure share name doesn't contain invalid characters. */
8777 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8778 DEBUG(0,("process_usershare_file: share name %s contains "
8779 "invalid characters (any of %s)\n",
8780 file_name, INVALID_SHARENAME_CHARS ));
8781 goto out;
8784 canon_name = canonicalize_servicename(ctx, file_name);
8785 if (!canon_name) {
8786 goto out;
8789 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
8790 if (!fname) {
8791 goto out;
8794 /* Minimize the race condition by doing an lstat before we
8795 open and fstat. Ensure this isn't a symlink link. */
8797 if (sys_lstat(fname, &lsbuf, false) != 0) {
8798 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8799 fname, strerror(errno) ));
8800 goto out;
8803 /* This must be a regular file, not a symlink, directory or
8804 other strange filetype. */
8805 if (!check_usershare_stat(fname, &lsbuf)) {
8806 goto out;
8810 TDB_DATA data = dbwrap_fetch_bystring(
8811 ServiceHash, canon_name, canon_name);
8813 iService = -1;
8815 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8816 iService = *(int *)data.dptr;
8820 if (iService != -1 &&
8821 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8822 &lsbuf.st_ex_mtime) == 0) {
8823 /* Nothing changed - Mark valid and return. */
8824 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8825 canon_name ));
8826 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8827 ret = iService;
8828 goto out;
8831 /* Try and open the file read only - no symlinks allowed. */
8832 #ifdef O_NOFOLLOW
8833 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8834 #else
8835 fd = sys_open(fname, O_RDONLY, 0);
8836 #endif
8838 if (fd == -1) {
8839 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8840 fname, strerror(errno) ));
8841 goto out;
8844 /* Now fstat to be *SURE* it's a regular file. */
8845 if (sys_fstat(fd, &sbuf, false) != 0) {
8846 close(fd);
8847 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8848 fname, strerror(errno) ));
8849 goto out;
8852 /* Is it the same dev/inode as was lstated ? */
8853 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
8854 close(fd);
8855 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8856 "Symlink spoofing going on ?\n", fname ));
8857 goto out;
8860 /* This must be a regular file, not a symlink, directory or
8861 other strange filetype. */
8862 if (!check_usershare_stat(fname, &sbuf)) {
8863 goto out;
8866 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8868 close(fd);
8869 if (lines == NULL) {
8870 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8871 fname, (unsigned int)sbuf.st_ex_uid ));
8872 goto out;
8875 if (parse_usershare_file(ctx, &sbuf, file_name,
8876 iService, lines, numlines, &sharepath,
8877 &comment, &cp_service_name,
8878 &psd, &guest_ok) != USERSHARE_OK) {
8879 goto out;
8882 /* Everything ok - add the service possibly using a template. */
8883 if (iService < 0) {
8884 const struct service *sp = &sDefault;
8885 if (snum_template != -1) {
8886 sp = ServicePtrs[snum_template];
8889 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
8890 DEBUG(0, ("process_usershare_file: Failed to add "
8891 "new service %s\n", cp_service_name));
8892 goto out;
8895 added_service = true;
8897 /* Read only is controlled by usershare ACL below. */
8898 ServicePtrs[iService]->bRead_only = False;
8901 /* Write the ACL of the new/modified share. */
8902 if (!set_share_security(canon_name, psd)) {
8903 DEBUG(0, ("process_usershare_file: Failed to set share "
8904 "security for user share %s\n",
8905 canon_name ));
8906 goto out;
8909 /* If from a template it may be marked invalid. */
8910 ServicePtrs[iService]->valid = True;
8912 /* Set the service as a valid usershare. */
8913 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8915 /* Set guest access. */
8916 if (lp_usershare_allow_guests()) {
8917 ServicePtrs[iService]->bGuest_ok = guest_ok;
8920 /* And note when it was loaded. */
8921 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
8922 string_set(&ServicePtrs[iService]->szPath, sharepath);
8923 string_set(&ServicePtrs[iService]->comment, comment);
8925 ret = iService;
8927 out:
8929 if (ret == -1 && iService != -1 && added_service) {
8930 lp_remove_service(iService);
8933 TALLOC_FREE(lines);
8934 TALLOC_FREE(ctx);
8935 return ret;
8938 /***************************************************************************
8939 Checks if a usershare entry has been modified since last load.
8940 ***************************************************************************/
8942 static bool usershare_exists(int iService, struct timespec *last_mod)
8944 SMB_STRUCT_STAT lsbuf;
8945 const char *usersharepath = Globals.szUsersharePath;
8946 char *fname;
8948 if (asprintf(&fname, "%s/%s",
8949 usersharepath,
8950 ServicePtrs[iService]->szService) < 0) {
8951 return false;
8954 if (sys_lstat(fname, &lsbuf, false) != 0) {
8955 SAFE_FREE(fname);
8956 return false;
8959 if (!S_ISREG(lsbuf.st_ex_mode)) {
8960 SAFE_FREE(fname);
8961 return false;
8964 SAFE_FREE(fname);
8965 *last_mod = lsbuf.st_ex_mtime;
8966 return true;
8969 /***************************************************************************
8970 Load a usershare service by name. Returns a valid servicenumber or -1.
8971 ***************************************************************************/
8973 int load_usershare_service(const char *servicename)
8975 SMB_STRUCT_STAT sbuf;
8976 const char *usersharepath = Globals.szUsersharePath;
8977 int max_user_shares = Globals.iUsershareMaxShares;
8978 int snum_template = -1;
8980 if (*usersharepath == 0 || max_user_shares == 0) {
8981 return -1;
8984 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8985 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8986 usersharepath, strerror(errno) ));
8987 return -1;
8990 if (!S_ISDIR(sbuf.st_ex_mode)) {
8991 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8992 usersharepath ));
8993 return -1;
8997 * This directory must be owned by root, and have the 't' bit set.
8998 * It also must not be writable by "other".
9001 #ifdef S_ISVTX
9002 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9003 #else
9004 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9005 #endif
9006 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9007 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9008 usersharepath ));
9009 return -1;
9012 /* Ensure the template share exists if it's set. */
9013 if (Globals.szUsershareTemplateShare[0]) {
9014 /* We can't use lp_servicenumber here as we are recommending that
9015 template shares have -valid=False set. */
9016 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9017 if (ServicePtrs[snum_template]->szService &&
9018 strequal(ServicePtrs[snum_template]->szService,
9019 Globals.szUsershareTemplateShare)) {
9020 break;
9024 if (snum_template == -1) {
9025 DEBUG(0,("load_usershare_service: usershare template share %s "
9026 "does not exist.\n",
9027 Globals.szUsershareTemplateShare ));
9028 return -1;
9032 return process_usershare_file(usersharepath, servicename, snum_template);
9035 /***************************************************************************
9036 Load all user defined shares from the user share directory.
9037 We only do this if we're enumerating the share list.
9038 This is the function that can delete usershares that have
9039 been removed.
9040 ***************************************************************************/
9042 int load_usershare_shares(void)
9044 SMB_STRUCT_DIR *dp;
9045 SMB_STRUCT_STAT sbuf;
9046 SMB_STRUCT_DIRENT *de;
9047 int num_usershares = 0;
9048 int max_user_shares = Globals.iUsershareMaxShares;
9049 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9050 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9051 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9052 int iService;
9053 int snum_template = -1;
9054 const char *usersharepath = Globals.szUsersharePath;
9055 int ret = lp_numservices();
9057 if (max_user_shares == 0 || *usersharepath == '\0') {
9058 return lp_numservices();
9061 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9062 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9063 usersharepath, strerror(errno) ));
9064 return ret;
9068 * This directory must be owned by root, and have the 't' bit set.
9069 * It also must not be writable by "other".
9072 #ifdef S_ISVTX
9073 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9074 #else
9075 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9076 #endif
9077 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9078 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9079 usersharepath ));
9080 return ret;
9083 /* Ensure the template share exists if it's set. */
9084 if (Globals.szUsershareTemplateShare[0]) {
9085 /* We can't use lp_servicenumber here as we are recommending that
9086 template shares have -valid=False set. */
9087 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9088 if (ServicePtrs[snum_template]->szService &&
9089 strequal(ServicePtrs[snum_template]->szService,
9090 Globals.szUsershareTemplateShare)) {
9091 break;
9095 if (snum_template == -1) {
9096 DEBUG(0,("load_usershare_shares: usershare template share %s "
9097 "does not exist.\n",
9098 Globals.szUsershareTemplateShare ));
9099 return ret;
9103 /* Mark all existing usershares as pending delete. */
9104 for (iService = iNumServices - 1; iService >= 0; iService--) {
9105 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9106 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9110 dp = sys_opendir(usersharepath);
9111 if (!dp) {
9112 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9113 usersharepath, strerror(errno) ));
9114 return ret;
9117 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9118 (de = sys_readdir(dp));
9119 num_dir_entries++ ) {
9120 int r;
9121 const char *n = de->d_name;
9123 /* Ignore . and .. */
9124 if (*n == '.') {
9125 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9126 continue;
9130 if (n[0] == ':') {
9131 /* Temporary file used when creating a share. */
9132 num_tmp_dir_entries++;
9135 /* Allow 20% tmp entries. */
9136 if (num_tmp_dir_entries > allowed_tmp_entries) {
9137 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9138 "in directory %s\n",
9139 num_tmp_dir_entries, usersharepath));
9140 break;
9143 r = process_usershare_file(usersharepath, n, snum_template);
9144 if (r == 0) {
9145 /* Update the services count. */
9146 num_usershares++;
9147 if (num_usershares >= max_user_shares) {
9148 DEBUG(0,("load_usershare_shares: max user shares reached "
9149 "on file %s in directory %s\n",
9150 n, usersharepath ));
9151 break;
9153 } else if (r == -1) {
9154 num_bad_dir_entries++;
9157 /* Allow 20% bad entries. */
9158 if (num_bad_dir_entries > allowed_bad_entries) {
9159 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9160 "in directory %s\n",
9161 num_bad_dir_entries, usersharepath));
9162 break;
9165 /* Allow 20% bad entries. */
9166 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9167 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9168 "in directory %s\n",
9169 num_dir_entries, usersharepath));
9170 break;
9174 sys_closedir(dp);
9176 /* Sweep through and delete any non-refreshed usershares that are
9177 not currently in use. */
9178 for (iService = iNumServices - 1; iService >= 0; iService--) {
9179 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9180 if (conn_snum_used(iService)) {
9181 continue;
9183 /* Remove from the share ACL db. */
9184 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9185 lp_servicename(iService) ));
9186 delete_share_security(lp_servicename(iService));
9187 free_service_byindex(iService);
9191 return lp_numservices();
9194 /********************************************************
9195 Destroy global resources allocated in this file
9196 ********************************************************/
9198 void gfree_loadparm(void)
9200 int i;
9202 free_file_list();
9204 /* Free resources allocated to services */
9206 for ( i = 0; i < iNumServices; i++ ) {
9207 if ( VALID(i) ) {
9208 free_service_byindex(i);
9212 SAFE_FREE( ServicePtrs );
9213 iNumServices = 0;
9215 /* Now release all resources allocated to global
9216 parameters and the default service */
9218 free_global_parameters();
9222 /***************************************************************************
9223 Allow client apps to specify that they are a client
9224 ***************************************************************************/
9225 void lp_set_in_client(bool b)
9227 in_client = b;
9231 /***************************************************************************
9232 Determine if we're running in a client app
9233 ***************************************************************************/
9234 bool lp_is_in_client(void)
9236 return in_client;
9239 /***************************************************************************
9240 Load the services array from the services file. Return True on success,
9241 False on failure.
9242 ***************************************************************************/
9244 bool lp_load_ex(const char *pszFname,
9245 bool global_only,
9246 bool save_defaults,
9247 bool add_ipc,
9248 bool initialize_globals,
9249 bool allow_include_registry,
9250 bool allow_registry_shares)
9252 char *n2 = NULL;
9253 bool bRetval;
9255 bRetval = False;
9257 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9259 bInGlobalSection = True;
9260 bGlobalOnly = global_only;
9261 bAllowIncludeRegistry = allow_include_registry;
9263 init_globals(! initialize_globals);
9264 debug_init();
9266 free_file_list();
9268 if (save_defaults) {
9269 init_locals();
9270 lp_save_defaults();
9273 free_param_opts(&Globals.param_opt);
9275 /* We get sections first, so have to start 'behind' to make up */
9276 iServiceIndex = -1;
9278 if (lp_config_backend_is_file()) {
9279 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9280 current_user_info.domain,
9281 pszFname);
9282 if (!n2) {
9283 smb_panic("lp_load_ex: out of memory");
9286 add_to_file_list(pszFname, n2);
9288 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9289 TALLOC_FREE(n2);
9291 /* finish up the last section */
9292 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9293 if (bRetval) {
9294 if (iServiceIndex >= 0) {
9295 bRetval = service_ok(iServiceIndex);
9299 if (lp_config_backend_is_registry()) {
9300 /* config backend changed to registry in config file */
9302 * We need to use this extra global variable here to
9303 * survive restart: init_globals uses this as a default
9304 * for ConfigBackend. Otherwise, init_globals would
9305 * send us into an endless loop here.
9307 config_backend = CONFIG_BACKEND_REGISTRY;
9308 /* start over */
9309 DEBUG(1, ("lp_load_ex: changing to config backend "
9310 "registry\n"));
9311 init_globals(false);
9312 lp_kill_all_services();
9313 return lp_load_ex(pszFname, global_only, save_defaults,
9314 add_ipc, initialize_globals,
9315 allow_include_registry,
9316 allow_registry_shares);
9318 } else if (lp_config_backend_is_registry()) {
9319 bRetval = process_registry_globals();
9320 } else {
9321 DEBUG(0, ("Illegal config backend given: %d\n",
9322 lp_config_backend()));
9323 bRetval = false;
9326 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9327 bRetval = process_registry_shares();
9330 lp_add_auto_services(lp_auto_services());
9332 if (add_ipc) {
9333 /* When 'restrict anonymous = 2' guest connections to ipc$
9334 are denied */
9335 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9336 if ( lp_enable_asu_support() ) {
9337 lp_add_ipc("ADMIN$", false);
9341 set_server_role();
9342 set_default_server_announce_type();
9343 set_allowed_client_auth();
9345 bLoaded = True;
9347 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9348 /* if bWINSsupport is true and we are in the client */
9349 if (lp_is_in_client() && Globals.bWINSsupport) {
9350 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9353 init_iconv();
9355 bAllowIncludeRegistry = true;
9357 return (bRetval);
9360 bool lp_load(const char *pszFname,
9361 bool global_only,
9362 bool save_defaults,
9363 bool add_ipc,
9364 bool initialize_globals)
9366 return lp_load_ex(pszFname,
9367 global_only,
9368 save_defaults,
9369 add_ipc,
9370 initialize_globals,
9371 true, false);
9374 bool lp_load_initial_only(const char *pszFname)
9376 return lp_load_ex(pszFname,
9377 true,
9378 false,
9379 false,
9380 true,
9381 false,
9382 false);
9385 bool lp_load_with_registry_shares(const char *pszFname,
9386 bool global_only,
9387 bool save_defaults,
9388 bool add_ipc,
9389 bool initialize_globals)
9391 return lp_load_ex(pszFname,
9392 global_only,
9393 save_defaults,
9394 add_ipc,
9395 initialize_globals,
9396 true,
9397 true);
9400 /***************************************************************************
9401 Return the max number of services.
9402 ***************************************************************************/
9404 int lp_numservices(void)
9406 return (iNumServices);
9409 /***************************************************************************
9410 Display the contents of the services array in human-readable form.
9411 ***************************************************************************/
9413 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9415 int iService;
9417 if (show_defaults)
9418 defaults_saved = False;
9420 dump_globals(f);
9422 dump_a_service(&sDefault, f);
9424 for (iService = 0; iService < maxtoprint; iService++) {
9425 fprintf(f,"\n");
9426 lp_dump_one(f, show_defaults, iService);
9430 /***************************************************************************
9431 Display the contents of one service in human-readable form.
9432 ***************************************************************************/
9434 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9436 if (VALID(snum)) {
9437 if (ServicePtrs[snum]->szService[0] == '\0')
9438 return;
9439 dump_a_service(ServicePtrs[snum], f);
9443 /***************************************************************************
9444 Return the number of the service with the given name, or -1 if it doesn't
9445 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9446 getservicebyname()! This works ONLY if all services have been loaded, and
9447 does not copy the found service.
9448 ***************************************************************************/
9450 int lp_servicenumber(const char *pszServiceName)
9452 int iService;
9453 fstring serviceName;
9455 if (!pszServiceName) {
9456 return GLOBAL_SECTION_SNUM;
9459 for (iService = iNumServices - 1; iService >= 0; iService--) {
9460 if (VALID(iService) && ServicePtrs[iService]->szService) {
9462 * The substitution here is used to support %U is
9463 * service names
9465 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9466 standard_sub_basic(get_current_username(),
9467 current_user_info.domain,
9468 serviceName,sizeof(serviceName));
9469 if (strequal(serviceName, pszServiceName)) {
9470 break;
9475 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9476 struct timespec last_mod;
9478 if (!usershare_exists(iService, &last_mod)) {
9479 /* Remove the share security tdb entry for it. */
9480 delete_share_security(lp_servicename(iService));
9481 /* Remove it from the array. */
9482 free_service_byindex(iService);
9483 /* Doesn't exist anymore. */
9484 return GLOBAL_SECTION_SNUM;
9487 /* Has it been modified ? If so delete and reload. */
9488 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9489 &last_mod) < 0) {
9490 /* Remove it from the array. */
9491 free_service_byindex(iService);
9492 /* and now reload it. */
9493 iService = load_usershare_service(pszServiceName);
9497 if (iService < 0) {
9498 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9499 return GLOBAL_SECTION_SNUM;
9502 return (iService);
9505 bool share_defined(const char *service_name)
9507 return (lp_servicenumber(service_name) != -1);
9510 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9511 const char *sharename)
9513 struct share_params *result;
9514 char *sname;
9515 int snum;
9517 if (!(sname = SMB_STRDUP(sharename))) {
9518 return NULL;
9521 snum = find_service(sname);
9522 SAFE_FREE(sname);
9524 if (snum < 0) {
9525 return NULL;
9528 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9529 DEBUG(0, ("talloc failed\n"));
9530 return NULL;
9533 result->service = snum;
9534 return result;
9537 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9539 struct share_iterator *result;
9541 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9542 DEBUG(0, ("talloc failed\n"));
9543 return NULL;
9546 result->next_id = 0;
9547 return result;
9550 struct share_params *next_share(struct share_iterator *list)
9552 struct share_params *result;
9554 while (!lp_snum_ok(list->next_id) &&
9555 (list->next_id < lp_numservices())) {
9556 list->next_id += 1;
9559 if (list->next_id >= lp_numservices()) {
9560 return NULL;
9563 if (!(result = TALLOC_P(list, struct share_params))) {
9564 DEBUG(0, ("talloc failed\n"));
9565 return NULL;
9568 result->service = list->next_id;
9569 list->next_id += 1;
9570 return result;
9573 struct share_params *next_printer(struct share_iterator *list)
9575 struct share_params *result;
9577 while ((result = next_share(list)) != NULL) {
9578 if (lp_print_ok(result->service)) {
9579 break;
9582 return result;
9586 * This is a hack for a transition period until we transformed all code from
9587 * service numbers to struct share_params.
9590 struct share_params *snum2params_static(int snum)
9592 static struct share_params result;
9593 result.service = snum;
9594 return &result;
9597 /*******************************************************************
9598 A useful volume label function.
9599 ********************************************************************/
9601 const char *volume_label(int snum)
9603 char *ret;
9604 const char *label = lp_volume(snum);
9605 if (!*label) {
9606 label = lp_servicename(snum);
9609 /* This returns a 33 byte guarenteed null terminated string. */
9610 ret = talloc_strndup(talloc_tos(), label, 32);
9611 if (!ret) {
9612 return "";
9614 return ret;
9617 /*******************************************************************
9618 Set the server type we will announce as via nmbd.
9619 ********************************************************************/
9621 static void set_default_server_announce_type(void)
9623 default_server_announce = 0;
9624 default_server_announce |= SV_TYPE_WORKSTATION;
9625 default_server_announce |= SV_TYPE_SERVER;
9626 default_server_announce |= SV_TYPE_SERVER_UNIX;
9628 /* note that the flag should be set only if we have a
9629 printer service but nmbd doesn't actually load the
9630 services so we can't tell --jerry */
9632 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9634 switch (lp_announce_as()) {
9635 case ANNOUNCE_AS_NT_SERVER:
9636 default_server_announce |= SV_TYPE_SERVER_NT;
9637 /* fall through... */
9638 case ANNOUNCE_AS_NT_WORKSTATION:
9639 default_server_announce |= SV_TYPE_NT;
9640 break;
9641 case ANNOUNCE_AS_WIN95:
9642 default_server_announce |= SV_TYPE_WIN95_PLUS;
9643 break;
9644 case ANNOUNCE_AS_WFW:
9645 default_server_announce |= SV_TYPE_WFW;
9646 break;
9647 default:
9648 break;
9651 switch (lp_server_role()) {
9652 case ROLE_DOMAIN_MEMBER:
9653 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9654 break;
9655 case ROLE_DOMAIN_PDC:
9656 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9657 break;
9658 case ROLE_DOMAIN_BDC:
9659 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9660 break;
9661 case ROLE_STANDALONE:
9662 default:
9663 break;
9665 if (lp_time_server())
9666 default_server_announce |= SV_TYPE_TIME_SOURCE;
9668 if (lp_host_msdfs())
9669 default_server_announce |= SV_TYPE_DFS_SERVER;
9672 /***********************************************************
9673 returns role of Samba server
9674 ************************************************************/
9676 int lp_server_role(void)
9678 return server_role;
9681 /***********************************************************
9682 If we are PDC then prefer us as DMB
9683 ************************************************************/
9685 bool lp_domain_master(void)
9687 if (Globals.iDomainMaster == Auto)
9688 return (lp_server_role() == ROLE_DOMAIN_PDC);
9690 return (bool)Globals.iDomainMaster;
9693 /***********************************************************
9694 If we are DMB then prefer us as LMB
9695 ************************************************************/
9697 bool lp_preferred_master(void)
9699 if (Globals.iPreferredMaster == Auto)
9700 return (lp_local_master() && lp_domain_master());
9702 return (bool)Globals.iPreferredMaster;
9705 /*******************************************************************
9706 Remove a service.
9707 ********************************************************************/
9709 void lp_remove_service(int snum)
9711 ServicePtrs[snum]->valid = False;
9712 invalid_services[num_invalid_services++] = snum;
9715 /*******************************************************************
9716 Copy a service.
9717 ********************************************************************/
9719 void lp_copy_service(int snum, const char *new_name)
9721 do_section(new_name, NULL);
9722 if (snum >= 0) {
9723 snum = lp_servicenumber(new_name);
9724 if (snum >= 0)
9725 lp_do_parameter(snum, "copy", lp_servicename(snum));
9730 /*******************************************************************
9731 Get the default server type we will announce as via nmbd.
9732 ********************************************************************/
9734 int lp_default_server_announce(void)
9736 return default_server_announce;
9739 /*******************************************************************
9740 Split the announce version into major and minor numbers.
9741 ********************************************************************/
9743 int lp_major_announce_version(void)
9745 static bool got_major = False;
9746 static int major_version = DEFAULT_MAJOR_VERSION;
9747 char *vers;
9748 char *p;
9750 if (got_major)
9751 return major_version;
9753 got_major = True;
9754 if ((vers = lp_announce_version()) == NULL)
9755 return major_version;
9757 if ((p = strchr_m(vers, '.')) == 0)
9758 return major_version;
9760 *p = '\0';
9761 major_version = atoi(vers);
9762 return major_version;
9765 int lp_minor_announce_version(void)
9767 static bool got_minor = False;
9768 static int minor_version = DEFAULT_MINOR_VERSION;
9769 char *vers;
9770 char *p;
9772 if (got_minor)
9773 return minor_version;
9775 got_minor = True;
9776 if ((vers = lp_announce_version()) == NULL)
9777 return minor_version;
9779 if ((p = strchr_m(vers, '.')) == 0)
9780 return minor_version;
9782 p++;
9783 minor_version = atoi(p);
9784 return minor_version;
9787 /***********************************************************
9788 Set the global name resolution order (used in smbclient).
9789 ************************************************************/
9791 void lp_set_name_resolve_order(const char *new_order)
9793 string_set(&Globals.szNameResolveOrder, new_order);
9796 const char *lp_printername(int snum)
9798 const char *ret = _lp_printername(snum);
9799 if (ret == NULL || (ret != NULL && *ret == '\0'))
9800 ret = lp_const_servicename(snum);
9802 return ret;
9806 /***********************************************************
9807 Allow daemons such as winbindd to fix their logfile name.
9808 ************************************************************/
9810 void lp_set_logfile(const char *name)
9812 string_set(&Globals.szLogFile, name);
9813 debug_set_logfile(name);
9816 /*******************************************************************
9817 Return the max print jobs per queue.
9818 ********************************************************************/
9820 int lp_maxprintjobs(int snum)
9822 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9823 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9824 maxjobs = PRINT_MAX_JOBID - 1;
9826 return maxjobs;
9829 const char *lp_printcapname(void)
9831 if ((Globals.szPrintcapname != NULL) &&
9832 (Globals.szPrintcapname[0] != '\0'))
9833 return Globals.szPrintcapname;
9835 if (sDefault.iPrinting == PRINT_CUPS) {
9836 #ifdef HAVE_CUPS
9837 return "cups";
9838 #else
9839 return "lpstat";
9840 #endif
9843 if (sDefault.iPrinting == PRINT_BSD)
9844 return "/etc/printcap";
9846 return PRINTCAP_NAME;
9849 static uint32 spoolss_state;
9851 bool lp_disable_spoolss( void )
9853 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9854 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9856 return spoolss_state == SVCCTL_STOPPED ? True : False;
9859 void lp_set_spoolss_state( uint32 state )
9861 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9863 spoolss_state = state;
9866 uint32 lp_get_spoolss_state( void )
9868 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9871 /*******************************************************************
9872 Ensure we don't use sendfile if server smb signing is active.
9873 ********************************************************************/
9875 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
9877 bool sign_active = false;
9879 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9880 if (get_Protocol() < PROTOCOL_NT1) {
9881 return false;
9883 if (signing_state) {
9884 sign_active = smb_signing_is_active(signing_state);
9886 return (_lp_use_sendfile(snum) &&
9887 (get_remote_arch() != RA_WIN95) &&
9888 !sign_active);
9891 /*******************************************************************
9892 Turn off sendfile if we find the underlying OS doesn't support it.
9893 ********************************************************************/
9895 void set_use_sendfile(int snum, bool val)
9897 if (LP_SNUM_OK(snum))
9898 ServicePtrs[snum]->bUseSendfile = val;
9899 else
9900 sDefault.bUseSendfile = val;
9903 /*******************************************************************
9904 Turn off storing DOS attributes if this share doesn't support it.
9905 ********************************************************************/
9907 void set_store_dos_attributes(int snum, bool val)
9909 if (!LP_SNUM_OK(snum))
9910 return;
9911 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9914 void lp_set_mangling_method(const char *new_method)
9916 string_set(&Globals.szManglingMethod, new_method);
9919 /*******************************************************************
9920 Global state for POSIX pathname processing.
9921 ********************************************************************/
9923 static bool posix_pathnames;
9925 bool lp_posix_pathnames(void)
9927 return posix_pathnames;
9930 /*******************************************************************
9931 Change everything needed to ensure POSIX pathname processing (currently
9932 not much).
9933 ********************************************************************/
9935 void lp_set_posix_pathnames(void)
9937 posix_pathnames = True;
9940 /*******************************************************************
9941 Global state for POSIX lock processing - CIFS unix extensions.
9942 ********************************************************************/
9944 bool posix_default_lock_was_set;
9945 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9947 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
9949 if (posix_default_lock_was_set) {
9950 return posix_cifsx_locktype;
9951 } else {
9952 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9956 /*******************************************************************
9957 ********************************************************************/
9959 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
9961 posix_default_lock_was_set = True;
9962 posix_cifsx_locktype = val;
9965 int lp_min_receive_file_size(void)
9967 if (Globals.iminreceivefile < 0) {
9968 return 0;
9970 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
9973 /*******************************************************************
9974 If socket address is an empty character string, it is necessary to
9975 define it as "0.0.0.0".
9976 ********************************************************************/
9978 const char *lp_socket_address(void)
9980 char *sock_addr = Globals.szSocketAddress;
9982 if (sock_addr[0] == '\0'){
9983 string_set(&Globals.szSocketAddress, "0.0.0.0");
9985 return Globals.szSocketAddress;
9988 void lp_set_passdb_backend(const char *backend)
9990 string_set(&Globals.szPassdbBackend, backend);
9993 /*******************************************************************
9994 Safe wide links checks.
9995 This helper function always verify the validity of wide links,
9996 even after a configuration file reload.
9997 ********************************************************************/
9999 static bool lp_widelinks_internal(int snum)
10001 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10002 sDefault.bWidelinks);
10005 void widelinks_warning(int snum)
10007 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10008 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10009 "These parameters are incompatible. "
10010 "Wide links will be disabled for this share.\n",
10011 lp_servicename(snum) ));
10015 bool lp_widelinks(int snum)
10017 /* wide links is always incompatible with unix extensions */
10018 if (lp_unix_extensions()) {
10019 return false;
10022 return lp_widelinks_internal(snum);