s4:librpc/rpc: make PyErr_SetDCERPCStatus() static
[Samba/gebeck_regimport.git] / source3 / param / loadparm.c
blob350f3c077caceeb7d9f8d27fc5454f55f8f0e9ce
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"
57 #ifdef HAVE_SYS_SYSCTL_H
58 #include <sys/sysctl.h>
59 #endif
61 #ifdef HAVE_HTTPCONNECTENCRYPT
62 #include <cups/http.h>
63 #endif
65 bool bLoaded = False;
67 extern userdom_struct current_user_info;
69 #ifndef GLOBAL_NAME
70 #define GLOBAL_NAME "global"
71 #endif
73 #ifndef PRINTERS_NAME
74 #define PRINTERS_NAME "printers"
75 #endif
77 #ifndef HOMES_NAME
78 #define HOMES_NAME "homes"
79 #endif
81 /* the special value for the include parameter
82 * to be interpreted not as a file name but to
83 * trigger loading of the global smb.conf options
84 * from registry. */
85 #ifndef INCLUDE_REGISTRY_NAME
86 #define INCLUDE_REGISTRY_NAME "registry"
87 #endif
89 static bool in_client = False; /* Not in the client by default */
90 static struct smbconf_csn conf_last_csn;
92 #define CONFIG_BACKEND_FILE 0
93 #define CONFIG_BACKEND_REGISTRY 1
95 static int config_backend = CONFIG_BACKEND_FILE;
97 /* some helpful bits */
98 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
99 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
101 #define USERSHARE_VALID 1
102 #define USERSHARE_PENDING_DELETE 2
104 static bool defaults_saved = False;
106 struct param_opt_struct {
107 struct param_opt_struct *prev, *next;
108 char *key;
109 char *value;
110 char **list;
114 * This structure describes global (ie., server-wide) parameters.
116 struct global {
117 int ConfigBackend;
118 char *smb_ports;
119 char *dos_charset;
120 char *unix_charset;
121 char *display_charset;
122 char *szPrintcapname;
123 char *szAddPortCommand;
124 char *szEnumPortsCommand;
125 char *szAddPrinterCommand;
126 char *szDeletePrinterCommand;
127 char *szOs2DriverMap;
128 char *szLockDir;
129 char *szStateDir;
130 char *szCacheDir;
131 char *szPidDir;
132 char *szRootdir;
133 char *szDefaultService;
134 char *szGetQuota;
135 char *szSetQuota;
136 char *szMsgCommand;
137 char *szServerString;
138 char *szAutoServices;
139 char *szPasswdProgram;
140 char *szPasswdChat;
141 char *szLogFile;
142 char *szConfigFile;
143 char *szSMBPasswdFile;
144 char *szPrivateDir;
145 char *szPassdbBackend;
146 char **szPreloadModules;
147 char *szPasswordServer;
148 char *szSocketOptions;
149 char *szRealm;
150 char *szAfsUsernameMap;
151 int iAfsTokenLifetime;
152 char *szLogNtTokenCommand;
153 char *szUsernameMap;
154 char *szLogonScript;
155 char *szLogonPath;
156 char *szLogonDrive;
157 char *szLogonHome;
158 char **szWINSservers;
159 char **szInterfaces;
160 char *szRemoteAnnounce;
161 char *szRemoteBrowseSync;
162 char *szSocketAddress;
163 bool bNmbdBindExplicitBroadcast;
164 char *szNISHomeMapName;
165 char *szAnnounceVersion; /* This is initialised in init_globals */
166 char *szWorkgroup;
167 char *szNetbiosName;
168 char **szNetbiosAliases;
169 char *szNetbiosScope;
170 char *szNameResolveOrder;
171 char *szPanicAction;
172 char *szAddUserScript;
173 char *szRenameUserScript;
174 char *szDelUserScript;
175 char *szAddGroupScript;
176 char *szDelGroupScript;
177 char *szAddUserToGroupScript;
178 char *szDelUserFromGroupScript;
179 char *szSetPrimaryGroupScript;
180 char *szAddMachineScript;
181 char *szShutdownScript;
182 char *szAbortShutdownScript;
183 char *szUsernameMapScript;
184 int iUsernameMapCacheTime;
185 char *szCheckPasswordScript;
186 char *szWINSHook;
187 char *szUtmpDir;
188 char *szWtmpDir;
189 bool bUtmp;
190 char *szIdmapUID;
191 char *szIdmapGID;
192 bool bPassdbExpandExplicit;
193 int AlgorithmicRidBase;
194 char *szTemplateHomedir;
195 char *szTemplateShell;
196 char *szWinbindSeparator;
197 bool bWinbindEnumUsers;
198 bool bWinbindEnumGroups;
199 bool bWinbindUseDefaultDomain;
200 bool bWinbindTrustedDomainsOnly;
201 bool bWinbindNestedGroups;
202 int winbind_expand_groups;
203 bool bWinbindRefreshTickets;
204 bool bWinbindOfflineLogon;
205 bool bWinbindNormalizeNames;
206 bool bWinbindRpcOnly;
207 bool bCreateKrb5Conf;
208 char *szIdmapBackend;
209 char *szIdmapAllocBackend;
210 char *szAddShareCommand;
211 char *szChangeShareCommand;
212 char *szDeleteShareCommand;
213 char **szEventLogs;
214 char *szGuestaccount;
215 char *szManglingMethod;
216 char **szServicesList;
217 char *szUsersharePath;
218 char *szUsershareTemplateShare;
219 char **szUsersharePrefixAllowList;
220 char **szUsersharePrefixDenyList;
221 int mangle_prefix;
222 int max_log_size;
223 char *szLogLevel;
224 int max_xmit;
225 int max_mux;
226 int max_open_files;
227 int open_files_db_hash_size;
228 int pwordlevel;
229 int unamelevel;
230 int deadtime;
231 bool getwd_cache;
232 int maxprotocol;
233 int minprotocol;
234 int security;
235 char **AuthMethods;
236 bool paranoid_server_security;
237 int maxdisksize;
238 int lpqcachetime;
239 int iMaxSmbdProcesses;
240 bool bDisableSpoolss;
241 int syslog;
242 int os_level;
243 bool enhanced_browsing;
244 int max_ttl;
245 int max_wins_ttl;
246 int min_wins_ttl;
247 int lm_announce;
248 int lm_interval;
249 int announce_as; /* This is initialised in init_globals */
250 int machine_password_timeout;
251 int map_to_guest;
252 int oplock_break_wait_time;
253 int winbind_cache_time;
254 int winbind_reconnect_delay;
255 int winbind_max_idle_children;
256 char **szWinbindNssInfo;
257 int iLockSpinTime;
258 char *szLdapMachineSuffix;
259 char *szLdapUserSuffix;
260 char *szLdapIdmapSuffix;
261 char *szLdapGroupSuffix;
262 int ldap_ssl;
263 bool ldap_ssl_ads;
264 int ldap_deref;
265 int ldap_follow_referral;
266 char *szLdapSuffix;
267 char *szLdapAdminDn;
268 int ldap_debug_level;
269 int ldap_debug_threshold;
270 int iAclCompat;
271 char *szCupsServer;
272 int CupsEncrypt;
273 char *szIPrintServer;
274 char *ctdbdSocket;
275 char **szClusterAddresses;
276 bool clustering;
277 int ctdb_timeout;
278 int ctdb_locktime_warn_threshold;
279 int ldap_passwd_sync;
280 int ldap_replication_sleep;
281 int ldap_timeout; /* This is initialised in init_globals */
282 int ldap_connection_timeout;
283 int ldap_page_size;
284 bool ldap_delete_dn;
285 bool bMsAddPrinterWizard;
286 bool bDNSproxy;
287 bool bWINSsupport;
288 bool bWINSproxy;
289 bool bLocalMaster;
290 int iPreferredMaster;
291 int iDomainMaster;
292 bool bDomainLogons;
293 char **szInitLogonDelayedHosts;
294 int InitLogonDelay;
295 bool bEncryptPasswords;
296 bool bUpdateEncrypt;
297 int clientSchannel;
298 int serverSchannel;
299 bool bNullPasswords;
300 bool bObeyPamRestrictions;
301 bool bLoadPrinters;
302 int PrintcapCacheTime;
303 bool bLargeReadwrite;
304 bool bReadRaw;
305 bool bWriteRaw;
306 bool bSyslogOnly;
307 bool bBrowseList;
308 bool bNISHomeMap;
309 bool bTimeServer;
310 bool bBindInterfacesOnly;
311 bool bPamPasswordChange;
312 bool bUnixPasswdSync;
313 bool bPasswdChatDebug;
314 int iPasswdChatTimeout;
315 bool bTimestampLogs;
316 bool bNTSmbSupport;
317 bool bNTPipeSupport;
318 bool bNTStatusSupport;
319 bool bStatCache;
320 int iMaxStatCacheSize;
321 bool bKernelOplocks;
322 bool bAllowTrustedDomains;
323 bool bLanmanAuth;
324 bool bNTLMAuth;
325 bool bUseSpnego;
326 bool bClientLanManAuth;
327 bool bClientNTLMv2Auth;
328 bool bClientPlaintextAuth;
329 bool bClientUseSpnego;
330 bool bDebugPrefixTimestamp;
331 bool bDebugHiresTimestamp;
332 bool bDebugPid;
333 bool bDebugUid;
334 bool bDebugClass;
335 bool bEnableCoreFiles;
336 bool bHostMSDfs;
337 bool bUseMmap;
338 bool bHostnameLookups;
339 bool bUnixExtensions;
340 bool bDisableNetbios;
341 char * szDedicatedKeytabFile;
342 int iKerberosMethod;
343 bool bDeferSharingViolations;
344 bool bEnablePrivileges;
345 bool bASUSupport;
346 bool bUsershareOwnerOnly;
347 bool bUsershareAllowGuests;
348 bool bRegistryShares;
349 int restrict_anonymous;
350 int name_cache_timeout;
351 int client_signing;
352 int server_signing;
353 int client_ldap_sasl_wrapping;
354 int iUsershareMaxShares;
355 int iIdmapCacheTime;
356 int iIdmapNegativeCacheTime;
357 bool bResetOnZeroVC;
358 bool bLogWriteableFilesOnExit;
359 int iKeepalive;
360 int iminreceivefile;
361 struct param_opt_struct *param_opt;
362 int cups_connection_timeout;
363 char *szSMBPerfcountModule;
364 bool bMapUntrustedToDomain;
365 bool bAsyncSMBEchoHandler;
366 int ismb2_max_read;
367 int ismb2_max_write;
368 int ismb2_max_trans;
371 static struct global Globals;
374 * This structure describes a single service.
376 struct service {
377 bool valid;
378 bool autoloaded;
379 int usershare;
380 struct timespec usershare_last_mod;
381 char *szService;
382 char *szPath;
383 char *szUsername;
384 char **szInvalidUsers;
385 char **szValidUsers;
386 char **szAdminUsers;
387 char *szCopy;
388 char *szInclude;
389 char *szPreExec;
390 char *szPostExec;
391 char *szRootPreExec;
392 char *szRootPostExec;
393 char *szCupsOptions;
394 char *szPrintcommand;
395 char *szLpqcommand;
396 char *szLprmcommand;
397 char *szLppausecommand;
398 char *szLpresumecommand;
399 char *szQueuepausecommand;
400 char *szQueueresumecommand;
401 char *szPrintername;
402 char *szPrintjobUsername;
403 char *szDontdescend;
404 char **szHostsallow;
405 char **szHostsdeny;
406 char *szMagicScript;
407 char *szMagicOutput;
408 char *szVetoFiles;
409 char *szHideFiles;
410 char *szVetoOplockFiles;
411 char *comment;
412 char *force_user;
413 char *force_group;
414 char **readlist;
415 char **writelist;
416 char **printer_admin;
417 char *volume;
418 char *fstype;
419 char **szVfsObjects;
420 char *szMSDfsProxy;
421 char *szAioWriteBehind;
422 char *szDfree;
423 int iMinPrintSpace;
424 int iMaxPrintJobs;
425 int iMaxReportedPrintJobs;
426 int iWriteCacheSize;
427 int iCreate_mask;
428 int iCreate_force_mode;
429 int iSecurity_mask;
430 int iSecurity_force_mode;
431 int iDir_mask;
432 int iDir_force_mode;
433 int iDir_Security_mask;
434 int iDir_Security_force_mode;
435 int iMaxConnections;
436 int iDefaultCase;
437 int iPrinting;
438 int iOplockContentionLimit;
439 int iCSCPolicy;
440 int iBlock_size;
441 int iDfreeCacheTime;
442 bool bPreexecClose;
443 bool bRootpreexecClose;
444 int iCaseSensitive;
445 bool bCasePreserve;
446 bool bShortCasePreserve;
447 bool bHideDotFiles;
448 bool bHideSpecialFiles;
449 bool bHideUnReadable;
450 bool bHideUnWriteableFiles;
451 bool bBrowseable;
452 bool bAccessBasedShareEnum;
453 bool bAvailable;
454 bool bRead_only;
455 bool bNo_set_dir;
456 bool bGuest_only;
457 bool bAdministrative_share;
458 bool bGuest_ok;
459 bool bPrint_ok;
460 bool bMap_system;
461 bool bMap_hidden;
462 bool bMap_archive;
463 bool bStoreDosAttributes;
464 bool bDmapiSupport;
465 bool bLocking;
466 int iStrictLocking;
467 bool bPosixLocking;
468 bool bShareModes;
469 bool bOpLocks;
470 bool bLevel2OpLocks;
471 bool bOnlyUser;
472 bool bMangledNames;
473 bool bWidelinks;
474 bool bSymlinks;
475 bool bSyncAlways;
476 bool bStrictAllocate;
477 bool bStrictSync;
478 char magic_char;
479 struct bitmap *copymap;
480 bool bDeleteReadonly;
481 bool bFakeOplocks;
482 bool bDeleteVetoFiles;
483 bool bDosFilemode;
484 bool bDosFiletimes;
485 bool bDosFiletimeResolution;
486 bool bFakeDirCreateTimes;
487 bool bBlockingLocks;
488 bool bInheritPerms;
489 bool bInheritACLS;
490 bool bInheritOwner;
491 bool bMSDfsRoot;
492 bool bUseClientDriver;
493 bool bDefaultDevmode;
494 bool bForcePrintername;
495 bool bNTAclSupport;
496 bool bForceUnknownAclUser;
497 bool bUseSendfile;
498 bool bProfileAcls;
499 bool bMap_acl_inherit;
500 bool bAfs_Share;
501 bool bEASupport;
502 bool bAclCheckPermissions;
503 bool bAclMapFullControl;
504 bool bAclGroupControl;
505 bool bChangeNotify;
506 bool bKernelChangeNotify;
507 int iallocation_roundup_size;
508 int iAioReadSize;
509 int iAioWriteSize;
510 int iMap_readonly;
511 int iDirectoryNameCacheSize;
512 int ismb_encrypt;
513 struct param_opt_struct *param_opt;
515 char dummy[3]; /* for alignment */
519 /* This is a default service used to prime a services structure */
520 static struct service sDefault = {
521 True, /* valid */
522 False, /* not autoloaded */
523 0, /* not a usershare */
524 {0, }, /* No last mod time */
525 NULL, /* szService */
526 NULL, /* szPath */
527 NULL, /* szUsername */
528 NULL, /* szInvalidUsers */
529 NULL, /* szValidUsers */
530 NULL, /* szAdminUsers */
531 NULL, /* szCopy */
532 NULL, /* szInclude */
533 NULL, /* szPreExec */
534 NULL, /* szPostExec */
535 NULL, /* szRootPreExec */
536 NULL, /* szRootPostExec */
537 NULL, /* szCupsOptions */
538 NULL, /* szPrintcommand */
539 NULL, /* szLpqcommand */
540 NULL, /* szLprmcommand */
541 NULL, /* szLppausecommand */
542 NULL, /* szLpresumecommand */
543 NULL, /* szQueuepausecommand */
544 NULL, /* szQueueresumecommand */
545 NULL, /* szPrintername */
546 NULL, /* szPrintjobUsername */
547 NULL, /* szDontdescend */
548 NULL, /* szHostsallow */
549 NULL, /* szHostsdeny */
550 NULL, /* szMagicScript */
551 NULL, /* szMagicOutput */
552 NULL, /* szVetoFiles */
553 NULL, /* szHideFiles */
554 NULL, /* szVetoOplockFiles */
555 NULL, /* comment */
556 NULL, /* force user */
557 NULL, /* force group */
558 NULL, /* readlist */
559 NULL, /* writelist */
560 NULL, /* printer admin */
561 NULL, /* volume */
562 NULL, /* fstype */
563 NULL, /* vfs objects */
564 NULL, /* szMSDfsProxy */
565 NULL, /* szAioWriteBehind */
566 NULL, /* szDfree */
567 0, /* iMinPrintSpace */
568 1000, /* iMaxPrintJobs */
569 0, /* iMaxReportedPrintJobs */
570 0, /* iWriteCacheSize */
571 0744, /* iCreate_mask */
572 0000, /* iCreate_force_mode */
573 0777, /* iSecurity_mask */
574 0, /* iSecurity_force_mode */
575 0755, /* iDir_mask */
576 0000, /* iDir_force_mode */
577 0777, /* iDir_Security_mask */
578 0, /* iDir_Security_force_mode */
579 0, /* iMaxConnections */
580 CASE_LOWER, /* iDefaultCase */
581 DEFAULT_PRINTING, /* iPrinting */
582 2, /* iOplockContentionLimit */
583 0, /* iCSCPolicy */
584 1024, /* iBlock_size */
585 0, /* iDfreeCacheTime */
586 False, /* bPreexecClose */
587 False, /* bRootpreexecClose */
588 Auto, /* case sensitive */
589 True, /* case preserve */
590 True, /* short case preserve */
591 True, /* bHideDotFiles */
592 False, /* bHideSpecialFiles */
593 False, /* bHideUnReadable */
594 False, /* bHideUnWriteableFiles */
595 True, /* bBrowseable */
596 False, /* bAccessBasedShareEnum */
597 True, /* bAvailable */
598 True, /* bRead_only */
599 True, /* bNo_set_dir */
600 False, /* bGuest_only */
601 False, /* bAdministrative_share */
602 False, /* bGuest_ok */
603 False, /* bPrint_ok */
604 False, /* bMap_system */
605 False, /* bMap_hidden */
606 True, /* bMap_archive */
607 False, /* bStoreDosAttributes */
608 False, /* bDmapiSupport */
609 True, /* bLocking */
610 Auto, /* iStrictLocking */
611 True, /* bPosixLocking */
612 True, /* bShareModes */
613 True, /* bOpLocks */
614 True, /* bLevel2OpLocks */
615 False, /* bOnlyUser */
616 True, /* bMangledNames */
617 false, /* bWidelinks */
618 True, /* bSymlinks */
619 False, /* bSyncAlways */
620 False, /* bStrictAllocate */
621 False, /* bStrictSync */
622 '~', /* magic char */
623 NULL, /* copymap */
624 False, /* bDeleteReadonly */
625 False, /* bFakeOplocks */
626 False, /* bDeleteVetoFiles */
627 False, /* bDosFilemode */
628 True, /* bDosFiletimes */
629 False, /* bDosFiletimeResolution */
630 False, /* bFakeDirCreateTimes */
631 True, /* bBlockingLocks */
632 False, /* bInheritPerms */
633 False, /* bInheritACLS */
634 False, /* bInheritOwner */
635 False, /* bMSDfsRoot */
636 False, /* bUseClientDriver */
637 True, /* bDefaultDevmode */
638 False, /* bForcePrintername */
639 True, /* bNTAclSupport */
640 False, /* bForceUnknownAclUser */
641 False, /* bUseSendfile */
642 False, /* bProfileAcls */
643 False, /* bMap_acl_inherit */
644 False, /* bAfs_Share */
645 False, /* bEASupport */
646 True, /* bAclCheckPermissions */
647 True, /* bAclMapFullControl */
648 False, /* bAclGroupControl */
649 True, /* bChangeNotify */
650 True, /* bKernelChangeNotify */
651 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
652 0, /* iAioReadSize */
653 0, /* iAioWriteSize */
654 MAP_READONLY_YES, /* iMap_readonly */
655 #ifdef BROKEN_DIRECTORY_HANDLING
656 0, /* iDirectoryNameCacheSize */
657 #else
658 100, /* iDirectoryNameCacheSize */
659 #endif
660 Auto, /* ismb_encrypt */
661 NULL, /* Parametric options */
663 "" /* dummy */
666 /* local variables */
667 static struct service **ServicePtrs = NULL;
668 static int iNumServices = 0;
669 static int iServiceIndex = 0;
670 static struct db_context *ServiceHash;
671 static int *invalid_services = NULL;
672 static int num_invalid_services = 0;
673 static bool bInGlobalSection = True;
674 static bool bGlobalOnly = False;
675 static int server_role;
676 static int default_server_announce;
678 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
680 /* prototypes for the special type handlers */
681 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
682 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
683 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
684 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
685 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
686 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
687 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
688 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
689 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
690 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
691 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
692 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
694 static void set_server_role(void);
695 static void set_default_server_announce_type(void);
696 static void set_allowed_client_auth(void);
698 static void *lp_local_ptr(struct service *service, void *ptr);
700 static void add_to_file_list(const char *fname, const char *subfname);
702 static const struct enum_list enum_protocol[] = {
703 {PROTOCOL_SMB2, "SMB2"},
704 {PROTOCOL_NT1, "NT1"},
705 {PROTOCOL_LANMAN2, "LANMAN2"},
706 {PROTOCOL_LANMAN1, "LANMAN1"},
707 {PROTOCOL_CORE, "CORE"},
708 {PROTOCOL_COREPLUS, "COREPLUS"},
709 {PROTOCOL_COREPLUS, "CORE+"},
710 {-1, NULL}
713 static const struct enum_list enum_security[] = {
714 {SEC_SHARE, "SHARE"},
715 {SEC_USER, "USER"},
716 {SEC_SERVER, "SERVER"},
717 {SEC_DOMAIN, "DOMAIN"},
718 #ifdef HAVE_ADS
719 {SEC_ADS, "ADS"},
720 #endif
721 {-1, NULL}
724 static const struct enum_list enum_printing[] = {
725 {PRINT_SYSV, "sysv"},
726 {PRINT_AIX, "aix"},
727 {PRINT_HPUX, "hpux"},
728 {PRINT_BSD, "bsd"},
729 {PRINT_QNX, "qnx"},
730 {PRINT_PLP, "plp"},
731 {PRINT_LPRNG, "lprng"},
732 {PRINT_CUPS, "cups"},
733 {PRINT_IPRINT, "iprint"},
734 {PRINT_LPRNT, "nt"},
735 {PRINT_LPROS2, "os2"},
736 #ifdef DEVELOPER
737 {PRINT_TEST, "test"},
738 {PRINT_VLP, "vlp"},
739 #endif /* DEVELOPER */
740 {-1, NULL}
743 static const struct enum_list enum_ldap_sasl_wrapping[] = {
744 {0, "plain"},
745 {ADS_AUTH_SASL_SIGN, "sign"},
746 {ADS_AUTH_SASL_SEAL, "seal"},
747 {-1, NULL}
750 static const struct enum_list enum_ldap_ssl[] = {
751 {LDAP_SSL_OFF, "no"},
752 {LDAP_SSL_OFF, "off"},
753 {LDAP_SSL_START_TLS, "start tls"},
754 {LDAP_SSL_START_TLS, "start_tls"},
755 {-1, NULL}
758 /* LDAP Dereferencing Alias types */
759 #define SAMBA_LDAP_DEREF_NEVER 0
760 #define SAMBA_LDAP_DEREF_SEARCHING 1
761 #define SAMBA_LDAP_DEREF_FINDING 2
762 #define SAMBA_LDAP_DEREF_ALWAYS 3
764 static const struct enum_list enum_ldap_deref[] = {
765 {SAMBA_LDAP_DEREF_NEVER, "never"},
766 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
767 {SAMBA_LDAP_DEREF_FINDING, "finding"},
768 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
769 {-1, "auto"}
772 static const struct enum_list enum_ldap_passwd_sync[] = {
773 {LDAP_PASSWD_SYNC_OFF, "no"},
774 {LDAP_PASSWD_SYNC_OFF, "off"},
775 {LDAP_PASSWD_SYNC_ON, "yes"},
776 {LDAP_PASSWD_SYNC_ON, "on"},
777 {LDAP_PASSWD_SYNC_ONLY, "only"},
778 {-1, NULL}
781 /* Types of machine we can announce as. */
782 #define ANNOUNCE_AS_NT_SERVER 1
783 #define ANNOUNCE_AS_WIN95 2
784 #define ANNOUNCE_AS_WFW 3
785 #define ANNOUNCE_AS_NT_WORKSTATION 4
787 static const struct enum_list enum_announce_as[] = {
788 {ANNOUNCE_AS_NT_SERVER, "NT"},
789 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
790 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
791 {ANNOUNCE_AS_WIN95, "win95"},
792 {ANNOUNCE_AS_WFW, "WfW"},
793 {-1, NULL}
796 static const struct enum_list enum_map_readonly[] = {
797 {MAP_READONLY_NO, "no"},
798 {MAP_READONLY_NO, "false"},
799 {MAP_READONLY_NO, "0"},
800 {MAP_READONLY_YES, "yes"},
801 {MAP_READONLY_YES, "true"},
802 {MAP_READONLY_YES, "1"},
803 {MAP_READONLY_PERMISSIONS, "permissions"},
804 {MAP_READONLY_PERMISSIONS, "perms"},
805 {-1, NULL}
808 static const struct enum_list enum_case[] = {
809 {CASE_LOWER, "lower"},
810 {CASE_UPPER, "upper"},
811 {-1, NULL}
816 static const struct enum_list enum_bool_auto[] = {
817 {False, "No"},
818 {False, "False"},
819 {False, "0"},
820 {True, "Yes"},
821 {True, "True"},
822 {True, "1"},
823 {Auto, "Auto"},
824 {-1, NULL}
827 /* Client-side offline caching policy types */
828 #define CSC_POLICY_MANUAL 0
829 #define CSC_POLICY_DOCUMENTS 1
830 #define CSC_POLICY_PROGRAMS 2
831 #define CSC_POLICY_DISABLE 3
833 static const struct enum_list enum_csc_policy[] = {
834 {CSC_POLICY_MANUAL, "manual"},
835 {CSC_POLICY_DOCUMENTS, "documents"},
836 {CSC_POLICY_PROGRAMS, "programs"},
837 {CSC_POLICY_DISABLE, "disable"},
838 {-1, NULL}
841 /* SMB signing types. */
842 static const struct enum_list enum_smb_signing_vals[] = {
843 {False, "No"},
844 {False, "False"},
845 {False, "0"},
846 {False, "Off"},
847 {False, "disabled"},
848 {True, "Yes"},
849 {True, "True"},
850 {True, "1"},
851 {True, "On"},
852 {True, "enabled"},
853 {Auto, "auto"},
854 {Required, "required"},
855 {Required, "mandatory"},
856 {Required, "force"},
857 {Required, "forced"},
858 {Required, "enforced"},
859 {-1, NULL}
862 /* ACL compatibility options. */
863 static const struct enum_list enum_acl_compat_vals[] = {
864 { ACL_COMPAT_AUTO, "auto" },
865 { ACL_COMPAT_WINNT, "winnt" },
866 { ACL_COMPAT_WIN2K, "win2k" },
867 { -1, NULL}
871 Do you want session setups at user level security with a invalid
872 password to be rejected or allowed in as guest? WinNT rejects them
873 but it can be a pain as it means "net view" needs to use a password
875 You have 3 choices in the setting of map_to_guest:
877 "Never" means session setups with an invalid password
878 are rejected. This is the default.
880 "Bad User" means session setups with an invalid password
881 are rejected, unless the username does not exist, in which case it
882 is treated as a guest login
884 "Bad Password" means session setups with an invalid password
885 are treated as a guest login
887 Note that map_to_guest only has an effect in user or server
888 level security.
891 static const struct enum_list enum_map_to_guest[] = {
892 {NEVER_MAP_TO_GUEST, "Never"},
893 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
894 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
895 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
896 {-1, NULL}
899 /* Config backend options */
901 static const struct enum_list enum_config_backend[] = {
902 {CONFIG_BACKEND_FILE, "file"},
903 {CONFIG_BACKEND_REGISTRY, "registry"},
904 {-1, NULL}
907 /* ADS kerberos ticket verification options */
909 static const struct enum_list enum_kerberos_method[] = {
910 {KERBEROS_VERIFY_SECRETS, "default"},
911 {KERBEROS_VERIFY_SECRETS, "secrets only"},
912 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
913 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
914 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
915 {-1, NULL}
918 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
920 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
921 * screen in SWAT. This is used to exclude parameters as well as to squash all
922 * parameters that have been duplicated by pseudonyms.
924 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
925 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
926 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
927 * respective views.
929 * NOTE2: Handling of duplicated (synonym) parameters:
930 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
931 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
932 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
933 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
936 static struct parm_struct parm_table[] = {
937 {N_("Base Options"), P_SEP, P_SEPARATOR},
940 .label = "dos charset",
941 .type = P_STRING,
942 .p_class = P_GLOBAL,
943 .ptr = &Globals.dos_charset,
944 .special = handle_charset,
945 .enum_list = NULL,
946 .flags = FLAG_ADVANCED
949 .label = "unix charset",
950 .type = P_STRING,
951 .p_class = P_GLOBAL,
952 .ptr = &Globals.unix_charset,
953 .special = handle_charset,
954 .enum_list = NULL,
955 .flags = FLAG_ADVANCED
958 .label = "display charset",
959 .type = P_STRING,
960 .p_class = P_GLOBAL,
961 .ptr = &Globals.display_charset,
962 .special = handle_charset,
963 .enum_list = NULL,
964 .flags = FLAG_ADVANCED
967 .label = "comment",
968 .type = P_STRING,
969 .p_class = P_LOCAL,
970 .ptr = &sDefault.comment,
971 .special = NULL,
972 .enum_list = NULL,
973 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
976 .label = "path",
977 .type = P_STRING,
978 .p_class = P_LOCAL,
979 .ptr = &sDefault.szPath,
980 .special = NULL,
981 .enum_list = NULL,
982 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
985 .label = "directory",
986 .type = P_STRING,
987 .p_class = P_LOCAL,
988 .ptr = &sDefault.szPath,
989 .special = NULL,
990 .enum_list = NULL,
991 .flags = FLAG_HIDE,
994 .label = "workgroup",
995 .type = P_USTRING,
996 .p_class = P_GLOBAL,
997 .ptr = &Globals.szWorkgroup,
998 .special = handle_workgroup,
999 .enum_list = NULL,
1000 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1002 #ifdef WITH_ADS
1004 .label = "realm",
1005 .type = P_USTRING,
1006 .p_class = P_GLOBAL,
1007 .ptr = &Globals.szRealm,
1008 .special = NULL,
1009 .enum_list = NULL,
1010 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1012 #endif
1014 .label = "netbios name",
1015 .type = P_USTRING,
1016 .p_class = P_GLOBAL,
1017 .ptr = &Globals.szNetbiosName,
1018 .special = handle_netbios_name,
1019 .enum_list = NULL,
1020 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1023 .label = "netbios aliases",
1024 .type = P_LIST,
1025 .p_class = P_GLOBAL,
1026 .ptr = &Globals.szNetbiosAliases,
1027 .special = handle_netbios_aliases,
1028 .enum_list = NULL,
1029 .flags = FLAG_ADVANCED,
1032 .label = "netbios scope",
1033 .type = P_USTRING,
1034 .p_class = P_GLOBAL,
1035 .ptr = &Globals.szNetbiosScope,
1036 .special = handle_netbios_scope,
1037 .enum_list = NULL,
1038 .flags = FLAG_ADVANCED,
1041 .label = "server string",
1042 .type = P_STRING,
1043 .p_class = P_GLOBAL,
1044 .ptr = &Globals.szServerString,
1045 .special = NULL,
1046 .enum_list = NULL,
1047 .flags = FLAG_BASIC | FLAG_ADVANCED,
1050 .label = "interfaces",
1051 .type = P_LIST,
1052 .p_class = P_GLOBAL,
1053 .ptr = &Globals.szInterfaces,
1054 .special = NULL,
1055 .enum_list = NULL,
1056 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1059 .label = "bind interfaces only",
1060 .type = P_BOOL,
1061 .p_class = P_GLOBAL,
1062 .ptr = &Globals.bBindInterfacesOnly,
1063 .special = NULL,
1064 .enum_list = NULL,
1065 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1068 .label = "config backend",
1069 .type = P_ENUM,
1070 .p_class = P_GLOBAL,
1071 .ptr = &Globals.ConfigBackend,
1072 .special = NULL,
1073 .enum_list = enum_config_backend,
1074 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1077 {N_("Security Options"), P_SEP, P_SEPARATOR},
1080 .label = "security",
1081 .type = P_ENUM,
1082 .p_class = P_GLOBAL,
1083 .ptr = &Globals.security,
1084 .special = NULL,
1085 .enum_list = enum_security,
1086 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1089 .label = "auth methods",
1090 .type = P_LIST,
1091 .p_class = P_GLOBAL,
1092 .ptr = &Globals.AuthMethods,
1093 .special = NULL,
1094 .enum_list = NULL,
1095 .flags = FLAG_ADVANCED,
1098 .label = "encrypt passwords",
1099 .type = P_BOOL,
1100 .p_class = P_GLOBAL,
1101 .ptr = &Globals.bEncryptPasswords,
1102 .special = NULL,
1103 .enum_list = NULL,
1104 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1107 .label = "update encrypted",
1108 .type = P_BOOL,
1109 .p_class = P_GLOBAL,
1110 .ptr = &Globals.bUpdateEncrypt,
1111 .special = NULL,
1112 .enum_list = NULL,
1113 .flags = FLAG_ADVANCED,
1116 .label = "client schannel",
1117 .type = P_ENUM,
1118 .p_class = P_GLOBAL,
1119 .ptr = &Globals.clientSchannel,
1120 .special = NULL,
1121 .enum_list = enum_bool_auto,
1122 .flags = FLAG_BASIC | FLAG_ADVANCED,
1125 .label = "server schannel",
1126 .type = P_ENUM,
1127 .p_class = P_GLOBAL,
1128 .ptr = &Globals.serverSchannel,
1129 .special = NULL,
1130 .enum_list = enum_bool_auto,
1131 .flags = FLAG_BASIC | FLAG_ADVANCED,
1134 .label = "allow trusted domains",
1135 .type = P_BOOL,
1136 .p_class = P_GLOBAL,
1137 .ptr = &Globals.bAllowTrustedDomains,
1138 .special = NULL,
1139 .enum_list = NULL,
1140 .flags = FLAG_ADVANCED,
1143 .label = "map to guest",
1144 .type = P_ENUM,
1145 .p_class = P_GLOBAL,
1146 .ptr = &Globals.map_to_guest,
1147 .special = NULL,
1148 .enum_list = enum_map_to_guest,
1149 .flags = FLAG_ADVANCED,
1152 .label = "null passwords",
1153 .type = P_BOOL,
1154 .p_class = P_GLOBAL,
1155 .ptr = &Globals.bNullPasswords,
1156 .special = NULL,
1157 .enum_list = NULL,
1158 .flags = FLAG_ADVANCED,
1161 .label = "obey pam restrictions",
1162 .type = P_BOOL,
1163 .p_class = P_GLOBAL,
1164 .ptr = &Globals.bObeyPamRestrictions,
1165 .special = NULL,
1166 .enum_list = NULL,
1167 .flags = FLAG_ADVANCED,
1170 .label = "password server",
1171 .type = P_STRING,
1172 .p_class = P_GLOBAL,
1173 .ptr = &Globals.szPasswordServer,
1174 .special = NULL,
1175 .enum_list = NULL,
1176 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1179 .label = "smb passwd file",
1180 .type = P_STRING,
1181 .p_class = P_GLOBAL,
1182 .ptr = &Globals.szSMBPasswdFile,
1183 .special = NULL,
1184 .enum_list = NULL,
1185 .flags = FLAG_ADVANCED,
1188 .label = "private dir",
1189 .type = P_STRING,
1190 .p_class = P_GLOBAL,
1191 .ptr = &Globals.szPrivateDir,
1192 .special = NULL,
1193 .enum_list = NULL,
1194 .flags = FLAG_ADVANCED,
1197 .label = "passdb backend",
1198 .type = P_STRING,
1199 .p_class = P_GLOBAL,
1200 .ptr = &Globals.szPassdbBackend,
1201 .special = NULL,
1202 .enum_list = NULL,
1203 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1206 .label = "algorithmic rid base",
1207 .type = P_INTEGER,
1208 .p_class = P_GLOBAL,
1209 .ptr = &Globals.AlgorithmicRidBase,
1210 .special = NULL,
1211 .enum_list = NULL,
1212 .flags = FLAG_ADVANCED,
1215 .label = "root directory",
1216 .type = P_STRING,
1217 .p_class = P_GLOBAL,
1218 .ptr = &Globals.szRootdir,
1219 .special = NULL,
1220 .enum_list = NULL,
1221 .flags = FLAG_ADVANCED,
1224 .label = "root dir",
1225 .type = P_STRING,
1226 .p_class = P_GLOBAL,
1227 .ptr = &Globals.szRootdir,
1228 .special = NULL,
1229 .enum_list = NULL,
1230 .flags = FLAG_HIDE,
1233 .label = "root",
1234 .type = P_STRING,
1235 .p_class = P_GLOBAL,
1236 .ptr = &Globals.szRootdir,
1237 .special = NULL,
1238 .enum_list = NULL,
1239 .flags = FLAG_HIDE,
1242 .label = "guest account",
1243 .type = P_STRING,
1244 .p_class = P_GLOBAL,
1245 .ptr = &Globals.szGuestaccount,
1246 .special = NULL,
1247 .enum_list = NULL,
1248 .flags = FLAG_BASIC | FLAG_ADVANCED,
1251 .label = "enable privileges",
1252 .type = P_BOOL,
1253 .p_class = P_GLOBAL,
1254 .ptr = &Globals.bEnablePrivileges,
1255 .special = NULL,
1256 .enum_list = NULL,
1257 .flags = FLAG_ADVANCED,
1261 .label = "pam password change",
1262 .type = P_BOOL,
1263 .p_class = P_GLOBAL,
1264 .ptr = &Globals.bPamPasswordChange,
1265 .special = NULL,
1266 .enum_list = NULL,
1267 .flags = FLAG_ADVANCED,
1270 .label = "passwd program",
1271 .type = P_STRING,
1272 .p_class = P_GLOBAL,
1273 .ptr = &Globals.szPasswdProgram,
1274 .special = NULL,
1275 .enum_list = NULL,
1276 .flags = FLAG_ADVANCED,
1279 .label = "passwd chat",
1280 .type = P_STRING,
1281 .p_class = P_GLOBAL,
1282 .ptr = &Globals.szPasswdChat,
1283 .special = NULL,
1284 .enum_list = NULL,
1285 .flags = FLAG_ADVANCED,
1288 .label = "passwd chat debug",
1289 .type = P_BOOL,
1290 .p_class = P_GLOBAL,
1291 .ptr = &Globals.bPasswdChatDebug,
1292 .special = NULL,
1293 .enum_list = NULL,
1294 .flags = FLAG_ADVANCED,
1297 .label = "passwd chat timeout",
1298 .type = P_INTEGER,
1299 .p_class = P_GLOBAL,
1300 .ptr = &Globals.iPasswdChatTimeout,
1301 .special = NULL,
1302 .enum_list = NULL,
1303 .flags = FLAG_ADVANCED,
1306 .label = "check password script",
1307 .type = P_STRING,
1308 .p_class = P_GLOBAL,
1309 .ptr = &Globals.szCheckPasswordScript,
1310 .special = NULL,
1311 .enum_list = NULL,
1312 .flags = FLAG_ADVANCED,
1315 .label = "username map",
1316 .type = P_STRING,
1317 .p_class = P_GLOBAL,
1318 .ptr = &Globals.szUsernameMap,
1319 .special = NULL,
1320 .enum_list = NULL,
1321 .flags = FLAG_ADVANCED,
1324 .label = "password level",
1325 .type = P_INTEGER,
1326 .p_class = P_GLOBAL,
1327 .ptr = &Globals.pwordlevel,
1328 .special = NULL,
1329 .enum_list = NULL,
1330 .flags = FLAG_ADVANCED,
1333 .label = "username level",
1334 .type = P_INTEGER,
1335 .p_class = P_GLOBAL,
1336 .ptr = &Globals.unamelevel,
1337 .special = NULL,
1338 .enum_list = NULL,
1339 .flags = FLAG_ADVANCED,
1342 .label = "unix password sync",
1343 .type = P_BOOL,
1344 .p_class = P_GLOBAL,
1345 .ptr = &Globals.bUnixPasswdSync,
1346 .special = NULL,
1347 .enum_list = NULL,
1348 .flags = FLAG_ADVANCED,
1351 .label = "restrict anonymous",
1352 .type = P_INTEGER,
1353 .p_class = P_GLOBAL,
1354 .ptr = &Globals.restrict_anonymous,
1355 .special = NULL,
1356 .enum_list = NULL,
1357 .flags = FLAG_ADVANCED,
1360 .label = "lanman auth",
1361 .type = P_BOOL,
1362 .p_class = P_GLOBAL,
1363 .ptr = &Globals.bLanmanAuth,
1364 .special = NULL,
1365 .enum_list = NULL,
1366 .flags = FLAG_ADVANCED,
1369 .label = "ntlm auth",
1370 .type = P_BOOL,
1371 .p_class = P_GLOBAL,
1372 .ptr = &Globals.bNTLMAuth,
1373 .special = NULL,
1374 .enum_list = NULL,
1375 .flags = FLAG_ADVANCED,
1378 .label = "client NTLMv2 auth",
1379 .type = P_BOOL,
1380 .p_class = P_GLOBAL,
1381 .ptr = &Globals.bClientNTLMv2Auth,
1382 .special = NULL,
1383 .enum_list = NULL,
1384 .flags = FLAG_ADVANCED,
1387 .label = "client lanman auth",
1388 .type = P_BOOL,
1389 .p_class = P_GLOBAL,
1390 .ptr = &Globals.bClientLanManAuth,
1391 .special = NULL,
1392 .enum_list = NULL,
1393 .flags = FLAG_ADVANCED,
1396 .label = "client plaintext auth",
1397 .type = P_BOOL,
1398 .p_class = P_GLOBAL,
1399 .ptr = &Globals.bClientPlaintextAuth,
1400 .special = NULL,
1401 .enum_list = NULL,
1402 .flags = FLAG_ADVANCED,
1405 .label = "username",
1406 .type = P_STRING,
1407 .p_class = P_LOCAL,
1408 .ptr = &sDefault.szUsername,
1409 .special = NULL,
1410 .enum_list = NULL,
1411 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1414 .label = "user",
1415 .type = P_STRING,
1416 .p_class = P_LOCAL,
1417 .ptr = &sDefault.szUsername,
1418 .special = NULL,
1419 .enum_list = NULL,
1420 .flags = FLAG_HIDE,
1423 .label = "users",
1424 .type = P_STRING,
1425 .p_class = P_LOCAL,
1426 .ptr = &sDefault.szUsername,
1427 .special = NULL,
1428 .enum_list = NULL,
1429 .flags = FLAG_HIDE,
1432 .label = "invalid users",
1433 .type = P_LIST,
1434 .p_class = P_LOCAL,
1435 .ptr = &sDefault.szInvalidUsers,
1436 .special = NULL,
1437 .enum_list = NULL,
1438 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1441 .label = "valid users",
1442 .type = P_LIST,
1443 .p_class = P_LOCAL,
1444 .ptr = &sDefault.szValidUsers,
1445 .special = NULL,
1446 .enum_list = NULL,
1447 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1450 .label = "admin users",
1451 .type = P_LIST,
1452 .p_class = P_LOCAL,
1453 .ptr = &sDefault.szAdminUsers,
1454 .special = NULL,
1455 .enum_list = NULL,
1456 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1459 .label = "read list",
1460 .type = P_LIST,
1461 .p_class = P_LOCAL,
1462 .ptr = &sDefault.readlist,
1463 .special = NULL,
1464 .enum_list = NULL,
1465 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1468 .label = "write list",
1469 .type = P_LIST,
1470 .p_class = P_LOCAL,
1471 .ptr = &sDefault.writelist,
1472 .special = NULL,
1473 .enum_list = NULL,
1474 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1477 .label = "printer admin",
1478 .type = P_LIST,
1479 .p_class = P_LOCAL,
1480 .ptr = &sDefault.printer_admin,
1481 .special = NULL,
1482 .enum_list = NULL,
1483 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1486 .label = "force user",
1487 .type = P_STRING,
1488 .p_class = P_LOCAL,
1489 .ptr = &sDefault.force_user,
1490 .special = NULL,
1491 .enum_list = NULL,
1492 .flags = FLAG_ADVANCED | FLAG_SHARE,
1495 .label = "force group",
1496 .type = P_STRING,
1497 .p_class = P_LOCAL,
1498 .ptr = &sDefault.force_group,
1499 .special = NULL,
1500 .enum_list = NULL,
1501 .flags = FLAG_ADVANCED | FLAG_SHARE,
1504 .label = "group",
1505 .type = P_STRING,
1506 .p_class = P_LOCAL,
1507 .ptr = &sDefault.force_group,
1508 .special = NULL,
1509 .enum_list = NULL,
1510 .flags = FLAG_ADVANCED,
1513 .label = "read only",
1514 .type = P_BOOL,
1515 .p_class = P_LOCAL,
1516 .ptr = &sDefault.bRead_only,
1517 .special = NULL,
1518 .enum_list = NULL,
1519 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1522 .label = "write ok",
1523 .type = P_BOOLREV,
1524 .p_class = P_LOCAL,
1525 .ptr = &sDefault.bRead_only,
1526 .special = NULL,
1527 .enum_list = NULL,
1528 .flags = FLAG_HIDE,
1531 .label = "writeable",
1532 .type = P_BOOLREV,
1533 .p_class = P_LOCAL,
1534 .ptr = &sDefault.bRead_only,
1535 .special = NULL,
1536 .enum_list = NULL,
1537 .flags = FLAG_HIDE,
1540 .label = "writable",
1541 .type = P_BOOLREV,
1542 .p_class = P_LOCAL,
1543 .ptr = &sDefault.bRead_only,
1544 .special = NULL,
1545 .enum_list = NULL,
1546 .flags = FLAG_HIDE,
1549 .label = "acl check permissions",
1550 .type = P_BOOL,
1551 .p_class = P_LOCAL,
1552 .ptr = &sDefault.bAclCheckPermissions,
1553 .special = NULL,
1554 .enum_list = NULL,
1555 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1558 .label = "acl group control",
1559 .type = P_BOOL,
1560 .p_class = P_LOCAL,
1561 .ptr = &sDefault.bAclGroupControl,
1562 .special = NULL,
1563 .enum_list = NULL,
1564 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1567 .label = "acl map full control",
1568 .type = P_BOOL,
1569 .p_class = P_LOCAL,
1570 .ptr = &sDefault.bAclMapFullControl,
1571 .special = NULL,
1572 .enum_list = NULL,
1573 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1576 .label = "create mask",
1577 .type = P_OCTAL,
1578 .p_class = P_LOCAL,
1579 .ptr = &sDefault.iCreate_mask,
1580 .special = NULL,
1581 .enum_list = NULL,
1582 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1585 .label = "create mode",
1586 .type = P_OCTAL,
1587 .p_class = P_LOCAL,
1588 .ptr = &sDefault.iCreate_mask,
1589 .special = NULL,
1590 .enum_list = NULL,
1591 .flags = FLAG_HIDE,
1594 .label = "force create mode",
1595 .type = P_OCTAL,
1596 .p_class = P_LOCAL,
1597 .ptr = &sDefault.iCreate_force_mode,
1598 .special = NULL,
1599 .enum_list = NULL,
1600 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1603 .label = "security mask",
1604 .type = P_OCTAL,
1605 .p_class = P_LOCAL,
1606 .ptr = &sDefault.iSecurity_mask,
1607 .special = NULL,
1608 .enum_list = NULL,
1609 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1612 .label = "force security mode",
1613 .type = P_OCTAL,
1614 .p_class = P_LOCAL,
1615 .ptr = &sDefault.iSecurity_force_mode,
1616 .special = NULL,
1617 .enum_list = NULL,
1618 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1621 .label = "directory mask",
1622 .type = P_OCTAL,
1623 .p_class = P_LOCAL,
1624 .ptr = &sDefault.iDir_mask,
1625 .special = NULL,
1626 .enum_list = NULL,
1627 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1630 .label = "directory mode",
1631 .type = P_OCTAL,
1632 .p_class = P_LOCAL,
1633 .ptr = &sDefault.iDir_mask,
1634 .special = NULL,
1635 .enum_list = NULL,
1636 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1639 .label = "force directory mode",
1640 .type = P_OCTAL,
1641 .p_class = P_LOCAL,
1642 .ptr = &sDefault.iDir_force_mode,
1643 .special = NULL,
1644 .enum_list = NULL,
1645 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1648 .label = "directory security mask",
1649 .type = P_OCTAL,
1650 .p_class = P_LOCAL,
1651 .ptr = &sDefault.iDir_Security_mask,
1652 .special = NULL,
1653 .enum_list = NULL,
1654 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1657 .label = "force directory security mode",
1658 .type = P_OCTAL,
1659 .p_class = P_LOCAL,
1660 .ptr = &sDefault.iDir_Security_force_mode,
1661 .special = NULL,
1662 .enum_list = NULL,
1663 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1666 .label = "force unknown acl user",
1667 .type = P_BOOL,
1668 .p_class = P_LOCAL,
1669 .ptr = &sDefault.bForceUnknownAclUser,
1670 .special = NULL,
1671 .enum_list = NULL,
1672 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1675 .label = "inherit permissions",
1676 .type = P_BOOL,
1677 .p_class = P_LOCAL,
1678 .ptr = &sDefault.bInheritPerms,
1679 .special = NULL,
1680 .enum_list = NULL,
1681 .flags = FLAG_ADVANCED | FLAG_SHARE,
1684 .label = "inherit acls",
1685 .type = P_BOOL,
1686 .p_class = P_LOCAL,
1687 .ptr = &sDefault.bInheritACLS,
1688 .special = NULL,
1689 .enum_list = NULL,
1690 .flags = FLAG_ADVANCED | FLAG_SHARE,
1693 .label = "inherit owner",
1694 .type = P_BOOL,
1695 .p_class = P_LOCAL,
1696 .ptr = &sDefault.bInheritOwner,
1697 .special = NULL,
1698 .enum_list = NULL,
1699 .flags = FLAG_ADVANCED | FLAG_SHARE,
1702 .label = "guest only",
1703 .type = P_BOOL,
1704 .p_class = P_LOCAL,
1705 .ptr = &sDefault.bGuest_only,
1706 .special = NULL,
1707 .enum_list = NULL,
1708 .flags = FLAG_ADVANCED | FLAG_SHARE,
1711 .label = "only guest",
1712 .type = P_BOOL,
1713 .p_class = P_LOCAL,
1714 .ptr = &sDefault.bGuest_only,
1715 .special = NULL,
1716 .enum_list = NULL,
1717 .flags = FLAG_HIDE,
1720 .label = "administrative share",
1721 .type = P_BOOL,
1722 .p_class = P_LOCAL,
1723 .ptr = &sDefault.bAdministrative_share,
1724 .special = NULL,
1725 .enum_list = NULL,
1726 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1730 .label = "guest ok",
1731 .type = P_BOOL,
1732 .p_class = P_LOCAL,
1733 .ptr = &sDefault.bGuest_ok,
1734 .special = NULL,
1735 .enum_list = NULL,
1736 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1739 .label = "public",
1740 .type = P_BOOL,
1741 .p_class = P_LOCAL,
1742 .ptr = &sDefault.bGuest_ok,
1743 .special = NULL,
1744 .enum_list = NULL,
1745 .flags = FLAG_HIDE,
1748 .label = "only user",
1749 .type = P_BOOL,
1750 .p_class = P_LOCAL,
1751 .ptr = &sDefault.bOnlyUser,
1752 .special = NULL,
1753 .enum_list = NULL,
1754 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1757 .label = "hosts allow",
1758 .type = P_LIST,
1759 .p_class = P_LOCAL,
1760 .ptr = &sDefault.szHostsallow,
1761 .special = NULL,
1762 .enum_list = NULL,
1763 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1766 .label = "allow hosts",
1767 .type = P_LIST,
1768 .p_class = P_LOCAL,
1769 .ptr = &sDefault.szHostsallow,
1770 .special = NULL,
1771 .enum_list = NULL,
1772 .flags = FLAG_HIDE,
1775 .label = "hosts deny",
1776 .type = P_LIST,
1777 .p_class = P_LOCAL,
1778 .ptr = &sDefault.szHostsdeny,
1779 .special = NULL,
1780 .enum_list = NULL,
1781 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1784 .label = "deny hosts",
1785 .type = P_LIST,
1786 .p_class = P_LOCAL,
1787 .ptr = &sDefault.szHostsdeny,
1788 .special = NULL,
1789 .enum_list = NULL,
1790 .flags = FLAG_HIDE,
1793 .label = "preload modules",
1794 .type = P_LIST,
1795 .p_class = P_GLOBAL,
1796 .ptr = &Globals.szPreloadModules,
1797 .special = NULL,
1798 .enum_list = NULL,
1799 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1802 .label = "dedicated keytab file",
1803 .type = P_STRING,
1804 .p_class = P_GLOBAL,
1805 .ptr = &Globals.szDedicatedKeytabFile,
1806 .special = NULL,
1807 .enum_list = NULL,
1808 .flags = FLAG_ADVANCED,
1811 .label = "kerberos method",
1812 .type = P_ENUM,
1813 .p_class = P_GLOBAL,
1814 .ptr = &Globals.iKerberosMethod,
1815 .special = NULL,
1816 .enum_list = enum_kerberos_method,
1817 .flags = FLAG_ADVANCED,
1820 .label = "map untrusted to domain",
1821 .type = P_BOOL,
1822 .p_class = P_GLOBAL,
1823 .ptr = &Globals.bMapUntrustedToDomain,
1824 .special = NULL,
1825 .enum_list = NULL,
1826 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1830 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1833 .label = "log level",
1834 .type = P_STRING,
1835 .p_class = P_GLOBAL,
1836 .ptr = &Globals.szLogLevel,
1837 .special = handle_debug_list,
1838 .enum_list = NULL,
1839 .flags = FLAG_ADVANCED,
1842 .label = "debuglevel",
1843 .type = P_STRING,
1844 .p_class = P_GLOBAL,
1845 .ptr = &Globals.szLogLevel,
1846 .special = handle_debug_list,
1847 .enum_list = NULL,
1848 .flags = FLAG_HIDE,
1851 .label = "syslog",
1852 .type = P_INTEGER,
1853 .p_class = P_GLOBAL,
1854 .ptr = &Globals.syslog,
1855 .special = NULL,
1856 .enum_list = NULL,
1857 .flags = FLAG_ADVANCED,
1860 .label = "syslog only",
1861 .type = P_BOOL,
1862 .p_class = P_GLOBAL,
1863 .ptr = &Globals.bSyslogOnly,
1864 .special = NULL,
1865 .enum_list = NULL,
1866 .flags = FLAG_ADVANCED,
1869 .label = "log file",
1870 .type = P_STRING,
1871 .p_class = P_GLOBAL,
1872 .ptr = &Globals.szLogFile,
1873 .special = NULL,
1874 .enum_list = NULL,
1875 .flags = FLAG_ADVANCED,
1878 .label = "max log size",
1879 .type = P_INTEGER,
1880 .p_class = P_GLOBAL,
1881 .ptr = &Globals.max_log_size,
1882 .special = NULL,
1883 .enum_list = NULL,
1884 .flags = FLAG_ADVANCED,
1887 .label = "debug timestamp",
1888 .type = P_BOOL,
1889 .p_class = P_GLOBAL,
1890 .ptr = &Globals.bTimestampLogs,
1891 .special = NULL,
1892 .enum_list = NULL,
1893 .flags = FLAG_ADVANCED,
1896 .label = "timestamp logs",
1897 .type = P_BOOL,
1898 .p_class = P_GLOBAL,
1899 .ptr = &Globals.bTimestampLogs,
1900 .special = NULL,
1901 .enum_list = NULL,
1902 .flags = FLAG_ADVANCED,
1905 .label = "debug prefix timestamp",
1906 .type = P_BOOL,
1907 .p_class = P_GLOBAL,
1908 .ptr = &Globals.bDebugPrefixTimestamp,
1909 .special = NULL,
1910 .enum_list = NULL,
1911 .flags = FLAG_ADVANCED,
1914 .label = "debug hires timestamp",
1915 .type = P_BOOL,
1916 .p_class = P_GLOBAL,
1917 .ptr = &Globals.bDebugHiresTimestamp,
1918 .special = NULL,
1919 .enum_list = NULL,
1920 .flags = FLAG_ADVANCED,
1923 .label = "debug pid",
1924 .type = P_BOOL,
1925 .p_class = P_GLOBAL,
1926 .ptr = &Globals.bDebugPid,
1927 .special = NULL,
1928 .enum_list = NULL,
1929 .flags = FLAG_ADVANCED,
1932 .label = "debug uid",
1933 .type = P_BOOL,
1934 .p_class = P_GLOBAL,
1935 .ptr = &Globals.bDebugUid,
1936 .special = NULL,
1937 .enum_list = NULL,
1938 .flags = FLAG_ADVANCED,
1941 .label = "debug class",
1942 .type = P_BOOL,
1943 .p_class = P_GLOBAL,
1944 .ptr = &Globals.bDebugClass,
1945 .special = NULL,
1946 .enum_list = NULL,
1947 .flags = FLAG_ADVANCED,
1950 .label = "enable core files",
1951 .type = P_BOOL,
1952 .p_class = P_GLOBAL,
1953 .ptr = &Globals.bEnableCoreFiles,
1954 .special = NULL,
1955 .enum_list = NULL,
1956 .flags = FLAG_ADVANCED,
1959 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1962 .label = "allocation roundup size",
1963 .type = P_INTEGER,
1964 .p_class = P_LOCAL,
1965 .ptr = &sDefault.iallocation_roundup_size,
1966 .special = NULL,
1967 .enum_list = NULL,
1968 .flags = FLAG_ADVANCED,
1971 .label = "aio read size",
1972 .type = P_INTEGER,
1973 .p_class = P_LOCAL,
1974 .ptr = &sDefault.iAioReadSize,
1975 .special = NULL,
1976 .enum_list = NULL,
1977 .flags = FLAG_ADVANCED,
1980 .label = "aio write size",
1981 .type = P_INTEGER,
1982 .p_class = P_LOCAL,
1983 .ptr = &sDefault.iAioWriteSize,
1984 .special = NULL,
1985 .enum_list = NULL,
1986 .flags = FLAG_ADVANCED,
1989 .label = "aio write behind",
1990 .type = P_STRING,
1991 .p_class = P_LOCAL,
1992 .ptr = &sDefault.szAioWriteBehind,
1993 .special = NULL,
1994 .enum_list = NULL,
1995 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1998 .label = "smb ports",
1999 .type = P_STRING,
2000 .p_class = P_GLOBAL,
2001 .ptr = &Globals.smb_ports,
2002 .special = NULL,
2003 .enum_list = NULL,
2004 .flags = FLAG_ADVANCED,
2007 .label = "large readwrite",
2008 .type = P_BOOL,
2009 .p_class = P_GLOBAL,
2010 .ptr = &Globals.bLargeReadwrite,
2011 .special = NULL,
2012 .enum_list = NULL,
2013 .flags = FLAG_ADVANCED,
2016 .label = "max protocol",
2017 .type = P_ENUM,
2018 .p_class = P_GLOBAL,
2019 .ptr = &Globals.maxprotocol,
2020 .special = NULL,
2021 .enum_list = enum_protocol,
2022 .flags = FLAG_ADVANCED,
2025 .label = "protocol",
2026 .type = P_ENUM,
2027 .p_class = P_GLOBAL,
2028 .ptr = &Globals.maxprotocol,
2029 .special = NULL,
2030 .enum_list = enum_protocol,
2031 .flags = FLAG_ADVANCED,
2034 .label = "min protocol",
2035 .type = P_ENUM,
2036 .p_class = P_GLOBAL,
2037 .ptr = &Globals.minprotocol,
2038 .special = NULL,
2039 .enum_list = enum_protocol,
2040 .flags = FLAG_ADVANCED,
2043 .label = "min receivefile size",
2044 .type = P_INTEGER,
2045 .p_class = P_GLOBAL,
2046 .ptr = &Globals.iminreceivefile,
2047 .special = NULL,
2048 .enum_list = NULL,
2049 .flags = FLAG_ADVANCED,
2052 .label = "read raw",
2053 .type = P_BOOL,
2054 .p_class = P_GLOBAL,
2055 .ptr = &Globals.bReadRaw,
2056 .special = NULL,
2057 .enum_list = NULL,
2058 .flags = FLAG_ADVANCED,
2061 .label = "write raw",
2062 .type = P_BOOL,
2063 .p_class = P_GLOBAL,
2064 .ptr = &Globals.bWriteRaw,
2065 .special = NULL,
2066 .enum_list = NULL,
2067 .flags = FLAG_ADVANCED,
2070 .label = "disable netbios",
2071 .type = P_BOOL,
2072 .p_class = P_GLOBAL,
2073 .ptr = &Globals.bDisableNetbios,
2074 .special = NULL,
2075 .enum_list = NULL,
2076 .flags = FLAG_ADVANCED,
2079 .label = "reset on zero vc",
2080 .type = P_BOOL,
2081 .p_class = P_GLOBAL,
2082 .ptr = &Globals.bResetOnZeroVC,
2083 .special = NULL,
2084 .enum_list = NULL,
2085 .flags = FLAG_ADVANCED,
2088 .label = "log writeable files on exit",
2089 .type = P_BOOL,
2090 .p_class = P_GLOBAL,
2091 .ptr = &Globals.bLogWriteableFilesOnExit,
2092 .special = NULL,
2093 .enum_list = NULL,
2094 .flags = FLAG_ADVANCED,
2097 .label = "acl compatibility",
2098 .type = P_ENUM,
2099 .p_class = P_GLOBAL,
2100 .ptr = &Globals.iAclCompat,
2101 .special = NULL,
2102 .enum_list = enum_acl_compat_vals,
2103 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2106 .label = "defer sharing violations",
2107 .type = P_BOOL,
2108 .p_class = P_GLOBAL,
2109 .ptr = &Globals.bDeferSharingViolations,
2110 .special = NULL,
2111 .enum_list = NULL,
2112 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2115 .label = "ea support",
2116 .type = P_BOOL,
2117 .p_class = P_LOCAL,
2118 .ptr = &sDefault.bEASupport,
2119 .special = NULL,
2120 .enum_list = NULL,
2121 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2124 .label = "nt acl support",
2125 .type = P_BOOL,
2126 .p_class = P_LOCAL,
2127 .ptr = &sDefault.bNTAclSupport,
2128 .special = NULL,
2129 .enum_list = NULL,
2130 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2133 .label = "nt pipe support",
2134 .type = P_BOOL,
2135 .p_class = P_GLOBAL,
2136 .ptr = &Globals.bNTPipeSupport,
2137 .special = NULL,
2138 .enum_list = NULL,
2139 .flags = FLAG_ADVANCED,
2142 .label = "nt status support",
2143 .type = P_BOOL,
2144 .p_class = P_GLOBAL,
2145 .ptr = &Globals.bNTStatusSupport,
2146 .special = NULL,
2147 .enum_list = NULL,
2148 .flags = FLAG_ADVANCED,
2151 .label = "profile acls",
2152 .type = P_BOOL,
2153 .p_class = P_LOCAL,
2154 .ptr = &sDefault.bProfileAcls,
2155 .special = NULL,
2156 .enum_list = NULL,
2157 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2160 .label = "announce version",
2161 .type = P_STRING,
2162 .p_class = P_GLOBAL,
2163 .ptr = &Globals.szAnnounceVersion,
2164 .special = NULL,
2165 .enum_list = NULL,
2166 .flags = FLAG_ADVANCED,
2169 .label = "announce as",
2170 .type = P_ENUM,
2171 .p_class = P_GLOBAL,
2172 .ptr = &Globals.announce_as,
2173 .special = NULL,
2174 .enum_list = enum_announce_as,
2175 .flags = FLAG_ADVANCED,
2178 .label = "map acl inherit",
2179 .type = P_BOOL,
2180 .p_class = P_LOCAL,
2181 .ptr = &sDefault.bMap_acl_inherit,
2182 .special = NULL,
2183 .enum_list = NULL,
2184 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2187 .label = "afs share",
2188 .type = P_BOOL,
2189 .p_class = P_LOCAL,
2190 .ptr = &sDefault.bAfs_Share,
2191 .special = NULL,
2192 .enum_list = NULL,
2193 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2196 .label = "max mux",
2197 .type = P_INTEGER,
2198 .p_class = P_GLOBAL,
2199 .ptr = &Globals.max_mux,
2200 .special = NULL,
2201 .enum_list = NULL,
2202 .flags = FLAG_ADVANCED,
2205 .label = "max xmit",
2206 .type = P_INTEGER,
2207 .p_class = P_GLOBAL,
2208 .ptr = &Globals.max_xmit,
2209 .special = NULL,
2210 .enum_list = NULL,
2211 .flags = FLAG_ADVANCED,
2214 .label = "name resolve order",
2215 .type = P_STRING,
2216 .p_class = P_GLOBAL,
2217 .ptr = &Globals.szNameResolveOrder,
2218 .special = NULL,
2219 .enum_list = NULL,
2220 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2223 .label = "max ttl",
2224 .type = P_INTEGER,
2225 .p_class = P_GLOBAL,
2226 .ptr = &Globals.max_ttl,
2227 .special = NULL,
2228 .enum_list = NULL,
2229 .flags = FLAG_ADVANCED,
2232 .label = "max wins ttl",
2233 .type = P_INTEGER,
2234 .p_class = P_GLOBAL,
2235 .ptr = &Globals.max_wins_ttl,
2236 .special = NULL,
2237 .enum_list = NULL,
2238 .flags = FLAG_ADVANCED,
2241 .label = "min wins ttl",
2242 .type = P_INTEGER,
2243 .p_class = P_GLOBAL,
2244 .ptr = &Globals.min_wins_ttl,
2245 .special = NULL,
2246 .enum_list = NULL,
2247 .flags = FLAG_ADVANCED,
2250 .label = "time server",
2251 .type = P_BOOL,
2252 .p_class = P_GLOBAL,
2253 .ptr = &Globals.bTimeServer,
2254 .special = NULL,
2255 .enum_list = NULL,
2256 .flags = FLAG_ADVANCED,
2259 .label = "unix extensions",
2260 .type = P_BOOL,
2261 .p_class = P_GLOBAL,
2262 .ptr = &Globals.bUnixExtensions,
2263 .special = NULL,
2264 .enum_list = NULL,
2265 .flags = FLAG_ADVANCED,
2268 .label = "use spnego",
2269 .type = P_BOOL,
2270 .p_class = P_GLOBAL,
2271 .ptr = &Globals.bUseSpnego,
2272 .special = NULL,
2273 .enum_list = NULL,
2274 .flags = FLAG_ADVANCED,
2277 .label = "client signing",
2278 .type = P_ENUM,
2279 .p_class = P_GLOBAL,
2280 .ptr = &Globals.client_signing,
2281 .special = NULL,
2282 .enum_list = enum_smb_signing_vals,
2283 .flags = FLAG_ADVANCED,
2286 .label = "server signing",
2287 .type = P_ENUM,
2288 .p_class = P_GLOBAL,
2289 .ptr = &Globals.server_signing,
2290 .special = NULL,
2291 .enum_list = enum_smb_signing_vals,
2292 .flags = FLAG_ADVANCED,
2295 .label = "smb encrypt",
2296 .type = P_ENUM,
2297 .p_class = P_LOCAL,
2298 .ptr = &sDefault.ismb_encrypt,
2299 .special = NULL,
2300 .enum_list = enum_smb_signing_vals,
2301 .flags = FLAG_ADVANCED,
2304 .label = "client use spnego",
2305 .type = P_BOOL,
2306 .p_class = P_GLOBAL,
2307 .ptr = &Globals.bClientUseSpnego,
2308 .special = NULL,
2309 .enum_list = NULL,
2310 .flags = FLAG_ADVANCED,
2313 .label = "client ldap sasl wrapping",
2314 .type = P_ENUM,
2315 .p_class = P_GLOBAL,
2316 .ptr = &Globals.client_ldap_sasl_wrapping,
2317 .special = NULL,
2318 .enum_list = enum_ldap_sasl_wrapping,
2319 .flags = FLAG_ADVANCED,
2322 .label = "enable asu support",
2323 .type = P_BOOL,
2324 .p_class = P_GLOBAL,
2325 .ptr = &Globals.bASUSupport,
2326 .special = NULL,
2327 .enum_list = NULL,
2328 .flags = FLAG_ADVANCED,
2331 .label = "svcctl list",
2332 .type = P_LIST,
2333 .p_class = P_GLOBAL,
2334 .ptr = &Globals.szServicesList,
2335 .special = NULL,
2336 .enum_list = NULL,
2337 .flags = FLAG_ADVANCED,
2340 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2343 .label = "block size",
2344 .type = P_INTEGER,
2345 .p_class = P_LOCAL,
2346 .ptr = &sDefault.iBlock_size,
2347 .special = NULL,
2348 .enum_list = NULL,
2349 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2352 .label = "deadtime",
2353 .type = P_INTEGER,
2354 .p_class = P_GLOBAL,
2355 .ptr = &Globals.deadtime,
2356 .special = NULL,
2357 .enum_list = NULL,
2358 .flags = FLAG_ADVANCED,
2361 .label = "getwd cache",
2362 .type = P_BOOL,
2363 .p_class = P_GLOBAL,
2364 .ptr = &Globals.getwd_cache,
2365 .special = NULL,
2366 .enum_list = NULL,
2367 .flags = FLAG_ADVANCED,
2370 .label = "keepalive",
2371 .type = P_INTEGER,
2372 .p_class = P_GLOBAL,
2373 .ptr = &Globals.iKeepalive,
2374 .special = NULL,
2375 .enum_list = NULL,
2376 .flags = FLAG_ADVANCED,
2379 .label = "change notify",
2380 .type = P_BOOL,
2381 .p_class = P_LOCAL,
2382 .ptr = &sDefault.bChangeNotify,
2383 .special = NULL,
2384 .enum_list = NULL,
2385 .flags = FLAG_ADVANCED | FLAG_SHARE,
2388 .label = "directory name cache size",
2389 .type = P_INTEGER,
2390 .p_class = P_LOCAL,
2391 .ptr = &sDefault.iDirectoryNameCacheSize,
2392 .special = NULL,
2393 .enum_list = NULL,
2394 .flags = FLAG_ADVANCED | FLAG_SHARE,
2397 .label = "kernel change notify",
2398 .type = P_BOOL,
2399 .p_class = P_LOCAL,
2400 .ptr = &sDefault.bKernelChangeNotify,
2401 .special = NULL,
2402 .enum_list = NULL,
2403 .flags = FLAG_ADVANCED | FLAG_SHARE,
2406 .label = "lpq cache time",
2407 .type = P_INTEGER,
2408 .p_class = P_GLOBAL,
2409 .ptr = &Globals.lpqcachetime,
2410 .special = NULL,
2411 .enum_list = NULL,
2412 .flags = FLAG_ADVANCED,
2415 .label = "max smbd processes",
2416 .type = P_INTEGER,
2417 .p_class = P_GLOBAL,
2418 .ptr = &Globals.iMaxSmbdProcesses,
2419 .special = NULL,
2420 .enum_list = NULL,
2421 .flags = FLAG_ADVANCED,
2424 .label = "max connections",
2425 .type = P_INTEGER,
2426 .p_class = P_LOCAL,
2427 .ptr = &sDefault.iMaxConnections,
2428 .special = NULL,
2429 .enum_list = NULL,
2430 .flags = FLAG_ADVANCED | FLAG_SHARE,
2433 .label = "paranoid server security",
2434 .type = P_BOOL,
2435 .p_class = P_GLOBAL,
2436 .ptr = &Globals.paranoid_server_security,
2437 .special = NULL,
2438 .enum_list = NULL,
2439 .flags = FLAG_ADVANCED,
2442 .label = "max disk size",
2443 .type = P_INTEGER,
2444 .p_class = P_GLOBAL,
2445 .ptr = &Globals.maxdisksize,
2446 .special = NULL,
2447 .enum_list = NULL,
2448 .flags = FLAG_ADVANCED,
2451 .label = "max open files",
2452 .type = P_INTEGER,
2453 .p_class = P_GLOBAL,
2454 .ptr = &Globals.max_open_files,
2455 .special = NULL,
2456 .enum_list = NULL,
2457 .flags = FLAG_ADVANCED,
2460 .label = "min print space",
2461 .type = P_INTEGER,
2462 .p_class = P_LOCAL,
2463 .ptr = &sDefault.iMinPrintSpace,
2464 .special = NULL,
2465 .enum_list = NULL,
2466 .flags = FLAG_ADVANCED | FLAG_PRINT,
2469 .label = "socket options",
2470 .type = P_STRING,
2471 .p_class = P_GLOBAL,
2472 .ptr = &Globals.szSocketOptions,
2473 .special = NULL,
2474 .enum_list = NULL,
2475 .flags = FLAG_ADVANCED,
2478 .label = "strict allocate",
2479 .type = P_BOOL,
2480 .p_class = P_LOCAL,
2481 .ptr = &sDefault.bStrictAllocate,
2482 .special = NULL,
2483 .enum_list = NULL,
2484 .flags = FLAG_ADVANCED | FLAG_SHARE,
2487 .label = "strict sync",
2488 .type = P_BOOL,
2489 .p_class = P_LOCAL,
2490 .ptr = &sDefault.bStrictSync,
2491 .special = NULL,
2492 .enum_list = NULL,
2493 .flags = FLAG_ADVANCED | FLAG_SHARE,
2496 .label = "sync always",
2497 .type = P_BOOL,
2498 .p_class = P_LOCAL,
2499 .ptr = &sDefault.bSyncAlways,
2500 .special = NULL,
2501 .enum_list = NULL,
2502 .flags = FLAG_ADVANCED | FLAG_SHARE,
2505 .label = "use mmap",
2506 .type = P_BOOL,
2507 .p_class = P_GLOBAL,
2508 .ptr = &Globals.bUseMmap,
2509 .special = NULL,
2510 .enum_list = NULL,
2511 .flags = FLAG_ADVANCED,
2514 .label = "use sendfile",
2515 .type = P_BOOL,
2516 .p_class = P_LOCAL,
2517 .ptr = &sDefault.bUseSendfile,
2518 .special = NULL,
2519 .enum_list = NULL,
2520 .flags = FLAG_ADVANCED | FLAG_SHARE,
2523 .label = "hostname lookups",
2524 .type = P_BOOL,
2525 .p_class = P_GLOBAL,
2526 .ptr = &Globals.bHostnameLookups,
2527 .special = NULL,
2528 .enum_list = NULL,
2529 .flags = FLAG_ADVANCED,
2532 .label = "write cache size",
2533 .type = P_INTEGER,
2534 .p_class = P_LOCAL,
2535 .ptr = &sDefault.iWriteCacheSize,
2536 .special = NULL,
2537 .enum_list = NULL,
2538 .flags = FLAG_ADVANCED | FLAG_SHARE,
2541 .label = "name cache timeout",
2542 .type = P_INTEGER,
2543 .p_class = P_GLOBAL,
2544 .ptr = &Globals.name_cache_timeout,
2545 .special = NULL,
2546 .enum_list = NULL,
2547 .flags = FLAG_ADVANCED,
2550 .label = "ctdbd socket",
2551 .type = P_STRING,
2552 .p_class = P_GLOBAL,
2553 .ptr = &Globals.ctdbdSocket,
2554 .special = NULL,
2555 .enum_list = NULL,
2556 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2559 .label = "cluster addresses",
2560 .type = P_LIST,
2561 .p_class = P_GLOBAL,
2562 .ptr = &Globals.szClusterAddresses,
2563 .special = NULL,
2564 .enum_list = NULL,
2565 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2568 .label = "clustering",
2569 .type = P_BOOL,
2570 .p_class = P_GLOBAL,
2571 .ptr = &Globals.clustering,
2572 .special = NULL,
2573 .enum_list = NULL,
2574 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2577 .label = "ctdb timeout",
2578 .type = P_INTEGER,
2579 .p_class = P_GLOBAL,
2580 .ptr = &Globals.ctdb_timeout,
2581 .special = NULL,
2582 .enum_list = NULL,
2583 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2586 .label = "ctdb locktime warn threshold",
2587 .type = P_INTEGER,
2588 .p_class = P_GLOBAL,
2589 .ptr = &Globals.ctdb_locktime_warn_threshold,
2590 .special = NULL,
2591 .enum_list = NULL,
2592 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2595 .label = "smb2 max read",
2596 .type = P_INTEGER,
2597 .p_class = P_GLOBAL,
2598 .ptr = &Globals.ismb2_max_read,
2599 .special = NULL,
2600 .enum_list = NULL,
2601 .flags = FLAG_ADVANCED,
2604 .label = "smb2 max write",
2605 .type = P_INTEGER,
2606 .p_class = P_GLOBAL,
2607 .ptr = &Globals.ismb2_max_write,
2608 .special = NULL,
2609 .enum_list = NULL,
2610 .flags = FLAG_ADVANCED,
2613 .label = "smb2 max trans",
2614 .type = P_INTEGER,
2615 .p_class = P_GLOBAL,
2616 .ptr = &Globals.ismb2_max_trans,
2617 .special = NULL,
2618 .enum_list = NULL,
2619 .flags = FLAG_ADVANCED,
2622 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2625 .label = "max reported print jobs",
2626 .type = P_INTEGER,
2627 .p_class = P_LOCAL,
2628 .ptr = &sDefault.iMaxReportedPrintJobs,
2629 .special = NULL,
2630 .enum_list = NULL,
2631 .flags = FLAG_ADVANCED | FLAG_PRINT,
2634 .label = "max print jobs",
2635 .type = P_INTEGER,
2636 .p_class = P_LOCAL,
2637 .ptr = &sDefault.iMaxPrintJobs,
2638 .special = NULL,
2639 .enum_list = NULL,
2640 .flags = FLAG_ADVANCED | FLAG_PRINT,
2643 .label = "load printers",
2644 .type = P_BOOL,
2645 .p_class = P_GLOBAL,
2646 .ptr = &Globals.bLoadPrinters,
2647 .special = NULL,
2648 .enum_list = NULL,
2649 .flags = FLAG_ADVANCED | FLAG_PRINT,
2652 .label = "printcap cache time",
2653 .type = P_INTEGER,
2654 .p_class = P_GLOBAL,
2655 .ptr = &Globals.PrintcapCacheTime,
2656 .special = NULL,
2657 .enum_list = NULL,
2658 .flags = FLAG_ADVANCED | FLAG_PRINT,
2661 .label = "printcap name",
2662 .type = P_STRING,
2663 .p_class = P_GLOBAL,
2664 .ptr = &Globals.szPrintcapname,
2665 .special = NULL,
2666 .enum_list = NULL,
2667 .flags = FLAG_ADVANCED | FLAG_PRINT,
2670 .label = "printcap",
2671 .type = P_STRING,
2672 .p_class = P_GLOBAL,
2673 .ptr = &Globals.szPrintcapname,
2674 .special = NULL,
2675 .enum_list = NULL,
2676 .flags = FLAG_HIDE,
2679 .label = "printable",
2680 .type = P_BOOL,
2681 .p_class = P_LOCAL,
2682 .ptr = &sDefault.bPrint_ok,
2683 .special = NULL,
2684 .enum_list = NULL,
2685 .flags = FLAG_ADVANCED | FLAG_PRINT,
2688 .label = "print ok",
2689 .type = P_BOOL,
2690 .p_class = P_LOCAL,
2691 .ptr = &sDefault.bPrint_ok,
2692 .special = NULL,
2693 .enum_list = NULL,
2694 .flags = FLAG_HIDE,
2697 .label = "printing",
2698 .type = P_ENUM,
2699 .p_class = P_LOCAL,
2700 .ptr = &sDefault.iPrinting,
2701 .special = handle_printing,
2702 .enum_list = enum_printing,
2703 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2706 .label = "cups options",
2707 .type = P_STRING,
2708 .p_class = P_LOCAL,
2709 .ptr = &sDefault.szCupsOptions,
2710 .special = NULL,
2711 .enum_list = NULL,
2712 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2715 .label = "cups server",
2716 .type = P_STRING,
2717 .p_class = P_GLOBAL,
2718 .ptr = &Globals.szCupsServer,
2719 .special = NULL,
2720 .enum_list = NULL,
2721 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2724 .label = "cups encrypt",
2725 .type = P_ENUM,
2726 .p_class = P_GLOBAL,
2727 .ptr = &Globals.CupsEncrypt,
2728 .special = NULL,
2729 .enum_list = enum_bool_auto,
2730 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2734 .label = "cups connection timeout",
2735 .type = P_INTEGER,
2736 .p_class = P_GLOBAL,
2737 .ptr = &Globals.cups_connection_timeout,
2738 .special = NULL,
2739 .enum_list = NULL,
2740 .flags = FLAG_ADVANCED,
2743 .label = "iprint server",
2744 .type = P_STRING,
2745 .p_class = P_GLOBAL,
2746 .ptr = &Globals.szIPrintServer,
2747 .special = NULL,
2748 .enum_list = NULL,
2749 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2752 .label = "print command",
2753 .type = P_STRING,
2754 .p_class = P_LOCAL,
2755 .ptr = &sDefault.szPrintcommand,
2756 .special = NULL,
2757 .enum_list = NULL,
2758 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2761 .label = "disable spoolss",
2762 .type = P_BOOL,
2763 .p_class = P_GLOBAL,
2764 .ptr = &Globals.bDisableSpoolss,
2765 .special = NULL,
2766 .enum_list = NULL,
2767 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2770 .label = "enable spoolss",
2771 .type = P_BOOLREV,
2772 .p_class = P_GLOBAL,
2773 .ptr = &Globals.bDisableSpoolss,
2774 .special = NULL,
2775 .enum_list = NULL,
2776 .flags = FLAG_HIDE,
2779 .label = "lpq command",
2780 .type = P_STRING,
2781 .p_class = P_LOCAL,
2782 .ptr = &sDefault.szLpqcommand,
2783 .special = NULL,
2784 .enum_list = NULL,
2785 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2788 .label = "lprm command",
2789 .type = P_STRING,
2790 .p_class = P_LOCAL,
2791 .ptr = &sDefault.szLprmcommand,
2792 .special = NULL,
2793 .enum_list = NULL,
2794 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2797 .label = "lppause command",
2798 .type = P_STRING,
2799 .p_class = P_LOCAL,
2800 .ptr = &sDefault.szLppausecommand,
2801 .special = NULL,
2802 .enum_list = NULL,
2803 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2806 .label = "lpresume command",
2807 .type = P_STRING,
2808 .p_class = P_LOCAL,
2809 .ptr = &sDefault.szLpresumecommand,
2810 .special = NULL,
2811 .enum_list = NULL,
2812 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2815 .label = "queuepause command",
2816 .type = P_STRING,
2817 .p_class = P_LOCAL,
2818 .ptr = &sDefault.szQueuepausecommand,
2819 .special = NULL,
2820 .enum_list = NULL,
2821 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2824 .label = "queueresume command",
2825 .type = P_STRING,
2826 .p_class = P_LOCAL,
2827 .ptr = &sDefault.szQueueresumecommand,
2828 .special = NULL,
2829 .enum_list = NULL,
2830 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2833 .label = "addport command",
2834 .type = P_STRING,
2835 .p_class = P_GLOBAL,
2836 .ptr = &Globals.szAddPortCommand,
2837 .special = NULL,
2838 .enum_list = NULL,
2839 .flags = FLAG_ADVANCED,
2842 .label = "enumports command",
2843 .type = P_STRING,
2844 .p_class = P_GLOBAL,
2845 .ptr = &Globals.szEnumPortsCommand,
2846 .special = NULL,
2847 .enum_list = NULL,
2848 .flags = FLAG_ADVANCED,
2851 .label = "addprinter command",
2852 .type = P_STRING,
2853 .p_class = P_GLOBAL,
2854 .ptr = &Globals.szAddPrinterCommand,
2855 .special = NULL,
2856 .enum_list = NULL,
2857 .flags = FLAG_ADVANCED,
2860 .label = "deleteprinter command",
2861 .type = P_STRING,
2862 .p_class = P_GLOBAL,
2863 .ptr = &Globals.szDeletePrinterCommand,
2864 .special = NULL,
2865 .enum_list = NULL,
2866 .flags = FLAG_ADVANCED,
2869 .label = "show add printer wizard",
2870 .type = P_BOOL,
2871 .p_class = P_GLOBAL,
2872 .ptr = &Globals.bMsAddPrinterWizard,
2873 .special = NULL,
2874 .enum_list = NULL,
2875 .flags = FLAG_ADVANCED,
2878 .label = "os2 driver map",
2879 .type = P_STRING,
2880 .p_class = P_GLOBAL,
2881 .ptr = &Globals.szOs2DriverMap,
2882 .special = NULL,
2883 .enum_list = NULL,
2884 .flags = FLAG_ADVANCED,
2888 .label = "printer name",
2889 .type = P_STRING,
2890 .p_class = P_LOCAL,
2891 .ptr = &sDefault.szPrintername,
2892 .special = NULL,
2893 .enum_list = NULL,
2894 .flags = FLAG_ADVANCED | FLAG_PRINT,
2897 .label = "printer",
2898 .type = P_STRING,
2899 .p_class = P_LOCAL,
2900 .ptr = &sDefault.szPrintername,
2901 .special = NULL,
2902 .enum_list = NULL,
2903 .flags = FLAG_HIDE,
2906 .label = "use client driver",
2907 .type = P_BOOL,
2908 .p_class = P_LOCAL,
2909 .ptr = &sDefault.bUseClientDriver,
2910 .special = NULL,
2911 .enum_list = NULL,
2912 .flags = FLAG_ADVANCED | FLAG_PRINT,
2915 .label = "default devmode",
2916 .type = P_BOOL,
2917 .p_class = P_LOCAL,
2918 .ptr = &sDefault.bDefaultDevmode,
2919 .special = NULL,
2920 .enum_list = NULL,
2921 .flags = FLAG_ADVANCED | FLAG_PRINT,
2924 .label = "force printername",
2925 .type = P_BOOL,
2926 .p_class = P_LOCAL,
2927 .ptr = &sDefault.bForcePrintername,
2928 .special = NULL,
2929 .enum_list = NULL,
2930 .flags = FLAG_ADVANCED | FLAG_PRINT,
2933 .label = "printjob username",
2934 .type = P_STRING,
2935 .p_class = P_LOCAL,
2936 .ptr = &sDefault.szPrintjobUsername,
2937 .special = NULL,
2938 .enum_list = NULL,
2939 .flags = FLAG_ADVANCED | FLAG_PRINT,
2942 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2945 .label = "mangling method",
2946 .type = P_STRING,
2947 .p_class = P_GLOBAL,
2948 .ptr = &Globals.szManglingMethod,
2949 .special = NULL,
2950 .enum_list = NULL,
2951 .flags = FLAG_ADVANCED,
2954 .label = "mangle prefix",
2955 .type = P_INTEGER,
2956 .p_class = P_GLOBAL,
2957 .ptr = &Globals.mangle_prefix,
2958 .special = NULL,
2959 .enum_list = NULL,
2960 .flags = FLAG_ADVANCED,
2964 .label = "default case",
2965 .type = P_ENUM,
2966 .p_class = P_LOCAL,
2967 .ptr = &sDefault.iDefaultCase,
2968 .special = NULL,
2969 .enum_list = enum_case,
2970 .flags = FLAG_ADVANCED | FLAG_SHARE,
2973 .label = "case sensitive",
2974 .type = P_ENUM,
2975 .p_class = P_LOCAL,
2976 .ptr = &sDefault.iCaseSensitive,
2977 .special = NULL,
2978 .enum_list = enum_bool_auto,
2979 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2982 .label = "casesignames",
2983 .type = P_ENUM,
2984 .p_class = P_LOCAL,
2985 .ptr = &sDefault.iCaseSensitive,
2986 .special = NULL,
2987 .enum_list = enum_bool_auto,
2988 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2991 .label = "preserve case",
2992 .type = P_BOOL,
2993 .p_class = P_LOCAL,
2994 .ptr = &sDefault.bCasePreserve,
2995 .special = NULL,
2996 .enum_list = NULL,
2997 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3000 .label = "short preserve case",
3001 .type = P_BOOL,
3002 .p_class = P_LOCAL,
3003 .ptr = &sDefault.bShortCasePreserve,
3004 .special = NULL,
3005 .enum_list = NULL,
3006 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3009 .label = "mangling char",
3010 .type = P_CHAR,
3011 .p_class = P_LOCAL,
3012 .ptr = &sDefault.magic_char,
3013 .special = NULL,
3014 .enum_list = NULL,
3015 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3018 .label = "hide dot files",
3019 .type = P_BOOL,
3020 .p_class = P_LOCAL,
3021 .ptr = &sDefault.bHideDotFiles,
3022 .special = NULL,
3023 .enum_list = NULL,
3024 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3027 .label = "hide special files",
3028 .type = P_BOOL,
3029 .p_class = P_LOCAL,
3030 .ptr = &sDefault.bHideSpecialFiles,
3031 .special = NULL,
3032 .enum_list = NULL,
3033 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3036 .label = "hide unreadable",
3037 .type = P_BOOL,
3038 .p_class = P_LOCAL,
3039 .ptr = &sDefault.bHideUnReadable,
3040 .special = NULL,
3041 .enum_list = NULL,
3042 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3045 .label = "hide unwriteable files",
3046 .type = P_BOOL,
3047 .p_class = P_LOCAL,
3048 .ptr = &sDefault.bHideUnWriteableFiles,
3049 .special = NULL,
3050 .enum_list = NULL,
3051 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3054 .label = "delete veto files",
3055 .type = P_BOOL,
3056 .p_class = P_LOCAL,
3057 .ptr = &sDefault.bDeleteVetoFiles,
3058 .special = NULL,
3059 .enum_list = NULL,
3060 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3063 .label = "veto files",
3064 .type = P_STRING,
3065 .p_class = P_LOCAL,
3066 .ptr = &sDefault.szVetoFiles,
3067 .special = NULL,
3068 .enum_list = NULL,
3069 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3072 .label = "hide files",
3073 .type = P_STRING,
3074 .p_class = P_LOCAL,
3075 .ptr = &sDefault.szHideFiles,
3076 .special = NULL,
3077 .enum_list = NULL,
3078 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3081 .label = "veto oplock files",
3082 .type = P_STRING,
3083 .p_class = P_LOCAL,
3084 .ptr = &sDefault.szVetoOplockFiles,
3085 .special = NULL,
3086 .enum_list = NULL,
3087 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3090 .label = "map archive",
3091 .type = P_BOOL,
3092 .p_class = P_LOCAL,
3093 .ptr = &sDefault.bMap_archive,
3094 .special = NULL,
3095 .enum_list = NULL,
3096 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3099 .label = "map hidden",
3100 .type = P_BOOL,
3101 .p_class = P_LOCAL,
3102 .ptr = &sDefault.bMap_hidden,
3103 .special = NULL,
3104 .enum_list = NULL,
3105 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3108 .label = "map system",
3109 .type = P_BOOL,
3110 .p_class = P_LOCAL,
3111 .ptr = &sDefault.bMap_system,
3112 .special = NULL,
3113 .enum_list = NULL,
3114 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3117 .label = "map readonly",
3118 .type = P_ENUM,
3119 .p_class = P_LOCAL,
3120 .ptr = &sDefault.iMap_readonly,
3121 .special = NULL,
3122 .enum_list = enum_map_readonly,
3123 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3126 .label = "mangled names",
3127 .type = P_BOOL,
3128 .p_class = P_LOCAL,
3129 .ptr = &sDefault.bMangledNames,
3130 .special = NULL,
3131 .enum_list = NULL,
3132 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3135 .label = "max stat cache size",
3136 .type = P_INTEGER,
3137 .p_class = P_GLOBAL,
3138 .ptr = &Globals.iMaxStatCacheSize,
3139 .special = NULL,
3140 .enum_list = NULL,
3141 .flags = FLAG_ADVANCED,
3144 .label = "stat cache",
3145 .type = P_BOOL,
3146 .p_class = P_GLOBAL,
3147 .ptr = &Globals.bStatCache,
3148 .special = NULL,
3149 .enum_list = NULL,
3150 .flags = FLAG_ADVANCED,
3153 .label = "store dos attributes",
3154 .type = P_BOOL,
3155 .p_class = P_LOCAL,
3156 .ptr = &sDefault.bStoreDosAttributes,
3157 .special = NULL,
3158 .enum_list = NULL,
3159 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3162 .label = "dmapi support",
3163 .type = P_BOOL,
3164 .p_class = P_LOCAL,
3165 .ptr = &sDefault.bDmapiSupport,
3166 .special = NULL,
3167 .enum_list = NULL,
3168 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3172 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3175 .label = "machine password timeout",
3176 .type = P_INTEGER,
3177 .p_class = P_GLOBAL,
3178 .ptr = &Globals.machine_password_timeout,
3179 .special = NULL,
3180 .enum_list = NULL,
3181 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3184 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3187 .label = "add user script",
3188 .type = P_STRING,
3189 .p_class = P_GLOBAL,
3190 .ptr = &Globals.szAddUserScript,
3191 .special = NULL,
3192 .enum_list = NULL,
3193 .flags = FLAG_ADVANCED,
3196 .label = "rename user script",
3197 .type = P_STRING,
3198 .p_class = P_GLOBAL,
3199 .ptr = &Globals.szRenameUserScript,
3200 .special = NULL,
3201 .enum_list = NULL,
3202 .flags = FLAG_ADVANCED,
3205 .label = "delete user script",
3206 .type = P_STRING,
3207 .p_class = P_GLOBAL,
3208 .ptr = &Globals.szDelUserScript,
3209 .special = NULL,
3210 .enum_list = NULL,
3211 .flags = FLAG_ADVANCED,
3214 .label = "add group script",
3215 .type = P_STRING,
3216 .p_class = P_GLOBAL,
3217 .ptr = &Globals.szAddGroupScript,
3218 .special = NULL,
3219 .enum_list = NULL,
3220 .flags = FLAG_ADVANCED,
3223 .label = "delete group script",
3224 .type = P_STRING,
3225 .p_class = P_GLOBAL,
3226 .ptr = &Globals.szDelGroupScript,
3227 .special = NULL,
3228 .enum_list = NULL,
3229 .flags = FLAG_ADVANCED,
3232 .label = "add user to group script",
3233 .type = P_STRING,
3234 .p_class = P_GLOBAL,
3235 .ptr = &Globals.szAddUserToGroupScript,
3236 .special = NULL,
3237 .enum_list = NULL,
3238 .flags = FLAG_ADVANCED,
3241 .label = "delete user from group script",
3242 .type = P_STRING,
3243 .p_class = P_GLOBAL,
3244 .ptr = &Globals.szDelUserFromGroupScript,
3245 .special = NULL,
3246 .enum_list = NULL,
3247 .flags = FLAG_ADVANCED,
3250 .label = "set primary group script",
3251 .type = P_STRING,
3252 .p_class = P_GLOBAL,
3253 .ptr = &Globals.szSetPrimaryGroupScript,
3254 .special = NULL,
3255 .enum_list = NULL,
3256 .flags = FLAG_ADVANCED,
3259 .label = "add machine script",
3260 .type = P_STRING,
3261 .p_class = P_GLOBAL,
3262 .ptr = &Globals.szAddMachineScript,
3263 .special = NULL,
3264 .enum_list = NULL,
3265 .flags = FLAG_ADVANCED,
3268 .label = "shutdown script",
3269 .type = P_STRING,
3270 .p_class = P_GLOBAL,
3271 .ptr = &Globals.szShutdownScript,
3272 .special = NULL,
3273 .enum_list = NULL,
3274 .flags = FLAG_ADVANCED,
3277 .label = "abort shutdown script",
3278 .type = P_STRING,
3279 .p_class = P_GLOBAL,
3280 .ptr = &Globals.szAbortShutdownScript,
3281 .special = NULL,
3282 .enum_list = NULL,
3283 .flags = FLAG_ADVANCED,
3286 .label = "username map script",
3287 .type = P_STRING,
3288 .p_class = P_GLOBAL,
3289 .ptr = &Globals.szUsernameMapScript,
3290 .special = NULL,
3291 .enum_list = NULL,
3292 .flags = FLAG_ADVANCED,
3295 .label = "username map cache time",
3296 .type = P_INTEGER,
3297 .p_class = P_GLOBAL,
3298 .ptr = &Globals.iUsernameMapCacheTime,
3299 .special = NULL,
3300 .enum_list = NULL,
3301 .flags = FLAG_ADVANCED,
3304 .label = "logon script",
3305 .type = P_STRING,
3306 .p_class = P_GLOBAL,
3307 .ptr = &Globals.szLogonScript,
3308 .special = NULL,
3309 .enum_list = NULL,
3310 .flags = FLAG_ADVANCED,
3313 .label = "logon path",
3314 .type = P_STRING,
3315 .p_class = P_GLOBAL,
3316 .ptr = &Globals.szLogonPath,
3317 .special = NULL,
3318 .enum_list = NULL,
3319 .flags = FLAG_ADVANCED,
3322 .label = "logon drive",
3323 .type = P_STRING,
3324 .p_class = P_GLOBAL,
3325 .ptr = &Globals.szLogonDrive,
3326 .special = NULL,
3327 .enum_list = NULL,
3328 .flags = FLAG_ADVANCED,
3331 .label = "logon home",
3332 .type = P_STRING,
3333 .p_class = P_GLOBAL,
3334 .ptr = &Globals.szLogonHome,
3335 .special = NULL,
3336 .enum_list = NULL,
3337 .flags = FLAG_ADVANCED,
3340 .label = "domain logons",
3341 .type = P_BOOL,
3342 .p_class = P_GLOBAL,
3343 .ptr = &Globals.bDomainLogons,
3344 .special = NULL,
3345 .enum_list = NULL,
3346 .flags = FLAG_ADVANCED,
3350 .label = "init logon delayed hosts",
3351 .type = P_LIST,
3352 .p_class = P_GLOBAL,
3353 .ptr = &Globals.szInitLogonDelayedHosts,
3354 .special = NULL,
3355 .enum_list = NULL,
3356 .flags = FLAG_ADVANCED,
3360 .label = "init logon delay",
3361 .type = P_INTEGER,
3362 .p_class = P_GLOBAL,
3363 .ptr = &Globals.InitLogonDelay,
3364 .special = NULL,
3365 .enum_list = NULL,
3366 .flags = FLAG_ADVANCED,
3370 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3373 .label = "os level",
3374 .type = P_INTEGER,
3375 .p_class = P_GLOBAL,
3376 .ptr = &Globals.os_level,
3377 .special = NULL,
3378 .enum_list = NULL,
3379 .flags = FLAG_BASIC | FLAG_ADVANCED,
3382 .label = "lm announce",
3383 .type = P_ENUM,
3384 .p_class = P_GLOBAL,
3385 .ptr = &Globals.lm_announce,
3386 .special = NULL,
3387 .enum_list = enum_bool_auto,
3388 .flags = FLAG_ADVANCED,
3391 .label = "lm interval",
3392 .type = P_INTEGER,
3393 .p_class = P_GLOBAL,
3394 .ptr = &Globals.lm_interval,
3395 .special = NULL,
3396 .enum_list = NULL,
3397 .flags = FLAG_ADVANCED,
3400 .label = "preferred master",
3401 .type = P_ENUM,
3402 .p_class = P_GLOBAL,
3403 .ptr = &Globals.iPreferredMaster,
3404 .special = NULL,
3405 .enum_list = enum_bool_auto,
3406 .flags = FLAG_BASIC | FLAG_ADVANCED,
3409 .label = "prefered master",
3410 .type = P_ENUM,
3411 .p_class = P_GLOBAL,
3412 .ptr = &Globals.iPreferredMaster,
3413 .special = NULL,
3414 .enum_list = enum_bool_auto,
3415 .flags = FLAG_HIDE,
3418 .label = "local master",
3419 .type = P_BOOL,
3420 .p_class = P_GLOBAL,
3421 .ptr = &Globals.bLocalMaster,
3422 .special = NULL,
3423 .enum_list = NULL,
3424 .flags = FLAG_BASIC | FLAG_ADVANCED,
3427 .label = "domain master",
3428 .type = P_ENUM,
3429 .p_class = P_GLOBAL,
3430 .ptr = &Globals.iDomainMaster,
3431 .special = NULL,
3432 .enum_list = enum_bool_auto,
3433 .flags = FLAG_BASIC | FLAG_ADVANCED,
3436 .label = "browse list",
3437 .type = P_BOOL,
3438 .p_class = P_GLOBAL,
3439 .ptr = &Globals.bBrowseList,
3440 .special = NULL,
3441 .enum_list = NULL,
3442 .flags = FLAG_ADVANCED,
3445 .label = "browseable",
3446 .type = P_BOOL,
3447 .p_class = P_LOCAL,
3448 .ptr = &sDefault.bBrowseable,
3449 .special = NULL,
3450 .enum_list = NULL,
3451 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3454 .label = "browsable",
3455 .type = P_BOOL,
3456 .p_class = P_LOCAL,
3457 .ptr = &sDefault.bBrowseable,
3458 .special = NULL,
3459 .enum_list = NULL,
3460 .flags = FLAG_HIDE,
3463 .label = "access based share enum",
3464 .type = P_BOOL,
3465 .p_class = P_LOCAL,
3466 .ptr = &sDefault.bAccessBasedShareEnum,
3467 .special = NULL,
3468 .enum_list = NULL,
3469 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3472 .label = "enhanced browsing",
3473 .type = P_BOOL,
3474 .p_class = P_GLOBAL,
3475 .ptr = &Globals.enhanced_browsing,
3476 .special = NULL,
3477 .enum_list = NULL,
3478 .flags = FLAG_ADVANCED,
3481 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3484 .label = "dns proxy",
3485 .type = P_BOOL,
3486 .p_class = P_GLOBAL,
3487 .ptr = &Globals.bDNSproxy,
3488 .special = NULL,
3489 .enum_list = NULL,
3490 .flags = FLAG_ADVANCED,
3493 .label = "wins proxy",
3494 .type = P_BOOL,
3495 .p_class = P_GLOBAL,
3496 .ptr = &Globals.bWINSproxy,
3497 .special = NULL,
3498 .enum_list = NULL,
3499 .flags = FLAG_ADVANCED,
3502 .label = "wins server",
3503 .type = P_LIST,
3504 .p_class = P_GLOBAL,
3505 .ptr = &Globals.szWINSservers,
3506 .special = NULL,
3507 .enum_list = NULL,
3508 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3511 .label = "wins support",
3512 .type = P_BOOL,
3513 .p_class = P_GLOBAL,
3514 .ptr = &Globals.bWINSsupport,
3515 .special = NULL,
3516 .enum_list = NULL,
3517 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3520 .label = "wins hook",
3521 .type = P_STRING,
3522 .p_class = P_GLOBAL,
3523 .ptr = &Globals.szWINSHook,
3524 .special = NULL,
3525 .enum_list = NULL,
3526 .flags = FLAG_ADVANCED,
3529 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3532 .label = "blocking locks",
3533 .type = P_BOOL,
3534 .p_class = P_LOCAL,
3535 .ptr = &sDefault.bBlockingLocks,
3536 .special = NULL,
3537 .enum_list = NULL,
3538 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3541 .label = "csc policy",
3542 .type = P_ENUM,
3543 .p_class = P_LOCAL,
3544 .ptr = &sDefault.iCSCPolicy,
3545 .special = NULL,
3546 .enum_list = enum_csc_policy,
3547 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3550 .label = "fake oplocks",
3551 .type = P_BOOL,
3552 .p_class = P_LOCAL,
3553 .ptr = &sDefault.bFakeOplocks,
3554 .special = NULL,
3555 .enum_list = NULL,
3556 .flags = FLAG_ADVANCED | FLAG_SHARE,
3559 .label = "kernel oplocks",
3560 .type = P_BOOL,
3561 .p_class = P_GLOBAL,
3562 .ptr = &Globals.bKernelOplocks,
3563 .special = NULL,
3564 .enum_list = NULL,
3565 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3568 .label = "locking",
3569 .type = P_BOOL,
3570 .p_class = P_LOCAL,
3571 .ptr = &sDefault.bLocking,
3572 .special = NULL,
3573 .enum_list = NULL,
3574 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3577 .label = "lock spin time",
3578 .type = P_INTEGER,
3579 .p_class = P_GLOBAL,
3580 .ptr = &Globals.iLockSpinTime,
3581 .special = NULL,
3582 .enum_list = NULL,
3583 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3586 .label = "oplocks",
3587 .type = P_BOOL,
3588 .p_class = P_LOCAL,
3589 .ptr = &sDefault.bOpLocks,
3590 .special = NULL,
3591 .enum_list = NULL,
3592 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3595 .label = "level2 oplocks",
3596 .type = P_BOOL,
3597 .p_class = P_LOCAL,
3598 .ptr = &sDefault.bLevel2OpLocks,
3599 .special = NULL,
3600 .enum_list = NULL,
3601 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3604 .label = "oplock break wait time",
3605 .type = P_INTEGER,
3606 .p_class = P_GLOBAL,
3607 .ptr = &Globals.oplock_break_wait_time,
3608 .special = NULL,
3609 .enum_list = NULL,
3610 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3613 .label = "oplock contention limit",
3614 .type = P_INTEGER,
3615 .p_class = P_LOCAL,
3616 .ptr = &sDefault.iOplockContentionLimit,
3617 .special = NULL,
3618 .enum_list = NULL,
3619 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3622 .label = "posix locking",
3623 .type = P_BOOL,
3624 .p_class = P_LOCAL,
3625 .ptr = &sDefault.bPosixLocking,
3626 .special = NULL,
3627 .enum_list = NULL,
3628 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3631 .label = "strict locking",
3632 .type = P_ENUM,
3633 .p_class = P_LOCAL,
3634 .ptr = &sDefault.iStrictLocking,
3635 .special = NULL,
3636 .enum_list = enum_bool_auto,
3637 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3640 .label = "share modes",
3641 .type = P_BOOL,
3642 .p_class = P_LOCAL,
3643 .ptr = &sDefault.bShareModes,
3644 .special = NULL,
3645 .enum_list = NULL,
3646 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3649 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3652 .label = "ldap admin dn",
3653 .type = P_STRING,
3654 .p_class = P_GLOBAL,
3655 .ptr = &Globals.szLdapAdminDn,
3656 .special = NULL,
3657 .enum_list = NULL,
3658 .flags = FLAG_ADVANCED,
3661 .label = "ldap delete dn",
3662 .type = P_BOOL,
3663 .p_class = P_GLOBAL,
3664 .ptr = &Globals.ldap_delete_dn,
3665 .special = NULL,
3666 .enum_list = NULL,
3667 .flags = FLAG_ADVANCED,
3670 .label = "ldap group suffix",
3671 .type = P_STRING,
3672 .p_class = P_GLOBAL,
3673 .ptr = &Globals.szLdapGroupSuffix,
3674 .special = NULL,
3675 .enum_list = NULL,
3676 .flags = FLAG_ADVANCED,
3679 .label = "ldap idmap suffix",
3680 .type = P_STRING,
3681 .p_class = P_GLOBAL,
3682 .ptr = &Globals.szLdapIdmapSuffix,
3683 .special = NULL,
3684 .enum_list = NULL,
3685 .flags = FLAG_ADVANCED,
3688 .label = "ldap machine suffix",
3689 .type = P_STRING,
3690 .p_class = P_GLOBAL,
3691 .ptr = &Globals.szLdapMachineSuffix,
3692 .special = NULL,
3693 .enum_list = NULL,
3694 .flags = FLAG_ADVANCED,
3697 .label = "ldap passwd sync",
3698 .type = P_ENUM,
3699 .p_class = P_GLOBAL,
3700 .ptr = &Globals.ldap_passwd_sync,
3701 .special = NULL,
3702 .enum_list = enum_ldap_passwd_sync,
3703 .flags = FLAG_ADVANCED,
3706 .label = "ldap password sync",
3707 .type = P_ENUM,
3708 .p_class = P_GLOBAL,
3709 .ptr = &Globals.ldap_passwd_sync,
3710 .special = NULL,
3711 .enum_list = enum_ldap_passwd_sync,
3712 .flags = FLAG_HIDE,
3715 .label = "ldap replication sleep",
3716 .type = P_INTEGER,
3717 .p_class = P_GLOBAL,
3718 .ptr = &Globals.ldap_replication_sleep,
3719 .special = NULL,
3720 .enum_list = NULL,
3721 .flags = FLAG_ADVANCED,
3724 .label = "ldap suffix",
3725 .type = P_STRING,
3726 .p_class = P_GLOBAL,
3727 .ptr = &Globals.szLdapSuffix,
3728 .special = NULL,
3729 .enum_list = NULL,
3730 .flags = FLAG_ADVANCED,
3733 .label = "ldap ssl",
3734 .type = P_ENUM,
3735 .p_class = P_GLOBAL,
3736 .ptr = &Globals.ldap_ssl,
3737 .special = NULL,
3738 .enum_list = enum_ldap_ssl,
3739 .flags = FLAG_ADVANCED,
3742 .label = "ldap ssl ads",
3743 .type = P_BOOL,
3744 .p_class = P_GLOBAL,
3745 .ptr = &Globals.ldap_ssl_ads,
3746 .special = NULL,
3747 .enum_list = NULL,
3748 .flags = FLAG_ADVANCED,
3751 .label = "ldap deref",
3752 .type = P_ENUM,
3753 .p_class = P_GLOBAL,
3754 .ptr = &Globals.ldap_deref,
3755 .special = NULL,
3756 .enum_list = enum_ldap_deref,
3757 .flags = FLAG_ADVANCED,
3760 .label = "ldap follow referral",
3761 .type = P_ENUM,
3762 .p_class = P_GLOBAL,
3763 .ptr = &Globals.ldap_follow_referral,
3764 .special = NULL,
3765 .enum_list = enum_bool_auto,
3766 .flags = FLAG_ADVANCED,
3769 .label = "ldap timeout",
3770 .type = P_INTEGER,
3771 .p_class = P_GLOBAL,
3772 .ptr = &Globals.ldap_timeout,
3773 .special = NULL,
3774 .enum_list = NULL,
3775 .flags = FLAG_ADVANCED,
3778 .label = "ldap connection timeout",
3779 .type = P_INTEGER,
3780 .p_class = P_GLOBAL,
3781 .ptr = &Globals.ldap_connection_timeout,
3782 .special = NULL,
3783 .enum_list = NULL,
3784 .flags = FLAG_ADVANCED,
3787 .label = "ldap page size",
3788 .type = P_INTEGER,
3789 .p_class = P_GLOBAL,
3790 .ptr = &Globals.ldap_page_size,
3791 .special = NULL,
3792 .enum_list = NULL,
3793 .flags = FLAG_ADVANCED,
3796 .label = "ldap user suffix",
3797 .type = P_STRING,
3798 .p_class = P_GLOBAL,
3799 .ptr = &Globals.szLdapUserSuffix,
3800 .special = NULL,
3801 .enum_list = NULL,
3802 .flags = FLAG_ADVANCED,
3805 .label = "ldap debug level",
3806 .type = P_INTEGER,
3807 .p_class = P_GLOBAL,
3808 .ptr = &Globals.ldap_debug_level,
3809 .special = handle_ldap_debug_level,
3810 .enum_list = NULL,
3811 .flags = FLAG_ADVANCED,
3814 .label = "ldap debug threshold",
3815 .type = P_INTEGER,
3816 .p_class = P_GLOBAL,
3817 .ptr = &Globals.ldap_debug_threshold,
3818 .special = NULL,
3819 .enum_list = NULL,
3820 .flags = FLAG_ADVANCED,
3823 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3826 .label = "eventlog list",
3827 .type = P_LIST,
3828 .p_class = P_GLOBAL,
3829 .ptr = &Globals.szEventLogs,
3830 .special = NULL,
3831 .enum_list = NULL,
3832 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3835 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3838 .label = "add share command",
3839 .type = P_STRING,
3840 .p_class = P_GLOBAL,
3841 .ptr = &Globals.szAddShareCommand,
3842 .special = NULL,
3843 .enum_list = NULL,
3844 .flags = FLAG_ADVANCED,
3847 .label = "change share command",
3848 .type = P_STRING,
3849 .p_class = P_GLOBAL,
3850 .ptr = &Globals.szChangeShareCommand,
3851 .special = NULL,
3852 .enum_list = NULL,
3853 .flags = FLAG_ADVANCED,
3856 .label = "delete share command",
3857 .type = P_STRING,
3858 .p_class = P_GLOBAL,
3859 .ptr = &Globals.szDeleteShareCommand,
3860 .special = NULL,
3861 .enum_list = NULL,
3862 .flags = FLAG_ADVANCED,
3865 .label = "config file",
3866 .type = P_STRING,
3867 .p_class = P_GLOBAL,
3868 .ptr = &Globals.szConfigFile,
3869 .special = NULL,
3870 .enum_list = NULL,
3871 .flags = FLAG_HIDE|FLAG_META,
3874 .label = "preload",
3875 .type = P_STRING,
3876 .p_class = P_GLOBAL,
3877 .ptr = &Globals.szAutoServices,
3878 .special = NULL,
3879 .enum_list = NULL,
3880 .flags = FLAG_ADVANCED,
3883 .label = "auto services",
3884 .type = P_STRING,
3885 .p_class = P_GLOBAL,
3886 .ptr = &Globals.szAutoServices,
3887 .special = NULL,
3888 .enum_list = NULL,
3889 .flags = FLAG_ADVANCED,
3892 .label = "lock directory",
3893 .type = P_STRING,
3894 .p_class = P_GLOBAL,
3895 .ptr = &Globals.szLockDir,
3896 .special = NULL,
3897 .enum_list = NULL,
3898 .flags = FLAG_ADVANCED,
3901 .label = "lock dir",
3902 .type = P_STRING,
3903 .p_class = P_GLOBAL,
3904 .ptr = &Globals.szLockDir,
3905 .special = NULL,
3906 .enum_list = NULL,
3907 .flags = FLAG_HIDE,
3910 .label = "state directory",
3911 .type = P_STRING,
3912 .p_class = P_GLOBAL,
3913 .ptr = &Globals.szStateDir,
3914 .special = NULL,
3915 .enum_list = NULL,
3916 .flags = FLAG_ADVANCED,
3919 .label = "cache directory",
3920 .type = P_STRING,
3921 .p_class = P_GLOBAL,
3922 .ptr = &Globals.szCacheDir,
3923 .special = NULL,
3924 .enum_list = NULL,
3925 .flags = FLAG_ADVANCED,
3928 .label = "pid directory",
3929 .type = P_STRING,
3930 .p_class = P_GLOBAL,
3931 .ptr = &Globals.szPidDir,
3932 .special = NULL,
3933 .enum_list = NULL,
3934 .flags = FLAG_ADVANCED,
3936 #ifdef WITH_UTMP
3938 .label = "utmp directory",
3939 .type = P_STRING,
3940 .p_class = P_GLOBAL,
3941 .ptr = &Globals.szUtmpDir,
3942 .special = NULL,
3943 .enum_list = NULL,
3944 .flags = FLAG_ADVANCED,
3947 .label = "wtmp directory",
3948 .type = P_STRING,
3949 .p_class = P_GLOBAL,
3950 .ptr = &Globals.szWtmpDir,
3951 .special = NULL,
3952 .enum_list = NULL,
3953 .flags = FLAG_ADVANCED,
3956 .label = "utmp",
3957 .type = P_BOOL,
3958 .p_class = P_GLOBAL,
3959 .ptr = &Globals.bUtmp,
3960 .special = NULL,
3961 .enum_list = NULL,
3962 .flags = FLAG_ADVANCED,
3964 #endif
3966 .label = "default service",
3967 .type = P_STRING,
3968 .p_class = P_GLOBAL,
3969 .ptr = &Globals.szDefaultService,
3970 .special = NULL,
3971 .enum_list = NULL,
3972 .flags = FLAG_ADVANCED,
3975 .label = "default",
3976 .type = P_STRING,
3977 .p_class = P_GLOBAL,
3978 .ptr = &Globals.szDefaultService,
3979 .special = NULL,
3980 .enum_list = NULL,
3981 .flags = FLAG_ADVANCED,
3984 .label = "message command",
3985 .type = P_STRING,
3986 .p_class = P_GLOBAL,
3987 .ptr = &Globals.szMsgCommand,
3988 .special = NULL,
3989 .enum_list = NULL,
3990 .flags = FLAG_ADVANCED,
3993 .label = "dfree cache time",
3994 .type = P_INTEGER,
3995 .p_class = P_LOCAL,
3996 .ptr = &sDefault.iDfreeCacheTime,
3997 .special = NULL,
3998 .enum_list = NULL,
3999 .flags = FLAG_ADVANCED,
4002 .label = "dfree command",
4003 .type = P_STRING,
4004 .p_class = P_LOCAL,
4005 .ptr = &sDefault.szDfree,
4006 .special = NULL,
4007 .enum_list = NULL,
4008 .flags = FLAG_ADVANCED,
4011 .label = "get quota command",
4012 .type = P_STRING,
4013 .p_class = P_GLOBAL,
4014 .ptr = &Globals.szGetQuota,
4015 .special = NULL,
4016 .enum_list = NULL,
4017 .flags = FLAG_ADVANCED,
4020 .label = "set quota command",
4021 .type = P_STRING,
4022 .p_class = P_GLOBAL,
4023 .ptr = &Globals.szSetQuota,
4024 .special = NULL,
4025 .enum_list = NULL,
4026 .flags = FLAG_ADVANCED,
4029 .label = "remote announce",
4030 .type = P_STRING,
4031 .p_class = P_GLOBAL,
4032 .ptr = &Globals.szRemoteAnnounce,
4033 .special = NULL,
4034 .enum_list = NULL,
4035 .flags = FLAG_ADVANCED,
4038 .label = "remote browse sync",
4039 .type = P_STRING,
4040 .p_class = P_GLOBAL,
4041 .ptr = &Globals.szRemoteBrowseSync,
4042 .special = NULL,
4043 .enum_list = NULL,
4044 .flags = FLAG_ADVANCED,
4047 .label = "socket address",
4048 .type = P_STRING,
4049 .p_class = P_GLOBAL,
4050 .ptr = &Globals.szSocketAddress,
4051 .special = NULL,
4052 .enum_list = NULL,
4053 .flags = FLAG_ADVANCED,
4056 .label = "nmbd bind explicit broadcast",
4057 .type = P_BOOL,
4058 .p_class = P_GLOBAL,
4059 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4060 .special = NULL,
4061 .enum_list = NULL,
4062 .flags = FLAG_ADVANCED,
4065 .label = "homedir map",
4066 .type = P_STRING,
4067 .p_class = P_GLOBAL,
4068 .ptr = &Globals.szNISHomeMapName,
4069 .special = NULL,
4070 .enum_list = NULL,
4071 .flags = FLAG_ADVANCED,
4074 .label = "afs username map",
4075 .type = P_STRING,
4076 .p_class = P_GLOBAL,
4077 .ptr = &Globals.szAfsUsernameMap,
4078 .special = NULL,
4079 .enum_list = NULL,
4080 .flags = FLAG_ADVANCED,
4083 .label = "afs token lifetime",
4084 .type = P_INTEGER,
4085 .p_class = P_GLOBAL,
4086 .ptr = &Globals.iAfsTokenLifetime,
4087 .special = NULL,
4088 .enum_list = NULL,
4089 .flags = FLAG_ADVANCED,
4092 .label = "log nt token command",
4093 .type = P_STRING,
4094 .p_class = P_GLOBAL,
4095 .ptr = &Globals.szLogNtTokenCommand,
4096 .special = NULL,
4097 .enum_list = NULL,
4098 .flags = FLAG_ADVANCED,
4101 .label = "time offset",
4102 .type = P_INTEGER,
4103 .p_class = P_GLOBAL,
4104 .ptr = &extra_time_offset,
4105 .special = NULL,
4106 .enum_list = NULL,
4107 .flags = FLAG_ADVANCED,
4110 .label = "NIS homedir",
4111 .type = P_BOOL,
4112 .p_class = P_GLOBAL,
4113 .ptr = &Globals.bNISHomeMap,
4114 .special = NULL,
4115 .enum_list = NULL,
4116 .flags = FLAG_ADVANCED,
4119 .label = "-valid",
4120 .type = P_BOOL,
4121 .p_class = P_LOCAL,
4122 .ptr = &sDefault.valid,
4123 .special = NULL,
4124 .enum_list = NULL,
4125 .flags = FLAG_HIDE,
4128 .label = "copy",
4129 .type = P_STRING,
4130 .p_class = P_LOCAL,
4131 .ptr = &sDefault.szCopy,
4132 .special = handle_copy,
4133 .enum_list = NULL,
4134 .flags = FLAG_HIDE,
4137 .label = "include",
4138 .type = P_STRING,
4139 .p_class = P_LOCAL,
4140 .ptr = &sDefault.szInclude,
4141 .special = handle_include,
4142 .enum_list = NULL,
4143 .flags = FLAG_HIDE|FLAG_META,
4146 .label = "preexec",
4147 .type = P_STRING,
4148 .p_class = P_LOCAL,
4149 .ptr = &sDefault.szPreExec,
4150 .special = NULL,
4151 .enum_list = NULL,
4152 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4155 .label = "exec",
4156 .type = P_STRING,
4157 .p_class = P_LOCAL,
4158 .ptr = &sDefault.szPreExec,
4159 .special = NULL,
4160 .enum_list = NULL,
4161 .flags = FLAG_ADVANCED,
4164 .label = "preexec close",
4165 .type = P_BOOL,
4166 .p_class = P_LOCAL,
4167 .ptr = &sDefault.bPreexecClose,
4168 .special = NULL,
4169 .enum_list = NULL,
4170 .flags = FLAG_ADVANCED | FLAG_SHARE,
4173 .label = "postexec",
4174 .type = P_STRING,
4175 .p_class = P_LOCAL,
4176 .ptr = &sDefault.szPostExec,
4177 .special = NULL,
4178 .enum_list = NULL,
4179 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4182 .label = "root preexec",
4183 .type = P_STRING,
4184 .p_class = P_LOCAL,
4185 .ptr = &sDefault.szRootPreExec,
4186 .special = NULL,
4187 .enum_list = NULL,
4188 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4191 .label = "root preexec close",
4192 .type = P_BOOL,
4193 .p_class = P_LOCAL,
4194 .ptr = &sDefault.bRootpreexecClose,
4195 .special = NULL,
4196 .enum_list = NULL,
4197 .flags = FLAG_ADVANCED | FLAG_SHARE,
4200 .label = "root postexec",
4201 .type = P_STRING,
4202 .p_class = P_LOCAL,
4203 .ptr = &sDefault.szRootPostExec,
4204 .special = NULL,
4205 .enum_list = NULL,
4206 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4209 .label = "available",
4210 .type = P_BOOL,
4211 .p_class = P_LOCAL,
4212 .ptr = &sDefault.bAvailable,
4213 .special = NULL,
4214 .enum_list = NULL,
4215 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4218 .label = "registry shares",
4219 .type = P_BOOL,
4220 .p_class = P_GLOBAL,
4221 .ptr = &Globals.bRegistryShares,
4222 .special = NULL,
4223 .enum_list = NULL,
4224 .flags = FLAG_ADVANCED,
4227 .label = "usershare allow guests",
4228 .type = P_BOOL,
4229 .p_class = P_GLOBAL,
4230 .ptr = &Globals.bUsershareAllowGuests,
4231 .special = NULL,
4232 .enum_list = NULL,
4233 .flags = FLAG_ADVANCED,
4236 .label = "usershare max shares",
4237 .type = P_INTEGER,
4238 .p_class = P_GLOBAL,
4239 .ptr = &Globals.iUsershareMaxShares,
4240 .special = NULL,
4241 .enum_list = NULL,
4242 .flags = FLAG_ADVANCED,
4245 .label = "usershare owner only",
4246 .type = P_BOOL,
4247 .p_class = P_GLOBAL,
4248 .ptr = &Globals.bUsershareOwnerOnly,
4249 .special = NULL,
4250 .enum_list = NULL,
4251 .flags = FLAG_ADVANCED,
4254 .label = "usershare path",
4255 .type = P_STRING,
4256 .p_class = P_GLOBAL,
4257 .ptr = &Globals.szUsersharePath,
4258 .special = NULL,
4259 .enum_list = NULL,
4260 .flags = FLAG_ADVANCED,
4263 .label = "usershare prefix allow list",
4264 .type = P_LIST,
4265 .p_class = P_GLOBAL,
4266 .ptr = &Globals.szUsersharePrefixAllowList,
4267 .special = NULL,
4268 .enum_list = NULL,
4269 .flags = FLAG_ADVANCED,
4272 .label = "usershare prefix deny list",
4273 .type = P_LIST,
4274 .p_class = P_GLOBAL,
4275 .ptr = &Globals.szUsersharePrefixDenyList,
4276 .special = NULL,
4277 .enum_list = NULL,
4278 .flags = FLAG_ADVANCED,
4281 .label = "usershare template share",
4282 .type = P_STRING,
4283 .p_class = P_GLOBAL,
4284 .ptr = &Globals.szUsershareTemplateShare,
4285 .special = NULL,
4286 .enum_list = NULL,
4287 .flags = FLAG_ADVANCED,
4290 .label = "volume",
4291 .type = P_STRING,
4292 .p_class = P_LOCAL,
4293 .ptr = &sDefault.volume,
4294 .special = NULL,
4295 .enum_list = NULL,
4296 .flags = FLAG_ADVANCED | FLAG_SHARE,
4299 .label = "fstype",
4300 .type = P_STRING,
4301 .p_class = P_LOCAL,
4302 .ptr = &sDefault.fstype,
4303 .special = NULL,
4304 .enum_list = NULL,
4305 .flags = FLAG_ADVANCED | FLAG_SHARE,
4308 .label = "set directory",
4309 .type = P_BOOLREV,
4310 .p_class = P_LOCAL,
4311 .ptr = &sDefault.bNo_set_dir,
4312 .special = NULL,
4313 .enum_list = NULL,
4314 .flags = FLAG_ADVANCED | FLAG_SHARE,
4317 .label = "wide links",
4318 .type = P_BOOL,
4319 .p_class = P_LOCAL,
4320 .ptr = &sDefault.bWidelinks,
4321 .special = NULL,
4322 .enum_list = NULL,
4323 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4326 .label = "follow symlinks",
4327 .type = P_BOOL,
4328 .p_class = P_LOCAL,
4329 .ptr = &sDefault.bSymlinks,
4330 .special = NULL,
4331 .enum_list = NULL,
4332 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4335 .label = "dont descend",
4336 .type = P_STRING,
4337 .p_class = P_LOCAL,
4338 .ptr = &sDefault.szDontdescend,
4339 .special = NULL,
4340 .enum_list = NULL,
4341 .flags = FLAG_ADVANCED | FLAG_SHARE,
4344 .label = "magic script",
4345 .type = P_STRING,
4346 .p_class = P_LOCAL,
4347 .ptr = &sDefault.szMagicScript,
4348 .special = NULL,
4349 .enum_list = NULL,
4350 .flags = FLAG_ADVANCED | FLAG_SHARE,
4353 .label = "magic output",
4354 .type = P_STRING,
4355 .p_class = P_LOCAL,
4356 .ptr = &sDefault.szMagicOutput,
4357 .special = NULL,
4358 .enum_list = NULL,
4359 .flags = FLAG_ADVANCED | FLAG_SHARE,
4362 .label = "delete readonly",
4363 .type = P_BOOL,
4364 .p_class = P_LOCAL,
4365 .ptr = &sDefault.bDeleteReadonly,
4366 .special = NULL,
4367 .enum_list = NULL,
4368 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4371 .label = "dos filemode",
4372 .type = P_BOOL,
4373 .p_class = P_LOCAL,
4374 .ptr = &sDefault.bDosFilemode,
4375 .special = NULL,
4376 .enum_list = NULL,
4377 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4380 .label = "dos filetimes",
4381 .type = P_BOOL,
4382 .p_class = P_LOCAL,
4383 .ptr = &sDefault.bDosFiletimes,
4384 .special = NULL,
4385 .enum_list = NULL,
4386 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4389 .label = "dos filetime resolution",
4390 .type = P_BOOL,
4391 .p_class = P_LOCAL,
4392 .ptr = &sDefault.bDosFiletimeResolution,
4393 .special = NULL,
4394 .enum_list = NULL,
4395 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4398 .label = "fake directory create times",
4399 .type = P_BOOL,
4400 .p_class = P_LOCAL,
4401 .ptr = &sDefault.bFakeDirCreateTimes,
4402 .special = NULL,
4403 .enum_list = NULL,
4404 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4407 .label = "async smb echo handler",
4408 .type = P_BOOL,
4409 .p_class = P_GLOBAL,
4410 .ptr = &Globals.bAsyncSMBEchoHandler,
4411 .special = NULL,
4412 .enum_list = NULL,
4413 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4416 .label = "panic action",
4417 .type = P_STRING,
4418 .p_class = P_GLOBAL,
4419 .ptr = &Globals.szPanicAction,
4420 .special = NULL,
4421 .enum_list = NULL,
4422 .flags = FLAG_ADVANCED,
4425 .label = "perfcount module",
4426 .type = P_STRING,
4427 .p_class = P_GLOBAL,
4428 .ptr = &Globals.szSMBPerfcountModule,
4429 .special = NULL,
4430 .enum_list = NULL,
4431 .flags = FLAG_ADVANCED,
4434 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4437 .label = "vfs objects",
4438 .type = P_LIST,
4439 .p_class = P_LOCAL,
4440 .ptr = &sDefault.szVfsObjects,
4441 .special = NULL,
4442 .enum_list = NULL,
4443 .flags = FLAG_ADVANCED | FLAG_SHARE,
4446 .label = "vfs object",
4447 .type = P_LIST,
4448 .p_class = P_LOCAL,
4449 .ptr = &sDefault.szVfsObjects,
4450 .special = NULL,
4451 .enum_list = NULL,
4452 .flags = FLAG_HIDE,
4456 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4459 .label = "msdfs root",
4460 .type = P_BOOL,
4461 .p_class = P_LOCAL,
4462 .ptr = &sDefault.bMSDfsRoot,
4463 .special = NULL,
4464 .enum_list = NULL,
4465 .flags = FLAG_ADVANCED | FLAG_SHARE,
4468 .label = "msdfs proxy",
4469 .type = P_STRING,
4470 .p_class = P_LOCAL,
4471 .ptr = &sDefault.szMSDfsProxy,
4472 .special = NULL,
4473 .enum_list = NULL,
4474 .flags = FLAG_ADVANCED | FLAG_SHARE,
4477 .label = "host msdfs",
4478 .type = P_BOOL,
4479 .p_class = P_GLOBAL,
4480 .ptr = &Globals.bHostMSDfs,
4481 .special = NULL,
4482 .enum_list = NULL,
4483 .flags = FLAG_ADVANCED,
4486 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4489 .label = "passdb expand explicit",
4490 .type = P_BOOL,
4491 .p_class = P_GLOBAL,
4492 .ptr = &Globals.bPassdbExpandExplicit,
4493 .special = NULL,
4494 .enum_list = NULL,
4495 .flags = FLAG_ADVANCED,
4498 .label = "idmap backend",
4499 .type = P_STRING,
4500 .p_class = P_GLOBAL,
4501 .ptr = &Globals.szIdmapBackend,
4502 .special = NULL,
4503 .enum_list = NULL,
4504 .flags = FLAG_ADVANCED,
4507 .label = "idmap alloc backend",
4508 .type = P_STRING,
4509 .p_class = P_GLOBAL,
4510 .ptr = &Globals.szIdmapAllocBackend,
4511 .special = NULL,
4512 .enum_list = NULL,
4513 .flags = FLAG_ADVANCED,
4516 .label = "idmap cache time",
4517 .type = P_INTEGER,
4518 .p_class = P_GLOBAL,
4519 .ptr = &Globals.iIdmapCacheTime,
4520 .special = NULL,
4521 .enum_list = NULL,
4522 .flags = FLAG_ADVANCED,
4525 .label = "idmap negative cache time",
4526 .type = P_INTEGER,
4527 .p_class = P_GLOBAL,
4528 .ptr = &Globals.iIdmapNegativeCacheTime,
4529 .special = NULL,
4530 .enum_list = NULL,
4531 .flags = FLAG_ADVANCED,
4534 .label = "idmap uid",
4535 .type = P_STRING,
4536 .p_class = P_GLOBAL,
4537 .ptr = &Globals.szIdmapUID,
4538 .special = handle_idmap_uid,
4539 .enum_list = NULL,
4540 .flags = FLAG_ADVANCED,
4543 .label = "winbind uid",
4544 .type = P_STRING,
4545 .p_class = P_GLOBAL,
4546 .ptr = &Globals.szIdmapUID,
4547 .special = handle_idmap_uid,
4548 .enum_list = NULL,
4549 .flags = FLAG_HIDE,
4552 .label = "idmap gid",
4553 .type = P_STRING,
4554 .p_class = P_GLOBAL,
4555 .ptr = &Globals.szIdmapGID,
4556 .special = handle_idmap_gid,
4557 .enum_list = NULL,
4558 .flags = FLAG_ADVANCED,
4561 .label = "winbind gid",
4562 .type = P_STRING,
4563 .p_class = P_GLOBAL,
4564 .ptr = &Globals.szIdmapGID,
4565 .special = handle_idmap_gid,
4566 .enum_list = NULL,
4567 .flags = FLAG_HIDE,
4570 .label = "template homedir",
4571 .type = P_STRING,
4572 .p_class = P_GLOBAL,
4573 .ptr = &Globals.szTemplateHomedir,
4574 .special = NULL,
4575 .enum_list = NULL,
4576 .flags = FLAG_ADVANCED,
4579 .label = "template shell",
4580 .type = P_STRING,
4581 .p_class = P_GLOBAL,
4582 .ptr = &Globals.szTemplateShell,
4583 .special = NULL,
4584 .enum_list = NULL,
4585 .flags = FLAG_ADVANCED,
4588 .label = "winbind separator",
4589 .type = P_STRING,
4590 .p_class = P_GLOBAL,
4591 .ptr = &Globals.szWinbindSeparator,
4592 .special = NULL,
4593 .enum_list = NULL,
4594 .flags = FLAG_ADVANCED,
4597 .label = "winbind cache time",
4598 .type = P_INTEGER,
4599 .p_class = P_GLOBAL,
4600 .ptr = &Globals.winbind_cache_time,
4601 .special = NULL,
4602 .enum_list = NULL,
4603 .flags = FLAG_ADVANCED,
4606 .label = "winbind reconnect delay",
4607 .type = P_INTEGER,
4608 .p_class = P_GLOBAL,
4609 .ptr = &Globals.winbind_reconnect_delay,
4610 .special = NULL,
4611 .enum_list = NULL,
4612 .flags = FLAG_ADVANCED,
4615 .label = "winbind enum users",
4616 .type = P_BOOL,
4617 .p_class = P_GLOBAL,
4618 .ptr = &Globals.bWinbindEnumUsers,
4619 .special = NULL,
4620 .enum_list = NULL,
4621 .flags = FLAG_ADVANCED,
4624 .label = "winbind enum groups",
4625 .type = P_BOOL,
4626 .p_class = P_GLOBAL,
4627 .ptr = &Globals.bWinbindEnumGroups,
4628 .special = NULL,
4629 .enum_list = NULL,
4630 .flags = FLAG_ADVANCED,
4633 .label = "winbind use default domain",
4634 .type = P_BOOL,
4635 .p_class = P_GLOBAL,
4636 .ptr = &Globals.bWinbindUseDefaultDomain,
4637 .special = NULL,
4638 .enum_list = NULL,
4639 .flags = FLAG_ADVANCED,
4642 .label = "winbind trusted domains only",
4643 .type = P_BOOL,
4644 .p_class = P_GLOBAL,
4645 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4646 .special = NULL,
4647 .enum_list = NULL,
4648 .flags = FLAG_ADVANCED,
4651 .label = "winbind nested groups",
4652 .type = P_BOOL,
4653 .p_class = P_GLOBAL,
4654 .ptr = &Globals.bWinbindNestedGroups,
4655 .special = NULL,
4656 .enum_list = NULL,
4657 .flags = FLAG_ADVANCED,
4660 .label = "winbind expand groups",
4661 .type = P_INTEGER,
4662 .p_class = P_GLOBAL,
4663 .ptr = &Globals.winbind_expand_groups,
4664 .special = NULL,
4665 .enum_list = NULL,
4666 .flags = FLAG_ADVANCED,
4669 .label = "winbind nss info",
4670 .type = P_LIST,
4671 .p_class = P_GLOBAL,
4672 .ptr = &Globals.szWinbindNssInfo,
4673 .special = NULL,
4674 .enum_list = NULL,
4675 .flags = FLAG_ADVANCED,
4678 .label = "winbind refresh tickets",
4679 .type = P_BOOL,
4680 .p_class = P_GLOBAL,
4681 .ptr = &Globals.bWinbindRefreshTickets,
4682 .special = NULL,
4683 .enum_list = NULL,
4684 .flags = FLAG_ADVANCED,
4687 .label = "winbind offline logon",
4688 .type = P_BOOL,
4689 .p_class = P_GLOBAL,
4690 .ptr = &Globals.bWinbindOfflineLogon,
4691 .special = NULL,
4692 .enum_list = NULL,
4693 .flags = FLAG_ADVANCED,
4696 .label = "winbind normalize names",
4697 .type = P_BOOL,
4698 .p_class = P_GLOBAL,
4699 .ptr = &Globals.bWinbindNormalizeNames,
4700 .special = NULL,
4701 .enum_list = NULL,
4702 .flags = FLAG_ADVANCED,
4705 .label = "winbind rpc only",
4706 .type = P_BOOL,
4707 .p_class = P_GLOBAL,
4708 .ptr = &Globals.bWinbindRpcOnly,
4709 .special = NULL,
4710 .enum_list = NULL,
4711 .flags = FLAG_ADVANCED,
4714 .label = "create krb5 conf",
4715 .type = P_BOOL,
4716 .p_class = P_GLOBAL,
4717 .ptr = &Globals.bCreateKrb5Conf,
4718 .special = NULL,
4719 .enum_list = NULL,
4720 .flags = FLAG_ADVANCED,
4723 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4726 /***************************************************************************
4727 Initialise the sDefault parameter structure for the printer values.
4728 ***************************************************************************/
4730 static void init_printer_values(struct service *pService)
4732 /* choose defaults depending on the type of printing */
4733 switch (pService->iPrinting) {
4734 case PRINT_BSD:
4735 case PRINT_AIX:
4736 case PRINT_LPRNT:
4737 case PRINT_LPROS2:
4738 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4739 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4740 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4741 break;
4743 case PRINT_LPRNG:
4744 case PRINT_PLP:
4745 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4746 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4747 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4748 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4749 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4750 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4751 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4752 break;
4754 case PRINT_CUPS:
4755 case PRINT_IPRINT:
4756 #ifdef HAVE_CUPS
4757 /* set the lpq command to contain the destination printer
4758 name only. This is used by cups_queue_get() */
4759 string_set(&pService->szLpqcommand, "%p");
4760 string_set(&pService->szLprmcommand, "");
4761 string_set(&pService->szPrintcommand, "");
4762 string_set(&pService->szLppausecommand, "");
4763 string_set(&pService->szLpresumecommand, "");
4764 string_set(&pService->szQueuepausecommand, "");
4765 string_set(&pService->szQueueresumecommand, "");
4766 #else
4767 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4768 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4769 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4770 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4771 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4772 string_set(&pService->szQueuepausecommand, "disable '%p'");
4773 string_set(&pService->szQueueresumecommand, "enable '%p'");
4774 #endif /* HAVE_CUPS */
4775 break;
4777 case PRINT_SYSV:
4778 case PRINT_HPUX:
4779 string_set(&pService->szLpqcommand, "lpstat -o%p");
4780 string_set(&pService->szLprmcommand, "cancel %p-%j");
4781 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4782 string_set(&pService->szQueuepausecommand, "disable %p");
4783 string_set(&pService->szQueueresumecommand, "enable %p");
4784 #ifndef HPUX
4785 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4786 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4787 #endif /* HPUX */
4788 break;
4790 case PRINT_QNX:
4791 string_set(&pService->szLpqcommand, "lpq -P%p");
4792 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4793 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4794 break;
4796 #ifdef DEVELOPER
4797 case PRINT_TEST:
4798 case PRINT_VLP:
4799 string_set(&pService->szPrintcommand, "vlp print %p %s");
4800 string_set(&pService->szLpqcommand, "vlp lpq %p");
4801 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4802 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4803 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4804 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4805 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4806 break;
4807 #endif /* DEVELOPER */
4812 * Function to return the default value for the maximum number of open
4813 * file descriptors permitted. This function tries to consult the
4814 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4815 * the smaller of those.
4817 static int max_open_files(void)
4819 int sysctl_max = MAX_OPEN_FILES;
4820 int rlimit_max = MAX_OPEN_FILES;
4822 #ifdef HAVE_SYSCTLBYNAME
4824 size_t size = sizeof(sysctl_max);
4825 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4828 #endif
4830 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4832 struct rlimit rl;
4834 ZERO_STRUCT(rl);
4836 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4837 rlimit_max = rl.rlim_cur;
4839 #if defined(RLIM_INFINITY)
4840 if(rl.rlim_cur == RLIM_INFINITY)
4841 rlimit_max = MAX_OPEN_FILES;
4843 #endif
4844 #endif
4846 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4847 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4848 "minimum Windows limit (%d)\n",
4849 sysctl_max,
4850 MIN_OPEN_FILES_WINDOWS));
4851 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4854 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4855 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4856 "minimum Windows limit (%d)\n",
4857 rlimit_max,
4858 MIN_OPEN_FILES_WINDOWS));
4859 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4862 return MIN(sysctl_max, rlimit_max);
4866 * Common part of freeing allocated data for one parameter.
4868 static void free_one_parameter_common(void *parm_ptr,
4869 struct parm_struct parm)
4871 if ((parm.type == P_STRING) ||
4872 (parm.type == P_USTRING))
4874 string_free((char**)parm_ptr);
4875 } else if (parm.type == P_LIST) {
4876 TALLOC_FREE(*((char***)parm_ptr));
4881 * Free the allocated data for one parameter for a share
4882 * given as a service struct.
4884 static void free_one_parameter(struct service *service,
4885 struct parm_struct parm)
4887 void *parm_ptr;
4889 if (parm.p_class != P_LOCAL) {
4890 return;
4893 parm_ptr = lp_local_ptr(service, parm.ptr);
4895 free_one_parameter_common(parm_ptr, parm);
4899 * Free the allocated parameter data of a share given
4900 * as a service struct.
4902 static void free_parameters(struct service *service)
4904 uint32_t i;
4906 for (i=0; parm_table[i].label; i++) {
4907 free_one_parameter(service, parm_table[i]);
4912 * Free the allocated data for one parameter for a given share
4913 * specified by an snum.
4915 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4917 void *parm_ptr;
4919 if (parm.ptr == NULL) {
4920 return;
4923 if (snum < 0) {
4924 parm_ptr = parm.ptr;
4925 } else if (parm.p_class != P_LOCAL) {
4926 return;
4927 } else {
4928 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4931 free_one_parameter_common(parm_ptr, parm);
4935 * Free the allocated parameter data for a share specified
4936 * by an snum.
4938 static void free_parameters_by_snum(int snum)
4940 uint32_t i;
4942 for (i=0; parm_table[i].label; i++) {
4943 free_one_parameter_by_snum(snum, parm_table[i]);
4948 * Free the allocated global parameters.
4950 static void free_global_parameters(void)
4952 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4955 /***************************************************************************
4956 Initialise the global parameter structure.
4957 ***************************************************************************/
4959 static void init_globals(bool first_time_only)
4961 static bool done_init = False;
4962 char *s = NULL;
4963 int i;
4965 /* If requested to initialize only once and we've already done it... */
4966 if (first_time_only && done_init) {
4967 /* ... then we have nothing more to do */
4968 return;
4971 if (!done_init) {
4972 /* The logfile can be set before this is invoked. Free it if so. */
4973 if (Globals.szLogFile != NULL) {
4974 string_free(&Globals.szLogFile);
4975 Globals.szLogFile = NULL;
4977 done_init = True;
4978 } else {
4979 free_global_parameters();
4982 memset((void *)&Globals, '\0', sizeof(Globals));
4984 for (i = 0; parm_table[i].label; i++) {
4985 if ((parm_table[i].type == P_STRING ||
4986 parm_table[i].type == P_USTRING) &&
4987 parm_table[i].ptr)
4989 string_set((char **)parm_table[i].ptr, "");
4993 string_set(&sDefault.fstype, FSTYPE_STRING);
4994 string_set(&sDefault.szPrintjobUsername, "%U");
4996 init_printer_values(&sDefault);
4999 DEBUG(3, ("Initialising global parameters\n"));
5001 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
5002 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
5004 /* use the new 'hash2' method by default, with a prefix of 1 */
5005 string_set(&Globals.szManglingMethod, "hash2");
5006 Globals.mangle_prefix = 1;
5008 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
5010 /* using UTF8 by default allows us to support all chars */
5011 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
5013 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
5014 /* If the system supports nl_langinfo(), try to grab the value
5015 from the user's locale */
5016 string_set(&Globals.display_charset, "LOCALE");
5017 #else
5018 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
5019 #endif
5021 /* Use codepage 850 as a default for the dos character set */
5022 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
5025 * Allow the default PASSWD_CHAT to be overridden in local.h.
5027 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
5029 set_global_myname(myhostname());
5030 string_set(&Globals.szNetbiosName,global_myname());
5032 set_global_myworkgroup(WORKGROUP);
5033 string_set(&Globals.szWorkgroup, lp_workgroup());
5035 string_set(&Globals.szPasswdProgram, "");
5036 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
5037 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
5038 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
5039 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5040 string_set(&Globals.szSocketAddress, "0.0.0.0");
5042 * By default support explicit binding to broadcast
5043 * addresses.
5045 Globals.bNmbdBindExplicitBroadcast = true;
5047 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5048 smb_panic("init_globals: ENOMEM");
5050 string_set(&Globals.szServerString, s);
5051 SAFE_FREE(s);
5052 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5053 DEFAULT_MINOR_VERSION) < 0) {
5054 smb_panic("init_globals: ENOMEM");
5056 string_set(&Globals.szAnnounceVersion, s);
5057 SAFE_FREE(s);
5058 #ifdef DEVELOPER
5059 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5060 #endif
5062 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5064 string_set(&Globals.szLogonDrive, "");
5065 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5066 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5067 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5069 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5070 string_set(&Globals.szPasswordServer, "*");
5072 Globals.AlgorithmicRidBase = BASE_RID;
5074 Globals.bLoadPrinters = True;
5075 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5077 Globals.ConfigBackend = config_backend;
5079 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5080 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5081 Globals.max_xmit = 0x4104;
5082 Globals.max_mux = 50; /* This is *needed* for profile support. */
5083 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5084 Globals.bDisableSpoolss = False;
5085 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5086 Globals.pwordlevel = 0;
5087 Globals.unamelevel = 0;
5088 Globals.deadtime = 0;
5089 Globals.getwd_cache = true;
5090 Globals.bLargeReadwrite = True;
5091 Globals.max_log_size = 5000;
5092 Globals.max_open_files = max_open_files();
5093 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5094 Globals.maxprotocol = PROTOCOL_NT1;
5095 Globals.minprotocol = PROTOCOL_CORE;
5096 Globals.security = SEC_USER;
5097 Globals.paranoid_server_security = True;
5098 Globals.bEncryptPasswords = True;
5099 Globals.bUpdateEncrypt = False;
5100 Globals.clientSchannel = Auto;
5101 Globals.serverSchannel = Auto;
5102 Globals.bReadRaw = True;
5103 Globals.bWriteRaw = True;
5104 Globals.bNullPasswords = False;
5105 Globals.bObeyPamRestrictions = False;
5106 Globals.syslog = 1;
5107 Globals.bSyslogOnly = False;
5108 Globals.bTimestampLogs = True;
5109 string_set(&Globals.szLogLevel, "0");
5110 Globals.bDebugPrefixTimestamp = False;
5111 Globals.bDebugHiresTimestamp = true;
5112 Globals.bDebugPid = False;
5113 Globals.bDebugUid = False;
5114 Globals.bDebugClass = False;
5115 Globals.bEnableCoreFiles = True;
5116 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5117 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5118 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5119 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5120 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5121 Globals.lm_interval = 60;
5122 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5123 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5124 Globals.bNISHomeMap = False;
5125 #ifdef WITH_NISPLUS_HOME
5126 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5127 #else
5128 string_set(&Globals.szNISHomeMapName, "auto.home");
5129 #endif
5130 #endif
5131 Globals.bTimeServer = False;
5132 Globals.bBindInterfacesOnly = False;
5133 Globals.bUnixPasswdSync = False;
5134 Globals.bPamPasswordChange = False;
5135 Globals.bPasswdChatDebug = False;
5136 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5137 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5138 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5139 Globals.bStatCache = True; /* use stat cache by default */
5140 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5141 Globals.restrict_anonymous = 0;
5142 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5143 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5144 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5145 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5146 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5147 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5149 Globals.map_to_guest = 0; /* By Default, "Never" */
5150 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5151 Globals.enhanced_browsing = true;
5152 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5153 #ifdef MMAP_BLACKLIST
5154 Globals.bUseMmap = False;
5155 #else
5156 Globals.bUseMmap = True;
5157 #endif
5158 Globals.bUnixExtensions = True;
5159 Globals.bResetOnZeroVC = False;
5160 Globals.bLogWriteableFilesOnExit = False;
5161 Globals.bCreateKrb5Conf = true;
5163 /* hostname lookups can be very expensive and are broken on
5164 a large number of sites (tridge) */
5165 Globals.bHostnameLookups = False;
5167 string_set(&Globals.szPassdbBackend, "tdbsam");
5168 string_set(&Globals.szLdapSuffix, "");
5169 string_set(&Globals.szLdapMachineSuffix, "");
5170 string_set(&Globals.szLdapUserSuffix, "");
5171 string_set(&Globals.szLdapGroupSuffix, "");
5172 string_set(&Globals.szLdapIdmapSuffix, "");
5174 string_set(&Globals.szLdapAdminDn, "");
5175 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5176 Globals.ldap_ssl_ads = False;
5177 Globals.ldap_deref = -1;
5178 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5179 Globals.ldap_delete_dn = False;
5180 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5181 Globals.ldap_follow_referral = Auto;
5182 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5183 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5184 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5186 Globals.ldap_debug_level = 0;
5187 Globals.ldap_debug_threshold = 10;
5189 /* This is what we tell the afs client. in reality we set the token
5190 * to never expire, though, when this runs out the afs client will
5191 * forget the token. Set to 0 to get NEVERDATE.*/
5192 Globals.iAfsTokenLifetime = 604800;
5193 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5195 /* these parameters are set to defaults that are more appropriate
5196 for the increasing samba install base:
5198 as a member of the workgroup, that will possibly become a
5199 _local_ master browser (lm = True). this is opposed to a forced
5200 local master browser startup (pm = True).
5202 doesn't provide WINS server service by default (wsupp = False),
5203 and doesn't provide domain master browser services by default, either.
5207 Globals.bMsAddPrinterWizard = True;
5208 Globals.os_level = 20;
5209 Globals.bLocalMaster = True;
5210 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5211 Globals.bDomainLogons = False;
5212 Globals.bBrowseList = True;
5213 Globals.bWINSsupport = False;
5214 Globals.bWINSproxy = False;
5216 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5217 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5219 Globals.bDNSproxy = True;
5221 /* this just means to use them if they exist */
5222 Globals.bKernelOplocks = True;
5224 Globals.bAllowTrustedDomains = True;
5225 string_set(&Globals.szIdmapBackend, "tdb");
5227 string_set(&Globals.szTemplateShell, "/bin/false");
5228 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5229 string_set(&Globals.szWinbindSeparator, "\\");
5231 string_set(&Globals.szCupsServer, "");
5232 string_set(&Globals.szIPrintServer, "");
5234 string_set(&Globals.ctdbdSocket, "");
5235 Globals.szClusterAddresses = NULL;
5236 Globals.clustering = False;
5237 Globals.ctdb_timeout = 0;
5238 Globals.ctdb_locktime_warn_threshold = 0;
5240 Globals.winbind_cache_time = 300; /* 5 minutes */
5241 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5242 Globals.bWinbindEnumUsers = False;
5243 Globals.bWinbindEnumGroups = False;
5244 Globals.bWinbindUseDefaultDomain = False;
5245 Globals.bWinbindTrustedDomainsOnly = False;
5246 Globals.bWinbindNestedGroups = True;
5247 Globals.winbind_expand_groups = 1;
5248 Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL);
5249 Globals.bWinbindRefreshTickets = False;
5250 Globals.bWinbindOfflineLogon = False;
5252 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5253 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5255 Globals.bPassdbExpandExplicit = False;
5257 Globals.name_cache_timeout = 660; /* In seconds */
5259 Globals.bUseSpnego = True;
5260 Globals.bClientUseSpnego = True;
5262 Globals.client_signing = Auto;
5263 Globals.server_signing = False;
5265 Globals.bDeferSharingViolations = True;
5266 string_set(&Globals.smb_ports, SMB_PORTS);
5268 Globals.bEnablePrivileges = True;
5269 Globals.bHostMSDfs = True;
5270 Globals.bASUSupport = False;
5272 /* User defined shares. */
5273 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5274 smb_panic("init_globals: ENOMEM");
5276 string_set(&Globals.szUsersharePath, s);
5277 SAFE_FREE(s);
5278 string_set(&Globals.szUsershareTemplateShare, "");
5279 Globals.iUsershareMaxShares = 0;
5280 /* By default disallow sharing of directories not owned by the sharer. */
5281 Globals.bUsershareOwnerOnly = True;
5282 /* By default disallow guest access to usershares. */
5283 Globals.bUsershareAllowGuests = False;
5285 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5287 /* By default no shares out of the registry */
5288 Globals.bRegistryShares = False;
5290 Globals.iminreceivefile = 0;
5292 Globals.bMapUntrustedToDomain = false;
5294 Globals.ismb2_max_read = 64*1024;
5295 Globals.ismb2_max_write = 64*1024;
5296 Globals.ismb2_max_trans = 64*1024;
5299 /*******************************************************************
5300 Convenience routine to grab string parameters into temporary memory
5301 and run standard_sub_basic on them. The buffers can be written to by
5302 callers without affecting the source string.
5303 ********************************************************************/
5305 static char *lp_string(const char *s)
5307 char *ret;
5308 TALLOC_CTX *ctx = talloc_tos();
5310 /* The follow debug is useful for tracking down memory problems
5311 especially if you have an inner loop that is calling a lp_*()
5312 function that returns a string. Perhaps this debug should be
5313 present all the time? */
5315 #if 0
5316 DEBUG(10, ("lp_string(%s)\n", s));
5317 #endif
5318 if (!s) {
5319 return NULL;
5322 ret = talloc_sub_basic(ctx,
5323 get_current_username(),
5324 current_user_info.domain,
5326 if (trim_char(ret, '\"', '\"')) {
5327 if (strchr(ret,'\"') != NULL) {
5328 TALLOC_FREE(ret);
5329 ret = talloc_sub_basic(ctx,
5330 get_current_username(),
5331 current_user_info.domain,
5335 return ret;
5339 In this section all the functions that are used to access the
5340 parameters from the rest of the program are defined
5343 #define FN_GLOBAL_STRING(fn_name,ptr) \
5344 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5345 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5346 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5347 #define FN_GLOBAL_LIST(fn_name,ptr) \
5348 const char **fn_name(void) {return(*(const char ***)(ptr));}
5349 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5350 bool fn_name(void) {return(*(bool *)(ptr));}
5351 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5352 char fn_name(void) {return(*(char *)(ptr));}
5353 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5354 int fn_name(void) {return(*(int *)(ptr));}
5356 #define FN_LOCAL_STRING(fn_name,val) \
5357 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5358 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5359 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5360 #define FN_LOCAL_LIST(fn_name,val) \
5361 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5362 #define FN_LOCAL_BOOL(fn_name,val) \
5363 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5364 #define FN_LOCAL_INTEGER(fn_name,val) \
5365 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5367 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5368 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5369 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5370 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5371 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5372 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));}
5373 #define FN_LOCAL_CHAR(fn_name,val) \
5374 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5376 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5377 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5378 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5379 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5380 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5381 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5382 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5383 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5384 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5385 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5386 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5387 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5388 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5389 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5390 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5391 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5392 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5393 * build process or in smb.conf, we use that value. Otherwise they
5394 * default to the value of lp_lockdir(). */
5395 char *lp_statedir(void) {
5396 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5397 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5398 return(lp_string(*(char **)(&Globals.szStateDir) ?
5399 *(char **)(&Globals.szStateDir) : ""));
5400 else
5401 return(lp_string(*(char **)(&Globals.szLockDir) ?
5402 *(char **)(&Globals.szLockDir) : ""));
5404 char *lp_cachedir(void) {
5405 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5406 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5407 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5408 *(char **)(&Globals.szCacheDir) : ""));
5409 else
5410 return(lp_string(*(char **)(&Globals.szLockDir) ?
5411 *(char **)(&Globals.szLockDir) : ""));
5413 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5414 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5415 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5416 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5417 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5418 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5419 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5420 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5421 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5422 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5423 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5424 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5425 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5426 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5427 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5428 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5429 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5430 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5431 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5432 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5433 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5434 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5435 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5436 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5437 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5438 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5439 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5440 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5441 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5442 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5443 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5444 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5445 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5446 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5447 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5448 * lp_passdb_backend() should be replace by the this macro again after
5449 * some releases.
5450 * */
5451 const char *lp_passdb_backend(void)
5453 char *delim, *quote;
5455 delim = strchr( Globals.szPassdbBackend, ' ');
5456 /* no space at all */
5457 if (delim == NULL) {
5458 goto out;
5461 quote = strchr(Globals.szPassdbBackend, '"');
5462 /* no quote char or non in the first part */
5463 if (quote == NULL || quote > delim) {
5464 *delim = '\0';
5465 goto warn;
5468 quote = strchr(quote+1, '"');
5469 if (quote == NULL) {
5470 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5471 goto out;
5472 } else if (*(quote+1) == '\0') {
5473 /* space, fitting quote char, and one backend only */
5474 goto out;
5475 } else {
5476 /* terminate string after the fitting quote char */
5477 *(quote+1) = '\0';
5480 warn:
5481 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5482 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5483 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5484 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5486 out:
5487 return Globals.szPassdbBackend;
5489 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5490 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5491 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5492 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5493 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5495 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5496 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5497 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5498 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5499 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5500 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5502 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5504 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5505 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5506 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5507 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
5509 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5511 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5512 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5513 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5514 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5515 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5516 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5517 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5518 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5519 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5520 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5521 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5522 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5523 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5524 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5525 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5526 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5528 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5529 FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
5530 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5531 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5532 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5533 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5535 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5536 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5537 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5538 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5539 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5540 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5541 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5542 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5543 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5544 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5545 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5546 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5547 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5548 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5549 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5550 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5551 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5552 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5553 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5554 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5556 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5558 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5559 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5560 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5561 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5562 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5563 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5564 &Globals.bLogWriteableFilesOnExit)
5565 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5566 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5567 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5568 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5569 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5570 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5571 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5572 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5573 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5574 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5575 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
5576 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5577 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
5578 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5579 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5580 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5581 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
5582 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5583 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5584 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5585 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5586 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5587 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5588 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5589 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5590 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5591 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5592 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5593 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5594 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5595 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5596 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5597 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5598 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5599 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5600 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5601 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5602 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5603 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5604 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5605 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5606 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5607 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5608 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5609 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5610 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5611 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5612 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5613 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5614 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5615 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5616 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5617 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5618 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5619 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5620 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5621 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5622 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5623 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5624 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5625 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5626 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5627 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5628 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5629 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5630 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5631 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5632 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5633 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5634 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5635 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5636 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5637 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5638 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5639 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5640 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5641 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5642 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5643 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5644 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5645 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5646 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5647 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5648 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5649 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5650 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5651 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5652 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5653 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5654 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5655 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5656 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5657 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5658 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5659 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5660 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
5661 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
5662 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
5664 FN_LOCAL_STRING(lp_preexec, szPreExec)
5665 FN_LOCAL_STRING(lp_postexec, szPostExec)
5666 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5667 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5668 FN_LOCAL_STRING(lp_servicename, szService)
5669 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5670 FN_LOCAL_STRING(lp_pathname, szPath)
5671 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5672 FN_LOCAL_STRING(lp_username, szUsername)
5673 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5674 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5675 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5676 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5677 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5678 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5679 int lp_cups_encrypt(void)
5681 #ifdef HAVE_HTTPCONNECTENCRYPT
5682 switch (Globals.CupsEncrypt) {
5683 case Auto:
5684 Globals.CupsEncrypt = HTTP_ENCRYPT_REQUIRED;
5685 break;
5686 case True:
5687 Globals.CupsEncrypt = HTTP_ENCRYPT_ALWAYS;
5688 break;
5689 case False:
5690 Globals.CupsEncrypt = HTTP_ENCRYPT_NEVER;
5691 break;
5693 #endif
5694 return Globals.CupsEncrypt;
5696 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5697 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5698 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5699 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5700 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5701 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5702 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5703 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5704 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5705 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5706 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5707 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5708 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5709 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5710 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5711 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5712 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5713 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5714 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5715 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5716 FN_LOCAL_STRING(lp_comment, comment)
5717 FN_LOCAL_STRING(lp_force_user, force_user)
5718 FN_LOCAL_STRING(lp_force_group, force_group)
5719 FN_LOCAL_LIST(lp_readlist, readlist)
5720 FN_LOCAL_LIST(lp_writelist, writelist)
5721 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5722 FN_LOCAL_STRING(lp_fstype, fstype)
5723 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5724 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5725 static FN_LOCAL_STRING(lp_volume, volume)
5726 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5727 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5728 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5729 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5730 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5731 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5732 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5733 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5734 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5735 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5736 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5737 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5738 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5739 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5740 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5741 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5742 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5743 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5744 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5745 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5746 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5747 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5748 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5749 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5750 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5751 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5752 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5753 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5754 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5755 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5756 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5757 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5758 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5759 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5760 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5761 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5762 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5763 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5764 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5765 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5766 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5767 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5768 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5769 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5770 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5771 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5772 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5773 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5774 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5775 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5776 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5777 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5778 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5779 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5780 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5781 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5782 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5783 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5784 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5785 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5786 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5787 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5788 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5789 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5790 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5791 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5792 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5793 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5794 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5795 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5796 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5797 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5798 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5799 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5800 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5801 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5802 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5803 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5804 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5805 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5806 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5807 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5808 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5809 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5810 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5811 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5812 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5813 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5814 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5815 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5816 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5817 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5818 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5819 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5820 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5821 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5822 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5823 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5824 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5826 /* local prototypes */
5828 static int map_parameter(const char *pszParmName);
5829 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5830 static const char *get_boolean(bool bool_value);
5831 static int getservicebyname(const char *pszServiceName,
5832 struct service *pserviceDest);
5833 static void copy_service(struct service *pserviceDest,
5834 struct service *pserviceSource,
5835 struct bitmap *pcopymapDest);
5836 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5837 void *userdata);
5838 static bool do_section(const char *pszSectionName, void *userdata);
5839 static void init_copymap(struct service *pservice);
5840 static bool hash_a_service(const char *name, int number);
5841 static void free_service_byindex(int iService);
5842 static void free_param_opts(struct param_opt_struct **popts);
5843 static void show_parameter(int parmIndex);
5844 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5847 * This is a helper function for parametrical options support. It returns a
5848 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5849 * parametrical functions are quite simple
5851 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5852 const char *option)
5854 bool global_section = False;
5855 char* param_key;
5856 struct param_opt_struct *data;
5858 if (snum >= iNumServices) return NULL;
5860 if (snum < 0) {
5861 data = Globals.param_opt;
5862 global_section = True;
5863 } else {
5864 data = ServicePtrs[snum]->param_opt;
5867 if (asprintf(&param_key, "%s:%s", type, option) == -1) {
5868 DEBUG(0,("asprintf failed!\n"));
5869 return NULL;
5872 while (data) {
5873 if (strwicmp(data->key, param_key) == 0) {
5874 string_free(&param_key);
5875 return data;
5877 data = data->next;
5880 if (!global_section) {
5881 /* Try to fetch the same option but from globals */
5882 /* but only if we are not already working with Globals */
5883 data = Globals.param_opt;
5884 while (data) {
5885 if (strwicmp(data->key, param_key) == 0) {
5886 string_free(&param_key);
5887 return data;
5889 data = data->next;
5893 string_free(&param_key);
5895 return NULL;
5899 #define MISSING_PARAMETER(name) \
5900 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5902 /*******************************************************************
5903 convenience routine to return int parameters.
5904 ********************************************************************/
5905 static int lp_int(const char *s)
5908 if (!s || !*s) {
5909 MISSING_PARAMETER(lp_int);
5910 return (-1);
5913 return (int)strtol(s, NULL, 0);
5916 /*******************************************************************
5917 convenience routine to return unsigned long parameters.
5918 ********************************************************************/
5919 static unsigned long lp_ulong(const char *s)
5922 if (!s || !*s) {
5923 MISSING_PARAMETER(lp_ulong);
5924 return (0);
5927 return strtoul(s, NULL, 0);
5930 /*******************************************************************
5931 convenience routine to return boolean parameters.
5932 ********************************************************************/
5933 static bool lp_bool(const char *s)
5935 bool ret = False;
5937 if (!s || !*s) {
5938 MISSING_PARAMETER(lp_bool);
5939 return False;
5942 if (!set_boolean(s, &ret)) {
5943 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5944 return False;
5947 return ret;
5950 /*******************************************************************
5951 convenience routine to return enum parameters.
5952 ********************************************************************/
5953 static int lp_enum(const char *s,const struct enum_list *_enum)
5955 int i;
5957 if (!s || !*s || !_enum) {
5958 MISSING_PARAMETER(lp_enum);
5959 return (-1);
5962 for (i=0; _enum[i].name; i++) {
5963 if (strequal(_enum[i].name,s))
5964 return _enum[i].value;
5967 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5968 return (-1);
5971 #undef MISSING_PARAMETER
5973 /* DO NOT USE lp_parm_string ANYMORE!!!!
5974 * use lp_parm_const_string or lp_parm_talloc_string
5976 * lp_parm_string is only used to let old modules find this symbol
5978 #undef lp_parm_string
5979 char *lp_parm_string(const char *servicename, const char *type, const char *option);
5980 char *lp_parm_string(const char *servicename, const char *type, const char *option)
5982 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
5985 /* Return parametric option from a given service. Type is a part of option before ':' */
5986 /* Parametric option has following syntax: 'Type: option = value' */
5987 /* the returned value is talloced on the talloc_tos() */
5988 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
5990 struct param_opt_struct *data = get_parametrics(snum, type, option);
5992 if (data == NULL||data->value==NULL) {
5993 if (def) {
5994 return lp_string(def);
5995 } else {
5996 return NULL;
6000 return lp_string(data->value);
6003 /* Return parametric option from a given service. Type is a part of option before ':' */
6004 /* Parametric option has following syntax: 'Type: option = value' */
6005 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
6007 struct param_opt_struct *data = get_parametrics(snum, type, option);
6009 if (data == NULL||data->value==NULL)
6010 return def;
6012 return data->value;
6015 /* Return parametric option from a given service. Type is a part of option before ':' */
6016 /* Parametric option has following syntax: 'Type: option = value' */
6018 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
6020 struct param_opt_struct *data = get_parametrics(snum, type, option);
6022 if (data == NULL||data->value==NULL)
6023 return (const char **)def;
6025 if (data->list==NULL) {
6026 data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL);
6029 return (const char **)data->list;
6032 /* Return parametric option from a given service. Type is a part of option before ':' */
6033 /* Parametric option has following syntax: 'Type: option = value' */
6035 int lp_parm_int(int snum, const char *type, const char *option, int def)
6037 struct param_opt_struct *data = get_parametrics(snum, type, option);
6039 if (data && data->value && *data->value)
6040 return lp_int(data->value);
6042 return def;
6045 /* Return parametric option from a given service. Type is a part of option before ':' */
6046 /* Parametric option has following syntax: 'Type: option = value' */
6048 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6050 struct param_opt_struct *data = get_parametrics(snum, type, option);
6052 if (data && data->value && *data->value)
6053 return lp_ulong(data->value);
6055 return def;
6058 /* Return parametric option from a given service. Type is a part of option before ':' */
6059 /* Parametric option has following syntax: 'Type: option = value' */
6061 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6063 struct param_opt_struct *data = get_parametrics(snum, type, option);
6065 if (data && data->value && *data->value)
6066 return lp_bool(data->value);
6068 return def;
6071 /* Return parametric option from a given service. Type is a part of option before ':' */
6072 /* Parametric option has following syntax: 'Type: option = value' */
6074 int lp_parm_enum(int snum, const char *type, const char *option,
6075 const struct enum_list *_enum, int def)
6077 struct param_opt_struct *data = get_parametrics(snum, type, option);
6079 if (data && data->value && *data->value && _enum)
6080 return lp_enum(data->value, _enum);
6082 return def;
6086 /***************************************************************************
6087 Initialise a service to the defaults.
6088 ***************************************************************************/
6090 static void init_service(struct service *pservice)
6092 memset((char *)pservice, '\0', sizeof(struct service));
6093 copy_service(pservice, &sDefault, NULL);
6098 * free a param_opts structure.
6099 * param_opts handling should be moved to talloc;
6100 * then this whole functions reduces to a TALLOC_FREE().
6103 static void free_param_opts(struct param_opt_struct **popts)
6105 struct param_opt_struct *opt, *next_opt;
6107 if (popts == NULL) {
6108 return;
6111 if (*popts != NULL) {
6112 DEBUG(5, ("Freeing parametrics:\n"));
6114 opt = *popts;
6115 while (opt != NULL) {
6116 string_free(&opt->key);
6117 string_free(&opt->value);
6118 TALLOC_FREE(opt->list);
6119 next_opt = opt->next;
6120 SAFE_FREE(opt);
6121 opt = next_opt;
6123 *popts = NULL;
6126 /***************************************************************************
6127 Free the dynamically allocated parts of a service struct.
6128 ***************************************************************************/
6130 static void free_service(struct service *pservice)
6132 if (!pservice)
6133 return;
6135 if (pservice->szService)
6136 DEBUG(5, ("free_service: Freeing service %s\n",
6137 pservice->szService));
6139 free_parameters(pservice);
6141 string_free(&pservice->szService);
6142 TALLOC_FREE(pservice->copymap);
6144 free_param_opts(&pservice->param_opt);
6146 ZERO_STRUCTP(pservice);
6150 /***************************************************************************
6151 remove a service indexed in the ServicePtrs array from the ServiceHash
6152 and free the dynamically allocated parts
6153 ***************************************************************************/
6155 static void free_service_byindex(int idx)
6157 if ( !LP_SNUM_OK(idx) )
6158 return;
6160 ServicePtrs[idx]->valid = False;
6161 invalid_services[num_invalid_services++] = idx;
6163 /* we have to cleanup the hash record */
6165 if (ServicePtrs[idx]->szService) {
6166 char *canon_name = canonicalize_servicename(
6167 talloc_tos(),
6168 ServicePtrs[idx]->szService );
6170 dbwrap_delete_bystring(ServiceHash, canon_name );
6171 TALLOC_FREE(canon_name);
6174 free_service(ServicePtrs[idx]);
6177 /***************************************************************************
6178 Add a new service to the services array initialising it with the given
6179 service.
6180 ***************************************************************************/
6182 static int add_a_service(const struct service *pservice, const char *name)
6184 int i;
6185 struct service tservice;
6186 int num_to_alloc = iNumServices + 1;
6188 tservice = *pservice;
6190 /* it might already exist */
6191 if (name) {
6192 i = getservicebyname(name, NULL);
6193 if (i >= 0) {
6194 /* Clean all parametric options for service */
6195 /* They will be added during parsing again */
6196 free_param_opts(&ServicePtrs[i]->param_opt);
6197 return (i);
6201 /* find an invalid one */
6202 i = iNumServices;
6203 if (num_invalid_services > 0) {
6204 i = invalid_services[--num_invalid_services];
6207 /* if not, then create one */
6208 if (i == iNumServices) {
6209 struct service **tsp;
6210 int *tinvalid;
6212 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6213 if (tsp == NULL) {
6214 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6215 return (-1);
6217 ServicePtrs = tsp;
6218 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6219 if (!ServicePtrs[iNumServices]) {
6220 DEBUG(0,("add_a_service: out of memory!\n"));
6221 return (-1);
6223 iNumServices++;
6225 /* enlarge invalid_services here for now... */
6226 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6227 num_to_alloc);
6228 if (tinvalid == NULL) {
6229 DEBUG(0,("add_a_service: failed to enlarge "
6230 "invalid_services!\n"));
6231 return (-1);
6233 invalid_services = tinvalid;
6234 } else {
6235 free_service_byindex(i);
6238 ServicePtrs[i]->valid = True;
6240 init_service(ServicePtrs[i]);
6241 copy_service(ServicePtrs[i], &tservice, NULL);
6242 if (name)
6243 string_set(&ServicePtrs[i]->szService, name);
6245 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6246 i, ServicePtrs[i]->szService));
6248 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6249 return (-1);
6252 return (i);
6255 /***************************************************************************
6256 Convert a string to uppercase and remove whitespaces.
6257 ***************************************************************************/
6259 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6261 char *result;
6263 if ( !src ) {
6264 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6265 return NULL;
6268 result = talloc_strdup(ctx, src);
6269 SMB_ASSERT(result != NULL);
6271 strlower_m(result);
6272 return result;
6275 /***************************************************************************
6276 Add a name/index pair for the services array to the hash table.
6277 ***************************************************************************/
6279 static bool hash_a_service(const char *name, int idx)
6281 char *canon_name;
6283 if ( !ServiceHash ) {
6284 DEBUG(10,("hash_a_service: creating servicehash\n"));
6285 ServiceHash = db_open_rbt(NULL);
6286 if ( !ServiceHash ) {
6287 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6288 return False;
6292 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6293 idx, name));
6295 canon_name = canonicalize_servicename(talloc_tos(), name );
6297 dbwrap_store_bystring(ServiceHash, canon_name,
6298 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6299 TDB_REPLACE);
6301 TALLOC_FREE(canon_name);
6303 return True;
6306 /***************************************************************************
6307 Add a new home service, with the specified home directory, defaults coming
6308 from service ifrom.
6309 ***************************************************************************/
6311 bool lp_add_home(const char *pszHomename, int iDefaultService,
6312 const char *user, const char *pszHomedir)
6314 int i;
6316 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6317 pszHomedir[0] == '\0') {
6318 return false;
6321 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6323 if (i < 0)
6324 return (False);
6326 if (!(*(ServicePtrs[iDefaultService]->szPath))
6327 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6328 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6331 if (!(*(ServicePtrs[i]->comment))) {
6332 char *comment = NULL;
6333 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6334 return false;
6336 string_set(&ServicePtrs[i]->comment, comment);
6337 SAFE_FREE(comment);
6340 /* set the browseable flag from the global default */
6342 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6343 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6345 ServicePtrs[i]->autoloaded = True;
6347 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6348 user, ServicePtrs[i]->szPath ));
6350 return (True);
6353 /***************************************************************************
6354 Add a new service, based on an old one.
6355 ***************************************************************************/
6357 int lp_add_service(const char *pszService, int iDefaultService)
6359 if (iDefaultService < 0) {
6360 return add_a_service(&sDefault, pszService);
6363 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6366 /***************************************************************************
6367 Add the IPC service.
6368 ***************************************************************************/
6370 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6372 char *comment = NULL;
6373 int i = add_a_service(&sDefault, ipc_name);
6375 if (i < 0)
6376 return (False);
6378 if (asprintf(&comment, "IPC Service (%s)",
6379 Globals.szServerString) < 0) {
6380 return (False);
6383 string_set(&ServicePtrs[i]->szPath, tmpdir());
6384 string_set(&ServicePtrs[i]->szUsername, "");
6385 string_set(&ServicePtrs[i]->comment, comment);
6386 string_set(&ServicePtrs[i]->fstype, "IPC");
6387 ServicePtrs[i]->iMaxConnections = 0;
6388 ServicePtrs[i]->bAvailable = True;
6389 ServicePtrs[i]->bRead_only = True;
6390 ServicePtrs[i]->bGuest_only = False;
6391 ServicePtrs[i]->bAdministrative_share = True;
6392 ServicePtrs[i]->bGuest_ok = guest_ok;
6393 ServicePtrs[i]->bPrint_ok = False;
6394 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6396 DEBUG(3, ("adding IPC service\n"));
6398 SAFE_FREE(comment);
6399 return (True);
6402 /***************************************************************************
6403 Add a new printer service, with defaults coming from service iFrom.
6404 ***************************************************************************/
6406 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6408 const char *comment = "From Printcap";
6409 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6411 if (i < 0)
6412 return (False);
6414 /* note that we do NOT default the availability flag to True - */
6415 /* we take it from the default service passed. This allows all */
6416 /* dynamic printers to be disabled by disabling the [printers] */
6417 /* entry (if/when the 'available' keyword is implemented!). */
6419 /* the printer name is set to the service name. */
6420 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6421 string_set(&ServicePtrs[i]->comment, comment);
6423 /* set the browseable flag from the gloabl default */
6424 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6426 /* Printers cannot be read_only. */
6427 ServicePtrs[i]->bRead_only = False;
6428 /* No share modes on printer services. */
6429 ServicePtrs[i]->bShareModes = False;
6430 /* No oplocks on printer services. */
6431 ServicePtrs[i]->bOpLocks = False;
6432 /* Printer services must be printable. */
6433 ServicePtrs[i]->bPrint_ok = True;
6435 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6437 return (True);
6441 /***************************************************************************
6442 Check whether the given parameter name is valid.
6443 Parametric options (names containing a colon) are considered valid.
6444 ***************************************************************************/
6446 bool lp_parameter_is_valid(const char *pszParmName)
6448 return ((map_parameter(pszParmName) != -1) ||
6449 (strchr(pszParmName, ':') != NULL));
6452 /***************************************************************************
6453 Check whether the given name is the name of a global parameter.
6454 Returns True for strings belonging to parameters of class
6455 P_GLOBAL, False for all other strings, also for parametric options
6456 and strings not belonging to any option.
6457 ***************************************************************************/
6459 bool lp_parameter_is_global(const char *pszParmName)
6461 int num = map_parameter(pszParmName);
6463 if (num >= 0) {
6464 return (parm_table[num].p_class == P_GLOBAL);
6467 return False;
6470 /**************************************************************************
6471 Check whether the given name is the canonical name of a parameter.
6472 Returns False if it is not a valid parameter Name.
6473 For parametric options, True is returned.
6474 **************************************************************************/
6476 bool lp_parameter_is_canonical(const char *parm_name)
6478 if (!lp_parameter_is_valid(parm_name)) {
6479 return False;
6482 return (map_parameter(parm_name) ==
6483 map_parameter_canonical(parm_name, NULL));
6486 /**************************************************************************
6487 Determine the canonical name for a parameter.
6488 Indicate when it is an inverse (boolean) synonym instead of a
6489 "usual" synonym.
6490 **************************************************************************/
6492 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6493 bool *inverse)
6495 int num;
6497 if (!lp_parameter_is_valid(parm_name)) {
6498 *canon_parm = NULL;
6499 return False;
6502 num = map_parameter_canonical(parm_name, inverse);
6503 if (num < 0) {
6504 /* parametric option */
6505 *canon_parm = parm_name;
6506 } else {
6507 *canon_parm = parm_table[num].label;
6510 return True;
6514 /**************************************************************************
6515 Determine the canonical name for a parameter.
6516 Turn the value given into the inverse boolean expression when
6517 the synonym is an invers boolean synonym.
6519 Return True if parm_name is a valid parameter name and
6520 in case it is an invers boolean synonym, if the val string could
6521 successfully be converted to the reverse bool.
6522 Return false in all other cases.
6523 **************************************************************************/
6525 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6526 const char *val,
6527 const char **canon_parm,
6528 const char **canon_val)
6530 int num;
6531 bool inverse;
6533 if (!lp_parameter_is_valid(parm_name)) {
6534 *canon_parm = NULL;
6535 *canon_val = NULL;
6536 return False;
6539 num = map_parameter_canonical(parm_name, &inverse);
6540 if (num < 0) {
6541 /* parametric option */
6542 *canon_parm = parm_name;
6543 *canon_val = val;
6544 } else {
6545 *canon_parm = parm_table[num].label;
6546 if (inverse) {
6547 if (!lp_invert_boolean(val, canon_val)) {
6548 *canon_val = NULL;
6549 return False;
6551 } else {
6552 *canon_val = val;
6556 return True;
6559 /***************************************************************************
6560 Map a parameter's string representation to something we can use.
6561 Returns False if the parameter string is not recognised, else TRUE.
6562 ***************************************************************************/
6564 static int map_parameter(const char *pszParmName)
6566 int iIndex;
6568 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6569 return (-1);
6571 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6572 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6573 return (iIndex);
6575 /* Warn only if it isn't parametric option */
6576 if (strchr(pszParmName, ':') == NULL)
6577 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6578 /* We do return 'fail' for parametric options as well because they are
6579 stored in different storage
6581 return (-1);
6584 /***************************************************************************
6585 Map a parameter's string representation to the index of the canonical
6586 form of the parameter (it might be a synonym).
6587 Returns -1 if the parameter string is not recognised.
6588 ***************************************************************************/
6590 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6592 int parm_num, canon_num;
6593 bool loc_inverse = False;
6595 parm_num = map_parameter(pszParmName);
6596 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6597 /* invalid, parametric or no canidate for synonyms ... */
6598 goto done;
6601 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6602 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6603 parm_num = canon_num;
6604 goto done;
6608 done:
6609 if (inverse != NULL) {
6610 *inverse = loc_inverse;
6612 return parm_num;
6615 /***************************************************************************
6616 return true if parameter number parm1 is a synonym of parameter
6617 number parm2 (parm2 being the principal name).
6618 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6619 False otherwise.
6620 ***************************************************************************/
6622 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6624 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6625 (parm_table[parm1].flags & FLAG_HIDE) &&
6626 !(parm_table[parm2].flags & FLAG_HIDE))
6628 if (inverse != NULL) {
6629 if ((parm_table[parm1].type == P_BOOLREV) &&
6630 (parm_table[parm2].type == P_BOOL))
6632 *inverse = True;
6633 } else {
6634 *inverse = False;
6637 return True;
6639 return False;
6642 /***************************************************************************
6643 Show one parameter's name, type, [values,] and flags.
6644 (helper functions for show_parameter_list)
6645 ***************************************************************************/
6647 static void show_parameter(int parmIndex)
6649 int enumIndex, flagIndex;
6650 int parmIndex2;
6651 bool hadFlag;
6652 bool hadSyn;
6653 bool inverse;
6654 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6655 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6656 "P_ENUM", "P_SEP"};
6657 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6658 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6659 FLAG_HIDE, FLAG_DOS_STRING};
6660 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6661 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6662 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6664 printf("%s=%s", parm_table[parmIndex].label,
6665 type[parm_table[parmIndex].type]);
6666 if (parm_table[parmIndex].type == P_ENUM) {
6667 printf(",");
6668 for (enumIndex=0;
6669 parm_table[parmIndex].enum_list[enumIndex].name;
6670 enumIndex++)
6672 printf("%s%s",
6673 enumIndex ? "|" : "",
6674 parm_table[parmIndex].enum_list[enumIndex].name);
6677 printf(",");
6678 hadFlag = False;
6679 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6680 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6681 printf("%s%s",
6682 hadFlag ? "|" : "",
6683 flag_names[flagIndex]);
6684 hadFlag = True;
6688 /* output synonyms */
6689 hadSyn = False;
6690 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6691 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6692 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6693 parm_table[parmIndex2].label);
6694 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6695 if (!hadSyn) {
6696 printf(" (synonyms: ");
6697 hadSyn = True;
6698 } else {
6699 printf(", ");
6701 printf("%s%s", parm_table[parmIndex2].label,
6702 inverse ? "[i]" : "");
6705 if (hadSyn) {
6706 printf(")");
6709 printf("\n");
6712 /***************************************************************************
6713 Show all parameter's name, type, [values,] and flags.
6714 ***************************************************************************/
6716 void show_parameter_list(void)
6718 int classIndex, parmIndex;
6719 const char *section_names[] = { "local", "global", NULL};
6721 for (classIndex=0; section_names[classIndex]; classIndex++) {
6722 printf("[%s]\n", section_names[classIndex]);
6723 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6724 if (parm_table[parmIndex].p_class == classIndex) {
6725 show_parameter(parmIndex);
6731 /***************************************************************************
6732 Check if a given string correctly represents a boolean value.
6733 ***************************************************************************/
6735 bool lp_string_is_valid_boolean(const char *parm_value)
6737 return set_boolean(parm_value, NULL);
6740 /***************************************************************************
6741 Get the standard string representation of a boolean value ("yes" or "no")
6742 ***************************************************************************/
6744 static const char *get_boolean(bool bool_value)
6746 static const char *yes_str = "yes";
6747 static const char *no_str = "no";
6749 return (bool_value ? yes_str : no_str);
6752 /***************************************************************************
6753 Provide the string of the negated boolean value associated to the boolean
6754 given as a string. Returns False if the passed string does not correctly
6755 represent a boolean.
6756 ***************************************************************************/
6758 bool lp_invert_boolean(const char *str, const char **inverse_str)
6760 bool val;
6762 if (!set_boolean(str, &val)) {
6763 return False;
6766 *inverse_str = get_boolean(!val);
6767 return True;
6770 /***************************************************************************
6771 Provide the canonical string representation of a boolean value given
6772 as a string. Return True on success, False if the string given does
6773 not correctly represent a boolean.
6774 ***************************************************************************/
6776 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6778 bool val;
6780 if (!set_boolean(str, &val)) {
6781 return False;
6784 *canon_str = get_boolean(val);
6785 return True;
6788 /***************************************************************************
6789 Find a service by name. Otherwise works like get_service.
6790 ***************************************************************************/
6792 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6794 int iService = -1;
6795 char *canon_name;
6796 TDB_DATA data;
6798 if (ServiceHash == NULL) {
6799 return -1;
6802 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6804 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6806 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6807 iService = *(int *)data.dptr;
6810 TALLOC_FREE(canon_name);
6812 if ((iService != -1) && (LP_SNUM_OK(iService))
6813 && (pserviceDest != NULL)) {
6814 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6817 return (iService);
6820 /***************************************************************************
6821 Copy a service structure to another.
6822 If pcopymapDest is NULL then copy all fields
6823 ***************************************************************************/
6826 * Add a parametric option to a param_opt_struct,
6827 * replacing old value, if already present.
6829 static void set_param_opt(struct param_opt_struct **opt_list,
6830 const char *opt_name,
6831 const char *opt_value)
6833 struct param_opt_struct *new_opt, *opt;
6834 bool not_added;
6836 if (opt_list == NULL) {
6837 return;
6840 opt = *opt_list;
6841 not_added = true;
6843 /* Traverse destination */
6844 while (opt) {
6845 /* If we already have same option, override it */
6846 if (strwicmp(opt->key, opt_name) == 0) {
6847 string_free(&opt->value);
6848 TALLOC_FREE(opt->list);
6849 opt->value = SMB_STRDUP(opt_value);
6850 not_added = false;
6851 break;
6853 opt = opt->next;
6855 if (not_added) {
6856 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6857 new_opt->key = SMB_STRDUP(opt_name);
6858 new_opt->value = SMB_STRDUP(opt_value);
6859 new_opt->list = NULL;
6860 DLIST_ADD(*opt_list, new_opt);
6864 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6865 struct bitmap *pcopymapDest)
6867 int i;
6868 bool bcopyall = (pcopymapDest == NULL);
6869 struct param_opt_struct *data;
6871 for (i = 0; parm_table[i].label; i++)
6872 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6873 (bcopyall || bitmap_query(pcopymapDest,i))) {
6874 void *def_ptr = parm_table[i].ptr;
6875 void *src_ptr =
6876 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6877 &sDefault);
6878 void *dest_ptr =
6879 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6880 &sDefault);
6882 switch (parm_table[i].type) {
6883 case P_BOOL:
6884 case P_BOOLREV:
6885 *(bool *)dest_ptr = *(bool *)src_ptr;
6886 break;
6888 case P_INTEGER:
6889 case P_ENUM:
6890 case P_OCTAL:
6891 *(int *)dest_ptr = *(int *)src_ptr;
6892 break;
6894 case P_CHAR:
6895 *(char *)dest_ptr = *(char *)src_ptr;
6896 break;
6898 case P_STRING:
6899 string_set((char **)dest_ptr,
6900 *(char **)src_ptr);
6901 break;
6903 case P_USTRING:
6904 string_set((char **)dest_ptr,
6905 *(char **)src_ptr);
6906 strupper_m(*(char **)dest_ptr);
6907 break;
6908 case P_LIST:
6909 TALLOC_FREE(*((char ***)dest_ptr));
6910 *((char ***)dest_ptr) = str_list_copy(NULL,
6911 *(const char ***)src_ptr);
6912 break;
6913 default:
6914 break;
6918 if (bcopyall) {
6919 init_copymap(pserviceDest);
6920 if (pserviceSource->copymap)
6921 bitmap_copy(pserviceDest->copymap,
6922 pserviceSource->copymap);
6925 data = pserviceSource->param_opt;
6926 while (data) {
6927 set_param_opt(&pserviceDest->param_opt, data->key, data->value);
6928 data = data->next;
6932 /***************************************************************************
6933 Check a service for consistency. Return False if the service is in any way
6934 incomplete or faulty, else True.
6935 ***************************************************************************/
6937 bool service_ok(int iService)
6939 bool bRetval;
6941 bRetval = True;
6942 if (ServicePtrs[iService]->szService[0] == '\0') {
6943 DEBUG(0, ("The following message indicates an internal error:\n"));
6944 DEBUG(0, ("No service name in service entry.\n"));
6945 bRetval = False;
6948 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6949 /* I can't see why you'd want a non-printable printer service... */
6950 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6951 if (!ServicePtrs[iService]->bPrint_ok) {
6952 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6953 ServicePtrs[iService]->szService));
6954 ServicePtrs[iService]->bPrint_ok = True;
6956 /* [printers] service must also be non-browsable. */
6957 if (ServicePtrs[iService]->bBrowseable)
6958 ServicePtrs[iService]->bBrowseable = False;
6961 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6962 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6963 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6965 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6966 ServicePtrs[iService]->szService));
6967 ServicePtrs[iService]->bAvailable = False;
6970 /* If a service is flagged unavailable, log the fact at level 1. */
6971 if (!ServicePtrs[iService]->bAvailable)
6972 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6973 ServicePtrs[iService]->szService));
6975 return (bRetval);
6978 static struct smbconf_ctx *lp_smbconf_ctx(void)
6980 WERROR werr;
6981 static struct smbconf_ctx *conf_ctx = NULL;
6983 if (conf_ctx == NULL) {
6984 werr = smbconf_init(NULL, &conf_ctx, "registry:");
6985 if (!W_ERROR_IS_OK(werr)) {
6986 DEBUG(1, ("error initializing registry configuration: "
6987 "%s\n", win_errstr(werr)));
6988 conf_ctx = NULL;
6992 return conf_ctx;
6995 static bool process_smbconf_service(struct smbconf_service *service)
6997 uint32_t count;
6998 bool ret;
7000 if (service == NULL) {
7001 return false;
7004 ret = do_section(service->name, NULL);
7005 if (ret != true) {
7006 return false;
7008 for (count = 0; count < service->num_params; count++) {
7009 ret = do_parameter(service->param_names[count],
7010 service->param_values[count],
7011 NULL);
7012 if (ret != true) {
7013 return false;
7016 if (iServiceIndex >= 0) {
7017 return service_ok(iServiceIndex);
7019 return true;
7023 * load a service from registry and activate it
7025 bool process_registry_service(const char *service_name)
7027 WERROR werr;
7028 struct smbconf_service *service = NULL;
7029 TALLOC_CTX *mem_ctx = talloc_stackframe();
7030 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7031 bool ret = false;
7033 if (conf_ctx == NULL) {
7034 goto done;
7037 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
7039 if (!smbconf_share_exists(conf_ctx, service_name)) {
7041 * Registry does not contain data for this service (yet),
7042 * but make sure lp_load doesn't return false.
7044 ret = true;
7045 goto done;
7048 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7049 if (!W_ERROR_IS_OK(werr)) {
7050 goto done;
7053 ret = process_smbconf_service(service);
7054 if (!ret) {
7055 goto done;
7058 /* store the csn */
7059 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7061 done:
7062 TALLOC_FREE(mem_ctx);
7063 return ret;
7067 * process_registry_globals
7069 static bool process_registry_globals(void)
7071 bool ret;
7073 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7075 ret = do_parameter("registry shares", "yes", NULL);
7076 if (!ret) {
7077 return ret;
7080 return process_registry_service(GLOBAL_NAME);
7083 bool process_registry_shares(void)
7085 WERROR werr;
7086 uint32_t count;
7087 struct smbconf_service **service = NULL;
7088 uint32_t num_shares = 0;
7089 TALLOC_CTX *mem_ctx = talloc_stackframe();
7090 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7091 bool ret = false;
7093 if (conf_ctx == NULL) {
7094 goto done;
7097 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7098 if (!W_ERROR_IS_OK(werr)) {
7099 goto done;
7102 ret = true;
7104 for (count = 0; count < num_shares; count++) {
7105 if (strequal(service[count]->name, GLOBAL_NAME)) {
7106 continue;
7108 ret = process_smbconf_service(service[count]);
7109 if (!ret) {
7110 goto done;
7114 /* store the csn */
7115 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7117 done:
7118 TALLOC_FREE(mem_ctx);
7119 return ret;
7122 #define MAX_INCLUDE_DEPTH 100
7124 static uint8_t include_depth;
7126 static struct file_lists {
7127 struct file_lists *next;
7128 char *name;
7129 char *subfname;
7130 time_t modtime;
7131 } *file_lists = NULL;
7133 /*******************************************************************
7134 Keep a linked list of all config files so we know when one has changed
7135 it's date and needs to be reloaded.
7136 ********************************************************************/
7138 static void add_to_file_list(const char *fname, const char *subfname)
7140 struct file_lists *f = file_lists;
7142 while (f) {
7143 if (f->name && !strcmp(f->name, fname))
7144 break;
7145 f = f->next;
7148 if (!f) {
7149 f = SMB_MALLOC_P(struct file_lists);
7150 if (!f)
7151 return;
7152 f->next = file_lists;
7153 f->name = SMB_STRDUP(fname);
7154 if (!f->name) {
7155 SAFE_FREE(f);
7156 return;
7158 f->subfname = SMB_STRDUP(subfname);
7159 if (!f->subfname) {
7160 SAFE_FREE(f->name);
7161 SAFE_FREE(f);
7162 return;
7164 file_lists = f;
7165 f->modtime = file_modtime(subfname);
7166 } else {
7167 time_t t = file_modtime(subfname);
7168 if (t)
7169 f->modtime = t;
7171 return;
7175 * Free the file lists
7177 static void free_file_list(void)
7179 struct file_lists *f;
7180 struct file_lists *next;
7182 f = file_lists;
7183 while( f ) {
7184 next = f->next;
7185 SAFE_FREE( f->name );
7186 SAFE_FREE( f->subfname );
7187 SAFE_FREE( f );
7188 f = next;
7190 file_lists = NULL;
7195 * Utility function for outsiders to check if we're running on registry.
7197 bool lp_config_backend_is_registry(void)
7199 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7203 * Utility function to check if the config backend is FILE.
7205 bool lp_config_backend_is_file(void)
7207 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7210 /*******************************************************************
7211 Check if a config file has changed date.
7212 ********************************************************************/
7214 bool lp_file_list_changed(void)
7216 struct file_lists *f = file_lists;
7218 DEBUG(6, ("lp_file_list_changed()\n"));
7220 while (f) {
7221 time_t mod_time;
7223 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7224 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7226 if (conf_ctx == NULL) {
7227 return false;
7229 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7230 NULL))
7232 DEBUGADD(6, ("registry config changed\n"));
7233 return true;
7235 } else {
7236 char *n2 = NULL;
7237 n2 = talloc_sub_basic(talloc_tos(),
7238 get_current_username(),
7239 current_user_info.domain,
7240 f->name);
7241 if (!n2) {
7242 return false;
7244 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7245 f->name, n2, ctime(&f->modtime)));
7247 mod_time = file_modtime(n2);
7249 if (mod_time &&
7250 ((f->modtime != mod_time) ||
7251 (f->subfname == NULL) ||
7252 (strcmp(n2, f->subfname) != 0)))
7254 DEBUGADD(6,
7255 ("file %s modified: %s\n", n2,
7256 ctime(&mod_time)));
7257 f->modtime = mod_time;
7258 SAFE_FREE(f->subfname);
7259 f->subfname = SMB_STRDUP(n2);
7260 TALLOC_FREE(n2);
7261 return true;
7263 TALLOC_FREE(n2);
7265 f = f->next;
7267 return (False);
7271 /***************************************************************************
7272 Run standard_sub_basic on netbios name... needed because global_myname
7273 is not accessed through any lp_ macro.
7274 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7275 ***************************************************************************/
7277 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7279 bool ret;
7280 char *netbios_name = talloc_sub_basic(
7281 talloc_tos(), get_current_username(), current_user_info.domain,
7282 pszParmValue);
7284 ret = set_global_myname(netbios_name);
7285 TALLOC_FREE(netbios_name);
7286 string_set(&Globals.szNetbiosName,global_myname());
7288 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7289 global_myname()));
7291 return ret;
7294 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7296 if (strcmp(*ptr, pszParmValue) != 0) {
7297 string_set(ptr, pszParmValue);
7298 init_iconv();
7300 return True;
7305 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7307 bool ret;
7309 ret = set_global_myworkgroup(pszParmValue);
7310 string_set(&Globals.szWorkgroup,lp_workgroup());
7312 return ret;
7315 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7317 bool ret;
7319 ret = set_global_scope(pszParmValue);
7320 string_set(&Globals.szNetbiosScope,global_scope());
7322 return ret;
7325 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7327 TALLOC_FREE(Globals.szNetbiosAliases);
7328 Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL);
7329 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7332 /***************************************************************************
7333 Handle the include operation.
7334 ***************************************************************************/
7335 static bool bAllowIncludeRegistry = true;
7337 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7339 char *fname;
7341 if (include_depth >= MAX_INCLUDE_DEPTH) {
7342 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7343 include_depth));
7344 return false;
7347 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7348 if (!bAllowIncludeRegistry) {
7349 return true;
7351 if (bInGlobalSection) {
7352 bool ret;
7353 include_depth++;
7354 ret = process_registry_globals();
7355 include_depth--;
7356 return ret;
7357 } else {
7358 DEBUG(1, ("\"include = registry\" only effective "
7359 "in %s section\n", GLOBAL_NAME));
7360 return false;
7364 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7365 current_user_info.domain,
7366 pszParmValue);
7368 add_to_file_list(pszParmValue, fname);
7370 string_set(ptr, fname);
7372 if (file_exist(fname)) {
7373 bool ret;
7374 include_depth++;
7375 ret = pm_process(fname, do_section, do_parameter, NULL);
7376 include_depth--;
7377 TALLOC_FREE(fname);
7378 return ret;
7381 DEBUG(2, ("Can't find include file %s\n", fname));
7382 TALLOC_FREE(fname);
7383 return true;
7386 /***************************************************************************
7387 Handle the interpretation of the copy parameter.
7388 ***************************************************************************/
7390 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7392 bool bRetval;
7393 int iTemp;
7394 struct service serviceTemp;
7396 string_set(ptr, pszParmValue);
7398 init_service(&serviceTemp);
7400 bRetval = False;
7402 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7404 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7405 if (iTemp == iServiceIndex) {
7406 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7407 } else {
7408 copy_service(ServicePtrs[iServiceIndex],
7409 &serviceTemp,
7410 ServicePtrs[iServiceIndex]->copymap);
7411 bRetval = True;
7413 } else {
7414 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7415 bRetval = False;
7418 free_service(&serviceTemp);
7419 return (bRetval);
7422 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7424 Globals.ldap_debug_level = lp_int(pszParmValue);
7425 init_ldap_debugging();
7426 return true;
7429 /***************************************************************************
7430 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7431 parameters is:
7433 [global]
7435 idmap uid = 1000-1999
7436 idmap gid = 700-899
7438 We only do simple parsing checks here. The strings are parsed into useful
7439 structures in the idmap daemon code.
7441 ***************************************************************************/
7443 /* Some lp_ routines to return idmap [ug]id information */
7445 static uid_t idmap_uid_low, idmap_uid_high;
7446 static gid_t idmap_gid_low, idmap_gid_high;
7448 bool lp_idmap_uid(uid_t *low, uid_t *high)
7450 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7451 return False;
7453 if (low)
7454 *low = idmap_uid_low;
7456 if (high)
7457 *high = idmap_uid_high;
7459 return True;
7462 bool lp_idmap_gid(gid_t *low, gid_t *high)
7464 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7465 return False;
7467 if (low)
7468 *low = idmap_gid_low;
7470 if (high)
7471 *high = idmap_gid_high;
7473 return True;
7476 /* Do some simple checks on "idmap [ug]id" parameter values */
7478 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7480 uint32 low, high;
7482 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7483 return False;
7485 /* Parse OK */
7487 string_set(ptr, pszParmValue);
7489 idmap_uid_low = low;
7490 idmap_uid_high = high;
7492 return True;
7495 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7497 uint32 low, high;
7499 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7500 return False;
7502 /* Parse OK */
7504 string_set(ptr, pszParmValue);
7506 idmap_gid_low = low;
7507 idmap_gid_high = high;
7509 return True;
7512 /***************************************************************************
7513 Handle the DEBUG level list.
7514 ***************************************************************************/
7516 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7518 string_set(ptr, pszParmValueIn);
7519 return debug_parse_levels(pszParmValueIn);
7522 /***************************************************************************
7523 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7524 ***************************************************************************/
7526 static const char *append_ldap_suffix( const char *str )
7528 const char *suffix_string;
7531 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7532 Globals.szLdapSuffix );
7533 if ( !suffix_string ) {
7534 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7535 return "";
7538 return suffix_string;
7541 const char *lp_ldap_machine_suffix(void)
7543 if (Globals.szLdapMachineSuffix[0])
7544 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7546 return lp_string(Globals.szLdapSuffix);
7549 const char *lp_ldap_user_suffix(void)
7551 if (Globals.szLdapUserSuffix[0])
7552 return append_ldap_suffix(Globals.szLdapUserSuffix);
7554 return lp_string(Globals.szLdapSuffix);
7557 const char *lp_ldap_group_suffix(void)
7559 if (Globals.szLdapGroupSuffix[0])
7560 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7562 return lp_string(Globals.szLdapSuffix);
7565 const char *lp_ldap_idmap_suffix(void)
7567 if (Globals.szLdapIdmapSuffix[0])
7568 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7570 return lp_string(Globals.szLdapSuffix);
7573 /****************************************************************************
7574 set the value for a P_ENUM
7575 ***************************************************************************/
7577 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7578 int *ptr )
7580 int i;
7582 for (i = 0; parm->enum_list[i].name; i++) {
7583 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7584 *ptr = parm->enum_list[i].value;
7585 return;
7588 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7589 pszParmValue, parm->label));
7592 /***************************************************************************
7593 ***************************************************************************/
7595 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7597 static int parm_num = -1;
7598 struct service *s;
7600 if ( parm_num == -1 )
7601 parm_num = map_parameter( "printing" );
7603 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7605 if ( snum < 0 )
7606 s = &sDefault;
7607 else
7608 s = ServicePtrs[snum];
7610 init_printer_values( s );
7612 return True;
7616 /***************************************************************************
7617 Initialise a copymap.
7618 ***************************************************************************/
7620 static void init_copymap(struct service *pservice)
7622 int i;
7624 TALLOC_FREE(pservice->copymap);
7626 pservice->copymap = bitmap_talloc(talloc_autofree_context(),
7627 NUMPARAMETERS);
7628 if (!pservice->copymap)
7629 DEBUG(0,
7630 ("Couldn't allocate copymap!! (size %d)\n",
7631 (int)NUMPARAMETERS));
7632 else
7633 for (i = 0; i < NUMPARAMETERS; i++)
7634 bitmap_set(pservice->copymap, i);
7637 /***************************************************************************
7638 Return the local pointer to a parameter given a service struct and the
7639 pointer into the default structure.
7640 ***************************************************************************/
7642 static void *lp_local_ptr(struct service *service, void *ptr)
7644 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7647 /***************************************************************************
7648 Return the local pointer to a parameter given the service number and the
7649 pointer into the default structure.
7650 ***************************************************************************/
7652 void *lp_local_ptr_by_snum(int snum, void *ptr)
7654 return lp_local_ptr(ServicePtrs[snum], ptr);
7657 /***************************************************************************
7658 Process a parameter for a particular service number. If snum < 0
7659 then assume we are in the globals.
7660 ***************************************************************************/
7662 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7664 int parmnum, i;
7665 void *parm_ptr = NULL; /* where we are going to store the result */
7666 void *def_ptr = NULL;
7667 struct param_opt_struct **opt_list;
7669 parmnum = map_parameter(pszParmName);
7671 if (parmnum < 0) {
7672 if (strchr(pszParmName, ':') == NULL) {
7673 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7674 pszParmName));
7675 return (True);
7679 * We've got a parametric option
7682 opt_list = (snum < 0)
7683 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7684 set_param_opt(opt_list, pszParmName, pszParmValue);
7686 return (True);
7689 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7690 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7691 pszParmName));
7694 def_ptr = parm_table[parmnum].ptr;
7696 /* we might point at a service, the default service or a global */
7697 if (snum < 0) {
7698 parm_ptr = def_ptr;
7699 } else {
7700 if (parm_table[parmnum].p_class == P_GLOBAL) {
7701 DEBUG(0,
7702 ("Global parameter %s found in service section!\n",
7703 pszParmName));
7704 return (True);
7706 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7709 if (snum >= 0) {
7710 if (!ServicePtrs[snum]->copymap)
7711 init_copymap(ServicePtrs[snum]);
7713 /* this handles the aliases - set the copymap for other entries with
7714 the same data pointer */
7715 for (i = 0; parm_table[i].label; i++)
7716 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7717 bitmap_clear(ServicePtrs[snum]->copymap, i);
7720 /* if it is a special case then go ahead */
7721 if (parm_table[parmnum].special) {
7722 return parm_table[parmnum].special(snum, pszParmValue,
7723 (char **)parm_ptr);
7726 /* now switch on the type of variable it is */
7727 switch (parm_table[parmnum].type)
7729 case P_BOOL:
7730 *(bool *)parm_ptr = lp_bool(pszParmValue);
7731 break;
7733 case P_BOOLREV:
7734 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7735 break;
7737 case P_INTEGER:
7738 *(int *)parm_ptr = lp_int(pszParmValue);
7739 break;
7741 case P_CHAR:
7742 *(char *)parm_ptr = *pszParmValue;
7743 break;
7745 case P_OCTAL:
7746 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7747 if ( i != 1 ) {
7748 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7750 break;
7752 case P_LIST:
7753 TALLOC_FREE(*((char ***)parm_ptr));
7754 *(char ***)parm_ptr = str_list_make_v3(
7755 talloc_autofree_context(), pszParmValue, NULL);
7756 break;
7758 case P_STRING:
7759 string_set((char **)parm_ptr, pszParmValue);
7760 break;
7762 case P_USTRING:
7763 string_set((char **)parm_ptr, pszParmValue);
7764 strupper_m(*(char **)parm_ptr);
7765 break;
7767 case P_ENUM:
7768 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7769 break;
7770 case P_SEP:
7771 break;
7774 return (True);
7777 /***************************************************************************
7778 Process a parameter.
7779 ***************************************************************************/
7781 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7782 void *userdata)
7784 if (!bInGlobalSection && bGlobalOnly)
7785 return (True);
7787 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7789 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7790 pszParmName, pszParmValue));
7793 /***************************************************************************
7794 Print a parameter of the specified type.
7795 ***************************************************************************/
7797 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7799 int i;
7800 switch (p->type)
7802 case P_ENUM:
7803 for (i = 0; p->enum_list[i].name; i++) {
7804 if (*(int *)ptr == p->enum_list[i].value) {
7805 fprintf(f, "%s",
7806 p->enum_list[i].name);
7807 break;
7810 break;
7812 case P_BOOL:
7813 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7814 break;
7816 case P_BOOLREV:
7817 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7818 break;
7820 case P_INTEGER:
7821 fprintf(f, "%d", *(int *)ptr);
7822 break;
7824 case P_CHAR:
7825 fprintf(f, "%c", *(char *)ptr);
7826 break;
7828 case P_OCTAL: {
7829 char *o = octal_string(*(int *)ptr);
7830 fprintf(f, "%s", o);
7831 TALLOC_FREE(o);
7832 break;
7835 case P_LIST:
7836 if ((char ***)ptr && *(char ***)ptr) {
7837 char **list = *(char ***)ptr;
7838 for (; *list; list++) {
7839 /* surround strings with whitespace in double quotes */
7840 if ( strchr_m( *list, ' ' ) )
7841 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
7842 else
7843 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
7846 break;
7848 case P_STRING:
7849 case P_USTRING:
7850 if (*(char **)ptr) {
7851 fprintf(f, "%s", *(char **)ptr);
7853 break;
7854 case P_SEP:
7855 break;
7859 /***************************************************************************
7860 Check if two parameters are equal.
7861 ***************************************************************************/
7863 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
7865 switch (type) {
7866 case P_BOOL:
7867 case P_BOOLREV:
7868 return (*((bool *)ptr1) == *((bool *)ptr2));
7870 case P_INTEGER:
7871 case P_ENUM:
7872 case P_OCTAL:
7873 return (*((int *)ptr1) == *((int *)ptr2));
7875 case P_CHAR:
7876 return (*((char *)ptr1) == *((char *)ptr2));
7878 case P_LIST:
7879 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
7881 case P_STRING:
7882 case P_USTRING:
7884 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7885 if (p1 && !*p1)
7886 p1 = NULL;
7887 if (p2 && !*p2)
7888 p2 = NULL;
7889 return (p1 == p2 || strequal(p1, p2));
7891 case P_SEP:
7892 break;
7894 return (False);
7897 /***************************************************************************
7898 Initialize any local varients in the sDefault table.
7899 ***************************************************************************/
7901 void init_locals(void)
7903 /* None as yet. */
7906 /***************************************************************************
7907 Process a new section (service). At this stage all sections are services.
7908 Later we'll have special sections that permit server parameters to be set.
7909 Returns True on success, False on failure.
7910 ***************************************************************************/
7912 static bool do_section(const char *pszSectionName, void *userdata)
7914 bool bRetval;
7915 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7916 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7917 bRetval = False;
7919 /* if we were in a global section then do the local inits */
7920 if (bInGlobalSection && !isglobal)
7921 init_locals();
7923 /* if we've just struck a global section, note the fact. */
7924 bInGlobalSection = isglobal;
7926 /* check for multiple global sections */
7927 if (bInGlobalSection) {
7928 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7929 return (True);
7932 if (!bInGlobalSection && bGlobalOnly)
7933 return (True);
7935 /* if we have a current service, tidy it up before moving on */
7936 bRetval = True;
7938 if (iServiceIndex >= 0)
7939 bRetval = service_ok(iServiceIndex);
7941 /* if all is still well, move to the next record in the services array */
7942 if (bRetval) {
7943 /* We put this here to avoid an odd message order if messages are */
7944 /* issued by the post-processing of a previous section. */
7945 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7947 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
7948 < 0) {
7949 DEBUG(0, ("Failed to add a new service\n"));
7950 return (False);
7954 return (bRetval);
7958 /***************************************************************************
7959 Determine if a partcular base parameter is currentl set to the default value.
7960 ***************************************************************************/
7962 static bool is_default(int i)
7964 if (!defaults_saved)
7965 return False;
7966 switch (parm_table[i].type) {
7967 case P_LIST:
7968 return str_list_equal((const char **)parm_table[i].def.lvalue,
7969 *(const char ***)parm_table[i].ptr);
7970 case P_STRING:
7971 case P_USTRING:
7972 return strequal(parm_table[i].def.svalue,
7973 *(char **)parm_table[i].ptr);
7974 case P_BOOL:
7975 case P_BOOLREV:
7976 return parm_table[i].def.bvalue ==
7977 *(bool *)parm_table[i].ptr;
7978 case P_CHAR:
7979 return parm_table[i].def.cvalue ==
7980 *(char *)parm_table[i].ptr;
7981 case P_INTEGER:
7982 case P_OCTAL:
7983 case P_ENUM:
7984 return parm_table[i].def.ivalue ==
7985 *(int *)parm_table[i].ptr;
7986 case P_SEP:
7987 break;
7989 return False;
7992 /***************************************************************************
7993 Display the contents of the global structure.
7994 ***************************************************************************/
7996 static void dump_globals(FILE *f)
7998 int i;
7999 struct param_opt_struct *data;
8001 fprintf(f, "[global]\n");
8003 for (i = 0; parm_table[i].label; i++)
8004 if (parm_table[i].p_class == P_GLOBAL &&
8005 !(parm_table[i].flags & FLAG_META) &&
8006 parm_table[i].ptr &&
8007 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
8008 if (defaults_saved && is_default(i))
8009 continue;
8010 fprintf(f, "\t%s = ", parm_table[i].label);
8011 print_parameter(&parm_table[i], parm_table[i].ptr, f);
8012 fprintf(f, "\n");
8014 if (Globals.param_opt != NULL) {
8015 data = Globals.param_opt;
8016 while(data) {
8017 fprintf(f, "\t%s = %s\n", data->key, data->value);
8018 data = data->next;
8024 /***************************************************************************
8025 Return True if a local parameter is currently set to the global default.
8026 ***************************************************************************/
8028 bool lp_is_default(int snum, struct parm_struct *parm)
8030 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
8032 return equal_parameter(parm->type,
8033 ((char *)ServicePtrs[snum]) + pdiff,
8034 ((char *)&sDefault) + pdiff);
8037 /***************************************************************************
8038 Display the contents of a single services record.
8039 ***************************************************************************/
8041 static void dump_a_service(struct service *pService, FILE * f)
8043 int i;
8044 struct param_opt_struct *data;
8046 if (pService != &sDefault)
8047 fprintf(f, "[%s]\n", pService->szService);
8049 for (i = 0; parm_table[i].label; i++) {
8051 if (parm_table[i].p_class == P_LOCAL &&
8052 !(parm_table[i].flags & FLAG_META) &&
8053 parm_table[i].ptr &&
8054 (*parm_table[i].label != '-') &&
8055 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8057 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8059 if (pService == &sDefault) {
8060 if (defaults_saved && is_default(i))
8061 continue;
8062 } else {
8063 if (equal_parameter(parm_table[i].type,
8064 ((char *)pService) +
8065 pdiff,
8066 ((char *)&sDefault) +
8067 pdiff))
8068 continue;
8071 fprintf(f, "\t%s = ", parm_table[i].label);
8072 print_parameter(&parm_table[i],
8073 ((char *)pService) + pdiff, f);
8074 fprintf(f, "\n");
8078 if (pService->param_opt != NULL) {
8079 data = pService->param_opt;
8080 while(data) {
8081 fprintf(f, "\t%s = %s\n", data->key, data->value);
8082 data = data->next;
8087 /***************************************************************************
8088 Display the contents of a parameter of a single services record.
8089 ***************************************************************************/
8091 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8093 int i;
8094 bool result = False;
8095 parm_class p_class;
8096 unsigned flag = 0;
8097 fstring local_parm_name;
8098 char *parm_opt;
8099 const char *parm_opt_value;
8101 /* check for parametrical option */
8102 fstrcpy( local_parm_name, parm_name);
8103 parm_opt = strchr( local_parm_name, ':');
8105 if (parm_opt) {
8106 *parm_opt = '\0';
8107 parm_opt++;
8108 if (strlen(parm_opt)) {
8109 parm_opt_value = lp_parm_const_string( snum,
8110 local_parm_name, parm_opt, NULL);
8111 if (parm_opt_value) {
8112 printf( "%s\n", parm_opt_value);
8113 result = True;
8116 return result;
8119 /* check for a key and print the value */
8120 if (isGlobal) {
8121 p_class = P_GLOBAL;
8122 flag = FLAG_GLOBAL;
8123 } else
8124 p_class = P_LOCAL;
8126 for (i = 0; parm_table[i].label; i++) {
8127 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8128 !(parm_table[i].flags & FLAG_META) &&
8129 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8130 parm_table[i].ptr &&
8131 (*parm_table[i].label != '-') &&
8132 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8134 void *ptr;
8136 if (isGlobal) {
8137 ptr = parm_table[i].ptr;
8138 } else {
8139 struct service *pService = ServicePtrs[snum];
8140 ptr = ((char *)pService) +
8141 PTR_DIFF(parm_table[i].ptr, &sDefault);
8144 print_parameter(&parm_table[i],
8145 ptr, f);
8146 fprintf(f, "\n");
8147 result = True;
8148 break;
8152 return result;
8155 /***************************************************************************
8156 Return info about the requested parameter (given as a string).
8157 Return NULL when the string is not a valid parameter name.
8158 ***************************************************************************/
8160 struct parm_struct *lp_get_parameter(const char *param_name)
8162 int num = map_parameter(param_name);
8164 if (num < 0) {
8165 return NULL;
8168 return &parm_table[num];
8171 /***************************************************************************
8172 Return info about the next parameter in a service.
8173 snum==GLOBAL_SECTION_SNUM gives the globals.
8174 Return NULL when out of parameters.
8175 ***************************************************************************/
8177 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8179 if (snum < 0) {
8180 /* do the globals */
8181 for (; parm_table[*i].label; (*i)++) {
8182 if (parm_table[*i].p_class == P_SEPARATOR)
8183 return &parm_table[(*i)++];
8185 if (!parm_table[*i].ptr
8186 || (*parm_table[*i].label == '-'))
8187 continue;
8189 if ((*i) > 0
8190 && (parm_table[*i].ptr ==
8191 parm_table[(*i) - 1].ptr))
8192 continue;
8194 if (is_default(*i) && !allparameters)
8195 continue;
8197 return &parm_table[(*i)++];
8199 } else {
8200 struct service *pService = ServicePtrs[snum];
8202 for (; parm_table[*i].label; (*i)++) {
8203 if (parm_table[*i].p_class == P_SEPARATOR)
8204 return &parm_table[(*i)++];
8206 if (parm_table[*i].p_class == P_LOCAL &&
8207 parm_table[*i].ptr &&
8208 (*parm_table[*i].label != '-') &&
8209 ((*i) == 0 ||
8210 (parm_table[*i].ptr !=
8211 parm_table[(*i) - 1].ptr)))
8213 int pdiff =
8214 PTR_DIFF(parm_table[*i].ptr,
8215 &sDefault);
8217 if (allparameters ||
8218 !equal_parameter(parm_table[*i].type,
8219 ((char *)pService) +
8220 pdiff,
8221 ((char *)&sDefault) +
8222 pdiff))
8224 return &parm_table[(*i)++];
8230 return NULL;
8234 #if 0
8235 /***************************************************************************
8236 Display the contents of a single copy structure.
8237 ***************************************************************************/
8238 static void dump_copy_map(bool *pcopymap)
8240 int i;
8241 if (!pcopymap)
8242 return;
8244 printf("\n\tNon-Copied parameters:\n");
8246 for (i = 0; parm_table[i].label; i++)
8247 if (parm_table[i].p_class == P_LOCAL &&
8248 parm_table[i].ptr && !pcopymap[i] &&
8249 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8251 printf("\t\t%s\n", parm_table[i].label);
8254 #endif
8256 /***************************************************************************
8257 Return TRUE if the passed service number is within range.
8258 ***************************************************************************/
8260 bool lp_snum_ok(int iService)
8262 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8265 /***************************************************************************
8266 Auto-load some home services.
8267 ***************************************************************************/
8269 static void lp_add_auto_services(char *str)
8271 char *s;
8272 char *p;
8273 int homes;
8274 char *saveptr;
8276 if (!str)
8277 return;
8279 s = SMB_STRDUP(str);
8280 if (!s)
8281 return;
8283 homes = lp_servicenumber(HOMES_NAME);
8285 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8286 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8287 char *home;
8289 if (lp_servicenumber(p) >= 0)
8290 continue;
8292 home = get_user_home_dir(talloc_tos(), p);
8294 if (home && home[0] && homes >= 0)
8295 lp_add_home(p, homes, p, home);
8297 TALLOC_FREE(home);
8299 SAFE_FREE(s);
8302 /***************************************************************************
8303 Auto-load one printer.
8304 ***************************************************************************/
8306 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
8308 int printers = lp_servicenumber(PRINTERS_NAME);
8309 int i;
8311 if (lp_servicenumber(name) < 0) {
8312 lp_add_printer(name, printers);
8313 if ((i = lp_servicenumber(name)) >= 0) {
8314 string_set(&ServicePtrs[i]->comment, comment);
8315 ServicePtrs[i]->autoloaded = True;
8320 /***************************************************************************
8321 Have we loaded a services file yet?
8322 ***************************************************************************/
8324 bool lp_loaded(void)
8326 return (bLoaded);
8329 /***************************************************************************
8330 Unload unused services.
8331 ***************************************************************************/
8333 void lp_killunused(bool (*snumused) (int))
8335 int i;
8336 for (i = 0; i < iNumServices; i++) {
8337 if (!VALID(i))
8338 continue;
8340 /* don't kill autoloaded or usershare services */
8341 if ( ServicePtrs[i]->autoloaded ||
8342 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8343 continue;
8346 if (!snumused || !snumused(i)) {
8347 free_service_byindex(i);
8353 * Kill all except autoloaded and usershare services - convenience wrapper
8355 void lp_kill_all_services(void)
8357 lp_killunused(NULL);
8360 /***************************************************************************
8361 Unload a service.
8362 ***************************************************************************/
8364 void lp_killservice(int iServiceIn)
8366 if (VALID(iServiceIn)) {
8367 free_service_byindex(iServiceIn);
8371 /***************************************************************************
8372 Save the curent values of all global and sDefault parameters into the
8373 defaults union. This allows swat and testparm to show only the
8374 changed (ie. non-default) parameters.
8375 ***************************************************************************/
8377 static void lp_save_defaults(void)
8379 int i;
8380 for (i = 0; parm_table[i].label; i++) {
8381 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8382 continue;
8383 switch (parm_table[i].type) {
8384 case P_LIST:
8385 parm_table[i].def.lvalue = str_list_copy(
8386 NULL, *(const char ***)parm_table[i].ptr);
8387 break;
8388 case P_STRING:
8389 case P_USTRING:
8390 if (parm_table[i].ptr) {
8391 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8392 } else {
8393 parm_table[i].def.svalue = NULL;
8395 break;
8396 case P_BOOL:
8397 case P_BOOLREV:
8398 parm_table[i].def.bvalue =
8399 *(bool *)parm_table[i].ptr;
8400 break;
8401 case P_CHAR:
8402 parm_table[i].def.cvalue =
8403 *(char *)parm_table[i].ptr;
8404 break;
8405 case P_INTEGER:
8406 case P_OCTAL:
8407 case P_ENUM:
8408 parm_table[i].def.ivalue =
8409 *(int *)parm_table[i].ptr;
8410 break;
8411 case P_SEP:
8412 break;
8415 defaults_saved = True;
8418 /*******************************************************************
8419 Set the server type we will announce as via nmbd.
8420 ********************************************************************/
8422 static const struct srv_role_tab {
8423 uint32 role;
8424 const char *role_str;
8425 } srv_role_tab [] = {
8426 { ROLE_STANDALONE, "ROLE_STANDALONE" },
8427 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
8428 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
8429 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
8430 { 0, NULL }
8433 const char* server_role_str(uint32 role)
8435 int i = 0;
8436 for (i=0; srv_role_tab[i].role_str; i++) {
8437 if (role == srv_role_tab[i].role) {
8438 return srv_role_tab[i].role_str;
8441 return NULL;
8444 static void set_server_role(void)
8446 server_role = ROLE_STANDALONE;
8448 switch (lp_security()) {
8449 case SEC_SHARE:
8450 if (lp_domain_logons())
8451 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8452 break;
8453 case SEC_SERVER:
8454 if (lp_domain_logons())
8455 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8456 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8457 server_role = ROLE_STANDALONE;
8458 break;
8459 case SEC_DOMAIN:
8460 if (lp_domain_logons()) {
8461 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8462 server_role = ROLE_DOMAIN_BDC;
8463 break;
8465 server_role = ROLE_DOMAIN_MEMBER;
8466 break;
8467 case SEC_ADS:
8468 if (lp_domain_logons()) {
8469 server_role = ROLE_DOMAIN_PDC;
8470 break;
8472 server_role = ROLE_DOMAIN_MEMBER;
8473 break;
8474 case SEC_USER:
8475 if (lp_domain_logons()) {
8477 if (Globals.iDomainMaster) /* auto or yes */
8478 server_role = ROLE_DOMAIN_PDC;
8479 else
8480 server_role = ROLE_DOMAIN_BDC;
8482 break;
8483 default:
8484 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8485 break;
8488 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
8491 /***********************************************************
8492 If we should send plaintext/LANMAN passwords in the clinet
8493 ************************************************************/
8495 static void set_allowed_client_auth(void)
8497 if (Globals.bClientNTLMv2Auth) {
8498 Globals.bClientLanManAuth = False;
8500 if (!Globals.bClientLanManAuth) {
8501 Globals.bClientPlaintextAuth = False;
8505 /***************************************************************************
8506 JRA.
8507 The following code allows smbd to read a user defined share file.
8508 Yes, this is my intent. Yes, I'm comfortable with that...
8510 THE FOLLOWING IS SECURITY CRITICAL CODE.
8512 It washes your clothes, it cleans your house, it guards you while you sleep...
8513 Do not f%^k with it....
8514 ***************************************************************************/
8516 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8518 /***************************************************************************
8519 Check allowed stat state of a usershare file.
8520 Ensure we print out who is dicking with us so the admin can
8521 get their sorry ass fired.
8522 ***************************************************************************/
8524 static bool check_usershare_stat(const char *fname,
8525 const SMB_STRUCT_STAT *psbuf)
8527 if (!S_ISREG(psbuf->st_ex_mode)) {
8528 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8529 "not a regular file\n",
8530 fname, (unsigned int)psbuf->st_ex_uid ));
8531 return False;
8534 /* Ensure this doesn't have the other write bit set. */
8535 if (psbuf->st_ex_mode & S_IWOTH) {
8536 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8537 "public write. Refusing to allow as a usershare file.\n",
8538 fname, (unsigned int)psbuf->st_ex_uid ));
8539 return False;
8542 /* Should be 10k or less. */
8543 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8544 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8545 "too large (%u) to be a user share file.\n",
8546 fname, (unsigned int)psbuf->st_ex_uid,
8547 (unsigned int)psbuf->st_ex_size ));
8548 return False;
8551 return True;
8554 /***************************************************************************
8555 Parse the contents of a usershare file.
8556 ***************************************************************************/
8558 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8559 SMB_STRUCT_STAT *psbuf,
8560 const char *servicename,
8561 int snum,
8562 char **lines,
8563 int numlines,
8564 char **pp_sharepath,
8565 char **pp_comment,
8566 char **pp_cp_servicename,
8567 SEC_DESC **ppsd,
8568 bool *pallow_guest)
8570 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8571 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8572 int us_vers;
8573 SMB_STRUCT_DIR *dp;
8574 SMB_STRUCT_STAT sbuf;
8575 char *sharepath = NULL;
8576 char *comment = NULL;
8578 *pp_sharepath = NULL;
8579 *pp_comment = NULL;
8581 *pallow_guest = False;
8583 if (numlines < 4) {
8584 return USERSHARE_MALFORMED_FILE;
8587 if (strcmp(lines[0], "#VERSION 1") == 0) {
8588 us_vers = 1;
8589 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8590 us_vers = 2;
8591 if (numlines < 5) {
8592 return USERSHARE_MALFORMED_FILE;
8594 } else {
8595 return USERSHARE_BAD_VERSION;
8598 if (strncmp(lines[1], "path=", 5) != 0) {
8599 return USERSHARE_MALFORMED_PATH;
8602 sharepath = talloc_strdup(ctx, &lines[1][5]);
8603 if (!sharepath) {
8604 return USERSHARE_POSIX_ERR;
8606 trim_string(sharepath, " ", " ");
8608 if (strncmp(lines[2], "comment=", 8) != 0) {
8609 return USERSHARE_MALFORMED_COMMENT_DEF;
8612 comment = talloc_strdup(ctx, &lines[2][8]);
8613 if (!comment) {
8614 return USERSHARE_POSIX_ERR;
8616 trim_string(comment, " ", " ");
8617 trim_char(comment, '"', '"');
8619 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8620 return USERSHARE_MALFORMED_ACL_DEF;
8623 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8624 return USERSHARE_ACL_ERR;
8627 if (us_vers == 2) {
8628 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8629 return USERSHARE_MALFORMED_ACL_DEF;
8631 if (lines[4][9] == 'y') {
8632 *pallow_guest = True;
8635 /* Backwards compatible extension to file version #2. */
8636 if (numlines > 5) {
8637 if (strncmp(lines[5], "sharename=", 10) != 0) {
8638 return USERSHARE_MALFORMED_SHARENAME_DEF;
8640 if (!strequal(&lines[5][10], servicename)) {
8641 return USERSHARE_BAD_SHARENAME;
8643 *pp_cp_servicename = talloc_strdup(ctx, &lines[5][10]);
8644 if (!*pp_cp_servicename) {
8645 return USERSHARE_POSIX_ERR;
8650 if (*pp_cp_servicename == NULL) {
8651 *pp_cp_servicename = talloc_strdup(ctx, servicename);
8652 if (!*pp_cp_servicename) {
8653 return USERSHARE_POSIX_ERR;
8657 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8658 /* Path didn't change, no checks needed. */
8659 *pp_sharepath = sharepath;
8660 *pp_comment = comment;
8661 return USERSHARE_OK;
8664 /* The path *must* be absolute. */
8665 if (sharepath[0] != '/') {
8666 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8667 servicename, sharepath));
8668 return USERSHARE_PATH_NOT_ABSOLUTE;
8671 /* If there is a usershare prefix deny list ensure one of these paths
8672 doesn't match the start of the user given path. */
8673 if (prefixdenylist) {
8674 int i;
8675 for ( i=0; prefixdenylist[i]; i++ ) {
8676 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8677 servicename, i, prefixdenylist[i], sharepath ));
8678 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8679 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8680 "usershare prefix deny list entries.\n",
8681 servicename, sharepath));
8682 return USERSHARE_PATH_IS_DENIED;
8687 /* If there is a usershare prefix allow list ensure one of these paths
8688 does match the start of the user given path. */
8690 if (prefixallowlist) {
8691 int i;
8692 for ( i=0; prefixallowlist[i]; i++ ) {
8693 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8694 servicename, i, prefixallowlist[i], sharepath ));
8695 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8696 break;
8699 if (prefixallowlist[i] == NULL) {
8700 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8701 "usershare prefix allow list entries.\n",
8702 servicename, sharepath));
8703 return USERSHARE_PATH_NOT_ALLOWED;
8707 /* Ensure this is pointing to a directory. */
8708 dp = sys_opendir(sharepath);
8710 if (!dp) {
8711 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8712 servicename, sharepath));
8713 return USERSHARE_PATH_NOT_DIRECTORY;
8716 /* Ensure the owner of the usershare file has permission to share
8717 this directory. */
8719 if (sys_stat(sharepath, &sbuf, false) == -1) {
8720 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8721 servicename, sharepath, strerror(errno) ));
8722 sys_closedir(dp);
8723 return USERSHARE_POSIX_ERR;
8726 sys_closedir(dp);
8728 if (!S_ISDIR(sbuf.st_ex_mode)) {
8729 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8730 servicename, sharepath ));
8731 return USERSHARE_PATH_NOT_DIRECTORY;
8734 /* Check if sharing is restricted to owner-only. */
8735 /* psbuf is the stat of the usershare definition file,
8736 sbuf is the stat of the target directory to be shared. */
8738 if (lp_usershare_owner_only()) {
8739 /* root can share anything. */
8740 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8741 return USERSHARE_PATH_NOT_ALLOWED;
8745 *pp_sharepath = sharepath;
8746 *pp_comment = comment;
8747 return USERSHARE_OK;
8750 /***************************************************************************
8751 Deal with a usershare file.
8752 Returns:
8753 >= 0 - snum
8754 -1 - Bad name, invalid contents.
8755 - service name already existed and not a usershare, problem
8756 with permissions to share directory etc.
8757 ***************************************************************************/
8759 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8761 SMB_STRUCT_STAT sbuf;
8762 SMB_STRUCT_STAT lsbuf;
8763 char *fname = NULL;
8764 char *sharepath = NULL;
8765 char *comment = NULL;
8766 char *cp_service_name = NULL;
8767 char **lines = NULL;
8768 int numlines = 0;
8769 int fd = -1;
8770 int iService = -1;
8771 TALLOC_CTX *ctx = talloc_stackframe();
8772 SEC_DESC *psd = NULL;
8773 bool guest_ok = False;
8774 char *canon_name = NULL;
8775 bool added_service = false;
8776 int ret = -1;
8778 /* Ensure share name doesn't contain invalid characters. */
8779 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8780 DEBUG(0,("process_usershare_file: share name %s contains "
8781 "invalid characters (any of %s)\n",
8782 file_name, INVALID_SHARENAME_CHARS ));
8783 goto out;
8786 canon_name = canonicalize_servicename(ctx, file_name);
8787 if (!canon_name) {
8788 goto out;
8791 fname = talloc_asprintf(ctx, "%s/%s", dir_name, file_name);
8792 if (!fname) {
8793 goto out;
8796 /* Minimize the race condition by doing an lstat before we
8797 open and fstat. Ensure this isn't a symlink link. */
8799 if (sys_lstat(fname, &lsbuf, false) != 0) {
8800 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8801 fname, strerror(errno) ));
8802 goto out;
8805 /* This must be a regular file, not a symlink, directory or
8806 other strange filetype. */
8807 if (!check_usershare_stat(fname, &lsbuf)) {
8808 goto out;
8812 TDB_DATA data = dbwrap_fetch_bystring(
8813 ServiceHash, canon_name, canon_name);
8815 iService = -1;
8817 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8818 iService = *(int *)data.dptr;
8822 if (iService != -1 &&
8823 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8824 &lsbuf.st_ex_mtime) == 0) {
8825 /* Nothing changed - Mark valid and return. */
8826 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8827 canon_name ));
8828 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8829 ret = iService;
8830 goto out;
8833 /* Try and open the file read only - no symlinks allowed. */
8834 #ifdef O_NOFOLLOW
8835 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8836 #else
8837 fd = sys_open(fname, O_RDONLY, 0);
8838 #endif
8840 if (fd == -1) {
8841 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8842 fname, strerror(errno) ));
8843 goto out;
8846 /* Now fstat to be *SURE* it's a regular file. */
8847 if (sys_fstat(fd, &sbuf, false) != 0) {
8848 close(fd);
8849 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8850 fname, strerror(errno) ));
8851 goto out;
8854 /* Is it the same dev/inode as was lstated ? */
8855 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
8856 close(fd);
8857 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8858 "Symlink spoofing going on ?\n", fname ));
8859 goto out;
8862 /* This must be a regular file, not a symlink, directory or
8863 other strange filetype. */
8864 if (!check_usershare_stat(fname, &sbuf)) {
8865 goto out;
8868 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8870 close(fd);
8871 if (lines == NULL) {
8872 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8873 fname, (unsigned int)sbuf.st_ex_uid ));
8874 goto out;
8877 if (parse_usershare_file(ctx, &sbuf, file_name,
8878 iService, lines, numlines, &sharepath,
8879 &comment, &cp_service_name,
8880 &psd, &guest_ok) != USERSHARE_OK) {
8881 goto out;
8884 /* Everything ok - add the service possibly using a template. */
8885 if (iService < 0) {
8886 const struct service *sp = &sDefault;
8887 if (snum_template != -1) {
8888 sp = ServicePtrs[snum_template];
8891 if ((iService = add_a_service(sp, cp_service_name)) < 0) {
8892 DEBUG(0, ("process_usershare_file: Failed to add "
8893 "new service %s\n", cp_service_name));
8894 goto out;
8897 added_service = true;
8899 /* Read only is controlled by usershare ACL below. */
8900 ServicePtrs[iService]->bRead_only = False;
8903 /* Write the ACL of the new/modified share. */
8904 if (!set_share_security(canon_name, psd)) {
8905 DEBUG(0, ("process_usershare_file: Failed to set share "
8906 "security for user share %s\n",
8907 canon_name ));
8908 goto out;
8911 /* If from a template it may be marked invalid. */
8912 ServicePtrs[iService]->valid = True;
8914 /* Set the service as a valid usershare. */
8915 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8917 /* Set guest access. */
8918 if (lp_usershare_allow_guests()) {
8919 ServicePtrs[iService]->bGuest_ok = guest_ok;
8922 /* And note when it was loaded. */
8923 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
8924 string_set(&ServicePtrs[iService]->szPath, sharepath);
8925 string_set(&ServicePtrs[iService]->comment, comment);
8927 ret = iService;
8929 out:
8931 if (ret == -1 && iService != -1 && added_service) {
8932 lp_remove_service(iService);
8935 TALLOC_FREE(lines);
8936 TALLOC_FREE(ctx);
8937 return ret;
8940 /***************************************************************************
8941 Checks if a usershare entry has been modified since last load.
8942 ***************************************************************************/
8944 static bool usershare_exists(int iService, struct timespec *last_mod)
8946 SMB_STRUCT_STAT lsbuf;
8947 const char *usersharepath = Globals.szUsersharePath;
8948 char *fname;
8950 if (asprintf(&fname, "%s/%s",
8951 usersharepath,
8952 ServicePtrs[iService]->szService) < 0) {
8953 return false;
8956 if (sys_lstat(fname, &lsbuf, false) != 0) {
8957 SAFE_FREE(fname);
8958 return false;
8961 if (!S_ISREG(lsbuf.st_ex_mode)) {
8962 SAFE_FREE(fname);
8963 return false;
8966 SAFE_FREE(fname);
8967 *last_mod = lsbuf.st_ex_mtime;
8968 return true;
8971 /***************************************************************************
8972 Load a usershare service by name. Returns a valid servicenumber or -1.
8973 ***************************************************************************/
8975 int load_usershare_service(const char *servicename)
8977 SMB_STRUCT_STAT sbuf;
8978 const char *usersharepath = Globals.szUsersharePath;
8979 int max_user_shares = Globals.iUsershareMaxShares;
8980 int snum_template = -1;
8982 if (*usersharepath == 0 || max_user_shares == 0) {
8983 return -1;
8986 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8987 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8988 usersharepath, strerror(errno) ));
8989 return -1;
8992 if (!S_ISDIR(sbuf.st_ex_mode)) {
8993 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8994 usersharepath ));
8995 return -1;
8999 * This directory must be owned by root, and have the 't' bit set.
9000 * It also must not be writable by "other".
9003 #ifdef S_ISVTX
9004 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9005 #else
9006 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9007 #endif
9008 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
9009 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9010 usersharepath ));
9011 return -1;
9014 /* Ensure the template share exists if it's set. */
9015 if (Globals.szUsershareTemplateShare[0]) {
9016 /* We can't use lp_servicenumber here as we are recommending that
9017 template shares have -valid=False set. */
9018 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9019 if (ServicePtrs[snum_template]->szService &&
9020 strequal(ServicePtrs[snum_template]->szService,
9021 Globals.szUsershareTemplateShare)) {
9022 break;
9026 if (snum_template == -1) {
9027 DEBUG(0,("load_usershare_service: usershare template share %s "
9028 "does not exist.\n",
9029 Globals.szUsershareTemplateShare ));
9030 return -1;
9034 return process_usershare_file(usersharepath, servicename, snum_template);
9037 /***************************************************************************
9038 Load all user defined shares from the user share directory.
9039 We only do this if we're enumerating the share list.
9040 This is the function that can delete usershares that have
9041 been removed.
9042 ***************************************************************************/
9044 int load_usershare_shares(void)
9046 SMB_STRUCT_DIR *dp;
9047 SMB_STRUCT_STAT sbuf;
9048 SMB_STRUCT_DIRENT *de;
9049 int num_usershares = 0;
9050 int max_user_shares = Globals.iUsershareMaxShares;
9051 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
9052 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
9053 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
9054 int iService;
9055 int snum_template = -1;
9056 const char *usersharepath = Globals.szUsersharePath;
9057 int ret = lp_numservices();
9059 if (max_user_shares == 0 || *usersharepath == '\0') {
9060 return lp_numservices();
9063 if (sys_stat(usersharepath, &sbuf, false) != 0) {
9064 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9065 usersharepath, strerror(errno) ));
9066 return ret;
9070 * This directory must be owned by root, and have the 't' bit set.
9071 * It also must not be writable by "other".
9074 #ifdef S_ISVTX
9075 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9076 #else
9077 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9078 #endif
9079 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9080 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9081 usersharepath ));
9082 return ret;
9085 /* Ensure the template share exists if it's set. */
9086 if (Globals.szUsershareTemplateShare[0]) {
9087 /* We can't use lp_servicenumber here as we are recommending that
9088 template shares have -valid=False set. */
9089 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9090 if (ServicePtrs[snum_template]->szService &&
9091 strequal(ServicePtrs[snum_template]->szService,
9092 Globals.szUsershareTemplateShare)) {
9093 break;
9097 if (snum_template == -1) {
9098 DEBUG(0,("load_usershare_shares: usershare template share %s "
9099 "does not exist.\n",
9100 Globals.szUsershareTemplateShare ));
9101 return ret;
9105 /* Mark all existing usershares as pending delete. */
9106 for (iService = iNumServices - 1; iService >= 0; iService--) {
9107 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9108 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9112 dp = sys_opendir(usersharepath);
9113 if (!dp) {
9114 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9115 usersharepath, strerror(errno) ));
9116 return ret;
9119 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9120 (de = sys_readdir(dp));
9121 num_dir_entries++ ) {
9122 int r;
9123 const char *n = de->d_name;
9125 /* Ignore . and .. */
9126 if (*n == '.') {
9127 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9128 continue;
9132 if (n[0] == ':') {
9133 /* Temporary file used when creating a share. */
9134 num_tmp_dir_entries++;
9137 /* Allow 20% tmp entries. */
9138 if (num_tmp_dir_entries > allowed_tmp_entries) {
9139 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9140 "in directory %s\n",
9141 num_tmp_dir_entries, usersharepath));
9142 break;
9145 r = process_usershare_file(usersharepath, n, snum_template);
9146 if (r == 0) {
9147 /* Update the services count. */
9148 num_usershares++;
9149 if (num_usershares >= max_user_shares) {
9150 DEBUG(0,("load_usershare_shares: max user shares reached "
9151 "on file %s in directory %s\n",
9152 n, usersharepath ));
9153 break;
9155 } else if (r == -1) {
9156 num_bad_dir_entries++;
9159 /* Allow 20% bad entries. */
9160 if (num_bad_dir_entries > allowed_bad_entries) {
9161 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9162 "in directory %s\n",
9163 num_bad_dir_entries, usersharepath));
9164 break;
9167 /* Allow 20% bad entries. */
9168 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9169 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9170 "in directory %s\n",
9171 num_dir_entries, usersharepath));
9172 break;
9176 sys_closedir(dp);
9178 /* Sweep through and delete any non-refreshed usershares that are
9179 not currently in use. */
9180 for (iService = iNumServices - 1; iService >= 0; iService--) {
9181 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9182 if (conn_snum_used(iService)) {
9183 continue;
9185 /* Remove from the share ACL db. */
9186 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9187 lp_servicename(iService) ));
9188 delete_share_security(lp_servicename(iService));
9189 free_service_byindex(iService);
9193 return lp_numservices();
9196 /********************************************************
9197 Destroy global resources allocated in this file
9198 ********************************************************/
9200 void gfree_loadparm(void)
9202 int i;
9204 free_file_list();
9206 /* Free resources allocated to services */
9208 for ( i = 0; i < iNumServices; i++ ) {
9209 if ( VALID(i) ) {
9210 free_service_byindex(i);
9214 SAFE_FREE( ServicePtrs );
9215 iNumServices = 0;
9217 /* Now release all resources allocated to global
9218 parameters and the default service */
9220 free_global_parameters();
9224 /***************************************************************************
9225 Allow client apps to specify that they are a client
9226 ***************************************************************************/
9227 void lp_set_in_client(bool b)
9229 in_client = b;
9233 /***************************************************************************
9234 Determine if we're running in a client app
9235 ***************************************************************************/
9236 bool lp_is_in_client(void)
9238 return in_client;
9241 /***************************************************************************
9242 Load the services array from the services file. Return True on success,
9243 False on failure.
9244 ***************************************************************************/
9246 bool lp_load_ex(const char *pszFname,
9247 bool global_only,
9248 bool save_defaults,
9249 bool add_ipc,
9250 bool initialize_globals,
9251 bool allow_include_registry,
9252 bool allow_registry_shares)
9254 char *n2 = NULL;
9255 bool bRetval;
9257 bRetval = False;
9259 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9261 bInGlobalSection = True;
9262 bGlobalOnly = global_only;
9263 bAllowIncludeRegistry = allow_include_registry;
9265 init_globals(! initialize_globals);
9266 debug_init();
9268 free_file_list();
9270 if (save_defaults) {
9271 init_locals();
9272 lp_save_defaults();
9275 free_param_opts(&Globals.param_opt);
9277 /* We get sections first, so have to start 'behind' to make up */
9278 iServiceIndex = -1;
9280 if (lp_config_backend_is_file()) {
9281 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9282 current_user_info.domain,
9283 pszFname);
9284 if (!n2) {
9285 smb_panic("lp_load_ex: out of memory");
9288 add_to_file_list(pszFname, n2);
9290 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9291 TALLOC_FREE(n2);
9293 /* finish up the last section */
9294 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9295 if (bRetval) {
9296 if (iServiceIndex >= 0) {
9297 bRetval = service_ok(iServiceIndex);
9301 if (lp_config_backend_is_registry()) {
9302 /* config backend changed to registry in config file */
9304 * We need to use this extra global variable here to
9305 * survive restart: init_globals uses this as a default
9306 * for ConfigBackend. Otherwise, init_globals would
9307 * send us into an endless loop here.
9309 config_backend = CONFIG_BACKEND_REGISTRY;
9310 /* start over */
9311 DEBUG(1, ("lp_load_ex: changing to config backend "
9312 "registry\n"));
9313 init_globals(false);
9314 lp_kill_all_services();
9315 return lp_load_ex(pszFname, global_only, save_defaults,
9316 add_ipc, initialize_globals,
9317 allow_include_registry,
9318 allow_registry_shares);
9320 } else if (lp_config_backend_is_registry()) {
9321 bRetval = process_registry_globals();
9322 } else {
9323 DEBUG(0, ("Illegal config backend given: %d\n",
9324 lp_config_backend()));
9325 bRetval = false;
9328 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9329 bRetval = process_registry_shares();
9332 lp_add_auto_services(lp_auto_services());
9334 if (add_ipc) {
9335 /* When 'restrict anonymous = 2' guest connections to ipc$
9336 are denied */
9337 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9338 if ( lp_enable_asu_support() ) {
9339 lp_add_ipc("ADMIN$", false);
9343 set_server_role();
9344 set_default_server_announce_type();
9345 set_allowed_client_auth();
9347 bLoaded = True;
9349 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9350 /* if bWINSsupport is true and we are in the client */
9351 if (lp_is_in_client() && Globals.bWINSsupport) {
9352 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9355 init_iconv();
9357 bAllowIncludeRegistry = true;
9359 return (bRetval);
9362 bool lp_load(const char *pszFname,
9363 bool global_only,
9364 bool save_defaults,
9365 bool add_ipc,
9366 bool initialize_globals)
9368 return lp_load_ex(pszFname,
9369 global_only,
9370 save_defaults,
9371 add_ipc,
9372 initialize_globals,
9373 true, false);
9376 bool lp_load_initial_only(const char *pszFname)
9378 return lp_load_ex(pszFname,
9379 true,
9380 false,
9381 false,
9382 true,
9383 false,
9384 false);
9387 bool lp_load_with_registry_shares(const char *pszFname,
9388 bool global_only,
9389 bool save_defaults,
9390 bool add_ipc,
9391 bool initialize_globals)
9393 return lp_load_ex(pszFname,
9394 global_only,
9395 save_defaults,
9396 add_ipc,
9397 initialize_globals,
9398 true,
9399 true);
9402 /***************************************************************************
9403 Return the max number of services.
9404 ***************************************************************************/
9406 int lp_numservices(void)
9408 return (iNumServices);
9411 /***************************************************************************
9412 Display the contents of the services array in human-readable form.
9413 ***************************************************************************/
9415 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9417 int iService;
9419 if (show_defaults)
9420 defaults_saved = False;
9422 dump_globals(f);
9424 dump_a_service(&sDefault, f);
9426 for (iService = 0; iService < maxtoprint; iService++) {
9427 fprintf(f,"\n");
9428 lp_dump_one(f, show_defaults, iService);
9432 /***************************************************************************
9433 Display the contents of one service in human-readable form.
9434 ***************************************************************************/
9436 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9438 if (VALID(snum)) {
9439 if (ServicePtrs[snum]->szService[0] == '\0')
9440 return;
9441 dump_a_service(ServicePtrs[snum], f);
9445 /***************************************************************************
9446 Return the number of the service with the given name, or -1 if it doesn't
9447 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9448 getservicebyname()! This works ONLY if all services have been loaded, and
9449 does not copy the found service.
9450 ***************************************************************************/
9452 int lp_servicenumber(const char *pszServiceName)
9454 int iService;
9455 fstring serviceName;
9457 if (!pszServiceName) {
9458 return GLOBAL_SECTION_SNUM;
9461 for (iService = iNumServices - 1; iService >= 0; iService--) {
9462 if (VALID(iService) && ServicePtrs[iService]->szService) {
9464 * The substitution here is used to support %U is
9465 * service names
9467 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9468 standard_sub_basic(get_current_username(),
9469 current_user_info.domain,
9470 serviceName,sizeof(serviceName));
9471 if (strequal(serviceName, pszServiceName)) {
9472 break;
9477 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9478 struct timespec last_mod;
9480 if (!usershare_exists(iService, &last_mod)) {
9481 /* Remove the share security tdb entry for it. */
9482 delete_share_security(lp_servicename(iService));
9483 /* Remove it from the array. */
9484 free_service_byindex(iService);
9485 /* Doesn't exist anymore. */
9486 return GLOBAL_SECTION_SNUM;
9489 /* Has it been modified ? If so delete and reload. */
9490 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9491 &last_mod) < 0) {
9492 /* Remove it from the array. */
9493 free_service_byindex(iService);
9494 /* and now reload it. */
9495 iService = load_usershare_service(pszServiceName);
9499 if (iService < 0) {
9500 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9501 return GLOBAL_SECTION_SNUM;
9504 return (iService);
9507 bool share_defined(const char *service_name)
9509 return (lp_servicenumber(service_name) != -1);
9512 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9513 const char *sharename)
9515 struct share_params *result;
9516 char *sname;
9517 int snum;
9519 if (!(sname = SMB_STRDUP(sharename))) {
9520 return NULL;
9523 snum = find_service(sname);
9524 SAFE_FREE(sname);
9526 if (snum < 0) {
9527 return NULL;
9530 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9531 DEBUG(0, ("talloc failed\n"));
9532 return NULL;
9535 result->service = snum;
9536 return result;
9539 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9541 struct share_iterator *result;
9543 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9544 DEBUG(0, ("talloc failed\n"));
9545 return NULL;
9548 result->next_id = 0;
9549 return result;
9552 struct share_params *next_share(struct share_iterator *list)
9554 struct share_params *result;
9556 while (!lp_snum_ok(list->next_id) &&
9557 (list->next_id < lp_numservices())) {
9558 list->next_id += 1;
9561 if (list->next_id >= lp_numservices()) {
9562 return NULL;
9565 if (!(result = TALLOC_P(list, struct share_params))) {
9566 DEBUG(0, ("talloc failed\n"));
9567 return NULL;
9570 result->service = list->next_id;
9571 list->next_id += 1;
9572 return result;
9575 struct share_params *next_printer(struct share_iterator *list)
9577 struct share_params *result;
9579 while ((result = next_share(list)) != NULL) {
9580 if (lp_print_ok(result->service)) {
9581 break;
9584 return result;
9588 * This is a hack for a transition period until we transformed all code from
9589 * service numbers to struct share_params.
9592 struct share_params *snum2params_static(int snum)
9594 static struct share_params result;
9595 result.service = snum;
9596 return &result;
9599 /*******************************************************************
9600 A useful volume label function.
9601 ********************************************************************/
9603 const char *volume_label(int snum)
9605 char *ret;
9606 const char *label = lp_volume(snum);
9607 if (!*label) {
9608 label = lp_servicename(snum);
9611 /* This returns a 33 byte guarenteed null terminated string. */
9612 ret = talloc_strndup(talloc_tos(), label, 32);
9613 if (!ret) {
9614 return "";
9616 return ret;
9619 /*******************************************************************
9620 Set the server type we will announce as via nmbd.
9621 ********************************************************************/
9623 static void set_default_server_announce_type(void)
9625 default_server_announce = 0;
9626 default_server_announce |= SV_TYPE_WORKSTATION;
9627 default_server_announce |= SV_TYPE_SERVER;
9628 default_server_announce |= SV_TYPE_SERVER_UNIX;
9630 /* note that the flag should be set only if we have a
9631 printer service but nmbd doesn't actually load the
9632 services so we can't tell --jerry */
9634 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9636 switch (lp_announce_as()) {
9637 case ANNOUNCE_AS_NT_SERVER:
9638 default_server_announce |= SV_TYPE_SERVER_NT;
9639 /* fall through... */
9640 case ANNOUNCE_AS_NT_WORKSTATION:
9641 default_server_announce |= SV_TYPE_NT;
9642 break;
9643 case ANNOUNCE_AS_WIN95:
9644 default_server_announce |= SV_TYPE_WIN95_PLUS;
9645 break;
9646 case ANNOUNCE_AS_WFW:
9647 default_server_announce |= SV_TYPE_WFW;
9648 break;
9649 default:
9650 break;
9653 switch (lp_server_role()) {
9654 case ROLE_DOMAIN_MEMBER:
9655 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9656 break;
9657 case ROLE_DOMAIN_PDC:
9658 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9659 break;
9660 case ROLE_DOMAIN_BDC:
9661 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9662 break;
9663 case ROLE_STANDALONE:
9664 default:
9665 break;
9667 if (lp_time_server())
9668 default_server_announce |= SV_TYPE_TIME_SOURCE;
9670 if (lp_host_msdfs())
9671 default_server_announce |= SV_TYPE_DFS_SERVER;
9674 /***********************************************************
9675 returns role of Samba server
9676 ************************************************************/
9678 int lp_server_role(void)
9680 return server_role;
9683 /***********************************************************
9684 If we are PDC then prefer us as DMB
9685 ************************************************************/
9687 bool lp_domain_master(void)
9689 if (Globals.iDomainMaster == Auto)
9690 return (lp_server_role() == ROLE_DOMAIN_PDC);
9692 return (bool)Globals.iDomainMaster;
9695 /***********************************************************
9696 If we are DMB then prefer us as LMB
9697 ************************************************************/
9699 bool lp_preferred_master(void)
9701 if (Globals.iPreferredMaster == Auto)
9702 return (lp_local_master() && lp_domain_master());
9704 return (bool)Globals.iPreferredMaster;
9707 /*******************************************************************
9708 Remove a service.
9709 ********************************************************************/
9711 void lp_remove_service(int snum)
9713 ServicePtrs[snum]->valid = False;
9714 invalid_services[num_invalid_services++] = snum;
9717 /*******************************************************************
9718 Copy a service.
9719 ********************************************************************/
9721 void lp_copy_service(int snum, const char *new_name)
9723 do_section(new_name, NULL);
9724 if (snum >= 0) {
9725 snum = lp_servicenumber(new_name);
9726 if (snum >= 0)
9727 lp_do_parameter(snum, "copy", lp_servicename(snum));
9732 /*******************************************************************
9733 Get the default server type we will announce as via nmbd.
9734 ********************************************************************/
9736 int lp_default_server_announce(void)
9738 return default_server_announce;
9741 /*******************************************************************
9742 Split the announce version into major and minor numbers.
9743 ********************************************************************/
9745 int lp_major_announce_version(void)
9747 static bool got_major = False;
9748 static int major_version = DEFAULT_MAJOR_VERSION;
9749 char *vers;
9750 char *p;
9752 if (got_major)
9753 return major_version;
9755 got_major = True;
9756 if ((vers = lp_announce_version()) == NULL)
9757 return major_version;
9759 if ((p = strchr_m(vers, '.')) == 0)
9760 return major_version;
9762 *p = '\0';
9763 major_version = atoi(vers);
9764 return major_version;
9767 int lp_minor_announce_version(void)
9769 static bool got_minor = False;
9770 static int minor_version = DEFAULT_MINOR_VERSION;
9771 char *vers;
9772 char *p;
9774 if (got_minor)
9775 return minor_version;
9777 got_minor = True;
9778 if ((vers = lp_announce_version()) == NULL)
9779 return minor_version;
9781 if ((p = strchr_m(vers, '.')) == 0)
9782 return minor_version;
9784 p++;
9785 minor_version = atoi(p);
9786 return minor_version;
9789 /***********************************************************
9790 Set the global name resolution order (used in smbclient).
9791 ************************************************************/
9793 void lp_set_name_resolve_order(const char *new_order)
9795 string_set(&Globals.szNameResolveOrder, new_order);
9798 const char *lp_printername(int snum)
9800 const char *ret = _lp_printername(snum);
9801 if (ret == NULL || (ret != NULL && *ret == '\0'))
9802 ret = lp_const_servicename(snum);
9804 return ret;
9808 /***********************************************************
9809 Allow daemons such as winbindd to fix their logfile name.
9810 ************************************************************/
9812 void lp_set_logfile(const char *name)
9814 string_set(&Globals.szLogFile, name);
9815 debug_set_logfile(name);
9818 /*******************************************************************
9819 Return the max print jobs per queue.
9820 ********************************************************************/
9822 int lp_maxprintjobs(int snum)
9824 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9825 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9826 maxjobs = PRINT_MAX_JOBID - 1;
9828 return maxjobs;
9831 const char *lp_printcapname(void)
9833 if ((Globals.szPrintcapname != NULL) &&
9834 (Globals.szPrintcapname[0] != '\0'))
9835 return Globals.szPrintcapname;
9837 if (sDefault.iPrinting == PRINT_CUPS) {
9838 #ifdef HAVE_CUPS
9839 return "cups";
9840 #else
9841 return "lpstat";
9842 #endif
9845 if (sDefault.iPrinting == PRINT_BSD)
9846 return "/etc/printcap";
9848 return PRINTCAP_NAME;
9851 static uint32 spoolss_state;
9853 bool lp_disable_spoolss( void )
9855 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9856 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9858 return spoolss_state == SVCCTL_STOPPED ? True : False;
9861 void lp_set_spoolss_state( uint32 state )
9863 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9865 spoolss_state = state;
9868 uint32 lp_get_spoolss_state( void )
9870 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9873 /*******************************************************************
9874 Ensure we don't use sendfile if server smb signing is active.
9875 ********************************************************************/
9877 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
9879 bool sign_active = false;
9881 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9882 if (get_Protocol() < PROTOCOL_NT1) {
9883 return false;
9885 if (signing_state) {
9886 sign_active = smb_signing_is_active(signing_state);
9888 return (_lp_use_sendfile(snum) &&
9889 (get_remote_arch() != RA_WIN95) &&
9890 !sign_active);
9893 /*******************************************************************
9894 Turn off sendfile if we find the underlying OS doesn't support it.
9895 ********************************************************************/
9897 void set_use_sendfile(int snum, bool val)
9899 if (LP_SNUM_OK(snum))
9900 ServicePtrs[snum]->bUseSendfile = val;
9901 else
9902 sDefault.bUseSendfile = val;
9905 /*******************************************************************
9906 Turn off storing DOS attributes if this share doesn't support it.
9907 ********************************************************************/
9909 void set_store_dos_attributes(int snum, bool val)
9911 if (!LP_SNUM_OK(snum))
9912 return;
9913 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9916 void lp_set_mangling_method(const char *new_method)
9918 string_set(&Globals.szManglingMethod, new_method);
9921 /*******************************************************************
9922 Global state for POSIX pathname processing.
9923 ********************************************************************/
9925 static bool posix_pathnames;
9927 bool lp_posix_pathnames(void)
9929 return posix_pathnames;
9932 /*******************************************************************
9933 Change everything needed to ensure POSIX pathname processing (currently
9934 not much).
9935 ********************************************************************/
9937 void lp_set_posix_pathnames(void)
9939 posix_pathnames = True;
9942 /*******************************************************************
9943 Global state for POSIX lock processing - CIFS unix extensions.
9944 ********************************************************************/
9946 bool posix_default_lock_was_set;
9947 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9949 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
9951 if (posix_default_lock_was_set) {
9952 return posix_cifsx_locktype;
9953 } else {
9954 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9958 /*******************************************************************
9959 ********************************************************************/
9961 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
9963 posix_default_lock_was_set = True;
9964 posix_cifsx_locktype = val;
9967 int lp_min_receive_file_size(void)
9969 if (Globals.iminreceivefile < 0) {
9970 return 0;
9972 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
9975 /*******************************************************************
9976 If socket address is an empty character string, it is necessary to
9977 define it as "0.0.0.0".
9978 ********************************************************************/
9980 const char *lp_socket_address(void)
9982 char *sock_addr = Globals.szSocketAddress;
9984 if (sock_addr[0] == '\0'){
9985 string_set(&Globals.szSocketAddress, "0.0.0.0");
9987 return Globals.szSocketAddress;
9990 void lp_set_passdb_backend(const char *backend)
9992 string_set(&Globals.szPassdbBackend, backend);
9995 /*******************************************************************
9996 Safe wide links checks.
9997 This helper function always verify the validity of wide links,
9998 even after a configuration file reload.
9999 ********************************************************************/
10001 static bool lp_widelinks_internal(int snum)
10003 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
10004 sDefault.bWidelinks);
10007 void widelinks_warning(int snum)
10009 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
10010 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
10011 "These parameters are incompatible. "
10012 "Wide links will be disabled for this share.\n",
10013 lp_servicename(snum) ));
10017 bool lp_widelinks(int snum)
10019 /* wide links is always incompatible with unix extensions */
10020 if (lp_unix_extensions()) {
10021 return false;
10024 return lp_widelinks_internal(snum);