BUG 761: read the config file before initialized default values for printing options
[Samba/gebeck_regimport.git] / source / param / loadparm.c
blobaf26697476ae92da05de70a5a894fd5bd2a1020d
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
13 This program is free software; you can redistribute it and/or modify
14 it under the terms of the GNU General Public License as published by
15 the Free Software Foundation; either version 2 of the License, or
16 (at your option) any later version.
18 This program is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 GNU General Public License for more details.
23 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
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"
56 BOOL in_client = False; /* Not in the client by default */
57 BOOL bLoaded = False;
59 extern userdom_struct current_user_info;
60 extern pstring user_socket_options;
62 #ifndef GLOBAL_NAME
63 #define GLOBAL_NAME "global"
64 #endif
66 #ifndef PRINTERS_NAME
67 #define PRINTERS_NAME "printers"
68 #endif
70 #ifndef HOMES_NAME
71 #define HOMES_NAME "homes"
72 #endif
74 /* some helpful bits */
75 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && ServicePtrs[(i)]->valid)
76 #define VALID(i) ServicePtrs[i]->valid
78 int keepalive = DEFAULT_KEEPALIVE;
79 BOOL use_getwd_cache = True;
81 extern int extra_time_offset;
83 static BOOL defaults_saved = False;
85 typedef struct _param_opt_struct param_opt_struct;
86 struct _param_opt_struct {
87 param_opt_struct *prev, *next;
88 char *key;
89 char *value;
90 char **list;
93 /*
94 * This structure describes global (ie., server-wide) parameters.
96 typedef struct
98 char *smb_ports;
99 char *dos_charset;
100 char *unix_charset;
101 char *display_charset;
102 char *szPrintcapname;
103 char *szEnumPortsCommand;
104 char *szAddPrinterCommand;
105 char *szDeletePrinterCommand;
106 char *szOs2DriverMap;
107 char *szLockDir;
108 char *szPidDir;
109 char *szRootdir;
110 char *szDefaultService;
111 char *szDfree;
112 char *szGetQuota;
113 char *szSetQuota;
114 char *szMsgCommand;
115 char *szHostsEquiv;
116 char *szServerString;
117 char *szAutoServices;
118 char *szPasswdProgram;
119 char *szPasswdChat;
120 char *szLogFile;
121 char *szConfigFile;
122 char *szSMBPasswdFile;
123 char *szPrivateDir;
124 char **szPassdbBackend;
125 char **szPreloadModules;
126 char *szPasswordServer;
127 char *szSocketOptions;
128 char *szRealm;
129 char *szAfsUsernameMap;
130 char *szUsernameMap;
131 char *szLogonScript;
132 char *szLogonPath;
133 char *szLogonDrive;
134 char *szLogonHome;
135 char **szWINSservers;
136 char **szInterfaces;
137 char *szRemoteAnnounce;
138 char *szRemoteBrowseSync;
139 char *szSocketAddress;
140 char *szNISHomeMapName;
141 char *szAnnounceVersion; /* This is initialised in init_globals */
142 char *szWorkgroup;
143 char *szNetbiosName;
144 char **szNetbiosAliases;
145 char *szNetbiosScope;
146 char *szDomainOtherSIDs;
147 char *szNameResolveOrder;
148 char *szPanicAction;
149 char *szAddUserScript;
150 char *szDelUserScript;
151 char *szAddGroupScript;
152 char *szDelGroupScript;
153 char *szAddUserToGroupScript;
154 char *szDelUserFromGroupScript;
155 char *szSetPrimaryGroupScript;
156 char *szAddMachineScript;
157 char *szShutdownScript;
158 char *szAbortShutdownScript;
159 char *szWINSHook;
160 char *szWINSPartners;
161 char *szUtmpDir;
162 char *szWtmpDir;
163 BOOL bUtmp;
164 char *szIdmapUID;
165 char *szIdmapGID;
166 BOOL bEnableRidAlgorithm;
167 int AlgorithmicRidBase;
168 char *szTemplatePrimaryGroup;
169 char *szTemplateHomedir;
170 char *szTemplateShell;
171 char *szWinbindSeparator;
172 BOOL bWinbindEnableLocalAccounts;
173 BOOL bWinbindEnumUsers;
174 BOOL bWinbindEnumGroups;
175 BOOL bWinbindUseDefaultDomain;
176 BOOL bWinbindTrustedDomainsOnly;
177 char *szWinbindBackend;
178 char *szIdmapBackend;
179 char *szAddShareCommand;
180 char *szChangeShareCommand;
181 char *szDeleteShareCommand;
182 char *szGuestaccount;
183 char *szManglingMethod;
184 int mangle_prefix;
185 int max_log_size;
186 char *szLogLevel;
187 int max_xmit;
188 int max_mux;
189 int max_open_files;
190 int pwordlevel;
191 int unamelevel;
192 int deadtime;
193 int maxprotocol;
194 int minprotocol;
195 int security;
196 char **AuthMethods;
197 BOOL paranoid_server_security;
198 int maxdisksize;
199 int lpqcachetime;
200 int iMaxSmbdProcesses;
201 BOOL bDisableSpoolss;
202 int iTotalPrintJobs;
203 int syslog;
204 int os_level;
205 int enhanced_browsing;
206 int max_ttl;
207 int max_wins_ttl;
208 int min_wins_ttl;
209 int lm_announce;
210 int lm_interval;
211 int announce_as; /* This is initialised in init_globals */
212 int machine_password_timeout;
213 int change_notify_timeout;
214 int map_to_guest;
215 int min_passwd_length;
216 BOOL use_cracklib;
217 int oplock_break_wait_time;
218 int winbind_cache_time;
219 int iLockSpinCount;
220 int iLockSpinTime;
221 char *szLdapMachineSuffix;
222 char *szLdapUserSuffix;
223 char *szLdapIdmapSuffix;
224 char *szLdapGroupSuffix;
225 #ifdef WITH_LDAP_SAMCONFIG
226 int ldap_port;
227 char *szLdapServer;
228 #endif
229 int ldap_ssl;
230 char *szLdapSuffix;
231 char *szLdapFilter;
232 char *szLdapAdminDn;
233 char *szAclCompat;
234 int ldap_passwd_sync;
235 int ldap_replication_sleep;
236 BOOL ldap_delete_dn;
237 BOOL bMsAddPrinterWizard;
238 BOOL bDNSproxy;
239 BOOL bWINSsupport;
240 BOOL bWINSproxy;
241 BOOL bLocalMaster;
242 BOOL bPreferredMaster;
243 BOOL bDomainMaster;
244 BOOL bDomainLogons;
245 BOOL bEncryptPasswords;
246 BOOL bUpdateEncrypt;
247 int clientSchannel;
248 int serverSchannel;
249 BOOL bNullPasswords;
250 BOOL bObeyPamRestrictions;
251 BOOL bLoadPrinters;
252 BOOL bLargeReadwrite;
253 BOOL bReadRaw;
254 BOOL bWriteRaw;
255 BOOL bReadbmpx;
256 BOOL bSyslogOnly;
257 BOOL bBrowseList;
258 BOOL bNISHomeMap;
259 BOOL bTimeServer;
260 BOOL bBindInterfacesOnly;
261 BOOL bPamPasswordChange;
262 BOOL bUnixPasswdSync;
263 BOOL bPasswdChatDebug;
264 int iPasswdChatTimeout;
265 BOOL bTimestampLogs;
266 BOOL bNTSmbSupport;
267 BOOL bNTPipeSupport;
268 BOOL bNTStatusSupport;
269 BOOL bStatCache;
270 BOOL bKernelOplocks;
271 BOOL bAllowTrustedDomains;
272 BOOL bLanmanAuth;
273 BOOL bNTLMAuth;
274 BOOL bUseSpnego;
275 BOOL bClientLanManAuth;
276 BOOL bClientNTLMv2Auth;
277 BOOL bClientPlaintextAuth;
278 BOOL bClientUseSpnego;
279 BOOL bDebugHiresTimestamp;
280 BOOL bDebugPid;
281 BOOL bDebugUid;
282 BOOL bHostMSDfs;
283 BOOL bUnicode;
284 BOOL bUseMmap;
285 BOOL bHostnameLookups;
286 BOOL bUnixExtensions;
287 BOOL bDisableNetbios;
288 BOOL bKernelChangeNotify;
289 int restrict_anonymous;
290 int name_cache_timeout;
291 int client_signing;
292 int server_signing;
293 param_opt_struct *param_opt;
295 global;
297 static global Globals;
300 * This structure describes a single service.
302 typedef struct
304 BOOL valid;
305 BOOL autoloaded;
306 char *szService;
307 char *szPath;
308 char *szUsername;
309 char **szInvalidUsers;
310 char **szValidUsers;
311 char **szAdminUsers;
312 char *szCopy;
313 char *szInclude;
314 char *szPreExec;
315 char *szPostExec;
316 char *szRootPreExec;
317 char *szRootPostExec;
318 char *szPrintcommand;
319 char *szLpqcommand;
320 char *szLprmcommand;
321 char *szLppausecommand;
322 char *szLpresumecommand;
323 char *szQueuepausecommand;
324 char *szQueueresumecommand;
325 char *szPrintername;
326 char *szDontdescend;
327 char **szHostsallow;
328 char **szHostsdeny;
329 char *szMagicScript;
330 char *szMagicOutput;
331 char *szMangledMap;
332 char *szVetoFiles;
333 char *szHideFiles;
334 char *szVetoOplockFiles;
335 char *comment;
336 char *force_user;
337 char *force_group;
338 char **readlist;
339 char **writelist;
340 char **printer_admin;
341 char *volume;
342 char *fstype;
343 char **szVfsObjects;
344 char *szMSDfsProxy;
345 int iMinPrintSpace;
346 int iMaxPrintJobs;
347 int iMaxReportedPrintJobs;
348 int iWriteCacheSize;
349 int iCreate_mask;
350 int iCreate_force_mode;
351 int iSecurity_mask;
352 int iSecurity_force_mode;
353 int iDir_mask;
354 int iDir_force_mode;
355 int iDir_Security_mask;
356 int iDir_Security_force_mode;
357 int iMaxConnections;
358 int iDefaultCase;
359 int iPrinting;
360 int iOplockContentionLimit;
361 int iCSCPolicy;
362 int iBlock_size;
363 BOOL bPreexecClose;
364 BOOL bRootpreexecClose;
365 BOOL bCaseSensitive;
366 BOOL bCasePreserve;
367 BOOL bShortCasePreserve;
368 BOOL bCaseMangle;
369 BOOL bHideDotFiles;
370 BOOL bHideSpecialFiles;
371 BOOL bHideUnReadable;
372 BOOL bHideUnWriteableFiles;
373 BOOL bBrowseable;
374 BOOL bAvailable;
375 BOOL bRead_only;
376 BOOL bNo_set_dir;
377 BOOL bGuest_only;
378 BOOL bGuest_ok;
379 BOOL bPrint_ok;
380 BOOL bMap_system;
381 BOOL bMap_hidden;
382 BOOL bMap_archive;
383 BOOL bLocking;
384 BOOL bStrictLocking;
385 BOOL bPosixLocking;
386 BOOL bShareModes;
387 BOOL bOpLocks;
388 BOOL bLevel2OpLocks;
389 BOOL bOnlyUser;
390 BOOL bMangledNames;
391 BOOL bWidelinks;
392 BOOL bSymlinks;
393 BOOL bSyncAlways;
394 BOOL bStrictAllocate;
395 BOOL bStrictSync;
396 char magic_char;
397 BOOL *copymap;
398 BOOL bDeleteReadonly;
399 BOOL bFakeOplocks;
400 BOOL bDeleteVetoFiles;
401 BOOL bDosFilemode;
402 BOOL bDosFiletimes;
403 BOOL bDosFiletimeResolution;
404 BOOL bFakeDirCreateTimes;
405 BOOL bBlockingLocks;
406 BOOL bInheritPerms;
407 BOOL bInheritACLS;
408 BOOL bMSDfsRoot;
409 BOOL bUseClientDriver;
410 BOOL bDefaultDevmode;
411 BOOL bNTAclSupport;
412 BOOL bUseSendfile;
413 BOOL bProfileAcls;
414 BOOL bMap_acl_inherit;
415 BOOL bAfs_Share;
416 param_opt_struct *param_opt;
418 char dummy[3]; /* for alignment */
420 service;
423 /* This is a default service used to prime a services structure */
424 static service sDefault = {
425 True, /* valid */
426 False, /* not autoloaded */
427 NULL, /* szService */
428 NULL, /* szPath */
429 NULL, /* szUsername */
430 NULL, /* szInvalidUsers */
431 NULL, /* szValidUsers */
432 NULL, /* szAdminUsers */
433 NULL, /* szCopy */
434 NULL, /* szInclude */
435 NULL, /* szPreExec */
436 NULL, /* szPostExec */
437 NULL, /* szRootPreExec */
438 NULL, /* szRootPostExec */
439 NULL, /* szPrintcommand */
440 NULL, /* szLpqcommand */
441 NULL, /* szLprmcommand */
442 NULL, /* szLppausecommand */
443 NULL, /* szLpresumecommand */
444 NULL, /* szQueuepausecommand */
445 NULL, /* szQueueresumecommand */
446 NULL, /* szPrintername */
447 NULL, /* szDontdescend */
448 NULL, /* szHostsallow */
449 NULL, /* szHostsdeny */
450 NULL, /* szMagicScript */
451 NULL, /* szMagicOutput */
452 NULL, /* szMangledMap */
453 NULL, /* szVetoFiles */
454 NULL, /* szHideFiles */
455 NULL, /* szVetoOplockFiles */
456 NULL, /* comment */
457 NULL, /* force user */
458 NULL, /* force group */
459 NULL, /* readlist */
460 NULL, /* writelist */
461 NULL, /* printer admin */
462 NULL, /* volume */
463 NULL, /* fstype */
464 NULL, /* vfs objects */
465 NULL, /* szMSDfsProxy */
466 0, /* iMinPrintSpace */
467 1000, /* iMaxPrintJobs */
468 0, /* iMaxReportedPrintJobs */
469 0, /* iWriteCacheSize */
470 0744, /* iCreate_mask */
471 0000, /* iCreate_force_mode */
472 0777, /* iSecurity_mask */
473 0, /* iSecurity_force_mode */
474 0755, /* iDir_mask */
475 0000, /* iDir_force_mode */
476 0777, /* iDir_Security_mask */
477 0, /* iDir_Security_force_mode */
478 0, /* iMaxConnections */
479 CASE_LOWER, /* iDefaultCase */
480 DEFAULT_PRINTING, /* iPrinting */
481 2, /* iOplockContentionLimit */
482 0, /* iCSCPolicy */
483 1024, /* iBlock_size */
484 False, /* bPreexecClose */
485 False, /* bRootpreexecClose */
486 False, /* case sensitive */
487 True, /* case preserve */
488 True, /* short case preserve */
489 False, /* case mangle */
490 True, /* bHideDotFiles */
491 False, /* bHideSpecialFiles */
492 False, /* bHideUnReadable */
493 False, /* bHideUnWriteableFiles */
494 True, /* bBrowseable */
495 True, /* bAvailable */
496 True, /* bRead_only */
497 True, /* bNo_set_dir */
498 False, /* bGuest_only */
499 False, /* bGuest_ok */
500 False, /* bPrint_ok */
501 False, /* bMap_system */
502 False, /* bMap_hidden */
503 True, /* bMap_archive */
504 True, /* bLocking */
505 True, /* bStrictLocking */
506 True, /* bPosixLocking */
507 True, /* bShareModes */
508 True, /* bOpLocks */
509 True, /* bLevel2OpLocks */
510 False, /* bOnlyUser */
511 True, /* bMangledNames */
512 True, /* bWidelinks */
513 True, /* bSymlinks */
514 False, /* bSyncAlways */
515 False, /* bStrictAllocate */
516 False, /* bStrictSync */
517 '~', /* magic char */
518 NULL, /* copymap */
519 False, /* bDeleteReadonly */
520 False, /* bFakeOplocks */
521 False, /* bDeleteVetoFiles */
522 False, /* bDosFilemode */
523 False, /* bDosFiletimes */
524 False, /* bDosFiletimeResolution */
525 False, /* bFakeDirCreateTimes */
526 True, /* bBlockingLocks */
527 False, /* bInheritPerms */
528 False, /* bInheritACLS */
529 False, /* bMSDfsRoot */
530 False, /* bUseClientDriver */
531 False, /* bDefaultDevmode */
532 True, /* bNTAclSupport */
533 False, /* bUseSendfile */
534 False, /* bProfileAcls */
535 False, /* bMap_acl_inherit */
536 False, /* bAfs_Share */
538 NULL, /* Parametric options */
540 "" /* dummy */
543 /* local variables */
544 static service **ServicePtrs = NULL;
545 static int iNumServices = 0;
546 static int iServiceIndex = 0;
547 static BOOL bInGlobalSection = True;
548 static BOOL bGlobalOnly = False;
549 static int server_role;
550 static int default_server_announce;
552 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
554 /* prototypes for the special type handlers */
555 static BOOL handle_include(const char *pszParmValue, char **ptr);
556 static BOOL handle_copy(const char *pszParmValue, char **ptr);
557 static BOOL handle_netbios_name(const char *pszParmValue, char **ptr);
558 static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr);
559 static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr);
560 static BOOL handle_debug_list( const char *pszParmValue, char **ptr );
561 static BOOL handle_workgroup( const char *pszParmValue, char **ptr );
562 static BOOL handle_netbios_aliases( const char *pszParmValue, char **ptr );
563 static BOOL handle_netbios_scope( const char *pszParmValue, char **ptr );
564 static BOOL handle_charset( const char *pszParmValue, char **ptr );
566 static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr);
568 static void set_server_role(void);
569 static void set_default_server_announce_type(void);
570 static void set_allowed_client_auth(void);
572 static const struct enum_list enum_protocol[] = {
573 {PROTOCOL_NT1, "NT1"},
574 {PROTOCOL_LANMAN2, "LANMAN2"},
575 {PROTOCOL_LANMAN1, "LANMAN1"},
576 {PROTOCOL_CORE, "CORE"},
577 {PROTOCOL_COREPLUS, "COREPLUS"},
578 {PROTOCOL_COREPLUS, "CORE+"},
579 {-1, NULL}
582 static const struct enum_list enum_security[] = {
583 {SEC_SHARE, "SHARE"},
584 {SEC_USER, "USER"},
585 {SEC_SERVER, "SERVER"},
586 {SEC_DOMAIN, "DOMAIN"},
587 #ifdef HAVE_ADS
588 {SEC_ADS, "ADS"},
589 #endif
590 {-1, NULL}
593 static const struct enum_list enum_printing[] = {
594 {PRINT_SYSV, "sysv"},
595 {PRINT_AIX, "aix"},
596 {PRINT_HPUX, "hpux"},
597 {PRINT_BSD, "bsd"},
598 {PRINT_QNX, "qnx"},
599 {PRINT_PLP, "plp"},
600 {PRINT_LPRNG, "lprng"},
601 {PRINT_CUPS, "cups"},
602 {PRINT_LPRNT, "nt"},
603 {PRINT_LPROS2, "os2"},
604 #ifdef DEVELOPER
605 {PRINT_TEST, "test"},
606 {PRINT_VLP, "vlp"},
607 #endif /* DEVELOPER */
608 {-1, NULL}
611 static const struct enum_list enum_ldap_ssl[] = {
612 #ifdef WITH_LDAP_SAMCONFIG
613 {LDAP_SSL_ON, "Yes"},
614 {LDAP_SSL_ON, "yes"},
615 {LDAP_SSL_ON, "on"},
616 {LDAP_SSL_ON, "On"},
617 #endif
618 {LDAP_SSL_OFF, "no"},
619 {LDAP_SSL_OFF, "No"},
620 {LDAP_SSL_OFF, "off"},
621 {LDAP_SSL_OFF, "Off"},
622 {LDAP_SSL_START_TLS, "start tls"},
623 {LDAP_SSL_START_TLS, "Start_tls"},
624 {-1, NULL}
627 static const struct enum_list enum_ldap_passwd_sync[] = {
628 {LDAP_PASSWD_SYNC_OFF, "no"},
629 {LDAP_PASSWD_SYNC_OFF, "No"},
630 {LDAP_PASSWD_SYNC_OFF, "off"},
631 {LDAP_PASSWD_SYNC_OFF, "Off"},
632 {LDAP_PASSWD_SYNC_ON, "Yes"},
633 {LDAP_PASSWD_SYNC_ON, "yes"},
634 {LDAP_PASSWD_SYNC_ON, "on"},
635 {LDAP_PASSWD_SYNC_ON, "On"},
636 {LDAP_PASSWD_SYNC_ONLY, "Only"},
637 {LDAP_PASSWD_SYNC_ONLY, "only"},
638 {-1, NULL}
641 /* Types of machine we can announce as. */
642 #define ANNOUNCE_AS_NT_SERVER 1
643 #define ANNOUNCE_AS_WIN95 2
644 #define ANNOUNCE_AS_WFW 3
645 #define ANNOUNCE_AS_NT_WORKSTATION 4
647 static const struct enum_list enum_announce_as[] = {
648 {ANNOUNCE_AS_NT_SERVER, "NT"},
649 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
650 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
651 {ANNOUNCE_AS_WIN95, "win95"},
652 {ANNOUNCE_AS_WFW, "WfW"},
653 {-1, NULL}
656 static const struct enum_list enum_case[] = {
657 {CASE_LOWER, "lower"},
658 {CASE_UPPER, "upper"},
659 {-1, NULL}
662 static const struct enum_list enum_bool_auto[] = {
663 {False, "No"},
664 {False, "False"},
665 {False, "0"},
666 {True, "Yes"},
667 {True, "True"},
668 {True, "1"},
669 {Auto, "Auto"},
670 {-1, NULL}
673 /* Client-side offline caching policy types */
674 #define CSC_POLICY_MANUAL 0
675 #define CSC_POLICY_DOCUMENTS 1
676 #define CSC_POLICY_PROGRAMS 2
677 #define CSC_POLICY_DISABLE 3
679 static const struct enum_list enum_csc_policy[] = {
680 {CSC_POLICY_MANUAL, "manual"},
681 {CSC_POLICY_DOCUMENTS, "documents"},
682 {CSC_POLICY_PROGRAMS, "programs"},
683 {CSC_POLICY_DISABLE, "disable"},
684 {-1, NULL}
687 /* SMB signing types. */
688 static const struct enum_list enum_smb_signing_vals[] = {
689 {False, "No"},
690 {False, "False"},
691 {False, "0"},
692 {False, "Off"},
693 {False, "disabled"},
694 {True, "Yes"},
695 {True, "True"},
696 {True, "1"},
697 {True, "On"},
698 {True, "enabled"},
699 {Auto, "auto"},
700 {Required, "required"},
701 {Required, "mandatory"},
702 {Required, "force"},
703 {Required, "forced"},
704 {Required, "enforced"},
705 {-1, NULL}
710 Do you want session setups at user level security with a invalid
711 password to be rejected or allowed in as guest? WinNT rejects them
712 but it can be a pain as it means "net view" needs to use a password
714 You have 3 choices in the setting of map_to_guest:
716 "Never" means session setups with an invalid password
717 are rejected. This is the default.
719 "Bad User" means session setups with an invalid password
720 are rejected, unless the username does not exist, in which case it
721 is treated as a guest login
723 "Bad Password" means session setups with an invalid password
724 are treated as a guest login
726 Note that map_to_guest only has an effect in user or server
727 level security.
730 static const struct enum_list enum_map_to_guest[] = {
731 {NEVER_MAP_TO_GUEST, "Never"},
732 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
733 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
734 {-1, NULL}
737 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
739 * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
740 * screen in SWAT. This is used to exclude parameters as well as to squash all
741 * parameters that have been duplicated by pseudonyms.
743 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
744 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
745 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
746 * respective views.
748 * NOTE2: Handling of duplicated (synonym) paramters:
749 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
750 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
751 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
752 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
755 static struct parm_struct parm_table[] = {
756 {N_("Base Options"), P_SEP, P_SEPARATOR},
758 {"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, handle_charset, NULL, FLAG_ADVANCED},
759 {"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, handle_charset, NULL, FLAG_ADVANCED},
760 {"display charset", P_STRING, P_GLOBAL, &Globals.display_charset, handle_charset, NULL, FLAG_ADVANCED},
761 {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
762 {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
763 {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE},
764 {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkgroup, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
765 #ifdef WITH_ADS
766 {"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
767 #endif
768 {"netbios name", P_USTRING, P_GLOBAL, &Globals.szNetbiosName, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
769 {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases, NULL, FLAG_ADVANCED},
770 {"netbios scope", P_USTRING, P_GLOBAL, &Globals.szNetbiosScope, handle_netbios_scope, NULL, FLAG_ADVANCED},
771 {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED },
772 {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
773 {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
775 {N_("Security Options"), P_SEP, P_SEPARATOR},
777 {"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
778 {"auth methods", P_LIST, P_GLOBAL, &Globals.AuthMethods, NULL, NULL, FLAG_ADVANCED},
779 {"encrypt passwords", P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
780 {"update encrypted", P_BOOL, P_GLOBAL, &Globals.bUpdateEncrypt, NULL, NULL, FLAG_ADVANCED},
781 {"client schannel", P_ENUM, P_GLOBAL, &Globals.clientSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
782 {"server schannel", P_ENUM, P_GLOBAL, &Globals.serverSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
783 {"allow trusted domains", P_BOOL, P_GLOBAL, &Globals.bAllowTrustedDomains, NULL, NULL, FLAG_ADVANCED},
784 {"hosts equiv", P_STRING, P_GLOBAL, &Globals.szHostsEquiv, NULL, NULL, FLAG_ADVANCED},
785 {"min passwd length", P_INTEGER, P_GLOBAL, &Globals.min_passwd_length, NULL, NULL, FLAG_ADVANCED},
786 {"min password length", P_INTEGER, P_GLOBAL, &Globals.min_passwd_length, NULL, NULL, FLAG_ADVANCED},
787 {"use cracklib", P_BOOL, P_GLOBAL, &Globals.use_cracklib, NULL, NULL, FLAG_ADVANCED},
788 {"map to guest", P_ENUM, P_GLOBAL, &Globals.map_to_guest, NULL, enum_map_to_guest, FLAG_ADVANCED},
789 {"null passwords", P_BOOL, P_GLOBAL, &Globals.bNullPasswords, NULL, NULL, FLAG_ADVANCED},
790 {"obey pam restrictions", P_BOOL, P_GLOBAL, &Globals.bObeyPamRestrictions, NULL, NULL, FLAG_ADVANCED},
791 {"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
792 {"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED},
793 {"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED},
794 {"passdb backend", P_LIST, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
795 {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED},
796 {"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED},
797 {"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE},
798 {"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE},
799 {"guest account", P_STRING, P_GLOBAL, &Globals.szGuestaccount, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
801 {"pam password change", P_BOOL, P_GLOBAL, &Globals.bPamPasswordChange, NULL, NULL, FLAG_ADVANCED},
802 {"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, FLAG_ADVANCED},
803 {"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED},
804 {"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED},
805 {"passwd chat timeout", P_INTEGER, P_GLOBAL, &Globals.iPasswdChatTimeout, NULL, NULL, FLAG_ADVANCED},
806 {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED},
807 {"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED},
808 {"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, FLAG_ADVANCED},
809 {"unix password sync", P_BOOL, P_GLOBAL, &Globals.bUnixPasswdSync, NULL, NULL, FLAG_ADVANCED},
810 {"restrict anonymous", P_INTEGER, P_GLOBAL, &Globals.restrict_anonymous, NULL, NULL, FLAG_ADVANCED},
811 {"lanman auth", P_BOOL, P_GLOBAL, &Globals.bLanmanAuth, NULL, NULL, FLAG_ADVANCED},
812 {"ntlm auth", P_BOOL, P_GLOBAL, &Globals.bNTLMAuth, NULL, NULL, FLAG_ADVANCED},
813 {"client NTLMv2 auth", P_BOOL, P_GLOBAL, &Globals.bClientNTLMv2Auth, NULL, NULL, FLAG_ADVANCED},
814 {"client lanman auth", P_BOOL, P_GLOBAL, &Globals.bClientLanManAuth, NULL, NULL, FLAG_ADVANCED},
815 {"client plaintext auth", P_BOOL, P_GLOBAL, &Globals.bClientPlaintextAuth, NULL, NULL, FLAG_ADVANCED},
817 {"username", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
818 {"user", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_HIDE},
819 {"users", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_HIDE},
821 {"invalid users", P_LIST, P_LOCAL, &sDefault.szInvalidUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
822 {"valid users", P_LIST, P_LOCAL, &sDefault.szValidUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
823 {"admin users", P_LIST, P_LOCAL, &sDefault.szAdminUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
824 {"read list", P_LIST, P_LOCAL, &sDefault.readlist, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
825 {"write list", P_LIST, P_LOCAL, &sDefault.writelist, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
826 {"printer admin", P_LIST, P_LOCAL, &sDefault.printer_admin, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT},
827 {"force user", P_STRING, P_LOCAL, &sDefault.force_user, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
828 {"force group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
829 {"group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, FLAG_ADVANCED},
831 {"read only", P_BOOL, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE},
832 {"write ok", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
833 {"writeable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
834 {"writable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
836 {"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
837 {"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_HIDE},
838 {"force create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
839 {"security mask", P_OCTAL, P_LOCAL, &sDefault.iSecurity_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
840 {"force security mode", P_OCTAL, P_LOCAL, &sDefault.iSecurity_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
841 {"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
842 {"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
843 {"force directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
844 {"directory security mask", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
845 {"force directory security mode", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
846 {"inherit permissions", P_BOOL, P_LOCAL, &sDefault.bInheritPerms, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
847 {"inherit acls", P_BOOL, P_LOCAL, &sDefault.bInheritACLS, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
848 {"guest only", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
849 {"only guest", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, FLAG_HIDE},
851 {"guest ok", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
852 {"public", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, FLAG_HIDE},
854 {"only user", P_BOOL, P_LOCAL, &sDefault.bOnlyUser, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED},
855 {"hosts allow", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
856 {"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
857 {"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
858 {"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
859 {"preload modules", P_LIST, P_GLOBAL, &Globals.szPreloadModules, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
861 {N_("Logging Options"), P_SEP, P_SEPARATOR},
863 {"log level", P_STRING, P_GLOBAL, &Globals.szLogLevel, handle_debug_list, NULL, FLAG_ADVANCED},
864 {"debuglevel", P_STRING, P_GLOBAL, &Globals.szLogLevel, handle_debug_list, NULL, FLAG_HIDE},
865 {"syslog", P_INTEGER, P_GLOBAL, &Globals.syslog, NULL, NULL, FLAG_ADVANCED},
866 {"syslog only", P_BOOL, P_GLOBAL, &Globals.bSyslogOnly, NULL, NULL, FLAG_ADVANCED},
867 {"log file", P_STRING, P_GLOBAL, &Globals.szLogFile, NULL, NULL, FLAG_ADVANCED},
869 {"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL, FLAG_ADVANCED},
870 {"timestamp logs", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
871 {"debug timestamp", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
872 {"debug hires timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED},
873 {"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, FLAG_ADVANCED},
874 {"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, FLAG_ADVANCED},
876 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
878 {"smb ports", P_STRING, P_GLOBAL, &Globals.smb_ports, NULL, NULL, FLAG_ADVANCED},
879 {"protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
880 {"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_ADVANCED},
881 {"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
882 {"min protocol", P_ENUM, P_GLOBAL, &Globals.minprotocol, NULL, enum_protocol, FLAG_ADVANCED},
883 {"unicode", P_BOOL, P_GLOBAL, &Globals.bUnicode, NULL, NULL, FLAG_ADVANCED},
884 {"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL, FLAG_ADVANCED},
885 {"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL, FLAG_ADVANCED},
886 {"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, FLAG_ADVANCED},
887 {"disable netbios", P_BOOL, P_GLOBAL, &Globals.bDisableNetbios, NULL, NULL, FLAG_ADVANCED},
889 {"acl compatibility", P_STRING, P_GLOBAL, &Globals.szAclCompat, handle_acl_compatibility, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
890 {"nt acl support", P_BOOL, P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
891 {"nt pipe support", P_BOOL, P_GLOBAL, &Globals.bNTPipeSupport, NULL, NULL, FLAG_ADVANCED},
892 {"nt status support", P_BOOL, P_GLOBAL, &Globals.bNTStatusSupport, NULL, NULL, FLAG_ADVANCED},
893 {"profile acls", P_BOOL, P_LOCAL, &sDefault.bProfileAcls, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
895 {"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL, FLAG_ADVANCED},
896 {"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, FLAG_ADVANCED},
897 {"map acl inherit", P_BOOL, P_LOCAL, &sDefault.bMap_acl_inherit, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
898 {"afs share", P_BOOL, P_LOCAL, &sDefault.bAfs_Share, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
899 {"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, FLAG_ADVANCED},
900 {"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL, FLAG_ADVANCED},
902 {"name resolve order", P_STRING, P_GLOBAL, &Globals.szNameResolveOrder, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
903 {"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL, NULL, FLAG_ADVANCED},
904 {"max wins ttl", P_INTEGER, P_GLOBAL, &Globals.max_wins_ttl, NULL, NULL, FLAG_ADVANCED},
905 {"min wins ttl", P_INTEGER, P_GLOBAL, &Globals.min_wins_ttl, NULL, NULL, FLAG_ADVANCED},
906 {"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL, FLAG_ADVANCED},
907 {"unix extensions", P_BOOL, P_GLOBAL, &Globals.bUnixExtensions, NULL, NULL, FLAG_ADVANCED},
908 {"use spnego", P_BOOL, P_GLOBAL, &Globals.bUseSpnego, NULL, NULL, FLAG_ADVANCED},
909 {"client signing", P_ENUM, P_GLOBAL, &Globals.client_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED},
910 {"server signing", P_ENUM, P_GLOBAL, &Globals.server_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED},
911 {"client use spnego", P_BOOL, P_GLOBAL, &Globals.bClientUseSpnego, NULL, NULL, FLAG_ADVANCED},
913 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
915 {"block size", P_INTEGER, P_LOCAL, &sDefault.iBlock_size, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
916 {"change notify timeout", P_INTEGER, P_GLOBAL, &Globals.change_notify_timeout, NULL, NULL, FLAG_ADVANCED},
917 {"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, FLAG_ADVANCED},
918 {"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, FLAG_ADVANCED},
919 {"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL, NULL, FLAG_ADVANCED},
920 {"kernel change notify", P_BOOL, P_GLOBAL, &Globals.bKernelChangeNotify, NULL, NULL, FLAG_ADVANCED},
922 {"lpq cache time", P_INTEGER, P_GLOBAL, &Globals.lpqcachetime, NULL, NULL, FLAG_ADVANCED},
923 {"max smbd processes", P_INTEGER, P_GLOBAL, &Globals.iMaxSmbdProcesses, NULL, NULL, FLAG_ADVANCED},
924 {"max connections", P_INTEGER, P_LOCAL, &sDefault.iMaxConnections, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
925 {"paranoid server security", P_BOOL, P_GLOBAL, &Globals.paranoid_server_security, NULL, NULL, FLAG_ADVANCED},
926 {"max disk size", P_INTEGER, P_GLOBAL, &Globals.maxdisksize, NULL, NULL, FLAG_ADVANCED},
927 {"max open files", P_INTEGER, P_GLOBAL, &Globals.max_open_files, NULL, NULL, FLAG_ADVANCED},
928 {"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
930 {"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED},
931 {"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
932 {"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
933 {"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
934 {"use mmap", P_BOOL, P_GLOBAL, &Globals.bUseMmap, NULL, NULL, FLAG_ADVANCED},
935 {"use sendfile", P_BOOL, P_LOCAL, &sDefault.bUseSendfile, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
936 {"hostname lookups", P_BOOL, P_GLOBAL, &Globals.bHostnameLookups, NULL, NULL, FLAG_ADVANCED},
937 {"write cache size", P_INTEGER, P_LOCAL, &sDefault.iWriteCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
939 {"name cache timeout", P_INTEGER, P_GLOBAL, &Globals.name_cache_timeout, NULL, NULL, FLAG_ADVANCED},
941 {N_("Printing Options"), P_SEP, P_SEPARATOR},
943 {"max reported print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxReportedPrintJobs, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
944 {"max print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxPrintJobs, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
945 {"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
946 {"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
947 {"printcap", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_HIDE},
948 {"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
949 {"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_HIDE},
950 {"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, NULL, enum_printing, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
951 {"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
952 {"disable spoolss", P_BOOL, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
953 {"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
954 {"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
955 {"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
956 {"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
957 {"queuepause command", P_STRING, P_LOCAL, &sDefault.szQueuepausecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
958 {"queueresume command", P_STRING, P_LOCAL, &sDefault.szQueueresumecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
960 {"enumports command", P_STRING, P_GLOBAL, &Globals.szEnumPortsCommand, NULL, NULL, FLAG_ADVANCED},
961 {"addprinter command", P_STRING, P_GLOBAL, &Globals.szAddPrinterCommand, NULL, NULL, FLAG_ADVANCED},
962 {"deleteprinter command", P_STRING, P_GLOBAL, &Globals.szDeletePrinterCommand, NULL, NULL, FLAG_ADVANCED},
963 {"show add printer wizard", P_BOOL, P_GLOBAL, &Globals.bMsAddPrinterWizard, NULL, NULL, FLAG_ADVANCED},
964 {"os2 driver map", P_STRING, P_GLOBAL, &Globals.szOs2DriverMap, NULL, NULL, FLAG_ADVANCED},
966 {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
967 {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_HIDE},
968 {"use client driver", P_BOOL, P_LOCAL, &sDefault.bUseClientDriver, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
969 {"default devmode", P_BOOL, P_LOCAL, &sDefault.bDefaultDevmode, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
971 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
972 {"mangling method", P_STRING, P_GLOBAL, &Globals.szManglingMethod, NULL, NULL, FLAG_ADVANCED},
973 {"mangle prefix", P_INTEGER, P_GLOBAL, &Globals.mangle_prefix, NULL, NULL, FLAG_ADVANCED},
975 {"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case, FLAG_ADVANCED | FLAG_SHARE},
976 {"case sensitive", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
977 {"casesignames", P_BOOL, P_LOCAL, &sDefault.bCaseSensitive, NULL, NULL, FLAG_HIDE},
978 {"preserve case", P_BOOL, P_LOCAL, &sDefault.bCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
979 {"short preserve case", P_BOOL, P_LOCAL, &sDefault.bShortCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
980 {"mangle case", P_BOOL, P_LOCAL, &sDefault.bCaseMangle, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
981 {"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
982 {"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
983 {"hide special files", P_BOOL, P_LOCAL, &sDefault.bHideSpecialFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
984 {"hide unreadable", P_BOOL, P_LOCAL, &sDefault.bHideUnReadable, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
985 {"hide unwriteable files", P_BOOL, P_LOCAL, &sDefault.bHideUnWriteableFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
986 {"delete veto files", P_BOOL, P_LOCAL, &sDefault.bDeleteVetoFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
987 {"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
988 {"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
989 {"veto oplock files", P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
990 {"map system", P_BOOL, P_LOCAL, &sDefault.bMap_system, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
991 {"map hidden", P_BOOL, P_LOCAL, &sDefault.bMap_hidden, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
992 {"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
993 {"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
994 {"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED },
995 {"stat cache", P_BOOL, P_GLOBAL, &Globals.bStatCache, NULL, NULL, FLAG_ADVANCED},
997 {N_("Domain Options"), P_SEP, P_SEPARATOR},
999 {"machine password timeout", P_INTEGER, P_GLOBAL, &Globals.machine_password_timeout, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
1001 {N_("Logon Options"), P_SEP, P_SEPARATOR},
1003 {"add user script", P_STRING, P_GLOBAL, &Globals.szAddUserScript, NULL, NULL, FLAG_ADVANCED},
1004 {"delete user script", P_STRING, P_GLOBAL, &Globals.szDelUserScript, NULL, NULL, FLAG_ADVANCED},
1005 {"add group script", P_STRING, P_GLOBAL, &Globals.szAddGroupScript, NULL, NULL, FLAG_ADVANCED},
1006 {"delete group script", P_STRING, P_GLOBAL, &Globals.szDelGroupScript, NULL, NULL, FLAG_ADVANCED},
1007 {"add user to group script", P_STRING, P_GLOBAL, &Globals.szAddUserToGroupScript, NULL, NULL, FLAG_ADVANCED},
1008 {"delete user from group script", P_STRING, P_GLOBAL, &Globals.szDelUserFromGroupScript, NULL, NULL, FLAG_ADVANCED},
1009 {"set primary group script", P_STRING, P_GLOBAL, &Globals.szSetPrimaryGroupScript, NULL, NULL, FLAG_ADVANCED},
1010 {"add machine script", P_STRING, P_GLOBAL, &Globals.szAddMachineScript, NULL, NULL, FLAG_ADVANCED},
1011 {"shutdown script", P_STRING, P_GLOBAL, &Globals.szShutdownScript, NULL, NULL, FLAG_ADVANCED},
1012 {"abort shutdown script", P_STRING, P_GLOBAL, &Globals.szAbortShutdownScript, NULL, NULL, FLAG_ADVANCED},
1014 {"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, FLAG_ADVANCED},
1015 {"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, FLAG_ADVANCED},
1016 {"logon drive", P_STRING, P_GLOBAL, &Globals.szLogonDrive, NULL, NULL, FLAG_ADVANCED},
1017 {"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL, FLAG_ADVANCED},
1018 {"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL, NULL, FLAG_ADVANCED},
1020 {N_("Browse Options"), P_SEP, P_SEPARATOR},
1022 {"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
1023 {"lm announce", P_ENUM, P_GLOBAL, &Globals.lm_announce, NULL, enum_bool_auto, FLAG_ADVANCED},
1024 {"lm interval", P_INTEGER, P_GLOBAL, &Globals.lm_interval, NULL, NULL, FLAG_ADVANCED},
1025 {"preferred master", P_ENUM, P_GLOBAL, &Globals.bPreferredMaster, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
1026 {"prefered master", P_ENUM, P_GLOBAL, &Globals.bPreferredMaster, NULL, enum_bool_auto, FLAG_HIDE},
1027 {"local master", P_BOOL, P_GLOBAL, &Globals.bLocalMaster, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
1028 {"domain master", P_ENUM, P_GLOBAL, &Globals.bDomainMaster, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
1029 {"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL, NULL, FLAG_ADVANCED},
1030 {"browseable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1031 {"browsable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, FLAG_HIDE},
1032 {"enhanced browsing", P_BOOL, P_GLOBAL, &Globals.enhanced_browsing, NULL, NULL, FLAG_ADVANCED},
1034 {N_("WINS Options"), P_SEP, P_SEPARATOR},
1036 {"dns proxy", P_BOOL, P_GLOBAL, &Globals.bDNSproxy, NULL, NULL, FLAG_ADVANCED},
1037 {"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL, NULL, FLAG_ADVANCED},
1039 {"wins server", P_LIST, P_GLOBAL, &Globals.szWINSservers, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
1040 {"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
1041 {"wins hook", P_STRING, P_GLOBAL, &Globals.szWINSHook, NULL, NULL, FLAG_ADVANCED},
1042 {"wins partners", P_STRING, P_GLOBAL, &Globals.szWINSPartners, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
1044 {N_("Locking Options"), P_SEP, P_SEPARATOR},
1046 {"blocking locks", P_BOOL, P_LOCAL, &sDefault.bBlockingLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1047 {"csc policy", P_ENUM, P_LOCAL, &sDefault.iCSCPolicy, NULL, enum_csc_policy, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1048 {"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1049 {"kernel oplocks", P_BOOL, P_GLOBAL, &Globals.bKernelOplocks, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
1050 {"locking", P_BOOL, P_LOCAL, &sDefault.bLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1051 {"lock spin count", P_INTEGER, P_GLOBAL, &Globals.iLockSpinCount, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
1052 {"lock spin time", P_INTEGER, P_GLOBAL, &Globals.iLockSpinTime, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
1054 {"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1055 {"level2 oplocks", P_BOOL, P_LOCAL, &sDefault.bLevel2OpLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1056 {"oplock break wait time", P_INTEGER, P_GLOBAL, &Globals.oplock_break_wait_time, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
1057 {"oplock contention limit", P_INTEGER, P_LOCAL, &sDefault.iOplockContentionLimit, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1058 {"posix locking", P_BOOL, P_LOCAL, &sDefault.bPosixLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1059 {"strict locking", P_BOOL, P_LOCAL, &sDefault.bStrictLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1060 {"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1062 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
1064 #ifdef WITH_LDAP_SAMCONFIG
1065 {"ldap server", P_STRING, P_GLOBAL, &Globals.szLdapServer, NULL, NULL, FLAG_ADVANCED},
1066 {"ldap port", P_INTEGER, P_GLOBAL, &Globals.ldap_port, NULL, NULL, FLAG_ADVANCED},
1067 #endif
1068 {"ldap suffix", P_STRING, P_GLOBAL, &Globals.szLdapSuffix, NULL, NULL, FLAG_ADVANCED},
1069 {"ldap machine suffix", P_STRING, P_GLOBAL, &Globals.szLdapMachineSuffix, NULL, NULL, FLAG_ADVANCED},
1070 {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, NULL, NULL, FLAG_ADVANCED},
1071 {"ldap group suffix", P_STRING, P_GLOBAL, &Globals.szLdapGroupSuffix, NULL, NULL, FLAG_ADVANCED},
1072 {"ldap idmap suffix", P_STRING, P_GLOBAL, &Globals.szLdapIdmapSuffix, NULL, NULL, FLAG_ADVANCED},
1073 {"ldap filter", P_STRING, P_GLOBAL, &Globals.szLdapFilter, NULL, NULL, FLAG_ADVANCED},
1074 {"ldap admin dn", P_STRING, P_GLOBAL, &Globals.szLdapAdminDn, NULL, NULL, FLAG_ADVANCED},
1075 {"ldap ssl", P_ENUM, P_GLOBAL, &Globals.ldap_ssl, NULL, enum_ldap_ssl, FLAG_ADVANCED},
1076 {"ldap passwd sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_ADVANCED},
1077 {"ldap delete dn", P_BOOL, P_GLOBAL, &Globals.ldap_delete_dn, NULL, NULL, FLAG_ADVANCED},
1078 {"ldap replication sleep", P_INTEGER, P_GLOBAL, &Globals.ldap_replication_sleep, NULL, NULL, FLAG_ADVANCED},
1080 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
1081 {"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, FLAG_ADVANCED},
1082 {"change share command", P_STRING, P_GLOBAL, &Globals.szChangeShareCommand, NULL, NULL, FLAG_ADVANCED},
1083 {"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, FLAG_ADVANCED},
1085 {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE},
1086 {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
1087 {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
1088 {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED},
1089 {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE},
1090 {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED},
1091 #ifdef WITH_UTMP
1092 {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED},
1093 {"wtmp directory", P_STRING, P_GLOBAL, &Globals.szWtmpDir, NULL, NULL, FLAG_ADVANCED},
1094 {"utmp", P_BOOL, P_GLOBAL, &Globals.bUtmp, NULL, NULL, FLAG_ADVANCED},
1095 #endif
1097 {"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_ADVANCED},
1098 {"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_ADVANCED},
1099 {"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL, FLAG_ADVANCED},
1100 {"dfree command", P_STRING, P_GLOBAL, &Globals.szDfree, NULL, NULL, FLAG_ADVANCED},
1101 {"get quota command", P_STRING, P_GLOBAL, &Globals.szGetQuota, NULL, NULL, FLAG_ADVANCED},
1102 {"set quota command", P_STRING, P_GLOBAL, &Globals.szSetQuota, NULL, NULL, FLAG_ADVANCED},
1103 {"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL, FLAG_ADVANCED},
1104 {"remote browse sync", P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync, NULL, NULL, FLAG_ADVANCED},
1105 {"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL, FLAG_ADVANCED},
1106 {"homedir map", P_STRING, P_GLOBAL, &Globals.szNISHomeMapName, NULL, NULL, FLAG_ADVANCED},
1107 {"afs username map", P_USTRING, P_GLOBAL, &Globals.szAfsUsernameMap, NULL, NULL, FLAG_ADVANCED},
1108 {"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL, NULL, FLAG_ADVANCED},
1109 {"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL, NULL, FLAG_ADVANCED},
1110 {"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL, NULL, FLAG_HIDE},
1112 {"copy", P_STRING, P_LOCAL, &sDefault.szCopy, handle_copy, NULL, FLAG_HIDE},
1113 {"include", P_STRING, P_LOCAL, &sDefault.szInclude, handle_include, NULL, FLAG_HIDE},
1114 {"exec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1115 {"preexec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, FLAG_ADVANCED},
1117 {"preexec close", P_BOOL, P_LOCAL, &sDefault.bPreexecClose, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1118 {"postexec", P_STRING, P_LOCAL, &sDefault.szPostExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1119 {"root preexec", P_STRING, P_LOCAL, &sDefault.szRootPreExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1120 {"root preexec close", P_BOOL, P_LOCAL, &sDefault.bRootpreexecClose, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1121 {"root postexec", P_STRING, P_LOCAL, &sDefault.szRootPostExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1122 {"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
1123 {"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
1124 {"fstype", P_STRING, P_LOCAL, &sDefault.fstype, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1125 {"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1126 {"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1127 {"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1128 {"dont descend", P_STRING, P_LOCAL, &sDefault.szDontdescend, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1129 {"magic script", P_STRING, P_LOCAL, &sDefault.szMagicScript, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1130 {"magic output", P_STRING, P_LOCAL, &sDefault.szMagicOutput, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1131 {"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1132 {"dos filemode", P_BOOL, P_LOCAL, &sDefault.bDosFilemode, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1133 {"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1134 {"dos filetime resolution", P_BOOL, P_LOCAL, &sDefault.bDosFiletimeResolution, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1136 {"fake directory create times", P_BOOL, P_LOCAL, &sDefault.bFakeDirCreateTimes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
1137 {"panic action", P_STRING, P_GLOBAL, &Globals.szPanicAction, NULL, NULL, FLAG_ADVANCED},
1139 {N_("VFS module options"), P_SEP, P_SEPARATOR},
1141 {"vfs objects", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1142 {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_HIDE},
1145 {"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1146 {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
1147 {"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED},
1149 {N_("Winbind options"), P_SEP, P_SEPARATOR},
1151 {"enable rid algorithm", P_BOOL, P_GLOBAL, &Globals.bEnableRidAlgorithm, NULL, NULL, FLAG_DEPRECATED},
1152 {"idmap backend", P_STRING, P_GLOBAL, &Globals.szIdmapBackend, NULL, NULL, FLAG_ADVANCED},
1153 {"idmap uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED},
1154 {"winbind uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_HIDE},
1155 {"idmap gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED},
1156 {"winbind gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_HIDE},
1157 {"template primary group", P_STRING, P_GLOBAL, &Globals.szTemplatePrimaryGroup, NULL, NULL, FLAG_ADVANCED},
1158 {"template homedir", P_STRING, P_GLOBAL, &Globals.szTemplateHomedir, NULL, NULL, FLAG_ADVANCED},
1159 {"template shell", P_STRING, P_GLOBAL, &Globals.szTemplateShell, NULL, NULL, FLAG_ADVANCED},
1160 {"winbind separator", P_STRING, P_GLOBAL, &Globals.szWinbindSeparator, NULL, NULL, FLAG_ADVANCED},
1161 {"winbind cache time", P_INTEGER, P_GLOBAL, &Globals.winbind_cache_time, NULL, NULL, FLAG_ADVANCED},
1162 {"winbind enable local accounts", P_BOOL, P_GLOBAL, &Globals.bWinbindEnableLocalAccounts, NULL, NULL, FLAG_ADVANCED},
1163 {"winbind enum users", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumUsers, NULL, NULL, FLAG_ADVANCED},
1164 {"winbind enum groups", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumGroups, NULL, NULL, FLAG_ADVANCED},
1165 {"winbind use default domain", P_BOOL, P_GLOBAL, &Globals.bWinbindUseDefaultDomain, NULL, NULL, FLAG_ADVANCED},
1166 {"winbind trusted domains only", P_BOOL, P_GLOBAL, &Globals.bWinbindTrustedDomainsOnly, NULL, NULL, FLAG_ADVANCED},
1168 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
1171 /***************************************************************************
1172 Initialise the sDefault parameter structure for the printer values.
1173 ***************************************************************************/
1175 static void init_printer_values(service *pService)
1177 if ( pService == NULL ) {
1178 DEBUG(0,("init_printer_values: NULL pointer\n"));
1179 return;
1182 /* choose defaults depending on the type of printing */
1183 switch (pService->iPrinting) {
1184 case PRINT_BSD:
1185 case PRINT_AIX:
1186 case PRINT_LPRNT:
1187 case PRINT_LPROS2:
1188 string_set(&pService->szLpqcommand, "lpq -P'%p'");
1189 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
1190 string_set(&pService->szPrintcommand,
1191 "lpr -r -P'%p' %s");
1192 break;
1194 case PRINT_LPRNG:
1195 case PRINT_PLP:
1196 string_set(&pService->szLpqcommand, "lpq -P'%p'");
1197 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
1198 string_set(&pService->szPrintcommand,
1199 "lpr -r -P'%p' %s");
1200 string_set(&pService->szQueuepausecommand,
1201 "lpc stop '%p'");
1202 string_set(&pService->szQueueresumecommand,
1203 "lpc start '%p'");
1204 string_set(&pService->szLppausecommand,
1205 "lpc hold '%p' %j");
1206 string_set(&pService->szLpresumecommand,
1207 "lpc release '%p' %j");
1208 break;
1210 case PRINT_CUPS:
1211 #ifdef HAVE_CUPS
1212 string_set(&pService->szLpqcommand, "");
1213 string_set(&pService->szLprmcommand, "");
1214 string_set(&pService->szPrintcommand, "");
1215 string_set(&pService->szLppausecommand, "");
1216 string_set(&pService->szLpresumecommand, "");
1217 string_set(&pService->szQueuepausecommand, "");
1218 string_set(&pService->szQueueresumecommand, "");
1220 string_set(&Globals.szPrintcapname, "cups");
1221 #else
1222 string_set(&pService->szLpqcommand,
1223 "/usr/bin/lpstat -o '%p'");
1224 string_set(&pService->szLprmcommand,
1225 "/usr/bin/cancel '%p-%j'");
1226 string_set(&pService->szPrintcommand,
1227 "/usr/bin/lp -d '%p' %s; rm %s");
1228 string_set(&pService->szLppausecommand,
1229 "lp -i '%p-%j' -H hold");
1230 string_set(&pService->szLpresumecommand,
1231 "lp -i '%p-%j' -H resume");
1232 string_set(&pService->szQueuepausecommand,
1233 "/usr/bin/disable '%p'");
1234 string_set(&pService->szQueueresumecommand,
1235 "/usr/bin/enable '%p'");
1236 string_set(&Globals.szPrintcapname, "lpstat");
1237 #endif /* HAVE_CUPS */
1238 break;
1240 case PRINT_SYSV:
1241 case PRINT_HPUX:
1242 string_set(&pService->szLpqcommand, "lpstat -o%p");
1243 string_set(&pService->szLprmcommand, "cancel %p-%j");
1244 string_set(&pService->szPrintcommand,
1245 "lp -c -d%p %s; rm %s");
1246 string_set(&pService->szQueuepausecommand,
1247 "disable %p");
1248 string_set(&pService->szQueueresumecommand,
1249 "enable %p");
1250 #ifndef HPUX
1251 string_set(&pService->szLppausecommand,
1252 "lp -i %p-%j -H hold");
1253 string_set(&pService->szLpresumecommand,
1254 "lp -i %p-%j -H resume");
1255 #endif /* HPUX */
1256 break;
1258 case PRINT_QNX:
1259 string_set(&pService->szLpqcommand, "lpq -P%p");
1260 string_set(&pService->szLprmcommand, "lprm -P%p %j");
1261 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
1262 break;
1264 #ifdef DEVELOPER
1265 case PRINT_TEST:
1266 case PRINT_VLP:
1267 string_set(&pService->szPrintcommand, "vlp print %p %s");
1268 string_set(&pService->szLpqcommand, "vlp lpq %p");
1269 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
1270 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
1271 string_set(&pService->szLpresumecommand, "vlp lpresum %p %j");
1272 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
1273 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
1274 break;
1275 #endif /* DEVELOPER */
1280 /***************************************************************************
1281 Initialise the global parameter structure.
1282 ***************************************************************************/
1284 static void init_globals(void)
1286 static BOOL done_init = False;
1287 pstring s;
1289 if (!done_init) {
1290 int i;
1291 memset((void *)&Globals, '\0', sizeof(Globals));
1293 for (i = 0; parm_table[i].label; i++)
1294 if ((parm_table[i].type == P_STRING ||
1295 parm_table[i].type == P_USTRING) &&
1296 parm_table[i].ptr)
1297 string_set(parm_table[i].ptr, "");
1299 string_set(&sDefault.fstype, FSTYPE_STRING);
1301 done_init = True;
1305 DEBUG(3, ("Initialising global parameters\n"));
1307 string_set(&Globals.szSMBPasswdFile, dyn_SMB_PASSWD_FILE);
1308 string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR);
1310 /* use the new 'hash2' method by default, with a prefix of 1 */
1311 string_set(&Globals.szManglingMethod, "hash2");
1312 Globals.mangle_prefix = 1;
1314 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
1316 /* using UTF8 by default allows us to support all chars */
1317 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
1319 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
1320 /* If the system supports nl_langinfo(), try to grab the value
1321 from the user's locale */
1322 string_set(&Globals.display_charset, "LOCALE");
1323 #else
1324 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
1325 #endif
1327 /* Use codepage 850 as a default for the dos character set */
1328 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
1331 * Allow the default PASSWD_CHAT to be overridden in local.h.
1333 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
1335 set_global_myname(myhostname());
1336 string_set(&Globals.szNetbiosName,global_myname());
1338 set_global_myworkgroup(WORKGROUP);
1339 string_set(&Globals.szWorkgroup, lp_workgroup());
1341 string_set(&Globals.szPasswdProgram, "");
1342 string_set(&Globals.szPrintcapname, PRINTCAP_NAME);
1343 string_set(&Globals.szPidDir, dyn_PIDDIR);
1344 string_set(&Globals.szLockDir, dyn_LOCKDIR);
1345 string_set(&Globals.szSocketAddress, "0.0.0.0");
1346 pstrcpy(s, "Samba ");
1347 pstrcat(s, SAMBA_VERSION_STRING);
1348 string_set(&Globals.szServerString, s);
1349 slprintf(s, sizeof(s) - 1, "%d.%d", DEFAULT_MAJOR_VERSION,
1350 DEFAULT_MINOR_VERSION);
1351 string_set(&Globals.szAnnounceVersion, s);
1353 pstrcpy(user_socket_options, DEFAULT_SOCKET_OPTIONS);
1355 string_set(&Globals.szLogonDrive, "");
1356 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
1357 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
1358 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
1360 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
1361 string_set(&Globals.szPasswordServer, "*");
1363 Globals.AlgorithmicRidBase = BASE_RID;
1365 Globals.bLoadPrinters = True;
1366 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
1367 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
1368 Globals.max_xmit = 0x4104;
1369 Globals.max_mux = 50; /* This is *needed* for profile support. */
1370 Globals.lpqcachetime = 10;
1371 Globals.bDisableSpoolss = False;
1372 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
1373 Globals.iTotalPrintJobs = 0; /* no limit specified */
1374 Globals.pwordlevel = 0;
1375 Globals.unamelevel = 0;
1376 Globals.deadtime = 0;
1377 Globals.bLargeReadwrite = True;
1378 Globals.max_log_size = 5000;
1379 Globals.max_open_files = MAX_OPEN_FILES;
1380 Globals.maxprotocol = PROTOCOL_NT1;
1381 Globals.minprotocol = PROTOCOL_CORE;
1382 Globals.security = SEC_USER;
1383 Globals.paranoid_server_security = True;
1384 Globals.bEncryptPasswords = True;
1385 Globals.bUpdateEncrypt = False;
1386 Globals.clientSchannel = Auto;
1387 Globals.serverSchannel = Auto;
1388 Globals.bReadRaw = True;
1389 Globals.bWriteRaw = True;
1390 Globals.bReadbmpx = False;
1391 Globals.bNullPasswords = False;
1392 Globals.bObeyPamRestrictions = False;
1393 Globals.syslog = 1;
1394 Globals.bSyslogOnly = False;
1395 Globals.bTimestampLogs = True;
1396 string_set(&Globals.szLogLevel, "0");
1397 Globals.bDebugHiresTimestamp = False;
1398 Globals.bDebugPid = False;
1399 Globals.bDebugUid = False;
1400 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
1401 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
1402 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
1403 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
1404 Globals.change_notify_timeout = 60; /* 1 minute default. */
1405 Globals.bKernelChangeNotify = True; /* On if we have it. */
1406 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
1407 Globals.lm_interval = 60;
1408 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
1409 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
1410 Globals.bNISHomeMap = False;
1411 #ifdef WITH_NISPLUS_HOME
1412 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
1413 #else
1414 string_set(&Globals.szNISHomeMapName, "auto.home");
1415 #endif
1416 #endif
1417 Globals.bTimeServer = False;
1418 Globals.bBindInterfacesOnly = False;
1419 Globals.bUnixPasswdSync = False;
1420 Globals.bPamPasswordChange = False;
1421 Globals.bPasswdChatDebug = False;
1422 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
1423 Globals.bUnicode = True; /* Do unicode on the wire by default */
1424 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
1425 Globals.bNTStatusSupport = True; /* Use NT status by default. */
1426 Globals.bStatCache = True; /* use stat cache by default */
1427 Globals.restrict_anonymous = 0;
1428 Globals.bClientLanManAuth = True; /* Do use the LanMan hash if it is available */
1429 Globals.bClientPlaintextAuth = True; /* Do use a plaintext password if is requested by the server */
1430 Globals.bLanmanAuth = True; /* Do use the LanMan hash if it is available */
1431 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is available (otherwise NTLMv2) */
1432 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
1433 /* Note, that we will use NTLM2 session security (which is different), if it is available */
1435 Globals.map_to_guest = 0; /* By Default, "Never" */
1436 Globals.min_passwd_length = MINPASSWDLENGTH; /* By Default, 5. */
1437 Globals.use_cracklib = False;
1438 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
1439 Globals.enhanced_browsing = True;
1440 Globals.iLockSpinCount = 3; /* Try 3 times. */
1441 Globals.iLockSpinTime = 10; /* usec. */
1442 #ifdef MMAP_BLACKLIST
1443 Globals.bUseMmap = False;
1444 #else
1445 Globals.bUseMmap = True;
1446 #endif
1447 Globals.bUnixExtensions = True;
1449 /* hostname lookups can be very expensive and are broken on
1450 a large number of sites (tridge) */
1451 Globals.bHostnameLookups = False;
1453 #ifdef WITH_LDAP_SAMCONFIG
1454 string_set(&Globals.szLdapServer, "localhost");
1455 Globals.ldap_port = 636;
1456 Globals.szPassdbBackend = str_list_make("ldapsam_compat", NULL);
1457 #else
1458 Globals.szPassdbBackend = str_list_make("smbpasswd", NULL);
1459 #endif /* WITH_LDAP_SAMCONFIG */
1461 string_set(&Globals.szLdapSuffix, "");
1462 string_set(&Globals.szLdapFilter, "(uid=%u)");
1463 string_set(&Globals.szLdapMachineSuffix, "");
1464 string_set(&Globals.szLdapUserSuffix, "");
1465 string_set(&Globals.szLdapGroupSuffix, "");
1466 string_set(&Globals.szLdapIdmapSuffix, "");
1468 string_set(&Globals.szLdapAdminDn, "");
1469 Globals.ldap_ssl = LDAP_SSL_ON;
1470 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
1471 Globals.ldap_delete_dn = False;
1472 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
1474 /* these parameters are set to defaults that are more appropriate
1475 for the increasing samba install base:
1477 as a member of the workgroup, that will possibly become a
1478 _local_ master browser (lm = True). this is opposed to a forced
1479 local master browser startup (pm = True).
1481 doesn't provide WINS server service by default (wsupp = False),
1482 and doesn't provide domain master browser services by default, either.
1486 Globals.bMsAddPrinterWizard = True;
1487 Globals.bPreferredMaster = Auto; /* depending on bDomainMaster */
1488 Globals.os_level = 20;
1489 Globals.bLocalMaster = True;
1490 Globals.bDomainMaster = Auto; /* depending on bDomainLogons */
1491 Globals.bDomainLogons = False;
1492 Globals.bBrowseList = True;
1493 Globals.bWINSsupport = False;
1494 Globals.bWINSproxy = False;
1496 Globals.bDNSproxy = True;
1498 /* this just means to use them if they exist */
1499 Globals.bKernelOplocks = True;
1501 Globals.bAllowTrustedDomains = True;
1503 string_set(&Globals.szTemplateShell, "/bin/false");
1504 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
1505 string_set(&Globals.szTemplatePrimaryGroup, "nobody");
1506 string_set(&Globals.szWinbindSeparator, "\\");
1507 string_set(&Globals.szAclCompat, "");
1509 Globals.winbind_cache_time = 300; /* 5 minutes */
1510 Globals.bWinbindEnableLocalAccounts = True;
1511 Globals.bWinbindEnumUsers = True;
1512 Globals.bWinbindEnumGroups = True;
1513 Globals.bWinbindUseDefaultDomain = False;
1514 Globals.bWinbindTrustedDomainsOnly = False;
1516 Globals.bEnableRidAlgorithm = True;
1518 Globals.name_cache_timeout = 660; /* In seconds */
1520 Globals.bUseSpnego = True;
1521 Globals.bClientUseSpnego = True;
1523 Globals.client_signing = Auto;
1524 Globals.server_signing = False;
1526 string_set(&Globals.smb_ports, SMB_PORTS);
1529 static TALLOC_CTX *lp_talloc;
1531 /******************************************************************* a
1532 Free up temporary memory - called from the main loop.
1533 ********************************************************************/
1535 void lp_talloc_free(void)
1537 if (!lp_talloc)
1538 return;
1539 talloc_destroy(lp_talloc);
1540 lp_talloc = NULL;
1543 /*******************************************************************
1544 Convenience routine to grab string parameters into temporary memory
1545 and run standard_sub_basic on them. The buffers can be written to by
1546 callers without affecting the source string.
1547 ********************************************************************/
1549 static char *lp_string(const char *s)
1551 char *ret, *tmpstr;
1553 /* The follow debug is useful for tracking down memory problems
1554 especially if you have an inner loop that is calling a lp_*()
1555 function that returns a string. Perhaps this debug should be
1556 present all the time? */
1558 #if 0
1559 DEBUG(10, ("lp_string(%s)\n", s));
1560 #endif
1562 if (!lp_talloc)
1563 lp_talloc = talloc_init("lp_talloc");
1565 tmpstr = alloc_sub_basic(current_user_info.smb_name, s);
1566 if (trim_char(tmpstr, '\"', '\"')) {
1567 if (strchr(tmpstr,'\"') != NULL) {
1568 SAFE_FREE(tmpstr);
1569 tmpstr = alloc_sub_basic(current_user_info.smb_name,s);
1572 ret = talloc_strdup(lp_talloc, tmpstr);
1573 SAFE_FREE(tmpstr);
1575 return (ret);
1579 In this section all the functions that are used to access the
1580 parameters from the rest of the program are defined
1583 #define FN_GLOBAL_STRING(fn_name,ptr) \
1584 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
1585 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
1586 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
1587 #define FN_GLOBAL_LIST(fn_name,ptr) \
1588 const char **fn_name(void) {return(*(const char ***)(ptr));}
1589 #define FN_GLOBAL_BOOL(fn_name,ptr) \
1590 BOOL fn_name(void) {return(*(BOOL *)(ptr));}
1591 #define FN_GLOBAL_CHAR(fn_name,ptr) \
1592 char fn_name(void) {return(*(char *)(ptr));}
1593 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
1594 int fn_name(void) {return(*(int *)(ptr));}
1596 #define FN_LOCAL_STRING(fn_name,val) \
1597 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
1598 #define FN_LOCAL_CONST_STRING(fn_name,val) \
1599 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
1600 #define FN_LOCAL_LIST(fn_name,val) \
1601 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1602 #define FN_LOCAL_BOOL(fn_name,val) \
1603 BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1604 #define FN_LOCAL_CHAR(fn_name,val) \
1605 char fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1606 #define FN_LOCAL_INTEGER(fn_name,val) \
1607 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
1609 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
1610 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
1611 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
1612 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
1613 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
1614 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
1615 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
1616 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
1617 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
1618 FN_GLOBAL_STRING(lp_printcapname, &Globals.szPrintcapname)
1619 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
1620 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
1621 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
1622 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
1623 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
1624 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
1625 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
1626 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
1627 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
1628 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
1629 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
1630 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
1631 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
1632 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
1633 FN_GLOBAL_STRING(lp_dfree_command, &Globals.szDfree)
1634 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
1635 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
1636 FN_GLOBAL_STRING(lp_hosts_equiv, &Globals.szHostsEquiv)
1637 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
1638 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
1639 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
1640 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
1641 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
1642 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
1643 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
1644 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
1645 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
1646 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
1647 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
1648 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
1649 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
1650 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
1651 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
1652 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
1653 FN_GLOBAL_STRING(lp_socket_address, &Globals.szSocketAddress)
1654 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
1655 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
1656 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
1657 FN_GLOBAL_LIST(lp_passdb_backend, &Globals.szPassdbBackend)
1658 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
1659 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
1660 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
1661 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
1663 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
1664 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
1665 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
1666 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
1667 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
1668 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
1670 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
1672 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
1673 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
1675 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
1676 FN_GLOBAL_STRING(lp_wins_partners, &Globals.szWINSPartners)
1677 FN_GLOBAL_STRING(lp_template_primary_group, &Globals.szTemplatePrimaryGroup)
1678 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
1679 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
1680 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
1681 FN_GLOBAL_STRING(lp_acl_compatibility, &Globals.szAclCompat)
1682 FN_GLOBAL_BOOL(lp_winbind_enable_local_accounts, &Globals.bWinbindEnableLocalAccounts)
1683 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
1684 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
1685 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
1686 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
1688 FN_GLOBAL_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
1689 FN_GLOBAL_BOOL(lp_enable_rid_algorithm, &Globals.bEnableRidAlgorithm)
1691 #ifdef WITH_LDAP_SAMCONFIG
1692 FN_GLOBAL_STRING(lp_ldap_server, &Globals.szLdapServer)
1693 FN_GLOBAL_INTEGER(lp_ldap_port, &Globals.ldap_port)
1694 #endif
1695 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
1696 FN_GLOBAL_STRING(lp_ldap_filter, &Globals.szLdapFilter)
1697 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
1698 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
1699 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
1700 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
1701 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
1702 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
1703 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
1704 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
1706 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
1707 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
1708 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
1709 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
1710 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
1711 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
1712 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
1713 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
1714 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
1715 FN_GLOBAL_BOOL(lp_readbmpx, &Globals.bReadbmpx)
1716 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
1717 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
1718 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
1719 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
1720 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
1721 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
1722 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
1723 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
1724 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
1725 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
1726 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
1727 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
1728 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
1729 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
1730 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
1731 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
1732 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
1733 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
1734 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
1735 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
1736 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
1737 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
1738 FN_GLOBAL_BOOL(lp_unicode, &Globals.bUnicode)
1739 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
1740 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
1741 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
1742 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
1743 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
1744 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
1745 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
1746 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
1747 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
1748 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
1749 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
1750 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
1751 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
1752 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
1753 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
1754 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
1755 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
1756 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
1757 FN_GLOBAL_BOOL(lp_kernel_change_notify, &Globals.bKernelChangeNotify)
1758 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
1759 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
1760 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
1761 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
1762 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
1763 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
1764 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
1765 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
1766 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
1767 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
1768 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
1769 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
1770 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
1771 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
1772 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
1773 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
1774 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
1775 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
1776 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
1777 FN_GLOBAL_INTEGER(lp_disable_spoolss, &Globals.bDisableSpoolss)
1778 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
1779 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
1780 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
1781 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
1782 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
1783 FN_GLOBAL_INTEGER(lp_change_notify_timeout, &Globals.change_notify_timeout)
1784 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
1785 FN_GLOBAL_INTEGER(lp_min_passwd_length, &Globals.min_passwd_length)
1786 FN_GLOBAL_BOOL(lp_use_cracklib, &Globals.use_cracklib)
1787 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
1788 FN_GLOBAL_INTEGER(lp_lock_spin_count, &Globals.iLockSpinCount)
1789 FN_GLOBAL_INTEGER(lp_lock_sleep_time, &Globals.iLockSpinTime)
1790 FN_LOCAL_STRING(lp_preexec, szPreExec)
1791 FN_LOCAL_STRING(lp_postexec, szPostExec)
1792 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
1793 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
1794 FN_LOCAL_STRING(lp_servicename, szService)
1795 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
1796 FN_LOCAL_STRING(lp_pathname, szPath)
1797 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
1798 FN_LOCAL_STRING(lp_username, szUsername)
1799 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
1800 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
1801 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
1802 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
1803 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
1804 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
1805 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
1806 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
1807 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
1808 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
1809 static FN_LOCAL_STRING(_lp_printername, szPrintername)
1810 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
1811 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
1812 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
1813 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
1814 FN_LOCAL_STRING(lp_comment, comment)
1815 FN_LOCAL_STRING(lp_force_user, force_user)
1816 FN_LOCAL_STRING(lp_force_group, force_group)
1817 FN_LOCAL_LIST(lp_readlist, readlist)
1818 FN_LOCAL_LIST(lp_writelist, writelist)
1819 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
1820 FN_LOCAL_STRING(lp_fstype, fstype)
1821 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
1822 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
1823 static FN_LOCAL_STRING(lp_volume, volume)
1824 FN_LOCAL_STRING(lp_mangled_map, szMangledMap)
1825 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
1826 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
1827 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
1828 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
1829 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
1830 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
1831 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
1832 FN_LOCAL_BOOL(lp_casesensitive, bCaseSensitive)
1833 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
1834 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
1835 FN_LOCAL_BOOL(lp_casemangle, bCaseMangle)
1836 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
1837 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
1838 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
1839 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
1840 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
1841 FN_LOCAL_BOOL(lp_readonly, bRead_only)
1842 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
1843 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
1844 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
1845 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
1846 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
1847 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
1848 FN_LOCAL_BOOL(lp_locking, bLocking)
1849 FN_LOCAL_BOOL(lp_strict_locking, bStrictLocking)
1850 FN_LOCAL_BOOL(lp_posix_locking, bPosixLocking)
1851 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
1852 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
1853 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
1854 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
1855 FN_LOCAL_BOOL(lp_manglednames, bMangledNames)
1856 FN_LOCAL_BOOL(lp_widelinks, bWidelinks)
1857 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
1858 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
1859 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
1860 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
1861 FN_LOCAL_BOOL(lp_map_system, bMap_system)
1862 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
1863 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
1864 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
1865 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
1866 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
1867 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
1868 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
1869 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
1870 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
1871 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
1872 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
1873 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
1874 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
1875 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
1876 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
1877 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
1878 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
1879 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
1880 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
1881 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
1882 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
1883 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
1884 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
1885 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
1886 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
1887 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
1888 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
1889 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
1890 FN_LOCAL_INTEGER(lp_printing, iPrinting)
1891 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
1892 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
1893 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
1894 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
1895 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
1896 FN_LOCAL_CHAR(lp_magicchar, magic_char)
1897 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
1898 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
1899 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
1900 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
1901 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
1903 /* local prototypes */
1905 static int map_parameter(const char *pszParmName);
1906 static BOOL set_boolean(BOOL *pb, const char *pszParmValue);
1907 static int getservicebyname(const char *pszServiceName,
1908 service * pserviceDest);
1909 static void copy_service(service * pserviceDest,
1910 service * pserviceSource, BOOL *pcopymapDest);
1911 static BOOL service_ok(int iService);
1912 static BOOL do_parameter(const char *pszParmName, const char *pszParmValue);
1913 static BOOL do_section(const char *pszSectionName);
1914 static void init_copymap(service * pservice);
1916 /* This is a helper function for parametrical options support. */
1917 /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
1918 /* Actual parametrical functions are quite simple */
1919 static param_opt_struct *get_parametrics(int snum, const char *type, const char *option)
1921 BOOL global_section = False;
1922 char* param_key;
1923 param_opt_struct *data;
1925 if (snum >= iNumServices) return NULL;
1927 if (snum < 0) {
1928 data = Globals.param_opt;
1929 global_section = True;
1930 } else {
1931 data = ServicePtrs[snum]->param_opt;
1934 asprintf(&param_key, "%s:%s", type, option);
1935 if (!param_key) {
1936 DEBUG(0,("asprintf failed!\n"));
1937 return NULL;
1940 while (data) {
1941 if (strcmp(data->key, param_key) == 0) {
1942 string_free(&param_key);
1943 return data;
1945 data = data->next;
1948 if (!global_section) {
1949 /* Try to fetch the same option but from globals */
1950 /* but only if we are not already working with Globals */
1951 data = Globals.param_opt;
1952 while (data) {
1953 if (strcmp(data->key, param_key) == 0) {
1954 string_free(&param_key);
1955 return data;
1957 data = data->next;
1961 string_free(&param_key);
1963 return NULL;
1967 /*******************************************************************
1968 convenience routine to return int parameters.
1969 ********************************************************************/
1970 static int lp_int(const char *s)
1973 if (!s) {
1974 DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
1975 return (-1);
1978 return atoi(s);
1981 /*******************************************************************
1982 convenience routine to return unsigned long parameters.
1983 ********************************************************************/
1984 static int lp_ulong(const char *s)
1987 if (!s) {
1988 DEBUG(0,("lp_int(%s): is called with NULL!\n",s));
1989 return (-1);
1992 return strtoul(s, NULL, 10);
1995 /*******************************************************************
1996 convenience routine to return boolean parameters.
1997 ********************************************************************/
1998 static BOOL lp_bool(const char *s)
2000 BOOL ret = False;
2002 if (!s) {
2003 DEBUG(0,("lp_bool(%s): is called with NULL!\n",s));
2004 return False;
2007 if (!set_boolean(&ret,s)) {
2008 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
2009 return False;
2012 return ret;
2015 /*******************************************************************
2016 convenience routine to return enum parameters.
2017 ********************************************************************/
2018 static int lp_enum(const char *s,const struct enum_list *_enum)
2020 int i;
2022 if (!s || !_enum) {
2023 DEBUG(0,("lp_enum(%s,enum): is called with NULL!\n",s));
2024 return (-1);
2027 for (i=0; _enum[i].name; i++) {
2028 if (strequal(_enum[i].name,s))
2029 return _enum[i].value;
2032 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
2033 return (-1);
2037 /* DO NOT USE lp_parm_string ANYMORE!!!!
2038 * use lp_parm_const_string or lp_parm_talloc_string
2040 * lp_parm_string is only used to let old modules find this symbol
2042 #undef lp_parm_string
2043 char *lp_parm_string(const char *servicename, const char *type, const char *option)
2045 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
2048 /* Return parametric option from a given service. Type is a part of option before ':' */
2049 /* Parametric option has following syntax: 'Type: option = value' */
2050 /* the returned value is talloced in lp_talloc */
2051 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
2053 param_opt_struct *data = get_parametrics(snum, type, option);
2055 if (data == NULL||data->value==NULL) {
2056 if (def) {
2057 return lp_string(def);
2058 } else {
2059 return NULL;
2063 return lp_string(data->value);
2066 /* Return parametric option from a given service. Type is a part of option before ':' */
2067 /* Parametric option has following syntax: 'Type: option = value' */
2068 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
2070 param_opt_struct *data = get_parametrics(snum, type, option);
2072 if (data == NULL||data->value==NULL)
2073 return def;
2075 return data->value;
2078 /* Return parametric option from a given service. Type is a part of option before ':' */
2079 /* Parametric option has following syntax: 'Type: option = value' */
2081 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
2083 param_opt_struct *data = get_parametrics(snum, type, option);
2085 if (data == NULL||data->value==NULL)
2086 return (const char **)def;
2088 if (data->list==NULL) {
2089 data->list = str_list_make(data->value, NULL);
2092 return (const char **)data->list;
2095 /* Return parametric option from a given service. Type is a part of option before ':' */
2096 /* Parametric option has following syntax: 'Type: option = value' */
2098 int lp_parm_int(int snum, const char *type, const char *option, int def)
2100 param_opt_struct *data = get_parametrics(snum, type, option);
2102 if (data && data->value && *data->value)
2103 return lp_int(data->value);
2105 return def;
2108 /* Return parametric option from a given service. Type is a part of option before ':' */
2109 /* Parametric option has following syntax: 'Type: option = value' */
2111 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
2113 param_opt_struct *data = get_parametrics(snum, type, option);
2115 if (data && data->value && *data->value)
2116 return lp_ulong(data->value);
2118 return def;
2121 /* Return parametric option from a given service. Type is a part of option before ':' */
2122 /* Parametric option has following syntax: 'Type: option = value' */
2124 BOOL lp_parm_bool(int snum, const char *type, const char *option, BOOL def)
2126 param_opt_struct *data = get_parametrics(snum, type, option);
2128 if (data && data->value && *data->value)
2129 return lp_bool(data->value);
2131 return def;
2134 /* Return parametric option from a given service. Type is a part of option before ':' */
2135 /* Parametric option has following syntax: 'Type: option = value' */
2137 int lp_parm_enum(int snum, const char *type, const char *option,
2138 const struct enum_list *_enum, int def)
2140 param_opt_struct *data = get_parametrics(snum, type, option);
2142 if (data && data->value && *data->value && _enum)
2143 return lp_enum(data->value, _enum);
2145 return def;
2149 /***************************************************************************
2150 Initialise a service to the defaults.
2151 ***************************************************************************/
2153 static void init_service(service * pservice)
2155 memset((char *)pservice, '\0', sizeof(service));
2156 copy_service(pservice, &sDefault, NULL);
2159 /***************************************************************************
2160 Free the dynamically allocated parts of a service struct.
2161 ***************************************************************************/
2163 static void free_service(service *pservice)
2165 int i;
2166 param_opt_struct *data, *pdata;
2167 if (!pservice)
2168 return;
2170 if (pservice->szService)
2171 DEBUG(5, ("free_service: Freeing service %s\n",
2172 pservice->szService));
2174 string_free(&pservice->szService);
2175 SAFE_FREE(pservice->copymap);
2177 for (i = 0; parm_table[i].label; i++) {
2178 if ((parm_table[i].type == P_STRING ||
2179 parm_table[i].type == P_USTRING) &&
2180 parm_table[i].class == P_LOCAL)
2181 string_free((char **)
2182 (((char *)pservice) +
2183 PTR_DIFF(parm_table[i].ptr, &sDefault)));
2184 else if (parm_table[i].type == P_LIST &&
2185 parm_table[i].class == P_LOCAL)
2186 str_list_free((char ***)
2187 (((char *)pservice) +
2188 PTR_DIFF(parm_table[i].ptr, &sDefault)));
2191 data = pservice->param_opt;
2192 if (data)
2193 DEBUG(5,("Freeing parametrics:\n"));
2194 while (data) {
2195 DEBUG(5,("[%s = %s]\n", data->key, data->value));
2196 string_free(&data->key);
2197 string_free(&data->value);
2198 str_list_free(&data->list);
2199 pdata = data->next;
2200 SAFE_FREE(data);
2201 data = pdata;
2204 ZERO_STRUCTP(pservice);
2207 /***************************************************************************
2208 Add a new service to the services array initialising it with the given
2209 service.
2210 ***************************************************************************/
2212 static int add_a_service(const service *pservice, const char *name)
2214 int i;
2215 service tservice;
2216 int num_to_alloc = iNumServices + 1;
2217 param_opt_struct *data, *pdata;
2219 tservice = *pservice;
2221 /* it might already exist */
2222 if (name) {
2223 i = getservicebyname(name, NULL);
2224 if (i >= 0) {
2225 /* Clean all parametric options for service */
2226 /* They will be added during parsing again */
2227 data = ServicePtrs[i]->param_opt;
2228 while (data) {
2229 string_free(&data->key);
2230 string_free(&data->value);
2231 str_list_free(&data->list);
2232 pdata = data->next;
2233 SAFE_FREE(data);
2234 data = pdata;
2236 ServicePtrs[i]->param_opt = NULL;
2237 return (i);
2241 /* find an invalid one */
2242 for (i = 0; i < iNumServices; i++)
2243 if (!ServicePtrs[i]->valid)
2244 break;
2246 /* if not, then create one */
2247 if (i == iNumServices) {
2248 service **tsp;
2250 tsp = (service **) Realloc(ServicePtrs,
2251 sizeof(service *) *
2252 num_to_alloc);
2254 if (!tsp) {
2255 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
2256 return (-1);
2258 else {
2259 ServicePtrs = tsp;
2260 ServicePtrs[iNumServices] =
2261 (service *) malloc(sizeof(service));
2263 if (!ServicePtrs[iNumServices]) {
2264 DEBUG(0,("add_a_service: out of memory!\n"));
2265 return (-1);
2268 iNumServices++;
2269 } else
2270 free_service(ServicePtrs[i]);
2272 ServicePtrs[i]->valid = True;
2274 init_service(ServicePtrs[i]);
2275 copy_service(ServicePtrs[i], &tservice, NULL);
2276 if (name)
2277 string_set(&ServicePtrs[i]->szService, name);
2278 return (i);
2281 /***************************************************************************
2282 Add a new home service, with the specified home directory, defaults coming
2283 from service ifrom.
2284 ***************************************************************************/
2286 BOOL lp_add_home(const char *pszHomename, int iDefaultService,
2287 const char *user, const char *pszHomedir)
2289 int i;
2290 pstring newHomedir;
2292 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
2294 if (i < 0)
2295 return (False);
2297 if (!(*(ServicePtrs[iDefaultService]->szPath))
2298 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
2299 pstrcpy(newHomedir, pszHomedir);
2300 string_set(&ServicePtrs[i]->szPath, newHomedir);
2303 if (!(*(ServicePtrs[i]->comment))) {
2304 pstring comment;
2305 slprintf(comment, sizeof(comment) - 1,
2306 "Home directory of %s", user);
2307 string_set(&ServicePtrs[i]->comment, comment);
2310 /* set the browseable flag from the gloabl default */
2312 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
2314 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
2315 user, newHomedir));
2317 return (True);
2320 /***************************************************************************
2321 Add a new service, based on an old one.
2322 ***************************************************************************/
2324 int lp_add_service(const char *pszService, int iDefaultService)
2326 return (add_a_service(ServicePtrs[iDefaultService], pszService));
2329 /***************************************************************************
2330 Add the IPC service.
2331 ***************************************************************************/
2333 static BOOL lp_add_ipc(const char *ipc_name, BOOL guest_ok)
2335 pstring comment;
2336 int i = add_a_service(&sDefault, ipc_name);
2338 if (i < 0)
2339 return (False);
2341 slprintf(comment, sizeof(comment) - 1,
2342 "IPC Service (%s)", Globals.szServerString);
2344 string_set(&ServicePtrs[i]->szPath, tmpdir());
2345 string_set(&ServicePtrs[i]->szUsername, "");
2346 string_set(&ServicePtrs[i]->comment, comment);
2347 string_set(&ServicePtrs[i]->fstype, "IPC");
2348 ServicePtrs[i]->iMaxConnections = 0;
2349 ServicePtrs[i]->bAvailable = True;
2350 ServicePtrs[i]->bRead_only = True;
2351 ServicePtrs[i]->bGuest_only = False;
2352 ServicePtrs[i]->bGuest_ok = guest_ok;
2353 ServicePtrs[i]->bPrint_ok = False;
2354 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
2356 DEBUG(3, ("adding IPC service\n"));
2358 return (True);
2361 /***************************************************************************
2362 Add a new printer service, with defaults coming from service iFrom.
2363 ***************************************************************************/
2365 BOOL lp_add_printer(const char *pszPrintername, int iDefaultService)
2367 const char *comment = "From Printcap";
2368 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
2370 if (i < 0)
2371 return (False);
2373 /* note that we do NOT default the availability flag to True - */
2374 /* we take it from the default service passed. This allows all */
2375 /* dynamic printers to be disabled by disabling the [printers] */
2376 /* entry (if/when the 'available' keyword is implemented!). */
2378 /* the printer name is set to the service name. */
2379 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
2380 string_set(&ServicePtrs[i]->comment, comment);
2382 /* set the browseable flag from the gloabl default */
2383 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
2385 /* Printers cannot be read_only. */
2386 ServicePtrs[i]->bRead_only = False;
2387 /* No share modes on printer services. */
2388 ServicePtrs[i]->bShareModes = False;
2389 /* No oplocks on printer services. */
2390 ServicePtrs[i]->bOpLocks = False;
2391 /* Printer services must be printable. */
2392 ServicePtrs[i]->bPrint_ok = True;
2394 DEBUG(3, ("adding printer service %s\n", pszPrintername));
2396 return (True);
2399 /***************************************************************************
2400 Map a parameter's string representation to something we can use.
2401 Returns False if the parameter string is not recognised, else TRUE.
2402 ***************************************************************************/
2404 static int map_parameter(const char *pszParmName)
2406 int iIndex;
2408 if (*pszParmName == '-')
2409 return (-1);
2411 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
2412 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
2413 return (iIndex);
2415 /* Warn only if it isn't parametric option */
2416 if (strchr(pszParmName, ':') == NULL)
2417 DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
2418 /* We do return 'fail' for parametric options as well because they are
2419 stored in different storage
2421 return (-1);
2424 /***************************************************************************
2425 Set a boolean variable from the text value stored in the passed string.
2426 Returns True in success, False if the passed string does not correctly
2427 represent a boolean.
2428 ***************************************************************************/
2430 static BOOL set_boolean(BOOL *pb, const char *pszParmValue)
2432 BOOL bRetval;
2434 bRetval = True;
2435 if (strwicmp(pszParmValue, "yes") == 0 ||
2436 strwicmp(pszParmValue, "true") == 0 ||
2437 strwicmp(pszParmValue, "1") == 0)
2438 *pb = True;
2439 else if (strwicmp(pszParmValue, "no") == 0 ||
2440 strwicmp(pszParmValue, "False") == 0 ||
2441 strwicmp(pszParmValue, "0") == 0)
2442 *pb = False;
2443 else {
2444 DEBUG(0,
2445 ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
2446 pszParmValue));
2447 bRetval = False;
2449 return (bRetval);
2452 /***************************************************************************
2453 Find a service by name. Otherwise works like get_service.
2454 ***************************************************************************/
2456 static int getservicebyname(const char *pszServiceName, service * pserviceDest)
2458 int iService;
2460 for (iService = iNumServices - 1; iService >= 0; iService--)
2461 if (VALID(iService) &&
2462 strwicmp(ServicePtrs[iService]->szService, pszServiceName) == 0) {
2463 if (pserviceDest != NULL)
2464 copy_service(pserviceDest, ServicePtrs[iService], NULL);
2465 break;
2468 return (iService);
2471 /***************************************************************************
2472 Copy a service structure to another.
2473 If pcopymapDest is NULL then copy all fields
2474 ***************************************************************************/
2476 static void copy_service(service * pserviceDest, service * pserviceSource, BOOL *pcopymapDest)
2478 int i;
2479 BOOL bcopyall = (pcopymapDest == NULL);
2480 param_opt_struct *data, *pdata, *paramo;
2481 BOOL not_added;
2483 for (i = 0; parm_table[i].label; i++)
2484 if (parm_table[i].ptr && parm_table[i].class == P_LOCAL &&
2485 (bcopyall || pcopymapDest[i])) {
2486 void *def_ptr = parm_table[i].ptr;
2487 void *src_ptr =
2488 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
2489 &sDefault);
2490 void *dest_ptr =
2491 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
2492 &sDefault);
2494 switch (parm_table[i].type) {
2495 case P_BOOL:
2496 case P_BOOLREV:
2497 *(BOOL *)dest_ptr = *(BOOL *)src_ptr;
2498 break;
2500 case P_INTEGER:
2501 case P_ENUM:
2502 case P_OCTAL:
2503 *(int *)dest_ptr = *(int *)src_ptr;
2504 break;
2506 case P_CHAR:
2507 *(char *)dest_ptr = *(char *)src_ptr;
2508 break;
2510 case P_STRING:
2511 string_set(dest_ptr,
2512 *(char **)src_ptr);
2513 break;
2515 case P_USTRING:
2516 string_set(dest_ptr,
2517 *(char **)src_ptr);
2518 strupper_m(*(char **)dest_ptr);
2519 break;
2520 case P_LIST:
2521 str_list_copy((char ***)dest_ptr, *(const char ***)src_ptr);
2522 break;
2523 default:
2524 break;
2528 if (bcopyall) {
2529 init_copymap(pserviceDest);
2530 if (pserviceSource->copymap)
2531 memcpy((void *)pserviceDest->copymap,
2532 (void *)pserviceSource->copymap,
2533 sizeof(BOOL) * NUMPARAMETERS);
2536 data = pserviceSource->param_opt;
2537 while (data) {
2538 not_added = True;
2539 pdata = pserviceDest->param_opt;
2540 /* Traverse destination */
2541 while (pdata) {
2542 /* If we already have same option, override it */
2543 if (strcmp(pdata->key, data->key) == 0) {
2544 string_free(&pdata->value);
2545 str_list_free(&data->list);
2546 pdata->value = strdup(data->value);
2547 not_added = False;
2548 break;
2550 pdata = pdata->next;
2552 if (not_added) {
2553 paramo = smb_xmalloc(sizeof(param_opt_struct));
2554 paramo->key = strdup(data->key);
2555 paramo->value = strdup(data->value);
2556 paramo->list = NULL;
2557 DLIST_ADD(pserviceDest->param_opt, paramo);
2559 data = data->next;
2563 /***************************************************************************
2564 Check a service for consistency. Return False if the service is in any way
2565 incomplete or faulty, else True.
2566 ***************************************************************************/
2568 static BOOL service_ok(int iService)
2570 BOOL bRetval;
2572 bRetval = True;
2573 if (ServicePtrs[iService]->szService[0] == '\0') {
2574 DEBUG(0, ("The following message indicates an internal error:\n"));
2575 DEBUG(0, ("No service name in service entry.\n"));
2576 bRetval = False;
2579 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
2580 /* I can't see why you'd want a non-printable printer service... */
2581 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
2582 if (!ServicePtrs[iService]->bPrint_ok) {
2583 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
2584 ServicePtrs[iService]->szService));
2585 ServicePtrs[iService]->bPrint_ok = True;
2587 /* [printers] service must also be non-browsable. */
2588 if (ServicePtrs[iService]->bBrowseable)
2589 ServicePtrs[iService]->bBrowseable = False;
2592 if (ServicePtrs[iService]->szPath[0] == '\0' &&
2593 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0) {
2594 DEBUG(0, ("No path in service %s - using %s\n",
2595 ServicePtrs[iService]->szService, tmpdir()));
2596 string_set(&ServicePtrs[iService]->szPath, tmpdir());
2599 /* If a service is flagged unavailable, log the fact at level 0. */
2600 if (!ServicePtrs[iService]->bAvailable)
2601 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
2602 ServicePtrs[iService]->szService));
2604 return (bRetval);
2607 static struct file_lists {
2608 struct file_lists *next;
2609 char *name;
2610 char *subfname;
2611 time_t modtime;
2612 } *file_lists = NULL;
2614 /*******************************************************************
2615 Keep a linked list of all config files so we know when one has changed
2616 it's date and needs to be reloaded.
2617 ********************************************************************/
2619 static void add_to_file_list(const char *fname, const char *subfname)
2621 struct file_lists *f = file_lists;
2623 while (f) {
2624 if (f->name && !strcmp(f->name, fname))
2625 break;
2626 f = f->next;
2629 if (!f) {
2630 f = (struct file_lists *)malloc(sizeof(file_lists[0]));
2631 if (!f)
2632 return;
2633 f->next = file_lists;
2634 f->name = strdup(fname);
2635 if (!f->name) {
2636 SAFE_FREE(f);
2637 return;
2639 f->subfname = strdup(subfname);
2640 if (!f->subfname) {
2641 SAFE_FREE(f);
2642 return;
2644 file_lists = f;
2645 f->modtime = file_modtime(subfname);
2646 } else {
2647 time_t t = file_modtime(subfname);
2648 if (t)
2649 f->modtime = t;
2653 /*******************************************************************
2654 Check if a config file has changed date.
2655 ********************************************************************/
2657 BOOL lp_file_list_changed(void)
2659 struct file_lists *f = file_lists;
2660 DEBUG(6, ("lp_file_list_changed()\n"));
2662 while (f) {
2663 pstring n2;
2664 time_t mod_time;
2666 pstrcpy(n2, f->name);
2667 standard_sub_basic(current_user_info.smb_name, n2,sizeof(n2));
2669 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
2670 f->name, n2, ctime(&f->modtime)));
2672 mod_time = file_modtime(n2);
2674 if (mod_time && ((f->modtime != mod_time) || (f->subfname == NULL) || (strcmp(n2, f->subfname) != 0))) {
2675 DEBUGADD(6,
2676 ("file %s modified: %s\n", n2,
2677 ctime(&mod_time)));
2678 f->modtime = mod_time;
2679 SAFE_FREE(f->subfname);
2680 f->subfname = strdup(n2);
2681 return (True);
2683 f = f->next;
2685 return (False);
2688 /***************************************************************************
2689 Run standard_sub_basic on netbios name... needed because global_myname
2690 is not accessed through any lp_ macro.
2691 Note: We must *NOT* use string_set() here as ptr points to global_myname.
2692 ***************************************************************************/
2694 static BOOL handle_netbios_name(const char *pszParmValue, char **ptr)
2696 BOOL ret;
2697 pstring netbios_name;
2699 pstrcpy(netbios_name, pszParmValue);
2701 standard_sub_basic(current_user_info.smb_name, netbios_name,sizeof(netbios_name));
2703 ret = set_global_myname(netbios_name);
2704 string_set(&Globals.szNetbiosName,global_myname());
2706 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
2707 global_myname()));
2709 return ret;
2712 static BOOL handle_charset(const char *pszParmValue, char **ptr)
2714 if (strcmp(*ptr, pszParmValue) != 0) {
2715 string_set(ptr, pszParmValue);
2716 init_iconv();
2718 return True;
2721 static BOOL handle_workgroup(const char *pszParmValue, char **ptr)
2723 BOOL ret;
2725 ret = set_global_myworkgroup(pszParmValue);
2726 string_set(&Globals.szWorkgroup,lp_workgroup());
2728 return ret;
2731 static BOOL handle_netbios_scope(const char *pszParmValue, char **ptr)
2733 BOOL ret;
2735 ret = set_global_scope(pszParmValue);
2736 string_set(&Globals.szNetbiosScope,global_scope());
2738 return ret;
2741 static BOOL handle_netbios_aliases(const char *pszParmValue, char **ptr)
2743 Globals.szNetbiosAliases = str_list_make(pszParmValue, NULL);
2744 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
2747 /***************************************************************************
2748 Handle the include operation.
2749 ***************************************************************************/
2751 static BOOL handle_include(const char *pszParmValue, char **ptr)
2753 pstring fname;
2754 pstrcpy(fname, pszParmValue);
2756 standard_sub_basic(current_user_info.smb_name, fname,sizeof(fname));
2758 add_to_file_list(pszParmValue, fname);
2760 string_set(ptr, fname);
2762 if (file_exist(fname, NULL))
2763 return (pm_process(fname, do_section, do_parameter));
2765 DEBUG(2, ("Can't find include file %s\n", fname));
2767 return (False);
2770 /***************************************************************************
2771 Handle the interpretation of the copy parameter.
2772 ***************************************************************************/
2774 static BOOL handle_copy(const char *pszParmValue, char **ptr)
2776 BOOL bRetval;
2777 int iTemp;
2778 service serviceTemp;
2780 string_set(ptr, pszParmValue);
2782 init_service(&serviceTemp);
2784 bRetval = False;
2786 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
2788 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
2789 if (iTemp == iServiceIndex) {
2790 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
2791 } else {
2792 copy_service(ServicePtrs[iServiceIndex],
2793 &serviceTemp,
2794 ServicePtrs[iServiceIndex]->copymap);
2795 bRetval = True;
2797 } else {
2798 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
2799 bRetval = False;
2802 free_service(&serviceTemp);
2803 return (bRetval);
2806 /***************************************************************************
2807 Handle idmap/non unix account uid and gid allocation parameters. The format of these
2808 parameters is:
2810 [global]
2812 idmap uid = 1000-1999
2813 idmap gid = 700-899
2815 We only do simple parsing checks here. The strings are parsed into useful
2816 structures in the idmap daemon code.
2818 ***************************************************************************/
2820 /* Some lp_ routines to return idmap [ug]id information */
2822 static uid_t idmap_uid_low, idmap_uid_high;
2823 static gid_t idmap_gid_low, idmap_gid_high;
2825 BOOL lp_idmap_uid(uid_t *low, uid_t *high)
2827 if (idmap_uid_low == 0 || idmap_uid_high == 0)
2828 return False;
2830 if (low)
2831 *low = idmap_uid_low;
2833 if (high)
2834 *high = idmap_uid_high;
2836 return True;
2839 BOOL lp_idmap_gid(gid_t *low, gid_t *high)
2841 if (idmap_gid_low == 0 || idmap_gid_high == 0)
2842 return False;
2844 if (low)
2845 *low = idmap_gid_low;
2847 if (high)
2848 *high = idmap_gid_high;
2850 return True;
2853 /* Do some simple checks on "idmap [ug]id" parameter values */
2855 static BOOL handle_idmap_uid(const char *pszParmValue, char **ptr)
2857 uint32 low, high;
2859 if (sscanf(pszParmValue, "%u-%u", &low, &high) != 2 || high < low)
2860 return False;
2862 /* Parse OK */
2864 string_set(ptr, pszParmValue);
2866 idmap_uid_low = low;
2867 idmap_uid_high = high;
2869 return True;
2872 static BOOL handle_idmap_gid(const char *pszParmValue, char **ptr)
2874 uint32 low, high;
2876 if (sscanf(pszParmValue, "%u-%u", &low, &high) != 2 || high < low)
2877 return False;
2879 /* Parse OK */
2881 string_set(ptr, pszParmValue);
2883 idmap_gid_low = low;
2884 idmap_gid_high = high;
2886 return True;
2889 /***************************************************************************
2890 Handle the DEBUG level list.
2891 ***************************************************************************/
2893 static BOOL handle_debug_list( const char *pszParmValueIn, char **ptr )
2895 pstring pszParmValue;
2897 pstrcpy(pszParmValue, pszParmValueIn);
2898 string_set(ptr, pszParmValueIn);
2899 return debug_parse_levels( pszParmValue );
2902 /***************************************************************************
2903 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
2904 ***************************************************************************/
2906 static char* append_ldap_suffix( const char *str )
2908 char *suffix_string;
2911 if (!lp_talloc)
2912 lp_talloc = talloc_init("lp_talloc");
2914 suffix_string = talloc_asprintf( lp_talloc, "%s,%s", str, Globals.szLdapSuffix );
2915 if ( !suffix_string ) {
2916 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
2917 return NULL;
2920 return suffix_string;
2923 char *lp_ldap_machine_suffix(void)
2925 if (Globals.szLdapMachineSuffix[0])
2926 return append_ldap_suffix(Globals.szLdapMachineSuffix);
2928 return lp_string(Globals.szLdapSuffix);
2931 char *lp_ldap_user_suffix(void)
2933 if (Globals.szLdapUserSuffix[0])
2934 return append_ldap_suffix(Globals.szLdapUserSuffix);
2936 return lp_string(Globals.szLdapSuffix);
2939 char *lp_ldap_group_suffix(void)
2941 if (Globals.szLdapGroupSuffix[0])
2942 return append_ldap_suffix(Globals.szLdapGroupSuffix);
2944 return lp_string(Globals.szLdapSuffix);
2947 char *lp_ldap_idmap_suffix(void)
2949 if (Globals.szLdapIdmapSuffix[0])
2950 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
2952 return lp_string(Globals.szLdapSuffix);
2955 /***************************************************************************
2956 ***************************************************************************/
2958 static BOOL handle_acl_compatibility(const char *pszParmValue, char **ptr)
2960 if (strequal(pszParmValue, "auto"))
2961 string_set(ptr, "");
2962 else if (strequal(pszParmValue, "winnt"))
2963 string_set(ptr, "winnt");
2964 else if (strequal(pszParmValue, "win2k"))
2965 string_set(ptr, "win2k");
2966 else
2967 return False;
2969 return True;
2972 /***************************************************************************
2973 Initialise a copymap.
2974 ***************************************************************************/
2976 static void init_copymap(service * pservice)
2978 int i;
2979 SAFE_FREE(pservice->copymap);
2980 pservice->copymap = (BOOL *)malloc(sizeof(BOOL) * NUMPARAMETERS);
2981 if (!pservice->copymap)
2982 DEBUG(0,
2983 ("Couldn't allocate copymap!! (size %d)\n",
2984 (int)NUMPARAMETERS));
2985 else
2986 for (i = 0; i < NUMPARAMETERS; i++)
2987 pservice->copymap[i] = True;
2990 /***************************************************************************
2991 Return the local pointer to a parameter given the service number and the
2992 pointer into the default structure.
2993 ***************************************************************************/
2995 void *lp_local_ptr(int snum, void *ptr)
2997 return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
3000 /***************************************************************************
3001 Process a parameter for a particular service number. If snum < 0
3002 then assume we are in the globals.
3003 ***************************************************************************/
3005 BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
3007 int parmnum, i, slen;
3008 void *parm_ptr = NULL; /* where we are going to store the result */
3009 void *def_ptr = NULL;
3010 pstring param_key;
3011 char *sep;
3012 param_opt_struct *paramo, *data;
3013 BOOL not_added;
3015 parmnum = map_parameter(pszParmName);
3017 if (parmnum < 0) {
3018 if ((sep=strchr(pszParmName, ':')) != NULL) {
3019 *sep = '\0';
3020 ZERO_STRUCT(param_key);
3021 pstr_sprintf(param_key, "%s:", pszParmName);
3022 slen = strlen(param_key);
3023 pstrcat(param_key, sep+1);
3024 trim_char(param_key+slen, ' ', ' ');
3025 not_added = True;
3026 data = (snum < 0) ? Globals.param_opt :
3027 ServicePtrs[snum]->param_opt;
3028 /* Traverse destination */
3029 while (data) {
3030 /* If we already have same option, override it */
3031 if (strcmp(data->key, param_key) == 0) {
3032 string_free(&data->value);
3033 str_list_free(&data->list);
3034 data->value = strdup(pszParmValue);
3035 not_added = False;
3036 break;
3038 data = data->next;
3040 if (not_added) {
3041 paramo = smb_xmalloc(sizeof(param_opt_struct));
3042 paramo->key = strdup(param_key);
3043 paramo->value = strdup(pszParmValue);
3044 paramo->list = NULL;
3045 if (snum < 0) {
3046 DLIST_ADD(Globals.param_opt, paramo);
3047 } else {
3048 DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
3052 *sep = ':';
3053 return (True);
3055 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
3056 return (True);
3059 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
3060 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
3061 pszParmName));
3064 def_ptr = parm_table[parmnum].ptr;
3066 /* we might point at a service, the default service or a global */
3067 if (snum < 0) {
3068 parm_ptr = def_ptr;
3069 } else {
3070 if (parm_table[parmnum].class == P_GLOBAL) {
3071 DEBUG(0,
3072 ("Global parameter %s found in service section!\n",
3073 pszParmName));
3074 return (True);
3076 parm_ptr =
3077 ((char *)ServicePtrs[snum]) + PTR_DIFF(def_ptr,
3078 &sDefault);
3081 if (snum >= 0) {
3082 if (!ServicePtrs[snum]->copymap)
3083 init_copymap(ServicePtrs[snum]);
3085 /* this handles the aliases - set the copymap for other entries with
3086 the same data pointer */
3087 for (i = 0; parm_table[i].label; i++)
3088 if (parm_table[i].ptr == parm_table[parmnum].ptr)
3089 ServicePtrs[snum]->copymap[i] = False;
3092 /* if it is a special case then go ahead */
3093 if (parm_table[parmnum].special) {
3094 parm_table[parmnum].special(pszParmValue, (char **)parm_ptr);
3095 return (True);
3098 /* now switch on the type of variable it is */
3099 switch (parm_table[parmnum].type)
3101 case P_BOOL:
3102 set_boolean(parm_ptr, pszParmValue);
3103 break;
3105 case P_BOOLREV:
3106 set_boolean(parm_ptr, pszParmValue);
3107 *(BOOL *)parm_ptr = !*(BOOL *)parm_ptr;
3108 break;
3110 case P_INTEGER:
3111 *(int *)parm_ptr = atoi(pszParmValue);
3112 break;
3114 case P_CHAR:
3115 *(char *)parm_ptr = *pszParmValue;
3116 break;
3118 case P_OCTAL:
3119 sscanf(pszParmValue, "%o", (int *)parm_ptr);
3120 break;
3122 case P_LIST:
3123 str_list_free(parm_ptr);
3124 *(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
3125 break;
3127 case P_STRING:
3128 string_set(parm_ptr, pszParmValue);
3129 break;
3131 case P_USTRING:
3132 string_set(parm_ptr, pszParmValue);
3133 strupper_m(*(char **)parm_ptr);
3134 break;
3136 case P_GSTRING:
3137 pstrcpy((char *)parm_ptr, pszParmValue);
3138 break;
3140 case P_UGSTRING:
3141 pstrcpy((char *)parm_ptr, pszParmValue);
3142 strupper_m((char *)parm_ptr);
3143 break;
3145 case P_ENUM:
3146 for (i = 0; parm_table[parmnum].enum_list[i].name; i++) {
3147 if (strequal
3148 (pszParmValue,
3149 parm_table[parmnum].enum_list[i].name)) {
3150 *(int *)parm_ptr =
3151 parm_table[parmnum].
3152 enum_list[i].value;
3153 break;
3156 break;
3157 case P_SEP:
3158 break;
3161 return (True);
3164 /***************************************************************************
3165 Process a parameter.
3166 ***************************************************************************/
3168 static BOOL do_parameter(const char *pszParmName, const char *pszParmValue)
3170 if (!bInGlobalSection && bGlobalOnly)
3171 return (True);
3173 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
3175 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
3176 pszParmName, pszParmValue));
3179 /***************************************************************************
3180 Print a parameter of the specified type.
3181 ***************************************************************************/
3183 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
3185 int i;
3186 switch (p->type)
3188 case P_ENUM:
3189 for (i = 0; p->enum_list[i].name; i++) {
3190 if (*(int *)ptr == p->enum_list[i].value) {
3191 fprintf(f, "%s",
3192 p->enum_list[i].name);
3193 break;
3196 break;
3198 case P_BOOL:
3199 fprintf(f, "%s", BOOLSTR(*(BOOL *)ptr));
3200 break;
3202 case P_BOOLREV:
3203 fprintf(f, "%s", BOOLSTR(!*(BOOL *)ptr));
3204 break;
3206 case P_INTEGER:
3207 fprintf(f, "%d", *(int *)ptr);
3208 break;
3210 case P_CHAR:
3211 fprintf(f, "%c", *(char *)ptr);
3212 break;
3214 case P_OCTAL:
3215 fprintf(f, "%s", octal_string(*(int *)ptr));
3216 break;
3218 case P_LIST:
3219 if ((char ***)ptr && *(char ***)ptr) {
3220 char **list = *(char ***)ptr;
3222 for (; *list; list++) {
3223 /* surround strings with whitespace in single quotes */
3224 if ( strchr_m( *list, ' ' ) )
3225 fprintf(f, "\'%s\'%s", *list, ((*(list+1))?", ":""));
3226 else
3227 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
3230 break;
3232 case P_GSTRING:
3233 case P_UGSTRING:
3234 if ((char *)ptr) {
3235 fprintf(f, "%s", (char *)ptr);
3237 break;
3239 case P_STRING:
3240 case P_USTRING:
3241 if (*(char **)ptr) {
3242 fprintf(f, "%s", *(char **)ptr);
3244 break;
3245 case P_SEP:
3246 break;
3250 /***************************************************************************
3251 Check if two parameters are equal.
3252 ***************************************************************************/
3254 static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
3256 switch (type) {
3257 case P_BOOL:
3258 case P_BOOLREV:
3259 return (*((BOOL *)ptr1) == *((BOOL *)ptr2));
3261 case P_INTEGER:
3262 case P_ENUM:
3263 case P_OCTAL:
3264 return (*((int *)ptr1) == *((int *)ptr2));
3266 case P_CHAR:
3267 return (*((char *)ptr1) == *((char *)ptr2));
3269 case P_LIST:
3270 return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
3272 case P_GSTRING:
3273 case P_UGSTRING:
3275 char *p1 = (char *)ptr1, *p2 = (char *)ptr2;
3276 if (p1 && !*p1)
3277 p1 = NULL;
3278 if (p2 && !*p2)
3279 p2 = NULL;
3280 return (p1 == p2 || strequal(p1, p2));
3282 case P_STRING:
3283 case P_USTRING:
3285 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
3286 if (p1 && !*p1)
3287 p1 = NULL;
3288 if (p2 && !*p2)
3289 p2 = NULL;
3290 return (p1 == p2 || strequal(p1, p2));
3292 case P_SEP:
3293 break;
3295 return (False);
3298 /***************************************************************************
3299 Initialize any local varients in the sDefault table.
3300 ***************************************************************************/
3302 void init_locals(void)
3304 /* None as yet. */
3307 /***************************************************************************
3308 Process a new section (service). At this stage all sections are services.
3309 Later we'll have special sections that permit server parameters to be set.
3310 Returns True on success, False on failure.
3311 ***************************************************************************/
3313 static BOOL do_section(const char *pszSectionName)
3315 BOOL bRetval;
3316 BOOL isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
3317 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
3318 bRetval = False;
3320 /* if we were in a global section then do the local inits */
3321 if (bInGlobalSection && !isglobal)
3322 init_locals();
3324 /* if we've just struck a global section, note the fact. */
3325 bInGlobalSection = isglobal;
3327 /* check for multiple global sections */
3328 if (bInGlobalSection) {
3329 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
3330 return (True);
3333 if (!bInGlobalSection && bGlobalOnly)
3334 return (True);
3336 /* if we have a current service, tidy it up before moving on */
3337 bRetval = True;
3339 if (iServiceIndex >= 0)
3340 bRetval = service_ok(iServiceIndex);
3342 /* if all is still well, move to the next record in the services array */
3343 if (bRetval) {
3344 /* We put this here to avoid an odd message order if messages are */
3345 /* issued by the post-processing of a previous section. */
3346 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
3348 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
3349 < 0) {
3350 DEBUG(0, ("Failed to add a new service\n"));
3351 return (False);
3355 return (bRetval);
3359 /***************************************************************************
3360 Determine if a partcular base parameter is currentl set to the default value.
3361 ***************************************************************************/
3363 static BOOL is_default(int i)
3365 if (!defaults_saved)
3366 return False;
3367 switch (parm_table[i].type) {
3368 case P_LIST:
3369 return str_list_compare (parm_table[i].def.lvalue,
3370 *(char ***)parm_table[i].ptr);
3371 case P_STRING:
3372 case P_USTRING:
3373 return strequal(parm_table[i].def.svalue,
3374 *(char **)parm_table[i].ptr);
3375 case P_GSTRING:
3376 case P_UGSTRING:
3377 return strequal(parm_table[i].def.svalue,
3378 (char *)parm_table[i].ptr);
3379 case P_BOOL:
3380 case P_BOOLREV:
3381 return parm_table[i].def.bvalue ==
3382 *(BOOL *)parm_table[i].ptr;
3383 case P_CHAR:
3384 return parm_table[i].def.cvalue ==
3385 *(char *)parm_table[i].ptr;
3386 case P_INTEGER:
3387 case P_OCTAL:
3388 case P_ENUM:
3389 return parm_table[i].def.ivalue ==
3390 *(int *)parm_table[i].ptr;
3391 case P_SEP:
3392 break;
3394 return False;
3397 /***************************************************************************
3398 Display the contents of the global structure.
3399 ***************************************************************************/
3401 static void dump_globals(FILE *f)
3403 int i;
3404 param_opt_struct *data;
3406 fprintf(f, "# Global parameters\n[global]\n");
3408 for (i = 0; parm_table[i].label; i++)
3409 if (parm_table[i].class == P_GLOBAL &&
3410 parm_table[i].ptr &&
3411 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
3412 if (defaults_saved && is_default(i))
3413 continue;
3414 fprintf(f, "\t%s = ", parm_table[i].label);
3415 print_parameter(&parm_table[i], parm_table[i].ptr, f);
3416 fprintf(f, "\n");
3418 if (Globals.param_opt != NULL) {
3419 data = Globals.param_opt;
3420 while(data) {
3421 fprintf(f, "\t%s = %s\n", data->key, data->value);
3422 data = data->next;
3428 /***************************************************************************
3429 Return True if a local parameter is currently set to the global default.
3430 ***************************************************************************/
3432 BOOL lp_is_default(int snum, struct parm_struct *parm)
3434 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
3436 return equal_parameter(parm->type,
3437 ((char *)ServicePtrs[snum]) + pdiff,
3438 ((char *)&sDefault) + pdiff);
3441 /***************************************************************************
3442 Display the contents of a single services record.
3443 ***************************************************************************/
3445 static void dump_a_service(service * pService, FILE * f)
3447 int i;
3448 param_opt_struct *data;
3450 if (pService != &sDefault)
3451 fprintf(f, "\n[%s]\n", pService->szService);
3453 for (i = 0; parm_table[i].label; i++)
3454 if (parm_table[i].class == P_LOCAL &&
3455 parm_table[i].ptr &&
3456 (*parm_table[i].label != '-') &&
3457 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
3458 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
3460 if (pService == &sDefault) {
3461 if (defaults_saved && is_default(i))
3462 continue;
3463 } else {
3464 if (equal_parameter(parm_table[i].type,
3465 ((char *)pService) +
3466 pdiff,
3467 ((char *)&sDefault) +
3468 pdiff))
3469 continue;
3472 fprintf(f, "\t%s = ", parm_table[i].label);
3473 print_parameter(&parm_table[i],
3474 ((char *)pService) + pdiff, f);
3475 fprintf(f, "\n");
3477 if (pService->param_opt != NULL) {
3478 data = pService->param_opt;
3479 while(data) {
3480 fprintf(f, "\t%s = %s\n", data->key, data->value);
3481 data = data->next;
3487 /***************************************************************************
3488 Return info about the next service in a service. snum==GLOBAL_SECTION_SNUM gives the globals.
3489 Return NULL when out of parameters.
3490 ***************************************************************************/
3492 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
3494 if (snum < 0) {
3495 /* do the globals */
3496 for (; parm_table[*i].label; (*i)++) {
3497 if (parm_table[*i].class == P_SEPARATOR)
3498 return &parm_table[(*i)++];
3500 if (!parm_table[*i].ptr
3501 || (*parm_table[*i].label == '-'))
3502 continue;
3504 if ((*i) > 0
3505 && (parm_table[*i].ptr ==
3506 parm_table[(*i) - 1].ptr))
3507 continue;
3509 return &parm_table[(*i)++];
3511 } else {
3512 service *pService = ServicePtrs[snum];
3514 for (; parm_table[*i].label; (*i)++) {
3515 if (parm_table[*i].class == P_SEPARATOR)
3516 return &parm_table[(*i)++];
3518 if (parm_table[*i].class == P_LOCAL &&
3519 parm_table[*i].ptr &&
3520 (*parm_table[*i].label != '-') &&
3521 ((*i) == 0 ||
3522 (parm_table[*i].ptr !=
3523 parm_table[(*i) - 1].ptr)))
3525 int pdiff =
3526 PTR_DIFF(parm_table[*i].ptr,
3527 &sDefault);
3529 if (allparameters ||
3530 !equal_parameter(parm_table[*i].type,
3531 ((char *)pService) +
3532 pdiff,
3533 ((char *)&sDefault) +
3534 pdiff))
3536 return &parm_table[(*i)++];
3542 return NULL;
3546 #if 0
3547 /***************************************************************************
3548 Display the contents of a single copy structure.
3549 ***************************************************************************/
3550 static void dump_copy_map(BOOL *pcopymap)
3552 int i;
3553 if (!pcopymap)
3554 return;
3556 printf("\n\tNon-Copied parameters:\n");
3558 for (i = 0; parm_table[i].label; i++)
3559 if (parm_table[i].class == P_LOCAL &&
3560 parm_table[i].ptr && !pcopymap[i] &&
3561 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
3563 printf("\t\t%s\n", parm_table[i].label);
3566 #endif
3568 /***************************************************************************
3569 Return TRUE if the passed service number is within range.
3570 ***************************************************************************/
3572 BOOL lp_snum_ok(int iService)
3574 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
3577 /***************************************************************************
3578 Auto-load some home services.
3579 ***************************************************************************/
3581 static void lp_add_auto_services(char *str)
3583 char *s;
3584 char *p;
3585 int homes;
3587 if (!str)
3588 return;
3590 s = strdup(str);
3591 if (!s)
3592 return;
3594 homes = lp_servicenumber(HOMES_NAME);
3596 for (p = strtok(s, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) {
3597 char *home = get_user_home_dir(p);
3599 if (lp_servicenumber(p) >= 0)
3600 continue;
3602 if (home && homes >= 0)
3603 lp_add_home(p, homes, p, home);
3605 SAFE_FREE(s);
3608 /***************************************************************************
3609 Auto-load one printer.
3610 ***************************************************************************/
3612 void lp_add_one_printer(char *name, char *comment)
3614 int printers = lp_servicenumber(PRINTERS_NAME);
3615 int i;
3617 if (lp_servicenumber(name) < 0) {
3618 lp_add_printer(name, printers);
3619 if ((i = lp_servicenumber(name)) >= 0) {
3620 string_set(&ServicePtrs[i]->comment, comment);
3621 ServicePtrs[i]->autoloaded = True;
3626 /***************************************************************************
3627 Have we loaded a services file yet?
3628 ***************************************************************************/
3630 BOOL lp_loaded(void)
3632 return (bLoaded);
3635 /***************************************************************************
3636 Unload unused services.
3637 ***************************************************************************/
3639 void lp_killunused(BOOL (*snumused) (int))
3641 int i;
3642 for (i = 0; i < iNumServices; i++) {
3643 if (!VALID(i))
3644 continue;
3646 if (!snumused || !snumused(i)) {
3647 ServicePtrs[i]->valid = False;
3648 free_service(ServicePtrs[i]);
3653 /***************************************************************************
3654 Unload a service.
3655 ***************************************************************************/
3657 void lp_killservice(int iServiceIn)
3659 if (VALID(iServiceIn)) {
3660 ServicePtrs[iServiceIn]->valid = False;
3661 free_service(ServicePtrs[iServiceIn]);
3665 /***************************************************************************
3666 Save the curent values of all global and sDefault parameters into the
3667 defaults union. This allows swat and testparm to show only the
3668 changed (ie. non-default) parameters.
3669 ***************************************************************************/
3671 static void lp_save_defaults(void)
3673 int i;
3674 for (i = 0; parm_table[i].label; i++) {
3675 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
3676 continue;
3677 switch (parm_table[i].type) {
3678 case P_LIST:
3679 str_list_copy(&(parm_table[i].def.lvalue),
3680 *(const char ***)parm_table[i].ptr);
3681 break;
3682 case P_STRING:
3683 case P_USTRING:
3684 if (parm_table[i].ptr) {
3685 parm_table[i].def.svalue = strdup(*(char **)parm_table[i].ptr);
3686 } else {
3687 parm_table[i].def.svalue = NULL;
3689 break;
3690 case P_GSTRING:
3691 case P_UGSTRING:
3692 if (parm_table[i].ptr) {
3693 parm_table[i].def.svalue = strdup((char *)parm_table[i].ptr);
3694 } else {
3695 parm_table[i].def.svalue = NULL;
3697 break;
3698 case P_BOOL:
3699 case P_BOOLREV:
3700 parm_table[i].def.bvalue =
3701 *(BOOL *)parm_table[i].ptr;
3702 break;
3703 case P_CHAR:
3704 parm_table[i].def.cvalue =
3705 *(char *)parm_table[i].ptr;
3706 break;
3707 case P_INTEGER:
3708 case P_OCTAL:
3709 case P_ENUM:
3710 parm_table[i].def.ivalue =
3711 *(int *)parm_table[i].ptr;
3712 break;
3713 case P_SEP:
3714 break;
3717 defaults_saved = True;
3720 /*******************************************************************
3721 Set the server type we will announce as via nmbd.
3722 ********************************************************************/
3724 static void set_server_role(void)
3726 server_role = ROLE_STANDALONE;
3728 switch (lp_security()) {
3729 case SEC_SHARE:
3730 if (lp_domain_logons())
3731 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
3732 break;
3733 case SEC_SERVER:
3734 if (lp_domain_logons())
3735 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
3736 server_role = ROLE_DOMAIN_MEMBER;
3737 break;
3738 case SEC_DOMAIN:
3739 if (lp_domain_logons()) {
3740 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
3741 server_role = ROLE_DOMAIN_BDC;
3742 break;
3744 server_role = ROLE_DOMAIN_MEMBER;
3745 break;
3746 case SEC_ADS:
3747 if (lp_domain_logons()) {
3748 server_role = ROLE_DOMAIN_PDC;
3749 break;
3751 server_role = ROLE_DOMAIN_MEMBER;
3752 break;
3753 case SEC_USER:
3754 if (lp_domain_logons()) {
3756 if (Globals.bDomainMaster) /* auto or yes */
3757 server_role = ROLE_DOMAIN_PDC;
3758 else
3759 server_role = ROLE_DOMAIN_BDC;
3761 break;
3762 default:
3763 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
3764 break;
3767 DEBUG(10, ("set_server_role: role = "));
3769 switch(server_role) {
3770 case ROLE_STANDALONE:
3771 DEBUGADD(10, ("ROLE_STANDALONE\n"));
3772 break;
3773 case ROLE_DOMAIN_MEMBER:
3774 DEBUGADD(10, ("ROLE_DOMAIN_MEMBER\n"));
3775 break;
3776 case ROLE_DOMAIN_BDC:
3777 DEBUGADD(10, ("ROLE_DOMAIN_BDC\n"));
3778 break;
3779 case ROLE_DOMAIN_PDC:
3780 DEBUGADD(10, ("ROLE_DOMAIN_PDC\n"));
3781 break;
3785 /***********************************************************
3786 If we should send plaintext/LANMAN passwords in the clinet
3787 ************************************************************/
3788 static void set_allowed_client_auth(void)
3790 if (Globals.bClientNTLMv2Auth) {
3791 Globals.bClientLanManAuth = False;
3793 if (!Globals.bClientLanManAuth) {
3794 Globals.bClientPlaintextAuth = False;
3798 /***************************************************************************
3799 Load the services array from the services file. Return True on success,
3800 False on failure.
3801 ***************************************************************************/
3803 BOOL lp_load(const char *pszFname, BOOL global_only, BOOL save_defaults,
3804 BOOL add_ipc)
3806 pstring n2;
3807 BOOL bRetval;
3808 param_opt_struct *data, *pdata;
3810 pstrcpy(n2, pszFname);
3811 standard_sub_basic(current_user_info.smb_name, n2,sizeof(n2));
3813 add_to_file_list(pszFname, n2);
3815 bRetval = False;
3817 DEBUG(3, ("lp_load: refreshing parameters\n"));
3819 bInGlobalSection = True;
3820 bGlobalOnly = global_only;
3822 init_globals();
3823 debug_init();
3825 if (save_defaults)
3827 init_locals();
3828 lp_save_defaults();
3831 if (Globals.param_opt != NULL) {
3832 data = Globals.param_opt;
3833 while (data) {
3834 string_free(&data->key);
3835 string_free(&data->value);
3836 str_list_free(&data->list);
3837 pdata = data->next;
3838 SAFE_FREE(data);
3839 data = pdata;
3841 Globals.param_opt = NULL;
3844 /* We get sections first, so have to start 'behind' to make up */
3845 iServiceIndex = -1;
3846 bRetval = pm_process(n2, do_section, do_parameter);
3848 /* finish up the last section */
3849 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
3850 if (bRetval)
3851 if (iServiceIndex >= 0)
3852 bRetval = service_ok(iServiceIndex);
3854 lp_add_auto_services(lp_auto_services());
3856 if (add_ipc) {
3857 /* When 'restrict anonymous = 2' guest connections to ipc$
3858 are denied */
3859 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
3860 lp_add_ipc("ADMIN$", False);
3863 set_server_role();
3864 set_default_server_announce_type();
3865 set_allowed_client_auth();
3867 bLoaded = True;
3869 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
3870 /* if bWINSsupport is true and we are in the client */
3871 if (in_client && Globals.bWINSsupport) {
3872 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
3875 init_iconv();
3876 init_printer_values(&sDefault);
3878 return (bRetval);
3881 /***************************************************************************
3882 Reset the max number of services.
3883 ***************************************************************************/
3885 void lp_resetnumservices(void)
3887 iNumServices = 0;
3890 /***************************************************************************
3891 Return the max number of services.
3892 ***************************************************************************/
3894 int lp_numservices(void)
3896 return (iNumServices);
3899 /***************************************************************************
3900 Display the contents of the services array in human-readable form.
3901 ***************************************************************************/
3903 void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
3905 int iService;
3907 if (show_defaults)
3908 defaults_saved = False;
3910 dump_globals(f);
3912 dump_a_service(&sDefault, f);
3914 for (iService = 0; iService < maxtoprint; iService++)
3915 lp_dump_one(f, show_defaults, iService);
3918 /***************************************************************************
3919 Display the contents of one service in human-readable form.
3920 ***************************************************************************/
3922 void lp_dump_one(FILE * f, BOOL show_defaults, int snum)
3924 if (VALID(snum)) {
3925 if (ServicePtrs[snum]->szService[0] == '\0')
3926 return;
3927 dump_a_service(ServicePtrs[snum], f);
3931 /***************************************************************************
3932 Return the number of the service with the given name, or -1 if it doesn't
3933 exist. Note that this is a DIFFERENT ANIMAL from the internal function
3934 getservicebyname()! This works ONLY if all services have been loaded, and
3935 does not copy the found service.
3936 ***************************************************************************/
3938 int lp_servicenumber(const char *pszServiceName)
3940 int iService;
3941 fstring serviceName;
3943 if (!pszServiceName)
3944 return GLOBAL_SECTION_SNUM;
3946 for (iService = iNumServices - 1; iService >= 0; iService--) {
3947 if (VALID(iService) && ServicePtrs[iService]->szService) {
3949 * The substitution here is used to support %U is
3950 * service names
3952 fstrcpy(serviceName, ServicePtrs[iService]->szService);
3953 standard_sub_basic(current_user_info.smb_name, serviceName,sizeof(serviceName));
3954 if (strequal(serviceName, pszServiceName))
3955 break;
3959 if (iService < 0) {
3960 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
3961 return GLOBAL_SECTION_SNUM;
3964 return (iService);
3967 /*******************************************************************
3968 A useful volume label function.
3969 ********************************************************************/
3971 char *volume_label(int snum)
3973 char *ret = lp_volume(snum);
3974 if (!*ret)
3975 return lp_servicename(snum);
3976 return (ret);
3980 /*******************************************************************
3981 Set the server type we will announce as via nmbd.
3982 ********************************************************************/
3984 static void set_default_server_announce_type(void)
3986 default_server_announce = 0;
3987 default_server_announce |= SV_TYPE_WORKSTATION;
3988 default_server_announce |= SV_TYPE_SERVER;
3989 default_server_announce |= SV_TYPE_SERVER_UNIX;
3991 /* note that the flag should be set only if we have a
3992 printer service but nmbd doesn't actually load the
3993 services so we can't tell --jerry */
3995 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
3997 switch (lp_announce_as()) {
3998 case ANNOUNCE_AS_NT_SERVER:
3999 default_server_announce |= SV_TYPE_SERVER_NT;
4000 /* fall through... */
4001 case ANNOUNCE_AS_NT_WORKSTATION:
4002 default_server_announce |= SV_TYPE_NT;
4003 break;
4004 case ANNOUNCE_AS_WIN95:
4005 default_server_announce |= SV_TYPE_WIN95_PLUS;
4006 break;
4007 case ANNOUNCE_AS_WFW:
4008 default_server_announce |= SV_TYPE_WFW;
4009 break;
4010 default:
4011 break;
4014 switch (lp_server_role()) {
4015 case ROLE_DOMAIN_MEMBER:
4016 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
4017 break;
4018 case ROLE_DOMAIN_PDC:
4019 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
4020 break;
4021 case ROLE_DOMAIN_BDC:
4022 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
4023 break;
4024 case ROLE_STANDALONE:
4025 default:
4026 break;
4028 if (lp_time_server())
4029 default_server_announce |= SV_TYPE_TIME_SOURCE;
4031 if (lp_host_msdfs())
4032 default_server_announce |= SV_TYPE_DFS_SERVER;
4035 /***********************************************************
4036 returns role of Samba server
4037 ************************************************************/
4039 int lp_server_role(void)
4041 return server_role;
4044 /***********************************************************
4045 If we are PDC then prefer us as DMB
4046 ************************************************************/
4048 BOOL lp_domain_master(void)
4050 if (Globals.bDomainMaster == Auto)
4051 return (lp_server_role() == ROLE_DOMAIN_PDC);
4053 return Globals.bDomainMaster;
4056 /***********************************************************
4057 If we are DMB then prefer us as LMB
4058 ************************************************************/
4060 BOOL lp_preferred_master(void)
4062 if (Globals.bPreferredMaster == Auto)
4063 return (lp_local_master() && lp_domain_master());
4065 return Globals.bPreferredMaster;
4068 /*******************************************************************
4069 Remove a service.
4070 ********************************************************************/
4072 void lp_remove_service(int snum)
4074 ServicePtrs[snum]->valid = False;
4077 /*******************************************************************
4078 Copy a service.
4079 ********************************************************************/
4081 void lp_copy_service(int snum, const char *new_name)
4083 do_section(new_name);
4084 if (snum >= 0) {
4085 snum = lp_servicenumber(new_name);
4086 if (snum >= 0)
4087 lp_do_parameter(snum, "copy", lp_servicename(snum));
4092 /*******************************************************************
4093 Get the default server type we will announce as via nmbd.
4094 ********************************************************************/
4096 int lp_default_server_announce(void)
4098 return default_server_announce;
4101 /*******************************************************************
4102 Split the announce version into major and minor numbers.
4103 ********************************************************************/
4105 int lp_major_announce_version(void)
4107 static BOOL got_major = False;
4108 static int major_version = DEFAULT_MAJOR_VERSION;
4109 char *vers;
4110 char *p;
4112 if (got_major)
4113 return major_version;
4115 got_major = True;
4116 if ((vers = lp_announce_version()) == NULL)
4117 return major_version;
4119 if ((p = strchr_m(vers, '.')) == 0)
4120 return major_version;
4122 *p = '\0';
4123 major_version = atoi(vers);
4124 return major_version;
4127 int lp_minor_announce_version(void)
4129 static BOOL got_minor = False;
4130 static int minor_version = DEFAULT_MINOR_VERSION;
4131 char *vers;
4132 char *p;
4134 if (got_minor)
4135 return minor_version;
4137 got_minor = True;
4138 if ((vers = lp_announce_version()) == NULL)
4139 return minor_version;
4141 if ((p = strchr_m(vers, '.')) == 0)
4142 return minor_version;
4144 p++;
4145 minor_version = atoi(p);
4146 return minor_version;
4149 /***********************************************************
4150 Set the global name resolution order (used in smbclient).
4151 ************************************************************/
4153 void lp_set_name_resolve_order(const char *new_order)
4155 string_set(&Globals.szNameResolveOrder, new_order);
4158 const char *lp_printername(int snum)
4160 const char *ret = _lp_printername(snum);
4161 if (ret == NULL || (ret != NULL && *ret == '\0'))
4162 ret = lp_const_servicename(snum);
4164 return ret;
4168 /****************************************************************
4169 Compatibility fn. for 2.2.2 code.....
4170 *****************************************************************/
4172 void get_private_directory(pstring privdir)
4174 pstrcpy (privdir, lp_private_dir());
4177 /***********************************************************
4178 Allow daemons such as winbindd to fix their logfile name.
4179 ************************************************************/
4181 void lp_set_logfile(const char *name)
4183 string_set(&Globals.szLogFile, name);
4184 pstrcpy(debugf, name);
4187 /*******************************************************************
4188 Return the NetBIOS called name, or my IP - but never global_myname().
4189 ********************************************************************/
4191 const char *get_called_name(void)
4193 extern fstring local_machine;
4194 static fstring called_name;
4196 if (!*local_machine) {
4197 fstrcpy(called_name, get_my_primary_ip());
4198 DEBUG(8,("get_called_name: assuming that client used IP address [%s] as called name.\n",
4199 called_name));
4200 return called_name;
4203 return local_machine;
4206 /*******************************************************************
4207 Return the max print jobs per queue.
4208 ********************************************************************/
4210 int lp_maxprintjobs(int snum)
4212 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
4213 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
4214 maxjobs = PRINT_MAX_JOBID - 1;
4216 return maxjobs;
4219 /*******************************************************************
4220 Ensure we don't use sendfile if server smb signing is active.
4221 ********************************************************************/
4223 BOOL lp_use_sendfile(int snum)
4225 return (_lp_use_sendfile(snum) && !srv_is_signing_active());