s3-util_sock: Rise debug level for getpeername failed messages.
[Samba/gebeck_regimport.git] / source3 / param / loadparm.c
blob9e9930f7d48061b02ffaf2481e33b18e032931a9
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 char *szCheckPasswordScript;
185 char *szWINSHook;
186 char *szUtmpDir;
187 char *szWtmpDir;
188 bool bUtmp;
189 char *szIdmapUID;
190 char *szIdmapGID;
191 bool bPassdbExpandExplicit;
192 int AlgorithmicRidBase;
193 char *szTemplateHomedir;
194 char *szTemplateShell;
195 char *szWinbindSeparator;
196 bool bWinbindEnumUsers;
197 bool bWinbindEnumGroups;
198 bool bWinbindUseDefaultDomain;
199 bool bWinbindTrustedDomainsOnly;
200 bool bWinbindNestedGroups;
201 int winbind_expand_groups;
202 bool bWinbindRefreshTickets;
203 bool bWinbindOfflineLogon;
204 bool bWinbindNormalizeNames;
205 bool bWinbindRpcOnly;
206 bool bCreateKrb5Conf;
207 char *szIdmapBackend;
208 char *szIdmapAllocBackend;
209 char *szAddShareCommand;
210 char *szChangeShareCommand;
211 char *szDeleteShareCommand;
212 char **szEventLogs;
213 char *szGuestaccount;
214 char *szManglingMethod;
215 char **szServicesList;
216 char *szUsersharePath;
217 char *szUsershareTemplateShare;
218 char **szUsersharePrefixAllowList;
219 char **szUsersharePrefixDenyList;
220 int mangle_prefix;
221 int max_log_size;
222 char *szLogLevel;
223 int max_xmit;
224 int max_mux;
225 int max_open_files;
226 int open_files_db_hash_size;
227 int pwordlevel;
228 int unamelevel;
229 int deadtime;
230 bool getwd_cache;
231 int maxprotocol;
232 int minprotocol;
233 int security;
234 char **AuthMethods;
235 bool paranoid_server_security;
236 int maxdisksize;
237 int lpqcachetime;
238 int iMaxSmbdProcesses;
239 bool bDisableSpoolss;
240 int syslog;
241 int os_level;
242 bool enhanced_browsing;
243 int max_ttl;
244 int max_wins_ttl;
245 int min_wins_ttl;
246 int lm_announce;
247 int lm_interval;
248 int announce_as; /* This is initialised in init_globals */
249 int machine_password_timeout;
250 int map_to_guest;
251 int oplock_break_wait_time;
252 int winbind_cache_time;
253 int winbind_reconnect_delay;
254 int winbind_max_idle_children;
255 char **szWinbindNssInfo;
256 int iLockSpinTime;
257 char *szLdapMachineSuffix;
258 char *szLdapUserSuffix;
259 char *szLdapIdmapSuffix;
260 char *szLdapGroupSuffix;
261 int ldap_ssl;
262 bool ldap_ssl_ads;
263 int ldap_deref;
264 int ldap_follow_referral;
265 char *szLdapSuffix;
266 char *szLdapAdminDn;
267 int ldap_debug_level;
268 int ldap_debug_threshold;
269 int iAclCompat;
270 char *szCupsServer;
271 int CupsEncrypt;
272 char *szIPrintServer;
273 char *ctdbdSocket;
274 char **szClusterAddresses;
275 bool clustering;
276 int ctdb_timeout;
277 int ctdb_locktime_warn_threshold;
278 int ldap_passwd_sync;
279 int ldap_replication_sleep;
280 int ldap_timeout; /* This is initialised in init_globals */
281 int ldap_connection_timeout;
282 int ldap_page_size;
283 bool ldap_delete_dn;
284 bool bMsAddPrinterWizard;
285 bool bDNSproxy;
286 bool bWINSsupport;
287 bool bWINSproxy;
288 bool bLocalMaster;
289 int iPreferredMaster;
290 int iDomainMaster;
291 bool bDomainLogons;
292 char **szInitLogonDelayedHosts;
293 int InitLogonDelay;
294 bool bEncryptPasswords;
295 bool bUpdateEncrypt;
296 int clientSchannel;
297 int serverSchannel;
298 bool bNullPasswords;
299 bool bObeyPamRestrictions;
300 bool bLoadPrinters;
301 int PrintcapCacheTime;
302 bool bLargeReadwrite;
303 bool bReadRaw;
304 bool bWriteRaw;
305 bool bSyslogOnly;
306 bool bBrowseList;
307 bool bNISHomeMap;
308 bool bTimeServer;
309 bool bBindInterfacesOnly;
310 bool bPamPasswordChange;
311 bool bUnixPasswdSync;
312 bool bPasswdChatDebug;
313 int iPasswdChatTimeout;
314 bool bTimestampLogs;
315 bool bNTSmbSupport;
316 bool bNTPipeSupport;
317 bool bNTStatusSupport;
318 bool bStatCache;
319 int iMaxStatCacheSize;
320 bool bKernelOplocks;
321 bool bAllowTrustedDomains;
322 bool bLanmanAuth;
323 bool bNTLMAuth;
324 bool bUseSpnego;
325 bool bClientLanManAuth;
326 bool bClientNTLMv2Auth;
327 bool bClientPlaintextAuth;
328 bool bClientUseSpnego;
329 bool bDebugPrefixTimestamp;
330 bool bDebugHiresTimestamp;
331 bool bDebugPid;
332 bool bDebugUid;
333 bool bDebugClass;
334 bool bEnableCoreFiles;
335 bool bHostMSDfs;
336 bool bUseMmap;
337 bool bHostnameLookups;
338 bool bUnixExtensions;
339 bool bDisableNetbios;
340 char * szDedicatedKeytabFile;
341 int iKerberosMethod;
342 bool bDeferSharingViolations;
343 bool bEnablePrivileges;
344 bool bASUSupport;
345 bool bUsershareOwnerOnly;
346 bool bUsershareAllowGuests;
347 bool bRegistryShares;
348 int restrict_anonymous;
349 int name_cache_timeout;
350 int client_signing;
351 int server_signing;
352 int client_ldap_sasl_wrapping;
353 int iUsershareMaxShares;
354 int iIdmapCacheTime;
355 int iIdmapNegativeCacheTime;
356 bool bResetOnZeroVC;
357 bool bLogWriteableFilesOnExit;
358 int iKeepalive;
359 int iminreceivefile;
360 struct param_opt_struct *param_opt;
361 int cups_connection_timeout;
362 char *szSMBPerfcountModule;
363 bool bMapUntrustedToDomain;
364 bool bAsyncSMBEchoHandler;
367 static struct global Globals;
370 * This structure describes a single service.
372 struct service {
373 bool valid;
374 bool autoloaded;
375 int usershare;
376 struct timespec usershare_last_mod;
377 char *szService;
378 char *szPath;
379 char *szUsername;
380 char **szInvalidUsers;
381 char **szValidUsers;
382 char **szAdminUsers;
383 char *szCopy;
384 char *szInclude;
385 char *szPreExec;
386 char *szPostExec;
387 char *szRootPreExec;
388 char *szRootPostExec;
389 char *szCupsOptions;
390 char *szPrintcommand;
391 char *szLpqcommand;
392 char *szLprmcommand;
393 char *szLppausecommand;
394 char *szLpresumecommand;
395 char *szQueuepausecommand;
396 char *szQueueresumecommand;
397 char *szPrintername;
398 char *szPrintjobUsername;
399 char *szDontdescend;
400 char **szHostsallow;
401 char **szHostsdeny;
402 char *szMagicScript;
403 char *szMagicOutput;
404 char *szVetoFiles;
405 char *szHideFiles;
406 char *szVetoOplockFiles;
407 char *comment;
408 char *force_user;
409 char *force_group;
410 char **readlist;
411 char **writelist;
412 char **printer_admin;
413 char *volume;
414 char *fstype;
415 char **szVfsObjects;
416 char *szMSDfsProxy;
417 char *szAioWriteBehind;
418 char *szDfree;
419 int iMinPrintSpace;
420 int iMaxPrintJobs;
421 int iMaxReportedPrintJobs;
422 int iWriteCacheSize;
423 int iCreate_mask;
424 int iCreate_force_mode;
425 int iSecurity_mask;
426 int iSecurity_force_mode;
427 int iDir_mask;
428 int iDir_force_mode;
429 int iDir_Security_mask;
430 int iDir_Security_force_mode;
431 int iMaxConnections;
432 int iDefaultCase;
433 int iPrinting;
434 int iOplockContentionLimit;
435 int iCSCPolicy;
436 int iBlock_size;
437 int iDfreeCacheTime;
438 bool bPreexecClose;
439 bool bRootpreexecClose;
440 int iCaseSensitive;
441 bool bCasePreserve;
442 bool bShortCasePreserve;
443 bool bHideDotFiles;
444 bool bHideSpecialFiles;
445 bool bHideUnReadable;
446 bool bHideUnWriteableFiles;
447 bool bBrowseable;
448 bool bAccessBasedShareEnum;
449 bool bAvailable;
450 bool bRead_only;
451 bool bNo_set_dir;
452 bool bGuest_only;
453 bool bAdministrative_share;
454 bool bGuest_ok;
455 bool bPrint_ok;
456 bool bMap_system;
457 bool bMap_hidden;
458 bool bMap_archive;
459 bool bStoreDosAttributes;
460 bool bDmapiSupport;
461 bool bLocking;
462 int iStrictLocking;
463 bool bPosixLocking;
464 bool bShareModes;
465 bool bOpLocks;
466 bool bLevel2OpLocks;
467 bool bOnlyUser;
468 bool bMangledNames;
469 bool bWidelinks;
470 bool bSymlinks;
471 bool bSyncAlways;
472 bool bStrictAllocate;
473 bool bStrictSync;
474 char magic_char;
475 struct bitmap *copymap;
476 bool bDeleteReadonly;
477 bool bFakeOplocks;
478 bool bDeleteVetoFiles;
479 bool bDosFilemode;
480 bool bDosFiletimes;
481 bool bDosFiletimeResolution;
482 bool bFakeDirCreateTimes;
483 bool bBlockingLocks;
484 bool bInheritPerms;
485 bool bInheritACLS;
486 bool bInheritOwner;
487 bool bMSDfsRoot;
488 bool bUseClientDriver;
489 bool bDefaultDevmode;
490 bool bForcePrintername;
491 bool bNTAclSupport;
492 bool bForceUnknownAclUser;
493 bool bUseSendfile;
494 bool bProfileAcls;
495 bool bMap_acl_inherit;
496 bool bAfs_Share;
497 bool bEASupport;
498 bool bAclCheckPermissions;
499 bool bAclMapFullControl;
500 bool bAclGroupControl;
501 bool bChangeNotify;
502 bool bKernelChangeNotify;
503 int iallocation_roundup_size;
504 int iAioReadSize;
505 int iAioWriteSize;
506 int iMap_readonly;
507 int iDirectoryNameCacheSize;
508 int ismb_encrypt;
509 struct param_opt_struct *param_opt;
511 char dummy[3]; /* for alignment */
515 /* This is a default service used to prime a services structure */
516 static struct service sDefault = {
517 True, /* valid */
518 False, /* not autoloaded */
519 0, /* not a usershare */
520 {0, }, /* No last mod time */
521 NULL, /* szService */
522 NULL, /* szPath */
523 NULL, /* szUsername */
524 NULL, /* szInvalidUsers */
525 NULL, /* szValidUsers */
526 NULL, /* szAdminUsers */
527 NULL, /* szCopy */
528 NULL, /* szInclude */
529 NULL, /* szPreExec */
530 NULL, /* szPostExec */
531 NULL, /* szRootPreExec */
532 NULL, /* szRootPostExec */
533 NULL, /* szCupsOptions */
534 NULL, /* szPrintcommand */
535 NULL, /* szLpqcommand */
536 NULL, /* szLprmcommand */
537 NULL, /* szLppausecommand */
538 NULL, /* szLpresumecommand */
539 NULL, /* szQueuepausecommand */
540 NULL, /* szQueueresumecommand */
541 NULL, /* szPrintername */
542 NULL, /* szPrintjobUsername */
543 NULL, /* szDontdescend */
544 NULL, /* szHostsallow */
545 NULL, /* szHostsdeny */
546 NULL, /* szMagicScript */
547 NULL, /* szMagicOutput */
548 NULL, /* szVetoFiles */
549 NULL, /* szHideFiles */
550 NULL, /* szVetoOplockFiles */
551 NULL, /* comment */
552 NULL, /* force user */
553 NULL, /* force group */
554 NULL, /* readlist */
555 NULL, /* writelist */
556 NULL, /* printer admin */
557 NULL, /* volume */
558 NULL, /* fstype */
559 NULL, /* vfs objects */
560 NULL, /* szMSDfsProxy */
561 NULL, /* szAioWriteBehind */
562 NULL, /* szDfree */
563 0, /* iMinPrintSpace */
564 1000, /* iMaxPrintJobs */
565 0, /* iMaxReportedPrintJobs */
566 0, /* iWriteCacheSize */
567 0744, /* iCreate_mask */
568 0000, /* iCreate_force_mode */
569 0777, /* iSecurity_mask */
570 0, /* iSecurity_force_mode */
571 0755, /* iDir_mask */
572 0000, /* iDir_force_mode */
573 0777, /* iDir_Security_mask */
574 0, /* iDir_Security_force_mode */
575 0, /* iMaxConnections */
576 CASE_LOWER, /* iDefaultCase */
577 DEFAULT_PRINTING, /* iPrinting */
578 2, /* iOplockContentionLimit */
579 0, /* iCSCPolicy */
580 1024, /* iBlock_size */
581 0, /* iDfreeCacheTime */
582 False, /* bPreexecClose */
583 False, /* bRootpreexecClose */
584 Auto, /* case sensitive */
585 True, /* case preserve */
586 True, /* short case preserve */
587 True, /* bHideDotFiles */
588 False, /* bHideSpecialFiles */
589 False, /* bHideUnReadable */
590 False, /* bHideUnWriteableFiles */
591 True, /* bBrowseable */
592 False, /* bAccessBasedShareEnum */
593 True, /* bAvailable */
594 True, /* bRead_only */
595 True, /* bNo_set_dir */
596 False, /* bGuest_only */
597 False, /* bAdministrative_share */
598 False, /* bGuest_ok */
599 False, /* bPrint_ok */
600 False, /* bMap_system */
601 False, /* bMap_hidden */
602 True, /* bMap_archive */
603 False, /* bStoreDosAttributes */
604 False, /* bDmapiSupport */
605 True, /* bLocking */
606 Auto, /* iStrictLocking */
607 True, /* bPosixLocking */
608 True, /* bShareModes */
609 True, /* bOpLocks */
610 True, /* bLevel2OpLocks */
611 False, /* bOnlyUser */
612 True, /* bMangledNames */
613 false, /* bWidelinks */
614 True, /* bSymlinks */
615 False, /* bSyncAlways */
616 False, /* bStrictAllocate */
617 False, /* bStrictSync */
618 '~', /* magic char */
619 NULL, /* copymap */
620 False, /* bDeleteReadonly */
621 False, /* bFakeOplocks */
622 False, /* bDeleteVetoFiles */
623 False, /* bDosFilemode */
624 True, /* bDosFiletimes */
625 False, /* bDosFiletimeResolution */
626 False, /* bFakeDirCreateTimes */
627 True, /* bBlockingLocks */
628 False, /* bInheritPerms */
629 False, /* bInheritACLS */
630 False, /* bInheritOwner */
631 False, /* bMSDfsRoot */
632 False, /* bUseClientDriver */
633 True, /* bDefaultDevmode */
634 False, /* bForcePrintername */
635 True, /* bNTAclSupport */
636 False, /* bForceUnknownAclUser */
637 False, /* bUseSendfile */
638 False, /* bProfileAcls */
639 False, /* bMap_acl_inherit */
640 False, /* bAfs_Share */
641 False, /* bEASupport */
642 True, /* bAclCheckPermissions */
643 True, /* bAclMapFullControl */
644 False, /* bAclGroupControl */
645 True, /* bChangeNotify */
646 True, /* bKernelChangeNotify */
647 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
648 0, /* iAioReadSize */
649 0, /* iAioWriteSize */
650 MAP_READONLY_YES, /* iMap_readonly */
651 #ifdef BROKEN_DIRECTORY_HANDLING
652 0, /* iDirectoryNameCacheSize */
653 #else
654 100, /* iDirectoryNameCacheSize */
655 #endif
656 Auto, /* ismb_encrypt */
657 NULL, /* Parametric options */
659 "" /* dummy */
662 /* local variables */
663 static struct service **ServicePtrs = NULL;
664 static int iNumServices = 0;
665 static int iServiceIndex = 0;
666 static struct db_context *ServiceHash;
667 static int *invalid_services = NULL;
668 static int num_invalid_services = 0;
669 static bool bInGlobalSection = True;
670 static bool bGlobalOnly = False;
671 static int server_role;
672 static int default_server_announce;
674 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
676 /* prototypes for the special type handlers */
677 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
678 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
679 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
680 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
681 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
682 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
683 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
684 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
685 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
686 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
687 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
688 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
690 static void set_server_role(void);
691 static void set_default_server_announce_type(void);
692 static void set_allowed_client_auth(void);
694 static void *lp_local_ptr(struct service *service, void *ptr);
696 static void add_to_file_list(const char *fname, const char *subfname);
698 static const struct enum_list enum_protocol[] = {
699 {PROTOCOL_SMB2, "SMB2"},
700 {PROTOCOL_NT1, "NT1"},
701 {PROTOCOL_LANMAN2, "LANMAN2"},
702 {PROTOCOL_LANMAN1, "LANMAN1"},
703 {PROTOCOL_CORE, "CORE"},
704 {PROTOCOL_COREPLUS, "COREPLUS"},
705 {PROTOCOL_COREPLUS, "CORE+"},
706 {-1, NULL}
709 static const struct enum_list enum_security[] = {
710 {SEC_SHARE, "SHARE"},
711 {SEC_USER, "USER"},
712 {SEC_SERVER, "SERVER"},
713 {SEC_DOMAIN, "DOMAIN"},
714 #ifdef HAVE_ADS
715 {SEC_ADS, "ADS"},
716 #endif
717 {-1, NULL}
720 static const struct enum_list enum_printing[] = {
721 {PRINT_SYSV, "sysv"},
722 {PRINT_AIX, "aix"},
723 {PRINT_HPUX, "hpux"},
724 {PRINT_BSD, "bsd"},
725 {PRINT_QNX, "qnx"},
726 {PRINT_PLP, "plp"},
727 {PRINT_LPRNG, "lprng"},
728 {PRINT_CUPS, "cups"},
729 {PRINT_IPRINT, "iprint"},
730 {PRINT_LPRNT, "nt"},
731 {PRINT_LPROS2, "os2"},
732 #ifdef DEVELOPER
733 {PRINT_TEST, "test"},
734 {PRINT_VLP, "vlp"},
735 #endif /* DEVELOPER */
736 {-1, NULL}
739 static const struct enum_list enum_ldap_sasl_wrapping[] = {
740 {0, "plain"},
741 {ADS_AUTH_SASL_SIGN, "sign"},
742 {ADS_AUTH_SASL_SEAL, "seal"},
743 {-1, NULL}
746 static const struct enum_list enum_ldap_ssl[] = {
747 {LDAP_SSL_OFF, "no"},
748 {LDAP_SSL_OFF, "off"},
749 {LDAP_SSL_START_TLS, "start tls"},
750 {LDAP_SSL_START_TLS, "start_tls"},
751 {-1, NULL}
754 /* LDAP Dereferencing Alias types */
755 #define SAMBA_LDAP_DEREF_NEVER 0
756 #define SAMBA_LDAP_DEREF_SEARCHING 1
757 #define SAMBA_LDAP_DEREF_FINDING 2
758 #define SAMBA_LDAP_DEREF_ALWAYS 3
760 static const struct enum_list enum_ldap_deref[] = {
761 {SAMBA_LDAP_DEREF_NEVER, "never"},
762 {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
763 {SAMBA_LDAP_DEREF_FINDING, "finding"},
764 {SAMBA_LDAP_DEREF_ALWAYS, "always"},
765 {-1, "auto"}
768 static const struct enum_list enum_ldap_passwd_sync[] = {
769 {LDAP_PASSWD_SYNC_OFF, "no"},
770 {LDAP_PASSWD_SYNC_OFF, "off"},
771 {LDAP_PASSWD_SYNC_ON, "yes"},
772 {LDAP_PASSWD_SYNC_ON, "on"},
773 {LDAP_PASSWD_SYNC_ONLY, "only"},
774 {-1, NULL}
777 /* Types of machine we can announce as. */
778 #define ANNOUNCE_AS_NT_SERVER 1
779 #define ANNOUNCE_AS_WIN95 2
780 #define ANNOUNCE_AS_WFW 3
781 #define ANNOUNCE_AS_NT_WORKSTATION 4
783 static const struct enum_list enum_announce_as[] = {
784 {ANNOUNCE_AS_NT_SERVER, "NT"},
785 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
786 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
787 {ANNOUNCE_AS_WIN95, "win95"},
788 {ANNOUNCE_AS_WFW, "WfW"},
789 {-1, NULL}
792 static const struct enum_list enum_map_readonly[] = {
793 {MAP_READONLY_NO, "no"},
794 {MAP_READONLY_NO, "false"},
795 {MAP_READONLY_NO, "0"},
796 {MAP_READONLY_YES, "yes"},
797 {MAP_READONLY_YES, "true"},
798 {MAP_READONLY_YES, "1"},
799 {MAP_READONLY_PERMISSIONS, "permissions"},
800 {MAP_READONLY_PERMISSIONS, "perms"},
801 {-1, NULL}
804 static const struct enum_list enum_case[] = {
805 {CASE_LOWER, "lower"},
806 {CASE_UPPER, "upper"},
807 {-1, NULL}
812 static const struct enum_list enum_bool_auto[] = {
813 {False, "No"},
814 {False, "False"},
815 {False, "0"},
816 {True, "Yes"},
817 {True, "True"},
818 {True, "1"},
819 {Auto, "Auto"},
820 {-1, NULL}
823 /* Client-side offline caching policy types */
824 #define CSC_POLICY_MANUAL 0
825 #define CSC_POLICY_DOCUMENTS 1
826 #define CSC_POLICY_PROGRAMS 2
827 #define CSC_POLICY_DISABLE 3
829 static const struct enum_list enum_csc_policy[] = {
830 {CSC_POLICY_MANUAL, "manual"},
831 {CSC_POLICY_DOCUMENTS, "documents"},
832 {CSC_POLICY_PROGRAMS, "programs"},
833 {CSC_POLICY_DISABLE, "disable"},
834 {-1, NULL}
837 /* SMB signing types. */
838 static const struct enum_list enum_smb_signing_vals[] = {
839 {False, "No"},
840 {False, "False"},
841 {False, "0"},
842 {False, "Off"},
843 {False, "disabled"},
844 {True, "Yes"},
845 {True, "True"},
846 {True, "1"},
847 {True, "On"},
848 {True, "enabled"},
849 {Auto, "auto"},
850 {Required, "required"},
851 {Required, "mandatory"},
852 {Required, "force"},
853 {Required, "forced"},
854 {Required, "enforced"},
855 {-1, NULL}
858 /* ACL compatibility options. */
859 static const struct enum_list enum_acl_compat_vals[] = {
860 { ACL_COMPAT_AUTO, "auto" },
861 { ACL_COMPAT_WINNT, "winnt" },
862 { ACL_COMPAT_WIN2K, "win2k" },
863 { -1, NULL}
867 Do you want session setups at user level security with a invalid
868 password to be rejected or allowed in as guest? WinNT rejects them
869 but it can be a pain as it means "net view" needs to use a password
871 You have 3 choices in the setting of map_to_guest:
873 "Never" means session setups with an invalid password
874 are rejected. This is the default.
876 "Bad User" means session setups with an invalid password
877 are rejected, unless the username does not exist, in which case it
878 is treated as a guest login
880 "Bad Password" means session setups with an invalid password
881 are treated as a guest login
883 Note that map_to_guest only has an effect in user or server
884 level security.
887 static const struct enum_list enum_map_to_guest[] = {
888 {NEVER_MAP_TO_GUEST, "Never"},
889 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
890 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
891 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
892 {-1, NULL}
895 /* Config backend options */
897 static const struct enum_list enum_config_backend[] = {
898 {CONFIG_BACKEND_FILE, "file"},
899 {CONFIG_BACKEND_REGISTRY, "registry"},
900 {-1, NULL}
903 /* ADS kerberos ticket verification options */
905 static const struct enum_list enum_kerberos_method[] = {
906 {KERBEROS_VERIFY_SECRETS, "default"},
907 {KERBEROS_VERIFY_SECRETS, "secrets only"},
908 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
909 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
910 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
911 {-1, NULL}
914 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
916 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
917 * screen in SWAT. This is used to exclude parameters as well as to squash all
918 * parameters that have been duplicated by pseudonyms.
920 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
921 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
922 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
923 * respective views.
925 * NOTE2: Handling of duplicated (synonym) parameters:
926 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
927 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
928 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
929 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
932 static struct parm_struct parm_table[] = {
933 {N_("Base Options"), P_SEP, P_SEPARATOR},
936 .label = "dos charset",
937 .type = P_STRING,
938 .p_class = P_GLOBAL,
939 .ptr = &Globals.dos_charset,
940 .special = handle_charset,
941 .enum_list = NULL,
942 .flags = FLAG_ADVANCED
945 .label = "unix charset",
946 .type = P_STRING,
947 .p_class = P_GLOBAL,
948 .ptr = &Globals.unix_charset,
949 .special = handle_charset,
950 .enum_list = NULL,
951 .flags = FLAG_ADVANCED
954 .label = "display charset",
955 .type = P_STRING,
956 .p_class = P_GLOBAL,
957 .ptr = &Globals.display_charset,
958 .special = handle_charset,
959 .enum_list = NULL,
960 .flags = FLAG_ADVANCED
963 .label = "comment",
964 .type = P_STRING,
965 .p_class = P_LOCAL,
966 .ptr = &sDefault.comment,
967 .special = NULL,
968 .enum_list = NULL,
969 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
972 .label = "path",
973 .type = P_STRING,
974 .p_class = P_LOCAL,
975 .ptr = &sDefault.szPath,
976 .special = NULL,
977 .enum_list = NULL,
978 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
981 .label = "directory",
982 .type = P_STRING,
983 .p_class = P_LOCAL,
984 .ptr = &sDefault.szPath,
985 .special = NULL,
986 .enum_list = NULL,
987 .flags = FLAG_HIDE,
990 .label = "workgroup",
991 .type = P_USTRING,
992 .p_class = P_GLOBAL,
993 .ptr = &Globals.szWorkgroup,
994 .special = handle_workgroup,
995 .enum_list = NULL,
996 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
998 #ifdef WITH_ADS
1000 .label = "realm",
1001 .type = P_USTRING,
1002 .p_class = P_GLOBAL,
1003 .ptr = &Globals.szRealm,
1004 .special = NULL,
1005 .enum_list = NULL,
1006 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1008 #endif
1010 .label = "netbios name",
1011 .type = P_USTRING,
1012 .p_class = P_GLOBAL,
1013 .ptr = &Globals.szNetbiosName,
1014 .special = handle_netbios_name,
1015 .enum_list = NULL,
1016 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1019 .label = "netbios aliases",
1020 .type = P_LIST,
1021 .p_class = P_GLOBAL,
1022 .ptr = &Globals.szNetbiosAliases,
1023 .special = handle_netbios_aliases,
1024 .enum_list = NULL,
1025 .flags = FLAG_ADVANCED,
1028 .label = "netbios scope",
1029 .type = P_USTRING,
1030 .p_class = P_GLOBAL,
1031 .ptr = &Globals.szNetbiosScope,
1032 .special = handle_netbios_scope,
1033 .enum_list = NULL,
1034 .flags = FLAG_ADVANCED,
1037 .label = "server string",
1038 .type = P_STRING,
1039 .p_class = P_GLOBAL,
1040 .ptr = &Globals.szServerString,
1041 .special = NULL,
1042 .enum_list = NULL,
1043 .flags = FLAG_BASIC | FLAG_ADVANCED,
1046 .label = "interfaces",
1047 .type = P_LIST,
1048 .p_class = P_GLOBAL,
1049 .ptr = &Globals.szInterfaces,
1050 .special = NULL,
1051 .enum_list = NULL,
1052 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1055 .label = "bind interfaces only",
1056 .type = P_BOOL,
1057 .p_class = P_GLOBAL,
1058 .ptr = &Globals.bBindInterfacesOnly,
1059 .special = NULL,
1060 .enum_list = NULL,
1061 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1064 .label = "config backend",
1065 .type = P_ENUM,
1066 .p_class = P_GLOBAL,
1067 .ptr = &Globals.ConfigBackend,
1068 .special = NULL,
1069 .enum_list = enum_config_backend,
1070 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1073 {N_("Security Options"), P_SEP, P_SEPARATOR},
1076 .label = "security",
1077 .type = P_ENUM,
1078 .p_class = P_GLOBAL,
1079 .ptr = &Globals.security,
1080 .special = NULL,
1081 .enum_list = enum_security,
1082 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1085 .label = "auth methods",
1086 .type = P_LIST,
1087 .p_class = P_GLOBAL,
1088 .ptr = &Globals.AuthMethods,
1089 .special = NULL,
1090 .enum_list = NULL,
1091 .flags = FLAG_ADVANCED,
1094 .label = "encrypt passwords",
1095 .type = P_BOOL,
1096 .p_class = P_GLOBAL,
1097 .ptr = &Globals.bEncryptPasswords,
1098 .special = NULL,
1099 .enum_list = NULL,
1100 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1103 .label = "update encrypted",
1104 .type = P_BOOL,
1105 .p_class = P_GLOBAL,
1106 .ptr = &Globals.bUpdateEncrypt,
1107 .special = NULL,
1108 .enum_list = NULL,
1109 .flags = FLAG_ADVANCED,
1112 .label = "client schannel",
1113 .type = P_ENUM,
1114 .p_class = P_GLOBAL,
1115 .ptr = &Globals.clientSchannel,
1116 .special = NULL,
1117 .enum_list = enum_bool_auto,
1118 .flags = FLAG_BASIC | FLAG_ADVANCED,
1121 .label = "server schannel",
1122 .type = P_ENUM,
1123 .p_class = P_GLOBAL,
1124 .ptr = &Globals.serverSchannel,
1125 .special = NULL,
1126 .enum_list = enum_bool_auto,
1127 .flags = FLAG_BASIC | FLAG_ADVANCED,
1130 .label = "allow trusted domains",
1131 .type = P_BOOL,
1132 .p_class = P_GLOBAL,
1133 .ptr = &Globals.bAllowTrustedDomains,
1134 .special = NULL,
1135 .enum_list = NULL,
1136 .flags = FLAG_ADVANCED,
1139 .label = "map to guest",
1140 .type = P_ENUM,
1141 .p_class = P_GLOBAL,
1142 .ptr = &Globals.map_to_guest,
1143 .special = NULL,
1144 .enum_list = enum_map_to_guest,
1145 .flags = FLAG_ADVANCED,
1148 .label = "null passwords",
1149 .type = P_BOOL,
1150 .p_class = P_GLOBAL,
1151 .ptr = &Globals.bNullPasswords,
1152 .special = NULL,
1153 .enum_list = NULL,
1154 .flags = FLAG_ADVANCED,
1157 .label = "obey pam restrictions",
1158 .type = P_BOOL,
1159 .p_class = P_GLOBAL,
1160 .ptr = &Globals.bObeyPamRestrictions,
1161 .special = NULL,
1162 .enum_list = NULL,
1163 .flags = FLAG_ADVANCED,
1166 .label = "password server",
1167 .type = P_STRING,
1168 .p_class = P_GLOBAL,
1169 .ptr = &Globals.szPasswordServer,
1170 .special = NULL,
1171 .enum_list = NULL,
1172 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1175 .label = "smb passwd file",
1176 .type = P_STRING,
1177 .p_class = P_GLOBAL,
1178 .ptr = &Globals.szSMBPasswdFile,
1179 .special = NULL,
1180 .enum_list = NULL,
1181 .flags = FLAG_ADVANCED,
1184 .label = "private dir",
1185 .type = P_STRING,
1186 .p_class = P_GLOBAL,
1187 .ptr = &Globals.szPrivateDir,
1188 .special = NULL,
1189 .enum_list = NULL,
1190 .flags = FLAG_ADVANCED,
1193 .label = "passdb backend",
1194 .type = P_STRING,
1195 .p_class = P_GLOBAL,
1196 .ptr = &Globals.szPassdbBackend,
1197 .special = NULL,
1198 .enum_list = NULL,
1199 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1202 .label = "algorithmic rid base",
1203 .type = P_INTEGER,
1204 .p_class = P_GLOBAL,
1205 .ptr = &Globals.AlgorithmicRidBase,
1206 .special = NULL,
1207 .enum_list = NULL,
1208 .flags = FLAG_ADVANCED,
1211 .label = "root directory",
1212 .type = P_STRING,
1213 .p_class = P_GLOBAL,
1214 .ptr = &Globals.szRootdir,
1215 .special = NULL,
1216 .enum_list = NULL,
1217 .flags = FLAG_ADVANCED,
1220 .label = "root dir",
1221 .type = P_STRING,
1222 .p_class = P_GLOBAL,
1223 .ptr = &Globals.szRootdir,
1224 .special = NULL,
1225 .enum_list = NULL,
1226 .flags = FLAG_HIDE,
1229 .label = "root",
1230 .type = P_STRING,
1231 .p_class = P_GLOBAL,
1232 .ptr = &Globals.szRootdir,
1233 .special = NULL,
1234 .enum_list = NULL,
1235 .flags = FLAG_HIDE,
1238 .label = "guest account",
1239 .type = P_STRING,
1240 .p_class = P_GLOBAL,
1241 .ptr = &Globals.szGuestaccount,
1242 .special = NULL,
1243 .enum_list = NULL,
1244 .flags = FLAG_BASIC | FLAG_ADVANCED,
1247 .label = "enable privileges",
1248 .type = P_BOOL,
1249 .p_class = P_GLOBAL,
1250 .ptr = &Globals.bEnablePrivileges,
1251 .special = NULL,
1252 .enum_list = NULL,
1253 .flags = FLAG_ADVANCED,
1257 .label = "pam password change",
1258 .type = P_BOOL,
1259 .p_class = P_GLOBAL,
1260 .ptr = &Globals.bPamPasswordChange,
1261 .special = NULL,
1262 .enum_list = NULL,
1263 .flags = FLAG_ADVANCED,
1266 .label = "passwd program",
1267 .type = P_STRING,
1268 .p_class = P_GLOBAL,
1269 .ptr = &Globals.szPasswdProgram,
1270 .special = NULL,
1271 .enum_list = NULL,
1272 .flags = FLAG_ADVANCED,
1275 .label = "passwd chat",
1276 .type = P_STRING,
1277 .p_class = P_GLOBAL,
1278 .ptr = &Globals.szPasswdChat,
1279 .special = NULL,
1280 .enum_list = NULL,
1281 .flags = FLAG_ADVANCED,
1284 .label = "passwd chat debug",
1285 .type = P_BOOL,
1286 .p_class = P_GLOBAL,
1287 .ptr = &Globals.bPasswdChatDebug,
1288 .special = NULL,
1289 .enum_list = NULL,
1290 .flags = FLAG_ADVANCED,
1293 .label = "passwd chat timeout",
1294 .type = P_INTEGER,
1295 .p_class = P_GLOBAL,
1296 .ptr = &Globals.iPasswdChatTimeout,
1297 .special = NULL,
1298 .enum_list = NULL,
1299 .flags = FLAG_ADVANCED,
1302 .label = "check password script",
1303 .type = P_STRING,
1304 .p_class = P_GLOBAL,
1305 .ptr = &Globals.szCheckPasswordScript,
1306 .special = NULL,
1307 .enum_list = NULL,
1308 .flags = FLAG_ADVANCED,
1311 .label = "username map",
1312 .type = P_STRING,
1313 .p_class = P_GLOBAL,
1314 .ptr = &Globals.szUsernameMap,
1315 .special = NULL,
1316 .enum_list = NULL,
1317 .flags = FLAG_ADVANCED,
1320 .label = "password level",
1321 .type = P_INTEGER,
1322 .p_class = P_GLOBAL,
1323 .ptr = &Globals.pwordlevel,
1324 .special = NULL,
1325 .enum_list = NULL,
1326 .flags = FLAG_ADVANCED,
1329 .label = "username level",
1330 .type = P_INTEGER,
1331 .p_class = P_GLOBAL,
1332 .ptr = &Globals.unamelevel,
1333 .special = NULL,
1334 .enum_list = NULL,
1335 .flags = FLAG_ADVANCED,
1338 .label = "unix password sync",
1339 .type = P_BOOL,
1340 .p_class = P_GLOBAL,
1341 .ptr = &Globals.bUnixPasswdSync,
1342 .special = NULL,
1343 .enum_list = NULL,
1344 .flags = FLAG_ADVANCED,
1347 .label = "restrict anonymous",
1348 .type = P_INTEGER,
1349 .p_class = P_GLOBAL,
1350 .ptr = &Globals.restrict_anonymous,
1351 .special = NULL,
1352 .enum_list = NULL,
1353 .flags = FLAG_ADVANCED,
1356 .label = "lanman auth",
1357 .type = P_BOOL,
1358 .p_class = P_GLOBAL,
1359 .ptr = &Globals.bLanmanAuth,
1360 .special = NULL,
1361 .enum_list = NULL,
1362 .flags = FLAG_ADVANCED,
1365 .label = "ntlm auth",
1366 .type = P_BOOL,
1367 .p_class = P_GLOBAL,
1368 .ptr = &Globals.bNTLMAuth,
1369 .special = NULL,
1370 .enum_list = NULL,
1371 .flags = FLAG_ADVANCED,
1374 .label = "client NTLMv2 auth",
1375 .type = P_BOOL,
1376 .p_class = P_GLOBAL,
1377 .ptr = &Globals.bClientNTLMv2Auth,
1378 .special = NULL,
1379 .enum_list = NULL,
1380 .flags = FLAG_ADVANCED,
1383 .label = "client lanman auth",
1384 .type = P_BOOL,
1385 .p_class = P_GLOBAL,
1386 .ptr = &Globals.bClientLanManAuth,
1387 .special = NULL,
1388 .enum_list = NULL,
1389 .flags = FLAG_ADVANCED,
1392 .label = "client plaintext auth",
1393 .type = P_BOOL,
1394 .p_class = P_GLOBAL,
1395 .ptr = &Globals.bClientPlaintextAuth,
1396 .special = NULL,
1397 .enum_list = NULL,
1398 .flags = FLAG_ADVANCED,
1401 .label = "username",
1402 .type = P_STRING,
1403 .p_class = P_LOCAL,
1404 .ptr = &sDefault.szUsername,
1405 .special = NULL,
1406 .enum_list = NULL,
1407 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1410 .label = "user",
1411 .type = P_STRING,
1412 .p_class = P_LOCAL,
1413 .ptr = &sDefault.szUsername,
1414 .special = NULL,
1415 .enum_list = NULL,
1416 .flags = FLAG_HIDE,
1419 .label = "users",
1420 .type = P_STRING,
1421 .p_class = P_LOCAL,
1422 .ptr = &sDefault.szUsername,
1423 .special = NULL,
1424 .enum_list = NULL,
1425 .flags = FLAG_HIDE,
1428 .label = "invalid users",
1429 .type = P_LIST,
1430 .p_class = P_LOCAL,
1431 .ptr = &sDefault.szInvalidUsers,
1432 .special = NULL,
1433 .enum_list = NULL,
1434 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1437 .label = "valid users",
1438 .type = P_LIST,
1439 .p_class = P_LOCAL,
1440 .ptr = &sDefault.szValidUsers,
1441 .special = NULL,
1442 .enum_list = NULL,
1443 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1446 .label = "admin users",
1447 .type = P_LIST,
1448 .p_class = P_LOCAL,
1449 .ptr = &sDefault.szAdminUsers,
1450 .special = NULL,
1451 .enum_list = NULL,
1452 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1455 .label = "read list",
1456 .type = P_LIST,
1457 .p_class = P_LOCAL,
1458 .ptr = &sDefault.readlist,
1459 .special = NULL,
1460 .enum_list = NULL,
1461 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1464 .label = "write list",
1465 .type = P_LIST,
1466 .p_class = P_LOCAL,
1467 .ptr = &sDefault.writelist,
1468 .special = NULL,
1469 .enum_list = NULL,
1470 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1473 .label = "printer admin",
1474 .type = P_LIST,
1475 .p_class = P_LOCAL,
1476 .ptr = &sDefault.printer_admin,
1477 .special = NULL,
1478 .enum_list = NULL,
1479 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1482 .label = "force user",
1483 .type = P_STRING,
1484 .p_class = P_LOCAL,
1485 .ptr = &sDefault.force_user,
1486 .special = NULL,
1487 .enum_list = NULL,
1488 .flags = FLAG_ADVANCED | FLAG_SHARE,
1491 .label = "force group",
1492 .type = P_STRING,
1493 .p_class = P_LOCAL,
1494 .ptr = &sDefault.force_group,
1495 .special = NULL,
1496 .enum_list = NULL,
1497 .flags = FLAG_ADVANCED | FLAG_SHARE,
1500 .label = "group",
1501 .type = P_STRING,
1502 .p_class = P_LOCAL,
1503 .ptr = &sDefault.force_group,
1504 .special = NULL,
1505 .enum_list = NULL,
1506 .flags = FLAG_ADVANCED,
1509 .label = "read only",
1510 .type = P_BOOL,
1511 .p_class = P_LOCAL,
1512 .ptr = &sDefault.bRead_only,
1513 .special = NULL,
1514 .enum_list = NULL,
1515 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1518 .label = "write ok",
1519 .type = P_BOOLREV,
1520 .p_class = P_LOCAL,
1521 .ptr = &sDefault.bRead_only,
1522 .special = NULL,
1523 .enum_list = NULL,
1524 .flags = FLAG_HIDE,
1527 .label = "writeable",
1528 .type = P_BOOLREV,
1529 .p_class = P_LOCAL,
1530 .ptr = &sDefault.bRead_only,
1531 .special = NULL,
1532 .enum_list = NULL,
1533 .flags = FLAG_HIDE,
1536 .label = "writable",
1537 .type = P_BOOLREV,
1538 .p_class = P_LOCAL,
1539 .ptr = &sDefault.bRead_only,
1540 .special = NULL,
1541 .enum_list = NULL,
1542 .flags = FLAG_HIDE,
1545 .label = "acl check permissions",
1546 .type = P_BOOL,
1547 .p_class = P_LOCAL,
1548 .ptr = &sDefault.bAclCheckPermissions,
1549 .special = NULL,
1550 .enum_list = NULL,
1551 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1554 .label = "acl group control",
1555 .type = P_BOOL,
1556 .p_class = P_LOCAL,
1557 .ptr = &sDefault.bAclGroupControl,
1558 .special = NULL,
1559 .enum_list = NULL,
1560 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1563 .label = "acl map full control",
1564 .type = P_BOOL,
1565 .p_class = P_LOCAL,
1566 .ptr = &sDefault.bAclMapFullControl,
1567 .special = NULL,
1568 .enum_list = NULL,
1569 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1572 .label = "create mask",
1573 .type = P_OCTAL,
1574 .p_class = P_LOCAL,
1575 .ptr = &sDefault.iCreate_mask,
1576 .special = NULL,
1577 .enum_list = NULL,
1578 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1581 .label = "create mode",
1582 .type = P_OCTAL,
1583 .p_class = P_LOCAL,
1584 .ptr = &sDefault.iCreate_mask,
1585 .special = NULL,
1586 .enum_list = NULL,
1587 .flags = FLAG_HIDE,
1590 .label = "force create mode",
1591 .type = P_OCTAL,
1592 .p_class = P_LOCAL,
1593 .ptr = &sDefault.iCreate_force_mode,
1594 .special = NULL,
1595 .enum_list = NULL,
1596 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1599 .label = "security mask",
1600 .type = P_OCTAL,
1601 .p_class = P_LOCAL,
1602 .ptr = &sDefault.iSecurity_mask,
1603 .special = NULL,
1604 .enum_list = NULL,
1605 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1608 .label = "force security mode",
1609 .type = P_OCTAL,
1610 .p_class = P_LOCAL,
1611 .ptr = &sDefault.iSecurity_force_mode,
1612 .special = NULL,
1613 .enum_list = NULL,
1614 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1617 .label = "directory mask",
1618 .type = P_OCTAL,
1619 .p_class = P_LOCAL,
1620 .ptr = &sDefault.iDir_mask,
1621 .special = NULL,
1622 .enum_list = NULL,
1623 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1626 .label = "directory mode",
1627 .type = P_OCTAL,
1628 .p_class = P_LOCAL,
1629 .ptr = &sDefault.iDir_mask,
1630 .special = NULL,
1631 .enum_list = NULL,
1632 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1635 .label = "force directory mode",
1636 .type = P_OCTAL,
1637 .p_class = P_LOCAL,
1638 .ptr = &sDefault.iDir_force_mode,
1639 .special = NULL,
1640 .enum_list = NULL,
1641 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1644 .label = "directory security mask",
1645 .type = P_OCTAL,
1646 .p_class = P_LOCAL,
1647 .ptr = &sDefault.iDir_Security_mask,
1648 .special = NULL,
1649 .enum_list = NULL,
1650 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1653 .label = "force directory security mode",
1654 .type = P_OCTAL,
1655 .p_class = P_LOCAL,
1656 .ptr = &sDefault.iDir_Security_force_mode,
1657 .special = NULL,
1658 .enum_list = NULL,
1659 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1662 .label = "force unknown acl user",
1663 .type = P_BOOL,
1664 .p_class = P_LOCAL,
1665 .ptr = &sDefault.bForceUnknownAclUser,
1666 .special = NULL,
1667 .enum_list = NULL,
1668 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1671 .label = "inherit permissions",
1672 .type = P_BOOL,
1673 .p_class = P_LOCAL,
1674 .ptr = &sDefault.bInheritPerms,
1675 .special = NULL,
1676 .enum_list = NULL,
1677 .flags = FLAG_ADVANCED | FLAG_SHARE,
1680 .label = "inherit acls",
1681 .type = P_BOOL,
1682 .p_class = P_LOCAL,
1683 .ptr = &sDefault.bInheritACLS,
1684 .special = NULL,
1685 .enum_list = NULL,
1686 .flags = FLAG_ADVANCED | FLAG_SHARE,
1689 .label = "inherit owner",
1690 .type = P_BOOL,
1691 .p_class = P_LOCAL,
1692 .ptr = &sDefault.bInheritOwner,
1693 .special = NULL,
1694 .enum_list = NULL,
1695 .flags = FLAG_ADVANCED | FLAG_SHARE,
1698 .label = "guest only",
1699 .type = P_BOOL,
1700 .p_class = P_LOCAL,
1701 .ptr = &sDefault.bGuest_only,
1702 .special = NULL,
1703 .enum_list = NULL,
1704 .flags = FLAG_ADVANCED | FLAG_SHARE,
1707 .label = "only guest",
1708 .type = P_BOOL,
1709 .p_class = P_LOCAL,
1710 .ptr = &sDefault.bGuest_only,
1711 .special = NULL,
1712 .enum_list = NULL,
1713 .flags = FLAG_HIDE,
1716 .label = "administrative share",
1717 .type = P_BOOL,
1718 .p_class = P_LOCAL,
1719 .ptr = &sDefault.bAdministrative_share,
1720 .special = NULL,
1721 .enum_list = NULL,
1722 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1726 .label = "guest ok",
1727 .type = P_BOOL,
1728 .p_class = P_LOCAL,
1729 .ptr = &sDefault.bGuest_ok,
1730 .special = NULL,
1731 .enum_list = NULL,
1732 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1735 .label = "public",
1736 .type = P_BOOL,
1737 .p_class = P_LOCAL,
1738 .ptr = &sDefault.bGuest_ok,
1739 .special = NULL,
1740 .enum_list = NULL,
1741 .flags = FLAG_HIDE,
1744 .label = "only user",
1745 .type = P_BOOL,
1746 .p_class = P_LOCAL,
1747 .ptr = &sDefault.bOnlyUser,
1748 .special = NULL,
1749 .enum_list = NULL,
1750 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1753 .label = "hosts allow",
1754 .type = P_LIST,
1755 .p_class = P_LOCAL,
1756 .ptr = &sDefault.szHostsallow,
1757 .special = NULL,
1758 .enum_list = NULL,
1759 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1762 .label = "allow hosts",
1763 .type = P_LIST,
1764 .p_class = P_LOCAL,
1765 .ptr = &sDefault.szHostsallow,
1766 .special = NULL,
1767 .enum_list = NULL,
1768 .flags = FLAG_HIDE,
1771 .label = "hosts deny",
1772 .type = P_LIST,
1773 .p_class = P_LOCAL,
1774 .ptr = &sDefault.szHostsdeny,
1775 .special = NULL,
1776 .enum_list = NULL,
1777 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1780 .label = "deny hosts",
1781 .type = P_LIST,
1782 .p_class = P_LOCAL,
1783 .ptr = &sDefault.szHostsdeny,
1784 .special = NULL,
1785 .enum_list = NULL,
1786 .flags = FLAG_HIDE,
1789 .label = "preload modules",
1790 .type = P_LIST,
1791 .p_class = P_GLOBAL,
1792 .ptr = &Globals.szPreloadModules,
1793 .special = NULL,
1794 .enum_list = NULL,
1795 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1798 .label = "dedicated keytab file",
1799 .type = P_STRING,
1800 .p_class = P_GLOBAL,
1801 .ptr = &Globals.szDedicatedKeytabFile,
1802 .special = NULL,
1803 .enum_list = NULL,
1804 .flags = FLAG_ADVANCED,
1807 .label = "kerberos method",
1808 .type = P_ENUM,
1809 .p_class = P_GLOBAL,
1810 .ptr = &Globals.iKerberosMethod,
1811 .special = NULL,
1812 .enum_list = enum_kerberos_method,
1813 .flags = FLAG_ADVANCED,
1816 .label = "map untrusted to domain",
1817 .type = P_BOOL,
1818 .p_class = P_GLOBAL,
1819 .ptr = &Globals.bMapUntrustedToDomain,
1820 .special = NULL,
1821 .enum_list = NULL,
1822 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1826 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1829 .label = "log level",
1830 .type = P_STRING,
1831 .p_class = P_GLOBAL,
1832 .ptr = &Globals.szLogLevel,
1833 .special = handle_debug_list,
1834 .enum_list = NULL,
1835 .flags = FLAG_ADVANCED,
1838 .label = "debuglevel",
1839 .type = P_STRING,
1840 .p_class = P_GLOBAL,
1841 .ptr = &Globals.szLogLevel,
1842 .special = handle_debug_list,
1843 .enum_list = NULL,
1844 .flags = FLAG_HIDE,
1847 .label = "syslog",
1848 .type = P_INTEGER,
1849 .p_class = P_GLOBAL,
1850 .ptr = &Globals.syslog,
1851 .special = NULL,
1852 .enum_list = NULL,
1853 .flags = FLAG_ADVANCED,
1856 .label = "syslog only",
1857 .type = P_BOOL,
1858 .p_class = P_GLOBAL,
1859 .ptr = &Globals.bSyslogOnly,
1860 .special = NULL,
1861 .enum_list = NULL,
1862 .flags = FLAG_ADVANCED,
1865 .label = "log file",
1866 .type = P_STRING,
1867 .p_class = P_GLOBAL,
1868 .ptr = &Globals.szLogFile,
1869 .special = NULL,
1870 .enum_list = NULL,
1871 .flags = FLAG_ADVANCED,
1874 .label = "max log size",
1875 .type = P_INTEGER,
1876 .p_class = P_GLOBAL,
1877 .ptr = &Globals.max_log_size,
1878 .special = NULL,
1879 .enum_list = NULL,
1880 .flags = FLAG_ADVANCED,
1883 .label = "debug timestamp",
1884 .type = P_BOOL,
1885 .p_class = P_GLOBAL,
1886 .ptr = &Globals.bTimestampLogs,
1887 .special = NULL,
1888 .enum_list = NULL,
1889 .flags = FLAG_ADVANCED,
1892 .label = "timestamp logs",
1893 .type = P_BOOL,
1894 .p_class = P_GLOBAL,
1895 .ptr = &Globals.bTimestampLogs,
1896 .special = NULL,
1897 .enum_list = NULL,
1898 .flags = FLAG_ADVANCED,
1901 .label = "debug prefix timestamp",
1902 .type = P_BOOL,
1903 .p_class = P_GLOBAL,
1904 .ptr = &Globals.bDebugPrefixTimestamp,
1905 .special = NULL,
1906 .enum_list = NULL,
1907 .flags = FLAG_ADVANCED,
1910 .label = "debug hires timestamp",
1911 .type = P_BOOL,
1912 .p_class = P_GLOBAL,
1913 .ptr = &Globals.bDebugHiresTimestamp,
1914 .special = NULL,
1915 .enum_list = NULL,
1916 .flags = FLAG_ADVANCED,
1919 .label = "debug pid",
1920 .type = P_BOOL,
1921 .p_class = P_GLOBAL,
1922 .ptr = &Globals.bDebugPid,
1923 .special = NULL,
1924 .enum_list = NULL,
1925 .flags = FLAG_ADVANCED,
1928 .label = "debug uid",
1929 .type = P_BOOL,
1930 .p_class = P_GLOBAL,
1931 .ptr = &Globals.bDebugUid,
1932 .special = NULL,
1933 .enum_list = NULL,
1934 .flags = FLAG_ADVANCED,
1937 .label = "debug class",
1938 .type = P_BOOL,
1939 .p_class = P_GLOBAL,
1940 .ptr = &Globals.bDebugClass,
1941 .special = NULL,
1942 .enum_list = NULL,
1943 .flags = FLAG_ADVANCED,
1946 .label = "enable core files",
1947 .type = P_BOOL,
1948 .p_class = P_GLOBAL,
1949 .ptr = &Globals.bEnableCoreFiles,
1950 .special = NULL,
1951 .enum_list = NULL,
1952 .flags = FLAG_ADVANCED,
1955 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1958 .label = "allocation roundup size",
1959 .type = P_INTEGER,
1960 .p_class = P_LOCAL,
1961 .ptr = &sDefault.iallocation_roundup_size,
1962 .special = NULL,
1963 .enum_list = NULL,
1964 .flags = FLAG_ADVANCED,
1967 .label = "aio read size",
1968 .type = P_INTEGER,
1969 .p_class = P_LOCAL,
1970 .ptr = &sDefault.iAioReadSize,
1971 .special = NULL,
1972 .enum_list = NULL,
1973 .flags = FLAG_ADVANCED,
1976 .label = "aio write size",
1977 .type = P_INTEGER,
1978 .p_class = P_LOCAL,
1979 .ptr = &sDefault.iAioWriteSize,
1980 .special = NULL,
1981 .enum_list = NULL,
1982 .flags = FLAG_ADVANCED,
1985 .label = "aio write behind",
1986 .type = P_STRING,
1987 .p_class = P_LOCAL,
1988 .ptr = &sDefault.szAioWriteBehind,
1989 .special = NULL,
1990 .enum_list = NULL,
1991 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1994 .label = "smb ports",
1995 .type = P_STRING,
1996 .p_class = P_GLOBAL,
1997 .ptr = &Globals.smb_ports,
1998 .special = NULL,
1999 .enum_list = NULL,
2000 .flags = FLAG_ADVANCED,
2003 .label = "large readwrite",
2004 .type = P_BOOL,
2005 .p_class = P_GLOBAL,
2006 .ptr = &Globals.bLargeReadwrite,
2007 .special = NULL,
2008 .enum_list = NULL,
2009 .flags = FLAG_ADVANCED,
2012 .label = "max protocol",
2013 .type = P_ENUM,
2014 .p_class = P_GLOBAL,
2015 .ptr = &Globals.maxprotocol,
2016 .special = NULL,
2017 .enum_list = enum_protocol,
2018 .flags = FLAG_ADVANCED,
2021 .label = "protocol",
2022 .type = P_ENUM,
2023 .p_class = P_GLOBAL,
2024 .ptr = &Globals.maxprotocol,
2025 .special = NULL,
2026 .enum_list = enum_protocol,
2027 .flags = FLAG_ADVANCED,
2030 .label = "min protocol",
2031 .type = P_ENUM,
2032 .p_class = P_GLOBAL,
2033 .ptr = &Globals.minprotocol,
2034 .special = NULL,
2035 .enum_list = enum_protocol,
2036 .flags = FLAG_ADVANCED,
2039 .label = "min receivefile size",
2040 .type = P_INTEGER,
2041 .p_class = P_GLOBAL,
2042 .ptr = &Globals.iminreceivefile,
2043 .special = NULL,
2044 .enum_list = NULL,
2045 .flags = FLAG_ADVANCED,
2048 .label = "read raw",
2049 .type = P_BOOL,
2050 .p_class = P_GLOBAL,
2051 .ptr = &Globals.bReadRaw,
2052 .special = NULL,
2053 .enum_list = NULL,
2054 .flags = FLAG_ADVANCED,
2057 .label = "write raw",
2058 .type = P_BOOL,
2059 .p_class = P_GLOBAL,
2060 .ptr = &Globals.bWriteRaw,
2061 .special = NULL,
2062 .enum_list = NULL,
2063 .flags = FLAG_ADVANCED,
2066 .label = "disable netbios",
2067 .type = P_BOOL,
2068 .p_class = P_GLOBAL,
2069 .ptr = &Globals.bDisableNetbios,
2070 .special = NULL,
2071 .enum_list = NULL,
2072 .flags = FLAG_ADVANCED,
2075 .label = "reset on zero vc",
2076 .type = P_BOOL,
2077 .p_class = P_GLOBAL,
2078 .ptr = &Globals.bResetOnZeroVC,
2079 .special = NULL,
2080 .enum_list = NULL,
2081 .flags = FLAG_ADVANCED,
2084 .label = "log writeable files on exit",
2085 .type = P_BOOL,
2086 .p_class = P_GLOBAL,
2087 .ptr = &Globals.bLogWriteableFilesOnExit,
2088 .special = NULL,
2089 .enum_list = NULL,
2090 .flags = FLAG_ADVANCED,
2093 .label = "acl compatibility",
2094 .type = P_ENUM,
2095 .p_class = P_GLOBAL,
2096 .ptr = &Globals.iAclCompat,
2097 .special = NULL,
2098 .enum_list = enum_acl_compat_vals,
2099 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2102 .label = "defer sharing violations",
2103 .type = P_BOOL,
2104 .p_class = P_GLOBAL,
2105 .ptr = &Globals.bDeferSharingViolations,
2106 .special = NULL,
2107 .enum_list = NULL,
2108 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2111 .label = "ea support",
2112 .type = P_BOOL,
2113 .p_class = P_LOCAL,
2114 .ptr = &sDefault.bEASupport,
2115 .special = NULL,
2116 .enum_list = NULL,
2117 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2120 .label = "nt acl support",
2121 .type = P_BOOL,
2122 .p_class = P_LOCAL,
2123 .ptr = &sDefault.bNTAclSupport,
2124 .special = NULL,
2125 .enum_list = NULL,
2126 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2129 .label = "nt pipe support",
2130 .type = P_BOOL,
2131 .p_class = P_GLOBAL,
2132 .ptr = &Globals.bNTPipeSupport,
2133 .special = NULL,
2134 .enum_list = NULL,
2135 .flags = FLAG_ADVANCED,
2138 .label = "nt status support",
2139 .type = P_BOOL,
2140 .p_class = P_GLOBAL,
2141 .ptr = &Globals.bNTStatusSupport,
2142 .special = NULL,
2143 .enum_list = NULL,
2144 .flags = FLAG_ADVANCED,
2147 .label = "profile acls",
2148 .type = P_BOOL,
2149 .p_class = P_LOCAL,
2150 .ptr = &sDefault.bProfileAcls,
2151 .special = NULL,
2152 .enum_list = NULL,
2153 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2156 .label = "announce version",
2157 .type = P_STRING,
2158 .p_class = P_GLOBAL,
2159 .ptr = &Globals.szAnnounceVersion,
2160 .special = NULL,
2161 .enum_list = NULL,
2162 .flags = FLAG_ADVANCED,
2165 .label = "announce as",
2166 .type = P_ENUM,
2167 .p_class = P_GLOBAL,
2168 .ptr = &Globals.announce_as,
2169 .special = NULL,
2170 .enum_list = enum_announce_as,
2171 .flags = FLAG_ADVANCED,
2174 .label = "map acl inherit",
2175 .type = P_BOOL,
2176 .p_class = P_LOCAL,
2177 .ptr = &sDefault.bMap_acl_inherit,
2178 .special = NULL,
2179 .enum_list = NULL,
2180 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2183 .label = "afs share",
2184 .type = P_BOOL,
2185 .p_class = P_LOCAL,
2186 .ptr = &sDefault.bAfs_Share,
2187 .special = NULL,
2188 .enum_list = NULL,
2189 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2192 .label = "max mux",
2193 .type = P_INTEGER,
2194 .p_class = P_GLOBAL,
2195 .ptr = &Globals.max_mux,
2196 .special = NULL,
2197 .enum_list = NULL,
2198 .flags = FLAG_ADVANCED,
2201 .label = "max xmit",
2202 .type = P_INTEGER,
2203 .p_class = P_GLOBAL,
2204 .ptr = &Globals.max_xmit,
2205 .special = NULL,
2206 .enum_list = NULL,
2207 .flags = FLAG_ADVANCED,
2210 .label = "name resolve order",
2211 .type = P_STRING,
2212 .p_class = P_GLOBAL,
2213 .ptr = &Globals.szNameResolveOrder,
2214 .special = NULL,
2215 .enum_list = NULL,
2216 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2219 .label = "max ttl",
2220 .type = P_INTEGER,
2221 .p_class = P_GLOBAL,
2222 .ptr = &Globals.max_ttl,
2223 .special = NULL,
2224 .enum_list = NULL,
2225 .flags = FLAG_ADVANCED,
2228 .label = "max wins ttl",
2229 .type = P_INTEGER,
2230 .p_class = P_GLOBAL,
2231 .ptr = &Globals.max_wins_ttl,
2232 .special = NULL,
2233 .enum_list = NULL,
2234 .flags = FLAG_ADVANCED,
2237 .label = "min wins ttl",
2238 .type = P_INTEGER,
2239 .p_class = P_GLOBAL,
2240 .ptr = &Globals.min_wins_ttl,
2241 .special = NULL,
2242 .enum_list = NULL,
2243 .flags = FLAG_ADVANCED,
2246 .label = "time server",
2247 .type = P_BOOL,
2248 .p_class = P_GLOBAL,
2249 .ptr = &Globals.bTimeServer,
2250 .special = NULL,
2251 .enum_list = NULL,
2252 .flags = FLAG_ADVANCED,
2255 .label = "unix extensions",
2256 .type = P_BOOL,
2257 .p_class = P_GLOBAL,
2258 .ptr = &Globals.bUnixExtensions,
2259 .special = NULL,
2260 .enum_list = NULL,
2261 .flags = FLAG_ADVANCED,
2264 .label = "use spnego",
2265 .type = P_BOOL,
2266 .p_class = P_GLOBAL,
2267 .ptr = &Globals.bUseSpnego,
2268 .special = NULL,
2269 .enum_list = NULL,
2270 .flags = FLAG_ADVANCED,
2273 .label = "client signing",
2274 .type = P_ENUM,
2275 .p_class = P_GLOBAL,
2276 .ptr = &Globals.client_signing,
2277 .special = NULL,
2278 .enum_list = enum_smb_signing_vals,
2279 .flags = FLAG_ADVANCED,
2282 .label = "server signing",
2283 .type = P_ENUM,
2284 .p_class = P_GLOBAL,
2285 .ptr = &Globals.server_signing,
2286 .special = NULL,
2287 .enum_list = enum_smb_signing_vals,
2288 .flags = FLAG_ADVANCED,
2291 .label = "smb encrypt",
2292 .type = P_ENUM,
2293 .p_class = P_LOCAL,
2294 .ptr = &sDefault.ismb_encrypt,
2295 .special = NULL,
2296 .enum_list = enum_smb_signing_vals,
2297 .flags = FLAG_ADVANCED,
2300 .label = "client use spnego",
2301 .type = P_BOOL,
2302 .p_class = P_GLOBAL,
2303 .ptr = &Globals.bClientUseSpnego,
2304 .special = NULL,
2305 .enum_list = NULL,
2306 .flags = FLAG_ADVANCED,
2309 .label = "client ldap sasl wrapping",
2310 .type = P_ENUM,
2311 .p_class = P_GLOBAL,
2312 .ptr = &Globals.client_ldap_sasl_wrapping,
2313 .special = NULL,
2314 .enum_list = enum_ldap_sasl_wrapping,
2315 .flags = FLAG_ADVANCED,
2318 .label = "enable asu support",
2319 .type = P_BOOL,
2320 .p_class = P_GLOBAL,
2321 .ptr = &Globals.bASUSupport,
2322 .special = NULL,
2323 .enum_list = NULL,
2324 .flags = FLAG_ADVANCED,
2327 .label = "svcctl list",
2328 .type = P_LIST,
2329 .p_class = P_GLOBAL,
2330 .ptr = &Globals.szServicesList,
2331 .special = NULL,
2332 .enum_list = NULL,
2333 .flags = FLAG_ADVANCED,
2336 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2339 .label = "block size",
2340 .type = P_INTEGER,
2341 .p_class = P_LOCAL,
2342 .ptr = &sDefault.iBlock_size,
2343 .special = NULL,
2344 .enum_list = NULL,
2345 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2348 .label = "deadtime",
2349 .type = P_INTEGER,
2350 .p_class = P_GLOBAL,
2351 .ptr = &Globals.deadtime,
2352 .special = NULL,
2353 .enum_list = NULL,
2354 .flags = FLAG_ADVANCED,
2357 .label = "getwd cache",
2358 .type = P_BOOL,
2359 .p_class = P_GLOBAL,
2360 .ptr = &Globals.getwd_cache,
2361 .special = NULL,
2362 .enum_list = NULL,
2363 .flags = FLAG_ADVANCED,
2366 .label = "keepalive",
2367 .type = P_INTEGER,
2368 .p_class = P_GLOBAL,
2369 .ptr = &Globals.iKeepalive,
2370 .special = NULL,
2371 .enum_list = NULL,
2372 .flags = FLAG_ADVANCED,
2375 .label = "change notify",
2376 .type = P_BOOL,
2377 .p_class = P_LOCAL,
2378 .ptr = &sDefault.bChangeNotify,
2379 .special = NULL,
2380 .enum_list = NULL,
2381 .flags = FLAG_ADVANCED | FLAG_SHARE,
2384 .label = "directory name cache size",
2385 .type = P_INTEGER,
2386 .p_class = P_LOCAL,
2387 .ptr = &sDefault.iDirectoryNameCacheSize,
2388 .special = NULL,
2389 .enum_list = NULL,
2390 .flags = FLAG_ADVANCED | FLAG_SHARE,
2393 .label = "kernel change notify",
2394 .type = P_BOOL,
2395 .p_class = P_LOCAL,
2396 .ptr = &sDefault.bKernelChangeNotify,
2397 .special = NULL,
2398 .enum_list = NULL,
2399 .flags = FLAG_ADVANCED | FLAG_SHARE,
2402 .label = "lpq cache time",
2403 .type = P_INTEGER,
2404 .p_class = P_GLOBAL,
2405 .ptr = &Globals.lpqcachetime,
2406 .special = NULL,
2407 .enum_list = NULL,
2408 .flags = FLAG_ADVANCED,
2411 .label = "max smbd processes",
2412 .type = P_INTEGER,
2413 .p_class = P_GLOBAL,
2414 .ptr = &Globals.iMaxSmbdProcesses,
2415 .special = NULL,
2416 .enum_list = NULL,
2417 .flags = FLAG_ADVANCED,
2420 .label = "max connections",
2421 .type = P_INTEGER,
2422 .p_class = P_LOCAL,
2423 .ptr = &sDefault.iMaxConnections,
2424 .special = NULL,
2425 .enum_list = NULL,
2426 .flags = FLAG_ADVANCED | FLAG_SHARE,
2429 .label = "paranoid server security",
2430 .type = P_BOOL,
2431 .p_class = P_GLOBAL,
2432 .ptr = &Globals.paranoid_server_security,
2433 .special = NULL,
2434 .enum_list = NULL,
2435 .flags = FLAG_ADVANCED,
2438 .label = "max disk size",
2439 .type = P_INTEGER,
2440 .p_class = P_GLOBAL,
2441 .ptr = &Globals.maxdisksize,
2442 .special = NULL,
2443 .enum_list = NULL,
2444 .flags = FLAG_ADVANCED,
2447 .label = "max open files",
2448 .type = P_INTEGER,
2449 .p_class = P_GLOBAL,
2450 .ptr = &Globals.max_open_files,
2451 .special = NULL,
2452 .enum_list = NULL,
2453 .flags = FLAG_ADVANCED,
2456 .label = "min print space",
2457 .type = P_INTEGER,
2458 .p_class = P_LOCAL,
2459 .ptr = &sDefault.iMinPrintSpace,
2460 .special = NULL,
2461 .enum_list = NULL,
2462 .flags = FLAG_ADVANCED | FLAG_PRINT,
2465 .label = "socket options",
2466 .type = P_STRING,
2467 .p_class = P_GLOBAL,
2468 .ptr = &Globals.szSocketOptions,
2469 .special = NULL,
2470 .enum_list = NULL,
2471 .flags = FLAG_ADVANCED,
2474 .label = "strict allocate",
2475 .type = P_BOOL,
2476 .p_class = P_LOCAL,
2477 .ptr = &sDefault.bStrictAllocate,
2478 .special = NULL,
2479 .enum_list = NULL,
2480 .flags = FLAG_ADVANCED | FLAG_SHARE,
2483 .label = "strict sync",
2484 .type = P_BOOL,
2485 .p_class = P_LOCAL,
2486 .ptr = &sDefault.bStrictSync,
2487 .special = NULL,
2488 .enum_list = NULL,
2489 .flags = FLAG_ADVANCED | FLAG_SHARE,
2492 .label = "sync always",
2493 .type = P_BOOL,
2494 .p_class = P_LOCAL,
2495 .ptr = &sDefault.bSyncAlways,
2496 .special = NULL,
2497 .enum_list = NULL,
2498 .flags = FLAG_ADVANCED | FLAG_SHARE,
2501 .label = "use mmap",
2502 .type = P_BOOL,
2503 .p_class = P_GLOBAL,
2504 .ptr = &Globals.bUseMmap,
2505 .special = NULL,
2506 .enum_list = NULL,
2507 .flags = FLAG_ADVANCED,
2510 .label = "use sendfile",
2511 .type = P_BOOL,
2512 .p_class = P_LOCAL,
2513 .ptr = &sDefault.bUseSendfile,
2514 .special = NULL,
2515 .enum_list = NULL,
2516 .flags = FLAG_ADVANCED | FLAG_SHARE,
2519 .label = "hostname lookups",
2520 .type = P_BOOL,
2521 .p_class = P_GLOBAL,
2522 .ptr = &Globals.bHostnameLookups,
2523 .special = NULL,
2524 .enum_list = NULL,
2525 .flags = FLAG_ADVANCED,
2528 .label = "write cache size",
2529 .type = P_INTEGER,
2530 .p_class = P_LOCAL,
2531 .ptr = &sDefault.iWriteCacheSize,
2532 .special = NULL,
2533 .enum_list = NULL,
2534 .flags = FLAG_ADVANCED | FLAG_SHARE,
2537 .label = "name cache timeout",
2538 .type = P_INTEGER,
2539 .p_class = P_GLOBAL,
2540 .ptr = &Globals.name_cache_timeout,
2541 .special = NULL,
2542 .enum_list = NULL,
2543 .flags = FLAG_ADVANCED,
2546 .label = "ctdbd socket",
2547 .type = P_STRING,
2548 .p_class = P_GLOBAL,
2549 .ptr = &Globals.ctdbdSocket,
2550 .special = NULL,
2551 .enum_list = NULL,
2552 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2555 .label = "cluster addresses",
2556 .type = P_LIST,
2557 .p_class = P_GLOBAL,
2558 .ptr = &Globals.szClusterAddresses,
2559 .special = NULL,
2560 .enum_list = NULL,
2561 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2564 .label = "clustering",
2565 .type = P_BOOL,
2566 .p_class = P_GLOBAL,
2567 .ptr = &Globals.clustering,
2568 .special = NULL,
2569 .enum_list = NULL,
2570 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2573 .label = "ctdb timeout",
2574 .type = P_INTEGER,
2575 .p_class = P_GLOBAL,
2576 .ptr = &Globals.ctdb_timeout,
2577 .special = NULL,
2578 .enum_list = NULL,
2579 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2582 .label = "ctdb locktime warn threshold",
2583 .type = P_INTEGER,
2584 .p_class = P_GLOBAL,
2585 .ptr = &Globals.ctdb_locktime_warn_threshold,
2586 .special = NULL,
2587 .enum_list = NULL,
2588 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2591 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2594 .label = "max reported print jobs",
2595 .type = P_INTEGER,
2596 .p_class = P_LOCAL,
2597 .ptr = &sDefault.iMaxReportedPrintJobs,
2598 .special = NULL,
2599 .enum_list = NULL,
2600 .flags = FLAG_ADVANCED | FLAG_PRINT,
2603 .label = "max print jobs",
2604 .type = P_INTEGER,
2605 .p_class = P_LOCAL,
2606 .ptr = &sDefault.iMaxPrintJobs,
2607 .special = NULL,
2608 .enum_list = NULL,
2609 .flags = FLAG_ADVANCED | FLAG_PRINT,
2612 .label = "load printers",
2613 .type = P_BOOL,
2614 .p_class = P_GLOBAL,
2615 .ptr = &Globals.bLoadPrinters,
2616 .special = NULL,
2617 .enum_list = NULL,
2618 .flags = FLAG_ADVANCED | FLAG_PRINT,
2621 .label = "printcap cache time",
2622 .type = P_INTEGER,
2623 .p_class = P_GLOBAL,
2624 .ptr = &Globals.PrintcapCacheTime,
2625 .special = NULL,
2626 .enum_list = NULL,
2627 .flags = FLAG_ADVANCED | FLAG_PRINT,
2630 .label = "printcap name",
2631 .type = P_STRING,
2632 .p_class = P_GLOBAL,
2633 .ptr = &Globals.szPrintcapname,
2634 .special = NULL,
2635 .enum_list = NULL,
2636 .flags = FLAG_ADVANCED | FLAG_PRINT,
2639 .label = "printcap",
2640 .type = P_STRING,
2641 .p_class = P_GLOBAL,
2642 .ptr = &Globals.szPrintcapname,
2643 .special = NULL,
2644 .enum_list = NULL,
2645 .flags = FLAG_HIDE,
2648 .label = "printable",
2649 .type = P_BOOL,
2650 .p_class = P_LOCAL,
2651 .ptr = &sDefault.bPrint_ok,
2652 .special = NULL,
2653 .enum_list = NULL,
2654 .flags = FLAG_ADVANCED | FLAG_PRINT,
2657 .label = "print ok",
2658 .type = P_BOOL,
2659 .p_class = P_LOCAL,
2660 .ptr = &sDefault.bPrint_ok,
2661 .special = NULL,
2662 .enum_list = NULL,
2663 .flags = FLAG_HIDE,
2666 .label = "printing",
2667 .type = P_ENUM,
2668 .p_class = P_LOCAL,
2669 .ptr = &sDefault.iPrinting,
2670 .special = handle_printing,
2671 .enum_list = enum_printing,
2672 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2675 .label = "cups options",
2676 .type = P_STRING,
2677 .p_class = P_LOCAL,
2678 .ptr = &sDefault.szCupsOptions,
2679 .special = NULL,
2680 .enum_list = NULL,
2681 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2684 .label = "cups server",
2685 .type = P_STRING,
2686 .p_class = P_GLOBAL,
2687 .ptr = &Globals.szCupsServer,
2688 .special = NULL,
2689 .enum_list = NULL,
2690 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2693 .label = "cups encrypt",
2694 .type = P_ENUM,
2695 .p_class = P_GLOBAL,
2696 .ptr = &Globals.CupsEncrypt,
2697 .special = NULL,
2698 .enum_list = enum_bool_auto,
2699 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2703 .label = "cups connection timeout",
2704 .type = P_INTEGER,
2705 .p_class = P_GLOBAL,
2706 .ptr = &Globals.cups_connection_timeout,
2707 .special = NULL,
2708 .enum_list = NULL,
2709 .flags = FLAG_ADVANCED,
2712 .label = "iprint server",
2713 .type = P_STRING,
2714 .p_class = P_GLOBAL,
2715 .ptr = &Globals.szIPrintServer,
2716 .special = NULL,
2717 .enum_list = NULL,
2718 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2721 .label = "print command",
2722 .type = P_STRING,
2723 .p_class = P_LOCAL,
2724 .ptr = &sDefault.szPrintcommand,
2725 .special = NULL,
2726 .enum_list = NULL,
2727 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2730 .label = "disable spoolss",
2731 .type = P_BOOL,
2732 .p_class = P_GLOBAL,
2733 .ptr = &Globals.bDisableSpoolss,
2734 .special = NULL,
2735 .enum_list = NULL,
2736 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2739 .label = "enable spoolss",
2740 .type = P_BOOLREV,
2741 .p_class = P_GLOBAL,
2742 .ptr = &Globals.bDisableSpoolss,
2743 .special = NULL,
2744 .enum_list = NULL,
2745 .flags = FLAG_HIDE,
2748 .label = "lpq command",
2749 .type = P_STRING,
2750 .p_class = P_LOCAL,
2751 .ptr = &sDefault.szLpqcommand,
2752 .special = NULL,
2753 .enum_list = NULL,
2754 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2757 .label = "lprm command",
2758 .type = P_STRING,
2759 .p_class = P_LOCAL,
2760 .ptr = &sDefault.szLprmcommand,
2761 .special = NULL,
2762 .enum_list = NULL,
2763 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2766 .label = "lppause command",
2767 .type = P_STRING,
2768 .p_class = P_LOCAL,
2769 .ptr = &sDefault.szLppausecommand,
2770 .special = NULL,
2771 .enum_list = NULL,
2772 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2775 .label = "lpresume command",
2776 .type = P_STRING,
2777 .p_class = P_LOCAL,
2778 .ptr = &sDefault.szLpresumecommand,
2779 .special = NULL,
2780 .enum_list = NULL,
2781 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2784 .label = "queuepause command",
2785 .type = P_STRING,
2786 .p_class = P_LOCAL,
2787 .ptr = &sDefault.szQueuepausecommand,
2788 .special = NULL,
2789 .enum_list = NULL,
2790 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2793 .label = "queueresume command",
2794 .type = P_STRING,
2795 .p_class = P_LOCAL,
2796 .ptr = &sDefault.szQueueresumecommand,
2797 .special = NULL,
2798 .enum_list = NULL,
2799 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2802 .label = "addport command",
2803 .type = P_STRING,
2804 .p_class = P_GLOBAL,
2805 .ptr = &Globals.szAddPortCommand,
2806 .special = NULL,
2807 .enum_list = NULL,
2808 .flags = FLAG_ADVANCED,
2811 .label = "enumports command",
2812 .type = P_STRING,
2813 .p_class = P_GLOBAL,
2814 .ptr = &Globals.szEnumPortsCommand,
2815 .special = NULL,
2816 .enum_list = NULL,
2817 .flags = FLAG_ADVANCED,
2820 .label = "addprinter command",
2821 .type = P_STRING,
2822 .p_class = P_GLOBAL,
2823 .ptr = &Globals.szAddPrinterCommand,
2824 .special = NULL,
2825 .enum_list = NULL,
2826 .flags = FLAG_ADVANCED,
2829 .label = "deleteprinter command",
2830 .type = P_STRING,
2831 .p_class = P_GLOBAL,
2832 .ptr = &Globals.szDeletePrinterCommand,
2833 .special = NULL,
2834 .enum_list = NULL,
2835 .flags = FLAG_ADVANCED,
2838 .label = "show add printer wizard",
2839 .type = P_BOOL,
2840 .p_class = P_GLOBAL,
2841 .ptr = &Globals.bMsAddPrinterWizard,
2842 .special = NULL,
2843 .enum_list = NULL,
2844 .flags = FLAG_ADVANCED,
2847 .label = "os2 driver map",
2848 .type = P_STRING,
2849 .p_class = P_GLOBAL,
2850 .ptr = &Globals.szOs2DriverMap,
2851 .special = NULL,
2852 .enum_list = NULL,
2853 .flags = FLAG_ADVANCED,
2857 .label = "printer name",
2858 .type = P_STRING,
2859 .p_class = P_LOCAL,
2860 .ptr = &sDefault.szPrintername,
2861 .special = NULL,
2862 .enum_list = NULL,
2863 .flags = FLAG_ADVANCED | FLAG_PRINT,
2866 .label = "printer",
2867 .type = P_STRING,
2868 .p_class = P_LOCAL,
2869 .ptr = &sDefault.szPrintername,
2870 .special = NULL,
2871 .enum_list = NULL,
2872 .flags = FLAG_HIDE,
2875 .label = "use client driver",
2876 .type = P_BOOL,
2877 .p_class = P_LOCAL,
2878 .ptr = &sDefault.bUseClientDriver,
2879 .special = NULL,
2880 .enum_list = NULL,
2881 .flags = FLAG_ADVANCED | FLAG_PRINT,
2884 .label = "default devmode",
2885 .type = P_BOOL,
2886 .p_class = P_LOCAL,
2887 .ptr = &sDefault.bDefaultDevmode,
2888 .special = NULL,
2889 .enum_list = NULL,
2890 .flags = FLAG_ADVANCED | FLAG_PRINT,
2893 .label = "force printername",
2894 .type = P_BOOL,
2895 .p_class = P_LOCAL,
2896 .ptr = &sDefault.bForcePrintername,
2897 .special = NULL,
2898 .enum_list = NULL,
2899 .flags = FLAG_ADVANCED | FLAG_PRINT,
2902 .label = "printjob username",
2903 .type = P_STRING,
2904 .p_class = P_LOCAL,
2905 .ptr = &sDefault.szPrintjobUsername,
2906 .special = NULL,
2907 .enum_list = NULL,
2908 .flags = FLAG_ADVANCED | FLAG_PRINT,
2911 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2914 .label = "mangling method",
2915 .type = P_STRING,
2916 .p_class = P_GLOBAL,
2917 .ptr = &Globals.szManglingMethod,
2918 .special = NULL,
2919 .enum_list = NULL,
2920 .flags = FLAG_ADVANCED,
2923 .label = "mangle prefix",
2924 .type = P_INTEGER,
2925 .p_class = P_GLOBAL,
2926 .ptr = &Globals.mangle_prefix,
2927 .special = NULL,
2928 .enum_list = NULL,
2929 .flags = FLAG_ADVANCED,
2933 .label = "default case",
2934 .type = P_ENUM,
2935 .p_class = P_LOCAL,
2936 .ptr = &sDefault.iDefaultCase,
2937 .special = NULL,
2938 .enum_list = enum_case,
2939 .flags = FLAG_ADVANCED | FLAG_SHARE,
2942 .label = "case sensitive",
2943 .type = P_ENUM,
2944 .p_class = P_LOCAL,
2945 .ptr = &sDefault.iCaseSensitive,
2946 .special = NULL,
2947 .enum_list = enum_bool_auto,
2948 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2951 .label = "casesignames",
2952 .type = P_ENUM,
2953 .p_class = P_LOCAL,
2954 .ptr = &sDefault.iCaseSensitive,
2955 .special = NULL,
2956 .enum_list = enum_bool_auto,
2957 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2960 .label = "preserve case",
2961 .type = P_BOOL,
2962 .p_class = P_LOCAL,
2963 .ptr = &sDefault.bCasePreserve,
2964 .special = NULL,
2965 .enum_list = NULL,
2966 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2969 .label = "short preserve case",
2970 .type = P_BOOL,
2971 .p_class = P_LOCAL,
2972 .ptr = &sDefault.bShortCasePreserve,
2973 .special = NULL,
2974 .enum_list = NULL,
2975 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2978 .label = "mangling char",
2979 .type = P_CHAR,
2980 .p_class = P_LOCAL,
2981 .ptr = &sDefault.magic_char,
2982 .special = NULL,
2983 .enum_list = NULL,
2984 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2987 .label = "hide dot files",
2988 .type = P_BOOL,
2989 .p_class = P_LOCAL,
2990 .ptr = &sDefault.bHideDotFiles,
2991 .special = NULL,
2992 .enum_list = NULL,
2993 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2996 .label = "hide special files",
2997 .type = P_BOOL,
2998 .p_class = P_LOCAL,
2999 .ptr = &sDefault.bHideSpecialFiles,
3000 .special = NULL,
3001 .enum_list = NULL,
3002 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3005 .label = "hide unreadable",
3006 .type = P_BOOL,
3007 .p_class = P_LOCAL,
3008 .ptr = &sDefault.bHideUnReadable,
3009 .special = NULL,
3010 .enum_list = NULL,
3011 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3014 .label = "hide unwriteable files",
3015 .type = P_BOOL,
3016 .p_class = P_LOCAL,
3017 .ptr = &sDefault.bHideUnWriteableFiles,
3018 .special = NULL,
3019 .enum_list = NULL,
3020 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3023 .label = "delete veto files",
3024 .type = P_BOOL,
3025 .p_class = P_LOCAL,
3026 .ptr = &sDefault.bDeleteVetoFiles,
3027 .special = NULL,
3028 .enum_list = NULL,
3029 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3032 .label = "veto files",
3033 .type = P_STRING,
3034 .p_class = P_LOCAL,
3035 .ptr = &sDefault.szVetoFiles,
3036 .special = NULL,
3037 .enum_list = NULL,
3038 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3041 .label = "hide files",
3042 .type = P_STRING,
3043 .p_class = P_LOCAL,
3044 .ptr = &sDefault.szHideFiles,
3045 .special = NULL,
3046 .enum_list = NULL,
3047 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3050 .label = "veto oplock files",
3051 .type = P_STRING,
3052 .p_class = P_LOCAL,
3053 .ptr = &sDefault.szVetoOplockFiles,
3054 .special = NULL,
3055 .enum_list = NULL,
3056 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3059 .label = "map archive",
3060 .type = P_BOOL,
3061 .p_class = P_LOCAL,
3062 .ptr = &sDefault.bMap_archive,
3063 .special = NULL,
3064 .enum_list = NULL,
3065 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3068 .label = "map hidden",
3069 .type = P_BOOL,
3070 .p_class = P_LOCAL,
3071 .ptr = &sDefault.bMap_hidden,
3072 .special = NULL,
3073 .enum_list = NULL,
3074 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3077 .label = "map system",
3078 .type = P_BOOL,
3079 .p_class = P_LOCAL,
3080 .ptr = &sDefault.bMap_system,
3081 .special = NULL,
3082 .enum_list = NULL,
3083 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3086 .label = "map readonly",
3087 .type = P_ENUM,
3088 .p_class = P_LOCAL,
3089 .ptr = &sDefault.iMap_readonly,
3090 .special = NULL,
3091 .enum_list = enum_map_readonly,
3092 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3095 .label = "mangled names",
3096 .type = P_BOOL,
3097 .p_class = P_LOCAL,
3098 .ptr = &sDefault.bMangledNames,
3099 .special = NULL,
3100 .enum_list = NULL,
3101 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3104 .label = "max stat cache size",
3105 .type = P_INTEGER,
3106 .p_class = P_GLOBAL,
3107 .ptr = &Globals.iMaxStatCacheSize,
3108 .special = NULL,
3109 .enum_list = NULL,
3110 .flags = FLAG_ADVANCED,
3113 .label = "stat cache",
3114 .type = P_BOOL,
3115 .p_class = P_GLOBAL,
3116 .ptr = &Globals.bStatCache,
3117 .special = NULL,
3118 .enum_list = NULL,
3119 .flags = FLAG_ADVANCED,
3122 .label = "store dos attributes",
3123 .type = P_BOOL,
3124 .p_class = P_LOCAL,
3125 .ptr = &sDefault.bStoreDosAttributes,
3126 .special = NULL,
3127 .enum_list = NULL,
3128 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3131 .label = "dmapi support",
3132 .type = P_BOOL,
3133 .p_class = P_LOCAL,
3134 .ptr = &sDefault.bDmapiSupport,
3135 .special = NULL,
3136 .enum_list = NULL,
3137 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3141 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3144 .label = "machine password timeout",
3145 .type = P_INTEGER,
3146 .p_class = P_GLOBAL,
3147 .ptr = &Globals.machine_password_timeout,
3148 .special = NULL,
3149 .enum_list = NULL,
3150 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3153 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3156 .label = "add user script",
3157 .type = P_STRING,
3158 .p_class = P_GLOBAL,
3159 .ptr = &Globals.szAddUserScript,
3160 .special = NULL,
3161 .enum_list = NULL,
3162 .flags = FLAG_ADVANCED,
3165 .label = "rename user script",
3166 .type = P_STRING,
3167 .p_class = P_GLOBAL,
3168 .ptr = &Globals.szRenameUserScript,
3169 .special = NULL,
3170 .enum_list = NULL,
3171 .flags = FLAG_ADVANCED,
3174 .label = "delete user script",
3175 .type = P_STRING,
3176 .p_class = P_GLOBAL,
3177 .ptr = &Globals.szDelUserScript,
3178 .special = NULL,
3179 .enum_list = NULL,
3180 .flags = FLAG_ADVANCED,
3183 .label = "add group script",
3184 .type = P_STRING,
3185 .p_class = P_GLOBAL,
3186 .ptr = &Globals.szAddGroupScript,
3187 .special = NULL,
3188 .enum_list = NULL,
3189 .flags = FLAG_ADVANCED,
3192 .label = "delete group script",
3193 .type = P_STRING,
3194 .p_class = P_GLOBAL,
3195 .ptr = &Globals.szDelGroupScript,
3196 .special = NULL,
3197 .enum_list = NULL,
3198 .flags = FLAG_ADVANCED,
3201 .label = "add user to group script",
3202 .type = P_STRING,
3203 .p_class = P_GLOBAL,
3204 .ptr = &Globals.szAddUserToGroupScript,
3205 .special = NULL,
3206 .enum_list = NULL,
3207 .flags = FLAG_ADVANCED,
3210 .label = "delete user from group script",
3211 .type = P_STRING,
3212 .p_class = P_GLOBAL,
3213 .ptr = &Globals.szDelUserFromGroupScript,
3214 .special = NULL,
3215 .enum_list = NULL,
3216 .flags = FLAG_ADVANCED,
3219 .label = "set primary group script",
3220 .type = P_STRING,
3221 .p_class = P_GLOBAL,
3222 .ptr = &Globals.szSetPrimaryGroupScript,
3223 .special = NULL,
3224 .enum_list = NULL,
3225 .flags = FLAG_ADVANCED,
3228 .label = "add machine script",
3229 .type = P_STRING,
3230 .p_class = P_GLOBAL,
3231 .ptr = &Globals.szAddMachineScript,
3232 .special = NULL,
3233 .enum_list = NULL,
3234 .flags = FLAG_ADVANCED,
3237 .label = "shutdown script",
3238 .type = P_STRING,
3239 .p_class = P_GLOBAL,
3240 .ptr = &Globals.szShutdownScript,
3241 .special = NULL,
3242 .enum_list = NULL,
3243 .flags = FLAG_ADVANCED,
3246 .label = "abort shutdown script",
3247 .type = P_STRING,
3248 .p_class = P_GLOBAL,
3249 .ptr = &Globals.szAbortShutdownScript,
3250 .special = NULL,
3251 .enum_list = NULL,
3252 .flags = FLAG_ADVANCED,
3255 .label = "username map script",
3256 .type = P_STRING,
3257 .p_class = P_GLOBAL,
3258 .ptr = &Globals.szUsernameMapScript,
3259 .special = NULL,
3260 .enum_list = NULL,
3261 .flags = FLAG_ADVANCED,
3264 .label = "logon script",
3265 .type = P_STRING,
3266 .p_class = P_GLOBAL,
3267 .ptr = &Globals.szLogonScript,
3268 .special = NULL,
3269 .enum_list = NULL,
3270 .flags = FLAG_ADVANCED,
3273 .label = "logon path",
3274 .type = P_STRING,
3275 .p_class = P_GLOBAL,
3276 .ptr = &Globals.szLogonPath,
3277 .special = NULL,
3278 .enum_list = NULL,
3279 .flags = FLAG_ADVANCED,
3282 .label = "logon drive",
3283 .type = P_STRING,
3284 .p_class = P_GLOBAL,
3285 .ptr = &Globals.szLogonDrive,
3286 .special = NULL,
3287 .enum_list = NULL,
3288 .flags = FLAG_ADVANCED,
3291 .label = "logon home",
3292 .type = P_STRING,
3293 .p_class = P_GLOBAL,
3294 .ptr = &Globals.szLogonHome,
3295 .special = NULL,
3296 .enum_list = NULL,
3297 .flags = FLAG_ADVANCED,
3300 .label = "domain logons",
3301 .type = P_BOOL,
3302 .p_class = P_GLOBAL,
3303 .ptr = &Globals.bDomainLogons,
3304 .special = NULL,
3305 .enum_list = NULL,
3306 .flags = FLAG_ADVANCED,
3310 .label = "init logon delayed hosts",
3311 .type = P_LIST,
3312 .p_class = P_GLOBAL,
3313 .ptr = &Globals.szInitLogonDelayedHosts,
3314 .special = NULL,
3315 .enum_list = NULL,
3316 .flags = FLAG_ADVANCED,
3320 .label = "init logon delay",
3321 .type = P_INTEGER,
3322 .p_class = P_GLOBAL,
3323 .ptr = &Globals.InitLogonDelay,
3324 .special = NULL,
3325 .enum_list = NULL,
3326 .flags = FLAG_ADVANCED,
3330 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3333 .label = "os level",
3334 .type = P_INTEGER,
3335 .p_class = P_GLOBAL,
3336 .ptr = &Globals.os_level,
3337 .special = NULL,
3338 .enum_list = NULL,
3339 .flags = FLAG_BASIC | FLAG_ADVANCED,
3342 .label = "lm announce",
3343 .type = P_ENUM,
3344 .p_class = P_GLOBAL,
3345 .ptr = &Globals.lm_announce,
3346 .special = NULL,
3347 .enum_list = enum_bool_auto,
3348 .flags = FLAG_ADVANCED,
3351 .label = "lm interval",
3352 .type = P_INTEGER,
3353 .p_class = P_GLOBAL,
3354 .ptr = &Globals.lm_interval,
3355 .special = NULL,
3356 .enum_list = NULL,
3357 .flags = FLAG_ADVANCED,
3360 .label = "preferred master",
3361 .type = P_ENUM,
3362 .p_class = P_GLOBAL,
3363 .ptr = &Globals.iPreferredMaster,
3364 .special = NULL,
3365 .enum_list = enum_bool_auto,
3366 .flags = FLAG_BASIC | FLAG_ADVANCED,
3369 .label = "prefered master",
3370 .type = P_ENUM,
3371 .p_class = P_GLOBAL,
3372 .ptr = &Globals.iPreferredMaster,
3373 .special = NULL,
3374 .enum_list = enum_bool_auto,
3375 .flags = FLAG_HIDE,
3378 .label = "local master",
3379 .type = P_BOOL,
3380 .p_class = P_GLOBAL,
3381 .ptr = &Globals.bLocalMaster,
3382 .special = NULL,
3383 .enum_list = NULL,
3384 .flags = FLAG_BASIC | FLAG_ADVANCED,
3387 .label = "domain master",
3388 .type = P_ENUM,
3389 .p_class = P_GLOBAL,
3390 .ptr = &Globals.iDomainMaster,
3391 .special = NULL,
3392 .enum_list = enum_bool_auto,
3393 .flags = FLAG_BASIC | FLAG_ADVANCED,
3396 .label = "browse list",
3397 .type = P_BOOL,
3398 .p_class = P_GLOBAL,
3399 .ptr = &Globals.bBrowseList,
3400 .special = NULL,
3401 .enum_list = NULL,
3402 .flags = FLAG_ADVANCED,
3405 .label = "browseable",
3406 .type = P_BOOL,
3407 .p_class = P_LOCAL,
3408 .ptr = &sDefault.bBrowseable,
3409 .special = NULL,
3410 .enum_list = NULL,
3411 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3414 .label = "browsable",
3415 .type = P_BOOL,
3416 .p_class = P_LOCAL,
3417 .ptr = &sDefault.bBrowseable,
3418 .special = NULL,
3419 .enum_list = NULL,
3420 .flags = FLAG_HIDE,
3423 .label = "access based share enum",
3424 .type = P_BOOL,
3425 .p_class = P_LOCAL,
3426 .ptr = &sDefault.bAccessBasedShareEnum,
3427 .special = NULL,
3428 .enum_list = NULL,
3429 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3432 .label = "enhanced browsing",
3433 .type = P_BOOL,
3434 .p_class = P_GLOBAL,
3435 .ptr = &Globals.enhanced_browsing,
3436 .special = NULL,
3437 .enum_list = NULL,
3438 .flags = FLAG_ADVANCED,
3441 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3444 .label = "dns proxy",
3445 .type = P_BOOL,
3446 .p_class = P_GLOBAL,
3447 .ptr = &Globals.bDNSproxy,
3448 .special = NULL,
3449 .enum_list = NULL,
3450 .flags = FLAG_ADVANCED,
3453 .label = "wins proxy",
3454 .type = P_BOOL,
3455 .p_class = P_GLOBAL,
3456 .ptr = &Globals.bWINSproxy,
3457 .special = NULL,
3458 .enum_list = NULL,
3459 .flags = FLAG_ADVANCED,
3462 .label = "wins server",
3463 .type = P_LIST,
3464 .p_class = P_GLOBAL,
3465 .ptr = &Globals.szWINSservers,
3466 .special = NULL,
3467 .enum_list = NULL,
3468 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3471 .label = "wins support",
3472 .type = P_BOOL,
3473 .p_class = P_GLOBAL,
3474 .ptr = &Globals.bWINSsupport,
3475 .special = NULL,
3476 .enum_list = NULL,
3477 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3480 .label = "wins hook",
3481 .type = P_STRING,
3482 .p_class = P_GLOBAL,
3483 .ptr = &Globals.szWINSHook,
3484 .special = NULL,
3485 .enum_list = NULL,
3486 .flags = FLAG_ADVANCED,
3489 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3492 .label = "blocking locks",
3493 .type = P_BOOL,
3494 .p_class = P_LOCAL,
3495 .ptr = &sDefault.bBlockingLocks,
3496 .special = NULL,
3497 .enum_list = NULL,
3498 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3501 .label = "csc policy",
3502 .type = P_ENUM,
3503 .p_class = P_LOCAL,
3504 .ptr = &sDefault.iCSCPolicy,
3505 .special = NULL,
3506 .enum_list = enum_csc_policy,
3507 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3510 .label = "fake oplocks",
3511 .type = P_BOOL,
3512 .p_class = P_LOCAL,
3513 .ptr = &sDefault.bFakeOplocks,
3514 .special = NULL,
3515 .enum_list = NULL,
3516 .flags = FLAG_ADVANCED | FLAG_SHARE,
3519 .label = "kernel oplocks",
3520 .type = P_BOOL,
3521 .p_class = P_GLOBAL,
3522 .ptr = &Globals.bKernelOplocks,
3523 .special = NULL,
3524 .enum_list = NULL,
3525 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3528 .label = "locking",
3529 .type = P_BOOL,
3530 .p_class = P_LOCAL,
3531 .ptr = &sDefault.bLocking,
3532 .special = NULL,
3533 .enum_list = NULL,
3534 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3537 .label = "lock spin time",
3538 .type = P_INTEGER,
3539 .p_class = P_GLOBAL,
3540 .ptr = &Globals.iLockSpinTime,
3541 .special = NULL,
3542 .enum_list = NULL,
3543 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3546 .label = "oplocks",
3547 .type = P_BOOL,
3548 .p_class = P_LOCAL,
3549 .ptr = &sDefault.bOpLocks,
3550 .special = NULL,
3551 .enum_list = NULL,
3552 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3555 .label = "level2 oplocks",
3556 .type = P_BOOL,
3557 .p_class = P_LOCAL,
3558 .ptr = &sDefault.bLevel2OpLocks,
3559 .special = NULL,
3560 .enum_list = NULL,
3561 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3564 .label = "oplock break wait time",
3565 .type = P_INTEGER,
3566 .p_class = P_GLOBAL,
3567 .ptr = &Globals.oplock_break_wait_time,
3568 .special = NULL,
3569 .enum_list = NULL,
3570 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3573 .label = "oplock contention limit",
3574 .type = P_INTEGER,
3575 .p_class = P_LOCAL,
3576 .ptr = &sDefault.iOplockContentionLimit,
3577 .special = NULL,
3578 .enum_list = NULL,
3579 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3582 .label = "posix locking",
3583 .type = P_BOOL,
3584 .p_class = P_LOCAL,
3585 .ptr = &sDefault.bPosixLocking,
3586 .special = NULL,
3587 .enum_list = NULL,
3588 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3591 .label = "strict locking",
3592 .type = P_ENUM,
3593 .p_class = P_LOCAL,
3594 .ptr = &sDefault.iStrictLocking,
3595 .special = NULL,
3596 .enum_list = enum_bool_auto,
3597 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3600 .label = "share modes",
3601 .type = P_BOOL,
3602 .p_class = P_LOCAL,
3603 .ptr = &sDefault.bShareModes,
3604 .special = NULL,
3605 .enum_list = NULL,
3606 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3609 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3612 .label = "ldap admin dn",
3613 .type = P_STRING,
3614 .p_class = P_GLOBAL,
3615 .ptr = &Globals.szLdapAdminDn,
3616 .special = NULL,
3617 .enum_list = NULL,
3618 .flags = FLAG_ADVANCED,
3621 .label = "ldap delete dn",
3622 .type = P_BOOL,
3623 .p_class = P_GLOBAL,
3624 .ptr = &Globals.ldap_delete_dn,
3625 .special = NULL,
3626 .enum_list = NULL,
3627 .flags = FLAG_ADVANCED,
3630 .label = "ldap group suffix",
3631 .type = P_STRING,
3632 .p_class = P_GLOBAL,
3633 .ptr = &Globals.szLdapGroupSuffix,
3634 .special = NULL,
3635 .enum_list = NULL,
3636 .flags = FLAG_ADVANCED,
3639 .label = "ldap idmap suffix",
3640 .type = P_STRING,
3641 .p_class = P_GLOBAL,
3642 .ptr = &Globals.szLdapIdmapSuffix,
3643 .special = NULL,
3644 .enum_list = NULL,
3645 .flags = FLAG_ADVANCED,
3648 .label = "ldap machine suffix",
3649 .type = P_STRING,
3650 .p_class = P_GLOBAL,
3651 .ptr = &Globals.szLdapMachineSuffix,
3652 .special = NULL,
3653 .enum_list = NULL,
3654 .flags = FLAG_ADVANCED,
3657 .label = "ldap passwd sync",
3658 .type = P_ENUM,
3659 .p_class = P_GLOBAL,
3660 .ptr = &Globals.ldap_passwd_sync,
3661 .special = NULL,
3662 .enum_list = enum_ldap_passwd_sync,
3663 .flags = FLAG_ADVANCED,
3666 .label = "ldap password sync",
3667 .type = P_ENUM,
3668 .p_class = P_GLOBAL,
3669 .ptr = &Globals.ldap_passwd_sync,
3670 .special = NULL,
3671 .enum_list = enum_ldap_passwd_sync,
3672 .flags = FLAG_HIDE,
3675 .label = "ldap replication sleep",
3676 .type = P_INTEGER,
3677 .p_class = P_GLOBAL,
3678 .ptr = &Globals.ldap_replication_sleep,
3679 .special = NULL,
3680 .enum_list = NULL,
3681 .flags = FLAG_ADVANCED,
3684 .label = "ldap suffix",
3685 .type = P_STRING,
3686 .p_class = P_GLOBAL,
3687 .ptr = &Globals.szLdapSuffix,
3688 .special = NULL,
3689 .enum_list = NULL,
3690 .flags = FLAG_ADVANCED,
3693 .label = "ldap ssl",
3694 .type = P_ENUM,
3695 .p_class = P_GLOBAL,
3696 .ptr = &Globals.ldap_ssl,
3697 .special = NULL,
3698 .enum_list = enum_ldap_ssl,
3699 .flags = FLAG_ADVANCED,
3702 .label = "ldap ssl ads",
3703 .type = P_BOOL,
3704 .p_class = P_GLOBAL,
3705 .ptr = &Globals.ldap_ssl_ads,
3706 .special = NULL,
3707 .enum_list = NULL,
3708 .flags = FLAG_ADVANCED,
3711 .label = "ldap deref",
3712 .type = P_ENUM,
3713 .p_class = P_GLOBAL,
3714 .ptr = &Globals.ldap_deref,
3715 .special = NULL,
3716 .enum_list = enum_ldap_deref,
3717 .flags = FLAG_ADVANCED,
3720 .label = "ldap follow referral",
3721 .type = P_ENUM,
3722 .p_class = P_GLOBAL,
3723 .ptr = &Globals.ldap_follow_referral,
3724 .special = NULL,
3725 .enum_list = enum_bool_auto,
3726 .flags = FLAG_ADVANCED,
3729 .label = "ldap timeout",
3730 .type = P_INTEGER,
3731 .p_class = P_GLOBAL,
3732 .ptr = &Globals.ldap_timeout,
3733 .special = NULL,
3734 .enum_list = NULL,
3735 .flags = FLAG_ADVANCED,
3738 .label = "ldap connection timeout",
3739 .type = P_INTEGER,
3740 .p_class = P_GLOBAL,
3741 .ptr = &Globals.ldap_connection_timeout,
3742 .special = NULL,
3743 .enum_list = NULL,
3744 .flags = FLAG_ADVANCED,
3747 .label = "ldap page size",
3748 .type = P_INTEGER,
3749 .p_class = P_GLOBAL,
3750 .ptr = &Globals.ldap_page_size,
3751 .special = NULL,
3752 .enum_list = NULL,
3753 .flags = FLAG_ADVANCED,
3756 .label = "ldap user suffix",
3757 .type = P_STRING,
3758 .p_class = P_GLOBAL,
3759 .ptr = &Globals.szLdapUserSuffix,
3760 .special = NULL,
3761 .enum_list = NULL,
3762 .flags = FLAG_ADVANCED,
3765 .label = "ldap debug level",
3766 .type = P_INTEGER,
3767 .p_class = P_GLOBAL,
3768 .ptr = &Globals.ldap_debug_level,
3769 .special = handle_ldap_debug_level,
3770 .enum_list = NULL,
3771 .flags = FLAG_ADVANCED,
3774 .label = "ldap debug threshold",
3775 .type = P_INTEGER,
3776 .p_class = P_GLOBAL,
3777 .ptr = &Globals.ldap_debug_threshold,
3778 .special = NULL,
3779 .enum_list = NULL,
3780 .flags = FLAG_ADVANCED,
3783 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3786 .label = "eventlog list",
3787 .type = P_LIST,
3788 .p_class = P_GLOBAL,
3789 .ptr = &Globals.szEventLogs,
3790 .special = NULL,
3791 .enum_list = NULL,
3792 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3795 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3798 .label = "add share command",
3799 .type = P_STRING,
3800 .p_class = P_GLOBAL,
3801 .ptr = &Globals.szAddShareCommand,
3802 .special = NULL,
3803 .enum_list = NULL,
3804 .flags = FLAG_ADVANCED,
3807 .label = "change share command",
3808 .type = P_STRING,
3809 .p_class = P_GLOBAL,
3810 .ptr = &Globals.szChangeShareCommand,
3811 .special = NULL,
3812 .enum_list = NULL,
3813 .flags = FLAG_ADVANCED,
3816 .label = "delete share command",
3817 .type = P_STRING,
3818 .p_class = P_GLOBAL,
3819 .ptr = &Globals.szDeleteShareCommand,
3820 .special = NULL,
3821 .enum_list = NULL,
3822 .flags = FLAG_ADVANCED,
3825 .label = "config file",
3826 .type = P_STRING,
3827 .p_class = P_GLOBAL,
3828 .ptr = &Globals.szConfigFile,
3829 .special = NULL,
3830 .enum_list = NULL,
3831 .flags = FLAG_HIDE|FLAG_META,
3834 .label = "preload",
3835 .type = P_STRING,
3836 .p_class = P_GLOBAL,
3837 .ptr = &Globals.szAutoServices,
3838 .special = NULL,
3839 .enum_list = NULL,
3840 .flags = FLAG_ADVANCED,
3843 .label = "auto services",
3844 .type = P_STRING,
3845 .p_class = P_GLOBAL,
3846 .ptr = &Globals.szAutoServices,
3847 .special = NULL,
3848 .enum_list = NULL,
3849 .flags = FLAG_ADVANCED,
3852 .label = "lock directory",
3853 .type = P_STRING,
3854 .p_class = P_GLOBAL,
3855 .ptr = &Globals.szLockDir,
3856 .special = NULL,
3857 .enum_list = NULL,
3858 .flags = FLAG_ADVANCED,
3861 .label = "lock dir",
3862 .type = P_STRING,
3863 .p_class = P_GLOBAL,
3864 .ptr = &Globals.szLockDir,
3865 .special = NULL,
3866 .enum_list = NULL,
3867 .flags = FLAG_HIDE,
3870 .label = "state directory",
3871 .type = P_STRING,
3872 .p_class = P_GLOBAL,
3873 .ptr = &Globals.szStateDir,
3874 .special = NULL,
3875 .enum_list = NULL,
3876 .flags = FLAG_ADVANCED,
3879 .label = "cache directory",
3880 .type = P_STRING,
3881 .p_class = P_GLOBAL,
3882 .ptr = &Globals.szCacheDir,
3883 .special = NULL,
3884 .enum_list = NULL,
3885 .flags = FLAG_ADVANCED,
3888 .label = "pid directory",
3889 .type = P_STRING,
3890 .p_class = P_GLOBAL,
3891 .ptr = &Globals.szPidDir,
3892 .special = NULL,
3893 .enum_list = NULL,
3894 .flags = FLAG_ADVANCED,
3896 #ifdef WITH_UTMP
3898 .label = "utmp directory",
3899 .type = P_STRING,
3900 .p_class = P_GLOBAL,
3901 .ptr = &Globals.szUtmpDir,
3902 .special = NULL,
3903 .enum_list = NULL,
3904 .flags = FLAG_ADVANCED,
3907 .label = "wtmp directory",
3908 .type = P_STRING,
3909 .p_class = P_GLOBAL,
3910 .ptr = &Globals.szWtmpDir,
3911 .special = NULL,
3912 .enum_list = NULL,
3913 .flags = FLAG_ADVANCED,
3916 .label = "utmp",
3917 .type = P_BOOL,
3918 .p_class = P_GLOBAL,
3919 .ptr = &Globals.bUtmp,
3920 .special = NULL,
3921 .enum_list = NULL,
3922 .flags = FLAG_ADVANCED,
3924 #endif
3926 .label = "default service",
3927 .type = P_STRING,
3928 .p_class = P_GLOBAL,
3929 .ptr = &Globals.szDefaultService,
3930 .special = NULL,
3931 .enum_list = NULL,
3932 .flags = FLAG_ADVANCED,
3935 .label = "default",
3936 .type = P_STRING,
3937 .p_class = P_GLOBAL,
3938 .ptr = &Globals.szDefaultService,
3939 .special = NULL,
3940 .enum_list = NULL,
3941 .flags = FLAG_ADVANCED,
3944 .label = "message command",
3945 .type = P_STRING,
3946 .p_class = P_GLOBAL,
3947 .ptr = &Globals.szMsgCommand,
3948 .special = NULL,
3949 .enum_list = NULL,
3950 .flags = FLAG_ADVANCED,
3953 .label = "dfree cache time",
3954 .type = P_INTEGER,
3955 .p_class = P_LOCAL,
3956 .ptr = &sDefault.iDfreeCacheTime,
3957 .special = NULL,
3958 .enum_list = NULL,
3959 .flags = FLAG_ADVANCED,
3962 .label = "dfree command",
3963 .type = P_STRING,
3964 .p_class = P_LOCAL,
3965 .ptr = &sDefault.szDfree,
3966 .special = NULL,
3967 .enum_list = NULL,
3968 .flags = FLAG_ADVANCED,
3971 .label = "get quota command",
3972 .type = P_STRING,
3973 .p_class = P_GLOBAL,
3974 .ptr = &Globals.szGetQuota,
3975 .special = NULL,
3976 .enum_list = NULL,
3977 .flags = FLAG_ADVANCED,
3980 .label = "set quota command",
3981 .type = P_STRING,
3982 .p_class = P_GLOBAL,
3983 .ptr = &Globals.szSetQuota,
3984 .special = NULL,
3985 .enum_list = NULL,
3986 .flags = FLAG_ADVANCED,
3989 .label = "remote announce",
3990 .type = P_STRING,
3991 .p_class = P_GLOBAL,
3992 .ptr = &Globals.szRemoteAnnounce,
3993 .special = NULL,
3994 .enum_list = NULL,
3995 .flags = FLAG_ADVANCED,
3998 .label = "remote browse sync",
3999 .type = P_STRING,
4000 .p_class = P_GLOBAL,
4001 .ptr = &Globals.szRemoteBrowseSync,
4002 .special = NULL,
4003 .enum_list = NULL,
4004 .flags = FLAG_ADVANCED,
4007 .label = "socket address",
4008 .type = P_STRING,
4009 .p_class = P_GLOBAL,
4010 .ptr = &Globals.szSocketAddress,
4011 .special = NULL,
4012 .enum_list = NULL,
4013 .flags = FLAG_ADVANCED,
4016 .label = "nmbd bind explicit broadcast",
4017 .type = P_BOOL,
4018 .p_class = P_GLOBAL,
4019 .ptr = &Globals.bNmbdBindExplicitBroadcast,
4020 .special = NULL,
4021 .enum_list = NULL,
4022 .flags = FLAG_ADVANCED,
4025 .label = "homedir map",
4026 .type = P_STRING,
4027 .p_class = P_GLOBAL,
4028 .ptr = &Globals.szNISHomeMapName,
4029 .special = NULL,
4030 .enum_list = NULL,
4031 .flags = FLAG_ADVANCED,
4034 .label = "afs username map",
4035 .type = P_STRING,
4036 .p_class = P_GLOBAL,
4037 .ptr = &Globals.szAfsUsernameMap,
4038 .special = NULL,
4039 .enum_list = NULL,
4040 .flags = FLAG_ADVANCED,
4043 .label = "afs token lifetime",
4044 .type = P_INTEGER,
4045 .p_class = P_GLOBAL,
4046 .ptr = &Globals.iAfsTokenLifetime,
4047 .special = NULL,
4048 .enum_list = NULL,
4049 .flags = FLAG_ADVANCED,
4052 .label = "log nt token command",
4053 .type = P_STRING,
4054 .p_class = P_GLOBAL,
4055 .ptr = &Globals.szLogNtTokenCommand,
4056 .special = NULL,
4057 .enum_list = NULL,
4058 .flags = FLAG_ADVANCED,
4061 .label = "time offset",
4062 .type = P_INTEGER,
4063 .p_class = P_GLOBAL,
4064 .ptr = &extra_time_offset,
4065 .special = NULL,
4066 .enum_list = NULL,
4067 .flags = FLAG_ADVANCED,
4070 .label = "NIS homedir",
4071 .type = P_BOOL,
4072 .p_class = P_GLOBAL,
4073 .ptr = &Globals.bNISHomeMap,
4074 .special = NULL,
4075 .enum_list = NULL,
4076 .flags = FLAG_ADVANCED,
4079 .label = "-valid",
4080 .type = P_BOOL,
4081 .p_class = P_LOCAL,
4082 .ptr = &sDefault.valid,
4083 .special = NULL,
4084 .enum_list = NULL,
4085 .flags = FLAG_HIDE,
4088 .label = "copy",
4089 .type = P_STRING,
4090 .p_class = P_LOCAL,
4091 .ptr = &sDefault.szCopy,
4092 .special = handle_copy,
4093 .enum_list = NULL,
4094 .flags = FLAG_HIDE,
4097 .label = "include",
4098 .type = P_STRING,
4099 .p_class = P_LOCAL,
4100 .ptr = &sDefault.szInclude,
4101 .special = handle_include,
4102 .enum_list = NULL,
4103 .flags = FLAG_HIDE|FLAG_META,
4106 .label = "preexec",
4107 .type = P_STRING,
4108 .p_class = P_LOCAL,
4109 .ptr = &sDefault.szPreExec,
4110 .special = NULL,
4111 .enum_list = NULL,
4112 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4115 .label = "exec",
4116 .type = P_STRING,
4117 .p_class = P_LOCAL,
4118 .ptr = &sDefault.szPreExec,
4119 .special = NULL,
4120 .enum_list = NULL,
4121 .flags = FLAG_ADVANCED,
4124 .label = "preexec close",
4125 .type = P_BOOL,
4126 .p_class = P_LOCAL,
4127 .ptr = &sDefault.bPreexecClose,
4128 .special = NULL,
4129 .enum_list = NULL,
4130 .flags = FLAG_ADVANCED | FLAG_SHARE,
4133 .label = "postexec",
4134 .type = P_STRING,
4135 .p_class = P_LOCAL,
4136 .ptr = &sDefault.szPostExec,
4137 .special = NULL,
4138 .enum_list = NULL,
4139 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4142 .label = "root preexec",
4143 .type = P_STRING,
4144 .p_class = P_LOCAL,
4145 .ptr = &sDefault.szRootPreExec,
4146 .special = NULL,
4147 .enum_list = NULL,
4148 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4151 .label = "root preexec close",
4152 .type = P_BOOL,
4153 .p_class = P_LOCAL,
4154 .ptr = &sDefault.bRootpreexecClose,
4155 .special = NULL,
4156 .enum_list = NULL,
4157 .flags = FLAG_ADVANCED | FLAG_SHARE,
4160 .label = "root postexec",
4161 .type = P_STRING,
4162 .p_class = P_LOCAL,
4163 .ptr = &sDefault.szRootPostExec,
4164 .special = NULL,
4165 .enum_list = NULL,
4166 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4169 .label = "available",
4170 .type = P_BOOL,
4171 .p_class = P_LOCAL,
4172 .ptr = &sDefault.bAvailable,
4173 .special = NULL,
4174 .enum_list = NULL,
4175 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4178 .label = "registry shares",
4179 .type = P_BOOL,
4180 .p_class = P_GLOBAL,
4181 .ptr = &Globals.bRegistryShares,
4182 .special = NULL,
4183 .enum_list = NULL,
4184 .flags = FLAG_ADVANCED,
4187 .label = "usershare allow guests",
4188 .type = P_BOOL,
4189 .p_class = P_GLOBAL,
4190 .ptr = &Globals.bUsershareAllowGuests,
4191 .special = NULL,
4192 .enum_list = NULL,
4193 .flags = FLAG_ADVANCED,
4196 .label = "usershare max shares",
4197 .type = P_INTEGER,
4198 .p_class = P_GLOBAL,
4199 .ptr = &Globals.iUsershareMaxShares,
4200 .special = NULL,
4201 .enum_list = NULL,
4202 .flags = FLAG_ADVANCED,
4205 .label = "usershare owner only",
4206 .type = P_BOOL,
4207 .p_class = P_GLOBAL,
4208 .ptr = &Globals.bUsershareOwnerOnly,
4209 .special = NULL,
4210 .enum_list = NULL,
4211 .flags = FLAG_ADVANCED,
4214 .label = "usershare path",
4215 .type = P_STRING,
4216 .p_class = P_GLOBAL,
4217 .ptr = &Globals.szUsersharePath,
4218 .special = NULL,
4219 .enum_list = NULL,
4220 .flags = FLAG_ADVANCED,
4223 .label = "usershare prefix allow list",
4224 .type = P_LIST,
4225 .p_class = P_GLOBAL,
4226 .ptr = &Globals.szUsersharePrefixAllowList,
4227 .special = NULL,
4228 .enum_list = NULL,
4229 .flags = FLAG_ADVANCED,
4232 .label = "usershare prefix deny list",
4233 .type = P_LIST,
4234 .p_class = P_GLOBAL,
4235 .ptr = &Globals.szUsersharePrefixDenyList,
4236 .special = NULL,
4237 .enum_list = NULL,
4238 .flags = FLAG_ADVANCED,
4241 .label = "usershare template share",
4242 .type = P_STRING,
4243 .p_class = P_GLOBAL,
4244 .ptr = &Globals.szUsershareTemplateShare,
4245 .special = NULL,
4246 .enum_list = NULL,
4247 .flags = FLAG_ADVANCED,
4250 .label = "volume",
4251 .type = P_STRING,
4252 .p_class = P_LOCAL,
4253 .ptr = &sDefault.volume,
4254 .special = NULL,
4255 .enum_list = NULL,
4256 .flags = FLAG_ADVANCED | FLAG_SHARE,
4259 .label = "fstype",
4260 .type = P_STRING,
4261 .p_class = P_LOCAL,
4262 .ptr = &sDefault.fstype,
4263 .special = NULL,
4264 .enum_list = NULL,
4265 .flags = FLAG_ADVANCED | FLAG_SHARE,
4268 .label = "set directory",
4269 .type = P_BOOLREV,
4270 .p_class = P_LOCAL,
4271 .ptr = &sDefault.bNo_set_dir,
4272 .special = NULL,
4273 .enum_list = NULL,
4274 .flags = FLAG_ADVANCED | FLAG_SHARE,
4277 .label = "wide links",
4278 .type = P_BOOL,
4279 .p_class = P_LOCAL,
4280 .ptr = &sDefault.bWidelinks,
4281 .special = NULL,
4282 .enum_list = NULL,
4283 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4286 .label = "follow symlinks",
4287 .type = P_BOOL,
4288 .p_class = P_LOCAL,
4289 .ptr = &sDefault.bSymlinks,
4290 .special = NULL,
4291 .enum_list = NULL,
4292 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4295 .label = "dont descend",
4296 .type = P_STRING,
4297 .p_class = P_LOCAL,
4298 .ptr = &sDefault.szDontdescend,
4299 .special = NULL,
4300 .enum_list = NULL,
4301 .flags = FLAG_ADVANCED | FLAG_SHARE,
4304 .label = "magic script",
4305 .type = P_STRING,
4306 .p_class = P_LOCAL,
4307 .ptr = &sDefault.szMagicScript,
4308 .special = NULL,
4309 .enum_list = NULL,
4310 .flags = FLAG_ADVANCED | FLAG_SHARE,
4313 .label = "magic output",
4314 .type = P_STRING,
4315 .p_class = P_LOCAL,
4316 .ptr = &sDefault.szMagicOutput,
4317 .special = NULL,
4318 .enum_list = NULL,
4319 .flags = FLAG_ADVANCED | FLAG_SHARE,
4322 .label = "delete readonly",
4323 .type = P_BOOL,
4324 .p_class = P_LOCAL,
4325 .ptr = &sDefault.bDeleteReadonly,
4326 .special = NULL,
4327 .enum_list = NULL,
4328 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4331 .label = "dos filemode",
4332 .type = P_BOOL,
4333 .p_class = P_LOCAL,
4334 .ptr = &sDefault.bDosFilemode,
4335 .special = NULL,
4336 .enum_list = NULL,
4337 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4340 .label = "dos filetimes",
4341 .type = P_BOOL,
4342 .p_class = P_LOCAL,
4343 .ptr = &sDefault.bDosFiletimes,
4344 .special = NULL,
4345 .enum_list = NULL,
4346 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4349 .label = "dos filetime resolution",
4350 .type = P_BOOL,
4351 .p_class = P_LOCAL,
4352 .ptr = &sDefault.bDosFiletimeResolution,
4353 .special = NULL,
4354 .enum_list = NULL,
4355 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4358 .label = "fake directory create times",
4359 .type = P_BOOL,
4360 .p_class = P_LOCAL,
4361 .ptr = &sDefault.bFakeDirCreateTimes,
4362 .special = NULL,
4363 .enum_list = NULL,
4364 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4367 .label = "async smb echo handler",
4368 .type = P_BOOL,
4369 .p_class = P_GLOBAL,
4370 .ptr = &Globals.bAsyncSMBEchoHandler,
4371 .special = NULL,
4372 .enum_list = NULL,
4373 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
4376 .label = "panic action",
4377 .type = P_STRING,
4378 .p_class = P_GLOBAL,
4379 .ptr = &Globals.szPanicAction,
4380 .special = NULL,
4381 .enum_list = NULL,
4382 .flags = FLAG_ADVANCED,
4385 .label = "perfcount module",
4386 .type = P_STRING,
4387 .p_class = P_GLOBAL,
4388 .ptr = &Globals.szSMBPerfcountModule,
4389 .special = NULL,
4390 .enum_list = NULL,
4391 .flags = FLAG_ADVANCED,
4394 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4397 .label = "vfs objects",
4398 .type = P_LIST,
4399 .p_class = P_LOCAL,
4400 .ptr = &sDefault.szVfsObjects,
4401 .special = NULL,
4402 .enum_list = NULL,
4403 .flags = FLAG_ADVANCED | FLAG_SHARE,
4406 .label = "vfs object",
4407 .type = P_LIST,
4408 .p_class = P_LOCAL,
4409 .ptr = &sDefault.szVfsObjects,
4410 .special = NULL,
4411 .enum_list = NULL,
4412 .flags = FLAG_HIDE,
4416 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4419 .label = "msdfs root",
4420 .type = P_BOOL,
4421 .p_class = P_LOCAL,
4422 .ptr = &sDefault.bMSDfsRoot,
4423 .special = NULL,
4424 .enum_list = NULL,
4425 .flags = FLAG_ADVANCED | FLAG_SHARE,
4428 .label = "msdfs proxy",
4429 .type = P_STRING,
4430 .p_class = P_LOCAL,
4431 .ptr = &sDefault.szMSDfsProxy,
4432 .special = NULL,
4433 .enum_list = NULL,
4434 .flags = FLAG_ADVANCED | FLAG_SHARE,
4437 .label = "host msdfs",
4438 .type = P_BOOL,
4439 .p_class = P_GLOBAL,
4440 .ptr = &Globals.bHostMSDfs,
4441 .special = NULL,
4442 .enum_list = NULL,
4443 .flags = FLAG_ADVANCED,
4446 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4449 .label = "passdb expand explicit",
4450 .type = P_BOOL,
4451 .p_class = P_GLOBAL,
4452 .ptr = &Globals.bPassdbExpandExplicit,
4453 .special = NULL,
4454 .enum_list = NULL,
4455 .flags = FLAG_ADVANCED,
4458 .label = "idmap backend",
4459 .type = P_STRING,
4460 .p_class = P_GLOBAL,
4461 .ptr = &Globals.szIdmapBackend,
4462 .special = NULL,
4463 .enum_list = NULL,
4464 .flags = FLAG_ADVANCED,
4467 .label = "idmap alloc backend",
4468 .type = P_STRING,
4469 .p_class = P_GLOBAL,
4470 .ptr = &Globals.szIdmapAllocBackend,
4471 .special = NULL,
4472 .enum_list = NULL,
4473 .flags = FLAG_ADVANCED,
4476 .label = "idmap cache time",
4477 .type = P_INTEGER,
4478 .p_class = P_GLOBAL,
4479 .ptr = &Globals.iIdmapCacheTime,
4480 .special = NULL,
4481 .enum_list = NULL,
4482 .flags = FLAG_ADVANCED,
4485 .label = "idmap negative cache time",
4486 .type = P_INTEGER,
4487 .p_class = P_GLOBAL,
4488 .ptr = &Globals.iIdmapNegativeCacheTime,
4489 .special = NULL,
4490 .enum_list = NULL,
4491 .flags = FLAG_ADVANCED,
4494 .label = "idmap uid",
4495 .type = P_STRING,
4496 .p_class = P_GLOBAL,
4497 .ptr = &Globals.szIdmapUID,
4498 .special = handle_idmap_uid,
4499 .enum_list = NULL,
4500 .flags = FLAG_ADVANCED,
4503 .label = "winbind uid",
4504 .type = P_STRING,
4505 .p_class = P_GLOBAL,
4506 .ptr = &Globals.szIdmapUID,
4507 .special = handle_idmap_uid,
4508 .enum_list = NULL,
4509 .flags = FLAG_HIDE,
4512 .label = "idmap gid",
4513 .type = P_STRING,
4514 .p_class = P_GLOBAL,
4515 .ptr = &Globals.szIdmapGID,
4516 .special = handle_idmap_gid,
4517 .enum_list = NULL,
4518 .flags = FLAG_ADVANCED,
4521 .label = "winbind gid",
4522 .type = P_STRING,
4523 .p_class = P_GLOBAL,
4524 .ptr = &Globals.szIdmapGID,
4525 .special = handle_idmap_gid,
4526 .enum_list = NULL,
4527 .flags = FLAG_HIDE,
4530 .label = "template homedir",
4531 .type = P_STRING,
4532 .p_class = P_GLOBAL,
4533 .ptr = &Globals.szTemplateHomedir,
4534 .special = NULL,
4535 .enum_list = NULL,
4536 .flags = FLAG_ADVANCED,
4539 .label = "template shell",
4540 .type = P_STRING,
4541 .p_class = P_GLOBAL,
4542 .ptr = &Globals.szTemplateShell,
4543 .special = NULL,
4544 .enum_list = NULL,
4545 .flags = FLAG_ADVANCED,
4548 .label = "winbind separator",
4549 .type = P_STRING,
4550 .p_class = P_GLOBAL,
4551 .ptr = &Globals.szWinbindSeparator,
4552 .special = NULL,
4553 .enum_list = NULL,
4554 .flags = FLAG_ADVANCED,
4557 .label = "winbind cache time",
4558 .type = P_INTEGER,
4559 .p_class = P_GLOBAL,
4560 .ptr = &Globals.winbind_cache_time,
4561 .special = NULL,
4562 .enum_list = NULL,
4563 .flags = FLAG_ADVANCED,
4566 .label = "winbind reconnect delay",
4567 .type = P_INTEGER,
4568 .p_class = P_GLOBAL,
4569 .ptr = &Globals.winbind_reconnect_delay,
4570 .special = NULL,
4571 .enum_list = NULL,
4572 .flags = FLAG_ADVANCED,
4575 .label = "winbind enum users",
4576 .type = P_BOOL,
4577 .p_class = P_GLOBAL,
4578 .ptr = &Globals.bWinbindEnumUsers,
4579 .special = NULL,
4580 .enum_list = NULL,
4581 .flags = FLAG_ADVANCED,
4584 .label = "winbind enum groups",
4585 .type = P_BOOL,
4586 .p_class = P_GLOBAL,
4587 .ptr = &Globals.bWinbindEnumGroups,
4588 .special = NULL,
4589 .enum_list = NULL,
4590 .flags = FLAG_ADVANCED,
4593 .label = "winbind use default domain",
4594 .type = P_BOOL,
4595 .p_class = P_GLOBAL,
4596 .ptr = &Globals.bWinbindUseDefaultDomain,
4597 .special = NULL,
4598 .enum_list = NULL,
4599 .flags = FLAG_ADVANCED,
4602 .label = "winbind trusted domains only",
4603 .type = P_BOOL,
4604 .p_class = P_GLOBAL,
4605 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4606 .special = NULL,
4607 .enum_list = NULL,
4608 .flags = FLAG_ADVANCED,
4611 .label = "winbind nested groups",
4612 .type = P_BOOL,
4613 .p_class = P_GLOBAL,
4614 .ptr = &Globals.bWinbindNestedGroups,
4615 .special = NULL,
4616 .enum_list = NULL,
4617 .flags = FLAG_ADVANCED,
4620 .label = "winbind expand groups",
4621 .type = P_INTEGER,
4622 .p_class = P_GLOBAL,
4623 .ptr = &Globals.winbind_expand_groups,
4624 .special = NULL,
4625 .enum_list = NULL,
4626 .flags = FLAG_ADVANCED,
4629 .label = "winbind nss info",
4630 .type = P_LIST,
4631 .p_class = P_GLOBAL,
4632 .ptr = &Globals.szWinbindNssInfo,
4633 .special = NULL,
4634 .enum_list = NULL,
4635 .flags = FLAG_ADVANCED,
4638 .label = "winbind refresh tickets",
4639 .type = P_BOOL,
4640 .p_class = P_GLOBAL,
4641 .ptr = &Globals.bWinbindRefreshTickets,
4642 .special = NULL,
4643 .enum_list = NULL,
4644 .flags = FLAG_ADVANCED,
4647 .label = "winbind offline logon",
4648 .type = P_BOOL,
4649 .p_class = P_GLOBAL,
4650 .ptr = &Globals.bWinbindOfflineLogon,
4651 .special = NULL,
4652 .enum_list = NULL,
4653 .flags = FLAG_ADVANCED,
4656 .label = "winbind normalize names",
4657 .type = P_BOOL,
4658 .p_class = P_GLOBAL,
4659 .ptr = &Globals.bWinbindNormalizeNames,
4660 .special = NULL,
4661 .enum_list = NULL,
4662 .flags = FLAG_ADVANCED,
4665 .label = "winbind rpc only",
4666 .type = P_BOOL,
4667 .p_class = P_GLOBAL,
4668 .ptr = &Globals.bWinbindRpcOnly,
4669 .special = NULL,
4670 .enum_list = NULL,
4671 .flags = FLAG_ADVANCED,
4674 .label = "create krb5 conf",
4675 .type = P_BOOL,
4676 .p_class = P_GLOBAL,
4677 .ptr = &Globals.bCreateKrb5Conf,
4678 .special = NULL,
4679 .enum_list = NULL,
4680 .flags = FLAG_ADVANCED,
4683 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4686 /***************************************************************************
4687 Initialise the sDefault parameter structure for the printer values.
4688 ***************************************************************************/
4690 static void init_printer_values(struct service *pService)
4692 /* choose defaults depending on the type of printing */
4693 switch (pService->iPrinting) {
4694 case PRINT_BSD:
4695 case PRINT_AIX:
4696 case PRINT_LPRNT:
4697 case PRINT_LPROS2:
4698 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4699 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4700 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4701 break;
4703 case PRINT_LPRNG:
4704 case PRINT_PLP:
4705 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4706 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4707 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4708 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4709 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4710 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4711 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4712 break;
4714 case PRINT_CUPS:
4715 case PRINT_IPRINT:
4716 #ifdef HAVE_CUPS
4717 /* set the lpq command to contain the destination printer
4718 name only. This is used by cups_queue_get() */
4719 string_set(&pService->szLpqcommand, "%p");
4720 string_set(&pService->szLprmcommand, "");
4721 string_set(&pService->szPrintcommand, "");
4722 string_set(&pService->szLppausecommand, "");
4723 string_set(&pService->szLpresumecommand, "");
4724 string_set(&pService->szQueuepausecommand, "");
4725 string_set(&pService->szQueueresumecommand, "");
4726 #else
4727 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4728 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4729 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4730 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4731 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4732 string_set(&pService->szQueuepausecommand, "disable '%p'");
4733 string_set(&pService->szQueueresumecommand, "enable '%p'");
4734 #endif /* HAVE_CUPS */
4735 break;
4737 case PRINT_SYSV:
4738 case PRINT_HPUX:
4739 string_set(&pService->szLpqcommand, "lpstat -o%p");
4740 string_set(&pService->szLprmcommand, "cancel %p-%j");
4741 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4742 string_set(&pService->szQueuepausecommand, "disable %p");
4743 string_set(&pService->szQueueresumecommand, "enable %p");
4744 #ifndef HPUX
4745 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4746 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4747 #endif /* HPUX */
4748 break;
4750 case PRINT_QNX:
4751 string_set(&pService->szLpqcommand, "lpq -P%p");
4752 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4753 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4754 break;
4756 #ifdef DEVELOPER
4757 case PRINT_TEST:
4758 case PRINT_VLP:
4759 string_set(&pService->szPrintcommand, "vlp print %p %s");
4760 string_set(&pService->szLpqcommand, "vlp lpq %p");
4761 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4762 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4763 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4764 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4765 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4766 break;
4767 #endif /* DEVELOPER */
4772 * Function to return the default value for the maximum number of open
4773 * file descriptors permitted. This function tries to consult the
4774 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4775 * the smaller of those.
4777 static int max_open_files(void)
4779 int sysctl_max = MAX_OPEN_FILES;
4780 int rlimit_max = MAX_OPEN_FILES;
4782 #ifdef HAVE_SYSCTLBYNAME
4784 size_t size = sizeof(sysctl_max);
4785 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4788 #endif
4790 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4792 struct rlimit rl;
4794 ZERO_STRUCT(rl);
4796 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4797 rlimit_max = rl.rlim_cur;
4799 #if defined(RLIM_INFINITY)
4800 if(rl.rlim_cur == RLIM_INFINITY)
4801 rlimit_max = MAX_OPEN_FILES;
4803 #endif
4804 #endif
4806 if (sysctl_max < MIN_OPEN_FILES_WINDOWS) {
4807 DEBUG(2,("max_open_files: sysctl_max (%d) below "
4808 "minimum Windows limit (%d)\n",
4809 sysctl_max,
4810 MIN_OPEN_FILES_WINDOWS));
4811 sysctl_max = MIN_OPEN_FILES_WINDOWS;
4814 if (rlimit_max < MIN_OPEN_FILES_WINDOWS) {
4815 DEBUG(2,("rlimit_max: rlimit_max (%d) below "
4816 "minimum Windows limit (%d)\n",
4817 rlimit_max,
4818 MIN_OPEN_FILES_WINDOWS));
4819 rlimit_max = MIN_OPEN_FILES_WINDOWS;
4822 return MIN(sysctl_max, rlimit_max);
4826 * Common part of freeing allocated data for one parameter.
4828 static void free_one_parameter_common(void *parm_ptr,
4829 struct parm_struct parm)
4831 if ((parm.type == P_STRING) ||
4832 (parm.type == P_USTRING))
4834 string_free((char**)parm_ptr);
4835 } else if (parm.type == P_LIST) {
4836 TALLOC_FREE(*((char***)parm_ptr));
4841 * Free the allocated data for one parameter for a share
4842 * given as a service struct.
4844 static void free_one_parameter(struct service *service,
4845 struct parm_struct parm)
4847 void *parm_ptr;
4849 if (parm.p_class != P_LOCAL) {
4850 return;
4853 parm_ptr = lp_local_ptr(service, parm.ptr);
4855 free_one_parameter_common(parm_ptr, parm);
4859 * Free the allocated parameter data of a share given
4860 * as a service struct.
4862 static void free_parameters(struct service *service)
4864 uint32_t i;
4866 for (i=0; parm_table[i].label; i++) {
4867 free_one_parameter(service, parm_table[i]);
4872 * Free the allocated data for one parameter for a given share
4873 * specified by an snum.
4875 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
4877 void *parm_ptr;
4879 if (parm.ptr == NULL) {
4880 return;
4883 if (snum < 0) {
4884 parm_ptr = parm.ptr;
4885 } else if (parm.p_class != P_LOCAL) {
4886 return;
4887 } else {
4888 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4891 free_one_parameter_common(parm_ptr, parm);
4895 * Free the allocated parameter data for a share specified
4896 * by an snum.
4898 static void free_parameters_by_snum(int snum)
4900 uint32_t i;
4902 for (i=0; parm_table[i].label; i++) {
4903 free_one_parameter_by_snum(snum, parm_table[i]);
4908 * Free the allocated global parameters.
4910 static void free_global_parameters(void)
4912 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4915 /***************************************************************************
4916 Initialise the global parameter structure.
4917 ***************************************************************************/
4919 static void init_globals(bool first_time_only)
4921 static bool done_init = False;
4922 char *s = NULL;
4923 int i;
4925 /* If requested to initialize only once and we've already done it... */
4926 if (first_time_only && done_init) {
4927 /* ... then we have nothing more to do */
4928 return;
4931 if (!done_init) {
4932 /* The logfile can be set before this is invoked. Free it if so. */
4933 if (Globals.szLogFile != NULL) {
4934 string_free(&Globals.szLogFile);
4935 Globals.szLogFile = NULL;
4937 done_init = True;
4938 } else {
4939 free_global_parameters();
4942 memset((void *)&Globals, '\0', sizeof(Globals));
4944 for (i = 0; parm_table[i].label; i++) {
4945 if ((parm_table[i].type == P_STRING ||
4946 parm_table[i].type == P_USTRING) &&
4947 parm_table[i].ptr)
4949 string_set((char **)parm_table[i].ptr, "");
4953 string_set(&sDefault.fstype, FSTYPE_STRING);
4954 string_set(&sDefault.szPrintjobUsername, "%U");
4956 init_printer_values(&sDefault);
4959 DEBUG(3, ("Initialising global parameters\n"));
4961 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
4962 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
4964 /* use the new 'hash2' method by default, with a prefix of 1 */
4965 string_set(&Globals.szManglingMethod, "hash2");
4966 Globals.mangle_prefix = 1;
4968 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
4970 /* using UTF8 by default allows us to support all chars */
4971 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
4973 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4974 /* If the system supports nl_langinfo(), try to grab the value
4975 from the user's locale */
4976 string_set(&Globals.display_charset, "LOCALE");
4977 #else
4978 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
4979 #endif
4981 /* Use codepage 850 as a default for the dos character set */
4982 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
4985 * Allow the default PASSWD_CHAT to be overridden in local.h.
4987 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
4989 set_global_myname(myhostname());
4990 string_set(&Globals.szNetbiosName,global_myname());
4992 set_global_myworkgroup(WORKGROUP);
4993 string_set(&Globals.szWorkgroup, lp_workgroup());
4995 string_set(&Globals.szPasswdProgram, "");
4996 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
4997 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
4998 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
4999 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
5000 string_set(&Globals.szSocketAddress, "0.0.0.0");
5002 * By default support explicit binding to broadcast
5003 * addresses.
5005 Globals.bNmbdBindExplicitBroadcast = true;
5007 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
5008 smb_panic("init_globals: ENOMEM");
5010 string_set(&Globals.szServerString, s);
5011 SAFE_FREE(s);
5012 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
5013 DEFAULT_MINOR_VERSION) < 0) {
5014 smb_panic("init_globals: ENOMEM");
5016 string_set(&Globals.szAnnounceVersion, s);
5017 SAFE_FREE(s);
5018 #ifdef DEVELOPER
5019 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
5020 #endif
5022 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
5024 string_set(&Globals.szLogonDrive, "");
5025 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
5026 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
5027 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
5029 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
5030 string_set(&Globals.szPasswordServer, "*");
5032 Globals.AlgorithmicRidBase = BASE_RID;
5034 Globals.bLoadPrinters = True;
5035 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
5037 Globals.ConfigBackend = config_backend;
5039 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
5040 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
5041 Globals.max_xmit = 0x4104;
5042 Globals.max_mux = 50; /* This is *needed* for profile support. */
5043 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
5044 Globals.bDisableSpoolss = False;
5045 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
5046 Globals.pwordlevel = 0;
5047 Globals.unamelevel = 0;
5048 Globals.deadtime = 0;
5049 Globals.getwd_cache = true;
5050 Globals.bLargeReadwrite = True;
5051 Globals.max_log_size = 5000;
5052 Globals.max_open_files = max_open_files();
5053 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
5054 Globals.maxprotocol = PROTOCOL_NT1;
5055 Globals.minprotocol = PROTOCOL_CORE;
5056 Globals.security = SEC_USER;
5057 Globals.paranoid_server_security = True;
5058 Globals.bEncryptPasswords = True;
5059 Globals.bUpdateEncrypt = False;
5060 Globals.clientSchannel = Auto;
5061 Globals.serverSchannel = Auto;
5062 Globals.bReadRaw = True;
5063 Globals.bWriteRaw = True;
5064 Globals.bNullPasswords = False;
5065 Globals.bObeyPamRestrictions = False;
5066 Globals.syslog = 1;
5067 Globals.bSyslogOnly = False;
5068 Globals.bTimestampLogs = True;
5069 string_set(&Globals.szLogLevel, "0");
5070 Globals.bDebugPrefixTimestamp = False;
5071 Globals.bDebugHiresTimestamp = true;
5072 Globals.bDebugPid = False;
5073 Globals.bDebugUid = False;
5074 Globals.bDebugClass = False;
5075 Globals.bEnableCoreFiles = True;
5076 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
5077 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
5078 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
5079 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
5080 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
5081 Globals.lm_interval = 60;
5082 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
5083 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
5084 Globals.bNISHomeMap = False;
5085 #ifdef WITH_NISPLUS_HOME
5086 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
5087 #else
5088 string_set(&Globals.szNISHomeMapName, "auto.home");
5089 #endif
5090 #endif
5091 Globals.bTimeServer = False;
5092 Globals.bBindInterfacesOnly = False;
5093 Globals.bUnixPasswdSync = False;
5094 Globals.bPamPasswordChange = False;
5095 Globals.bPasswdChatDebug = False;
5096 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
5097 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
5098 Globals.bNTStatusSupport = True; /* Use NT status by default. */
5099 Globals.bStatCache = True; /* use stat cache by default */
5100 Globals.iMaxStatCacheSize = 256; /* 256k by default */
5101 Globals.restrict_anonymous = 0;
5102 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
5103 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
5104 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
5105 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
5106 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
5107 /* Note, that we will use NTLM2 session security (which is different), if it is available */
5109 Globals.map_to_guest = 0; /* By Default, "Never" */
5110 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
5111 Globals.enhanced_browsing = true;
5112 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
5113 #ifdef MMAP_BLACKLIST
5114 Globals.bUseMmap = False;
5115 #else
5116 Globals.bUseMmap = True;
5117 #endif
5118 Globals.bUnixExtensions = True;
5119 Globals.bResetOnZeroVC = False;
5120 Globals.bLogWriteableFilesOnExit = False;
5121 Globals.bCreateKrb5Conf = true;
5123 /* hostname lookups can be very expensive and are broken on
5124 a large number of sites (tridge) */
5125 Globals.bHostnameLookups = False;
5127 string_set(&Globals.szPassdbBackend, "tdbsam");
5128 string_set(&Globals.szLdapSuffix, "");
5129 string_set(&Globals.szLdapMachineSuffix, "");
5130 string_set(&Globals.szLdapUserSuffix, "");
5131 string_set(&Globals.szLdapGroupSuffix, "");
5132 string_set(&Globals.szLdapIdmapSuffix, "");
5134 string_set(&Globals.szLdapAdminDn, "");
5135 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5136 Globals.ldap_ssl_ads = False;
5137 Globals.ldap_deref = -1;
5138 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5139 Globals.ldap_delete_dn = False;
5140 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5141 Globals.ldap_follow_referral = Auto;
5142 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5143 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5144 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5146 Globals.ldap_debug_level = 0;
5147 Globals.ldap_debug_threshold = 10;
5149 /* This is what we tell the afs client. in reality we set the token
5150 * to never expire, though, when this runs out the afs client will
5151 * forget the token. Set to 0 to get NEVERDATE.*/
5152 Globals.iAfsTokenLifetime = 604800;
5153 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5155 /* these parameters are set to defaults that are more appropriate
5156 for the increasing samba install base:
5158 as a member of the workgroup, that will possibly become a
5159 _local_ master browser (lm = True). this is opposed to a forced
5160 local master browser startup (pm = True).
5162 doesn't provide WINS server service by default (wsupp = False),
5163 and doesn't provide domain master browser services by default, either.
5167 Globals.bMsAddPrinterWizard = True;
5168 Globals.os_level = 20;
5169 Globals.bLocalMaster = True;
5170 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5171 Globals.bDomainLogons = False;
5172 Globals.bBrowseList = True;
5173 Globals.bWINSsupport = False;
5174 Globals.bWINSproxy = False;
5176 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5177 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5179 Globals.bDNSproxy = True;
5181 /* this just means to use them if they exist */
5182 Globals.bKernelOplocks = True;
5184 Globals.bAllowTrustedDomains = True;
5185 string_set(&Globals.szIdmapBackend, "tdb");
5187 string_set(&Globals.szTemplateShell, "/bin/false");
5188 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5189 string_set(&Globals.szWinbindSeparator, "\\");
5191 string_set(&Globals.szCupsServer, "");
5192 string_set(&Globals.szIPrintServer, "");
5194 string_set(&Globals.ctdbdSocket, "");
5195 Globals.szClusterAddresses = NULL;
5196 Globals.clustering = False;
5197 Globals.ctdb_timeout = 0;
5198 Globals.ctdb_locktime_warn_threshold = 0;
5200 Globals.winbind_cache_time = 300; /* 5 minutes */
5201 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5202 Globals.bWinbindEnumUsers = False;
5203 Globals.bWinbindEnumGroups = False;
5204 Globals.bWinbindUseDefaultDomain = False;
5205 Globals.bWinbindTrustedDomainsOnly = False;
5206 Globals.bWinbindNestedGroups = True;
5207 Globals.winbind_expand_groups = 1;
5208 Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL);
5209 Globals.bWinbindRefreshTickets = False;
5210 Globals.bWinbindOfflineLogon = False;
5212 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5213 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5215 Globals.bPassdbExpandExplicit = False;
5217 Globals.name_cache_timeout = 660; /* In seconds */
5219 Globals.bUseSpnego = True;
5220 Globals.bClientUseSpnego = True;
5222 Globals.client_signing = Auto;
5223 Globals.server_signing = False;
5225 Globals.bDeferSharingViolations = True;
5226 string_set(&Globals.smb_ports, SMB_PORTS);
5228 Globals.bEnablePrivileges = True;
5229 Globals.bHostMSDfs = True;
5230 Globals.bASUSupport = False;
5232 /* User defined shares. */
5233 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5234 smb_panic("init_globals: ENOMEM");
5236 string_set(&Globals.szUsersharePath, s);
5237 SAFE_FREE(s);
5238 string_set(&Globals.szUsershareTemplateShare, "");
5239 Globals.iUsershareMaxShares = 0;
5240 /* By default disallow sharing of directories not owned by the sharer. */
5241 Globals.bUsershareOwnerOnly = True;
5242 /* By default disallow guest access to usershares. */
5243 Globals.bUsershareAllowGuests = False;
5245 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5247 /* By default no shares out of the registry */
5248 Globals.bRegistryShares = False;
5250 Globals.iminreceivefile = 0;
5252 Globals.bMapUntrustedToDomain = false;
5255 /*******************************************************************
5256 Convenience routine to grab string parameters into temporary memory
5257 and run standard_sub_basic on them. The buffers can be written to by
5258 callers without affecting the source string.
5259 ********************************************************************/
5261 static char *lp_string(const char *s)
5263 char *ret;
5264 TALLOC_CTX *ctx = talloc_tos();
5266 /* The follow debug is useful for tracking down memory problems
5267 especially if you have an inner loop that is calling a lp_*()
5268 function that returns a string. Perhaps this debug should be
5269 present all the time? */
5271 #if 0
5272 DEBUG(10, ("lp_string(%s)\n", s));
5273 #endif
5274 if (!s) {
5275 return NULL;
5278 ret = talloc_sub_basic(ctx,
5279 get_current_username(),
5280 current_user_info.domain,
5282 if (trim_char(ret, '\"', '\"')) {
5283 if (strchr(ret,'\"') != NULL) {
5284 TALLOC_FREE(ret);
5285 ret = talloc_sub_basic(ctx,
5286 get_current_username(),
5287 current_user_info.domain,
5291 return ret;
5295 In this section all the functions that are used to access the
5296 parameters from the rest of the program are defined
5299 #define FN_GLOBAL_STRING(fn_name,ptr) \
5300 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5301 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5302 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5303 #define FN_GLOBAL_LIST(fn_name,ptr) \
5304 const char **fn_name(void) {return(*(const char ***)(ptr));}
5305 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5306 bool fn_name(void) {return(*(bool *)(ptr));}
5307 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5308 char fn_name(void) {return(*(char *)(ptr));}
5309 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5310 int fn_name(void) {return(*(int *)(ptr));}
5312 #define FN_LOCAL_STRING(fn_name,val) \
5313 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5314 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5315 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5316 #define FN_LOCAL_LIST(fn_name,val) \
5317 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5318 #define FN_LOCAL_BOOL(fn_name,val) \
5319 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5320 #define FN_LOCAL_INTEGER(fn_name,val) \
5321 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5323 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5324 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5325 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5326 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5327 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5328 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));}
5329 #define FN_LOCAL_CHAR(fn_name,val) \
5330 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5332 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
5333 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5334 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5335 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5336 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5337 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5338 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5339 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5340 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5341 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5342 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5343 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5344 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5345 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5346 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5347 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5348 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5349 * build process or in smb.conf, we use that value. Otherwise they
5350 * default to the value of lp_lockdir(). */
5351 char *lp_statedir(void) {
5352 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5353 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5354 return(lp_string(*(char **)(&Globals.szStateDir) ?
5355 *(char **)(&Globals.szStateDir) : ""));
5356 else
5357 return(lp_string(*(char **)(&Globals.szLockDir) ?
5358 *(char **)(&Globals.szLockDir) : ""));
5360 char *lp_cachedir(void) {
5361 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5362 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5363 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5364 *(char **)(&Globals.szCacheDir) : ""));
5365 else
5366 return(lp_string(*(char **)(&Globals.szLockDir) ?
5367 *(char **)(&Globals.szLockDir) : ""));
5369 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
5370 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5371 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5372 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5373 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5374 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5375 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5376 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5377 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5378 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5379 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5380 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5381 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5382 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5383 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5384 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5385 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5386 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5387 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5388 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5389 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5390 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5391 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5392 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5393 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5394 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5395 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5396 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5397 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
5398 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5399 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5400 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5401 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5402 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5403 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5404 * lp_passdb_backend() should be replace by the this macro again after
5405 * some releases.
5406 * */
5407 const char *lp_passdb_backend(void)
5409 char *delim, *quote;
5411 delim = strchr( Globals.szPassdbBackend, ' ');
5412 /* no space at all */
5413 if (delim == NULL) {
5414 goto out;
5417 quote = strchr(Globals.szPassdbBackend, '"');
5418 /* no quote char or non in the first part */
5419 if (quote == NULL || quote > delim) {
5420 *delim = '\0';
5421 goto warn;
5424 quote = strchr(quote+1, '"');
5425 if (quote == NULL) {
5426 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5427 goto out;
5428 } else if (*(quote+1) == '\0') {
5429 /* space, fitting quote char, and one backend only */
5430 goto out;
5431 } else {
5432 /* terminate string after the fitting quote char */
5433 *(quote+1) = '\0';
5436 warn:
5437 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5438 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5439 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5440 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5442 out:
5443 return Globals.szPassdbBackend;
5445 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5446 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5447 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5448 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5449 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5451 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5452 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5453 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5454 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5455 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5456 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5458 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5460 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5461 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5462 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5464 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5466 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5467 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5468 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5469 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5470 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5471 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5472 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5473 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5474 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5475 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5476 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5477 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5478 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5479 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5480 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5481 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
5483 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5484 FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
5485 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5486 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5487 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5488 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5490 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5491 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5492 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5493 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5494 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
5495 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
5496 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5497 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5498 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5499 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5500 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5501 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5502 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5503 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5504 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5505 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5506 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5507 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5508 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5509 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5511 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5513 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5514 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5515 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5516 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5517 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5518 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
5519 &Globals.bLogWriteableFilesOnExit)
5520 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5521 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5522 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5523 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5524 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5525 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5526 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5527 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5528 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5529 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5530 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
5531 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5532 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
5533 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5534 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5535 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5536 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
5537 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5538 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5539 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5540 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5541 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5542 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5543 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5544 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5545 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5546 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5547 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5548 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5549 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5550 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5551 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5552 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5553 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5554 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5555 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5556 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5557 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5558 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5559 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5560 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5561 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5562 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5563 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5564 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5565 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5566 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5567 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5568 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5569 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5570 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5571 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5572 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5573 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5574 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5575 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5576 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5577 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5578 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5579 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5580 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5581 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5582 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5583 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5584 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5585 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5586 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5587 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5588 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5589 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5590 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5591 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5592 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5593 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5594 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5595 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5596 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5597 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5598 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5599 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5600 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5601 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5602 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5603 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5604 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5605 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5606 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5607 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5608 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5609 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5610 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5611 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5612 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5613 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5614 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5616 FN_LOCAL_STRING(lp_preexec, szPreExec)
5617 FN_LOCAL_STRING(lp_postexec, szPostExec)
5618 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5619 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5620 FN_LOCAL_STRING(lp_servicename, szService)
5621 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5622 FN_LOCAL_STRING(lp_pathname, szPath)
5623 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5624 FN_LOCAL_STRING(lp_username, szUsername)
5625 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5626 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5627 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5628 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5629 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5630 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5631 int lp_cups_encrypt(void)
5633 #ifdef HAVE_HTTPCONNECTENCRYPT
5634 switch (Globals.CupsEncrypt) {
5635 case Auto:
5636 Globals.CupsEncrypt = HTTP_ENCRYPT_REQUIRED;
5637 break;
5638 case True:
5639 Globals.CupsEncrypt = HTTP_ENCRYPT_ALWAYS;
5640 break;
5641 case False:
5642 Globals.CupsEncrypt = HTTP_ENCRYPT_NEVER;
5643 break;
5645 #endif
5646 return Globals.CupsEncrypt;
5648 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5649 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5650 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5651 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5652 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5653 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
5654 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
5655 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5656 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5657 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5658 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5659 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5660 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5661 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5662 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5663 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5664 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5665 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5666 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5667 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5668 FN_LOCAL_STRING(lp_comment, comment)
5669 FN_LOCAL_STRING(lp_force_user, force_user)
5670 FN_LOCAL_STRING(lp_force_group, force_group)
5671 FN_LOCAL_LIST(lp_readlist, readlist)
5672 FN_LOCAL_LIST(lp_writelist, writelist)
5673 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5674 FN_LOCAL_STRING(lp_fstype, fstype)
5675 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5676 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5677 static FN_LOCAL_STRING(lp_volume, volume)
5678 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5679 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5680 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5681 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5682 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5683 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5684 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5685 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5686 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5687 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5688 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5689 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5690 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5691 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5692 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5693 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5694 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5695 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5696 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5697 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5698 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5699 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5700 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5701 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5702 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5703 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5704 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5705 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5706 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5707 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5708 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5709 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5710 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5711 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5712 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5713 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5714 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5715 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5716 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5717 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5718 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5719 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5720 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5721 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5722 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5723 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5724 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5725 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5726 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
5727 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5728 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5729 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5730 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5731 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5732 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5733 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5734 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5735 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5736 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5737 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5738 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5739 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5740 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5741 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5742 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5743 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5744 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5745 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5746 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5747 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5748 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5749 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5750 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5751 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5752 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5753 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5754 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5755 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5756 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5757 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5758 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5759 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5760 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5761 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5762 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5763 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5764 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5765 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5766 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5767 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5768 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5769 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5770 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5771 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5772 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5773 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5774 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5775 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5776 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5778 /* local prototypes */
5780 static int map_parameter(const char *pszParmName);
5781 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5782 static const char *get_boolean(bool bool_value);
5783 static int getservicebyname(const char *pszServiceName,
5784 struct service *pserviceDest);
5785 static void copy_service(struct service *pserviceDest,
5786 struct service *pserviceSource,
5787 struct bitmap *pcopymapDest);
5788 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5789 void *userdata);
5790 static bool do_section(const char *pszSectionName, void *userdata);
5791 static void init_copymap(struct service *pservice);
5792 static bool hash_a_service(const char *name, int number);
5793 static void free_service_byindex(int iService);
5794 static void free_param_opts(struct param_opt_struct **popts);
5795 static void show_parameter(int parmIndex);
5796 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5799 * This is a helper function for parametrical options support. It returns a
5800 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5801 * parametrical functions are quite simple
5803 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5804 const char *option)
5806 bool global_section = False;
5807 char* param_key;
5808 struct param_opt_struct *data;
5810 if (snum >= iNumServices) return NULL;
5812 if (snum < 0) {
5813 data = Globals.param_opt;
5814 global_section = True;
5815 } else {
5816 data = ServicePtrs[snum]->param_opt;
5819 if (asprintf(&param_key, "%s:%s", type, option) == -1) {
5820 DEBUG(0,("asprintf failed!\n"));
5821 return NULL;
5824 while (data) {
5825 if (strwicmp(data->key, param_key) == 0) {
5826 string_free(&param_key);
5827 return data;
5829 data = data->next;
5832 if (!global_section) {
5833 /* Try to fetch the same option but from globals */
5834 /* but only if we are not already working with Globals */
5835 data = Globals.param_opt;
5836 while (data) {
5837 if (strwicmp(data->key, param_key) == 0) {
5838 string_free(&param_key);
5839 return data;
5841 data = data->next;
5845 string_free(&param_key);
5847 return NULL;
5851 #define MISSING_PARAMETER(name) \
5852 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5854 /*******************************************************************
5855 convenience routine to return int parameters.
5856 ********************************************************************/
5857 static int lp_int(const char *s)
5860 if (!s || !*s) {
5861 MISSING_PARAMETER(lp_int);
5862 return (-1);
5865 return (int)strtol(s, NULL, 0);
5868 /*******************************************************************
5869 convenience routine to return unsigned long parameters.
5870 ********************************************************************/
5871 static unsigned long lp_ulong(const char *s)
5874 if (!s || !*s) {
5875 MISSING_PARAMETER(lp_ulong);
5876 return (0);
5879 return strtoul(s, NULL, 0);
5882 /*******************************************************************
5883 convenience routine to return boolean parameters.
5884 ********************************************************************/
5885 static bool lp_bool(const char *s)
5887 bool ret = False;
5889 if (!s || !*s) {
5890 MISSING_PARAMETER(lp_bool);
5891 return False;
5894 if (!set_boolean(s, &ret)) {
5895 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5896 return False;
5899 return ret;
5902 /*******************************************************************
5903 convenience routine to return enum parameters.
5904 ********************************************************************/
5905 static int lp_enum(const char *s,const struct enum_list *_enum)
5907 int i;
5909 if (!s || !*s || !_enum) {
5910 MISSING_PARAMETER(lp_enum);
5911 return (-1);
5914 for (i=0; _enum[i].name; i++) {
5915 if (strequal(_enum[i].name,s))
5916 return _enum[i].value;
5919 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5920 return (-1);
5923 #undef MISSING_PARAMETER
5925 /* DO NOT USE lp_parm_string ANYMORE!!!!
5926 * use lp_parm_const_string or lp_parm_talloc_string
5928 * lp_parm_string is only used to let old modules find this symbol
5930 #undef lp_parm_string
5931 char *lp_parm_string(const char *servicename, const char *type, const char *option);
5932 char *lp_parm_string(const char *servicename, const char *type, const char *option)
5934 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
5937 /* Return parametric option from a given service. Type is a part of option before ':' */
5938 /* Parametric option has following syntax: 'Type: option = value' */
5939 /* the returned value is talloced on the talloc_tos() */
5940 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
5942 struct param_opt_struct *data = get_parametrics(snum, type, option);
5944 if (data == NULL||data->value==NULL) {
5945 if (def) {
5946 return lp_string(def);
5947 } else {
5948 return NULL;
5952 return lp_string(data->value);
5955 /* Return parametric option from a given service. Type is a part of option before ':' */
5956 /* Parametric option has following syntax: 'Type: option = value' */
5957 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
5959 struct param_opt_struct *data = get_parametrics(snum, type, option);
5961 if (data == NULL||data->value==NULL)
5962 return def;
5964 return data->value;
5967 /* Return parametric option from a given service. Type is a part of option before ':' */
5968 /* Parametric option has following syntax: 'Type: option = value' */
5970 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
5972 struct param_opt_struct *data = get_parametrics(snum, type, option);
5974 if (data == NULL||data->value==NULL)
5975 return (const char **)def;
5977 if (data->list==NULL) {
5978 data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL);
5981 return (const char **)data->list;
5984 /* Return parametric option from a given service. Type is a part of option before ':' */
5985 /* Parametric option has following syntax: 'Type: option = value' */
5987 int lp_parm_int(int snum, const char *type, const char *option, int def)
5989 struct param_opt_struct *data = get_parametrics(snum, type, option);
5991 if (data && data->value && *data->value)
5992 return lp_int(data->value);
5994 return def;
5997 /* Return parametric option from a given service. Type is a part of option before ':' */
5998 /* Parametric option has following syntax: 'Type: option = value' */
6000 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
6002 struct param_opt_struct *data = get_parametrics(snum, type, option);
6004 if (data && data->value && *data->value)
6005 return lp_ulong(data->value);
6007 return def;
6010 /* Return parametric option from a given service. Type is a part of option before ':' */
6011 /* Parametric option has following syntax: 'Type: option = value' */
6013 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
6015 struct param_opt_struct *data = get_parametrics(snum, type, option);
6017 if (data && data->value && *data->value)
6018 return lp_bool(data->value);
6020 return def;
6023 /* Return parametric option from a given service. Type is a part of option before ':' */
6024 /* Parametric option has following syntax: 'Type: option = value' */
6026 int lp_parm_enum(int snum, const char *type, const char *option,
6027 const struct enum_list *_enum, int def)
6029 struct param_opt_struct *data = get_parametrics(snum, type, option);
6031 if (data && data->value && *data->value && _enum)
6032 return lp_enum(data->value, _enum);
6034 return def;
6038 /***************************************************************************
6039 Initialise a service to the defaults.
6040 ***************************************************************************/
6042 static void init_service(struct service *pservice)
6044 memset((char *)pservice, '\0', sizeof(struct service));
6045 copy_service(pservice, &sDefault, NULL);
6050 * free a param_opts structure.
6051 * param_opts handling should be moved to talloc;
6052 * then this whole functions reduces to a TALLOC_FREE().
6055 static void free_param_opts(struct param_opt_struct **popts)
6057 struct param_opt_struct *opt, *next_opt;
6059 if (popts == NULL) {
6060 return;
6063 if (*popts != NULL) {
6064 DEBUG(5, ("Freeing parametrics:\n"));
6066 opt = *popts;
6067 while (opt != NULL) {
6068 string_free(&opt->key);
6069 string_free(&opt->value);
6070 TALLOC_FREE(opt->list);
6071 next_opt = opt->next;
6072 SAFE_FREE(opt);
6073 opt = next_opt;
6075 *popts = NULL;
6078 /***************************************************************************
6079 Free the dynamically allocated parts of a service struct.
6080 ***************************************************************************/
6082 static void free_service(struct service *pservice)
6084 if (!pservice)
6085 return;
6087 if (pservice->szService)
6088 DEBUG(5, ("free_service: Freeing service %s\n",
6089 pservice->szService));
6091 free_parameters(pservice);
6093 string_free(&pservice->szService);
6094 bitmap_free(pservice->copymap);
6096 free_param_opts(&pservice->param_opt);
6098 ZERO_STRUCTP(pservice);
6102 /***************************************************************************
6103 remove a service indexed in the ServicePtrs array from the ServiceHash
6104 and free the dynamically allocated parts
6105 ***************************************************************************/
6107 static void free_service_byindex(int idx)
6109 if ( !LP_SNUM_OK(idx) )
6110 return;
6112 ServicePtrs[idx]->valid = False;
6113 invalid_services[num_invalid_services++] = idx;
6115 /* we have to cleanup the hash record */
6117 if (ServicePtrs[idx]->szService) {
6118 char *canon_name = canonicalize_servicename(
6119 talloc_tos(),
6120 ServicePtrs[idx]->szService );
6122 dbwrap_delete_bystring(ServiceHash, canon_name );
6123 TALLOC_FREE(canon_name);
6126 free_service(ServicePtrs[idx]);
6129 /***************************************************************************
6130 Add a new service to the services array initialising it with the given
6131 service.
6132 ***************************************************************************/
6134 static int add_a_service(const struct service *pservice, const char *name)
6136 int i;
6137 struct service tservice;
6138 int num_to_alloc = iNumServices + 1;
6140 tservice = *pservice;
6142 /* it might already exist */
6143 if (name) {
6144 i = getservicebyname(name, NULL);
6145 if (i >= 0) {
6146 /* Clean all parametric options for service */
6147 /* They will be added during parsing again */
6148 free_param_opts(&ServicePtrs[i]->param_opt);
6149 return (i);
6153 /* find an invalid one */
6154 i = iNumServices;
6155 if (num_invalid_services > 0) {
6156 i = invalid_services[--num_invalid_services];
6159 /* if not, then create one */
6160 if (i == iNumServices) {
6161 struct service **tsp;
6162 int *tinvalid;
6164 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
6165 if (tsp == NULL) {
6166 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6167 return (-1);
6169 ServicePtrs = tsp;
6170 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6171 if (!ServicePtrs[iNumServices]) {
6172 DEBUG(0,("add_a_service: out of memory!\n"));
6173 return (-1);
6175 iNumServices++;
6177 /* enlarge invalid_services here for now... */
6178 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6179 num_to_alloc);
6180 if (tinvalid == NULL) {
6181 DEBUG(0,("add_a_service: failed to enlarge "
6182 "invalid_services!\n"));
6183 return (-1);
6185 invalid_services = tinvalid;
6186 } else {
6187 free_service_byindex(i);
6190 ServicePtrs[i]->valid = True;
6192 init_service(ServicePtrs[i]);
6193 copy_service(ServicePtrs[i], &tservice, NULL);
6194 if (name)
6195 string_set(&ServicePtrs[i]->szService, name);
6197 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6198 i, ServicePtrs[i]->szService));
6200 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6201 return (-1);
6204 return (i);
6207 /***************************************************************************
6208 Convert a string to uppercase and remove whitespaces.
6209 ***************************************************************************/
6211 char *canonicalize_servicename(TALLOC_CTX *ctx, const char *src)
6213 char *result;
6215 if ( !src ) {
6216 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6217 return NULL;
6220 result = talloc_strdup(ctx, src);
6221 SMB_ASSERT(result != NULL);
6223 strlower_m(result);
6224 return result;
6227 /***************************************************************************
6228 Add a name/index pair for the services array to the hash table.
6229 ***************************************************************************/
6231 static bool hash_a_service(const char *name, int idx)
6233 char *canon_name;
6235 if ( !ServiceHash ) {
6236 DEBUG(10,("hash_a_service: creating servicehash\n"));
6237 ServiceHash = db_open_rbt(NULL);
6238 if ( !ServiceHash ) {
6239 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6240 return False;
6244 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6245 idx, name));
6247 canon_name = canonicalize_servicename(talloc_tos(), name );
6249 dbwrap_store_bystring(ServiceHash, canon_name,
6250 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6251 TDB_REPLACE);
6253 TALLOC_FREE(canon_name);
6255 return True;
6258 /***************************************************************************
6259 Add a new home service, with the specified home directory, defaults coming
6260 from service ifrom.
6261 ***************************************************************************/
6263 bool lp_add_home(const char *pszHomename, int iDefaultService,
6264 const char *user, const char *pszHomedir)
6266 int i;
6268 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6269 pszHomedir[0] == '\0') {
6270 return false;
6273 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6275 if (i < 0)
6276 return (False);
6278 if (!(*(ServicePtrs[iDefaultService]->szPath))
6279 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6280 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6283 if (!(*(ServicePtrs[i]->comment))) {
6284 char *comment = NULL;
6285 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6286 return false;
6288 string_set(&ServicePtrs[i]->comment, comment);
6289 SAFE_FREE(comment);
6292 /* set the browseable flag from the global default */
6294 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6295 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6297 ServicePtrs[i]->autoloaded = True;
6299 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6300 user, ServicePtrs[i]->szPath ));
6302 return (True);
6305 /***************************************************************************
6306 Add a new service, based on an old one.
6307 ***************************************************************************/
6309 int lp_add_service(const char *pszService, int iDefaultService)
6311 if (iDefaultService < 0) {
6312 return add_a_service(&sDefault, pszService);
6315 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6318 /***************************************************************************
6319 Add the IPC service.
6320 ***************************************************************************/
6322 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
6324 char *comment = NULL;
6325 int i = add_a_service(&sDefault, ipc_name);
6327 if (i < 0)
6328 return (False);
6330 if (asprintf(&comment, "IPC Service (%s)",
6331 Globals.szServerString) < 0) {
6332 return (False);
6335 string_set(&ServicePtrs[i]->szPath, tmpdir());
6336 string_set(&ServicePtrs[i]->szUsername, "");
6337 string_set(&ServicePtrs[i]->comment, comment);
6338 string_set(&ServicePtrs[i]->fstype, "IPC");
6339 ServicePtrs[i]->iMaxConnections = 0;
6340 ServicePtrs[i]->bAvailable = True;
6341 ServicePtrs[i]->bRead_only = True;
6342 ServicePtrs[i]->bGuest_only = False;
6343 ServicePtrs[i]->bAdministrative_share = True;
6344 ServicePtrs[i]->bGuest_ok = guest_ok;
6345 ServicePtrs[i]->bPrint_ok = False;
6346 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6348 DEBUG(3, ("adding IPC service\n"));
6350 SAFE_FREE(comment);
6351 return (True);
6354 /***************************************************************************
6355 Add a new printer service, with defaults coming from service iFrom.
6356 ***************************************************************************/
6358 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
6360 const char *comment = "From Printcap";
6361 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6363 if (i < 0)
6364 return (False);
6366 /* note that we do NOT default the availability flag to True - */
6367 /* we take it from the default service passed. This allows all */
6368 /* dynamic printers to be disabled by disabling the [printers] */
6369 /* entry (if/when the 'available' keyword is implemented!). */
6371 /* the printer name is set to the service name. */
6372 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6373 string_set(&ServicePtrs[i]->comment, comment);
6375 /* set the browseable flag from the gloabl default */
6376 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6378 /* Printers cannot be read_only. */
6379 ServicePtrs[i]->bRead_only = False;
6380 /* No share modes on printer services. */
6381 ServicePtrs[i]->bShareModes = False;
6382 /* No oplocks on printer services. */
6383 ServicePtrs[i]->bOpLocks = False;
6384 /* Printer services must be printable. */
6385 ServicePtrs[i]->bPrint_ok = True;
6387 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6389 return (True);
6393 /***************************************************************************
6394 Check whether the given parameter name is valid.
6395 Parametric options (names containing a colon) are considered valid.
6396 ***************************************************************************/
6398 bool lp_parameter_is_valid(const char *pszParmName)
6400 return ((map_parameter(pszParmName) != -1) ||
6401 (strchr(pszParmName, ':') != NULL));
6404 /***************************************************************************
6405 Check whether the given name is the name of a global parameter.
6406 Returns True for strings belonging to parameters of class
6407 P_GLOBAL, False for all other strings, also for parametric options
6408 and strings not belonging to any option.
6409 ***************************************************************************/
6411 bool lp_parameter_is_global(const char *pszParmName)
6413 int num = map_parameter(pszParmName);
6415 if (num >= 0) {
6416 return (parm_table[num].p_class == P_GLOBAL);
6419 return False;
6422 /**************************************************************************
6423 Check whether the given name is the canonical name of a parameter.
6424 Returns False if it is not a valid parameter Name.
6425 For parametric options, True is returned.
6426 **************************************************************************/
6428 bool lp_parameter_is_canonical(const char *parm_name)
6430 if (!lp_parameter_is_valid(parm_name)) {
6431 return False;
6434 return (map_parameter(parm_name) ==
6435 map_parameter_canonical(parm_name, NULL));
6438 /**************************************************************************
6439 Determine the canonical name for a parameter.
6440 Indicate when it is an inverse (boolean) synonym instead of a
6441 "usual" synonym.
6442 **************************************************************************/
6444 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
6445 bool *inverse)
6447 int num;
6449 if (!lp_parameter_is_valid(parm_name)) {
6450 *canon_parm = NULL;
6451 return False;
6454 num = map_parameter_canonical(parm_name, inverse);
6455 if (num < 0) {
6456 /* parametric option */
6457 *canon_parm = parm_name;
6458 } else {
6459 *canon_parm = parm_table[num].label;
6462 return True;
6466 /**************************************************************************
6467 Determine the canonical name for a parameter.
6468 Turn the value given into the inverse boolean expression when
6469 the synonym is an invers boolean synonym.
6471 Return True if parm_name is a valid parameter name and
6472 in case it is an invers boolean synonym, if the val string could
6473 successfully be converted to the reverse bool.
6474 Return false in all other cases.
6475 **************************************************************************/
6477 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6478 const char *val,
6479 const char **canon_parm,
6480 const char **canon_val)
6482 int num;
6483 bool inverse;
6485 if (!lp_parameter_is_valid(parm_name)) {
6486 *canon_parm = NULL;
6487 *canon_val = NULL;
6488 return False;
6491 num = map_parameter_canonical(parm_name, &inverse);
6492 if (num < 0) {
6493 /* parametric option */
6494 *canon_parm = parm_name;
6495 *canon_val = val;
6496 } else {
6497 *canon_parm = parm_table[num].label;
6498 if (inverse) {
6499 if (!lp_invert_boolean(val, canon_val)) {
6500 *canon_val = NULL;
6501 return False;
6503 } else {
6504 *canon_val = val;
6508 return True;
6511 /***************************************************************************
6512 Map a parameter's string representation to something we can use.
6513 Returns False if the parameter string is not recognised, else TRUE.
6514 ***************************************************************************/
6516 static int map_parameter(const char *pszParmName)
6518 int iIndex;
6520 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6521 return (-1);
6523 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6524 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6525 return (iIndex);
6527 /* Warn only if it isn't parametric option */
6528 if (strchr(pszParmName, ':') == NULL)
6529 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6530 /* We do return 'fail' for parametric options as well because they are
6531 stored in different storage
6533 return (-1);
6536 /***************************************************************************
6537 Map a parameter's string representation to the index of the canonical
6538 form of the parameter (it might be a synonym).
6539 Returns -1 if the parameter string is not recognised.
6540 ***************************************************************************/
6542 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6544 int parm_num, canon_num;
6545 bool loc_inverse = False;
6547 parm_num = map_parameter(pszParmName);
6548 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6549 /* invalid, parametric or no canidate for synonyms ... */
6550 goto done;
6553 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6554 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6555 parm_num = canon_num;
6556 goto done;
6560 done:
6561 if (inverse != NULL) {
6562 *inverse = loc_inverse;
6564 return parm_num;
6567 /***************************************************************************
6568 return true if parameter number parm1 is a synonym of parameter
6569 number parm2 (parm2 being the principal name).
6570 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6571 False otherwise.
6572 ***************************************************************************/
6574 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6576 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6577 (parm_table[parm1].flags & FLAG_HIDE) &&
6578 !(parm_table[parm2].flags & FLAG_HIDE))
6580 if (inverse != NULL) {
6581 if ((parm_table[parm1].type == P_BOOLREV) &&
6582 (parm_table[parm2].type == P_BOOL))
6584 *inverse = True;
6585 } else {
6586 *inverse = False;
6589 return True;
6591 return False;
6594 /***************************************************************************
6595 Show one parameter's name, type, [values,] and flags.
6596 (helper functions for show_parameter_list)
6597 ***************************************************************************/
6599 static void show_parameter(int parmIndex)
6601 int enumIndex, flagIndex;
6602 int parmIndex2;
6603 bool hadFlag;
6604 bool hadSyn;
6605 bool inverse;
6606 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6607 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6608 "P_ENUM", "P_SEP"};
6609 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6610 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6611 FLAG_HIDE, FLAG_DOS_STRING};
6612 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6613 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6614 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6616 printf("%s=%s", parm_table[parmIndex].label,
6617 type[parm_table[parmIndex].type]);
6618 if (parm_table[parmIndex].type == P_ENUM) {
6619 printf(",");
6620 for (enumIndex=0;
6621 parm_table[parmIndex].enum_list[enumIndex].name;
6622 enumIndex++)
6624 printf("%s%s",
6625 enumIndex ? "|" : "",
6626 parm_table[parmIndex].enum_list[enumIndex].name);
6629 printf(",");
6630 hadFlag = False;
6631 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6632 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6633 printf("%s%s",
6634 hadFlag ? "|" : "",
6635 flag_names[flagIndex]);
6636 hadFlag = True;
6640 /* output synonyms */
6641 hadSyn = False;
6642 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6643 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6644 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6645 parm_table[parmIndex2].label);
6646 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6647 if (!hadSyn) {
6648 printf(" (synonyms: ");
6649 hadSyn = True;
6650 } else {
6651 printf(", ");
6653 printf("%s%s", parm_table[parmIndex2].label,
6654 inverse ? "[i]" : "");
6657 if (hadSyn) {
6658 printf(")");
6661 printf("\n");
6664 /***************************************************************************
6665 Show all parameter's name, type, [values,] and flags.
6666 ***************************************************************************/
6668 void show_parameter_list(void)
6670 int classIndex, parmIndex;
6671 const char *section_names[] = { "local", "global", NULL};
6673 for (classIndex=0; section_names[classIndex]; classIndex++) {
6674 printf("[%s]\n", section_names[classIndex]);
6675 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6676 if (parm_table[parmIndex].p_class == classIndex) {
6677 show_parameter(parmIndex);
6683 /***************************************************************************
6684 Check if a given string correctly represents a boolean value.
6685 ***************************************************************************/
6687 bool lp_string_is_valid_boolean(const char *parm_value)
6689 return set_boolean(parm_value, NULL);
6692 /***************************************************************************
6693 Get the standard string representation of a boolean value ("yes" or "no")
6694 ***************************************************************************/
6696 static const char *get_boolean(bool bool_value)
6698 static const char *yes_str = "yes";
6699 static const char *no_str = "no";
6701 return (bool_value ? yes_str : no_str);
6704 /***************************************************************************
6705 Provide the string of the negated boolean value associated to the boolean
6706 given as a string. Returns False if the passed string does not correctly
6707 represent a boolean.
6708 ***************************************************************************/
6710 bool lp_invert_boolean(const char *str, const char **inverse_str)
6712 bool val;
6714 if (!set_boolean(str, &val)) {
6715 return False;
6718 *inverse_str = get_boolean(!val);
6719 return True;
6722 /***************************************************************************
6723 Provide the canonical string representation of a boolean value given
6724 as a string. Return True on success, False if the string given does
6725 not correctly represent a boolean.
6726 ***************************************************************************/
6728 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6730 bool val;
6732 if (!set_boolean(str, &val)) {
6733 return False;
6736 *canon_str = get_boolean(val);
6737 return True;
6740 /***************************************************************************
6741 Find a service by name. Otherwise works like get_service.
6742 ***************************************************************************/
6744 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6746 int iService = -1;
6747 char *canon_name;
6748 TDB_DATA data;
6750 if (ServiceHash == NULL) {
6751 return -1;
6754 canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
6756 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6758 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6759 iService = *(int *)data.dptr;
6762 TALLOC_FREE(canon_name);
6764 if ((iService != -1) && (LP_SNUM_OK(iService))
6765 && (pserviceDest != NULL)) {
6766 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6769 return (iService);
6772 /***************************************************************************
6773 Copy a service structure to another.
6774 If pcopymapDest is NULL then copy all fields
6775 ***************************************************************************/
6778 * Add a parametric option to a param_opt_struct,
6779 * replacing old value, if already present.
6781 static void set_param_opt(struct param_opt_struct **opt_list,
6782 const char *opt_name,
6783 const char *opt_value)
6785 struct param_opt_struct *new_opt, *opt;
6786 bool not_added;
6788 if (opt_list == NULL) {
6789 return;
6792 opt = *opt_list;
6793 not_added = true;
6795 /* Traverse destination */
6796 while (opt) {
6797 /* If we already have same option, override it */
6798 if (strwicmp(opt->key, opt_name) == 0) {
6799 string_free(&opt->value);
6800 TALLOC_FREE(opt->list);
6801 opt->value = SMB_STRDUP(opt_value);
6802 not_added = false;
6803 break;
6805 opt = opt->next;
6807 if (not_added) {
6808 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6809 new_opt->key = SMB_STRDUP(opt_name);
6810 new_opt->value = SMB_STRDUP(opt_value);
6811 new_opt->list = NULL;
6812 DLIST_ADD(*opt_list, new_opt);
6816 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6817 struct bitmap *pcopymapDest)
6819 int i;
6820 bool bcopyall = (pcopymapDest == NULL);
6821 struct param_opt_struct *data;
6823 for (i = 0; parm_table[i].label; i++)
6824 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6825 (bcopyall || bitmap_query(pcopymapDest,i))) {
6826 void *def_ptr = parm_table[i].ptr;
6827 void *src_ptr =
6828 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6829 &sDefault);
6830 void *dest_ptr =
6831 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6832 &sDefault);
6834 switch (parm_table[i].type) {
6835 case P_BOOL:
6836 case P_BOOLREV:
6837 *(bool *)dest_ptr = *(bool *)src_ptr;
6838 break;
6840 case P_INTEGER:
6841 case P_ENUM:
6842 case P_OCTAL:
6843 *(int *)dest_ptr = *(int *)src_ptr;
6844 break;
6846 case P_CHAR:
6847 *(char *)dest_ptr = *(char *)src_ptr;
6848 break;
6850 case P_STRING:
6851 string_set((char **)dest_ptr,
6852 *(char **)src_ptr);
6853 break;
6855 case P_USTRING:
6856 string_set((char **)dest_ptr,
6857 *(char **)src_ptr);
6858 strupper_m(*(char **)dest_ptr);
6859 break;
6860 case P_LIST:
6861 TALLOC_FREE(*((char ***)dest_ptr));
6862 *((char ***)dest_ptr) = str_list_copy(NULL,
6863 *(const char ***)src_ptr);
6864 break;
6865 default:
6866 break;
6870 if (bcopyall) {
6871 init_copymap(pserviceDest);
6872 if (pserviceSource->copymap)
6873 bitmap_copy(pserviceDest->copymap,
6874 pserviceSource->copymap);
6877 data = pserviceSource->param_opt;
6878 while (data) {
6879 set_param_opt(&pserviceDest->param_opt, data->key, data->value);
6880 data = data->next;
6884 /***************************************************************************
6885 Check a service for consistency. Return False if the service is in any way
6886 incomplete or faulty, else True.
6887 ***************************************************************************/
6889 bool service_ok(int iService)
6891 bool bRetval;
6893 bRetval = True;
6894 if (ServicePtrs[iService]->szService[0] == '\0') {
6895 DEBUG(0, ("The following message indicates an internal error:\n"));
6896 DEBUG(0, ("No service name in service entry.\n"));
6897 bRetval = False;
6900 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6901 /* I can't see why you'd want a non-printable printer service... */
6902 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6903 if (!ServicePtrs[iService]->bPrint_ok) {
6904 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6905 ServicePtrs[iService]->szService));
6906 ServicePtrs[iService]->bPrint_ok = True;
6908 /* [printers] service must also be non-browsable. */
6909 if (ServicePtrs[iService]->bBrowseable)
6910 ServicePtrs[iService]->bBrowseable = False;
6913 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6914 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6915 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6917 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6918 ServicePtrs[iService]->szService));
6919 ServicePtrs[iService]->bAvailable = False;
6922 /* If a service is flagged unavailable, log the fact at level 1. */
6923 if (!ServicePtrs[iService]->bAvailable)
6924 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6925 ServicePtrs[iService]->szService));
6927 return (bRetval);
6930 static struct smbconf_ctx *lp_smbconf_ctx(void)
6932 WERROR werr;
6933 static struct smbconf_ctx *conf_ctx = NULL;
6935 if (conf_ctx == NULL) {
6936 werr = smbconf_init(NULL, &conf_ctx, "registry:");
6937 if (!W_ERROR_IS_OK(werr)) {
6938 DEBUG(1, ("error initializing registry configuration: "
6939 "%s\n", win_errstr(werr)));
6940 conf_ctx = NULL;
6944 return conf_ctx;
6947 static bool process_smbconf_service(struct smbconf_service *service)
6949 uint32_t count;
6950 bool ret;
6952 if (service == NULL) {
6953 return false;
6956 ret = do_section(service->name, NULL);
6957 if (ret != true) {
6958 return false;
6960 for (count = 0; count < service->num_params; count++) {
6961 ret = do_parameter(service->param_names[count],
6962 service->param_values[count],
6963 NULL);
6964 if (ret != true) {
6965 return false;
6968 if (iServiceIndex >= 0) {
6969 return service_ok(iServiceIndex);
6971 return true;
6975 * load a service from registry and activate it
6977 bool process_registry_service(const char *service_name)
6979 WERROR werr;
6980 struct smbconf_service *service = NULL;
6981 TALLOC_CTX *mem_ctx = talloc_stackframe();
6982 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6983 bool ret = false;
6985 if (conf_ctx == NULL) {
6986 goto done;
6989 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
6991 if (!smbconf_share_exists(conf_ctx, service_name)) {
6993 * Registry does not contain data for this service (yet),
6994 * but make sure lp_load doesn't return false.
6996 ret = true;
6997 goto done;
7000 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
7001 if (!W_ERROR_IS_OK(werr)) {
7002 goto done;
7005 ret = process_smbconf_service(service);
7006 if (!ret) {
7007 goto done;
7010 /* store the csn */
7011 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7013 done:
7014 TALLOC_FREE(mem_ctx);
7015 return ret;
7019 * process_registry_globals
7021 static bool process_registry_globals(void)
7023 bool ret;
7025 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
7027 ret = do_parameter("registry shares", "yes", NULL);
7028 if (!ret) {
7029 return ret;
7032 return process_registry_service(GLOBAL_NAME);
7035 bool process_registry_shares(void)
7037 WERROR werr;
7038 uint32_t count;
7039 struct smbconf_service **service = NULL;
7040 uint32_t num_shares = 0;
7041 TALLOC_CTX *mem_ctx = talloc_stackframe();
7042 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7043 bool ret = false;
7045 if (conf_ctx == NULL) {
7046 goto done;
7049 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
7050 if (!W_ERROR_IS_OK(werr)) {
7051 goto done;
7054 ret = true;
7056 for (count = 0; count < num_shares; count++) {
7057 if (strequal(service[count]->name, GLOBAL_NAME)) {
7058 continue;
7060 ret = process_smbconf_service(service[count]);
7061 if (!ret) {
7062 goto done;
7066 /* store the csn */
7067 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
7069 done:
7070 TALLOC_FREE(mem_ctx);
7071 return ret;
7074 #define MAX_INCLUDE_DEPTH 100
7076 static uint8_t include_depth;
7078 static struct file_lists {
7079 struct file_lists *next;
7080 char *name;
7081 char *subfname;
7082 time_t modtime;
7083 } *file_lists = NULL;
7085 /*******************************************************************
7086 Keep a linked list of all config files so we know when one has changed
7087 it's date and needs to be reloaded.
7088 ********************************************************************/
7090 static void add_to_file_list(const char *fname, const char *subfname)
7092 struct file_lists *f = file_lists;
7094 while (f) {
7095 if (f->name && !strcmp(f->name, fname))
7096 break;
7097 f = f->next;
7100 if (!f) {
7101 f = SMB_MALLOC_P(struct file_lists);
7102 if (!f)
7103 return;
7104 f->next = file_lists;
7105 f->name = SMB_STRDUP(fname);
7106 if (!f->name) {
7107 SAFE_FREE(f);
7108 return;
7110 f->subfname = SMB_STRDUP(subfname);
7111 if (!f->subfname) {
7112 SAFE_FREE(f->name);
7113 SAFE_FREE(f);
7114 return;
7116 file_lists = f;
7117 f->modtime = file_modtime(subfname);
7118 } else {
7119 time_t t = file_modtime(subfname);
7120 if (t)
7121 f->modtime = t;
7123 return;
7127 * Free the file lists
7129 static void free_file_list(void)
7131 struct file_lists *f;
7132 struct file_lists *next;
7134 f = file_lists;
7135 while( f ) {
7136 next = f->next;
7137 SAFE_FREE( f->name );
7138 SAFE_FREE( f->subfname );
7139 SAFE_FREE( f );
7140 f = next;
7142 file_lists = NULL;
7147 * Utility function for outsiders to check if we're running on registry.
7149 bool lp_config_backend_is_registry(void)
7151 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
7155 * Utility function to check if the config backend is FILE.
7157 bool lp_config_backend_is_file(void)
7159 return (lp_config_backend() == CONFIG_BACKEND_FILE);
7162 /*******************************************************************
7163 Check if a config file has changed date.
7164 ********************************************************************/
7166 bool lp_file_list_changed(void)
7168 struct file_lists *f = file_lists;
7170 DEBUG(6, ("lp_file_list_changed()\n"));
7172 while (f) {
7173 time_t mod_time;
7175 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7176 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7178 if (conf_ctx == NULL) {
7179 return false;
7181 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7182 NULL))
7184 DEBUGADD(6, ("registry config changed\n"));
7185 return true;
7187 } else {
7188 char *n2 = NULL;
7189 n2 = talloc_sub_basic(talloc_tos(),
7190 get_current_username(),
7191 current_user_info.domain,
7192 f->name);
7193 if (!n2) {
7194 return false;
7196 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7197 f->name, n2, ctime(&f->modtime)));
7199 mod_time = file_modtime(n2);
7201 if (mod_time &&
7202 ((f->modtime != mod_time) ||
7203 (f->subfname == NULL) ||
7204 (strcmp(n2, f->subfname) != 0)))
7206 DEBUGADD(6,
7207 ("file %s modified: %s\n", n2,
7208 ctime(&mod_time)));
7209 f->modtime = mod_time;
7210 SAFE_FREE(f->subfname);
7211 f->subfname = SMB_STRDUP(n2);
7212 TALLOC_FREE(n2);
7213 return true;
7215 TALLOC_FREE(n2);
7217 f = f->next;
7219 return (False);
7223 /***************************************************************************
7224 Run standard_sub_basic on netbios name... needed because global_myname
7225 is not accessed through any lp_ macro.
7226 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7227 ***************************************************************************/
7229 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
7231 bool ret;
7232 char *netbios_name = talloc_sub_basic(
7233 talloc_tos(), get_current_username(), current_user_info.domain,
7234 pszParmValue);
7236 ret = set_global_myname(netbios_name);
7237 TALLOC_FREE(netbios_name);
7238 string_set(&Globals.szNetbiosName,global_myname());
7240 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7241 global_myname()));
7243 return ret;
7246 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
7248 if (strcmp(*ptr, pszParmValue) != 0) {
7249 string_set(ptr, pszParmValue);
7250 init_iconv();
7252 return True;
7257 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
7259 bool ret;
7261 ret = set_global_myworkgroup(pszParmValue);
7262 string_set(&Globals.szWorkgroup,lp_workgroup());
7264 return ret;
7267 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
7269 bool ret;
7271 ret = set_global_scope(pszParmValue);
7272 string_set(&Globals.szNetbiosScope,global_scope());
7274 return ret;
7277 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
7279 TALLOC_FREE(Globals.szNetbiosAliases);
7280 Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL);
7281 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7284 /***************************************************************************
7285 Handle the include operation.
7286 ***************************************************************************/
7287 static bool bAllowIncludeRegistry = true;
7289 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
7291 char *fname;
7293 if (include_depth >= MAX_INCLUDE_DEPTH) {
7294 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7295 include_depth));
7296 return false;
7299 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7300 if (!bAllowIncludeRegistry) {
7301 return true;
7303 if (bInGlobalSection) {
7304 bool ret;
7305 include_depth++;
7306 ret = process_registry_globals();
7307 include_depth--;
7308 return ret;
7309 } else {
7310 DEBUG(1, ("\"include = registry\" only effective "
7311 "in %s section\n", GLOBAL_NAME));
7312 return false;
7316 fname = talloc_sub_basic(talloc_tos(), get_current_username(),
7317 current_user_info.domain,
7318 pszParmValue);
7320 add_to_file_list(pszParmValue, fname);
7322 string_set(ptr, fname);
7324 if (file_exist(fname)) {
7325 bool ret;
7326 include_depth++;
7327 ret = pm_process(fname, do_section, do_parameter, NULL);
7328 include_depth--;
7329 TALLOC_FREE(fname);
7330 return ret;
7333 DEBUG(2, ("Can't find include file %s\n", fname));
7334 TALLOC_FREE(fname);
7335 return true;
7338 /***************************************************************************
7339 Handle the interpretation of the copy parameter.
7340 ***************************************************************************/
7342 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
7344 bool bRetval;
7345 int iTemp;
7346 struct service serviceTemp;
7348 string_set(ptr, pszParmValue);
7350 init_service(&serviceTemp);
7352 bRetval = False;
7354 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7356 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7357 if (iTemp == iServiceIndex) {
7358 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7359 } else {
7360 copy_service(ServicePtrs[iServiceIndex],
7361 &serviceTemp,
7362 ServicePtrs[iServiceIndex]->copymap);
7363 bRetval = True;
7365 } else {
7366 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7367 bRetval = False;
7370 free_service(&serviceTemp);
7371 return (bRetval);
7374 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
7376 Globals.ldap_debug_level = lp_int(pszParmValue);
7377 init_ldap_debugging();
7378 return true;
7381 /***************************************************************************
7382 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7383 parameters is:
7385 [global]
7387 idmap uid = 1000-1999
7388 idmap gid = 700-899
7390 We only do simple parsing checks here. The strings are parsed into useful
7391 structures in the idmap daemon code.
7393 ***************************************************************************/
7395 /* Some lp_ routines to return idmap [ug]id information */
7397 static uid_t idmap_uid_low, idmap_uid_high;
7398 static gid_t idmap_gid_low, idmap_gid_high;
7400 bool lp_idmap_uid(uid_t *low, uid_t *high)
7402 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7403 return False;
7405 if (low)
7406 *low = idmap_uid_low;
7408 if (high)
7409 *high = idmap_uid_high;
7411 return True;
7414 bool lp_idmap_gid(gid_t *low, gid_t *high)
7416 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7417 return False;
7419 if (low)
7420 *low = idmap_gid_low;
7422 if (high)
7423 *high = idmap_gid_high;
7425 return True;
7428 /* Do some simple checks on "idmap [ug]id" parameter values */
7430 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
7432 uint32 low, high;
7434 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7435 return False;
7437 /* Parse OK */
7439 string_set(ptr, pszParmValue);
7441 idmap_uid_low = low;
7442 idmap_uid_high = high;
7444 return True;
7447 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
7449 uint32 low, high;
7451 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7452 return False;
7454 /* Parse OK */
7456 string_set(ptr, pszParmValue);
7458 idmap_gid_low = low;
7459 idmap_gid_high = high;
7461 return True;
7464 /***************************************************************************
7465 Handle the DEBUG level list.
7466 ***************************************************************************/
7468 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
7470 string_set(ptr, pszParmValueIn);
7471 return debug_parse_levels(pszParmValueIn);
7474 /***************************************************************************
7475 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7476 ***************************************************************************/
7478 static const char *append_ldap_suffix( const char *str )
7480 const char *suffix_string;
7483 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7484 Globals.szLdapSuffix );
7485 if ( !suffix_string ) {
7486 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7487 return "";
7490 return suffix_string;
7493 const char *lp_ldap_machine_suffix(void)
7495 if (Globals.szLdapMachineSuffix[0])
7496 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7498 return lp_string(Globals.szLdapSuffix);
7501 const char *lp_ldap_user_suffix(void)
7503 if (Globals.szLdapUserSuffix[0])
7504 return append_ldap_suffix(Globals.szLdapUserSuffix);
7506 return lp_string(Globals.szLdapSuffix);
7509 const char *lp_ldap_group_suffix(void)
7511 if (Globals.szLdapGroupSuffix[0])
7512 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7514 return lp_string(Globals.szLdapSuffix);
7517 const char *lp_ldap_idmap_suffix(void)
7519 if (Globals.szLdapIdmapSuffix[0])
7520 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7522 return lp_string(Globals.szLdapSuffix);
7525 /****************************************************************************
7526 set the value for a P_ENUM
7527 ***************************************************************************/
7529 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
7530 int *ptr )
7532 int i;
7534 for (i = 0; parm->enum_list[i].name; i++) {
7535 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7536 *ptr = parm->enum_list[i].value;
7537 return;
7540 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7541 pszParmValue, parm->label));
7544 /***************************************************************************
7545 ***************************************************************************/
7547 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
7549 static int parm_num = -1;
7550 struct service *s;
7552 if ( parm_num == -1 )
7553 parm_num = map_parameter( "printing" );
7555 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7557 if ( snum < 0 )
7558 s = &sDefault;
7559 else
7560 s = ServicePtrs[snum];
7562 init_printer_values( s );
7564 return True;
7568 /***************************************************************************
7569 Initialise a copymap.
7570 ***************************************************************************/
7572 static void init_copymap(struct service *pservice)
7574 int i;
7575 if (pservice->copymap) {
7576 bitmap_free(pservice->copymap);
7578 pservice->copymap = bitmap_allocate(NUMPARAMETERS);
7579 if (!pservice->copymap)
7580 DEBUG(0,
7581 ("Couldn't allocate copymap!! (size %d)\n",
7582 (int)NUMPARAMETERS));
7583 else
7584 for (i = 0; i < NUMPARAMETERS; i++)
7585 bitmap_set(pservice->copymap, i);
7588 /***************************************************************************
7589 Return the local pointer to a parameter given a service struct and the
7590 pointer into the default structure.
7591 ***************************************************************************/
7593 static void *lp_local_ptr(struct service *service, void *ptr)
7595 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7598 /***************************************************************************
7599 Return the local pointer to a parameter given the service number and the
7600 pointer into the default structure.
7601 ***************************************************************************/
7603 void *lp_local_ptr_by_snum(int snum, void *ptr)
7605 return lp_local_ptr(ServicePtrs[snum], ptr);
7608 /***************************************************************************
7609 Process a parameter for a particular service number. If snum < 0
7610 then assume we are in the globals.
7611 ***************************************************************************/
7613 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7615 int parmnum, i;
7616 void *parm_ptr = NULL; /* where we are going to store the result */
7617 void *def_ptr = NULL;
7618 struct param_opt_struct **opt_list;
7620 parmnum = map_parameter(pszParmName);
7622 if (parmnum < 0) {
7623 if (strchr(pszParmName, ':') == NULL) {
7624 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7625 pszParmName));
7626 return (True);
7630 * We've got a parametric option
7633 opt_list = (snum < 0)
7634 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7635 set_param_opt(opt_list, pszParmName, pszParmValue);
7637 return (True);
7640 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7641 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7642 pszParmName));
7645 def_ptr = parm_table[parmnum].ptr;
7647 /* we might point at a service, the default service or a global */
7648 if (snum < 0) {
7649 parm_ptr = def_ptr;
7650 } else {
7651 if (parm_table[parmnum].p_class == P_GLOBAL) {
7652 DEBUG(0,
7653 ("Global parameter %s found in service section!\n",
7654 pszParmName));
7655 return (True);
7657 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7660 if (snum >= 0) {
7661 if (!ServicePtrs[snum]->copymap)
7662 init_copymap(ServicePtrs[snum]);
7664 /* this handles the aliases - set the copymap for other entries with
7665 the same data pointer */
7666 for (i = 0; parm_table[i].label; i++)
7667 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7668 bitmap_clear(ServicePtrs[snum]->copymap, i);
7671 /* if it is a special case then go ahead */
7672 if (parm_table[parmnum].special) {
7673 return parm_table[parmnum].special(snum, pszParmValue,
7674 (char **)parm_ptr);
7677 /* now switch on the type of variable it is */
7678 switch (parm_table[parmnum].type)
7680 case P_BOOL:
7681 *(bool *)parm_ptr = lp_bool(pszParmValue);
7682 break;
7684 case P_BOOLREV:
7685 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7686 break;
7688 case P_INTEGER:
7689 *(int *)parm_ptr = lp_int(pszParmValue);
7690 break;
7692 case P_CHAR:
7693 *(char *)parm_ptr = *pszParmValue;
7694 break;
7696 case P_OCTAL:
7697 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7698 if ( i != 1 ) {
7699 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7701 break;
7703 case P_LIST:
7704 TALLOC_FREE(*((char ***)parm_ptr));
7705 *(char ***)parm_ptr = str_list_make_v3(
7706 talloc_autofree_context(), pszParmValue, NULL);
7707 break;
7709 case P_STRING:
7710 string_set((char **)parm_ptr, pszParmValue);
7711 break;
7713 case P_USTRING:
7714 string_set((char **)parm_ptr, pszParmValue);
7715 strupper_m(*(char **)parm_ptr);
7716 break;
7718 case P_ENUM:
7719 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7720 break;
7721 case P_SEP:
7722 break;
7725 return (True);
7728 /***************************************************************************
7729 Process a parameter.
7730 ***************************************************************************/
7732 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
7733 void *userdata)
7735 if (!bInGlobalSection && bGlobalOnly)
7736 return (True);
7738 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7740 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7741 pszParmName, pszParmValue));
7744 /***************************************************************************
7745 Print a parameter of the specified type.
7746 ***************************************************************************/
7748 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7750 int i;
7751 switch (p->type)
7753 case P_ENUM:
7754 for (i = 0; p->enum_list[i].name; i++) {
7755 if (*(int *)ptr == p->enum_list[i].value) {
7756 fprintf(f, "%s",
7757 p->enum_list[i].name);
7758 break;
7761 break;
7763 case P_BOOL:
7764 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7765 break;
7767 case P_BOOLREV:
7768 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7769 break;
7771 case P_INTEGER:
7772 fprintf(f, "%d", *(int *)ptr);
7773 break;
7775 case P_CHAR:
7776 fprintf(f, "%c", *(char *)ptr);
7777 break;
7779 case P_OCTAL: {
7780 char *o = octal_string(*(int *)ptr);
7781 fprintf(f, "%s", o);
7782 TALLOC_FREE(o);
7783 break;
7786 case P_LIST:
7787 if ((char ***)ptr && *(char ***)ptr) {
7788 char **list = *(char ***)ptr;
7789 for (; *list; list++) {
7790 /* surround strings with whitespace in double quotes */
7791 if ( strchr_m( *list, ' ' ) )
7792 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
7793 else
7794 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
7797 break;
7799 case P_STRING:
7800 case P_USTRING:
7801 if (*(char **)ptr) {
7802 fprintf(f, "%s", *(char **)ptr);
7804 break;
7805 case P_SEP:
7806 break;
7810 /***************************************************************************
7811 Check if two parameters are equal.
7812 ***************************************************************************/
7814 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
7816 switch (type) {
7817 case P_BOOL:
7818 case P_BOOLREV:
7819 return (*((bool *)ptr1) == *((bool *)ptr2));
7821 case P_INTEGER:
7822 case P_ENUM:
7823 case P_OCTAL:
7824 return (*((int *)ptr1) == *((int *)ptr2));
7826 case P_CHAR:
7827 return (*((char *)ptr1) == *((char *)ptr2));
7829 case P_LIST:
7830 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
7832 case P_STRING:
7833 case P_USTRING:
7835 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7836 if (p1 && !*p1)
7837 p1 = NULL;
7838 if (p2 && !*p2)
7839 p2 = NULL;
7840 return (p1 == p2 || strequal(p1, p2));
7842 case P_SEP:
7843 break;
7845 return (False);
7848 /***************************************************************************
7849 Initialize any local varients in the sDefault table.
7850 ***************************************************************************/
7852 void init_locals(void)
7854 /* None as yet. */
7857 /***************************************************************************
7858 Process a new section (service). At this stage all sections are services.
7859 Later we'll have special sections that permit server parameters to be set.
7860 Returns True on success, False on failure.
7861 ***************************************************************************/
7863 static bool do_section(const char *pszSectionName, void *userdata)
7865 bool bRetval;
7866 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7867 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7868 bRetval = False;
7870 /* if we were in a global section then do the local inits */
7871 if (bInGlobalSection && !isglobal)
7872 init_locals();
7874 /* if we've just struck a global section, note the fact. */
7875 bInGlobalSection = isglobal;
7877 /* check for multiple global sections */
7878 if (bInGlobalSection) {
7879 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7880 return (True);
7883 if (!bInGlobalSection && bGlobalOnly)
7884 return (True);
7886 /* if we have a current service, tidy it up before moving on */
7887 bRetval = True;
7889 if (iServiceIndex >= 0)
7890 bRetval = service_ok(iServiceIndex);
7892 /* if all is still well, move to the next record in the services array */
7893 if (bRetval) {
7894 /* We put this here to avoid an odd message order if messages are */
7895 /* issued by the post-processing of a previous section. */
7896 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7898 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
7899 < 0) {
7900 DEBUG(0, ("Failed to add a new service\n"));
7901 return (False);
7905 return (bRetval);
7909 /***************************************************************************
7910 Determine if a partcular base parameter is currentl set to the default value.
7911 ***************************************************************************/
7913 static bool is_default(int i)
7915 if (!defaults_saved)
7916 return False;
7917 switch (parm_table[i].type) {
7918 case P_LIST:
7919 return str_list_equal((const char **)parm_table[i].def.lvalue,
7920 *(const char ***)parm_table[i].ptr);
7921 case P_STRING:
7922 case P_USTRING:
7923 return strequal(parm_table[i].def.svalue,
7924 *(char **)parm_table[i].ptr);
7925 case P_BOOL:
7926 case P_BOOLREV:
7927 return parm_table[i].def.bvalue ==
7928 *(bool *)parm_table[i].ptr;
7929 case P_CHAR:
7930 return parm_table[i].def.cvalue ==
7931 *(char *)parm_table[i].ptr;
7932 case P_INTEGER:
7933 case P_OCTAL:
7934 case P_ENUM:
7935 return parm_table[i].def.ivalue ==
7936 *(int *)parm_table[i].ptr;
7937 case P_SEP:
7938 break;
7940 return False;
7943 /***************************************************************************
7944 Display the contents of the global structure.
7945 ***************************************************************************/
7947 static void dump_globals(FILE *f)
7949 int i;
7950 struct param_opt_struct *data;
7952 fprintf(f, "[global]\n");
7954 for (i = 0; parm_table[i].label; i++)
7955 if (parm_table[i].p_class == P_GLOBAL &&
7956 !(parm_table[i].flags & FLAG_META) &&
7957 parm_table[i].ptr &&
7958 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
7959 if (defaults_saved && is_default(i))
7960 continue;
7961 fprintf(f, "\t%s = ", parm_table[i].label);
7962 print_parameter(&parm_table[i], parm_table[i].ptr, f);
7963 fprintf(f, "\n");
7965 if (Globals.param_opt != NULL) {
7966 data = Globals.param_opt;
7967 while(data) {
7968 fprintf(f, "\t%s = %s\n", data->key, data->value);
7969 data = data->next;
7975 /***************************************************************************
7976 Return True if a local parameter is currently set to the global default.
7977 ***************************************************************************/
7979 bool lp_is_default(int snum, struct parm_struct *parm)
7981 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
7983 return equal_parameter(parm->type,
7984 ((char *)ServicePtrs[snum]) + pdiff,
7985 ((char *)&sDefault) + pdiff);
7988 /***************************************************************************
7989 Display the contents of a single services record.
7990 ***************************************************************************/
7992 static void dump_a_service(struct service *pService, FILE * f)
7994 int i;
7995 struct param_opt_struct *data;
7997 if (pService != &sDefault)
7998 fprintf(f, "[%s]\n", pService->szService);
8000 for (i = 0; parm_table[i].label; i++) {
8002 if (parm_table[i].p_class == P_LOCAL &&
8003 !(parm_table[i].flags & FLAG_META) &&
8004 parm_table[i].ptr &&
8005 (*parm_table[i].label != '-') &&
8006 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8008 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
8010 if (pService == &sDefault) {
8011 if (defaults_saved && is_default(i))
8012 continue;
8013 } else {
8014 if (equal_parameter(parm_table[i].type,
8015 ((char *)pService) +
8016 pdiff,
8017 ((char *)&sDefault) +
8018 pdiff))
8019 continue;
8022 fprintf(f, "\t%s = ", parm_table[i].label);
8023 print_parameter(&parm_table[i],
8024 ((char *)pService) + pdiff, f);
8025 fprintf(f, "\n");
8029 if (pService->param_opt != NULL) {
8030 data = pService->param_opt;
8031 while(data) {
8032 fprintf(f, "\t%s = %s\n", data->key, data->value);
8033 data = data->next;
8038 /***************************************************************************
8039 Display the contents of a parameter of a single services record.
8040 ***************************************************************************/
8042 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
8044 int i;
8045 bool result = False;
8046 parm_class p_class;
8047 unsigned flag = 0;
8048 fstring local_parm_name;
8049 char *parm_opt;
8050 const char *parm_opt_value;
8052 /* check for parametrical option */
8053 fstrcpy( local_parm_name, parm_name);
8054 parm_opt = strchr( local_parm_name, ':');
8056 if (parm_opt) {
8057 *parm_opt = '\0';
8058 parm_opt++;
8059 if (strlen(parm_opt)) {
8060 parm_opt_value = lp_parm_const_string( snum,
8061 local_parm_name, parm_opt, NULL);
8062 if (parm_opt_value) {
8063 printf( "%s\n", parm_opt_value);
8064 result = True;
8067 return result;
8070 /* check for a key and print the value */
8071 if (isGlobal) {
8072 p_class = P_GLOBAL;
8073 flag = FLAG_GLOBAL;
8074 } else
8075 p_class = P_LOCAL;
8077 for (i = 0; parm_table[i].label; i++) {
8078 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
8079 !(parm_table[i].flags & FLAG_META) &&
8080 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
8081 parm_table[i].ptr &&
8082 (*parm_table[i].label != '-') &&
8083 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8085 void *ptr;
8087 if (isGlobal) {
8088 ptr = parm_table[i].ptr;
8089 } else {
8090 struct service *pService = ServicePtrs[snum];
8091 ptr = ((char *)pService) +
8092 PTR_DIFF(parm_table[i].ptr, &sDefault);
8095 print_parameter(&parm_table[i],
8096 ptr, f);
8097 fprintf(f, "\n");
8098 result = True;
8099 break;
8103 return result;
8106 /***************************************************************************
8107 Return info about the requested parameter (given as a string).
8108 Return NULL when the string is not a valid parameter name.
8109 ***************************************************************************/
8111 struct parm_struct *lp_get_parameter(const char *param_name)
8113 int num = map_parameter(param_name);
8115 if (num < 0) {
8116 return NULL;
8119 return &parm_table[num];
8122 /***************************************************************************
8123 Return info about the next parameter in a service.
8124 snum==GLOBAL_SECTION_SNUM gives the globals.
8125 Return NULL when out of parameters.
8126 ***************************************************************************/
8128 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
8130 if (snum < 0) {
8131 /* do the globals */
8132 for (; parm_table[*i].label; (*i)++) {
8133 if (parm_table[*i].p_class == P_SEPARATOR)
8134 return &parm_table[(*i)++];
8136 if (!parm_table[*i].ptr
8137 || (*parm_table[*i].label == '-'))
8138 continue;
8140 if ((*i) > 0
8141 && (parm_table[*i].ptr ==
8142 parm_table[(*i) - 1].ptr))
8143 continue;
8145 if (is_default(*i) && !allparameters)
8146 continue;
8148 return &parm_table[(*i)++];
8150 } else {
8151 struct service *pService = ServicePtrs[snum];
8153 for (; parm_table[*i].label; (*i)++) {
8154 if (parm_table[*i].p_class == P_SEPARATOR)
8155 return &parm_table[(*i)++];
8157 if (parm_table[*i].p_class == P_LOCAL &&
8158 parm_table[*i].ptr &&
8159 (*parm_table[*i].label != '-') &&
8160 ((*i) == 0 ||
8161 (parm_table[*i].ptr !=
8162 parm_table[(*i) - 1].ptr)))
8164 int pdiff =
8165 PTR_DIFF(parm_table[*i].ptr,
8166 &sDefault);
8168 if (allparameters ||
8169 !equal_parameter(parm_table[*i].type,
8170 ((char *)pService) +
8171 pdiff,
8172 ((char *)&sDefault) +
8173 pdiff))
8175 return &parm_table[(*i)++];
8181 return NULL;
8185 #if 0
8186 /***************************************************************************
8187 Display the contents of a single copy structure.
8188 ***************************************************************************/
8189 static void dump_copy_map(bool *pcopymap)
8191 int i;
8192 if (!pcopymap)
8193 return;
8195 printf("\n\tNon-Copied parameters:\n");
8197 for (i = 0; parm_table[i].label; i++)
8198 if (parm_table[i].p_class == P_LOCAL &&
8199 parm_table[i].ptr && !pcopymap[i] &&
8200 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8202 printf("\t\t%s\n", parm_table[i].label);
8205 #endif
8207 /***************************************************************************
8208 Return TRUE if the passed service number is within range.
8209 ***************************************************************************/
8211 bool lp_snum_ok(int iService)
8213 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8216 /***************************************************************************
8217 Auto-load some home services.
8218 ***************************************************************************/
8220 static void lp_add_auto_services(char *str)
8222 char *s;
8223 char *p;
8224 int homes;
8225 char *saveptr;
8227 if (!str)
8228 return;
8230 s = SMB_STRDUP(str);
8231 if (!s)
8232 return;
8234 homes = lp_servicenumber(HOMES_NAME);
8236 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8237 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8238 char *home;
8240 if (lp_servicenumber(p) >= 0)
8241 continue;
8243 home = get_user_home_dir(talloc_tos(), p);
8245 if (home && home[0] && homes >= 0)
8246 lp_add_home(p, homes, p, home);
8248 TALLOC_FREE(home);
8250 SAFE_FREE(s);
8253 /***************************************************************************
8254 Auto-load one printer.
8255 ***************************************************************************/
8257 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
8259 int printers = lp_servicenumber(PRINTERS_NAME);
8260 int i;
8262 if (lp_servicenumber(name) < 0) {
8263 lp_add_printer(name, printers);
8264 if ((i = lp_servicenumber(name)) >= 0) {
8265 string_set(&ServicePtrs[i]->comment, comment);
8266 ServicePtrs[i]->autoloaded = True;
8271 /***************************************************************************
8272 Have we loaded a services file yet?
8273 ***************************************************************************/
8275 bool lp_loaded(void)
8277 return (bLoaded);
8280 /***************************************************************************
8281 Unload unused services.
8282 ***************************************************************************/
8284 void lp_killunused(bool (*snumused) (int))
8286 int i;
8287 for (i = 0; i < iNumServices; i++) {
8288 if (!VALID(i))
8289 continue;
8291 /* don't kill autoloaded or usershare services */
8292 if ( ServicePtrs[i]->autoloaded ||
8293 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8294 continue;
8297 if (!snumused || !snumused(i)) {
8298 free_service_byindex(i);
8304 * Kill all except autoloaded and usershare services - convenience wrapper
8306 void lp_kill_all_services(void)
8308 lp_killunused(NULL);
8311 /***************************************************************************
8312 Unload a service.
8313 ***************************************************************************/
8315 void lp_killservice(int iServiceIn)
8317 if (VALID(iServiceIn)) {
8318 free_service_byindex(iServiceIn);
8322 /***************************************************************************
8323 Save the curent values of all global and sDefault parameters into the
8324 defaults union. This allows swat and testparm to show only the
8325 changed (ie. non-default) parameters.
8326 ***************************************************************************/
8328 static void lp_save_defaults(void)
8330 int i;
8331 for (i = 0; parm_table[i].label; i++) {
8332 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8333 continue;
8334 switch (parm_table[i].type) {
8335 case P_LIST:
8336 parm_table[i].def.lvalue = str_list_copy(
8337 NULL, *(const char ***)parm_table[i].ptr);
8338 break;
8339 case P_STRING:
8340 case P_USTRING:
8341 if (parm_table[i].ptr) {
8342 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8343 } else {
8344 parm_table[i].def.svalue = NULL;
8346 break;
8347 case P_BOOL:
8348 case P_BOOLREV:
8349 parm_table[i].def.bvalue =
8350 *(bool *)parm_table[i].ptr;
8351 break;
8352 case P_CHAR:
8353 parm_table[i].def.cvalue =
8354 *(char *)parm_table[i].ptr;
8355 break;
8356 case P_INTEGER:
8357 case P_OCTAL:
8358 case P_ENUM:
8359 parm_table[i].def.ivalue =
8360 *(int *)parm_table[i].ptr;
8361 break;
8362 case P_SEP:
8363 break;
8366 defaults_saved = True;
8369 /*******************************************************************
8370 Set the server type we will announce as via nmbd.
8371 ********************************************************************/
8373 static const struct srv_role_tab {
8374 uint32 role;
8375 const char *role_str;
8376 } srv_role_tab [] = {
8377 { ROLE_STANDALONE, "ROLE_STANDALONE" },
8378 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
8379 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
8380 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
8381 { 0, NULL }
8384 const char* server_role_str(uint32 role)
8386 int i = 0;
8387 for (i=0; srv_role_tab[i].role_str; i++) {
8388 if (role == srv_role_tab[i].role) {
8389 return srv_role_tab[i].role_str;
8392 return NULL;
8395 static void set_server_role(void)
8397 server_role = ROLE_STANDALONE;
8399 switch (lp_security()) {
8400 case SEC_SHARE:
8401 if (lp_domain_logons())
8402 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8403 break;
8404 case SEC_SERVER:
8405 if (lp_domain_logons())
8406 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8407 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8408 server_role = ROLE_STANDALONE;
8409 break;
8410 case SEC_DOMAIN:
8411 if (lp_domain_logons()) {
8412 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8413 server_role = ROLE_DOMAIN_BDC;
8414 break;
8416 server_role = ROLE_DOMAIN_MEMBER;
8417 break;
8418 case SEC_ADS:
8419 if (lp_domain_logons()) {
8420 server_role = ROLE_DOMAIN_PDC;
8421 break;
8423 server_role = ROLE_DOMAIN_MEMBER;
8424 break;
8425 case SEC_USER:
8426 if (lp_domain_logons()) {
8428 if (Globals.iDomainMaster) /* auto or yes */
8429 server_role = ROLE_DOMAIN_PDC;
8430 else
8431 server_role = ROLE_DOMAIN_BDC;
8433 break;
8434 default:
8435 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8436 break;
8439 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
8442 /***********************************************************
8443 If we should send plaintext/LANMAN passwords in the clinet
8444 ************************************************************/
8446 static void set_allowed_client_auth(void)
8448 if (Globals.bClientNTLMv2Auth) {
8449 Globals.bClientLanManAuth = False;
8451 if (!Globals.bClientLanManAuth) {
8452 Globals.bClientPlaintextAuth = False;
8456 /***************************************************************************
8457 JRA.
8458 The following code allows smbd to read a user defined share file.
8459 Yes, this is my intent. Yes, I'm comfortable with that...
8461 THE FOLLOWING IS SECURITY CRITICAL CODE.
8463 It washes your clothes, it cleans your house, it guards you while you sleep...
8464 Do not f%^k with it....
8465 ***************************************************************************/
8467 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8469 /***************************************************************************
8470 Check allowed stat state of a usershare file.
8471 Ensure we print out who is dicking with us so the admin can
8472 get their sorry ass fired.
8473 ***************************************************************************/
8475 static bool check_usershare_stat(const char *fname,
8476 const SMB_STRUCT_STAT *psbuf)
8478 if (!S_ISREG(psbuf->st_ex_mode)) {
8479 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8480 "not a regular file\n",
8481 fname, (unsigned int)psbuf->st_ex_uid ));
8482 return False;
8485 /* Ensure this doesn't have the other write bit set. */
8486 if (psbuf->st_ex_mode & S_IWOTH) {
8487 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8488 "public write. Refusing to allow as a usershare file.\n",
8489 fname, (unsigned int)psbuf->st_ex_uid ));
8490 return False;
8493 /* Should be 10k or less. */
8494 if (psbuf->st_ex_size > MAX_USERSHARE_FILE_SIZE) {
8495 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8496 "too large (%u) to be a user share file.\n",
8497 fname, (unsigned int)psbuf->st_ex_uid,
8498 (unsigned int)psbuf->st_ex_size ));
8499 return False;
8502 return True;
8505 /***************************************************************************
8506 Parse the contents of a usershare file.
8507 ***************************************************************************/
8509 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
8510 SMB_STRUCT_STAT *psbuf,
8511 const char *servicename,
8512 int snum,
8513 char **lines,
8514 int numlines,
8515 char **pp_sharepath,
8516 char **pp_comment,
8517 SEC_DESC **ppsd,
8518 bool *pallow_guest)
8520 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8521 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8522 int us_vers;
8523 SMB_STRUCT_DIR *dp;
8524 SMB_STRUCT_STAT sbuf;
8525 char *sharepath = NULL;
8526 char *comment = NULL;
8528 *pp_sharepath = NULL;
8529 *pp_comment = NULL;
8531 *pallow_guest = False;
8533 if (numlines < 4) {
8534 return USERSHARE_MALFORMED_FILE;
8537 if (strcmp(lines[0], "#VERSION 1") == 0) {
8538 us_vers = 1;
8539 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8540 us_vers = 2;
8541 if (numlines < 5) {
8542 return USERSHARE_MALFORMED_FILE;
8544 } else {
8545 return USERSHARE_BAD_VERSION;
8548 if (strncmp(lines[1], "path=", 5) != 0) {
8549 return USERSHARE_MALFORMED_PATH;
8552 sharepath = talloc_strdup(ctx, &lines[1][5]);
8553 if (!sharepath) {
8554 return USERSHARE_POSIX_ERR;
8556 trim_string(sharepath, " ", " ");
8558 if (strncmp(lines[2], "comment=", 8) != 0) {
8559 return USERSHARE_MALFORMED_COMMENT_DEF;
8562 comment = talloc_strdup(ctx, &lines[2][8]);
8563 if (!comment) {
8564 return USERSHARE_POSIX_ERR;
8566 trim_string(comment, " ", " ");
8567 trim_char(comment, '"', '"');
8569 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8570 return USERSHARE_MALFORMED_ACL_DEF;
8573 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8574 return USERSHARE_ACL_ERR;
8577 if (us_vers == 2) {
8578 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8579 return USERSHARE_MALFORMED_ACL_DEF;
8581 if (lines[4][9] == 'y') {
8582 *pallow_guest = True;
8586 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8587 /* Path didn't change, no checks needed. */
8588 *pp_sharepath = sharepath;
8589 *pp_comment = comment;
8590 return USERSHARE_OK;
8593 /* The path *must* be absolute. */
8594 if (sharepath[0] != '/') {
8595 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8596 servicename, sharepath));
8597 return USERSHARE_PATH_NOT_ABSOLUTE;
8600 /* If there is a usershare prefix deny list ensure one of these paths
8601 doesn't match the start of the user given path. */
8602 if (prefixdenylist) {
8603 int i;
8604 for ( i=0; prefixdenylist[i]; i++ ) {
8605 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8606 servicename, i, prefixdenylist[i], sharepath ));
8607 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8608 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8609 "usershare prefix deny list entries.\n",
8610 servicename, sharepath));
8611 return USERSHARE_PATH_IS_DENIED;
8616 /* If there is a usershare prefix allow list ensure one of these paths
8617 does match the start of the user given path. */
8619 if (prefixallowlist) {
8620 int i;
8621 for ( i=0; prefixallowlist[i]; i++ ) {
8622 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8623 servicename, i, prefixallowlist[i], sharepath ));
8624 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8625 break;
8628 if (prefixallowlist[i] == NULL) {
8629 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8630 "usershare prefix allow list entries.\n",
8631 servicename, sharepath));
8632 return USERSHARE_PATH_NOT_ALLOWED;
8636 /* Ensure this is pointing to a directory. */
8637 dp = sys_opendir(sharepath);
8639 if (!dp) {
8640 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8641 servicename, sharepath));
8642 return USERSHARE_PATH_NOT_DIRECTORY;
8645 /* Ensure the owner of the usershare file has permission to share
8646 this directory. */
8648 if (sys_stat(sharepath, &sbuf, false) == -1) {
8649 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8650 servicename, sharepath, strerror(errno) ));
8651 sys_closedir(dp);
8652 return USERSHARE_POSIX_ERR;
8655 sys_closedir(dp);
8657 if (!S_ISDIR(sbuf.st_ex_mode)) {
8658 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8659 servicename, sharepath ));
8660 return USERSHARE_PATH_NOT_DIRECTORY;
8663 /* Check if sharing is restricted to owner-only. */
8664 /* psbuf is the stat of the usershare definition file,
8665 sbuf is the stat of the target directory to be shared. */
8667 if (lp_usershare_owner_only()) {
8668 /* root can share anything. */
8669 if ((psbuf->st_ex_uid != 0) && (sbuf.st_ex_uid != psbuf->st_ex_uid)) {
8670 return USERSHARE_PATH_NOT_ALLOWED;
8674 *pp_sharepath = sharepath;
8675 *pp_comment = comment;
8676 return USERSHARE_OK;
8679 /***************************************************************************
8680 Deal with a usershare file.
8681 Returns:
8682 >= 0 - snum
8683 -1 - Bad name, invalid contents.
8684 - service name already existed and not a usershare, problem
8685 with permissions to share directory etc.
8686 ***************************************************************************/
8688 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8690 SMB_STRUCT_STAT sbuf;
8691 SMB_STRUCT_STAT lsbuf;
8692 char *fname = NULL;
8693 char *sharepath = NULL;
8694 char *comment = NULL;
8695 fstring service_name;
8696 char **lines = NULL;
8697 int numlines = 0;
8698 int fd = -1;
8699 int iService = -1;
8700 TALLOC_CTX *ctx = NULL;
8701 SEC_DESC *psd = NULL;
8702 bool guest_ok = False;
8704 /* Ensure share name doesn't contain invalid characters. */
8705 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8706 DEBUG(0,("process_usershare_file: share name %s contains "
8707 "invalid characters (any of %s)\n",
8708 file_name, INVALID_SHARENAME_CHARS ));
8709 return -1;
8712 fstrcpy(service_name, file_name);
8714 if (asprintf(&fname, "%s/%s", dir_name, file_name) < 0) {
8717 /* Minimize the race condition by doing an lstat before we
8718 open and fstat. Ensure this isn't a symlink link. */
8720 if (sys_lstat(fname, &lsbuf, false) != 0) {
8721 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8722 fname, strerror(errno) ));
8723 SAFE_FREE(fname);
8724 return -1;
8727 /* This must be a regular file, not a symlink, directory or
8728 other strange filetype. */
8729 if (!check_usershare_stat(fname, &lsbuf)) {
8730 SAFE_FREE(fname);
8731 return -1;
8735 char *canon_name = canonicalize_servicename(talloc_tos(), service_name);
8736 TDB_DATA data = dbwrap_fetch_bystring(
8737 ServiceHash, canon_name, canon_name);
8739 iService = -1;
8741 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8742 iService = *(int *)data.dptr;
8744 TALLOC_FREE(canon_name);
8747 if (iService != -1 &&
8748 timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
8749 &lsbuf.st_ex_mtime) == 0) {
8750 /* Nothing changed - Mark valid and return. */
8751 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8752 service_name ));
8753 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8754 SAFE_FREE(fname);
8755 return iService;
8758 /* Try and open the file read only - no symlinks allowed. */
8759 #ifdef O_NOFOLLOW
8760 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8761 #else
8762 fd = sys_open(fname, O_RDONLY, 0);
8763 #endif
8765 if (fd == -1) {
8766 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8767 fname, strerror(errno) ));
8768 SAFE_FREE(fname);
8769 return -1;
8772 /* Now fstat to be *SURE* it's a regular file. */
8773 if (sys_fstat(fd, &sbuf, false) != 0) {
8774 close(fd);
8775 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8776 fname, strerror(errno) ));
8777 SAFE_FREE(fname);
8778 return -1;
8781 /* Is it the same dev/inode as was lstated ? */
8782 if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
8783 close(fd);
8784 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8785 "Symlink spoofing going on ?\n", fname ));
8786 SAFE_FREE(fname);
8787 return -1;
8790 /* This must be a regular file, not a symlink, directory or
8791 other strange filetype. */
8792 if (!check_usershare_stat(fname, &sbuf)) {
8793 SAFE_FREE(fname);
8794 return -1;
8797 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8799 close(fd);
8800 if (lines == NULL) {
8801 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8802 fname, (unsigned int)sbuf.st_ex_uid ));
8803 SAFE_FREE(fname);
8804 return -1;
8807 SAFE_FREE(fname);
8809 /* Should we allow printers to be shared... ? */
8810 ctx = talloc_init("usershare_sd_xctx");
8811 if (!ctx) {
8812 TALLOC_FREE(lines);
8813 return 1;
8816 if (parse_usershare_file(ctx, &sbuf, service_name,
8817 iService, lines, numlines, &sharepath,
8818 &comment, &psd, &guest_ok) != USERSHARE_OK) {
8819 talloc_destroy(ctx);
8820 TALLOC_FREE(lines);
8821 return -1;
8824 TALLOC_FREE(lines);
8826 /* Everything ok - add the service possibly using a template. */
8827 if (iService < 0) {
8828 const struct service *sp = &sDefault;
8829 if (snum_template != -1) {
8830 sp = ServicePtrs[snum_template];
8833 if ((iService = add_a_service(sp, service_name)) < 0) {
8834 DEBUG(0, ("process_usershare_file: Failed to add "
8835 "new service %s\n", service_name));
8836 talloc_destroy(ctx);
8837 return -1;
8840 /* Read only is controlled by usershare ACL below. */
8841 ServicePtrs[iService]->bRead_only = False;
8844 /* Write the ACL of the new/modified share. */
8845 if (!set_share_security(service_name, psd)) {
8846 DEBUG(0, ("process_usershare_file: Failed to set share "
8847 "security for user share %s\n",
8848 service_name ));
8849 lp_remove_service(iService);
8850 talloc_destroy(ctx);
8851 return -1;
8854 /* If from a template it may be marked invalid. */
8855 ServicePtrs[iService]->valid = True;
8857 /* Set the service as a valid usershare. */
8858 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8860 /* Set guest access. */
8861 if (lp_usershare_allow_guests()) {
8862 ServicePtrs[iService]->bGuest_ok = guest_ok;
8865 /* And note when it was loaded. */
8866 ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
8867 string_set(&ServicePtrs[iService]->szPath, sharepath);
8868 string_set(&ServicePtrs[iService]->comment, comment);
8870 talloc_destroy(ctx);
8872 return iService;
8875 /***************************************************************************
8876 Checks if a usershare entry has been modified since last load.
8877 ***************************************************************************/
8879 static bool usershare_exists(int iService, struct timespec *last_mod)
8881 SMB_STRUCT_STAT lsbuf;
8882 const char *usersharepath = Globals.szUsersharePath;
8883 char *fname;
8885 if (asprintf(&fname, "%s/%s",
8886 usersharepath,
8887 ServicePtrs[iService]->szService) < 0) {
8888 return false;
8891 if (sys_lstat(fname, &lsbuf, false) != 0) {
8892 SAFE_FREE(fname);
8893 return false;
8896 if (!S_ISREG(lsbuf.st_ex_mode)) {
8897 SAFE_FREE(fname);
8898 return false;
8901 SAFE_FREE(fname);
8902 *last_mod = lsbuf.st_ex_mtime;
8903 return true;
8906 /***************************************************************************
8907 Load a usershare service by name. Returns a valid servicenumber or -1.
8908 ***************************************************************************/
8910 int load_usershare_service(const char *servicename)
8912 SMB_STRUCT_STAT sbuf;
8913 const char *usersharepath = Globals.szUsersharePath;
8914 int max_user_shares = Globals.iUsershareMaxShares;
8915 int snum_template = -1;
8917 if (*usersharepath == 0 || max_user_shares == 0) {
8918 return -1;
8921 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8922 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8923 usersharepath, strerror(errno) ));
8924 return -1;
8927 if (!S_ISDIR(sbuf.st_ex_mode)) {
8928 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8929 usersharepath ));
8930 return -1;
8934 * This directory must be owned by root, and have the 't' bit set.
8935 * It also must not be writable by "other".
8938 #ifdef S_ISVTX
8939 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
8940 #else
8941 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
8942 #endif
8943 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8944 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8945 usersharepath ));
8946 return -1;
8949 /* Ensure the template share exists if it's set. */
8950 if (Globals.szUsershareTemplateShare[0]) {
8951 /* We can't use lp_servicenumber here as we are recommending that
8952 template shares have -valid=False set. */
8953 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8954 if (ServicePtrs[snum_template]->szService &&
8955 strequal(ServicePtrs[snum_template]->szService,
8956 Globals.szUsershareTemplateShare)) {
8957 break;
8961 if (snum_template == -1) {
8962 DEBUG(0,("load_usershare_service: usershare template share %s "
8963 "does not exist.\n",
8964 Globals.szUsershareTemplateShare ));
8965 return -1;
8969 return process_usershare_file(usersharepath, servicename, snum_template);
8972 /***************************************************************************
8973 Load all user defined shares from the user share directory.
8974 We only do this if we're enumerating the share list.
8975 This is the function that can delete usershares that have
8976 been removed.
8977 ***************************************************************************/
8979 int load_usershare_shares(void)
8981 SMB_STRUCT_DIR *dp;
8982 SMB_STRUCT_STAT sbuf;
8983 SMB_STRUCT_DIRENT *de;
8984 int num_usershares = 0;
8985 int max_user_shares = Globals.iUsershareMaxShares;
8986 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
8987 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
8988 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
8989 int iService;
8990 int snum_template = -1;
8991 const char *usersharepath = Globals.szUsersharePath;
8992 int ret = lp_numservices();
8994 if (max_user_shares == 0 || *usersharepath == '\0') {
8995 return lp_numservices();
8998 if (sys_stat(usersharepath, &sbuf, false) != 0) {
8999 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
9000 usersharepath, strerror(errno) ));
9001 return ret;
9005 * This directory must be owned by root, and have the 't' bit set.
9006 * It also must not be writable by "other".
9009 #ifdef S_ISVTX
9010 if (sbuf.st_ex_uid != 0 || !(sbuf.st_ex_mode & S_ISVTX) || (sbuf.st_ex_mode & S_IWOTH)) {
9011 #else
9012 if (sbuf.st_ex_uid != 0 || (sbuf.st_ex_mode & S_IWOTH)) {
9013 #endif
9014 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
9015 "or does not have the sticky bit 't' set or is writable by anyone.\n",
9016 usersharepath ));
9017 return ret;
9020 /* Ensure the template share exists if it's set. */
9021 if (Globals.szUsershareTemplateShare[0]) {
9022 /* We can't use lp_servicenumber here as we are recommending that
9023 template shares have -valid=False set. */
9024 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
9025 if (ServicePtrs[snum_template]->szService &&
9026 strequal(ServicePtrs[snum_template]->szService,
9027 Globals.szUsershareTemplateShare)) {
9028 break;
9032 if (snum_template == -1) {
9033 DEBUG(0,("load_usershare_shares: usershare template share %s "
9034 "does not exist.\n",
9035 Globals.szUsershareTemplateShare ));
9036 return ret;
9040 /* Mark all existing usershares as pending delete. */
9041 for (iService = iNumServices - 1; iService >= 0; iService--) {
9042 if (VALID(iService) && ServicePtrs[iService]->usershare) {
9043 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
9047 dp = sys_opendir(usersharepath);
9048 if (!dp) {
9049 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
9050 usersharepath, strerror(errno) ));
9051 return ret;
9054 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
9055 (de = sys_readdir(dp));
9056 num_dir_entries++ ) {
9057 int r;
9058 const char *n = de->d_name;
9060 /* Ignore . and .. */
9061 if (*n == '.') {
9062 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
9063 continue;
9067 if (n[0] == ':') {
9068 /* Temporary file used when creating a share. */
9069 num_tmp_dir_entries++;
9072 /* Allow 20% tmp entries. */
9073 if (num_tmp_dir_entries > allowed_tmp_entries) {
9074 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
9075 "in directory %s\n",
9076 num_tmp_dir_entries, usersharepath));
9077 break;
9080 r = process_usershare_file(usersharepath, n, snum_template);
9081 if (r == 0) {
9082 /* Update the services count. */
9083 num_usershares++;
9084 if (num_usershares >= max_user_shares) {
9085 DEBUG(0,("load_usershare_shares: max user shares reached "
9086 "on file %s in directory %s\n",
9087 n, usersharepath ));
9088 break;
9090 } else if (r == -1) {
9091 num_bad_dir_entries++;
9094 /* Allow 20% bad entries. */
9095 if (num_bad_dir_entries > allowed_bad_entries) {
9096 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
9097 "in directory %s\n",
9098 num_bad_dir_entries, usersharepath));
9099 break;
9102 /* Allow 20% bad entries. */
9103 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
9104 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
9105 "in directory %s\n",
9106 num_dir_entries, usersharepath));
9107 break;
9111 sys_closedir(dp);
9113 /* Sweep through and delete any non-refreshed usershares that are
9114 not currently in use. */
9115 for (iService = iNumServices - 1; iService >= 0; iService--) {
9116 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
9117 if (conn_snum_used(iService)) {
9118 continue;
9120 /* Remove from the share ACL db. */
9121 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
9122 lp_servicename(iService) ));
9123 delete_share_security(lp_servicename(iService));
9124 free_service_byindex(iService);
9128 return lp_numservices();
9131 /********************************************************
9132 Destroy global resources allocated in this file
9133 ********************************************************/
9135 void gfree_loadparm(void)
9137 int i;
9139 free_file_list();
9141 /* Free resources allocated to services */
9143 for ( i = 0; i < iNumServices; i++ ) {
9144 if ( VALID(i) ) {
9145 free_service_byindex(i);
9149 SAFE_FREE( ServicePtrs );
9150 iNumServices = 0;
9152 /* Now release all resources allocated to global
9153 parameters and the default service */
9155 free_global_parameters();
9159 /***************************************************************************
9160 Allow client apps to specify that they are a client
9161 ***************************************************************************/
9162 void lp_set_in_client(bool b)
9164 in_client = b;
9168 /***************************************************************************
9169 Determine if we're running in a client app
9170 ***************************************************************************/
9171 bool lp_is_in_client(void)
9173 return in_client;
9176 /***************************************************************************
9177 Load the services array from the services file. Return True on success,
9178 False on failure.
9179 ***************************************************************************/
9181 bool lp_load_ex(const char *pszFname,
9182 bool global_only,
9183 bool save_defaults,
9184 bool add_ipc,
9185 bool initialize_globals,
9186 bool allow_include_registry,
9187 bool allow_registry_shares)
9189 char *n2 = NULL;
9190 bool bRetval;
9192 bRetval = False;
9194 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9196 bInGlobalSection = True;
9197 bGlobalOnly = global_only;
9198 bAllowIncludeRegistry = allow_include_registry;
9200 init_globals(! initialize_globals);
9201 debug_init();
9203 free_file_list();
9205 if (save_defaults) {
9206 init_locals();
9207 lp_save_defaults();
9210 free_param_opts(&Globals.param_opt);
9212 /* We get sections first, so have to start 'behind' to make up */
9213 iServiceIndex = -1;
9215 if (lp_config_backend_is_file()) {
9216 n2 = talloc_sub_basic(talloc_tos(), get_current_username(),
9217 current_user_info.domain,
9218 pszFname);
9219 if (!n2) {
9220 smb_panic("lp_load_ex: out of memory");
9223 add_to_file_list(pszFname, n2);
9225 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9226 TALLOC_FREE(n2);
9228 /* finish up the last section */
9229 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9230 if (bRetval) {
9231 if (iServiceIndex >= 0) {
9232 bRetval = service_ok(iServiceIndex);
9236 if (lp_config_backend_is_registry()) {
9237 /* config backend changed to registry in config file */
9239 * We need to use this extra global variable here to
9240 * survive restart: init_globals uses this as a default
9241 * for ConfigBackend. Otherwise, init_globals would
9242 * send us into an endless loop here.
9244 config_backend = CONFIG_BACKEND_REGISTRY;
9245 /* start over */
9246 DEBUG(1, ("lp_load_ex: changing to config backend "
9247 "registry\n"));
9248 init_globals(false);
9249 lp_kill_all_services();
9250 return lp_load_ex(pszFname, global_only, save_defaults,
9251 add_ipc, initialize_globals,
9252 allow_include_registry,
9253 allow_registry_shares);
9255 } else if (lp_config_backend_is_registry()) {
9256 bRetval = process_registry_globals();
9257 } else {
9258 DEBUG(0, ("Illegal config backend given: %d\n",
9259 lp_config_backend()));
9260 bRetval = false;
9263 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9264 bRetval = process_registry_shares();
9267 lp_add_auto_services(lp_auto_services());
9269 if (add_ipc) {
9270 /* When 'restrict anonymous = 2' guest connections to ipc$
9271 are denied */
9272 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9273 if ( lp_enable_asu_support() ) {
9274 lp_add_ipc("ADMIN$", false);
9278 set_server_role();
9279 set_default_server_announce_type();
9280 set_allowed_client_auth();
9282 bLoaded = True;
9284 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9285 /* if bWINSsupport is true and we are in the client */
9286 if (lp_is_in_client() && Globals.bWINSsupport) {
9287 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9290 init_iconv();
9292 bAllowIncludeRegistry = true;
9294 return (bRetval);
9297 bool lp_load(const char *pszFname,
9298 bool global_only,
9299 bool save_defaults,
9300 bool add_ipc,
9301 bool initialize_globals)
9303 return lp_load_ex(pszFname,
9304 global_only,
9305 save_defaults,
9306 add_ipc,
9307 initialize_globals,
9308 true, false);
9311 bool lp_load_initial_only(const char *pszFname)
9313 return lp_load_ex(pszFname,
9314 true,
9315 false,
9316 false,
9317 true,
9318 false,
9319 false);
9322 bool lp_load_with_registry_shares(const char *pszFname,
9323 bool global_only,
9324 bool save_defaults,
9325 bool add_ipc,
9326 bool initialize_globals)
9328 return lp_load_ex(pszFname,
9329 global_only,
9330 save_defaults,
9331 add_ipc,
9332 initialize_globals,
9333 true,
9334 true);
9337 /***************************************************************************
9338 Return the max number of services.
9339 ***************************************************************************/
9341 int lp_numservices(void)
9343 return (iNumServices);
9346 /***************************************************************************
9347 Display the contents of the services array in human-readable form.
9348 ***************************************************************************/
9350 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
9352 int iService;
9354 if (show_defaults)
9355 defaults_saved = False;
9357 dump_globals(f);
9359 dump_a_service(&sDefault, f);
9361 for (iService = 0; iService < maxtoprint; iService++) {
9362 fprintf(f,"\n");
9363 lp_dump_one(f, show_defaults, iService);
9367 /***************************************************************************
9368 Display the contents of one service in human-readable form.
9369 ***************************************************************************/
9371 void lp_dump_one(FILE * f, bool show_defaults, int snum)
9373 if (VALID(snum)) {
9374 if (ServicePtrs[snum]->szService[0] == '\0')
9375 return;
9376 dump_a_service(ServicePtrs[snum], f);
9380 /***************************************************************************
9381 Return the number of the service with the given name, or -1 if it doesn't
9382 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9383 getservicebyname()! This works ONLY if all services have been loaded, and
9384 does not copy the found service.
9385 ***************************************************************************/
9387 int lp_servicenumber(const char *pszServiceName)
9389 int iService;
9390 fstring serviceName;
9392 if (!pszServiceName) {
9393 return GLOBAL_SECTION_SNUM;
9396 for (iService = iNumServices - 1; iService >= 0; iService--) {
9397 if (VALID(iService) && ServicePtrs[iService]->szService) {
9399 * The substitution here is used to support %U is
9400 * service names
9402 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9403 standard_sub_basic(get_current_username(),
9404 current_user_info.domain,
9405 serviceName,sizeof(serviceName));
9406 if (strequal(serviceName, pszServiceName)) {
9407 break;
9412 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9413 struct timespec last_mod;
9415 if (!usershare_exists(iService, &last_mod)) {
9416 /* Remove the share security tdb entry for it. */
9417 delete_share_security(lp_servicename(iService));
9418 /* Remove it from the array. */
9419 free_service_byindex(iService);
9420 /* Doesn't exist anymore. */
9421 return GLOBAL_SECTION_SNUM;
9424 /* Has it been modified ? If so delete and reload. */
9425 if (timespec_compare(&ServicePtrs[iService]->usershare_last_mod,
9426 &last_mod) < 0) {
9427 /* Remove it from the array. */
9428 free_service_byindex(iService);
9429 /* and now reload it. */
9430 iService = load_usershare_service(pszServiceName);
9434 if (iService < 0) {
9435 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9436 return GLOBAL_SECTION_SNUM;
9439 return (iService);
9442 bool share_defined(const char *service_name)
9444 return (lp_servicenumber(service_name) != -1);
9447 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
9448 const char *sharename)
9450 struct share_params *result;
9451 char *sname;
9452 int snum;
9454 if (!(sname = SMB_STRDUP(sharename))) {
9455 return NULL;
9458 snum = find_service(sname);
9459 SAFE_FREE(sname);
9461 if (snum < 0) {
9462 return NULL;
9465 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9466 DEBUG(0, ("talloc failed\n"));
9467 return NULL;
9470 result->service = snum;
9471 return result;
9474 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
9476 struct share_iterator *result;
9478 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9479 DEBUG(0, ("talloc failed\n"));
9480 return NULL;
9483 result->next_id = 0;
9484 return result;
9487 struct share_params *next_share(struct share_iterator *list)
9489 struct share_params *result;
9491 while (!lp_snum_ok(list->next_id) &&
9492 (list->next_id < lp_numservices())) {
9493 list->next_id += 1;
9496 if (list->next_id >= lp_numservices()) {
9497 return NULL;
9500 if (!(result = TALLOC_P(list, struct share_params))) {
9501 DEBUG(0, ("talloc failed\n"));
9502 return NULL;
9505 result->service = list->next_id;
9506 list->next_id += 1;
9507 return result;
9510 struct share_params *next_printer(struct share_iterator *list)
9512 struct share_params *result;
9514 while ((result = next_share(list)) != NULL) {
9515 if (lp_print_ok(result->service)) {
9516 break;
9519 return result;
9523 * This is a hack for a transition period until we transformed all code from
9524 * service numbers to struct share_params.
9527 struct share_params *snum2params_static(int snum)
9529 static struct share_params result;
9530 result.service = snum;
9531 return &result;
9534 /*******************************************************************
9535 A useful volume label function.
9536 ********************************************************************/
9538 const char *volume_label(int snum)
9540 char *ret;
9541 const char *label = lp_volume(snum);
9542 if (!*label) {
9543 label = lp_servicename(snum);
9546 /* This returns a 33 byte guarenteed null terminated string. */
9547 ret = talloc_strndup(talloc_tos(), label, 32);
9548 if (!ret) {
9549 return "";
9551 return ret;
9554 /*******************************************************************
9555 Set the server type we will announce as via nmbd.
9556 ********************************************************************/
9558 static void set_default_server_announce_type(void)
9560 default_server_announce = 0;
9561 default_server_announce |= SV_TYPE_WORKSTATION;
9562 default_server_announce |= SV_TYPE_SERVER;
9563 default_server_announce |= SV_TYPE_SERVER_UNIX;
9565 /* note that the flag should be set only if we have a
9566 printer service but nmbd doesn't actually load the
9567 services so we can't tell --jerry */
9569 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9571 switch (lp_announce_as()) {
9572 case ANNOUNCE_AS_NT_SERVER:
9573 default_server_announce |= SV_TYPE_SERVER_NT;
9574 /* fall through... */
9575 case ANNOUNCE_AS_NT_WORKSTATION:
9576 default_server_announce |= SV_TYPE_NT;
9577 break;
9578 case ANNOUNCE_AS_WIN95:
9579 default_server_announce |= SV_TYPE_WIN95_PLUS;
9580 break;
9581 case ANNOUNCE_AS_WFW:
9582 default_server_announce |= SV_TYPE_WFW;
9583 break;
9584 default:
9585 break;
9588 switch (lp_server_role()) {
9589 case ROLE_DOMAIN_MEMBER:
9590 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9591 break;
9592 case ROLE_DOMAIN_PDC:
9593 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9594 break;
9595 case ROLE_DOMAIN_BDC:
9596 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9597 break;
9598 case ROLE_STANDALONE:
9599 default:
9600 break;
9602 if (lp_time_server())
9603 default_server_announce |= SV_TYPE_TIME_SOURCE;
9605 if (lp_host_msdfs())
9606 default_server_announce |= SV_TYPE_DFS_SERVER;
9609 /***********************************************************
9610 returns role of Samba server
9611 ************************************************************/
9613 int lp_server_role(void)
9615 return server_role;
9618 /***********************************************************
9619 If we are PDC then prefer us as DMB
9620 ************************************************************/
9622 bool lp_domain_master(void)
9624 if (Globals.iDomainMaster == Auto)
9625 return (lp_server_role() == ROLE_DOMAIN_PDC);
9627 return (bool)Globals.iDomainMaster;
9630 /***********************************************************
9631 If we are DMB then prefer us as LMB
9632 ************************************************************/
9634 bool lp_preferred_master(void)
9636 if (Globals.iPreferredMaster == Auto)
9637 return (lp_local_master() && lp_domain_master());
9639 return (bool)Globals.iPreferredMaster;
9642 /*******************************************************************
9643 Remove a service.
9644 ********************************************************************/
9646 void lp_remove_service(int snum)
9648 ServicePtrs[snum]->valid = False;
9649 invalid_services[num_invalid_services++] = snum;
9652 /*******************************************************************
9653 Copy a service.
9654 ********************************************************************/
9656 void lp_copy_service(int snum, const char *new_name)
9658 do_section(new_name, NULL);
9659 if (snum >= 0) {
9660 snum = lp_servicenumber(new_name);
9661 if (snum >= 0)
9662 lp_do_parameter(snum, "copy", lp_servicename(snum));
9667 /*******************************************************************
9668 Get the default server type we will announce as via nmbd.
9669 ********************************************************************/
9671 int lp_default_server_announce(void)
9673 return default_server_announce;
9676 /*******************************************************************
9677 Split the announce version into major and minor numbers.
9678 ********************************************************************/
9680 int lp_major_announce_version(void)
9682 static bool got_major = False;
9683 static int major_version = DEFAULT_MAJOR_VERSION;
9684 char *vers;
9685 char *p;
9687 if (got_major)
9688 return major_version;
9690 got_major = True;
9691 if ((vers = lp_announce_version()) == NULL)
9692 return major_version;
9694 if ((p = strchr_m(vers, '.')) == 0)
9695 return major_version;
9697 *p = '\0';
9698 major_version = atoi(vers);
9699 return major_version;
9702 int lp_minor_announce_version(void)
9704 static bool got_minor = False;
9705 static int minor_version = DEFAULT_MINOR_VERSION;
9706 char *vers;
9707 char *p;
9709 if (got_minor)
9710 return minor_version;
9712 got_minor = True;
9713 if ((vers = lp_announce_version()) == NULL)
9714 return minor_version;
9716 if ((p = strchr_m(vers, '.')) == 0)
9717 return minor_version;
9719 p++;
9720 minor_version = atoi(p);
9721 return minor_version;
9724 /***********************************************************
9725 Set the global name resolution order (used in smbclient).
9726 ************************************************************/
9728 void lp_set_name_resolve_order(const char *new_order)
9730 string_set(&Globals.szNameResolveOrder, new_order);
9733 const char *lp_printername(int snum)
9735 const char *ret = _lp_printername(snum);
9736 if (ret == NULL || (ret != NULL && *ret == '\0'))
9737 ret = lp_const_servicename(snum);
9739 return ret;
9743 /***********************************************************
9744 Allow daemons such as winbindd to fix their logfile name.
9745 ************************************************************/
9747 void lp_set_logfile(const char *name)
9749 string_set(&Globals.szLogFile, name);
9750 debug_set_logfile(name);
9753 /*******************************************************************
9754 Return the max print jobs per queue.
9755 ********************************************************************/
9757 int lp_maxprintjobs(int snum)
9759 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9760 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9761 maxjobs = PRINT_MAX_JOBID - 1;
9763 return maxjobs;
9766 const char *lp_printcapname(void)
9768 if ((Globals.szPrintcapname != NULL) &&
9769 (Globals.szPrintcapname[0] != '\0'))
9770 return Globals.szPrintcapname;
9772 if (sDefault.iPrinting == PRINT_CUPS) {
9773 #ifdef HAVE_CUPS
9774 return "cups";
9775 #else
9776 return "lpstat";
9777 #endif
9780 if (sDefault.iPrinting == PRINT_BSD)
9781 return "/etc/printcap";
9783 return PRINTCAP_NAME;
9786 static uint32 spoolss_state;
9788 bool lp_disable_spoolss( void )
9790 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9791 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9793 return spoolss_state == SVCCTL_STOPPED ? True : False;
9796 void lp_set_spoolss_state( uint32 state )
9798 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9800 spoolss_state = state;
9803 uint32 lp_get_spoolss_state( void )
9805 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9808 /*******************************************************************
9809 Ensure we don't use sendfile if server smb signing is active.
9810 ********************************************************************/
9812 bool lp_use_sendfile(int snum, struct smb_signing_state *signing_state)
9814 bool sign_active = false;
9816 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9817 if (get_Protocol() < PROTOCOL_NT1) {
9818 return false;
9820 if (signing_state) {
9821 sign_active = smb_signing_is_active(signing_state);
9823 return (_lp_use_sendfile(snum) &&
9824 (get_remote_arch() != RA_WIN95) &&
9825 !sign_active);
9828 /*******************************************************************
9829 Turn off sendfile if we find the underlying OS doesn't support it.
9830 ********************************************************************/
9832 void set_use_sendfile(int snum, bool val)
9834 if (LP_SNUM_OK(snum))
9835 ServicePtrs[snum]->bUseSendfile = val;
9836 else
9837 sDefault.bUseSendfile = val;
9840 /*******************************************************************
9841 Turn off storing DOS attributes if this share doesn't support it.
9842 ********************************************************************/
9844 void set_store_dos_attributes(int snum, bool val)
9846 if (!LP_SNUM_OK(snum))
9847 return;
9848 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9851 void lp_set_mangling_method(const char *new_method)
9853 string_set(&Globals.szManglingMethod, new_method);
9856 /*******************************************************************
9857 Global state for POSIX pathname processing.
9858 ********************************************************************/
9860 static bool posix_pathnames;
9862 bool lp_posix_pathnames(void)
9864 return posix_pathnames;
9867 /*******************************************************************
9868 Change everything needed to ensure POSIX pathname processing (currently
9869 not much).
9870 ********************************************************************/
9872 void lp_set_posix_pathnames(void)
9874 posix_pathnames = True;
9877 /*******************************************************************
9878 Global state for POSIX lock processing - CIFS unix extensions.
9879 ********************************************************************/
9881 bool posix_default_lock_was_set;
9882 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9884 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
9886 if (posix_default_lock_was_set) {
9887 return posix_cifsx_locktype;
9888 } else {
9889 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9893 /*******************************************************************
9894 ********************************************************************/
9896 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
9898 posix_default_lock_was_set = True;
9899 posix_cifsx_locktype = val;
9902 int lp_min_receive_file_size(void)
9904 if (Globals.iminreceivefile < 0) {
9905 return 0;
9907 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
9910 /*******************************************************************
9911 If socket address is an empty character string, it is necessary to
9912 define it as "0.0.0.0".
9913 ********************************************************************/
9915 const char *lp_socket_address(void)
9917 char *sock_addr = Globals.szSocketAddress;
9919 if (sock_addr[0] == '\0'){
9920 string_set(&Globals.szSocketAddress, "0.0.0.0");
9922 return Globals.szSocketAddress;
9925 void lp_set_passdb_backend(const char *backend)
9927 string_set(&Globals.szPassdbBackend, backend);
9930 /*******************************************************************
9931 Safe wide links checks.
9932 This helper function always verify the validity of wide links,
9933 even after a configuration file reload.
9934 ********************************************************************/
9936 static bool lp_widelinks_internal(int snum)
9938 return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
9939 sDefault.bWidelinks);
9942 void widelinks_warning(int snum)
9944 if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
9945 DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
9946 "These parameters are incompatible. "
9947 "Wide links will be disabled for this share.\n",
9948 lp_servicename(snum) ));
9952 bool lp_widelinks(int snum)
9954 /* wide links is always incompatible with unix extensions */
9955 if (lp_unix_extensions()) {
9956 return false;
9959 return lp_widelinks_internal(snum);