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 |
|
---|
13 | This program is free software; you can redistribute it and/or modify
|
---|
14 | it under the terms of the GNU General Public License as published by
|
---|
15 | the Free Software Foundation; either version 2 of the License, or
|
---|
16 | (at your option) any later version.
|
---|
17 |
|
---|
18 | This program is distributed in the hope that it will be useful,
|
---|
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
21 | GNU General Public License for more details.
|
---|
22 |
|
---|
23 | You should have received a copy of the GNU General Public License
|
---|
24 | along with this program; if not, write to the Free Software
|
---|
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
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 |
|
---|
56 | BOOL in_client = False; /* Not in the client by default */
|
---|
57 | BOOL bLoaded = False;
|
---|
58 |
|
---|
59 | extern pstring user_socket_options;
|
---|
60 | extern enum protocol_types Protocol;
|
---|
61 | extern userdom_struct current_user_info;
|
---|
62 |
|
---|
63 | #ifndef GLOBAL_NAME
|
---|
64 | #define GLOBAL_NAME "global"
|
---|
65 | #endif
|
---|
66 |
|
---|
67 | #ifndef PRINTERS_NAME
|
---|
68 | #define PRINTERS_NAME "printers"
|
---|
69 | #endif
|
---|
70 |
|
---|
71 | #ifndef HOMES_NAME
|
---|
72 | #define HOMES_NAME "homes"
|
---|
73 | #endif
|
---|
74 |
|
---|
75 | /* some helpful bits */
|
---|
76 | #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
|
---|
77 | #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
|
---|
78 |
|
---|
79 | #define USERSHARE_VALID 1
|
---|
80 | #define USERSHARE_PENDING_DELETE 2
|
---|
81 |
|
---|
82 | int keepalive = DEFAULT_KEEPALIVE;
|
---|
83 | BOOL use_getwd_cache = True;
|
---|
84 |
|
---|
85 | extern int extra_time_offset;
|
---|
86 |
|
---|
87 | static BOOL defaults_saved = False;
|
---|
88 |
|
---|
89 | typedef struct _param_opt_struct param_opt_struct;
|
---|
90 | struct _param_opt_struct {
|
---|
91 | param_opt_struct *prev, *next;
|
---|
92 | char *key;
|
---|
93 | char *value;
|
---|
94 | char **list;
|
---|
95 | };
|
---|
96 |
|
---|
97 | /*
|
---|
98 | * This structure describes global (ie., server-wide) parameters.
|
---|
99 | */
|
---|
100 | typedef struct {
|
---|
101 | char *smb_ports;
|
---|
102 | char *dos_charset;
|
---|
103 | char *unix_charset;
|
---|
104 | char *display_charset;
|
---|
105 | char *szPrintcapname;
|
---|
106 | char *szAddPortCommand;
|
---|
107 | char *szEnumPortsCommand;
|
---|
108 | char *szAddPrinterCommand;
|
---|
109 | char *szDeletePrinterCommand;
|
---|
110 | char *szOs2DriverMap;
|
---|
111 | char *szLockDir;
|
---|
112 | char *szPidDir;
|
---|
113 | char *szRootdir;
|
---|
114 | char *szDefaultService;
|
---|
115 | char *szGetQuota;
|
---|
116 | char *szSetQuota;
|
---|
117 | char *szMsgCommand;
|
---|
118 | char *szServerString;
|
---|
119 | char *szAutoServices;
|
---|
120 | char *szPasswdProgram;
|
---|
121 | char *szPasswdChat;
|
---|
122 | char *szLogFile;
|
---|
123 | char *szConfigFile;
|
---|
124 | char *szSMBPasswdFile;
|
---|
125 | char *szPrivateDir;
|
---|
126 | char *szPassdbBackend;
|
---|
127 | char **szPreloadModules;
|
---|
128 | char *szPasswordServer;
|
---|
129 | char *szSocketOptions;
|
---|
130 | char *szRealm;
|
---|
131 | char *szAfsUsernameMap;
|
---|
132 | int iAfsTokenLifetime;
|
---|
133 | char *szLogNtTokenCommand;
|
---|
134 | char *szUsernameMap;
|
---|
135 | char *szLogonScript;
|
---|
136 | char *szLogonPath;
|
---|
137 | char *szLogonDrive;
|
---|
138 | char *szLogonHome;
|
---|
139 | char **szWINSservers;
|
---|
140 | char **szInterfaces;
|
---|
141 | char *szRemoteAnnounce;
|
---|
142 | char *szRemoteBrowseSync;
|
---|
143 | char *szSocketAddress;
|
---|
144 | char *szNISHomeMapName;
|
---|
145 | char *szAnnounceVersion; /* This is initialised in init_globals */
|
---|
146 | char *szWorkgroup;
|
---|
147 | char *szNetbiosName;
|
---|
148 | char **szNetbiosAliases;
|
---|
149 | char *szNetbiosScope;
|
---|
150 | char *szNameResolveOrder;
|
---|
151 | char *szPanicAction;
|
---|
152 | char *szAddUserScript;
|
---|
153 | char *szRenameUserScript;
|
---|
154 | char *szDelUserScript;
|
---|
155 | char *szAddGroupScript;
|
---|
156 | char *szDelGroupScript;
|
---|
157 | char *szAddUserToGroupScript;
|
---|
158 | char *szDelUserFromGroupScript;
|
---|
159 | char *szSetPrimaryGroupScript;
|
---|
160 | char *szAddMachineScript;
|
---|
161 | char *szShutdownScript;
|
---|
162 | char *szAbortShutdownScript;
|
---|
163 | char *szUsernameMapScript;
|
---|
164 | char *szCheckPasswordScript;
|
---|
165 | char *szWINSHook;
|
---|
166 | char *szUtmpDir;
|
---|
167 | char *szWtmpDir;
|
---|
168 | BOOL bUtmp;
|
---|
169 | char *szIdmapUID;
|
---|
170 | char *szIdmapGID;
|
---|
171 | BOOL bPassdbExpandExplicit;
|
---|
172 | int AlgorithmicRidBase;
|
---|
173 | char *szTemplateHomedir;
|
---|
174 | char *szTemplateShell;
|
---|
175 | char *szWinbindSeparator;
|
---|
176 | BOOL bWinbindEnumUsers;
|
---|
177 | BOOL bWinbindEnumGroups;
|
---|
178 | BOOL bWinbindUseDefaultDomain;
|
---|
179 | BOOL bWinbindTrustedDomainsOnly;
|
---|
180 | BOOL bWinbindNestedGroups;
|
---|
181 | BOOL bWinbindRefreshTickets;
|
---|
182 | BOOL bWinbindOfflineLogon;
|
---|
183 | BOOL bWinbindNormalizeNames;
|
---|
184 | char **szIdmapDomains;
|
---|
185 | char **szIdmapBackend; /* deprecated */
|
---|
186 | char *szIdmapAllocBackend;
|
---|
187 | char *szAddShareCommand;
|
---|
188 | char *szChangeShareCommand;
|
---|
189 | char *szDeleteShareCommand;
|
---|
190 | char **szEventLogs;
|
---|
191 | char *szGuestaccount;
|
---|
192 | char *szManglingMethod;
|
---|
193 | char **szServicesList;
|
---|
194 | char *szUsersharePath;
|
---|
195 | char *szUsershareTemplateShare;
|
---|
196 | char **szUsersharePrefixAllowList;
|
---|
197 | char **szUsersharePrefixDenyList;
|
---|
198 | int mangle_prefix;
|
---|
199 | int max_log_size;
|
---|
200 | char *szLogLevel;
|
---|
201 | int max_xmit;
|
---|
202 | int max_mux;
|
---|
203 | int max_open_files;
|
---|
204 | int open_files_db_hash_size;
|
---|
205 | int pwordlevel;
|
---|
206 | int unamelevel;
|
---|
207 | int deadtime;
|
---|
208 | int maxprotocol;
|
---|
209 | int minprotocol;
|
---|
210 | int security;
|
---|
211 | char **AuthMethods;
|
---|
212 | BOOL paranoid_server_security;
|
---|
213 | int maxdisksize;
|
---|
214 | int lpqcachetime;
|
---|
215 | int iMaxSmbdProcesses;
|
---|
216 | BOOL bDisableSpoolss;
|
---|
217 | int syslog;
|
---|
218 | int os_level;
|
---|
219 | int enhanced_browsing;
|
---|
220 | int max_ttl;
|
---|
221 | int max_wins_ttl;
|
---|
222 | int min_wins_ttl;
|
---|
223 | int lm_announce;
|
---|
224 | int lm_interval;
|
---|
225 | int announce_as; /* This is initialised in init_globals */
|
---|
226 | int machine_password_timeout;
|
---|
227 | int map_to_guest;
|
---|
228 | int oplock_break_wait_time;
|
---|
229 | int winbind_cache_time;
|
---|
230 | int winbind_max_idle_children;
|
---|
231 | char **szWinbindNssInfo;
|
---|
232 | int iLockSpinTime;
|
---|
233 | char *szLdapMachineSuffix;
|
---|
234 | char *szLdapUserSuffix;
|
---|
235 | char *szLdapIdmapSuffix;
|
---|
236 | char *szLdapGroupSuffix;
|
---|
237 | int ldap_ssl;
|
---|
238 | char *szLdapSuffix;
|
---|
239 | char *szLdapAdminDn;
|
---|
240 | int iAclCompat;
|
---|
241 | char *szCupsServer;
|
---|
242 | char *szIPrintServer;
|
---|
243 | int ldap_passwd_sync;
|
---|
244 | int ldap_replication_sleep;
|
---|
245 | int ldap_timeout; /* This is initialised in init_globals */
|
---|
246 | int ldap_page_size;
|
---|
247 | BOOL ldap_delete_dn;
|
---|
248 | BOOL bMsAddPrinterWizard;
|
---|
249 | BOOL bDNSproxy;
|
---|
250 | BOOL bWINSsupport;
|
---|
251 | BOOL bWINSproxy;
|
---|
252 | BOOL bLocalMaster;
|
---|
253 | BOOL bPreferredMaster;
|
---|
254 | BOOL bDomainMaster;
|
---|
255 | BOOL bDomainLogons;
|
---|
256 | BOOL bEncryptPasswords;
|
---|
257 | BOOL bUpdateEncrypt;
|
---|
258 | int clientSchannel;
|
---|
259 | int serverSchannel;
|
---|
260 | BOOL bNullPasswords;
|
---|
261 | BOOL bObeyPamRestrictions;
|
---|
262 | BOOL bLoadPrinters;
|
---|
263 | int PrintcapCacheTime;
|
---|
264 | BOOL bLargeReadwrite;
|
---|
265 | BOOL bReadRaw;
|
---|
266 | BOOL bWriteRaw;
|
---|
267 | BOOL bReadbmpx;
|
---|
268 | BOOL bSyslogOnly;
|
---|
269 | BOOL bBrowseList;
|
---|
270 | BOOL bNISHomeMap;
|
---|
271 | BOOL bTimeServer;
|
---|
272 | BOOL bBindInterfacesOnly;
|
---|
273 | BOOL bPamPasswordChange;
|
---|
274 | BOOL bUnixPasswdSync;
|
---|
275 | BOOL bPasswdChatDebug;
|
---|
276 | int iPasswdChatTimeout;
|
---|
277 | BOOL bTimestampLogs;
|
---|
278 | BOOL bNTSmbSupport;
|
---|
279 | BOOL bNTPipeSupport;
|
---|
280 | BOOL bNTStatusSupport;
|
---|
281 | BOOL bStatCache;
|
---|
282 | int iMaxStatCacheSize;
|
---|
283 | BOOL bKernelOplocks;
|
---|
284 | BOOL bAllowTrustedDomains;
|
---|
285 | BOOL bLanmanAuth;
|
---|
286 | BOOL bNTLMAuth;
|
---|
287 | BOOL bUseSpnego;
|
---|
288 | BOOL bClientLanManAuth;
|
---|
289 | BOOL bClientNTLMv2Auth;
|
---|
290 | BOOL bClientPlaintextAuth;
|
---|
291 | BOOL bClientUseSpnego;
|
---|
292 | BOOL bDebugPrefixTimestamp;
|
---|
293 | BOOL bDebugHiresTimestamp;
|
---|
294 | BOOL bDebugPid;
|
---|
295 | BOOL bDebugUid;
|
---|
296 | BOOL bEnableCoreFiles;
|
---|
297 | BOOL bHostMSDfs;
|
---|
298 | BOOL bUseMmap;
|
---|
299 | BOOL bHostnameLookups;
|
---|
300 | BOOL bUnixExtensions;
|
---|
301 | BOOL bDisableNetbios;
|
---|
302 | BOOL bUseKerberosKeytab;
|
---|
303 | BOOL bDeferSharingViolations;
|
---|
304 | BOOL bEnablePrivileges;
|
---|
305 | BOOL bASUSupport;
|
---|
306 | BOOL bUsershareOwnerOnly;
|
---|
307 | BOOL bUsershareAllowGuests;
|
---|
308 | int restrict_anonymous;
|
---|
309 | int name_cache_timeout;
|
---|
310 | int client_signing;
|
---|
311 | int server_signing;
|
---|
312 | int iUsershareMaxShares;
|
---|
313 | int iIdmapCacheTime;
|
---|
314 | int iIdmapNegativeCacheTime;
|
---|
315 |
|
---|
316 | BOOL bResetOnZeroVC;
|
---|
317 | param_opt_struct *param_opt;
|
---|
318 | } global;
|
---|
319 |
|
---|
320 | static global Globals;
|
---|
321 |
|
---|
322 | /*
|
---|
323 | * This structure describes a single service.
|
---|
324 | */
|
---|
325 | typedef struct {
|
---|
326 | BOOL valid;
|
---|
327 | BOOL autoloaded;
|
---|
328 | int usershare;
|
---|
329 | time_t usershare_last_mod;
|
---|
330 | char *szService;
|
---|
331 | char *szPath;
|
---|
332 | char *szUsername;
|
---|
333 | char **szInvalidUsers;
|
---|
334 | char **szValidUsers;
|
---|
335 | char **szAdminUsers;
|
---|
336 | char *szCopy;
|
---|
337 | char *szInclude;
|
---|
338 | char *szPreExec;
|
---|
339 | char *szPostExec;
|
---|
340 | char *szRootPreExec;
|
---|
341 | char *szRootPostExec;
|
---|
342 | char *szCupsOptions;
|
---|
343 | char *szPrintcommand;
|
---|
344 | char *szLpqcommand;
|
---|
345 | char *szLprmcommand;
|
---|
346 | char *szLppausecommand;
|
---|
347 | char *szLpresumecommand;
|
---|
348 | char *szQueuepausecommand;
|
---|
349 | char *szQueueresumecommand;
|
---|
350 | char *szPrintername;
|
---|
351 | char *szPrintjobUsername;
|
---|
352 | char *szDontdescend;
|
---|
353 | char **szHostsallow;
|
---|
354 | char **szHostsdeny;
|
---|
355 | char *szMagicScript;
|
---|
356 | char *szMagicOutput;
|
---|
357 | char *szMangledMap;
|
---|
358 | char *szVetoFiles;
|
---|
359 | char *szHideFiles;
|
---|
360 | char *szVetoOplockFiles;
|
---|
361 | char *comment;
|
---|
362 | char *force_user;
|
---|
363 | char *force_group;
|
---|
364 | char **readlist;
|
---|
365 | char **writelist;
|
---|
366 | char **printer_admin;
|
---|
367 | char *volume;
|
---|
368 | char *fstype;
|
---|
369 | char **szVfsObjects;
|
---|
370 | char *szMSDfsProxy;
|
---|
371 | char *szAioWriteBehind;
|
---|
372 | char *szDfree;
|
---|
373 | int iMinPrintSpace;
|
---|
374 | int iMaxPrintJobs;
|
---|
375 | int iMaxReportedPrintJobs;
|
---|
376 | int iWriteCacheSize;
|
---|
377 | int iCreate_mask;
|
---|
378 | int iCreate_force_mode;
|
---|
379 | int iSecurity_mask;
|
---|
380 | int iSecurity_force_mode;
|
---|
381 | int iDir_mask;
|
---|
382 | int iDir_force_mode;
|
---|
383 | int iDir_Security_mask;
|
---|
384 | int iDir_Security_force_mode;
|
---|
385 | int iMaxConnections;
|
---|
386 | int iDefaultCase;
|
---|
387 | int iPrinting;
|
---|
388 | int iOplockContentionLimit;
|
---|
389 | int iCSCPolicy;
|
---|
390 | int iBlock_size;
|
---|
391 | int iDfreeCacheTime;
|
---|
392 | BOOL bPreexecClose;
|
---|
393 | BOOL bRootpreexecClose;
|
---|
394 | int iCaseSensitive;
|
---|
395 | BOOL bCasePreserve;
|
---|
396 | BOOL bShortCasePreserve;
|
---|
397 | BOOL bHideDotFiles;
|
---|
398 | BOOL bHideSpecialFiles;
|
---|
399 | BOOL bHideUnReadable;
|
---|
400 | BOOL bHideUnWriteableFiles;
|
---|
401 | BOOL bBrowseable;
|
---|
402 | BOOL bAvailable;
|
---|
403 | BOOL bRead_only;
|
---|
404 | BOOL bNo_set_dir;
|
---|
405 | BOOL bGuest_only;
|
---|
406 | BOOL bGuest_ok;
|
---|
407 | BOOL bPrint_ok;
|
---|
408 | BOOL bMap_system;
|
---|
409 | BOOL bMap_hidden;
|
---|
410 | BOOL bMap_archive;
|
---|
411 | BOOL bStoreDosAttributes;
|
---|
412 | BOOL bDmapiSupport;
|
---|
413 | BOOL bLocking;
|
---|
414 | int iStrictLocking;
|
---|
415 | BOOL bPosixLocking;
|
---|
416 | BOOL bShareModes;
|
---|
417 | BOOL bOpLocks;
|
---|
418 | BOOL bLevel2OpLocks;
|
---|
419 | BOOL bOnlyUser;
|
---|
420 | BOOL bMangledNames;
|
---|
421 | BOOL bWidelinks;
|
---|
422 | BOOL bSymlinks;
|
---|
423 | BOOL bSyncAlways;
|
---|
424 | BOOL bStrictAllocate;
|
---|
425 | BOOL bStrictSync;
|
---|
426 | char magic_char;
|
---|
427 | BOOL *copymap;
|
---|
428 | BOOL bDeleteReadonly;
|
---|
429 | BOOL bFakeOplocks;
|
---|
430 | BOOL bDeleteVetoFiles;
|
---|
431 | BOOL bDosFilemode;
|
---|
432 | BOOL bDosFiletimes;
|
---|
433 | BOOL bDosFiletimeResolution;
|
---|
434 | BOOL bFakeDirCreateTimes;
|
---|
435 | BOOL bBlockingLocks;
|
---|
436 | BOOL bInheritPerms;
|
---|
437 | BOOL bInheritACLS;
|
---|
438 | BOOL bInheritOwner;
|
---|
439 | BOOL bMSDfsRoot;
|
---|
440 | BOOL bUseClientDriver;
|
---|
441 | BOOL bDefaultDevmode;
|
---|
442 | BOOL bForcePrintername;
|
---|
443 | BOOL bNTAclSupport;
|
---|
444 | BOOL bForceUnknownAclUser;
|
---|
445 | BOOL bUseSendfile;
|
---|
446 | BOOL bProfileAcls;
|
---|
447 | BOOL bMap_acl_inherit;
|
---|
448 | BOOL bAfs_Share;
|
---|
449 | BOOL bEASupport;
|
---|
450 | BOOL bAclCheckPermissions;
|
---|
451 | BOOL bAclMapFullControl;
|
---|
452 | BOOL bAclGroupControl;
|
---|
453 | BOOL bChangeNotify;
|
---|
454 | BOOL bKernelChangeNotify;
|
---|
455 | int iallocation_roundup_size;
|
---|
456 | int iAioReadSize;
|
---|
457 | int iAioWriteSize;
|
---|
458 | int iMap_readonly;
|
---|
459 | int iDirectoryNameCacheSize;
|
---|
460 | param_opt_struct *param_opt;
|
---|
461 |
|
---|
462 | char dummy[3]; /* for alignment */
|
---|
463 | } service;
|
---|
464 |
|
---|
465 |
|
---|
466 | /* This is a default service used to prime a services structure */
|
---|
467 | static service sDefault = {
|
---|
468 | True, /* valid */
|
---|
469 | False, /* not autoloaded */
|
---|
470 | 0, /* not a usershare */
|
---|
471 | (time_t)0, /* No last mod time */
|
---|
472 | NULL, /* szService */
|
---|
473 | NULL, /* szPath */
|
---|
474 | NULL, /* szUsername */
|
---|
475 | NULL, /* szInvalidUsers */
|
---|
476 | NULL, /* szValidUsers */
|
---|
477 | NULL, /* szAdminUsers */
|
---|
478 | NULL, /* szCopy */
|
---|
479 | NULL, /* szInclude */
|
---|
480 | NULL, /* szPreExec */
|
---|
481 | NULL, /* szPostExec */
|
---|
482 | NULL, /* szRootPreExec */
|
---|
483 | NULL, /* szRootPostExec */
|
---|
484 | NULL, /* szCupsOptions */
|
---|
485 | NULL, /* szPrintcommand */
|
---|
486 | NULL, /* szLpqcommand */
|
---|
487 | NULL, /* szLprmcommand */
|
---|
488 | NULL, /* szLppausecommand */
|
---|
489 | NULL, /* szLpresumecommand */
|
---|
490 | NULL, /* szQueuepausecommand */
|
---|
491 | NULL, /* szQueueresumecommand */
|
---|
492 | NULL, /* szPrintername */
|
---|
493 | NULL, /* szPrintjobUsername */
|
---|
494 | NULL, /* szDontdescend */
|
---|
495 | NULL, /* szHostsallow */
|
---|
496 | NULL, /* szHostsdeny */
|
---|
497 | NULL, /* szMagicScript */
|
---|
498 | NULL, /* szMagicOutput */
|
---|
499 | NULL, /* szMangledMap */
|
---|
500 | NULL, /* szVetoFiles */
|
---|
501 | NULL, /* szHideFiles */
|
---|
502 | NULL, /* szVetoOplockFiles */
|
---|
503 | NULL, /* comment */
|
---|
504 | NULL, /* force user */
|
---|
505 | NULL, /* force group */
|
---|
506 | NULL, /* readlist */
|
---|
507 | NULL, /* writelist */
|
---|
508 | NULL, /* printer admin */
|
---|
509 | NULL, /* volume */
|
---|
510 | NULL, /* fstype */
|
---|
511 | NULL, /* vfs objects */
|
---|
512 | NULL, /* szMSDfsProxy */
|
---|
513 | NULL, /* szAioWriteBehind */
|
---|
514 | NULL, /* szDfree */
|
---|
515 | 0, /* iMinPrintSpace */
|
---|
516 | 1000, /* iMaxPrintJobs */
|
---|
517 | 0, /* iMaxReportedPrintJobs */
|
---|
518 | 0, /* iWriteCacheSize */
|
---|
519 | 0744, /* iCreate_mask */
|
---|
520 | 0000, /* iCreate_force_mode */
|
---|
521 | 0777, /* iSecurity_mask */
|
---|
522 | 0, /* iSecurity_force_mode */
|
---|
523 | 0755, /* iDir_mask */
|
---|
524 | 0000, /* iDir_force_mode */
|
---|
525 | 0777, /* iDir_Security_mask */
|
---|
526 | 0, /* iDir_Security_force_mode */
|
---|
527 | 0, /* iMaxConnections */
|
---|
528 | CASE_LOWER, /* iDefaultCase */
|
---|
529 | DEFAULT_PRINTING, /* iPrinting */
|
---|
530 | 2, /* iOplockContentionLimit */
|
---|
531 | 0, /* iCSCPolicy */
|
---|
532 | 1024, /* iBlock_size */
|
---|
533 | 0, /* iDfreeCacheTime */
|
---|
534 | False, /* bPreexecClose */
|
---|
535 | False, /* bRootpreexecClose */
|
---|
536 | Auto, /* case sensitive */
|
---|
537 | True, /* case preserve */
|
---|
538 | True, /* short case preserve */
|
---|
539 | True, /* bHideDotFiles */
|
---|
540 | False, /* bHideSpecialFiles */
|
---|
541 | False, /* bHideUnReadable */
|
---|
542 | False, /* bHideUnWriteableFiles */
|
---|
543 | True, /* bBrowseable */
|
---|
544 | True, /* bAvailable */
|
---|
545 | True, /* bRead_only */
|
---|
546 | True, /* bNo_set_dir */
|
---|
547 | False, /* bGuest_only */
|
---|
548 | False, /* bGuest_ok */
|
---|
549 | False, /* bPrint_ok */
|
---|
550 | False, /* bMap_system */
|
---|
551 | False, /* bMap_hidden */
|
---|
552 | True, /* bMap_archive */
|
---|
553 | False, /* bStoreDosAttributes */
|
---|
554 | False, /* bDmapiSupport */
|
---|
555 | True, /* bLocking */
|
---|
556 | Auto, /* iStrictLocking */
|
---|
557 | True, /* bPosixLocking */
|
---|
558 | True, /* bShareModes */
|
---|
559 | True, /* bOpLocks */
|
---|
560 | True, /* bLevel2OpLocks */
|
---|
561 | False, /* bOnlyUser */
|
---|
562 | True, /* bMangledNames */
|
---|
563 | True, /* bWidelinks */
|
---|
564 | True, /* bSymlinks */
|
---|
565 | False, /* bSyncAlways */
|
---|
566 | False, /* bStrictAllocate */
|
---|
567 | False, /* bStrictSync */
|
---|
568 | '~', /* magic char */
|
---|
569 | NULL, /* copymap */
|
---|
570 | False, /* bDeleteReadonly */
|
---|
571 | False, /* bFakeOplocks */
|
---|
572 | False, /* bDeleteVetoFiles */
|
---|
573 | False, /* bDosFilemode */
|
---|
574 | True, /* bDosFiletimes */
|
---|
575 | False, /* bDosFiletimeResolution */
|
---|
576 | False, /* bFakeDirCreateTimes */
|
---|
577 | True, /* bBlockingLocks */
|
---|
578 | False, /* bInheritPerms */
|
---|
579 | False, /* bInheritACLS */
|
---|
580 | False, /* bInheritOwner */
|
---|
581 | False, /* bMSDfsRoot */
|
---|
582 | False, /* bUseClientDriver */
|
---|
583 | True, /* bDefaultDevmode */
|
---|
584 | False, /* bForcePrintername */
|
---|
585 | True, /* bNTAclSupport */
|
---|
586 | False, /* bForceUnknownAclUser */
|
---|
587 | False, /* bUseSendfile */
|
---|
588 | False, /* bProfileAcls */
|
---|
589 | False, /* bMap_acl_inherit */
|
---|
590 | False, /* bAfs_Share */
|
---|
591 | False, /* bEASupport */
|
---|
592 | True, /* bAclCheckPermissions */
|
---|
593 | True, /* bAclMapFullControl */
|
---|
594 | False, /* bAclGroupControl */
|
---|
595 | True, /* bChangeNotify */
|
---|
596 | True, /* bKernelChangeNotify */
|
---|
597 | SMB_ROUNDUP_ALLOCATION_SIZE, /* iallocation_roundup_size */
|
---|
598 | 0, /* iAioReadSize */
|
---|
599 | 0, /* iAioWriteSize */
|
---|
600 | MAP_READONLY_YES, /* iMap_readonly */
|
---|
601 | #ifdef BROKEN_DIRECTORY_HANDLING
|
---|
602 | 0, /* iDirectoryNameCacheSize */
|
---|
603 | #else
|
---|
604 | 100, /* iDirectoryNameCacheSize */
|
---|
605 | #endif
|
---|
606 | NULL, /* Parametric options */
|
---|
607 |
|
---|
608 | "" /* dummy */
|
---|
609 | };
|
---|
610 |
|
---|
611 | /* local variables */
|
---|
612 | static service **ServicePtrs = NULL;
|
---|
613 | static int iNumServices = 0;
|
---|
614 | static int iServiceIndex = 0;
|
---|
615 | static TDB_CONTEXT *ServiceHash;
|
---|
616 | static int *invalid_services = NULL;
|
---|
617 | static int num_invalid_services = 0;
|
---|
618 | static BOOL bInGlobalSection = True;
|
---|
619 | static BOOL bGlobalOnly = False;
|
---|
620 | static int server_role;
|
---|
621 | static int default_server_announce;
|
---|
622 |
|
---|
623 | #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
|
---|
624 |
|
---|
625 | /* prototypes for the special type handlers */
|
---|
626 | static BOOL handle_include( int snum, const char *pszParmValue, char **ptr);
|
---|
627 | static BOOL handle_copy( int snum, const char *pszParmValue, char **ptr);
|
---|
628 | static BOOL handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
|
---|
629 | static BOOL handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
|
---|
630 | static BOOL handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
|
---|
631 | static BOOL handle_debug_list( int snum, const char *pszParmValue, char **ptr );
|
---|
632 | static BOOL handle_workgroup( int snum, const char *pszParmValue, char **ptr );
|
---|
633 | static BOOL handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
|
---|
634 | static BOOL handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
|
---|
635 | static BOOL handle_charset( int snum, const char *pszParmValue, char **ptr );
|
---|
636 | static BOOL handle_printing( int snum, const char *pszParmValue, char **ptr);
|
---|
637 |
|
---|
638 | static void set_server_role(void);
|
---|
639 | static void set_default_server_announce_type(void);
|
---|
640 | static void set_allowed_client_auth(void);
|
---|
641 |
|
---|
642 | static const struct enum_list enum_protocol[] = {
|
---|
643 | {PROTOCOL_NT1, "NT1"},
|
---|
644 | {PROTOCOL_LANMAN2, "LANMAN2"},
|
---|
645 | {PROTOCOL_LANMAN1, "LANMAN1"},
|
---|
646 | {PROTOCOL_CORE, "CORE"},
|
---|
647 | {PROTOCOL_COREPLUS, "COREPLUS"},
|
---|
648 | {PROTOCOL_COREPLUS, "CORE+"},
|
---|
649 | {-1, NULL}
|
---|
650 | };
|
---|
651 |
|
---|
652 | static const struct enum_list enum_security[] = {
|
---|
653 | {SEC_SHARE, "SHARE"},
|
---|
654 | {SEC_USER, "USER"},
|
---|
655 | {SEC_SERVER, "SERVER"},
|
---|
656 | {SEC_DOMAIN, "DOMAIN"},
|
---|
657 | #ifdef HAVE_ADS
|
---|
658 | {SEC_ADS, "ADS"},
|
---|
659 | #endif
|
---|
660 | {-1, NULL}
|
---|
661 | };
|
---|
662 |
|
---|
663 | static const struct enum_list enum_printing[] = {
|
---|
664 | {PRINT_SYSV, "sysv"},
|
---|
665 | {PRINT_AIX, "aix"},
|
---|
666 | {PRINT_HPUX, "hpux"},
|
---|
667 | {PRINT_BSD, "bsd"},
|
---|
668 | {PRINT_QNX, "qnx"},
|
---|
669 | {PRINT_PLP, "plp"},
|
---|
670 | {PRINT_LPRNG, "lprng"},
|
---|
671 | {PRINT_CUPS, "cups"},
|
---|
672 | {PRINT_IPRINT, "iprint"},
|
---|
673 | {PRINT_LPRNT, "nt"},
|
---|
674 | {PRINT_LPROS2, "os2"},
|
---|
675 | #ifdef DEVELOPER
|
---|
676 | {PRINT_TEST, "test"},
|
---|
677 | {PRINT_VLP, "vlp"},
|
---|
678 | #endif /* DEVELOPER */
|
---|
679 | {-1, NULL}
|
---|
680 | };
|
---|
681 |
|
---|
682 | static const struct enum_list enum_ldap_ssl[] = {
|
---|
683 | {LDAP_SSL_OFF, "no"},
|
---|
684 | {LDAP_SSL_OFF, "No"},
|
---|
685 | {LDAP_SSL_OFF, "off"},
|
---|
686 | {LDAP_SSL_OFF, "Off"},
|
---|
687 | {LDAP_SSL_START_TLS, "start tls"},
|
---|
688 | {LDAP_SSL_START_TLS, "Start_tls"},
|
---|
689 | {-1, NULL}
|
---|
690 | };
|
---|
691 |
|
---|
692 | static const struct enum_list enum_ldap_passwd_sync[] = {
|
---|
693 | {LDAP_PASSWD_SYNC_OFF, "no"},
|
---|
694 | {LDAP_PASSWD_SYNC_OFF, "No"},
|
---|
695 | {LDAP_PASSWD_SYNC_OFF, "off"},
|
---|
696 | {LDAP_PASSWD_SYNC_OFF, "Off"},
|
---|
697 | {LDAP_PASSWD_SYNC_ON, "Yes"},
|
---|
698 | {LDAP_PASSWD_SYNC_ON, "yes"},
|
---|
699 | {LDAP_PASSWD_SYNC_ON, "on"},
|
---|
700 | {LDAP_PASSWD_SYNC_ON, "On"},
|
---|
701 | {LDAP_PASSWD_SYNC_ONLY, "Only"},
|
---|
702 | {LDAP_PASSWD_SYNC_ONLY, "only"},
|
---|
703 | {-1, NULL}
|
---|
704 | };
|
---|
705 |
|
---|
706 | /* Types of machine we can announce as. */
|
---|
707 | #define ANNOUNCE_AS_NT_SERVER 1
|
---|
708 | #define ANNOUNCE_AS_WIN95 2
|
---|
709 | #define ANNOUNCE_AS_WFW 3
|
---|
710 | #define ANNOUNCE_AS_NT_WORKSTATION 4
|
---|
711 |
|
---|
712 | static const struct enum_list enum_announce_as[] = {
|
---|
713 | {ANNOUNCE_AS_NT_SERVER, "NT"},
|
---|
714 | {ANNOUNCE_AS_NT_SERVER, "NT Server"},
|
---|
715 | {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
|
---|
716 | {ANNOUNCE_AS_WIN95, "win95"},
|
---|
717 | {ANNOUNCE_AS_WFW, "WfW"},
|
---|
718 | {-1, NULL}
|
---|
719 | };
|
---|
720 |
|
---|
721 | static const struct enum_list enum_map_readonly[] = {
|
---|
722 | {MAP_READONLY_NO, "no"},
|
---|
723 | {MAP_READONLY_NO, "false"},
|
---|
724 | {MAP_READONLY_NO, "0"},
|
---|
725 | {MAP_READONLY_YES, "yes"},
|
---|
726 | {MAP_READONLY_YES, "true"},
|
---|
727 | {MAP_READONLY_YES, "1"},
|
---|
728 | {MAP_READONLY_PERMISSIONS, "permissions"},
|
---|
729 | {MAP_READONLY_PERMISSIONS, "perms"},
|
---|
730 | {-1, NULL}
|
---|
731 | };
|
---|
732 |
|
---|
733 | static const struct enum_list enum_case[] = {
|
---|
734 | {CASE_LOWER, "lower"},
|
---|
735 | {CASE_UPPER, "upper"},
|
---|
736 | {-1, NULL}
|
---|
737 | };
|
---|
738 |
|
---|
739 | static const struct enum_list enum_bool_auto[] = {
|
---|
740 | {False, "No"},
|
---|
741 | {False, "False"},
|
---|
742 | {False, "0"},
|
---|
743 | {True, "Yes"},
|
---|
744 | {True, "True"},
|
---|
745 | {True, "1"},
|
---|
746 | {Auto, "Auto"},
|
---|
747 | {-1, NULL}
|
---|
748 | };
|
---|
749 |
|
---|
750 | /* Client-side offline caching policy types */
|
---|
751 | #define CSC_POLICY_MANUAL 0
|
---|
752 | #define CSC_POLICY_DOCUMENTS 1
|
---|
753 | #define CSC_POLICY_PROGRAMS 2
|
---|
754 | #define CSC_POLICY_DISABLE 3
|
---|
755 |
|
---|
756 | static const struct enum_list enum_csc_policy[] = {
|
---|
757 | {CSC_POLICY_MANUAL, "manual"},
|
---|
758 | {CSC_POLICY_DOCUMENTS, "documents"},
|
---|
759 | {CSC_POLICY_PROGRAMS, "programs"},
|
---|
760 | {CSC_POLICY_DISABLE, "disable"},
|
---|
761 | {-1, NULL}
|
---|
762 | };
|
---|
763 |
|
---|
764 | /* SMB signing types. */
|
---|
765 | static const struct enum_list enum_smb_signing_vals[] = {
|
---|
766 | {False, "No"},
|
---|
767 | {False, "False"},
|
---|
768 | {False, "0"},
|
---|
769 | {False, "Off"},
|
---|
770 | {False, "disabled"},
|
---|
771 | {True, "Yes"},
|
---|
772 | {True, "True"},
|
---|
773 | {True, "1"},
|
---|
774 | {True, "On"},
|
---|
775 | {True, "enabled"},
|
---|
776 | {Auto, "auto"},
|
---|
777 | {Required, "required"},
|
---|
778 | {Required, "mandatory"},
|
---|
779 | {Required, "force"},
|
---|
780 | {Required, "forced"},
|
---|
781 | {Required, "enforced"},
|
---|
782 | {-1, NULL}
|
---|
783 | };
|
---|
784 |
|
---|
785 | /* ACL compatibility options. */
|
---|
786 | static const struct enum_list enum_acl_compat_vals[] = {
|
---|
787 | { ACL_COMPAT_AUTO, "auto" },
|
---|
788 | { ACL_COMPAT_WINNT, "winnt" },
|
---|
789 | { ACL_COMPAT_WIN2K, "win2k" },
|
---|
790 | { -1, NULL}
|
---|
791 | };
|
---|
792 |
|
---|
793 | /*
|
---|
794 | Do you want session setups at user level security with a invalid
|
---|
795 | password to be rejected or allowed in as guest? WinNT rejects them
|
---|
796 | but it can be a pain as it means "net view" needs to use a password
|
---|
797 |
|
---|
798 | You have 3 choices in the setting of map_to_guest:
|
---|
799 |
|
---|
800 | "Never" means session setups with an invalid password
|
---|
801 | are rejected. This is the default.
|
---|
802 |
|
---|
803 | "Bad User" means session setups with an invalid password
|
---|
804 | are rejected, unless the username does not exist, in which case it
|
---|
805 | is treated as a guest login
|
---|
806 |
|
---|
807 | "Bad Password" means session setups with an invalid password
|
---|
808 | are treated as a guest login
|
---|
809 |
|
---|
810 | Note that map_to_guest only has an effect in user or server
|
---|
811 | level security.
|
---|
812 | */
|
---|
813 |
|
---|
814 | static const struct enum_list enum_map_to_guest[] = {
|
---|
815 | {NEVER_MAP_TO_GUEST, "Never"},
|
---|
816 | {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
|
---|
817 | {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
|
---|
818 | {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
|
---|
819 | {-1, NULL}
|
---|
820 | };
|
---|
821 |
|
---|
822 | /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
|
---|
823 | *
|
---|
824 | * The FLAG_HIDE is explicit. Paramters set this way do NOT appear in any edit
|
---|
825 | * screen in SWAT. This is used to exclude parameters as well as to squash all
|
---|
826 | * parameters that have been duplicated by pseudonyms.
|
---|
827 | *
|
---|
828 | * NOTE: To display a parameter in BASIC view set FLAG_BASIC
|
---|
829 | * Any parameter that does NOT have FLAG_ADVANCED will not disply at all
|
---|
830 | * Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
|
---|
831 | * respective views.
|
---|
832 | *
|
---|
833 | * NOTE2: Handling of duplicated (synonym) paramters:
|
---|
834 | * Only the first occurance of a parameter should be enabled by FLAG_BASIC
|
---|
835 | * and/or FLAG_ADVANCED. All duplicates following the first mention should be
|
---|
836 | * set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
|
---|
837 | * name first, and all synonyms must follow it with the FLAG_HIDE attribute.
|
---|
838 | */
|
---|
839 |
|
---|
840 | static struct parm_struct parm_table[] = {
|
---|
841 | {N_("Base Options"), P_SEP, P_SEPARATOR},
|
---|
842 |
|
---|
843 | {"dos charset", P_STRING, P_GLOBAL, &Globals.dos_charset, handle_charset, NULL, FLAG_ADVANCED},
|
---|
844 | {"unix charset", P_STRING, P_GLOBAL, &Globals.unix_charset, handle_charset, NULL, FLAG_ADVANCED},
|
---|
845 | {"display charset", P_STRING, P_GLOBAL, &Globals.display_charset, handle_charset, NULL, FLAG_ADVANCED},
|
---|
846 | {"comment", P_STRING, P_LOCAL, &sDefault.comment, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
847 | {"path", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
848 | {"directory", P_STRING, P_LOCAL, &sDefault.szPath, NULL, NULL, FLAG_HIDE},
|
---|
849 | {"workgroup", P_USTRING, P_GLOBAL, &Globals.szWorkgroup, handle_workgroup, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
850 | #ifdef WITH_ADS
|
---|
851 | {"realm", P_USTRING, P_GLOBAL, &Globals.szRealm, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
852 | #endif
|
---|
853 | {"netbios name", P_USTRING, P_GLOBAL, &Globals.szNetbiosName, handle_netbios_name, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
854 | {"netbios aliases", P_LIST, P_GLOBAL, &Globals.szNetbiosAliases, handle_netbios_aliases, NULL, FLAG_ADVANCED},
|
---|
855 | {"netbios scope", P_USTRING, P_GLOBAL, &Globals.szNetbiosScope, handle_netbios_scope, NULL, FLAG_ADVANCED},
|
---|
856 | {"server string", P_STRING, P_GLOBAL, &Globals.szServerString, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED },
|
---|
857 | {"interfaces", P_LIST, P_GLOBAL, &Globals.szInterfaces, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
858 | {"bind interfaces only", P_BOOL, P_GLOBAL, &Globals.bBindInterfacesOnly, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
|
---|
859 |
|
---|
860 | {N_("Security Options"), P_SEP, P_SEPARATOR},
|
---|
861 |
|
---|
862 | {"security", P_ENUM, P_GLOBAL, &Globals.security, NULL, enum_security, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
863 | {"auth methods", P_LIST, P_GLOBAL, &Globals.AuthMethods, NULL, NULL, FLAG_ADVANCED},
|
---|
864 | {"encrypt passwords", P_BOOL, P_GLOBAL, &Globals.bEncryptPasswords, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
865 | {"update encrypted", P_BOOL, P_GLOBAL, &Globals.bUpdateEncrypt, NULL, NULL, FLAG_ADVANCED},
|
---|
866 | {"client schannel", P_ENUM, P_GLOBAL, &Globals.clientSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
|
---|
867 | {"server schannel", P_ENUM, P_GLOBAL, &Globals.serverSchannel, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
|
---|
868 | {"allow trusted domains", P_BOOL, P_GLOBAL, &Globals.bAllowTrustedDomains, NULL, NULL, FLAG_ADVANCED},
|
---|
869 | {"map to guest", P_ENUM, P_GLOBAL, &Globals.map_to_guest, NULL, enum_map_to_guest, FLAG_ADVANCED},
|
---|
870 | {"null passwords", P_BOOL, P_GLOBAL, &Globals.bNullPasswords, NULL, NULL, FLAG_ADVANCED},
|
---|
871 | {"obey pam restrictions", P_BOOL, P_GLOBAL, &Globals.bObeyPamRestrictions, NULL, NULL, FLAG_ADVANCED},
|
---|
872 | {"password server", P_STRING, P_GLOBAL, &Globals.szPasswordServer, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
|
---|
873 | {"smb passwd file", P_STRING, P_GLOBAL, &Globals.szSMBPasswdFile, NULL, NULL, FLAG_ADVANCED},
|
---|
874 | {"private dir", P_STRING, P_GLOBAL, &Globals.szPrivateDir, NULL, NULL, FLAG_ADVANCED},
|
---|
875 | {"passdb backend", P_STRING, P_GLOBAL, &Globals.szPassdbBackend, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
|
---|
876 | {"algorithmic rid base", P_INTEGER, P_GLOBAL, &Globals.AlgorithmicRidBase, NULL, NULL, FLAG_ADVANCED},
|
---|
877 | {"root directory", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_ADVANCED},
|
---|
878 | {"root dir", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE},
|
---|
879 | {"root", P_STRING, P_GLOBAL, &Globals.szRootdir, NULL, NULL, FLAG_HIDE},
|
---|
880 | {"guest account", P_STRING, P_GLOBAL, &Globals.szGuestaccount, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
|
---|
881 | {"enable privileges", P_BOOL, P_GLOBAL, &Globals.bEnablePrivileges, NULL, NULL, FLAG_ADVANCED},
|
---|
882 |
|
---|
883 | {"pam password change", P_BOOL, P_GLOBAL, &Globals.bPamPasswordChange, NULL, NULL, FLAG_ADVANCED},
|
---|
884 | {"passwd program", P_STRING, P_GLOBAL, &Globals.szPasswdProgram, NULL, NULL, FLAG_ADVANCED},
|
---|
885 | {"passwd chat", P_STRING, P_GLOBAL, &Globals.szPasswdChat, NULL, NULL, FLAG_ADVANCED},
|
---|
886 | {"passwd chat debug", P_BOOL, P_GLOBAL, &Globals.bPasswdChatDebug, NULL, NULL, FLAG_ADVANCED},
|
---|
887 | {"passwd chat timeout", P_INTEGER, P_GLOBAL, &Globals.iPasswdChatTimeout, NULL, NULL, FLAG_ADVANCED},
|
---|
888 | {"check password script", P_STRING, P_GLOBAL, &Globals.szCheckPasswordScript, NULL, NULL, FLAG_ADVANCED},
|
---|
889 | {"username map", P_STRING, P_GLOBAL, &Globals.szUsernameMap, NULL, NULL, FLAG_ADVANCED},
|
---|
890 | {"password level", P_INTEGER, P_GLOBAL, &Globals.pwordlevel, NULL, NULL, FLAG_ADVANCED},
|
---|
891 | {"username level", P_INTEGER, P_GLOBAL, &Globals.unamelevel, NULL, NULL, FLAG_ADVANCED},
|
---|
892 | {"unix password sync", P_BOOL, P_GLOBAL, &Globals.bUnixPasswdSync, NULL, NULL, FLAG_ADVANCED},
|
---|
893 | {"restrict anonymous", P_INTEGER, P_GLOBAL, &Globals.restrict_anonymous, NULL, NULL, FLAG_ADVANCED},
|
---|
894 | {"lanman auth", P_BOOL, P_GLOBAL, &Globals.bLanmanAuth, NULL, NULL, FLAG_ADVANCED},
|
---|
895 | {"ntlm auth", P_BOOL, P_GLOBAL, &Globals.bNTLMAuth, NULL, NULL, FLAG_ADVANCED},
|
---|
896 | {"client NTLMv2 auth", P_BOOL, P_GLOBAL, &Globals.bClientNTLMv2Auth, NULL, NULL, FLAG_ADVANCED},
|
---|
897 | {"client lanman auth", P_BOOL, P_GLOBAL, &Globals.bClientLanManAuth, NULL, NULL, FLAG_ADVANCED},
|
---|
898 | {"client plaintext auth", P_BOOL, P_GLOBAL, &Globals.bClientPlaintextAuth, NULL, NULL, FLAG_ADVANCED},
|
---|
899 |
|
---|
900 | {"username", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
901 | {"user", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_HIDE},
|
---|
902 | {"users", P_STRING, P_LOCAL, &sDefault.szUsername, NULL, NULL, FLAG_HIDE},
|
---|
903 |
|
---|
904 | {"invalid users", P_LIST, P_LOCAL, &sDefault.szInvalidUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
905 | {"valid users", P_LIST, P_LOCAL, &sDefault.szValidUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
906 | {"admin users", P_LIST, P_LOCAL, &sDefault.szAdminUsers, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
907 | {"read list", P_LIST, P_LOCAL, &sDefault.readlist, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
908 | {"write list", P_LIST, P_LOCAL, &sDefault.writelist, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
909 | {"printer admin", P_LIST, P_LOCAL, &sDefault.printer_admin, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED },
|
---|
910 | {"force user", P_STRING, P_LOCAL, &sDefault.force_user, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
911 | {"force group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
912 | {"group", P_STRING, P_LOCAL, &sDefault.force_group, NULL, NULL, FLAG_ADVANCED},
|
---|
913 |
|
---|
914 | {"read only", P_BOOL, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE},
|
---|
915 | {"write ok", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
|
---|
916 | {"writeable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
|
---|
917 | {"writable", P_BOOLREV, P_LOCAL, &sDefault.bRead_only, NULL, NULL, FLAG_HIDE},
|
---|
918 |
|
---|
919 | {"acl check permissions", P_BOOL, P_LOCAL, &sDefault.bAclCheckPermissions, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
920 | {"acl group control", P_BOOL, P_LOCAL, &sDefault.bAclGroupControl, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED },
|
---|
921 | {"acl map full control", P_BOOL, P_LOCAL, &sDefault.bAclMapFullControl, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
922 | {"create mask", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
923 | {"create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_mask, NULL, NULL, FLAG_HIDE},
|
---|
924 | {"force create mode", P_OCTAL, P_LOCAL, &sDefault.iCreate_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
925 | {"security mask", P_OCTAL, P_LOCAL, &sDefault.iSecurity_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
926 | {"force security mode", P_OCTAL, P_LOCAL, &sDefault.iSecurity_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
927 | {"directory mask", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
928 | {"directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
929 | {"force directory mode", P_OCTAL, P_LOCAL, &sDefault.iDir_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
930 | {"directory security mask", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_mask, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
931 | {"force directory security mode", P_OCTAL, P_LOCAL, &sDefault.iDir_Security_force_mode, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
932 | {"force unknown acl user", P_BOOL, P_LOCAL, &sDefault.bForceUnknownAclUser, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
933 | {"inherit permissions", P_BOOL, P_LOCAL, &sDefault.bInheritPerms, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
934 | {"inherit acls", P_BOOL, P_LOCAL, &sDefault.bInheritACLS, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
935 | {"inherit owner", P_BOOL, P_LOCAL, &sDefault.bInheritOwner, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
936 | {"guest only", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
937 | {"only guest", P_BOOL, P_LOCAL, &sDefault.bGuest_only, NULL, NULL, FLAG_HIDE},
|
---|
938 |
|
---|
939 | {"guest ok", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
940 | {"public", P_BOOL, P_LOCAL, &sDefault.bGuest_ok, NULL, NULL, FLAG_HIDE},
|
---|
941 |
|
---|
942 | {"only user", P_BOOL, P_LOCAL, &sDefault.bOnlyUser, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED},
|
---|
943 | {"hosts allow", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
944 | {"allow hosts", P_LIST, P_LOCAL, &sDefault.szHostsallow, NULL, NULL, FLAG_HIDE},
|
---|
945 | {"hosts deny", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
946 | {"deny hosts", P_LIST, P_LOCAL, &sDefault.szHostsdeny, NULL, NULL, FLAG_HIDE},
|
---|
947 | {"preload modules", P_LIST, P_GLOBAL, &Globals.szPreloadModules, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
948 | {"use kerberos keytab", P_BOOL, P_GLOBAL, &Globals.bUseKerberosKeytab, NULL, NULL, FLAG_ADVANCED},
|
---|
949 |
|
---|
950 | {N_("Logging Options"), P_SEP, P_SEPARATOR},
|
---|
951 |
|
---|
952 | {"log level", P_STRING, P_GLOBAL, &Globals.szLogLevel, handle_debug_list, NULL, FLAG_ADVANCED},
|
---|
953 | {"debuglevel", P_STRING, P_GLOBAL, &Globals.szLogLevel, handle_debug_list, NULL, FLAG_HIDE},
|
---|
954 | {"syslog", P_INTEGER, P_GLOBAL, &Globals.syslog, NULL, NULL, FLAG_ADVANCED},
|
---|
955 | {"syslog only", P_BOOL, P_GLOBAL, &Globals.bSyslogOnly, NULL, NULL, FLAG_ADVANCED},
|
---|
956 | {"log file", P_STRING, P_GLOBAL, &Globals.szLogFile, NULL, NULL, FLAG_ADVANCED},
|
---|
957 |
|
---|
958 | {"max log size", P_INTEGER, P_GLOBAL, &Globals.max_log_size, NULL, NULL, FLAG_ADVANCED},
|
---|
959 | {"debug timestamp", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
|
---|
960 | {"timestamp logs", P_BOOL, P_GLOBAL, &Globals.bTimestampLogs, NULL, NULL, FLAG_ADVANCED},
|
---|
961 | {"debug prefix timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugPrefixTimestamp, NULL, NULL, FLAG_ADVANCED},
|
---|
962 | {"debug hires timestamp", P_BOOL, P_GLOBAL, &Globals.bDebugHiresTimestamp, NULL, NULL, FLAG_ADVANCED},
|
---|
963 | {"debug pid", P_BOOL, P_GLOBAL, &Globals.bDebugPid, NULL, NULL, FLAG_ADVANCED},
|
---|
964 | {"debug uid", P_BOOL, P_GLOBAL, &Globals.bDebugUid, NULL, NULL, FLAG_ADVANCED},
|
---|
965 | {"enable core files", P_BOOL, P_GLOBAL, &Globals.bEnableCoreFiles, NULL, NULL, FLAG_ADVANCED},
|
---|
966 |
|
---|
967 | {N_("Protocol Options"), P_SEP, P_SEPARATOR},
|
---|
968 |
|
---|
969 | {"allocation roundup size", P_INTEGER, P_LOCAL, &sDefault.iallocation_roundup_size, NULL, NULL, FLAG_ADVANCED},
|
---|
970 | {"aio read size", P_INTEGER, P_LOCAL, &sDefault.iAioReadSize, NULL, NULL, FLAG_ADVANCED},
|
---|
971 | {"aio write size", P_INTEGER, P_LOCAL, &sDefault.iAioWriteSize, NULL, NULL, FLAG_ADVANCED},
|
---|
972 | {"aio write behind", P_STRING, P_LOCAL, &sDefault.szAioWriteBehind, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
|
---|
973 | {"smb ports", P_STRING, P_GLOBAL, &Globals.smb_ports, NULL, NULL, FLAG_ADVANCED},
|
---|
974 | {"large readwrite", P_BOOL, P_GLOBAL, &Globals.bLargeReadwrite, NULL, NULL, FLAG_ADVANCED},
|
---|
975 | {"max protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
|
---|
976 | {"protocol", P_ENUM, P_GLOBAL, &Globals.maxprotocol, NULL, enum_protocol, FLAG_ADVANCED},
|
---|
977 | {"min protocol", P_ENUM, P_GLOBAL, &Globals.minprotocol, NULL, enum_protocol, FLAG_ADVANCED},
|
---|
978 | {"read bmpx", P_BOOL, P_GLOBAL, &Globals.bReadbmpx, NULL, NULL, FLAG_ADVANCED},
|
---|
979 | {"read raw", P_BOOL, P_GLOBAL, &Globals.bReadRaw, NULL, NULL, FLAG_ADVANCED},
|
---|
980 | {"write raw", P_BOOL, P_GLOBAL, &Globals.bWriteRaw, NULL, NULL, FLAG_ADVANCED},
|
---|
981 | {"disable netbios", P_BOOL, P_GLOBAL, &Globals.bDisableNetbios, NULL, NULL, FLAG_ADVANCED},
|
---|
982 | {"reset on zero vc", P_BOOL, P_GLOBAL, &Globals.bResetOnZeroVC, NULL, NULL, FLAG_ADVANCED},
|
---|
983 |
|
---|
984 | {"acl compatibility", P_ENUM, P_GLOBAL, &Globals.iAclCompat, NULL, enum_acl_compat_vals, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
985 | {"defer sharing violations", P_BOOL, P_GLOBAL, &Globals.bDeferSharingViolations, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
986 | {"ea support", P_BOOL, P_LOCAL, &sDefault.bEASupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
987 | {"nt acl support", P_BOOL, P_LOCAL, &sDefault.bNTAclSupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
988 | {"nt pipe support", P_BOOL, P_GLOBAL, &Globals.bNTPipeSupport, NULL, NULL, FLAG_ADVANCED},
|
---|
989 | {"nt status support", P_BOOL, P_GLOBAL, &Globals.bNTStatusSupport, NULL, NULL, FLAG_ADVANCED},
|
---|
990 | {"profile acls", P_BOOL, P_LOCAL, &sDefault.bProfileAcls, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
991 |
|
---|
992 | {"announce version", P_STRING, P_GLOBAL, &Globals.szAnnounceVersion, NULL, NULL, FLAG_ADVANCED},
|
---|
993 | {"announce as", P_ENUM, P_GLOBAL, &Globals.announce_as, NULL, enum_announce_as, FLAG_ADVANCED},
|
---|
994 | {"map acl inherit", P_BOOL, P_LOCAL, &sDefault.bMap_acl_inherit, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
995 | {"afs share", P_BOOL, P_LOCAL, &sDefault.bAfs_Share, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
996 | {"max mux", P_INTEGER, P_GLOBAL, &Globals.max_mux, NULL, NULL, FLAG_ADVANCED},
|
---|
997 | {"max xmit", P_INTEGER, P_GLOBAL, &Globals.max_xmit, NULL, NULL, FLAG_ADVANCED},
|
---|
998 |
|
---|
999 | {"name resolve order", P_STRING, P_GLOBAL, &Globals.szNameResolveOrder, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
|
---|
1000 | {"max ttl", P_INTEGER, P_GLOBAL, &Globals.max_ttl, NULL, NULL, FLAG_ADVANCED},
|
---|
1001 | {"max wins ttl", P_INTEGER, P_GLOBAL, &Globals.max_wins_ttl, NULL, NULL, FLAG_ADVANCED},
|
---|
1002 | {"min wins ttl", P_INTEGER, P_GLOBAL, &Globals.min_wins_ttl, NULL, NULL, FLAG_ADVANCED},
|
---|
1003 | {"time server", P_BOOL, P_GLOBAL, &Globals.bTimeServer, NULL, NULL, FLAG_ADVANCED},
|
---|
1004 | {"unix extensions", P_BOOL, P_GLOBAL, &Globals.bUnixExtensions, NULL, NULL, FLAG_ADVANCED},
|
---|
1005 | {"use spnego", P_BOOL, P_GLOBAL, &Globals.bUseSpnego, NULL, NULL, FLAG_ADVANCED},
|
---|
1006 | {"client signing", P_ENUM, P_GLOBAL, &Globals.client_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED},
|
---|
1007 | {"server signing", P_ENUM, P_GLOBAL, &Globals.server_signing, NULL, enum_smb_signing_vals, FLAG_ADVANCED},
|
---|
1008 | {"client use spnego", P_BOOL, P_GLOBAL, &Globals.bClientUseSpnego, NULL, NULL, FLAG_ADVANCED},
|
---|
1009 |
|
---|
1010 | {"enable asu support", P_BOOL, P_GLOBAL, &Globals.bASUSupport, NULL, NULL, FLAG_ADVANCED},
|
---|
1011 | {"svcctl list", P_LIST, P_GLOBAL, &Globals.szServicesList, NULL, NULL, FLAG_ADVANCED},
|
---|
1012 |
|
---|
1013 | {N_("Tuning Options"), P_SEP, P_SEPARATOR},
|
---|
1014 |
|
---|
1015 | {"block size", P_INTEGER, P_LOCAL, &sDefault.iBlock_size, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1016 | {"deadtime", P_INTEGER, P_GLOBAL, &Globals.deadtime, NULL, NULL, FLAG_ADVANCED},
|
---|
1017 | {"getwd cache", P_BOOL, P_GLOBAL, &use_getwd_cache, NULL, NULL, FLAG_ADVANCED},
|
---|
1018 | {"keepalive", P_INTEGER, P_GLOBAL, &keepalive, NULL, NULL, FLAG_ADVANCED},
|
---|
1019 | {"change notify", P_BOOL, P_LOCAL, &sDefault.bChangeNotify, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
|
---|
1020 | {"directory name cache size", P_INTEGER, P_LOCAL, &sDefault.iDirectoryNameCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
|
---|
1021 | {"kernel change notify", P_BOOL, P_LOCAL, &sDefault.bKernelChangeNotify, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
|
---|
1022 |
|
---|
1023 | {"lpq cache time", P_INTEGER, P_GLOBAL, &Globals.lpqcachetime, NULL, NULL, FLAG_ADVANCED},
|
---|
1024 | {"max smbd processes", P_INTEGER, P_GLOBAL, &Globals.iMaxSmbdProcesses, NULL, NULL, FLAG_ADVANCED},
|
---|
1025 | {"max connections", P_INTEGER, P_LOCAL, &sDefault.iMaxConnections, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1026 | {"paranoid server security", P_BOOL, P_GLOBAL, &Globals.paranoid_server_security, NULL, NULL, FLAG_ADVANCED},
|
---|
1027 | {"max disk size", P_INTEGER, P_GLOBAL, &Globals.maxdisksize, NULL, NULL, FLAG_ADVANCED},
|
---|
1028 | {"max open files", P_INTEGER, P_GLOBAL, &Globals.max_open_files, NULL, NULL, FLAG_ADVANCED},
|
---|
1029 | {"min print space", P_INTEGER, P_LOCAL, &sDefault.iMinPrintSpace, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1030 | {"open files database hash size", P_INTEGER, P_GLOBAL, &Globals.open_files_db_hash_size, NULL, NULL, FLAG_ADVANCED},
|
---|
1031 |
|
---|
1032 | {"socket options", P_GSTRING, P_GLOBAL, user_socket_options, NULL, NULL, FLAG_ADVANCED},
|
---|
1033 | {"strict allocate", P_BOOL, P_LOCAL, &sDefault.bStrictAllocate, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1034 | {"strict sync", P_BOOL, P_LOCAL, &sDefault.bStrictSync, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1035 | {"sync always", P_BOOL, P_LOCAL, &sDefault.bSyncAlways, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1036 | {"use mmap", P_BOOL, P_GLOBAL, &Globals.bUseMmap, NULL, NULL, FLAG_ADVANCED},
|
---|
1037 | {"use sendfile", P_BOOL, P_LOCAL, &sDefault.bUseSendfile, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1038 | {"hostname lookups", P_BOOL, P_GLOBAL, &Globals.bHostnameLookups, NULL, NULL, FLAG_ADVANCED},
|
---|
1039 | {"write cache size", P_INTEGER, P_LOCAL, &sDefault.iWriteCacheSize, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED},
|
---|
1040 |
|
---|
1041 | {"name cache timeout", P_INTEGER, P_GLOBAL, &Globals.name_cache_timeout, NULL, NULL, FLAG_ADVANCED},
|
---|
1042 |
|
---|
1043 | {N_("Printing Options"), P_SEP, P_SEPARATOR},
|
---|
1044 |
|
---|
1045 | {"max reported print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxReportedPrintJobs, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1046 | {"max print jobs", P_INTEGER, P_LOCAL, &sDefault.iMaxPrintJobs, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1047 | {"load printers", P_BOOL, P_GLOBAL, &Globals.bLoadPrinters, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1048 | {"printcap cache time", P_INTEGER, P_GLOBAL, &Globals.PrintcapCacheTime, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1049 | {"printcap name", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1050 | {"printcap", P_STRING, P_GLOBAL, &Globals.szPrintcapname, NULL, NULL, FLAG_HIDE},
|
---|
1051 | {"printable", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1052 | {"print ok", P_BOOL, P_LOCAL, &sDefault.bPrint_ok, NULL, NULL, FLAG_HIDE},
|
---|
1053 | {"printing", P_ENUM, P_LOCAL, &sDefault.iPrinting, handle_printing, enum_printing, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1054 | {"cups options", P_STRING, P_LOCAL, &sDefault.szCupsOptions, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1055 | {"cups server", P_STRING, P_GLOBAL, &Globals.szCupsServer, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1056 | {"iprint server", P_STRING, P_GLOBAL, &Globals.szIPrintServer, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1057 | {"print command", P_STRING, P_LOCAL, &sDefault.szPrintcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1058 | {"disable spoolss", P_BOOL, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1059 | {"enable spoolss", P_BOOLREV, P_GLOBAL, &Globals.bDisableSpoolss, NULL, NULL, FLAG_HIDE},
|
---|
1060 | {"lpq command", P_STRING, P_LOCAL, &sDefault.szLpqcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1061 | {"lprm command", P_STRING, P_LOCAL, &sDefault.szLprmcommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1062 | {"lppause command", P_STRING, P_LOCAL, &sDefault.szLppausecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1063 | {"lpresume command", P_STRING, P_LOCAL, &sDefault.szLpresumecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1064 | {"queuepause command", P_STRING, P_LOCAL, &sDefault.szQueuepausecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1065 | {"queueresume command", P_STRING, P_LOCAL, &sDefault.szQueueresumecommand, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL},
|
---|
1066 |
|
---|
1067 | {"addport command", P_STRING, P_GLOBAL, &Globals.szAddPortCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1068 | {"enumports command", P_STRING, P_GLOBAL, &Globals.szEnumPortsCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1069 | {"addprinter command", P_STRING, P_GLOBAL, &Globals.szAddPrinterCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1070 | {"deleteprinter command", P_STRING, P_GLOBAL, &Globals.szDeletePrinterCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1071 | {"show add printer wizard", P_BOOL, P_GLOBAL, &Globals.bMsAddPrinterWizard, NULL, NULL, FLAG_ADVANCED},
|
---|
1072 | {"os2 driver map", P_STRING, P_GLOBAL, &Globals.szOs2DriverMap, NULL, NULL, FLAG_ADVANCED},
|
---|
1073 |
|
---|
1074 | {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1075 | {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_HIDE},
|
---|
1076 | {"use client driver", P_BOOL, P_LOCAL, &sDefault.bUseClientDriver, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1077 | {"default devmode", P_BOOL, P_LOCAL, &sDefault.bDefaultDevmode, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1078 | {"force printername", P_BOOL, P_LOCAL, &sDefault.bForcePrintername, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1079 | {"printjob username", P_STRING, P_LOCAL, &sDefault.szPrintjobUsername, NULL, NULL, FLAG_ADVANCED | FLAG_PRINT},
|
---|
1080 |
|
---|
1081 | {N_("Filename Handling"), P_SEP, P_SEPARATOR},
|
---|
1082 | {"mangling method", P_STRING, P_GLOBAL, &Globals.szManglingMethod, NULL, NULL, FLAG_ADVANCED},
|
---|
1083 | {"mangle prefix", P_INTEGER, P_GLOBAL, &Globals.mangle_prefix, NULL, NULL, FLAG_ADVANCED},
|
---|
1084 |
|
---|
1085 | {"default case", P_ENUM, P_LOCAL, &sDefault.iDefaultCase, NULL, enum_case, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1086 | {"case sensitive", P_ENUM, P_LOCAL, &sDefault.iCaseSensitive, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1087 | {"casesignames", P_ENUM, P_LOCAL, &sDefault.iCaseSensitive, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE},
|
---|
1088 | {"preserve case", P_BOOL, P_LOCAL, &sDefault.bCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1089 | {"short preserve case", P_BOOL, P_LOCAL, &sDefault.bShortCasePreserve, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1090 | {"mangling char", P_CHAR, P_LOCAL, &sDefault.magic_char, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1091 | {"hide dot files", P_BOOL, P_LOCAL, &sDefault.bHideDotFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1092 | {"hide special files", P_BOOL, P_LOCAL, &sDefault.bHideSpecialFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1093 | {"hide unreadable", P_BOOL, P_LOCAL, &sDefault.bHideUnReadable, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1094 | {"hide unwriteable files", P_BOOL, P_LOCAL, &sDefault.bHideUnWriteableFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1095 | {"delete veto files", P_BOOL, P_LOCAL, &sDefault.bDeleteVetoFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1096 | {"veto files", P_STRING, P_LOCAL, &sDefault.szVetoFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
|
---|
1097 | {"hide files", P_STRING, P_LOCAL, &sDefault.szHideFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
|
---|
1098 | {"veto oplock files", P_STRING, P_LOCAL, &sDefault.szVetoOplockFiles, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL },
|
---|
1099 | {"map archive", P_BOOL, P_LOCAL, &sDefault.bMap_archive, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1100 | {"map hidden", P_BOOL, P_LOCAL, &sDefault.bMap_hidden, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1101 | {"map system", P_BOOL, P_LOCAL, &sDefault.bMap_system, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1102 | {"map readonly", P_ENUM, P_LOCAL, &sDefault.iMap_readonly, NULL, enum_map_readonly, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1103 | {"mangled names", P_BOOL, P_LOCAL, &sDefault.bMangledNames, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1104 | {"mangled map", P_STRING, P_LOCAL, &sDefault.szMangledMap, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED },
|
---|
1105 | {"max stat cache size", P_INTEGER, P_GLOBAL, &Globals.iMaxStatCacheSize, NULL, NULL, FLAG_ADVANCED},
|
---|
1106 | {"stat cache", P_BOOL, P_GLOBAL, &Globals.bStatCache, NULL, NULL, FLAG_ADVANCED},
|
---|
1107 | {"store dos attributes", P_BOOL, P_LOCAL, &sDefault.bStoreDosAttributes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1108 | {"dmapi support", P_BOOL, P_LOCAL, &sDefault.bDmapiSupport, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1109 |
|
---|
1110 |
|
---|
1111 | {N_("Domain Options"), P_SEP, P_SEPARATOR},
|
---|
1112 |
|
---|
1113 | {"machine password timeout", P_INTEGER, P_GLOBAL, &Globals.machine_password_timeout, NULL, NULL, FLAG_ADVANCED | FLAG_WIZARD},
|
---|
1114 |
|
---|
1115 | {N_("Logon Options"), P_SEP, P_SEPARATOR},
|
---|
1116 |
|
---|
1117 | {"add user script", P_STRING, P_GLOBAL, &Globals.szAddUserScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1118 | {"rename user script", P_STRING, P_GLOBAL, &Globals.szRenameUserScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1119 | {"delete user script", P_STRING, P_GLOBAL, &Globals.szDelUserScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1120 | {"add group script", P_STRING, P_GLOBAL, &Globals.szAddGroupScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1121 | {"delete group script", P_STRING, P_GLOBAL, &Globals.szDelGroupScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1122 | {"add user to group script", P_STRING, P_GLOBAL, &Globals.szAddUserToGroupScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1123 | {"delete user from group script", P_STRING, P_GLOBAL, &Globals.szDelUserFromGroupScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1124 | {"set primary group script", P_STRING, P_GLOBAL, &Globals.szSetPrimaryGroupScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1125 | {"add machine script", P_STRING, P_GLOBAL, &Globals.szAddMachineScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1126 | {"shutdown script", P_STRING, P_GLOBAL, &Globals.szShutdownScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1127 | {"abort shutdown script", P_STRING, P_GLOBAL, &Globals.szAbortShutdownScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1128 | {"username map script", P_STRING, P_GLOBAL, &Globals.szUsernameMapScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1129 |
|
---|
1130 | {"logon script", P_STRING, P_GLOBAL, &Globals.szLogonScript, NULL, NULL, FLAG_ADVANCED},
|
---|
1131 | {"logon path", P_STRING, P_GLOBAL, &Globals.szLogonPath, NULL, NULL, FLAG_ADVANCED},
|
---|
1132 | {"logon drive", P_STRING, P_GLOBAL, &Globals.szLogonDrive, NULL, NULL, FLAG_ADVANCED},
|
---|
1133 | {"logon home", P_STRING, P_GLOBAL, &Globals.szLogonHome, NULL, NULL, FLAG_ADVANCED},
|
---|
1134 | {"domain logons", P_BOOL, P_GLOBAL, &Globals.bDomainLogons, NULL, NULL, FLAG_ADVANCED},
|
---|
1135 |
|
---|
1136 | {N_("Browse Options"), P_SEP, P_SEPARATOR},
|
---|
1137 |
|
---|
1138 | {"os level", P_INTEGER, P_GLOBAL, &Globals.os_level, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
|
---|
1139 | {"lm announce", P_ENUM, P_GLOBAL, &Globals.lm_announce, NULL, enum_bool_auto, FLAG_ADVANCED},
|
---|
1140 | {"lm interval", P_INTEGER, P_GLOBAL, &Globals.lm_interval, NULL, NULL, FLAG_ADVANCED},
|
---|
1141 | {"preferred master", P_ENUM, P_GLOBAL, &Globals.bPreferredMaster, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
|
---|
1142 | {"prefered master", P_ENUM, P_GLOBAL, &Globals.bPreferredMaster, NULL, enum_bool_auto, FLAG_HIDE},
|
---|
1143 | {"local master", P_BOOL, P_GLOBAL, &Globals.bLocalMaster, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED},
|
---|
1144 | {"domain master", P_ENUM, P_GLOBAL, &Globals.bDomainMaster, NULL, enum_bool_auto, FLAG_BASIC | FLAG_ADVANCED},
|
---|
1145 | {"browse list", P_BOOL, P_GLOBAL, &Globals.bBrowseList, NULL, NULL, FLAG_ADVANCED},
|
---|
1146 | {"browseable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1147 | {"browsable", P_BOOL, P_LOCAL, &sDefault.bBrowseable, NULL, NULL, FLAG_HIDE},
|
---|
1148 | {"enhanced browsing", P_BOOL, P_GLOBAL, &Globals.enhanced_browsing, NULL, NULL, FLAG_ADVANCED},
|
---|
1149 |
|
---|
1150 | {N_("WINS Options"), P_SEP, P_SEPARATOR},
|
---|
1151 |
|
---|
1152 | {"dns proxy", P_BOOL, P_GLOBAL, &Globals.bDNSproxy, NULL, NULL, FLAG_ADVANCED},
|
---|
1153 | {"wins proxy", P_BOOL, P_GLOBAL, &Globals.bWINSproxy, NULL, NULL, FLAG_ADVANCED},
|
---|
1154 |
|
---|
1155 | {"wins server", P_LIST, P_GLOBAL, &Globals.szWINSservers, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
1156 | {"wins support", P_BOOL, P_GLOBAL, &Globals.bWINSsupport, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD},
|
---|
1157 | {"wins hook", P_STRING, P_GLOBAL, &Globals.szWINSHook, NULL, NULL, FLAG_ADVANCED},
|
---|
1158 |
|
---|
1159 | {N_("Locking Options"), P_SEP, P_SEPARATOR},
|
---|
1160 |
|
---|
1161 | {"blocking locks", P_BOOL, P_LOCAL, &sDefault.bBlockingLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1162 | {"csc policy", P_ENUM, P_LOCAL, &sDefault.iCSCPolicy, NULL, enum_csc_policy, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1163 | {"fake oplocks", P_BOOL, P_LOCAL, &sDefault.bFakeOplocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1164 | {"kernel oplocks", P_BOOL, P_GLOBAL, &Globals.bKernelOplocks, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
1165 | {"locking", P_BOOL, P_LOCAL, &sDefault.bLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1166 | {"lock spin time", P_INTEGER, P_GLOBAL, &Globals.iLockSpinTime, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
1167 |
|
---|
1168 | {"oplocks", P_BOOL, P_LOCAL, &sDefault.bOpLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1169 | {"level2 oplocks", P_BOOL, P_LOCAL, &sDefault.bLevel2OpLocks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1170 | {"oplock break wait time", P_INTEGER, P_GLOBAL, &Globals.oplock_break_wait_time, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL},
|
---|
1171 | {"oplock contention limit", P_INTEGER, P_LOCAL, &sDefault.iOplockContentionLimit, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1172 | {"posix locking", P_BOOL, P_LOCAL, &sDefault.bPosixLocking, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1173 | {"strict locking", P_ENUM, P_LOCAL, &sDefault.iStrictLocking, NULL, enum_bool_auto, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1174 | {"share modes", P_BOOL, P_LOCAL, &sDefault.bShareModes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1175 |
|
---|
1176 | {N_("Ldap Options"), P_SEP, P_SEPARATOR},
|
---|
1177 |
|
---|
1178 | {"ldap admin dn", P_STRING, P_GLOBAL, &Globals.szLdapAdminDn, NULL, NULL, FLAG_ADVANCED},
|
---|
1179 | {"ldap delete dn", P_BOOL, P_GLOBAL, &Globals.ldap_delete_dn, NULL, NULL, FLAG_ADVANCED},
|
---|
1180 | {"ldap group suffix", P_STRING, P_GLOBAL, &Globals.szLdapGroupSuffix, NULL, NULL, FLAG_ADVANCED},
|
---|
1181 | {"ldap idmap suffix", P_STRING, P_GLOBAL, &Globals.szLdapIdmapSuffix, NULL, NULL, FLAG_ADVANCED},
|
---|
1182 | {"ldap machine suffix", P_STRING, P_GLOBAL, &Globals.szLdapMachineSuffix, NULL, NULL, FLAG_ADVANCED},
|
---|
1183 | {"ldap passwd sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_ADVANCED},
|
---|
1184 | {"ldap password sync", P_ENUM, P_GLOBAL, &Globals.ldap_passwd_sync, NULL, enum_ldap_passwd_sync, FLAG_HIDE},
|
---|
1185 | {"ldap replication sleep", P_INTEGER, P_GLOBAL, &Globals.ldap_replication_sleep, NULL, NULL, FLAG_ADVANCED},
|
---|
1186 | {"ldap suffix", P_STRING, P_GLOBAL, &Globals.szLdapSuffix, NULL, NULL, FLAG_ADVANCED},
|
---|
1187 | {"ldap ssl", P_ENUM, P_GLOBAL, &Globals.ldap_ssl, NULL, enum_ldap_ssl, FLAG_ADVANCED},
|
---|
1188 | {"ldap timeout", P_INTEGER, P_GLOBAL, &Globals.ldap_timeout, NULL, NULL, FLAG_ADVANCED},
|
---|
1189 | {"ldap page size", P_INTEGER, P_GLOBAL, &Globals.ldap_page_size, NULL, NULL, FLAG_ADVANCED},
|
---|
1190 | {"ldap user suffix", P_STRING, P_GLOBAL, &Globals.szLdapUserSuffix, NULL, NULL, FLAG_ADVANCED},
|
---|
1191 |
|
---|
1192 | {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
|
---|
1193 | {"add share command", P_STRING, P_GLOBAL, &Globals.szAddShareCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1194 | {"change share command", P_STRING, P_GLOBAL, &Globals.szChangeShareCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1195 | {"delete share command", P_STRING, P_GLOBAL, &Globals.szDeleteShareCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1196 |
|
---|
1197 | {N_("EventLog Options"), P_SEP, P_SEPARATOR},
|
---|
1198 | {"eventlog list", P_LIST, P_GLOBAL, &Globals.szEventLogs, NULL, NULL, FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE},
|
---|
1199 |
|
---|
1200 | {"config file", P_STRING, P_GLOBAL, &Globals.szConfigFile, NULL, NULL, FLAG_HIDE},
|
---|
1201 | {"preload", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
|
---|
1202 | {"auto services", P_STRING, P_GLOBAL, &Globals.szAutoServices, NULL, NULL, FLAG_ADVANCED},
|
---|
1203 | {"lock directory", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_ADVANCED},
|
---|
1204 | {"lock dir", P_STRING, P_GLOBAL, &Globals.szLockDir, NULL, NULL, FLAG_HIDE},
|
---|
1205 | {"pid directory", P_STRING, P_GLOBAL, &Globals.szPidDir, NULL, NULL, FLAG_ADVANCED},
|
---|
1206 | #ifdef WITH_UTMP
|
---|
1207 | {"utmp directory", P_STRING, P_GLOBAL, &Globals.szUtmpDir, NULL, NULL, FLAG_ADVANCED},
|
---|
1208 | {"wtmp directory", P_STRING, P_GLOBAL, &Globals.szWtmpDir, NULL, NULL, FLAG_ADVANCED},
|
---|
1209 | {"utmp", P_BOOL, P_GLOBAL, &Globals.bUtmp, NULL, NULL, FLAG_ADVANCED},
|
---|
1210 | #endif
|
---|
1211 |
|
---|
1212 | {"default service", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_ADVANCED},
|
---|
1213 | {"default", P_STRING, P_GLOBAL, &Globals.szDefaultService, NULL, NULL, FLAG_ADVANCED},
|
---|
1214 | {"message command", P_STRING, P_GLOBAL, &Globals.szMsgCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1215 | {"dfree cache time", P_INTEGER, P_LOCAL, &sDefault.iDfreeCacheTime, NULL, NULL, FLAG_ADVANCED},
|
---|
1216 | {"dfree command", P_STRING, P_LOCAL, &sDefault.szDfree, NULL, NULL, FLAG_ADVANCED},
|
---|
1217 | {"get quota command", P_STRING, P_GLOBAL, &Globals.szGetQuota, NULL, NULL, FLAG_ADVANCED},
|
---|
1218 | {"set quota command", P_STRING, P_GLOBAL, &Globals.szSetQuota, NULL, NULL, FLAG_ADVANCED},
|
---|
1219 | {"remote announce", P_STRING, P_GLOBAL, &Globals.szRemoteAnnounce, NULL, NULL, FLAG_ADVANCED},
|
---|
1220 | {"remote browse sync", P_STRING, P_GLOBAL, &Globals.szRemoteBrowseSync, NULL, NULL, FLAG_ADVANCED},
|
---|
1221 | {"socket address", P_STRING, P_GLOBAL, &Globals.szSocketAddress, NULL, NULL, FLAG_ADVANCED},
|
---|
1222 | {"homedir map", P_STRING, P_GLOBAL, &Globals.szNISHomeMapName, NULL, NULL, FLAG_ADVANCED},
|
---|
1223 | {"afs username map", P_STRING, P_GLOBAL, &Globals.szAfsUsernameMap, NULL, NULL, FLAG_ADVANCED},
|
---|
1224 | {"afs token lifetime", P_INTEGER, P_GLOBAL, &Globals.iAfsTokenLifetime, NULL, NULL, FLAG_ADVANCED},
|
---|
1225 | {"log nt token command", P_STRING, P_GLOBAL, &Globals.szLogNtTokenCommand, NULL, NULL, FLAG_ADVANCED},
|
---|
1226 | {"time offset", P_INTEGER, P_GLOBAL, &extra_time_offset, NULL, NULL, FLAG_ADVANCED},
|
---|
1227 | {"NIS homedir", P_BOOL, P_GLOBAL, &Globals.bNISHomeMap, NULL, NULL, FLAG_ADVANCED},
|
---|
1228 | {"-valid", P_BOOL, P_LOCAL, &sDefault.valid, NULL, NULL, FLAG_HIDE},
|
---|
1229 |
|
---|
1230 | {"copy", P_STRING, P_LOCAL, &sDefault.szCopy, handle_copy, NULL, FLAG_HIDE},
|
---|
1231 | {"include", P_STRING, P_LOCAL, &sDefault.szInclude, handle_include, NULL, FLAG_HIDE},
|
---|
1232 | {"preexec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1233 | {"exec", P_STRING, P_LOCAL, &sDefault.szPreExec, NULL, NULL, FLAG_ADVANCED},
|
---|
1234 |
|
---|
1235 | {"preexec close", P_BOOL, P_LOCAL, &sDefault.bPreexecClose, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1236 | {"postexec", P_STRING, P_LOCAL, &sDefault.szPostExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1237 | {"root preexec", P_STRING, P_LOCAL, &sDefault.szRootPreExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1238 | {"root preexec close", P_BOOL, P_LOCAL, &sDefault.bRootpreexecClose, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1239 | {"root postexec", P_STRING, P_LOCAL, &sDefault.szRootPostExec, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1240 | {"available", P_BOOL, P_LOCAL, &sDefault.bAvailable, NULL, NULL, FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT},
|
---|
1241 | {"usershare allow guests", P_BOOL, P_GLOBAL, &Globals.bUsershareAllowGuests, NULL, NULL, FLAG_ADVANCED},
|
---|
1242 | {"usershare max shares", P_INTEGER, P_GLOBAL, &Globals.iUsershareMaxShares, NULL, NULL, FLAG_ADVANCED},
|
---|
1243 | {"usershare owner only", P_BOOL, P_GLOBAL, &Globals.bUsershareOwnerOnly, NULL, NULL, FLAG_ADVANCED},
|
---|
1244 | {"usershare path", P_STRING, P_GLOBAL, &Globals.szUsersharePath, NULL, NULL, FLAG_ADVANCED},
|
---|
1245 | {"usershare prefix allow list", P_LIST, P_GLOBAL, &Globals.szUsersharePrefixAllowList, NULL, NULL, FLAG_ADVANCED},
|
---|
1246 | {"usershare prefix deny list", P_LIST, P_GLOBAL, &Globals.szUsersharePrefixDenyList, NULL, NULL, FLAG_ADVANCED},
|
---|
1247 | {"usershare template share", P_STRING, P_GLOBAL, &Globals.szUsershareTemplateShare, NULL, NULL, FLAG_ADVANCED},
|
---|
1248 | {"volume", P_STRING, P_LOCAL, &sDefault.volume, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE },
|
---|
1249 | {"fstype", P_STRING, P_LOCAL, &sDefault.fstype, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1250 | {"set directory", P_BOOLREV, P_LOCAL, &sDefault.bNo_set_dir, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1251 | {"wide links", P_BOOL, P_LOCAL, &sDefault.bWidelinks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1252 | {"follow symlinks", P_BOOL, P_LOCAL, &sDefault.bSymlinks, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1253 | {"dont descend", P_STRING, P_LOCAL, &sDefault.szDontdescend, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1254 | {"magic script", P_STRING, P_LOCAL, &sDefault.szMagicScript, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1255 | {"magic output", P_STRING, P_LOCAL, &sDefault.szMagicOutput, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1256 | {"delete readonly", P_BOOL, P_LOCAL, &sDefault.bDeleteReadonly, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1257 | {"dos filemode", P_BOOL, P_LOCAL, &sDefault.bDosFilemode, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1258 | {"dos filetimes", P_BOOL, P_LOCAL, &sDefault.bDosFiletimes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1259 | {"dos filetime resolution", P_BOOL, P_LOCAL, &sDefault.bDosFiletimeResolution, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1260 |
|
---|
1261 | {"fake directory create times", P_BOOL, P_LOCAL, &sDefault.bFakeDirCreateTimes, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL},
|
---|
1262 | {"panic action", P_STRING, P_GLOBAL, &Globals.szPanicAction, NULL, NULL, FLAG_ADVANCED},
|
---|
1263 |
|
---|
1264 | {N_("VFS module options"), P_SEP, P_SEPARATOR},
|
---|
1265 |
|
---|
1266 | {"vfs objects", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1267 | {"vfs object", P_LIST, P_LOCAL, &sDefault.szVfsObjects, NULL, NULL, FLAG_HIDE},
|
---|
1268 |
|
---|
1269 |
|
---|
1270 | {"msdfs root", P_BOOL, P_LOCAL, &sDefault.bMSDfsRoot, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1271 | {"msdfs proxy", P_STRING, P_LOCAL, &sDefault.szMSDfsProxy, NULL, NULL, FLAG_ADVANCED | FLAG_SHARE},
|
---|
1272 | {"host msdfs", P_BOOL, P_GLOBAL, &Globals.bHostMSDfs, NULL, NULL, FLAG_ADVANCED},
|
---|
1273 |
|
---|
1274 | {N_("Winbind options"), P_SEP, P_SEPARATOR},
|
---|
1275 |
|
---|
1276 | {"passdb expand explicit", P_BOOL, P_GLOBAL, &Globals.bPassdbExpandExplicit, NULL, NULL, FLAG_ADVANCED},
|
---|
1277 | {"idmap domains", P_LIST, P_GLOBAL, &Globals.szIdmapDomains, NULL, NULL, FLAG_ADVANCED},
|
---|
1278 | {"idmap backend", P_LIST, P_GLOBAL, &Globals.szIdmapBackend, NULL, NULL, FLAG_ADVANCED },
|
---|
1279 | {"idmap alloc backend", P_STRING, P_GLOBAL, &Globals.szIdmapAllocBackend, NULL, NULL, FLAG_ADVANCED},
|
---|
1280 | {"idmap cache time", P_INTEGER, P_GLOBAL, &Globals.iIdmapCacheTime, NULL, NULL, FLAG_ADVANCED},
|
---|
1281 | {"idmap negative cache time", P_INTEGER, P_GLOBAL, &Globals.iIdmapNegativeCacheTime, NULL, NULL, FLAG_ADVANCED},
|
---|
1282 | {"idmap uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_ADVANCED },
|
---|
1283 | {"winbind uid", P_STRING, P_GLOBAL, &Globals.szIdmapUID, handle_idmap_uid, NULL, FLAG_HIDE },
|
---|
1284 | {"idmap gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_ADVANCED },
|
---|
1285 | {"winbind gid", P_STRING, P_GLOBAL, &Globals.szIdmapGID, handle_idmap_gid, NULL, FLAG_HIDE },
|
---|
1286 | {"template homedir", P_STRING, P_GLOBAL, &Globals.szTemplateHomedir, NULL, NULL, FLAG_ADVANCED},
|
---|
1287 | {"template shell", P_STRING, P_GLOBAL, &Globals.szTemplateShell, NULL, NULL, FLAG_ADVANCED},
|
---|
1288 | {"winbind separator", P_STRING, P_GLOBAL, &Globals.szWinbindSeparator, NULL, NULL, FLAG_ADVANCED},
|
---|
1289 | {"winbind cache time", P_INTEGER, P_GLOBAL, &Globals.winbind_cache_time, NULL, NULL, FLAG_ADVANCED},
|
---|
1290 | {"winbind enum users", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumUsers, NULL, NULL, FLAG_ADVANCED},
|
---|
1291 | {"winbind enum groups", P_BOOL, P_GLOBAL, &Globals.bWinbindEnumGroups, NULL, NULL, FLAG_ADVANCED},
|
---|
1292 | {"winbind use default domain", P_BOOL, P_GLOBAL, &Globals.bWinbindUseDefaultDomain, NULL, NULL, FLAG_ADVANCED},
|
---|
1293 | {"winbind trusted domains only", P_BOOL, P_GLOBAL, &Globals.bWinbindTrustedDomainsOnly, NULL, NULL, FLAG_ADVANCED},
|
---|
1294 | {"winbind nested groups", P_BOOL, P_GLOBAL, &Globals.bWinbindNestedGroups, NULL, NULL, FLAG_ADVANCED},
|
---|
1295 | {"winbind nss info", P_LIST, P_GLOBAL, &Globals.szWinbindNssInfo, NULL, NULL, FLAG_ADVANCED},
|
---|
1296 | {"winbind refresh tickets", P_BOOL, P_GLOBAL, &Globals.bWinbindRefreshTickets, NULL, NULL, FLAG_ADVANCED},
|
---|
1297 | {"winbind offline logon", P_BOOL, P_GLOBAL, &Globals.bWinbindOfflineLogon, NULL, NULL, FLAG_ADVANCED},
|
---|
1298 | {"winbind normalize names", P_BOOL, P_GLOBAL, &Globals.bWinbindNormalizeNames, NULL, NULL, FLAG_ADVANCED},
|
---|
1299 |
|
---|
1300 | {NULL, P_BOOL, P_NONE, NULL, NULL, NULL, 0}
|
---|
1301 | };
|
---|
1302 |
|
---|
1303 | /***************************************************************************
|
---|
1304 | Initialise the sDefault parameter structure for the printer values.
|
---|
1305 | ***************************************************************************/
|
---|
1306 |
|
---|
1307 | static void init_printer_values(service *pService)
|
---|
1308 | {
|
---|
1309 | /* choose defaults depending on the type of printing */
|
---|
1310 | switch (pService->iPrinting) {
|
---|
1311 | case PRINT_BSD:
|
---|
1312 | case PRINT_AIX:
|
---|
1313 | case PRINT_LPRNT:
|
---|
1314 | #ifndef __OS2__
|
---|
1315 | case PRINT_LPROS2:
|
---|
1316 | #endif
|
---|
1317 | string_set(&pService->szLpqcommand, "lpq -P'%p'");
|
---|
1318 | string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
|
---|
1319 | string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
|
---|
1320 | break;
|
---|
1321 | #ifdef __OS2__
|
---|
1322 | case PRINT_LPROS2:
|
---|
1323 | string_set(&pService->szLpqcommand, "lpq.exe -s %i -p %p");
|
---|
1324 | string_set(&pService->szLprmcommand, "lprm.exe -s %i -p %p %j");
|
---|
1325 | string_set(&pService->szPrintcommand, "lpr.exe -b -s %i -p %p %s & cmd.exe /c del %s");
|
---|
1326 | break;
|
---|
1327 | #endif
|
---|
1328 |
|
---|
1329 | case PRINT_LPRNG:
|
---|
1330 | case PRINT_PLP:
|
---|
1331 | string_set(&pService->szLpqcommand, "lpq -P'%p'");
|
---|
1332 | string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
|
---|
1333 | string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
|
---|
1334 | string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
|
---|
1335 | string_set(&pService->szQueueresumecommand, "lpc start '%p'");
|
---|
1336 | string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
|
---|
1337 | string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
|
---|
1338 | break;
|
---|
1339 |
|
---|
1340 | case PRINT_CUPS:
|
---|
1341 | case PRINT_IPRINT:
|
---|
1342 | #ifdef HAVE_CUPS
|
---|
1343 | /* set the lpq command to contain the destination printer
|
---|
1344 | name only. This is used by cups_queue_get() */
|
---|
1345 | string_set(&pService->szLpqcommand, "%p");
|
---|
1346 | string_set(&pService->szLprmcommand, "");
|
---|
1347 | string_set(&pService->szPrintcommand, "");
|
---|
1348 | string_set(&pService->szLppausecommand, "");
|
---|
1349 | string_set(&pService->szLpresumecommand, "");
|
---|
1350 | string_set(&pService->szQueuepausecommand, "");
|
---|
1351 | string_set(&pService->szQueueresumecommand, "");
|
---|
1352 | #else
|
---|
1353 | string_set(&pService->szLpqcommand, "lpq -P'%p'");
|
---|
1354 | string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
|
---|
1355 | string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
|
---|
1356 | string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
|
---|
1357 | string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
|
---|
1358 | string_set(&pService->szQueuepausecommand, "disable '%p'");
|
---|
1359 | string_set(&pService->szQueueresumecommand, "enable '%p'");
|
---|
1360 | #endif /* HAVE_CUPS */
|
---|
1361 | break;
|
---|
1362 |
|
---|
1363 | case PRINT_SYSV:
|
---|
1364 | case PRINT_HPUX:
|
---|
1365 | string_set(&pService->szLpqcommand, "lpstat -o%p");
|
---|
1366 | string_set(&pService->szLprmcommand, "cancel %p-%j");
|
---|
1367 | string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
|
---|
1368 | string_set(&pService->szQueuepausecommand, "disable %p");
|
---|
1369 | string_set(&pService->szQueueresumecommand, "enable %p");
|
---|
1370 | #ifndef HPUX
|
---|
1371 | string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
|
---|
1372 | string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
|
---|
1373 | #endif /* HPUX */
|
---|
1374 | break;
|
---|
1375 |
|
---|
1376 | case PRINT_QNX:
|
---|
1377 | string_set(&pService->szLpqcommand, "lpq -P%p");
|
---|
1378 | string_set(&pService->szLprmcommand, "lprm -P%p %j");
|
---|
1379 | string_set(&pService->szPrintcommand, "lp -r -P%p %s");
|
---|
1380 | break;
|
---|
1381 |
|
---|
1382 | #ifdef DEVELOPER
|
---|
1383 | case PRINT_TEST:
|
---|
1384 | case PRINT_VLP:
|
---|
1385 | string_set(&pService->szPrintcommand, "vlp print %p %s");
|
---|
1386 | string_set(&pService->szLpqcommand, "vlp lpq %p");
|
---|
1387 | string_set(&pService->szLprmcommand, "vlp lprm %p %j");
|
---|
1388 | string_set(&pService->szLppausecommand, "vlp lppause %p %j");
|
---|
1389 | string_set(&pService->szLpresumecommand, "vlp lpresum %p %j");
|
---|
1390 | string_set(&pService->szQueuepausecommand, "vlp queuepause %p");
|
---|
1391 | string_set(&pService->szQueueresumecommand, "vlp queueresume %p");
|
---|
1392 | break;
|
---|
1393 | #endif /* DEVELOPER */
|
---|
1394 |
|
---|
1395 | }
|
---|
1396 | }
|
---|
1397 |
|
---|
1398 | /***************************************************************************
|
---|
1399 | Initialise the global parameter structure.
|
---|
1400 | ***************************************************************************/
|
---|
1401 |
|
---|
1402 | #ifndef __OS2__
|
---|
1403 | static
|
---|
1404 | #endif
|
---|
1405 | void init_globals(BOOL first_time_only)
|
---|
1406 | {
|
---|
1407 | static BOOL done_init = False;
|
---|
1408 | pstring s;
|
---|
1409 |
|
---|
1410 | /* If requested to initialize only once and we've already done it... */
|
---|
1411 | if (first_time_only && done_init) {
|
---|
1412 | /* ... then we have nothing more to do */
|
---|
1413 | return;
|
---|
1414 | }
|
---|
1415 |
|
---|
1416 | if (!done_init) {
|
---|
1417 | int i;
|
---|
1418 |
|
---|
1419 | /* The logfile can be set before this is invoked. Free it if so. */
|
---|
1420 | if (Globals.szLogFile != NULL) {
|
---|
1421 | string_free(&Globals.szLogFile);
|
---|
1422 | Globals.szLogFile = NULL;
|
---|
1423 | }
|
---|
1424 |
|
---|
1425 | memset((void *)&Globals, '\0', sizeof(Globals));
|
---|
1426 |
|
---|
1427 | for (i = 0; parm_table[i].label; i++)
|
---|
1428 | if ((parm_table[i].type == P_STRING ||
|
---|
1429 | parm_table[i].type == P_USTRING) &&
|
---|
1430 | parm_table[i].ptr)
|
---|
1431 | string_set((char **)parm_table[i].ptr, "");
|
---|
1432 |
|
---|
1433 | string_set(&sDefault.fstype, FSTYPE_STRING);
|
---|
1434 | string_set(&sDefault.szPrintjobUsername, "%U");
|
---|
1435 |
|
---|
1436 | init_printer_values(&sDefault);
|
---|
1437 |
|
---|
1438 | done_init = True;
|
---|
1439 | }
|
---|
1440 |
|
---|
1441 |
|
---|
1442 | DEBUG(3, ("Initialising global parameters\n"));
|
---|
1443 |
|
---|
1444 | string_set(&Globals.szSMBPasswdFile, dyn_SMB_PASSWD_FILE);
|
---|
1445 | string_set(&Globals.szPrivateDir, dyn_PRIVATE_DIR);
|
---|
1446 |
|
---|
1447 | /* use the new 'hash2' method by default, with a prefix of 1 */
|
---|
1448 | string_set(&Globals.szManglingMethod, "hash2");
|
---|
1449 | Globals.mangle_prefix = 1;
|
---|
1450 |
|
---|
1451 | string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
|
---|
1452 |
|
---|
1453 | #ifndef __OS2__
|
---|
1454 | /* using UTF8 by default allows us to support all chars */
|
---|
1455 | string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
|
---|
1456 | #else
|
---|
1457 | /* On OS/2, using UTF8 causes problems with display of foreign characters - default to SYSTEM codepage */
|
---|
1458 | string_set(&Globals.unix_charset, "SYSTEM");
|
---|
1459 | #endif
|
---|
1460 |
|
---|
1461 | #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
|
---|
1462 | /* If the system supports nl_langinfo(), try to grab the value
|
---|
1463 | from the user's locale */
|
---|
1464 | string_set(&Globals.display_charset, "LOCALE");
|
---|
1465 | #else
|
---|
1466 | string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
|
---|
1467 | #endif
|
---|
1468 |
|
---|
1469 | #ifndef __OS2__
|
---|
1470 | /* Use codepage 850 as a default for the dos character set */
|
---|
1471 | string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
|
---|
1472 | #else
|
---|
1473 | /* On OS/2, using UTF8 causes problems with display of foreign characters - default to SYSTEM codepage */
|
---|
1474 | string_set(&Globals.dos_charset, "SYSTEM");
|
---|
1475 | #endif
|
---|
1476 | /*
|
---|
1477 | * Allow the default PASSWD_CHAT to be overridden in local.h.
|
---|
1478 | */
|
---|
1479 | string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
|
---|
1480 |
|
---|
1481 | set_global_myname(myhostname());
|
---|
1482 | string_set(&Globals.szNetbiosName,global_myname());
|
---|
1483 |
|
---|
1484 | set_global_myworkgroup(WORKGROUP);
|
---|
1485 | string_set(&Globals.szWorkgroup, lp_workgroup());
|
---|
1486 |
|
---|
1487 | string_set(&Globals.szPasswdProgram, "");
|
---|
1488 | string_set(&Globals.szPidDir, dyn_PIDDIR);
|
---|
1489 | string_set(&Globals.szLockDir, dyn_LOCKDIR);
|
---|
1490 | string_set(&Globals.szSocketAddress, "0.0.0.0");
|
---|
1491 | pstrcpy(s, "Samba ");
|
---|
1492 | pstrcat(s, SAMBA_VERSION_STRING);
|
---|
1493 | string_set(&Globals.szServerString, s);
|
---|
1494 | slprintf(s, sizeof(s) - 1, "%d.%d", DEFAULT_MAJOR_VERSION,
|
---|
1495 | DEFAULT_MINOR_VERSION);
|
---|
1496 | string_set(&Globals.szAnnounceVersion, s);
|
---|
1497 | #ifdef DEVELOPER
|
---|
1498 | string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
|
---|
1499 | #endif
|
---|
1500 |
|
---|
1501 | pstrcpy(user_socket_options, DEFAULT_SOCKET_OPTIONS);
|
---|
1502 |
|
---|
1503 | string_set(&Globals.szLogonDrive, "");
|
---|
1504 | /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
|
---|
1505 | string_set(&Globals.szLogonHome, "\\\\%N\\%U");
|
---|
1506 | string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
|
---|
1507 |
|
---|
1508 | string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
|
---|
1509 | string_set(&Globals.szPasswordServer, "*");
|
---|
1510 |
|
---|
1511 | Globals.AlgorithmicRidBase = BASE_RID;
|
---|
1512 |
|
---|
1513 | Globals.bLoadPrinters = True;
|
---|
1514 | Globals.PrintcapCacheTime = 750; /* 12.5 minutes */
|
---|
1515 |
|
---|
1516 | /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
|
---|
1517 | /* Discovered by 2 days of pain by Don McCall @ HP :-). */
|
---|
1518 | Globals.max_xmit = 0x4104;
|
---|
1519 | Globals.max_mux = 50; /* This is *needed* for profile support. */
|
---|
1520 | Globals.lpqcachetime = 30; /* changed to handle large print servers better -- jerry */
|
---|
1521 | Globals.bDisableSpoolss = False;
|
---|
1522 | Globals.iMaxSmbdProcesses = 0;/* no limit specified */
|
---|
1523 | Globals.pwordlevel = 0;
|
---|
1524 | Globals.unamelevel = 0;
|
---|
1525 | Globals.deadtime = 0;
|
---|
1526 | Globals.bLargeReadwrite = True;
|
---|
1527 | Globals.max_log_size = 5000;
|
---|
1528 | Globals.max_open_files = MAX_OPEN_FILES;
|
---|
1529 | Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
|
---|
1530 | Globals.maxprotocol = PROTOCOL_NT1;
|
---|
1531 | Globals.minprotocol = PROTOCOL_CORE;
|
---|
1532 | Globals.security = SEC_USER;
|
---|
1533 | Globals.paranoid_server_security = True;
|
---|
1534 | Globals.bEncryptPasswords = True;
|
---|
1535 | Globals.bUpdateEncrypt = False;
|
---|
1536 | Globals.clientSchannel = Auto;
|
---|
1537 | Globals.serverSchannel = Auto;
|
---|
1538 | Globals.bReadRaw = True;
|
---|
1539 | Globals.bWriteRaw = True;
|
---|
1540 | Globals.bReadbmpx = False;
|
---|
1541 | Globals.bNullPasswords = False;
|
---|
1542 | Globals.bObeyPamRestrictions = False;
|
---|
1543 | Globals.syslog = 1;
|
---|
1544 | Globals.bSyslogOnly = False;
|
---|
1545 | Globals.bTimestampLogs = True;
|
---|
1546 | string_set(&Globals.szLogLevel, "0");
|
---|
1547 | Globals.bDebugPrefixTimestamp = False;
|
---|
1548 | Globals.bDebugHiresTimestamp = False;
|
---|
1549 | Globals.bDebugPid = False;
|
---|
1550 | Globals.bDebugUid = False;
|
---|
1551 | Globals.bEnableCoreFiles = True;
|
---|
1552 | Globals.max_ttl = 60 * 60 * 24 * 3; /* 3 days default. */
|
---|
1553 | Globals.max_wins_ttl = 60 * 60 * 24 * 6; /* 6 days default. */
|
---|
1554 | Globals.min_wins_ttl = 60 * 60 * 6; /* 6 hours default. */
|
---|
1555 | Globals.machine_password_timeout = 60 * 60 * 24 * 7; /* 7 days default. */
|
---|
1556 | Globals.lm_announce = 2; /* = Auto: send only if LM clients found */
|
---|
1557 | Globals.lm_interval = 60;
|
---|
1558 | Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
|
---|
1559 | #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
|
---|
1560 | Globals.bNISHomeMap = False;
|
---|
1561 | #ifdef WITH_NISPLUS_HOME
|
---|
1562 | string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
|
---|
1563 | #else
|
---|
1564 | string_set(&Globals.szNISHomeMapName, "auto.home");
|
---|
1565 | #endif
|
---|
1566 | #endif
|
---|
1567 | Globals.bTimeServer = False;
|
---|
1568 | Globals.bBindInterfacesOnly = False;
|
---|
1569 | Globals.bUnixPasswdSync = False;
|
---|
1570 | Globals.bPamPasswordChange = False;
|
---|
1571 | Globals.bPasswdChatDebug = False;
|
---|
1572 | Globals.iPasswdChatTimeout = 2; /* 2 second default. */
|
---|
1573 | Globals.bNTPipeSupport = True; /* Do NT pipes by default. */
|
---|
1574 | Globals.bNTStatusSupport = True; /* Use NT status by default. */
|
---|
1575 | Globals.bStatCache = True; /* use stat cache by default */
|
---|
1576 | Globals.iMaxStatCacheSize = 1024; /* one Meg by default. */
|
---|
1577 | Globals.restrict_anonymous = 0;
|
---|
1578 | Globals.bClientLanManAuth = True; /* Do use the LanMan hash if it is available */
|
---|
1579 | Globals.bClientPlaintextAuth = True; /* Do use a plaintext password if is requested by the server */
|
---|
1580 | Globals.bLanmanAuth = True; /* Do use the LanMan hash if it is available */
|
---|
1581 | Globals.bNTLMAuth = True; /* Do use NTLMv1 if it is available (otherwise NTLMv2) */
|
---|
1582 | Globals.bClientNTLMv2Auth = False; /* Client should not use NTLMv2, as we can't tell that the server supports it. */
|
---|
1583 | /* Note, that we will use NTLM2 session security (which is different), if it is available */
|
---|
1584 |
|
---|
1585 | Globals.map_to_guest = 0; /* By Default, "Never" */
|
---|
1586 | Globals.oplock_break_wait_time = 0; /* By Default, 0 msecs. */
|
---|
1587 | Globals.enhanced_browsing = True;
|
---|
1588 | Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
|
---|
1589 | #ifdef MMAP_BLACKLIST
|
---|
1590 | Globals.bUseMmap = False;
|
---|
1591 | #else
|
---|
1592 | Globals.bUseMmap = True;
|
---|
1593 | #endif
|
---|
1594 | Globals.bUnixExtensions = True;
|
---|
1595 | Globals.bResetOnZeroVC = False;
|
---|
1596 |
|
---|
1597 | /* hostname lookups can be very expensive and are broken on
|
---|
1598 | a large number of sites (tridge) */
|
---|
1599 | Globals.bHostnameLookups = False;
|
---|
1600 |
|
---|
1601 | string_set(&Globals.szPassdbBackend, "smbpasswd");
|
---|
1602 | string_set(&Globals.szLdapSuffix, "");
|
---|
1603 | string_set(&Globals.szLdapMachineSuffix, "");
|
---|
1604 | string_set(&Globals.szLdapUserSuffix, "");
|
---|
1605 | string_set(&Globals.szLdapGroupSuffix, "");
|
---|
1606 | string_set(&Globals.szLdapIdmapSuffix, "");
|
---|
1607 |
|
---|
1608 | string_set(&Globals.szLdapAdminDn, "");
|
---|
1609 | Globals.ldap_ssl = LDAP_SSL_ON;
|
---|
1610 | Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
|
---|
1611 | Globals.ldap_delete_dn = False;
|
---|
1612 | Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
|
---|
1613 | Globals.ldap_timeout = LDAP_CONNECT_DEFAULT_TIMEOUT;
|
---|
1614 | Globals.ldap_page_size = LDAP_PAGE_SIZE;
|
---|
1615 |
|
---|
1616 | /* This is what we tell the afs client. in reality we set the token
|
---|
1617 | * to never expire, though, when this runs out the afs client will
|
---|
1618 | * forget the token. Set to 0 to get NEVERDATE.*/
|
---|
1619 | Globals.iAfsTokenLifetime = 604800;
|
---|
1620 |
|
---|
1621 | /* these parameters are set to defaults that are more appropriate
|
---|
1622 | for the increasing samba install base:
|
---|
1623 |
|
---|
1624 | as a member of the workgroup, that will possibly become a
|
---|
1625 | _local_ master browser (lm = True). this is opposed to a forced
|
---|
1626 | local master browser startup (pm = True).
|
---|
1627 |
|
---|
1628 | doesn't provide WINS server service by default (wsupp = False),
|
---|
1629 | and doesn't provide domain master browser services by default, either.
|
---|
1630 |
|
---|
1631 | */
|
---|
1632 |
|
---|
1633 | Globals.bMsAddPrinterWizard = True;
|
---|
1634 | Globals.bPreferredMaster = Auto; /* depending on bDomainMaster */
|
---|
1635 | Globals.os_level = 20;
|
---|
1636 | Globals.bLocalMaster = True;
|
---|
1637 | Globals.bDomainMaster = Auto; /* depending on bDomainLogons */
|
---|
1638 | Globals.bDomainLogons = False;
|
---|
1639 | Globals.bBrowseList = True;
|
---|
1640 | Globals.bWINSsupport = False;
|
---|
1641 | Globals.bWINSproxy = False;
|
---|
1642 |
|
---|
1643 | Globals.bDNSproxy = True;
|
---|
1644 |
|
---|
1645 | /* this just means to use them if they exist */
|
---|
1646 | Globals.bKernelOplocks = True;
|
---|
1647 |
|
---|
1648 | Globals.bAllowTrustedDomains = True;
|
---|
1649 |
|
---|
1650 | string_set(&Globals.szTemplateShell, "/bin/false");
|
---|
1651 | string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
|
---|
1652 | string_set(&Globals.szWinbindSeparator, "\\");
|
---|
1653 |
|
---|
1654 | string_set(&Globals.szCupsServer, "");
|
---|
1655 | string_set(&Globals.szIPrintServer, "");
|
---|
1656 |
|
---|
1657 | Globals.winbind_cache_time = 300; /* 5 minutes */
|
---|
1658 | Globals.bWinbindEnumUsers = False;
|
---|
1659 | Globals.bWinbindEnumGroups = False;
|
---|
1660 | Globals.bWinbindUseDefaultDomain = False;
|
---|
1661 | Globals.bWinbindTrustedDomainsOnly = False;
|
---|
1662 | Globals.bWinbindNestedGroups = True;
|
---|
1663 | Globals.szWinbindNssInfo = str_list_make("template", NULL);
|
---|
1664 | Globals.bWinbindRefreshTickets = False;
|
---|
1665 | Globals.bWinbindOfflineLogon = False;
|
---|
1666 |
|
---|
1667 | Globals.iIdmapCacheTime = 900; /* 15 minutes by default */
|
---|
1668 | Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
|
---|
1669 |
|
---|
1670 | Globals.bPassdbExpandExplicit = False;
|
---|
1671 |
|
---|
1672 | Globals.name_cache_timeout = 660; /* In seconds */
|
---|
1673 |
|
---|
1674 | Globals.bUseSpnego = True;
|
---|
1675 | Globals.bClientUseSpnego = True;
|
---|
1676 |
|
---|
1677 | Globals.client_signing = Auto;
|
---|
1678 | Globals.server_signing = False;
|
---|
1679 |
|
---|
1680 | Globals.bDeferSharingViolations = True;
|
---|
1681 | string_set(&Globals.smb_ports, SMB_PORTS);
|
---|
1682 |
|
---|
1683 | Globals.bEnablePrivileges = True;
|
---|
1684 | Globals.bHostMSDfs = True;
|
---|
1685 | Globals.bASUSupport = False;
|
---|
1686 |
|
---|
1687 | /* User defined shares. */
|
---|
1688 | pstrcpy(s, dyn_LOCKDIR);
|
---|
1689 | pstrcat(s, "/usershares");
|
---|
1690 | string_set(&Globals.szUsersharePath, s);
|
---|
1691 | string_set(&Globals.szUsershareTemplateShare, "");
|
---|
1692 | Globals.iUsershareMaxShares = 0;
|
---|
1693 | /* By default disallow sharing of directories not owned by the sharer. */
|
---|
1694 | Globals.bUsershareOwnerOnly = True;
|
---|
1695 | /* By default disallow guest access to usershares. */
|
---|
1696 | Globals.bUsershareAllowGuests = False;
|
---|
1697 | }
|
---|
1698 |
|
---|
1699 | static TALLOC_CTX *lp_talloc;
|
---|
1700 |
|
---|
1701 | /******************************************************************* a
|
---|
1702 | Free up temporary memory - called from the main loop.
|
---|
1703 | ********************************************************************/
|
---|
1704 |
|
---|
1705 | void lp_TALLOC_FREE(void)
|
---|
1706 | {
|
---|
1707 | if (!lp_talloc)
|
---|
1708 | return;
|
---|
1709 | TALLOC_FREE(lp_talloc);
|
---|
1710 | lp_talloc = NULL;
|
---|
1711 | }
|
---|
1712 |
|
---|
1713 | TALLOC_CTX *tmp_talloc_ctx(void)
|
---|
1714 | {
|
---|
1715 | if (lp_talloc == NULL) {
|
---|
1716 | lp_talloc = talloc_init("tmp_talloc_ctx");
|
---|
1717 | }
|
---|
1718 |
|
---|
1719 | if (lp_talloc == NULL) {
|
---|
1720 | smb_panic("Could not create temporary talloc context\n");
|
---|
1721 | }
|
---|
1722 |
|
---|
1723 | return lp_talloc;
|
---|
1724 | }
|
---|
1725 |
|
---|
1726 | /*******************************************************************
|
---|
1727 | Convenience routine to grab string parameters into temporary memory
|
---|
1728 | and run standard_sub_basic on them. The buffers can be written to by
|
---|
1729 | callers without affecting the source string.
|
---|
1730 | ********************************************************************/
|
---|
1731 |
|
---|
1732 | static char *lp_string(const char *s)
|
---|
1733 | {
|
---|
1734 | char *ret, *tmpstr;
|
---|
1735 |
|
---|
1736 | /* The follow debug is useful for tracking down memory problems
|
---|
1737 | especially if you have an inner loop that is calling a lp_*()
|
---|
1738 | function that returns a string. Perhaps this debug should be
|
---|
1739 | present all the time? */
|
---|
1740 |
|
---|
1741 | #if 0
|
---|
1742 | DEBUG(10, ("lp_string(%s)\n", s));
|
---|
1743 | #endif
|
---|
1744 |
|
---|
1745 | if (!lp_talloc)
|
---|
1746 | lp_talloc = talloc_init("lp_talloc");
|
---|
1747 |
|
---|
1748 | tmpstr = alloc_sub_basic(get_current_username(),
|
---|
1749 | current_user_info.domain, s);
|
---|
1750 | if (trim_char(tmpstr, '\"', '\"')) {
|
---|
1751 | if (strchr(tmpstr,'\"') != NULL) {
|
---|
1752 | SAFE_FREE(tmpstr);
|
---|
1753 | tmpstr = alloc_sub_basic(get_current_username(),
|
---|
1754 | current_user_info.domain, s);
|
---|
1755 | }
|
---|
1756 | }
|
---|
1757 | ret = talloc_strdup(lp_talloc, tmpstr);
|
---|
1758 | SAFE_FREE(tmpstr);
|
---|
1759 |
|
---|
1760 | return (ret);
|
---|
1761 | }
|
---|
1762 |
|
---|
1763 | /*
|
---|
1764 | In this section all the functions that are used to access the
|
---|
1765 | parameters from the rest of the program are defined
|
---|
1766 | */
|
---|
1767 |
|
---|
1768 | #define FN_GLOBAL_STRING(fn_name,ptr) \
|
---|
1769 | char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
|
---|
1770 | #define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
|
---|
1771 | const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
|
---|
1772 | #define FN_GLOBAL_LIST(fn_name,ptr) \
|
---|
1773 | const char **fn_name(void) {return(*(const char ***)(ptr));}
|
---|
1774 | #define FN_GLOBAL_BOOL(fn_name,ptr) \
|
---|
1775 | BOOL fn_name(void) {return(*(BOOL *)(ptr));}
|
---|
1776 | #define FN_GLOBAL_CHAR(fn_name,ptr) \
|
---|
1777 | char fn_name(void) {return(*(char *)(ptr));}
|
---|
1778 | #define FN_GLOBAL_INTEGER(fn_name,ptr) \
|
---|
1779 | int fn_name(void) {return(*(int *)(ptr));}
|
---|
1780 |
|
---|
1781 | #define FN_LOCAL_STRING(fn_name,val) \
|
---|
1782 | char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
|
---|
1783 | #define FN_LOCAL_CONST_STRING(fn_name,val) \
|
---|
1784 | const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
|
---|
1785 | #define FN_LOCAL_LIST(fn_name,val) \
|
---|
1786 | const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
|
---|
1787 | #define FN_LOCAL_BOOL(fn_name,val) \
|
---|
1788 | BOOL fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
|
---|
1789 | #define FN_LOCAL_INTEGER(fn_name,val) \
|
---|
1790 | int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
|
---|
1791 |
|
---|
1792 | #define FN_LOCAL_PARM_BOOL(fn_name,val) \
|
---|
1793 | BOOL fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
|
---|
1794 | #define FN_LOCAL_PARM_INTEGER(fn_name,val) \
|
---|
1795 | int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
|
---|
1796 | #define FN_LOCAL_PARM_STRING(fn_name,val) \
|
---|
1797 | 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));}
|
---|
1798 | #define FN_LOCAL_CHAR(fn_name,val) \
|
---|
1799 | char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
|
---|
1800 |
|
---|
1801 | FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
|
---|
1802 | FN_GLOBAL_STRING(lp_dos_charset, &Globals.dos_charset)
|
---|
1803 | FN_GLOBAL_STRING(lp_unix_charset, &Globals.unix_charset)
|
---|
1804 | FN_GLOBAL_STRING(lp_display_charset, &Globals.display_charset)
|
---|
1805 | FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
|
---|
1806 | FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
|
---|
1807 | FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
|
---|
1808 | FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
|
---|
1809 | FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
|
---|
1810 | FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
|
---|
1811 | FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
|
---|
1812 | FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
|
---|
1813 | FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
|
---|
1814 | FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
|
---|
1815 | FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
|
---|
1816 | FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
|
---|
1817 | FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
|
---|
1818 | FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
|
---|
1819 | FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
|
---|
1820 | FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
|
---|
1821 | FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
|
---|
1822 | FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
|
---|
1823 | FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
|
---|
1824 | FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
|
---|
1825 | FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
|
---|
1826 | FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
|
---|
1827 | FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
|
---|
1828 | FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
|
---|
1829 | FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
|
---|
1830 | FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
|
---|
1831 | FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
|
---|
1832 | FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
|
---|
1833 | FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
|
---|
1834 | FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
|
---|
1835 | FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
|
---|
1836 | FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
|
---|
1837 | FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
|
---|
1838 | FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
|
---|
1839 | FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
|
---|
1840 | FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
|
---|
1841 | FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
|
---|
1842 | FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
|
---|
1843 | FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
|
---|
1844 | FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
|
---|
1845 | FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
|
---|
1846 | FN_GLOBAL_STRING(lp_socket_address, &Globals.szSocketAddress)
|
---|
1847 | FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
|
---|
1848 | static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
|
---|
1849 | FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
|
---|
1850 | /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
|
---|
1851 | * lp_passdb_backend() should be replace by the this macro again after
|
---|
1852 | * some releases.
|
---|
1853 | * */
|
---|
1854 | const char *lp_passdb_backend(void)
|
---|
1855 | {
|
---|
1856 | char *delim, *quote;
|
---|
1857 |
|
---|
1858 | delim = strchr( Globals.szPassdbBackend, ' ');
|
---|
1859 | /* no space at all */
|
---|
1860 | if (delim == NULL) {
|
---|
1861 | goto out;
|
---|
1862 | }
|
---|
1863 |
|
---|
1864 | quote = strchr(Globals.szPassdbBackend, '"');
|
---|
1865 | /* no quote char or non in the first part */
|
---|
1866 | if (quote == NULL || quote > delim) {
|
---|
1867 | *delim = '\0';
|
---|
1868 | goto warn;
|
---|
1869 | }
|
---|
1870 |
|
---|
1871 | quote = strchr(quote+1, '"');
|
---|
1872 | if (quote == NULL) {
|
---|
1873 | DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
|
---|
1874 | goto out;
|
---|
1875 | } else if (*(quote+1) == '\0') {
|
---|
1876 | /* space, fitting quote char, and one backend only */
|
---|
1877 | goto out;
|
---|
1878 | } else {
|
---|
1879 | /* terminate string after the fitting quote char */
|
---|
1880 | *(quote+1) = '\0';
|
---|
1881 | }
|
---|
1882 |
|
---|
1883 | warn:
|
---|
1884 | DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends. This\n"
|
---|
1885 | "is deprecated since Samba 3.0.23. Please check WHATSNEW.txt or the section 'Passdb\n"
|
---|
1886 | "Changes' from the ChangeNotes as part of the Samba HOWTO collection. Only the first\n"
|
---|
1887 | "backend (%s) is used. The rest is ignored.\n", Globals.szPassdbBackend));
|
---|
1888 |
|
---|
1889 | out:
|
---|
1890 | return Globals.szPassdbBackend;
|
---|
1891 | }
|
---|
1892 | FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
|
---|
1893 | FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
|
---|
1894 | FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
|
---|
1895 | FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
|
---|
1896 | FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
|
---|
1897 |
|
---|
1898 | FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
|
---|
1899 | FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
|
---|
1900 | FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
|
---|
1901 | FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
|
---|
1902 | FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
|
---|
1903 | FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
|
---|
1904 |
|
---|
1905 | FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
|
---|
1906 |
|
---|
1907 | FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
|
---|
1908 | FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
|
---|
1909 | FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
|
---|
1910 |
|
---|
1911 | FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
|
---|
1912 |
|
---|
1913 | FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
|
---|
1914 | FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
|
---|
1915 | FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
|
---|
1916 | FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
|
---|
1917 | FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
|
---|
1918 | FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
|
---|
1919 | FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
|
---|
1920 | FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
|
---|
1921 | FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
|
---|
1922 | FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
|
---|
1923 | FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
|
---|
1924 | FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
|
---|
1925 | FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
|
---|
1926 |
|
---|
1927 | FN_GLOBAL_LIST(lp_idmap_domains, &Globals.szIdmapDomains)
|
---|
1928 | FN_GLOBAL_LIST(lp_idmap_backend, &Globals.szIdmapBackend) /* deprecated */
|
---|
1929 | FN_GLOBAL_STRING(lp_idmap_alloc_backend, &Globals.szIdmapAllocBackend)
|
---|
1930 | FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
|
---|
1931 | FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
|
---|
1932 | FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
|
---|
1933 |
|
---|
1934 | FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
|
---|
1935 | FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
|
---|
1936 | FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
|
---|
1937 | FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
|
---|
1938 | FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
|
---|
1939 | FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
|
---|
1940 | FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
|
---|
1941 | FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
|
---|
1942 | FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
|
---|
1943 | FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
|
---|
1944 | FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
|
---|
1945 | FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
|
---|
1946 | FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
|
---|
1947 | FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
|
---|
1948 |
|
---|
1949 | FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
|
---|
1950 |
|
---|
1951 | FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
|
---|
1952 | FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
|
---|
1953 | FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
|
---|
1954 | FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
|
---|
1955 | FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
|
---|
1956 | FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
|
---|
1957 | FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
|
---|
1958 | FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
|
---|
1959 | FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
|
---|
1960 | FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
|
---|
1961 | FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
|
---|
1962 | FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
|
---|
1963 | FN_GLOBAL_BOOL(lp_readbmpx, &Globals.bReadbmpx)
|
---|
1964 | FN_GLOBAL_BOOL(lp_readraw, &Globals.bReadRaw)
|
---|
1965 | FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
|
---|
1966 | FN_GLOBAL_BOOL(lp_writeraw, &Globals.bWriteRaw)
|
---|
1967 | FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
|
---|
1968 | FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
|
---|
1969 | FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
|
---|
1970 | FN_GLOBAL_BOOL(lp_update_encrypted, &Globals.bUpdateEncrypt)
|
---|
1971 | FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
|
---|
1972 | FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
|
---|
1973 | FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
|
---|
1974 | FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
|
---|
1975 | FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
|
---|
1976 | FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
|
---|
1977 | FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
|
---|
1978 | FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
|
---|
1979 | FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
|
---|
1980 | FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
|
---|
1981 | FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
|
---|
1982 | static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
|
---|
1983 | FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
|
---|
1984 | FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
|
---|
1985 | FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
|
---|
1986 | FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
|
---|
1987 | FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
|
---|
1988 | FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
|
---|
1989 | FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
|
---|
1990 | FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
|
---|
1991 | FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
|
---|
1992 | FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
|
---|
1993 | FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
|
---|
1994 | FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
|
---|
1995 | FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
|
---|
1996 | FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
|
---|
1997 | FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
|
---|
1998 | FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
|
---|
1999 | FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
|
---|
2000 | FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
|
---|
2001 | FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
|
---|
2002 | FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
|
---|
2003 | FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
|
---|
2004 | FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
|
---|
2005 | FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
|
---|
2006 | FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
|
---|
2007 | FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
|
---|
2008 | FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
|
---|
2009 | FN_GLOBAL_BOOL(lp_use_kerberos_keytab, &Globals.bUseKerberosKeytab)
|
---|
2010 | FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
|
---|
2011 | FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
|
---|
2012 | FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
|
---|
2013 | FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
|
---|
2014 | FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
|
---|
2015 | FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
|
---|
2016 | FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
|
---|
2017 | FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
|
---|
2018 | FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
|
---|
2019 | FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
|
---|
2020 | FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
|
---|
2021 | FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
|
---|
2022 | FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
|
---|
2023 | FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
|
---|
2024 | FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
|
---|
2025 | FN_GLOBAL_INTEGER(lp_maxprotocol, &Globals.maxprotocol)
|
---|
2026 | FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
|
---|
2027 | FN_GLOBAL_INTEGER(lp_security, &Globals.security)
|
---|
2028 | FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
|
---|
2029 | FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
|
---|
2030 | FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
|
---|
2031 | FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
|
---|
2032 | FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
|
---|
2033 | FN_GLOBAL_INTEGER(_lp_disable_spoolss, &Globals.bDisableSpoolss)
|
---|
2034 | FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
|
---|
2035 | static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
|
---|
2036 | FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
|
---|
2037 | FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
|
---|
2038 | FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
|
---|
2039 | FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
|
---|
2040 | FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
|
---|
2041 | FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
|
---|
2042 | FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
|
---|
2043 |
|
---|
2044 | FN_LOCAL_STRING(lp_preexec, szPreExec)
|
---|
2045 | FN_LOCAL_STRING(lp_postexec, szPostExec)
|
---|
2046 | FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
|
---|
2047 | FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
|
---|
2048 | FN_LOCAL_STRING(lp_servicename, szService)
|
---|
2049 | FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
|
---|
2050 | FN_LOCAL_STRING(lp_pathname, szPath)
|
---|
2051 | FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
|
---|
2052 | FN_LOCAL_STRING(lp_username, szUsername)
|
---|
2053 | FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
|
---|
2054 | FN_LOCAL_LIST(lp_valid_users, szValidUsers)
|
---|
2055 | FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
|
---|
2056 | FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
|
---|
2057 | FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
|
---|
2058 | FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
|
---|
2059 | FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
|
---|
2060 | FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
|
---|
2061 | FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
|
---|
2062 | FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
|
---|
2063 | FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
|
---|
2064 | FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
|
---|
2065 | FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
|
---|
2066 | FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
|
---|
2067 | static FN_LOCAL_STRING(_lp_printername, szPrintername)
|
---|
2068 | FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
|
---|
2069 | FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
|
---|
2070 | FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
|
---|
2071 | FN_LOCAL_STRING(lp_magicscript, szMagicScript)
|
---|
2072 | FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
|
---|
2073 | FN_LOCAL_STRING(lp_comment, comment)
|
---|
2074 | FN_LOCAL_STRING(lp_force_user, force_user)
|
---|
2075 | FN_LOCAL_STRING(lp_force_group, force_group)
|
---|
2076 | FN_LOCAL_LIST(lp_readlist, readlist)
|
---|
2077 | FN_LOCAL_LIST(lp_writelist, writelist)
|
---|
2078 | FN_LOCAL_LIST(lp_printer_admin, printer_admin)
|
---|
2079 | FN_LOCAL_STRING(lp_fstype, fstype)
|
---|
2080 | FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
|
---|
2081 | FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
|
---|
2082 | static FN_LOCAL_STRING(lp_volume, volume)
|
---|
2083 | FN_LOCAL_PARM_STRING(lp_mangled_map, szMangledMap)
|
---|
2084 | FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
|
---|
2085 | FN_LOCAL_STRING(lp_hide_files, szHideFiles)
|
---|
2086 | FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
|
---|
2087 | FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
|
---|
2088 | FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
|
---|
2089 | FN_LOCAL_STRING(lp_dfree_command, szDfree)
|
---|
2090 | FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
|
---|
2091 | FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
|
---|
2092 | FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
|
---|
2093 | FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
|
---|
2094 | FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
|
---|
2095 | FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
|
---|
2096 | FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
|
---|
2097 | FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
|
---|
2098 | FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
|
---|
2099 | FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
|
---|
2100 | FN_LOCAL_BOOL(lp_browseable, bBrowseable)
|
---|
2101 | FN_LOCAL_BOOL(lp_readonly, bRead_only)
|
---|
2102 | FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
|
---|
2103 | FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
|
---|
2104 | FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
|
---|
2105 | FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
|
---|
2106 | FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
|
---|
2107 | FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
|
---|
2108 | FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
|
---|
2109 | FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
|
---|
2110 | FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
|
---|
2111 | FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
|
---|
2112 | FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
|
---|
2113 | FN_LOCAL_BOOL(lp_share_modes, bShareModes)
|
---|
2114 | FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
|
---|
2115 | FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
|
---|
2116 | FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
|
---|
2117 | FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
|
---|
2118 | FN_LOCAL_BOOL(lp_widelinks, bWidelinks)
|
---|
2119 | FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
|
---|
2120 | FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
|
---|
2121 | FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
|
---|
2122 | FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
|
---|
2123 | FN_LOCAL_BOOL(lp_map_system, bMap_system)
|
---|
2124 | FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
|
---|
2125 | FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
|
---|
2126 | FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
|
---|
2127 | FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
|
---|
2128 | FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
|
---|
2129 | FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
|
---|
2130 | FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
|
---|
2131 | FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
|
---|
2132 | FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
|
---|
2133 | FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
|
---|
2134 | FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
|
---|
2135 | FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
|
---|
2136 | FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
|
---|
2137 | FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
|
---|
2138 | FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
|
---|
2139 | FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
|
---|
2140 | FN_LOCAL_BOOL(lp_ea_support, bEASupport)
|
---|
2141 | FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
|
---|
2142 | FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
|
---|
2143 | FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
|
---|
2144 | FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
|
---|
2145 | FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
|
---|
2146 | FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
|
---|
2147 | FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
|
---|
2148 | FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
|
---|
2149 | FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
|
---|
2150 | FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
|
---|
2151 | FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
|
---|
2152 | FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
|
---|
2153 | FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
|
---|
2154 | FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
|
---|
2155 | FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
|
---|
2156 | FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
|
---|
2157 | FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
|
---|
2158 | FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
|
---|
2159 | FN_LOCAL_INTEGER(lp_printing, iPrinting)
|
---|
2160 | FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
|
---|
2161 | FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
|
---|
2162 | FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
|
---|
2163 | FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
|
---|
2164 | FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
|
---|
2165 | FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
|
---|
2166 | FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
|
---|
2167 | FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
|
---|
2168 | FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
|
---|
2169 | FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
|
---|
2170 | FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
|
---|
2171 | FN_LOCAL_CHAR(lp_magicchar, magic_char)
|
---|
2172 | FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
|
---|
2173 | FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
|
---|
2174 | FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
|
---|
2175 | FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
|
---|
2176 | FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
|
---|
2177 | FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
|
---|
2178 |
|
---|
2179 | /* local prototypes */
|
---|
2180 |
|
---|
2181 | static int map_parameter(const char *pszParmName);
|
---|
2182 | static BOOL set_boolean(BOOL *pb, const char *pszParmValue);
|
---|
2183 | static int getservicebyname(const char *pszServiceName,
|
---|
2184 | service * pserviceDest);
|
---|
2185 | static void copy_service(service * pserviceDest,
|
---|
2186 | service * pserviceSource, BOOL *pcopymapDest);
|
---|
2187 | static BOOL service_ok(int iService);
|
---|
2188 | static BOOL do_parameter(const char *pszParmName, const char *pszParmValue);
|
---|
2189 | static BOOL do_section(const char *pszSectionName);
|
---|
2190 | static void init_copymap(service * pservice);
|
---|
2191 | static BOOL hash_a_service(const char *name, int number);
|
---|
2192 | static void free_service_byindex(int iService);
|
---|
2193 | static char * canonicalize_servicename(const char *name);
|
---|
2194 |
|
---|
2195 | /* This is a helper function for parametrical options support. */
|
---|
2196 | /* It returns a pointer to parametrical option value if it exists or NULL otherwise */
|
---|
2197 | /* Actual parametrical functions are quite simple */
|
---|
2198 | static param_opt_struct *get_parametrics(int snum, const char *type, const char *option)
|
---|
2199 | {
|
---|
2200 | BOOL global_section = False;
|
---|
2201 | char* param_key;
|
---|
2202 | param_opt_struct *data;
|
---|
2203 |
|
---|
2204 | if (snum >= iNumServices) return NULL;
|
---|
2205 |
|
---|
2206 | if (snum < 0) {
|
---|
2207 | data = Globals.param_opt;
|
---|
2208 | global_section = True;
|
---|
2209 | } else {
|
---|
2210 | data = ServicePtrs[snum]->param_opt;
|
---|
2211 | }
|
---|
2212 |
|
---|
2213 | asprintf(¶m_key, "%s:%s", type, option);
|
---|
2214 | if (!param_key) {
|
---|
2215 | DEBUG(0,("asprintf failed!\n"));
|
---|
2216 | return NULL;
|
---|
2217 | }
|
---|
2218 |
|
---|
2219 | while (data) {
|
---|
2220 | if (strcmp(data->key, param_key) == 0) {
|
---|
2221 | string_free(¶m_key);
|
---|
2222 | return data;
|
---|
2223 | }
|
---|
2224 | data = data->next;
|
---|
2225 | }
|
---|
2226 |
|
---|
2227 | if (!global_section) {
|
---|
2228 | /* Try to fetch the same option but from globals */
|
---|
2229 | /* but only if we are not already working with Globals */
|
---|
2230 | data = Globals.param_opt;
|
---|
2231 | while (data) {
|
---|
2232 | if (strcmp(data->key, param_key) == 0) {
|
---|
2233 | string_free(¶m_key);
|
---|
2234 | return data;
|
---|
2235 | }
|
---|
2236 | data = data->next;
|
---|
2237 | }
|
---|
2238 | }
|
---|
2239 |
|
---|
2240 | string_free(¶m_key);
|
---|
2241 |
|
---|
2242 | return NULL;
|
---|
2243 | }
|
---|
2244 |
|
---|
2245 |
|
---|
2246 | #define MISSING_PARAMETER(name) \
|
---|
2247 | DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
|
---|
2248 |
|
---|
2249 | /*******************************************************************
|
---|
2250 | convenience routine to return int parameters.
|
---|
2251 | ********************************************************************/
|
---|
2252 | static int lp_int(const char *s)
|
---|
2253 | {
|
---|
2254 |
|
---|
2255 | if (!s || !*s) {
|
---|
2256 | MISSING_PARAMETER(lp_int);
|
---|
2257 | return (-1);
|
---|
2258 | }
|
---|
2259 |
|
---|
2260 | return (int)strtol(s, NULL, 0);
|
---|
2261 | }
|
---|
2262 |
|
---|
2263 | /*******************************************************************
|
---|
2264 | convenience routine to return unsigned long parameters.
|
---|
2265 | ********************************************************************/
|
---|
2266 | static unsigned long lp_ulong(const char *s)
|
---|
2267 | {
|
---|
2268 |
|
---|
2269 | if (!s || !*s) {
|
---|
2270 | MISSING_PARAMETER(lp_ulong);
|
---|
2271 | return (0);
|
---|
2272 | }
|
---|
2273 |
|
---|
2274 | return strtoul(s, NULL, 0);
|
---|
2275 | }
|
---|
2276 |
|
---|
2277 | /*******************************************************************
|
---|
2278 | convenience routine to return boolean parameters.
|
---|
2279 | ********************************************************************/
|
---|
2280 | static BOOL lp_bool(const char *s)
|
---|
2281 | {
|
---|
2282 | BOOL ret = False;
|
---|
2283 |
|
---|
2284 | if (!s || !*s) {
|
---|
2285 | MISSING_PARAMETER(lp_bool);
|
---|
2286 | return False;
|
---|
2287 | }
|
---|
2288 |
|
---|
2289 | if (!set_boolean(&ret,s)) {
|
---|
2290 | DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
|
---|
2291 | return False;
|
---|
2292 | }
|
---|
2293 |
|
---|
2294 | return ret;
|
---|
2295 | }
|
---|
2296 |
|
---|
2297 | /*******************************************************************
|
---|
2298 | convenience routine to return enum parameters.
|
---|
2299 | ********************************************************************/
|
---|
2300 | static int lp_enum(const char *s,const struct enum_list *_enum)
|
---|
2301 | {
|
---|
2302 | int i;
|
---|
2303 |
|
---|
2304 | if (!s || !*s || !_enum) {
|
---|
2305 | MISSING_PARAMETER(lp_enum);
|
---|
2306 | return (-1);
|
---|
2307 | }
|
---|
2308 |
|
---|
2309 | for (i=0; _enum[i].name; i++) {
|
---|
2310 | if (strequal(_enum[i].name,s))
|
---|
2311 | return _enum[i].value;
|
---|
2312 | }
|
---|
2313 |
|
---|
2314 | DEBUG(0,("lp_enum(%s,enum): value is not in enum_list!\n",s));
|
---|
2315 | return (-1);
|
---|
2316 | }
|
---|
2317 |
|
---|
2318 | #undef MISSING_PARAMETER
|
---|
2319 |
|
---|
2320 | /* DO NOT USE lp_parm_string ANYMORE!!!!
|
---|
2321 | * use lp_parm_const_string or lp_parm_talloc_string
|
---|
2322 | *
|
---|
2323 | * lp_parm_string is only used to let old modules find this symbol
|
---|
2324 | */
|
---|
2325 | #undef lp_parm_string
|
---|
2326 | char *lp_parm_string(const char *servicename, const char *type, const char *option);
|
---|
2327 | char *lp_parm_string(const char *servicename, const char *type, const char *option)
|
---|
2328 | {
|
---|
2329 | return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
|
---|
2330 | }
|
---|
2331 |
|
---|
2332 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2333 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2334 | /* the returned value is talloced in lp_talloc */
|
---|
2335 | char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
|
---|
2336 | {
|
---|
2337 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2338 |
|
---|
2339 | if (data == NULL||data->value==NULL) {
|
---|
2340 | if (def) {
|
---|
2341 | return lp_string(def);
|
---|
2342 | } else {
|
---|
2343 | return NULL;
|
---|
2344 | }
|
---|
2345 | }
|
---|
2346 |
|
---|
2347 | return lp_string(data->value);
|
---|
2348 | }
|
---|
2349 |
|
---|
2350 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2351 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2352 | const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
|
---|
2353 | {
|
---|
2354 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2355 |
|
---|
2356 | if (data == NULL||data->value==NULL)
|
---|
2357 | return def;
|
---|
2358 |
|
---|
2359 | return data->value;
|
---|
2360 | }
|
---|
2361 |
|
---|
2362 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2363 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2364 |
|
---|
2365 | const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
|
---|
2366 | {
|
---|
2367 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2368 |
|
---|
2369 | if (data == NULL||data->value==NULL)
|
---|
2370 | return (const char **)def;
|
---|
2371 |
|
---|
2372 | if (data->list==NULL) {
|
---|
2373 | data->list = str_list_make(data->value, NULL);
|
---|
2374 | }
|
---|
2375 |
|
---|
2376 | return (const char **)data->list;
|
---|
2377 | }
|
---|
2378 |
|
---|
2379 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2380 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2381 |
|
---|
2382 | int lp_parm_int(int snum, const char *type, const char *option, int def)
|
---|
2383 | {
|
---|
2384 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2385 |
|
---|
2386 | if (data && data->value && *data->value)
|
---|
2387 | return lp_int(data->value);
|
---|
2388 |
|
---|
2389 | return def;
|
---|
2390 | }
|
---|
2391 |
|
---|
2392 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2393 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2394 |
|
---|
2395 | unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
|
---|
2396 | {
|
---|
2397 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2398 |
|
---|
2399 | if (data && data->value && *data->value)
|
---|
2400 | return lp_ulong(data->value);
|
---|
2401 |
|
---|
2402 | return def;
|
---|
2403 | }
|
---|
2404 |
|
---|
2405 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2406 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2407 |
|
---|
2408 | BOOL lp_parm_bool(int snum, const char *type, const char *option, BOOL def)
|
---|
2409 | {
|
---|
2410 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2411 |
|
---|
2412 | if (data && data->value && *data->value)
|
---|
2413 | return lp_bool(data->value);
|
---|
2414 |
|
---|
2415 | return def;
|
---|
2416 | }
|
---|
2417 |
|
---|
2418 | /* Return parametric option from a given service. Type is a part of option before ':' */
|
---|
2419 | /* Parametric option has following syntax: 'Type: option = value' */
|
---|
2420 |
|
---|
2421 | int lp_parm_enum(int snum, const char *type, const char *option,
|
---|
2422 | const struct enum_list *_enum, int def)
|
---|
2423 | {
|
---|
2424 | param_opt_struct *data = get_parametrics(snum, type, option);
|
---|
2425 |
|
---|
2426 | if (data && data->value && *data->value && _enum)
|
---|
2427 | return lp_enum(data->value, _enum);
|
---|
2428 |
|
---|
2429 | return def;
|
---|
2430 | }
|
---|
2431 |
|
---|
2432 |
|
---|
2433 | /***************************************************************************
|
---|
2434 | Initialise a service to the defaults.
|
---|
2435 | ***************************************************************************/
|
---|
2436 |
|
---|
2437 | static void init_service(service * pservice)
|
---|
2438 | {
|
---|
2439 | memset((char *)pservice, '\0', sizeof(service));
|
---|
2440 | copy_service(pservice, &sDefault, NULL);
|
---|
2441 | }
|
---|
2442 |
|
---|
2443 | /***************************************************************************
|
---|
2444 | Free the dynamically allocated parts of a service struct.
|
---|
2445 | ***************************************************************************/
|
---|
2446 |
|
---|
2447 | static void free_service(service *pservice)
|
---|
2448 | {
|
---|
2449 | int i;
|
---|
2450 | param_opt_struct *data, *pdata;
|
---|
2451 | if (!pservice)
|
---|
2452 | return;
|
---|
2453 |
|
---|
2454 | if (pservice->szService)
|
---|
2455 | DEBUG(5, ("free_service: Freeing service %s\n",
|
---|
2456 | pservice->szService));
|
---|
2457 |
|
---|
2458 | string_free(&pservice->szService);
|
---|
2459 | SAFE_FREE(pservice->copymap);
|
---|
2460 |
|
---|
2461 | for (i = 0; parm_table[i].label; i++) {
|
---|
2462 | if ((parm_table[i].type == P_STRING ||
|
---|
2463 | parm_table[i].type == P_USTRING) &&
|
---|
2464 | parm_table[i].p_class == P_LOCAL)
|
---|
2465 | string_free((char **)
|
---|
2466 | (((char *)pservice) +
|
---|
2467 | PTR_DIFF(parm_table[i].ptr, &sDefault)));
|
---|
2468 | else if (parm_table[i].type == P_LIST &&
|
---|
2469 | parm_table[i].p_class == P_LOCAL)
|
---|
2470 | str_list_free((char ***)
|
---|
2471 | (((char *)pservice) +
|
---|
2472 | PTR_DIFF(parm_table[i].ptr, &sDefault)));
|
---|
2473 | }
|
---|
2474 |
|
---|
2475 | data = pservice->param_opt;
|
---|
2476 | if (data)
|
---|
2477 | DEBUG(5,("Freeing parametrics:\n"));
|
---|
2478 | while (data) {
|
---|
2479 | DEBUG(5,("[%s = %s]\n", data->key, data->value));
|
---|
2480 | string_free(&data->key);
|
---|
2481 | string_free(&data->value);
|
---|
2482 | str_list_free(&data->list);
|
---|
2483 | pdata = data->next;
|
---|
2484 | SAFE_FREE(data);
|
---|
2485 | data = pdata;
|
---|
2486 | }
|
---|
2487 |
|
---|
2488 | ZERO_STRUCTP(pservice);
|
---|
2489 | }
|
---|
2490 |
|
---|
2491 |
|
---|
2492 | /***************************************************************************
|
---|
2493 | remove a service indexed in the ServicePtrs array from the ServiceHash
|
---|
2494 | and free the dynamically allocated parts
|
---|
2495 | ***************************************************************************/
|
---|
2496 |
|
---|
2497 | static void free_service_byindex(int idx)
|
---|
2498 | {
|
---|
2499 | if ( !LP_SNUM_OK(idx) )
|
---|
2500 | return;
|
---|
2501 |
|
---|
2502 | ServicePtrs[idx]->valid = False;
|
---|
2503 | invalid_services[num_invalid_services++] = idx;
|
---|
2504 |
|
---|
2505 | /* we have to cleanup the hash record */
|
---|
2506 |
|
---|
2507 | if (ServicePtrs[idx]->szService) {
|
---|
2508 | char *canon_name = canonicalize_servicename( ServicePtrs[idx]->szService );
|
---|
2509 |
|
---|
2510 | tdb_delete_bystring(ServiceHash, canon_name );
|
---|
2511 | }
|
---|
2512 |
|
---|
2513 | free_service(ServicePtrs[idx]);
|
---|
2514 | }
|
---|
2515 |
|
---|
2516 | /***************************************************************************
|
---|
2517 | Add a new service to the services array initialising it with the given
|
---|
2518 | service.
|
---|
2519 | ***************************************************************************/
|
---|
2520 |
|
---|
2521 | static int add_a_service(const service *pservice, const char *name)
|
---|
2522 | {
|
---|
2523 | int i;
|
---|
2524 | service tservice;
|
---|
2525 | int num_to_alloc = iNumServices + 1;
|
---|
2526 | param_opt_struct *data, *pdata;
|
---|
2527 |
|
---|
2528 | tservice = *pservice;
|
---|
2529 |
|
---|
2530 | /* it might already exist */
|
---|
2531 | if (name) {
|
---|
2532 | i = getservicebyname(name, NULL);
|
---|
2533 | if (i >= 0) {
|
---|
2534 | /* Clean all parametric options for service */
|
---|
2535 | /* They will be added during parsing again */
|
---|
2536 | data = ServicePtrs[i]->param_opt;
|
---|
2537 | while (data) {
|
---|
2538 | string_free(&data->key);
|
---|
2539 | string_free(&data->value);
|
---|
2540 | str_list_free(&data->list);
|
---|
2541 | pdata = data->next;
|
---|
2542 | SAFE_FREE(data);
|
---|
2543 | data = pdata;
|
---|
2544 | }
|
---|
2545 | ServicePtrs[i]->param_opt = NULL;
|
---|
2546 | return (i);
|
---|
2547 | }
|
---|
2548 | }
|
---|
2549 |
|
---|
2550 | /* find an invalid one */
|
---|
2551 | i = iNumServices;
|
---|
2552 | if (num_invalid_services > 0) {
|
---|
2553 | i = invalid_services[--num_invalid_services];
|
---|
2554 | }
|
---|
2555 |
|
---|
2556 | /* if not, then create one */
|
---|
2557 | if (i == iNumServices) {
|
---|
2558 | service **tsp;
|
---|
2559 | int *tinvalid;
|
---|
2560 |
|
---|
2561 | tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, service *, num_to_alloc);
|
---|
2562 | if (tsp == NULL) {
|
---|
2563 | DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
|
---|
2564 | return (-1);
|
---|
2565 | }
|
---|
2566 | ServicePtrs = tsp;
|
---|
2567 | ServicePtrs[iNumServices] = SMB_MALLOC_P(service);
|
---|
2568 | if (!ServicePtrs[iNumServices]) {
|
---|
2569 | DEBUG(0,("add_a_service: out of memory!\n"));
|
---|
2570 | return (-1);
|
---|
2571 | }
|
---|
2572 | iNumServices++;
|
---|
2573 |
|
---|
2574 | /* enlarge invalid_services here for now... */
|
---|
2575 | tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
|
---|
2576 | num_to_alloc);
|
---|
2577 | if (tinvalid == NULL) {
|
---|
2578 | DEBUG(0,("add_a_service: failed to enlarge "
|
---|
2579 | "invalid_services!\n"));
|
---|
2580 | return (-1);
|
---|
2581 | }
|
---|
2582 | invalid_services = tinvalid;
|
---|
2583 | } else {
|
---|
2584 | free_service_byindex(i);
|
---|
2585 | }
|
---|
2586 |
|
---|
2587 | ServicePtrs[i]->valid = True;
|
---|
2588 |
|
---|
2589 | init_service(ServicePtrs[i]);
|
---|
2590 | copy_service(ServicePtrs[i], &tservice, NULL);
|
---|
2591 | if (name)
|
---|
2592 | string_set(&ServicePtrs[i]->szService, name);
|
---|
2593 |
|
---|
2594 | DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
|
---|
2595 | i, ServicePtrs[i]->szService));
|
---|
2596 |
|
---|
2597 | if (!hash_a_service(ServicePtrs[i]->szService, i)) {
|
---|
2598 | return (-1);
|
---|
2599 | }
|
---|
2600 |
|
---|
2601 | return (i);
|
---|
2602 | }
|
---|
2603 |
|
---|
2604 | /***************************************************************************
|
---|
2605 | Convert a string to uppercase and remove whitespaces.
|
---|
2606 | ***************************************************************************/
|
---|
2607 |
|
---|
2608 | static char *canonicalize_servicename(const char *src)
|
---|
2609 | {
|
---|
2610 | static fstring canon; /* is fstring large enough? */
|
---|
2611 |
|
---|
2612 | if ( !src ) {
|
---|
2613 | DEBUG(0,("canonicalize_servicename: NULL source name!\n"));
|
---|
2614 | return NULL;
|
---|
2615 | }
|
---|
2616 |
|
---|
2617 | fstrcpy( canon, src );
|
---|
2618 | strlower_m( canon );
|
---|
2619 |
|
---|
2620 | return canon;
|
---|
2621 | }
|
---|
2622 |
|
---|
2623 | /***************************************************************************
|
---|
2624 | Add a name/index pair for the services array to the hash table.
|
---|
2625 | ***************************************************************************/
|
---|
2626 |
|
---|
2627 | static BOOL hash_a_service(const char *name, int idx)
|
---|
2628 | {
|
---|
2629 | char *canon_name;
|
---|
2630 |
|
---|
2631 | if ( !ServiceHash ) {
|
---|
2632 | DEBUG(10,("hash_a_service: creating tdb servicehash\n"));
|
---|
2633 | ServiceHash = tdb_open("servicehash", 1031, TDB_INTERNAL,
|
---|
2634 | (O_RDWR|O_CREAT), 0600);
|
---|
2635 | if ( !ServiceHash ) {
|
---|
2636 | DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
|
---|
2637 | return False;
|
---|
2638 | }
|
---|
2639 | }
|
---|
2640 |
|
---|
2641 | DEBUG(10,("hash_a_service: hashing index %d for service name %s\n",
|
---|
2642 | idx, name));
|
---|
2643 |
|
---|
2644 | if ( !(canon_name = canonicalize_servicename( name )) )
|
---|
2645 | return False;
|
---|
2646 |
|
---|
2647 | tdb_store_int32(ServiceHash, canon_name, idx);
|
---|
2648 |
|
---|
2649 | return True;
|
---|
2650 | }
|
---|
2651 |
|
---|
2652 | /***************************************************************************
|
---|
2653 | Add a new home service, with the specified home directory, defaults coming
|
---|
2654 | from service ifrom.
|
---|
2655 | ***************************************************************************/
|
---|
2656 |
|
---|
2657 | BOOL lp_add_home(const char *pszHomename, int iDefaultService,
|
---|
2658 | const char *user, const char *pszHomedir)
|
---|
2659 | {
|
---|
2660 | int i;
|
---|
2661 | pstring newHomedir;
|
---|
2662 |
|
---|
2663 | i = add_a_service(ServicePtrs[iDefaultService], pszHomename);
|
---|
2664 |
|
---|
2665 | if (i < 0)
|
---|
2666 | return (False);
|
---|
2667 |
|
---|
2668 | if (!(*(ServicePtrs[iDefaultService]->szPath))
|
---|
2669 | || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
|
---|
2670 | pstrcpy(newHomedir, pszHomedir);
|
---|
2671 | string_set(&ServicePtrs[i]->szPath, newHomedir);
|
---|
2672 | }
|
---|
2673 |
|
---|
2674 | if (!(*(ServicePtrs[i]->comment))) {
|
---|
2675 | pstring comment;
|
---|
2676 | slprintf(comment, sizeof(comment) - 1,
|
---|
2677 | "Home directory of %s", user);
|
---|
2678 | string_set(&ServicePtrs[i]->comment, comment);
|
---|
2679 | }
|
---|
2680 |
|
---|
2681 | /* set the browseable flag from the global default */
|
---|
2682 |
|
---|
2683 | ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
|
---|
2684 |
|
---|
2685 | ServicePtrs[i]->autoloaded = True;
|
---|
2686 |
|
---|
2687 | DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
|
---|
2688 | user, ServicePtrs[i]->szPath ));
|
---|
2689 |
|
---|
2690 | return (True);
|
---|
2691 | }
|
---|
2692 |
|
---|
2693 | /***************************************************************************
|
---|
2694 | Add a new service, based on an old one.
|
---|
2695 | ***************************************************************************/
|
---|
2696 |
|
---|
2697 | int lp_add_service(const char *pszService, int iDefaultService)
|
---|
2698 | {
|
---|
2699 | return (add_a_service(ServicePtrs[iDefaultService], pszService));
|
---|
2700 | }
|
---|
2701 |
|
---|
2702 | /***************************************************************************
|
---|
2703 | Add the IPC service.
|
---|
2704 | ***************************************************************************/
|
---|
2705 |
|
---|
2706 | static BOOL lp_add_ipc(const char *ipc_name, BOOL guest_ok)
|
---|
2707 | {
|
---|
2708 | pstring comment;
|
---|
2709 | int i = add_a_service(&sDefault, ipc_name);
|
---|
2710 |
|
---|
2711 | if (i < 0)
|
---|
2712 | return (False);
|
---|
2713 |
|
---|
2714 | slprintf(comment, sizeof(comment) - 1,
|
---|
2715 | "IPC Service (%s)", Globals.szServerString);
|
---|
2716 |
|
---|
2717 | string_set(&ServicePtrs[i]->szPath, tmpdir());
|
---|
2718 | string_set(&ServicePtrs[i]->szUsername, "");
|
---|
2719 | string_set(&ServicePtrs[i]->comment, comment);
|
---|
2720 | string_set(&ServicePtrs[i]->fstype, "IPC");
|
---|
2721 | ServicePtrs[i]->iMaxConnections = 0;
|
---|
2722 | ServicePtrs[i]->bAvailable = True;
|
---|
2723 | ServicePtrs[i]->bRead_only = True;
|
---|
2724 | ServicePtrs[i]->bGuest_only = False;
|
---|
2725 | ServicePtrs[i]->bGuest_ok = guest_ok;
|
---|
2726 | ServicePtrs[i]->bPrint_ok = False;
|
---|
2727 | ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
|
---|
2728 |
|
---|
2729 | DEBUG(3, ("adding IPC service\n"));
|
---|
2730 |
|
---|
2731 | return (True);
|
---|
2732 | }
|
---|
2733 |
|
---|
2734 | /***************************************************************************
|
---|
2735 | Add a new printer service, with defaults coming from service iFrom.
|
---|
2736 | ***************************************************************************/
|
---|
2737 |
|
---|
2738 | BOOL lp_add_printer(const char *pszPrintername, int iDefaultService)
|
---|
2739 | {
|
---|
2740 | const char *comment = "From Printcap";
|
---|
2741 | int i = add_a_service(ServicePtrs[iDefaultService], pszPrintername);
|
---|
2742 |
|
---|
2743 | if (i < 0)
|
---|
2744 | return (False);
|
---|
2745 |
|
---|
2746 | /* note that we do NOT default the availability flag to True - */
|
---|
2747 | /* we take it from the default service passed. This allows all */
|
---|
2748 | /* dynamic printers to be disabled by disabling the [printers] */
|
---|
2749 | /* entry (if/when the 'available' keyword is implemented!). */
|
---|
2750 |
|
---|
2751 | /* the printer name is set to the service name. */
|
---|
2752 | string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
|
---|
2753 | string_set(&ServicePtrs[i]->comment, comment);
|
---|
2754 |
|
---|
2755 | /* set the browseable flag from the gloabl default */
|
---|
2756 | ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
|
---|
2757 |
|
---|
2758 | /* Printers cannot be read_only. */
|
---|
2759 | ServicePtrs[i]->bRead_only = False;
|
---|
2760 | /* No share modes on printer services. */
|
---|
2761 | ServicePtrs[i]->bShareModes = False;
|
---|
2762 | /* No oplocks on printer services. */
|
---|
2763 | ServicePtrs[i]->bOpLocks = False;
|
---|
2764 | /* Printer services must be printable. */
|
---|
2765 | ServicePtrs[i]->bPrint_ok = True;
|
---|
2766 |
|
---|
2767 | DEBUG(3, ("adding printer service %s\n", pszPrintername));
|
---|
2768 |
|
---|
2769 | return (True);
|
---|
2770 | }
|
---|
2771 |
|
---|
2772 | /***************************************************************************
|
---|
2773 | Map a parameter's string representation to something we can use.
|
---|
2774 | Returns False if the parameter string is not recognised, else TRUE.
|
---|
2775 | ***************************************************************************/
|
---|
2776 |
|
---|
2777 | static int map_parameter(const char *pszParmName)
|
---|
2778 | {
|
---|
2779 | int iIndex;
|
---|
2780 |
|
---|
2781 | if (*pszParmName == '-')
|
---|
2782 | return (-1);
|
---|
2783 |
|
---|
2784 | for (iIndex = 0; parm_table[iIndex].label; iIndex++)
|
---|
2785 | if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
|
---|
2786 | return (iIndex);
|
---|
2787 |
|
---|
2788 | /* Warn only if it isn't parametric option */
|
---|
2789 | if (strchr(pszParmName, ':') == NULL)
|
---|
2790 | DEBUG(0, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
|
---|
2791 | /* We do return 'fail' for parametric options as well because they are
|
---|
2792 | stored in different storage
|
---|
2793 | */
|
---|
2794 | return (-1);
|
---|
2795 | }
|
---|
2796 |
|
---|
2797 | /***************************************************************************
|
---|
2798 | Show all parameter's name, type, [values,] and flags.
|
---|
2799 | ***************************************************************************/
|
---|
2800 |
|
---|
2801 | void show_parameter_list(void)
|
---|
2802 | {
|
---|
2803 | int classIndex, parmIndex, enumIndex, flagIndex;
|
---|
2804 | BOOL hadFlag;
|
---|
2805 | const char *section_names[] = { "local", "global", NULL};
|
---|
2806 | const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
|
---|
2807 | "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING", "P_GSTRING",
|
---|
2808 | "P_UGSTRING", "P_ENUM", "P_SEP"};
|
---|
2809 | unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
|
---|
2810 | FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
|
---|
2811 | FLAG_HIDE, FLAG_DOS_STRING};
|
---|
2812 | const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
|
---|
2813 | "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
|
---|
2814 | "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
|
---|
2815 |
|
---|
2816 | for ( classIndex=0; section_names[classIndex]; classIndex++) {
|
---|
2817 | printf("[%s]\n", section_names[classIndex]);
|
---|
2818 | for (parmIndex = 0; parm_table[parmIndex].label; parmIndex++) {
|
---|
2819 | if (parm_table[parmIndex].p_class == classIndex) {
|
---|
2820 | printf("%s=%s",
|
---|
2821 | parm_table[parmIndex].label,
|
---|
2822 | type[parm_table[parmIndex].type]);
|
---|
2823 | switch (parm_table[parmIndex].type) {
|
---|
2824 | case P_ENUM:
|
---|
2825 | printf(",");
|
---|
2826 | for (enumIndex=0; parm_table[parmIndex].enum_list[enumIndex].name; enumIndex++)
|
---|
2827 | printf("%s%s",
|
---|
2828 | enumIndex ? "|" : "",
|
---|
2829 | parm_table[parmIndex].enum_list[enumIndex].name);
|
---|
2830 | break;
|
---|
2831 | default:
|
---|
2832 | break;
|
---|
2833 | }
|
---|
2834 | printf(",");
|
---|
2835 | hadFlag = False;
|
---|
2836 | for ( flagIndex=0; flag_names[flagIndex]; flagIndex++ ) {
|
---|
2837 | if (parm_table[parmIndex].flags & flags[flagIndex]) {
|
---|
2838 | printf("%s%s",
|
---|
2839 | hadFlag ? "|" : "",
|
---|
2840 | flag_names[flagIndex]);
|
---|
2841 | hadFlag = True;
|
---|
2842 | }
|
---|
2843 | }
|
---|
2844 | printf("\n");
|
---|
2845 | }
|
---|
2846 | }
|
---|
2847 | }
|
---|
2848 | }
|
---|
2849 |
|
---|
2850 | /***************************************************************************
|
---|
2851 | Set a boolean variable from the text value stored in the passed string.
|
---|
2852 | Returns True in success, False if the passed string does not correctly
|
---|
2853 | represent a boolean.
|
---|
2854 | ***************************************************************************/
|
---|
2855 |
|
---|
2856 | static BOOL set_boolean(BOOL *pb, const char *pszParmValue)
|
---|
2857 | {
|
---|
2858 | BOOL bRetval;
|
---|
2859 |
|
---|
2860 | bRetval = True;
|
---|
2861 | if (strwicmp(pszParmValue, "yes") == 0 ||
|
---|
2862 | strwicmp(pszParmValue, "true") == 0 ||
|
---|
2863 | strwicmp(pszParmValue, "1") == 0)
|
---|
2864 | *pb = True;
|
---|
2865 | else if (strwicmp(pszParmValue, "no") == 0 ||
|
---|
2866 | strwicmp(pszParmValue, "False") == 0 ||
|
---|
2867 | strwicmp(pszParmValue, "0") == 0)
|
---|
2868 | *pb = False;
|
---|
2869 | else {
|
---|
2870 | DEBUG(0,
|
---|
2871 | ("ERROR: Badly formed boolean in configuration file: \"%s\".\n",
|
---|
2872 | pszParmValue));
|
---|
2873 | bRetval = False;
|
---|
2874 | }
|
---|
2875 | return (bRetval);
|
---|
2876 | }
|
---|
2877 |
|
---|
2878 | /***************************************************************************
|
---|
2879 | Find a service by name. Otherwise works like get_service.
|
---|
2880 | ***************************************************************************/
|
---|
2881 |
|
---|
2882 | static int getservicebyname(const char *pszServiceName, service * pserviceDest)
|
---|
2883 | {
|
---|
2884 | int iService = -1;
|
---|
2885 | char *canon_name;
|
---|
2886 |
|
---|
2887 | if (ServiceHash != NULL) {
|
---|
2888 | if ( !(canon_name = canonicalize_servicename( pszServiceName )) )
|
---|
2889 | return -1;
|
---|
2890 |
|
---|
2891 | iService = tdb_fetch_int32(ServiceHash, canon_name );
|
---|
2892 |
|
---|
2893 | if (LP_SNUM_OK(iService)) {
|
---|
2894 | if (pserviceDest != NULL) {
|
---|
2895 | copy_service(pserviceDest, ServicePtrs[iService], NULL);
|
---|
2896 | }
|
---|
2897 | } else {
|
---|
2898 | iService = -1;
|
---|
2899 | }
|
---|
2900 | }
|
---|
2901 |
|
---|
2902 | return (iService);
|
---|
2903 | }
|
---|
2904 |
|
---|
2905 | /***************************************************************************
|
---|
2906 | Copy a service structure to another.
|
---|
2907 | If pcopymapDest is NULL then copy all fields
|
---|
2908 | ***************************************************************************/
|
---|
2909 |
|
---|
2910 | static void copy_service(service * pserviceDest, service * pserviceSource, BOOL *pcopymapDest)
|
---|
2911 | {
|
---|
2912 | int i;
|
---|
2913 | BOOL bcopyall = (pcopymapDest == NULL);
|
---|
2914 | param_opt_struct *data, *pdata, *paramo;
|
---|
2915 | BOOL not_added;
|
---|
2916 |
|
---|
2917 | for (i = 0; parm_table[i].label; i++)
|
---|
2918 | if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
|
---|
2919 | (bcopyall || pcopymapDest[i])) {
|
---|
2920 | void *def_ptr = parm_table[i].ptr;
|
---|
2921 | void *src_ptr =
|
---|
2922 | ((char *)pserviceSource) + PTR_DIFF(def_ptr,
|
---|
2923 | &sDefault);
|
---|
2924 | void *dest_ptr =
|
---|
2925 | ((char *)pserviceDest) + PTR_DIFF(def_ptr,
|
---|
2926 | &sDefault);
|
---|
2927 |
|
---|
2928 | switch (parm_table[i].type) {
|
---|
2929 | case P_BOOL:
|
---|
2930 | case P_BOOLREV:
|
---|
2931 | *(BOOL *)dest_ptr = *(BOOL *)src_ptr;
|
---|
2932 | break;
|
---|
2933 |
|
---|
2934 | case P_INTEGER:
|
---|
2935 | case P_ENUM:
|
---|
2936 | case P_OCTAL:
|
---|
2937 | *(int *)dest_ptr = *(int *)src_ptr;
|
---|
2938 | break;
|
---|
2939 |
|
---|
2940 | case P_CHAR:
|
---|
2941 | *(char *)dest_ptr = *(char *)src_ptr;
|
---|
2942 | break;
|
---|
2943 |
|
---|
2944 | case P_STRING:
|
---|
2945 | string_set((char **)dest_ptr,
|
---|
2946 | *(char **)src_ptr);
|
---|
2947 | break;
|
---|
2948 |
|
---|
2949 | case P_USTRING:
|
---|
2950 | string_set((char **)dest_ptr,
|
---|
2951 | *(char **)src_ptr);
|
---|
2952 | strupper_m(*(char **)dest_ptr);
|
---|
2953 | break;
|
---|
2954 | case P_LIST:
|
---|
2955 | str_list_free((char ***)dest_ptr);
|
---|
2956 | str_list_copy((char ***)dest_ptr, *(const char ***)src_ptr);
|
---|
2957 | break;
|
---|
2958 | default:
|
---|
2959 | break;
|
---|
2960 | }
|
---|
2961 | }
|
---|
2962 |
|
---|
2963 | if (bcopyall) {
|
---|
2964 | init_copymap(pserviceDest);
|
---|
2965 | if (pserviceSource->copymap)
|
---|
2966 | memcpy((void *)pserviceDest->copymap,
|
---|
2967 | (void *)pserviceSource->copymap,
|
---|
2968 | sizeof(BOOL) * NUMPARAMETERS);
|
---|
2969 | }
|
---|
2970 |
|
---|
2971 | data = pserviceSource->param_opt;
|
---|
2972 | while (data) {
|
---|
2973 | not_added = True;
|
---|
2974 | pdata = pserviceDest->param_opt;
|
---|
2975 | /* Traverse destination */
|
---|
2976 | while (pdata) {
|
---|
2977 | /* If we already have same option, override it */
|
---|
2978 | if (strcmp(pdata->key, data->key) == 0) {
|
---|
2979 | string_free(&pdata->value);
|
---|
2980 | str_list_free(&data->list);
|
---|
2981 | pdata->value = SMB_STRDUP(data->value);
|
---|
2982 | not_added = False;
|
---|
2983 | break;
|
---|
2984 | }
|
---|
2985 | pdata = pdata->next;
|
---|
2986 | }
|
---|
2987 | if (not_added) {
|
---|
2988 | paramo = SMB_XMALLOC_P(param_opt_struct);
|
---|
2989 | paramo->key = SMB_STRDUP(data->key);
|
---|
2990 | paramo->value = SMB_STRDUP(data->value);
|
---|
2991 | paramo->list = NULL;
|
---|
2992 | DLIST_ADD(pserviceDest->param_opt, paramo);
|
---|
2993 | }
|
---|
2994 | data = data->next;
|
---|
2995 | }
|
---|
2996 | }
|
---|
2997 |
|
---|
2998 | /***************************************************************************
|
---|
2999 | Check a service for consistency. Return False if the service is in any way
|
---|
3000 | incomplete or faulty, else True.
|
---|
3001 | ***************************************************************************/
|
---|
3002 |
|
---|
3003 | static BOOL service_ok(int iService)
|
---|
3004 | {
|
---|
3005 | BOOL bRetval;
|
---|
3006 |
|
---|
3007 | bRetval = True;
|
---|
3008 | if (ServicePtrs[iService]->szService[0] == '\0') {
|
---|
3009 | DEBUG(0, ("The following message indicates an internal error:\n"));
|
---|
3010 | DEBUG(0, ("No service name in service entry.\n"));
|
---|
3011 | bRetval = False;
|
---|
3012 | }
|
---|
3013 |
|
---|
3014 | /* The [printers] entry MUST be printable. I'm all for flexibility, but */
|
---|
3015 | /* I can't see why you'd want a non-printable printer service... */
|
---|
3016 | if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
|
---|
3017 | if (!ServicePtrs[iService]->bPrint_ok) {
|
---|
3018 | DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
|
---|
3019 | ServicePtrs[iService]->szService));
|
---|
3020 | ServicePtrs[iService]->bPrint_ok = True;
|
---|
3021 | }
|
---|
3022 | /* [printers] service must also be non-browsable. */
|
---|
3023 | if (ServicePtrs[iService]->bBrowseable)
|
---|
3024 | ServicePtrs[iService]->bBrowseable = False;
|
---|
3025 | }
|
---|
3026 |
|
---|
3027 | if (ServicePtrs[iService]->szPath[0] == '\0' &&
|
---|
3028 | strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
|
---|
3029 | ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
|
---|
3030 | ) {
|
---|
3031 | DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
|
---|
3032 | ServicePtrs[iService]->szService));
|
---|
3033 | ServicePtrs[iService]->bAvailable = False;
|
---|
3034 | }
|
---|
3035 |
|
---|
3036 | /* If a service is flagged unavailable, log the fact at level 0. */
|
---|
3037 | if (!ServicePtrs[iService]->bAvailable)
|
---|
3038 | DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
|
---|
3039 | ServicePtrs[iService]->szService));
|
---|
3040 |
|
---|
3041 | return (bRetval);
|
---|
3042 | }
|
---|
3043 |
|
---|
3044 | static struct file_lists {
|
---|
3045 | struct file_lists *next;
|
---|
3046 | char *name;
|
---|
3047 | char *subfname;
|
---|
3048 | time_t modtime;
|
---|
3049 | } *file_lists = NULL;
|
---|
3050 |
|
---|
3051 | /*******************************************************************
|
---|
3052 | Keep a linked list of all config files so we know when one has changed
|
---|
3053 | it's date and needs to be reloaded.
|
---|
3054 | ********************************************************************/
|
---|
3055 |
|
---|
3056 | static void add_to_file_list(const char *fname, const char *subfname)
|
---|
3057 | {
|
---|
3058 | struct file_lists *f = file_lists;
|
---|
3059 |
|
---|
3060 | while (f) {
|
---|
3061 | if (f->name && !strcmp(f->name, fname))
|
---|
3062 | break;
|
---|
3063 | f = f->next;
|
---|
3064 | }
|
---|
3065 |
|
---|
3066 | if (!f) {
|
---|
3067 | f = SMB_MALLOC_P(struct file_lists);
|
---|
3068 | if (!f)
|
---|
3069 | return;
|
---|
3070 | f->next = file_lists;
|
---|
3071 | f->name = SMB_STRDUP(fname);
|
---|
3072 | if (!f->name) {
|
---|
3073 | SAFE_FREE(f);
|
---|
3074 | return;
|
---|
3075 | }
|
---|
3076 | f->subfname = SMB_STRDUP(subfname);
|
---|
3077 | if (!f->subfname) {
|
---|
3078 | SAFE_FREE(f);
|
---|
3079 | return;
|
---|
3080 | }
|
---|
3081 | file_lists = f;
|
---|
3082 | f->modtime = file_modtime(subfname);
|
---|
3083 | } else {
|
---|
3084 | time_t t = file_modtime(subfname);
|
---|
3085 | if (t)
|
---|
3086 | f->modtime = t;
|
---|
3087 | }
|
---|
3088 | }
|
---|
3089 |
|
---|
3090 | /*******************************************************************
|
---|
3091 | Check if a config file has changed date.
|
---|
3092 | ********************************************************************/
|
---|
3093 |
|
---|
3094 | BOOL lp_file_list_changed(void)
|
---|
3095 | {
|
---|
3096 | struct file_lists *f = file_lists;
|
---|
3097 |
|
---|
3098 | DEBUG(6, ("lp_file_list_changed()\n"));
|
---|
3099 |
|
---|
3100 | while (f) {
|
---|
3101 | pstring n2;
|
---|
3102 | time_t mod_time;
|
---|
3103 |
|
---|
3104 | pstrcpy(n2, f->name);
|
---|
3105 | standard_sub_basic( get_current_username(),
|
---|
3106 | current_user_info.domain,
|
---|
3107 | n2, sizeof(n2) );
|
---|
3108 |
|
---|
3109 | DEBUGADD(6, ("file %s -> %s last mod_time: %s\n",
|
---|
3110 | f->name, n2, ctime(&f->modtime)));
|
---|
3111 |
|
---|
3112 | mod_time = file_modtime(n2);
|
---|
3113 |
|
---|
3114 | if (mod_time && ((f->modtime != mod_time) || (f->subfname == NULL) || (strcmp(n2, f->subfname) != 0))) {
|
---|
3115 | DEBUGADD(6,
|
---|
3116 | ("file %s modified: %s\n", n2,
|
---|
3117 | ctime(&mod_time)));
|
---|
3118 | f->modtime = mod_time;
|
---|
3119 | SAFE_FREE(f->subfname);
|
---|
3120 | f->subfname = SMB_STRDUP(n2);
|
---|
3121 | return (True);
|
---|
3122 | }
|
---|
3123 | f = f->next;
|
---|
3124 | }
|
---|
3125 | return (False);
|
---|
3126 | }
|
---|
3127 |
|
---|
3128 | /***************************************************************************
|
---|
3129 | Run standard_sub_basic on netbios name... needed because global_myname
|
---|
3130 | is not accessed through any lp_ macro.
|
---|
3131 | Note: We must *NOT* use string_set() here as ptr points to global_myname.
|
---|
3132 | ***************************************************************************/
|
---|
3133 |
|
---|
3134 | static BOOL handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
|
---|
3135 | {
|
---|
3136 | BOOL ret;
|
---|
3137 | pstring netbios_name;
|
---|
3138 |
|
---|
3139 | pstrcpy(netbios_name, pszParmValue);
|
---|
3140 |
|
---|
3141 | standard_sub_basic(get_current_username(), current_user_info.domain,
|
---|
3142 | netbios_name, sizeof(netbios_name));
|
---|
3143 |
|
---|
3144 | ret = set_global_myname(netbios_name);
|
---|
3145 | string_set(&Globals.szNetbiosName,global_myname());
|
---|
3146 |
|
---|
3147 | DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
|
---|
3148 | global_myname()));
|
---|
3149 |
|
---|
3150 | return ret;
|
---|
3151 | }
|
---|
3152 |
|
---|
3153 | static BOOL handle_charset(int snum, const char *pszParmValue, char **ptr)
|
---|
3154 | {
|
---|
3155 | if (strcmp(*ptr, pszParmValue) != 0) {
|
---|
3156 | string_set(ptr, pszParmValue);
|
---|
3157 | init_iconv();
|
---|
3158 | }
|
---|
3159 | return True;
|
---|
3160 | }
|
---|
3161 |
|
---|
3162 |
|
---|
3163 |
|
---|
3164 | static BOOL handle_workgroup(int snum, const char *pszParmValue, char **ptr)
|
---|
3165 | {
|
---|
3166 | BOOL ret;
|
---|
3167 |
|
---|
3168 | ret = set_global_myworkgroup(pszParmValue);
|
---|
3169 | string_set(&Globals.szWorkgroup,lp_workgroup());
|
---|
3170 |
|
---|
3171 | return ret;
|
---|
3172 | }
|
---|
3173 |
|
---|
3174 | static BOOL handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
|
---|
3175 | {
|
---|
3176 | BOOL ret;
|
---|
3177 |
|
---|
3178 | ret = set_global_scope(pszParmValue);
|
---|
3179 | string_set(&Globals.szNetbiosScope,global_scope());
|
---|
3180 |
|
---|
3181 | return ret;
|
---|
3182 | }
|
---|
3183 |
|
---|
3184 | static BOOL handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
|
---|
3185 | {
|
---|
3186 | str_list_free(&Globals.szNetbiosAliases);
|
---|
3187 | Globals.szNetbiosAliases = str_list_make(pszParmValue, NULL);
|
---|
3188 | return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
|
---|
3189 | }
|
---|
3190 |
|
---|
3191 | /***************************************************************************
|
---|
3192 | Handle the include operation.
|
---|
3193 | ***************************************************************************/
|
---|
3194 |
|
---|
3195 | static BOOL handle_include(int snum, const char *pszParmValue, char **ptr)
|
---|
3196 | {
|
---|
3197 | pstring fname;
|
---|
3198 | pstrcpy(fname, pszParmValue);
|
---|
3199 |
|
---|
3200 | standard_sub_basic(get_current_username(), current_user_info.domain,
|
---|
3201 | fname,sizeof(fname));
|
---|
3202 |
|
---|
3203 | add_to_file_list(pszParmValue, fname);
|
---|
3204 |
|
---|
3205 | string_set(ptr, fname);
|
---|
3206 |
|
---|
3207 | if (file_exist(fname, NULL))
|
---|
3208 | return (pm_process(fname, do_section, do_parameter));
|
---|
3209 |
|
---|
3210 | DEBUG(2, ("Can't find include file %s\n", fname));
|
---|
3211 |
|
---|
3212 | return (False);
|
---|
3213 | }
|
---|
3214 |
|
---|
3215 | /***************************************************************************
|
---|
3216 | Handle the interpretation of the copy parameter.
|
---|
3217 | ***************************************************************************/
|
---|
3218 |
|
---|
3219 | static BOOL handle_copy(int snum, const char *pszParmValue, char **ptr)
|
---|
3220 | {
|
---|
3221 | BOOL bRetval;
|
---|
3222 | int iTemp;
|
---|
3223 | service serviceTemp;
|
---|
3224 |
|
---|
3225 | string_set(ptr, pszParmValue);
|
---|
3226 |
|
---|
3227 | init_service(&serviceTemp);
|
---|
3228 |
|
---|
3229 | bRetval = False;
|
---|
3230 |
|
---|
3231 | DEBUG(3, ("Copying service from service %s\n", pszParmValue));
|
---|
3232 |
|
---|
3233 | if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
|
---|
3234 | if (iTemp == iServiceIndex) {
|
---|
3235 | DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
|
---|
3236 | } else {
|
---|
3237 | copy_service(ServicePtrs[iServiceIndex],
|
---|
3238 | &serviceTemp,
|
---|
3239 | ServicePtrs[iServiceIndex]->copymap);
|
---|
3240 | bRetval = True;
|
---|
3241 | }
|
---|
3242 | } else {
|
---|
3243 | DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
|
---|
3244 | bRetval = False;
|
---|
3245 | }
|
---|
3246 |
|
---|
3247 | free_service(&serviceTemp);
|
---|
3248 | return (bRetval);
|
---|
3249 | }
|
---|
3250 |
|
---|
3251 | /***************************************************************************
|
---|
3252 | Handle idmap/non unix account uid and gid allocation parameters. The format of these
|
---|
3253 | parameters is:
|
---|
3254 |
|
---|
3255 | [global]
|
---|
3256 |
|
---|
3257 | idmap uid = 1000-1999
|
---|
3258 | idmap gid = 700-899
|
---|
3259 |
|
---|
3260 | We only do simple parsing checks here. The strings are parsed into useful
|
---|
3261 | structures in the idmap daemon code.
|
---|
3262 |
|
---|
3263 | ***************************************************************************/
|
---|
3264 |
|
---|
3265 | /* Some lp_ routines to return idmap [ug]id information */
|
---|
3266 |
|
---|
3267 | static uid_t idmap_uid_low, idmap_uid_high;
|
---|
3268 | static gid_t idmap_gid_low, idmap_gid_high;
|
---|
3269 |
|
---|
3270 | BOOL lp_idmap_uid(uid_t *low, uid_t *high)
|
---|
3271 | {
|
---|
3272 | if (idmap_uid_low == 0 || idmap_uid_high == 0)
|
---|
3273 | return False;
|
---|
3274 |
|
---|
3275 | if (low)
|
---|
3276 | *low = idmap_uid_low;
|
---|
3277 |
|
---|
3278 | if (high)
|
---|
3279 | *high = idmap_uid_high;
|
---|
3280 |
|
---|
3281 | return True;
|
---|
3282 | }
|
---|
3283 |
|
---|
3284 | BOOL lp_idmap_gid(gid_t *low, gid_t *high)
|
---|
3285 | {
|
---|
3286 | if (idmap_gid_low == 0 || idmap_gid_high == 0)
|
---|
3287 | return False;
|
---|
3288 |
|
---|
3289 | if (low)
|
---|
3290 | *low = idmap_gid_low;
|
---|
3291 |
|
---|
3292 | if (high)
|
---|
3293 | *high = idmap_gid_high;
|
---|
3294 |
|
---|
3295 | return True;
|
---|
3296 | }
|
---|
3297 |
|
---|
3298 | /* Do some simple checks on "idmap [ug]id" parameter values */
|
---|
3299 |
|
---|
3300 | static BOOL handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
|
---|
3301 | {
|
---|
3302 | uint32 low, high;
|
---|
3303 |
|
---|
3304 | if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
|
---|
3305 | return False;
|
---|
3306 |
|
---|
3307 | /* Parse OK */
|
---|
3308 |
|
---|
3309 | string_set(ptr, pszParmValue);
|
---|
3310 |
|
---|
3311 | idmap_uid_low = low;
|
---|
3312 | idmap_uid_high = high;
|
---|
3313 |
|
---|
3314 | return True;
|
---|
3315 | }
|
---|
3316 |
|
---|
3317 | static BOOL handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
|
---|
3318 | {
|
---|
3319 | uint32 low, high;
|
---|
3320 |
|
---|
3321 | if (sscanf(pszParmValue, "%u - %u", &low, &high) != 2 || high < low)
|
---|
3322 | return False;
|
---|
3323 |
|
---|
3324 | /* Parse OK */
|
---|
3325 |
|
---|
3326 | string_set(ptr, pszParmValue);
|
---|
3327 |
|
---|
3328 | idmap_gid_low = low;
|
---|
3329 | idmap_gid_high = high;
|
---|
3330 |
|
---|
3331 | return True;
|
---|
3332 | }
|
---|
3333 |
|
---|
3334 | /***************************************************************************
|
---|
3335 | Handle the DEBUG level list.
|
---|
3336 | ***************************************************************************/
|
---|
3337 |
|
---|
3338 | static BOOL handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
|
---|
3339 | {
|
---|
3340 | pstring pszParmValue;
|
---|
3341 |
|
---|
3342 | pstrcpy(pszParmValue, pszParmValueIn);
|
---|
3343 | string_set(ptr, pszParmValueIn);
|
---|
3344 | return debug_parse_levels( pszParmValue );
|
---|
3345 | }
|
---|
3346 |
|
---|
3347 | /***************************************************************************
|
---|
3348 | Handle ldap suffixes - default to ldapsuffix if sub-suffixes are not defined.
|
---|
3349 | ***************************************************************************/
|
---|
3350 |
|
---|
3351 | static const char *append_ldap_suffix( const char *str )
|
---|
3352 | {
|
---|
3353 | const char *suffix_string;
|
---|
3354 |
|
---|
3355 |
|
---|
3356 | if (!lp_talloc)
|
---|
3357 | lp_talloc = talloc_init("lp_talloc");
|
---|
3358 |
|
---|
3359 | suffix_string = talloc_asprintf( lp_talloc, "%s,%s", str, Globals.szLdapSuffix );
|
---|
3360 | if ( !suffix_string ) {
|
---|
3361 | DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
|
---|
3362 | return "";
|
---|
3363 | }
|
---|
3364 |
|
---|
3365 | return suffix_string;
|
---|
3366 | }
|
---|
3367 |
|
---|
3368 | const char *lp_ldap_machine_suffix(void)
|
---|
3369 | {
|
---|
3370 | if (Globals.szLdapMachineSuffix[0])
|
---|
3371 | return append_ldap_suffix(Globals.szLdapMachineSuffix);
|
---|
3372 |
|
---|
3373 | return lp_string(Globals.szLdapSuffix);
|
---|
3374 | }
|
---|
3375 |
|
---|
3376 | const char *lp_ldap_user_suffix(void)
|
---|
3377 | {
|
---|
3378 | if (Globals.szLdapUserSuffix[0])
|
---|
3379 | return append_ldap_suffix(Globals.szLdapUserSuffix);
|
---|
3380 |
|
---|
3381 | return lp_string(Globals.szLdapSuffix);
|
---|
3382 | }
|
---|
3383 |
|
---|
3384 | const char *lp_ldap_group_suffix(void)
|
---|
3385 | {
|
---|
3386 | if (Globals.szLdapGroupSuffix[0])
|
---|
3387 | return append_ldap_suffix(Globals.szLdapGroupSuffix);
|
---|
3388 |
|
---|
3389 | return lp_string(Globals.szLdapSuffix);
|
---|
3390 | }
|
---|
3391 |
|
---|
3392 | const char *lp_ldap_idmap_suffix(void)
|
---|
3393 | {
|
---|
3394 | if (Globals.szLdapIdmapSuffix[0])
|
---|
3395 | return append_ldap_suffix(Globals.szLdapIdmapSuffix);
|
---|
3396 |
|
---|
3397 | return lp_string(Globals.szLdapSuffix);
|
---|
3398 | }
|
---|
3399 |
|
---|
3400 | /****************************************************************************
|
---|
3401 | set the value for a P_ENUM
|
---|
3402 | ***************************************************************************/
|
---|
3403 |
|
---|
3404 | static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
|
---|
3405 | int *ptr )
|
---|
3406 | {
|
---|
3407 | int i;
|
---|
3408 |
|
---|
3409 | for (i = 0; parm->enum_list[i].name; i++) {
|
---|
3410 | if ( strequal(pszParmValue, parm->enum_list[i].name)) {
|
---|
3411 | *ptr = parm->enum_list[i].value;
|
---|
3412 | break;
|
---|
3413 | }
|
---|
3414 | }
|
---|
3415 | }
|
---|
3416 |
|
---|
3417 | /***************************************************************************
|
---|
3418 | ***************************************************************************/
|
---|
3419 |
|
---|
3420 | static BOOL handle_printing(int snum, const char *pszParmValue, char **ptr)
|
---|
3421 | {
|
---|
3422 | static int parm_num = -1;
|
---|
3423 | service *s;
|
---|
3424 |
|
---|
3425 | if ( parm_num == -1 )
|
---|
3426 | parm_num = map_parameter( "printing" );
|
---|
3427 |
|
---|
3428 | lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
|
---|
3429 |
|
---|
3430 | if ( snum < 0 )
|
---|
3431 | s = &sDefault;
|
---|
3432 | else
|
---|
3433 | s = ServicePtrs[snum];
|
---|
3434 |
|
---|
3435 | init_printer_values( s );
|
---|
3436 |
|
---|
3437 | return True;
|
---|
3438 | }
|
---|
3439 |
|
---|
3440 |
|
---|
3441 | /***************************************************************************
|
---|
3442 | Initialise a copymap.
|
---|
3443 | ***************************************************************************/
|
---|
3444 |
|
---|
3445 | static void init_copymap(service * pservice)
|
---|
3446 | {
|
---|
3447 | int i;
|
---|
3448 | SAFE_FREE(pservice->copymap);
|
---|
3449 | pservice->copymap = SMB_MALLOC_ARRAY(BOOL,NUMPARAMETERS);
|
---|
3450 | if (!pservice->copymap)
|
---|
3451 | DEBUG(0,
|
---|
3452 | ("Couldn't allocate copymap!! (size %d)\n",
|
---|
3453 | (int)NUMPARAMETERS));
|
---|
3454 | else
|
---|
3455 | for (i = 0; i < NUMPARAMETERS; i++)
|
---|
3456 | pservice->copymap[i] = True;
|
---|
3457 | }
|
---|
3458 |
|
---|
3459 | /***************************************************************************
|
---|
3460 | Return the local pointer to a parameter given the service number and the
|
---|
3461 | pointer into the default structure.
|
---|
3462 | ***************************************************************************/
|
---|
3463 |
|
---|
3464 | void *lp_local_ptr(int snum, void *ptr)
|
---|
3465 | {
|
---|
3466 | return (void *)(((char *)ServicePtrs[snum]) + PTR_DIFF(ptr, &sDefault));
|
---|
3467 | }
|
---|
3468 |
|
---|
3469 | /***************************************************************************
|
---|
3470 | Process a parameter for a particular service number. If snum < 0
|
---|
3471 | then assume we are in the globals.
|
---|
3472 | ***************************************************************************/
|
---|
3473 |
|
---|
3474 | BOOL lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
|
---|
3475 | {
|
---|
3476 | int parmnum, i, slen;
|
---|
3477 | void *parm_ptr = NULL; /* where we are going to store the result */
|
---|
3478 | void *def_ptr = NULL;
|
---|
3479 | pstring param_key;
|
---|
3480 | char *sep;
|
---|
3481 | param_opt_struct *paramo, *data;
|
---|
3482 | BOOL not_added;
|
---|
3483 |
|
---|
3484 | parmnum = map_parameter(pszParmName);
|
---|
3485 |
|
---|
3486 | if (parmnum < 0) {
|
---|
3487 | if ((sep=strchr(pszParmName, ':')) != NULL) {
|
---|
3488 | *sep = '\0';
|
---|
3489 | ZERO_STRUCT(param_key);
|
---|
3490 | pstr_sprintf(param_key, "%s:", pszParmName);
|
---|
3491 | slen = strlen(param_key);
|
---|
3492 | pstrcat(param_key, sep+1);
|
---|
3493 | trim_char(param_key+slen, ' ', ' ');
|
---|
3494 | not_added = True;
|
---|
3495 | data = (snum < 0) ? Globals.param_opt :
|
---|
3496 | ServicePtrs[snum]->param_opt;
|
---|
3497 | /* Traverse destination */
|
---|
3498 | while (data) {
|
---|
3499 | /* If we already have same option, override it */
|
---|
3500 | if (strcmp(data->key, param_key) == 0) {
|
---|
3501 | string_free(&data->value);
|
---|
3502 | str_list_free(&data->list);
|
---|
3503 | data->value = SMB_STRDUP(pszParmValue);
|
---|
3504 | not_added = False;
|
---|
3505 | break;
|
---|
3506 | }
|
---|
3507 | data = data->next;
|
---|
3508 | }
|
---|
3509 | if (not_added) {
|
---|
3510 | paramo = SMB_XMALLOC_P(param_opt_struct);
|
---|
3511 | paramo->key = SMB_STRDUP(param_key);
|
---|
3512 | paramo->value = SMB_STRDUP(pszParmValue);
|
---|
3513 | paramo->list = NULL;
|
---|
3514 | if (snum < 0) {
|
---|
3515 | DLIST_ADD(Globals.param_opt, paramo);
|
---|
3516 | } else {
|
---|
3517 | DLIST_ADD(ServicePtrs[snum]->param_opt, paramo);
|
---|
3518 | }
|
---|
3519 | }
|
---|
3520 |
|
---|
3521 | *sep = ':';
|
---|
3522 | return (True);
|
---|
3523 | }
|
---|
3524 | DEBUG(0, ("Ignoring unknown parameter \"%s\"\n", pszParmName));
|
---|
3525 | return (True);
|
---|
3526 | }
|
---|
3527 |
|
---|
3528 | if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
|
---|
3529 | DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
|
---|
3530 | pszParmName));
|
---|
3531 | }
|
---|
3532 |
|
---|
3533 | def_ptr = parm_table[parmnum].ptr;
|
---|
3534 |
|
---|
3535 | /* we might point at a service, the default service or a global */
|
---|
3536 | if (snum < 0) {
|
---|
3537 | parm_ptr = def_ptr;
|
---|
3538 | } else {
|
---|
3539 | if (parm_table[parmnum].p_class == P_GLOBAL) {
|
---|
3540 | DEBUG(0,
|
---|
3541 | ("Global parameter %s found in service section!\n",
|
---|
3542 | pszParmName));
|
---|
3543 | return (True);
|
---|
3544 | }
|
---|
3545 | parm_ptr =
|
---|
3546 | ((char *)ServicePtrs[snum]) + PTR_DIFF(def_ptr,
|
---|
3547 | &sDefault);
|
---|
3548 | }
|
---|
3549 |
|
---|
3550 | if (snum >= 0) {
|
---|
3551 | if (!ServicePtrs[snum]->copymap)
|
---|
3552 | init_copymap(ServicePtrs[snum]);
|
---|
3553 |
|
---|
3554 | /* this handles the aliases - set the copymap for other entries with
|
---|
3555 | the same data pointer */
|
---|
3556 | for (i = 0; parm_table[i].label; i++)
|
---|
3557 | if (parm_table[i].ptr == parm_table[parmnum].ptr)
|
---|
3558 | ServicePtrs[snum]->copymap[i] = False;
|
---|
3559 | }
|
---|
3560 |
|
---|
3561 | /* if it is a special case then go ahead */
|
---|
3562 | if (parm_table[parmnum].special) {
|
---|
3563 | parm_table[parmnum].special(snum, pszParmValue, (char **)parm_ptr);
|
---|
3564 | return (True);
|
---|
3565 | }
|
---|
3566 |
|
---|
3567 | /* now switch on the type of variable it is */
|
---|
3568 | switch (parm_table[parmnum].type)
|
---|
3569 | {
|
---|
3570 | case P_BOOL:
|
---|
3571 | *(BOOL *)parm_ptr = lp_bool(pszParmValue);
|
---|
3572 | break;
|
---|
3573 |
|
---|
3574 | case P_BOOLREV:
|
---|
3575 | *(BOOL *)parm_ptr = !lp_bool(pszParmValue);
|
---|
3576 | break;
|
---|
3577 |
|
---|
3578 | case P_INTEGER:
|
---|
3579 | *(int *)parm_ptr = lp_int(pszParmValue);
|
---|
3580 | break;
|
---|
3581 |
|
---|
3582 | case P_CHAR:
|
---|
3583 | *(char *)parm_ptr = *pszParmValue;
|
---|
3584 | break;
|
---|
3585 |
|
---|
3586 | case P_OCTAL:
|
---|
3587 | i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
|
---|
3588 | if ( i != 1 ) {
|
---|
3589 | DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
|
---|
3590 | }
|
---|
3591 | break;
|
---|
3592 |
|
---|
3593 | case P_LIST:
|
---|
3594 | str_list_free((char ***)parm_ptr);
|
---|
3595 | *(char ***)parm_ptr = str_list_make(pszParmValue, NULL);
|
---|
3596 | break;
|
---|
3597 |
|
---|
3598 | case P_STRING:
|
---|
3599 | string_set((char **)parm_ptr, pszParmValue);
|
---|
3600 | break;
|
---|
3601 |
|
---|
3602 | case P_USTRING:
|
---|
3603 | string_set((char **)parm_ptr, pszParmValue);
|
---|
3604 | strupper_m(*(char **)parm_ptr);
|
---|
3605 | break;
|
---|
3606 |
|
---|
3607 | case P_GSTRING:
|
---|
3608 | pstrcpy((char *)parm_ptr, pszParmValue);
|
---|
3609 | break;
|
---|
3610 |
|
---|
3611 | case P_UGSTRING:
|
---|
3612 | pstrcpy((char *)parm_ptr, pszParmValue);
|
---|
3613 | strupper_m((char *)parm_ptr);
|
---|
3614 | break;
|
---|
3615 |
|
---|
3616 | case P_ENUM:
|
---|
3617 | lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
|
---|
3618 | break;
|
---|
3619 | case P_SEP:
|
---|
3620 | break;
|
---|
3621 | }
|
---|
3622 |
|
---|
3623 | return (True);
|
---|
3624 | }
|
---|
3625 |
|
---|
3626 | /***************************************************************************
|
---|
3627 | Process a parameter.
|
---|
3628 | ***************************************************************************/
|
---|
3629 |
|
---|
3630 | static BOOL do_parameter(const char *pszParmName, const char *pszParmValue)
|
---|
3631 | {
|
---|
3632 | if (!bInGlobalSection && bGlobalOnly)
|
---|
3633 | return (True);
|
---|
3634 |
|
---|
3635 | DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
|
---|
3636 |
|
---|
3637 | return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
|
---|
3638 | pszParmName, pszParmValue));
|
---|
3639 | }
|
---|
3640 |
|
---|
3641 | /***************************************************************************
|
---|
3642 | Print a parameter of the specified type.
|
---|
3643 | ***************************************************************************/
|
---|
3644 |
|
---|
3645 | static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
|
---|
3646 | {
|
---|
3647 | int i;
|
---|
3648 | switch (p->type)
|
---|
3649 | {
|
---|
3650 | case P_ENUM:
|
---|
3651 | for (i = 0; p->enum_list[i].name; i++) {
|
---|
3652 | if (*(int *)ptr == p->enum_list[i].value) {
|
---|
3653 | fprintf(f, "%s",
|
---|
3654 | p->enum_list[i].name);
|
---|
3655 | break;
|
---|
3656 | }
|
---|
3657 | }
|
---|
3658 | break;
|
---|
3659 |
|
---|
3660 | case P_BOOL:
|
---|
3661 | fprintf(f, "%s", BOOLSTR(*(BOOL *)ptr));
|
---|
3662 | break;
|
---|
3663 |
|
---|
3664 | case P_BOOLREV:
|
---|
3665 | fprintf(f, "%s", BOOLSTR(!*(BOOL *)ptr));
|
---|
3666 | break;
|
---|
3667 |
|
---|
3668 | case P_INTEGER:
|
---|
3669 | fprintf(f, "%d", *(int *)ptr);
|
---|
3670 | break;
|
---|
3671 |
|
---|
3672 | case P_CHAR:
|
---|
3673 | fprintf(f, "%c", *(char *)ptr);
|
---|
3674 | break;
|
---|
3675 |
|
---|
3676 | case P_OCTAL:
|
---|
3677 | fprintf(f, "%s", octal_string(*(int *)ptr));
|
---|
3678 | break;
|
---|
3679 |
|
---|
3680 | case P_LIST:
|
---|
3681 | if ((char ***)ptr && *(char ***)ptr) {
|
---|
3682 | char **list = *(char ***)ptr;
|
---|
3683 |
|
---|
3684 | for (; *list; list++) {
|
---|
3685 | /* surround strings with whitespace in double quotes */
|
---|
3686 | if ( strchr_m( *list, ' ' ) )
|
---|
3687 | fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
|
---|
3688 | else
|
---|
3689 | fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
|
---|
3690 | }
|
---|
3691 | }
|
---|
3692 | break;
|
---|
3693 |
|
---|
3694 | case P_GSTRING:
|
---|
3695 | case P_UGSTRING:
|
---|
3696 | if ((char *)ptr) {
|
---|
3697 | fprintf(f, "%s", (char *)ptr);
|
---|
3698 | }
|
---|
3699 | break;
|
---|
3700 |
|
---|
3701 | case P_STRING:
|
---|
3702 | case P_USTRING:
|
---|
3703 | if (*(char **)ptr) {
|
---|
3704 | fprintf(f, "%s", *(char **)ptr);
|
---|
3705 | }
|
---|
3706 | break;
|
---|
3707 | case P_SEP:
|
---|
3708 | break;
|
---|
3709 | }
|
---|
3710 | }
|
---|
3711 |
|
---|
3712 | /***************************************************************************
|
---|
3713 | Check if two parameters are equal.
|
---|
3714 | ***************************************************************************/
|
---|
3715 |
|
---|
3716 | static BOOL equal_parameter(parm_type type, void *ptr1, void *ptr2)
|
---|
3717 | {
|
---|
3718 | switch (type) {
|
---|
3719 | case P_BOOL:
|
---|
3720 | case P_BOOLREV:
|
---|
3721 | return (*((BOOL *)ptr1) == *((BOOL *)ptr2));
|
---|
3722 |
|
---|
3723 | case P_INTEGER:
|
---|
3724 | case P_ENUM:
|
---|
3725 | case P_OCTAL:
|
---|
3726 | return (*((int *)ptr1) == *((int *)ptr2));
|
---|
3727 |
|
---|
3728 | case P_CHAR:
|
---|
3729 | return (*((char *)ptr1) == *((char *)ptr2));
|
---|
3730 |
|
---|
3731 | case P_LIST:
|
---|
3732 | return str_list_compare(*(char ***)ptr1, *(char ***)ptr2);
|
---|
3733 |
|
---|
3734 | case P_GSTRING:
|
---|
3735 | case P_UGSTRING:
|
---|
3736 | {
|
---|
3737 | char *p1 = (char *)ptr1, *p2 = (char *)ptr2;
|
---|
3738 | if (p1 && !*p1)
|
---|
3739 | p1 = NULL;
|
---|
3740 | if (p2 && !*p2)
|
---|
3741 | p2 = NULL;
|
---|
3742 | return (p1 == p2 || strequal(p1, p2));
|
---|
3743 | }
|
---|
3744 | case P_STRING:
|
---|
3745 | case P_USTRING:
|
---|
3746 | {
|
---|
3747 | char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
|
---|
3748 | if (p1 && !*p1)
|
---|
3749 | p1 = NULL;
|
---|
3750 | if (p2 && !*p2)
|
---|
3751 | p2 = NULL;
|
---|
3752 | return (p1 == p2 || strequal(p1, p2));
|
---|
3753 | }
|
---|
3754 | case P_SEP:
|
---|
3755 | break;
|
---|
3756 | }
|
---|
3757 | return (False);
|
---|
3758 | }
|
---|
3759 |
|
---|
3760 | /***************************************************************************
|
---|
3761 | Initialize any local varients in the sDefault table.
|
---|
3762 | ***************************************************************************/
|
---|
3763 |
|
---|
3764 | void init_locals(void)
|
---|
3765 | {
|
---|
3766 | /* None as yet. */
|
---|
3767 | }
|
---|
3768 |
|
---|
3769 | /***************************************************************************
|
---|
3770 | Process a new section (service). At this stage all sections are services.
|
---|
3771 | Later we'll have special sections that permit server parameters to be set.
|
---|
3772 | Returns True on success, False on failure.
|
---|
3773 | ***************************************************************************/
|
---|
3774 |
|
---|
3775 | static BOOL do_section(const char *pszSectionName)
|
---|
3776 | {
|
---|
3777 | BOOL bRetval;
|
---|
3778 | BOOL isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
|
---|
3779 | (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
|
---|
3780 | bRetval = False;
|
---|
3781 |
|
---|
3782 | /* if we were in a global section then do the local inits */
|
---|
3783 | if (bInGlobalSection && !isglobal)
|
---|
3784 | init_locals();
|
---|
3785 |
|
---|
3786 | /* if we've just struck a global section, note the fact. */
|
---|
3787 | bInGlobalSection = isglobal;
|
---|
3788 |
|
---|
3789 | /* check for multiple global sections */
|
---|
3790 | if (bInGlobalSection) {
|
---|
3791 | DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
|
---|
3792 | return (True);
|
---|
3793 | }
|
---|
3794 |
|
---|
3795 | if (!bInGlobalSection && bGlobalOnly)
|
---|
3796 | return (True);
|
---|
3797 |
|
---|
3798 | /* if we have a current service, tidy it up before moving on */
|
---|
3799 | bRetval = True;
|
---|
3800 |
|
---|
3801 | if (iServiceIndex >= 0)
|
---|
3802 | bRetval = service_ok(iServiceIndex);
|
---|
3803 |
|
---|
3804 | /* if all is still well, move to the next record in the services array */
|
---|
3805 | if (bRetval) {
|
---|
3806 | /* We put this here to avoid an odd message order if messages are */
|
---|
3807 | /* issued by the post-processing of a previous section. */
|
---|
3808 | DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
|
---|
3809 |
|
---|
3810 | if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
|
---|
3811 | < 0) {
|
---|
3812 | DEBUG(0, ("Failed to add a new service\n"));
|
---|
3813 | return (False);
|
---|
3814 | }
|
---|
3815 | }
|
---|
3816 |
|
---|
3817 | return (bRetval);
|
---|
3818 | }
|
---|
3819 |
|
---|
3820 |
|
---|
3821 | /***************************************************************************
|
---|
3822 | Determine if a partcular base parameter is currentl set to the default value.
|
---|
3823 | ***************************************************************************/
|
---|
3824 |
|
---|
3825 | static BOOL is_default(int i)
|
---|
3826 | {
|
---|
3827 | if (!defaults_saved)
|
---|
3828 | return False;
|
---|
3829 | switch (parm_table[i].type) {
|
---|
3830 | case P_LIST:
|
---|
3831 | return str_list_compare (parm_table[i].def.lvalue,
|
---|
3832 | *(char ***)parm_table[i].ptr);
|
---|
3833 | case P_STRING:
|
---|
3834 | case P_USTRING:
|
---|
3835 | return strequal(parm_table[i].def.svalue,
|
---|
3836 | *(char **)parm_table[i].ptr);
|
---|
3837 | case P_GSTRING:
|
---|
3838 | case P_UGSTRING:
|
---|
3839 | return strequal(parm_table[i].def.svalue,
|
---|
3840 | (char *)parm_table[i].ptr);
|
---|
3841 | case P_BOOL:
|
---|
3842 | case P_BOOLREV:
|
---|
3843 | return parm_table[i].def.bvalue ==
|
---|
3844 | *(BOOL *)parm_table[i].ptr;
|
---|
3845 | case P_CHAR:
|
---|
3846 | return parm_table[i].def.cvalue ==
|
---|
3847 | *(char *)parm_table[i].ptr;
|
---|
3848 | case P_INTEGER:
|
---|
3849 | case P_OCTAL:
|
---|
3850 | case P_ENUM:
|
---|
3851 | return parm_table[i].def.ivalue ==
|
---|
3852 | *(int *)parm_table[i].ptr;
|
---|
3853 | case P_SEP:
|
---|
3854 | break;
|
---|
3855 | }
|
---|
3856 | return False;
|
---|
3857 | }
|
---|
3858 |
|
---|
3859 | /***************************************************************************
|
---|
3860 | Display the contents of the global structure.
|
---|
3861 | ***************************************************************************/
|
---|
3862 |
|
---|
3863 | static void dump_globals(FILE *f)
|
---|
3864 | {
|
---|
3865 | int i;
|
---|
3866 | param_opt_struct *data;
|
---|
3867 |
|
---|
3868 | fprintf(f, "[global]\n");
|
---|
3869 |
|
---|
3870 | for (i = 0; parm_table[i].label; i++)
|
---|
3871 | if (parm_table[i].p_class == P_GLOBAL &&
|
---|
3872 | parm_table[i].ptr &&
|
---|
3873 | (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
|
---|
3874 | if (defaults_saved && is_default(i))
|
---|
3875 | continue;
|
---|
3876 | fprintf(f, "\t%s = ", parm_table[i].label);
|
---|
3877 | print_parameter(&parm_table[i], parm_table[i].ptr, f);
|
---|
3878 | fprintf(f, "\n");
|
---|
3879 | }
|
---|
3880 | if (Globals.param_opt != NULL) {
|
---|
3881 | data = Globals.param_opt;
|
---|
3882 | while(data) {
|
---|
3883 | fprintf(f, "\t%s = %s\n", data->key, data->value);
|
---|
3884 | data = data->next;
|
---|
3885 | }
|
---|
3886 | }
|
---|
3887 |
|
---|
3888 | }
|
---|
3889 |
|
---|
3890 | /***************************************************************************
|
---|
3891 | Return True if a local parameter is currently set to the global default.
|
---|
3892 | ***************************************************************************/
|
---|
3893 |
|
---|
3894 | BOOL lp_is_default(int snum, struct parm_struct *parm)
|
---|
3895 | {
|
---|
3896 | int pdiff = PTR_DIFF(parm->ptr, &sDefault);
|
---|
3897 |
|
---|
3898 | return equal_parameter(parm->type,
|
---|
3899 | ((char *)ServicePtrs[snum]) + pdiff,
|
---|
3900 | ((char *)&sDefault) + pdiff);
|
---|
3901 | }
|
---|
3902 |
|
---|
3903 | /***************************************************************************
|
---|
3904 | Display the contents of a single services record.
|
---|
3905 | ***************************************************************************/
|
---|
3906 |
|
---|
3907 | static void dump_a_service(service * pService, FILE * f)
|
---|
3908 | {
|
---|
3909 | int i;
|
---|
3910 | param_opt_struct *data;
|
---|
3911 |
|
---|
3912 | if (pService != &sDefault)
|
---|
3913 | fprintf(f, "[%s]\n", pService->szService);
|
---|
3914 |
|
---|
3915 | for (i = 0; parm_table[i].label; i++) {
|
---|
3916 |
|
---|
3917 | if (parm_table[i].p_class == P_LOCAL &&
|
---|
3918 | parm_table[i].ptr &&
|
---|
3919 | (*parm_table[i].label != '-') &&
|
---|
3920 | (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
|
---|
3921 | {
|
---|
3922 |
|
---|
3923 | int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
|
---|
3924 |
|
---|
3925 | if (pService == &sDefault) {
|
---|
3926 | if (defaults_saved && is_default(i))
|
---|
3927 | continue;
|
---|
3928 | } else {
|
---|
3929 | if (equal_parameter(parm_table[i].type,
|
---|
3930 | ((char *)pService) +
|
---|
3931 | pdiff,
|
---|
3932 | ((char *)&sDefault) +
|
---|
3933 | pdiff))
|
---|
3934 | continue;
|
---|
3935 | }
|
---|
3936 |
|
---|
3937 | fprintf(f, "\t%s = ", parm_table[i].label);
|
---|
3938 | print_parameter(&parm_table[i],
|
---|
3939 | ((char *)pService) + pdiff, f);
|
---|
3940 | fprintf(f, "\n");
|
---|
3941 | }
|
---|
3942 | }
|
---|
3943 |
|
---|
3944 | if (pService->param_opt != NULL) {
|
---|
3945 | data = pService->param_opt;
|
---|
3946 | while(data) {
|
---|
3947 | fprintf(f, "\t%s = %s\n", data->key, data->value);
|
---|
3948 | data = data->next;
|
---|
3949 | }
|
---|
3950 | }
|
---|
3951 | }
|
---|
3952 |
|
---|
3953 | /***************************************************************************
|
---|
3954 | Display the contents of a parameter of a single services record.
|
---|
3955 | ***************************************************************************/
|
---|
3956 |
|
---|
3957 | BOOL dump_a_parameter(int snum, char *parm_name, FILE * f, BOOL isGlobal)
|
---|
3958 | {
|
---|
3959 | int i;
|
---|
3960 | BOOL result = False;
|
---|
3961 | parm_class p_class;
|
---|
3962 | unsigned flag = 0;
|
---|
3963 | fstring local_parm_name;
|
---|
3964 | char *parm_opt;
|
---|
3965 | const char *parm_opt_value;
|
---|
3966 |
|
---|
3967 | /* check for parametrical option */
|
---|
3968 | fstrcpy( local_parm_name, parm_name);
|
---|
3969 | parm_opt = strchr( local_parm_name, ':');
|
---|
3970 |
|
---|
3971 | if (parm_opt) {
|
---|
3972 | *parm_opt = '\0';
|
---|
3973 | parm_opt++;
|
---|
3974 | if (strlen(parm_opt)) {
|
---|
3975 | parm_opt_value = lp_parm_const_string( snum,
|
---|
3976 | local_parm_name, parm_opt, NULL);
|
---|
3977 | if (parm_opt_value) {
|
---|
3978 | printf( "%s\n", parm_opt_value);
|
---|
3979 | result = True;
|
---|
3980 | }
|
---|
3981 | }
|
---|
3982 | return result;
|
---|
3983 | }
|
---|
3984 |
|
---|
3985 | /* check for a key and print the value */
|
---|
3986 | if (isGlobal) {
|
---|
3987 | p_class = P_GLOBAL;
|
---|
3988 | flag = FLAG_GLOBAL;
|
---|
3989 | } else
|
---|
3990 | p_class = P_LOCAL;
|
---|
3991 |
|
---|
3992 | for (i = 0; parm_table[i].label; i++) {
|
---|
3993 | if (strwicmp(parm_table[i].label, parm_name) == 0 &&
|
---|
3994 | (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
|
---|
3995 | parm_table[i].ptr &&
|
---|
3996 | (*parm_table[i].label != '-') &&
|
---|
3997 | (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
|
---|
3998 | {
|
---|
3999 | void *ptr;
|
---|
4000 |
|
---|
4001 | if (isGlobal) {
|
---|
4002 | ptr = parm_table[i].ptr;
|
---|
4003 | } else {
|
---|
4004 | service * pService = ServicePtrs[snum];
|
---|
4005 | ptr = ((char *)pService) +
|
---|
4006 | PTR_DIFF(parm_table[i].ptr, &sDefault);
|
---|
4007 | }
|
---|
4008 |
|
---|
4009 | print_parameter(&parm_table[i],
|
---|
4010 | ptr, f);
|
---|
4011 | fprintf(f, "\n");
|
---|
4012 | result = True;
|
---|
4013 | break;
|
---|
4014 | }
|
---|
4015 | }
|
---|
4016 |
|
---|
4017 | return result;
|
---|
4018 | }
|
---|
4019 |
|
---|
4020 | /***************************************************************************
|
---|
4021 | Return info about the next service in a service. snum==GLOBAL_SECTION_SNUM gives the globals.
|
---|
4022 | Return NULL when out of parameters.
|
---|
4023 | ***************************************************************************/
|
---|
4024 |
|
---|
4025 | struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
|
---|
4026 | {
|
---|
4027 | if (snum < 0) {
|
---|
4028 | /* do the globals */
|
---|
4029 | for (; parm_table[*i].label; (*i)++) {
|
---|
4030 | if (parm_table[*i].p_class == P_SEPARATOR)
|
---|
4031 | return &parm_table[(*i)++];
|
---|
4032 |
|
---|
4033 | if (!parm_table[*i].ptr
|
---|
4034 | || (*parm_table[*i].label == '-'))
|
---|
4035 | continue;
|
---|
4036 |
|
---|
4037 | if ((*i) > 0
|
---|
4038 | && (parm_table[*i].ptr ==
|
---|
4039 | parm_table[(*i) - 1].ptr))
|
---|
4040 | continue;
|
---|
4041 |
|
---|
4042 | return &parm_table[(*i)++];
|
---|
4043 | }
|
---|
4044 | } else {
|
---|
4045 | service *pService = ServicePtrs[snum];
|
---|
4046 |
|
---|
4047 | for (; parm_table[*i].label; (*i)++) {
|
---|
4048 | if (parm_table[*i].p_class == P_SEPARATOR)
|
---|
4049 | return &parm_table[(*i)++];
|
---|
4050 |
|
---|
4051 | if (parm_table[*i].p_class == P_LOCAL &&
|
---|
4052 | parm_table[*i].ptr &&
|
---|
4053 | (*parm_table[*i].label != '-') &&
|
---|
4054 | ((*i) == 0 ||
|
---|
4055 | (parm_table[*i].ptr !=
|
---|
4056 | parm_table[(*i) - 1].ptr)))
|
---|
4057 | {
|
---|
4058 | int pdiff =
|
---|
4059 | PTR_DIFF(parm_table[*i].ptr,
|
---|
4060 | &sDefault);
|
---|
4061 |
|
---|
4062 | if (allparameters ||
|
---|
4063 | !equal_parameter(parm_table[*i].type,
|
---|
4064 | ((char *)pService) +
|
---|
4065 | pdiff,
|
---|
4066 | ((char *)&sDefault) +
|
---|
4067 | pdiff))
|
---|
4068 | {
|
---|
4069 | return &parm_table[(*i)++];
|
---|
4070 | }
|
---|
4071 | }
|
---|
4072 | }
|
---|
4073 | }
|
---|
4074 |
|
---|
4075 | return NULL;
|
---|
4076 | }
|
---|
4077 |
|
---|
4078 |
|
---|
4079 | #if 0
|
---|
4080 | /***************************************************************************
|
---|
4081 | Display the contents of a single copy structure.
|
---|
4082 | ***************************************************************************/
|
---|
4083 | static void dump_copy_map(BOOL *pcopymap)
|
---|
4084 | {
|
---|
4085 | int i;
|
---|
4086 | if (!pcopymap)
|
---|
4087 | return;
|
---|
4088 |
|
---|
4089 | printf("\n\tNon-Copied parameters:\n");
|
---|
4090 |
|
---|
4091 | for (i = 0; parm_table[i].label; i++)
|
---|
4092 | if (parm_table[i].p_class == P_LOCAL &&
|
---|
4093 | parm_table[i].ptr && !pcopymap[i] &&
|
---|
4094 | (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
|
---|
4095 | {
|
---|
4096 | printf("\t\t%s\n", parm_table[i].label);
|
---|
4097 | }
|
---|
4098 | }
|
---|
4099 | #endif
|
---|
4100 |
|
---|
4101 | /***************************************************************************
|
---|
4102 | Return TRUE if the passed service number is within range.
|
---|
4103 | ***************************************************************************/
|
---|
4104 |
|
---|
4105 | BOOL lp_snum_ok(int iService)
|
---|
4106 | {
|
---|
4107 | return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
|
---|
4108 | }
|
---|
4109 |
|
---|
4110 | /***************************************************************************
|
---|
4111 | Auto-load some home services.
|
---|
4112 | ***************************************************************************/
|
---|
4113 |
|
---|
4114 | static void lp_add_auto_services(char *str)
|
---|
4115 | {
|
---|
4116 | char *s;
|
---|
4117 | char *p;
|
---|
4118 | int homes;
|
---|
4119 |
|
---|
4120 | if (!str)
|
---|
4121 | return;
|
---|
4122 |
|
---|
4123 | s = SMB_STRDUP(str);
|
---|
4124 | if (!s)
|
---|
4125 | return;
|
---|
4126 |
|
---|
4127 | homes = lp_servicenumber(HOMES_NAME);
|
---|
4128 |
|
---|
4129 | for (p = strtok(s, LIST_SEP); p; p = strtok(NULL, LIST_SEP)) {
|
---|
4130 | char *home = get_user_home_dir(p);
|
---|
4131 |
|
---|
4132 | if (lp_servicenumber(p) >= 0)
|
---|
4133 | continue;
|
---|
4134 |
|
---|
4135 | if (home && homes >= 0)
|
---|
4136 | lp_add_home(p, homes, p, home);
|
---|
4137 | }
|
---|
4138 | SAFE_FREE(s);
|
---|
4139 | }
|
---|
4140 |
|
---|
4141 | /***************************************************************************
|
---|
4142 | Auto-load one printer.
|
---|
4143 | ***************************************************************************/
|
---|
4144 |
|
---|
4145 | void lp_add_one_printer(char *name, char *comment)
|
---|
4146 | {
|
---|
4147 | int printers = lp_servicenumber(PRINTERS_NAME);
|
---|
4148 | int i;
|
---|
4149 |
|
---|
4150 | if (lp_servicenumber(name) < 0) {
|
---|
4151 | lp_add_printer(name, printers);
|
---|
4152 | if ((i = lp_servicenumber(name)) >= 0) {
|
---|
4153 | string_set(&ServicePtrs[i]->comment, comment);
|
---|
4154 | ServicePtrs[i]->autoloaded = True;
|
---|
4155 | }
|
---|
4156 | }
|
---|
4157 | }
|
---|
4158 |
|
---|
4159 | /***************************************************************************
|
---|
4160 | Have we loaded a services file yet?
|
---|
4161 | ***************************************************************************/
|
---|
4162 |
|
---|
4163 | BOOL lp_loaded(void)
|
---|
4164 | {
|
---|
4165 | return (bLoaded);
|
---|
4166 | }
|
---|
4167 |
|
---|
4168 | /***************************************************************************
|
---|
4169 | Unload unused services.
|
---|
4170 | ***************************************************************************/
|
---|
4171 |
|
---|
4172 | void lp_killunused(BOOL (*snumused) (int))
|
---|
4173 | {
|
---|
4174 | int i;
|
---|
4175 | for (i = 0; i < iNumServices; i++) {
|
---|
4176 | if (!VALID(i))
|
---|
4177 | continue;
|
---|
4178 |
|
---|
4179 | /* don't kill autoloaded or usershare services */
|
---|
4180 | if ( ServicePtrs[i]->autoloaded ||
|
---|
4181 | ServicePtrs[i]->usershare == USERSHARE_VALID) {
|
---|
4182 | continue;
|
---|
4183 | }
|
---|
4184 |
|
---|
4185 | if (!snumused || !snumused(i)) {
|
---|
4186 | free_service_byindex(i);
|
---|
4187 | }
|
---|
4188 | }
|
---|
4189 | }
|
---|
4190 |
|
---|
4191 | /***************************************************************************
|
---|
4192 | Unload a service.
|
---|
4193 | ***************************************************************************/
|
---|
4194 |
|
---|
4195 | void lp_killservice(int iServiceIn)
|
---|
4196 | {
|
---|
4197 | if (VALID(iServiceIn)) {
|
---|
4198 | free_service_byindex(iServiceIn);
|
---|
4199 | }
|
---|
4200 | }
|
---|
4201 |
|
---|
4202 | /***************************************************************************
|
---|
4203 | Save the curent values of all global and sDefault parameters into the
|
---|
4204 | defaults union. This allows swat and testparm to show only the
|
---|
4205 | changed (ie. non-default) parameters.
|
---|
4206 | ***************************************************************************/
|
---|
4207 |
|
---|
4208 | static void lp_save_defaults(void)
|
---|
4209 | {
|
---|
4210 | int i;
|
---|
4211 | for (i = 0; parm_table[i].label; i++) {
|
---|
4212 | if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
|
---|
4213 | continue;
|
---|
4214 | switch (parm_table[i].type) {
|
---|
4215 | case P_LIST:
|
---|
4216 | str_list_copy(&(parm_table[i].def.lvalue),
|
---|
4217 | *(const char ***)parm_table[i].ptr);
|
---|
4218 | break;
|
---|
4219 | case P_STRING:
|
---|
4220 | case P_USTRING:
|
---|
4221 | if (parm_table[i].ptr) {
|
---|
4222 | parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
|
---|
4223 | } else {
|
---|
4224 | parm_table[i].def.svalue = NULL;
|
---|
4225 | }
|
---|
4226 | break;
|
---|
4227 | case P_GSTRING:
|
---|
4228 | case P_UGSTRING:
|
---|
4229 | if (parm_table[i].ptr) {
|
---|
4230 | parm_table[i].def.svalue = SMB_STRDUP((char *)parm_table[i].ptr);
|
---|
4231 | } else {
|
---|
4232 | parm_table[i].def.svalue = NULL;
|
---|
4233 | }
|
---|
4234 | break;
|
---|
4235 | case P_BOOL:
|
---|
4236 | case P_BOOLREV:
|
---|
4237 | parm_table[i].def.bvalue =
|
---|
4238 | *(BOOL *)parm_table[i].ptr;
|
---|
4239 | break;
|
---|
4240 | case P_CHAR:
|
---|
4241 | parm_table[i].def.cvalue =
|
---|
4242 | *(char *)parm_table[i].ptr;
|
---|
4243 | break;
|
---|
4244 | case P_INTEGER:
|
---|
4245 | case P_OCTAL:
|
---|
4246 | case P_ENUM:
|
---|
4247 | parm_table[i].def.ivalue =
|
---|
4248 | *(int *)parm_table[i].ptr;
|
---|
4249 | break;
|
---|
4250 | case P_SEP:
|
---|
4251 | break;
|
---|
4252 | }
|
---|
4253 | }
|
---|
4254 | defaults_saved = True;
|
---|
4255 | }
|
---|
4256 |
|
---|
4257 | /*******************************************************************
|
---|
4258 | Set the server type we will announce as via nmbd.
|
---|
4259 | ********************************************************************/
|
---|
4260 |
|
---|
4261 | static const struct srv_role_tab {
|
---|
4262 | uint32 role;
|
---|
4263 | const char *role_str;
|
---|
4264 | } srv_role_tab [] = {
|
---|
4265 | { ROLE_STANDALONE, "ROLE_STANDALONE" },
|
---|
4266 | { ROLE_DOMAIN_MEMBER, "ROLE_DOMAIN_MEMBER" },
|
---|
4267 | { ROLE_DOMAIN_BDC, "ROLE_DOMAIN_BDC" },
|
---|
4268 | { ROLE_DOMAIN_PDC, "ROLE_DOMAIN_PDC" },
|
---|
4269 | { 0, NULL }
|
---|
4270 | };
|
---|
4271 |
|
---|
4272 | const char* server_role_str(uint32 role)
|
---|
4273 | {
|
---|
4274 | int i = 0;
|
---|
4275 | for (i=0; srv_role_tab[i].role_str; i++) {
|
---|
4276 | if (role == srv_role_tab[i].role) {
|
---|
4277 | return srv_role_tab[i].role_str;
|
---|
4278 | }
|
---|
4279 | }
|
---|
4280 | return NULL;
|
---|
4281 | }
|
---|
4282 |
|
---|
4283 | static void set_server_role(void)
|
---|
4284 | {
|
---|
4285 | server_role = ROLE_STANDALONE;
|
---|
4286 |
|
---|
4287 | switch (lp_security()) {
|
---|
4288 | case SEC_SHARE:
|
---|
4289 | if (lp_domain_logons())
|
---|
4290 | DEBUG(0, ("Server's Role (logon server) conflicts with share-level security\n"));
|
---|
4291 | break;
|
---|
4292 | case SEC_SERVER:
|
---|
4293 | if (lp_domain_logons())
|
---|
4294 | DEBUG(0, ("Server's Role (logon server) conflicts with server-level security\n"));
|
---|
4295 | /* this used to be considered ROLE_DOMAIN_MEMBER but that's just wrong */
|
---|
4296 | server_role = ROLE_STANDALONE;
|
---|
4297 | break;
|
---|
4298 | case SEC_DOMAIN:
|
---|
4299 | if (lp_domain_logons()) {
|
---|
4300 | DEBUG(1, ("Server's Role (logon server) NOT ADVISED with domain-level security\n"));
|
---|
4301 | server_role = ROLE_DOMAIN_BDC;
|
---|
4302 | break;
|
---|
4303 | }
|
---|
4304 | server_role = ROLE_DOMAIN_MEMBER;
|
---|
4305 | break;
|
---|
4306 | case SEC_ADS:
|
---|
4307 | if (lp_domain_logons()) {
|
---|
4308 | server_role = ROLE_DOMAIN_PDC;
|
---|
4309 | break;
|
---|
4310 | }
|
---|
4311 | server_role = ROLE_DOMAIN_MEMBER;
|
---|
4312 | break;
|
---|
4313 | case SEC_USER:
|
---|
4314 | if (lp_domain_logons()) {
|
---|
4315 |
|
---|
4316 | if (Globals.bDomainMaster) /* auto or yes */
|
---|
4317 | server_role = ROLE_DOMAIN_PDC;
|
---|
4318 | else
|
---|
4319 | server_role = ROLE_DOMAIN_BDC;
|
---|
4320 | }
|
---|
4321 | break;
|
---|
4322 | default:
|
---|
4323 | DEBUG(0, ("Server's Role undefined due to unknown security mode\n"));
|
---|
4324 | break;
|
---|
4325 | }
|
---|
4326 |
|
---|
4327 | DEBUG(10, ("set_server_role: role = %s\n", server_role_str(server_role)));
|
---|
4328 | }
|
---|
4329 |
|
---|
4330 | /***********************************************************
|
---|
4331 | If we should send plaintext/LANMAN passwords in the clinet
|
---|
4332 | ************************************************************/
|
---|
4333 |
|
---|
4334 | static void set_allowed_client_auth(void)
|
---|
4335 | {
|
---|
4336 | if (Globals.bClientNTLMv2Auth) {
|
---|
4337 | Globals.bClientLanManAuth = False;
|
---|
4338 | }
|
---|
4339 | if (!Globals.bClientLanManAuth) {
|
---|
4340 | Globals.bClientPlaintextAuth = False;
|
---|
4341 | }
|
---|
4342 | }
|
---|
4343 |
|
---|
4344 | /***************************************************************************
|
---|
4345 | JRA.
|
---|
4346 | The following code allows smbd to read a user defined share file.
|
---|
4347 | Yes, this is my intent. Yes, I'm comfortable with that...
|
---|
4348 |
|
---|
4349 | THE FOLLOWING IS SECURITY CRITICAL CODE.
|
---|
4350 |
|
---|
4351 | It washes your clothes, it cleans your house, it guards you while you sleep...
|
---|
4352 | Do not f%^k with it....
|
---|
4353 | ***************************************************************************/
|
---|
4354 |
|
---|
4355 | #define MAX_USERSHARE_FILE_SIZE (10*1024)
|
---|
4356 |
|
---|
4357 | /***************************************************************************
|
---|
4358 | Check allowed stat state of a usershare file.
|
---|
4359 | Ensure we print out who is dicking with us so the admin can
|
---|
4360 | get their sorry ass fired.
|
---|
4361 | ***************************************************************************/
|
---|
4362 |
|
---|
4363 | static BOOL check_usershare_stat(const char *fname, SMB_STRUCT_STAT *psbuf)
|
---|
4364 | {
|
---|
4365 | if (!S_ISREG(psbuf->st_mode)) {
|
---|
4366 | DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
|
---|
4367 | "not a regular file\n",
|
---|
4368 | fname, (unsigned int)psbuf->st_uid ));
|
---|
4369 | return False;
|
---|
4370 | }
|
---|
4371 |
|
---|
4372 | /* Ensure this doesn't have the other write bit set. */
|
---|
4373 | if (psbuf->st_mode & S_IWOTH) {
|
---|
4374 | DEBUG(0,("check_usershare_stat: file %s owned by uid %u allows "
|
---|
4375 | "public write. Refusing to allow as a usershare file.\n",
|
---|
4376 | fname, (unsigned int)psbuf->st_uid ));
|
---|
4377 | return False;
|
---|
4378 | }
|
---|
4379 |
|
---|
4380 | /* Should be 10k or less. */
|
---|
4381 | if (psbuf->st_size > MAX_USERSHARE_FILE_SIZE) {
|
---|
4382 | DEBUG(0,("check_usershare_stat: file %s owned by uid %u is "
|
---|
4383 | "too large (%u) to be a user share file.\n",
|
---|
4384 | fname, (unsigned int)psbuf->st_uid,
|
---|
4385 | (unsigned int)psbuf->st_size ));
|
---|
4386 | return False;
|
---|
4387 | }
|
---|
4388 |
|
---|
4389 | return True;
|
---|
4390 | }
|
---|
4391 |
|
---|
4392 | /***************************************************************************
|
---|
4393 | Parse the contents of a usershare file.
|
---|
4394 | ***************************************************************************/
|
---|
4395 |
|
---|
4396 | enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
|
---|
4397 | SMB_STRUCT_STAT *psbuf,
|
---|
4398 | const char *servicename,
|
---|
4399 | int snum,
|
---|
4400 | char **lines,
|
---|
4401 | int numlines,
|
---|
4402 | pstring sharepath,
|
---|
4403 | pstring comment,
|
---|
4404 | SEC_DESC **ppsd,
|
---|
4405 | BOOL *pallow_guest)
|
---|
4406 | {
|
---|
4407 | const char **prefixallowlist = lp_usershare_prefix_allow_list();
|
---|
4408 | const char **prefixdenylist = lp_usershare_prefix_deny_list();
|
---|
4409 | int us_vers;
|
---|
4410 | SMB_STRUCT_DIR *dp;
|
---|
4411 | SMB_STRUCT_STAT sbuf;
|
---|
4412 |
|
---|
4413 | *pallow_guest = False;
|
---|
4414 |
|
---|
4415 | if (numlines < 4) {
|
---|
4416 | return USERSHARE_MALFORMED_FILE;
|
---|
4417 | }
|
---|
4418 |
|
---|
4419 | if (strcmp(lines[0], "#VERSION 1") == 0) {
|
---|
4420 | us_vers = 1;
|
---|
4421 | } else if (strcmp(lines[0], "#VERSION 2") == 0) {
|
---|
4422 | us_vers = 2;
|
---|
4423 | if (numlines < 5) {
|
---|
4424 | return USERSHARE_MALFORMED_FILE;
|
---|
4425 | }
|
---|
4426 | } else {
|
---|
4427 | return USERSHARE_BAD_VERSION;
|
---|
4428 | }
|
---|
4429 |
|
---|
4430 | if (strncmp(lines[1], "path=", 5) != 0) {
|
---|
4431 | return USERSHARE_MALFORMED_PATH;
|
---|
4432 | }
|
---|
4433 |
|
---|
4434 | pstrcpy(sharepath, &lines[1][5]);
|
---|
4435 | trim_string(sharepath, " ", " ");
|
---|
4436 |
|
---|
4437 | if (strncmp(lines[2], "comment=", 8) != 0) {
|
---|
4438 | return USERSHARE_MALFORMED_COMMENT_DEF;
|
---|
4439 | }
|
---|
4440 |
|
---|
4441 | pstrcpy(comment, &lines[2][8]);
|
---|
4442 | trim_string(comment, " ", " ");
|
---|
4443 | trim_char(comment, '"', '"');
|
---|
4444 |
|
---|
4445 | if (strncmp(lines[3], "usershare_acl=", 14) != 0) {
|
---|
4446 | return USERSHARE_MALFORMED_ACL_DEF;
|
---|
4447 | }
|
---|
4448 |
|
---|
4449 | if (!parse_usershare_acl(ctx, &lines[3][14], ppsd)) {
|
---|
4450 | return USERSHARE_ACL_ERR;
|
---|
4451 | }
|
---|
4452 |
|
---|
4453 | if (us_vers == 2) {
|
---|
4454 | if (strncmp(lines[4], "guest_ok=", 9) != 0) {
|
---|
4455 | return USERSHARE_MALFORMED_ACL_DEF;
|
---|
4456 | }
|
---|
4457 | if (lines[4][9] == 'y') {
|
---|
4458 | *pallow_guest = True;
|
---|
4459 | }
|
---|
4460 | }
|
---|
4461 |
|
---|
4462 | if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
|
---|
4463 | /* Path didn't change, no checks needed. */
|
---|
4464 | return USERSHARE_OK;
|
---|
4465 | }
|
---|
4466 |
|
---|
4467 | /* The path *must* be absolute. */
|
---|
4468 | if (sharepath[0] != '/') {
|
---|
4469 | DEBUG(2,("parse_usershare_file: share %s: path %s is not an absolute path.\n",
|
---|
4470 | servicename, sharepath));
|
---|
4471 | return USERSHARE_PATH_NOT_ABSOLUTE;
|
---|
4472 | }
|
---|
4473 |
|
---|
4474 | /* If there is a usershare prefix deny list ensure one of these paths
|
---|
4475 | doesn't match the start of the user given path. */
|
---|
4476 | if (prefixdenylist) {
|
---|
4477 | int i;
|
---|
4478 | for ( i=0; prefixdenylist[i]; i++ ) {
|
---|
4479 | DEBUG(10,("parse_usershare_file: share %s : checking prefixdenylist[%d]='%s' against %s\n",
|
---|
4480 | servicename, i, prefixdenylist[i], sharepath ));
|
---|
4481 | if (memcmp( sharepath, prefixdenylist[i], strlen(prefixdenylist[i])) == 0) {
|
---|
4482 | DEBUG(2,("parse_usershare_file: share %s path %s starts with one of the "
|
---|
4483 | "usershare prefix deny list entries.\n",
|
---|
4484 | servicename, sharepath));
|
---|
4485 | return USERSHARE_PATH_IS_DENIED;
|
---|
4486 | }
|
---|
4487 | }
|
---|
4488 | }
|
---|
4489 |
|
---|
4490 | /* If there is a usershare prefix allow list ensure one of these paths
|
---|
4491 | does match the start of the user given path. */
|
---|
4492 |
|
---|
4493 | if (prefixallowlist) {
|
---|
4494 | int i;
|
---|
4495 | for ( i=0; prefixallowlist[i]; i++ ) {
|
---|
4496 | DEBUG(10,("parse_usershare_file: share %s checking prefixallowlist[%d]='%s' against %s\n",
|
---|
4497 | servicename, i, prefixallowlist[i], sharepath ));
|
---|
4498 | if (memcmp( sharepath, prefixallowlist[i], strlen(prefixallowlist[i])) == 0) {
|
---|
4499 | break;
|
---|
4500 | }
|
---|
4501 | }
|
---|
4502 | if (prefixallowlist[i] == NULL) {
|
---|
4503 | DEBUG(2,("parse_usershare_file: share %s path %s doesn't start with one of the "
|
---|
4504 | "usershare prefix allow list entries.\n",
|
---|
4505 | servicename, sharepath));
|
---|
4506 | return USERSHARE_PATH_NOT_ALLOWED;
|
---|
4507 | }
|
---|
4508 | }
|
---|
4509 |
|
---|
4510 | /* Ensure this is pointing to a directory. */
|
---|
4511 | dp = sys_opendir(sharepath);
|
---|
4512 |
|
---|
4513 | if (!dp) {
|
---|
4514 | DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
|
---|
4515 | servicename, sharepath));
|
---|
4516 | return USERSHARE_PATH_NOT_DIRECTORY;
|
---|
4517 | }
|
---|
4518 |
|
---|
4519 | /* Ensure the owner of the usershare file has permission to share
|
---|
4520 | this directory. */
|
---|
4521 |
|
---|
4522 | if (sys_stat(sharepath, &sbuf) == -1) {
|
---|
4523 | DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
|
---|
4524 | servicename, sharepath, strerror(errno) ));
|
---|
4525 | sys_closedir(dp);
|
---|
4526 | return USERSHARE_POSIX_ERR;
|
---|
4527 | }
|
---|
4528 |
|
---|
4529 | sys_closedir(dp);
|
---|
4530 |
|
---|
4531 | if (!S_ISDIR(sbuf.st_mode)) {
|
---|
4532 | DEBUG(2,("parse_usershare_file: share %s path %s is not a directory.\n",
|
---|
4533 | servicename, sharepath ));
|
---|
4534 | return USERSHARE_PATH_NOT_DIRECTORY;
|
---|
4535 | }
|
---|
4536 |
|
---|
4537 | /* Check if sharing is restricted to owner-only. */
|
---|
4538 | /* psbuf is the stat of the usershare definition file,
|
---|
4539 | sbuf is the stat of the target directory to be shared. */
|
---|
4540 |
|
---|
4541 | if (lp_usershare_owner_only()) {
|
---|
4542 | /* root can share anything. */
|
---|
4543 | if ((psbuf->st_uid != 0) && (sbuf.st_uid != psbuf->st_uid)) {
|
---|
4544 | return USERSHARE_PATH_NOT_ALLOWED;
|
---|
4545 | }
|
---|
4546 | }
|
---|
4547 |
|
---|
4548 | return USERSHARE_OK;
|
---|
4549 | }
|
---|
4550 |
|
---|
4551 | /***************************************************************************
|
---|
4552 | Deal with a usershare file.
|
---|
4553 | Returns:
|
---|
4554 | >= 0 - snum
|
---|
4555 | -1 - Bad name, invalid contents.
|
---|
4556 | - service name already existed and not a usershare, problem
|
---|
4557 | with permissions to share directory etc.
|
---|
4558 | ***************************************************************************/
|
---|
4559 |
|
---|
4560 | static int process_usershare_file(const char *dir_name, const char *file_name, int snum_template)
|
---|
4561 | {
|
---|
4562 | SMB_STRUCT_STAT sbuf;
|
---|
4563 | SMB_STRUCT_STAT lsbuf;
|
---|
4564 | pstring fname;
|
---|
4565 | pstring sharepath;
|
---|
4566 | pstring comment;
|
---|
4567 | fstring service_name;
|
---|
4568 | char **lines = NULL;
|
---|
4569 | int numlines = 0;
|
---|
4570 | int fd = -1;
|
---|
4571 | int iService = -1;
|
---|
4572 | TALLOC_CTX *ctx = NULL;
|
---|
4573 | SEC_DESC *psd = NULL;
|
---|
4574 | BOOL guest_ok = False;
|
---|
4575 |
|
---|
4576 | /* Ensure share name doesn't contain invalid characters. */
|
---|
4577 | if (!validate_net_name(file_name, INVALID_SHARENAME_CHARS, strlen(file_name))) {
|
---|
4578 | DEBUG(0,("process_usershare_file: share name %s contains "
|
---|
4579 | "invalid characters (any of %s)\n",
|
---|
4580 | file_name, INVALID_SHARENAME_CHARS ));
|
---|
4581 | return -1;
|
---|
4582 | }
|
---|
4583 |
|
---|
4584 | fstrcpy(service_name, file_name);
|
---|
4585 |
|
---|
4586 | pstrcpy(fname, dir_name);
|
---|
4587 | pstrcat(fname, "/");
|
---|
4588 | pstrcat(fname, file_name);
|
---|
4589 |
|
---|
4590 | /* Minimize the race condition by doing an lstat before we
|
---|
4591 | open and fstat. Ensure this isn't a symlink link. */
|
---|
4592 |
|
---|
4593 | if (sys_lstat(fname, &lsbuf) != 0) {
|
---|
4594 | DEBUG(0,("process_usershare_file: stat of %s failed. %s\n",
|
---|
4595 | fname, strerror(errno) ));
|
---|
4596 | return -1;
|
---|
4597 | }
|
---|
4598 |
|
---|
4599 | /* This must be a regular file, not a symlink, directory or
|
---|
4600 | other strange filetype. */
|
---|
4601 | if (!check_usershare_stat(fname, &lsbuf)) {
|
---|
4602 | return -1;
|
---|
4603 | }
|
---|
4604 |
|
---|
4605 | /* See if there is already a servicenum for this name. */
|
---|
4606 | /* tdb_fetch_int32 returns -1 if not found. */
|
---|
4607 | iService = (int)tdb_fetch_int32(ServiceHash, canonicalize_servicename(service_name) );
|
---|
4608 |
|
---|
4609 | if (iService != -1 && ServicePtrs[iService]->usershare_last_mod == lsbuf.st_mtime) {
|
---|
4610 | /* Nothing changed - Mark valid and return. */
|
---|
4611 | DEBUG(10,("process_usershare_file: service %s not changed.\n",
|
---|
4612 | service_name ));
|
---|
4613 | ServicePtrs[iService]->usershare = USERSHARE_VALID;
|
---|
4614 | return iService;
|
---|
4615 | }
|
---|
4616 |
|
---|
4617 | /* Try and open the file read only - no symlinks allowed. */
|
---|
4618 | #ifdef O_NOFOLLOW
|
---|
4619 | fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
|
---|
4620 | #else
|
---|
4621 | fd = sys_open(fname, O_RDONLY, 0);
|
---|
4622 | #endif
|
---|
4623 |
|
---|
4624 | if (fd == -1) {
|
---|
4625 | DEBUG(0,("process_usershare_file: unable to open %s. %s\n",
|
---|
4626 | fname, strerror(errno) ));
|
---|
4627 | return -1;
|
---|
4628 | }
|
---|
4629 |
|
---|
4630 | /* Now fstat to be *SURE* it's a regular file. */
|
---|
4631 | if (sys_fstat(fd, &sbuf) != 0) {
|
---|
4632 | close(fd);
|
---|
4633 | DEBUG(0,("process_usershare_file: fstat of %s failed. %s\n",
|
---|
4634 | fname, strerror(errno) ));
|
---|
4635 | return -1;
|
---|
4636 | }
|
---|
4637 |
|
---|
4638 | /* Is it the same dev/inode as was lstated ? */
|
---|
4639 | if (lsbuf.st_dev != sbuf.st_dev || lsbuf.st_ino != sbuf.st_ino) {
|
---|
4640 | close(fd);
|
---|
4641 | DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
|
---|
4642 | "Symlink spoofing going on ?\n", fname ));
|
---|
4643 | return -1;
|
---|
4644 | }
|
---|
4645 |
|
---|
4646 | /* This must be a regular file, not a symlink, directory or
|
---|
4647 | other strange filetype. */
|
---|
4648 | if (!check_usershare_stat(fname, &sbuf)) {
|
---|
4649 | return -1;
|
---|
4650 | }
|
---|
4651 |
|
---|
4652 | lines = fd_lines_load(fd, &numlines, MAX_USERSHARE_FILE_SIZE);
|
---|
4653 |
|
---|
4654 | close(fd);
|
---|
4655 | if (lines == NULL) {
|
---|
4656 | DEBUG(0,("process_usershare_file: loading file %s owned by %u failed.\n",
|
---|
4657 | fname, (unsigned int)sbuf.st_uid ));
|
---|
4658 | return -1;
|
---|
4659 | }
|
---|
4660 |
|
---|
4661 | /* Should we allow printers to be shared... ? */
|
---|
4662 | ctx = talloc_init("usershare_sd_xctx");
|
---|
4663 | if (!ctx) {
|
---|
4664 | file_lines_free(lines);
|
---|
4665 | return 1;
|
---|
4666 | }
|
---|
4667 |
|
---|
4668 | if (parse_usershare_file(ctx, &sbuf, service_name,
|
---|
4669 | iService, lines, numlines, sharepath,
|
---|
4670 | comment, &psd, &guest_ok) != USERSHARE_OK) {
|
---|
4671 | talloc_destroy(ctx);
|
---|
4672 | file_lines_free(lines);
|
---|
4673 | return -1;
|
---|
4674 | }
|
---|
4675 |
|
---|
4676 | file_lines_free(lines);
|
---|
4677 |
|
---|
4678 | /* Everything ok - add the service possibly using a template. */
|
---|
4679 | if (iService < 0) {
|
---|
4680 | const service *sp = &sDefault;
|
---|
4681 | if (snum_template != -1) {
|
---|
4682 | sp = ServicePtrs[snum_template];
|
---|
4683 | }
|
---|
4684 |
|
---|
4685 | if ((iService = add_a_service(sp, service_name)) < 0) {
|
---|
4686 | DEBUG(0, ("process_usershare_file: Failed to add "
|
---|
4687 | "new service %s\n", service_name));
|
---|
4688 | talloc_destroy(ctx);
|
---|
4689 | return -1;
|
---|
4690 | }
|
---|
4691 |
|
---|
4692 | /* Read only is controlled by usershare ACL below. */
|
---|
4693 | ServicePtrs[iService]->bRead_only = False;
|
---|
4694 | }
|
---|
4695 |
|
---|
4696 | /* Write the ACL of the new/modified share. */
|
---|
4697 | if (!set_share_security(service_name, psd)) {
|
---|
4698 | DEBUG(0, ("process_usershare_file: Failed to set share "
|
---|
4699 | "security for user share %s\n",
|
---|
4700 | service_name ));
|
---|
4701 | lp_remove_service(iService);
|
---|
4702 | talloc_destroy(ctx);
|
---|
4703 | return -1;
|
---|
4704 | }
|
---|
4705 |
|
---|
4706 | talloc_destroy(ctx);
|
---|
4707 |
|
---|
4708 | /* If from a template it may be marked invalid. */
|
---|
4709 | ServicePtrs[iService]->valid = True;
|
---|
4710 |
|
---|
4711 | /* Set the service as a valid usershare. */
|
---|
4712 | ServicePtrs[iService]->usershare = USERSHARE_VALID;
|
---|
4713 |
|
---|
4714 | /* Set guest access. */
|
---|
4715 | if (lp_usershare_allow_guests()) {
|
---|
4716 | ServicePtrs[iService]->bGuest_ok = guest_ok;
|
---|
4717 | }
|
---|
4718 |
|
---|
4719 | /* And note when it was loaded. */
|
---|
4720 | ServicePtrs[iService]->usershare_last_mod = sbuf.st_mtime;
|
---|
4721 | string_set(&ServicePtrs[iService]->szPath, sharepath);
|
---|
4722 | string_set(&ServicePtrs[iService]->comment, comment);
|
---|
4723 |
|
---|
4724 | return iService;
|
---|
4725 | }
|
---|
4726 |
|
---|
4727 | /***************************************************************************
|
---|
4728 | Checks if a usershare entry has been modified since last load.
|
---|
4729 | ***************************************************************************/
|
---|
4730 |
|
---|
4731 | static BOOL usershare_exists(int iService, time_t *last_mod)
|
---|
4732 | {
|
---|
4733 | SMB_STRUCT_STAT lsbuf;
|
---|
4734 | const char *usersharepath = Globals.szUsersharePath;
|
---|
4735 | pstring fname;
|
---|
4736 |
|
---|
4737 | pstrcpy(fname, usersharepath);
|
---|
4738 | pstrcat(fname, "/");
|
---|
4739 | pstrcat(fname, ServicePtrs[iService]->szService);
|
---|
4740 |
|
---|
4741 | if (sys_lstat(fname, &lsbuf) != 0) {
|
---|
4742 | return False;
|
---|
4743 | }
|
---|
4744 |
|
---|
4745 | if (!S_ISREG(lsbuf.st_mode)) {
|
---|
4746 | return False;
|
---|
4747 | }
|
---|
4748 |
|
---|
4749 | *last_mod = lsbuf.st_mtime;
|
---|
4750 | return True;
|
---|
4751 | }
|
---|
4752 |
|
---|
4753 | /***************************************************************************
|
---|
4754 | Load a usershare service by name. Returns a valid servicenumber or -1.
|
---|
4755 | ***************************************************************************/
|
---|
4756 |
|
---|
4757 | int load_usershare_service(const char *servicename)
|
---|
4758 | {
|
---|
4759 | SMB_STRUCT_STAT sbuf;
|
---|
4760 | const char *usersharepath = Globals.szUsersharePath;
|
---|
4761 | int max_user_shares = Globals.iUsershareMaxShares;
|
---|
4762 | int snum_template = -1;
|
---|
4763 |
|
---|
4764 | if (*usersharepath == 0 || max_user_shares == 0) {
|
---|
4765 | return -1;
|
---|
4766 | }
|
---|
4767 |
|
---|
4768 | if (sys_stat(usersharepath, &sbuf) != 0) {
|
---|
4769 | DEBUG(0,("load_usershare_service: stat of %s failed. %s\n",
|
---|
4770 | usersharepath, strerror(errno) ));
|
---|
4771 | return -1;
|
---|
4772 | }
|
---|
4773 |
|
---|
4774 | if (!S_ISDIR(sbuf.st_mode)) {
|
---|
4775 | DEBUG(0,("load_usershare_service: %s is not a directory.\n",
|
---|
4776 | usersharepath ));
|
---|
4777 | return -1;
|
---|
4778 | }
|
---|
4779 |
|
---|
4780 | /*
|
---|
4781 | * This directory must be owned by root, and have the 't' bit set.
|
---|
4782 | * It also must not be writable by "other".
|
---|
4783 | */
|
---|
4784 |
|
---|
4785 | #ifdef S_ISVTX
|
---|
4786 | if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
|
---|
4787 | #else
|
---|
4788 | if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
|
---|
4789 | #endif
|
---|
4790 | DEBUG(0,("load_usershare_service: directory %s is not owned by root "
|
---|
4791 | "or does not have the sticky bit 't' set or is writable by anyone.\n",
|
---|
4792 | usersharepath ));
|
---|
4793 | return -1;
|
---|
4794 | }
|
---|
4795 |
|
---|
4796 | /* Ensure the template share exists if it's set. */
|
---|
4797 | if (Globals.szUsershareTemplateShare[0]) {
|
---|
4798 | /* We can't use lp_servicenumber here as we are recommending that
|
---|
4799 | template shares have -valid=False set. */
|
---|
4800 | for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
|
---|
4801 | if (ServicePtrs[snum_template]->szService &&
|
---|
4802 | strequal(ServicePtrs[snum_template]->szService,
|
---|
4803 | Globals.szUsershareTemplateShare)) {
|
---|
4804 | break;
|
---|
4805 | }
|
---|
4806 | }
|
---|
4807 |
|
---|
4808 | if (snum_template == -1) {
|
---|
4809 | DEBUG(0,("load_usershare_service: usershare template share %s "
|
---|
4810 | "does not exist.\n",
|
---|
4811 | Globals.szUsershareTemplateShare ));
|
---|
4812 | return -1;
|
---|
4813 | }
|
---|
4814 | }
|
---|
4815 |
|
---|
4816 | return process_usershare_file(usersharepath, servicename, snum_template);
|
---|
4817 | }
|
---|
4818 |
|
---|
4819 | /***************************************************************************
|
---|
4820 | Load all user defined shares from the user share directory.
|
---|
4821 | We only do this if we're enumerating the share list.
|
---|
4822 | This is the function that can delete usershares that have
|
---|
4823 | been removed.
|
---|
4824 | ***************************************************************************/
|
---|
4825 |
|
---|
4826 | int load_usershare_shares(void)
|
---|
4827 | {
|
---|
4828 | SMB_STRUCT_DIR *dp;
|
---|
4829 | SMB_STRUCT_STAT sbuf;
|
---|
4830 | SMB_STRUCT_DIRENT *de;
|
---|
4831 | int num_usershares = 0;
|
---|
4832 | int max_user_shares = Globals.iUsershareMaxShares;
|
---|
4833 | unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
|
---|
4834 | unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
|
---|
4835 | unsigned int allowed_tmp_entries = ((2*max_user_shares)/10);
|
---|
4836 | int iService;
|
---|
4837 | int snum_template = -1;
|
---|
4838 | const char *usersharepath = Globals.szUsersharePath;
|
---|
4839 | int ret = lp_numservices();
|
---|
4840 |
|
---|
4841 | if (max_user_shares == 0 || *usersharepath == '\0') {
|
---|
4842 | return lp_numservices();
|
---|
4843 | }
|
---|
4844 |
|
---|
4845 | if (sys_stat(usersharepath, &sbuf) != 0) {
|
---|
4846 | DEBUG(0,("load_usershare_shares: stat of %s failed. %s\n",
|
---|
4847 | usersharepath, strerror(errno) ));
|
---|
4848 | return ret;
|
---|
4849 | }
|
---|
4850 |
|
---|
4851 | /*
|
---|
4852 | * This directory must be owned by root, and have the 't' bit set.
|
---|
4853 | * It also must not be writable by "other".
|
---|
4854 | */
|
---|
4855 |
|
---|
4856 | #ifdef S_ISVTX
|
---|
4857 | if (sbuf.st_uid != 0 || !(sbuf.st_mode & S_ISVTX) || (sbuf.st_mode & S_IWOTH)) {
|
---|
4858 | #else
|
---|
4859 | if (sbuf.st_uid != 0 || (sbuf.st_mode & S_IWOTH)) {
|
---|
4860 | #endif
|
---|
4861 | DEBUG(0,("load_usershare_shares: directory %s is not owned by root "
|
---|
4862 | "or does not have the sticky bit 't' set or is writable by anyone.\n",
|
---|
4863 | usersharepath ));
|
---|
4864 | return ret;
|
---|
4865 | }
|
---|
4866 |
|
---|
4867 | /* Ensure the template share exists if it's set. */
|
---|
4868 | if (Globals.szUsershareTemplateShare[0]) {
|
---|
4869 | /* We can't use lp_servicenumber here as we are recommending that
|
---|
4870 | template shares have -valid=False set. */
|
---|
4871 | for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
|
---|
4872 | if (ServicePtrs[snum_template]->szService &&
|
---|
4873 | strequal(ServicePtrs[snum_template]->szService,
|
---|
4874 | Globals.szUsershareTemplateShare)) {
|
---|
4875 | break;
|
---|
4876 | }
|
---|
4877 | }
|
---|
4878 |
|
---|
4879 | if (snum_template == -1) {
|
---|
4880 | DEBUG(0,("load_usershare_shares: usershare template share %s "
|
---|
4881 | "does not exist.\n",
|
---|
4882 | Globals.szUsershareTemplateShare ));
|
---|
4883 | return ret;
|
---|
4884 | }
|
---|
4885 | }
|
---|
4886 |
|
---|
4887 | /* Mark all existing usershares as pending delete. */
|
---|
4888 | for (iService = iNumServices - 1; iService >= 0; iService--) {
|
---|
4889 | if (VALID(iService) && ServicePtrs[iService]->usershare) {
|
---|
4890 | ServicePtrs[iService]->usershare = USERSHARE_PENDING_DELETE;
|
---|
4891 | }
|
---|
4892 | }
|
---|
4893 |
|
---|
4894 | dp = sys_opendir(usersharepath);
|
---|
4895 | if (!dp) {
|
---|
4896 | DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
|
---|
4897 | usersharepath, strerror(errno) ));
|
---|
4898 | return ret;
|
---|
4899 | }
|
---|
4900 |
|
---|
4901 | for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
|
---|
4902 | (de = sys_readdir(dp));
|
---|
4903 | num_dir_entries++ ) {
|
---|
4904 | int r;
|
---|
4905 | const char *n = de->d_name;
|
---|
4906 |
|
---|
4907 | /* Ignore . and .. */
|
---|
4908 | if (*n == '.') {
|
---|
4909 | if ((n[1] == '\0') || (n[1] == '.' && n[2] == '\0')) {
|
---|
4910 | continue;
|
---|
4911 | }
|
---|
4912 | }
|
---|
4913 |
|
---|
4914 | if (n[0] == ':') {
|
---|
4915 | /* Temporary file used when creating a share. */
|
---|
4916 | num_tmp_dir_entries++;
|
---|
4917 | }
|
---|
4918 |
|
---|
4919 | /* Allow 20% tmp entries. */
|
---|
4920 | if (num_tmp_dir_entries > allowed_tmp_entries) {
|
---|
4921 | DEBUG(0,("load_usershare_shares: too many temp entries (%u) "
|
---|
4922 | "in directory %s\n",
|
---|
4923 | num_tmp_dir_entries, usersharepath));
|
---|
4924 | break;
|
---|
4925 | }
|
---|
4926 |
|
---|
4927 | r = process_usershare_file(usersharepath, n, snum_template);
|
---|
4928 | if (r == 0) {
|
---|
4929 | /* Update the services count. */
|
---|
4930 | num_usershares++;
|
---|
4931 | if (num_usershares >= max_user_shares) {
|
---|
4932 | DEBUG(0,("load_usershare_shares: max user shares reached "
|
---|
4933 | "on file %s in directory %s\n",
|
---|
4934 | n, usersharepath ));
|
---|
4935 | break;
|
---|
4936 | }
|
---|
4937 | } else if (r == -1) {
|
---|
4938 | num_bad_dir_entries++;
|
---|
4939 | }
|
---|
4940 |
|
---|
4941 | /* Allow 20% bad entries. */
|
---|
4942 | if (num_bad_dir_entries > allowed_bad_entries) {
|
---|
4943 | DEBUG(0,("load_usershare_shares: too many bad entries (%u) "
|
---|
4944 | "in directory %s\n",
|
---|
4945 | num_bad_dir_entries, usersharepath));
|
---|
4946 | break;
|
---|
4947 | }
|
---|
4948 |
|
---|
4949 | /* Allow 20% bad entries. */
|
---|
4950 | if (num_dir_entries > max_user_shares + allowed_bad_entries) {
|
---|
4951 | DEBUG(0,("load_usershare_shares: too many total entries (%u) "
|
---|
4952 | "in directory %s\n",
|
---|
4953 | num_dir_entries, usersharepath));
|
---|
4954 | break;
|
---|
4955 | }
|
---|
4956 | }
|
---|
4957 |
|
---|
4958 | sys_closedir(dp);
|
---|
4959 |
|
---|
4960 | /* Sweep through and delete any non-refreshed usershares that are
|
---|
4961 | not currently in use. */
|
---|
4962 | for (iService = iNumServices - 1; iService >= 0; iService--) {
|
---|
4963 | if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
|
---|
4964 | if (conn_snum_used(iService)) {
|
---|
4965 | continue;
|
---|
4966 | }
|
---|
4967 | /* Remove from the share ACL db. */
|
---|
4968 | DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
|
---|
4969 | lp_servicename(iService) ));
|
---|
4970 | delete_share_security(snum2params_static(iService));
|
---|
4971 | free_service_byindex(iService);
|
---|
4972 | }
|
---|
4973 | }
|
---|
4974 |
|
---|
4975 | return lp_numservices();
|
---|
4976 | }
|
---|
4977 |
|
---|
4978 | /********************************************************
|
---|
4979 | Destroy global resources allocated in this file
|
---|
4980 | ********************************************************/
|
---|
4981 |
|
---|
4982 | void gfree_loadparm(void)
|
---|
4983 | {
|
---|
4984 | struct file_lists *f;
|
---|
4985 | struct file_lists *next;
|
---|
4986 | int i;
|
---|
4987 |
|
---|
4988 | lp_TALLOC_FREE();
|
---|
4989 |
|
---|
4990 | /* Free the file lists */
|
---|
4991 |
|
---|
4992 | f = file_lists;
|
---|
4993 | while( f ) {
|
---|
4994 | next = f->next;
|
---|
4995 | SAFE_FREE( f->name );
|
---|
4996 | SAFE_FREE( f->subfname );
|
---|
4997 | SAFE_FREE( f );
|
---|
4998 | f = next;
|
---|
4999 | }
|
---|
5000 |
|
---|
5001 | /* Free resources allocated to services */
|
---|
5002 |
|
---|
5003 | for ( i = 0; i < iNumServices; i++ ) {
|
---|
5004 | if ( VALID(i) ) {
|
---|
5005 | free_service_byindex(i);
|
---|
5006 | }
|
---|
5007 | }
|
---|
5008 |
|
---|
5009 | SAFE_FREE( ServicePtrs );
|
---|
5010 | iNumServices = 0;
|
---|
5011 |
|
---|
5012 | /* Now release all resources allocated to global
|
---|
5013 | parameters and the default service */
|
---|
5014 |
|
---|
5015 | for (i = 0; parm_table[i].label; i++)
|
---|
5016 | {
|
---|
5017 | if ( parm_table[i].type == P_STRING
|
---|
5018 | || parm_table[i].type == P_USTRING )
|
---|
5019 | {
|
---|
5020 | string_free( (char**)parm_table[i].ptr );
|
---|
5021 | }
|
---|
5022 | else if (parm_table[i].type == P_LIST) {
|
---|
5023 | str_list_free( (char***)parm_table[i].ptr );
|
---|
5024 | }
|
---|
5025 | }
|
---|
5026 | }
|
---|
5027 |
|
---|
5028 | /***************************************************************************
|
---|
5029 | Load the services array from the services file. Return True on success,
|
---|
5030 | False on failure.
|
---|
5031 | ***************************************************************************/
|
---|
5032 |
|
---|
5033 | BOOL lp_load(const char *pszFname,
|
---|
5034 | BOOL global_only,
|
---|
5035 | BOOL save_defaults,
|
---|
5036 | BOOL add_ipc,
|
---|
5037 | BOOL initialize_globals)
|
---|
5038 | {
|
---|
5039 | pstring n2;
|
---|
5040 | BOOL bRetval;
|
---|
5041 | param_opt_struct *data, *pdata;
|
---|
5042 |
|
---|
5043 | pstrcpy(n2, pszFname);
|
---|
5044 |
|
---|
5045 | standard_sub_basic( get_current_username(), current_user_info.domain,
|
---|
5046 | n2,sizeof(n2) );
|
---|
5047 |
|
---|
5048 | add_to_file_list(pszFname, n2);
|
---|
5049 |
|
---|
5050 | bRetval = False;
|
---|
5051 |
|
---|
5052 | DEBUG(3, ("lp_load: refreshing parameters\n"));
|
---|
5053 |
|
---|
5054 | bInGlobalSection = True;
|
---|
5055 | bGlobalOnly = global_only;
|
---|
5056 |
|
---|
5057 | init_globals(! initialize_globals);
|
---|
5058 | debug_init();
|
---|
5059 |
|
---|
5060 | if (save_defaults) {
|
---|
5061 | init_locals();
|
---|
5062 | lp_save_defaults();
|
---|
5063 | }
|
---|
5064 |
|
---|
5065 | if (Globals.param_opt != NULL) {
|
---|
5066 | data = Globals.param_opt;
|
---|
5067 | while (data) {
|
---|
5068 | string_free(&data->key);
|
---|
5069 | string_free(&data->value);
|
---|
5070 | str_list_free(&data->list);
|
---|
5071 | pdata = data->next;
|
---|
5072 | SAFE_FREE(data);
|
---|
5073 | data = pdata;
|
---|
5074 | }
|
---|
5075 | Globals.param_opt = NULL;
|
---|
5076 | }
|
---|
5077 |
|
---|
5078 | /* We get sections first, so have to start 'behind' to make up */
|
---|
5079 | iServiceIndex = -1;
|
---|
5080 | bRetval = pm_process(n2, do_section, do_parameter);
|
---|
5081 |
|
---|
5082 | /* finish up the last section */
|
---|
5083 | DEBUG(4, ("pm_process() returned %s\n", BOOLSTR(bRetval)));
|
---|
5084 | if (bRetval)
|
---|
5085 | if (iServiceIndex >= 0)
|
---|
5086 | bRetval = service_ok(iServiceIndex);
|
---|
5087 |
|
---|
5088 | lp_add_auto_services(lp_auto_services());
|
---|
5089 |
|
---|
5090 | if (add_ipc) {
|
---|
5091 | /* When 'restrict anonymous = 2' guest connections to ipc$
|
---|
5092 | are denied */
|
---|
5093 | lp_add_ipc("IPC$", (lp_restrict_anonymous() < 2));
|
---|
5094 | if ( lp_enable_asu_support() )
|
---|
5095 | lp_add_ipc("ADMIN$", False);
|
---|
5096 | }
|
---|
5097 |
|
---|
5098 | set_server_role();
|
---|
5099 | set_default_server_announce_type();
|
---|
5100 | set_allowed_client_auth();
|
---|
5101 |
|
---|
5102 | bLoaded = True;
|
---|
5103 |
|
---|
5104 | /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
|
---|
5105 | /* if bWINSsupport is true and we are in the client */
|
---|
5106 | if (in_client && Globals.bWINSsupport) {
|
---|
5107 | lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
|
---|
5108 | }
|
---|
5109 |
|
---|
5110 | init_iconv();
|
---|
5111 |
|
---|
5112 | return (bRetval);
|
---|
5113 | }
|
---|
5114 |
|
---|
5115 | /***************************************************************************
|
---|
5116 | Reset the max number of services.
|
---|
5117 | ***************************************************************************/
|
---|
5118 |
|
---|
5119 | void lp_resetnumservices(void)
|
---|
5120 | {
|
---|
5121 | iNumServices = 0;
|
---|
5122 | }
|
---|
5123 |
|
---|
5124 | /***************************************************************************
|
---|
5125 | Return the max number of services.
|
---|
5126 | ***************************************************************************/
|
---|
5127 |
|
---|
5128 | int lp_numservices(void)
|
---|
5129 | {
|
---|
5130 | return (iNumServices);
|
---|
5131 | }
|
---|
5132 |
|
---|
5133 | /***************************************************************************
|
---|
5134 | Display the contents of the services array in human-readable form.
|
---|
5135 | ***************************************************************************/
|
---|
5136 |
|
---|
5137 | void lp_dump(FILE *f, BOOL show_defaults, int maxtoprint)
|
---|
5138 | {
|
---|
5139 | int iService;
|
---|
5140 |
|
---|
5141 | if (show_defaults)
|
---|
5142 | defaults_saved = False;
|
---|
5143 |
|
---|
5144 | dump_globals(f);
|
---|
5145 |
|
---|
5146 | dump_a_service(&sDefault, f);
|
---|
5147 |
|
---|
5148 | for (iService = 0; iService < maxtoprint; iService++) {
|
---|
5149 | fprintf(f,"\n");
|
---|
5150 | lp_dump_one(f, show_defaults, iService);
|
---|
5151 | }
|
---|
5152 | }
|
---|
5153 |
|
---|
5154 | /***************************************************************************
|
---|
5155 | Display the contents of one service in human-readable form.
|
---|
5156 | ***************************************************************************/
|
---|
5157 |
|
---|
5158 | void lp_dump_one(FILE * f, BOOL show_defaults, int snum)
|
---|
5159 | {
|
---|
5160 | if (VALID(snum)) {
|
---|
5161 | if (ServicePtrs[snum]->szService[0] == '\0')
|
---|
5162 | return;
|
---|
5163 | dump_a_service(ServicePtrs[snum], f);
|
---|
5164 | }
|
---|
5165 | }
|
---|
5166 |
|
---|
5167 | /***************************************************************************
|
---|
5168 | Return the number of the service with the given name, or -1 if it doesn't
|
---|
5169 | exist. Note that this is a DIFFERENT ANIMAL from the internal function
|
---|
5170 | getservicebyname()! This works ONLY if all services have been loaded, and
|
---|
5171 | does not copy the found service.
|
---|
5172 | ***************************************************************************/
|
---|
5173 |
|
---|
5174 | int lp_servicenumber(const char *pszServiceName)
|
---|
5175 | {
|
---|
5176 | int iService;
|
---|
5177 | fstring serviceName;
|
---|
5178 |
|
---|
5179 | if (!pszServiceName) {
|
---|
5180 | return GLOBAL_SECTION_SNUM;
|
---|
5181 | }
|
---|
5182 |
|
---|
5183 | for (iService = iNumServices - 1; iService >= 0; iService--) {
|
---|
5184 | if (VALID(iService) && ServicePtrs[iService]->szService) {
|
---|
5185 | /*
|
---|
5186 | * The substitution here is used to support %U is
|
---|
5187 | * service names
|
---|
5188 | */
|
---|
5189 | fstrcpy(serviceName, ServicePtrs[iService]->szService);
|
---|
5190 | standard_sub_basic(get_current_username(),
|
---|
5191 | current_user_info.domain,
|
---|
5192 | serviceName,sizeof(serviceName));
|
---|
5193 | if (strequal(serviceName, pszServiceName)) {
|
---|
5194 | break;
|
---|
5195 | }
|
---|
5196 | }
|
---|
5197 | }
|
---|
5198 |
|
---|
5199 | if (iService >= 0 && ServicePtrs[iService]->usershare == USERSHARE_VALID) {
|
---|
5200 | time_t last_mod;
|
---|
5201 |
|
---|
5202 | if (!usershare_exists(iService, &last_mod)) {
|
---|
5203 | /* Remove the share security tdb entry for it. */
|
---|
5204 | delete_share_security(snum2params_static(iService));
|
---|
5205 | /* Remove it from the array. */
|
---|
5206 | free_service_byindex(iService);
|
---|
5207 | /* Doesn't exist anymore. */
|
---|
5208 | return GLOBAL_SECTION_SNUM;
|
---|
5209 | }
|
---|
5210 |
|
---|
5211 | /* Has it been modified ? If so delete and reload. */
|
---|
5212 | if (ServicePtrs[iService]->usershare_last_mod < last_mod) {
|
---|
5213 | /* Remove it from the array. */
|
---|
5214 | free_service_byindex(iService);
|
---|
5215 | /* and now reload it. */
|
---|
5216 | iService = load_usershare_service(pszServiceName);
|
---|
5217 | }
|
---|
5218 | }
|
---|
5219 |
|
---|
5220 | if (iService < 0) {
|
---|
5221 | DEBUG(7,("lp_servicenumber: couldn't find %s\n", pszServiceName));
|
---|
5222 | return GLOBAL_SECTION_SNUM;
|
---|
5223 | }
|
---|
5224 |
|
---|
5225 | return (iService);
|
---|
5226 | }
|
---|
5227 |
|
---|
5228 | BOOL share_defined(const char *service_name)
|
---|
5229 | {
|
---|
5230 | return (lp_servicenumber(service_name) != -1);
|
---|
5231 | }
|
---|
5232 |
|
---|
5233 | struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
|
---|
5234 | const char *sharename)
|
---|
5235 | {
|
---|
5236 | struct share_params *result;
|
---|
5237 | char *sname;
|
---|
5238 | int snum;
|
---|
5239 |
|
---|
5240 | if (!(sname = SMB_STRDUP(sharename))) {
|
---|
5241 | return NULL;
|
---|
5242 | }
|
---|
5243 |
|
---|
5244 | snum = find_service(sname);
|
---|
5245 | SAFE_FREE(sname);
|
---|
5246 |
|
---|
5247 | if (snum < 0) {
|
---|
5248 | return NULL;
|
---|
5249 | }
|
---|
5250 |
|
---|
5251 | if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
|
---|
5252 | DEBUG(0, ("talloc failed\n"));
|
---|
5253 | return NULL;
|
---|
5254 | }
|
---|
5255 |
|
---|
5256 | result->service = snum;
|
---|
5257 | return result;
|
---|
5258 | }
|
---|
5259 |
|
---|
5260 | struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
|
---|
5261 | {
|
---|
5262 | struct share_iterator *result;
|
---|
5263 |
|
---|
5264 | if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
|
---|
5265 | DEBUG(0, ("talloc failed\n"));
|
---|
5266 | return NULL;
|
---|
5267 | }
|
---|
5268 |
|
---|
5269 | result->next_id = 0;
|
---|
5270 | return result;
|
---|
5271 | }
|
---|
5272 |
|
---|
5273 | struct share_params *next_share(struct share_iterator *list)
|
---|
5274 | {
|
---|
5275 | struct share_params *result;
|
---|
5276 |
|
---|
5277 | while (!lp_snum_ok(list->next_id) &&
|
---|
5278 | (list->next_id < lp_numservices())) {
|
---|
5279 | list->next_id += 1;
|
---|
5280 | }
|
---|
5281 |
|
---|
5282 | if (list->next_id >= lp_numservices()) {
|
---|
5283 | return NULL;
|
---|
5284 | }
|
---|
5285 |
|
---|
5286 | if (!(result = TALLOC_P(list, struct share_params))) {
|
---|
5287 | DEBUG(0, ("talloc failed\n"));
|
---|
5288 | return NULL;
|
---|
5289 | }
|
---|
5290 |
|
---|
5291 | result->service = list->next_id;
|
---|
5292 | list->next_id += 1;
|
---|
5293 | return result;
|
---|
5294 | }
|
---|
5295 |
|
---|
5296 | struct share_params *next_printer(struct share_iterator *list)
|
---|
5297 | {
|
---|
5298 | struct share_params *result;
|
---|
5299 |
|
---|
5300 | while ((result = next_share(list)) != NULL) {
|
---|
5301 | if (lp_print_ok(result->service)) {
|
---|
5302 | break;
|
---|
5303 | }
|
---|
5304 | }
|
---|
5305 | return result;
|
---|
5306 | }
|
---|
5307 |
|
---|
5308 | /*
|
---|
5309 | * This is a hack for a transition period until we transformed all code from
|
---|
5310 | * service numbers to struct share_params.
|
---|
5311 | */
|
---|
5312 |
|
---|
5313 | struct share_params *snum2params_static(int snum)
|
---|
5314 | {
|
---|
5315 | static struct share_params result;
|
---|
5316 | result.service = snum;
|
---|
5317 | return &result;
|
---|
5318 | }
|
---|
5319 |
|
---|
5320 | /*******************************************************************
|
---|
5321 | A useful volume label function.
|
---|
5322 | ********************************************************************/
|
---|
5323 |
|
---|
5324 | const char *volume_label(int snum)
|
---|
5325 | {
|
---|
5326 | char *ret;
|
---|
5327 | const char *label = lp_volume(snum);
|
---|
5328 | if (!*label) {
|
---|
5329 | label = lp_servicename(snum);
|
---|
5330 | }
|
---|
5331 |
|
---|
5332 | /* This returns a 33 byte guarenteed null terminated string. */
|
---|
5333 | ret = talloc_strndup(main_loop_talloc_get(), label, 32);
|
---|
5334 | if (!ret) {
|
---|
5335 | return "";
|
---|
5336 | }
|
---|
5337 | return ret;
|
---|
5338 | }
|
---|
5339 |
|
---|
5340 | /*******************************************************************
|
---|
5341 | Set the server type we will announce as via nmbd.
|
---|
5342 | ********************************************************************/
|
---|
5343 |
|
---|
5344 | static void set_default_server_announce_type(void)
|
---|
5345 | {
|
---|
5346 | default_server_announce = 0;
|
---|
5347 | default_server_announce |= SV_TYPE_WORKSTATION;
|
---|
5348 | default_server_announce |= SV_TYPE_SERVER;
|
---|
5349 | default_server_announce |= SV_TYPE_SERVER_UNIX;
|
---|
5350 |
|
---|
5351 | /* note that the flag should be set only if we have a
|
---|
5352 | printer service but nmbd doesn't actually load the
|
---|
5353 | services so we can't tell --jerry */
|
---|
5354 |
|
---|
5355 | default_server_announce |= SV_TYPE_PRINTQ_SERVER;
|
---|
5356 |
|
---|
5357 | switch (lp_announce_as()) {
|
---|
5358 | case ANNOUNCE_AS_NT_SERVER:
|
---|
5359 | default_server_announce |= SV_TYPE_SERVER_NT;
|
---|
5360 | /* fall through... */
|
---|
5361 | case ANNOUNCE_AS_NT_WORKSTATION:
|
---|
5362 | default_server_announce |= SV_TYPE_NT;
|
---|
5363 | break;
|
---|
5364 | case ANNOUNCE_AS_WIN95:
|
---|
5365 | default_server_announce |= SV_TYPE_WIN95_PLUS;
|
---|
5366 | break;
|
---|
5367 | case ANNOUNCE_AS_WFW:
|
---|
5368 | default_server_announce |= SV_TYPE_WFW;
|
---|
5369 | break;
|
---|
5370 | default:
|
---|
5371 | break;
|
---|
5372 | }
|
---|
5373 |
|
---|
5374 | switch (lp_server_role()) {
|
---|
5375 | case ROLE_DOMAIN_MEMBER:
|
---|
5376 | default_server_announce |= SV_TYPE_DOMAIN_MEMBER;
|
---|
5377 | break;
|
---|
5378 | case ROLE_DOMAIN_PDC:
|
---|
5379 | default_server_announce |= SV_TYPE_DOMAIN_CTRL;
|
---|
5380 | break;
|
---|
5381 | case ROLE_DOMAIN_BDC:
|
---|
5382 | default_server_announce |= SV_TYPE_DOMAIN_BAKCTRL;
|
---|
5383 | break;
|
---|
5384 | case ROLE_STANDALONE:
|
---|
5385 | default:
|
---|
5386 | break;
|
---|
5387 | }
|
---|
5388 | if (lp_time_server())
|
---|
5389 | default_server_announce |= SV_TYPE_TIME_SOURCE;
|
---|
5390 |
|
---|
5391 | if (lp_host_msdfs())
|
---|
5392 | default_server_announce |= SV_TYPE_DFS_SERVER;
|
---|
5393 | }
|
---|
5394 |
|
---|
5395 | /***********************************************************
|
---|
5396 | returns role of Samba server
|
---|
5397 | ************************************************************/
|
---|
5398 |
|
---|
5399 | int lp_server_role(void)
|
---|
5400 | {
|
---|
5401 | return server_role;
|
---|
5402 | }
|
---|
5403 |
|
---|
5404 | /***********************************************************
|
---|
5405 | If we are PDC then prefer us as DMB
|
---|
5406 | ************************************************************/
|
---|
5407 |
|
---|
5408 | BOOL lp_domain_master(void)
|
---|
5409 | {
|
---|
5410 | if (Globals.bDomainMaster == Auto)
|
---|
5411 | return (lp_server_role() == ROLE_DOMAIN_PDC);
|
---|
5412 |
|
---|
5413 | return Globals.bDomainMaster;
|
---|
5414 | }
|
---|
5415 |
|
---|
5416 | /***********************************************************
|
---|
5417 | If we are DMB then prefer us as LMB
|
---|
5418 | ************************************************************/
|
---|
5419 |
|
---|
5420 | BOOL lp_preferred_master(void)
|
---|
5421 | {
|
---|
5422 | if (Globals.bPreferredMaster == Auto)
|
---|
5423 | return (lp_local_master() && lp_domain_master());
|
---|
5424 |
|
---|
5425 | return Globals.bPreferredMaster;
|
---|
5426 | }
|
---|
5427 |
|
---|
5428 | /*******************************************************************
|
---|
5429 | Remove a service.
|
---|
5430 | ********************************************************************/
|
---|
5431 |
|
---|
5432 | void lp_remove_service(int snum)
|
---|
5433 | {
|
---|
5434 | ServicePtrs[snum]->valid = False;
|
---|
5435 | invalid_services[num_invalid_services++] = snum;
|
---|
5436 | }
|
---|
5437 |
|
---|
5438 | /*******************************************************************
|
---|
5439 | Copy a service.
|
---|
5440 | ********************************************************************/
|
---|
5441 |
|
---|
5442 | void lp_copy_service(int snum, const char *new_name)
|
---|
5443 | {
|
---|
5444 | do_section(new_name);
|
---|
5445 | if (snum >= 0) {
|
---|
5446 | snum = lp_servicenumber(new_name);
|
---|
5447 | if (snum >= 0)
|
---|
5448 | lp_do_parameter(snum, "copy", lp_servicename(snum));
|
---|
5449 | }
|
---|
5450 | }
|
---|
5451 |
|
---|
5452 |
|
---|
5453 | /*******************************************************************
|
---|
5454 | Get the default server type we will announce as via nmbd.
|
---|
5455 | ********************************************************************/
|
---|
5456 |
|
---|
5457 | int lp_default_server_announce(void)
|
---|
5458 | {
|
---|
5459 | return default_server_announce;
|
---|
5460 | }
|
---|
5461 |
|
---|
5462 | /*******************************************************************
|
---|
5463 | Split the announce version into major and minor numbers.
|
---|
5464 | ********************************************************************/
|
---|
5465 |
|
---|
5466 | int lp_major_announce_version(void)
|
---|
5467 | {
|
---|
5468 | static BOOL got_major = False;
|
---|
5469 | static int major_version = DEFAULT_MAJOR_VERSION;
|
---|
5470 | char *vers;
|
---|
5471 | char *p;
|
---|
5472 |
|
---|
5473 | if (got_major)
|
---|
5474 | return major_version;
|
---|
5475 |
|
---|
5476 | got_major = True;
|
---|
5477 | if ((vers = lp_announce_version()) == NULL)
|
---|
5478 | return major_version;
|
---|
5479 |
|
---|
5480 | if ((p = strchr_m(vers, '.')) == 0)
|
---|
5481 | return major_version;
|
---|
5482 |
|
---|
5483 | *p = '\0';
|
---|
5484 | major_version = atoi(vers);
|
---|
5485 | return major_version;
|
---|
5486 | }
|
---|
5487 |
|
---|
5488 | int lp_minor_announce_version(void)
|
---|
5489 | {
|
---|
5490 | static BOOL got_minor = False;
|
---|
5491 | static int minor_version = DEFAULT_MINOR_VERSION;
|
---|
5492 | char *vers;
|
---|
5493 | char *p;
|
---|
5494 |
|
---|
5495 | if (got_minor)
|
---|
5496 | return minor_version;
|
---|
5497 |
|
---|
5498 | got_minor = True;
|
---|
5499 | if ((vers = lp_announce_version()) == NULL)
|
---|
5500 | return minor_version;
|
---|
5501 |
|
---|
5502 | if ((p = strchr_m(vers, '.')) == 0)
|
---|
5503 | return minor_version;
|
---|
5504 |
|
---|
5505 | p++;
|
---|
5506 | minor_version = atoi(p);
|
---|
5507 | return minor_version;
|
---|
5508 | }
|
---|
5509 |
|
---|
5510 | /***********************************************************
|
---|
5511 | Set the global name resolution order (used in smbclient).
|
---|
5512 | ************************************************************/
|
---|
5513 |
|
---|
5514 | void lp_set_name_resolve_order(const char *new_order)
|
---|
5515 | {
|
---|
5516 | string_set(&Globals.szNameResolveOrder, new_order);
|
---|
5517 | }
|
---|
5518 |
|
---|
5519 | const char *lp_printername(int snum)
|
---|
5520 | {
|
---|
5521 | const char *ret = _lp_printername(snum);
|
---|
5522 | if (ret == NULL || (ret != NULL && *ret == '\0'))
|
---|
5523 | ret = lp_const_servicename(snum);
|
---|
5524 |
|
---|
5525 | return ret;
|
---|
5526 | }
|
---|
5527 |
|
---|
5528 |
|
---|
5529 | /***********************************************************
|
---|
5530 | Allow daemons such as winbindd to fix their logfile name.
|
---|
5531 | ************************************************************/
|
---|
5532 |
|
---|
5533 | void lp_set_logfile(const char *name)
|
---|
5534 | {
|
---|
5535 | string_set(&Globals.szLogFile, name);
|
---|
5536 | pstrcpy(debugf, name);
|
---|
5537 | }
|
---|
5538 |
|
---|
5539 | /*******************************************************************
|
---|
5540 | Return the max print jobs per queue.
|
---|
5541 | ********************************************************************/
|
---|
5542 |
|
---|
5543 | int lp_maxprintjobs(int snum)
|
---|
5544 | {
|
---|
5545 | int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
|
---|
5546 | if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
|
---|
5547 | maxjobs = PRINT_MAX_JOBID - 1;
|
---|
5548 |
|
---|
5549 | return maxjobs;
|
---|
5550 | }
|
---|
5551 |
|
---|
5552 | const char *lp_printcapname(void)
|
---|
5553 | {
|
---|
5554 | if ((Globals.szPrintcapname != NULL) &&
|
---|
5555 | (Globals.szPrintcapname[0] != '\0'))
|
---|
5556 | return Globals.szPrintcapname;
|
---|
5557 |
|
---|
5558 | if (sDefault.iPrinting == PRINT_CUPS) {
|
---|
5559 | #ifdef HAVE_CUPS
|
---|
5560 | return "cups";
|
---|
5561 | #else
|
---|
5562 | return "lpstat";
|
---|
5563 | #endif
|
---|
5564 | }
|
---|
5565 |
|
---|
5566 | if (sDefault.iPrinting == PRINT_BSD)
|
---|
5567 | return "/etc/printcap";
|
---|
5568 |
|
---|
5569 | return PRINTCAP_NAME;
|
---|
5570 | }
|
---|
5571 |
|
---|
5572 | /*******************************************************************
|
---|
5573 | Ensure we don't use sendfile if server smb signing is active.
|
---|
5574 | ********************************************************************/
|
---|
5575 |
|
---|
5576 | static uint32 spoolss_state;
|
---|
5577 |
|
---|
5578 | BOOL lp_disable_spoolss( void )
|
---|
5579 | {
|
---|
5580 | if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
|
---|
5581 | spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
|
---|
5582 |
|
---|
5583 | return spoolss_state == SVCCTL_STOPPED ? True : False;
|
---|
5584 | }
|
---|
5585 |
|
---|
5586 | void lp_set_spoolss_state( uint32 state )
|
---|
5587 | {
|
---|
5588 | SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
|
---|
5589 |
|
---|
5590 | spoolss_state = state;
|
---|
5591 | }
|
---|
5592 |
|
---|
5593 | uint32 lp_get_spoolss_state( void )
|
---|
5594 | {
|
---|
5595 | return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
|
---|
5596 | }
|
---|
5597 |
|
---|
5598 | /*******************************************************************
|
---|
5599 | Ensure we don't use sendfile if server smb signing is active.
|
---|
5600 | ********************************************************************/
|
---|
5601 |
|
---|
5602 | BOOL lp_use_sendfile(int snum)
|
---|
5603 | {
|
---|
5604 | /* Using sendfile blows the brains out of any DOS or Win9x TCP stack... JRA. */
|
---|
5605 | if (Protocol < PROTOCOL_NT1) {
|
---|
5606 | return False;
|
---|
5607 | }
|
---|
5608 | return (_lp_use_sendfile(snum) && (get_remote_arch() != RA_WIN95) && !srv_is_signing_active());
|
---|
5609 | }
|
---|
5610 |
|
---|
5611 | /*******************************************************************
|
---|
5612 | Turn off sendfile if we find the underlying OS doesn't support it.
|
---|
5613 | ********************************************************************/
|
---|
5614 |
|
---|
5615 | void set_use_sendfile(int snum, BOOL val)
|
---|
5616 | {
|
---|
5617 | if (LP_SNUM_OK(snum))
|
---|
5618 | ServicePtrs[snum]->bUseSendfile = val;
|
---|
5619 | else
|
---|
5620 | sDefault.bUseSendfile = val;
|
---|
5621 | }
|
---|
5622 |
|
---|
5623 | /*******************************************************************
|
---|
5624 | Turn off storing DOS attributes if this share doesn't support it.
|
---|
5625 | ********************************************************************/
|
---|
5626 |
|
---|
5627 | void set_store_dos_attributes(int snum, BOOL val)
|
---|
5628 | {
|
---|
5629 | if (!LP_SNUM_OK(snum))
|
---|
5630 | return;
|
---|
5631 | ServicePtrs[(snum)]->bStoreDosAttributes = val;
|
---|
5632 | }
|
---|
5633 |
|
---|
5634 | void lp_set_mangling_method(const char *new_method)
|
---|
5635 | {
|
---|
5636 | string_set(&Globals.szManglingMethod, new_method);
|
---|
5637 | }
|
---|
5638 |
|
---|
5639 | /*******************************************************************
|
---|
5640 | Global state for POSIX pathname processing.
|
---|
5641 | ********************************************************************/
|
---|
5642 |
|
---|
5643 | static BOOL posix_pathnames;
|
---|
5644 |
|
---|
5645 | BOOL lp_posix_pathnames(void)
|
---|
5646 | {
|
---|
5647 | return posix_pathnames;
|
---|
5648 | }
|
---|
5649 |
|
---|
5650 | /*******************************************************************
|
---|
5651 | Change everything needed to ensure POSIX pathname processing (currently
|
---|
5652 | not much).
|
---|
5653 | ********************************************************************/
|
---|
5654 |
|
---|
5655 | void lp_set_posix_pathnames(void)
|
---|
5656 | {
|
---|
5657 | posix_pathnames = True;
|
---|
5658 | }
|
---|
5659 |
|
---|
5660 | /*******************************************************************
|
---|
5661 | Global state for POSIX lock processing - CIFS unix extensions.
|
---|
5662 | ********************************************************************/
|
---|
5663 |
|
---|
5664 | BOOL posix_default_lock_was_set;
|
---|
5665 | static enum brl_flavour posix_cifsx_locktype; /* By default 0 == WINDOWS_LOCK */
|
---|
5666 |
|
---|
5667 | enum brl_flavour lp_posix_cifsu_locktype(files_struct *fsp)
|
---|
5668 | {
|
---|
5669 | if (posix_default_lock_was_set) {
|
---|
5670 | return posix_cifsx_locktype;
|
---|
5671 | } else {
|
---|
5672 | return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
|
---|
5673 | }
|
---|
5674 | }
|
---|
5675 |
|
---|
5676 | /*******************************************************************
|
---|
5677 | ********************************************************************/
|
---|
5678 |
|
---|
5679 | void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
|
---|
5680 | {
|
---|
5681 | posix_default_lock_was_set = True;
|
---|
5682 | posix_cifsx_locktype = val;
|
---|
5683 | }
|
---|