/* [<][>][^][v][top][bottom][index][help] */
DEFINITIONS
This source file includes following definitions.
- init_printer_values
- max_open_files
- free_one_parameter_common
- free_one_parameter
- free_parameters
- free_one_parameter_by_snum
- free_parameters_by_snum
- free_global_parameters
- init_globals
- lp_string
- FN_GLOBAL_STRING
- lp_cachedir
- FN_GLOBAL_STRING
- FN_GLOBAL_LIST
- lp_int
- lp_ulong
- lp_bool
- lp_enum
- lp_parm_string
- lp_parm_talloc_string
- lp_parm_const_string
- lp_parm_string_list
- lp_parm_int
- lp_parm_ulong
- lp_parm_bool
- lp_parm_enum
- init_service
- free_param_opts
- free_service
- free_service_byindex
- add_a_service
- canonicalize_servicename
- hash_a_service
- lp_add_home
- lp_add_service
- lp_add_ipc
- lp_add_printer
- lp_parameter_is_valid
- lp_parameter_is_global
- lp_parameter_is_canonical
- lp_canonicalize_parameter
- lp_canonicalize_parameter_with_value
- map_parameter
- map_parameter_canonical
- is_synonym_of
- show_parameter
- show_parameter_list
- lp_string_is_valid_boolean
- get_boolean
- lp_invert_boolean
- lp_canonicalize_boolean
- getservicebyname
- set_param_opt
- copy_service
- service_ok
- lp_smbconf_ctx
- process_smbconf_service
- process_registry_service
- process_registry_globals
- process_registry_shares
- add_to_file_list
- free_file_list
- lp_config_backend_is_registry
- lp_config_backend_is_file
- lp_file_list_changed
- handle_netbios_name
- handle_charset
- handle_workgroup
- handle_netbios_scope
- handle_netbios_aliases
- handle_include
- handle_copy
- handle_ldap_debug_level
- lp_idmap_uid
- lp_idmap_gid
- handle_idmap_uid
- handle_idmap_gid
- handle_debug_list
- append_ldap_suffix
- lp_ldap_machine_suffix
- lp_ldap_user_suffix
- lp_ldap_group_suffix
- lp_ldap_idmap_suffix
- lp_set_enum_parm
- handle_printing
- init_copymap
- lp_local_ptr
- lp_local_ptr_by_snum
- lp_do_parameter
- do_parameter
- print_parameter
- equal_parameter
- init_locals
- do_section
- is_default
- dump_globals
- lp_is_default
- dump_a_service
- dump_a_parameter
- lp_get_parameter
- lp_next_parameter
- dump_copy_map
- lp_snum_ok
- lp_add_auto_services
- lp_add_one_printer
- lp_loaded
- lp_killunused
- lp_kill_all_services
- lp_killservice
- lp_save_defaults
- server_role_str
- set_server_role
- set_allowed_client_auth
- check_usershare_stat
- parse_usershare_file
- process_usershare_file
- usershare_exists
- load_usershare_service
- load_usershare_shares
- gfree_loadparm
- lp_set_in_client
- lp_is_in_client
- lp_load_ex
- lp_load
- lp_load_initial_only
- lp_load_with_registry_shares
- lp_numservices
- lp_dump
- lp_dump_one
- lp_servicenumber
- share_defined
- get_share_params
- share_list_all
- next_share
- next_printer
- snum2params_static
- volume_label
- set_default_server_announce_type
- lp_server_role
- lp_domain_master
- lp_preferred_master
- lp_remove_service
- lp_copy_service
- lp_default_server_announce
- lp_major_announce_version
- lp_minor_announce_version
- lp_set_name_resolve_order
- lp_printername
- lp_set_logfile
- lp_maxprintjobs
- lp_printcapname
- lp_disable_spoolss
- lp_set_spoolss_state
- lp_get_spoolss_state
- lp_use_sendfile
- set_use_sendfile
- set_store_dos_attributes
- lp_set_mangling_method
- lp_posix_pathnames
- lp_set_posix_pathnames
- lp_posix_cifsu_locktype
- lp_set_posix_default_cifsx_readwrite_locktype
- lp_min_receive_file_size
- lp_socket_address
- lp_set_passdb_backend
1 /*
2 Unix SMB/CIFS implementation.
3 Parameter loading functions
4 Copyright (C) Karl Auer 1993-1998
5
6 Largely re-written by Andrew Tridgell, September 1994
7
8 Copyright (C) Simo Sorce 2001
9 Copyright (C) Alexander Bokovoy 2002
10 Copyright (C) Stefan (metze) Metzmacher 2002
11 Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
12 Copyright (C) Michael Adam 2008
13
14 This program is free software; you can redistribute it and/or modify
15 it under the terms of the GNU General Public License as published by
16 the Free Software Foundation; either version 3 of the License, or
17 (at your option) any later version.
18
19 This program is distributed in the hope that it will be useful,
20 but WITHOUT ANY WARRANTY; without even the implied warranty of
21 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22 GNU General Public License for more details.
23
24 You should have received a copy of the GNU General Public License
25 along with this program. If not, see <http://www.gnu.org/licenses/>.
26 */
27
28 /*
29 * Load parameters.
30 *
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.
34 *
35 * To add a parameter:
36 *
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
42 *
43 *
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!
51 *
52 */
53
54 #include "includes.h"
55 #include "printing.h"
56
57 #ifdef HAVE_SYS_SYSCTL_H
58 #include <sys/sysctl.h>
59 #endif
60
61 bool bLoaded = False;
62
63 extern enum protocol_types Protocol;
64 extern userdom_struct current_user_info;
65
66 #ifndef GLOBAL_NAME
67 #define GLOBAL_NAME "global"
68 #endif
69
70 #ifndef PRINTERS_NAME
71 #define PRINTERS_NAME "printers"
72 #endif
73
74 #ifndef HOMES_NAME
75 #define HOMES_NAME "homes"
76 #endif
77
78 /* the special value for the include parameter
79 * to be interpreted not as a file name but to
80 * trigger loading of the global smb.conf options
81 * from registry. */
82 #ifndef INCLUDE_REGISTRY_NAME
83 #define INCLUDE_REGISTRY_NAME "registry"
84 #endif
85
86 static bool in_client = False; /* Not in the client by default */
87 static struct smbconf_csn conf_last_csn;
88
89 #define CONFIG_BACKEND_FILE 0
90 #define CONFIG_BACKEND_REGISTRY 1
91
92 static int config_backend = CONFIG_BACKEND_FILE;
93
94 /* some helpful bits */
95 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
96 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
97
98 #define USERSHARE_VALID 1
99 #define USERSHARE_PENDING_DELETE 2
100
101 static bool defaults_saved = False;
102
103 struct param_opt_struct {
104 struct param_opt_struct *prev, *next;
105 char *key;
106 char *value;
107 char **list;
108 };
109
110 /*
111 * This structure describes global (ie., server-wide) parameters.
112 */
113 struct global {
114 int ConfigBackend;
115 char *smb_ports;
116 char *dos_charset;
117 char *unix_charset;
118 char *display_charset;
119 char *szPrintcapname;
120 char *szAddPortCommand;
121 char *szEnumPortsCommand;
122 char *szAddPrinterCommand;
123 char *szDeletePrinterCommand;
124 char *szOs2DriverMap;
125 char *szLockDir;
126 char *szStateDir;
127 char *szCacheDir;
128 char *szPidDir;
129 char *szRootdir;
130 char *szDefaultService;
131 char *szGetQuota;
132 char *szSetQuota;
133 char *szMsgCommand;
134 char *szServerString;
135 char *szAutoServices;
136 char *szPasswdProgram;
137 char *szPasswdChat;
138 char *szLogFile;
139 char *szConfigFile;
140 char *szSMBPasswdFile;
141 char *szPrivateDir;
142 char *szPassdbBackend;
143 char **szPreloadModules;
144 char *szPasswordServer;
145 char *szSocketOptions;
146 char *szRealm;
147 char *szAfsUsernameMap;
148 int iAfsTokenLifetime;
149 char *szLogNtTokenCommand;
150 char *szUsernameMap;
151 char *szLogonScript;
152 char *szLogonPath;
153 char *szLogonDrive;
154 char *szLogonHome;
155 char **szWINSservers;
156 char **szInterfaces;
157 char *szRemoteAnnounce;
158 char *szRemoteBrowseSync;
159 char *szSocketAddress;
160 char *szNISHomeMapName;
161 char *szAnnounceVersion; /* This is initialised in init_globals */
162 char *szWorkgroup;
163 char *szNetbiosName;
164 char **szNetbiosAliases;
165 char *szNetbiosScope;
166 char *szNameResolveOrder;
167 char *szPanicAction;
168 char *szAddUserScript;
169 char *szRenameUserScript;
170 char *szDelUserScript;
171 char *szAddGroupScript;
172 char *szDelGroupScript;
173 char *szAddUserToGroupScript;
174 char *szDelUserFromGroupScript;
175 char *szSetPrimaryGroupScript;
176 char *szAddMachineScript;
177 char *szShutdownScript;
178 char *szAbortShutdownScript;
179 char *szUsernameMapScript;
180 char *szCheckPasswordScript;
181 char *szWINSHook;
182 char *szUtmpDir;
183 char *szWtmpDir;
184 bool bUtmp;
185 char *szIdmapUID;
186 char *szIdmapGID;
187 bool bPassdbExpandExplicit;
188 int AlgorithmicRidBase;
189 char *szTemplateHomedir;
190 char *szTemplateShell;
191 char *szWinbindSeparator;
192 bool bWinbindEnumUsers;
193 bool bWinbindEnumGroups;
194 bool bWinbindUseDefaultDomain;
195 bool bWinbindTrustedDomainsOnly;
196 bool bWinbindNestedGroups;
197 int winbind_expand_groups;
198 bool bWinbindRefreshTickets;
199 bool bWinbindOfflineLogon;
200 bool bWinbindNormalizeNames;
201 bool bWinbindRpcOnly;
202 char *szIdmapBackend;
203 char *szIdmapAllocBackend;
204 char *szAddShareCommand;
205 char *szChangeShareCommand;
206 char *szDeleteShareCommand;
207 char **szEventLogs;
208 char *szGuestaccount;
209 char *szManglingMethod;
210 char **szServicesList;
211 char *szUsersharePath;
212 char *szUsershareTemplateShare;
213 char **szUsersharePrefixAllowList;
214 char **szUsersharePrefixDenyList;
215 int mangle_prefix;
216 int max_log_size;
217 char *szLogLevel;
218 int max_xmit;
219 int max_mux;
220 int max_open_files;
221 int open_files_db_hash_size;
222 int pwordlevel;
223 int unamelevel;
224 int deadtime;
225 bool getwd_cache;
226 int maxprotocol;
227 int minprotocol;
228 int security;
229 char **AuthMethods;
230 bool paranoid_server_security;
231 int maxdisksize;
232 int lpqcachetime;
233 int iMaxSmbdProcesses;
234 bool bDisableSpoolss;
235 int syslog;
236 int os_level;
237 bool enhanced_browsing;
238 int max_ttl;
239 int max_wins_ttl;
240 int min_wins_ttl;
241 int lm_announce;
242 int lm_interval;
243 int announce_as; /* This is initialised in init_globals */
244 int machine_password_timeout;
245 int map_to_guest;
246 int oplock_break_wait_time;
247 int winbind_cache_time;
248 int winbind_reconnect_delay;
249 int winbind_max_idle_children;
250 char **szWinbindNssInfo;
251 int iLockSpinTime;
252 char *szLdapMachineSuffix;
253 char *szLdapUserSuffix;
254 char *szLdapIdmapSuffix;
255 char *szLdapGroupSuffix;
256 int ldap_ssl;
257 bool ldap_ssl_ads;
258 char *szLdapSuffix;
259 char *szLdapAdminDn;
260 int ldap_debug_level;
261 int ldap_debug_threshold;
262 int iAclCompat;
263 char *szCupsServer;
264 char *szIPrintServer;
265 char *ctdbdSocket;
266 char **szClusterAddresses;
267 bool clustering;
268 int ldap_passwd_sync;
269 int ldap_replication_sleep;
270 int ldap_timeout; /* This is initialised in init_globals */
271 int ldap_connection_timeout;
272 int ldap_page_size;
273 bool ldap_delete_dn;
274 bool bMsAddPrinterWizard;
275 bool bDNSproxy;
276 bool bWINSsupport;
277 bool bWINSproxy;
278 bool bLocalMaster;
279 int iPreferredMaster;
280 int iDomainMaster;
281 bool bDomainLogons;
282 char **szInitLogonDelayedHosts;
283 int InitLogonDelay;
284 bool bEncryptPasswords;
285 bool bUpdateEncrypt;
286 int clientSchannel;
287 int serverSchannel;
288 bool bNullPasswords;
289 bool bObeyPamRestrictions;
290 bool bLoadPrinters;
291 int PrintcapCacheTime;
292 bool bLargeReadwrite;
293 bool bReadRaw;
294 bool bWriteRaw;
295 bool bSyslogOnly;
296 bool bBrowseList;
297 bool bNISHomeMap;
298 bool bTimeServer;
299 bool bBindInterfacesOnly;
300 bool bPamPasswordChange;
301 bool bUnixPasswdSync;
302 bool bPasswdChatDebug;
303 int iPasswdChatTimeout;
304 bool bTimestampLogs;
305 bool bNTSmbSupport;
306 bool bNTPipeSupport;
307 bool bNTStatusSupport;
308 bool bStatCache;
309 int iMaxStatCacheSize;
310 bool bKernelOplocks;
311 bool bAllowTrustedDomains;
312 bool bLanmanAuth;
313 bool bNTLMAuth;
314 bool bUseSpnego;
315 bool bClientLanManAuth;
316 bool bClientNTLMv2Auth;
317 bool bClientPlaintextAuth;
318 bool bClientUseSpnego;
319 bool bDebugPrefixTimestamp;
320 bool bDebugHiresTimestamp;
321 bool bDebugPid;
322 bool bDebugUid;
323 bool bDebugClass;
324 bool bEnableCoreFiles;
325 bool bHostMSDfs;
326 bool bUseMmap;
327 bool bHostnameLookups;
328 bool bUnixExtensions;
329 bool bDisableNetbios;
330 char * szDedicatedKeytabFile;
331 int iKerberosMethod;
332 bool bDeferSharingViolations;
333 bool bEnablePrivileges;
334 bool bASUSupport;
335 bool bUsershareOwnerOnly;
336 bool bUsershareAllowGuests;
337 bool bRegistryShares;
338 int restrict_anonymous;
339 int name_cache_timeout;
340 int client_signing;
341 int server_signing;
342 int client_ldap_sasl_wrapping;
343 int iUsershareMaxShares;
344 int iIdmapCacheTime;
345 int iIdmapNegativeCacheTime;
346 bool bResetOnZeroVC;
347 int iKeepalive;
348 int iminreceivefile;
349 struct param_opt_struct *param_opt;
350 int cups_connection_timeout;
351 char *szSMBPerfcountModule;
352 bool bMapUntrustedToDomain;
353 };
354
355 static struct global Globals;
356
357 /*
358 * This structure describes a single service.
359 */
360 struct service {
361 bool valid;
362 bool autoloaded;
363 int usershare;
364 time_t usershare_last_mod;
365 char *szService;
366 char *szPath;
367 char *szUsername;
368 char **szInvalidUsers;
369 char **szValidUsers;
370 char **szAdminUsers;
371 char *szCopy;
372 char *szInclude;
373 char *szPreExec;
374 char *szPostExec;
375 char *szRootPreExec;
376 char *szRootPostExec;
377 char *szCupsOptions;
378 char *szPrintcommand;
379 char *szLpqcommand;
380 char *szLprmcommand;
381 char *szLppausecommand;
382 char *szLpresumecommand;
383 char *szQueuepausecommand;
384 char *szQueueresumecommand;
385 char *szPrintername;
386 char *szPrintjobUsername;
387 char *szDontdescend;
388 char **szHostsallow;
389 char **szHostsdeny;
390 char *szMagicScript;
391 char *szMagicOutput;
392 char *szVetoFiles;
393 char *szHideFiles;
394 char *szVetoOplockFiles;
395 char *comment;
396 char *force_user;
397 char *force_group;
398 char **readlist;
399 char **writelist;
400 char **printer_admin;
401 char *volume;
402 char *fstype;
403 char **szVfsObjects;
404 char *szMSDfsProxy;
405 char *szAioWriteBehind;
406 char *szDfree;
407 int iMinPrintSpace;
408 int iMaxPrintJobs;
409 int iMaxReportedPrintJobs;
410 int iWriteCacheSize;
411 int iCreate_mask;
412 int iCreate_force_mode;
413 int iSecurity_mask;
414 int iSecurity_force_mode;
415 int iDir_mask;
416 int iDir_force_mode;
417 int iDir_Security_mask;
418 int iDir_Security_force_mode;
419 int iMaxConnections;
420 int iDefaultCase;
421 int iPrinting;
422 int iOplockContentionLimit;
423 int iCSCPolicy;
424 int iBlock_size;
425 int iDfreeCacheTime;
426 bool bPreexecClose;
427 bool bRootpreexecClose;
428 int iCaseSensitive;
429 bool bCasePreserve;
430 bool bShortCasePreserve;
431 bool bHideDotFiles;
432 bool bHideSpecialFiles;
433 bool bHideUnReadable;
434 bool bHideUnWriteableFiles;
435 bool bBrowseable;
436 bool bAccessBasedShareEnum;
437 bool bAvailable;
438 bool bRead_only;
439 bool bNo_set_dir;
440 bool bGuest_only;
441 bool bAdministrative_share;
442 bool bGuest_ok;
443 bool bPrint_ok;
444 bool bMap_system;
445 bool bMap_hidden;
446 bool bMap_archive;
447 bool bStoreDosAttributes;
448 bool bDmapiSupport;
449 bool bLocking;
450 int iStrictLocking;
451 bool bPosixLocking;
452 bool bShareModes;
453 bool bOpLocks;
454 bool bLevel2OpLocks;
455 bool bOnlyUser;
456 bool bMangledNames;
457 bool bWidelinks;
458 bool bSymlinks;
459 bool bSyncAlways;
460 bool bStrictAllocate;
461 bool bStrictSync;
462 char magic_char;
463 struct bitmap *copymap;
464 bool bDeleteReadonly;
465 bool bFakeOplocks;
466 bool bDeleteVetoFiles;
467 bool bDosFilemode;
468 bool bDosFiletimes;
469 bool bDosFiletimeResolution;
470 bool bFakeDirCreateTimes;
471 bool bBlockingLocks;
472 bool bInheritPerms;
473 bool bInheritACLS;
474 bool bInheritOwner;
475 bool bMSDfsRoot;
476 bool bUseClientDriver;
477 bool bDefaultDevmode;
478 bool bForcePrintername;
479 bool bNTAclSupport;
480 bool bForceUnknownAclUser;
481 bool bUseSendfile;
482 bool bProfileAcls;
483 bool bMap_acl_inherit;
484 bool bAfs_Share;
485 bool bEASupport;
486 bool bAclCheckPermissions;
487 bool bAclMapFullControl;
488 bool bAclGroupControl;
489 bool bChangeNotify;
490 bool bKernelChangeNotify;
491 int iallocation_roundup_size;
492 int iAioReadSize;
493 int iAioWriteSize;
494 int iMap_readonly;
495 int iDirectoryNameCacheSize;
496 int ismb_encrypt;
497 struct param_opt_struct *param_opt;
498
499 char dummy[3]; /* for alignment */
500 };
501
502
503 /* This is a default service used to prime a services structure */
504 static struct service sDefault = {
505 True, /* valid */
506 False, /* not autoloaded */
507 0, /* not a usershare */
508 (time_t)0, /* No last mod time */
509 NULL, /* szService */
510 NULL, /* szPath */
511 NULL, /* szUsername */
512 NULL, /* szInvalidUsers */
513 NULL, /* szValidUsers */
514 NULL, /* szAdminUsers */
515 NULL, /* szCopy */
516 NULL, /* szInclude */
517 NULL, /* szPreExec */
518 NULL, /* szPostExec */
519 NULL, /* szRootPreExec */
520 NULL, /* szRootPostExec */
521 NULL, /* szCupsOptions */
522 NULL, /* szPrintcommand */
523 NULL, /* szLpqcommand */
524 NULL, /* szLprmcommand */
525 NULL, /* szLppausecommand */
526 NULL, /* szLpresumecommand */
527 NULL, /* szQueuepausecommand */
528 NULL, /* szQueueresumecommand */
529 NULL, /* szPrintername */
530 NULL, /* szPrintjobUsername */
531 NULL, /* szDontdescend */
532 NULL, /* szHostsallow */
533 NULL, /* szHostsdeny */
534 NULL, /* szMagicScript */
535 NULL, /* szMagicOutput */
536 NULL, /* szVetoFiles */
537 NULL, /* szHideFiles */
538 NULL, /* szVetoOplockFiles */
539 NULL, /* comment */
540 NULL, /* force user */
541 NULL, /* force group */
542 NULL, /* readlist */
543 NULL, /* writelist */
544 NULL, /* printer admin */
545 NULL, /* volume */
546 NULL, /* fstype */
547 NULL, /* vfs objects */
548 NULL, /* szMSDfsProxy */
549 NULL, /* szAioWriteBehind */
550 NULL, /* szDfree */
551 0, /* iMinPrintSpace */
552 1000, /* iMaxPrintJobs */
553 0, /* iMaxReportedPrintJobs */
554 0, /* iWriteCacheSize */
555 0744, /* iCreate_mask */
556 0000, /* iCreate_force_mode */
557 0777, /* iSecurity_mask */
558 0, /* iSecurity_force_mode */
559 0755, /* iDir_mask */
560 0000, /* iDir_force_mode */
561 0777, /* iDir_Security_mask */
562 0, /* iDir_Security_force_mode */
563 0, /* iMaxConnections */
564 CASE_LOWER, /* iDefaultCase */
565 DEFAULT_PRINTING, /* iPrinting */
566 2, /* iOplockContentionLimit */
567 0, /* iCSCPolicy */
568 1024, /* iBlock_size */
569 0, /* iDfreeCacheTime */
570 False, /* bPreexecClose */
571 False, /* bRootpreexecClose */
572 Auto, /* case sensitive */
573 True, /* case preserve */
574 True, /* short case preserve */
575 True, /* bHideDotFiles */
576 False, /* bHideSpecialFiles */
577 False, /* bHideUnReadable */
578 False, /* bHideUnWriteableFiles */
579 True, /* bBrowseable */
580 False, /* bAccessBasedShareEnum */
581 True, /* bAvailable */
582 True, /* bRead_only */
583 True, /* bNo_set_dir */
584 False, /* bGuest_only */
585 False, /* bAdministrative_share */
586 False, /* bGuest_ok */
587 False, /* bPrint_ok */
588 False, /* bMap_system */
589 False, /* bMap_hidden */
590 True, /* bMap_archive */
591 False, /* bStoreDosAttributes */
592 False, /* bDmapiSupport */
593 True, /* bLocking */
594 Auto, /* iStrictLocking */
595 True, /* bPosixLocking */
596 True, /* bShareModes */
597 True, /* bOpLocks */
598 True, /* bLevel2OpLocks */
599 False, /* bOnlyUser */
600 True, /* bMangledNames */
601 false, /* bWidelinks */
602 True, /* bSymlinks */
603 False, /* bSyncAlways */
604 False, /* bStrictAllocate */
605 False, /* bStrictSync */
606 '~', /* magic char */
607 NULL, /* copymap */
608 False, /* bDeleteReadonly */
609 False, /* bFakeOplocks */
610 False, /* bDeleteVetoFiles */
611 False, /* bDosFilemode */
612 True, /* bDosFiletimes */
613 False, /* bDosFiletimeResolution */
614 False, /* bFakeDirCreateTimes */
615 True, /* bBlockingLocks */
616 False, /* bInheritPerms */
617 False, /* bInheritACLS */
618 False, /* bInheritOwner */
619 False, /* bMSDfsRoot */
620 False, /* bUseClientDriver */
621 True, /* bDefaultDevmode */
622 False, /* bForcePrintername */
623 True, /* bNTAclSupport */
624 False, /* bForceUnknownAclUser */
625 False, /* bUseSendfile */
626 False, /* bProfileAcls */
627 False, /* bMap_acl_inherit */
628 False, /* bAfs_Share */
629 False, /* bEASupport */
630 True, /* bAclCheckPermissions */
631 True, /* bAclMapFullControl */
632 False, /* bAclGroupControl */
633 True, /* bChangeNotify */
634 True, /* bKernelChangeNotify */
635 SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
636 0, /* iAioReadSize */
637 0, /* iAioWriteSize */
638 MAP_READONLY_YES, /* iMap_readonly */
639 #ifdef BROKEN_DIRECTORY_HANDLING
640 0, /* iDirectoryNameCacheSize */
641 #else
642 100, /* iDirectoryNameCacheSize */
643 #endif
644 Auto, /* ismb_encrypt */
645 NULL, /* Parametric options */
646
647 "" /* dummy */
648 };
649
650 /* local variables */
651 static struct service **ServicePtrs = NULL;
652 static int iNumServices = 0;
653 static int iServiceIndex = 0;
654 static struct db_context *ServiceHash;
655 static int *invalid_services = NULL;
656 static int num_invalid_services = 0;
657 static bool bInGlobalSection = True;
658 static bool bGlobalOnly = False;
659 static int server_role;
660 static int default_server_announce;
661
662 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
663
664 /* prototypes for the special type handlers */
665 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
666 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
667 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
668 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
669 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
670 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
671 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
672 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
673 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
674 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
675 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
676 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
677
678 static void set_server_role(void);
679 static void set_default_server_announce_type(void);
680 static void set_allowed_client_auth(void);
681
682 static void *lp_local_ptr(struct service *service, void *ptr);
683
684 static void add_to_file_list(const char *fname, const char *subfname);
685
686 static const struct enum_list enum_protocol[] = {
687 {PROTOCOL_NT1, "NT1"},
688 {PROTOCOL_LANMAN2, "LANMAN2"},
689 {PROTOCOL_LANMAN1, "LANMAN1"},
690 {PROTOCOL_CORE, "CORE"},
691 {PROTOCOL_COREPLUS, "COREPLUS"},
692 {PROTOCOL_COREPLUS, "CORE+"},
693 {-1, NULL}
694 };
695
696 static const struct enum_list enum_security[] = {
697 {SEC_SHARE, "SHARE"},
698 {SEC_USER, "USER"},
699 {SEC_SERVER, "SERVER"},
700 {SEC_DOMAIN, "DOMAIN"},
701 #ifdef HAVE_ADS
702 {SEC_ADS, "ADS"},
703 #endif
704 {-1, NULL}
705 };
706
707 static const struct enum_list enum_printing[] = {
708 {PRINT_SYSV, "sysv"},
709 {PRINT_AIX, "aix"},
710 {PRINT_HPUX, "hpux"},
711 {PRINT_BSD, "bsd"},
712 {PRINT_QNX, "qnx"},
713 {PRINT_PLP, "plp"},
714 {PRINT_LPRNG, "lprng"},
715 {PRINT_CUPS, "cups"},
716 {PRINT_IPRINT, "iprint"},
717 {PRINT_LPRNT, "nt"},
718 {PRINT_LPROS2, "os2"},
719 #ifdef DEVELOPER
720 {PRINT_TEST, "test"},
721 {PRINT_VLP, "vlp"},
722 #endif /* DEVELOPER */
723 {-1, NULL}
724 };
725
726 static const struct enum_list enum_ldap_sasl_wrapping[] = {
727 {0, "plain"},
728 {ADS_AUTH_SASL_SIGN, "sign"},
729 {ADS_AUTH_SASL_SEAL, "seal"},
730 {-1, NULL}
731 };
732
733 static const struct enum_list enum_ldap_ssl[] = {
734 {LDAP_SSL_OFF, "no"},
735 {LDAP_SSL_OFF, "off"},
736 {LDAP_SSL_START_TLS, "start tls"},
737 {LDAP_SSL_START_TLS, "start_tls"},
738 {-1, NULL}
739 };
740
741 static const struct enum_list enum_ldap_passwd_sync[] = {
742 {LDAP_PASSWD_SYNC_OFF, "no"},
743 {LDAP_PASSWD_SYNC_OFF, "off"},
744 {LDAP_PASSWD_SYNC_ON, "yes"},
745 {LDAP_PASSWD_SYNC_ON, "on"},
746 {LDAP_PASSWD_SYNC_ONLY, "only"},
747 {-1, NULL}
748 };
749
750 /* Types of machine we can announce as. */
751 #define ANNOUNCE_AS_NT_SERVER 1
752 #define ANNOUNCE_AS_WIN95 2
753 #define ANNOUNCE_AS_WFW 3
754 #define ANNOUNCE_AS_NT_WORKSTATION 4
755
756 static const struct enum_list enum_announce_as[] = {
757 {ANNOUNCE_AS_NT_SERVER, "NT"},
758 {ANNOUNCE_AS_NT_SERVER, "NT Server"},
759 {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
760 {ANNOUNCE_AS_WIN95, "win95"},
761 {ANNOUNCE_AS_WFW, "WfW"},
762 {-1, NULL}
763 };
764
765 static const struct enum_list enum_map_readonly[] = {
766 {MAP_READONLY_NO, "no"},
767 {MAP_READONLY_NO, "false"},
768 {MAP_READONLY_NO, "0"},
769 {MAP_READONLY_YES, "yes"},
770 {MAP_READONLY_YES, "true"},
771 {MAP_READONLY_YES, "1"},
772 {MAP_READONLY_PERMISSIONS, "permissions"},
773 {MAP_READONLY_PERMISSIONS, "perms"},
774 {-1, NULL}
775 };
776
777 static const struct enum_list enum_case[] = {
778 {CASE_LOWER, "lower"},
779 {CASE_UPPER, "upper"},
780 {-1, NULL}
781 };
782
783 static const struct enum_list enum_bool_auto[] = {
784 {False, "No"},
785 {False, "False"},
786 {False, "0"},
787 {True, "Yes"},
788 {True, "True"},
789 {True, "1"},
790 {Auto, "Auto"},
791 {-1, NULL}
792 };
793
794 /* Client-side offline caching policy types */
795 #define CSC_POLICY_MANUAL 0
796 #define CSC_POLICY_DOCUMENTS 1
797 #define CSC_POLICY_PROGRAMS 2
798 #define CSC_POLICY_DISABLE 3
799
800 static const struct enum_list enum_csc_policy[] = {
801 {CSC_POLICY_MANUAL, "manual"},
802 {CSC_POLICY_DOCUMENTS, "documents"},
803 {CSC_POLICY_PROGRAMS, "programs"},
804 {CSC_POLICY_DISABLE, "disable"},
805 {-1, NULL}
806 };
807
808 /* SMB signing types. */
809 static const struct enum_list enum_smb_signing_vals[] = {
810 {False, "No"},
811 {False, "False"},
812 {False, "0"},
813 {False, "Off"},
814 {False, "disabled"},
815 {True, "Yes"},
816 {True, "True"},
817 {True, "1"},
818 {True, "On"},
819 {True, "enabled"},
820 {Auto, "auto"},
821 {Required, "required"},
822 {Required, "mandatory"},
823 {Required, "force"},
824 {Required, "forced"},
825 {Required, "enforced"},
826 {-1, NULL}
827 };
828
829 /* ACL compatibility options. */
830 static const struct enum_list enum_acl_compat_vals[] = {
831 { ACL_COMPAT_AUTO, "auto" },
832 { ACL_COMPAT_WINNT, "winnt" },
833 { ACL_COMPAT_WIN2K, "win2k" },
834 { -1, NULL}
835 };
836
837 /*
838 Do you want session setups at user level security with a invalid
839 password to be rejected or allowed in as guest? WinNT rejects them
840 but it can be a pain as it means "net view" needs to use a password
841
842 You have 3 choices in the setting of map_to_guest:
843
844 "Never" means session setups with an invalid password
845 are rejected. This is the default.
846
847 "Bad User" means session setups with an invalid password
848 are rejected, unless the username does not exist, in which case it
849 is treated as a guest login
850
851 "Bad Password" means session setups with an invalid password
852 are treated as a guest login
853
854 Note that map_to_guest only has an effect in user or server
855 level security.
856 */
857
858 static const struct enum_list enum_map_to_guest[] = {
859 {NEVER_MAP_TO_GUEST, "Never"},
860 {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
861 {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
862 {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
863 {-1, NULL}
864 };
865
866 /* Config backend options */
867
868 static const struct enum_list enum_config_backend[] = {
869 {CONFIG_BACKEND_FILE, "file"},
870 {CONFIG_BACKEND_REGISTRY, "registry"},
871 {-1, NULL}
872 };
873
874 /* ADS kerberos ticket verification options */
875
876 static const struct enum_list enum_kerberos_method[] = {
877 {KERBEROS_VERIFY_SECRETS, "default"},
878 {KERBEROS_VERIFY_SECRETS, "secrets only"},
879 {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
880 {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
881 {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
882 {-1, NULL}
883 };
884
885 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
886 *
887 * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
888 * screen in SWAT. This is used to exclude parameters as well as to squash all
889 * parameters that have been duplicated by pseudonyms.
890 *
891 * NOTE: To display a parameter in BASIC view set FLAG_BASIC
892 * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
893 * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
894 * respective views.
895 *
896 * NOTE2: Handling of duplicated (synonym) parameters:
897 * Only the first occurance of a parameter should be enabled by FLAG_BASIC
898 * and/or FLAG_ADVANCED. All duplicates following the first mention should be
899 * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
900 * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
901 */
902
903 static struct parm_struct parm_table[] = {
904 {N_("Base Options"), P_SEP, P_SEPARATOR},
905
906 {
907 .label = "dos charset",
908 .type = P_STRING,
909 .p_class = P_GLOBAL,
910 .ptr = &Globals.dos_charset,
911 .special = handle_charset,
912 .enum_list = NULL,
913 .flags = FLAG_ADVANCED
914 },
915 {
916 .label = "unix charset",
917 .type = P_STRING,
918 .p_class = P_GLOBAL,
919 .ptr = &Globals.unix_charset,
920 .special = handle_charset,
921 .enum_list = NULL,
922 .flags = FLAG_ADVANCED
923 },
924 {
925 .label = "display charset",
926 .type = P_STRING,
927 .p_class = P_GLOBAL,
928 .ptr = &Globals.display_charset,
929 .special = handle_charset,
930 .enum_list = NULL,
931 .flags = FLAG_ADVANCED
932 },
933 {
934 .label = "comment",
935 .type = P_STRING,
936 .p_class = P_LOCAL,
937 .ptr = &sDefault.comment,
938 .special = NULL,
939 .enum_list = NULL,
940 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
941 },
942 {
943 .label = "path",
944 .type = P_STRING,
945 .p_class = P_LOCAL,
946 .ptr = &sDefault.szPath,
947 .special = NULL,
948 .enum_list = NULL,
949 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
950 },
951 {
952 .label = "directory",
953 .type = P_STRING,
954 .p_class = P_LOCAL,
955 .ptr = &sDefault.szPath,
956 .special = NULL,
957 .enum_list = NULL,
958 .flags = FLAG_HIDE,
959 },
960 {
961 .label = "workgroup",
962 .type = P_USTRING,
963 .p_class = P_GLOBAL,
964 .ptr = &Globals.szWorkgroup,
965 .special = handle_workgroup,
966 .enum_list = NULL,
967 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
968 },
969 #ifdef WITH_ADS
970 {
971 .label = "realm",
972 .type = P_USTRING,
973 .p_class = P_GLOBAL,
974 .ptr = &Globals.szRealm,
975 .special = NULL,
976 .enum_list = NULL,
977 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
978 },
979 #endif
980 {
981 .label = "netbios name",
982 .type = P_USTRING,
983 .p_class = P_GLOBAL,
984 .ptr = &Globals.szNetbiosName,
985 .special = handle_netbios_name,
986 .enum_list = NULL,
987 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
988 },
989 {
990 .label = "netbios aliases",
991 .type = P_LIST,
992 .p_class = P_GLOBAL,
993 .ptr = &Globals.szNetbiosAliases,
994 .special = handle_netbios_aliases,
995 .enum_list = NULL,
996 .flags = FLAG_ADVANCED,
997 },
998 {
999 .label = "netbios scope",
1000 .type = P_USTRING,
1001 .p_class = P_GLOBAL,
1002 .ptr = &Globals.szNetbiosScope,
1003 .special = handle_netbios_scope,
1004 .enum_list = NULL,
1005 .flags = FLAG_ADVANCED,
1006 },
1007 {
1008 .label = "server string",
1009 .type = P_STRING,
1010 .p_class = P_GLOBAL,
1011 .ptr = &Globals.szServerString,
1012 .special = NULL,
1013 .enum_list = NULL,
1014 .flags = FLAG_BASIC | FLAG_ADVANCED,
1015 },
1016 {
1017 .label = "interfaces",
1018 .type = P_LIST,
1019 .p_class = P_GLOBAL,
1020 .ptr = &Globals.szInterfaces,
1021 .special = NULL,
1022 .enum_list = NULL,
1023 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1024 },
1025 {
1026 .label = "bind interfaces only",
1027 .type = P_BOOL,
1028 .p_class = P_GLOBAL,
1029 .ptr = &Globals.bBindInterfacesOnly,
1030 .special = NULL,
1031 .enum_list = NULL,
1032 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1033 },
1034 {
1035 .label = "config backend",
1036 .type = P_ENUM,
1037 .p_class = P_GLOBAL,
1038 .ptr = &Globals.ConfigBackend,
1039 .special = NULL,
1040 .enum_list = enum_config_backend,
1041 .flags = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
1042 },
1043
1044 {N_("Security Options"), P_SEP, P_SEPARATOR},
1045
1046 {
1047 .label = "security",
1048 .type = P_ENUM,
1049 .p_class = P_GLOBAL,
1050 .ptr = &Globals.security,
1051 .special = NULL,
1052 .enum_list = enum_security,
1053 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1054 },
1055 {
1056 .label = "auth methods",
1057 .type = P_LIST,
1058 .p_class = P_GLOBAL,
1059 .ptr = &Globals.AuthMethods,
1060 .special = NULL,
1061 .enum_list = NULL,
1062 .flags = FLAG_ADVANCED,
1063 },
1064 {
1065 .label = "encrypt passwords",
1066 .type = P_BOOL,
1067 .p_class = P_GLOBAL,
1068 .ptr = &Globals.bEncryptPasswords,
1069 .special = NULL,
1070 .enum_list = NULL,
1071 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
1072 },
1073 {
1074 .label = "update encrypted",
1075 .type = P_BOOL,
1076 .p_class = P_GLOBAL,
1077 .ptr = &Globals.bUpdateEncrypt,
1078 .special = NULL,
1079 .enum_list = NULL,
1080 .flags = FLAG_ADVANCED,
1081 },
1082 {
1083 .label = "client schannel",
1084 .type = P_ENUM,
1085 .p_class = P_GLOBAL,
1086 .ptr = &Globals.clientSchannel,
1087 .special = NULL,
1088 .enum_list = enum_bool_auto,
1089 .flags = FLAG_BASIC | FLAG_ADVANCED,
1090 },
1091 {
1092 .label = "server schannel",
1093 .type = P_ENUM,
1094 .p_class = P_GLOBAL,
1095 .ptr = &Globals.serverSchannel,
1096 .special = NULL,
1097 .enum_list = enum_bool_auto,
1098 .flags = FLAG_BASIC | FLAG_ADVANCED,
1099 },
1100 {
1101 .label = "allow trusted domains",
1102 .type = P_BOOL,
1103 .p_class = P_GLOBAL,
1104 .ptr = &Globals.bAllowTrustedDomains,
1105 .special = NULL,
1106 .enum_list = NULL,
1107 .flags = FLAG_ADVANCED,
1108 },
1109 {
1110 .label = "map to guest",
1111 .type = P_ENUM,
1112 .p_class = P_GLOBAL,
1113 .ptr = &Globals.map_to_guest,
1114 .special = NULL,
1115 .enum_list = enum_map_to_guest,
1116 .flags = FLAG_ADVANCED,
1117 },
1118 {
1119 .label = "null passwords",
1120 .type = P_BOOL,
1121 .p_class = P_GLOBAL,
1122 .ptr = &Globals.bNullPasswords,
1123 .special = NULL,
1124 .enum_list = NULL,
1125 .flags = FLAG_ADVANCED,
1126 },
1127 {
1128 .label = "obey pam restrictions",
1129 .type = P_BOOL,
1130 .p_class = P_GLOBAL,
1131 .ptr = &Globals.bObeyPamRestrictions,
1132 .special = NULL,
1133 .enum_list = NULL,
1134 .flags = FLAG_ADVANCED,
1135 },
1136 {
1137 .label = "password server",
1138 .type = P_STRING,
1139 .p_class = P_GLOBAL,
1140 .ptr = &Globals.szPasswordServer,
1141 .special = NULL,
1142 .enum_list = NULL,
1143 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1144 },
1145 {
1146 .label = "smb passwd file",
1147 .type = P_STRING,
1148 .p_class = P_GLOBAL,
1149 .ptr = &Globals.szSMBPasswdFile,
1150 .special = NULL,
1151 .enum_list = NULL,
1152 .flags = FLAG_ADVANCED,
1153 },
1154 {
1155 .label = "private dir",
1156 .type = P_STRING,
1157 .p_class = P_GLOBAL,
1158 .ptr = &Globals.szPrivateDir,
1159 .special = NULL,
1160 .enum_list = NULL,
1161 .flags = FLAG_ADVANCED,
1162 },
1163 {
1164 .label = "passdb backend",
1165 .type = P_STRING,
1166 .p_class = P_GLOBAL,
1167 .ptr = &Globals.szPassdbBackend,
1168 .special = NULL,
1169 .enum_list = NULL,
1170 .flags = FLAG_ADVANCED | FLAG_WIZARD,
1171 },
1172 {
1173 .label = "algorithmic rid base",
1174 .type = P_INTEGER,
1175 .p_class = P_GLOBAL,
1176 .ptr = &Globals.AlgorithmicRidBase,
1177 .special = NULL,
1178 .enum_list = NULL,
1179 .flags = FLAG_ADVANCED,
1180 },
1181 {
1182 .label = "root directory",
1183 .type = P_STRING,
1184 .p_class = P_GLOBAL,
1185 .ptr = &Globals.szRootdir,
1186 .special = NULL,
1187 .enum_list = NULL,
1188 .flags = FLAG_ADVANCED,
1189 },
1190 {
1191 .label = "root dir",
1192 .type = P_STRING,
1193 .p_class = P_GLOBAL,
1194 .ptr = &Globals.szRootdir,
1195 .special = NULL,
1196 .enum_list = NULL,
1197 .flags = FLAG_HIDE,
1198 },
1199 {
1200 .label = "root",
1201 .type = P_STRING,
1202 .p_class = P_GLOBAL,
1203 .ptr = &Globals.szRootdir,
1204 .special = NULL,
1205 .enum_list = NULL,
1206 .flags = FLAG_HIDE,
1207 },
1208 {
1209 .label = "guest account",
1210 .type = P_STRING,
1211 .p_class = P_GLOBAL,
1212 .ptr = &Globals.szGuestaccount,
1213 .special = NULL,
1214 .enum_list = NULL,
1215 .flags = FLAG_BASIC | FLAG_ADVANCED,
1216 },
1217 {
1218 .label = "enable privileges",
1219 .type = P_BOOL,
1220 .p_class = P_GLOBAL,
1221 .ptr = &Globals.bEnablePrivileges,
1222 .special = NULL,
1223 .enum_list = NULL,
1224 .flags = FLAG_ADVANCED,
1225 },
1226
1227 {
1228 .label = "pam password change",
1229 .type = P_BOOL,
1230 .p_class = P_GLOBAL,
1231 .ptr = &Globals.bPamPasswordChange,
1232 .special = NULL,
1233 .enum_list = NULL,
1234 .flags = FLAG_ADVANCED,
1235 },
1236 {
1237 .label = "passwd program",
1238 .type = P_STRING,
1239 .p_class = P_GLOBAL,
1240 .ptr = &Globals.szPasswdProgram,
1241 .special = NULL,
1242 .enum_list = NULL,
1243 .flags = FLAG_ADVANCED,
1244 },
1245 {
1246 .label = "passwd chat",
1247 .type = P_STRING,
1248 .p_class = P_GLOBAL,
1249 .ptr = &Globals.szPasswdChat,
1250 .special = NULL,
1251 .enum_list = NULL,
1252 .flags = FLAG_ADVANCED,
1253 },
1254 {
1255 .label = "passwd chat debug",
1256 .type = P_BOOL,
1257 .p_class = P_GLOBAL,
1258 .ptr = &Globals.bPasswdChatDebug,
1259 .special = NULL,
1260 .enum_list = NULL,
1261 .flags = FLAG_ADVANCED,
1262 },
1263 {
1264 .label = "passwd chat timeout",
1265 .type = P_INTEGER,
1266 .p_class = P_GLOBAL,
1267 .ptr = &Globals.iPasswdChatTimeout,
1268 .special = NULL,
1269 .enum_list = NULL,
1270 .flags = FLAG_ADVANCED,
1271 },
1272 {
1273 .label = "check password script",
1274 .type = P_STRING,
1275 .p_class = P_GLOBAL,
1276 .ptr = &Globals.szCheckPasswordScript,
1277 .special = NULL,
1278 .enum_list = NULL,
1279 .flags = FLAG_ADVANCED,
1280 },
1281 {
1282 .label = "username map",
1283 .type = P_STRING,
1284 .p_class = P_GLOBAL,
1285 .ptr = &Globals.szUsernameMap,
1286 .special = NULL,
1287 .enum_list = NULL,
1288 .flags = FLAG_ADVANCED,
1289 },
1290 {
1291 .label = "password level",
1292 .type = P_INTEGER,
1293 .p_class = P_GLOBAL,
1294 .ptr = &Globals.pwordlevel,
1295 .special = NULL,
1296 .enum_list = NULL,
1297 .flags = FLAG_ADVANCED,
1298 },
1299 {
1300 .label = "username level",
1301 .type = P_INTEGER,
1302 .p_class = P_GLOBAL,
1303 .ptr = &Globals.unamelevel,
1304 .special = NULL,
1305 .enum_list = NULL,
1306 .flags = FLAG_ADVANCED,
1307 },
1308 {
1309 .label = "unix password sync",
1310 .type = P_BOOL,
1311 .p_class = P_GLOBAL,
1312 .ptr = &Globals.bUnixPasswdSync,
1313 .special = NULL,
1314 .enum_list = NULL,
1315 .flags = FLAG_ADVANCED,
1316 },
1317 {
1318 .label = "restrict anonymous",
1319 .type = P_INTEGER,
1320 .p_class = P_GLOBAL,
1321 .ptr = &Globals.restrict_anonymous,
1322 .special = NULL,
1323 .enum_list = NULL,
1324 .flags = FLAG_ADVANCED,
1325 },
1326 {
1327 .label = "lanman auth",
1328 .type = P_BOOL,
1329 .p_class = P_GLOBAL,
1330 .ptr = &Globals.bLanmanAuth,
1331 .special = NULL,
1332 .enum_list = NULL,
1333 .flags = FLAG_ADVANCED,
1334 },
1335 {
1336 .label = "ntlm auth",
1337 .type = P_BOOL,
1338 .p_class = P_GLOBAL,
1339 .ptr = &Globals.bNTLMAuth,
1340 .special = NULL,
1341 .enum_list = NULL,
1342 .flags = FLAG_ADVANCED,
1343 },
1344 {
1345 .label = "client NTLMv2 auth",
1346 .type = P_BOOL,
1347 .p_class = P_GLOBAL,
1348 .ptr = &Globals.bClientNTLMv2Auth,
1349 .special = NULL,
1350 .enum_list = NULL,
1351 .flags = FLAG_ADVANCED,
1352 },
1353 {
1354 .label = "client lanman auth",
1355 .type = P_BOOL,
1356 .p_class = P_GLOBAL,
1357 .ptr = &Globals.bClientLanManAuth,
1358 .special = NULL,
1359 .enum_list = NULL,
1360 .flags = FLAG_ADVANCED,
1361 },
1362 {
1363 .label = "client plaintext auth",
1364 .type = P_BOOL,
1365 .p_class = P_GLOBAL,
1366 .ptr = &Globals.bClientPlaintextAuth,
1367 .special = NULL,
1368 .enum_list = NULL,
1369 .flags = FLAG_ADVANCED,
1370 },
1371 {
1372 .label = "username",
1373 .type = P_STRING,
1374 .p_class = P_LOCAL,
1375 .ptr = &sDefault.szUsername,
1376 .special = NULL,
1377 .enum_list = NULL,
1378 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1379 },
1380 {
1381 .label = "user",
1382 .type = P_STRING,
1383 .p_class = P_LOCAL,
1384 .ptr = &sDefault.szUsername,
1385 .special = NULL,
1386 .enum_list = NULL,
1387 .flags = FLAG_HIDE,
1388 },
1389 {
1390 .label = "users",
1391 .type = P_STRING,
1392 .p_class = P_LOCAL,
1393 .ptr = &sDefault.szUsername,
1394 .special = NULL,
1395 .enum_list = NULL,
1396 .flags = FLAG_HIDE,
1397 },
1398 {
1399 .label = "invalid users",
1400 .type = P_LIST,
1401 .p_class = P_LOCAL,
1402 .ptr = &sDefault.szInvalidUsers,
1403 .special = NULL,
1404 .enum_list = NULL,
1405 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1406 },
1407 {
1408 .label = "valid users",
1409 .type = P_LIST,
1410 .p_class = P_LOCAL,
1411 .ptr = &sDefault.szValidUsers,
1412 .special = NULL,
1413 .enum_list = NULL,
1414 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1415 },
1416 {
1417 .label = "admin users",
1418 .type = P_LIST,
1419 .p_class = P_LOCAL,
1420 .ptr = &sDefault.szAdminUsers,
1421 .special = NULL,
1422 .enum_list = NULL,
1423 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1424 },
1425 {
1426 .label = "read list",
1427 .type = P_LIST,
1428 .p_class = P_LOCAL,
1429 .ptr = &sDefault.readlist,
1430 .special = NULL,
1431 .enum_list = NULL,
1432 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1433 },
1434 {
1435 .label = "write list",
1436 .type = P_LIST,
1437 .p_class = P_LOCAL,
1438 .ptr = &sDefault.writelist,
1439 .special = NULL,
1440 .enum_list = NULL,
1441 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1442 },
1443 {
1444 .label = "printer admin",
1445 .type = P_LIST,
1446 .p_class = P_LOCAL,
1447 .ptr = &sDefault.printer_admin,
1448 .special = NULL,
1449 .enum_list = NULL,
1450 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
1451 },
1452 {
1453 .label = "force user",
1454 .type = P_STRING,
1455 .p_class = P_LOCAL,
1456 .ptr = &sDefault.force_user,
1457 .special = NULL,
1458 .enum_list = NULL,
1459 .flags = FLAG_ADVANCED | FLAG_SHARE,
1460 },
1461 {
1462 .label = "force group",
1463 .type = P_STRING,
1464 .p_class = P_LOCAL,
1465 .ptr = &sDefault.force_group,
1466 .special = NULL,
1467 .enum_list = NULL,
1468 .flags = FLAG_ADVANCED | FLAG_SHARE,
1469 },
1470 {
1471 .label = "group",
1472 .type = P_STRING,
1473 .p_class = P_LOCAL,
1474 .ptr = &sDefault.force_group,
1475 .special = NULL,
1476 .enum_list = NULL,
1477 .flags = FLAG_ADVANCED,
1478 },
1479 {
1480 .label = "read only",
1481 .type = P_BOOL,
1482 .p_class = P_LOCAL,
1483 .ptr = &sDefault.bRead_only,
1484 .special = NULL,
1485 .enum_list = NULL,
1486 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
1487 },
1488 {
1489 .label = "write ok",
1490 .type = P_BOOLREV,
1491 .p_class = P_LOCAL,
1492 .ptr = &sDefault.bRead_only,
1493 .special = NULL,
1494 .enum_list = NULL,
1495 .flags = FLAG_HIDE,
1496 },
1497 {
1498 .label = "writeable",
1499 .type = P_BOOLREV,
1500 .p_class = P_LOCAL,
1501 .ptr = &sDefault.bRead_only,
1502 .special = NULL,
1503 .enum_list = NULL,
1504 .flags = FLAG_HIDE,
1505 },
1506 {
1507 .label = "writable",
1508 .type = P_BOOLREV,
1509 .p_class = P_LOCAL,
1510 .ptr = &sDefault.bRead_only,
1511 .special = NULL,
1512 .enum_list = NULL,
1513 .flags = FLAG_HIDE,
1514 },
1515 {
1516 .label = "acl check permissions",
1517 .type = P_BOOL,
1518 .p_class = P_LOCAL,
1519 .ptr = &sDefault.bAclCheckPermissions,
1520 .special = NULL,
1521 .enum_list = NULL,
1522 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1523 },
1524 {
1525 .label = "acl group control",
1526 .type = P_BOOL,
1527 .p_class = P_LOCAL,
1528 .ptr = &sDefault.bAclGroupControl,
1529 .special = NULL,
1530 .enum_list = NULL,
1531 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1532 },
1533 {
1534 .label = "acl map full control",
1535 .type = P_BOOL,
1536 .p_class = P_LOCAL,
1537 .ptr = &sDefault.bAclMapFullControl,
1538 .special = NULL,
1539 .enum_list = NULL,
1540 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1541 },
1542 {
1543 .label = "create mask",
1544 .type = P_OCTAL,
1545 .p_class = P_LOCAL,
1546 .ptr = &sDefault.iCreate_mask,
1547 .special = NULL,
1548 .enum_list = NULL,
1549 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1550 },
1551 {
1552 .label = "create mode",
1553 .type = P_OCTAL,
1554 .p_class = P_LOCAL,
1555 .ptr = &sDefault.iCreate_mask,
1556 .special = NULL,
1557 .enum_list = NULL,
1558 .flags = FLAG_HIDE,
1559 },
1560 {
1561 .label = "force create mode",
1562 .type = P_OCTAL,
1563 .p_class = P_LOCAL,
1564 .ptr = &sDefault.iCreate_force_mode,
1565 .special = NULL,
1566 .enum_list = NULL,
1567 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1568 },
1569 {
1570 .label = "security mask",
1571 .type = P_OCTAL,
1572 .p_class = P_LOCAL,
1573 .ptr = &sDefault.iSecurity_mask,
1574 .special = NULL,
1575 .enum_list = NULL,
1576 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1577 },
1578 {
1579 .label = "force security mode",
1580 .type = P_OCTAL,
1581 .p_class = P_LOCAL,
1582 .ptr = &sDefault.iSecurity_force_mode,
1583 .special = NULL,
1584 .enum_list = NULL,
1585 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1586 },
1587 {
1588 .label = "directory mask",
1589 .type = P_OCTAL,
1590 .p_class = P_LOCAL,
1591 .ptr = &sDefault.iDir_mask,
1592 .special = NULL,
1593 .enum_list = NULL,
1594 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1595 },
1596 {
1597 .label = "directory mode",
1598 .type = P_OCTAL,
1599 .p_class = P_LOCAL,
1600 .ptr = &sDefault.iDir_mask,
1601 .special = NULL,
1602 .enum_list = NULL,
1603 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1604 },
1605 {
1606 .label = "force directory mode",
1607 .type = P_OCTAL,
1608 .p_class = P_LOCAL,
1609 .ptr = &sDefault.iDir_force_mode,
1610 .special = NULL,
1611 .enum_list = NULL,
1612 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1613 },
1614 {
1615 .label = "directory security mask",
1616 .type = P_OCTAL,
1617 .p_class = P_LOCAL,
1618 .ptr = &sDefault.iDir_Security_mask,
1619 .special = NULL,
1620 .enum_list = NULL,
1621 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1622 },
1623 {
1624 .label = "force directory security mode",
1625 .type = P_OCTAL,
1626 .p_class = P_LOCAL,
1627 .ptr = &sDefault.iDir_Security_force_mode,
1628 .special = NULL,
1629 .enum_list = NULL,
1630 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1631 },
1632 {
1633 .label = "force unknown acl user",
1634 .type = P_BOOL,
1635 .p_class = P_LOCAL,
1636 .ptr = &sDefault.bForceUnknownAclUser,
1637 .special = NULL,
1638 .enum_list = NULL,
1639 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
1640 },
1641 {
1642 .label = "inherit permissions",
1643 .type = P_BOOL,
1644 .p_class = P_LOCAL,
1645 .ptr = &sDefault.bInheritPerms,
1646 .special = NULL,
1647 .enum_list = NULL,
1648 .flags = FLAG_ADVANCED | FLAG_SHARE,
1649 },
1650 {
1651 .label = "inherit acls",
1652 .type = P_BOOL,
1653 .p_class = P_LOCAL,
1654 .ptr = &sDefault.bInheritACLS,
1655 .special = NULL,
1656 .enum_list = NULL,
1657 .flags = FLAG_ADVANCED | FLAG_SHARE,
1658 },
1659 {
1660 .label = "inherit owner",
1661 .type = P_BOOL,
1662 .p_class = P_LOCAL,
1663 .ptr = &sDefault.bInheritOwner,
1664 .special = NULL,
1665 .enum_list = NULL,
1666 .flags = FLAG_ADVANCED | FLAG_SHARE,
1667 },
1668 {
1669 .label = "guest only",
1670 .type = P_BOOL,
1671 .p_class = P_LOCAL,
1672 .ptr = &sDefault.bGuest_only,
1673 .special = NULL,
1674 .enum_list = NULL,
1675 .flags = FLAG_ADVANCED | FLAG_SHARE,
1676 },
1677 {
1678 .label = "only guest",
1679 .type = P_BOOL,
1680 .p_class = P_LOCAL,
1681 .ptr = &sDefault.bGuest_only,
1682 .special = NULL,
1683 .enum_list = NULL,
1684 .flags = FLAG_HIDE,
1685 },
1686 {
1687 .label = "administrative share",
1688 .type = P_BOOL,
1689 .p_class = P_LOCAL,
1690 .ptr = &sDefault.bAdministrative_share,
1691 .special = NULL,
1692 .enum_list = NULL,
1693 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1694 },
1695
1696 {
1697 .label = "guest ok",
1698 .type = P_BOOL,
1699 .p_class = P_LOCAL,
1700 .ptr = &sDefault.bGuest_ok,
1701 .special = NULL,
1702 .enum_list = NULL,
1703 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1704 },
1705 {
1706 .label = "public",
1707 .type = P_BOOL,
1708 .p_class = P_LOCAL,
1709 .ptr = &sDefault.bGuest_ok,
1710 .special = NULL,
1711 .enum_list = NULL,
1712 .flags = FLAG_HIDE,
1713 },
1714 {
1715 .label = "only user",
1716 .type = P_BOOL,
1717 .p_class = P_LOCAL,
1718 .ptr = &sDefault.bOnlyUser,
1719 .special = NULL,
1720 .enum_list = NULL,
1721 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
1722 },
1723 {
1724 .label = "hosts allow",
1725 .type = P_LIST,
1726 .p_class = P_LOCAL,
1727 .ptr = &sDefault.szHostsallow,
1728 .special = NULL,
1729 .enum_list = NULL,
1730 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1731 },
1732 {
1733 .label = "allow hosts",
1734 .type = P_LIST,
1735 .p_class = P_LOCAL,
1736 .ptr = &sDefault.szHostsallow,
1737 .special = NULL,
1738 .enum_list = NULL,
1739 .flags = FLAG_HIDE,
1740 },
1741 {
1742 .label = "hosts deny",
1743 .type = P_LIST,
1744 .p_class = P_LOCAL,
1745 .ptr = &sDefault.szHostsdeny,
1746 .special = NULL,
1747 .enum_list = NULL,
1748 .flags = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
1749 },
1750 {
1751 .label = "deny hosts",
1752 .type = P_LIST,
1753 .p_class = P_LOCAL,
1754 .ptr = &sDefault.szHostsdeny,
1755 .special = NULL,
1756 .enum_list = NULL,
1757 .flags = FLAG_HIDE,
1758 },
1759 {
1760 .label = "preload modules",
1761 .type = P_LIST,
1762 .p_class = P_GLOBAL,
1763 .ptr = &Globals.szPreloadModules,
1764 .special = NULL,
1765 .enum_list = NULL,
1766 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1767 },
1768 {
1769 .label = "dedicated keytab file",
1770 .type = P_STRING,
1771 .p_class = P_GLOBAL,
1772 .ptr = &Globals.szDedicatedKeytabFile,
1773 .special = NULL,
1774 .enum_list = NULL,
1775 .flags = FLAG_ADVANCED,
1776 },
1777 {
1778 .label = "kerberos method",
1779 .type = P_ENUM,
1780 .p_class = P_GLOBAL,
1781 .ptr = &Globals.iKerberosMethod,
1782 .special = NULL,
1783 .enum_list = enum_kerberos_method,
1784 .flags = FLAG_ADVANCED,
1785 },
1786 {
1787 .label = "map untrusted to domain",
1788 .type = P_BOOL,
1789 .p_class = P_GLOBAL,
1790 .ptr = &Globals.bMapUntrustedToDomain,
1791 .special = NULL,
1792 .enum_list = NULL,
1793 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
1794 },
1795
1796
1797 {N_("Logging Options"), P_SEP, P_SEPARATOR},
1798
1799 {
1800 .label = "log level",
1801 .type = P_STRING,
1802 .p_class = P_GLOBAL,
1803 .ptr = &Globals.szLogLevel,
1804 .special = handle_debug_list,
1805 .enum_list = NULL,
1806 .flags = FLAG_ADVANCED,
1807 },
1808 {
1809 .label = "debuglevel",
1810 .type = P_STRING,
1811 .p_class = P_GLOBAL,
1812 .ptr = &Globals.szLogLevel,
1813 .special = handle_debug_list,
1814 .enum_list = NULL,
1815 .flags = FLAG_HIDE,
1816 },
1817 {
1818 .label = "syslog",
1819 .type = P_INTEGER,
1820 .p_class = P_GLOBAL,
1821 .ptr = &Globals.syslog,
1822 .special = NULL,
1823 .enum_list = NULL,
1824 .flags = FLAG_ADVANCED,
1825 },
1826 {
1827 .label = "syslog only",
1828 .type = P_BOOL,
1829 .p_class = P_GLOBAL,
1830 .ptr = &Globals.bSyslogOnly,
1831 .special = NULL,
1832 .enum_list = NULL,
1833 .flags = FLAG_ADVANCED,
1834 },
1835 {
1836 .label = "log file",
1837 .type = P_STRING,
1838 .p_class = P_GLOBAL,
1839 .ptr = &Globals.szLogFile,
1840 .special = NULL,
1841 .enum_list = NULL,
1842 .flags = FLAG_ADVANCED,
1843 },
1844 {
1845 .label = "max log size",
1846 .type = P_INTEGER,
1847 .p_class = P_GLOBAL,
1848 .ptr = &Globals.max_log_size,
1849 .special = NULL,
1850 .enum_list = NULL,
1851 .flags = FLAG_ADVANCED,
1852 },
1853 {
1854 .label = "debug timestamp",
1855 .type = P_BOOL,
1856 .p_class = P_GLOBAL,
1857 .ptr = &Globals.bTimestampLogs,
1858 .special = NULL,
1859 .enum_list = NULL,
1860 .flags = FLAG_ADVANCED,
1861 },
1862 {
1863 .label = "timestamp logs",
1864 .type = P_BOOL,
1865 .p_class = P_GLOBAL,
1866 .ptr = &Globals.bTimestampLogs,
1867 .special = NULL,
1868 .enum_list = NULL,
1869 .flags = FLAG_ADVANCED,
1870 },
1871 {
1872 .label = "debug prefix timestamp",
1873 .type = P_BOOL,
1874 .p_class = P_GLOBAL,
1875 .ptr = &Globals.bDebugPrefixTimestamp,
1876 .special = NULL,
1877 .enum_list = NULL,
1878 .flags = FLAG_ADVANCED,
1879 },
1880 {
1881 .label = "debug hires timestamp",
1882 .type = P_BOOL,
1883 .p_class = P_GLOBAL,
1884 .ptr = &Globals.bDebugHiresTimestamp,
1885 .special = NULL,
1886 .enum_list = NULL,
1887 .flags = FLAG_ADVANCED,
1888 },
1889 {
1890 .label = "debug pid",
1891 .type = P_BOOL,
1892 .p_class = P_GLOBAL,
1893 .ptr = &Globals.bDebugPid,
1894 .special = NULL,
1895 .enum_list = NULL,
1896 .flags = FLAG_ADVANCED,
1897 },
1898 {
1899 .label = "debug uid",
1900 .type = P_BOOL,
1901 .p_class = P_GLOBAL,
1902 .ptr = &Globals.bDebugUid,
1903 .special = NULL,
1904 .enum_list = NULL,
1905 .flags = FLAG_ADVANCED,
1906 },
1907 {
1908 .label = "debug class",
1909 .type = P_BOOL,
1910 .p_class = P_GLOBAL,
1911 .ptr = &Globals.bDebugClass,
1912 .special = NULL,
1913 .enum_list = NULL,
1914 .flags = FLAG_ADVANCED,
1915 },
1916 {
1917 .label = "enable core files",
1918 .type = P_BOOL,
1919 .p_class = P_GLOBAL,
1920 .ptr = &Globals.bEnableCoreFiles,
1921 .special = NULL,
1922 .enum_list = NULL,
1923 .flags = FLAG_ADVANCED,
1924 },
1925
1926 {N_("Protocol Options"), P_SEP, P_SEPARATOR},
1927
1928 {
1929 .label = "allocation roundup size",
1930 .type = P_INTEGER,
1931 .p_class = P_LOCAL,
1932 .ptr = &sDefault.iallocation_roundup_size,
1933 .special = NULL,
1934 .enum_list = NULL,
1935 .flags = FLAG_ADVANCED,
1936 },
1937 {
1938 .label = "aio read size",
1939 .type = P_INTEGER,
1940 .p_class = P_LOCAL,
1941 .ptr = &sDefault.iAioReadSize,
1942 .special = NULL,
1943 .enum_list = NULL,
1944 .flags = FLAG_ADVANCED,
1945 },
1946 {
1947 .label = "aio write size",
1948 .type = P_INTEGER,
1949 .p_class = P_LOCAL,
1950 .ptr = &sDefault.iAioWriteSize,
1951 .special = NULL,
1952 .enum_list = NULL,
1953 .flags = FLAG_ADVANCED,
1954 },
1955 {
1956 .label = "aio write behind",
1957 .type = P_STRING,
1958 .p_class = P_LOCAL,
1959 .ptr = &sDefault.szAioWriteBehind,
1960 .special = NULL,
1961 .enum_list = NULL,
1962 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
1963 },
1964 {
1965 .label = "smb ports",
1966 .type = P_STRING,
1967 .p_class = P_GLOBAL,
1968 .ptr = &Globals.smb_ports,
1969 .special = NULL,
1970 .enum_list = NULL,
1971 .flags = FLAG_ADVANCED,
1972 },
1973 {
1974 .label = "large readwrite",
1975 .type = P_BOOL,
1976 .p_class = P_GLOBAL,
1977 .ptr = &Globals.bLargeReadwrite,
1978 .special = NULL,
1979 .enum_list = NULL,
1980 .flags = FLAG_ADVANCED,
1981 },
1982 {
1983 .label = "max protocol",
1984 .type = P_ENUM,
1985 .p_class = P_GLOBAL,
1986 .ptr = &Globals.maxprotocol,
1987 .special = NULL,
1988 .enum_list = enum_protocol,
1989 .flags = FLAG_ADVANCED,
1990 },
1991 {
1992 .label = "protocol",
1993 .type = P_ENUM,
1994 .p_class = P_GLOBAL,
1995 .ptr = &Globals.maxprotocol,
1996 .special = NULL,
1997 .enum_list = enum_protocol,
1998 .flags = FLAG_ADVANCED,
1999 },
2000 {
2001 .label = "min protocol",
2002 .type = P_ENUM,
2003 .p_class = P_GLOBAL,
2004 .ptr = &Globals.minprotocol,
2005 .special = NULL,
2006 .enum_list = enum_protocol,
2007 .flags = FLAG_ADVANCED,
2008 },
2009 {
2010 .label = "min receivefile size",
2011 .type = P_INTEGER,
2012 .p_class = P_GLOBAL,
2013 .ptr = &Globals.iminreceivefile,
2014 .special = NULL,
2015 .enum_list = NULL,
2016 .flags = FLAG_ADVANCED,
2017 },
2018 {
2019 .label = "read raw",
2020 .type = P_BOOL,
2021 .p_class = P_GLOBAL,
2022 .ptr = &Globals.bReadRaw,
2023 .special = NULL,
2024 .enum_list = NULL,
2025 .flags = FLAG_ADVANCED,
2026 },
2027 {
2028 .label = "write raw",
2029 .type = P_BOOL,
2030 .p_class = P_GLOBAL,
2031 .ptr = &Globals.bWriteRaw,
2032 .special = NULL,
2033 .enum_list = NULL,
2034 .flags = FLAG_ADVANCED,
2035 },
2036 {
2037 .label = "disable netbios",
2038 .type = P_BOOL,
2039 .p_class = P_GLOBAL,
2040 .ptr = &Globals.bDisableNetbios,
2041 .special = NULL,
2042 .enum_list = NULL,
2043 .flags = FLAG_ADVANCED,
2044 },
2045 {
2046 .label = "reset on zero vc",
2047 .type = P_BOOL,
2048 .p_class = P_GLOBAL,
2049 .ptr = &Globals.bResetOnZeroVC,
2050 .special = NULL,
2051 .enum_list = NULL,
2052 .flags = FLAG_ADVANCED,
2053 },
2054 {
2055 .label = "acl compatibility",
2056 .type = P_ENUM,
2057 .p_class = P_GLOBAL,
2058 .ptr = &Globals.iAclCompat,
2059 .special = NULL,
2060 .enum_list = enum_acl_compat_vals,
2061 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2062 },
2063 {
2064 .label = "defer sharing violations",
2065 .type = P_BOOL,
2066 .p_class = P_GLOBAL,
2067 .ptr = &Globals.bDeferSharingViolations,
2068 .special = NULL,
2069 .enum_list = NULL,
2070 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2071 },
2072 {
2073 .label = "ea support",
2074 .type = P_BOOL,
2075 .p_class = P_LOCAL,
2076 .ptr = &sDefault.bEASupport,
2077 .special = NULL,
2078 .enum_list = NULL,
2079 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2080 },
2081 {
2082 .label = "nt acl support",
2083 .type = P_BOOL,
2084 .p_class = P_LOCAL,
2085 .ptr = &sDefault.bNTAclSupport,
2086 .special = NULL,
2087 .enum_list = NULL,
2088 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2089 },
2090 {
2091 .label = "nt pipe support",
2092 .type = P_BOOL,
2093 .p_class = P_GLOBAL,
2094 .ptr = &Globals.bNTPipeSupport,
2095 .special = NULL,
2096 .enum_list = NULL,
2097 .flags = FLAG_ADVANCED,
2098 },
2099 {
2100 .label = "nt status support",
2101 .type = P_BOOL,
2102 .p_class = P_GLOBAL,
2103 .ptr = &Globals.bNTStatusSupport,
2104 .special = NULL,
2105 .enum_list = NULL,
2106 .flags = FLAG_ADVANCED,
2107 },
2108 {
2109 .label = "profile acls",
2110 .type = P_BOOL,
2111 .p_class = P_LOCAL,
2112 .ptr = &sDefault.bProfileAcls,
2113 .special = NULL,
2114 .enum_list = NULL,
2115 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
2116 },
2117 {
2118 .label = "announce version",
2119 .type = P_STRING,
2120 .p_class = P_GLOBAL,
2121 .ptr = &Globals.szAnnounceVersion,
2122 .special = NULL,
2123 .enum_list = NULL,
2124 .flags = FLAG_ADVANCED,
2125 },
2126 {
2127 .label = "announce as",
2128 .type = P_ENUM,
2129 .p_class = P_GLOBAL,
2130 .ptr = &Globals.announce_as,
2131 .special = NULL,
2132 .enum_list = enum_announce_as,
2133 .flags = FLAG_ADVANCED,
2134 },
2135 {
2136 .label = "map acl inherit",
2137 .type = P_BOOL,
2138 .p_class = P_LOCAL,
2139 .ptr = &sDefault.bMap_acl_inherit,
2140 .special = NULL,
2141 .enum_list = NULL,
2142 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2143 },
2144 {
2145 .label = "afs share",
2146 .type = P_BOOL,
2147 .p_class = P_LOCAL,
2148 .ptr = &sDefault.bAfs_Share,
2149 .special = NULL,
2150 .enum_list = NULL,
2151 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2152 },
2153 {
2154 .label = "max mux",
2155 .type = P_INTEGER,
2156 .p_class = P_GLOBAL,
2157 .ptr = &Globals.max_mux,
2158 .special = NULL,
2159 .enum_list = NULL,
2160 .flags = FLAG_ADVANCED,
2161 },
2162 {
2163 .label = "max xmit",
2164 .type = P_INTEGER,
2165 .p_class = P_GLOBAL,
2166 .ptr = &Globals.max_xmit,
2167 .special = NULL,
2168 .enum_list = NULL,
2169 .flags = FLAG_ADVANCED,
2170 },
2171 {
2172 .label = "name resolve order",
2173 .type = P_STRING,
2174 .p_class = P_GLOBAL,
2175 .ptr = &Globals.szNameResolveOrder,
2176 .special = NULL,
2177 .enum_list = NULL,
2178 .flags = FLAG_ADVANCED | FLAG_WIZARD,
2179 },
2180 {
2181 .label = "max ttl",
2182 .type = P_INTEGER,
2183 .p_class = P_GLOBAL,
2184 .ptr = &Globals.max_ttl,
2185 .special = NULL,
2186 .enum_list = NULL,
2187 .flags = FLAG_ADVANCED,
2188 },
2189 {
2190 .label = "max wins ttl",
2191 .type = P_INTEGER,
2192 .p_class = P_GLOBAL,
2193 .ptr = &Globals.max_wins_ttl,
2194 .special = NULL,
2195 .enum_list = NULL,
2196 .flags = FLAG_ADVANCED,
2197 },
2198 {
2199 .label = "min wins ttl",
2200 .type = P_INTEGER,
2201 .p_class = P_GLOBAL,
2202 .ptr = &Globals.min_wins_ttl,
2203 .special = NULL,
2204 .enum_list = NULL,
2205 .flags = FLAG_ADVANCED,
2206 },
2207 {
2208 .label = "time server",
2209 .type = P_BOOL,
2210 .p_class = P_GLOBAL,
2211 .ptr = &Globals.bTimeServer,
2212 .special = NULL,
2213 .enum_list = NULL,
2214 .flags = FLAG_ADVANCED,
2215 },
2216 {
2217 .label = "unix extensions",
2218 .type = P_BOOL,
2219 .p_class = P_GLOBAL,
2220 .ptr = &Globals.bUnixExtensions,
2221 .special = NULL,
2222 .enum_list = NULL,
2223 .flags = FLAG_ADVANCED,
2224 },
2225 {
2226 .label = "use spnego",
2227 .type = P_BOOL,
2228 .p_class = P_GLOBAL,
2229 .ptr = &Globals.bUseSpnego,
2230 .special = NULL,
2231 .enum_list = NULL,
2232 .flags = FLAG_ADVANCED,
2233 },
2234 {
2235 .label = "client signing",
2236 .type = P_ENUM,
2237 .p_class = P_GLOBAL,
2238 .ptr = &Globals.client_signing,
2239 .special = NULL,
2240 .enum_list = enum_smb_signing_vals,
2241 .flags = FLAG_ADVANCED,
2242 },
2243 {
2244 .label = "server signing",
2245 .type = P_ENUM,
2246 .p_class = P_GLOBAL,
2247 .ptr = &Globals.server_signing,
2248 .special = NULL,
2249 .enum_list = enum_smb_signing_vals,
2250 .flags = FLAG_ADVANCED,
2251 },
2252 {
2253 .label = "smb encrypt",
2254 .type = P_ENUM,
2255 .p_class = P_LOCAL,
2256 .ptr = &sDefault.ismb_encrypt,
2257 .special = NULL,
2258 .enum_list = enum_smb_signing_vals,
2259 .flags = FLAG_ADVANCED,
2260 },
2261 {
2262 .label = "client use spnego",
2263 .type = P_BOOL,
2264 .p_class = P_GLOBAL,
2265 .ptr = &Globals.bClientUseSpnego,
2266 .special = NULL,
2267 .enum_list = NULL,
2268 .flags = FLAG_ADVANCED,
2269 },
2270 {
2271 .label = "client ldap sasl wrapping",
2272 .type = P_ENUM,
2273 .p_class = P_GLOBAL,
2274 .ptr = &Globals.client_ldap_sasl_wrapping,
2275 .special = NULL,
2276 .enum_list = enum_ldap_sasl_wrapping,
2277 .flags = FLAG_ADVANCED,
2278 },
2279 {
2280 .label = "enable asu support",
2281 .type = P_BOOL,
2282 .p_class = P_GLOBAL,
2283 .ptr = &Globals.bASUSupport,
2284 .special = NULL,
2285 .enum_list = NULL,
2286 .flags = FLAG_ADVANCED,
2287 },
2288 {
2289 .label = "svcctl list",
2290 .type = P_LIST,
2291 .p_class = P_GLOBAL,
2292 .ptr = &Globals.szServicesList,
2293 .special = NULL,
2294 .enum_list = NULL,
2295 .flags = FLAG_ADVANCED,
2296 },
2297
2298 {N_("Tuning Options"), P_SEP, P_SEPARATOR},
2299
2300 {
2301 .label = "block size",
2302 .type = P_INTEGER,
2303 .p_class = P_LOCAL,
2304 .ptr = &sDefault.iBlock_size,
2305 .special = NULL,
2306 .enum_list = NULL,
2307 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2308 },
2309 {
2310 .label = "deadtime",
2311 .type = P_INTEGER,
2312 .p_class = P_GLOBAL,
2313 .ptr = &Globals.deadtime,
2314 .special = NULL,
2315 .enum_list = NULL,
2316 .flags = FLAG_ADVANCED,
2317 },
2318 {
2319 .label = "getwd cache",
2320 .type = P_BOOL,
2321 .p_class = P_GLOBAL,
2322 .ptr = &Globals.getwd_cache,
2323 .special = NULL,
2324 .enum_list = NULL,
2325 .flags = FLAG_ADVANCED,
2326 },
2327 {
2328 .label = "keepalive",
2329 .type = P_INTEGER,
2330 .p_class = P_GLOBAL,
2331 .ptr = &Globals.iKeepalive,
2332 .special = NULL,
2333 .enum_list = NULL,
2334 .flags = FLAG_ADVANCED,
2335 },
2336 {
2337 .label = "change notify",
2338 .type = P_BOOL,
2339 .p_class = P_LOCAL,
2340 .ptr = &sDefault.bChangeNotify,
2341 .special = NULL,
2342 .enum_list = NULL,
2343 .flags = FLAG_ADVANCED | FLAG_SHARE,
2344 },
2345 {
2346 .label = "directory name cache size",
2347 .type = P_INTEGER,
2348 .p_class = P_LOCAL,
2349 .ptr = &sDefault.iDirectoryNameCacheSize,
2350 .special = NULL,
2351 .enum_list = NULL,
2352 .flags = FLAG_ADVANCED | FLAG_SHARE,
2353 },
2354 {
2355 .label = "kernel change notify",
2356 .type = P_BOOL,
2357 .p_class = P_LOCAL,
2358 .ptr = &sDefault.bKernelChangeNotify,
2359 .special = NULL,
2360 .enum_list = NULL,
2361 .flags = FLAG_ADVANCED | FLAG_SHARE,
2362 },
2363 {
2364 .label = "lpq cache time",
2365 .type = P_INTEGER,
2366 .p_class = P_GLOBAL,
2367 .ptr = &Globals.lpqcachetime,
2368 .special = NULL,
2369 .enum_list = NULL,
2370 .flags = FLAG_ADVANCED,
2371 },
2372 {
2373 .label = "max smbd processes",
2374 .type = P_INTEGER,
2375 .p_class = P_GLOBAL,
2376 .ptr = &Globals.iMaxSmbdProcesses,
2377 .special = NULL,
2378 .enum_list = NULL,
2379 .flags = FLAG_ADVANCED,
2380 },
2381 {
2382 .label = "max connections",
2383 .type = P_INTEGER,
2384 .p_class = P_LOCAL,
2385 .ptr = &sDefault.iMaxConnections,
2386 .special = NULL,
2387 .enum_list = NULL,
2388 .flags = FLAG_ADVANCED | FLAG_SHARE,
2389 },
2390 {
2391 .label = "paranoid server security",
2392 .type = P_BOOL,
2393 .p_class = P_GLOBAL,
2394 .ptr = &Globals.paranoid_server_security,
2395 .special = NULL,
2396 .enum_list = NULL,
2397 .flags = FLAG_ADVANCED,
2398 },
2399 {
2400 .label = "max disk size",
2401 .type = P_INTEGER,
2402 .p_class = P_GLOBAL,
2403 .ptr = &Globals.maxdisksize,
2404 .special = NULL,
2405 .enum_list = NULL,
2406 .flags = FLAG_ADVANCED,
2407 },
2408 {
2409 .label = "max open files",
2410 .type = P_INTEGER,
2411 .p_class = P_GLOBAL,
2412 .ptr = &Globals.max_open_files,
2413 .special = NULL,
2414 .enum_list = NULL,
2415 .flags = FLAG_ADVANCED,
2416 },
2417 {
2418 .label = "min print space",
2419 .type = P_INTEGER,
2420 .p_class = P_LOCAL,
2421 .ptr = &sDefault.iMinPrintSpace,
2422 .special = NULL,
2423 .enum_list = NULL,
2424 .flags = FLAG_ADVANCED | FLAG_PRINT,
2425 },
2426 {
2427 .label = "socket options",
2428 .type = P_STRING,
2429 .p_class = P_GLOBAL,
2430 .ptr = &Globals.szSocketOptions,
2431 .special = NULL,
2432 .enum_list = NULL,
2433 .flags = FLAG_ADVANCED,
2434 },
2435 {
2436 .label = "strict allocate",
2437 .type = P_BOOL,
2438 .p_class = P_LOCAL,
2439 .ptr = &sDefault.bStrictAllocate,
2440 .special = NULL,
2441 .enum_list = NULL,
2442 .flags = FLAG_ADVANCED | FLAG_SHARE,
2443 },
2444 {
2445 .label = "strict sync",
2446 .type = P_BOOL,
2447 .p_class = P_LOCAL,
2448 .ptr = &sDefault.bStrictSync,
2449 .special = NULL,
2450 .enum_list = NULL,
2451 .flags = FLAG_ADVANCED | FLAG_SHARE,
2452 },
2453 {
2454 .label = "sync always",
2455 .type = P_BOOL,
2456 .p_class = P_LOCAL,
2457 .ptr = &sDefault.bSyncAlways,
2458 .special = NULL,
2459 .enum_list = NULL,
2460 .flags = FLAG_ADVANCED | FLAG_SHARE,
2461 },
2462 {
2463 .label = "use mmap",
2464 .type = P_BOOL,
2465 .p_class = P_GLOBAL,
2466 .ptr = &Globals.bUseMmap,
2467 .special = NULL,
2468 .enum_list = NULL,
2469 .flags = FLAG_ADVANCED,
2470 },
2471 {
2472 .label = "use sendfile",
2473 .type = P_BOOL,
2474 .p_class = P_LOCAL,
2475 .ptr = &sDefault.bUseSendfile,
2476 .special = NULL,
2477 .enum_list = NULL,
2478 .flags = FLAG_ADVANCED | FLAG_SHARE,
2479 },
2480 {
2481 .label = "hostname lookups",
2482 .type = P_BOOL,
2483 .p_class = P_GLOBAL,
2484 .ptr = &Globals.bHostnameLookups,
2485 .special = NULL,
2486 .enum_list = NULL,
2487 .flags = FLAG_ADVANCED,
2488 },
2489 {
2490 .label = "write cache size",
2491 .type = P_INTEGER,
2492 .p_class = P_LOCAL,
2493 .ptr = &sDefault.iWriteCacheSize,
2494 .special = NULL,
2495 .enum_list = NULL,
2496 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
2497 },
2498 {
2499 .label = "name cache timeout",
2500 .type = P_INTEGER,
2501 .p_class = P_GLOBAL,
2502 .ptr = &Globals.name_cache_timeout,
2503 .special = NULL,
2504 .enum_list = NULL,
2505 .flags = FLAG_ADVANCED,
2506 },
2507 {
2508 .label = "ctdbd socket",
2509 .type = P_STRING,
2510 .p_class = P_GLOBAL,
2511 .ptr = &Globals.ctdbdSocket,
2512 .special = NULL,
2513 .enum_list = NULL,
2514 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2515 },
2516 {
2517 .label = "cluster addresses",
2518 .type = P_LIST,
2519 .p_class = P_GLOBAL,
2520 .ptr = &Globals.szClusterAddresses,
2521 .special = NULL,
2522 .enum_list = NULL,
2523 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2524 },
2525 {
2526 .label = "clustering",
2527 .type = P_BOOL,
2528 .p_class = P_GLOBAL,
2529 .ptr = &Globals.clustering,
2530 .special = NULL,
2531 .enum_list = NULL,
2532 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
2533 },
2534
2535 {N_("Printing Options"), P_SEP, P_SEPARATOR},
2536
2537 {
2538 .label = "max reported print jobs",
2539 .type = P_INTEGER,
2540 .p_class = P_LOCAL,
2541 .ptr = &sDefault.iMaxReportedPrintJobs,
2542 .special = NULL,
2543 .enum_list = NULL,
2544 .flags = FLAG_ADVANCED | FLAG_PRINT,
2545 },
2546 {
2547 .label = "max print jobs",
2548 .type = P_INTEGER,
2549 .p_class = P_LOCAL,
2550 .ptr = &sDefault.iMaxPrintJobs,
2551 .special = NULL,
2552 .enum_list = NULL,
2553 .flags = FLAG_ADVANCED | FLAG_PRINT,
2554 },
2555 {
2556 .label = "load printers",
2557 .type = P_BOOL,
2558 .p_class = P_GLOBAL,
2559 .ptr = &Globals.bLoadPrinters,
2560 .special = NULL,
2561 .enum_list = NULL,
2562 .flags = FLAG_ADVANCED | FLAG_PRINT,
2563 },
2564 {
2565 .label = "printcap cache time",
2566 .type = P_INTEGER,
2567 .p_class = P_GLOBAL,
2568 .ptr = &Globals.PrintcapCacheTime,
2569 .special = NULL,
2570 .enum_list = NULL,
2571 .flags = FLAG_ADVANCED | FLAG_PRINT,
2572 },
2573 {
2574 .label = "printcap name",
2575 .type = P_STRING,
2576 .p_class = P_GLOBAL,
2577 .ptr = &Globals.szPrintcapname,
2578 .special = NULL,
2579 .enum_list = NULL,
2580 .flags = FLAG_ADVANCED | FLAG_PRINT,
2581 },
2582 {
2583 .label = "printcap",
2584 .type = P_STRING,
2585 .p_class = P_GLOBAL,
2586 .ptr = &Globals.szPrintcapname,
2587 .special = NULL,
2588 .enum_list = NULL,
2589 .flags = FLAG_HIDE,
2590 },
2591 {
2592 .label = "printable",
2593 .type = P_BOOL,
2594 .p_class = P_LOCAL,
2595 .ptr = &sDefault.bPrint_ok,
2596 .special = NULL,
2597 .enum_list = NULL,
2598 .flags = FLAG_ADVANCED | FLAG_PRINT,
2599 },
2600 {
2601 .label = "print ok",
2602 .type = P_BOOL,
2603 .p_class = P_LOCAL,
2604 .ptr = &sDefault.bPrint_ok,
2605 .special = NULL,
2606 .enum_list = NULL,
2607 .flags = FLAG_HIDE,
2608 },
2609 {
2610 .label = "printing",
2611 .type = P_ENUM,
2612 .p_class = P_LOCAL,
2613 .ptr = &sDefault.iPrinting,
2614 .special = handle_printing,
2615 .enum_list = enum_printing,
2616 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2617 },
2618 {
2619 .label = "cups options",
2620 .type = P_STRING,
2621 .p_class = P_LOCAL,
2622 .ptr = &sDefault.szCupsOptions,
2623 .special = NULL,
2624 .enum_list = NULL,
2625 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2626 },
2627 {
2628 .label = "cups server",
2629 .type = P_STRING,
2630 .p_class = P_GLOBAL,
2631 .ptr = &Globals.szCupsServer,
2632 .special = NULL,
2633 .enum_list = NULL,
2634 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2635 },
2636 {
2637 .label = "cups connection timeout",
2638 .type = P_INTEGER,
2639 .p_class = P_GLOBAL,
2640 .ptr = &Globals.cups_connection_timeout,
2641 .special = NULL,
2642 .enum_list = NULL,
2643 .flags = FLAG_ADVANCED,
2644 },
2645 {
2646 .label = "iprint server",
2647 .type = P_STRING,
2648 .p_class = P_GLOBAL,
2649 .ptr = &Globals.szIPrintServer,
2650 .special = NULL,
2651 .enum_list = NULL,
2652 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2653 },
2654 {
2655 .label = "print command",
2656 .type = P_STRING,
2657 .p_class = P_LOCAL,
2658 .ptr = &sDefault.szPrintcommand,
2659 .special = NULL,
2660 .enum_list = NULL,
2661 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2662 },
2663 {
2664 .label = "disable spoolss",
2665 .type = P_BOOL,
2666 .p_class = P_GLOBAL,
2667 .ptr = &Globals.bDisableSpoolss,
2668 .special = NULL,
2669 .enum_list = NULL,
2670 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2671 },
2672 {
2673 .label = "enable spoolss",
2674 .type = P_BOOLREV,
2675 .p_class = P_GLOBAL,
2676 .ptr = &Globals.bDisableSpoolss,
2677 .special = NULL,
2678 .enum_list = NULL,
2679 .flags = FLAG_HIDE,
2680 },
2681 {
2682 .label = "lpq command",
2683 .type = P_STRING,
2684 .p_class = P_LOCAL,
2685 .ptr = &sDefault.szLpqcommand,
2686 .special = NULL,
2687 .enum_list = NULL,
2688 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2689 },
2690 {
2691 .label = "lprm command",
2692 .type = P_STRING,
2693 .p_class = P_LOCAL,
2694 .ptr = &sDefault.szLprmcommand,
2695 .special = NULL,
2696 .enum_list = NULL,
2697 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2698 },
2699 {
2700 .label = "lppause command",
2701 .type = P_STRING,
2702 .p_class = P_LOCAL,
2703 .ptr = &sDefault.szLppausecommand,
2704 .special = NULL,
2705 .enum_list = NULL,
2706 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2707 },
2708 {
2709 .label = "lpresume command",
2710 .type = P_STRING,
2711 .p_class = P_LOCAL,
2712 .ptr = &sDefault.szLpresumecommand,
2713 .special = NULL,
2714 .enum_list = NULL,
2715 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2716 },
2717 {
2718 .label = "queuepause command",
2719 .type = P_STRING,
2720 .p_class = P_LOCAL,
2721 .ptr = &sDefault.szQueuepausecommand,
2722 .special = NULL,
2723 .enum_list = NULL,
2724 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2725 },
2726 {
2727 .label = "queueresume command",
2728 .type = P_STRING,
2729 .p_class = P_LOCAL,
2730 .ptr = &sDefault.szQueueresumecommand,
2731 .special = NULL,
2732 .enum_list = NULL,
2733 .flags = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
2734 },
2735 {
2736 .label = "addport command",
2737 .type = P_STRING,
2738 .p_class = P_GLOBAL,
2739 .ptr = &Globals.szAddPortCommand,
2740 .special = NULL,
2741 .enum_list = NULL,
2742 .flags = FLAG_ADVANCED,
2743 },
2744 {
2745 .label = "enumports command",
2746 .type = P_STRING,
2747 .p_class = P_GLOBAL,
2748 .ptr = &Globals.szEnumPortsCommand,
2749 .special = NULL,
2750 .enum_list = NULL,
2751 .flags = FLAG_ADVANCED,
2752 },
2753 {
2754 .label = "addprinter command",
2755 .type = P_STRING,
2756 .p_class = P_GLOBAL,
2757 .ptr = &Globals.szAddPrinterCommand,
2758 .special = NULL,
2759 .enum_list = NULL,
2760 .flags = FLAG_ADVANCED,
2761 },
2762 {
2763 .label = "deleteprinter command",
2764 .type = P_STRING,
2765 .p_class = P_GLOBAL,
2766 .ptr = &Globals.szDeletePrinterCommand,
2767 .special = NULL,
2768 .enum_list = NULL,
2769 .flags = FLAG_ADVANCED,
2770 },
2771 {
2772 .label = "show add printer wizard",
2773 .type = P_BOOL,
2774 .p_class = P_GLOBAL,
2775 .ptr = &Globals.bMsAddPrinterWizard,
2776 .special = NULL,
2777 .enum_list = NULL,
2778 .flags = FLAG_ADVANCED,
2779 },
2780 {
2781 .label = "os2 driver map",
2782 .type = P_STRING,
2783 .p_class = P_GLOBAL,
2784 .ptr = &Globals.szOs2DriverMap,
2785 .special = NULL,
2786 .enum_list = NULL,
2787 .flags = FLAG_ADVANCED,
2788 },
2789
2790 {
2791 .label = "printer name",
2792 .type = P_STRING,
2793 .p_class = P_LOCAL,
2794 .ptr = &sDefault.szPrintername,
2795 .special = NULL,
2796 .enum_list = NULL,
2797 .flags = FLAG_ADVANCED | FLAG_PRINT,
2798 },
2799 {
2800 .label = "printer",
2801 .type = P_STRING,
2802 .p_class = P_LOCAL,
2803 .ptr = &sDefault.szPrintername,
2804 .special = NULL,
2805 .enum_list = NULL,
2806 .flags = FLAG_HIDE,
2807 },
2808 {
2809 .label = "use client driver",
2810 .type = P_BOOL,
2811 .p_class = P_LOCAL,
2812 .ptr = &sDefault.bUseClientDriver,
2813 .special = NULL,
2814 .enum_list = NULL,
2815 .flags = FLAG_ADVANCED | FLAG_PRINT,
2816 },
2817 {
2818 .label = "default devmode",
2819 .type = P_BOOL,
2820 .p_class = P_LOCAL,
2821 .ptr = &sDefault.bDefaultDevmode,
2822 .special = NULL,
2823 .enum_list = NULL,
2824 .flags = FLAG_ADVANCED | FLAG_PRINT,
2825 },
2826 {
2827 .label = "force printername",
2828 .type = P_BOOL,
2829 .p_class = P_LOCAL,
2830 .ptr = &sDefault.bForcePrintername,
2831 .special = NULL,
2832 .enum_list = NULL,
2833 .flags = FLAG_ADVANCED | FLAG_PRINT,
2834 },
2835 {
2836 .label = "printjob username",
2837 .type = P_STRING,
2838 .p_class = P_LOCAL,
2839 .ptr = &sDefault.szPrintjobUsername,
2840 .special = NULL,
2841 .enum_list = NULL,
2842 .flags = FLAG_ADVANCED | FLAG_PRINT,
2843 },
2844
2845 {N_("Filename Handling"), P_SEP, P_SEPARATOR},
2846
2847 {
2848 .label = "mangling method",
2849 .type = P_STRING,
2850 .p_class = P_GLOBAL,
2851 .ptr = &Globals.szManglingMethod,
2852 .special = NULL,
2853 .enum_list = NULL,
2854 .flags = FLAG_ADVANCED,
2855 },
2856 {
2857 .label = "mangle prefix",
2858 .type = P_INTEGER,
2859 .p_class = P_GLOBAL,
2860 .ptr = &Globals.mangle_prefix,
2861 .special = NULL,
2862 .enum_list = NULL,
2863 .flags = FLAG_ADVANCED,
2864 },
2865
2866 {
2867 .label = "default case",
2868 .type = P_ENUM,
2869 .p_class = P_LOCAL,
2870 .ptr = &sDefault.iDefaultCase,
2871 .special = NULL,
2872 .enum_list = enum_case,
2873 .flags = FLAG_ADVANCED | FLAG_SHARE,
2874 },
2875 {
2876 .label = "case sensitive",
2877 .type = P_ENUM,
2878 .p_class = P_LOCAL,
2879 .ptr = &sDefault.iCaseSensitive,
2880 .special = NULL,
2881 .enum_list = enum_bool_auto,
2882 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2883 },
2884 {
2885 .label = "casesignames",
2886 .type = P_ENUM,
2887 .p_class = P_LOCAL,
2888 .ptr = &sDefault.iCaseSensitive,
2889 .special = NULL,
2890 .enum_list = enum_bool_auto,
2891 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
2892 },
2893 {
2894 .label = "preserve case",
2895 .type = P_BOOL,
2896 .p_class = P_LOCAL,
2897 .ptr = &sDefault.bCasePreserve,
2898 .special = NULL,
2899 .enum_list = NULL,
2900 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2901 },
2902 {
2903 .label = "short preserve case",
2904 .type = P_BOOL,
2905 .p_class = P_LOCAL,
2906 .ptr = &sDefault.bShortCasePreserve,
2907 .special = NULL,
2908 .enum_list = NULL,
2909 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2910 },
2911 {
2912 .label = "mangling char",
2913 .type = P_CHAR,
2914 .p_class = P_LOCAL,
2915 .ptr = &sDefault.magic_char,
2916 .special = NULL,
2917 .enum_list = NULL,
2918 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2919 },
2920 {
2921 .label = "hide dot files",
2922 .type = P_BOOL,
2923 .p_class = P_LOCAL,
2924 .ptr = &sDefault.bHideDotFiles,
2925 .special = NULL,
2926 .enum_list = NULL,
2927 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2928 },
2929 {
2930 .label = "hide special files",
2931 .type = P_BOOL,
2932 .p_class = P_LOCAL,
2933 .ptr = &sDefault.bHideSpecialFiles,
2934 .special = NULL,
2935 .enum_list = NULL,
2936 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2937 },
2938 {
2939 .label = "hide unreadable",
2940 .type = P_BOOL,
2941 .p_class = P_LOCAL,
2942 .ptr = &sDefault.bHideUnReadable,
2943 .special = NULL,
2944 .enum_list = NULL,
2945 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2946 },
2947 {
2948 .label = "hide unwriteable files",
2949 .type = P_BOOL,
2950 .p_class = P_LOCAL,
2951 .ptr = &sDefault.bHideUnWriteableFiles,
2952 .special = NULL,
2953 .enum_list = NULL,
2954 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2955 },
2956 {
2957 .label = "delete veto files",
2958 .type = P_BOOL,
2959 .p_class = P_LOCAL,
2960 .ptr = &sDefault.bDeleteVetoFiles,
2961 .special = NULL,
2962 .enum_list = NULL,
2963 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2964 },
2965 {
2966 .label = "veto files",
2967 .type = P_STRING,
2968 .p_class = P_LOCAL,
2969 .ptr = &sDefault.szVetoFiles,
2970 .special = NULL,
2971 .enum_list = NULL,
2972 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2973 },
2974 {
2975 .label = "hide files",
2976 .type = P_STRING,
2977 .p_class = P_LOCAL,
2978 .ptr = &sDefault.szHideFiles,
2979 .special = NULL,
2980 .enum_list = NULL,
2981 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2982 },
2983 {
2984 .label = "veto oplock files",
2985 .type = P_STRING,
2986 .p_class = P_LOCAL,
2987 .ptr = &sDefault.szVetoOplockFiles,
2988 .special = NULL,
2989 .enum_list = NULL,
2990 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
2991 },
2992 {
2993 .label = "map archive",
2994 .type = P_BOOL,
2995 .p_class = P_LOCAL,
2996 .ptr = &sDefault.bMap_archive,
2997 .special = NULL,
2998 .enum_list = NULL,
2999 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3000 },
3001 {
3002 .label = "map hidden",
3003 .type = P_BOOL,
3004 .p_class = P_LOCAL,
3005 .ptr = &sDefault.bMap_hidden,
3006 .special = NULL,
3007 .enum_list = NULL,
3008 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3009 },
3010 {
3011 .label = "map system",
3012 .type = P_BOOL,
3013 .p_class = P_LOCAL,
3014 .ptr = &sDefault.bMap_system,
3015 .special = NULL,
3016 .enum_list = NULL,
3017 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3018 },
3019 {
3020 .label = "map readonly",
3021 .type = P_ENUM,
3022 .p_class = P_LOCAL,
3023 .ptr = &sDefault.iMap_readonly,
3024 .special = NULL,
3025 .enum_list = enum_map_readonly,
3026 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3027 },
3028 {
3029 .label = "mangled names",
3030 .type = P_BOOL,
3031 .p_class = P_LOCAL,
3032 .ptr = &sDefault.bMangledNames,
3033 .special = NULL,
3034 .enum_list = NULL,
3035 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3036 },
3037 {
3038 .label = "max stat cache size",
3039 .type = P_INTEGER,
3040 .p_class = P_GLOBAL,
3041 .ptr = &Globals.iMaxStatCacheSize,
3042 .special = NULL,
3043 .enum_list = NULL,
3044 .flags = FLAG_ADVANCED,
3045 },
3046 {
3047 .label = "stat cache",
3048 .type = P_BOOL,
3049 .p_class = P_GLOBAL,
3050 .ptr = &Globals.bStatCache,
3051 .special = NULL,
3052 .enum_list = NULL,
3053 .flags = FLAG_ADVANCED,
3054 },
3055 {
3056 .label = "store dos attributes",
3057 .type = P_BOOL,
3058 .p_class = P_LOCAL,
3059 .ptr = &sDefault.bStoreDosAttributes,
3060 .special = NULL,
3061 .enum_list = NULL,
3062 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3063 },
3064 {
3065 .label = "dmapi support",
3066 .type = P_BOOL,
3067 .p_class = P_LOCAL,
3068 .ptr = &sDefault.bDmapiSupport,
3069 .special = NULL,
3070 .enum_list = NULL,
3071 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3072 },
3073
3074
3075 {N_("Domain Options"), P_SEP, P_SEPARATOR},
3076
3077 {
3078 .label = "machine password timeout",
3079 .type = P_INTEGER,
3080 .p_class = P_GLOBAL,
3081 .ptr = &Globals.machine_password_timeout,
3082 .special = NULL,
3083 .enum_list = NULL,
3084 .flags = FLAG_ADVANCED | FLAG_WIZARD,
3085 },
3086
3087 {N_("Logon Options"), P_SEP, P_SEPARATOR},
3088
3089 {
3090 .label = "add user script",
3091 .type = P_STRING,
3092 .p_class = P_GLOBAL,
3093 .ptr = &Globals.szAddUserScript,
3094 .special = NULL,
3095 .enum_list = NULL,
3096 .flags = FLAG_ADVANCED,
3097 },
3098 {
3099 .label = "rename user script",
3100 .type = P_STRING,
3101 .p_class = P_GLOBAL,
3102 .ptr = &Globals.szRenameUserScript,
3103 .special = NULL,
3104 .enum_list = NULL,
3105 .flags = FLAG_ADVANCED,
3106 },
3107 {
3108 .label = "delete user script",
3109 .type = P_STRING,
3110 .p_class = P_GLOBAL,
3111 .ptr = &Globals.szDelUserScript,
3112 .special = NULL,
3113 .enum_list = NULL,
3114 .flags = FLAG_ADVANCED,
3115 },
3116 {
3117 .label = "add group script",
3118 .type = P_STRING,
3119 .p_class = P_GLOBAL,
3120 .ptr = &Globals.szAddGroupScript,
3121 .special = NULL,
3122 .enum_list = NULL,
3123 .flags = FLAG_ADVANCED,
3124 },
3125 {
3126 .label = "delete group script",
3127 .type = P_STRING,
3128 .p_class = P_GLOBAL,
3129 .ptr = &Globals.szDelGroupScript,
3130 .special = NULL,
3131 .enum_list = NULL,
3132 .flags = FLAG_ADVANCED,
3133 },
3134 {
3135 .label = "add user to group script",
3136 .type = P_STRING,
3137 .p_class = P_GLOBAL,
3138 .ptr = &Globals.szAddUserToGroupScript,
3139 .special = NULL,
3140 .enum_list = NULL,
3141 .flags = FLAG_ADVANCED,
3142 },
3143 {
3144 .label = "delete user from group script",
3145 .type = P_STRING,
3146 .p_class = P_GLOBAL,
3147 .ptr = &Globals.szDelUserFromGroupScript,
3148 .special = NULL,
3149 .enum_list = NULL,
3150 .flags = FLAG_ADVANCED,
3151 },
3152 {
3153 .label = "set primary group script",
3154 .type = P_STRING,
3155 .p_class = P_GLOBAL,
3156 .ptr = &Globals.szSetPrimaryGroupScript,
3157 .special = NULL,
3158 .enum_list = NULL,
3159 .flags = FLAG_ADVANCED,
3160 },
3161 {
3162 .label = "add machine script",
3163 .type = P_STRING,
3164 .p_class = P_GLOBAL,
3165 .ptr = &Globals.szAddMachineScript,
3166 .special = NULL,
3167 .enum_list = NULL,
3168 .flags = FLAG_ADVANCED,
3169 },
3170 {
3171 .label = "shutdown script",
3172 .type = P_STRING,
3173 .p_class = P_GLOBAL,
3174 .ptr = &Globals.szShutdownScript,
3175 .special = NULL,
3176 .enum_list = NULL,
3177 .flags = FLAG_ADVANCED,
3178 },
3179 {
3180 .label = "abort shutdown script",
3181 .type = P_STRING,
3182 .p_class = P_GLOBAL,
3183 .ptr = &Globals.szAbortShutdownScript,
3184 .special = NULL,
3185 .enum_list = NULL,
3186 .flags = FLAG_ADVANCED,
3187 },
3188 {
3189 .label = "username map script",
3190 .type = P_STRING,
3191 .p_class = P_GLOBAL,
3192 .ptr = &Globals.szUsernameMapScript,
3193 .special = NULL,
3194 .enum_list = NULL,
3195 .flags = FLAG_ADVANCED,
3196 },
3197 {
3198 .label = "logon script",
3199 .type = P_STRING,
3200 .p_class = P_GLOBAL,
3201 .ptr = &Globals.szLogonScript,
3202 .special = NULL,
3203 .enum_list = NULL,
3204 .flags = FLAG_ADVANCED,
3205 },
3206 {
3207 .label = "logon path",
3208 .type = P_STRING,
3209 .p_class = P_GLOBAL,
3210 .ptr = &Globals.szLogonPath,
3211 .special = NULL,
3212 .enum_list = NULL,
3213 .flags = FLAG_ADVANCED,
3214 },
3215 {
3216 .label = "logon drive",
3217 .type = P_STRING,
3218 .p_class = P_GLOBAL,
3219 .ptr = &Globals.szLogonDrive,
3220 .special = NULL,
3221 .enum_list = NULL,
3222 .flags = FLAG_ADVANCED,
3223 },
3224 {
3225 .label = "logon home",
3226 .type = P_STRING,
3227 .p_class = P_GLOBAL,
3228 .ptr = &Globals.szLogonHome,
3229 .special = NULL,
3230 .enum_list = NULL,
3231 .flags = FLAG_ADVANCED,
3232 },
3233 {
3234 .label = "domain logons",
3235 .type = P_BOOL,
3236 .p_class = P_GLOBAL,
3237 .ptr = &Globals.bDomainLogons,
3238 .special = NULL,
3239 .enum_list = NULL,
3240 .flags = FLAG_ADVANCED,
3241 },
3242
3243 {
3244 .label = "init logon delayed hosts",
3245 .type = P_LIST,
3246 .p_class = P_GLOBAL,
3247 .ptr = &Globals.szInitLogonDelayedHosts,
3248 .special = NULL,
3249 .enum_list = NULL,
3250 .flags = FLAG_ADVANCED,
3251 },
3252
3253 {
3254 .label = "init logon delay",
3255 .type = P_INTEGER,
3256 .p_class = P_GLOBAL,
3257 .ptr = &Globals.InitLogonDelay,
3258 .special = NULL,
3259 .enum_list = NULL,
3260 .flags = FLAG_ADVANCED,
3261
3262 },
3263
3264 {N_("Browse Options"), P_SEP, P_SEPARATOR},
3265
3266 {
3267 .label = "os level",
3268 .type = P_INTEGER,
3269 .p_class = P_GLOBAL,
3270 .ptr = &Globals.os_level,
3271 .special = NULL,
3272 .enum_list = NULL,
3273 .flags = FLAG_BASIC | FLAG_ADVANCED,
3274 },
3275 {
3276 .label = "lm announce",
3277 .type = P_ENUM,
3278 .p_class = P_GLOBAL,
3279 .ptr = &Globals.lm_announce,
3280 .special = NULL,
3281 .enum_list = enum_bool_auto,
3282 .flags = FLAG_ADVANCED,
3283 },
3284 {
3285 .label = "lm interval",
3286 .type = P_INTEGER,
3287 .p_class = P_GLOBAL,
3288 .ptr = &Globals.lm_interval,
3289 .special = NULL,
3290 .enum_list = NULL,
3291 .flags = FLAG_ADVANCED,
3292 },
3293 {
3294 .label = "preferred master",
3295 .type = P_ENUM,
3296 .p_class = P_GLOBAL,
3297 .ptr = &Globals.iPreferredMaster,
3298 .special = NULL,
3299 .enum_list = enum_bool_auto,
3300 .flags = FLAG_BASIC | FLAG_ADVANCED,
3301 },
3302 {
3303 .label = "prefered master",
3304 .type = P_ENUM,
3305 .p_class = P_GLOBAL,
3306 .ptr = &Globals.iPreferredMaster,
3307 .special = NULL,
3308 .enum_list = enum_bool_auto,
3309 .flags = FLAG_HIDE,
3310 },
3311 {
3312 .label = "local master",
3313 .type = P_BOOL,
3314 .p_class = P_GLOBAL,
3315 .ptr = &Globals.bLocalMaster,
3316 .special = NULL,
3317 .enum_list = NULL,
3318 .flags = FLAG_BASIC | FLAG_ADVANCED,
3319 },
3320 {
3321 .label = "domain master",
3322 .type = P_ENUM,
3323 .p_class = P_GLOBAL,
3324 .ptr = &Globals.iDomainMaster,
3325 .special = NULL,
3326 .enum_list = enum_bool_auto,
3327 .flags = FLAG_BASIC | FLAG_ADVANCED,
3328 },
3329 {
3330 .label = "browse list",
3331 .type = P_BOOL,
3332 .p_class = P_GLOBAL,
3333 .ptr = &Globals.bBrowseList,
3334 .special = NULL,
3335 .enum_list = NULL,
3336 .flags = FLAG_ADVANCED,
3337 },
3338 {
3339 .label = "browseable",
3340 .type = P_BOOL,
3341 .p_class = P_LOCAL,
3342 .ptr = &sDefault.bBrowseable,
3343 .special = NULL,
3344 .enum_list = NULL,
3345 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
3346 },
3347 {
3348 .label = "access based share enum",
3349 .type = P_BOOL,
3350 .p_class = P_LOCAL,
3351 .ptr = &sDefault.bAccessBasedShareEnum,
3352 .special = NULL,
3353 .enum_list = NULL,
3354 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
3355 },
3356 {
3357 .label = "browsable",
3358 .type = P_BOOL,
3359 .p_class = P_LOCAL,
3360 .ptr = &sDefault.bBrowseable,
3361 .special = NULL,
3362 .enum_list = NULL,
3363 .flags = FLAG_HIDE,
3364 },
3365 {
3366 .label = "enhanced browsing",
3367 .type = P_BOOL,
3368 .p_class = P_GLOBAL,
3369 .ptr = &Globals.enhanced_browsing,
3370 .special = NULL,
3371 .enum_list = NULL,
3372 .flags = FLAG_ADVANCED,
3373 },
3374
3375 {N_("WINS Options"), P_SEP, P_SEPARATOR},
3376
3377 {
3378 .label = "dns proxy",
3379 .type = P_BOOL,
3380 .p_class = P_GLOBAL,
3381 .ptr = &Globals.bDNSproxy,
3382 .special = NULL,
3383 .enum_list = NULL,
3384 .flags = FLAG_ADVANCED,
3385 },
3386 {
3387 .label = "wins proxy",
3388 .type = P_BOOL,
3389 .p_class = P_GLOBAL,
3390 .ptr = &Globals.bWINSproxy,
3391 .special = NULL,
3392 .enum_list = NULL,
3393 .flags = FLAG_ADVANCED,
3394 },
3395 {
3396 .label = "wins server",
3397 .type = P_LIST,
3398 .p_class = P_GLOBAL,
3399 .ptr = &Globals.szWINSservers,
3400 .special = NULL,
3401 .enum_list = NULL,
3402 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3403 },
3404 {
3405 .label = "wins support",
3406 .type = P_BOOL,
3407 .p_class = P_GLOBAL,
3408 .ptr = &Globals.bWINSsupport,
3409 .special = NULL,
3410 .enum_list = NULL,
3411 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
3412 },
3413 {
3414 .label = "wins hook",
3415 .type = P_STRING,
3416 .p_class = P_GLOBAL,
3417 .ptr = &Globals.szWINSHook,
3418 .special = NULL,
3419 .enum_list = NULL,
3420 .flags = FLAG_ADVANCED,
3421 },
3422
3423 {N_("Locking Options"), P_SEP, P_SEPARATOR},
3424
3425 {
3426 .label = "blocking locks",
3427 .type = P_BOOL,
3428 .p_class = P_LOCAL,
3429 .ptr = &sDefault.bBlockingLocks,
3430 .special = NULL,
3431 .enum_list = NULL,
3432 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3433 },
3434 {
3435 .label = "csc policy",
3436 .type = P_ENUM,
3437 .p_class = P_LOCAL,
3438 .ptr = &sDefault.iCSCPolicy,
3439 .special = NULL,
3440 .enum_list = enum_csc_policy,
3441 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3442 },
3443 {
3444 .label = "fake oplocks",
3445 .type = P_BOOL,
3446 .p_class = P_LOCAL,
3447 .ptr = &sDefault.bFakeOplocks,
3448 .special = NULL,
3449 .enum_list = NULL,
3450 .flags = FLAG_ADVANCED | FLAG_SHARE,
3451 },
3452 {
3453 .label = "kernel oplocks",
3454 .type = P_BOOL,
3455 .p_class = P_GLOBAL,
3456 .ptr = &Globals.bKernelOplocks,
3457 .special = NULL,
3458 .enum_list = NULL,
3459 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3460 },
3461 {
3462 .label = "locking",
3463 .type = P_BOOL,
3464 .p_class = P_LOCAL,
3465 .ptr = &sDefault.bLocking,
3466 .special = NULL,
3467 .enum_list = NULL,
3468 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3469 },
3470 {
3471 .label = "lock spin time",
3472 .type = P_INTEGER,
3473 .p_class = P_GLOBAL,
3474 .ptr = &Globals.iLockSpinTime,
3475 .special = NULL,
3476 .enum_list = NULL,
3477 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3478 },
3479 {
3480 .label = "oplocks",
3481 .type = P_BOOL,
3482 .p_class = P_LOCAL,
3483 .ptr = &sDefault.bOpLocks,
3484 .special = NULL,
3485 .enum_list = NULL,
3486 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3487 },
3488 {
3489 .label = "level2 oplocks",
3490 .type = P_BOOL,
3491 .p_class = P_LOCAL,
3492 .ptr = &sDefault.bLevel2OpLocks,
3493 .special = NULL,
3494 .enum_list = NULL,
3495 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3496 },
3497 {
3498 .label = "oplock break wait time",
3499 .type = P_INTEGER,
3500 .p_class = P_GLOBAL,
3501 .ptr = &Globals.oplock_break_wait_time,
3502 .special = NULL,
3503 .enum_list = NULL,
3504 .flags = FLAG_ADVANCED | FLAG_GLOBAL,
3505 },
3506 {
3507 .label = "oplock contention limit",
3508 .type = P_INTEGER,
3509 .p_class = P_LOCAL,
3510 .ptr = &sDefault.iOplockContentionLimit,
3511 .special = NULL,
3512 .enum_list = NULL,
3513 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3514 },
3515 {
3516 .label = "posix locking",
3517 .type = P_BOOL,
3518 .p_class = P_LOCAL,
3519 .ptr = &sDefault.bPosixLocking,
3520 .special = NULL,
3521 .enum_list = NULL,
3522 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3523 },
3524 {
3525 .label = "strict locking",
3526 .type = P_ENUM,
3527 .p_class = P_LOCAL,
3528 .ptr = &sDefault.iStrictLocking,
3529 .special = NULL,
3530 .enum_list = enum_bool_auto,
3531 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
3532 },
3533 {
3534 .label = "share modes",
3535 .type = P_BOOL,
3536 .p_class = P_LOCAL,
3537 .ptr = &sDefault.bShareModes,
3538 .special = NULL,
3539 .enum_list = NULL,
3540 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
3541 },
3542
3543 {N_("Ldap Options"), P_SEP, P_SEPARATOR},
3544
3545 {
3546 .label = "ldap admin dn",
3547 .type = P_STRING,
3548 .p_class = P_GLOBAL,
3549 .ptr = &Globals.szLdapAdminDn,
3550 .special = NULL,
3551 .enum_list = NULL,
3552 .flags = FLAG_ADVANCED,
3553 },
3554 {
3555 .label = "ldap delete dn",
3556 .type = P_BOOL,
3557 .p_class = P_GLOBAL,
3558 .ptr = &Globals.ldap_delete_dn,
3559 .special = NULL,
3560 .enum_list = NULL,
3561 .flags = FLAG_ADVANCED,
3562 },
3563 {
3564 .label = "ldap group suffix",
3565 .type = P_STRING,
3566 .p_class = P_GLOBAL,
3567 .ptr = &Globals.szLdapGroupSuffix,
3568 .special = NULL,
3569 .enum_list = NULL,
3570 .flags = FLAG_ADVANCED,
3571 },
3572 {
3573 .label = "ldap idmap suffix",
3574 .type = P_STRING,
3575 .p_class = P_GLOBAL,
3576 .ptr = &Globals.szLdapIdmapSuffix,
3577 .special = NULL,
3578 .enum_list = NULL,
3579 .flags = FLAG_ADVANCED,
3580 },
3581 {
3582 .label = "ldap machine suffix",
3583 .type = P_STRING,
3584 .p_class = P_GLOBAL,
3585 .ptr = &Globals.szLdapMachineSuffix,
3586 .special = NULL,
3587 .enum_list = NULL,
3588 .flags = FLAG_ADVANCED,
3589 },
3590 {
3591 .label = "ldap passwd sync",
3592 .type = P_ENUM,
3593 .p_class = P_GLOBAL,
3594 .ptr = &Globals.ldap_passwd_sync,
3595 .special = NULL,
3596 .enum_list = enum_ldap_passwd_sync,
3597 .flags = FLAG_ADVANCED,
3598 },
3599 {
3600 .label = "ldap password sync",
3601 .type = P_ENUM,
3602 .p_class = P_GLOBAL,
3603 .ptr = &Globals.ldap_passwd_sync,
3604 .special = NULL,
3605 .enum_list = enum_ldap_passwd_sync,
3606 .flags = FLAG_HIDE,
3607 },
3608 {
3609 .label = "ldap replication sleep",
3610 .type = P_INTEGER,
3611 .p_class = P_GLOBAL,
3612 .ptr = &Globals.ldap_replication_sleep,
3613 .special = NULL,
3614 .enum_list = NULL,
3615 .flags = FLAG_ADVANCED,
3616 },
3617 {
3618 .label = "ldap suffix",
3619 .type = P_STRING,
3620 .p_class = P_GLOBAL,
3621 .ptr = &Globals.szLdapSuffix,
3622 .special = NULL,
3623 .enum_list = NULL,
3624 .flags = FLAG_ADVANCED,
3625 },
3626 {
3627 .label = "ldap ssl",
3628 .type = P_ENUM,
3629 .p_class = P_GLOBAL,
3630 .ptr = &Globals.ldap_ssl,
3631 .special = NULL,
3632 .enum_list = enum_ldap_ssl,
3633 .flags = FLAG_ADVANCED,
3634 },
3635 {
3636 .label = "ldap ssl ads",
3637 .type = P_BOOL,
3638 .p_class = P_GLOBAL,
3639 .ptr = &Globals.ldap_ssl_ads,
3640 .special = NULL,
3641 .enum_list = NULL,
3642 .flags = FLAG_ADVANCED,
3643 },
3644 {
3645 .label = "ldap timeout",
3646 .type = P_INTEGER,
3647 .p_class = P_GLOBAL,
3648 .ptr = &Globals.ldap_timeout,
3649 .special = NULL,
3650 .enum_list = NULL,
3651 .flags = FLAG_ADVANCED,
3652 },
3653 {
3654 .label = "ldap connection timeout",
3655 .type = P_INTEGER,
3656 .p_class = P_GLOBAL,
3657 .ptr = &Globals.ldap_connection_timeout,
3658 .special = NULL,
3659 .enum_list = NULL,
3660 .flags = FLAG_ADVANCED,
3661 },
3662 {
3663 .label = "ldap page size",
3664 .type = P_INTEGER,
3665 .p_class = P_GLOBAL,
3666 .ptr = &Globals.ldap_page_size,
3667 .special = NULL,
3668 .enum_list = NULL,
3669 .flags = FLAG_ADVANCED,
3670 },
3671 {
3672 .label = "ldap user suffix",
3673 .type = P_STRING,
3674 .p_class = P_GLOBAL,
3675 .ptr = &Globals.szLdapUserSuffix,
3676 .special = NULL,
3677 .enum_list = NULL,
3678 .flags = FLAG_ADVANCED,
3679 },
3680 {
3681 .label = "ldap debug level",
3682 .type = P_INTEGER,
3683 .p_class = P_GLOBAL,
3684 .ptr = &Globals.ldap_debug_level,
3685 .special = handle_ldap_debug_level,
3686 .enum_list = NULL,
3687 .flags = FLAG_ADVANCED,
3688 },
3689 {
3690 .label = "ldap debug threshold",
3691 .type = P_INTEGER,
3692 .p_class = P_GLOBAL,
3693 .ptr = &Globals.ldap_debug_threshold,
3694 .special = NULL,
3695 .enum_list = NULL,
3696 .flags = FLAG_ADVANCED,
3697 },
3698
3699 {N_("EventLog Options"), P_SEP, P_SEPARATOR},
3700
3701 {
3702 .label = "eventlog list",
3703 .type = P_LIST,
3704 .p_class = P_GLOBAL,
3705 .ptr = &Globals.szEventLogs,
3706 .special = NULL,
3707 .enum_list = NULL,
3708 .flags = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
3709 },
3710
3711 {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
3712
3713 {
3714 .label = "add share command",
3715 .type = P_STRING,
3716 .p_class = P_GLOBAL,
3717 .ptr = &Globals.szAddShareCommand,
3718 .special = NULL,
3719 .enum_list = NULL,
3720 .flags = FLAG_ADVANCED,
3721 },
3722 {
3723 .label = "change share command",
3724 .type = P_STRING,
3725 .p_class = P_GLOBAL,
3726 .ptr = &Globals.szChangeShareCommand,
3727 .special = NULL,
3728 .enum_list = NULL,
3729 .flags = FLAG_ADVANCED,
3730 },
3731 {
3732 .label = "delete share command",
3733 .type = P_STRING,
3734 .p_class = P_GLOBAL,
3735 .ptr = &Globals.szDeleteShareCommand,
3736 .special = NULL,
3737 .enum_list = NULL,
3738 .flags = FLAG_ADVANCED,
3739 },
3740 {
3741 .label = "config file",
3742 .type = P_STRING,
3743 .p_class = P_GLOBAL,
3744 .ptr = &Globals.szConfigFile,
3745 .special = NULL,
3746 .enum_list = NULL,
3747 .flags = FLAG_HIDE|FLAG_META,
3748 },
3749 {
3750 .label = "preload",
3751 .type = P_STRING,
3752 .p_class = P_GLOBAL,
3753 .ptr = &Globals.szAutoServices,
3754 .special = NULL,
3755 .enum_list = NULL,
3756 .flags = FLAG_ADVANCED,
3757 },
3758 {
3759 .label = "auto services",
3760 .type = P_STRING,
3761 .p_class = P_GLOBAL,
3762 .ptr = &Globals.szAutoServices,
3763 .special = NULL,
3764 .enum_list = NULL,
3765 .flags = FLAG_ADVANCED,
3766 },
3767 {
3768 .label = "lock directory",
3769 .type = P_STRING,
3770 .p_class = P_GLOBAL,
3771 .ptr = &Globals.szLockDir,
3772 .special = NULL,
3773 .enum_list = NULL,
3774 .flags = FLAG_ADVANCED,
3775 },
3776 {
3777 .label = "lock dir",
3778 .type = P_STRING,
3779 .p_class = P_GLOBAL,
3780 .ptr = &Globals.szLockDir,
3781 .special = NULL,
3782 .enum_list = NULL,
3783 .flags = FLAG_HIDE,
3784 },
3785 {
3786 .label = "state directory",
3787 .type = P_STRING,
3788 .p_class = P_GLOBAL,
3789 .ptr = &Globals.szStateDir,
3790 .special = NULL,
3791 .enum_list = NULL,
3792 .flags = FLAG_ADVANCED,
3793 },
3794 {
3795 .label = "cache directory",
3796 .type = P_STRING,
3797 .p_class = P_GLOBAL,
3798 .ptr = &Globals.szCacheDir,
3799 .special = NULL,
3800 .enum_list = NULL,
3801 .flags = FLAG_ADVANCED,
3802 },
3803 {
3804 .label = "pid directory",
3805 .type = P_STRING,
3806 .p_class = P_GLOBAL,
3807 .ptr = &Globals.szPidDir,
3808 .special = NULL,
3809 .enum_list = NULL,
3810 .flags = FLAG_ADVANCED,
3811 },
3812 #ifdef WITH_UTMP
3813 {
3814 .label = "utmp directory",
3815 .type = P_STRING,
3816 .p_class = P_GLOBAL,
3817 .ptr = &Globals.szUtmpDir,
3818 .special = NULL,
3819 .enum_list = NULL,
3820 .flags = FLAG_ADVANCED,
3821 },
3822 {
3823 .label = "wtmp directory",
3824 .type = P_STRING,
3825 .p_class = P_GLOBAL,
3826 .ptr = &Globals.szWtmpDir,
3827 .special = NULL,
3828 .enum_list = NULL,
3829 .flags = FLAG_ADVANCED,
3830 },
3831 {
3832 .label = "utmp",
3833 .type = P_BOOL,
3834 .p_class = P_GLOBAL,
3835 .ptr = &Globals.bUtmp,
3836 .special = NULL,
3837 .enum_list = NULL,
3838 .flags = FLAG_ADVANCED,
3839 },
3840 #endif
3841 {
3842 .label = "default service",
3843 .type = P_STRING,
3844 .p_class = P_GLOBAL,
3845 .ptr = &Globals.szDefaultService,
3846 .special = NULL,
3847 .enum_list = NULL,
3848 .flags = FLAG_ADVANCED,
3849 },
3850 {
3851 .label = "default",
3852 .type = P_STRING,
3853 .p_class = P_GLOBAL,
3854 .ptr = &Globals.szDefaultService,
3855 .special = NULL,
3856 .enum_list = NULL,
3857 .flags = FLAG_ADVANCED,
3858 },
3859 {
3860 .label = "message command",
3861 .type = P_STRING,
3862 .p_class = P_GLOBAL,
3863 .ptr = &Globals.szMsgCommand,
3864 .special = NULL,
3865 .enum_list = NULL,
3866 .flags = FLAG_ADVANCED,
3867 },
3868 {
3869 .label = "dfree cache time",
3870 .type = P_INTEGER,
3871 .p_class = P_LOCAL,
3872 .ptr = &sDefault.iDfreeCacheTime,
3873 .special = NULL,
3874 .enum_list = NULL,
3875 .flags = FLAG_ADVANCED,
3876 },
3877 {
3878 .label = "dfree command",
3879 .type = P_STRING,
3880 .p_class = P_LOCAL,
3881 .ptr = &sDefault.szDfree,
3882 .special = NULL,
3883 .enum_list = NULL,
3884 .flags = FLAG_ADVANCED,
3885 },
3886 {
3887 .label = "get quota command",
3888 .type = P_STRING,
3889 .p_class = P_GLOBAL,
3890 .ptr = &Globals.szGetQuota,
3891 .special = NULL,
3892 .enum_list = NULL,
3893 .flags = FLAG_ADVANCED,
3894 },
3895 {
3896 .label = "set quota command",
3897 .type = P_STRING,
3898 .p_class = P_GLOBAL,
3899 .ptr = &Globals.szSetQuota,
3900 .special = NULL,
3901 .enum_list = NULL,
3902 .flags = FLAG_ADVANCED,
3903 },
3904 {
3905 .label = "remote announce",
3906 .type = P_STRING,
3907 .p_class = P_GLOBAL,
3908 .ptr = &Globals.szRemoteAnnounce,
3909 .special = NULL,
3910 .enum_list = NULL,
3911 .flags = FLAG_ADVANCED,
3912 },
3913 {
3914 .label = "remote browse sync",
3915 .type = P_STRING,
3916 .p_class = P_GLOBAL,
3917 .ptr = &Globals.szRemoteBrowseSync,
3918 .special = NULL,
3919 .enum_list = NULL,
3920 .flags = FLAG_ADVANCED,
3921 },
3922 {
3923 .label = "socket address",
3924 .type = P_STRING,
3925 .p_class = P_GLOBAL,
3926 .ptr = &Globals.szSocketAddress,
3927 .special = NULL,
3928 .enum_list = NULL,
3929 .flags = FLAG_ADVANCED,
3930 },
3931 {
3932 .label = "homedir map",
3933 .type = P_STRING,
3934 .p_class = P_GLOBAL,
3935 .ptr = &Globals.szNISHomeMapName,
3936 .special = NULL,
3937 .enum_list = NULL,
3938 .flags = FLAG_ADVANCED,
3939 },
3940 {
3941 .label = "afs username map",
3942 .type = P_STRING,
3943 .p_class = P_GLOBAL,
3944 .ptr = &Globals.szAfsUsernameMap,
3945 .special = NULL,
3946 .enum_list = NULL,
3947 .flags = FLAG_ADVANCED,
3948 },
3949 {
3950 .label = "afs token lifetime",
3951 .type = P_INTEGER,
3952 .p_class = P_GLOBAL,
3953 .ptr = &Globals.iAfsTokenLifetime,
3954 .special = NULL,
3955 .enum_list = NULL,
3956 .flags = FLAG_ADVANCED,
3957 },
3958 {
3959 .label = "log nt token command",
3960 .type = P_STRING,
3961 .p_class = P_GLOBAL,
3962 .ptr = &Globals.szLogNtTokenCommand,
3963 .special = NULL,
3964 .enum_list = NULL,
3965 .flags = FLAG_ADVANCED,
3966 },
3967 {
3968 .label = "time offset",
3969 .type = P_INTEGER,
3970 .p_class = P_GLOBAL,
3971 .ptr = &extra_time_offset,
3972 .special = NULL,
3973 .enum_list = NULL,
3974 .flags = FLAG_ADVANCED,
3975 },
3976 {
3977 .label = "NIS homedir",
3978 .type = P_BOOL,
3979 .p_class = P_GLOBAL,
3980 .ptr = &Globals.bNISHomeMap,
3981 .special = NULL,
3982 .enum_list = NULL,
3983 .flags = FLAG_ADVANCED,
3984 },
3985 {
3986 .label = "-valid",
3987 .type = P_BOOL,
3988 .p_class = P_LOCAL,
3989 .ptr = &sDefault.valid,
3990 .special = NULL,
3991 .enum_list = NULL,
3992 .flags = FLAG_HIDE,
3993 },
3994 {
3995 .label = "copy",
3996 .type = P_STRING,
3997 .p_class = P_LOCAL,
3998 .ptr = &sDefault.szCopy,
3999 .special = handle_copy,
4000 .enum_list = NULL,
4001 .flags = FLAG_HIDE,
4002 },
4003 {
4004 .label = "include",
4005 .type = P_STRING,
4006 .p_class = P_LOCAL,
4007 .ptr = &sDefault.szInclude,
4008 .special = handle_include,
4009 .enum_list = NULL,
4010 .flags = FLAG_HIDE|FLAG_META,
4011 },
4012 {
4013 .label = "preexec",
4014 .type = P_STRING,
4015 .p_class = P_LOCAL,
4016 .ptr = &sDefault.szPreExec,
4017 .special = NULL,
4018 .enum_list = NULL,
4019 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4020 },
4021 {
4022 .label = "exec",
4023 .type = P_STRING,
4024 .p_class = P_LOCAL,
4025 .ptr = &sDefault.szPreExec,
4026 .special = NULL,
4027 .enum_list = NULL,
4028 .flags = FLAG_ADVANCED,
4029 },
4030 {
4031 .label = "preexec close",
4032 .type = P_BOOL,
4033 .p_class = P_LOCAL,
4034 .ptr = &sDefault.bPreexecClose,
4035 .special = NULL,
4036 .enum_list = NULL,
4037 .flags = FLAG_ADVANCED | FLAG_SHARE,
4038 },
4039 {
4040 .label = "postexec",
4041 .type = P_STRING,
4042 .p_class = P_LOCAL,
4043 .ptr = &sDefault.szPostExec,
4044 .special = NULL,
4045 .enum_list = NULL,
4046 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4047 },
4048 {
4049 .label = "root preexec",
4050 .type = P_STRING,
4051 .p_class = P_LOCAL,
4052 .ptr = &sDefault.szRootPreExec,
4053 .special = NULL,
4054 .enum_list = NULL,
4055 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4056 },
4057 {
4058 .label = "root preexec close",
4059 .type = P_BOOL,
4060 .p_class = P_LOCAL,
4061 .ptr = &sDefault.bRootpreexecClose,
4062 .special = NULL,
4063 .enum_list = NULL,
4064 .flags = FLAG_ADVANCED | FLAG_SHARE,
4065 },
4066 {
4067 .label = "root postexec",
4068 .type = P_STRING,
4069 .p_class = P_LOCAL,
4070 .ptr = &sDefault.szRootPostExec,
4071 .special = NULL,
4072 .enum_list = NULL,
4073 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4074 },
4075 {
4076 .label = "available",
4077 .type = P_BOOL,
4078 .p_class = P_LOCAL,
4079 .ptr = &sDefault.bAvailable,
4080 .special = NULL,
4081 .enum_list = NULL,
4082 .flags = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
4083 },
4084 {
4085 .label = "registry shares",
4086 .type = P_BOOL,
4087 .p_class = P_GLOBAL,
4088 .ptr = &Globals.bRegistryShares,
4089 .special = NULL,
4090 .enum_list = NULL,
4091 .flags = FLAG_ADVANCED,
4092 },
4093 {
4094 .label = "usershare allow guests",
4095 .type = P_BOOL,
4096 .p_class = P_GLOBAL,
4097 .ptr = &Globals.bUsershareAllowGuests,
4098 .special = NULL,
4099 .enum_list = NULL,
4100 .flags = FLAG_ADVANCED,
4101 },
4102 {
4103 .label = "usershare max shares",
4104 .type = P_INTEGER,
4105 .p_class = P_GLOBAL,
4106 .ptr = &Globals.iUsershareMaxShares,
4107 .special = NULL,
4108 .enum_list = NULL,
4109 .flags = FLAG_ADVANCED,
4110 },
4111 {
4112 .label = "usershare owner only",
4113 .type = P_BOOL,
4114 .p_class = P_GLOBAL,
4115 .ptr = &Globals.bUsershareOwnerOnly,
4116 .special = NULL,
4117 .enum_list = NULL,
4118 .flags = FLAG_ADVANCED,
4119 },
4120 {
4121 .label = "usershare path",
4122 .type = P_STRING,
4123 .p_class = P_GLOBAL,
4124 .ptr = &Globals.szUsersharePath,
4125 .special = NULL,
4126 .enum_list = NULL,
4127 .flags = FLAG_ADVANCED,
4128 },
4129 {
4130 .label = "usershare prefix allow list",
4131 .type = P_LIST,
4132 .p_class = P_GLOBAL,
4133 .ptr = &Globals.szUsersharePrefixAllowList,
4134 .special = NULL,
4135 .enum_list = NULL,
4136 .flags = FLAG_ADVANCED,
4137 },
4138 {
4139 .label = "usershare prefix deny list",
4140 .type = P_LIST,
4141 .p_class = P_GLOBAL,
4142 .ptr = &Globals.szUsersharePrefixDenyList,
4143 .special = NULL,
4144 .enum_list = NULL,
4145 .flags = FLAG_ADVANCED,
4146 },
4147 {
4148 .label = "usershare template share",
4149 .type = P_STRING,
4150 .p_class = P_GLOBAL,
4151 .ptr = &Globals.szUsershareTemplateShare,
4152 .special = NULL,
4153 .enum_list = NULL,
4154 .flags = FLAG_ADVANCED,
4155 },
4156 {
4157 .label = "volume",
4158 .type = P_STRING,
4159 .p_class = P_LOCAL,
4160 .ptr = &sDefault.volume,
4161 .special = NULL,
4162 .enum_list = NULL,
4163 .flags = FLAG_ADVANCED | FLAG_SHARE,
4164 },
4165 {
4166 .label = "fstype",
4167 .type = P_STRING,
4168 .p_class = P_LOCAL,
4169 .ptr = &sDefault.fstype,
4170 .special = NULL,
4171 .enum_list = NULL,
4172 .flags = FLAG_ADVANCED | FLAG_SHARE,
4173 },
4174 {
4175 .label = "set directory",
4176 .type = P_BOOLREV,
4177 .p_class = P_LOCAL,
4178 .ptr = &sDefault.bNo_set_dir,
4179 .special = NULL,
4180 .enum_list = NULL,
4181 .flags = FLAG_ADVANCED | FLAG_SHARE,
4182 },
4183 {
4184 .label = "wide links",
4185 .type = P_BOOL,
4186 .p_class = P_LOCAL,
4187 .ptr = &sDefault.bWidelinks,
4188 .special = NULL,
4189 .enum_list = NULL,
4190 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4191 },
4192 {
4193 .label = "follow symlinks",
4194 .type = P_BOOL,
4195 .p_class = P_LOCAL,
4196 .ptr = &sDefault.bSymlinks,
4197 .special = NULL,
4198 .enum_list = NULL,
4199 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4200 },
4201 {
4202 .label = "dont descend",
4203 .type = P_STRING,
4204 .p_class = P_LOCAL,
4205 .ptr = &sDefault.szDontdescend,
4206 .special = NULL,
4207 .enum_list = NULL,
4208 .flags = FLAG_ADVANCED | FLAG_SHARE,
4209 },
4210 {
4211 .label = "magic script",
4212 .type = P_STRING,
4213 .p_class = P_LOCAL,
4214 .ptr = &sDefault.szMagicScript,
4215 .special = NULL,
4216 .enum_list = NULL,
4217 .flags = FLAG_ADVANCED | FLAG_SHARE,
4218 },
4219 {
4220 .label = "magic output",
4221 .type = P_STRING,
4222 .p_class = P_LOCAL,
4223 .ptr = &sDefault.szMagicOutput,
4224 .special = NULL,
4225 .enum_list = NULL,
4226 .flags = FLAG_ADVANCED | FLAG_SHARE,
4227 },
4228 {
4229 .label = "delete readonly",
4230 .type = P_BOOL,
4231 .p_class = P_LOCAL,
4232 .ptr = &sDefault.bDeleteReadonly,
4233 .special = NULL,
4234 .enum_list = NULL,
4235 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4236 },
4237 {
4238 .label = "dos filemode",
4239 .type = P_BOOL,
4240 .p_class = P_LOCAL,
4241 .ptr = &sDefault.bDosFilemode,
4242 .special = NULL,
4243 .enum_list = NULL,
4244 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4245 },
4246 {
4247 .label = "dos filetimes",
4248 .type = P_BOOL,
4249 .p_class = P_LOCAL,
4250 .ptr = &sDefault.bDosFiletimes,
4251 .special = NULL,
4252 .enum_list = NULL,
4253 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4254 },
4255 {
4256 .label = "dos filetime resolution",
4257 .type = P_BOOL,
4258 .p_class = P_LOCAL,
4259 .ptr = &sDefault.bDosFiletimeResolution,
4260 .special = NULL,
4261 .enum_list = NULL,
4262 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4263 },
4264 {
4265 .label = "fake directory create times",
4266 .type = P_BOOL,
4267 .p_class = P_LOCAL,
4268 .ptr = &sDefault.bFakeDirCreateTimes,
4269 .special = NULL,
4270 .enum_list = NULL,
4271 .flags = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
4272 },
4273 {
4274 .label = "panic action",
4275 .type = P_STRING,
4276 .p_class = P_GLOBAL,
4277 .ptr = &Globals.szPanicAction,
4278 .special = NULL,
4279 .enum_list = NULL,
4280 .flags = FLAG_ADVANCED,
4281 },
4282 {
4283 .label = "perfcount module",
4284 .type = P_STRING,
4285 .p_class = P_GLOBAL,
4286 .ptr = &Globals.szSMBPerfcountModule,
4287 .special = NULL,
4288 .enum_list = NULL,
4289 .flags = FLAG_ADVANCED,
4290 },
4291
4292 {N_("VFS module options"), P_SEP, P_SEPARATOR},
4293
4294 {
4295 .label = "vfs objects",
4296 .type = P_LIST,
4297 .p_class = P_LOCAL,
4298 .ptr = &sDefault.szVfsObjects,
4299 .special = NULL,
4300 .enum_list = NULL,
4301 .flags = FLAG_ADVANCED | FLAG_SHARE,
4302 },
4303 {
4304 .label = "vfs object",
4305 .type = P_LIST,
4306 .p_class = P_LOCAL,
4307 .ptr = &sDefault.szVfsObjects,
4308 .special = NULL,
4309 .enum_list = NULL,
4310 .flags = FLAG_HIDE,
4311 },
4312
4313
4314 {N_("MSDFS options"), P_SEP, P_SEPARATOR},
4315
4316 {
4317 .label = "msdfs root",
4318 .type = P_BOOL,
4319 .p_class = P_LOCAL,
4320 .ptr = &sDefault.bMSDfsRoot,
4321 .special = NULL,
4322 .enum_list = NULL,
4323 .flags = FLAG_ADVANCED | FLAG_SHARE,
4324 },
4325 {
4326 .label = "msdfs proxy",
4327 .type = P_STRING,
4328 .p_class = P_LOCAL,
4329 .ptr = &sDefault.szMSDfsProxy,
4330 .special = NULL,
4331 .enum_list = NULL,
4332 .flags = FLAG_ADVANCED | FLAG_SHARE,
4333 },
4334 {
4335 .label = "host msdfs",
4336 .type = P_BOOL,
4337 .p_class = P_GLOBAL,
4338 .ptr = &Globals.bHostMSDfs,
4339 .special = NULL,
4340 .enum_list = NULL,
4341 .flags = FLAG_ADVANCED,
4342 },
4343
4344 {N_("Winbind options"), P_SEP, P_SEPARATOR},
4345
4346 {
4347 .label = "passdb expand explicit",
4348 .type = P_BOOL,
4349 .p_class = P_GLOBAL,
4350 .ptr = &Globals.bPassdbExpandExplicit,
4351 .special = NULL,
4352 .enum_list = NULL,
4353 .flags = FLAG_ADVANCED,
4354 },
4355 {
4356 .label = "idmap backend",
4357 .type = P_STRING,
4358 .p_class = P_GLOBAL,
4359 .ptr = &Globals.szIdmapBackend,
4360 .special = NULL,
4361 .enum_list = NULL,
4362 .flags = FLAG_ADVANCED,
4363 },
4364 {
4365 .label = "idmap alloc backend",
4366 .type = P_STRING,
4367 .p_class = P_GLOBAL,
4368 .ptr = &Globals.szIdmapAllocBackend,
4369 .special = NULL,
4370 .enum_list = NULL,
4371 .flags = FLAG_ADVANCED,
4372 },
4373 {
4374 .label = "idmap cache time",
4375 .type = P_INTEGER,
4376 .p_class = P_GLOBAL,
4377 .ptr = &Globals.iIdmapCacheTime,
4378 .special = NULL,
4379 .enum_list = NULL,
4380 .flags = FLAG_ADVANCED,
4381 },
4382 {
4383 .label = "idmap negative cache time",
4384 .type = P_INTEGER,
4385 .p_class = P_GLOBAL,
4386 .ptr = &Globals.iIdmapNegativeCacheTime,
4387 .special = NULL,
4388 .enum_list = NULL,
4389 .flags = FLAG_ADVANCED,
4390 },
4391 {
4392 .label = "idmap uid",
4393 .type = P_STRING,
4394 .p_class = P_GLOBAL,
4395 .ptr = &Globals.szIdmapUID,
4396 .special = handle_idmap_uid,
4397 .enum_list = NULL,
4398 .flags = FLAG_ADVANCED,
4399 },
4400 {
4401 .label = "winbind uid",
4402 .type = P_STRING,
4403 .p_class = P_GLOBAL,
4404 .ptr = &Globals.szIdmapUID,
4405 .special = handle_idmap_uid,
4406 .enum_list = NULL,
4407 .flags = FLAG_HIDE,
4408 },
4409 {
4410 .label = "idmap gid",
4411 .type = P_STRING,
4412 .p_class = P_GLOBAL,
4413 .ptr = &Globals.szIdmapGID,
4414 .special = handle_idmap_gid,
4415 .enum_list = NULL,
4416 .flags = FLAG_ADVANCED,
4417 },
4418 {
4419 .label = "winbind gid",
4420 .type = P_STRING,
4421 .p_class = P_GLOBAL,
4422 .ptr = &Globals.szIdmapGID,
4423 .special = handle_idmap_gid,
4424 .enum_list = NULL,
4425 .flags = FLAG_HIDE,
4426 },
4427 {
4428 .label = "template homedir",
4429 .type = P_STRING,
4430 .p_class = P_GLOBAL,
4431 .ptr = &Globals.szTemplateHomedir,
4432 .special = NULL,
4433 .enum_list = NULL,
4434 .flags = FLAG_ADVANCED,
4435 },
4436 {
4437 .label = "template shell",
4438 .type = P_STRING,
4439 .p_class = P_GLOBAL,
4440 .ptr = &Globals.szTemplateShell,
4441 .special = NULL,
4442 .enum_list = NULL,
4443 .flags = FLAG_ADVANCED,
4444 },
4445 {
4446 .label = "winbind separator",
4447 .type = P_STRING,
4448 .p_class = P_GLOBAL,
4449 .ptr = &Globals.szWinbindSeparator,
4450 .special = NULL,
4451 .enum_list = NULL,
4452 .flags = FLAG_ADVANCED,
4453 },
4454 {
4455 .label = "winbind cache time",
4456 .type = P_INTEGER,
4457 .p_class = P_GLOBAL,
4458 .ptr = &Globals.winbind_cache_time,
4459 .special = NULL,
4460 .enum_list = NULL,
4461 .flags = FLAG_ADVANCED,
4462 },
4463 {
4464 .label = "winbind reconnect delay",
4465 .type = P_INTEGER,
4466 .p_class = P_GLOBAL,
4467 .ptr = &Globals.winbind_reconnect_delay,
4468 .special = NULL,
4469 .enum_list = NULL,
4470 .flags = FLAG_ADVANCED,
4471 },
4472 {
4473 .label = "winbind enum users",
4474 .type = P_BOOL,
4475 .p_class = P_GLOBAL,
4476 .ptr = &Globals.bWinbindEnumUsers,
4477 .special = NULL,
4478 .enum_list = NULL,
4479 .flags = FLAG_ADVANCED,
4480 },
4481 {
4482 .label = "winbind enum groups",
4483 .type = P_BOOL,
4484 .p_class = P_GLOBAL,
4485 .ptr = &Globals.bWinbindEnumGroups,
4486 .special = NULL,
4487 .enum_list = NULL,
4488 .flags = FLAG_ADVANCED,
4489 },
4490 {
4491 .label = "winbind use default domain",
4492 .type = P_BOOL,
4493 .p_class = P_GLOBAL,
4494 .ptr = &Globals.bWinbindUseDefaultDomain,
4495 .special = NULL,
4496 .enum_list = NULL,
4497 .flags = FLAG_ADVANCED,
4498 },
4499 {
4500 .label = "winbind trusted domains only",
4501 .type = P_BOOL,
4502 .p_class = P_GLOBAL,
4503 .ptr = &Globals.bWinbindTrustedDomainsOnly,
4504 .special = NULL,
4505 .enum_list = NULL,
4506 .flags = FLAG_ADVANCED,
4507 },
4508 {
4509 .label = "winbind nested groups",
4510 .type = P_BOOL,
4511 .p_class = P_GLOBAL,
4512 .ptr = &Globals.bWinbindNestedGroups,
4513 .special = NULL,
4514 .enum_list = NULL,
4515 .flags = FLAG_ADVANCED,
4516 },
4517 {
4518 .label = "winbind expand groups",
4519 .type = P_INTEGER,
4520 .p_class = P_GLOBAL,
4521 .ptr = &Globals.winbind_expand_groups,
4522 .special = NULL,
4523 .enum_list = NULL,
4524 .flags = FLAG_ADVANCED,
4525 },
4526 {
4527 .label = "winbind nss info",
4528 .type = P_LIST,
4529 .p_class = P_GLOBAL,
4530 .ptr = &Globals.szWinbindNssInfo,
4531 .special = NULL,
4532 .enum_list = NULL,
4533 .flags = FLAG_ADVANCED,
4534 },
4535 {
4536 .label = "winbind refresh tickets",
4537 .type = P_BOOL,
4538 .p_class = P_GLOBAL,
4539 .ptr = &Globals.bWinbindRefreshTickets,
4540 .special = NULL,
4541 .enum_list = NULL,
4542 .flags = FLAG_ADVANCED,
4543 },
4544 {
4545 .label = "winbind offline logon",
4546 .type = P_BOOL,
4547 .p_class = P_GLOBAL,
4548 .ptr = &Globals.bWinbindOfflineLogon,
4549 .special = NULL,
4550 .enum_list = NULL,
4551 .flags = FLAG_ADVANCED,
4552 },
4553 {
4554 .label = "winbind normalize names",
4555 .type = P_BOOL,
4556 .p_class = P_GLOBAL,
4557 .ptr = &Globals.bWinbindNormalizeNames,
4558 .special = NULL,
4559 .enum_list = NULL,
4560 .flags = FLAG_ADVANCED,
4561 },
4562 {
4563 .label = "winbind rpc only",
4564 .type = P_BOOL,
4565 .p_class = P_GLOBAL,
4566 .ptr = &Globals.bWinbindRpcOnly,
4567 .special = NULL,
4568 .enum_list = NULL,
4569 .flags = FLAG_ADVANCED,
4570 },
4571
4572 {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
4573 };
4574
4575 /***************************************************************************
4576 Initialise the sDefault parameter structure for the printer values.
4577 ***************************************************************************/
4578
4579 static void init_printer_values(struct service *pService)
/* [<][>][^][v][top][bottom][index][help] */
4580 {
4581 /* choose defaults depending on the type of printing */
4582 switch (pService->iPrinting) {
4583 case PRINT_BSD:
4584 case PRINT_AIX:
4585 case PRINT_LPRNT:
4586 case PRINT_LPROS2:
4587 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4588 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4589 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4590 break;
4591
4592 case PRINT_LPRNG:
4593 case PRINT_PLP:
4594 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4595 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4596 string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
4597 string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
4598 string_set(&pService->szQueueresumecommand, "lpc start '%p'");
4599 string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
4600 string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
4601 break;
4602
4603 case PRINT_CUPS:
4604 case PRINT_IPRINT:
4605 #ifdef HAVE_CUPS
4606 /* set the lpq command to contain the destination printer
4607 name only. This is used by cups_queue_get() */
4608 string_set(&pService->szLpqcommand, "%p");
4609 string_set(&pService->szLprmcommand, "");
4610 string_set(&pService->szPrintcommand, "");
4611 string_set(&pService->szLppausecommand, "");
4612 string_set(&pService->szLpresumecommand, "");
4613 string_set(&pService->szQueuepausecommand, "");
4614 string_set(&pService->szQueueresumecommand, "");
4615 #else
4616 string_set(&pService->szLpqcommand, "lpq -P'%p'");
4617 string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
4618 string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
4619 string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
4620 string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
4621 string_set(&pService->szQueuepausecommand, "disable '%p'");
4622 string_set(&pService->szQueueresumecommand, "enable '%p'");
4623 #endif /* HAVE_CUPS */
4624 break;
4625
4626 case PRINT_SYSV:
4627 case PRINT_HPUX:
4628 string_set(&pService->szLpqcommand, "lpstat -o%p");
4629 string_set(&pService->szLprmcommand, "cancel %p-%j");
4630 string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
4631 string_set(&pService->szQueuepausecommand, "disable %p");
4632 string_set(&pService->szQueueresumecommand, "enable %p");
4633 #ifndef HPUX
4634 string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
4635 string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
4636 #endif /* HPUX */
4637 break;
4638
4639 case PRINT_QNX:
4640 string_set(&pService->szLpqcommand, "lpq -P%p");
4641 string_set(&pService->szLprmcommand, "lprm -P%p %j");
4642 string_set(&pService->szPrintcommand, "lp -r -P%p %s");
4643 break;
4644
4645 #ifdef DEVELOPER
4646 case PRINT_TEST:
4647 case PRINT_VLP:
4648 string_set(&pService->szPrintcommand, "vlp print %p %s");
4649 string_set(&pService->szLpqcommand, "vlp lpq %p");
4650 string_set(&pService->szLprmcommand, "vlp lprm %p %j");
4651 string_set(&pService->szLppausecommand, "vlp lppause %p %j");
4652 string_set(&pService->szLpresumecommand, "vlp lpresume %p %j");
4653 string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
4654 string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
4655 break;
4656 #endif /* DEVELOPER */
4657
4658 }
4659 }
4660 /**
4661 * Function to return the default value for the maximum number of open
4662 * file descriptors permitted. This function tries to consult the
4663 * kernel-level (sysctl) and ulimit (getrlimit()) values and goes
4664 * the smaller of those.
4665 */
4666 static int max_open_files(void)
/* [<][>][^][v][top][bottom][index][help] */
4667 {
4668 int sysctl_max = MAX_OPEN_FILES;
4669 int rlimit_max = MAX_OPEN_FILES;
4670
4671 #ifdef HAVE_SYSCTLBYNAME
4672 {
4673 size_t size = sizeof(sysctl_max);
4674 sysctlbyname("kern.maxfilesperproc", &sysctl_max, &size, NULL,
4675 0);
4676 }
4677 #endif
4678
4679 #if (defined(HAVE_GETRLIMIT) && defined(RLIMIT_NOFILE))
4680 {
4681 struct rlimit rl;
4682
4683 ZERO_STRUCT(rl);
4684
4685 if (getrlimit(RLIMIT_NOFILE, &rl) == 0)
4686 rlimit_max = rl.rlim_cur;
4687
4688 #if defined(RLIM_INFINITY)
4689 if(rl.rlim_cur == RLIM_INFINITY)
4690 rlimit_max = MAX_OPEN_FILES;
4691 }
4692 #endif
4693 #endif
4694
4695 return MIN(sysctl_max, rlimit_max);
4696 }
4697
4698 /**
4699 * Common part of freeing allocated data for one parameter.
4700 */
4701 static void free_one_parameter_common(void *parm_ptr,
/* [<][>][^][v][top][bottom][index][help] */
4702 struct parm_struct parm)
4703 {
4704 if ((parm.type == P_STRING) ||
4705 (parm.type == P_USTRING))
4706 {
4707 string_free((char**)parm_ptr);
4708 } else if (parm.type == P_LIST) {
4709 TALLOC_FREE(*((char***)parm_ptr));
4710 }
4711 }
4712
4713 /**
4714 * Free the allocated data for one parameter for a share
4715 * given as a service struct.
4716 */
4717 static void free_one_parameter(struct service *service,
/* [<][>][^][v][top][bottom][index][help] */
4718 struct parm_struct parm)
4719 {
4720 void *parm_ptr;
4721
4722 if (parm.p_class != P_LOCAL) {
4723 return;
4724 }
4725
4726 parm_ptr = lp_local_ptr(service, parm.ptr);
4727
4728 free_one_parameter_common(parm_ptr, parm);
4729 }
4730
4731 /**
4732 * Free the allocated parameter data of a share given
4733 * as a service struct.
4734 */
4735 static void free_parameters(struct service *service)
/* [<][>][^][v][top][bottom][index][help] */
4736 {
4737 uint32_t i;
4738
4739 for (i=0; parm_table[i].label; i++) {
4740 free_one_parameter(service, parm_table[i]);
4741 }
4742 }
4743
4744 /**
4745 * Free the allocated data for one parameter for a given share
4746 * specified by an snum.
4747 */
4748 static void free_one_parameter_by_snum(int snum, struct parm_struct parm)
/* [<][>][^][v][top][bottom][index][help] */
4749 {
4750 void *parm_ptr;
4751
4752 if (parm.ptr == NULL) {
4753 return;
4754 }
4755
4756 if (snum < 0) {
4757 parm_ptr = parm.ptr;
4758 } else if (parm.p_class != P_LOCAL) {
4759 return;
4760 } else {
4761 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
4762 }
4763
4764 free_one_parameter_common(parm_ptr, parm);
4765 }
4766
4767 /**
4768 * Free the allocated parameter data for a share specified
4769 * by an snum.
4770 */
4771 static void free_parameters_by_snum(int snum)
/* [<][>][^][v][top][bottom][index][help] */
4772 {
4773 uint32_t i;
4774
4775 for (i=0; parm_table[i].label; i++) {
4776 free_one_parameter_by_snum(snum, parm_table[i]);
4777 }
4778 }
4779
4780 /**
4781 * Free the allocated global parameters.
4782 */
4783 static void free_global_parameters(void)
/* [<][>][^][v][top][bottom][index][help] */
4784 {
4785 free_parameters_by_snum(GLOBAL_SECTION_SNUM);
4786 }
4787
4788 /***************************************************************************
4789 Initialise the global parameter structure.
4790 ***************************************************************************/
4791
4792 static void init_globals(bool first_time_only)
/* [<][>][^][v][top][bottom][index][help] */
4793 {
4794 static bool done_init = False;
4795 char *s = NULL;
4796 int i;
4797
4798 /* If requested to initialize only once and we've already done it... */
4799 if (first_time_only && done_init) {
4800 /* ... then we have nothing more to do */
4801 return;
4802 }
4803
4804 if (!done_init) {
4805 /* The logfile can be set before this is invoked. Free it if so. */
4806 if (Globals.szLogFile != NULL) {
4807 string_free(&Globals.szLogFile);
4808 Globals.szLogFile = NULL;
4809 }
4810 done_init = True;
4811 } else {
4812 free_global_parameters();
4813 }
4814
4815 memset((void *)&Globals, '\0', sizeof(Globals));
4816
4817 for (i = 0; parm_table[i].label; i++) {
4818 if ((parm_table[i].type == P_STRING ||
4819 parm_table[i].type == P_USTRING) &&
4820 parm_table[i].ptr)
4821 {
4822 string_set((char **)parm_table[i].ptr, "");
4823 }
4824 }
4825
4826 string_set(&sDefault.fstype, FSTYPE_STRING);
4827 string_set(&sDefault.szPrintjobUsername, "%U");
4828
4829 init_printer_values(&sDefault);
4830
4831
4832 DEBUG(3, ("Initialising global parameters\n"));
4833
4834 string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
4835 string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
4836
4837 /* use the new 'hash2' method by default, with a prefix of 1 */
4838 string_set(&Globals.szManglingMethod, "hash2");
4839 Globals.mangle_prefix = 1;
4840
4841 string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
4842
4843 /* using UTF8 by default allows us to support all chars */
4844 string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
4845
4846 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
4847 /* If the system supports nl_langinfo(), try to grab the value
4848 from the user's locale */
4849 string_set(&Globals.display_charset, "LOCALE");
4850 #else
4851 string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
4852 #endif
4853
4854 /* Use codepage 850 as a default for the dos character set */
4855 string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
4856
4857 /*
4858 * Allow the default PASSWD_CHAT to be overridden in local.h.
4859 */
4860 string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
4861
4862 set_global_myname(myhostname());
4863 string_set(&Globals.szNetbiosName,global_myname());
4864
4865 set_global_myworkgroup(WORKGROUP);
4866 string_set(&Globals.szWorkgroup, lp_workgroup());
4867
4868 string_set(&Globals.szPasswdProgram, "");
4869 string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
4870 string_set(&Globals.szStateDir, get_dyn_STATEDIR());
4871 string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
4872 string_set(&Globals.szPidDir, get_dyn_PIDDIR());
4873 string_set(&Globals.szSocketAddress, "0.0.0.0");
4874
4875 if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
4876 smb_panic("init_globals: ENOMEM");
4877 }
4878 string_set(&Globals.szServerString, s);
4879 SAFE_FREE(s);
4880 if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
4881 DEFAULT_MINOR_VERSION) < 0) {
4882 smb_panic("init_globals: ENOMEM");
4883 }
4884 string_set(&Globals.szAnnounceVersion, s);
4885 SAFE_FREE(s);
4886 #ifdef DEVELOPER
4887 string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
4888 #endif
4889
4890 string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
4891
4892 string_set(&Globals.szLogonDrive, "");
4893 /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
4894 string_set(&Globals.szLogonHome, "\\\\%N\\%U");
4895 string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
4896
4897 string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
4898 string_set(&Globals.szPasswordServer, "*");
4899
4900 Globals.AlgorithmicRidBase = BASE_RID;
4901
4902 Globals.bLoadPrinters = True;
4903 Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
4904
4905 Globals.ConfigBackend = config_backend;
4906
4907 /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
4908 /* Discovered by 2 days of pain by Don McCall @ HP :-). */
4909 Globals.max_xmit = 0x4104;
4910 Globals.max_mux = 50; /* This is *needed* for profile support. */
4911 Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
4912 Globals.bDisableSpoolss = False;
4913 Globals.iMaxSmbdProcesses = 0;/* no limit specified */
4914 Globals.pwordlevel = 0;
4915 Globals.unamelevel = 0;
4916 Globals.deadtime = 0;
4917 Globals.getwd_cache = true;
4918 Globals.bLargeReadwrite = True;
4919 Globals.max_log_size = 5000;
4920 Globals.max_open_files = max_open_files();
4921 Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
4922 Globals.maxprotocol = PROTOCOL_NT1;
4923 Globals.minprotocol = PROTOCOL_CORE;
4924 Globals.security = SEC_USER;
4925 Globals.paranoid_server_security = True;
4926 Globals.bEncryptPasswords = True;
4927 Globals.bUpdateEncrypt = False;
4928 Globals.clientSchannel = Auto;
4929 Globals.serverSchannel = Auto;
4930 Globals.bReadRaw = True;
4931 Globals.bWriteRaw = True;
4932 Globals.bNullPasswords = False;
4933 Globals.bObeyPamRestrictions = False;
4934 Globals.syslog = 1;
4935 Globals.bSyslogOnly = False;
4936 Globals.bTimestampLogs = True;
4937 string_set(&Globals.szLogLevel, "0");
4938 Globals.bDebugPrefixTimestamp = False;
4939 Globals.bDebugHiresTimestamp = False;
4940 Globals.bDebugPid = False;
4941 Globals.bDebugUid = False;
4942 Globals.bDebugClass = False;
4943 Globals.bEnableCoreFiles = True;
4944 Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
4945 Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
4946 Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
4947 Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
4948 Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
4949 Globals.lm_interval = 60;
4950 Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
4951 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
4952 Globals.bNISHomeMap = False;
4953 #ifdef WITH_NISPLUS_HOME
4954 string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
4955 #else
4956 string_set(&Globals.szNISHomeMapName, "auto.home");
4957 #endif
4958 #endif
4959 Globals.bTimeServer = False;
4960 Globals.bBindInterfacesOnly = False;
4961 Globals.bUnixPasswdSync = False;
4962 Globals.bPamPasswordChange = False;
4963 Globals.bPasswdChatDebug = False;
4964 Globals.iPasswdChatTimeout = 2; /* 2 second default. */
4965 Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
4966 Globals.bNTStatusSupport = True; /* Use NT status by default. */
4967 Globals.bStatCache = True; /* use stat cache by default */
4968 Globals.iMaxStatCacheSize = 256; /* 256k by default */
4969 Globals.restrict_anonymous = 0;
4970 Globals.bClientLanManAuth = False; /* Do NOT use the LanMan hash if it is available */
4971 Globals.bClientPlaintextAuth = False; /* Do NOT use a plaintext password even if is requested by the server */
4972 Globals.bLanmanAuth = False; /* Do NOT use the LanMan hash, even if it is supplied */
4973 Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
4974 Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
4975 /* Note, that we will use NTLM2 session security (which is different), if it is available */
4976
4977 Globals.map_to_guest = 0; /* By Default, "Never" */
4978 Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
4979 Globals.enhanced_browsing = true;
4980 Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
4981 #ifdef MMAP_BLACKLIST
4982 Globals.bUseMmap = False;
4983 #else
4984 Globals.bUseMmap = True;
4985 #endif
4986 Globals.bUnixExtensions = True;
4987 Globals.bResetOnZeroVC = False;
4988
4989 /* hostname lookups can be very expensive and are broken on
4990 a large number of sites (tridge) */
4991 Globals.bHostnameLookups = False;
4992
4993 string_set(&Globals.szPassdbBackend, "tdbsam");
4994 string_set(&Globals.szLdapSuffix, "");
4995 string_set(&Globals.szLdapMachineSuffix, "");
4996 string_set(&Globals.szLdapUserSuffix, "");
4997 string_set(&Globals.szLdapGroupSuffix, "");
4998 string_set(&Globals.szLdapIdmapSuffix, "");
4999
5000 string_set(&Globals.szLdapAdminDn, "");
5001 Globals.ldap_ssl = LDAP_SSL_START_TLS;
5002 Globals.ldap_ssl_ads = False;
5003 Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
5004 Globals.ldap_delete_dn = False;
5005 Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
5006 Globals.ldap_timeout = LDAP_DEFAULT_TIMEOUT;
5007 Globals.ldap_connection_timeout = LDAP_CONNECTION_DEFAULT_TIMEOUT;
5008 Globals.ldap_page_size = LDAP_PAGE_SIZE;
5009
5010 Globals.ldap_debug_level = 0;
5011 Globals.ldap_debug_threshold = 10;
5012
5013 /* This is what we tell the afs client. in reality we set the token
5014 * to never expire, though, when this runs out the afs client will
5015 * forget the token. Set to 0 to get NEVERDATE.*/
5016 Globals.iAfsTokenLifetime = 604800;
5017 Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
5018
5019 /* these parameters are set to defaults that are more appropriate
5020 for the increasing samba install base:
5021
5022 as a member of the workgroup, that will possibly become a
5023 _local_ master browser (lm = True). this is opposed to a forced
5024 local master browser startup (pm = True).
5025
5026 doesn't provide WINS server service by default (wsupp = False),
5027 and doesn't provide domain master browser services by default, either.
5028
5029 */
5030
5031 Globals.bMsAddPrinterWizard = True;
5032 Globals.os_level = 20;
5033 Globals.bLocalMaster = True;
5034 Globals.iDomainMaster = Auto; /* depending on bDomainLogons */
5035 Globals.bDomainLogons = False;
5036 Globals.bBrowseList = True;
5037 Globals.bWINSsupport = False;
5038 Globals.bWINSproxy = False;
5039
5040 TALLOC_FREE(Globals.szInitLogonDelayedHosts);
5041 Globals.InitLogonDelay = 100; /* 100 ms default delay */
5042
5043 Globals.bDNSproxy = True;
5044
5045 /* this just means to use them if they exist */
5046 Globals.bKernelOplocks = True;
5047
5048 Globals.bAllowTrustedDomains = True;
5049 string_set(&Globals.szIdmapBackend, "tdb");
5050
5051 string_set(&Globals.szTemplateShell, "/bin/false");
5052 string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
5053 string_set(&Globals.szWinbindSeparator, "\\");
5054
5055 string_set(&Globals.szCupsServer, "");
5056 string_set(&Globals.szIPrintServer, "");
5057
5058 string_set(&Globals.ctdbdSocket, "");
5059 Globals.szClusterAddresses = NULL;
5060 Globals.clustering = False;
5061
5062 Globals.winbind_cache_time = 300; /* 5 minutes */
5063 Globals.winbind_reconnect_delay = 30; /* 30 seconds */
5064 Globals.bWinbindEnumUsers = False;
5065 Globals.bWinbindEnumGroups = False;
5066 Globals.bWinbindUseDefaultDomain = False;
5067 Globals.bWinbindTrustedDomainsOnly = False;
5068 Globals.bWinbindNestedGroups = True;
5069 Globals.winbind_expand_groups = 1;
5070 Globals.szWinbindNssInfo = str_list_make_v3(talloc_autofree_context(), "template", NULL);
5071 Globals.bWinbindRefreshTickets = False;
5072 Globals.bWinbindOfflineLogon = False;
5073
5074 Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
5075 Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
5076
5077 Globals.bPassdbExpandExplicit = False;
5078
5079 Globals.name_cache_timeout = 660; /* In seconds */
5080
5081 Globals.bUseSpnego = True;
5082 Globals.bClientUseSpnego = True;
5083
5084 Globals.client_signing = Auto;
5085 Globals.server_signing = False;
5086
5087 Globals.bDeferSharingViolations = True;
5088 string_set(&Globals.smb_ports, SMB_PORTS);
5089
5090 Globals.bEnablePrivileges = True;
5091 Globals.bHostMSDfs = True;
5092 Globals.bASUSupport = False;
5093
5094 /* User defined shares. */
5095 if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
5096 smb_panic("init_globals: ENOMEM");
5097 }
5098 string_set(&Globals.szUsersharePath, s);
5099 SAFE_FREE(s);
5100 string_set(&Globals.szUsershareTemplateShare, "");
5101 Globals.iUsershareMaxShares = 0;
5102 /* By default disallow sharing of directories not owned by the sharer. */
5103 Globals.bUsershareOwnerOnly = True;
5104 /* By default disallow guest access to usershares. */
5105 Globals.bUsershareAllowGuests = False;
5106
5107 Globals.iKeepalive = DEFAULT_KEEPALIVE;
5108
5109 /* By default no shares out of the registry */
5110 Globals.bRegistryShares = False;
5111
5112 Globals.iminreceivefile = 0;
5113
5114 Globals.bMapUntrustedToDomain = false;
5115 }
5116
5117 /*******************************************************************
5118 Convenience routine to grab string parameters into temporary memory
5119 and run standard_sub_basic on them. The buffers can be written to by
5120 callers without affecting the source string.
5121 ********************************************************************/
5122
5123 static char *lp_string(const char *s)
/* [<][>][^][v][top][bottom][index][help] */
5124 {
5125 char *ret;
5126 TALLOC_CTX *ctx = talloc_tos();
5127
5128 /* The follow debug is useful for tracking down memory problems
5129 especially if you have an inner loop that is calling a lp_*()
5130 function that returns a string. Perhaps this debug should be
5131 present all the time? */
5132
5133 #if 0
5134 DEBUG(10, ("lp_string(%s)\n", s));
5135 #endif
5136
5137 ret = talloc_sub_basic(ctx,
5138 get_current_username(),
5139 current_user_info.domain,
5140 s);
5141 if (trim_char(ret, '\"', '\"')) {
5142 if (strchr(ret,'\"') != NULL) {
5143 TALLOC_FREE(ret);
5144 ret = talloc_sub_basic(ctx,
5145 get_current_username(),
5146 current_user_info.domain,
5147 s);
5148 }
5149 }
5150 return ret;
5151 }
5152
5153 /*
5154 In this section all the functions that are used to access the
5155 parameters from the rest of the program are defined
5156 */
5157
5158 #define FN_GLOBAL_STRING(fn_name,ptr) \
5159 char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
5160 #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
5161 const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
5162 #define FN_GLOBAL_LIST(fn_name,ptr) \
5163 const char **fn_name(void) {return(*(const char ***)(ptr));}
5164 #define FN_GLOBAL_BOOL(fn_name,ptr) \
5165 bool fn_name(void) {return(*(bool *)(ptr));}
5166 #define FN_GLOBAL_CHAR(fn_name,ptr) \
5167 char fn_name(void) {return(*(char *)(ptr));}
5168 #define FN_GLOBAL_INTEGER(fn_name,ptr) \
5169 int fn_name(void) {return(*(int *)(ptr));}
5170
5171 #define FN_LOCAL_STRING(fn_name,val) \
5172 char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
5173 #define FN_LOCAL_CONST_STRING(fn_name,val) \
5174 const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
5175 #define FN_LOCAL_LIST(fn_name,val) \
5176 const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5177 #define FN_LOCAL_BOOL(fn_name,val) \
5178 bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5179 #define FN_LOCAL_INTEGER(fn_name,val) \
5180 int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
5181
5182 #define FN_LOCAL_PARM_BOOL(fn_name,val) \
5183 bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5184 #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
5185 int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5186 #define FN_LOCAL_PARM_STRING(fn_name,val) \
5187 char *fn_name(const struct share_params *p) {return(lp_string((LP_SNUM_OK(p->service) && ServicePtrs[(p->service)]->val) ? ServicePtrs[(p->service)]->val : sDefault.val));}
5188 #define FN_LOCAL_CHAR(fn_name,val) \
5189 char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
5190
5191 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
/* [<][>][^][v][top][bottom][index][help] */
5192 FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
5193 FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
5194 FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
5195 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
5196 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
5197 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
5198 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
5199 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
5200 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
5201 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
5202 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
5203 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
5204 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
5205 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
5206 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
5207 /* If lp_statedir() and lp_cachedir() are explicitely set during the
5208 * build process or in smb.conf, we use that value. Otherwise they
5209 * default to the value of lp_lockdir(). */
5210 char *lp_statedir(void) {
5211 if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
5212 (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
5213 return(lp_string(*(char **)(&Globals.szStateDir) ?
5214 *(char **)(&Globals.szStateDir) : ""));
5215 else
5216 return(lp_string(*(char **)(&Globals.szLockDir) ?
5217 *(char **)(&Globals.szLockDir) : ""));
5218 }
5219 char *lp_cachedir(void) {
/* [<][>][^][v][top][bottom][index][help] */
5220 if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
5221 (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
5222 return(lp_string(*(char **)(&Globals.szCacheDir) ?
5223 *(char **)(&Globals.szCacheDir) : ""));
5224 else
5225 return(lp_string(*(char **)(&Globals.szLockDir) ?
5226 *(char **)(&Globals.szLockDir) : ""));
5227 }
5228 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
/* [<][>][^][v][top][bottom][index][help] */
5229 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
5230 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
5231 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
5232 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
5233 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
5234 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
5235 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
5236 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
5237 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
5238 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
5239 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
5240 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
5241 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
5242 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
5243 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
5244 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
5245 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
5246 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
5247 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
5248 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
5249 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
5250 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
5251 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
5252 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
5253 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
5254 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
5255 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
5256 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
5257 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
5258 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
5259 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
5260 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
5261 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
5262 * lp_passdb_backend() should be replace by the this macro again after
5263 * some releases.
5264 * */
5265 const char *lp_passdb_backend(void)
5266 {
5267 char *delim, *quote;
5268
5269 delim = strchr( Globals.szPassdbBackend, ' ');
5270 /* no space at all */
5271 if (delim == NULL) {
5272 goto out;
5273 }
5274
5275 quote = strchr(Globals.szPassdbBackend, '"');
5276 /* no quote char or non in the first part */
5277 if (quote == NULL || quote > delim) {
5278 *delim = '\0';
5279 goto warn;
5280 }
5281
5282 quote = strchr(quote+1, '"');
5283 if (quote == NULL) {
5284 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
5285 goto out;
5286 } else if (*(quote+1) == '\0') {
5287 /* space, fitting quote char, and one backend only */
5288 goto out;
5289 } else {
5290 /* terminate string after the fitting quote char */
5291 *(quote+1) = '\0';
5292 }
5293
5294 warn:
5295 DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
5296 "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
5297 "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
5298 "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
5299
5300 out:
5301 return Globals.szPassdbBackend;
5302 }
5303 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
/* [<][>][^][v][top][bottom][index][help] */
5304 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
5305 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
5306 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
5307 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
5308
5309 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
5310 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
5311 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
5312 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
5313 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
5314 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
5315
5316 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
5317
5318 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
5319 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
5320 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
5321
5322 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
5323
5324 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
5325 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
5326 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
5327 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
5328 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
5329 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
5330 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
5331 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
5332 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
5333 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
5334 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
5335 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
5336 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
5337 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
5338 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
5339
5340 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
5341 FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
5342 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
5343 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
5344 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
5345 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
5346
5347 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
5348 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
5349 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
5350 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
5351 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
5352 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
5353 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
5354 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
5355 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
5356 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
5357 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
5358 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
5359 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
5360 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
5361 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
5362 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
5363 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
5364 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
5365
5366 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
5367
5368 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
5369 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
5370 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
5371 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
5372 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
5373 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
5374 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
5375 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
5376 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
5377 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
5378 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
5379 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
5380 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
5381 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
5382 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
5383 FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
5384 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
5385 FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
5386 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
5387 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
5388 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
5389 FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
5390 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
5391 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
5392 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
5393 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
5394 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
5395 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
5396 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
5397 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
5398 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
5399 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
5400 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
5401 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
5402 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
5403 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
5404 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
5405 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
5406 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
5407 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
5408 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
5409 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
5410 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
5411 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
5412 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
5413 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
5414 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
5415 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
5416 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
5417 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
5418 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
5419 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
5420 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
5421 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
5422 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
5423 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
5424 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
5425 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
5426 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
5427 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
5428 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
5429 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
5430 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
5431 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
5432 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
5433 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
5434 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
5435 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
5436 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
5437 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
5438 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
5439 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
5440 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
5441 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
5442 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
5443 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
5444 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
5445 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
5446 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
5447 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
5448 FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
5449 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
5450 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
5451 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
5452 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
5453 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
5454 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
5455 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
5456 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
5457 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
5458 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
5459 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
5460 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
5461 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
5462 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
5463 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
5464 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
5465 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
5466 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
5467 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
5468
5469 FN_LOCAL_STRING(lp_preexec, szPreExec)
5470 FN_LOCAL_STRING(lp_postexec, szPostExec)
5471 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
5472 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
5473 FN_LOCAL_STRING(lp_servicename, szService)
5474 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
5475 FN_LOCAL_STRING(lp_pathname, szPath)
5476 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
5477 FN_LOCAL_STRING(lp_username, szUsername)
5478 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
5479 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
5480 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
5481 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
5482 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
5483 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
5484 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
5485 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
5486 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
5487 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
5488 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
5489 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
5490 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
5491 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
5492 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
5493 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
5494 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
5495 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
5496 static FN_LOCAL_STRING(_lp_printername, szPrintername)
5497 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
5498 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
5499 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
5500 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
5501 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
5502 FN_LOCAL_STRING(lp_comment, comment)
5503 FN_LOCAL_STRING(lp_force_user, force_user)
5504 FN_LOCAL_STRING(lp_force_group, force_group)
5505 FN_LOCAL_LIST(lp_readlist, readlist)
5506 FN_LOCAL_LIST(lp_writelist, writelist)
5507 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
5508 FN_LOCAL_STRING(lp_fstype, fstype)
5509 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
5510 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
5511 static FN_LOCAL_STRING(lp_volume, volume)
5512 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
5513 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
5514 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
5515 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
5516 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
5517 FN_LOCAL_STRING(lp_dfree_command, szDfree)
5518 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
5519 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
5520 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
5521 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
5522 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
5523 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
5524 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
5525 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
5526 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
5527 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
5528 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
5529 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
5530 FN_LOCAL_BOOL(lp_readonly, bRead_only)
5531 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
5532 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
5533 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
5534 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
5535 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
5536 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
5537 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
5538 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
5539 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
5540 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
5541 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
5542 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
5543 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
5544 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
5545 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
5546 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
5547 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
5548 FN_LOCAL_BOOL(lp_widelinks, bWidelinks)
5549 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
5550 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
5551 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
5552 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
5553 FN_LOCAL_BOOL(lp_map_system, bMap_system)
5554 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
5555 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
5556 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
5557 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
5558 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
5559 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
5560 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
5561 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
5562 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
5563 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
5564 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
5565 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
5566 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
5567 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
5568 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
5569 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
5570 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
5571 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
5572 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
5573 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
5574 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
5575 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
5576 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
5577 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
5578 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
5579 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
5580 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
5581 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
5582 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
5583 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
5584 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
5585 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
5586 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
5587 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
5588 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
5589 FN_LOCAL_INTEGER(lp_printing, iPrinting)
5590 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
5591 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
5592 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
5593 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
5594 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
5595 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
5596 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
5597 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
5598 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
5599 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
5600 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
5601 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
5602 FN_LOCAL_CHAR(lp_magicchar, magic_char)
5603 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
5604 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
5605 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
5606 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
5607 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
5608 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
5609 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
5610 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
5611
5612 /* local prototypes */
5613
5614 static int map_parameter(const char *pszParmName);
5615 static int map_parameter_canonical(const char *pszParmName, bool *inverse);
5616 static const char *get_boolean(bool bool_value);
5617 static int getservicebyname(const char *pszServiceName,
5618 struct service *pserviceDest);
5619 static void copy_service(struct service *pserviceDest,
5620 struct service *pserviceSource,
5621 struct bitmap *pcopymapDest);
5622 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
5623 void *userdata);
5624 static bool do_section(const char *pszSectionName, void *userdata);
5625 static void init_copymap(struct service *pservice);
5626 static bool hash_a_service(const char *name, int number);
5627 static void free_service_byindex(int iService);
5628 static void free_param_opts(struct param_opt_struct **popts);
5629 static char * canonicalize_servicename(const char *name);
5630 static void show_parameter(int parmIndex);
5631 static bool is_synonym_of(int parm1, int parm2, bool *inverse);
5632
5633 /*
5634 * This is a helper function for parametrical options support. It returns a
5635 * pointer to parametrical option value if it exists or NULL otherwise. Actual
5636 * parametrical functions are quite simple
5637 */
5638 static struct param_opt_struct *get_parametrics(int snum, const char *type,
5639 const char *option)
5640 {
5641 bool global_section = False;
5642 char* param_key;
5643 struct param_opt_struct *data;
5644
5645 if (snum >= iNumServices) return NULL;
5646
5647 if (snum < 0) {
5648 data = Globals.param_opt;
5649 global_section = True;
5650 } else {
5651 data = ServicePtrs[snum]->param_opt;
5652 }
5653
5654 if (asprintf(¶m_key, "%s:%s", type, option) == -1) {
5655 DEBUG(0,("asprintf failed!\n"));
5656 return NULL;
5657 }
5658
5659 while (data) {
5660 if (strwicmp(data->key, param_key) == 0) {
5661 string_free(¶m_key);
5662 return data;
5663 }
5664 data = data->next;
5665 }
5666
5667 if (!global_section) {
5668 /* Try to fetch the same option but from globals */
5669 /* but only if we are not already working with Globals */
5670 data = Globals.param_opt;
5671 while (data) {
5672 if (strwicmp(data->key, param_key) == 0) {
5673 string_free(¶m_key);
5674 return data;
5675 }
5676 data = data->next;
5677 }
5678 }
5679
5680 string_free(¶m_key);
5681
5682 return NULL;
5683 }
5684
5685
5686 #define MISSING_PARAMETER(name) \
5687 DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
5688
5689 /*******************************************************************
5690 convenience routine to return int parameters.
5691 ********************************************************************/
5692 static int lp_int(const char *s)
/* [<][>][^][v][top][bottom][index][help] */
5693 {
5694
5695 if (!s || !*s) {
5696 MISSING_PARAMETER(lp_int);
5697 return (-1);
5698 }
5699
5700 return (int)strtol(s, NULL, 0);
5701 }
5702
5703 /*******************************************************************
5704 convenience routine to return unsigned long parameters.
5705 ********************************************************************/
5706 static unsigned long lp_ulong(const char *s)
/* [<][>][^][v][top][bottom][index][help] */
5707 {
5708
5709 if (!s || !*s) {
5710 MISSING_PARAMETER(lp_ulong);
5711 return (0);
5712 }
5713
5714 return strtoul(s, NULL, 0);
5715 }
5716
5717 /*******************************************************************
5718 convenience routine to return boolean parameters.
5719 ********************************************************************/
5720 static bool lp_bool(const char *s)
/* [<][>][^][v][top][bottom][index][help] */
5721 {
5722 bool ret = False;
5723
5724 if (!s || !*s) {
5725 MISSING_PARAMETER(lp_bool);
5726 return False;
5727 }
5728
5729 if (!set_boolean(s, &ret)) {
5730 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
5731 return False;
5732 }
5733
5734 return ret;
5735 }
5736
5737 /*******************************************************************
5738 convenience routine to return enum parameters.
5739 ********************************************************************/
5740 static int lp_enum(const char *s,const struct enum_list *_enum)
/* [<][>][^][v][top][bottom][index][help] */
5741 {
5742 int i;
5743
5744 if (!s || !*s || !_enum) {
5745 MISSING_PARAMETER(lp_enum);
5746 return (-1);
5747 }
5748
5749 for (i=0; _enum[i].name; i++) {
5750 if (strequal(_enum[i].name,s))
5751 return _enum[i].value;
5752 }
5753
5754 DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
5755 return (-1);
5756 }
5757
5758 #undef MISSING_PARAMETER
5759
5760 /* DO NOT USE lp_parm_string ANYMORE!!!!
5761 * use lp_parm_const_string or lp_parm_talloc_string
5762 *
5763 * lp_parm_string is only used to let old modules find this symbol
5764 */
5765 #undef lp_parm_string
5766 char *lp_parm_string(const char *servicename, const char *type, const char *option);
5767 char *lp_parm_string(const char *servicename, const char *type, const char *option)
/* [<][>][^][v][top][bottom][index][help] */
5768 {
5769 return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
5770 }
5771
5772 /* Return parametric option from a given service. Type is a part of option before ':' */
5773 /* Parametric option has following syntax: 'Type: option = value' */
5774 /* the returned value is talloced on the talloc_tos() */
5775 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
/* [<][>][^][v][top][bottom][index][help] */
5776 {
5777 struct param_opt_struct *data = get_parametrics(snum, type, option);
5778
5779 if (data == NULL||data->value==NULL) {
5780 if (def) {
5781 return lp_string(def);
5782 } else {
5783 return NULL;
5784 }
5785 }
5786
5787 return lp_string(data->value);
5788 }
5789
5790 /* Return parametric option from a given service. Type is a part of option before ':' */
5791 /* Parametric option has following syntax: 'Type: option = value' */
5792 const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
/* [<][>][^][v][top][bottom][index][help] */
5793 {
5794 struct param_opt_struct *data = get_parametrics(snum, type, option);
5795
5796 if (data == NULL||data->value==NULL)
5797 return def;
5798
5799 return data->value;
5800 }
5801
5802 /* Return parametric option from a given service. Type is a part of option before ':' */
5803 /* Parametric option has following syntax: 'Type: option = value' */
5804
5805 const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
/* [<][>][^][v][top][bottom][index][help] */
5806 {
5807 struct param_opt_struct *data = get_parametrics(snum, type, option);
5808
5809 if (data == NULL||data->value==NULL)
5810 return (const char **)def;
5811
5812 if (data->list==NULL) {
5813 data->list = str_list_make_v3(talloc_autofree_context(), data->value, NULL);
5814 }
5815
5816 return (const char **)data->list;
5817 }
5818
5819 /* Return parametric option from a given service. Type is a part of option before ':' */
5820 /* Parametric option has following syntax: 'Type: option = value' */
5821
5822 int lp_parm_int(int snum, const char *type, const char *option, int def)
/* [<][>][^][v][top][bottom][index][help] */
5823 {
5824 struct param_opt_struct *data = get_parametrics(snum, type, option);
5825
5826 if (data && data->value && *data->value)
5827 return lp_int(data->value);
5828
5829 return def;
5830 }
5831
5832 /* Return parametric option from a given service. Type is a part of option before ':' */
5833 /* Parametric option has following syntax: 'Type: option = value' */
5834
5835 unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
/* [<][>][^][v][top][bottom][index][help] */
5836 {
5837 struct param_opt_struct *data = get_parametrics(snum, type, option);
5838
5839 if (data && data->value && *data->value)
5840 return lp_ulong(data->value);
5841
5842 return def;
5843 }
5844
5845 /* Return parametric option from a given service. Type is a part of option before ':' */
5846 /* Parametric option has following syntax: 'Type: option = value' */
5847
5848 bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
/* [<][>][^][v][top][bottom][index][help] */
5849 {
5850 struct param_opt_struct *data = get_parametrics(snum, type, option);
5851
5852 if (data && data->value && *data->value)
5853 return lp_bool(data->value);
5854
5855 return def;
5856 }
5857
5858 /* Return parametric option from a given service. Type is a part of option before ':' */
5859 /* Parametric option has following syntax: 'Type: option = value' */
5860
5861 int lp_parm_enum(int snum, const char *type, const char *option,
/* [<][>][^][v][top][bottom][index][help] */
5862 const struct enum_list *_enum, int def)
5863 {
5864 struct param_opt_struct *data = get_parametrics(snum, type, option);
5865
5866 if (data && data->value && *data->value && _enum)
5867 return lp_enum(data->value, _enum);
5868
5869 return def;
5870 }
5871
5872
5873 /***************************************************************************
5874 Initialise a service to the defaults.
5875 ***************************************************************************/
5876
5877 static void init_service(struct service *pservice)
/* [<][>][^][v][top][bottom][index][help] */
5878 {
5879 memset((char *)pservice, '\0', sizeof(struct service));
5880 copy_service(pservice, &sDefault, NULL);
5881 }
5882
5883
5884 /**
5885 * free a param_opts structure.
5886 * param_opts handling should be moved to talloc;
5887 * then this whole functions reduces to a TALLOC_FREE().
5888 */
5889
5890 static void free_param_opts(struct param_opt_struct **popts)
/* [<][>][^][v][top][bottom][index][help] */
5891 {
5892 struct param_opt_struct *opt, *next_opt;
5893
5894 if (popts == NULL) {
5895 return;
5896 }
5897
5898 if (*popts != NULL) {
5899 DEBUG(5, ("Freeing parametrics:\n"));
5900 }
5901 opt = *popts;
5902 while (opt != NULL) {
5903 string_free(&opt->key);
5904 string_free(&opt->value);
5905 TALLOC_FREE(opt->list);
5906 next_opt = opt->next;
5907 SAFE_FREE(opt);
5908 opt = next_opt;
5909 }
5910 *popts = NULL;
5911 }
5912
5913 /***************************************************************************
5914 Free the dynamically allocated parts of a service struct.
5915 ***************************************************************************/
5916
5917 static void free_service(struct service *pservice)
/* [<][>][^][v][top][bottom][index][help] */
5918 {
5919 if (!pservice)
5920 return;
5921
5922 if (pservice->szService)
5923 DEBUG(5, ("free_service: Freeing service %s\n",
5924 pservice->szService));
5925
5926 free_parameters(pservice);
5927
5928 string_free(&pservice->szService);
5929 bitmap_free(pservice->copymap);
5930
5931 free_param_opts(&pservice->param_opt);
5932
5933 ZERO_STRUCTP(pservice);
5934 }
5935
5936
5937 /***************************************************************************
5938 remove a service indexed in the ServicePtrs array from the ServiceHash
5939 and free the dynamically allocated parts
5940 ***************************************************************************/
5941
5942 static void free_service_byindex(int idx)
/* [<][>][^][v][top][bottom][index][help] */
5943 {
5944 if ( !LP_SNUM_OK(idx) )
5945 return;
5946
5947 ServicePtrs[idx]->valid = False;
5948 invalid_services[num_invalid_services++] = idx;
5949
5950 /* we have to cleanup the hash record */
5951
5952 if (ServicePtrs[idx]->szService) {
5953 char *canon_name = canonicalize_servicename(
5954 ServicePtrs[idx]->szService );
5955
5956 dbwrap_delete_bystring(ServiceHash, canon_name );
5957 TALLOC_FREE(canon_name);
5958 }
5959
5960 free_service(ServicePtrs[idx]);
5961 }
5962
5963 /***************************************************************************
5964 Add a new service to the services array initialising it with the given
5965 service.
5966 ***************************************************************************/
5967
5968 static int add_a_service(const struct service *pservice, const char *name)
/* [<][>][^][v][top][bottom][index][help] */
5969 {
5970 int i;
5971 struct service tservice;
5972 int num_to_alloc = iNumServices + 1;
5973
5974 tservice = *pservice;
5975
5976 /* it might already exist */
5977 if (name) {
5978 i = getservicebyname(name, NULL);
5979 if (i >= 0) {
5980 /* Clean all parametric options for service */
5981 /* They will be added during parsing again */
5982 free_param_opts(&ServicePtrs[i]->param_opt);
5983 return (i);
5984 }
5985 }
5986
5987 /* find an invalid one */
5988 i = iNumServices;
5989 if (num_invalid_services > 0) {
5990 i = invalid_services[--num_invalid_services];
5991 }
5992
5993 /* if not, then create one */
5994 if (i == iNumServices) {
5995 struct service **tsp;
5996 int *tinvalid;
5997
5998 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
5999 if (tsp == NULL) {
6000 DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
6001 return (-1);
6002 }
6003 ServicePtrs = tsp;
6004 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
6005 if (!ServicePtrs[iNumServices]) {
6006 DEBUG(0,("add_a_service: out of memory!\n"));
6007 return (-1);
6008 }
6009 iNumServices++;
6010
6011 /* enlarge invalid_services here for now... */
6012 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
6013 num_to_alloc);
6014 if (tinvalid == NULL) {
6015 DEBUG(0,("add_a_service: failed to enlarge "
6016 "invalid_services!\n"));
6017 return (-1);
6018 }
6019 invalid_services = tinvalid;
6020 } else {
6021 free_service_byindex(i);
6022 }
6023
6024 ServicePtrs[i]->valid = True;
6025
6026 init_service(ServicePtrs[i]);
6027 copy_service(ServicePtrs[i], &tservice, NULL);
6028 if (name)
6029 string_set(&ServicePtrs[i]->szService, name);
6030
6031 DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
6032 i, ServicePtrs[i]->szService));
6033
6034 if (!hash_a_service(ServicePtrs[i]->szService, i)) {
6035 return (-1);
6036 }
6037
6038 return (i);
6039 }
6040
6041 /***************************************************************************
6042 Convert a string to uppercase and remove whitespaces.
6043 ***************************************************************************/
6044
6045 static char *canonicalize_servicename(const char *src)
/* [<][>][^][v][top][bottom][index][help] */
6046 {
6047 char *result;
6048
6049 if ( !src ) {
6050 DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
6051 return NULL;
6052 }
6053
6054 result = talloc_strdup(talloc_tos(), src);
6055 SMB_ASSERT(result != NULL);
6056
6057 strlower_m(result);
6058 return result;
6059 }
6060
6061 /***************************************************************************
6062 Add a name/index pair for the services array to the hash table.
6063 ***************************************************************************/
6064
6065 static bool hash_a_service(const char *name, int idx)
/* [<][>][^][v][top][bottom][index][help] */
6066 {
6067 char *canon_name;
6068
6069 if ( !ServiceHash ) {
6070 DEBUG(10,("hash_a_service: creating servicehash\n"));
6071 ServiceHash = db_open_rbt(NULL);
6072 if ( !ServiceHash ) {
6073 DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
6074 return False;
6075 }
6076 }
6077
6078 DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
6079 idx, name));
6080
6081 canon_name = canonicalize_servicename( name );
6082
6083 dbwrap_store_bystring(ServiceHash, canon_name,
6084 make_tdb_data((uint8 *)&idx, sizeof(idx)),
6085 TDB_REPLACE);
6086
6087 TALLOC_FREE(canon_name);
6088
6089 return True;
6090 }
6091
6092 /***************************************************************************
6093 Add a new home service, with the specified home directory, defaults coming
6094 from service ifrom.
6095 ***************************************************************************/
6096
6097 bool lp_add_home(const char *pszHomename, int iDefaultService,
/* [<][>][^][v][top][bottom][index][help] */
6098 const char *user, const char *pszHomedir)
6099 {
6100 int i;
6101
6102 if (pszHomename == NULL || user == NULL || pszHomedir == NULL ||
6103 pszHomedir[0] == '\0') {
6104 return false;
6105 }
6106
6107 i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
6108
6109 if (i < 0)
6110 return (False);
6111
6112 if (!(*(ServicePtrs[iDefaultService]->szPath))
6113 || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
6114 string_set(&ServicePtrs[i]->szPath, pszHomedir);
6115 }
6116
6117 if (!(*(ServicePtrs[i]->comment))) {
6118 char *comment = NULL;
6119 if (asprintf(&comment, "Home directory of %s", user) < 0) {
6120 return false;
6121 }
6122 string_set(&ServicePtrs[i]->comment, comment);
6123 SAFE_FREE(comment);
6124 }
6125
6126 /* set the browseable flag from the global default */
6127
6128 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6129 ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
6130
6131 ServicePtrs[i]->autoloaded = True;
6132
6133 DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
6134 user, ServicePtrs[i]->szPath ));
6135
6136 return (True);
6137 }
6138
6139 /***************************************************************************
6140 Add a new service, based on an old one.
6141 ***************************************************************************/
6142
6143 int lp_add_service(const char *pszService, int iDefaultService)
/* [<][>][^][v][top][bottom][index][help] */
6144 {
6145 if (iDefaultService < 0) {
6146 return add_a_service(&sDefault, pszService);
6147 }
6148
6149 return (add_a_service(ServicePtrs[iDefaultService], pszService));
6150 }
6151
6152 /***************************************************************************
6153 Add the IPC service.
6154 ***************************************************************************/
6155
6156 static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
/* [<][>][^][v][top][bottom][index][help] */
6157 {
6158 char *comment = NULL;
6159 int i = add_a_service(&sDefault, ipc_name);
6160
6161 if (i < 0)
6162 return (False);
6163
6164 if (asprintf(&comment, "IPC Service (%s)",
6165 Globals.szServerString) < 0) {
6166 return (False);
6167 }
6168
6169 string_set(&ServicePtrs[i]->szPath, tmpdir());
6170 string_set(&ServicePtrs[i]->szUsername, "");
6171 string_set(&ServicePtrs[i]->comment, comment);
6172 string_set(&ServicePtrs[i]->fstype, "IPC");
6173 ServicePtrs[i]->iMaxConnections = 0;
6174 ServicePtrs[i]->bAvailable = True;
6175 ServicePtrs[i]->bRead_only = True;
6176 ServicePtrs[i]->bGuest_only = False;
6177 ServicePtrs[i]->bAdministrative_share = True;
6178 ServicePtrs[i]->bGuest_ok = guest_ok;
6179 ServicePtrs[i]->bPrint_ok = False;
6180 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6181
6182 DEBUG(3, ("adding IPC service\n"));
6183
6184 SAFE_FREE(comment);
6185 return (True);
6186 }
6187
6188 /***************************************************************************
6189 Add a new printer service, with defaults coming from service iFrom.
6190 ***************************************************************************/
6191
6192 bool lp_add_printer(const char *pszPrintername, int iDefaultService)
/* [<][>][^][v][top][bottom][index][help] */
6193 {
6194 const char *comment = "From Printcap";
6195 int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
6196
6197 if (i < 0)
6198 return (False);
6199
6200 /* note that we do NOT default the availability flag to True - */
6201 /* we take it from the default service passed. This allows all */
6202 /* dynamic printers to be disabled by disabling the [printers] */
6203 /* entry (if/when the 'available' keyword is implemented!). */
6204
6205 /* the printer name is set to the service name. */
6206 string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
6207 string_set(&ServicePtrs[i]->comment, comment);
6208
6209 /* set the browseable flag from the gloabl default */
6210 ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
6211
6212 /* Printers cannot be read_only. */
6213 ServicePtrs[i]->bRead_only = False;
6214 /* No share modes on printer services. */
6215 ServicePtrs[i]->bShareModes = False;
6216 /* No oplocks on printer services. */
6217 ServicePtrs[i]->bOpLocks = False;
6218 /* Printer services must be printable. */
6219 ServicePtrs[i]->bPrint_ok = True;
6220
6221 DEBUG(3, ("adding printer service %s\n", pszPrintername));
6222
6223 return (True);
6224 }
6225
6226
6227 /***************************************************************************
6228 Check whether the given parameter name is valid.
6229 Parametric options (names containing a colon) are considered valid.
6230 ***************************************************************************/
6231
6232 bool lp_parameter_is_valid(const char *pszParmName)
/* [<][>][^][v][top][bottom][index][help] */
6233 {
6234 return ((map_parameter(pszParmName) != -1) ||
6235 (strchr(pszParmName, ':') != NULL));
6236 }
6237
6238 /***************************************************************************
6239 Check whether the given name is the name of a global parameter.
6240 Returns True for strings belonging to parameters of class
6241 P_GLOBAL, False for all other strings, also for parametric options
6242 and strings not belonging to any option.
6243 ***************************************************************************/
6244
6245 bool lp_parameter_is_global(const char *pszParmName)
/* [<][>][^][v][top][bottom][index][help] */
6246 {
6247 int num = map_parameter(pszParmName);
6248
6249 if (num >= 0) {
6250 return (parm_table[num].p_class == P_GLOBAL);
6251 }
6252
6253 return False;
6254 }
6255
6256 /**************************************************************************
6257 Check whether the given name is the canonical name of a parameter.
6258 Returns False if it is not a valid parameter Name.
6259 For parametric options, True is returned.
6260 **************************************************************************/
6261
6262 bool lp_parameter_is_canonical(const char *parm_name)
/* [<][>][^][v][top][bottom][index][help] */
6263 {
6264 if (!lp_parameter_is_valid(parm_name)) {
6265 return False;
6266 }
6267
6268 return (map_parameter(parm_name) ==
6269 map_parameter_canonical(parm_name, NULL));
6270 }
6271
6272 /**************************************************************************
6273 Determine the canonical name for a parameter.
6274 Indicate when it is an inverse (boolean) synonym instead of a
6275 "usual" synonym.
6276 **************************************************************************/
6277
6278 bool lp_canonicalize_parameter(const char *parm_name, const char **canon_parm,
/* [<][>][^][v][top][bottom][index][help] */
6279 bool *inverse)
6280 {
6281 int num;
6282
6283 if (!lp_parameter_is_valid(parm_name)) {
6284 *canon_parm = NULL;
6285 return False;
6286 }
6287
6288 num = map_parameter_canonical(parm_name, inverse);
6289 if (num < 0) {
6290 /* parametric option */
6291 *canon_parm = parm_name;
6292 } else {
6293 *canon_parm = parm_table[num].label;
6294 }
6295
6296 return True;
6297
6298 }
6299
6300 /**************************************************************************
6301 Determine the canonical name for a parameter.
6302 Turn the value given into the inverse boolean expression when
6303 the synonym is an invers boolean synonym.
6304
6305 Return True if parm_name is a valid parameter name and
6306 in case it is an invers boolean synonym, if the val string could
6307 successfully be converted to the reverse bool.
6308 Return false in all other cases.
6309 **************************************************************************/
6310
6311 bool lp_canonicalize_parameter_with_value(const char *parm_name,
/* [<][>][^][v][top][bottom][index][help] */
6312 const char *val,
6313 const char **canon_parm,
6314 const char **canon_val)
6315 {
6316 int num;
6317 bool inverse;
6318
6319 if (!lp_parameter_is_valid(parm_name)) {
6320 *canon_parm = NULL;
6321 *canon_val = NULL;
6322 return False;
6323 }
6324
6325 num = map_parameter_canonical(parm_name, &inverse);
6326 if (num < 0) {
6327 /* parametric option */
6328 *canon_parm = parm_name;
6329 *canon_val = val;
6330 } else {
6331 *canon_parm = parm_table[num].label;
6332 if (inverse) {
6333 if (!lp_invert_boolean(val, canon_val)) {
6334 *canon_val = NULL;
6335 return False;
6336 }
6337 } else {
6338 *canon_val = val;
6339 }
6340 }
6341
6342 return True;
6343 }
6344
6345 /***************************************************************************
6346 Map a parameter's string representation to something we can use.
6347 Returns False if the parameter string is not recognised, else TRUE.
6348 ***************************************************************************/
6349
6350 static int map_parameter(const char *pszParmName)
/* [<][>][^][v][top][bottom][index][help] */
6351 {
6352 int iIndex;
6353
6354 if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
6355 return (-1);
6356
6357 for (iIndex = 0; parm_table[iIndex].label; iIndex++)
6358 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
6359 return (iIndex);
6360
6361 /* Warn only if it isn't parametric option */
6362 if (strchr(pszParmName, ':') == NULL)
6363 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
6364 /* We do return 'fail' for parametric options as well because they are
6365 stored in different storage
6366 */
6367 return (-1);
6368 }
6369
6370 /***************************************************************************
6371 Map a parameter's string representation to the index of the canonical
6372 form of the parameter (it might be a synonym).
6373 Returns -1 if the parameter string is not recognised.
6374 ***************************************************************************/
6375
6376 static int map_parameter_canonical(const char *pszParmName, bool *inverse)
/* [<][>][^][v][top][bottom][index][help] */
6377 {
6378 int parm_num, canon_num;
6379 bool loc_inverse = False;
6380
6381 parm_num = map_parameter(pszParmName);
6382 if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
6383 /* invalid, parametric or no canidate for synonyms ... */
6384 goto done;
6385 }
6386
6387 for (canon_num = 0; parm_table[canon_num].label; canon_num++) {
6388 if (is_synonym_of(parm_num, canon_num, &loc_inverse)) {
6389 parm_num = canon_num;
6390 goto done;
6391 }
6392 }
6393
6394 done:
6395 if (inverse != NULL) {
6396 *inverse = loc_inverse;
6397 }
6398 return parm_num;
6399 }
6400
6401 /***************************************************************************
6402 return true if parameter number parm1 is a synonym of parameter
6403 number parm2 (parm2 being the principal name).
6404 set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
6405 False otherwise.
6406 ***************************************************************************/
6407
6408 static bool is_synonym_of(int parm1, int parm2, bool *inverse)
/* [<][>][^][v][top][bottom][index][help] */
6409 {
6410 if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
6411 (parm_table[parm1].flags & FLAG_HIDE) &&
6412 !(parm_table[parm2].flags & FLAG_HIDE))
6413 {
6414 if (inverse != NULL) {
6415 if ((parm_table[parm1].type == P_BOOLREV) &&
6416 (parm_table[parm2].type == P_BOOL))
6417 {
6418 *inverse = True;
6419 } else {
6420 *inverse = False;
6421 }
6422 }
6423 return True;
6424 }
6425 return False;
6426 }
6427
6428 /***************************************************************************
6429 Show one parameter's name, type, [values,] and flags.
6430 (helper functions for show_parameter_list)
6431 ***************************************************************************/
6432
6433 static void show_parameter(int parmIndex)
/* [<][>][^][v][top][bottom][index][help] */
6434 {
6435 int enumIndex, flagIndex;
6436 int parmIndex2;
6437 bool hadFlag;
6438 bool hadSyn;
6439 bool inverse;
6440 const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
6441 "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
6442 "P_ENUM", "P_SEP"};
6443 unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
6444 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
6445 FLAG_HIDE, FLAG_DOS_STRING};
6446 const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
6447 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
6448 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
6449
6450 printf("%s=%s", parm_table[parmIndex].label,
6451 type[parm_table[parmIndex].type]);
6452 if (parm_table[parmIndex].type == P_ENUM) {
6453 printf(",");
6454 for (enumIndex=0;
6455 parm_table[parmIndex].enum_list[enumIndex].name;
6456 enumIndex++)
6457 {
6458 printf("%s%s",
6459 enumIndex ? "|" : "",
6460 parm_table[parmIndex].enum_list[enumIndex].name);
6461 }
6462 }
6463 printf(",");
6464 hadFlag = False;
6465 for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
6466 if (parm_table[parmIndex].flags & flags[flagIndex]) {
6467 printf("%s%s",
6468 hadFlag ? "|" : "",
6469 flag_names[flagIndex]);
6470 hadFlag = True;
6471 }
6472 }
6473
6474 /* output synonyms */
6475 hadSyn = False;
6476 for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
6477 if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
6478 printf(" (%ssynonym of %s)", inverse ? "inverse " : "",
6479 parm_table[parmIndex2].label);
6480 } else if (is_synonym_of(parmIndex2, parmIndex, &inverse)) {
6481 if (!hadSyn) {
6482 printf(" (synonyms: ");
6483 hadSyn = True;
6484 } else {
6485 printf(", ");
6486 }
6487 printf("%s%s", parm_table[parmIndex2].label,
6488 inverse ? "[i]" : "");
6489 }
6490 }
6491 if (hadSyn) {
6492 printf(")");
6493 }
6494
6495 printf("\n");
6496 }
6497
6498 /***************************************************************************
6499 Show all parameter's name, type, [values,] and flags.
6500 ***************************************************************************/
6501
6502 void show_parameter_list(void)
/* [<][>][^][v][top][bottom][index][help] */
6503 {
6504 int classIndex, parmIndex;
6505 const char *section_names[] = { "local", "global", NULL};
6506
6507 for (classIndex=0; section_names[classIndex]; classIndex++) {
6508 printf("[%s]\n", section_names[classIndex]);
6509 for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
6510 if (parm_table[parmIndex].p_class == classIndex) {
6511 show_parameter(parmIndex);
6512 }
6513 }
6514 }
6515 }
6516
6517 /***************************************************************************
6518 Check if a given string correctly represents a boolean value.
6519 ***************************************************************************/
6520
6521 bool lp_string_is_valid_boolean(const char *parm_value)
/* [<][>][^][v][top][bottom][index][help] */
6522 {
6523 return set_boolean(parm_value, NULL);
6524 }
6525
6526 /***************************************************************************
6527 Get the standard string representation of a boolean value ("yes" or "no")
6528 ***************************************************************************/
6529
6530 static const char *get_boolean(bool bool_value)
/* [<][>][^][v][top][bottom][index][help] */
6531 {
6532 static const char *yes_str = "yes";
6533 static const char *no_str = "no";
6534
6535 return (bool_value ? yes_str : no_str);
6536 }
6537
6538 /***************************************************************************
6539 Provide the string of the negated boolean value associated to the boolean
6540 given as a string. Returns False if the passed string does not correctly
6541 represent a boolean.
6542 ***************************************************************************/
6543
6544 bool lp_invert_boolean(const char *str, const char **inverse_str)
/* [<][>][^][v][top][bottom][index][help] */
6545 {
6546 bool val;
6547
6548 if (!set_boolean(str, &val)) {
6549 return False;
6550 }
6551
6552 *inverse_str = get_boolean(!val);
6553 return True;
6554 }
6555
6556 /***************************************************************************
6557 Provide the canonical string representation of a boolean value given
6558 as a string. Return True on success, False if the string given does
6559 not correctly represent a boolean.
6560 ***************************************************************************/
6561
6562 bool lp_canonicalize_boolean(const char *str, const char**canon_str)
/* [<][>][^][v][top][bottom][index][help] */
6563 {
6564 bool val;
6565
6566 if (!set_boolean(str, &val)) {
6567 return False;
6568 }
6569
6570 *canon_str = get_boolean(val);
6571 return True;
6572 }
6573
6574 /***************************************************************************
6575 Find a service by name. Otherwise works like get_service.
6576 ***************************************************************************/
6577
6578 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
/* [<][>][^][v][top][bottom][index][help] */
6579 {
6580 int iService = -1;
6581 char *canon_name;
6582 TDB_DATA data;
6583
6584 if (ServiceHash == NULL) {
6585 return -1;
6586 }
6587
6588 canon_name = canonicalize_servicename(pszServiceName);
6589
6590 data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
6591
6592 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
6593 iService = *(int *)data.dptr;
6594 }
6595
6596 TALLOC_FREE(canon_name);
6597
6598 if ((iService != -1) && (LP_SNUM_OK(iService))
6599 && (pserviceDest != NULL)) {
6600 copy_service(pserviceDest, ServicePtrs[iService], NULL);
6601 }
6602
6603 return (iService);
6604 }
6605
6606 /***************************************************************************
6607 Copy a service structure to another.
6608 If pcopymapDest is NULL then copy all fields
6609 ***************************************************************************/
6610
6611 /**
6612 * Add a parametric option to a param_opt_struct,
6613 * replacing old value, if already present.
6614 */
6615 static void set_param_opt(struct param_opt_struct **opt_list,
/* [<][>][^][v][top][bottom][index][help] */
6616 const char *opt_name,
6617 const char *opt_value)
6618 {
6619 struct param_opt_struct *new_opt, *opt;
6620 bool not_added;
6621
6622 if (opt_list == NULL) {
6623 return;
6624 }
6625
6626 opt = *opt_list;
6627 not_added = true;
6628
6629 /* Traverse destination */
6630 while (opt) {
6631 /* If we already have same option, override it */
6632 if (strwicmp(opt->key, opt_name) == 0) {
6633 string_free(&opt->value);
6634 TALLOC_FREE(opt->list);
6635 opt->value = SMB_STRDUP(opt_value);
6636 not_added = false;
6637 break;
6638 }
6639 opt = opt->next;
6640 }
6641 if (not_added) {
6642 new_opt = SMB_XMALLOC_P(struct param_opt_struct);
6643 new_opt->key = SMB_STRDUP(opt_name);
6644 new_opt->value = SMB_STRDUP(opt_value);
6645 new_opt->list = NULL;
6646 DLIST_ADD(*opt_list, new_opt);
6647 }
6648 }
6649
6650 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
/* [<][>][^][v][top][bottom][index][help] */
6651 struct bitmap *pcopymapDest)
6652 {
6653 int i;
6654 bool bcopyall = (pcopymapDest == NULL);
6655 struct param_opt_struct *data;
6656
6657 for (i = 0; parm_table[i].label; i++)
6658 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
6659 (bcopyall || bitmap_query(pcopymapDest,i))) {
6660 void *def_ptr = parm_table[i].ptr;
6661 void *src_ptr =
6662 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
6663 &sDefault);
6664 void *dest_ptr =
6665 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
6666 &sDefault);
6667
6668 switch (parm_table[i].type) {
6669 case P_BOOL:
6670 case P_BOOLREV:
6671 *(bool *)dest_ptr = *(bool *)src_ptr;
6672 break;
6673
6674 case P_INTEGER:
6675 case P_ENUM:
6676 case P_OCTAL:
6677 *(int *)dest_ptr = *(int *)src_ptr;
6678 break;
6679
6680 case P_CHAR:
6681 *(char *)dest_ptr = *(char *)src_ptr;
6682 break;
6683
6684 case P_STRING:
6685 string_set((char **)dest_ptr,
6686 *(char **)src_ptr);
6687 break;
6688
6689 case P_USTRING:
6690 string_set((char **)dest_ptr,
6691 *(char **)src_ptr);
6692 strupper_m(*(char **)dest_ptr);
6693 break;
6694 case P_LIST:
6695 TALLOC_FREE(*((char ***)dest_ptr));
6696 *((char ***)dest_ptr) = str_list_copy(NULL,
6697 *(const char ***)src_ptr);
6698 break;
6699 default:
6700 break;
6701 }
6702 }
6703
6704 if (bcopyall) {
6705 init_copymap(pserviceDest);
6706 if (pserviceSource->copymap)
6707 bitmap_copy(pserviceDest->copymap,
6708 pserviceSource->copymap);
6709 }
6710
6711 data = pserviceSource->param_opt;
6712 while (data) {
6713 set_param_opt(&pserviceDest->param_opt, data->key, data->value);
6714 data = data->next;
6715 }
6716 }
6717
6718 /***************************************************************************
6719 Check a service for consistency. Return False if the service is in any way
6720 incomplete or faulty, else True.
6721 ***************************************************************************/
6722
6723 bool service_ok(int iService)
/* [<][>][^][v][top][bottom][index][help] */
6724 {
6725 bool bRetval;
6726
6727 bRetval = True;
6728 if (ServicePtrs[iService]->szService[0] == '\0') {
6729 DEBUG(0, ("The following message indicates an internal error:\n"));
6730 DEBUG(0, ("No service name in service entry.\n"));
6731 bRetval = False;
6732 }
6733
6734 /* The [printers] entry MUST be printable. I'm all for flexibility, but */
6735 /* I can't see why you'd want a non-printable printer service... */
6736 if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
6737 if (!ServicePtrs[iService]->bPrint_ok) {
6738 DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
6739 ServicePtrs[iService]->szService));
6740 ServicePtrs[iService]->bPrint_ok = True;
6741 }
6742 /* [printers] service must also be non-browsable. */
6743 if (ServicePtrs[iService]->bBrowseable)
6744 ServicePtrs[iService]->bBrowseable = False;
6745 }
6746
6747 if (ServicePtrs[iService]->szPath[0] == '\0' &&
6748 strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
6749 ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
6750 ) {
6751 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
6752 ServicePtrs[iService]->szService));
6753 ServicePtrs[iService]->bAvailable = False;
6754 }
6755
6756 /* If a service is flagged unavailable, log the fact at level 1. */
6757 if (!ServicePtrs[iService]->bAvailable)
6758 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
6759 ServicePtrs[iService]->szService));
6760
6761 return (bRetval);
6762 }
6763
6764 static struct smbconf_ctx *lp_smbconf_ctx(void)
/* [<][>][^][v][top][bottom][index][help] */
6765 {
6766 WERROR werr;
6767 static struct smbconf_ctx *conf_ctx = NULL;
6768
6769 if (conf_ctx == NULL) {
6770 werr = smbconf_init(NULL, &conf_ctx, "registry:");
6771 if (!W_ERROR_IS_OK(werr)) {
6772 DEBUG(1, ("error initializing registry configuration: "
6773 "%s\n", win_errstr(werr)));
6774 conf_ctx = NULL;
6775 }
6776 }
6777
6778 return conf_ctx;
6779 }
6780
6781 static bool process_smbconf_service(struct smbconf_service *service)
/* [<][>][^][v][top][bottom][index][help] */
6782 {
6783 uint32_t count;
6784 bool ret;
6785
6786 if (service == NULL) {
6787 return false;
6788 }
6789
6790 ret = do_section(service->name, NULL);
6791 if (ret != true) {
6792 return false;
6793 }
6794 for (count = 0; count < service->num_params; count++) {
6795 ret = do_parameter(service->param_names[count],
6796 service->param_values[count],
6797 NULL);
6798 if (ret != true) {
6799 return false;
6800 }
6801 }
6802 if (iServiceIndex >= 0) {
6803 return service_ok(iServiceIndex);
6804 }
6805 return true;
6806 }
6807
6808 /**
6809 * load a service from registry and activate it
6810 */
6811 bool process_registry_service(const char *service_name)
/* [<][>][^][v][top][bottom][index][help] */
6812 {
6813 WERROR werr;
6814 struct smbconf_service *service = NULL;
6815 TALLOC_CTX *mem_ctx = talloc_stackframe();
6816 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6817 bool ret = false;
6818
6819 if (conf_ctx == NULL) {
6820 goto done;
6821 }
6822
6823 DEBUG(5, ("process_registry_service: service name %s\n", service_name));
6824
6825 if (!smbconf_share_exists(conf_ctx, service_name)) {
6826 /*
6827 * Registry does not contain data for this service (yet),
6828 * but make sure lp_load doesn't return false.
6829 */
6830 ret = true;
6831 goto done;
6832 }
6833
6834 werr = smbconf_get_share(conf_ctx, mem_ctx, service_name, &service);
6835 if (!W_ERROR_IS_OK(werr)) {
6836 goto done;
6837 }
6838
6839 ret = process_smbconf_service(service);
6840 if (!ret) {
6841 goto done;
6842 }
6843
6844 /* store the csn */
6845 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
6846
6847 done:
6848 TALLOC_FREE(mem_ctx);
6849 return ret;
6850 }
6851
6852 /*
6853 * process_registry_globals
6854 */
6855 static bool process_registry_globals(void)
/* [<][>][^][v][top][bottom][index][help] */
6856 {
6857 bool ret;
6858
6859 add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
6860
6861 ret = do_parameter("registry shares", "yes", NULL);
6862 if (!ret) {
6863 return ret;
6864 }
6865
6866 return process_registry_service(GLOBAL_NAME);
6867 }
6868
6869 bool process_registry_shares(void)
/* [<][>][^][v][top][bottom][index][help] */
6870 {
6871 WERROR werr;
6872 uint32_t count;
6873 struct smbconf_service **service = NULL;
6874 uint32_t num_shares = 0;
6875 TALLOC_CTX *mem_ctx = talloc_stackframe();
6876 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
6877 bool ret = false;
6878
6879 if (conf_ctx == NULL) {
6880 goto done;
6881 }
6882
6883 werr = smbconf_get_config(conf_ctx, mem_ctx, &num_shares, &service);
6884 if (!W_ERROR_IS_OK(werr)) {
6885 goto done;
6886 }
6887
6888 ret = true;
6889
6890 for (count = 0; count < num_shares; count++) {
6891 if (strequal(service[count]->name, GLOBAL_NAME)) {
6892 continue;
6893 }
6894 ret = process_smbconf_service(service[count]);
6895 if (!ret) {
6896 goto done;
6897 }
6898 }
6899
6900 /* store the csn */
6901 smbconf_changed(conf_ctx, &conf_last_csn, NULL, NULL);
6902
6903 done:
6904 TALLOC_FREE(mem_ctx);
6905 return ret;
6906 }
6907
6908 #define MAX_INCLUDE_DEPTH 100
6909
6910 static uint8_t include_depth;
6911
6912 static struct file_lists {
6913 struct file_lists *next;
6914 char *name;
6915 char *subfname;
6916 time_t modtime;
6917 } *file_lists = NULL;
6918
6919 /*******************************************************************
6920 Keep a linked list of all config files so we know when one has changed
6921 it's date and needs to be reloaded.
6922 ********************************************************************/
6923
6924 static void add_to_file_list(const char *fname, const char *subfname)
/* [<][>][^][v][top][bottom][index][help] */
6925 {
6926 struct file_lists *f = file_lists;
6927
6928 while (f) {
6929 if (f->name && !strcmp(f->name, fname))
6930 break;
6931 f = f->next;
6932 }
6933
6934 if (!f) {
6935 f = SMB_MALLOC_P(struct file_lists);
6936 if (!f)
6937 return;
6938 f->next = file_lists;
6939 f->name = SMB_STRDUP(fname);
6940 if (!f->name) {
6941 SAFE_FREE(f);
6942 return;
6943 }
6944 f->subfname = SMB_STRDUP(subfname);
6945 if (!f->subfname) {
6946 SAFE_FREE(f);
6947 return;
6948 }
6949 file_lists = f;
6950 f->modtime = file_modtime(subfname);
6951 } else {
6952 time_t t = file_modtime(subfname);
6953 if (t)
6954 f->modtime = t;
6955 }
6956 }
6957
6958 /**
6959 * Free the file lists
6960 */
6961 static void free_file_list(void)
/* [<][>][^][v][top][bottom][index][help] */
6962 {
6963 struct file_lists *f;
6964 struct file_lists *next;
6965
6966 f = file_lists;
6967 while( f ) {
6968 next = f->next;
6969 SAFE_FREE( f->name );
6970 SAFE_FREE( f->subfname );
6971 SAFE_FREE( f );
6972 f = next;
6973 }
6974 file_lists = NULL;
6975 }
6976
6977
6978 /**
6979 * Utility function for outsiders to check if we're running on registry.
6980 */
6981 bool lp_config_backend_is_registry(void)
/* [<][>][^][v][top][bottom][index][help] */
6982 {
6983 return (lp_config_backend() == CONFIG_BACKEND_REGISTRY);
6984 }
6985
6986 /**
6987 * Utility function to check if the config backend is FILE.
6988 */
6989 bool lp_config_backend_is_file(void)
/* [<][>][^][v][top][bottom][index][help] */
6990 {
6991 return (lp_config_backend() == CONFIG_BACKEND_FILE);
6992 }
6993
6994 /*******************************************************************
6995 Check if a config file has changed date.
6996 ********************************************************************/
6997
6998 bool lp_file_list_changed(void)
/* [<][>][^][v][top][bottom][index][help] */
6999 {
7000 struct file_lists *f = file_lists;
7001
7002 DEBUG(6, ("lp_file_list_changed()\n"));
7003
7004 while (f) {
7005 char *n2 = NULL;
7006 time_t mod_time;
7007
7008 if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
7009 struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
7010
7011 if (conf_ctx == NULL) {
7012 return false;
7013 }
7014 if (smbconf_changed(conf_ctx, &conf_last_csn, NULL,
7015 NULL))
7016 {
7017 DEBUGADD(6, ("registry config changed\n"));
7018 return true;
7019 }
7020 } else {
7021 n2 = alloc_sub_basic(get_current_username(),
7022 current_user_info.domain,
7023 f->name);
7024 if (!n2) {
7025 return false;
7026 }
7027 DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
7028 f->name, n2, ctime(&f->modtime)));
7029
7030 mod_time = file_modtime(n2);
7031
7032 if (mod_time &&
7033 ((f->modtime != mod_time) ||
7034 (f->subfname == NULL) ||
7035 (strcmp(n2, f->subfname) != 0)))
7036 {
7037 DEBUGADD(6,
7038 ("file %s modified: %s\n", n2,
7039 ctime(&mod_time)));
7040 f->modtime = mod_time;
7041 SAFE_FREE(f->subfname);
7042 f->subfname = n2; /* Passing ownership of
7043 return from alloc_sub_basic
7044 above. */
7045 return true;
7046 }
7047 SAFE_FREE(n2);
7048 }
7049 f = f->next;
7050 }
7051 return (False);
7052 }
7053
7054
7055 /***************************************************************************
7056 Run standard_sub_basic on netbios name... needed because global_myname
7057 is not accessed through any lp_ macro.
7058 Note: We must *NOT* use string_set() here as ptr points to global_myname.
7059 ***************************************************************************/
7060
7061 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7062 {
7063 bool ret;
7064 char *netbios_name = alloc_sub_basic(get_current_username(),
7065 current_user_info.domain,
7066 pszParmValue);
7067
7068 ret = set_global_myname(netbios_name);
7069 SAFE_FREE(netbios_name);
7070 string_set(&Globals.szNetbiosName,global_myname());
7071
7072 DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
7073 global_myname()));
7074
7075 return ret;
7076 }
7077
7078 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7079 {
7080 if (strcmp(*ptr, pszParmValue) != 0) {
7081 string_set(ptr, pszParmValue);
7082 init_iconv();
7083 }
7084 return True;
7085 }
7086
7087
7088
7089 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7090 {
7091 bool ret;
7092
7093 ret = set_global_myworkgroup(pszParmValue);
7094 string_set(&Globals.szWorkgroup,lp_workgroup());
7095
7096 return ret;
7097 }
7098
7099 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7100 {
7101 bool ret;
7102
7103 ret = set_global_scope(pszParmValue);
7104 string_set(&Globals.szNetbiosScope,global_scope());
7105
7106 return ret;
7107 }
7108
7109 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7110 {
7111 TALLOC_FREE(Globals.szNetbiosAliases);
7112 Globals.szNetbiosAliases = str_list_make_v3(talloc_autofree_context(), pszParmValue, NULL);
7113 return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
7114 }
7115
7116 /***************************************************************************
7117 Handle the include operation.
7118 ***************************************************************************/
7119 static bool bAllowIncludeRegistry = true;
7120
7121 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7122 {
7123 char *fname;
7124
7125 if (include_depth >= MAX_INCLUDE_DEPTH) {
7126 DEBUG(0, ("Error: Maximum include depth (%u) exceeded!\n",
7127 include_depth));
7128 return false;
7129 }
7130
7131 if (strequal(pszParmValue, INCLUDE_REGISTRY_NAME)) {
7132 if (!bAllowIncludeRegistry) {
7133 return true;
7134 }
7135 if (bInGlobalSection) {
7136 bool ret;
7137 include_depth++;
7138 ret = process_registry_globals();
7139 include_depth--;
7140 return ret;
7141 } else {
7142 DEBUG(1, ("\"include = registry\" only effective "
7143 "in %s section\n", GLOBAL_NAME));
7144 return false;
7145 }
7146 }
7147
7148 fname = alloc_sub_basic(get_current_username(),
7149 current_user_info.domain,
7150 pszParmValue);
7151
7152 add_to_file_list(pszParmValue, fname);
7153
7154 string_set(ptr, fname);
7155
7156 if (file_exist(fname)) {
7157 bool ret;
7158 include_depth++;
7159 ret = pm_process(fname, do_section, do_parameter, NULL);
7160 include_depth--;
7161 SAFE_FREE(fname);
7162 return ret;
7163 }
7164
7165 DEBUG(2, ("Can't find include file %s\n", fname));
7166 SAFE_FREE(fname);
7167 return true;
7168 }
7169
7170 /***************************************************************************
7171 Handle the interpretation of the copy parameter.
7172 ***************************************************************************/
7173
7174 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7175 {
7176 bool bRetval;
7177 int iTemp;
7178 struct service serviceTemp;
7179
7180 string_set(ptr, pszParmValue);
7181
7182 init_service(&serviceTemp);
7183
7184 bRetval = False;
7185
7186 DEBUG(3, ("Copying service from service %s\n", pszParmValue));
7187
7188 if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
7189 if (iTemp == iServiceIndex) {
7190 DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
7191 } else {
7192 copy_service(ServicePtrs[iServiceIndex],
7193 &serviceTemp,
7194 ServicePtrs[iServiceIndex]->copymap);
7195 bRetval = True;
7196 }
7197 } else {
7198 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
7199 bRetval = False;
7200 }
7201
7202 free_service(&serviceTemp);
7203 return (bRetval);
7204 }
7205
7206 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7207 {
7208 Globals.ldap_debug_level = lp_int(pszParmValue);
7209 init_ldap_debugging();
7210 return true;
7211 }
7212
7213 /***************************************************************************
7214 Handle idmap/non unix account uid and gid allocation parameters. The format of these
7215 parameters is:
7216
7217 [global]
7218
7219 idmap uid = 1000-1999
7220 idmap gid = 700-899
7221
7222 We only do simple parsing checks here. The strings are parsed into useful
7223 structures in the idmap daemon code.
7224
7225 ***************************************************************************/
7226
7227 /* Some lp_ routines to return idmap [ug]id information */
7228
7229 static uid_t idmap_uid_low, idmap_uid_high;
7230 static gid_t idmap_gid_low, idmap_gid_high;
7231
7232 bool lp_idmap_uid(uid_t *low, uid_t *high)
/* [<][>][^][v][top][bottom][index][help] */
7233 {
7234 if (idmap_uid_low == 0 || idmap_uid_high == 0)
7235 return False;
7236
7237 if (low)
7238 *low = idmap_uid_low;
7239
7240 if (high)
7241 *high = idmap_uid_high;
7242
7243 return True;
7244 }
7245
7246 bool lp_idmap_gid(gid_t *low, gid_t *high)
/* [<][>][^][v][top][bottom][index][help] */
7247 {
7248 if (idmap_gid_low == 0 || idmap_gid_high == 0)
7249 return False;
7250
7251 if (low)
7252 *low = idmap_gid_low;
7253
7254 if (high)
7255 *high = idmap_gid_high;
7256
7257 return True;
7258 }
7259
7260 /* Do some simple checks on "idmap [ug]id" parameter values */
7261
7262 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7263 {
7264 uint32 low, high;
7265
7266 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7267 return False;
7268
7269 /* Parse OK */
7270
7271 string_set(ptr, pszParmValue);
7272
7273 idmap_uid_low = low;
7274 idmap_uid_high = high;
7275
7276 return True;
7277 }
7278
7279 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7280 {
7281 uint32 low, high;
7282
7283 if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
7284 return False;
7285
7286 /* Parse OK */
7287
7288 string_set(ptr, pszParmValue);
7289
7290 idmap_gid_low = low;
7291 idmap_gid_high = high;
7292
7293 return True;
7294 }
7295
7296 /***************************************************************************
7297 Handle the DEBUG level list.
7298 ***************************************************************************/
7299
7300 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
/* [<][>][^][v][top][bottom][index][help] */
7301 {
7302 string_set(ptr, pszParmValueIn);
7303 return debug_parse_levels(pszParmValueIn);
7304 }
7305
7306 /***************************************************************************
7307 Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
7308 ***************************************************************************/
7309
7310 static const char *append_ldap_suffix( const char *str )
/* [<][>][^][v][top][bottom][index][help] */
7311 {
7312 const char *suffix_string;
7313
7314
7315 suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
7316 Globals.szLdapSuffix );
7317 if ( !suffix_string ) {
7318 DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
7319 return "";
7320 }
7321
7322 return suffix_string;
7323 }
7324
7325 const char *lp_ldap_machine_suffix(void)
/* [<][>][^][v][top][bottom][index][help] */
7326 {
7327 if (Globals.szLdapMachineSuffix[0])
7328 return append_ldap_suffix(Globals.szLdapMachineSuffix);
7329
7330 return lp_string(Globals.szLdapSuffix);
7331 }
7332
7333 const char *lp_ldap_user_suffix(void)
/* [<][>][^][v][top][bottom][index][help] */
7334 {
7335 if (Globals.szLdapUserSuffix[0])
7336 return append_ldap_suffix(Globals.szLdapUserSuffix);
7337
7338 return lp_string(Globals.szLdapSuffix);
7339 }
7340
7341 const char *lp_ldap_group_suffix(void)
/* [<][>][^][v][top][bottom][index][help] */
7342 {
7343 if (Globals.szLdapGroupSuffix[0])
7344 return append_ldap_suffix(Globals.szLdapGroupSuffix);
7345
7346 return lp_string(Globals.szLdapSuffix);
7347 }
7348
7349 const char *lp_ldap_idmap_suffix(void)
/* [<][>][^][v][top][bottom][index][help] */
7350 {
7351 if (Globals.szLdapIdmapSuffix[0])
7352 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
7353
7354 return lp_string(Globals.szLdapSuffix);
7355 }
7356
7357 /****************************************************************************
7358 set the value for a P_ENUM
7359 ***************************************************************************/
7360
7361 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
/* [<][>][^][v][top][bottom][index][help] */
7362 int *ptr )
7363 {
7364 int i;
7365
7366 for (i = 0; parm->enum_list[i].name; i++) {
7367 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
7368 *ptr = parm->enum_list[i].value;
7369 return;
7370 }
7371 }
7372 DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
7373 pszParmValue, parm->label));
7374 }
7375
7376 /***************************************************************************
7377 ***************************************************************************/
7378
7379 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
/* [<][>][^][v][top][bottom][index][help] */
7380 {
7381 static int parm_num = -1;
7382 struct service *s;
7383
7384 if ( parm_num == -1 )
7385 parm_num = map_parameter( "printing" );
7386
7387 lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
7388
7389 if ( snum < 0 )
7390 s = &sDefault;
7391 else
7392 s = ServicePtrs[snum];
7393
7394 init_printer_values( s );
7395
7396 return True;
7397 }
7398
7399
7400 /***************************************************************************
7401 Initialise a copymap.
7402 ***************************************************************************/
7403
7404 static void init_copymap(struct service *pservice)
/* [<][>][^][v][top][bottom][index][help] */
7405 {
7406 int i;
7407 if (pservice->copymap) {
7408 bitmap_free(pservice->copymap);
7409 }
7410 pservice->copymap = bitmap_allocate(NUMPARAMETERS);
7411 if (!pservice->copymap)
7412 DEBUG(0,
7413 ("Couldn't allocate copymap!! (size %d)\n",
7414 (int)NUMPARAMETERS));
7415 else
7416 for (i = 0; i < NUMPARAMETERS; i++)
7417 bitmap_set(pservice->copymap, i);
7418 }
7419
7420 /***************************************************************************
7421 Return the local pointer to a parameter given a service struct and the
7422 pointer into the default structure.
7423 ***************************************************************************/
7424
7425 static void *lp_local_ptr(struct service *service, void *ptr)
/* [<][>][^][v][top][bottom][index][help] */
7426 {
7427 return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
7428 }
7429
7430 /***************************************************************************
7431 Return the local pointer to a parameter given the service number and the
7432 pointer into the default structure.
7433 ***************************************************************************/
7434
7435 void *lp_local_ptr_by_snum(int snum, void *ptr)
/* [<][>][^][v][top][bottom][index][help] */
7436 {
7437 return lp_local_ptr(ServicePtrs[snum], ptr);
7438 }
7439
7440 /***************************************************************************
7441 Process a parameter for a particular service number. If snum < 0
7442 then assume we are in the globals.
7443 ***************************************************************************/
7444
7445 bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
/* [<][>][^][v][top][bottom][index][help] */
7446 {
7447 int parmnum, i;
7448 void *parm_ptr = NULL; /* where we are going to store the result */
7449 void *def_ptr = NULL;
7450 struct param_opt_struct **opt_list;
7451
7452 parmnum = map_parameter(pszParmName);
7453
7454 if (parmnum < 0) {
7455 if (strchr(pszParmName, ':') == NULL) {
7456 DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
7457 pszParmName));
7458 return (True);
7459 }
7460
7461 /*
7462 * We've got a parametric option
7463 */
7464
7465 opt_list = (snum < 0)
7466 ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
7467 set_param_opt(opt_list, pszParmName, pszParmValue);
7468
7469 return (True);
7470 }
7471
7472 if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
7473 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
7474 pszParmName));
7475 }
7476
7477 def_ptr = parm_table[parmnum].ptr;
7478
7479 /* we might point at a service, the default service or a global */
7480 if (snum < 0) {
7481 parm_ptr = def_ptr;
7482 } else {
7483 if (parm_table[parmnum].p_class == P_GLOBAL) {
7484 DEBUG(0,
7485 ("Global parameter %s found in service section!\n",
7486 pszParmName));
7487 return (True);
7488 }
7489 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
7490 }
7491
7492 if (snum >= 0) {
7493 if (!ServicePtrs[snum]->copymap)
7494 init_copymap(ServicePtrs[snum]);
7495
7496 /* this handles the aliases - set the copymap for other entries with
7497 the same data pointer */
7498 for (i = 0; parm_table[i].label; i++)
7499 if (parm_table[i].ptr == parm_table[parmnum].ptr)
7500 bitmap_clear(ServicePtrs[snum]->copymap, i);
7501 }
7502
7503 /* if it is a special case then go ahead */
7504 if (parm_table[parmnum].special) {
7505 return parm_table[parmnum].special(snum, pszParmValue,
7506 (char **)parm_ptr);
7507 }
7508
7509 /* now switch on the type of variable it is */
7510 switch (parm_table[parmnum].type)
7511 {
7512 case P_BOOL:
7513 *(bool *)parm_ptr = lp_bool(pszParmValue);
7514 break;
7515
7516 case P_BOOLREV:
7517 *(bool *)parm_ptr = !lp_bool(pszParmValue);
7518 break;
7519
7520 case P_INTEGER:
7521 *(int *)parm_ptr = lp_int(pszParmValue);
7522 break;
7523
7524 case P_CHAR:
7525 *(char *)parm_ptr = *pszParmValue;
7526 break;
7527
7528 case P_OCTAL:
7529 i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
7530 if ( i != 1 ) {
7531 DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
7532 }
7533 break;
7534
7535 case P_LIST:
7536 TALLOC_FREE(*((char ***)parm_ptr));
7537 *(char ***)parm_ptr = str_list_make_v3(
7538 talloc_autofree_context(), pszParmValue, NULL);
7539 break;
7540
7541 case P_STRING:
7542 string_set((char **)parm_ptr, pszParmValue);
7543 break;
7544
7545 case P_USTRING:
7546 string_set((char **)parm_ptr, pszParmValue);
7547 strupper_m(*(char **)parm_ptr);
7548 break;
7549
7550 case P_ENUM:
7551 lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
7552 break;
7553 case P_SEP:
7554 break;
7555 }
7556
7557 return (True);
7558 }
7559
7560 /***************************************************************************
7561 Process a parameter.
7562 ***************************************************************************/
7563
7564 static bool do_parameter(const char *pszParmName, const char *pszParmValue,
/* [<][>][^][v][top][bottom][index][help] */
7565 void *userdata)
7566 {
7567 if (!bInGlobalSection && bGlobalOnly)
7568 return (True);
7569
7570 DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
7571
7572 return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
7573 pszParmName, pszParmValue));
7574 }
7575
7576 /***************************************************************************
7577 Print a parameter of the specified type.
7578 ***************************************************************************/
7579
7580 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
/* [<][>][^][v][top][bottom][index][help] */
7581 {
7582 int i;
7583 switch (p->type)
7584 {
7585 case P_ENUM:
7586 for (i = 0; p->enum_list[i].name; i++) {
7587 if (*(int *)ptr == p->enum_list[i].value) {
7588 fprintf(f, "%s",
7589 p->enum_list[i].name);
7590 break;
7591 }
7592 }
7593 break;
7594
7595 case P_BOOL:
7596 fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
7597 break;
7598
7599 case P_BOOLREV:
7600 fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
7601 break;
7602
7603 case P_INTEGER:
7604 fprintf(f, "%d", *(int *)ptr);
7605 break;
7606
7607 case P_CHAR:
7608 fprintf(f, "%c", *(char *)ptr);
7609 break;
7610
7611 case P_OCTAL: {
7612 char *o = octal_string(*(int *)ptr);
7613 fprintf(f, "%s", o);
7614 TALLOC_FREE(o);
7615 break;
7616 }
7617
7618 case P_LIST:
7619 if ((char ***)ptr && *(char ***)ptr) {
7620 char **list = *(char ***)ptr;
7621 for (; *list; list++) {
7622 /* surround strings with whitespace in double quotes */
7623 if ( strchr_m( *list, ' ' ) )
7624 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
7625 else
7626 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
7627 }
7628 }
7629 break;
7630
7631 case P_STRING:
7632 case P_USTRING:
7633 if (*(char **)ptr) {
7634 fprintf(f, "%s", *(char **)ptr);
7635 }
7636 break;
7637 case P_SEP:
7638 break;
7639 }
7640 }
7641
7642 /***************************************************************************
7643 Check if two parameters are equal.
7644 ***************************************************************************/
7645
7646 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
/* [<][>][^][v][top][bottom][index][help] */
7647 {
7648 switch (type) {
7649 case P_BOOL:
7650 case P_BOOLREV:
7651 return (*((bool *)ptr1) == *((bool *)ptr2));
7652
7653 case P_INTEGER:
7654 case P_ENUM:
7655 case P_OCTAL:
7656 return (*((int *)ptr1) == *((int *)ptr2));
7657
7658 case P_CHAR:
7659 return (*((char *)ptr1) == *((char *)ptr2));
7660
7661 case P_LIST:
7662 return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
7663
7664 case P_STRING:
7665 case P_USTRING:
7666 {
7667 char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
7668 if (p1 && !*p1)
7669 p1 = NULL;
7670 if (p2 && !*p2)
7671 p2 = NULL;
7672 return (p1 == p2 || strequal(p1, p2));
7673 }
7674 case P_SEP:
7675 break;
7676 }
7677 return (False);
7678 }
7679
7680 /***************************************************************************
7681 Initialize any local varients in the sDefault table.
7682 ***************************************************************************/
7683
7684 void init_locals(void)
/* [<][>][^][v][top][bottom][index][help] */
7685 {
7686 /* None as yet. */
7687 }
7688
7689 /***************************************************************************
7690 Process a new section (service). At this stage all sections are services.
7691 Later we'll have special sections that permit server parameters to be set.
7692 Returns True on success, False on failure.
7693 ***************************************************************************/
7694
7695 static bool do_section(const char *pszSectionName, void *userdata)
/* [<][>][^][v][top][bottom][index][help] */
7696 {
7697 bool bRetval;
7698 bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
7699 (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
7700 bRetval = False;
7701
7702 /* if we were in a global section then do the local inits */
7703 if (bInGlobalSection && !isglobal)
7704 init_locals();
7705
7706 /* if we've just struck a global section, note the fact. */
7707 bInGlobalSection = isglobal;
7708
7709 /* check for multiple global sections */
7710 if (bInGlobalSection) {
7711 DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
7712 return (True);
7713 }
7714
7715 if (!bInGlobalSection && bGlobalOnly)
7716 return (True);
7717
7718 /* if we have a current service, tidy it up before moving on */
7719 bRetval = True;
7720
7721 if (iServiceIndex >= 0)
7722 bRetval = service_ok(iServiceIndex);
7723
7724 /* if all is still well, move to the next record in the services array */
7725 if (bRetval) {
7726 /* We put this here to avoid an odd message order if messages are */
7727 /* issued by the post-processing of a previous section. */
7728 DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
7729
7730 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
7731 < 0) {
7732 DEBUG(0, ("Failed to add a new service\n"));
7733 return (False);
7734 }
7735 }
7736
7737 return (bRetval);
7738 }
7739
7740
7741 /***************************************************************************
7742 Determine if a partcular base parameter is currentl set to the default value.
7743 ***************************************************************************/
7744
7745 static bool is_default(int i)
/* [<][>][^][v][top][bottom][index][help] */
7746 {
7747 if (!defaults_saved)
7748 return False;
7749 switch (parm_table[i].type) {
7750 case P_LIST:
7751 return str_list_equal((const char **)parm_table[i].def.lvalue,
7752 *(const char ***)parm_table[i].ptr);
7753 case P_STRING:
7754 case P_USTRING:
7755 return strequal(parm_table[i].def.svalue,
7756 *(char **)parm_table[i].ptr);
7757 case P_BOOL:
7758 case P_BOOLREV:
7759 return parm_table[i].def.bvalue ==
7760 *(bool *)parm_table[i].ptr;
7761 case P_CHAR:
7762 return parm_table[i].def.cvalue ==
7763 *(char *)parm_table[i].ptr;
7764 case P_INTEGER:
7765 case P_OCTAL:
7766 case P_ENUM:
7767 return parm_table[i].def.ivalue ==
7768 *(int *)parm_table[i].ptr;
7769 case P_SEP:
7770 break;
7771 }
7772 return False;
7773 }
7774
7775 /***************************************************************************
7776 Display the contents of the global structure.
7777 ***************************************************************************/
7778
7779 static void dump_globals(FILE *f)
/* [<][>][^][v][top][bottom][index][help] */
7780 {
7781 int i;
7782 struct param_opt_struct *data;
7783
7784 fprintf(f, "[global]\n");
7785
7786 for (i = 0; parm_table[i].label; i++)
7787 if (parm_table[i].p_class == P_GLOBAL &&
7788 !(parm_table[i].flags & FLAG_META) &&
7789 parm_table[i].ptr &&
7790 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
7791 if (defaults_saved && is_default(i))
7792 continue;
7793 fprintf(f, "\t%s = ", parm_table[i].label);
7794 print_parameter(&parm_table[i], parm_table[i].ptr, f);
7795 fprintf(f, "\n");
7796 }
7797 if (Globals.param_opt != NULL) {
7798 data = Globals.param_opt;
7799 while(data) {
7800 fprintf(f, "\t%s = %s\n", data->key, data->value);
7801 data = data->next;
7802 }
7803 }
7804
7805 }
7806
7807 /***************************************************************************
7808 Return True if a local parameter is currently set to the global default.
7809 ***************************************************************************/
7810
7811 bool lp_is_default(int snum, struct parm_struct *parm)
/* [<][>][^][v][top][bottom][index][help] */
7812 {
7813 int pdiff = PTR_DIFF(parm->ptr, &sDefault);
7814
7815 return equal_parameter(parm->type,
7816 ((char *)ServicePtrs[snum]) + pdiff,
7817 ((char *)&sDefault) + pdiff);
7818 }
7819
7820 /***************************************************************************
7821 Display the contents of a single services record.
7822 ***************************************************************************/
7823
7824 static void dump_a_service(struct service *pService, FILE * f)
/* [<][>][^][v][top][bottom][index][help] */
7825 {
7826 int i;
7827 struct param_opt_struct *data;
7828
7829 if (pService != &sDefault)
7830 fprintf(f, "[%s]\n", pService->szService);
7831
7832 for (i = 0; parm_table[i].label; i++) {
7833
7834 if (parm_table[i].p_class == P_LOCAL &&
7835 !(parm_table[i].flags & FLAG_META) &&
7836 parm_table[i].ptr &&
7837 (*parm_table[i].label != '-') &&
7838 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
7839 {
7840
7841 int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
7842
7843 if (pService == &sDefault) {
7844 if (defaults_saved && is_default(i))
7845 continue;
7846 } else {
7847 if (equal_parameter(parm_table[i].type,
7848 ((char *)pService) +
7849 pdiff,
7850 ((char *)&sDefault) +
7851 pdiff))
7852 continue;
7853 }
7854
7855 fprintf(f, "\t%s = ", parm_table[i].label);
7856 print_parameter(&parm_table[i],
7857 ((char *)pService) + pdiff, f);
7858 fprintf(f, "\n");
7859 }
7860 }
7861
7862 if (pService->param_opt != NULL) {
7863 data = pService->param_opt;
7864 while(data) {
7865 fprintf(f, "\t%s = %s\n", data->key, data->value);
7866 data = data->next;
7867 }
7868 }
7869 }
7870
7871 /***************************************************************************
7872 Display the contents of a parameter of a single services record.
7873 ***************************************************************************/
7874
7875 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
/* [<][>][^][v][top][bottom][index][help] */
7876 {
7877 int i;
7878 bool result = False;
7879 parm_class p_class;
7880 unsigned flag = 0;
7881 fstring local_parm_name;
7882 char *parm_opt;
7883 const char *parm_opt_value;
7884
7885 /* check for parametrical option */
7886 fstrcpy( local_parm_name, parm_name);
7887 parm_opt = strchr( local_parm_name, ':');
7888
7889 if (parm_opt) {
7890 *parm_opt = '\0';
7891 parm_opt++;
7892 if (strlen(parm_opt)) {
7893 parm_opt_value = lp_parm_const_string( snum,
7894 local_parm_name, parm_opt, NULL);
7895 if (parm_opt_value) {
7896 printf( "%s\n", parm_opt_value);
7897 result = True;
7898 }
7899 }
7900 return result;
7901 }
7902
7903 /* check for a key and print the value */
7904 if (isGlobal) {
7905 p_class = P_GLOBAL;
7906 flag = FLAG_GLOBAL;
7907 } else
7908 p_class = P_LOCAL;
7909
7910 for (i = 0; parm_table[i].label; i++) {
7911 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
7912 !(parm_table[i].flags & FLAG_META) &&
7913 (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
7914 parm_table[i].ptr &&
7915 (*parm_table[i].label != '-') &&
7916 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
7917 {
7918 void *ptr;
7919
7920 if (isGlobal) {
7921 ptr = parm_table[i].ptr;
7922 } else {
7923 struct service *pService = ServicePtrs[snum];
7924 ptr = ((char *)pService) +
7925 PTR_DIFF(parm_table[i].ptr, &sDefault);
7926 }
7927
7928 print_parameter(&parm_table[i],
7929 ptr, f);
7930 fprintf(f, "\n");
7931 result = True;
7932 break;
7933 }
7934 }
7935
7936 return result;
7937 }
7938
7939 /***************************************************************************
7940 Return info about the requested parameter (given as a string).
7941 Return NULL when the string is not a valid parameter name.
7942 ***************************************************************************/
7943
7944 struct parm_struct *lp_get_parameter(const char *param_name)
/* [<][>][^][v][top][bottom][index][help] */
7945 {
7946 int num = map_parameter(param_name);
7947
7948 if (num < 0) {
7949 return NULL;
7950 }
7951
7952 return &parm_table[num];
7953 }
7954
7955 /***************************************************************************
7956 Return info about the next parameter in a service.
7957 snum==GLOBAL_SECTION_SNUM gives the globals.
7958 Return NULL when out of parameters.
7959 ***************************************************************************/
7960
7961 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
/* [<][>][^][v][top][bottom][index][help] */
7962 {
7963 if (snum < 0) {
7964 /* do the globals */
7965 for (; parm_table[*i].label; (*i)++) {
7966 if (parm_table[*i].p_class == P_SEPARATOR)
7967 return &parm_table[(*i)++];
7968
7969 if (!parm_table[*i].ptr
7970 || (*parm_table[*i].label == '-'))
7971 continue;
7972
7973 if ((*i) > 0
7974 && (parm_table[*i].ptr ==
7975 parm_table[(*i) - 1].ptr))
7976 continue;
7977
7978 if (is_default(*i) && !allparameters)
7979 continue;
7980
7981 return &parm_table[(*i)++];
7982 }
7983 } else {
7984 struct service *pService = ServicePtrs[snum];
7985
7986 for (; parm_table[*i].label; (*i)++) {
7987 if (parm_table[*i].p_class == P_SEPARATOR)
7988 return &parm_table[(*i)++];
7989
7990 if (parm_table[*i].p_class == P_LOCAL &&
7991 parm_table[*i].ptr &&
7992 (*parm_table[*i].label != '-') &&
7993 ((*i) == 0 ||
7994 (parm_table[*i].ptr !=
7995 parm_table[(*i) - 1].ptr)))
7996 {
7997 int pdiff =
7998 PTR_DIFF(parm_table[*i].ptr,
7999 &sDefault);
8000
8001 if (allparameters ||
8002 !equal_parameter(parm_table[*i].type,
8003 ((char *)pService) +
8004 pdiff,
8005 ((char *)&sDefault) +
8006 pdiff))
8007 {
8008 return &parm_table[(*i)++];
8009 }
8010 }
8011 }
8012 }
8013
8014 return NULL;
8015 }
8016
8017
8018 #if 0
8019 /***************************************************************************
8020 Display the contents of a single copy structure.
8021 ***************************************************************************/
8022 static void dump_copy_map(bool *pcopymap)
/* [<][>][^][v][top][bottom][index][help] */
8023 {
8024 int i;
8025 if (!pcopymap)
8026 return;
8027
8028 printf("\n\tNon-Copied parameters:\n");
8029
8030 for (i = 0; parm_table[i].label; i++)
8031 if (parm_table[i].p_class == P_LOCAL &&
8032 parm_table[i].ptr && !pcopymap[i] &&
8033 (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
8034 {
8035 printf("\t\t%s\n", parm_table[i].label);
8036 }
8037 }
8038 #endif
8039
8040 /***************************************************************************
8041 Return TRUE if the passed service number is within range.
8042 ***************************************************************************/
8043
8044 bool lp_snum_ok(int iService)
/* [<][>][^][v][top][bottom][index][help] */
8045 {
8046 return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
8047 }
8048
8049 /***************************************************************************
8050 Auto-load some home services.
8051 ***************************************************************************/
8052
8053 static void lp_add_auto_services(char *str)
/* [<][>][^][v][top][bottom][index][help] */
8054 {
8055 char *s;
8056 char *p;
8057 int homes;
8058 char *saveptr;
8059
8060 if (!str)
8061 return;
8062
8063 s = SMB_STRDUP(str);
8064 if (!s)
8065 return;
8066
8067 homes = lp_servicenumber(HOMES_NAME);
8068
8069 for (p = strtok_r(s, LIST_SEP, &saveptr); p;
8070 p = strtok_r(NULL, LIST_SEP, &saveptr)) {
8071 char *home;
8072
8073 if (lp_servicenumber(p) >= 0)
8074 continue;
8075
8076 home = get_user_home_dir(talloc_tos(), p);
8077
8078 if (home && home[0] && homes >= 0)
8079 lp_add_home(p, homes, p, home);
8080
8081 TALLOC_FREE(home);
8082 }
8083 SAFE_FREE(s);
8084 }
8085
8086 /***************************************************************************
8087 Auto-load one printer.
8088 ***************************************************************************/
8089
8090 void lp_add_one_printer(const char *name, const char *comment, void *pdata)
/* [<][>][^][v][top][bottom][index][help] */
8091 {
8092 int printers = lp_servicenumber(PRINTERS_NAME);
8093 int i;
8094
8095 if (lp_servicenumber(name) < 0) {
8096 lp_add_printer(name, printers);
8097 if ((i = lp_servicenumber(name)) >= 0) {
8098 string_set(&ServicePtrs[i]->comment, comment);
8099 ServicePtrs[i]->autoloaded = True;
8100 }
8101 }
8102 }
8103
8104 /***************************************************************************
8105 Have we loaded a services file yet?
8106 ***************************************************************************/
8107
8108 bool lp_loaded(void)
/* [<][>][^][v][top][bottom][index][help] */
8109 {
8110 return (bLoaded);
8111 }
8112
8113 /***************************************************************************
8114 Unload unused services.
8115 ***************************************************************************/
8116
8117 void lp_killunused(bool (*snumused) (int))
/* [<][>][^][v][top][bottom][index][help] */
8118 {
8119 int i;
8120 for (i = 0; i < iNumServices; i++) {
8121 if (!VALID(i))
8122 continue;
8123
8124 /* don't kill autoloaded or usershare services */
8125 if ( ServicePtrs[i]->autoloaded ||
8126 ServicePtrs[i]->usershare == USERSHARE_VALID) {
8127 continue;
8128 }
8129
8130 if (!snumused || !snumused(i)) {
8131 free_service_byindex(i);
8132 }
8133 }
8134 }
8135
8136 /**
8137 * Kill all except autoloaded and usershare services - convenience wrapper
8138 */
8139 void lp_kill_all_services(void)
/* [<][>][^][v][top][bottom][index][help] */
8140 {
8141 lp_killunused(NULL);
8142 }
8143
8144 /***************************************************************************
8145 Unload a service.
8146 ***************************************************************************/
8147
8148 void lp_killservice(int iServiceIn)
/* [<][>][^][v][top][bottom][index][help] */
8149 {
8150 if (VALID(iServiceIn)) {
8151 free_service_byindex(iServiceIn);
8152 }
8153 }
8154
8155 /***************************************************************************
8156 Save the curent values of all global and sDefault parameters into the
8157 defaults union. This allows swat and testparm to show only the
8158 changed (ie. non-default) parameters.
8159 ***************************************************************************/
8160
8161 static void lp_save_defaults(void)
/* [<][>][^][v][top][bottom][index][help] */
8162 {
8163 int i;
8164 for (i = 0; parm_table[i].label; i++) {
8165 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
8166 continue;
8167 switch (parm_table[i].type) {
8168 case P_LIST:
8169 parm_table[i].def.lvalue = str_list_copy(
8170 NULL, *(const char ***)parm_table[i].ptr);
8171 break;
8172 case P_STRING:
8173 case P_USTRING:
8174 if (parm_table[i].ptr) {
8175 parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
8176 } else {
8177 parm_table[i].def.svalue = NULL;
8178 }
8179 break;
8180 case P_BOOL:
8181 case P_BOOLREV:
8182 parm_table[i].def.bvalue =
8183 *(bool *)parm_table[i].ptr;
8184 break;
8185 case P_CHAR:
8186 parm_table[i].def.cvalue =
8187 *(char *)parm_table[i].ptr;
8188 break;
8189 case P_INTEGER:
8190 case P_OCTAL:
8191 case P_ENUM:
8192 parm_table[i].def.ivalue =
8193 *(int *)parm_table[i].ptr;
8194 break;
8195 case P_SEP:
8196 break;
8197 }
8198 }
8199 defaults_saved = True;
8200 }
8201
8202 /*******************************************************************
8203 Set the server type we will announce as via nmbd.
8204 ********************************************************************/
8205
8206 static const struct srv_role_tab {
8207 uint32 role;
8208 const char *role_str;
8209 } srv_role_tab [] = {
8210 { ROLE_STANDALONE, "ROLE_STANDALONE" },
8211 { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
8212 { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
8213 { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
8214 { 0, NULL }
8215 };
8216
8217 const char* server_role_str(uint32 role)
/* [<][>][^][v][top][bottom][index][help] */
8218 {
8219 int i = 0;
8220 for (i=0; srv_role_tab[i].role_str; i++) {
8221 if (role == srv_role_tab[i].role) {
8222 return srv_role_tab[i].role_str;
8223 }
8224 }
8225 return NULL;
8226 }
8227
8228 static void set_server_role(void)
/* [<][>][^][v][top][bottom][index][help] */
8229 {
8230 server_role = ROLE_STANDALONE;
8231
8232 switch (lp_security()) {
8233 case SEC_SHARE:
8234 if (lp_domain_logons())
8235 DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
8236 break;
8237 case SEC_SERVER:
8238 if (lp_domain_logons())
8239 DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
8240 /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
8241 server_role = ROLE_STANDALONE;
8242 break;
8243 case SEC_DOMAIN:
8244 if (lp_domain_logons()) {
8245 DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
8246 server_role = ROLE_DOMAIN_BDC;
8247 break;
8248 }
8249 server_role = ROLE_DOMAIN_MEMBER;
8250 break;
8251 case SEC_ADS:
8252 if (lp_domain_logons()) {
8253 server_role = ROLE_DOMAIN_PDC;
8254 break;
8255 }
8256 server_role = ROLE_DOMAIN_MEMBER;
8257 break;
8258 case SEC_USER:
8259 if (lp_domain_logons()) {
8260
8261 if (Globals.iDomainMaster) /* auto or yes */
8262 server_role = ROLE_DOMAIN_PDC;
8263 else
8264 server_role = ROLE_DOMAIN_BDC;
8265 }
8266 break;
8267 default:
8268 DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
8269 break;
8270 }
8271
8272 DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
8273 }
8274
8275 /***********************************************************
8276 If we should send plaintext/LANMAN passwords in the clinet
8277 ************************************************************/
8278
8279 static void set_allowed_client_auth(void)
/* [<][>][^][v][top][bottom][index][help] */
8280 {
8281 if (Globals.bClientNTLMv2Auth) {
8282 Globals.bClientLanManAuth = False;
8283 }
8284 if (!Globals.bClientLanManAuth) {
8285 Globals.bClientPlaintextAuth = False;
8286 }
8287 }
8288
8289 /***************************************************************************
8290 JRA.
8291 The following code allows smbd to read a user defined share file.
8292 Yes, this is my intent. Yes, I'm comfortable with that...
8293
8294 THE FOLLOWING IS SECURITY CRITICAL CODE.
8295
8296 It washes your clothes, it cleans your house, it guards you while you sleep...
8297 Do not f%^k with it....
8298 ***************************************************************************/
8299
8300 #define MAX_USERSHARE_FILE_SIZE (10*1024)
8301
8302 /***************************************************************************
8303 Check allowed stat state of a usershare file.
8304 Ensure we print out who is dicking with us so the admin can
8305 get their sorry ass fired.
8306 ***************************************************************************/
8307
8308 static bool check_usershare_stat(const char *fname, SMB_STRUCT_STAT *psbuf)
/* [<][>][^][v][top][bottom][index][help] */
8309 {
8310 if (!S_ISREG(psbuf->st_mode)) {
8311 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8312 "not a regular file\n",
8313 fname, (unsigned int)psbuf->st_uid ));
8314 return False;
8315 }
8316
8317 /* Ensure this doesn't have the other write bit set. */
8318 if (psbuf->st_mode & S_IWOTH) {
8319 DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
8320 "public write. Refusing to allow as a usershare file.\n",
8321 fname, (unsigned int)psbuf->st_uid ));
8322 return False;
8323 }
8324
8325 /* Should be 10k or less. */
8326 if (psbuf->st_size > MAX_USERSHARE_FILE_SIZE) {
8327 DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
8328 "too large (%u) to be a user share file.\n",
8329 fname, (unsigned int)psbuf->st_uid,
8330 (unsigned int)psbuf->st_size ));
8331 return False;
8332 }
8333
8334 return True;
8335 }
8336
8337 /***************************************************************************
8338 Parse the contents of a usershare file.
8339 ***************************************************************************/
8340
8341 enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
/* [<][>][^][v][top][bottom][index][help] */
8342 SMB_STRUCT_STAT *psbuf,
8343 const char *servicename,
8344 int snum,
8345 char **lines,
8346 int numlines,
8347 char **pp_sharepath,
8348 char **pp_comment,
8349 SEC_DESC **ppsd,
8350 bool *pallow_guest)
8351 {
8352 const char **prefixallowlist = lp_usershare_prefix_allow_list();
8353 const char **prefixdenylist = lp_usershare_prefix_deny_list();
8354 int us_vers;
8355 SMB_STRUCT_DIR *dp;
8356 SMB_STRUCT_STAT sbuf;
8357 char *sharepath = NULL;
8358 char *comment = NULL;
8359
8360 *pp_sharepath = NULL;
8361 *pp_comment = NULL;
8362
8363 *pallow_guest = False;
8364
8365 if (numlines < 4) {
8366 return USERSHARE_MALFORMED_FILE;
8367 }
8368
8369 if (strcmp(lines[0], "#VERSION 1") == 0) {
8370 us_vers = 1;
8371 } else if (strcmp(lines[0], "#VERSION 2") == 0) {
8372 us_vers = 2;
8373 if (numlines < 5) {
8374 return USERSHARE_MALFORMED_FILE;
8375 }
8376 } else {
8377 return USERSHARE_BAD_VERSION;
8378 }
8379
8380 if (strncmp(lines[1], "path=", 5) != 0) {
8381 return USERSHARE_MALFORMED_PATH;
8382 }
8383
8384 sharepath = talloc_strdup(ctx, &lines[1][5]);
8385 if (!sharepath) {
8386 return USERSHARE_POSIX_ERR;
8387 }
8388 trim_string(sharepath, " ", " ");
8389
8390 if (strncmp(lines[2], "comment=", 8) != 0) {
8391 return USERSHARE_MALFORMED_COMMENT_DEF;
8392 }
8393
8394 comment = talloc_strdup(ctx, &lines[2][8]);
8395 if (!comment) {
8396 return USERSHARE_POSIX_ERR;
8397 }
8398 trim_string(comment, " ", " ");
8399 trim_char(comment, '"', '"');
8400
8401 if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
8402 return USERSHARE_MALFORMED_ACL_DEF;
8403 }
8404
8405 if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
8406 return USERSHARE_ACL_ERR;
8407 }
8408
8409 if (us_vers == 2) {
8410 if (strncmp(lines[4], "guest_ok=", 9) != 0) {
8411 return USERSHARE_MALFORMED_ACL_DEF;
8412 }
8413 if (lines[4][9] == 'y') {
8414 *pallow_guest = True;
8415 }
8416 }
8417
8418 if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
8419 /* Path didn't change, no checks needed. */
8420 *pp_sharepath = sharepath;
8421 *pp_comment = comment;
8422 return USERSHARE_OK;
8423 }
8424
8425 /* The path *must* be absolute. */
8426 if (sharepath[0] != '/') {
8427 DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
8428 servicename, sharepath));
8429 return USERSHARE_PATH_NOT_ABSOLUTE;
8430 }
8431
8432 /* If there is a usershare prefix deny list ensure one of these paths
8433 doesn't match the start of the user given path. */
8434 if (prefixdenylist) {
8435 int i;
8436 for ( i=0; prefixdenylist[i]; i++ ) {
8437 DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
8438 servicename, i, prefixdenylist[i], sharepath ));
8439 if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
8440 DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
8441 "usershare prefix deny list entries.\n",
8442 servicename, sharepath));
8443 return USERSHARE_PATH_IS_DENIED;
8444 }
8445 }
8446 }
8447
8448 /* If there is a usershare prefix allow list ensure one of these paths
8449 does match the start of the user given path. */
8450
8451 if (prefixallowlist) {
8452 int i;
8453 for ( i=0; prefixallowlist[i]; i++ ) {
8454 DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
8455 servicename, i, prefixallowlist[i], sharepath ));
8456 if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
8457 break;
8458 }
8459 }
8460 if (prefixallowlist[i] == NULL) {
8461 DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
8462 "usershare prefix allow list entries.\n",
8463 servicename, sharepath));
8464 return USERSHARE_PATH_NOT_ALLOWED;
8465 }
8466 }
8467
8468 /* Ensure this is pointing to a directory. */
8469 dp = sys_opendir(sharepath);
8470
8471 if (!dp) {
8472 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8473 servicename, sharepath));
8474 return USERSHARE_PATH_NOT_DIRECTORY;
8475 }
8476
8477 /* Ensure the owner of the usershare file has permission to share
8478 this directory. */
8479
8480 if (sys_stat(sharepath, &sbuf) == -1) {
8481 DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
8482 servicename, sharepath, strerror(errno) ));
8483 sys_closedir(dp);
8484 return USERSHARE_POSIX_ERR;
8485 }
8486
8487 sys_closedir(dp);
8488
8489 if (!S_ISDIR(sbuf.st_mode)) {
8490 DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
8491 servicename, sharepath ));
8492 return USERSHARE_PATH_NOT_DIRECTORY;
8493 }
8494
8495 /* Check if sharing is restricted to owner-only. */
8496 /* psbuf is the stat of the usershare definition file,
8497 sbuf is the stat of the target directory to be shared. */
8498
8499 if (lp_usershare_owner_only()) {
8500 /* root can share anything. */
8501 if ((psbuf->st_uid != 0) && (sbuf.st_uid != psbuf->st_uid)) {
8502 return USERSHARE_PATH_NOT_ALLOWED;
8503 }
8504 }
8505
8506 *pp_sharepath = sharepath;
8507 *pp_comment = comment;
8508 return USERSHARE_OK;
8509 }
8510
8511 /***************************************************************************
8512 Deal with a usershare file.
8513 Returns:
8514 >= 0 - snum
8515 -1 - Bad name, invalid contents.
8516 - service name already existed and not a usershare, problem
8517 with permissions to share directory etc.
8518 ***************************************************************************/
8519
8520 static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
/* [<][>][^][v][top][bottom][index][help] */
8521 {
8522 SMB_STRUCT_STAT sbuf;
8523 SMB_STRUCT_STAT lsbuf;
8524 char *fname = NULL;
8525 char *sharepath = NULL;
8526 char *comment = NULL;
8527 fstring service_name;
8528 char **lines = NULL;
8529 int numlines = 0;
8530 int fd = -1;
8531 int iService = -1;
8532 TALLOC_CTX *ctx = NULL;
8533 SEC_DESC *psd = NULL;
8534 bool guest_ok = False;
8535
8536 /* Ensure share name doesn't contain invalid characters. */
8537 if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
8538 DEBUG(0,("process_usershare_file: share name %s contains "
8539 "invalid characters (any of %s)\n",
8540 file_name, INVALID_SHARENAME_CHARS ));
8541 return -1;
8542 }
8543
8544 fstrcpy(service_name, file_name);
8545
8546 if (asprintf(&fname, "%s/%s", dir_name, file_name) < 0) {
8547 }
8548
8549 /* Minimize the race condition by doing an lstat before we
8550 open and fstat. Ensure this isn't a symlink link. */
8551
8552 if (sys_lstat(fname, &lsbuf) != 0) {
8553 DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
8554 fname, strerror(errno) ));
8555 SAFE_FREE(fname);
8556 return -1;
8557 }
8558
8559 /* This must be a regular file, not a symlink, directory or
8560 other strange filetype. */
8561 if (!check_usershare_stat(fname, &lsbuf)) {
8562 SAFE_FREE(fname);
8563 return -1;
8564 }
8565
8566 {
8567 char *canon_name = canonicalize_servicename(service_name);
8568 TDB_DATA data = dbwrap_fetch_bystring(
8569 ServiceHash, canon_name, canon_name);
8570
8571 iService = -1;
8572
8573 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
8574 iService = *(int *)data.dptr;
8575 }
8576 TALLOC_FREE(canon_name);
8577 }
8578
8579 if (iService != -1 && ServicePtrs[iService]->usershare_last_mod == lsbuf.st_mtime) {
8580 /* Nothing changed - Mark valid and return. */
8581 DEBUG(10,("process_usershare_file: service %s not changed.\n",
8582 service_name ));
8583 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8584 SAFE_FREE(fname);
8585 return iService;
8586 }
8587
8588 /* Try and open the file read only - no symlinks allowed. */
8589 #ifdef O_NOFOLLOW
8590 fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
8591 #else
8592 fd = sys_open(fname, O_RDONLY, 0);
8593 #endif
8594
8595 if (fd == -1) {
8596 DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
8597 fname, strerror(errno) ));
8598 SAFE_FREE(fname);
8599 return -1;
8600 }
8601
8602 /* Now fstat to be *SURE* it's a regular file. */
8603 if (sys_fstat(fd, &sbuf) != 0) {
8604 close(fd);
8605 DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
8606 fname, strerror(errno) ));
8607 SAFE_FREE(fname);
8608 return -1;
8609 }
8610
8611 /* Is it the same dev/inode as was lstated ? */
8612 if (lsbuf.st_dev != sbuf.st_dev || lsbuf.st_ino != sbuf.st_ino) {
8613 close(fd);
8614 DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
8615 "Symlink spoofing going on ?\n", fname ));
8616 SAFE_FREE(fname);
8617 return -1;
8618 }
8619
8620 /* This must be a regular file, not a symlink, directory or
8621 other strange filetype. */
8622 if (!check_usershare_stat(fname, &sbuf)) {
8623 SAFE_FREE(fname);
8624 return -1;
8625 }
8626
8627 lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE, NULL);
8628
8629 close(fd);
8630 if (lines == NULL) {
8631 DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
8632 fname, (unsigned int)sbuf.st_uid ));
8633 SAFE_FREE(fname);
8634 return -1;
8635 }
8636
8637 SAFE_FREE(fname);
8638
8639 /* Should we allow printers to be shared... ? */
8640 ctx = talloc_init("usershare_sd_xctx");
8641 if (!ctx) {
8642 TALLOC_FREE(lines);
8643 return 1;
8644 }
8645
8646 if (parse_usershare_file(ctx, &sbuf, service_name,
8647 iService, lines, numlines, &sharepath,
8648 &comment, &psd, &guest_ok) != USERSHARE_OK) {
8649 talloc_destroy(ctx);
8650 TALLOC_FREE(lines);
8651 return -1;
8652 }
8653
8654 TALLOC_FREE(lines);
8655
8656 /* Everything ok - add the service possibly using a template. */
8657 if (iService < 0) {
8658 const struct service *sp = &sDefault;
8659 if (snum_template != -1) {
8660 sp = ServicePtrs[snum_template];
8661 }
8662
8663 if ((iService = add_a_service(sp, service_name)) < 0) {
8664 DEBUG(0, ("process_usershare_file: Failed to add "
8665 "new service %s\n", service_name));
8666 talloc_destroy(ctx);
8667 return -1;
8668 }
8669
8670 /* Read only is controlled by usershare ACL below. */
8671 ServicePtrs[iService]->bRead_only = False;
8672 }
8673
8674 /* Write the ACL of the new/modified share. */
8675 if (!set_share_security(service_name, psd)) {
8676 DEBUG(0, ("process_usershare_file: Failed to set share "
8677 "security for user share %s\n",
8678 service_name ));
8679 lp_remove_service(iService);
8680 talloc_destroy(ctx);
8681 return -1;
8682 }
8683
8684 /* If from a template it may be marked invalid. */
8685 ServicePtrs[iService]->valid = True;
8686
8687 /* Set the service as a valid usershare. */
8688 ServicePtrs[iService]->usershare = USERSHARE_VALID;
8689
8690 /* Set guest access. */
8691 if (lp_usershare_allow_guests()) {
8692 ServicePtrs[iService]->bGuest_ok = guest_ok;
8693 }
8694
8695 /* And note when it was loaded. */
8696 ServicePtrs[iService]->usershare_last_mod = sbuf.st_mtime;
8697 string_set(&ServicePtrs[iService]->szPath, sharepath);
8698 string_set(&ServicePtrs[iService]->comment, comment);
8699
8700 talloc_destroy(ctx);
8701
8702 return iService;
8703 }
8704
8705 /***************************************************************************
8706 Checks if a usershare entry has been modified since last load.
8707 ***************************************************************************/
8708
8709 static bool usershare_exists(int iService, time_t *last_mod)
/* [<][>][^][v][top][bottom][index][help] */
8710 {
8711 SMB_STRUCT_STAT lsbuf;
8712 const char *usersharepath = Globals.szUsersharePath;
8713 char *fname;
8714
8715 if (asprintf(&fname, "%s/%s",
8716 usersharepath,
8717 ServicePtrs[iService]->szService) < 0) {
8718 return false;
8719 }
8720
8721 if (sys_lstat(fname, &lsbuf) != 0) {
8722 SAFE_FREE(fname);
8723 return false;
8724 }
8725
8726 if (!S_ISREG(lsbuf.st_mode)) {
8727 SAFE_FREE(fname);
8728 return false;
8729 }
8730
8731 SAFE_FREE(fname);
8732 *last_mod = lsbuf.st_mtime;
8733 return true;
8734 }
8735
8736 /***************************************************************************
8737 Load a usershare service by name. Returns a valid servicenumber or -1.
8738 ***************************************************************************/
8739
8740 int load_usershare_service(const char *servicename)
/* [<][>][^][v][top][bottom][index][help] */
8741 {
8742 SMB_STRUCT_STAT sbuf;
8743 const char *usersharepath = Globals.szUsersharePath;
8744 int max_user_shares = Globals.iUsershareMaxShares;
8745 int snum_template = -1;
8746
8747 if (*usersharepath == 0 || max_user_shares == 0) {
8748 return -1;
8749 }
8750
8751 if (sys_stat(usersharepath, &sbuf) != 0) {
8752 DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
8753 usersharepath, strerror(errno) ));
8754 return -1;
8755 }
8756
8757 if (!S_ISDIR(sbuf.st_mode)) {
8758 DEBUG(0,("load_usershare_service: %s is not a directory.\n",
8759 usersharepath ));
8760 return -1;
8761 }
8762
8763 /*
8764 * This directory must be owned by root, and have the 't' bit set.
8765 * It also must not be writable by "other".
8766 */
8767
8768 #ifdef S_ISVTX
8769 if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
8770 #else
8771 if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
8772 #endif
8773 DEBUG(0,("load_usershare_service: directory %s is not owned by root "
8774 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8775 usersharepath ));
8776 return -1;
8777 }
8778
8779 /* Ensure the template share exists if it's set. */
8780 if (Globals.szUsershareTemplateShare[0]) {
8781 /* We can't use lp_servicenumber here as we are recommending that
8782 template shares have -valid=False set. */
8783 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8784 if (ServicePtrs[snum_template]->szService &&
8785 strequal(ServicePtrs[snum_template]->szService,
8786 Globals.szUsershareTemplateShare)) {
8787 break;
8788 }
8789 }
8790
8791 if (snum_template == -1) {
8792 DEBUG(0,("load_usershare_service: usershare template share %s "
8793 "does not exist.\n",
8794 Globals.szUsershareTemplateShare ));
8795 return -1;
8796 }
8797 }
8798
8799 return process_usershare_file(usersharepath, servicename, snum_template);
8800 }
8801
8802 /***************************************************************************
8803 Load all user defined shares from the user share directory.
8804 We only do this if we're enumerating the share list.
8805 This is the function that can delete usershares that have
8806 been removed.
8807 ***************************************************************************/
8808
8809 int load_usershare_shares(void)
/* [<][>][^][v][top][bottom][index][help] */
8810 {
8811 SMB_STRUCT_DIR *dp;
8812 SMB_STRUCT_STAT sbuf;
8813 SMB_STRUCT_DIRENT *de;
8814 int num_usershares = 0;
8815 int max_user_shares = Globals.iUsershareMaxShares;
8816 unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
8817 unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
8818 unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
8819 int iService;
8820 int snum_template = -1;
8821 const char *usersharepath = Globals.szUsersharePath;
8822 int ret = lp_numservices();
8823
8824 if (max_user_shares == 0 || *usersharepath == '\0') {
8825 return lp_numservices();
8826 }
8827
8828 if (sys_stat(usersharepath, &sbuf) != 0) {
8829 DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
8830 usersharepath, strerror(errno) ));
8831 return ret;
8832 }
8833
8834 /*
8835 * This directory must be owned by root, and have the 't' bit set.
8836 * It also must not be writable by "other".
8837 */
8838
8839 #ifdef S_ISVTX
8840 if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
8841 #else
8842 if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
8843 #endif
8844 DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
8845 "or does not have the sticky bit 't' set or is writable by anyone.\n",
8846 usersharepath ));
8847 return ret;
8848 }
8849
8850 /* Ensure the template share exists if it's set. */
8851 if (Globals.szUsershareTemplateShare[0]) {
8852 /* We can't use lp_servicenumber here as we are recommending that
8853 template shares have -valid=False set. */
8854 for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
8855 if (ServicePtrs[snum_template]->szService &&
8856 strequal(ServicePtrs[snum_template]->szService,
8857 Globals.szUsershareTemplateShare)) {
8858 break;
8859 }
8860 }
8861
8862 if (snum_template == -1) {
8863 DEBUG(0,("load_usershare_shares: usershare template share %s "
8864 "does not exist.\n",
8865 Globals.szUsershareTemplateShare ));
8866 return ret;
8867 }
8868 }
8869
8870 /* Mark all existing usershares as pending delete. */
8871 for (iService = iNumServices - 1; iService >= 0; iService--) {
8872 if (VALID(iService) && ServicePtrs[iService]->usershare) {
8873 ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
8874 }
8875 }
8876
8877 dp = sys_opendir(usersharepath);
8878 if (!dp) {
8879 DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
8880 usersharepath, strerror(errno) ));
8881 return ret;
8882 }
8883
8884 for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
8885 (de = sys_readdir(dp));
8886 num_dir_entries++ ) {
8887 int r;
8888 const char *n = de->d_name;
8889
8890 /* Ignore . and .. */
8891 if (*n == '.') {
8892 if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
8893 continue;
8894 }
8895 }
8896
8897 if (n[0] == ':') {
8898 /* Temporary file used when creating a share. */
8899 num_tmp_dir_entries++;
8900 }
8901
8902 /* Allow 20% tmp entries. */
8903 if (num_tmp_dir_entries > allowed_tmp_entries) {
8904 DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
8905 "in directory %s\n",
8906 num_tmp_dir_entries, usersharepath));
8907 break;
8908 }
8909
8910 r = process_usershare_file(usersharepath, n, snum_template);
8911 if (r == 0) {
8912 /* Update the services count. */
8913 num_usershares++;
8914 if (num_usershares >= max_user_shares) {
8915 DEBUG(0,("load_usershare_shares: max user shares reached "
8916 "on file %s in directory %s\n",
8917 n, usersharepath ));
8918 break;
8919 }
8920 } else if (r == -1) {
8921 num_bad_dir_entries++;
8922 }
8923
8924 /* Allow 20% bad entries. */
8925 if (num_bad_dir_entries > allowed_bad_entries) {
8926 DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
8927 "in directory %s\n",
8928 num_bad_dir_entries, usersharepath));
8929 break;
8930 }
8931
8932 /* Allow 20% bad entries. */
8933 if (num_dir_entries > max_user_shares + allowed_bad_entries) {
8934 DEBUG(0,("load_usershare_shares: too many total entries (%u) "
8935 "in directory %s\n",
8936 num_dir_entries, usersharepath));
8937 break;
8938 }
8939 }
8940
8941 sys_closedir(dp);
8942
8943 /* Sweep through and delete any non-refreshed usershares that are
8944 not currently in use. */
8945 for (iService = iNumServices - 1; iService >= 0; iService--) {
8946 if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
8947 if (conn_snum_used(iService)) {
8948 continue;
8949 }
8950 /* Remove from the share ACL db. */
8951 DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
8952 lp_servicename(iService) ));
8953 delete_share_security(lp_servicename(iService));
8954 free_service_byindex(iService);
8955 }
8956 }
8957
8958 return lp_numservices();
8959 }
8960
8961 /********************************************************
8962 Destroy global resources allocated in this file
8963 ********************************************************/
8964
8965 void gfree_loadparm(void)
/* [<][>][^][v][top][bottom][index][help] */
8966 {
8967 int i;
8968
8969 free_file_list();
8970
8971 /* Free resources allocated to services */
8972
8973 for ( i = 0; i < iNumServices; i++ ) {
8974 if ( VALID(i) ) {
8975 free_service_byindex(i);
8976 }
8977 }
8978
8979 SAFE_FREE( ServicePtrs );
8980 iNumServices = 0;
8981
8982 /* Now release all resources allocated to global
8983 parameters and the default service */
8984
8985 free_global_parameters();
8986 }
8987
8988
8989 /***************************************************************************
8990 Allow client apps to specify that they are a client
8991 ***************************************************************************/
8992 void lp_set_in_client(bool b)
/* [<][>][^][v][top][bottom][index][help] */
8993 {
8994 in_client = b;
8995 }
8996
8997
8998 /***************************************************************************
8999 Determine if we're running in a client app
9000 ***************************************************************************/
9001 bool lp_is_in_client(void)
/* [<][>][^][v][top][bottom][index][help] */
9002 {
9003 return in_client;
9004 }
9005
9006 /***************************************************************************
9007 Load the services array from the services file. Return True on success,
9008 False on failure.
9009 ***************************************************************************/
9010
9011 bool lp_load_ex(const char *pszFname,
/* [<][>][^][v][top][bottom][index][help] */
9012 bool global_only,
9013 bool save_defaults,
9014 bool add_ipc,
9015 bool initialize_globals,
9016 bool allow_include_registry,
9017 bool allow_registry_shares)
9018 {
9019 char *n2 = NULL;
9020 bool bRetval;
9021
9022 bRetval = False;
9023
9024 DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
9025
9026 bInGlobalSection = True;
9027 bGlobalOnly = global_only;
9028 bAllowIncludeRegistry = allow_include_registry;
9029
9030 init_globals(! initialize_globals);
9031 debug_init();
9032
9033 free_file_list();
9034
9035 if (save_defaults) {
9036 init_locals();
9037 lp_save_defaults();
9038 }
9039
9040 free_param_opts(&Globals.param_opt);
9041
9042 /* We get sections first, so have to start 'behind' to make up */
9043 iServiceIndex = -1;
9044
9045 if (lp_config_backend_is_file()) {
9046 n2 = alloc_sub_basic(get_current_username(),
9047 current_user_info.domain,
9048 pszFname);
9049 if (!n2) {
9050 smb_panic("lp_load_ex: out of memory");
9051 }
9052
9053 add_to_file_list(pszFname, n2);
9054
9055 bRetval = pm_process(n2, do_section, do_parameter, NULL);
9056 SAFE_FREE(n2);
9057
9058 /* finish up the last section */
9059 DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
9060 if (bRetval) {
9061 if (iServiceIndex >= 0) {
9062 bRetval = service_ok(iServiceIndex);
9063 }
9064 }
9065
9066 if (lp_config_backend_is_registry()) {
9067 /* config backend changed to registry in config file */
9068 /*
9069 * We need to use this extra global variable here to
9070 * survive restart: init_globals uses this as a default
9071 * for ConfigBackend. Otherwise, init_globals would
9072 * send us into an endless loop here.
9073 */
9074 config_backend = CONFIG_BACKEND_REGISTRY;
9075 /* start over */
9076 DEBUG(1, ("lp_load_ex: changing to config backend "
9077 "registry\n"));
9078 init_globals(false);
9079 lp_kill_all_services();
9080 return lp_load_ex(pszFname, global_only, save_defaults,
9081 add_ipc, initialize_globals,
9082 allow_include_registry,
9083 allow_registry_shares);
9084 }
9085 } else if (lp_config_backend_is_registry()) {
9086 bRetval = process_registry_globals();
9087 } else {
9088 DEBUG(0, ("Illegal config backend given: %d\n",
9089 lp_config_backend()));
9090 bRetval = false;
9091 }
9092
9093 if (bRetval && lp_registry_shares() && allow_registry_shares) {
9094 bRetval = process_registry_shares();
9095 }
9096
9097 lp_add_auto_services(lp_auto_services());
9098
9099 if (add_ipc) {
9100 /* When 'restrict anonymous = 2' guest connections to ipc$
9101 are denied */
9102 lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
9103 if ( lp_enable_asu_support() ) {
9104 lp_add_ipc("ADMIN$", false);
9105 }
9106 }
9107
9108 set_server_role();
9109 set_default_server_announce_type();
9110 set_allowed_client_auth();
9111
9112 bLoaded = True;
9113
9114 /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
9115 /* if bWINSsupport is true and we are in the client */
9116 if (lp_is_in_client() && Globals.bWINSsupport) {
9117 lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
9118 }
9119
9120 init_iconv();
9121
9122 bAllowIncludeRegistry = true;
9123
9124 return (bRetval);
9125 }
9126
9127 bool lp_load(const char *pszFname,
/* [<][>][^][v][top][bottom][index][help] */
9128 bool global_only,
9129 bool save_defaults,
9130 bool add_ipc,
9131 bool initialize_globals)
9132 {
9133 return lp_load_ex(pszFname,
9134 global_only,
9135 save_defaults,
9136 add_ipc,
9137 initialize_globals,
9138 true, false);
9139 }
9140
9141 bool lp_load_initial_only(const char *pszFname)
/* [<][>][^][v][top][bottom][index][help] */
9142 {
9143 return lp_load_ex(pszFname,
9144 true,
9145 false,
9146 false,
9147 true,
9148 false,
9149 false);
9150 }
9151
9152 bool lp_load_with_registry_shares(const char *pszFname,
/* [<][>][^][v][top][bottom][index][help] */
9153 bool global_only,
9154 bool save_defaults,
9155 bool add_ipc,
9156 bool initialize_globals)
9157 {
9158 return lp_load_ex(pszFname,
9159 global_only,
9160 save_defaults,
9161 add_ipc,
9162 initialize_globals,
9163 true,
9164 true);
9165 }
9166
9167 /***************************************************************************
9168 Return the max number of services.
9169 ***************************************************************************/
9170
9171 int lp_numservices(void)
/* [<][>][^][v][top][bottom][index][help] */
9172 {
9173 return (iNumServices);
9174 }
9175
9176 /***************************************************************************
9177 Display the contents of the services array in human-readable form.
9178 ***************************************************************************/
9179
9180 void lp_dump(FILE *f, bool show_defaults, int maxtoprint)
/* [<][>][^][v][top][bottom][index][help] */
9181 {
9182 int iService;
9183
9184 if (show_defaults)
9185 defaults_saved = False;
9186
9187 dump_globals(f);
9188
9189 dump_a_service(&sDefault, f);
9190
9191 for (iService = 0; iService < maxtoprint; iService++) {
9192 fprintf(f,"\n");
9193 lp_dump_one(f, show_defaults, iService);
9194 }
9195 }
9196
9197 /***************************************************************************
9198 Display the contents of one service in human-readable form.
9199 ***************************************************************************/
9200
9201 void lp_dump_one(FILE * f, bool show_defaults, int snum)
/* [<][>][^][v][top][bottom][index][help] */
9202 {
9203 if (VALID(snum)) {
9204 if (ServicePtrs[snum]->szService[0] == '\0')
9205 return;
9206 dump_a_service(ServicePtrs[snum], f);
9207 }
9208 }
9209
9210 /***************************************************************************
9211 Return the number of the service with the given name, or -1 if it doesn't
9212 exist. Note that this is a DIFFERENT ANIMAL from the internal function
9213 getservicebyname()! This works ONLY if all services have been loaded, and
9214 does not copy the found service.
9215 ***************************************************************************/
9216
9217 int lp_servicenumber(const char *pszServiceName)
/* [<][>][^][v][top][bottom][index][help] */
9218 {
9219 int iService;
9220 fstring serviceName;
9221
9222 if (!pszServiceName) {
9223 return GLOBAL_SECTION_SNUM;
9224 }
9225
9226 for (iService = iNumServices - 1; iService >= 0; iService--) {
9227 if (VALID(iService) && ServicePtrs[iService]->szService) {
9228 /*
9229 * The substitution here is used to support %U is
9230 * service names
9231 */
9232 fstrcpy(serviceName, ServicePtrs[iService]->szService);
9233 standard_sub_basic(get_current_username(),
9234 current_user_info.domain,
9235 serviceName,sizeof(serviceName));
9236 if (strequal(serviceName, pszServiceName)) {
9237 break;
9238 }
9239 }
9240 }
9241
9242 if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
9243 time_t last_mod;
9244
9245 if (!usershare_exists(iService, &last_mod)) {
9246 /* Remove the share security tdb entry for it. */
9247 delete_share_security(lp_servicename(iService));
9248 /* Remove it from the array. */
9249 free_service_byindex(iService);
9250 /* Doesn't exist anymore. */
9251 return GLOBAL_SECTION_SNUM;
9252 }
9253
9254 /* Has it been modified ? If so delete and reload. */
9255 if (ServicePtrs[iService]->usershare_last_mod < last_mod) {
9256 /* Remove it from the array. */
9257 free_service_byindex(iService);
9258 /* and now reload it. */
9259 iService = load_usershare_service(pszServiceName);
9260 }
9261 }
9262
9263 if (iService < 0) {
9264 DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
9265 return GLOBAL_SECTION_SNUM;
9266 }
9267
9268 return (iService);
9269 }
9270
9271 bool share_defined(const char *service_name)
/* [<][>][^][v][top][bottom][index][help] */
9272 {
9273 return (lp_servicenumber(service_name) != -1);
9274 }
9275
9276 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
/* [<][>][^][v][top][bottom][index][help] */
9277 const char *sharename)
9278 {
9279 struct share_params *result;
9280 char *sname;
9281 int snum;
9282
9283 if (!(sname = SMB_STRDUP(sharename))) {
9284 return NULL;
9285 }
9286
9287 snum = find_service(sname);
9288 SAFE_FREE(sname);
9289
9290 if (snum < 0) {
9291 return NULL;
9292 }
9293
9294 if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
9295 DEBUG(0, ("talloc failed\n"));
9296 return NULL;
9297 }
9298
9299 result->service = snum;
9300 return result;
9301 }
9302
9303 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
/* [<][>][^][v][top][bottom][index][help] */
9304 {
9305 struct share_iterator *result;
9306
9307 if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
9308 DEBUG(0, ("talloc failed\n"));
9309 return NULL;
9310 }
9311
9312 result->next_id = 0;
9313 return result;
9314 }
9315
9316 struct share_params *next_share(struct share_iterator *list)
/* [<][>][^][v][top][bottom][index][help] */
9317 {
9318 struct share_params *result;
9319
9320 while (!lp_snum_ok(list->next_id) &&
9321 (list->next_id < lp_numservices())) {
9322 list->next_id += 1;
9323 }
9324
9325 if (list->next_id >= lp_numservices()) {
9326 return NULL;
9327 }
9328
9329 if (!(result = TALLOC_P(list, struct share_params))) {
9330 DEBUG(0, ("talloc failed\n"));
9331 return NULL;
9332 }
9333
9334 result->service = list->next_id;
9335 list->next_id += 1;
9336 return result;
9337 }
9338
9339 struct share_params *next_printer(struct share_iterator *list)
/* [<][>][^][v][top][bottom][index][help] */
9340 {
9341 struct share_params *result;
9342
9343 while ((result = next_share(list)) != NULL) {
9344 if (lp_print_ok(result->service)) {
9345 break;
9346 }
9347 }
9348 return result;
9349 }
9350
9351 /*
9352 * This is a hack for a transition period until we transformed all code from
9353 * service numbers to struct share_params.
9354 */
9355
9356 struct share_params *snum2params_static(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9357 {
9358 static struct share_params result;
9359 result.service = snum;
9360 return &result;
9361 }
9362
9363 /*******************************************************************
9364 A useful volume label function.
9365 ********************************************************************/
9366
9367 const char *volume_label(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9368 {
9369 char *ret;
9370 const char *label = lp_volume(snum);
9371 if (!*label) {
9372 label = lp_servicename(snum);
9373 }
9374
9375 /* This returns a 33 byte guarenteed null terminated string. */
9376 ret = talloc_strndup(talloc_tos(), label, 32);
9377 if (!ret) {
9378 return "";
9379 }
9380 return ret;
9381 }
9382
9383 /*******************************************************************
9384 Set the server type we will announce as via nmbd.
9385 ********************************************************************/
9386
9387 static void set_default_server_announce_type(void)
/* [<][>][^][v][top][bottom][index][help] */
9388 {
9389 default_server_announce = 0;
9390 default_server_announce |= SV_TYPE_WORKSTATION;
9391 default_server_announce |= SV_TYPE_SERVER;
9392 default_server_announce |= SV_TYPE_SERVER_UNIX;
9393
9394 /* note that the flag should be set only if we have a
9395 printer service but nmbd doesn't actually load the
9396 services so we can't tell --jerry */
9397
9398 default_server_announce |= SV_TYPE_PRINTQ_SERVER;
9399
9400 switch (lp_announce_as()) {
9401 case ANNOUNCE_AS_NT_SERVER:
9402 default_server_announce |= SV_TYPE_SERVER_NT;
9403 /* fall through... */
9404 case ANNOUNCE_AS_NT_WORKSTATION:
9405 default_server_announce |= SV_TYPE_NT;
9406 break;
9407 case ANNOUNCE_AS_WIN95:
9408 default_server_announce |= SV_TYPE_WIN95_PLUS;
9409 break;
9410 case ANNOUNCE_AS_WFW:
9411 default_server_announce |= SV_TYPE_WFW;
9412 break;
9413 default:
9414 break;
9415 }
9416
9417 switch (lp_server_role()) {
9418 case ROLE_DOMAIN_MEMBER:
9419 default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
9420 break;
9421 case ROLE_DOMAIN_PDC:
9422 default_server_announce |= SV_TYPE_DOMAIN_CTRL;
9423 break;
9424 case ROLE_DOMAIN_BDC:
9425 default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
9426 break;
9427 case ROLE_STANDALONE:
9428 default:
9429 break;
9430 }
9431 if (lp_time_server())
9432 default_server_announce |= SV_TYPE_TIME_SOURCE;
9433
9434 if (lp_host_msdfs())
9435 default_server_announce |= SV_TYPE_DFS_SERVER;
9436 }
9437
9438 /***********************************************************
9439 returns role of Samba server
9440 ************************************************************/
9441
9442 int lp_server_role(void)
/* [<][>][^][v][top][bottom][index][help] */
9443 {
9444 return server_role;
9445 }
9446
9447 /***********************************************************
9448 If we are PDC then prefer us as DMB
9449 ************************************************************/
9450
9451 bool lp_domain_master(void)
/* [<][>][^][v][top][bottom][index][help] */
9452 {
9453 if (Globals.iDomainMaster == Auto)
9454 return (lp_server_role() == ROLE_DOMAIN_PDC);
9455
9456 return (bool)Globals.iDomainMaster;
9457 }
9458
9459 /***********************************************************
9460 If we are DMB then prefer us as LMB
9461 ************************************************************/
9462
9463 bool lp_preferred_master(void)
/* [<][>][^][v][top][bottom][index][help] */
9464 {
9465 if (Globals.iPreferredMaster == Auto)
9466 return (lp_local_master() && lp_domain_master());
9467
9468 return (bool)Globals.iPreferredMaster;
9469 }
9470
9471 /*******************************************************************
9472 Remove a service.
9473 ********************************************************************/
9474
9475 void lp_remove_service(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9476 {
9477 ServicePtrs[snum]->valid = False;
9478 invalid_services[num_invalid_services++] = snum;
9479 }
9480
9481 /*******************************************************************
9482 Copy a service.
9483 ********************************************************************/
9484
9485 void lp_copy_service(int snum, const char *new_name)
/* [<][>][^][v][top][bottom][index][help] */
9486 {
9487 do_section(new_name, NULL);
9488 if (snum >= 0) {
9489 snum = lp_servicenumber(new_name);
9490 if (snum >= 0)
9491 lp_do_parameter(snum, "copy", lp_servicename(snum));
9492 }
9493 }
9494
9495
9496 /*******************************************************************
9497 Get the default server type we will announce as via nmbd.
9498 ********************************************************************/
9499
9500 int lp_default_server_announce(void)
/* [<][>][^][v][top][bottom][index][help] */
9501 {
9502 return default_server_announce;
9503 }
9504
9505 /*******************************************************************
9506 Split the announce version into major and minor numbers.
9507 ********************************************************************/
9508
9509 int lp_major_announce_version(void)
/* [<][>][^][v][top][bottom][index][help] */
9510 {
9511 static bool got_major = False;
9512 static int major_version = DEFAULT_MAJOR_VERSION;
9513 char *vers;
9514 char *p;
9515
9516 if (got_major)
9517 return major_version;
9518
9519 got_major = True;
9520 if ((vers = lp_announce_version()) == NULL)
9521 return major_version;
9522
9523 if ((p = strchr_m(vers, '.')) == 0)
9524 return major_version;
9525
9526 *p = '\0';
9527 major_version = atoi(vers);
9528 return major_version;
9529 }
9530
9531 int lp_minor_announce_version(void)
/* [<][>][^][v][top][bottom][index][help] */
9532 {
9533 static bool got_minor = False;
9534 static int minor_version = DEFAULT_MINOR_VERSION;
9535 char *vers;
9536 char *p;
9537
9538 if (got_minor)
9539 return minor_version;
9540
9541 got_minor = True;
9542 if ((vers = lp_announce_version()) == NULL)
9543 return minor_version;
9544
9545 if ((p = strchr_m(vers, '.')) == 0)
9546 return minor_version;
9547
9548 p++;
9549 minor_version = atoi(p);
9550 return minor_version;
9551 }
9552
9553 /***********************************************************
9554 Set the global name resolution order (used in smbclient).
9555 ************************************************************/
9556
9557 void lp_set_name_resolve_order(const char *new_order)
/* [<][>][^][v][top][bottom][index][help] */
9558 {
9559 string_set(&Globals.szNameResolveOrder, new_order);
9560 }
9561
9562 const char *lp_printername(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9563 {
9564 const char *ret = _lp_printername(snum);
9565 if (ret == NULL || (ret != NULL && *ret == '\0'))
9566 ret = lp_const_servicename(snum);
9567
9568 return ret;
9569 }
9570
9571
9572 /***********************************************************
9573 Allow daemons such as winbindd to fix their logfile name.
9574 ************************************************************/
9575
9576 void lp_set_logfile(const char *name)
/* [<][>][^][v][top][bottom][index][help] */
9577 {
9578 string_set(&Globals.szLogFile, name);
9579 debug_set_logfile(name);
9580 }
9581
9582 /*******************************************************************
9583 Return the max print jobs per queue.
9584 ********************************************************************/
9585
9586 int lp_maxprintjobs(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9587 {
9588 int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
9589 if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
9590 maxjobs = PRINT_MAX_JOBID - 1;
9591
9592 return maxjobs;
9593 }
9594
9595 const char *lp_printcapname(void)
/* [<][>][^][v][top][bottom][index][help] */
9596 {
9597 if ((Globals.szPrintcapname != NULL) &&
9598 (Globals.szPrintcapname[0] != '\0'))
9599 return Globals.szPrintcapname;
9600
9601 if (sDefault.iPrinting == PRINT_CUPS) {
9602 #ifdef HAVE_CUPS
9603 return "cups";
9604 #else
9605 return "lpstat";
9606 #endif
9607 }
9608
9609 if (sDefault.iPrinting == PRINT_BSD)
9610 return "/etc/printcap";
9611
9612 return PRINTCAP_NAME;
9613 }
9614
9615 /*******************************************************************
9616 Ensure we don't use sendfile if server smb signing is active.
9617 ********************************************************************/
9618
9619 static uint32 spoolss_state;
9620
9621 bool lp_disable_spoolss( void )
/* [<][>][^][v][top][bottom][index][help] */
9622 {
9623 if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
9624 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9625
9626 return spoolss_state == SVCCTL_STOPPED ? True : False;
9627 }
9628
9629 void lp_set_spoolss_state( uint32 state )
/* [<][>][^][v][top][bottom][index][help] */
9630 {
9631 SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
9632
9633 spoolss_state = state;
9634 }
9635
9636 uint32 lp_get_spoolss_state( void )
/* [<][>][^][v][top][bottom][index][help] */
9637 {
9638 return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
9639 }
9640
9641 /*******************************************************************
9642 Ensure we don't use sendfile if server smb signing is active.
9643 ********************************************************************/
9644
9645 bool lp_use_sendfile(int snum)
/* [<][>][^][v][top][bottom][index][help] */
9646 {
9647 /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
9648 if (Protocol < PROTOCOL_NT1) {
9649 return False;
9650 }
9651 return (_lp_use_sendfile(snum) &&
9652 (get_remote_arch() != RA_WIN95) &&
9653 !srv_is_signing_active());
9654 }
9655
9656 /*******************************************************************
9657 Turn off sendfile if we find the underlying OS doesn't support it.
9658 ********************************************************************/
9659
9660 void set_use_sendfile(int snum, bool val)
/* [<][>][^][v][top][bottom][index][help] */
9661 {
9662 if (LP_SNUM_OK(snum))
9663 ServicePtrs[snum]->bUseSendfile = val;
9664 else
9665 sDefault.bUseSendfile = val;
9666 }
9667
9668 /*******************************************************************
9669 Turn off storing DOS attributes if this share doesn't support it.
9670 ********************************************************************/
9671
9672 void set_store_dos_attributes(int snum, bool val)
/* [<][>][^][v][top][bottom][index][help] */
9673 {
9674 if (!LP_SNUM_OK(snum))
9675 return;
9676 ServicePtrs[(snum)]->bStoreDosAttributes = val;
9677 }
9678
9679 void lp_set_mangling_method(const char *new_method)
/* [<][>][^][v][top][bottom][index][help] */
9680 {
9681 string_set(&Globals.szManglingMethod, new_method);
9682 }
9683
9684 /*******************************************************************
9685 Global state for POSIX pathname processing.
9686 ********************************************************************/
9687
9688 static bool posix_pathnames;
9689
9690 bool lp_posix_pathnames(void)
/* [<][>][^][v][top][bottom][index][help] */
9691 {
9692 return posix_pathnames;
9693 }
9694
9695 /*******************************************************************
9696 Change everything needed to ensure POSIX pathname processing (currently
9697 not much).
9698 ********************************************************************/
9699
9700 void lp_set_posix_pathnames(void)
/* [<][>][^][v][top][bottom][index][help] */
9701 {
9702 posix_pathnames = True;
9703 }
9704
9705 /*******************************************************************
9706 Global state for POSIX lock processing - CIFS unix extensions.
9707 ********************************************************************/
9708
9709 bool posix_default_lock_was_set;
9710 static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
9711
9712 enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
/* [<][>][^][v][top][bottom][index][help] */
9713 {
9714 if (posix_default_lock_was_set) {
9715 return posix_cifsx_locktype;
9716 } else {
9717 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
9718 }
9719 }
9720
9721 /*******************************************************************
9722 ********************************************************************/
9723
9724 void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
/* [<][>][^][v][top][bottom][index][help] */
9725 {
9726 posix_default_lock_was_set = True;
9727 posix_cifsx_locktype = val;
9728 }
9729
9730 int lp_min_receive_file_size(void)
/* [<][>][^][v][top][bottom][index][help] */
9731 {
9732 if (Globals.iminreceivefile < 0) {
9733 return 0;
9734 }
9735 return MIN(Globals.iminreceivefile, BUFFER_SIZE);
9736 }
9737
9738 /*******************************************************************
9739 If socket address is an empty character string, it is necessary to
9740 define it as "0.0.0.0".
9741 ********************************************************************/
9742
9743 const char *lp_socket_address(void)
/* [<][>][^][v][top][bottom][index][help] */
9744 {
9745 char *sock_addr = Globals.szSocketAddress;
9746
9747 if (sock_addr[0] == '\0'){
9748 string_set(&Globals.szSocketAddress, "0.0.0.0");
9749 }
9750 return Globals.szSocketAddress;
9751 }
9752
9753 void lp_set_passdb_backend(const char *backend)
/* [<][>][^][v][top][bottom][index][help] */
9754 {
9755 string_set(&Globals.szPassdbBackend, backend);
9756 }