loadparm: replace typedef struct {} global/service by struct global/struct service.
[Samba.git] / source / param / loadparm.c
blob96d3dac108302979f91c4e2b1984f289739e90c5
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 "libnet/libnet.h"
57 bool in_client = False; /* Not in the client by default */
58 bool bLoaded = False;
60 extern enum protocol_types Protocol;
61 extern userdom_struct current_user_info;
63 #ifndef GLOBAL_NAME
64 #define GLOBAL_NAME "global"
65 #endif
67 #ifndef PRINTERS_NAME
68 #define PRINTERS_NAME "printers"
69 #endif
71 #ifndef HOMES_NAME
72 #define HOMES_NAME "homes"
73 #endif
75 static uint64_t conf_last_seqnum = 0;
76 static struct libnet_conf_ctx *conf_ctx = NULL;
78 #define CONFIG_BACKEND_FILE 0
79 #define CONFIG_BACKEND_REGISTRY 1
81 static int config_backend = CONFIG_BACKEND_FILE;
83 /* some helpful bits */
84 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
85 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
87 #define USERSHARE_VALID 1
88 #define USERSHARE_PENDING_DELETE 2
90 extern int extra_time_offset;
92 static bool defaults_saved = False;
94 typedef struct _param_opt_struct param_opt_struct;
95 struct _param_opt_struct {
96 param_opt_struct *prev, *next;
97 char *key;
98 char *value;
99 char **list;
103 * This structure describes global (ie., server-wide) parameters.
105 struct global {
106 int ConfigBackend;
107 char *smb_ports;
108 char *dos_charset;
109 char *unix_charset;
110 char *display_charset;
111 char *szPrintcapname;
112 char *szAddPortCommand;
113 char *szEnumPortsCommand;
114 char *szAddPrinterCommand;
115 char *szDeletePrinterCommand;
116 char *szOs2DriverMap;
117 char *szLockDir;
118 char *szPidDir;
119 char *szRootdir;
120 char *szDefaultService;
121 char *szGetQuota;
122 char *szSetQuota;
123 char *szMsgCommand;
124 char *szServerString;
125 char *szAutoServices;
126 char *szPasswdProgram;
127 char *szPasswdChat;
128 char *szLogFile;
129 char *szConfigFile;
130 char *szSMBPasswdFile;
131 char *szPrivateDir;
132 char *szPassdbBackend;
133 char **szPreloadModules;
134 char *szPasswordServer;
135 char *szSocketOptions;
136 char *szRealm;
137 char *szAfsUsernameMap;
138 int iAfsTokenLifetime;
139 char *szLogNtTokenCommand;
140 char *szUsernameMap;
141 char *szLogonScript;
142 char *szLogonPath;
143 char *szLogonDrive;
144 char *szLogonHome;
145 char **szWINSservers;
146 char **szInterfaces;
147 char *szRemoteAnnounce;
148 char *szRemoteBrowseSync;
149 char *szSocketAddress;
150 char *szNISHomeMapName;
151 char *szAnnounceVersion; /* This is initialised in init_globals */
152 char *szWorkgroup;
153 char *szNetbiosName;
154 char **szNetbiosAliases;
155 char *szNetbiosScope;
156 char *szNameResolveOrder;
157 char *szPanicAction;
158 char *szAddUserScript;
159 char *szRenameUserScript;
160 char *szDelUserScript;
161 char *szAddGroupScript;
162 char *szDelGroupScript;
163 char *szAddUserToGroupScript;
164 char *szDelUserFromGroupScript;
165 char *szSetPrimaryGroupScript;
166 char *szAddMachineScript;
167 char *szShutdownScript;
168 char *szAbortShutdownScript;
169 char *szUsernameMapScript;
170 char *szCheckPasswordScript;
171 char *szWINSHook;
172 char *szUtmpDir;
173 char *szWtmpDir;
174 bool bUtmp;
175 char *szIdmapUID;
176 char *szIdmapGID;
177 bool bPassdbExpandExplicit;
178 int AlgorithmicRidBase;
179 char *szTemplateHomedir;
180 char *szTemplateShell;
181 char *szWinbindSeparator;
182 bool bWinbindEnumUsers;
183 bool bWinbindEnumGroups;
184 bool bWinbindUseDefaultDomain;
185 bool bWinbindTrustedDomainsOnly;
186 bool bWinbindNestedGroups;
187 int winbind_expand_groups;
188 bool bWinbindRefreshTickets;
189 bool bWinbindOfflineLogon;
190 bool bWinbindNormalizeNames;
191 bool bWinbindRpcOnly;
192 char **szIdmapDomains;
193 char **szIdmapBackend; /* deprecated */
194 char *szIdmapAllocBackend;
195 char *szAddShareCommand;
196 char *szChangeShareCommand;
197 char *szDeleteShareCommand;
198 char **szEventLogs;
199 char *szGuestaccount;
200 char *szManglingMethod;
201 char **szServicesList;
202 char *szUsersharePath;
203 char *szUsershareTemplateShare;
204 char **szUsersharePrefixAllowList;
205 char **szUsersharePrefixDenyList;
206 int mangle_prefix;
207 int max_log_size;
208 char *szLogLevel;
209 int max_xmit;
210 int max_mux;
211 int max_open_files;
212 int open_files_db_hash_size;
213 int pwordlevel;
214 int unamelevel;
215 int deadtime;
216 bool getwd_cache;
217 int maxprotocol;
218 int minprotocol;
219 int security;
220 char **AuthMethods;
221 bool paranoid_server_security;
222 int maxdisksize;
223 int lpqcachetime;
224 int iMaxSmbdProcesses;
225 bool bDisableSpoolss;
226 int syslog;
227 int os_level;
228 bool enhanced_browsing;
229 int max_ttl;
230 int max_wins_ttl;
231 int min_wins_ttl;
232 int lm_announce;
233 int lm_interval;
234 int announce_as; /* This is initialised in init_globals */
235 int machine_password_timeout;
236 int map_to_guest;
237 int oplock_break_wait_time;
238 int winbind_cache_time;
239 int winbind_max_idle_children;
240 char **szWinbindNssInfo;
241 int iLockSpinTime;
242 char *szLdapMachineSuffix;
243 char *szLdapUserSuffix;
244 char *szLdapIdmapSuffix;
245 char *szLdapGroupSuffix;
246 int ldap_ssl;
247 char *szLdapSuffix;
248 char *szLdapAdminDn;
249 int ldap_debug_level;
250 int ldap_debug_threshold;
251 int iAclCompat;
252 char *szCupsServer;
253 char *szIPrintServer;
254 char *ctdbdSocket;
255 char **szClusterAddresses;
256 bool clustering;
257 int ldap_passwd_sync;
258 int ldap_replication_sleep;
259 int ldap_timeout; /* This is initialised in init_globals */
260 int ldap_page_size;
261 bool ldap_delete_dn;
262 bool bMsAddPrinterWizard;
263 bool bDNSproxy;
264 bool bWINSsupport;
265 bool bWINSproxy;
266 bool bLocalMaster;
267 int iPreferredMaster;
268 int iDomainMaster;
269 bool bDomainLogons;
270 bool bEncryptPasswords;
271 bool bUpdateEncrypt;
272 int clientSchannel;
273 int serverSchannel;
274 bool bNullPasswords;
275 bool bObeyPamRestrictions;
276 bool bLoadPrinters;
277 int PrintcapCacheTime;
278 bool bLargeReadwrite;
279 bool bReadRaw;
280 bool bWriteRaw;
281 bool bSyslogOnly;
282 bool bBrowseList;
283 bool bNISHomeMap;
284 bool bTimeServer;
285 bool bBindInterfacesOnly;
286 bool bPamPasswordChange;
287 bool bUnixPasswdSync;
288 bool bPasswdChatDebug;
289 int iPasswdChatTimeout;
290 bool bTimestampLogs;
291 bool bNTSmbSupport;
292 bool bNTPipeSupport;
293 bool bNTStatusSupport;
294 bool bStatCache;
295 int iMaxStatCacheSize;
296 bool bKernelOplocks;
297 bool bAllowTrustedDomains;
298 bool bLanmanAuth;
299 bool bNTLMAuth;
300 bool bUseSpnego;
301 bool bClientLanManAuth;
302 bool bClientNTLMv2Auth;
303 bool bClientPlaintextAuth;
304 bool bClientUseSpnego;
305 bool bDebugPrefixTimestamp;
306 bool bDebugHiresTimestamp;
307 bool bDebugPid;
308 bool bDebugUid;
309 bool bDebugClass;
310 bool bEnableCoreFiles;
311 bool bHostMSDfs;
312 bool bUseMmap;
313 bool bHostnameLookups;
314 bool bUnixExtensions;
315 bool bDisableNetbios;
316 bool bUseKerberosKeytab;
317 bool bDeferSharingViolations;
318 bool bEnablePrivileges;
319 bool bASUSupport;
320 bool bUsershareOwnerOnly;
321 bool bUsershareAllowGuests;
322 bool bRegistryShares;
323 int restrict_anonymous;
324 int name_cache_timeout;
325 int client_signing;
326 int server_signing;
327 int client_ldap_sasl_wrapping;
328 int iUsershareMaxShares;
329 int iIdmapCacheTime;
330 int iIdmapNegativeCacheTime;
331 bool bResetOnZeroVC;
332 int iKeepalive;
333 int iminreceivefile;
334 param_opt_struct *param_opt;
337 static struct global Globals;
340 * This structure describes a single service.
342 struct service {
343 bool valid;
344 bool autoloaded;
345 int usershare;
346 time_t usershare_last_mod;
347 char *szService;
348 char *szPath;
349 char *szUsername;
350 char **szInvalidUsers;
351 char **szValidUsers;
352 char **szAdminUsers;
353 char *szCopy;
354 char *szInclude;
355 char *szPreExec;
356 char *szPostExec;
357 char *szRootPreExec;
358 char *szRootPostExec;
359 char *szCupsOptions;
360 char *szPrintcommand;
361 char *szLpqcommand;
362 char *szLprmcommand;
363 char *szLppausecommand;
364 char *szLpresumecommand;
365 char *szQueuepausecommand;
366 char *szQueueresumecommand;
367 char *szPrintername;
368 char *szPrintjobUsername;
369 char *szDontdescend;
370 char **szHostsallow;
371 char **szHostsdeny;
372 char *szMagicScript;
373 char *szMagicOutput;
374 char *szVetoFiles;
375 char *szHideFiles;
376 char *szVetoOplockFiles;
377 char *comment;
378 char *force_user;
379 char *force_group;
380 char **readlist;
381 char **writelist;
382 char **printer_admin;
383 char *volume;
384 char *fstype;
385 char **szVfsObjects;
386 char *szMSDfsProxy;
387 char *szAioWriteBehind;
388 char *szDfree;
389 int iMinPrintSpace;
390 int iMaxPrintJobs;
391 int iMaxReportedPrintJobs;
392 int iWriteCacheSize;
393 int iCreate_mask;
394 int iCreate_force_mode;
395 int iSecurity_mask;
396 int iSecurity_force_mode;
397 int iDir_mask;
398 int iDir_force_mode;
399 int iDir_Security_mask;
400 int iDir_Security_force_mode;
401 int iMaxConnections;
402 int iDefaultCase;
403 int iPrinting;
404 int iOplockContentionLimit;
405 int iCSCPolicy;
406 int iBlock_size;
407 int iDfreeCacheTime;
408 bool bPreexecClose;
409 bool bRootpreexecClose;
410 int iCaseSensitive;
411 bool bCasePreserve;
412 bool bShortCasePreserve;
413 bool bHideDotFiles;
414 bool bHideSpecialFiles;
415 bool bHideUnReadable;
416 bool bHideUnWriteableFiles;
417 bool bBrowseable;
418 bool bAvailable;
419 bool bRead_only;
420 bool bNo_set_dir;
421 bool bGuest_only;
422 bool bAdministrative_share;
423 bool bGuest_ok;
424 bool bPrint_ok;
425 bool bMap_system;
426 bool bMap_hidden;
427 bool bMap_archive;
428 bool bStoreDosAttributes;
429 bool bDmapiSupport;
430 bool bLocking;
431 int iStrictLocking;
432 bool bPosixLocking;
433 bool bShareModes;
434 bool bOpLocks;
435 bool bLevel2OpLocks;
436 bool bOnlyUser;
437 bool bMangledNames;
438 bool bWidelinks;
439 bool bSymlinks;
440 bool bSyncAlways;
441 bool bStrictAllocate;
442 bool bStrictSync;
443 char magic_char;
444 struct bitmap *copymap;
445 bool bDeleteReadonly;
446 bool bFakeOplocks;
447 bool bDeleteVetoFiles;
448 bool bDosFilemode;
449 bool bDosFiletimes;
450 bool bDosFiletimeResolution;
451 bool bFakeDirCreateTimes;
452 bool bBlockingLocks;
453 bool bInheritPerms;
454 bool bInheritACLS;
455 bool bInheritOwner;
456 bool bMSDfsRoot;
457 bool bUseClientDriver;
458 bool bDefaultDevmode;
459 bool bForcePrintername;
460 bool bNTAclSupport;
461 bool bForceUnknownAclUser;
462 bool bUseSendfile;
463 bool bProfileAcls;
464 bool bMap_acl_inherit;
465 bool bAfs_Share;
466 bool bEASupport;
467 bool bAclCheckPermissions;
468 bool bAclMapFullControl;
469 bool bAclGroupControl;
470 bool bChangeNotify;
471 bool bKernelChangeNotify;
472 int iallocation_roundup_size;
473 int iAioReadSize;
474 int iAioWriteSize;
475 int iMap_readonly;
476 int iDirectoryNameCacheSize;
477 int ismb_encrypt;
478 param_opt_struct *param_opt;
480 char dummy[3]; /* for alignment */
484 /* This is a default service used to prime a services structure */
485 static struct service sDefault = {
486 True, /* valid */
487 False, /* not autoloaded */
488 0, /* not a usershare */
489 (time_t)0, /* No last mod time */
490 NULL, /* szService */
491 NULL, /* szPath */
492 NULL, /* szUsername */
493 NULL, /* szInvalidUsers */
494 NULL, /* szValidUsers */
495 NULL, /* szAdminUsers */
496 NULL, /* szCopy */
497 NULL, /* szInclude */
498 NULL, /* szPreExec */
499 NULL, /* szPostExec */
500 NULL, /* szRootPreExec */
501 NULL, /* szRootPostExec */
502 NULL, /* szCupsOptions */
503 NULL, /* szPrintcommand */
504 NULL, /* szLpqcommand */
505 NULL, /* szLprmcommand */
506 NULL, /* szLppausecommand */
507 NULL, /* szLpresumecommand */
508 NULL, /* szQueuepausecommand */
509 NULL, /* szQueueresumecommand */
510 NULL, /* szPrintername */
511 NULL, /* szPrintjobUsername */
512 NULL, /* szDontdescend */
513 NULL, /* szHostsallow */
514 NULL, /* szHostsdeny */
515 NULL, /* szMagicScript */
516 NULL, /* szMagicOutput */
517 NULL, /* szVetoFiles */
518 NULL, /* szHideFiles */
519 NULL, /* szVetoOplockFiles */
520 NULL, /* comment */
521 NULL, /* force user */
522 NULL, /* force group */
523 NULL, /* readlist */
524 NULL, /* writelist */
525 NULL, /* printer admin */
526 NULL, /* volume */
527 NULL, /* fstype */
528 NULL, /* vfs objects */
529 NULL, /* szMSDfsProxy */
530 NULL, /* szAioWriteBehind */
531 NULL, /* szDfree */
532 0, /* iMinPrintSpace */
533 1000, /* iMaxPrintJobs */
534 0, /* iMaxReportedPrintJobs */
535 0, /* iWriteCacheSize */
536 0744, /* iCreate_mask */
537 0000, /* iCreate_force_mode */
538 0777, /* iSecurity_mask */
539 0, /* iSecurity_force_mode */
540 0755, /* iDir_mask */
541 0000, /* iDir_force_mode */
542 0777, /* iDir_Security_mask */
543 0, /* iDir_Security_force_mode */
544 0, /* iMaxConnections */
545 CASE_LOWER, /* iDefaultCase */
546 DEFAULT_PRINTING, /* iPrinting */
547 2, /* iOplockContentionLimit */
548 0, /* iCSCPolicy */
549 1024, /* iBlock_size */
550 0, /* iDfreeCacheTime */
551 False, /* bPreexecClose */
552 False, /* bRootpreexecClose */
553 Auto, /* case sensitive */
554 True, /* case preserve */
555 True, /* short case preserve */
556 True, /* bHideDotFiles */
557 False, /* bHideSpecialFiles */
558 False, /* bHideUnReadable */
559 False, /* bHideUnWriteableFiles */
560 True, /* bBrowseable */
561 True, /* bAvailable */
562 True, /* bRead_only */
563 True, /* bNo_set_dir */
564 False, /* bGuest_only */
565 False, /* bAdministrative_share */
566 False, /* bGuest_ok */
567 False, /* bPrint_ok */
568 False, /* bMap_system */
569 False, /* bMap_hidden */
570 True, /* bMap_archive */
571 False, /* bStoreDosAttributes */
572 False, /* bDmapiSupport */
573 True, /* bLocking */
574 Auto, /* iStrictLocking */
575 True, /* bPosixLocking */
576 True, /* bShareModes */
577 True, /* bOpLocks */
578 True, /* bLevel2OpLocks */
579 False, /* bOnlyUser */
580 True, /* bMangledNames */
581 True, /* bWidelinks */
582 True, /* bSymlinks */
583 False, /* bSyncAlways */
584 False, /* bStrictAllocate */
585 False, /* bStrictSync */
586 '~', /* magic char */
587 NULL, /* copymap */
588 False, /* bDeleteReadonly */
589 False, /* bFakeOplocks */
590 False, /* bDeleteVetoFiles */
591 False, /* bDosFilemode */
592 True, /* bDosFiletimes */
593 False, /* bDosFiletimeResolution */
594 False, /* bFakeDirCreateTimes */
595 True, /* bBlockingLocks */
596 False, /* bInheritPerms */
597 False, /* bInheritACLS */
598 False, /* bInheritOwner */
599 False, /* bMSDfsRoot */
600 False, /* bUseClientDriver */
601 True, /* bDefaultDevmode */
602 False, /* bForcePrintername */
603 True, /* bNTAclSupport */
604 False, /* bForceUnknownAclUser */
605 False, /* bUseSendfile */
606 False, /* bProfileAcls */
607 False, /* bMap_acl_inherit */
608 False, /* bAfs_Share */
609 False, /* bEASupport */
610 True, /* bAclCheckPermissions */
611 True, /* bAclMapFullControl */
612 False, /* bAclGroupControl */
613 True, /* bChangeNotify */
614 True, /* bKernelChangeNotify */
615 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
616 0, /* iAioReadSize */
617 0, /* iAioWriteSize */
618 MAP_READONLY_YES, /* iMap_readonly */
619 #ifdef BROKEN_DIRECTORY_HANDLING
620 0, /* iDirectoryNameCacheSize */
621 #else
622 100, /* iDirectoryNameCacheSize */
623 #endif
624 Auto, /* ismb_encrypt */
625 NULL, /* Parametric options */
627 "" /* dummy */
630 /* local variables */
631 static struct service **ServicePtrs = NULL;
632 static int iNumServices = 0;
633 static int iServiceIndex = 0;
634 static struct db_context *ServiceHash;
635 static int *invalid_services = NULL;
636 static int num_invalid_services = 0;
637 static bool bInGlobalSection = True;
638 static bool bGlobalOnly = False;
639 static int server_role;
640 static int default_server_announce;
642 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
644 /* prototypes for the special type handlers */
645 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
646 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
647 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
648 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
649 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
650 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
651 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
652 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
653 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
654 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
655 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
656 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
658 static void set_server_role(void);
659 static void set_default_server_announce_type(void);
660 static void set_allowed_client_auth(void);
662 static const struct enum_list enum_protocol[] = {
663 {PROTOCOL_NT1, "NT1"},
664 {PROTOCOL_LANMAN2, "LANMAN2"},
665 {PROTOCOL_LANMAN1, "LANMAN1"},
666 {PROTOCOL_CORE, "CORE"},
667 {PROTOCOL_COREPLUS, "COREPLUS"},
668 {PROTOCOL_COREPLUS, "CORE+"},
669 {-1, NULL}
672 static const struct enum_list enum_security[] = {
673 {SEC_SHARE, "SHARE"},
674 {SEC_USER, "USER"},
675 {SEC_SERVER, "SERVER"},
676 {SEC_DOMAIN, "DOMAIN"},
677 #ifdef HAVE_ADS
678 {SEC_ADS, "ADS"},
679 #endif
680 {-1, NULL}
683 static const struct enum_list enum_printing[] = {
684 {PRINT_SYSV, "sysv"},
685 {PRINT_AIX, "aix"},
686 {PRINT_HPUX, "hpux"},
687 {PRINT_BSD, "bsd"},
688 {PRINT_QNX, "qnx"},
689 {PRINT_PLP, "plp"},
690 {PRINT_LPRNG, "lprng"},
691 {PRINT_CUPS, "cups"},
692 {PRINT_IPRINT, "iprint"},
693 {PRINT_LPRNT, "nt"},
694 {PRINT_LPROS2, "os2"},
695 #ifdef DEVELOPER
696 {PRINT_TEST, "test"},
697 {PRINT_VLP, "vlp"},
698 #endif /* DEVELOPER */
699 {-1, NULL}
702 static const struct enum_list enum_ldap_sasl_wrapping[] = {
703 {0, "plain"},
704 {ADS_AUTH_SASL_SIGN, "sign"},
705 {ADS_AUTH_SASL_SEAL, "seal"},
706 {-1, NULL}
709 static const struct enum_list enum_ldap_ssl[] = {
710 {LDAP_SSL_OFF, "no"},
711 {LDAP_SSL_OFF, "No"},
712 {LDAP_SSL_OFF, "off"},
713 {LDAP_SSL_OFF, "Off"},
714 {LDAP_SSL_START_TLS, "start tls"},
715 {LDAP_SSL_START_TLS, "Start_tls"},
716 {-1, NULL}
719 static const struct enum_list enum_ldap_passwd_sync[] = {
720 {LDAP_PASSWD_SYNC_OFF, "no"},
721 {LDAP_PASSWD_SYNC_OFF, "No"},
722 {LDAP_PASSWD_SYNC_OFF, "off"},
723 {LDAP_PASSWD_SYNC_OFF, "Off"},
724 {LDAP_PASSWD_SYNC_ON, "Yes"},
725 {LDAP_PASSWD_SYNC_ON, "yes"},
726 {LDAP_PASSWD_SYNC_ON, "on"},
727 {LDAP_PASSWD_SYNC_ON, "On"},
728 {LDAP_PASSWD_SYNC_ONLY, "Only"},
729 {LDAP_PASSWD_SYNC_ONLY, "only"},
730 {-1, NULL}
733 /* Types of machine we can announce as. */
734 #define ANNOUNCE_AS_NT_SERVER 1
735 #define ANNOUNCE_AS_WIN95 2
736 #define ANNOUNCE_AS_WFW 3
737 #define ANNOUNCE_AS_NT_WORKSTATION 4
739 static const struct enum_list enum_announce_as[] = {
740 {ANNOUNCE_AS_NT_SERVER, "NT"},
741 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
742 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
743 {ANNOUNCE_AS_WIN95, "win95"},
744 {ANNOUNCE_AS_WFW, "WfW"},
745 {-1, NULL}
748 static const struct enum_list enum_map_readonly[] = {
749 {MAP_READONLY_NO, "no"},
750 {MAP_READONLY_NO, "false"},
751 {MAP_READONLY_NO, "0"},
752 {MAP_READONLY_YES, "yes"},
753 {MAP_READONLY_YES, "true"},
754 {MAP_READONLY_YES, "1"},
755 {MAP_READONLY_PERMISSIONS, "permissions"},
756 {MAP_READONLY_PERMISSIONS, "perms"},
757 {-1, NULL}
760 static const struct enum_list enum_case[] = {
761 {CASE_LOWER, "lower"},
762 {CASE_UPPER, "upper"},
763 {-1, NULL}
766 static const struct enum_list enum_bool_auto[] = {
767 {False, "No"},
768 {False, "False"},
769 {False, "0"},
770 {True, "Yes"},
771 {True, "True"},
772 {True, "1"},
773 {Auto, "Auto"},
774 {-1, NULL}
777 /* Client-side offline caching policy types */
778 #define CSC_POLICY_MANUAL 0
779 #define CSC_POLICY_DOCUMENTS 1
780 #define CSC_POLICY_PROGRAMS 2
781 #define CSC_POLICY_DISABLE 3
783 static const struct enum_list enum_csc_policy[] = {
784 {CSC_POLICY_MANUAL, "manual"},
785 {CSC_POLICY_DOCUMENTS, "documents"},
786 {CSC_POLICY_PROGRAMS, "programs"},
787 {CSC_POLICY_DISABLE, "disable"},
788 {-1, NULL}
791 /* SMB signing types. */
792 static const struct enum_list enum_smb_signing_vals[] = {
793 {False, "No"},
794 {False, "False"},
795 {False, "0"},
796 {False, "Off"},
797 {False, "disabled"},
798 {True, "Yes"},
799 {True, "True"},
800 {True, "1"},
801 {True, "On"},
802 {True, "enabled"},
803 {Auto, "auto"},
804 {Required, "required"},
805 {Required, "mandatory"},
806 {Required, "force"},
807 {Required, "forced"},
808 {Required, "enforced"},
809 {-1, NULL}
812 /* ACL compatibility options. */
813 static const struct enum_list enum_acl_compat_vals[] = {
814 { ACL_COMPAT_AUTO, "auto" },
815 { ACL_COMPAT_WINNT, "winnt" },
816 { ACL_COMPAT_WIN2K, "win2k" },
817 { -1, NULL}
821 Do you want session setups at user level security with a invalid
822 password to be rejected or allowed in as guest? WinNT rejects them
823 but it can be a pain as it means "net view" needs to use a password
825 You have 3 choices in the setting of map_to_guest:
827 "Never" means session setups with an invalid password
828 are rejected. This is the default.
830 "Bad User" means session setups with an invalid password
831 are rejected, unless the username does not exist, in which case it
832 is treated as a guest login
834 "Bad Password" means session setups with an invalid password
835 are treated as a guest login
837 Note that map_to_guest only has an effect in user or server
838 level security.
841 static const struct enum_list enum_map_to_guest[] = {
842 {NEVER_MAP_TO_GUEST, "Never"},
843 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
844 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
845 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
846 {-1, NULL}
849 /* Config backend options */
851 static const struct enum_list enum_config_backend[] = {
852 {CONFIG_BACKEND_FILE, "file"},
853 {CONFIG_BACKEND_REGISTRY, "registry"},
854 {-1, NULL}
857 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
859 * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
860 * screen in SWAT. This is used to exclude parameters as well as to squash all
861 * parameters that have been duplicated by pseudonyms.
863 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
864 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
865 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
866 * respective views.
868 * NOTE2: Handling of duplicated (synonym) paramters:
869 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
870 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
871 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
872 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
875 static struct parm_struct parm_table[] = {
876 {N_("Base Options"), P_SEP, P_SEPARATOR},
879 .label = "dos charset",
880 .type = P_STRING,
881 .p_class = P_GLOBAL,
882 .ptr = &Globals.dos_charset,
883 .special = handle_charset,
884 .enum_list = NULL,
885 .flags = FLAG_ADVANCED
888 .label = "unix charset",
889 .type = P_STRING,
890 .p_class = P_GLOBAL,
891 .ptr = &Globals.unix_charset,
892 .special = handle_charset,
893 .enum_list = NULL,
894 .flags = FLAG_ADVANCED
897 .label = "display charset",
898 .type = P_STRING,
899 .p_class = P_GLOBAL,
900 .ptr = &Globals.display_charset,
901 .special = handle_charset,
902 .enum_list = NULL,
903 .flags = FLAG_ADVANCED
906 .label = "comment",
907 .type = P_STRING,
908 .p_class = P_LOCAL,
909 .ptr = &sDefault.comment,
910 .special = NULL,
911 .enum_list = NULL,
912 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
915 .label = "path",
916 .type = P_STRING,
917 .p_class = P_LOCAL,
918 .ptr = &sDefault.szPath,
919 .special = NULL,
920 .enum_list = NULL,
921 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
924 .label = "directory",
925 .type = P_STRING,
926 .p_class = P_LOCAL,
927 .ptr = &sDefault.szPath,
928 .special = NULL,
929 .enum_list = NULL,
930 .flags = FLAG_HIDE,
933 .label = "workgroup",
934 .type = P_USTRING,
935 .p_class = P_GLOBAL,
936 .ptr = &Globals.szWorkgroup,
937 .special = handle_workgroup,
938 .enum_list = NULL,
939 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
941 #ifdef WITH_ADS
943 .label = "realm",
944 .type = P_USTRING,
945 .p_class = P_GLOBAL,
946 .ptr = &Globals.szRealm,
947 .special = NULL,
948 .enum_list = NULL,
949 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
951 #endif
953 .label = "netbios name",
954 .type = P_USTRING,
955 .p_class = P_GLOBAL,
956 .ptr = &Globals.szNetbiosName,
957 .special = handle_netbios_name,
958 .enum_list = NULL,
959 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
962 .label = "netbios aliases",
963 .type = P_LIST,
964 .p_class = P_GLOBAL,
965 .ptr = &Globals.szNetbiosAliases,
966 .special = handle_netbios_aliases,
967 .enum_list = NULL,
968 .flags = FLAG_ADVANCED,
971 .label = "netbios scope",
972 .type = P_USTRING,
973 .p_class = P_GLOBAL,
974 .ptr = &Globals.szNetbiosScope,
975 .special = handle_netbios_scope,
976 .enum_list = NULL,
977 .flags = FLAG_ADVANCED,
980 .label = "server string",
981 .type = P_STRING,
982 .p_class = P_GLOBAL,
983 .ptr = &Globals.szServerString,
984 .special = NULL,
985 .enum_list = NULL,
986 .flags = FLAG_BASIC | FLAG_ADVANCED,
989 .label = "interfaces",
990 .type = P_LIST,
991 .p_class = P_GLOBAL,
992 .ptr = &Globals.szInterfaces,
993 .special = NULL,
994 .enum_list = NULL,
995 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
998 .label = "bind interfaces only",
999 .type = P_BOOL,
1000 .p_class = P_GLOBAL,
1001 .ptr = &Globals.bBindInterfacesOnly,
1002 .special = NULL,
1003 .enum_list = NULL,
1004 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1007 .label = "config backend",
1008 .type = P_ENUM,
1009 .p_class = P_GLOBAL,
1010 .ptr = &Globals.ConfigBackend,
1011 .special = NULL,
1012 .enum_list = enum_config_backend,
1013 .flags = FLAG_ADVANCED,
1016 {N_("Security Options"), P_SEP, P_SEPARATOR},
1019 .label = "security",
1020 .type = P_ENUM,
1021 .p_class = P_GLOBAL,
1022 .ptr = &Globals.security,
1023 .special = NULL,
1024 .enum_list = enum_security,
1025 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1028 .label = "auth methods",
1029 .type = P_LIST,
1030 .p_class = P_GLOBAL,
1031 .ptr = &Globals.AuthMethods,
1032 .special = NULL,
1033 .enum_list = NULL,
1034 .flags = FLAG_ADVANCED,
1037 .label = "encrypt passwords",
1038 .type = P_BOOL,
1039 .p_class = P_GLOBAL,
1040 .ptr = &Globals.bEncryptPasswords,
1041 .special = NULL,
1042 .enum_list = NULL,
1043 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1046 .label = "update encrypted",
1047 .type = P_BOOL,
1048 .p_class = P_GLOBAL,
1049 .ptr = &Globals.bUpdateEncrypt,
1050 .special = NULL,
1051 .enum_list = NULL,
1052 .flags = FLAG_ADVANCED,
1055 .label = "client schannel",
1056 .type = P_ENUM,
1057 .p_class = P_GLOBAL,
1058 .ptr = &Globals.clientSchannel,
1059 .special = NULL,
1060 .enum_list = enum_bool_auto,
1061 .flags = FLAG_BASIC | FLAG_ADVANCED,
1064 .label = "server schannel",
1065 .type = P_ENUM,
1066 .p_class = P_GLOBAL,
1067 .ptr = &Globals.serverSchannel,
1068 .special = NULL,
1069 .enum_list = enum_bool_auto,
1070 .flags = FLAG_BASIC | FLAG_ADVANCED,
1073 .label = "allow trusted domains",
1074 .type = P_BOOL,
1075 .p_class = P_GLOBAL,
1076 .ptr = &Globals.bAllowTrustedDomains,
1077 .special = NULL,
1078 .enum_list = NULL,
1079 .flags = FLAG_ADVANCED,
1082 .label = "map to guest",
1083 .type = P_ENUM,
1084 .p_class = P_GLOBAL,
1085 .ptr = &Globals.map_to_guest,
1086 .special = NULL,
1087 .enum_list = enum_map_to_guest,
1088 .flags = FLAG_ADVANCED,
1091 .label = "null passwords",
1092 .type = P_BOOL,
1093 .p_class = P_GLOBAL,
1094 .ptr = &Globals.bNullPasswords,
1095 .special = NULL,
1096 .enum_list = NULL,
1097 .flags = FLAG_ADVANCED,
1100 .label = "obey pam restrictions",
1101 .type = P_BOOL,
1102 .p_class = P_GLOBAL,
1103 .ptr = &Globals.bObeyPamRestrictions,
1104 .special = NULL,
1105 .enum_list = NULL,
1106 .flags = FLAG_ADVANCED,
1109 .label = "password server",
1110 .type = P_STRING,
1111 .p_class = P_GLOBAL,
1112 .ptr = &Globals.szPasswordServer,
1113 .special = NULL,
1114 .enum_list = NULL,
1115 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1118 .label = "smb passwd file",
1119 .type = P_STRING,
1120 .p_class = P_GLOBAL,
1121 .ptr = &Globals.szSMBPasswdFile,
1122 .special = NULL,
1123 .enum_list = NULL,
1124 .flags = FLAG_ADVANCED,
1127 .label = "private dir",
1128 .type = P_STRING,
1129 .p_class = P_GLOBAL,
1130 .ptr = &Globals.szPrivateDir,
1131 .special = NULL,
1132 .enum_list = NULL,
1133 .flags = FLAG_ADVANCED,
1136 .label = "passdb backend",
1137 .type = P_STRING,
1138 .p_class = P_GLOBAL,
1139 .ptr = &Globals.szPassdbBackend,
1140 .special = NULL,
1141 .enum_list = NULL,
1142 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1145 .label = "algorithmic rid base",
1146 .type = P_INTEGER,
1147 .p_class = P_GLOBAL,
1148 .ptr = &Globals.AlgorithmicRidBase,
1149 .special = NULL,
1150 .enum_list = NULL,
1151 .flags = FLAG_ADVANCED,
1154 .label = "root directory",
1155 .type = P_STRING,
1156 .p_class = P_GLOBAL,
1157 .ptr = &Globals.szRootdir,
1158 .special = NULL,
1159 .enum_list = NULL,
1160 .flags = FLAG_ADVANCED,
1163 .label = "root dir",
1164 .type = P_STRING,
1165 .p_class = P_GLOBAL,
1166 .ptr = &Globals.szRootdir,
1167 .special = NULL,
1168 .enum_list = NULL,
1169 .flags = FLAG_HIDE,
1172 .label = "root",
1173 .type = P_STRING,
1174 .p_class = P_GLOBAL,
1175 .ptr = &Globals.szRootdir,
1176 .special = NULL,
1177 .enum_list = NULL,
1178 .flags = FLAG_HIDE,
1181 .label = "guest account",
1182 .type = P_STRING,
1183 .p_class = P_GLOBAL,
1184 .ptr = &Globals.szGuestaccount,
1185 .special = NULL,
1186 .enum_list = NULL,
1187 .flags = FLAG_BASIC | FLAG_ADVANCED,
1190 .label = "enable privileges",
1191 .type = P_BOOL,
1192 .p_class = P_GLOBAL,
1193 .ptr = &Globals.bEnablePrivileges,
1194 .special = NULL,
1195 .enum_list = NULL,
1196 .flags = FLAG_ADVANCED,
1200 .label = "pam password change",
1201 .type = P_BOOL,
1202 .p_class = P_GLOBAL,
1203 .ptr = &Globals.bPamPasswordChange,
1204 .special = NULL,
1205 .enum_list = NULL,
1206 .flags = FLAG_ADVANCED,
1209 .label = "passwd program",
1210 .type = P_STRING,
1211 .p_class = P_GLOBAL,
1212 .ptr = &Globals.szPasswdProgram,
1213 .special = NULL,
1214 .enum_list = NULL,
1215 .flags = FLAG_ADVANCED,
1218 .label = "passwd chat",
1219 .type = P_STRING,
1220 .p_class = P_GLOBAL,
1221 .ptr = &Globals.szPasswdChat,
1222 .special = NULL,
1223 .enum_list = NULL,
1224 .flags = FLAG_ADVANCED,
1227 .label = "passwd chat debug",
1228 .type = P_BOOL,
1229 .p_class = P_GLOBAL,
1230 .ptr = &Globals.bPasswdChatDebug,
1231 .special = NULL,
1232 .enum_list = NULL,
1233 .flags = FLAG_ADVANCED,
1236 .label = "passwd chat timeout",
1237 .type = P_INTEGER,
1238 .p_class = P_GLOBAL,
1239 .ptr = &Globals.iPasswdChatTimeout,
1240 .special = NULL,
1241 .enum_list = NULL,
1242 .flags = FLAG_ADVANCED,
1245 .label = "check password script",
1246 .type = P_STRING,
1247 .p_class = P_GLOBAL,
1248 .ptr = &Globals.szCheckPasswordScript,
1249 .special = NULL,
1250 .enum_list = NULL,
1251 .flags = FLAG_ADVANCED,
1254 .label = "username map",
1255 .type = P_STRING,
1256 .p_class = P_GLOBAL,
1257 .ptr = &Globals.szUsernameMap,
1258 .special = NULL,
1259 .enum_list = NULL,
1260 .flags = FLAG_ADVANCED,
1263 .label = "password level",
1264 .type = P_INTEGER,
1265 .p_class = P_GLOBAL,
1266 .ptr = &Globals.pwordlevel,
1267 .special = NULL,
1268 .enum_list = NULL,
1269 .flags = FLAG_ADVANCED,
1272 .label = "username level",
1273 .type = P_INTEGER,
1274 .p_class = P_GLOBAL,
1275 .ptr = &Globals.unamelevel,
1276 .special = NULL,
1277 .enum_list = NULL,
1278 .flags = FLAG_ADVANCED,
1281 .label = "unix password sync",
1282 .type = P_BOOL,
1283 .p_class = P_GLOBAL,
1284 .ptr = &Globals.bUnixPasswdSync,
1285 .special = NULL,
1286 .enum_list = NULL,
1287 .flags = FLAG_ADVANCED,
1290 .label = "restrict anonymous",
1291 .type = P_INTEGER,
1292 .p_class = P_GLOBAL,
1293 .ptr = &Globals.restrict_anonymous,
1294 .special = NULL,
1295 .enum_list = NULL,
1296 .flags = FLAG_ADVANCED,
1299 .label = "lanman auth",
1300 .type = P_BOOL,
1301 .p_class = P_GLOBAL,
1302 .ptr = &Globals.bLanmanAuth,
1303 .special = NULL,
1304 .enum_list = NULL,
1305 .flags = FLAG_ADVANCED,
1308 .label = "ntlm auth",
1309 .type = P_BOOL,
1310 .p_class = P_GLOBAL,
1311 .ptr = &Globals.bNTLMAuth,
1312 .special = NULL,
1313 .enum_list = NULL,
1314 .flags = FLAG_ADVANCED,
1317 .label = "client NTLMv2 auth",
1318 .type = P_BOOL,
1319 .p_class = P_GLOBAL,
1320 .ptr = &Globals.bClientNTLMv2Auth,
1321 .special = NULL,
1322 .enum_list = NULL,
1323 .flags = FLAG_ADVANCED,
1326 .label = "client lanman auth",
1327 .type = P_BOOL,
1328 .p_class = P_GLOBAL,
1329 .ptr = &Globals.bClientLanManAuth,
1330 .special = NULL,
1331 .enum_list = NULL,
1332 .flags = FLAG_ADVANCED,
1335 .label = "client plaintext auth",
1336 .type = P_BOOL,
1337 .p_class = P_GLOBAL,
1338 .ptr = &Globals.bClientPlaintextAuth,
1339 .special = NULL,
1340 .enum_list = NULL,
1341 .flags = FLAG_ADVANCED,
1344 .label = "username",
1345 .type = P_STRING,
1346 .p_class = P_LOCAL,
1347 .ptr = &sDefault.szUsername,
1348 .special = NULL,
1349 .enum_list = NULL,
1350 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1353 .label = "user",
1354 .type = P_STRING,
1355 .p_class = P_LOCAL,
1356 .ptr = &sDefault.szUsername,
1357 .special = NULL,
1358 .enum_list = NULL,
1359 .flags = FLAG_HIDE,
1362 .label = "users",
1363 .type = P_STRING,
1364 .p_class = P_LOCAL,
1365 .ptr = &sDefault.szUsername,
1366 .special = NULL,
1367 .enum_list = NULL,
1368 .flags = FLAG_HIDE,
1371 .label = "invalid users",
1372 .type = P_LIST,
1373 .p_class = P_LOCAL,
1374 .ptr = &sDefault.szInvalidUsers,
1375 .special = NULL,
1376 .enum_list = NULL,
1377 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1380 .label = "valid users",
1381 .type = P_LIST,
1382 .p_class = P_LOCAL,
1383 .ptr = &sDefault.szValidUsers,
1384 .special = NULL,
1385 .enum_list = NULL,
1386 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1389 .label = "admin users",
1390 .type = P_LIST,
1391 .p_class = P_LOCAL,
1392 .ptr = &sDefault.szAdminUsers,
1393 .special = NULL,
1394 .enum_list = NULL,
1395 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1398 .label = "read list",
1399 .type = P_LIST,
1400 .p_class = P_LOCAL,
1401 .ptr = &sDefault.readlist,
1402 .special = NULL,
1403 .enum_list = NULL,
1404 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1407 .label = "write list",
1408 .type = P_LIST,
1409 .p_class = P_LOCAL,
1410 .ptr = &sDefault.writelist,
1411 .special = NULL,
1412 .enum_list = NULL,
1413 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1416 .label = "printer admin",
1417 .type = P_LIST,
1418 .p_class = P_LOCAL,
1419 .ptr = &sDefault.printer_admin,
1420 .special = NULL,
1421 .enum_list = NULL,
1422 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1425 .label = "force user",
1426 .type = P_STRING,
1427 .p_class = P_LOCAL,
1428 .ptr = &sDefault.force_user,
1429 .special = NULL,
1430 .enum_list = NULL,
1431 .flags = FLAG_ADVANCED | FLAG_SHARE,
1434 .label = "force group",
1435 .type = P_STRING,
1436 .p_class = P_LOCAL,
1437 .ptr = &sDefault.force_group,
1438 .special = NULL,
1439 .enum_list = NULL,
1440 .flags = FLAG_ADVANCED | FLAG_SHARE,
1443 .label = "group",
1444 .type = P_STRING,
1445 .p_class = P_LOCAL,
1446 .ptr = &sDefault.force_group,
1447 .special = NULL,
1448 .enum_list = NULL,
1449 .flags = FLAG_ADVANCED,
1452 .label = "read only",
1453 .type = P_BOOL,
1454 .p_class = P_LOCAL,
1455 .ptr = &sDefault.bRead_only,
1456 .special = NULL,
1457 .enum_list = NULL,
1458 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1461 .label = "write ok",
1462 .type = P_BOOLREV,
1463 .p_class = P_LOCAL,
1464 .ptr = &sDefault.bRead_only,
1465 .special = NULL,
1466 .enum_list = NULL,
1467 .flags = FLAG_HIDE,
1470 .label = "writeable",
1471 .type = P_BOOLREV,
1472 .p_class = P_LOCAL,
1473 .ptr = &sDefault.bRead_only,
1474 .special = NULL,
1475 .enum_list = NULL,
1476 .flags = FLAG_HIDE,
1479 .label = "writable",
1480 .type = P_BOOLREV,
1481 .p_class = P_LOCAL,
1482 .ptr = &sDefault.bRead_only,
1483 .special = NULL,
1484 .enum_list = NULL,
1485 .flags = FLAG_HIDE,
1488 .label = "acl check permissions",
1489 .type = P_BOOL,
1490 .p_class = P_LOCAL,
1491 .ptr = &sDefault.bAclCheckPermissions,
1492 .special = NULL,
1493 .enum_list = NULL,
1494 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1497 .label = "acl group control",
1498 .type = P_BOOL,
1499 .p_class = P_LOCAL,
1500 .ptr = &sDefault.bAclGroupControl,
1501 .special = NULL,
1502 .enum_list = NULL,
1503 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
1506 .label = "acl map full control",
1507 .type = P_BOOL,
1508 .p_class = P_LOCAL,
1509 .ptr = &sDefault.bAclMapFullControl,
1510 .special = NULL,
1511 .enum_list = NULL,
1512 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1515 .label = "create mask",
1516 .type = P_OCTAL,
1517 .p_class = P_LOCAL,
1518 .ptr = &sDefault.iCreate_mask,
1519 .special = NULL,
1520 .enum_list = NULL,
1521 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1524 .label = "create mode",
1525 .type = P_OCTAL,
1526 .p_class = P_LOCAL,
1527 .ptr = &sDefault.iCreate_mask,
1528 .special = NULL,
1529 .enum_list = NULL,
1530 .flags = FLAG_HIDE,
1533 .label = "force create mode",
1534 .type = P_OCTAL,
1535 .p_class = P_LOCAL,
1536 .ptr = &sDefault.iCreate_force_mode,
1537 .special = NULL,
1538 .enum_list = NULL,
1539 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1542 .label = "security mask",
1543 .type = P_OCTAL,
1544 .p_class = P_LOCAL,
1545 .ptr = &sDefault.iSecurity_mask,
1546 .special = NULL,
1547 .enum_list = NULL,
1548 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1551 .label = "force security mode",
1552 .type = P_OCTAL,
1553 .p_class = P_LOCAL,
1554 .ptr = &sDefault.iSecurity_force_mode,
1555 .special = NULL,
1556 .enum_list = NULL,
1557 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1560 .label = "directory mask",
1561 .type = P_OCTAL,
1562 .p_class = P_LOCAL,
1563 .ptr = &sDefault.iDir_mask,
1564 .special = NULL,
1565 .enum_list = NULL,
1566 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1569 .label = "directory mode",
1570 .type = P_OCTAL,
1571 .p_class = P_LOCAL,
1572 .ptr = &sDefault.iDir_mask,
1573 .special = NULL,
1574 .enum_list = NULL,
1575 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1578 .label = "force directory mode",
1579 .type = P_OCTAL,
1580 .p_class = P_LOCAL,
1581 .ptr = &sDefault.iDir_force_mode,
1582 .special = NULL,
1583 .enum_list = NULL,
1584 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1587 .label = "directory security mask",
1588 .type = P_OCTAL,
1589 .p_class = P_LOCAL,
1590 .ptr = &sDefault.iDir_Security_mask,
1591 .special = NULL,
1592 .enum_list = NULL,
1593 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1596 .label = "force directory security mode",
1597 .type = P_OCTAL,
1598 .p_class = P_LOCAL,
1599 .ptr = &sDefault.iDir_Security_force_mode,
1600 .special = NULL,
1601 .enum_list = NULL,
1602 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1605 .label = "force unknown acl user",
1606 .type = P_BOOL,
1607 .p_class = P_LOCAL,
1608 .ptr = &sDefault.bForceUnknownAclUser,
1609 .special = NULL,
1610 .enum_list = NULL,
1611 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1614 .label = "inherit permissions",
1615 .type = P_BOOL,
1616 .p_class = P_LOCAL,
1617 .ptr = &sDefault.bInheritPerms,
1618 .special = NULL,
1619 .enum_list = NULL,
1620 .flags = FLAG_ADVANCED | FLAG_SHARE,
1623 .label = "inherit acls",
1624 .type = P_BOOL,
1625 .p_class = P_LOCAL,
1626 .ptr = &sDefault.bInheritACLS,
1627 .special = NULL,
1628 .enum_list = NULL,
1629 .flags = FLAG_ADVANCED | FLAG_SHARE,
1632 .label = "inherit owner",
1633 .type = P_BOOL,
1634 .p_class = P_LOCAL,
1635 .ptr = &sDefault.bInheritOwner,
1636 .special = NULL,
1637 .enum_list = NULL,
1638 .flags = FLAG_ADVANCED | FLAG_SHARE,
1641 .label = "guest only",
1642 .type = P_BOOL,
1643 .p_class = P_LOCAL,
1644 .ptr = &sDefault.bGuest_only,
1645 .special = NULL,
1646 .enum_list = NULL,
1647 .flags = FLAG_ADVANCED | FLAG_SHARE,
1650 .label = "only guest",
1651 .type = P_BOOL,
1652 .p_class = P_LOCAL,
1653 .ptr = &sDefault.bGuest_only,
1654 .special = NULL,
1655 .enum_list = NULL,
1656 .flags = FLAG_HIDE,
1659 .label = "administrative share",
1660 .type = P_BOOL,
1661 .p_class = P_LOCAL,
1662 .ptr = &sDefault.bAdministrative_share,
1663 .special = NULL,
1664 .enum_list = NULL,
1665 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1669 .label = "guest ok",
1670 .type = P_BOOL,
1671 .p_class = P_LOCAL,
1672 .ptr = &sDefault.bGuest_ok,
1673 .special = NULL,
1674 .enum_list = NULL,
1675 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1678 .label = "public",
1679 .type = P_BOOL,
1680 .p_class = P_LOCAL,
1681 .ptr = &sDefault.bGuest_ok,
1682 .special = NULL,
1683 .enum_list = NULL,
1684 .flags = FLAG_HIDE,
1687 .label = "only user",
1688 .type = P_BOOL,
1689 .p_class = P_LOCAL,
1690 .ptr = &sDefault.bOnlyUser,
1691 .special = NULL,
1692 .enum_list = NULL,
1693 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1696 .label = "hosts allow",
1697 .type = P_LIST,
1698 .p_class = P_LOCAL,
1699 .ptr = &sDefault.szHostsallow,
1700 .special = NULL,
1701 .enum_list = NULL,
1702 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1705 .label = "allow hosts",
1706 .type = P_LIST,
1707 .p_class = P_LOCAL,
1708 .ptr = &sDefault.szHostsallow,
1709 .special = NULL,
1710 .enum_list = NULL,
1711 .flags = FLAG_HIDE,
1714 .label = "hosts deny",
1715 .type = P_LIST,
1716 .p_class = P_LOCAL,
1717 .ptr = &sDefault.szHostsdeny,
1718 .special = NULL,
1719 .enum_list = NULL,
1720 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1723 .label = "deny hosts",
1724 .type = P_LIST,
1725 .p_class = P_LOCAL,
1726 .ptr = &sDefault.szHostsdeny,
1727 .special = NULL,
1728 .enum_list = NULL,
1729 .flags = FLAG_HIDE,
1732 .label = "preload modules",
1733 .type = P_LIST,
1734 .p_class = P_GLOBAL,
1735 .ptr = &Globals.szPreloadModules,
1736 .special = NULL,
1737 .enum_list = NULL,
1738 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1741 .label = "use kerberos keytab",
1742 .type = P_BOOL,
1743 .p_class = P_GLOBAL,
1744 .ptr = &Globals.bUseKerberosKeytab,
1745 .special = NULL,
1746 .enum_list = NULL,
1747 .flags = FLAG_ADVANCED,
1750 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1753 .label = "log level",
1754 .type = P_STRING,
1755 .p_class = P_GLOBAL,
1756 .ptr = &Globals.szLogLevel,
1757 .special = handle_debug_list,
1758 .enum_list = NULL,
1759 .flags = FLAG_ADVANCED,
1762 .label = "debuglevel",
1763 .type = P_STRING,
1764 .p_class = P_GLOBAL,
1765 .ptr = &Globals.szLogLevel,
1766 .special = handle_debug_list,
1767 .enum_list = NULL,
1768 .flags = FLAG_HIDE,
1771 .label = "syslog",
1772 .type = P_INTEGER,
1773 .p_class = P_GLOBAL,
1774 .ptr = &Globals.syslog,
1775 .special = NULL,
1776 .enum_list = NULL,
1777 .flags = FLAG_ADVANCED,
1780 .label = "syslog only",
1781 .type = P_BOOL,
1782 .p_class = P_GLOBAL,
1783 .ptr = &Globals.bSyslogOnly,
1784 .special = NULL,
1785 .enum_list = NULL,
1786 .flags = FLAG_ADVANCED,
1789 .label = "log file",
1790 .type = P_STRING,
1791 .p_class = P_GLOBAL,
1792 .ptr = &Globals.szLogFile,
1793 .special = NULL,
1794 .enum_list = NULL,
1795 .flags = FLAG_ADVANCED,
1798 .label = "max log size",
1799 .type = P_INTEGER,
1800 .p_class = P_GLOBAL,
1801 .ptr = &Globals.max_log_size,
1802 .special = NULL,
1803 .enum_list = NULL,
1804 .flags = FLAG_ADVANCED,
1807 .label = "debug timestamp",
1808 .type = P_BOOL,
1809 .p_class = P_GLOBAL,
1810 .ptr = &Globals.bTimestampLogs,
1811 .special = NULL,
1812 .enum_list = NULL,
1813 .flags = FLAG_ADVANCED,
1816 .label = "timestamp logs",
1817 .type = P_BOOL,
1818 .p_class = P_GLOBAL,
1819 .ptr = &Globals.bTimestampLogs,
1820 .special = NULL,
1821 .enum_list = NULL,
1822 .flags = FLAG_ADVANCED,
1825 .label = "debug prefix timestamp",
1826 .type = P_BOOL,
1827 .p_class = P_GLOBAL,
1828 .ptr = &Globals.bDebugPrefixTimestamp,
1829 .special = NULL,
1830 .enum_list = NULL,
1831 .flags = FLAG_ADVANCED,
1834 .label = "debug hires timestamp",
1835 .type = P_BOOL,
1836 .p_class = P_GLOBAL,
1837 .ptr = &Globals.bDebugHiresTimestamp,
1838 .special = NULL,
1839 .enum_list = NULL,
1840 .flags = FLAG_ADVANCED,
1843 .label = "debug pid",
1844 .type = P_BOOL,
1845 .p_class = P_GLOBAL,
1846 .ptr = &Globals.bDebugPid,
1847 .special = NULL,
1848 .enum_list = NULL,
1849 .flags = FLAG_ADVANCED,
1852 .label = "debug uid",
1853 .type = P_BOOL,
1854 .p_class = P_GLOBAL,
1855 .ptr = &Globals.bDebugUid,
1856 .special = NULL,
1857 .enum_list = NULL,
1858 .flags = FLAG_ADVANCED,
1861 .label = "debug class",
1862 .type = P_BOOL,
1863 .p_class = P_GLOBAL,
1864 .ptr = &Globals.bDebugClass,
1865 .special = NULL,
1866 .enum_list = NULL,
1867 .flags = FLAG_ADVANCED,
1870 .label = "enable core files",
1871 .type = P_BOOL,
1872 .p_class = P_GLOBAL,
1873 .ptr = &Globals.bEnableCoreFiles,
1874 .special = NULL,
1875 .enum_list = NULL,
1876 .flags = FLAG_ADVANCED,
1879 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1882 .label = "allocation roundup size",
1883 .type = P_INTEGER,
1884 .p_class = P_LOCAL,
1885 .ptr = &sDefault.iallocation_roundup_size,
1886 .special = NULL,
1887 .enum_list = NULL,
1888 .flags = FLAG_ADVANCED,
1891 .label = "aio read size",
1892 .type = P_INTEGER,
1893 .p_class = P_LOCAL,
1894 .ptr = &sDefault.iAioReadSize,
1895 .special = NULL,
1896 .enum_list = NULL,
1897 .flags = FLAG_ADVANCED,
1900 .label = "aio write size",
1901 .type = P_INTEGER,
1902 .p_class = P_LOCAL,
1903 .ptr = &sDefault.iAioWriteSize,
1904 .special = NULL,
1905 .enum_list = NULL,
1906 .flags = FLAG_ADVANCED,
1909 .label = "aio write behind",
1910 .type = P_STRING,
1911 .p_class = P_LOCAL,
1912 .ptr = &sDefault.szAioWriteBehind,
1913 .special = NULL,
1914 .enum_list = NULL,
1915 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1918 .label = "smb ports",
1919 .type = P_STRING,
1920 .p_class = P_GLOBAL,
1921 .ptr = &Globals.smb_ports,
1922 .special = NULL,
1923 .enum_list = NULL,
1924 .flags = FLAG_ADVANCED,
1927 .label = "large readwrite",
1928 .type = P_BOOL,
1929 .p_class = P_GLOBAL,
1930 .ptr = &Globals.bLargeReadwrite,
1931 .special = NULL,
1932 .enum_list = NULL,
1933 .flags = FLAG_ADVANCED,
1936 .label = "max protocol",
1937 .type = P_ENUM,
1938 .p_class = P_GLOBAL,
1939 .ptr = &Globals.maxprotocol,
1940 .special = NULL,
1941 .enum_list = enum_protocol,
1942 .flags = FLAG_ADVANCED,
1945 .label = "protocol",
1946 .type = P_ENUM,
1947 .p_class = P_GLOBAL,
1948 .ptr = &Globals.maxprotocol,
1949 .special = NULL,
1950 .enum_list = enum_protocol,
1951 .flags = FLAG_ADVANCED,
1954 .label = "min protocol",
1955 .type = P_ENUM,
1956 .p_class = P_GLOBAL,
1957 .ptr = &Globals.minprotocol,
1958 .special = NULL,
1959 .enum_list = enum_protocol,
1960 .flags = FLAG_ADVANCED,
1963 .label = "min receivefile size",
1964 .type = P_INTEGER,
1965 .p_class = P_GLOBAL,
1966 .ptr = &Globals.iminreceivefile,
1967 .special = NULL,
1968 .enum_list = NULL,
1969 .flags = FLAG_ADVANCED,
1972 .label = "read raw",
1973 .type = P_BOOL,
1974 .p_class = P_GLOBAL,
1975 .ptr = &Globals.bReadRaw,
1976 .special = NULL,
1977 .enum_list = NULL,
1978 .flags = FLAG_ADVANCED,
1981 .label = "write raw",
1982 .type = P_BOOL,
1983 .p_class = P_GLOBAL,
1984 .ptr = &Globals.bWriteRaw,
1985 .special = NULL,
1986 .enum_list = NULL,
1987 .flags = FLAG_ADVANCED,
1990 .label = "disable netbios",
1991 .type = P_BOOL,
1992 .p_class = P_GLOBAL,
1993 .ptr = &Globals.bDisableNetbios,
1994 .special = NULL,
1995 .enum_list = NULL,
1996 .flags = FLAG_ADVANCED,
1999 .label = "reset on zero vc",
2000 .type = P_BOOL,
2001 .p_class = P_GLOBAL,
2002 .ptr = &Globals.bResetOnZeroVC,
2003 .special = NULL,
2004 .enum_list = NULL,
2005 .flags = FLAG_ADVANCED,
2008 .label = "acl compatibility",
2009 .type = P_ENUM,
2010 .p_class = P_GLOBAL,
2011 .ptr = &Globals.iAclCompat,
2012 .special = NULL,
2013 .enum_list = enum_acl_compat_vals,
2014 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2017 .label = "defer sharing violations",
2018 .type = P_BOOL,
2019 .p_class = P_GLOBAL,
2020 .ptr = &Globals.bDeferSharingViolations,
2021 .special = NULL,
2022 .enum_list = NULL,
2023 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2026 .label = "ea support",
2027 .type = P_BOOL,
2028 .p_class = P_LOCAL,
2029 .ptr = &sDefault.bEASupport,
2030 .special = NULL,
2031 .enum_list = NULL,
2032 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2035 .label = "nt acl support",
2036 .type = P_BOOL,
2037 .p_class = P_LOCAL,
2038 .ptr = &sDefault.bNTAclSupport,
2039 .special = NULL,
2040 .enum_list = NULL,
2041 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2044 .label = "nt pipe support",
2045 .type = P_BOOL,
2046 .p_class = P_GLOBAL,
2047 .ptr = &Globals.bNTPipeSupport,
2048 .special = NULL,
2049 .enum_list = NULL,
2050 .flags = FLAG_ADVANCED,
2053 .label = "nt status support",
2054 .type = P_BOOL,
2055 .p_class = P_GLOBAL,
2056 .ptr = &Globals.bNTStatusSupport,
2057 .special = NULL,
2058 .enum_list = NULL,
2059 .flags = FLAG_ADVANCED,
2062 .label = "profile acls",
2063 .type = P_BOOL,
2064 .p_class = P_LOCAL,
2065 .ptr = &sDefault.bProfileAcls,
2066 .special = NULL,
2067 .enum_list = NULL,
2068 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2071 .label = "announce version",
2072 .type = P_STRING,
2073 .p_class = P_GLOBAL,
2074 .ptr = &Globals.szAnnounceVersion,
2075 .special = NULL,
2076 .enum_list = NULL,
2077 .flags = FLAG_ADVANCED,
2080 .label = "announce as",
2081 .type = P_ENUM,
2082 .p_class = P_GLOBAL,
2083 .ptr = &Globals.announce_as,
2084 .special = NULL,
2085 .enum_list = enum_announce_as,
2086 .flags = FLAG_ADVANCED,
2089 .label = "map acl inherit",
2090 .type = P_BOOL,
2091 .p_class = P_LOCAL,
2092 .ptr = &sDefault.bMap_acl_inherit,
2093 .special = NULL,
2094 .enum_list = NULL,
2095 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2098 .label = "afs share",
2099 .type = P_BOOL,
2100 .p_class = P_LOCAL,
2101 .ptr = &sDefault.bAfs_Share,
2102 .special = NULL,
2103 .enum_list = NULL,
2104 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2107 .label = "max mux",
2108 .type = P_INTEGER,
2109 .p_class = P_GLOBAL,
2110 .ptr = &Globals.max_mux,
2111 .special = NULL,
2112 .enum_list = NULL,
2113 .flags = FLAG_ADVANCED,
2116 .label = "max xmit",
2117 .type = P_INTEGER,
2118 .p_class = P_GLOBAL,
2119 .ptr = &Globals.max_xmit,
2120 .special = NULL,
2121 .enum_list = NULL,
2122 .flags = FLAG_ADVANCED,
2125 .label = "name resolve order",
2126 .type = P_STRING,
2127 .p_class = P_GLOBAL,
2128 .ptr = &Globals.szNameResolveOrder,
2129 .special = NULL,
2130 .enum_list = NULL,
2131 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2134 .label = "max ttl",
2135 .type = P_INTEGER,
2136 .p_class = P_GLOBAL,
2137 .ptr = &Globals.max_ttl,
2138 .special = NULL,
2139 .enum_list = NULL,
2140 .flags = FLAG_ADVANCED,
2143 .label = "max wins ttl",
2144 .type = P_INTEGER,
2145 .p_class = P_GLOBAL,
2146 .ptr = &Globals.max_wins_ttl,
2147 .special = NULL,
2148 .enum_list = NULL,
2149 .flags = FLAG_ADVANCED,
2152 .label = "min wins ttl",
2153 .type = P_INTEGER,
2154 .p_class = P_GLOBAL,
2155 .ptr = &Globals.min_wins_ttl,
2156 .special = NULL,
2157 .enum_list = NULL,
2158 .flags = FLAG_ADVANCED,
2161 .label = "time server",
2162 .type = P_BOOL,
2163 .p_class = P_GLOBAL,
2164 .ptr = &Globals.bTimeServer,
2165 .special = NULL,
2166 .enum_list = NULL,
2167 .flags = FLAG_ADVANCED,
2170 .label = "unix extensions",
2171 .type = P_BOOL,
2172 .p_class = P_GLOBAL,
2173 .ptr = &Globals.bUnixExtensions,
2174 .special = NULL,
2175 .enum_list = NULL,
2176 .flags = FLAG_ADVANCED,
2179 .label = "use spnego",
2180 .type = P_BOOL,
2181 .p_class = P_GLOBAL,
2182 .ptr = &Globals.bUseSpnego,
2183 .special = NULL,
2184 .enum_list = NULL,
2185 .flags = FLAG_ADVANCED,
2188 .label = "client signing",
2189 .type = P_ENUM,
2190 .p_class = P_GLOBAL,
2191 .ptr = &Globals.client_signing,
2192 .special = NULL,
2193 .enum_list = enum_smb_signing_vals,
2194 .flags = FLAG_ADVANCED,
2197 .label = "server signing",
2198 .type = P_ENUM,
2199 .p_class = P_GLOBAL,
2200 .ptr = &Globals.server_signing,
2201 .special = NULL,
2202 .enum_list = enum_smb_signing_vals,
2203 .flags = FLAG_ADVANCED,
2206 .label = "smb encrypt",
2207 .type = P_ENUM,
2208 .p_class = P_LOCAL,
2209 .ptr = &sDefault.ismb_encrypt,
2210 .special = NULL,
2211 .enum_list = enum_smb_signing_vals,
2212 .flags = FLAG_ADVANCED,
2215 .label = "client use spnego",
2216 .type = P_BOOL,
2217 .p_class = P_GLOBAL,
2218 .ptr = &Globals.bClientUseSpnego,
2219 .special = NULL,
2220 .enum_list = NULL,
2221 .flags = FLAG_ADVANCED,
2224 .label = "client ldap sasl wrapping",
2225 .type = P_ENUM,
2226 .p_class = P_GLOBAL,
2227 .ptr = &Globals.client_ldap_sasl_wrapping,
2228 .special = NULL,
2229 .enum_list = enum_ldap_sasl_wrapping,
2230 .flags = FLAG_ADVANCED,
2233 .label = "enable asu support",
2234 .type = P_BOOL,
2235 .p_class = P_GLOBAL,
2236 .ptr = &Globals.bASUSupport,
2237 .special = NULL,
2238 .enum_list = NULL,
2239 .flags = FLAG_ADVANCED,
2242 .label = "svcctl list",
2243 .type = P_LIST,
2244 .p_class = P_GLOBAL,
2245 .ptr = &Globals.szServicesList,
2246 .special = NULL,
2247 .enum_list = NULL,
2248 .flags = FLAG_ADVANCED,
2251 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2254 .label = "block size",
2255 .type = P_INTEGER,
2256 .p_class = P_LOCAL,
2257 .ptr = &sDefault.iBlock_size,
2258 .special = NULL,
2259 .enum_list = NULL,
2260 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2263 .label = "deadtime",
2264 .type = P_INTEGER,
2265 .p_class = P_GLOBAL,
2266 .ptr = &Globals.deadtime,
2267 .special = NULL,
2268 .enum_list = NULL,
2269 .flags = FLAG_ADVANCED,
2272 .label = "getwd cache",
2273 .type = P_BOOL,
2274 .p_class = P_GLOBAL,
2275 .ptr = &Globals.getwd_cache,
2276 .special = NULL,
2277 .enum_list = NULL,
2278 .flags = FLAG_ADVANCED,
2281 .label = "keepalive",
2282 .type = P_INTEGER,
2283 .p_class = P_GLOBAL,
2284 .ptr = &Globals.iKeepalive,
2285 .special = NULL,
2286 .enum_list = NULL,
2287 .flags = FLAG_ADVANCED,
2290 .label = "change notify",
2291 .type = P_BOOL,
2292 .p_class = P_LOCAL,
2293 .ptr = &sDefault.bChangeNotify,
2294 .special = NULL,
2295 .enum_list = NULL,
2296 .flags = FLAG_ADVANCED | FLAG_SHARE,
2299 .label = "directory name cache size",
2300 .type = P_INTEGER,
2301 .p_class = P_LOCAL,
2302 .ptr = &sDefault.iDirectoryNameCacheSize,
2303 .special = NULL,
2304 .enum_list = NULL,
2305 .flags = FLAG_ADVANCED | FLAG_SHARE,
2308 .label = "kernel change notify",
2309 .type = P_BOOL,
2310 .p_class = P_LOCAL,
2311 .ptr = &sDefault.bKernelChangeNotify,
2312 .special = NULL,
2313 .enum_list = NULL,
2314 .flags = FLAG_ADVANCED | FLAG_SHARE,
2317 .label = "lpq cache time",
2318 .type = P_INTEGER,
2319 .p_class = P_GLOBAL,
2320 .ptr = &Globals.lpqcachetime,
2321 .special = NULL,
2322 .enum_list = NULL,
2323 .flags = FLAG_ADVANCED,
2326 .label = "max smbd processes",
2327 .type = P_INTEGER,
2328 .p_class = P_GLOBAL,
2329 .ptr = &Globals.iMaxSmbdProcesses,
2330 .special = NULL,
2331 .enum_list = NULL,
2332 .flags = FLAG_ADVANCED,
2335 .label = "max connections",
2336 .type = P_INTEGER,
2337 .p_class = P_LOCAL,
2338 .ptr = &sDefault.iMaxConnections,
2339 .special = NULL,
2340 .enum_list = NULL,
2341 .flags = FLAG_ADVANCED | FLAG_SHARE,
2344 .label = "paranoid server security",
2345 .type = P_BOOL,
2346 .p_class = P_GLOBAL,
2347 .ptr = &Globals.paranoid_server_security,
2348 .special = NULL,
2349 .enum_list = NULL,
2350 .flags = FLAG_ADVANCED,
2353 .label = "max disk size",
2354 .type = P_INTEGER,
2355 .p_class = P_GLOBAL,
2356 .ptr = &Globals.maxdisksize,
2357 .special = NULL,
2358 .enum_list = NULL,
2359 .flags = FLAG_ADVANCED,
2362 .label = "max open files",
2363 .type = P_INTEGER,
2364 .p_class = P_GLOBAL,
2365 .ptr = &Globals.max_open_files,
2366 .special = NULL,
2367 .enum_list = NULL,
2368 .flags = FLAG_ADVANCED,
2371 .label = "min print space",
2372 .type = P_INTEGER,
2373 .p_class = P_LOCAL,
2374 .ptr = &sDefault.iMinPrintSpace,
2375 .special = NULL,
2376 .enum_list = NULL,
2377 .flags = FLAG_ADVANCED | FLAG_PRINT,
2380 .label = "socket options",
2381 .type = P_STRING,
2382 .p_class = P_GLOBAL,
2383 .ptr = &Globals.szSocketOptions,
2384 .special = NULL,
2385 .enum_list = NULL,
2386 .flags = FLAG_ADVANCED,
2389 .label = "strict allocate",
2390 .type = P_BOOL,
2391 .p_class = P_LOCAL,
2392 .ptr = &sDefault.bStrictAllocate,
2393 .special = NULL,
2394 .enum_list = NULL,
2395 .flags = FLAG_ADVANCED | FLAG_SHARE,
2398 .label = "strict sync",
2399 .type = P_BOOL,
2400 .p_class = P_LOCAL,
2401 .ptr = &sDefault.bStrictSync,
2402 .special = NULL,
2403 .enum_list = NULL,
2404 .flags = FLAG_ADVANCED | FLAG_SHARE,
2407 .label = "sync always",
2408 .type = P_BOOL,
2409 .p_class = P_LOCAL,
2410 .ptr = &sDefault.bSyncAlways,
2411 .special = NULL,
2412 .enum_list = NULL,
2413 .flags = FLAG_ADVANCED | FLAG_SHARE,
2416 .label = "use mmap",
2417 .type = P_BOOL,
2418 .p_class = P_GLOBAL,
2419 .ptr = &Globals.bUseMmap,
2420 .special = NULL,
2421 .enum_list = NULL,
2422 .flags = FLAG_ADVANCED,
2425 .label = "use sendfile",
2426 .type = P_BOOL,
2427 .p_class = P_LOCAL,
2428 .ptr = &sDefault.bUseSendfile,
2429 .special = NULL,
2430 .enum_list = NULL,
2431 .flags = FLAG_ADVANCED | FLAG_SHARE,
2434 .label = "hostname lookups",
2435 .type = P_BOOL,
2436 .p_class = P_GLOBAL,
2437 .ptr = &Globals.bHostnameLookups,
2438 .special = NULL,
2439 .enum_list = NULL,
2440 .flags = FLAG_ADVANCED,
2443 .label = "write cache size",
2444 .type = P_INTEGER,
2445 .p_class = P_LOCAL,
2446 .ptr = &sDefault.iWriteCacheSize,
2447 .special = NULL,
2448 .enum_list = NULL,
2449 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
2452 .label = "name cache timeout",
2453 .type = P_INTEGER,
2454 .p_class = P_GLOBAL,
2455 .ptr = &Globals.name_cache_timeout,
2456 .special = NULL,
2457 .enum_list = NULL,
2458 .flags = FLAG_ADVANCED,
2461 .label = "ctdbd socket",
2462 .type = P_STRING,
2463 .p_class = P_GLOBAL,
2464 .ptr = &Globals.ctdbdSocket,
2465 .special = NULL,
2466 .enum_list = NULL,
2467 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2470 .label = "cluster addresses",
2471 .type = P_LIST,
2472 .p_class = P_GLOBAL,
2473 .ptr = &Globals.szClusterAddresses,
2474 .special = NULL,
2475 .enum_list = NULL,
2476 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2479 .label = "clustering",
2480 .type = P_BOOL,
2481 .p_class = P_GLOBAL,
2482 .ptr = &Globals.clustering,
2483 .special = NULL,
2484 .enum_list = NULL,
2485 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2488 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2491 .label = "max reported print jobs",
2492 .type = P_INTEGER,
2493 .p_class = P_LOCAL,
2494 .ptr = &sDefault.iMaxReportedPrintJobs,
2495 .special = NULL,
2496 .enum_list = NULL,
2497 .flags = FLAG_ADVANCED | FLAG_PRINT,
2500 .label = "max print jobs",
2501 .type = P_INTEGER,
2502 .p_class = P_LOCAL,
2503 .ptr = &sDefault.iMaxPrintJobs,
2504 .special = NULL,
2505 .enum_list = NULL,
2506 .flags = FLAG_ADVANCED | FLAG_PRINT,
2509 .label = "load printers",
2510 .type = P_BOOL,
2511 .p_class = P_GLOBAL,
2512 .ptr = &Globals.bLoadPrinters,
2513 .special = NULL,
2514 .enum_list = NULL,
2515 .flags = FLAG_ADVANCED | FLAG_PRINT,
2518 .label = "printcap cache time",
2519 .type = P_INTEGER,
2520 .p_class = P_GLOBAL,
2521 .ptr = &Globals.PrintcapCacheTime,
2522 .special = NULL,
2523 .enum_list = NULL,
2524 .flags = FLAG_ADVANCED | FLAG_PRINT,
2527 .label = "printcap name",
2528 .type = P_STRING,
2529 .p_class = P_GLOBAL,
2530 .ptr = &Globals.szPrintcapname,
2531 .special = NULL,
2532 .enum_list = NULL,
2533 .flags = FLAG_ADVANCED | FLAG_PRINT,
2536 .label = "printcap",
2537 .type = P_STRING,
2538 .p_class = P_GLOBAL,
2539 .ptr = &Globals.szPrintcapname,
2540 .special = NULL,
2541 .enum_list = NULL,
2542 .flags = FLAG_HIDE,
2545 .label = "printable",
2546 .type = P_BOOL,
2547 .p_class = P_LOCAL,
2548 .ptr = &sDefault.bPrint_ok,
2549 .special = NULL,
2550 .enum_list = NULL,
2551 .flags = FLAG_ADVANCED | FLAG_PRINT,
2554 .label = "print ok",
2555 .type = P_BOOL,
2556 .p_class = P_LOCAL,
2557 .ptr = &sDefault.bPrint_ok,
2558 .special = NULL,
2559 .enum_list = NULL,
2560 .flags = FLAG_HIDE,
2563 .label = "printing",
2564 .type = P_ENUM,
2565 .p_class = P_LOCAL,
2566 .ptr = &sDefault.iPrinting,
2567 .special = handle_printing,
2568 .enum_list = enum_printing,
2569 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2572 .label = "cups options",
2573 .type = P_STRING,
2574 .p_class = P_LOCAL,
2575 .ptr = &sDefault.szCupsOptions,
2576 .special = NULL,
2577 .enum_list = NULL,
2578 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2581 .label = "cups server",
2582 .type = P_STRING,
2583 .p_class = P_GLOBAL,
2584 .ptr = &Globals.szCupsServer,
2585 .special = NULL,
2586 .enum_list = NULL,
2587 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2590 .label = "iprint server",
2591 .type = P_STRING,
2592 .p_class = P_GLOBAL,
2593 .ptr = &Globals.szIPrintServer,
2594 .special = NULL,
2595 .enum_list = NULL,
2596 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2599 .label = "print command",
2600 .type = P_STRING,
2601 .p_class = P_LOCAL,
2602 .ptr = &sDefault.szPrintcommand,
2603 .special = NULL,
2604 .enum_list = NULL,
2605 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2608 .label = "disable spoolss",
2609 .type = P_BOOL,
2610 .p_class = P_GLOBAL,
2611 .ptr = &Globals.bDisableSpoolss,
2612 .special = NULL,
2613 .enum_list = NULL,
2614 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2617 .label = "enable spoolss",
2618 .type = P_BOOLREV,
2619 .p_class = P_GLOBAL,
2620 .ptr = &Globals.bDisableSpoolss,
2621 .special = NULL,
2622 .enum_list = NULL,
2623 .flags = FLAG_HIDE,
2626 .label = "lpq command",
2627 .type = P_STRING,
2628 .p_class = P_LOCAL,
2629 .ptr = &sDefault.szLpqcommand,
2630 .special = NULL,
2631 .enum_list = NULL,
2632 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2635 .label = "lprm command",
2636 .type = P_STRING,
2637 .p_class = P_LOCAL,
2638 .ptr = &sDefault.szLprmcommand,
2639 .special = NULL,
2640 .enum_list = NULL,
2641 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2644 .label = "lppause command",
2645 .type = P_STRING,
2646 .p_class = P_LOCAL,
2647 .ptr = &sDefault.szLppausecommand,
2648 .special = NULL,
2649 .enum_list = NULL,
2650 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2653 .label = "lpresume command",
2654 .type = P_STRING,
2655 .p_class = P_LOCAL,
2656 .ptr = &sDefault.szLpresumecommand,
2657 .special = NULL,
2658 .enum_list = NULL,
2659 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2662 .label = "queuepause command",
2663 .type = P_STRING,
2664 .p_class = P_LOCAL,
2665 .ptr = &sDefault.szQueuepausecommand,
2666 .special = NULL,
2667 .enum_list = NULL,
2668 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2671 .label = "queueresume command",
2672 .type = P_STRING,
2673 .p_class = P_LOCAL,
2674 .ptr = &sDefault.szQueueresumecommand,
2675 .special = NULL,
2676 .enum_list = NULL,
2677 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2680 .label = "addport command",
2681 .type = P_STRING,
2682 .p_class = P_GLOBAL,
2683 .ptr = &Globals.szAddPortCommand,
2684 .special = NULL,
2685 .enum_list = NULL,
2686 .flags = FLAG_ADVANCED,
2689 .label = "enumports command",
2690 .type = P_STRING,
2691 .p_class = P_GLOBAL,
2692 .ptr = &Globals.szEnumPortsCommand,
2693 .special = NULL,
2694 .enum_list = NULL,
2695 .flags = FLAG_ADVANCED,
2698 .label = "addprinter command",
2699 .type = P_STRING,
2700 .p_class = P_GLOBAL,
2701 .ptr = &Globals.szAddPrinterCommand,
2702 .special = NULL,
2703 .enum_list = NULL,
2704 .flags = FLAG_ADVANCED,
2707 .label = "deleteprinter command",
2708 .type = P_STRING,
2709 .p_class = P_GLOBAL,
2710 .ptr = &Globals.szDeletePrinterCommand,
2711 .special = NULL,
2712 .enum_list = NULL,
2713 .flags = FLAG_ADVANCED,
2716 .label = "show add printer wizard",
2717 .type = P_BOOL,
2718 .p_class = P_GLOBAL,
2719 .ptr = &Globals.bMsAddPrinterWizard,
2720 .special = NULL,
2721 .enum_list = NULL,
2722 .flags = FLAG_ADVANCED,
2725 .label = "os2 driver map",
2726 .type = P_STRING,
2727 .p_class = P_GLOBAL,
2728 .ptr = &Globals.szOs2DriverMap,
2729 .special = NULL,
2730 .enum_list = NULL,
2731 .flags = FLAG_ADVANCED,
2735 .label = "printer name",
2736 .type = P_STRING,
2737 .p_class = P_LOCAL,
2738 .ptr = &sDefault.szPrintername,
2739 .special = NULL,
2740 .enum_list = NULL,
2741 .flags = FLAG_ADVANCED | FLAG_PRINT,
2744 .label = "printer",
2745 .type = P_STRING,
2746 .p_class = P_LOCAL,
2747 .ptr = &sDefault.szPrintername,
2748 .special = NULL,
2749 .enum_list = NULL,
2750 .flags = FLAG_HIDE,
2753 .label = "use client driver",
2754 .type = P_BOOL,
2755 .p_class = P_LOCAL,
2756 .ptr = &sDefault.bUseClientDriver,
2757 .special = NULL,
2758 .enum_list = NULL,
2759 .flags = FLAG_ADVANCED | FLAG_PRINT,
2762 .label = "default devmode",
2763 .type = P_BOOL,
2764 .p_class = P_LOCAL,
2765 .ptr = &sDefault.bDefaultDevmode,
2766 .special = NULL,
2767 .enum_list = NULL,
2768 .flags = FLAG_ADVANCED | FLAG_PRINT,
2771 .label = "force printername",
2772 .type = P_BOOL,
2773 .p_class = P_LOCAL,
2774 .ptr = &sDefault.bForcePrintername,
2775 .special = NULL,
2776 .enum_list = NULL,
2777 .flags = FLAG_ADVANCED | FLAG_PRINT,
2780 .label = "printjob username",
2781 .type = P_STRING,
2782 .p_class = P_LOCAL,
2783 .ptr = &sDefault.szPrintjobUsername,
2784 .special = NULL,
2785 .enum_list = NULL,
2786 .flags = FLAG_ADVANCED | FLAG_PRINT,
2789 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2792 .label = "mangling method",
2793 .type = P_STRING,
2794 .p_class = P_GLOBAL,
2795 .ptr = &Globals.szManglingMethod,
2796 .special = NULL,
2797 .enum_list = NULL,
2798 .flags = FLAG_ADVANCED,
2801 .label = "mangle prefix",
2802 .type = P_INTEGER,
2803 .p_class = P_GLOBAL,
2804 .ptr = &Globals.mangle_prefix,
2805 .special = NULL,
2806 .enum_list = NULL,
2807 .flags = FLAG_ADVANCED,
2811 .label = "default case",
2812 .type = P_ENUM,
2813 .p_class = P_LOCAL,
2814 .ptr = &sDefault.iDefaultCase,
2815 .special = NULL,
2816 .enum_list = enum_case,
2817 .flags = FLAG_ADVANCED | FLAG_SHARE,
2820 .label = "case sensitive",
2821 .type = P_ENUM,
2822 .p_class = P_LOCAL,
2823 .ptr = &sDefault.iCaseSensitive,
2824 .special = NULL,
2825 .enum_list = enum_bool_auto,
2826 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2829 .label = "casesignames",
2830 .type = P_ENUM,
2831 .p_class = P_LOCAL,
2832 .ptr = &sDefault.iCaseSensitive,
2833 .special = NULL,
2834 .enum_list = enum_bool_auto,
2835 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2838 .label = "preserve case",
2839 .type = P_BOOL,
2840 .p_class = P_LOCAL,
2841 .ptr = &sDefault.bCasePreserve,
2842 .special = NULL,
2843 .enum_list = NULL,
2844 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2847 .label = "short preserve case",
2848 .type = P_BOOL,
2849 .p_class = P_LOCAL,
2850 .ptr = &sDefault.bShortCasePreserve,
2851 .special = NULL,
2852 .enum_list = NULL,
2853 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2856 .label = "mangling char",
2857 .type = P_CHAR,
2858 .p_class = P_LOCAL,
2859 .ptr = &sDefault.magic_char,
2860 .special = NULL,
2861 .enum_list = NULL,
2862 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2865 .label = "hide dot files",
2866 .type = P_BOOL,
2867 .p_class = P_LOCAL,
2868 .ptr = &sDefault.bHideDotFiles,
2869 .special = NULL,
2870 .enum_list = NULL,
2871 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2874 .label = "hide special files",
2875 .type = P_BOOL,
2876 .p_class = P_LOCAL,
2877 .ptr = &sDefault.bHideSpecialFiles,
2878 .special = NULL,
2879 .enum_list = NULL,
2880 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2883 .label = "hide unreadable",
2884 .type = P_BOOL,
2885 .p_class = P_LOCAL,
2886 .ptr = &sDefault.bHideUnReadable,
2887 .special = NULL,
2888 .enum_list = NULL,
2889 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2892 .label = "hide unwriteable files",
2893 .type = P_BOOL,
2894 .p_class = P_LOCAL,
2895 .ptr = &sDefault.bHideUnWriteableFiles,
2896 .special = NULL,
2897 .enum_list = NULL,
2898 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2901 .label = "delete veto files",
2902 .type = P_BOOL,
2903 .p_class = P_LOCAL,
2904 .ptr = &sDefault.bDeleteVetoFiles,
2905 .special = NULL,
2906 .enum_list = NULL,
2907 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2910 .label = "veto files",
2911 .type = P_STRING,
2912 .p_class = P_LOCAL,
2913 .ptr = &sDefault.szVetoFiles,
2914 .special = NULL,
2915 .enum_list = NULL,
2916 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2919 .label = "hide files",
2920 .type = P_STRING,
2921 .p_class = P_LOCAL,
2922 .ptr = &sDefault.szHideFiles,
2923 .special = NULL,
2924 .enum_list = NULL,
2925 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2928 .label = "veto oplock files",
2929 .type = P_STRING,
2930 .p_class = P_LOCAL,
2931 .ptr = &sDefault.szVetoOplockFiles,
2932 .special = NULL,
2933 .enum_list = NULL,
2934 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2937 .label = "map archive",
2938 .type = P_BOOL,
2939 .p_class = P_LOCAL,
2940 .ptr = &sDefault.bMap_archive,
2941 .special = NULL,
2942 .enum_list = NULL,
2943 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2946 .label = "map hidden",
2947 .type = P_BOOL,
2948 .p_class = P_LOCAL,
2949 .ptr = &sDefault.bMap_hidden,
2950 .special = NULL,
2951 .enum_list = NULL,
2952 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2955 .label = "map system",
2956 .type = P_BOOL,
2957 .p_class = P_LOCAL,
2958 .ptr = &sDefault.bMap_system,
2959 .special = NULL,
2960 .enum_list = NULL,
2961 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2964 .label = "map readonly",
2965 .type = P_ENUM,
2966 .p_class = P_LOCAL,
2967 .ptr = &sDefault.iMap_readonly,
2968 .special = NULL,
2969 .enum_list = enum_map_readonly,
2970 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2973 .label = "mangled names",
2974 .type = P_BOOL,
2975 .p_class = P_LOCAL,
2976 .ptr = &sDefault.bMangledNames,
2977 .special = NULL,
2978 .enum_list = NULL,
2979 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2982 .label = "max stat cache size",
2983 .type = P_INTEGER,
2984 .p_class = P_GLOBAL,
2985 .ptr = &Globals.iMaxStatCacheSize,
2986 .special = NULL,
2987 .enum_list = NULL,
2988 .flags = FLAG_ADVANCED,
2991 .label = "stat cache",
2992 .type = P_BOOL,
2993 .p_class = P_GLOBAL,
2994 .ptr = &Globals.bStatCache,
2995 .special = NULL,
2996 .enum_list = NULL,
2997 .flags = FLAG_ADVANCED,
3000 .label = "store dos attributes",
3001 .type = P_BOOL,
3002 .p_class = P_LOCAL,
3003 .ptr = &sDefault.bStoreDosAttributes,
3004 .special = NULL,
3005 .enum_list = NULL,
3006 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3009 .label = "dmapi support",
3010 .type = P_BOOL,
3011 .p_class = P_LOCAL,
3012 .ptr = &sDefault.bDmapiSupport,
3013 .special = NULL,
3014 .enum_list = NULL,
3015 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3019 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3022 .label = "machine password timeout",
3023 .type = P_INTEGER,
3024 .p_class = P_GLOBAL,
3025 .ptr = &Globals.machine_password_timeout,
3026 .special = NULL,
3027 .enum_list = NULL,
3028 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3031 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3034 .label = "add user script",
3035 .type = P_STRING,
3036 .p_class = P_GLOBAL,
3037 .ptr = &Globals.szAddUserScript,
3038 .special = NULL,
3039 .enum_list = NULL,
3040 .flags = FLAG_ADVANCED,
3043 .label = "rename user script",
3044 .type = P_STRING,
3045 .p_class = P_GLOBAL,
3046 .ptr = &Globals.szRenameUserScript,
3047 .special = NULL,
3048 .enum_list = NULL,
3049 .flags = FLAG_ADVANCED,
3052 .label = "delete user script",
3053 .type = P_STRING,
3054 .p_class = P_GLOBAL,
3055 .ptr = &Globals.szDelUserScript,
3056 .special = NULL,
3057 .enum_list = NULL,
3058 .flags = FLAG_ADVANCED,
3061 .label = "add group script",
3062 .type = P_STRING,
3063 .p_class = P_GLOBAL,
3064 .ptr = &Globals.szAddGroupScript,
3065 .special = NULL,
3066 .enum_list = NULL,
3067 .flags = FLAG_ADVANCED,
3070 .label = "delete group script",
3071 .type = P_STRING,
3072 .p_class = P_GLOBAL,
3073 .ptr = &Globals.szDelGroupScript,
3074 .special = NULL,
3075 .enum_list = NULL,
3076 .flags = FLAG_ADVANCED,
3079 .label = "add user to group script",
3080 .type = P_STRING,
3081 .p_class = P_GLOBAL,
3082 .ptr = &Globals.szAddUserToGroupScript,
3083 .special = NULL,
3084 .enum_list = NULL,
3085 .flags = FLAG_ADVANCED,
3088 .label = "delete user from group script",
3089 .type = P_STRING,
3090 .p_class = P_GLOBAL,
3091 .ptr = &Globals.szDelUserFromGroupScript,
3092 .special = NULL,
3093 .enum_list = NULL,
3094 .flags = FLAG_ADVANCED,
3097 .label = "set primary group script",
3098 .type = P_STRING,
3099 .p_class = P_GLOBAL,
3100 .ptr = &Globals.szSetPrimaryGroupScript,
3101 .special = NULL,
3102 .enum_list = NULL,
3103 .flags = FLAG_ADVANCED,
3106 .label = "add machine script",
3107 .type = P_STRING,
3108 .p_class = P_GLOBAL,
3109 .ptr = &Globals.szAddMachineScript,
3110 .special = NULL,
3111 .enum_list = NULL,
3112 .flags = FLAG_ADVANCED,
3115 .label = "shutdown script",
3116 .type = P_STRING,
3117 .p_class = P_GLOBAL,
3118 .ptr = &Globals.szShutdownScript,
3119 .special = NULL,
3120 .enum_list = NULL,
3121 .flags = FLAG_ADVANCED,
3124 .label = "abort shutdown script",
3125 .type = P_STRING,
3126 .p_class = P_GLOBAL,
3127 .ptr = &Globals.szAbortShutdownScript,
3128 .special = NULL,
3129 .enum_list = NULL,
3130 .flags = FLAG_ADVANCED,
3133 .label = "username map script",
3134 .type = P_STRING,
3135 .p_class = P_GLOBAL,
3136 .ptr = &Globals.szUsernameMapScript,
3137 .special = NULL,
3138 .enum_list = NULL,
3139 .flags = FLAG_ADVANCED,
3142 .label = "logon script",
3143 .type = P_STRING,
3144 .p_class = P_GLOBAL,
3145 .ptr = &Globals.szLogonScript,
3146 .special = NULL,
3147 .enum_list = NULL,
3148 .flags = FLAG_ADVANCED,
3151 .label = "logon path",
3152 .type = P_STRING,
3153 .p_class = P_GLOBAL,
3154 .ptr = &Globals.szLogonPath,
3155 .special = NULL,
3156 .enum_list = NULL,
3157 .flags = FLAG_ADVANCED,
3160 .label = "logon drive",
3161 .type = P_STRING,
3162 .p_class = P_GLOBAL,
3163 .ptr = &Globals.szLogonDrive,
3164 .special = NULL,
3165 .enum_list = NULL,
3166 .flags = FLAG_ADVANCED,
3169 .label = "logon home",
3170 .type = P_STRING,
3171 .p_class = P_GLOBAL,
3172 .ptr = &Globals.szLogonHome,
3173 .special = NULL,
3174 .enum_list = NULL,
3175 .flags = FLAG_ADVANCED,
3178 .label = "domain logons",
3179 .type = P_BOOL,
3180 .p_class = P_GLOBAL,
3181 .ptr = &Globals.bDomainLogons,
3182 .special = NULL,
3183 .enum_list = NULL,
3184 .flags = FLAG_ADVANCED,
3187 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3190 .label = "os level",
3191 .type = P_INTEGER,
3192 .p_class = P_GLOBAL,
3193 .ptr = &Globals.os_level,
3194 .special = NULL,
3195 .enum_list = NULL,
3196 .flags = FLAG_BASIC | FLAG_ADVANCED,
3199 .label = "lm announce",
3200 .type = P_ENUM,
3201 .p_class = P_GLOBAL,
3202 .ptr = &Globals.lm_announce,
3203 .special = NULL,
3204 .enum_list = enum_bool_auto,
3205 .flags = FLAG_ADVANCED,
3208 .label = "lm interval",
3209 .type = P_INTEGER,
3210 .p_class = P_GLOBAL,
3211 .ptr = &Globals.lm_interval,
3212 .special = NULL,
3213 .enum_list = NULL,
3214 .flags = FLAG_ADVANCED,
3217 .label = "preferred master",
3218 .type = P_ENUM,
3219 .p_class = P_GLOBAL,
3220 .ptr = &Globals.iPreferredMaster,
3221 .special = NULL,
3222 .enum_list = enum_bool_auto,
3223 .flags = FLAG_BASIC | FLAG_ADVANCED,
3226 .label = "prefered master",
3227 .type = P_ENUM,
3228 .p_class = P_GLOBAL,
3229 .ptr = &Globals.iPreferredMaster,
3230 .special = NULL,
3231 .enum_list = enum_bool_auto,
3232 .flags = FLAG_HIDE,
3235 .label = "local master",
3236 .type = P_BOOL,
3237 .p_class = P_GLOBAL,
3238 .ptr = &Globals.bLocalMaster,
3239 .special = NULL,
3240 .enum_list = NULL,
3241 .flags = FLAG_BASIC | FLAG_ADVANCED,
3244 .label = "domain master",
3245 .type = P_ENUM,
3246 .p_class = P_GLOBAL,
3247 .ptr = &Globals.iDomainMaster,
3248 .special = NULL,
3249 .enum_list = enum_bool_auto,
3250 .flags = FLAG_BASIC | FLAG_ADVANCED,
3253 .label = "browse list",
3254 .type = P_BOOL,
3255 .p_class = P_GLOBAL,
3256 .ptr = &Globals.bBrowseList,
3257 .special = NULL,
3258 .enum_list = NULL,
3259 .flags = FLAG_ADVANCED,
3262 .label = "browseable",
3263 .type = P_BOOL,
3264 .p_class = P_LOCAL,
3265 .ptr = &sDefault.bBrowseable,
3266 .special = NULL,
3267 .enum_list = NULL,
3268 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3271 .label = "browsable",
3272 .type = P_BOOL,
3273 .p_class = P_LOCAL,
3274 .ptr = &sDefault.bBrowseable,
3275 .special = NULL,
3276 .enum_list = NULL,
3277 .flags = FLAG_HIDE,
3280 .label = "enhanced browsing",
3281 .type = P_BOOL,
3282 .p_class = P_GLOBAL,
3283 .ptr = &Globals.enhanced_browsing,
3284 .special = NULL,
3285 .enum_list = NULL,
3286 .flags = FLAG_ADVANCED,
3289 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3292 .label = "dns proxy",
3293 .type = P_BOOL,
3294 .p_class = P_GLOBAL,
3295 .ptr = &Globals.bDNSproxy,
3296 .special = NULL,
3297 .enum_list = NULL,
3298 .flags = FLAG_ADVANCED,
3301 .label = "wins proxy",
3302 .type = P_BOOL,
3303 .p_class = P_GLOBAL,
3304 .ptr = &Globals.bWINSproxy,
3305 .special = NULL,
3306 .enum_list = NULL,
3307 .flags = FLAG_ADVANCED,
3310 .label = "wins server",
3311 .type = P_LIST,
3312 .p_class = P_GLOBAL,
3313 .ptr = &Globals.szWINSservers,
3314 .special = NULL,
3315 .enum_list = NULL,
3316 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3319 .label = "wins support",
3320 .type = P_BOOL,
3321 .p_class = P_GLOBAL,
3322 .ptr = &Globals.bWINSsupport,
3323 .special = NULL,
3324 .enum_list = NULL,
3325 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3328 .label = "wins hook",
3329 .type = P_STRING,
3330 .p_class = P_GLOBAL,
3331 .ptr = &Globals.szWINSHook,
3332 .special = NULL,
3333 .enum_list = NULL,
3334 .flags = FLAG_ADVANCED,
3337 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3340 .label = "blocking locks",
3341 .type = P_BOOL,
3342 .p_class = P_LOCAL,
3343 .ptr = &sDefault.bBlockingLocks,
3344 .special = NULL,
3345 .enum_list = NULL,
3346 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3349 .label = "csc policy",
3350 .type = P_ENUM,
3351 .p_class = P_LOCAL,
3352 .ptr = &sDefault.iCSCPolicy,
3353 .special = NULL,
3354 .enum_list = enum_csc_policy,
3355 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3358 .label = "fake oplocks",
3359 .type = P_BOOL,
3360 .p_class = P_LOCAL,
3361 .ptr = &sDefault.bFakeOplocks,
3362 .special = NULL,
3363 .enum_list = NULL,
3364 .flags = FLAG_ADVANCED | FLAG_SHARE,
3367 .label = "kernel oplocks",
3368 .type = P_BOOL,
3369 .p_class = P_GLOBAL,
3370 .ptr = &Globals.bKernelOplocks,
3371 .special = NULL,
3372 .enum_list = NULL,
3373 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3376 .label = "locking",
3377 .type = P_BOOL,
3378 .p_class = P_LOCAL,
3379 .ptr = &sDefault.bLocking,
3380 .special = NULL,
3381 .enum_list = NULL,
3382 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3385 .label = "lock spin time",
3386 .type = P_INTEGER,
3387 .p_class = P_GLOBAL,
3388 .ptr = &Globals.iLockSpinTime,
3389 .special = NULL,
3390 .enum_list = NULL,
3391 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3394 .label = "oplocks",
3395 .type = P_BOOL,
3396 .p_class = P_LOCAL,
3397 .ptr = &sDefault.bOpLocks,
3398 .special = NULL,
3399 .enum_list = NULL,
3400 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3403 .label = "level2 oplocks",
3404 .type = P_BOOL,
3405 .p_class = P_LOCAL,
3406 .ptr = &sDefault.bLevel2OpLocks,
3407 .special = NULL,
3408 .enum_list = NULL,
3409 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3412 .label = "oplock break wait time",
3413 .type = P_INTEGER,
3414 .p_class = P_GLOBAL,
3415 .ptr = &Globals.oplock_break_wait_time,
3416 .special = NULL,
3417 .enum_list = NULL,
3418 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3421 .label = "oplock contention limit",
3422 .type = P_INTEGER,
3423 .p_class = P_LOCAL,
3424 .ptr = &sDefault.iOplockContentionLimit,
3425 .special = NULL,
3426 .enum_list = NULL,
3427 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3430 .label = "posix locking",
3431 .type = P_BOOL,
3432 .p_class = P_LOCAL,
3433 .ptr = &sDefault.bPosixLocking,
3434 .special = NULL,
3435 .enum_list = NULL,
3436 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3439 .label = "strict locking",
3440 .type = P_ENUM,
3441 .p_class = P_LOCAL,
3442 .ptr = &sDefault.iStrictLocking,
3443 .special = NULL,
3444 .enum_list = enum_bool_auto,
3445 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3448 .label = "share modes",
3449 .type = P_BOOL,
3450 .p_class = P_LOCAL,
3451 .ptr = &sDefault.bShareModes,
3452 .special = NULL,
3453 .enum_list = NULL,
3454 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3457 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3460 .label = "ldap admin dn",
3461 .type = P_STRING,
3462 .p_class = P_GLOBAL,
3463 .ptr = &Globals.szLdapAdminDn,
3464 .special = NULL,
3465 .enum_list = NULL,
3466 .flags = FLAG_ADVANCED,
3469 .label = "ldap delete dn",
3470 .type = P_BOOL,
3471 .p_class = P_GLOBAL,
3472 .ptr = &Globals.ldap_delete_dn,
3473 .special = NULL,
3474 .enum_list = NULL,
3475 .flags = FLAG_ADVANCED,
3478 .label = "ldap group suffix",
3479 .type = P_STRING,
3480 .p_class = P_GLOBAL,
3481 .ptr = &Globals.szLdapGroupSuffix,
3482 .special = NULL,
3483 .enum_list = NULL,
3484 .flags = FLAG_ADVANCED,
3487 .label = "ldap idmap suffix",
3488 .type = P_STRING,
3489 .p_class = P_GLOBAL,
3490 .ptr = &Globals.szLdapIdmapSuffix,
3491 .special = NULL,
3492 .enum_list = NULL,
3493 .flags = FLAG_ADVANCED,
3496 .label = "ldap machine suffix",
3497 .type = P_STRING,
3498 .p_class = P_GLOBAL,
3499 .ptr = &Globals.szLdapMachineSuffix,
3500 .special = NULL,
3501 .enum_list = NULL,
3502 .flags = FLAG_ADVANCED,
3505 .label = "ldap passwd sync",
3506 .type = P_ENUM,
3507 .p_class = P_GLOBAL,
3508 .ptr = &Globals.ldap_passwd_sync,
3509 .special = NULL,
3510 .enum_list = enum_ldap_passwd_sync,
3511 .flags = FLAG_ADVANCED,
3514 .label = "ldap password sync",
3515 .type = P_ENUM,
3516 .p_class = P_GLOBAL,
3517 .ptr = &Globals.ldap_passwd_sync,
3518 .special = NULL,
3519 .enum_list = enum_ldap_passwd_sync,
3520 .flags = FLAG_HIDE,
3523 .label = "ldap replication sleep",
3524 .type = P_INTEGER,
3525 .p_class = P_GLOBAL,
3526 .ptr = &Globals.ldap_replication_sleep,
3527 .special = NULL,
3528 .enum_list = NULL,
3529 .flags = FLAG_ADVANCED,
3532 .label = "ldap suffix",
3533 .type = P_STRING,
3534 .p_class = P_GLOBAL,
3535 .ptr = &Globals.szLdapSuffix,
3536 .special = NULL,
3537 .enum_list = NULL,
3538 .flags = FLAG_ADVANCED,
3541 .label = "ldap ssl",
3542 .type = P_ENUM,
3543 .p_class = P_GLOBAL,
3544 .ptr = &Globals.ldap_ssl,
3545 .special = NULL,
3546 .enum_list = enum_ldap_ssl,
3547 .flags = FLAG_ADVANCED,
3550 .label = "ldap timeout",
3551 .type = P_INTEGER,
3552 .p_class = P_GLOBAL,
3553 .ptr = &Globals.ldap_timeout,
3554 .special = NULL,
3555 .enum_list = NULL,
3556 .flags = FLAG_ADVANCED,
3559 .label = "ldap page size",
3560 .type = P_INTEGER,
3561 .p_class = P_GLOBAL,
3562 .ptr = &Globals.ldap_page_size,
3563 .special = NULL,
3564 .enum_list = NULL,
3565 .flags = FLAG_ADVANCED,
3568 .label = "ldap user suffix",
3569 .type = P_STRING,
3570 .p_class = P_GLOBAL,
3571 .ptr = &Globals.szLdapUserSuffix,
3572 .special = NULL,
3573 .enum_list = NULL,
3574 .flags = FLAG_ADVANCED,
3577 .label = "ldap debug level",
3578 .type = P_INTEGER,
3579 .p_class = P_GLOBAL,
3580 .ptr = &Globals.ldap_debug_level,
3581 .special = handle_ldap_debug_level,
3582 .enum_list = NULL,
3583 .flags = FLAG_ADVANCED,
3586 .label = "ldap debug threshold",
3587 .type = P_INTEGER,
3588 .p_class = P_GLOBAL,
3589 .ptr = &Globals.ldap_debug_threshold,
3590 .special = NULL,
3591 .enum_list = NULL,
3592 .flags = FLAG_ADVANCED,
3595 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3598 .label = "eventlog list",
3599 .type = P_LIST,
3600 .p_class = P_GLOBAL,
3601 .ptr = &Globals.szEventLogs,
3602 .special = NULL,
3603 .enum_list = NULL,
3604 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3607 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3610 .label = "add share command",
3611 .type = P_STRING,
3612 .p_class = P_GLOBAL,
3613 .ptr = &Globals.szAddShareCommand,
3614 .special = NULL,
3615 .enum_list = NULL,
3616 .flags = FLAG_ADVANCED,
3619 .label = "change share command",
3620 .type = P_STRING,
3621 .p_class = P_GLOBAL,
3622 .ptr = &Globals.szChangeShareCommand,
3623 .special = NULL,
3624 .enum_list = NULL,
3625 .flags = FLAG_ADVANCED,
3628 .label = "delete share command",
3629 .type = P_STRING,
3630 .p_class = P_GLOBAL,
3631 .ptr = &Globals.szDeleteShareCommand,
3632 .special = NULL,
3633 .enum_list = NULL,
3634 .flags = FLAG_ADVANCED,
3637 .label = "config file",
3638 .type = P_STRING,
3639 .p_class = P_GLOBAL,
3640 .ptr = &Globals.szConfigFile,
3641 .special = NULL,
3642 .enum_list = NULL,
3643 .flags = FLAG_HIDE,
3646 .label = "preload",
3647 .type = P_STRING,
3648 .p_class = P_GLOBAL,
3649 .ptr = &Globals.szAutoServices,
3650 .special = NULL,
3651 .enum_list = NULL,
3652 .flags = FLAG_ADVANCED,
3655 .label = "auto services",
3656 .type = P_STRING,
3657 .p_class = P_GLOBAL,
3658 .ptr = &Globals.szAutoServices,
3659 .special = NULL,
3660 .enum_list = NULL,
3661 .flags = FLAG_ADVANCED,
3664 .label = "lock directory",
3665 .type = P_STRING,
3666 .p_class = P_GLOBAL,
3667 .ptr = &Globals.szLockDir,
3668 .special = NULL,
3669 .enum_list = NULL,
3670 .flags = FLAG_ADVANCED,
3673 .label = "lock dir",
3674 .type = P_STRING,
3675 .p_class = P_GLOBAL,
3676 .ptr = &Globals.szLockDir,
3677 .special = NULL,
3678 .enum_list = NULL,
3679 .flags = FLAG_HIDE,
3682 .label = "pid directory",
3683 .type = P_STRING,
3684 .p_class = P_GLOBAL,
3685 .ptr = &Globals.szPidDir,
3686 .special = NULL,
3687 .enum_list = NULL,
3688 .flags = FLAG_ADVANCED,
3690 #ifdef WITH_UTMP
3692 .label = "utmp directory",
3693 .type = P_STRING,
3694 .p_class = P_GLOBAL,
3695 .ptr = &Globals.szUtmpDir,
3696 .special = NULL,
3697 .enum_list = NULL,
3698 .flags = FLAG_ADVANCED,
3701 .label = "wtmp directory",
3702 .type = P_STRING,
3703 .p_class = P_GLOBAL,
3704 .ptr = &Globals.szWtmpDir,
3705 .special = NULL,
3706 .enum_list = NULL,
3707 .flags = FLAG_ADVANCED,
3710 .label = "utmp",
3711 .type = P_BOOL,
3712 .p_class = P_GLOBAL,
3713 .ptr = &Globals.bUtmp,
3714 .special = NULL,
3715 .enum_list = NULL,
3716 .flags = FLAG_ADVANCED,
3718 #endif
3720 .label = "default service",
3721 .type = P_STRING,
3722 .p_class = P_GLOBAL,
3723 .ptr = &Globals.szDefaultService,
3724 .special = NULL,
3725 .enum_list = NULL,
3726 .flags = FLAG_ADVANCED,
3729 .label = "default",
3730 .type = P_STRING,
3731 .p_class = P_GLOBAL,
3732 .ptr = &Globals.szDefaultService,
3733 .special = NULL,
3734 .enum_list = NULL,
3735 .flags = FLAG_ADVANCED,
3738 .label = "message command",
3739 .type = P_STRING,
3740 .p_class = P_GLOBAL,
3741 .ptr = &Globals.szMsgCommand,
3742 .special = NULL,
3743 .enum_list = NULL,
3744 .flags = FLAG_ADVANCED,
3747 .label = "dfree cache time",
3748 .type = P_INTEGER,
3749 .p_class = P_LOCAL,
3750 .ptr = &sDefault.iDfreeCacheTime,
3751 .special = NULL,
3752 .enum_list = NULL,
3753 .flags = FLAG_ADVANCED,
3756 .label = "dfree command",
3757 .type = P_STRING,
3758 .p_class = P_LOCAL,
3759 .ptr = &sDefault.szDfree,
3760 .special = NULL,
3761 .enum_list = NULL,
3762 .flags = FLAG_ADVANCED,
3765 .label = "get quota command",
3766 .type = P_STRING,
3767 .p_class = P_GLOBAL,
3768 .ptr = &Globals.szGetQuota,
3769 .special = NULL,
3770 .enum_list = NULL,
3771 .flags = FLAG_ADVANCED,
3774 .label = "set quota command",
3775 .type = P_STRING,
3776 .p_class = P_GLOBAL,
3777 .ptr = &Globals.szSetQuota,
3778 .special = NULL,
3779 .enum_list = NULL,
3780 .flags = FLAG_ADVANCED,
3783 .label = "remote announce",
3784 .type = P_STRING,
3785 .p_class = P_GLOBAL,
3786 .ptr = &Globals.szRemoteAnnounce,
3787 .special = NULL,
3788 .enum_list = NULL,
3789 .flags = FLAG_ADVANCED,
3792 .label = "remote browse sync",
3793 .type = P_STRING,
3794 .p_class = P_GLOBAL,
3795 .ptr = &Globals.szRemoteBrowseSync,
3796 .special = NULL,
3797 .enum_list = NULL,
3798 .flags = FLAG_ADVANCED,
3801 .label = "socket address",
3802 .type = P_STRING,
3803 .p_class = P_GLOBAL,
3804 .ptr = &Globals.szSocketAddress,
3805 .special = NULL,
3806 .enum_list = NULL,
3807 .flags = FLAG_ADVANCED,
3810 .label = "homedir map",
3811 .type = P_STRING,
3812 .p_class = P_GLOBAL,
3813 .ptr = &Globals.szNISHomeMapName,
3814 .special = NULL,
3815 .enum_list = NULL,
3816 .flags = FLAG_ADVANCED,
3819 .label = "afs username map",
3820 .type = P_STRING,
3821 .p_class = P_GLOBAL,
3822 .ptr = &Globals.szAfsUsernameMap,
3823 .special = NULL,
3824 .enum_list = NULL,
3825 .flags = FLAG_ADVANCED,
3828 .label = "afs token lifetime",
3829 .type = P_INTEGER,
3830 .p_class = P_GLOBAL,
3831 .ptr = &Globals.iAfsTokenLifetime,
3832 .special = NULL,
3833 .enum_list = NULL,
3834 .flags = FLAG_ADVANCED,
3837 .label = "log nt token command",
3838 .type = P_STRING,
3839 .p_class = P_GLOBAL,
3840 .ptr = &Globals.szLogNtTokenCommand,
3841 .special = NULL,
3842 .enum_list = NULL,
3843 .flags = FLAG_ADVANCED,
3846 .label = "time offset",
3847 .type = P_INTEGER,
3848 .p_class = P_GLOBAL,
3849 .ptr = &extra_time_offset,
3850 .special = NULL,
3851 .enum_list = NULL,
3852 .flags = FLAG_ADVANCED,
3855 .label = "NIS homedir",
3856 .type = P_BOOL,
3857 .p_class = P_GLOBAL,
3858 .ptr = &Globals.bNISHomeMap,
3859 .special = NULL,
3860 .enum_list = NULL,
3861 .flags = FLAG_ADVANCED,
3864 .label = "-valid",
3865 .type = P_BOOL,
3866 .p_class = P_LOCAL,
3867 .ptr = &sDefault.valid,
3868 .special = NULL,
3869 .enum_list = NULL,
3870 .flags = FLAG_HIDE,
3873 .label = "copy",
3874 .type = P_STRING,
3875 .p_class = P_LOCAL,
3876 .ptr = &sDefault.szCopy,
3877 .special = handle_copy,
3878 .enum_list = NULL,
3879 .flags = FLAG_HIDE,
3882 .label = "include",
3883 .type = P_STRING,
3884 .p_class = P_LOCAL,
3885 .ptr = &sDefault.szInclude,
3886 .special = handle_include,
3887 .enum_list = NULL,
3888 .flags = FLAG_HIDE,
3891 .label = "preexec",
3892 .type = P_STRING,
3893 .p_class = P_LOCAL,
3894 .ptr = &sDefault.szPreExec,
3895 .special = NULL,
3896 .enum_list = NULL,
3897 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3900 .label = "exec",
3901 .type = P_STRING,
3902 .p_class = P_LOCAL,
3903 .ptr = &sDefault.szPreExec,
3904 .special = NULL,
3905 .enum_list = NULL,
3906 .flags = FLAG_ADVANCED,
3909 .label = "preexec close",
3910 .type = P_BOOL,
3911 .p_class = P_LOCAL,
3912 .ptr = &sDefault.bPreexecClose,
3913 .special = NULL,
3914 .enum_list = NULL,
3915 .flags = FLAG_ADVANCED | FLAG_SHARE,
3918 .label = "postexec",
3919 .type = P_STRING,
3920 .p_class = P_LOCAL,
3921 .ptr = &sDefault.szPostExec,
3922 .special = NULL,
3923 .enum_list = NULL,
3924 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3927 .label = "root preexec",
3928 .type = P_STRING,
3929 .p_class = P_LOCAL,
3930 .ptr = &sDefault.szRootPreExec,
3931 .special = NULL,
3932 .enum_list = NULL,
3933 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3936 .label = "root preexec close",
3937 .type = P_BOOL,
3938 .p_class = P_LOCAL,
3939 .ptr = &sDefault.bRootpreexecClose,
3940 .special = NULL,
3941 .enum_list = NULL,
3942 .flags = FLAG_ADVANCED | FLAG_SHARE,
3945 .label = "root postexec",
3946 .type = P_STRING,
3947 .p_class = P_LOCAL,
3948 .ptr = &sDefault.szRootPostExec,
3949 .special = NULL,
3950 .enum_list = NULL,
3951 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3954 .label = "available",
3955 .type = P_BOOL,
3956 .p_class = P_LOCAL,
3957 .ptr = &sDefault.bAvailable,
3958 .special = NULL,
3959 .enum_list = NULL,
3960 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3963 .label = "registry shares",
3964 .type = P_BOOL,
3965 .p_class = P_GLOBAL,
3966 .ptr = &Globals.bRegistryShares,
3967 .special = NULL,
3968 .enum_list = NULL,
3969 .flags = FLAG_ADVANCED,
3972 .label = "usershare allow guests",
3973 .type = P_BOOL,
3974 .p_class = P_GLOBAL,
3975 .ptr = &Globals.bUsershareAllowGuests,
3976 .special = NULL,
3977 .enum_list = NULL,
3978 .flags = FLAG_ADVANCED,
3981 .label = "usershare max shares",
3982 .type = P_INTEGER,
3983 .p_class = P_GLOBAL,
3984 .ptr = &Globals.iUsershareMaxShares,
3985 .special = NULL,
3986 .enum_list = NULL,
3987 .flags = FLAG_ADVANCED,
3990 .label = "usershare owner only",
3991 .type = P_BOOL,
3992 .p_class = P_GLOBAL,
3993 .ptr = &Globals.bUsershareOwnerOnly,
3994 .special = NULL,
3995 .enum_list = NULL,
3996 .flags = FLAG_ADVANCED,
3999 .label = "usershare path",
4000 .type = P_STRING,
4001 .p_class = P_GLOBAL,
4002 .ptr = &Globals.szUsersharePath,
4003 .special = NULL,
4004 .enum_list = NULL,
4005 .flags = FLAG_ADVANCED,
4008 .label = "usershare prefix allow list",
4009 .type = P_LIST,
4010 .p_class = P_GLOBAL,
4011 .ptr = &Globals.szUsersharePrefixAllowList,
4012 .special = NULL,
4013 .enum_list = NULL,
4014 .flags = FLAG_ADVANCED,
4017 .label = "usershare prefix deny list",
4018 .type = P_LIST,
4019 .p_class = P_GLOBAL,
4020 .ptr = &Globals.szUsersharePrefixDenyList,
4021 .special = NULL,
4022 .enum_list = NULL,
4023 .flags = FLAG_ADVANCED,
4026 .label = "usershare template share",
4027 .type = P_STRING,
4028 .p_class = P_GLOBAL,
4029 .ptr = &Globals.szUsershareTemplateShare,
4030 .special = NULL,
4031 .enum_list = NULL,
4032 .flags = FLAG_ADVANCED,
4035 .label = "volume",
4036 .type = P_STRING,
4037 .p_class = P_LOCAL,
4038 .ptr = &sDefault.volume,
4039 .special = NULL,
4040 .enum_list = NULL,
4041 .flags = FLAG_ADVANCED | FLAG_SHARE,
4044 .label = "fstype",
4045 .type = P_STRING,
4046 .p_class = P_LOCAL,
4047 .ptr = &sDefault.fstype,
4048 .special = NULL,
4049 .enum_list = NULL,
4050 .flags = FLAG_ADVANCED | FLAG_SHARE,
4053 .label = "set directory",
4054 .type = P_BOOLREV,
4055 .p_class = P_LOCAL,
4056 .ptr = &sDefault.bNo_set_dir,
4057 .special = NULL,
4058 .enum_list = NULL,
4059 .flags = FLAG_ADVANCED | FLAG_SHARE,
4062 .label = "wide links",
4063 .type = P_BOOL,
4064 .p_class = P_LOCAL,
4065 .ptr = &sDefault.bWidelinks,
4066 .special = NULL,
4067 .enum_list = NULL,
4068 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4071 .label = "follow symlinks",
4072 .type = P_BOOL,
4073 .p_class = P_LOCAL,
4074 .ptr = &sDefault.bSymlinks,
4075 .special = NULL,
4076 .enum_list = NULL,
4077 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4080 .label = "dont descend",
4081 .type = P_STRING,
4082 .p_class = P_LOCAL,
4083 .ptr = &sDefault.szDontdescend,
4084 .special = NULL,
4085 .enum_list = NULL,
4086 .flags = FLAG_ADVANCED | FLAG_SHARE,
4089 .label = "magic script",
4090 .type = P_STRING,
4091 .p_class = P_LOCAL,
4092 .ptr = &sDefault.szMagicScript,
4093 .special = NULL,
4094 .enum_list = NULL,
4095 .flags = FLAG_ADVANCED | FLAG_SHARE,
4098 .label = "magic output",
4099 .type = P_STRING,
4100 .p_class = P_LOCAL,
4101 .ptr = &sDefault.szMagicOutput,
4102 .special = NULL,
4103 .enum_list = NULL,
4104 .flags = FLAG_ADVANCED | FLAG_SHARE,
4107 .label = "delete readonly",
4108 .type = P_BOOL,
4109 .p_class = P_LOCAL,
4110 .ptr = &sDefault.bDeleteReadonly,
4111 .special = NULL,
4112 .enum_list = NULL,
4113 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4116 .label = "dos filemode",
4117 .type = P_BOOL,
4118 .p_class = P_LOCAL,
4119 .ptr = &sDefault.bDosFilemode,
4120 .special = NULL,
4121 .enum_list = NULL,
4122 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4125 .label = "dos filetimes",
4126 .type = P_BOOL,
4127 .p_class = P_LOCAL,
4128 .ptr = &sDefault.bDosFiletimes,
4129 .special = NULL,
4130 .enum_list = NULL,
4131 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4134 .label = "dos filetime resolution",
4135 .type = P_BOOL,
4136 .p_class = P_LOCAL,
4137 .ptr = &sDefault.bDosFiletimeResolution,
4138 .special = NULL,
4139 .enum_list = NULL,
4140 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4143 .label = "fake directory create times",
4144 .type = P_BOOL,
4145 .p_class = P_LOCAL,
4146 .ptr = &sDefault.bFakeDirCreateTimes,
4147 .special = NULL,
4148 .enum_list = NULL,
4149 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4152 .label = "panic action",
4153 .type = P_STRING,
4154 .p_class = P_GLOBAL,
4155 .ptr = &Globals.szPanicAction,
4156 .special = NULL,
4157 .enum_list = NULL,
4158 .flags = FLAG_ADVANCED,
4161 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4164 .label = "vfs objects",
4165 .type = P_LIST,
4166 .p_class = P_LOCAL,
4167 .ptr = &sDefault.szVfsObjects,
4168 .special = NULL,
4169 .enum_list = NULL,
4170 .flags = FLAG_ADVANCED | FLAG_SHARE,
4173 .label = "vfs object",
4174 .type = P_LIST,
4175 .p_class = P_LOCAL,
4176 .ptr = &sDefault.szVfsObjects,
4177 .special = NULL,
4178 .enum_list = NULL,
4179 .flags = FLAG_HIDE,
4183 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4186 .label = "msdfs root",
4187 .type = P_BOOL,
4188 .p_class = P_LOCAL,
4189 .ptr = &sDefault.bMSDfsRoot,
4190 .special = NULL,
4191 .enum_list = NULL,
4192 .flags = FLAG_ADVANCED | FLAG_SHARE,
4195 .label = "msdfs proxy",
4196 .type = P_STRING,
4197 .p_class = P_LOCAL,
4198 .ptr = &sDefault.szMSDfsProxy,
4199 .special = NULL,
4200 .enum_list = NULL,
4201 .flags = FLAG_ADVANCED | FLAG_SHARE,
4204 .label = "host msdfs",
4205 .type = P_BOOL,
4206 .p_class = P_GLOBAL,
4207 .ptr = &Globals.bHostMSDfs,
4208 .special = NULL,
4209 .enum_list = NULL,
4210 .flags = FLAG_ADVANCED,
4213 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4216 .label = "passdb expand explicit",
4217 .type = P_BOOL,
4218 .p_class = P_GLOBAL,
4219 .ptr = &Globals.bPassdbExpandExplicit,
4220 .special = NULL,
4221 .enum_list = NULL,
4222 .flags = FLAG_ADVANCED,
4225 .label = "idmap domains",
4226 .type = P_LIST,
4227 .p_class = P_GLOBAL,
4228 .ptr = &Globals.szIdmapDomains,
4229 .special = NULL,
4230 .enum_list = NULL,
4231 .flags = FLAG_ADVANCED,
4234 .label = "idmap backend",
4235 .type = P_LIST,
4236 .p_class = P_GLOBAL,
4237 .ptr = &Globals.szIdmapBackend,
4238 .special = NULL,
4239 .enum_list = NULL,
4240 .flags = FLAG_ADVANCED,
4243 .label = "idmap alloc backend",
4244 .type = P_STRING,
4245 .p_class = P_GLOBAL,
4246 .ptr = &Globals.szIdmapAllocBackend,
4247 .special = NULL,
4248 .enum_list = NULL,
4249 .flags = FLAG_ADVANCED,
4252 .label = "idmap cache time",
4253 .type = P_INTEGER,
4254 .p_class = P_GLOBAL,
4255 .ptr = &Globals.iIdmapCacheTime,
4256 .special = NULL,
4257 .enum_list = NULL,
4258 .flags = FLAG_ADVANCED,
4261 .label = "idmap negative cache time",
4262 .type = P_INTEGER,
4263 .p_class = P_GLOBAL,
4264 .ptr = &Globals.iIdmapNegativeCacheTime,
4265 .special = NULL,
4266 .enum_list = NULL,
4267 .flags = FLAG_ADVANCED,
4270 .label = "idmap uid",
4271 .type = P_STRING,
4272 .p_class = P_GLOBAL,
4273 .ptr = &Globals.szIdmapUID,
4274 .special = handle_idmap_uid,
4275 .enum_list = NULL,
4276 .flags = FLAG_ADVANCED,
4279 .label = "winbind uid",
4280 .type = P_STRING,
4281 .p_class = P_GLOBAL,
4282 .ptr = &Globals.szIdmapUID,
4283 .special = handle_idmap_uid,
4284 .enum_list = NULL,
4285 .flags = FLAG_HIDE,
4288 .label = "idmap gid",
4289 .type = P_STRING,
4290 .p_class = P_GLOBAL,
4291 .ptr = &Globals.szIdmapGID,
4292 .special = handle_idmap_gid,
4293 .enum_list = NULL,
4294 .flags = FLAG_ADVANCED,
4297 .label = "winbind gid",
4298 .type = P_STRING,
4299 .p_class = P_GLOBAL,
4300 .ptr = &Globals.szIdmapGID,
4301 .special = handle_idmap_gid,
4302 .enum_list = NULL,
4303 .flags = FLAG_HIDE,
4306 .label = "template homedir",
4307 .type = P_STRING,
4308 .p_class = P_GLOBAL,
4309 .ptr = &Globals.szTemplateHomedir,
4310 .special = NULL,
4311 .enum_list = NULL,
4312 .flags = FLAG_ADVANCED,
4315 .label = "template shell",
4316 .type = P_STRING,
4317 .p_class = P_GLOBAL,
4318 .ptr = &Globals.szTemplateShell,
4319 .special = NULL,
4320 .enum_list = NULL,
4321 .flags = FLAG_ADVANCED,
4324 .label = "winbind separator",
4325 .type = P_STRING,
4326 .p_class = P_GLOBAL,
4327 .ptr = &Globals.szWinbindSeparator,
4328 .special = NULL,
4329 .enum_list = NULL,
4330 .flags = FLAG_ADVANCED,
4333 .label = "winbind cache time",
4334 .type = P_INTEGER,
4335 .p_class = P_GLOBAL,
4336 .ptr = &Globals.winbind_cache_time,
4337 .special = NULL,
4338 .enum_list = NULL,
4339 .flags = FLAG_ADVANCED,
4342 .label = "winbind enum users",
4343 .type = P_BOOL,
4344 .p_class = P_GLOBAL,
4345 .ptr = &Globals.bWinbindEnumUsers,
4346 .special = NULL,
4347 .enum_list = NULL,
4348 .flags = FLAG_ADVANCED,
4351 .label = "winbind enum groups",
4352 .type = P_BOOL,
4353 .p_class = P_GLOBAL,
4354 .ptr = &Globals.bWinbindEnumGroups,
4355 .special = NULL,
4356 .enum_list = NULL,
4357 .flags = FLAG_ADVANCED,
4360 .label = "winbind use default domain",
4361 .type = P_BOOL,
4362 .p_class = P_GLOBAL,
4363 .ptr = &Globals.bWinbindUseDefaultDomain,
4364 .special = NULL,
4365 .enum_list = NULL,
4366 .flags = FLAG_ADVANCED,
4369 .label = "winbind trusted domains only",
4370 .type = P_BOOL,
4371 .p_class = P_GLOBAL,
4372 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4373 .special = NULL,
4374 .enum_list = NULL,
4375 .flags = FLAG_ADVANCED,
4378 .label = "winbind nested groups",
4379 .type = P_BOOL,
4380 .p_class = P_GLOBAL,
4381 .ptr = &Globals.bWinbindNestedGroups,
4382 .special = NULL,
4383 .enum_list = NULL,
4384 .flags = FLAG_ADVANCED,
4387 .label = "winbind expand groups",
4388 .type = P_INTEGER,
4389 .p_class = P_GLOBAL,
4390 .ptr = &Globals.winbind_expand_groups,
4391 .special = NULL,
4392 .enum_list = NULL,
4393 .flags = FLAG_ADVANCED,
4396 .label = "winbind nss info",
4397 .type = P_LIST,
4398 .p_class = P_GLOBAL,
4399 .ptr = &Globals.szWinbindNssInfo,
4400 .special = NULL,
4401 .enum_list = NULL,
4402 .flags = FLAG_ADVANCED,
4405 .label = "winbind refresh tickets",
4406 .type = P_BOOL,
4407 .p_class = P_GLOBAL,
4408 .ptr = &Globals.bWinbindRefreshTickets,
4409 .special = NULL,
4410 .enum_list = NULL,
4411 .flags = FLAG_ADVANCED,
4414 .label = "winbind offline logon",
4415 .type = P_BOOL,
4416 .p_class = P_GLOBAL,
4417 .ptr = &Globals.bWinbindOfflineLogon,
4418 .special = NULL,
4419 .enum_list = NULL,
4420 .flags = FLAG_ADVANCED,
4423 .label = "winbind normalize names",
4424 .type = P_BOOL,
4425 .p_class = P_GLOBAL,
4426 .ptr = &Globals.bWinbindNormalizeNames,
4427 .special = NULL,
4428 .enum_list = NULL,
4429 .flags = FLAG_ADVANCED,
4432 .label = "winbind rpc only",
4433 .type = P_BOOL,
4434 .p_class = P_GLOBAL,
4435 .ptr = &Globals.bWinbindRpcOnly,
4436 .special = NULL,
4437 .enum_list = NULL,
4438 .flags = FLAG_ADVANCED,
4441 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4444 /***************************************************************************
4445 Initialise the sDefault parameter structure for the printer values.
4446 ***************************************************************************/
4448 static void init_printer_values(struct service *pService)
4450 /* choose defaults depending on the type of printing */
4451 switch (pService->iPrinting) {
4452 case PRINT_BSD:
4453 case PRINT_AIX:
4454 case PRINT_LPRNT:
4455 case PRINT_LPROS2:
4456 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4457 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4458 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4459 break;
4461 case PRINT_LPRNG:
4462 case PRINT_PLP:
4463 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4464 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4465 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4466 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4467 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4468 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4469 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4470 break;
4472 case PRINT_CUPS:
4473 case PRINT_IPRINT:
4474 #ifdef HAVE_CUPS
4475 /* set the lpq command to contain the destination printer
4476 name only. This is used by cups_queue_get() */
4477 string_set(&pService->szLpqcommand, "%p");
4478 string_set(&pService->szLprmcommand, "");
4479 string_set(&pService->szPrintcommand, "");
4480 string_set(&pService->szLppausecommand, "");
4481 string_set(&pService->szLpresumecommand, "");
4482 string_set(&pService->szQueuepausecommand, "");
4483 string_set(&pService->szQueueresumecommand, "");
4484 #else
4485 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4486 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4487 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4488 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4489 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4490 string_set(&pService->szQueuepausecommand, "disable '%p'");
4491 string_set(&pService->szQueueresumecommand, "enable '%p'");
4492 #endif /* HAVE_CUPS */
4493 break;
4495 case PRINT_SYSV:
4496 case PRINT_HPUX:
4497 string_set(&pService->szLpqcommand, "lpstat -o%p");
4498 string_set(&pService->szLprmcommand, "cancel %p-%j");
4499 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4500 string_set(&pService->szQueuepausecommand, "disable %p");
4501 string_set(&pService->szQueueresumecommand, "enable %p");
4502 #ifndef HPUX
4503 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4504 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4505 #endif /* HPUX */
4506 break;
4508 case PRINT_QNX:
4509 string_set(&pService->szLpqcommand, "lpq -P%p");
4510 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4511 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4512 break;
4514 #ifdef DEVELOPER
4515 case PRINT_TEST:
4516 case PRINT_VLP:
4517 string_set(&pService->szPrintcommand, "vlp print %p %s");
4518 string_set(&pService->szLpqcommand, "vlp lpq %p");
4519 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4520 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4521 string_set(&pService->szLpresumecommand, "vlp lpresum %p %j");
4522 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4523 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4524 break;
4525 #endif /* DEVELOPER */
4530 /***************************************************************************
4531 Initialise the global parameter structure.
4532 ***************************************************************************/
4534 static void init_globals(bool first_time_only)
4536 static bool done_init = False;
4537 char *s = NULL;
4539 /* If requested to initialize only once and we've already done it... */
4540 if (first_time_only && done_init) {
4541 /* ... then we have nothing more to do */
4542 return;
4545 if (!done_init) {
4546 int i;
4548 /* The logfile can be set before this is invoked. Free it if so. */
4549 if (Globals.szLogFile != NULL) {
4550 string_free(&Globals.szLogFile);
4551 Globals.szLogFile = NULL;
4554 memset((void *)&Globals, '\0', sizeof(Globals));
4556 for (i = 0; parm_table[i].label; i++)
4557 if ((parm_table[i].type == P_STRING ||
4558 parm_table[i].type == P_USTRING) &&
4559 parm_table[i].ptr)
4560 string_set((char **)parm_table[i].ptr, "");
4562 string_set(&sDefault.fstype, FSTYPE_STRING);
4563 string_set(&sDefault.szPrintjobUsername, "%U");
4565 init_printer_values(&sDefault);
4567 done_init = True;
4571 DEBUG(3, ("Initialising global parameters\n"));
4573 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
4574 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
4576 /* use the new 'hash2' method by default, with a prefix of 1 */
4577 string_set(&Globals.szManglingMethod, "hash2");
4578 Globals.mangle_prefix = 1;
4580 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
4582 /* using UTF8 by default allows us to support all chars */
4583 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
4585 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4586 /* If the system supports nl_langinfo(), try to grab the value
4587 from the user's locale */
4588 string_set(&Globals.display_charset, "LOCALE");
4589 #else
4590 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
4591 #endif
4593 /* Use codepage 850 as a default for the dos character set */
4594 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
4597 * Allow the default PASSWD_CHAT to be overridden in local.h.
4599 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
4601 set_global_myname(myhostname());
4602 string_set(&Globals.szNetbiosName,global_myname());
4604 set_global_myworkgroup(WORKGROUP);
4605 string_set(&Globals.szWorkgroup, lp_workgroup());
4607 string_set(&Globals.szPasswdProgram, "");
4608 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
4609 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
4610 string_set(&Globals.szSocketAddress, "0.0.0.0");
4612 if (asprintf(&s, "Samba %s", SAMBA_VERSION_STRING) < 0) {
4613 smb_panic("init_globals: ENOMEM");
4615 string_set(&Globals.szServerString, s);
4616 SAFE_FREE(s);
4617 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
4618 DEFAULT_MINOR_VERSION) < 0) {
4619 smb_panic("init_globals: ENOMEM");
4621 string_set(&Globals.szAnnounceVersion, s);
4622 SAFE_FREE(s);
4623 #ifdef DEVELOPER
4624 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
4625 #endif
4627 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
4629 string_set(&Globals.szLogonDrive, "");
4630 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
4631 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
4632 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
4634 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
4635 string_set(&Globals.szPasswordServer, "*");
4637 Globals.AlgorithmicRidBase = BASE_RID;
4639 Globals.bLoadPrinters = True;
4640 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
4642 Globals.ConfigBackend = config_backend;
4644 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
4645 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
4646 Globals.max_xmit = 0x4104;
4647 Globals.max_mux = 50; /* This is *needed* for profile support. */
4648 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
4649 Globals.bDisableSpoolss = False;
4650 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
4651 Globals.pwordlevel = 0;
4652 Globals.unamelevel = 0;
4653 Globals.deadtime = 0;
4654 Globals.getwd_cache = true;
4655 Globals.bLargeReadwrite = True;
4656 Globals.max_log_size = 5000;
4657 Globals.max_open_files = MAX_OPEN_FILES;
4658 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
4659 Globals.maxprotocol = PROTOCOL_NT1;
4660 Globals.minprotocol = PROTOCOL_CORE;
4661 Globals.security = SEC_USER;
4662 Globals.paranoid_server_security = True;
4663 Globals.bEncryptPasswords = True;
4664 Globals.bUpdateEncrypt = False;
4665 Globals.clientSchannel = Auto;
4666 Globals.serverSchannel = Auto;
4667 Globals.bReadRaw = True;
4668 Globals.bWriteRaw = True;
4669 Globals.bNullPasswords = False;
4670 Globals.bObeyPamRestrictions = False;
4671 Globals.syslog = 1;
4672 Globals.bSyslogOnly = False;
4673 Globals.bTimestampLogs = True;
4674 string_set(&Globals.szLogLevel, "0");
4675 Globals.bDebugPrefixTimestamp = False;
4676 Globals.bDebugHiresTimestamp = False;
4677 Globals.bDebugPid = False;
4678 Globals.bDebugUid = False;
4679 Globals.bDebugClass = False;
4680 Globals.bEnableCoreFiles = True;
4681 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
4682 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
4683 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
4684 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
4685 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
4686 Globals.lm_interval = 60;
4687 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
4688 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
4689 Globals.bNISHomeMap = False;
4690 #ifdef WITH_NISPLUS_HOME
4691 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
4692 #else
4693 string_set(&Globals.szNISHomeMapName, "auto.home");
4694 #endif
4695 #endif
4696 Globals.bTimeServer = False;
4697 Globals.bBindInterfacesOnly = False;
4698 Globals.bUnixPasswdSync = False;
4699 Globals.bPamPasswordChange = False;
4700 Globals.bPasswdChatDebug = False;
4701 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
4702 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
4703 Globals.bNTStatusSupport = True; /* Use NT status by default. */
4704 Globals.bStatCache = True; /* use stat cache by default */
4705 Globals.iMaxStatCacheSize = 256; /* 256k by default */
4706 Globals.restrict_anonymous = 0;
4707 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
4708 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
4709 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
4710 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
4711 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
4712 /* Note, that we will use NTLM2 session security (which is different), if it is available */
4714 Globals.map_to_guest = 0; /* By Default, "Never" */
4715 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
4716 Globals.enhanced_browsing = true;
4717 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
4718 #ifdef MMAP_BLACKLIST
4719 Globals.bUseMmap = False;
4720 #else
4721 Globals.bUseMmap = True;
4722 #endif
4723 Globals.bUnixExtensions = True;
4724 Globals.bResetOnZeroVC = False;
4726 /* hostname lookups can be very expensive and are broken on
4727 a large number of sites (tridge) */
4728 Globals.bHostnameLookups = False;
4730 string_set(&Globals.szPassdbBackend, "smbpasswd");
4731 string_set(&Globals.szLdapSuffix, "");
4732 string_set(&Globals.szLdapMachineSuffix, "");
4733 string_set(&Globals.szLdapUserSuffix, "");
4734 string_set(&Globals.szLdapGroupSuffix, "");
4735 string_set(&Globals.szLdapIdmapSuffix, "");
4737 string_set(&Globals.szLdapAdminDn, "");
4738 Globals.ldap_ssl = LDAP_SSL_ON;
4739 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
4740 Globals.ldap_delete_dn = False;
4741 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
4742 Globals.ldap_timeout = LDAP_CONNECT_DEFAULT_TIMEOUT;
4743 Globals.ldap_page_size = LDAP_PAGE_SIZE;
4745 Globals.ldap_debug_level = 0;
4746 Globals.ldap_debug_threshold = 10;
4748 /* This is what we tell the afs client. in reality we set the token
4749 * to never expire, though, when this runs out the afs client will
4750 * forget the token. Set to 0 to get NEVERDATE.*/
4751 Globals.iAfsTokenLifetime = 604800;
4753 /* these parameters are set to defaults that are more appropriate
4754 for the increasing samba install base:
4756 as a member of the workgroup, that will possibly become a
4757 _local_ master browser (lm = True). this is opposed to a forced
4758 local master browser startup (pm = True).
4760 doesn't provide WINS server service by default (wsupp = False),
4761 and doesn't provide domain master browser services by default, either.
4765 Globals.bMsAddPrinterWizard = True;
4766 Globals.os_level = 20;
4767 Globals.bLocalMaster = True;
4768 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
4769 Globals.bDomainLogons = False;
4770 Globals.bBrowseList = True;
4771 Globals.bWINSsupport = False;
4772 Globals.bWINSproxy = False;
4774 Globals.bDNSproxy = True;
4776 /* this just means to use them if they exist */
4777 Globals.bKernelOplocks = True;
4779 Globals.bAllowTrustedDomains = True;
4781 string_set(&Globals.szTemplateShell, "/bin/false");
4782 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
4783 string_set(&Globals.szWinbindSeparator, "\\");
4785 string_set(&Globals.szCupsServer, "");
4786 string_set(&Globals.szIPrintServer, "");
4788 string_set(&Globals.ctdbdSocket, "");
4789 Globals.szClusterAddresses = NULL;
4790 Globals.clustering = False;
4792 Globals.winbind_cache_time = 300; /* 5 minutes */
4793 Globals.bWinbindEnumUsers = False;
4794 Globals.bWinbindEnumGroups = False;
4795 Globals.bWinbindUseDefaultDomain = False;
4796 Globals.bWinbindTrustedDomainsOnly = False;
4797 Globals.bWinbindNestedGroups = True;
4798 Globals.winbind_expand_groups = 1;
4799 Globals.szWinbindNssInfo = str_list_make(NULL, "template", NULL);
4800 Globals.bWinbindRefreshTickets = False;
4801 Globals.bWinbindOfflineLogon = False;
4803 Globals.iIdmapCacheTime = 900; /* 15 minutes by default */
4804 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
4806 Globals.bPassdbExpandExplicit = False;
4808 Globals.name_cache_timeout = 660; /* In seconds */
4810 Globals.bUseSpnego = True;
4811 Globals.bClientUseSpnego = True;
4813 Globals.client_signing = Auto;
4814 Globals.server_signing = False;
4816 Globals.bDeferSharingViolations = True;
4817 string_set(&Globals.smb_ports, SMB_PORTS);
4819 Globals.bEnablePrivileges = True;
4820 Globals.bHostMSDfs = True;
4821 Globals.bASUSupport = False;
4823 /* User defined shares. */
4824 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
4825 smb_panic("init_globals: ENOMEM");
4827 string_set(&Globals.szUsersharePath, s);
4828 SAFE_FREE(s);
4829 string_set(&Globals.szUsershareTemplateShare, "");
4830 Globals.iUsershareMaxShares = 0;
4831 /* By default disallow sharing of directories not owned by the sharer. */
4832 Globals.bUsershareOwnerOnly = True;
4833 /* By default disallow guest access to usershares. */
4834 Globals.bUsershareAllowGuests = False;
4836 Globals.iKeepalive = DEFAULT_KEEPALIVE;
4838 /* By default no shares out of the registry */
4839 Globals.bRegistryShares = False;
4841 Globals.iminreceivefile = 0;
4844 /*******************************************************************
4845 Convenience routine to grab string parameters into temporary memory
4846 and run standard_sub_basic on them. The buffers can be written to by
4847 callers without affecting the source string.
4848 ********************************************************************/
4850 static char *lp_string(const char *s)
4852 char *ret;
4853 TALLOC_CTX *ctx = talloc_tos();
4855 /* The follow debug is useful for tracking down memory problems
4856 especially if you have an inner loop that is calling a lp_*()
4857 function that returns a string. Perhaps this debug should be
4858 present all the time? */
4860 #if 0
4861 DEBUG(10, ("lp_string(%s)\n", s));
4862 #endif
4864 ret = talloc_sub_basic(ctx,
4865 get_current_username(),
4866 current_user_info.domain,
4868 if (trim_char(ret, '\"', '\"')) {
4869 if (strchr(ret,'\"') != NULL) {
4870 TALLOC_FREE(ret);
4871 ret = talloc_sub_basic(ctx,
4872 get_current_username(),
4873 current_user_info.domain,
4877 return ret;
4881 In this section all the functions that are used to access the
4882 parameters from the rest of the program are defined
4885 #define FN_GLOBAL_STRING(fn_name,ptr) \
4886 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
4887 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
4888 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
4889 #define FN_GLOBAL_LIST(fn_name,ptr) \
4890 const char **fn_name(void) {return(*(const char ***)(ptr));}
4891 #define FN_GLOBAL_BOOL(fn_name,ptr) \
4892 bool fn_name(void) {return(*(bool *)(ptr));}
4893 #define FN_GLOBAL_CHAR(fn_name,ptr) \
4894 char fn_name(void) {return(*(char *)(ptr));}
4895 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
4896 int fn_name(void) {return(*(int *)(ptr));}
4898 #define FN_LOCAL_STRING(fn_name,val) \
4899 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
4900 #define FN_LOCAL_CONST_STRING(fn_name,val) \
4901 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
4902 #define FN_LOCAL_LIST(fn_name,val) \
4903 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4904 #define FN_LOCAL_BOOL(fn_name,val) \
4905 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4906 #define FN_LOCAL_INTEGER(fn_name,val) \
4907 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
4909 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
4910 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4911 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
4912 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4913 #define FN_LOCAL_PARM_STRING(fn_name,val) \
4914 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));}
4915 #define FN_LOCAL_CHAR(fn_name,val) \
4916 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
4918 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
4919 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
4920 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
4921 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
4922 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
4923 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
4924 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
4925 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
4926 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
4927 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
4928 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
4929 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
4930 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
4931 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
4932 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
4933 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
4934 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
4935 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
4936 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
4937 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
4938 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
4939 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
4940 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
4941 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
4942 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
4943 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
4944 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
4945 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
4946 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
4947 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
4948 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
4949 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
4950 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
4951 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
4952 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
4953 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
4954 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
4955 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
4956 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
4957 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
4958 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
4959 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
4960 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
4961 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
4962 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
4963 FN_GLOBAL_STRING(lp_socket_address, &Globals.szSocketAddress)
4964 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
4965 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
4966 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
4967 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
4968 * lp_passdb_backend() should be replace by the this macro again after
4969 * some releases.
4970 * */
4971 const char *lp_passdb_backend(void)
4973 char *delim, *quote;
4975 delim = strchr( Globals.szPassdbBackend, ' ');
4976 /* no space at all */
4977 if (delim == NULL) {
4978 goto out;
4981 quote = strchr(Globals.szPassdbBackend, '"');
4982 /* no quote char or non in the first part */
4983 if (quote == NULL || quote > delim) {
4984 *delim = '\0';
4985 goto warn;
4988 quote = strchr(quote+1, '"');
4989 if (quote == NULL) {
4990 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
4991 goto out;
4992 } else if (*(quote+1) == '\0') {
4993 /* space, fitting quote char, and one backend only */
4994 goto out;
4995 } else {
4996 /* terminate string after the fitting quote char */
4997 *(quote+1) = '\0';
5000 warn:
5001 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5002 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5003 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5004 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5006 out:
5007 return Globals.szPassdbBackend;
5009 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
5010 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5011 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5012 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5013 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5015 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5016 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5017 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5018 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5019 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5020 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5022 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5024 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5025 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5026 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5028 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5030 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5031 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5032 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5033 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5034 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5035 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5036 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5037 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5038 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5039 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5040 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5041 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5042 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5043 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5044 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5046 FN_GLOBAL_LIST(lp_idmap_domains, &Globals.szIdmapDomains)
5047 FN_GLOBAL_LIST(lp_idmap_backend, &Globals.szIdmapBackend) /* deprecated */
5048 FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
5049 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5050 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5051 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5052 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5054 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5055 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5056 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5057 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5058 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5059 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5060 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5061 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5062 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5063 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5064 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5065 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5066 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5067 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5068 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5069 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5071 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5073 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5074 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5075 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5076 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5077 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5078 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5079 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5080 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5081 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5082 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5083 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5084 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5085 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5086 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
5087 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5088 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
5089 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5090 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5091 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5092 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
5093 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5094 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5095 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5096 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5097 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5098 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5099 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5100 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5101 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5102 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5103 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5104 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5105 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5106 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5107 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5108 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5109 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5110 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5111 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5112 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5113 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5114 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5115 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5116 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5117 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5118 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5119 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5120 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5121 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5122 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5123 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5124 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5125 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5126 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5127 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5128 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5129 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5130 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5131 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5132 FN_GLOBAL_BOOL(lp_use_kerberos_keytab, &Globals.bUseKerberosKeytab)
5133 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5134 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5135 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5136 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5137 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5138 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5139 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5140 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5141 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5142 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5143 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5144 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5145 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5146 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5147 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5148 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5149 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5150 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5151 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5152 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5153 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5154 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5155 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5156 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5157 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5158 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5159 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5160 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5161 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5162 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5163 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5164 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5165 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5166 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5167 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5168 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend);
5170 FN_LOCAL_STRING(lp_preexec, szPreExec)
5171 FN_LOCAL_STRING(lp_postexec, szPostExec)
5172 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5173 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5174 FN_LOCAL_STRING(lp_servicename, szService)
5175 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5176 FN_LOCAL_STRING(lp_pathname, szPath)
5177 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5178 FN_LOCAL_STRING(lp_username, szUsername)
5179 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5180 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5181 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5182 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5183 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5184 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5185 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5186 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5187 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5188 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering);
5189 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5190 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5191 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5192 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5193 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5194 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5195 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5196 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5197 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5198 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5199 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5200 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5201 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5202 FN_LOCAL_STRING(lp_comment, comment)
5203 FN_LOCAL_STRING(lp_force_user, force_user)
5204 FN_LOCAL_STRING(lp_force_group, force_group)
5205 FN_LOCAL_LIST(lp_readlist, readlist)
5206 FN_LOCAL_LIST(lp_writelist, writelist)
5207 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5208 FN_LOCAL_STRING(lp_fstype, fstype)
5209 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5210 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5211 static FN_LOCAL_STRING(lp_volume, volume)
5212 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5213 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5214 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5215 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5216 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5217 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5218 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5219 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5220 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5221 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5222 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5223 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5224 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5225 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5226 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5227 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5228 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5229 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5230 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5231 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5232 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5233 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5234 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5235 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5236 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5237 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5238 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5239 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5240 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5241 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5242 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5243 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5244 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5245 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5246 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5247 FN_LOCAL_BOOL(lp_widelinks, bWidelinks)
5248 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5249 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5250 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5251 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5252 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5253 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5254 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5255 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5256 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5257 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5258 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5259 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5260 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5261 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5262 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5263 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5264 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5265 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5266 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5267 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5268 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5269 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5270 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5271 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5272 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5273 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5274 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5275 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5276 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5277 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5278 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5279 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5280 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5281 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5282 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5283 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5284 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5285 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5286 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5287 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5288 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5289 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5290 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5291 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5292 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5293 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5294 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5295 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5296 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5297 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5298 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5299 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5300 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5301 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5302 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5303 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5304 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5305 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5306 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5307 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5308 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5310 /* local prototypes */
5312 static int map_parameter(const char *pszParmName);
5313 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5314 static bool set_boolean(bool *pb, const char *pszParmValue);
5315 static const char *get_boolean(bool bool_value);
5316 static int getservicebyname(const char *pszServiceName,
5317 struct service *pserviceDest);
5318 static void copy_service(struct service *pserviceDest,
5319 struct service *pserviceSource,
5320 struct bitmap *pcopymapDest);
5321 static bool do_parameter(const char *pszParmName, const char *pszParmValue);
5322 static bool do_section(const char *pszSectionName);
5323 static void init_copymap(struct service *pservice);
5324 static bool hash_a_service(const char *name, int number);
5325 static void free_service_byindex(int iService);
5326 static char * canonicalize_servicename(const char *name);
5327 static void show_parameter(int parmIndex);
5328 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5330 /* This is a helper function for parametrical options support. */
5331 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
5332 /* Actual parametrical functions are quite simple */
5333 static param_opt_struct *get_parametrics(int snum, const char *type, const char *option)
5335 bool global_section = False;
5336 char* param_key;
5337 param_opt_struct *data;
5339 if (snum >= iNumServices) return NULL;
5341 if (snum < 0) {
5342 data = Globals.param_opt;
5343 global_section = True;
5344 } else {
5345 data = ServicePtrs[snum]->param_opt;
5348 if (asprintf(&param_key, "%s:%s", type, option) == -1) {
5349 DEBUG(0,("asprintf failed!\n"));
5350 return NULL;
5353 while (data) {
5354 if (strcmp(data->key, param_key) == 0) {
5355 string_free(&param_key);
5356 return data;
5358 data = data->next;
5361 if (!global_section) {
5362 /* Try to fetch the same option but from globals */
5363 /* but only if we are not already working with Globals */
5364 data = Globals.param_opt;
5365 while (data) {
5366 if (strcmp(data->key, param_key) == 0) {
5367 string_free(&param_key);
5368 return data;
5370 data = data->next;
5374 string_free(&param_key);
5376 return NULL;
5380 #define MISSING_PARAMETER(name) \
5381 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5383 /*******************************************************************
5384 convenience routine to return int parameters.
5385 ********************************************************************/
5386 static int lp_int(const char *s)
5389 if (!s || !*s) {
5390 MISSING_PARAMETER(lp_int);
5391 return (-1);
5394 return (int)strtol(s, NULL, 0);
5397 /*******************************************************************
5398 convenience routine to return unsigned long parameters.
5399 ********************************************************************/
5400 static unsigned long lp_ulong(const char *s)
5403 if (!s || !*s) {
5404 MISSING_PARAMETER(lp_ulong);
5405 return (0);
5408 return strtoul(s, NULL, 0);
5411 /*******************************************************************
5412 convenience routine to return boolean parameters.
5413 ********************************************************************/
5414 static bool lp_bool(const char *s)
5416 bool ret = False;
5418 if (!s || !*s) {
5419 MISSING_PARAMETER(lp_bool);
5420 return False;
5423 if (!set_boolean(&ret,s)) {
5424 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5425 return False;
5428 return ret;
5431 /*******************************************************************
5432 convenience routine to return enum parameters.
5433 ********************************************************************/
5434 static int lp_enum(const char *s,const struct enum_list *_enum)
5436 int i;
5438 if (!s || !*s || !_enum) {
5439 MISSING_PARAMETER(lp_enum);
5440 return (-1);
5443 for (i=0; _enum[i].name; i++) {
5444 if (strequal(_enum[i].name,s))
5445 return _enum[i].value;
5448 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5449 return (-1);
5452 #undef MISSING_PARAMETER
5454 /* DO NOT USE lp_parm_string ANYMORE!!!!
5455 * use lp_parm_const_string or lp_parm_talloc_string
5457 * lp_parm_string is only used to let old modules find this symbol
5459 #undef lp_parm_string
5460 char *lp_parm_string(const char *servicename, const char *type, const char *option);
5461 char *lp_parm_string(const char *servicename, const char *type, const char *option)
5463 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
5466 /* Return parametric option from a given service. Type is a part of option before ':' */
5467 /* Parametric option has following syntax: 'Type: option = value' */
5468 /* the returned value is talloced on the talloc_tos() */
5469 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
5471 param_opt_struct *data = get_parametrics(snum, type, option);
5473 if (data == NULL||data->value==NULL) {
5474 if (def) {
5475 return lp_string(def);
5476 } else {
5477 return NULL;
5481 return lp_string(data->value);
5484 /* Return parametric option from a given service. Type is a part of option before ':' */
5485 /* Parametric option has following syntax: 'Type: option = value' */
5486 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
5488 param_opt_struct *data = get_parametrics(snum, type, option);
5490 if (data == NULL||data->value==NULL)
5491 return def;
5493 return data->value;
5496 /* Return parametric option from a given service. Type is a part of option before ':' */
5497 /* Parametric option has following syntax: 'Type: option = value' */
5499 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
5501 param_opt_struct *data = get_parametrics(snum, type, option);
5503 if (data == NULL||data->value==NULL)
5504 return (const char **)def;
5506 if (data->list==NULL) {
5507 data->list = str_list_make(NULL, data->value, NULL);
5510 return (const char **)data->list;
5513 /* Return parametric option from a given service. Type is a part of option before ':' */
5514 /* Parametric option has following syntax: 'Type: option = value' */
5516 int lp_parm_int(int snum, const char *type, const char *option, int def)
5518 param_opt_struct *data = get_parametrics(snum, type, option);
5520 if (data && data->value && *data->value)
5521 return lp_int(data->value);
5523 return def;
5526 /* Return parametric option from a given service. Type is a part of option before ':' */
5527 /* Parametric option has following syntax: 'Type: option = value' */
5529 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
5531 param_opt_struct *data = get_parametrics(snum, type, option);
5533 if (data && data->value && *data->value)
5534 return lp_ulong(data->value);
5536 return def;
5539 /* Return parametric option from a given service. Type is a part of option before ':' */
5540 /* Parametric option has following syntax: 'Type: option = value' */
5542 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
5544 param_opt_struct *data = get_parametrics(snum, type, option);
5546 if (data && data->value && *data->value)
5547 return lp_bool(data->value);
5549 return def;
5552 /* Return parametric option from a given service. Type is a part of option before ':' */
5553 /* Parametric option has following syntax: 'Type: option = value' */
5555 int lp_parm_enum(int snum, const char *type, const char *option,
5556 const struct enum_list *_enum, int def)
5558 param_opt_struct *data = get_parametrics(snum, type, option);
5560 if (data && data->value && *data->value && _enum)
5561 return lp_enum(data->value, _enum);
5563 return def;
5567 /***************************************************************************
5568 Initialise a service to the defaults.
5569 ***************************************************************************/
5571 static void init_service(struct service *pservice)
5573 memset((char *)pservice, '\0', sizeof(struct service));
5574 copy_service(pservice, &sDefault, NULL);
5577 /***************************************************************************
5578 Free the dynamically allocated parts of a service struct.
5579 ***************************************************************************/
5581 static void free_service(struct service *pservice)
5583 int i;
5584 param_opt_struct *data, *pdata;
5585 if (!pservice)
5586 return;
5588 if (pservice->szService)
5589 DEBUG(5, ("free_service: Freeing service %s\n",
5590 pservice->szService));
5592 string_free(&pservice->szService);
5593 bitmap_free(pservice->copymap);
5595 for (i = 0; parm_table[i].label; i++) {
5596 if ((parm_table[i].type == P_STRING ||
5597 parm_table[i].type == P_USTRING) &&
5598 parm_table[i].p_class == P_LOCAL)
5599 string_free((char **)
5600 (((char *)pservice) +
5601 PTR_DIFF(parm_table[i].ptr, &sDefault)));
5602 else if (parm_table[i].type == P_LIST &&
5603 parm_table[i].p_class == P_LOCAL)
5604 TALLOC_FREE(*((char ***)
5605 (((char *)pservice) +
5606 PTR_DIFF(parm_table[i].ptr,
5607 &sDefault))));
5610 data = pservice->param_opt;
5611 if (data)
5612 DEBUG(5,("Freeing parametrics:\n"));
5613 while (data) {
5614 DEBUG(5,("[%s = %s]\n", data->key, data->value));
5615 string_free(&data->key);
5616 string_free(&data->value);
5617 TALLOC_FREE(data->list);
5618 pdata = data->next;
5619 SAFE_FREE(data);
5620 data = pdata;
5623 ZERO_STRUCTP(pservice);
5627 /***************************************************************************
5628 remove a service indexed in the ServicePtrs array from the ServiceHash
5629 and free the dynamically allocated parts
5630 ***************************************************************************/
5632 static void free_service_byindex(int idx)
5634 if ( !LP_SNUM_OK(idx) )
5635 return;
5637 ServicePtrs[idx]->valid = False;
5638 invalid_services[num_invalid_services++] = idx;
5640 /* we have to cleanup the hash record */
5642 if (ServicePtrs[idx]->szService) {
5643 char *canon_name = canonicalize_servicename(
5644 ServicePtrs[idx]->szService );
5646 dbwrap_delete_bystring(ServiceHash, canon_name );
5647 TALLOC_FREE(canon_name);
5650 free_service(ServicePtrs[idx]);
5653 /***************************************************************************
5654 Add a new service to the services array initialising it with the given
5655 service.
5656 ***************************************************************************/
5658 static int add_a_service(const struct service *pservice, const char *name)
5660 int i;
5661 struct service tservice;
5662 int num_to_alloc = iNumServices + 1;
5663 param_opt_struct *data, *pdata;
5665 tservice = *pservice;
5667 /* it might already exist */
5668 if (name) {
5669 i = getservicebyname(name, NULL);
5670 if (i >= 0) {
5671 /* Clean all parametric options for service */
5672 /* They will be added during parsing again */
5673 data = ServicePtrs[i]->param_opt;
5674 while (data) {
5675 string_free(&data->key);
5676 string_free(&data->value);
5677 TALLOC_FREE(data->list);
5678 pdata = data->next;
5679 SAFE_FREE(data);
5680 data = pdata;
5682 ServicePtrs[i]->param_opt = NULL;
5683 return (i);
5687 /* find an invalid one */
5688 i = iNumServices;
5689 if (num_invalid_services > 0) {
5690 i = invalid_services[--num_invalid_services];
5693 /* if not, then create one */
5694 if (i == iNumServices) {
5695 struct service **tsp;
5696 int *tinvalid;
5698 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
5699 if (tsp == NULL) {
5700 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
5701 return (-1);
5703 ServicePtrs = tsp;
5704 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
5705 if (!ServicePtrs[iNumServices]) {
5706 DEBUG(0,("add_a_service: out of memory!\n"));
5707 return (-1);
5709 iNumServices++;
5711 /* enlarge invalid_services here for now... */
5712 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
5713 num_to_alloc);
5714 if (tinvalid == NULL) {
5715 DEBUG(0,("add_a_service: failed to enlarge "
5716 "invalid_services!\n"));
5717 return (-1);
5719 invalid_services = tinvalid;
5720 } else {
5721 free_service_byindex(i);
5724 ServicePtrs[i]->valid = True;
5726 init_service(ServicePtrs[i]);
5727 copy_service(ServicePtrs[i], &tservice, NULL);
5728 if (name)
5729 string_set(&ServicePtrs[i]->szService, name);
5731 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
5732 i, ServicePtrs[i]->szService));
5734 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
5735 return (-1);
5738 return (i);
5741 /***************************************************************************
5742 Convert a string to uppercase and remove whitespaces.
5743 ***************************************************************************/
5745 static char *canonicalize_servicename(const char *src)
5747 char *result;
5749 if ( !src ) {
5750 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
5751 return NULL;
5754 result = talloc_strdup(talloc_tos(), src);
5755 SMB_ASSERT(result != NULL);
5757 strlower_m(result);
5758 return result;
5761 /***************************************************************************
5762 Add a name/index pair for the services array to the hash table.
5763 ***************************************************************************/
5765 static bool hash_a_service(const char *name, int idx)
5767 char *canon_name;
5769 if ( !ServiceHash ) {
5770 DEBUG(10,("hash_a_service: creating servicehash\n"));
5771 ServiceHash = db_open_rbt(NULL);
5772 if ( !ServiceHash ) {
5773 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
5774 return False;
5778 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
5779 idx, name));
5781 canon_name = canonicalize_servicename( name );
5783 dbwrap_store_bystring(ServiceHash, canon_name,
5784 make_tdb_data((uint8 *)&idx, sizeof(idx)),
5785 TDB_REPLACE);
5787 TALLOC_FREE(canon_name);
5789 return True;
5792 /***************************************************************************
5793 Add a new home service, with the specified home directory, defaults coming
5794 from service ifrom.
5795 ***************************************************************************/
5797 bool lp_add_home(const char *pszHomename, int iDefaultService,
5798 const char *user, const char *pszHomedir)
5800 int i;
5802 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
5804 if (i < 0)
5805 return (False);
5807 if (!(*(ServicePtrs[iDefaultService]->szPath))
5808 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
5809 string_set(&ServicePtrs[i]->szPath, pszHomedir);
5812 if (!(*(ServicePtrs[i]->comment))) {
5813 char *comment = NULL;
5814 if (asprintf(&comment, "Home directory of %s", user) < 0) {
5815 return false;
5817 string_set(&ServicePtrs[i]->comment, comment);
5818 SAFE_FREE(comment);
5821 /* set the browseable flag from the global default */
5823 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
5825 ServicePtrs[i]->autoloaded = True;
5827 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
5828 user, ServicePtrs[i]->szPath ));
5830 return (True);
5833 /***************************************************************************
5834 Add a new service, based on an old one.
5835 ***************************************************************************/
5837 int lp_add_service(const char *pszService, int iDefaultService)
5839 if (iDefaultService < 0) {
5840 return add_a_service(&sDefault, pszService);
5843 return (add_a_service(ServicePtrs[iDefaultService], pszService));
5846 /***************************************************************************
5847 Add the IPC service.
5848 ***************************************************************************/
5850 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
5852 char *comment = NULL;
5853 int i = add_a_service(&sDefault, ipc_name);
5855 if (i < 0)
5856 return (False);
5858 if (asprintf(&comment, "IPC Service (%s)",
5859 Globals.szServerString) < 0) {
5860 return (False);
5863 string_set(&ServicePtrs[i]->szPath, tmpdir());
5864 string_set(&ServicePtrs[i]->szUsername, "");
5865 string_set(&ServicePtrs[i]->comment, comment);
5866 string_set(&ServicePtrs[i]->fstype, "IPC");
5867 ServicePtrs[i]->iMaxConnections = 0;
5868 ServicePtrs[i]->bAvailable = True;
5869 ServicePtrs[i]->bRead_only = True;
5870 ServicePtrs[i]->bGuest_only = False;
5871 ServicePtrs[i]->bAdministrative_share = True;
5872 ServicePtrs[i]->bGuest_ok = guest_ok;
5873 ServicePtrs[i]->bPrint_ok = False;
5874 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
5876 DEBUG(3, ("adding IPC service\n"));
5878 SAFE_FREE(comment);
5879 return (True);
5882 /***************************************************************************
5883 Add a new printer service, with defaults coming from service iFrom.
5884 ***************************************************************************/
5886 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
5888 const char *comment = "From Printcap";
5889 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
5891 if (i < 0)
5892 return (False);
5894 /* note that we do NOT default the availability flag to True - */
5895 /* we take it from the default service passed. This allows all */
5896 /* dynamic printers to be disabled by disabling the [printers] */
5897 /* entry (if/when the 'available' keyword is implemented!). */
5899 /* the printer name is set to the service name. */
5900 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
5901 string_set(&ServicePtrs[i]->comment, comment);
5903 /* set the browseable flag from the gloabl default */
5904 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
5906 /* Printers cannot be read_only. */
5907 ServicePtrs[i]->bRead_only = False;
5908 /* No share modes on printer services. */
5909 ServicePtrs[i]->bShareModes = False;
5910 /* No oplocks on printer services. */
5911 ServicePtrs[i]->bOpLocks = False;
5912 /* Printer services must be printable. */
5913 ServicePtrs[i]->bPrint_ok = True;
5915 DEBUG(3, ("adding printer service %s\n", pszPrintername));
5917 return (True);
5921 /***************************************************************************
5922 Check whether the given parameter name is valid.
5923 Parametric options (names containing a colon) are considered valid.
5924 ***************************************************************************/
5926 bool lp_parameter_is_valid(const char *pszParmName)
5928 return ((map_parameter(pszParmName) != -1) ||
5929 (strchr(pszParmName, ':') != NULL));
5932 /***************************************************************************
5933 Check whether the given name is the name of a global parameter.
5934 Returns True for strings belonging to parameters of class
5935 P_GLOBAL, False for all other strings, also for parametric options
5936 and strings not belonging to any option.
5937 ***************************************************************************/
5939 bool lp_parameter_is_global(const char *pszParmName)
5941 int num = map_parameter(pszParmName);
5943 if (num >= 0) {
5944 return (parm_table[num].p_class == P_GLOBAL);
5947 return False;
5950 /**************************************************************************
5951 Check whether the given name is the canonical name of a parameter.
5952 Returns False if it is not a valid parameter Name.
5953 For parametric options, True is returned.
5954 **************************************************************************/
5956 bool lp_parameter_is_canonical(const char *parm_name)
5958 if (!lp_parameter_is_valid(parm_name)) {
5959 return False;
5962 return (map_parameter(parm_name) ==
5963 map_parameter_canonical(parm_name, NULL));
5966 /**************************************************************************
5967 Determine the canonical name for a parameter.
5968 Indicate when it is an inverse (boolean) synonym instead of a
5969 "usual" synonym.
5970 **************************************************************************/
5972 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
5973 bool *inverse)
5975 int num;
5977 if (!lp_parameter_is_valid(parm_name)) {
5978 *canon_parm = NULL;
5979 return False;
5982 num = map_parameter_canonical(parm_name, inverse);
5983 if (num < 0) {
5984 /* parametric option */
5985 *canon_parm = parm_name;
5986 } else {
5987 *canon_parm = parm_table[num].label;
5990 return True;
5994 /**************************************************************************
5995 Determine the canonical name for a parameter.
5996 Turn the value given into the inverse boolean expression when
5997 the synonym is an invers boolean synonym.
5999 Return True if parm_name is a valid parameter name and
6000 in case it is an invers boolean synonym, if the val string could
6001 successfully be converted to the reverse bool.
6002 Return false in all other cases.
6003 **************************************************************************/
6005 bool lp_canonicalize_parameter_with_value(const char *parm_name,
6006 const char *val,
6007 const char **canon_parm,
6008 const char **canon_val)
6010 int num;
6011 bool inverse;
6013 if (!lp_parameter_is_valid(parm_name)) {
6014 *canon_parm = NULL;
6015 *canon_val = NULL;
6016 return False;
6019 num = map_parameter_canonical(parm_name, &inverse);
6020 if (num < 0) {
6021 /* parametric option */
6022 *canon_parm = parm_name;
6023 *canon_val = val;
6024 } else {
6025 *canon_parm = parm_table[num].label;
6026 if (inverse) {
6027 if (!lp_invert_boolean(val, canon_val)) {
6028 *canon_val = NULL;
6029 return False;
6031 } else {
6032 *canon_val = val;
6036 return True;
6039 /***************************************************************************
6040 Map a parameter's string representation to something we can use.
6041 Returns False if the parameter string is not recognised, else TRUE.
6042 ***************************************************************************/
6044 static int map_parameter(const char *pszParmName)
6046 int iIndex;
6048 if (*pszParmName == '-')
6049 return (-1);
6051 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6052 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6053 return (iIndex);
6055 /* Warn only if it isn't parametric option */
6056 if (strchr(pszParmName, ':') == NULL)
6057 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6058 /* We do return 'fail' for parametric options as well because they are
6059 stored in different storage
6061 return (-1);
6064 /***************************************************************************
6065 Map a parameter's string representation to the index of the canonical
6066 form of the parameter (it might be a synonym).
6067 Returns -1 if the parameter string is not recognised.
6068 ***************************************************************************/
6070 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
6072 int parm_num, canon_num;
6073 bool loc_inverse = False;
6075 parm_num = map_parameter(pszParmName);
6076 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6077 /* invalid, parametric or no canidate for synonyms ... */
6078 goto done;
6081 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6082 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6083 parm_num = canon_num;
6084 goto done;
6088 done:
6089 if (inverse != NULL) {
6090 *inverse = loc_inverse;
6092 return parm_num;
6095 /***************************************************************************
6096 return true if parameter number parm1 is a synonym of parameter
6097 number parm2 (parm2 being the principal name).
6098 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6099 False otherwise.
6100 ***************************************************************************/
6102 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
6104 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6105 (parm_table[parm1].flags & FLAG_HIDE) &&
6106 !(parm_table[parm2].flags & FLAG_HIDE))
6108 if (inverse != NULL) {
6109 if ((parm_table[parm1].type == P_BOOLREV) &&
6110 (parm_table[parm2].type == P_BOOL))
6112 *inverse = True;
6113 } else {
6114 *inverse = False;
6117 return True;
6119 return False;
6122 /***************************************************************************
6123 Show one parameter's name, type, [values,] and flags.
6124 (helper functions for show_parameter_list)
6125 ***************************************************************************/
6127 static void show_parameter(int parmIndex)
6129 int enumIndex, flagIndex;
6130 int parmIndex2;
6131 bool hadFlag;
6132 bool hadSyn;
6133 bool inverse;
6134 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6135 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6136 "P_ENUM", "P_SEP"};
6137 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6138 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6139 FLAG_HIDE, FLAG_DOS_STRING};
6140 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6141 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6142 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6144 printf("%s=%s", parm_table[parmIndex].label,
6145 type[parm_table[parmIndex].type]);
6146 if (parm_table[parmIndex].type == P_ENUM) {
6147 printf(",");
6148 for (enumIndex=0;
6149 parm_table[parmIndex].enum_list[enumIndex].name;
6150 enumIndex++)
6152 printf("%s%s",
6153 enumIndex ? "|" : "",
6154 parm_table[parmIndex].enum_list[enumIndex].name);
6157 printf(",");
6158 hadFlag = False;
6159 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6160 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6161 printf("%s%s",
6162 hadFlag ? "|" : "",
6163 flag_names[flagIndex]);
6164 hadFlag = True;
6168 /* output synonyms */
6169 hadSyn = False;
6170 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6171 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6172 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6173 parm_table[parmIndex2].label);
6174 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6175 if (!hadSyn) {
6176 printf(" (synonyms: ");
6177 hadSyn = True;
6178 } else {
6179 printf(", ");
6181 printf("%s%s", parm_table[parmIndex2].label,
6182 inverse ? "[i]" : "");
6185 if (hadSyn) {
6186 printf(")");
6189 printf("\n");
6192 /***************************************************************************
6193 Show all parameter's name, type, [values,] and flags.
6194 ***************************************************************************/
6196 void show_parameter_list(void)
6198 int classIndex, parmIndex;
6199 const char *section_names[] = { "local", "global", NULL};
6201 for (classIndex=0; section_names[classIndex]; classIndex++) {
6202 printf("[%s]\n", section_names[classIndex]);
6203 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6204 if (parm_table[parmIndex].p_class == classIndex) {
6205 show_parameter(parmIndex);
6211 /***************************************************************************
6212 Set a boolean variable from the text value stored in the passed string.
6213 Returns True in success, False if the passed string does not correctly
6214 represent a boolean.
6215 ***************************************************************************/
6217 static bool set_boolean(bool *pb, const char *pszParmValue)
6219 bool bRetval;
6220 bool value;
6222 bRetval = True;
6223 value = False;
6224 if (strwicmp(pszParmValue, "yes") == 0 ||
6225 strwicmp(pszParmValue, "true") == 0 ||
6226 strwicmp(pszParmValue, "1") == 0)
6227 value = True;
6228 else if (strwicmp(pszParmValue, "no") == 0 ||
6229 strwicmp(pszParmValue, "False") == 0 ||
6230 strwicmp(pszParmValue, "0") == 0)
6231 value = False;
6232 else {
6233 DEBUG(2,
6234 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
6235 pszParmValue));
6236 bRetval = False;
6239 if ((pb != NULL) && (bRetval != False)) {
6240 *pb = value;
6243 return (bRetval);
6247 /***************************************************************************
6248 Check if a given string correctly represents a boolean value.
6249 ***************************************************************************/
6251 bool lp_string_is_valid_boolean(const char *parm_value)
6253 return set_boolean(NULL, parm_value);
6256 /***************************************************************************
6257 Get the standard string representation of a boolean value ("yes" or "no")
6258 ***************************************************************************/
6260 static const char *get_boolean(bool bool_value)
6262 static const char *yes_str = "yes";
6263 static const char *no_str = "no";
6265 return (bool_value ? yes_str : no_str);
6268 /***************************************************************************
6269 Provide the string of the negated boolean value associated to the boolean
6270 given as a string. Returns False if the passed string does not correctly
6271 represent a boolean.
6272 ***************************************************************************/
6274 bool lp_invert_boolean(const char *str, const char **inverse_str)
6276 bool val;
6278 if (!set_boolean(&val, str)) {
6279 return False;
6282 *inverse_str = get_boolean(!val);
6283 return True;
6286 /***************************************************************************
6287 Provide the canonical string representation of a boolean value given
6288 as a string. Return True on success, False if the string given does
6289 not correctly represent a boolean.
6290 ***************************************************************************/
6292 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
6294 bool val;
6296 if (!set_boolean(&val, str)) {
6297 return False;
6300 *canon_str = get_boolean(val);
6301 return True;
6304 /***************************************************************************
6305 Find a service by name. Otherwise works like get_service.
6306 ***************************************************************************/
6308 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
6310 int iService = -1;
6311 char *canon_name;
6312 TDB_DATA data;
6314 if (ServiceHash == NULL) {
6315 return -1;
6318 canon_name = canonicalize_servicename(pszServiceName);
6320 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6322 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6323 iService = *(int *)data.dptr;
6326 TALLOC_FREE(canon_name);
6328 if ((iService != -1) && (LP_SNUM_OK(iService))
6329 && (pserviceDest != NULL)) {
6330 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6333 return (iService);
6336 /***************************************************************************
6337 Copy a service structure to another.
6338 If pcopymapDest is NULL then copy all fields
6339 ***************************************************************************/
6341 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
6342 struct bitmap *pcopymapDest)
6344 int i;
6345 bool bcopyall = (pcopymapDest == NULL);
6346 param_opt_struct *data, *pdata, *paramo;
6347 bool not_added;
6349 for (i = 0; parm_table[i].label; i++)
6350 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6351 (bcopyall || bitmap_query(pcopymapDest,i))) {
6352 void *def_ptr = parm_table[i].ptr;
6353 void *src_ptr =
6354 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6355 &sDefault);
6356 void *dest_ptr =
6357 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6358 &sDefault);
6360 switch (parm_table[i].type) {
6361 case P_BOOL:
6362 case P_BOOLREV:
6363 *(bool *)dest_ptr = *(bool *)src_ptr;
6364 break;
6366 case P_INTEGER:
6367 case P_ENUM:
6368 case P_OCTAL:
6369 *(int *)dest_ptr = *(int *)src_ptr;
6370 break;
6372 case P_CHAR:
6373 *(char *)dest_ptr = *(char *)src_ptr;
6374 break;
6376 case P_STRING:
6377 string_set((char **)dest_ptr,
6378 *(char **)src_ptr);
6379 break;
6381 case P_USTRING:
6382 string_set((char **)dest_ptr,
6383 *(char **)src_ptr);
6384 strupper_m(*(char **)dest_ptr);
6385 break;
6386 case P_LIST:
6387 TALLOC_FREE(*((char ***)dest_ptr));
6388 str_list_copy(NULL, (char ***)dest_ptr,
6389 *(const char ***)src_ptr);
6390 break;
6391 default:
6392 break;
6396 if (bcopyall) {
6397 init_copymap(pserviceDest);
6398 if (pserviceSource->copymap)
6399 bitmap_copy(pserviceDest->copymap,
6400 pserviceSource->copymap);
6403 data = pserviceSource->param_opt;
6404 while (data) {
6405 not_added = True;
6406 pdata = pserviceDest->param_opt;
6407 /* Traverse destination */
6408 while (pdata) {
6409 /* If we already have same option, override it */
6410 if (strcmp(pdata->key, data->key) == 0) {
6411 string_free(&pdata->value);
6412 TALLOC_FREE(data->list);
6413 pdata->value = SMB_STRDUP(data->value);
6414 not_added = False;
6415 break;
6417 pdata = pdata->next;
6419 if (not_added) {
6420 paramo = SMB_XMALLOC_P(param_opt_struct);
6421 paramo->key = SMB_STRDUP(data->key);
6422 paramo->value = SMB_STRDUP(data->value);
6423 paramo->list = NULL;
6424 DLIST_ADD(pserviceDest->param_opt, paramo);
6426 data = data->next;
6430 /***************************************************************************
6431 Check a service for consistency. Return False if the service is in any way
6432 incomplete or faulty, else True.
6433 ***************************************************************************/
6435 bool service_ok(int iService)
6437 bool bRetval;
6439 bRetval = True;
6440 if (ServicePtrs[iService]->szService[0] == '\0') {
6441 DEBUG(0, ("The following message indicates an internal error:\n"));
6442 DEBUG(0, ("No service name in service entry.\n"));
6443 bRetval = False;
6446 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6447 /* I can't see why you'd want a non-printable printer service... */
6448 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6449 if (!ServicePtrs[iService]->bPrint_ok) {
6450 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6451 ServicePtrs[iService]->szService));
6452 ServicePtrs[iService]->bPrint_ok = True;
6454 /* [printers] service must also be non-browsable. */
6455 if (ServicePtrs[iService]->bBrowseable)
6456 ServicePtrs[iService]->bBrowseable = False;
6459 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6460 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6461 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6463 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6464 ServicePtrs[iService]->szService));
6465 ServicePtrs[iService]->bAvailable = False;
6468 /* If a service is flagged unavailable, log the fact at level 1. */
6469 if (!ServicePtrs[iService]->bAvailable)
6470 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6471 ServicePtrs[iService]->szService));
6473 return (bRetval);
6477 * process_registry_globals
6479 static bool process_registry_globals(bool (*pfunc)(const char *, const char *))
6481 WERROR werr;
6482 char **param_names;
6483 char **param_values;
6484 uint32_t num_params;
6485 uint32_t count;
6486 TALLOC_CTX *mem_ctx = talloc_stackframe();
6487 bool ret = false;
6489 if (conf_ctx == NULL) {
6490 /* first time */
6491 werr = libnet_conf_open(NULL, &conf_ctx);
6492 if (!W_ERROR_IS_OK(werr)) {
6493 goto done;
6497 if (!libnet_conf_share_exists(conf_ctx, GLOBAL_NAME)) {
6498 /* nothing to read from the registry yet but make sure lp_load
6499 * doesn't return false */
6500 ret = true;
6501 goto done;
6504 werr = libnet_conf_get_share(mem_ctx, conf_ctx, GLOBAL_NAME,
6505 &num_params, &param_names, &param_values);
6506 if (!W_ERROR_IS_OK(werr)) {
6507 goto done;
6510 for (count = 0; count < num_params; count++) {
6511 ret = pfunc(param_names[count], param_values[count]);
6512 if (ret != true) {
6513 goto done;
6517 ret = pfunc("registry shares", "yes");
6518 conf_last_seqnum = libnet_conf_get_seqnum(conf_ctx, NULL, NULL);
6520 done:
6521 TALLOC_FREE(mem_ctx);
6522 return ret;
6525 static struct file_lists {
6526 struct file_lists *next;
6527 char *name;
6528 char *subfname;
6529 time_t modtime;
6530 } *file_lists = NULL;
6532 /*******************************************************************
6533 Keep a linked list of all config files so we know when one has changed
6534 it's date and needs to be reloaded.
6535 ********************************************************************/
6537 static void add_to_file_list(const char *fname, const char *subfname)
6539 struct file_lists *f = file_lists;
6541 while (f) {
6542 if (f->name && !strcmp(f->name, fname))
6543 break;
6544 f = f->next;
6547 if (!f) {
6548 f = SMB_MALLOC_P(struct file_lists);
6549 if (!f)
6550 return;
6551 f->next = file_lists;
6552 f->name = SMB_STRDUP(fname);
6553 if (!f->name) {
6554 SAFE_FREE(f);
6555 return;
6557 f->subfname = SMB_STRDUP(subfname);
6558 if (!f->subfname) {
6559 SAFE_FREE(f);
6560 return;
6562 file_lists = f;
6563 f->modtime = file_modtime(subfname);
6564 } else {
6565 time_t t = file_modtime(subfname);
6566 if (t)
6567 f->modtime = t;
6572 * Utility function for outsiders to check if we're running on registry.
6574 bool lp_config_backend_is_registry(void)
6576 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
6579 /*******************************************************************
6580 Check if a config file has changed date.
6581 ********************************************************************/
6583 bool lp_file_list_changed(void)
6585 struct file_lists *f = file_lists;
6587 DEBUG(6, ("lp_file_list_changed()\n"));
6589 if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
6590 uint64_t conf_cur_seqnum;
6591 if (conf_ctx == NULL) {
6592 WERROR werr;
6593 werr = libnet_conf_open(NULL, &conf_ctx);
6594 if (!W_ERROR_IS_OK(werr)) {
6595 DEBUG(0, ("error opening configuration: %s\n",
6596 dos_errstr(werr)));
6597 return false;
6600 conf_cur_seqnum = libnet_conf_get_seqnum(conf_ctx, NULL, NULL);
6601 if (conf_last_seqnum != conf_cur_seqnum) {
6602 DEBUGADD(6, ("regdb seqnum changed: old = %llu, "
6603 "new = %llu\n",
6604 (unsigned long long)conf_last_seqnum,
6605 (unsigned long long)conf_cur_seqnum));
6606 return true;
6607 } else {
6609 * Don't check files when config_backend is registry.
6610 * Remove this to obtain checking of files even with
6611 * registry config backend. That would enable switching
6612 * off registry configuration by changing smb.conf even
6613 * without restarting smbd.
6615 return false;
6619 while (f) {
6620 char *n2 = NULL;
6621 time_t mod_time;
6623 n2 = alloc_sub_basic(get_current_username(),
6624 current_user_info.domain,
6625 f->name);
6626 if (!n2) {
6627 return false;
6629 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
6630 f->name, n2, ctime(&f->modtime)));
6632 mod_time = file_modtime(n2);
6634 if (mod_time && ((f->modtime != mod_time) || (f->subfname == NULL) || (strcmp(n2, f->subfname) != 0))) {
6635 DEBUGADD(6,
6636 ("file %s modified: %s\n", n2,
6637 ctime(&mod_time)));
6638 f->modtime = mod_time;
6639 SAFE_FREE(f->subfname);
6640 f->subfname = n2; /* Passing ownership of
6641 return from alloc_sub_basic
6642 above. */
6643 return true;
6645 SAFE_FREE(n2);
6646 f = f->next;
6648 return (False);
6652 /***************************************************************************
6653 Run standard_sub_basic on netbios name... needed because global_myname
6654 is not accessed through any lp_ macro.
6655 Note: We must *NOT* use string_set() here as ptr points to global_myname.
6656 ***************************************************************************/
6658 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
6660 bool ret;
6661 char *netbios_name = alloc_sub_basic(get_current_username(),
6662 current_user_info.domain,
6663 pszParmValue);
6665 ret = set_global_myname(netbios_name);
6666 SAFE_FREE(netbios_name);
6667 string_set(&Globals.szNetbiosName,global_myname());
6669 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
6670 global_myname()));
6672 return ret;
6675 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
6677 if (strcmp(*ptr, pszParmValue) != 0) {
6678 string_set(ptr, pszParmValue);
6679 init_iconv();
6681 return True;
6686 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
6688 bool ret;
6690 ret = set_global_myworkgroup(pszParmValue);
6691 string_set(&Globals.szWorkgroup,lp_workgroup());
6693 return ret;
6696 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
6698 bool ret;
6700 ret = set_global_scope(pszParmValue);
6701 string_set(&Globals.szNetbiosScope,global_scope());
6703 return ret;
6706 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
6708 TALLOC_FREE(Globals.szNetbiosAliases);
6709 Globals.szNetbiosAliases = str_list_make(NULL, pszParmValue, NULL);
6710 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
6713 /***************************************************************************
6714 Handle the include operation.
6715 ***************************************************************************/
6717 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
6719 char *fname;
6721 fname = alloc_sub_basic(get_current_username(),
6722 current_user_info.domain,
6723 pszParmValue);
6725 add_to_file_list(pszParmValue, fname);
6727 string_set(ptr, fname);
6729 if (file_exist(fname, NULL)) {
6730 bool ret = pm_process(fname, do_section, do_parameter);
6731 SAFE_FREE(fname);
6732 return ret;
6735 DEBUG(2, ("Can't find include file %s\n", fname));
6736 SAFE_FREE(fname);
6737 return false;
6740 /***************************************************************************
6741 Handle the interpretation of the copy parameter.
6742 ***************************************************************************/
6744 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
6746 bool bRetval;
6747 int iTemp;
6748 struct service serviceTemp;
6750 string_set(ptr, pszParmValue);
6752 init_service(&serviceTemp);
6754 bRetval = False;
6756 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
6758 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
6759 if (iTemp == iServiceIndex) {
6760 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
6761 } else {
6762 copy_service(ServicePtrs[iServiceIndex],
6763 &serviceTemp,
6764 ServicePtrs[iServiceIndex]->copymap);
6765 bRetval = True;
6767 } else {
6768 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
6769 bRetval = False;
6772 free_service(&serviceTemp);
6773 return (bRetval);
6776 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
6778 Globals.ldap_debug_level = lp_int(pszParmValue);
6779 init_ldap_debugging();
6780 return true;
6783 /***************************************************************************
6784 Handle idmap/non unix account uid and gid allocation parameters. The format of these
6785 parameters is:
6787 [global]
6789 idmap uid = 1000-1999
6790 idmap gid = 700-899
6792 We only do simple parsing checks here. The strings are parsed into useful
6793 structures in the idmap daemon code.
6795 ***************************************************************************/
6797 /* Some lp_ routines to return idmap [ug]id information */
6799 static uid_t idmap_uid_low, idmap_uid_high;
6800 static gid_t idmap_gid_low, idmap_gid_high;
6802 bool lp_idmap_uid(uid_t *low, uid_t *high)
6804 if (idmap_uid_low == 0 || idmap_uid_high == 0)
6805 return False;
6807 if (low)
6808 *low = idmap_uid_low;
6810 if (high)
6811 *high = idmap_uid_high;
6813 return True;
6816 bool lp_idmap_gid(gid_t *low, gid_t *high)
6818 if (idmap_gid_low == 0 || idmap_gid_high == 0)
6819 return False;
6821 if (low)
6822 *low = idmap_gid_low;
6824 if (high)
6825 *high = idmap_gid_high;
6827 return True;
6830 /* Do some simple checks on "idmap [ug]id" parameter values */
6832 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
6834 uint32 low, high;
6836 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
6837 return False;
6839 /* Parse OK */
6841 string_set(ptr, pszParmValue);
6843 idmap_uid_low = low;
6844 idmap_uid_high = high;
6846 return True;
6849 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
6851 uint32 low, high;
6853 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
6854 return False;
6856 /* Parse OK */
6858 string_set(ptr, pszParmValue);
6860 idmap_gid_low = low;
6861 idmap_gid_high = high;
6863 return True;
6866 /***************************************************************************
6867 Handle the DEBUG level list.
6868 ***************************************************************************/
6870 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
6872 string_set(ptr, pszParmValueIn);
6873 return debug_parse_levels(pszParmValueIn);
6876 /***************************************************************************
6877 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
6878 ***************************************************************************/
6880 static const char *append_ldap_suffix( const char *str )
6882 const char *suffix_string;
6885 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
6886 Globals.szLdapSuffix );
6887 if ( !suffix_string ) {
6888 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
6889 return "";
6892 return suffix_string;
6895 const char *lp_ldap_machine_suffix(void)
6897 if (Globals.szLdapMachineSuffix[0])
6898 return append_ldap_suffix(Globals.szLdapMachineSuffix);
6900 return lp_string(Globals.szLdapSuffix);
6903 const char *lp_ldap_user_suffix(void)
6905 if (Globals.szLdapUserSuffix[0])
6906 return append_ldap_suffix(Globals.szLdapUserSuffix);
6908 return lp_string(Globals.szLdapSuffix);
6911 const char *lp_ldap_group_suffix(void)
6913 if (Globals.szLdapGroupSuffix[0])
6914 return append_ldap_suffix(Globals.szLdapGroupSuffix);
6916 return lp_string(Globals.szLdapSuffix);
6919 const char *lp_ldap_idmap_suffix(void)
6921 if (Globals.szLdapIdmapSuffix[0])
6922 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
6924 return lp_string(Globals.szLdapSuffix);
6927 /****************************************************************************
6928 set the value for a P_ENUM
6929 ***************************************************************************/
6931 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
6932 int *ptr )
6934 int i;
6936 for (i = 0; parm->enum_list[i].name; i++) {
6937 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
6938 *ptr = parm->enum_list[i].value;
6939 break;
6944 /***************************************************************************
6945 ***************************************************************************/
6947 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
6949 static int parm_num = -1;
6950 struct service *s;
6952 if ( parm_num == -1 )
6953 parm_num = map_parameter( "printing" );
6955 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
6957 if ( snum < 0 )
6958 s = &sDefault;
6959 else
6960 s = ServicePtrs[snum];
6962 init_printer_values( s );
6964 return True;
6968 /***************************************************************************
6969 Initialise a copymap.
6970 ***************************************************************************/
6972 static void init_copymap(struct service *pservice)
6974 int i;
6975 if (pservice->copymap) {
6976 bitmap_free(pservice->copymap);
6978 pservice->copymap = bitmap_allocate(NUMPARAMETERS);
6979 if (!pservice->copymap)
6980 DEBUG(0,
6981 ("Couldn't allocate copymap!! (size %d)\n",
6982 (int)NUMPARAMETERS));
6983 else
6984 for (i = 0; i < NUMPARAMETERS; i++)
6985 bitmap_set(pservice->copymap, i);
6988 /***************************************************************************
6989 Return the local pointer to a parameter given the service number and the
6990 pointer into the default structure.
6991 ***************************************************************************/
6993 void *lp_local_ptr(int snum, void *ptr)
6995 return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
6998 /***************************************************************************
6999 Process a parameter for a particular service number. If snum < 0
7000 then assume we are in the globals.
7001 ***************************************************************************/
7003 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
7005 int parmnum, i, slen;
7006 void *parm_ptr = NULL; /* where we are going to store the result */
7007 void *def_ptr = NULL;
7008 char *param_key = NULL;
7009 char *sep;
7010 param_opt_struct *paramo, *data;
7011 bool not_added;
7013 parmnum = map_parameter(pszParmName);
7015 if (parmnum < 0) {
7016 if ((sep=strchr(pszParmName, ':')) != NULL) {
7017 TALLOC_CTX *frame = talloc_stackframe();
7019 *sep = '\0';
7020 param_key = talloc_asprintf(frame, "%s:", pszParmName);
7021 if (!param_key) {
7022 TALLOC_FREE(frame);
7023 return false;
7025 slen = strlen(param_key);
7026 param_key = talloc_asprintf_append(param_key, sep+1);
7027 if (!param_key) {
7028 TALLOC_FREE(frame);
7029 return false;
7031 trim_char(param_key+slen, ' ', ' ');
7032 not_added = True;
7033 data = (snum < 0) ? Globals.param_opt :
7034 ServicePtrs[snum]->param_opt;
7035 /* Traverse destination */
7036 while (data) {
7037 /* If we already have same option, override it */
7038 if (strcmp(data->key, param_key) == 0) {
7039 string_free(&data->value);
7040 TALLOC_FREE(data->list);
7041 data->value = SMB_STRDUP(pszParmValue);
7042 not_added = False;
7043 break;
7045 data = data->next;
7047 if (not_added) {
7048 paramo = SMB_XMALLOC_P(param_opt_struct);
7049 paramo->key = SMB_STRDUP(param_key);
7050 paramo->value = SMB_STRDUP(pszParmValue);
7051 paramo->list = NULL;
7052 if (snum < 0) {
7053 DLIST_ADD(Globals.param_opt, paramo);
7054 } else {
7055 DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
7059 *sep = ':';
7060 TALLOC_FREE(frame);
7061 return (True);
7063 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
7064 return (True);
7067 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7068 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7069 pszParmName));
7072 def_ptr = parm_table[parmnum].ptr;
7074 /* we might point at a service, the default service or a global */
7075 if (snum < 0) {
7076 parm_ptr = def_ptr;
7077 } else {
7078 if (parm_table[parmnum].p_class == P_GLOBAL) {
7079 DEBUG(0,
7080 ("Global parameter %s found in service section!\n",
7081 pszParmName));
7082 return (True);
7084 parm_ptr =
7085 ((char *)ServicePtrs[snum]) + PTR_DIFF(def_ptr,
7086 &sDefault);
7089 if (snum >= 0) {
7090 if (!ServicePtrs[snum]->copymap)
7091 init_copymap(ServicePtrs[snum]);
7093 /* this handles the aliases - set the copymap for other entries with
7094 the same data pointer */
7095 for (i = 0; parm_table[i].label; i++)
7096 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7097 bitmap_clear(ServicePtrs[snum]->copymap, i);
7100 /* if it is a special case then go ahead */
7101 if (parm_table[parmnum].special) {
7102 parm_table[parmnum].special(snum, pszParmValue, (char **)parm_ptr);
7103 return (True);
7106 /* now switch on the type of variable it is */
7107 switch (parm_table[parmnum].type)
7109 case P_BOOL:
7110 *(bool *)parm_ptr = lp_bool(pszParmValue);
7111 break;
7113 case P_BOOLREV:
7114 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7115 break;
7117 case P_INTEGER:
7118 *(int *)parm_ptr = lp_int(pszParmValue);
7119 break;
7121 case P_CHAR:
7122 *(char *)parm_ptr = *pszParmValue;
7123 break;
7125 case P_OCTAL:
7126 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7127 if ( i != 1 ) {
7128 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7130 break;
7132 case P_LIST:
7133 TALLOC_FREE(*((char ***)parm_ptr));
7134 *(char ***)parm_ptr = str_list_make(
7135 NULL, pszParmValue, NULL);
7136 break;
7138 case P_STRING:
7139 string_set((char **)parm_ptr, pszParmValue);
7140 break;
7142 case P_USTRING:
7143 string_set((char **)parm_ptr, pszParmValue);
7144 strupper_m(*(char **)parm_ptr);
7145 break;
7147 case P_ENUM:
7148 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7149 break;
7150 case P_SEP:
7151 break;
7154 return (True);
7157 /***************************************************************************
7158 Process a parameter.
7159 ***************************************************************************/
7161 static bool do_parameter(const char *pszParmName, const char *pszParmValue)
7163 if (!bInGlobalSection && bGlobalOnly)
7164 return (True);
7166 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7168 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7169 pszParmName, pszParmValue));
7172 /***************************************************************************
7173 Print a parameter of the specified type.
7174 ***************************************************************************/
7176 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
7178 int i;
7179 switch (p->type)
7181 case P_ENUM:
7182 for (i = 0; p->enum_list[i].name; i++) {
7183 if (*(int *)ptr == p->enum_list[i].value) {
7184 fprintf(f, "%s",
7185 p->enum_list[i].name);
7186 break;
7189 break;
7191 case P_BOOL:
7192 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7193 break;
7195 case P_BOOLREV:
7196 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7197 break;
7199 case P_INTEGER:
7200 fprintf(f, "%d", *(int *)ptr);
7201 break;
7203 case P_CHAR:
7204 fprintf(f, "%c", *(char *)ptr);
7205 break;
7207 case P_OCTAL: {
7208 char *o = octal_string(*(int *)ptr);
7209 fprintf(f, "%s", o);
7210 TALLOC_FREE(o);
7211 break;
7214 case P_LIST:
7215 if ((char ***)ptr && *(char ***)ptr) {
7216 char **list = *(char ***)ptr;
7217 for (; *list; list++) {
7218 /* surround strings with whitespace in double quotes */
7219 if ( strchr_m( *list, ' ' ) )
7220 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
7221 else
7222 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
7225 break;
7227 case P_STRING:
7228 case P_USTRING:
7229 if (*(char **)ptr) {
7230 fprintf(f, "%s", *(char **)ptr);
7232 break;
7233 case P_SEP:
7234 break;
7238 /***************************************************************************
7239 Check if two parameters are equal.
7240 ***************************************************************************/
7242 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
7244 switch (type) {
7245 case P_BOOL:
7246 case P_BOOLREV:
7247 return (*((bool *)ptr1) == *((bool *)ptr2));
7249 case P_INTEGER:
7250 case P_ENUM:
7251 case P_OCTAL:
7252 return (*((int *)ptr1) == *((int *)ptr2));
7254 case P_CHAR:
7255 return (*((char *)ptr1) == *((char *)ptr2));
7257 case P_LIST:
7258 return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
7260 case P_STRING:
7261 case P_USTRING:
7263 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7264 if (p1 && !*p1)
7265 p1 = NULL;
7266 if (p2 && !*p2)
7267 p2 = NULL;
7268 return (p1 == p2 || strequal(p1, p2));
7270 case P_SEP:
7271 break;
7273 return (False);
7276 /***************************************************************************
7277 Initialize any local varients in the sDefault table.
7278 ***************************************************************************/
7280 void init_locals(void)
7282 /* None as yet. */
7285 /***************************************************************************
7286 Process a new section (service). At this stage all sections are services.
7287 Later we'll have special sections that permit server parameters to be set.
7288 Returns True on success, False on failure.
7289 ***************************************************************************/
7291 static bool do_section(const char *pszSectionName)
7293 bool bRetval;
7294 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7295 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7296 bRetval = False;
7298 /* if we were in a global section then do the local inits */
7299 if (bInGlobalSection && !isglobal)
7300 init_locals();
7302 /* if we've just struck a global section, note the fact. */
7303 bInGlobalSection = isglobal;
7305 /* check for multiple global sections */
7306 if (bInGlobalSection) {
7307 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7308 return (True);
7311 if (!bInGlobalSection && bGlobalOnly)
7312 return (True);
7314 /* if we have a current service, tidy it up before moving on */
7315 bRetval = True;
7317 if (iServiceIndex >= 0)
7318 bRetval = service_ok(iServiceIndex);
7320 /* if all is still well, move to the next record in the services array */
7321 if (bRetval) {
7322 /* We put this here to avoid an odd message order if messages are */
7323 /* issued by the post-processing of a previous section. */
7324 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7326 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
7327 < 0) {
7328 DEBUG(0, ("Failed to add a new service\n"));
7329 return (False);
7333 return (bRetval);
7337 /***************************************************************************
7338 Determine if a partcular base parameter is currentl set to the default value.
7339 ***************************************************************************/
7341 static bool is_default(int i)
7343 if (!defaults_saved)
7344 return False;
7345 switch (parm_table[i].type) {
7346 case P_LIST:
7347 return str_list_compare (parm_table[i].def.lvalue,
7348 *(char ***)parm_table[i].ptr);
7349 case P_STRING:
7350 case P_USTRING:
7351 return strequal(parm_table[i].def.svalue,
7352 *(char **)parm_table[i].ptr);
7353 case P_BOOL:
7354 case P_BOOLREV:
7355 return parm_table[i].def.bvalue ==
7356 *(bool *)parm_table[i].ptr;
7357 case P_CHAR:
7358 return parm_table[i].def.cvalue ==
7359 *(char *)parm_table[i].ptr;
7360 case P_INTEGER:
7361 case P_OCTAL:
7362 case P_ENUM:
7363 return parm_table[i].def.ivalue ==
7364 *(int *)parm_table[i].ptr;
7365 case P_SEP:
7366 break;
7368 return False;
7371 /***************************************************************************
7372 Display the contents of the global structure.
7373 ***************************************************************************/
7375 static void dump_globals(FILE *f)
7377 int i;
7378 param_opt_struct *data;
7380 fprintf(f, "[global]\n");
7382 for (i = 0; parm_table[i].label; i++)
7383 if (parm_table[i].p_class == P_GLOBAL &&
7384 parm_table[i].ptr &&
7385 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
7386 if (defaults_saved && is_default(i))
7387 continue;
7388 fprintf(f, "\t%s = ", parm_table[i].label);
7389 print_parameter(&parm_table[i], parm_table[i].ptr, f);
7390 fprintf(f, "\n");
7392 if (Globals.param_opt != NULL) {
7393 data = Globals.param_opt;
7394 while(data) {
7395 fprintf(f, "\t%s = %s\n", data->key, data->value);
7396 data = data->next;
7402 /***************************************************************************
7403 Return True if a local parameter is currently set to the global default.
7404 ***************************************************************************/
7406 bool lp_is_default(int snum, struct parm_struct *parm)
7408 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
7410 return equal_parameter(parm->type,
7411 ((char *)ServicePtrs[snum]) + pdiff,
7412 ((char *)&sDefault) + pdiff);
7415 /***************************************************************************
7416 Display the contents of a single services record.
7417 ***************************************************************************/
7419 static void dump_a_service(struct service *pService, FILE * f)
7421 int i;
7422 param_opt_struct *data;
7424 if (pService != &sDefault)
7425 fprintf(f, "[%s]\n", pService->szService);
7427 for (i = 0; parm_table[i].label; i++) {
7429 if (parm_table[i].p_class == P_LOCAL &&
7430 parm_table[i].ptr &&
7431 (*parm_table[i].label != '-') &&
7432 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
7435 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
7437 if (pService == &sDefault) {
7438 if (defaults_saved && is_default(i))
7439 continue;
7440 } else {
7441 if (equal_parameter(parm_table[i].type,
7442 ((char *)pService) +
7443 pdiff,
7444 ((char *)&sDefault) +
7445 pdiff))
7446 continue;
7449 fprintf(f, "\t%s = ", parm_table[i].label);
7450 print_parameter(&parm_table[i],
7451 ((char *)pService) + pdiff, f);
7452 fprintf(f, "\n");
7456 if (pService->param_opt != NULL) {
7457 data = pService->param_opt;
7458 while(data) {
7459 fprintf(f, "\t%s = %s\n", data->key, data->value);
7460 data = data->next;
7465 /***************************************************************************
7466 Display the contents of a parameter of a single services record.
7467 ***************************************************************************/
7469 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
7471 int i;
7472 bool result = False;
7473 parm_class p_class;
7474 unsigned flag = 0;
7475 fstring local_parm_name;
7476 char *parm_opt;
7477 const char *parm_opt_value;
7479 /* check for parametrical option */
7480 fstrcpy( local_parm_name, parm_name);
7481 parm_opt = strchr( local_parm_name, ':');
7483 if (parm_opt) {
7484 *parm_opt = '\0';
7485 parm_opt++;
7486 if (strlen(parm_opt)) {
7487 parm_opt_value = lp_parm_const_string( snum,
7488 local_parm_name, parm_opt, NULL);
7489 if (parm_opt_value) {
7490 printf( "%s\n", parm_opt_value);
7491 result = True;
7494 return result;
7497 /* check for a key and print the value */
7498 if (isGlobal) {
7499 p_class = P_GLOBAL;
7500 flag = FLAG_GLOBAL;
7501 } else
7502 p_class = P_LOCAL;
7504 for (i = 0; parm_table[i].label; i++) {
7505 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
7506 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
7507 parm_table[i].ptr &&
7508 (*parm_table[i].label != '-') &&
7509 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
7511 void *ptr;
7513 if (isGlobal) {
7514 ptr = parm_table[i].ptr;
7515 } else {
7516 struct service *pService = ServicePtrs[snum];
7517 ptr = ((char *)pService) +
7518 PTR_DIFF(parm_table[i].ptr, &sDefault);
7521 print_parameter(&parm_table[i],
7522 ptr, f);
7523 fprintf(f, "\n");
7524 result = True;
7525 break;
7529 return result;
7532 /***************************************************************************
7533 Return info about the requested parameter (given as a string).
7534 Return NULL when the string is not a valid parameter name.
7535 ***************************************************************************/
7537 struct parm_struct *lp_get_parameter(const char *param_name)
7539 int num = map_parameter(param_name);
7541 if (num < 0) {
7542 return NULL;
7545 return &parm_table[num];
7548 /***************************************************************************
7549 Return info about the next parameter in a service.
7550 snum==GLOBAL_SECTION_SNUM gives the globals.
7551 Return NULL when out of parameters.
7552 ***************************************************************************/
7554 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
7556 if (snum < 0) {
7557 /* do the globals */
7558 for (; parm_table[*i].label; (*i)++) {
7559 if (parm_table[*i].p_class == P_SEPARATOR)
7560 return &parm_table[(*i)++];
7562 if (!parm_table[*i].ptr
7563 || (*parm_table[*i].label == '-'))
7564 continue;
7566 if ((*i) > 0
7567 && (parm_table[*i].ptr ==
7568 parm_table[(*i) - 1].ptr))
7569 continue;
7571 if (is_default(*i) && !allparameters)
7572 continue;
7574 return &parm_table[(*i)++];
7576 } else {
7577 struct service *pService = ServicePtrs[snum];
7579 for (; parm_table[*i].label; (*i)++) {
7580 if (parm_table[*i].p_class == P_SEPARATOR)
7581 return &parm_table[(*i)++];
7583 if (parm_table[*i].p_class == P_LOCAL &&
7584 parm_table[*i].ptr &&
7585 (*parm_table[*i].label != '-') &&
7586 ((*i) == 0 ||
7587 (parm_table[*i].ptr !=
7588 parm_table[(*i) - 1].ptr)))
7590 int pdiff =
7591 PTR_DIFF(parm_table[*i].ptr,
7592 &sDefault);
7594 if (allparameters ||
7595 !equal_parameter(parm_table[*i].type,
7596 ((char *)pService) +
7597 pdiff,
7598 ((char *)&sDefault) +
7599 pdiff))
7601 return &parm_table[(*i)++];
7607 return NULL;
7611 #if 0
7612 /***************************************************************************
7613 Display the contents of a single copy structure.
7614 ***************************************************************************/
7615 static void dump_copy_map(bool *pcopymap)
7617 int i;
7618 if (!pcopymap)
7619 return;
7621 printf("\n\tNon-Copied parameters:\n");
7623 for (i = 0; parm_table[i].label; i++)
7624 if (parm_table[i].p_class == P_LOCAL &&
7625 parm_table[i].ptr && !pcopymap[i] &&
7626 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
7628 printf("\t\t%s\n", parm_table[i].label);
7631 #endif
7633 /***************************************************************************
7634 Return TRUE if the passed service number is within range.
7635 ***************************************************************************/
7637 bool lp_snum_ok(int iService)
7639 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
7642 /***************************************************************************
7643 Auto-load some home services.
7644 ***************************************************************************/
7646 static void lp_add_auto_services(char *str)
7648 char *s;
7649 char *p;
7650 int homes;
7651 char *saveptr;
7653 if (!str)
7654 return;
7656 s = SMB_STRDUP(str);
7657 if (!s)
7658 return;
7660 homes = lp_servicenumber(HOMES_NAME);
7662 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
7663 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
7664 char *home;
7666 if (lp_servicenumber(p) >= 0)
7667 continue;
7669 home = get_user_home_dir(talloc_tos(), p);
7671 if (home && homes >= 0)
7672 lp_add_home(p, homes, p, home);
7674 TALLOC_FREE(home);
7676 SAFE_FREE(s);
7679 /***************************************************************************
7680 Auto-load one printer.
7681 ***************************************************************************/
7683 void lp_add_one_printer(char *name, char *comment)
7685 int printers = lp_servicenumber(PRINTERS_NAME);
7686 int i;
7688 if (lp_servicenumber(name) < 0) {
7689 lp_add_printer(name, printers);
7690 if ((i = lp_servicenumber(name)) >= 0) {
7691 string_set(&ServicePtrs[i]->comment, comment);
7692 ServicePtrs[i]->autoloaded = True;
7697 /***************************************************************************
7698 Have we loaded a services file yet?
7699 ***************************************************************************/
7701 bool lp_loaded(void)
7703 return (bLoaded);
7706 /***************************************************************************
7707 Unload unused services.
7708 ***************************************************************************/
7710 void lp_killunused(bool (*snumused) (int))
7712 int i;
7713 for (i = 0; i < iNumServices; i++) {
7714 if (!VALID(i))
7715 continue;
7717 /* don't kill autoloaded or usershare services */
7718 if ( ServicePtrs[i]->autoloaded ||
7719 ServicePtrs[i]->usershare == USERSHARE_VALID) {
7720 continue;
7723 if (!snumused || !snumused(i)) {
7724 free_service_byindex(i);
7729 /***************************************************************************
7730 Unload a service.
7731 ***************************************************************************/
7733 void lp_killservice(int iServiceIn)
7735 if (VALID(iServiceIn)) {
7736 free_service_byindex(iServiceIn);
7740 /***************************************************************************
7741 Save the curent values of all global and sDefault parameters into the
7742 defaults union. This allows swat and testparm to show only the
7743 changed (ie. non-default) parameters.
7744 ***************************************************************************/
7746 static void lp_save_defaults(void)
7748 int i;
7749 for (i = 0; parm_table[i].label; i++) {
7750 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
7751 continue;
7752 switch (parm_table[i].type) {
7753 case P_LIST:
7754 str_list_copy(
7755 NULL, &(parm_table[i].def.lvalue),
7756 *(const char ***)parm_table[i].ptr);
7757 break;
7758 case P_STRING:
7759 case P_USTRING:
7760 if (parm_table[i].ptr) {
7761 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
7762 } else {
7763 parm_table[i].def.svalue = NULL;
7765 break;
7766 case P_BOOL:
7767 case P_BOOLREV:
7768 parm_table[i].def.bvalue =
7769 *(bool *)parm_table[i].ptr;
7770 break;
7771 case P_CHAR:
7772 parm_table[i].def.cvalue =
7773 *(char *)parm_table[i].ptr;
7774 break;
7775 case P_INTEGER:
7776 case P_OCTAL:
7777 case P_ENUM:
7778 parm_table[i].def.ivalue =
7779 *(int *)parm_table[i].ptr;
7780 break;
7781 case P_SEP:
7782 break;
7785 defaults_saved = True;
7788 /*******************************************************************
7789 Set the server type we will announce as via nmbd.
7790 ********************************************************************/
7792 static const struct srv_role_tab {
7793 uint32 role;
7794 const char *role_str;
7795 } srv_role_tab [] = {
7796 { ROLE_STANDALONE, "ROLE_STANDALONE" },
7797 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
7798 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
7799 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
7800 { 0, NULL }
7803 const char* server_role_str(uint32 role)
7805 int i = 0;
7806 for (i=0; srv_role_tab[i].role_str; i++) {
7807 if (role == srv_role_tab[i].role) {
7808 return srv_role_tab[i].role_str;
7811 return NULL;
7814 static void set_server_role(void)
7816 server_role = ROLE_STANDALONE;
7818 switch (lp_security()) {
7819 case SEC_SHARE:
7820 if (lp_domain_logons())
7821 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
7822 break;
7823 case SEC_SERVER:
7824 if (lp_domain_logons())
7825 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
7826 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
7827 server_role = ROLE_STANDALONE;
7828 break;
7829 case SEC_DOMAIN:
7830 if (lp_domain_logons()) {
7831 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
7832 server_role = ROLE_DOMAIN_BDC;
7833 break;
7835 server_role = ROLE_DOMAIN_MEMBER;
7836 break;
7837 case SEC_ADS:
7838 if (lp_domain_logons()) {
7839 server_role = ROLE_DOMAIN_PDC;
7840 break;
7842 server_role = ROLE_DOMAIN_MEMBER;
7843 break;
7844 case SEC_USER:
7845 if (lp_domain_logons()) {
7847 if (Globals.iDomainMaster) /* auto or yes */
7848 server_role = ROLE_DOMAIN_PDC;
7849 else
7850 server_role = ROLE_DOMAIN_BDC;
7852 break;
7853 default:
7854 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
7855 break;
7858 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
7861 /***********************************************************
7862 If we should send plaintext/LANMAN passwords in the clinet
7863 ************************************************************/
7865 static void set_allowed_client_auth(void)
7867 if (Globals.bClientNTLMv2Auth) {
7868 Globals.bClientLanManAuth = False;
7870 if (!Globals.bClientLanManAuth) {
7871 Globals.bClientPlaintextAuth = False;
7875 /***************************************************************************
7876 JRA.
7877 The following code allows smbd to read a user defined share file.
7878 Yes, this is my intent. Yes, I'm comfortable with that...
7880 THE FOLLOWING IS SECURITY CRITICAL CODE.
7882 It washes your clothes, it cleans your house, it guards you while you sleep...
7883 Do not f%^k with it....
7884 ***************************************************************************/
7886 #define MAX_USERSHARE_FILE_SIZE (10*1024)
7888 /***************************************************************************
7889 Check allowed stat state of a usershare file.
7890 Ensure we print out who is dicking with us so the admin can
7891 get their sorry ass fired.
7892 ***************************************************************************/
7894 static bool check_usershare_stat(const char *fname, SMB_STRUCT_STAT *psbuf)
7896 if (!S_ISREG(psbuf->st_mode)) {
7897 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
7898 "not a regular file\n",
7899 fname, (unsigned int)psbuf->st_uid ));
7900 return False;
7903 /* Ensure this doesn't have the other write bit set. */
7904 if (psbuf->st_mode & S_IWOTH) {
7905 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
7906 "public write. Refusing to allow as a usershare file.\n",
7907 fname, (unsigned int)psbuf->st_uid ));
7908 return False;
7911 /* Should be 10k or less. */
7912 if (psbuf->st_size > MAX_USERSHARE_FILE_SIZE) {
7913 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
7914 "too large (%u) to be a user share file.\n",
7915 fname, (unsigned int)psbuf->st_uid,
7916 (unsigned int)psbuf->st_size ));
7917 return False;
7920 return True;
7923 /***************************************************************************
7924 Parse the contents of a usershare file.
7925 ***************************************************************************/
7927 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
7928 SMB_STRUCT_STAT *psbuf,
7929 const char *servicename,
7930 int snum,
7931 char **lines,
7932 int numlines,
7933 char **pp_sharepath,
7934 char **pp_comment,
7935 SEC_DESC **ppsd,
7936 bool *pallow_guest)
7938 const char **prefixallowlist = lp_usershare_prefix_allow_list();
7939 const char **prefixdenylist = lp_usershare_prefix_deny_list();
7940 int us_vers;
7941 SMB_STRUCT_DIR *dp;
7942 SMB_STRUCT_STAT sbuf;
7943 char *sharepath = NULL;
7944 char *comment = NULL;
7946 *pp_sharepath = NULL;
7947 *pp_comment = NULL;
7949 *pallow_guest = False;
7951 if (numlines < 4) {
7952 return USERSHARE_MALFORMED_FILE;
7955 if (strcmp(lines[0], "#VERSION 1") == 0) {
7956 us_vers = 1;
7957 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
7958 us_vers = 2;
7959 if (numlines < 5) {
7960 return USERSHARE_MALFORMED_FILE;
7962 } else {
7963 return USERSHARE_BAD_VERSION;
7966 if (strncmp(lines[1], "path=", 5) != 0) {
7967 return USERSHARE_MALFORMED_PATH;
7970 sharepath = talloc_strdup(ctx, &lines[1][5]);
7971 if (!sharepath) {
7972 return USERSHARE_POSIX_ERR;
7974 trim_string(sharepath, " ", " ");
7976 if (strncmp(lines[2], "comment=", 8) != 0) {
7977 return USERSHARE_MALFORMED_COMMENT_DEF;
7980 comment = talloc_strdup(ctx, &lines[2][8]);
7981 if (!comment) {
7982 return USERSHARE_POSIX_ERR;
7984 trim_string(comment, " ", " ");
7985 trim_char(comment, '"', '"');
7987 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
7988 return USERSHARE_MALFORMED_ACL_DEF;
7991 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
7992 return USERSHARE_ACL_ERR;
7995 if (us_vers == 2) {
7996 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
7997 return USERSHARE_MALFORMED_ACL_DEF;
7999 if (lines[4][9] == 'y') {
8000 *pallow_guest = True;
8004 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8005 /* Path didn't change, no checks needed. */
8006 *pp_sharepath = sharepath;
8007 *pp_comment = comment;
8008 return USERSHARE_OK;
8011 /* The path *must* be absolute. */
8012 if (sharepath[0] != '/') {
8013 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8014 servicename, sharepath));
8015 return USERSHARE_PATH_NOT_ABSOLUTE;
8018 /* If there is a usershare prefix deny list ensure one of these paths
8019 doesn't match the start of the user given path. */
8020 if (prefixdenylist) {
8021 int i;
8022 for ( i=0; prefixdenylist[i]; i++ ) {
8023 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8024 servicename, i, prefixdenylist[i], sharepath ));
8025 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8026 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8027 "usershare prefix deny list entries.\n",
8028 servicename, sharepath));
8029 return USERSHARE_PATH_IS_DENIED;
8034 /* If there is a usershare prefix allow list ensure one of these paths
8035 does match the start of the user given path. */
8037 if (prefixallowlist) {
8038 int i;
8039 for ( i=0; prefixallowlist[i]; i++ ) {
8040 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8041 servicename, i, prefixallowlist[i], sharepath ));
8042 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8043 break;
8046 if (prefixallowlist[i] == NULL) {
8047 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8048 "usershare prefix allow list entries.\n",
8049 servicename, sharepath));
8050 return USERSHARE_PATH_NOT_ALLOWED;
8054 /* Ensure this is pointing to a directory. */
8055 dp = sys_opendir(sharepath);
8057 if (!dp) {
8058 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8059 servicename, sharepath));
8060 return USERSHARE_PATH_NOT_DIRECTORY;
8063 /* Ensure the owner of the usershare file has permission to share
8064 this directory. */
8066 if (sys_stat(sharepath, &sbuf) == -1) {
8067 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8068 servicename, sharepath, strerror(errno) ));
8069 sys_closedir(dp);
8070 return USERSHARE_POSIX_ERR;
8073 sys_closedir(dp);
8075 if (!S_ISDIR(sbuf.st_mode)) {
8076 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8077 servicename, sharepath ));
8078 return USERSHARE_PATH_NOT_DIRECTORY;
8081 /* Check if sharing is restricted to owner-only. */
8082 /* psbuf is the stat of the usershare definition file,
8083 sbuf is the stat of the target directory to be shared. */
8085 if (lp_usershare_owner_only()) {
8086 /* root can share anything. */
8087 if ((psbuf->st_uid != 0) && (sbuf.st_uid != psbuf->st_uid)) {
8088 return USERSHARE_PATH_NOT_ALLOWED;
8092 *pp_sharepath = sharepath;
8093 *pp_comment = comment;
8094 return USERSHARE_OK;
8097 /***************************************************************************
8098 Deal with a usershare file.
8099 Returns:
8100 >= 0 - snum
8101 -1 - Bad name, invalid contents.
8102 - service name already existed and not a usershare, problem
8103 with permissions to share directory etc.
8104 ***************************************************************************/
8106 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
8108 SMB_STRUCT_STAT sbuf;
8109 SMB_STRUCT_STAT lsbuf;
8110 char *fname = NULL;
8111 char *sharepath = NULL;
8112 char *comment = NULL;
8113 fstring service_name;
8114 char **lines = NULL;
8115 int numlines = 0;
8116 int fd = -1;
8117 int iService = -1;
8118 TALLOC_CTX *ctx = NULL;
8119 SEC_DESC *psd = NULL;
8120 bool guest_ok = False;
8122 /* Ensure share name doesn't contain invalid characters. */
8123 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8124 DEBUG(0,("process_usershare_file: share name %s contains "
8125 "invalid characters (any of %s)\n",
8126 file_name, INVALID_SHARENAME_CHARS ));
8127 return -1;
8130 fstrcpy(service_name, file_name);
8132 if (asprintf(&fname, "%s/%s", dir_name, file_name) < 0) {
8135 /* Minimize the race condition by doing an lstat before we
8136 open and fstat. Ensure this isn't a symlink link. */
8138 if (sys_lstat(fname, &lsbuf) != 0) {
8139 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8140 fname, strerror(errno) ));
8141 SAFE_FREE(fname);
8142 return -1;
8145 /* This must be a regular file, not a symlink, directory or
8146 other strange filetype. */
8147 if (!check_usershare_stat(fname, &lsbuf)) {
8148 SAFE_FREE(fname);
8149 return -1;
8153 char *canon_name = canonicalize_servicename(service_name);
8154 TDB_DATA data = dbwrap_fetch_bystring(
8155 ServiceHash, canon_name, canon_name);
8157 iService = -1;
8159 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8160 iService = *(int *)data.dptr;
8162 TALLOC_FREE(canon_name);
8165 if (iService != -1 && ServicePtrs[iService]->usershare_last_mod == lsbuf.st_mtime) {
8166 /* Nothing changed - Mark valid and return. */
8167 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8168 service_name ));
8169 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8170 SAFE_FREE(fname);
8171 return iService;
8174 /* Try and open the file read only - no symlinks allowed. */
8175 #ifdef O_NOFOLLOW
8176 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8177 #else
8178 fd = sys_open(fname, O_RDONLY, 0);
8179 #endif
8181 if (fd == -1) {
8182 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8183 fname, strerror(errno) ));
8184 SAFE_FREE(fname);
8185 return -1;
8188 /* Now fstat to be *SURE* it's a regular file. */
8189 if (sys_fstat(fd, &sbuf) != 0) {
8190 close(fd);
8191 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8192 fname, strerror(errno) ));
8193 SAFE_FREE(fname);
8194 return -1;
8197 /* Is it the same dev/inode as was lstated ? */
8198 if (lsbuf.st_dev != sbuf.st_dev || lsbuf.st_ino != sbuf.st_ino) {
8199 close(fd);
8200 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8201 "Symlink spoofing going on ?\n", fname ));
8202 SAFE_FREE(fname);
8203 return -1;
8206 /* This must be a regular file, not a symlink, directory or
8207 other strange filetype. */
8208 if (!check_usershare_stat(fname, &sbuf)) {
8209 SAFE_FREE(fname);
8210 return -1;
8213 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE);
8215 close(fd);
8216 if (lines == NULL) {
8217 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8218 fname, (unsigned int)sbuf.st_uid ));
8219 SAFE_FREE(fname);
8220 return -1;
8223 SAFE_FREE(fname);
8225 /* Should we allow printers to be shared... ? */
8226 ctx = talloc_init("usershare_sd_xctx");
8227 if (!ctx) {
8228 file_lines_free(lines);
8229 return 1;
8232 if (parse_usershare_file(ctx, &sbuf, service_name,
8233 iService, lines, numlines, &sharepath,
8234 &comment, &psd, &guest_ok) != USERSHARE_OK) {
8235 talloc_destroy(ctx);
8236 file_lines_free(lines);
8237 return -1;
8240 file_lines_free(lines);
8242 /* Everything ok - add the service possibly using a template. */
8243 if (iService < 0) {
8244 const struct service *sp = &sDefault;
8245 if (snum_template != -1) {
8246 sp = ServicePtrs[snum_template];
8249 if ((iService = add_a_service(sp, service_name)) < 0) {
8250 DEBUG(0, ("process_usershare_file: Failed to add "
8251 "new service %s\n", service_name));
8252 talloc_destroy(ctx);
8253 return -1;
8256 /* Read only is controlled by usershare ACL below. */
8257 ServicePtrs[iService]->bRead_only = False;
8260 /* Write the ACL of the new/modified share. */
8261 if (!set_share_security(service_name, psd)) {
8262 DEBUG(0, ("process_usershare_file: Failed to set share "
8263 "security for user share %s\n",
8264 service_name ));
8265 lp_remove_service(iService);
8266 talloc_destroy(ctx);
8267 return -1;
8270 /* If from a template it may be marked invalid. */
8271 ServicePtrs[iService]->valid = True;
8273 /* Set the service as a valid usershare. */
8274 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8276 /* Set guest access. */
8277 if (lp_usershare_allow_guests()) {
8278 ServicePtrs[iService]->bGuest_ok = guest_ok;
8281 /* And note when it was loaded. */
8282 ServicePtrs[iService]->usershare_last_mod = sbuf.st_mtime;
8283 string_set(&ServicePtrs[iService]->szPath, sharepath);
8284 string_set(&ServicePtrs[iService]->comment, comment);
8286 talloc_destroy(ctx);
8288 return iService;
8291 /***************************************************************************
8292 Checks if a usershare entry has been modified since last load.
8293 ***************************************************************************/
8295 static bool usershare_exists(int iService, time_t *last_mod)
8297 SMB_STRUCT_STAT lsbuf;
8298 const char *usersharepath = Globals.szUsersharePath;
8299 char *fname;
8301 if (asprintf(&fname, "%s/%s",
8302 usersharepath,
8303 ServicePtrs[iService]->szService) < 0) {
8304 return false;
8307 if (sys_lstat(fname, &lsbuf) != 0) {
8308 SAFE_FREE(fname);
8309 return false;
8312 if (!S_ISREG(lsbuf.st_mode)) {
8313 SAFE_FREE(fname);
8314 return false;
8317 SAFE_FREE(fname);
8318 *last_mod = lsbuf.st_mtime;
8319 return true;
8322 /***************************************************************************
8323 Load a usershare service by name. Returns a valid servicenumber or -1.
8324 ***************************************************************************/
8326 int load_usershare_service(const char *servicename)
8328 SMB_STRUCT_STAT sbuf;
8329 const char *usersharepath = Globals.szUsersharePath;
8330 int max_user_shares = Globals.iUsershareMaxShares;
8331 int snum_template = -1;
8333 if (*usersharepath == 0 || max_user_shares == 0) {
8334 return -1;
8337 if (sys_stat(usersharepath, &sbuf) != 0) {
8338 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8339 usersharepath, strerror(errno) ));
8340 return -1;
8343 if (!S_ISDIR(sbuf.st_mode)) {
8344 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8345 usersharepath ));
8346 return -1;
8350 * This directory must be owned by root, and have the 't' bit set.
8351 * It also must not be writable by "other".
8354 #ifdef S_ISVTX
8355 if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
8356 #else
8357 if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
8358 #endif
8359 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8360 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8361 usersharepath ));
8362 return -1;
8365 /* Ensure the template share exists if it's set. */
8366 if (Globals.szUsershareTemplateShare[0]) {
8367 /* We can't use lp_servicenumber here as we are recommending that
8368 template shares have -valid=False set. */
8369 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8370 if (ServicePtrs[snum_template]->szService &&
8371 strequal(ServicePtrs[snum_template]->szService,
8372 Globals.szUsershareTemplateShare)) {
8373 break;
8377 if (snum_template == -1) {
8378 DEBUG(0,("load_usershare_service: usershare template share %s "
8379 "does not exist.\n",
8380 Globals.szUsershareTemplateShare ));
8381 return -1;
8385 return process_usershare_file(usersharepath, servicename, snum_template);
8388 /***************************************************************************
8389 Load all user defined shares from the user share directory.
8390 We only do this if we're enumerating the share list.
8391 This is the function that can delete usershares that have
8392 been removed.
8393 ***************************************************************************/
8395 int load_usershare_shares(void)
8397 SMB_STRUCT_DIR *dp;
8398 SMB_STRUCT_STAT sbuf;
8399 SMB_STRUCT_DIRENT *de;
8400 int num_usershares = 0;
8401 int max_user_shares = Globals.iUsershareMaxShares;
8402 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
8403 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
8404 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
8405 int iService;
8406 int snum_template = -1;
8407 const char *usersharepath = Globals.szUsersharePath;
8408 int ret = lp_numservices();
8410 if (max_user_shares == 0 || *usersharepath == '\0') {
8411 return lp_numservices();
8414 if (sys_stat(usersharepath, &sbuf) != 0) {
8415 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8416 usersharepath, strerror(errno) ));
8417 return ret;
8421 * This directory must be owned by root, and have the 't' bit set.
8422 * It also must not be writable by "other".
8425 #ifdef S_ISVTX
8426 if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
8427 #else
8428 if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
8429 #endif
8430 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8431 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8432 usersharepath ));
8433 return ret;
8436 /* Ensure the template share exists if it's set. */
8437 if (Globals.szUsershareTemplateShare[0]) {
8438 /* We can't use lp_servicenumber here as we are recommending that
8439 template shares have -valid=False set. */
8440 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8441 if (ServicePtrs[snum_template]->szService &&
8442 strequal(ServicePtrs[snum_template]->szService,
8443 Globals.szUsershareTemplateShare)) {
8444 break;
8448 if (snum_template == -1) {
8449 DEBUG(0,("load_usershare_shares: usershare template share %s "
8450 "does not exist.\n",
8451 Globals.szUsershareTemplateShare ));
8452 return ret;
8456 /* Mark all existing usershares as pending delete. */
8457 for (iService = iNumServices - 1; iService >= 0; iService--) {
8458 if (VALID(iService) && ServicePtrs[iService]->usershare) {
8459 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
8463 dp = sys_opendir(usersharepath);
8464 if (!dp) {
8465 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8466 usersharepath, strerror(errno) ));
8467 return ret;
8470 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
8471 (de = sys_readdir(dp));
8472 num_dir_entries++ ) {
8473 int r;
8474 const char *n = de->d_name;
8476 /* Ignore . and .. */
8477 if (*n == '.') {
8478 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
8479 continue;
8483 if (n[0] == ':') {
8484 /* Temporary file used when creating a share. */
8485 num_tmp_dir_entries++;
8488 /* Allow 20% tmp entries. */
8489 if (num_tmp_dir_entries > allowed_tmp_entries) {
8490 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8491 "in directory %s\n",
8492 num_tmp_dir_entries, usersharepath));
8493 break;
8496 r = process_usershare_file(usersharepath, n, snum_template);
8497 if (r == 0) {
8498 /* Update the services count. */
8499 num_usershares++;
8500 if (num_usershares >= max_user_shares) {
8501 DEBUG(0,("load_usershare_shares: max user shares reached "
8502 "on file %s in directory %s\n",
8503 n, usersharepath ));
8504 break;
8506 } else if (r == -1) {
8507 num_bad_dir_entries++;
8510 /* Allow 20% bad entries. */
8511 if (num_bad_dir_entries > allowed_bad_entries) {
8512 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8513 "in directory %s\n",
8514 num_bad_dir_entries, usersharepath));
8515 break;
8518 /* Allow 20% bad entries. */
8519 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
8520 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8521 "in directory %s\n",
8522 num_dir_entries, usersharepath));
8523 break;
8527 sys_closedir(dp);
8529 /* Sweep through and delete any non-refreshed usershares that are
8530 not currently in use. */
8531 for (iService = iNumServices - 1; iService >= 0; iService--) {
8532 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
8533 if (conn_snum_used(iService)) {
8534 continue;
8536 /* Remove from the share ACL db. */
8537 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
8538 lp_servicename(iService) ));
8539 delete_share_security(lp_servicename(iService));
8540 free_service_byindex(iService);
8544 return lp_numservices();
8547 /********************************************************
8548 Destroy global resources allocated in this file
8549 ********************************************************/
8551 void gfree_loadparm(void)
8553 struct file_lists *f;
8554 struct file_lists *next;
8555 int i;
8557 /* Free the file lists */
8559 f = file_lists;
8560 while( f ) {
8561 next = f->next;
8562 SAFE_FREE( f->name );
8563 SAFE_FREE( f->subfname );
8564 SAFE_FREE( f );
8565 f = next;
8568 /* Free resources allocated to services */
8570 for ( i = 0; i < iNumServices; i++ ) {
8571 if ( VALID(i) ) {
8572 free_service_byindex(i);
8576 SAFE_FREE( ServicePtrs );
8577 iNumServices = 0;
8579 /* Now release all resources allocated to global
8580 parameters and the default service */
8582 for (i = 0; parm_table[i].label; i++)
8584 if ( parm_table[i].type == P_STRING
8585 || parm_table[i].type == P_USTRING )
8587 string_free( (char**)parm_table[i].ptr );
8589 else if (parm_table[i].type == P_LIST) {
8590 TALLOC_FREE( *((char***)parm_table[i].ptr) );
8595 /***************************************************************************
8596 Load the services array from the services file. Return True on success,
8597 False on failure.
8598 ***************************************************************************/
8600 bool lp_load(const char *pszFname,
8601 bool global_only,
8602 bool save_defaults,
8603 bool add_ipc,
8604 bool initialize_globals)
8606 char *n2 = NULL;
8607 bool bRetval;
8608 param_opt_struct *data, *pdata;
8610 bRetval = False;
8612 DEBUG(3, ("lp_load: refreshing parameters\n"));
8614 bInGlobalSection = True;
8615 bGlobalOnly = global_only;
8617 init_globals(! initialize_globals);
8618 debug_init();
8620 if (save_defaults) {
8621 init_locals();
8622 lp_save_defaults();
8625 if (Globals.param_opt != NULL) {
8626 data = Globals.param_opt;
8627 while (data) {
8628 string_free(&data->key);
8629 string_free(&data->value);
8630 TALLOC_FREE(data->list);
8631 pdata = data->next;
8632 SAFE_FREE(data);
8633 data = pdata;
8635 Globals.param_opt = NULL;
8638 if (lp_config_backend() == CONFIG_BACKEND_FILE) {
8639 n2 = alloc_sub_basic(get_current_username(),
8640 current_user_info.domain,
8641 pszFname);
8642 if (!n2) {
8643 smb_panic("lp_load: out of memory");
8646 add_to_file_list(pszFname, n2);
8648 /* We get sections first, so have to start 'behind' to make up */
8649 iServiceIndex = -1;
8650 bRetval = pm_process(n2, do_section, do_parameter);
8651 SAFE_FREE(n2);
8653 /* finish up the last section */
8654 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
8655 if (bRetval) {
8656 if (iServiceIndex >= 0) {
8657 bRetval = service_ok(iServiceIndex);
8661 if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
8663 * We need to use this extra global variable here to
8664 * survive restart: init_globals usese this as a default
8665 * for ConfigBackend. Otherwise, init_globals would
8666 * send us into an endless loop here.
8668 config_backend = CONFIG_BACKEND_REGISTRY;
8669 /* start over */
8670 init_globals(false);
8671 return lp_load(pszFname, global_only, save_defaults,
8672 add_ipc, initialize_globals);
8674 } else if (lp_config_backend() == CONFIG_BACKEND_REGISTRY) {
8675 bRetval = process_registry_globals(do_parameter);
8676 } else {
8677 DEBUG(0, ("Illegal config backend given: %d\n",
8678 lp_config_backend()));
8679 bRetval = false;
8682 lp_add_auto_services(lp_auto_services());
8684 if (add_ipc) {
8685 /* When 'restrict anonymous = 2' guest connections to ipc$
8686 are denied */
8687 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
8688 if ( lp_enable_asu_support() ) {
8689 lp_add_ipc("ADMIN$", false);
8693 set_server_role();
8694 set_default_server_announce_type();
8695 set_allowed_client_auth();
8697 bLoaded = True;
8699 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
8700 /* if bWINSsupport is true and we are in the client */
8701 if (in_client && Globals.bWINSsupport) {
8702 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
8705 init_iconv();
8707 return (bRetval);
8710 /***************************************************************************
8711 Reset the max number of services.
8712 ***************************************************************************/
8714 void lp_resetnumservices(void)
8716 iNumServices = 0;
8719 /***************************************************************************
8720 Return the max number of services.
8721 ***************************************************************************/
8723 int lp_numservices(void)
8725 return (iNumServices);
8728 /***************************************************************************
8729 Display the contents of the services array in human-readable form.
8730 ***************************************************************************/
8732 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
8734 int iService;
8736 if (show_defaults)
8737 defaults_saved = False;
8739 dump_globals(f);
8741 dump_a_service(&sDefault, f);
8743 for (iService = 0; iService < maxtoprint; iService++) {
8744 fprintf(f,"\n");
8745 lp_dump_one(f, show_defaults, iService);
8749 /***************************************************************************
8750 Display the contents of one service in human-readable form.
8751 ***************************************************************************/
8753 void lp_dump_one(FILE * f, bool show_defaults, int snum)
8755 if (VALID(snum)) {
8756 if (ServicePtrs[snum]->szService[0] == '\0')
8757 return;
8758 dump_a_service(ServicePtrs[snum], f);
8762 /***************************************************************************
8763 Return the number of the service with the given name, or -1 if it doesn't
8764 exist. Note that this is a DIFFERENT ANIMAL from the internal function
8765 getservicebyname()! This works ONLY if all services have been loaded, and
8766 does not copy the found service.
8767 ***************************************************************************/
8769 int lp_servicenumber(const char *pszServiceName)
8771 int iService;
8772 fstring serviceName;
8774 if (!pszServiceName) {
8775 return GLOBAL_SECTION_SNUM;
8778 for (iService = iNumServices - 1; iService >= 0; iService--) {
8779 if (VALID(iService) && ServicePtrs[iService]->szService) {
8781 * The substitution here is used to support %U is
8782 * service names
8784 fstrcpy(serviceName, ServicePtrs[iService]->szService);
8785 standard_sub_basic(get_current_username(),
8786 current_user_info.domain,
8787 serviceName,sizeof(serviceName));
8788 if (strequal(serviceName, pszServiceName)) {
8789 break;
8794 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
8795 time_t last_mod;
8797 if (!usershare_exists(iService, &last_mod)) {
8798 /* Remove the share security tdb entry for it. */
8799 delete_share_security(lp_servicename(iService));
8800 /* Remove it from the array. */
8801 free_service_byindex(iService);
8802 /* Doesn't exist anymore. */
8803 return GLOBAL_SECTION_SNUM;
8806 /* Has it been modified ? If so delete and reload. */
8807 if (ServicePtrs[iService]->usershare_last_mod < last_mod) {
8808 /* Remove it from the array. */
8809 free_service_byindex(iService);
8810 /* and now reload it. */
8811 iService = load_usershare_service(pszServiceName);
8815 if (iService < 0) {
8816 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
8817 return GLOBAL_SECTION_SNUM;
8820 return (iService);
8823 bool share_defined(const char *service_name)
8825 return (lp_servicenumber(service_name) != -1);
8828 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
8829 const char *sharename)
8831 struct share_params *result;
8832 char *sname;
8833 int snum;
8835 if (!(sname = SMB_STRDUP(sharename))) {
8836 return NULL;
8839 snum = find_service(sname);
8840 SAFE_FREE(sname);
8842 if (snum < 0) {
8843 return NULL;
8846 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
8847 DEBUG(0, ("talloc failed\n"));
8848 return NULL;
8851 result->service = snum;
8852 return result;
8855 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
8857 struct share_iterator *result;
8859 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
8860 DEBUG(0, ("talloc failed\n"));
8861 return NULL;
8864 result->next_id = 0;
8865 return result;
8868 struct share_params *next_share(struct share_iterator *list)
8870 struct share_params *result;
8872 while (!lp_snum_ok(list->next_id) &&
8873 (list->next_id < lp_numservices())) {
8874 list->next_id += 1;
8877 if (list->next_id >= lp_numservices()) {
8878 return NULL;
8881 if (!(result = TALLOC_P(list, struct share_params))) {
8882 DEBUG(0, ("talloc failed\n"));
8883 return NULL;
8886 result->service = list->next_id;
8887 list->next_id += 1;
8888 return result;
8891 struct share_params *next_printer(struct share_iterator *list)
8893 struct share_params *result;
8895 while ((result = next_share(list)) != NULL) {
8896 if (lp_print_ok(result->service)) {
8897 break;
8900 return result;
8904 * This is a hack for a transition period until we transformed all code from
8905 * service numbers to struct share_params.
8908 struct share_params *snum2params_static(int snum)
8910 static struct share_params result;
8911 result.service = snum;
8912 return &result;
8915 /*******************************************************************
8916 A useful volume label function.
8917 ********************************************************************/
8919 const char *volume_label(int snum)
8921 char *ret;
8922 const char *label = lp_volume(snum);
8923 if (!*label) {
8924 label = lp_servicename(snum);
8927 /* This returns a 33 byte guarenteed null terminated string. */
8928 ret = talloc_strndup(talloc_tos(), label, 32);
8929 if (!ret) {
8930 return "";
8932 return ret;
8935 /*******************************************************************
8936 Set the server type we will announce as via nmbd.
8937 ********************************************************************/
8939 static void set_default_server_announce_type(void)
8941 default_server_announce = 0;
8942 default_server_announce |= SV_TYPE_WORKSTATION;
8943 default_server_announce |= SV_TYPE_SERVER;
8944 default_server_announce |= SV_TYPE_SERVER_UNIX;
8946 /* note that the flag should be set only if we have a
8947 printer service but nmbd doesn't actually load the
8948 services so we can't tell --jerry */
8950 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
8952 switch (lp_announce_as()) {
8953 case ANNOUNCE_AS_NT_SERVER:
8954 default_server_announce |= SV_TYPE_SERVER_NT;
8955 /* fall through... */
8956 case ANNOUNCE_AS_NT_WORKSTATION:
8957 default_server_announce |= SV_TYPE_NT;
8958 break;
8959 case ANNOUNCE_AS_WIN95:
8960 default_server_announce |= SV_TYPE_WIN95_PLUS;
8961 break;
8962 case ANNOUNCE_AS_WFW:
8963 default_server_announce |= SV_TYPE_WFW;
8964 break;
8965 default:
8966 break;
8969 switch (lp_server_role()) {
8970 case ROLE_DOMAIN_MEMBER:
8971 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
8972 break;
8973 case ROLE_DOMAIN_PDC:
8974 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
8975 break;
8976 case ROLE_DOMAIN_BDC:
8977 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
8978 break;
8979 case ROLE_STANDALONE:
8980 default:
8981 break;
8983 if (lp_time_server())
8984 default_server_announce |= SV_TYPE_TIME_SOURCE;
8986 if (lp_host_msdfs())
8987 default_server_announce |= SV_TYPE_DFS_SERVER;
8990 /***********************************************************
8991 returns role of Samba server
8992 ************************************************************/
8994 int lp_server_role(void)
8996 return server_role;
8999 /***********************************************************
9000 If we are PDC then prefer us as DMB
9001 ************************************************************/
9003 bool lp_domain_master(void)
9005 if (Globals.iDomainMaster == Auto)
9006 return (lp_server_role() == ROLE_DOMAIN_PDC);
9008 return (bool)Globals.iDomainMaster;
9011 /***********************************************************
9012 If we are DMB then prefer us as LMB
9013 ************************************************************/
9015 bool lp_preferred_master(void)
9017 if (Globals.iPreferredMaster == Auto)
9018 return (lp_local_master() && lp_domain_master());
9020 return (bool)Globals.iPreferredMaster;
9023 /*******************************************************************
9024 Remove a service.
9025 ********************************************************************/
9027 void lp_remove_service(int snum)
9029 ServicePtrs[snum]->valid = False;
9030 invalid_services[num_invalid_services++] = snum;
9033 /*******************************************************************
9034 Copy a service.
9035 ********************************************************************/
9037 void lp_copy_service(int snum, const char *new_name)
9039 do_section(new_name);
9040 if (snum >= 0) {
9041 snum = lp_servicenumber(new_name);
9042 if (snum >= 0)
9043 lp_do_parameter(snum, "copy", lp_servicename(snum));
9048 /*******************************************************************
9049 Get the default server type we will announce as via nmbd.
9050 ********************************************************************/
9052 int lp_default_server_announce(void)
9054 return default_server_announce;
9057 /*******************************************************************
9058 Split the announce version into major and minor numbers.
9059 ********************************************************************/
9061 int lp_major_announce_version(void)
9063 static bool got_major = False;
9064 static int major_version = DEFAULT_MAJOR_VERSION;
9065 char *vers;
9066 char *p;
9068 if (got_major)
9069 return major_version;
9071 got_major = True;
9072 if ((vers = lp_announce_version()) == NULL)
9073 return major_version;
9075 if ((p = strchr_m(vers, '.')) == 0)
9076 return major_version;
9078 *p = '\0';
9079 major_version = atoi(vers);
9080 return major_version;
9083 int lp_minor_announce_version(void)
9085 static bool got_minor = False;
9086 static int minor_version = DEFAULT_MINOR_VERSION;
9087 char *vers;
9088 char *p;
9090 if (got_minor)
9091 return minor_version;
9093 got_minor = True;
9094 if ((vers = lp_announce_version()) == NULL)
9095 return minor_version;
9097 if ((p = strchr_m(vers, '.')) == 0)
9098 return minor_version;
9100 p++;
9101 minor_version = atoi(p);
9102 return minor_version;
9105 /***********************************************************
9106 Set the global name resolution order (used in smbclient).
9107 ************************************************************/
9109 void lp_set_name_resolve_order(const char *new_order)
9111 string_set(&Globals.szNameResolveOrder, new_order);
9114 const char *lp_printername(int snum)
9116 const char *ret = _lp_printername(snum);
9117 if (ret == NULL || (ret != NULL && *ret == '\0'))
9118 ret = lp_const_servicename(snum);
9120 return ret;
9124 /***********************************************************
9125 Allow daemons such as winbindd to fix their logfile name.
9126 ************************************************************/
9128 void lp_set_logfile(const char *name)
9130 string_set(&Globals.szLogFile, name);
9131 debug_set_logfile(name);
9134 /*******************************************************************
9135 Return the max print jobs per queue.
9136 ********************************************************************/
9138 int lp_maxprintjobs(int snum)
9140 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9141 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9142 maxjobs = PRINT_MAX_JOBID - 1;
9144 return maxjobs;
9147 const char *lp_printcapname(void)
9149 if ((Globals.szPrintcapname != NULL) &&
9150 (Globals.szPrintcapname[0] != '\0'))
9151 return Globals.szPrintcapname;
9153 if (sDefault.iPrinting == PRINT_CUPS) {
9154 #ifdef HAVE_CUPS
9155 return "cups";
9156 #else
9157 return "lpstat";
9158 #endif
9161 if (sDefault.iPrinting == PRINT_BSD)
9162 return "/etc/printcap";
9164 return PRINTCAP_NAME;
9167 /*******************************************************************
9168 Ensure we don't use sendfile if server smb signing is active.
9169 ********************************************************************/
9171 static uint32 spoolss_state;
9173 bool lp_disable_spoolss( void )
9175 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9176 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9178 return spoolss_state == SVCCTL_STOPPED ? True : False;
9181 void lp_set_spoolss_state( uint32 state )
9183 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9185 spoolss_state = state;
9188 uint32 lp_get_spoolss_state( void )
9190 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9193 /*******************************************************************
9194 Ensure we don't use sendfile if server smb signing is active.
9195 ********************************************************************/
9197 bool lp_use_sendfile(int snum)
9199 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9200 if (Protocol < PROTOCOL_NT1) {
9201 return False;
9203 return (_lp_use_sendfile(snum) &&
9204 (get_remote_arch() != RA_WIN95) &&
9205 !srv_is_signing_active());
9208 /*******************************************************************
9209 Turn off sendfile if we find the underlying OS doesn't support it.
9210 ********************************************************************/
9212 void set_use_sendfile(int snum, bool val)
9214 if (LP_SNUM_OK(snum))
9215 ServicePtrs[snum]->bUseSendfile = val;
9216 else
9217 sDefault.bUseSendfile = val;
9220 /*******************************************************************
9221 Turn off storing DOS attributes if this share doesn't support it.
9222 ********************************************************************/
9224 void set_store_dos_attributes(int snum, bool val)
9226 if (!LP_SNUM_OK(snum))
9227 return;
9228 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9231 void lp_set_mangling_method(const char *new_method)
9233 string_set(&Globals.szManglingMethod, new_method);
9236 /*******************************************************************
9237 Global state for POSIX pathname processing.
9238 ********************************************************************/
9240 static bool posix_pathnames;
9242 bool lp_posix_pathnames(void)
9244 return posix_pathnames;
9247 /*******************************************************************
9248 Change everything needed to ensure POSIX pathname processing (currently
9249 not much).
9250 ********************************************************************/
9252 void lp_set_posix_pathnames(void)
9254 posix_pathnames = True;
9257 /*******************************************************************
9258 Global state for POSIX lock processing - CIFS unix extensions.
9259 ********************************************************************/
9261 bool posix_default_lock_was_set;
9262 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9264 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
9266 if (posix_default_lock_was_set) {
9267 return posix_cifsx_locktype;
9268 } else {
9269 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9273 /*******************************************************************
9274 ********************************************************************/
9276 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
9278 posix_default_lock_was_set = True;
9279 posix_cifsx_locktype = val;
9282 int lp_min_receive_file_size(void)
9284 if (Globals.iminreceivefile < 0) {
9285 return 0;
9287 return MIN(Globals.iminreceivefile, BUFFER_SIZE);