Ignore:
Timestamp:
Nov 24, 2016, 1:14:11 PM (9 years ago)
Author:
Silvan Scherrer
Message:

Samba Server: update vendor to version 4.4.3

Location:
vendor/current/source3/param
Files:
4 added
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • vendor/current/source3/param/loadparm.c

    r919 r988  
    1111   Copyright (C) Jim McDonough <jmcd@us.ibm.com> 2003
    1212   Copyright (C) Michael Adam 2008
     13   Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
     14   Copyright (C) Andrew Bartlett 2011
    1315
    1416   This program is free software; you can redistribute it and/or modify
     
    5557#include "system/filesys.h"
    5658#include "util_tdb.h"
     59#include "lib/param/loadparm.h"
     60#include "lib/param/param.h"
    5761#include "printing.h"
    5862#include "lib/smbconf/smbconf.h"
     
    6266#include "../librpc/gen_ndr/svcctl.h"
    6367#include "intl.h"
    64 #include "smb_signing.h"
    65 #include "dbwrap.h"
    66 #include "smbldap.h"
     68#include "../libcli/smb/smb_signing.h"
     69#include "dbwrap/dbwrap.h"
     70#include "dbwrap/dbwrap_rbt.h"
    6771#include "../lib/util/bitmap.h"
     72#include "librpc/gen_ndr/nbt.h"
     73#include "source4/lib/tls/tls.h"
    6874
    6975#ifdef HAVE_SYS_SYSCTL_H
     
    7177#endif
    7278
    73 #ifdef HAVE_HTTPCONNECTENCRYPT
    74 #include <cups/http.h>
    75 #endif
    76 
    77 bool bLoaded = False;
     79bool bLoaded = false;
    7880
    7981extern userdom_struct current_user_info;
    80 
    81 #ifndef GLOBAL_NAME
    82 #define GLOBAL_NAME "global"
    83 #endif
    84 
    85 #ifndef PRINTERS_NAME
    86 #define PRINTERS_NAME "printers"
    87 #endif
    88 
    89 #ifndef HOMES_NAME
    90 #define HOMES_NAME "homes"
    91 #endif
    9282
    9383/* the special value for the include parameter
     
    9989#endif
    10090
    101 static bool in_client = False;          /* Not in the client by default */
     91static bool in_client = false;          /* Not in the client by default */
    10292static struct smbconf_csn conf_last_csn;
    10393
    104 #define CONFIG_BACKEND_FILE 0
    105 #define CONFIG_BACKEND_REGISTRY 1
    106 
    10794static int config_backend = CONFIG_BACKEND_FILE;
    10895
    10996/* some helpful bits */
    110 #define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && (ServicePtrs != NULL) && ServicePtrs[(i)]->valid)
    111 #define VALID(i) (ServicePtrs != NULL && ServicePtrs[i]->valid)
     97#define LP_SNUM_OK(i) (((i) >= 0) && ((i) < iNumServices) && \
     98                       (ServicePtrs != NULL) && \
     99                       (ServicePtrs[(i)] != NULL) && ServicePtrs[(i)]->valid)
     100#define VALID(i) ((ServicePtrs != NULL) && (ServicePtrs[i]!= NULL) && \
     101                  ServicePtrs[i]->valid)
    112102
    113103#define USERSHARE_VALID 1
    114104#define USERSHARE_PENDING_DELETE 2
    115105
    116 static bool defaults_saved = False;
    117 
    118 struct param_opt_struct {
    119         struct param_opt_struct *prev, *next;
    120         char *key;
    121         char *value;
    122         char **list;
    123         unsigned flags;
     106static bool defaults_saved = false;
     107
     108#include "lib/param/param_global.h"
     109
     110static struct loadparm_global Globals;
     111
     112/* This is a default service used to prime a services structure */
     113static struct loadparm_service sDefault =
     114{
     115        .valid = true,
     116        .autoloaded = false,
     117        .usershare = 0,
     118        .usershare_last_mod = {0, 0},
     119        .szService = NULL,
     120        .path = NULL,
     121        .username = NULL,
     122        .invalid_users = NULL,
     123        .valid_users = NULL,
     124        .admin_users = NULL,
     125        .copy = NULL,
     126        .include = NULL,
     127        .preexec = NULL,
     128        .postexec = NULL,
     129        .root_preexec = NULL,
     130        .root_postexec = NULL,
     131        .cups_options = NULL,
     132        .print_command = NULL,
     133        .lpq_command = NULL,
     134        .lprm_command = NULL,
     135        .lppause_command = NULL,
     136        .lpresume_command = NULL,
     137        .queuepause_command = NULL,
     138        .queueresume_command = NULL,
     139        ._printername = NULL,
     140        .printjob_username = NULL,
     141        .dont_descend = NULL,
     142        .hosts_allow = NULL,
     143        .hosts_deny = NULL,
     144        .magic_script = NULL,
     145        .magic_output = NULL,
     146        .veto_files = NULL,
     147        .hide_files = NULL,
     148        .veto_oplock_files = NULL,
     149        .comment = NULL,
     150        .force_user = NULL,
     151        .force_group = NULL,
     152        .read_list = NULL,
     153        .write_list = NULL,
     154        .volume = NULL,
     155        .fstype = NULL,
     156        .vfs_objects = NULL,
     157        .msdfs_proxy = NULL,
     158        .aio_write_behind = NULL,
     159        .dfree_command = NULL,
     160        .min_print_space = 0,
     161        .max_print_jobs = 1000,
     162        .max_reported_print_jobs = 0,
     163        .write_cache_size = 0,
     164        .create_mask = 0744,
     165        .force_create_mode = 0,
     166        .directory_mask = 0755,
     167        .force_directory_mode = 0,
     168        .max_connections = 0,
     169        .default_case = CASE_LOWER,
     170        .printing = DEFAULT_PRINTING,
     171        .oplock_contention_limit = 2,
     172        .csc_policy = 0,
     173        .block_size = 1024,
     174        .dfree_cache_time = 0,
     175        .preexec_close = false,
     176        .root_preexec_close = false,
     177        .case_sensitive = Auto,
     178        .preserve_case = true,
     179        .short_preserve_case = true,
     180        .hide_dot_files = true,
     181        .hide_special_files = false,
     182        .hide_unreadable = false,
     183        .hide_unwriteable_files = false,
     184        .browseable = true,
     185        .access_based_share_enum = false,
     186        .available = true,
     187        .read_only = true,
     188        .spotlight = false,
     189        .guest_only = false,
     190        .administrative_share = false,
     191        .guest_ok = false,
     192        .printable = false,
     193        .print_notify_backchannel = false,
     194        .map_system = false,
     195        .map_hidden = false,
     196        .map_archive = true,
     197        .store_dos_attributes = false,
     198        .dmapi_support = false,
     199        .locking = true,
     200        .strict_locking = Auto,
     201        .posix_locking = true,
     202        .oplocks = true,
     203        .kernel_oplocks = false,
     204        .level2_oplocks = true,
     205        .only_user = false,
     206        .mangled_names = true,
     207        .wide_links = false,
     208        .follow_symlinks = true,
     209        .sync_always = false,
     210        .strict_allocate = false,
     211        .strict_rename = false,
     212        .strict_sync = false,
     213        .mangling_char = '~',
     214        .copymap = NULL,
     215        .delete_readonly = false,
     216        .fake_oplocks = false,
     217        .delete_veto_files = false,
     218        .dos_filemode = false,
     219        .dos_filetimes = true,
     220        .dos_filetime_resolution = false,
     221        .fake_directory_create_times = false,
     222        .blocking_locks = true,
     223        .inherit_permissions = false,
     224        .inherit_acls = false,
     225        .inherit_owner = false,
     226        .msdfs_root = false,
     227        .msdfs_shuffle_referrals = false,
     228        .use_client_driver = false,
     229        .default_devmode = true,
     230        .force_printername = false,
     231        .nt_acl_support = true,
     232        .force_unknown_acl_user = false,
     233        ._use_sendfile = false,
     234        .profile_acls = false,
     235        .map_acl_inherit = false,
     236        .afs_share = false,
     237        .ea_support = false,
     238        .acl_check_permissions = true,
     239        .acl_map_full_control = true,
     240        .acl_group_control = false,
     241        .acl_allow_execute_always = false,
     242        .allocation_roundup_size = SMB_ROUNDUP_ALLOCATION_SIZE,
     243        .aio_read_size = 0,
     244        .aio_write_size = 0,
     245        .map_readonly = MAP_READONLY_YES,
     246        .directory_name_cache_size = 100,
     247        .smb_encrypt = SMB_SIGNING_DEFAULT,
     248        .kernel_share_modes = true,
     249        .durable_handles = true,
     250        .param_opt = NULL,
     251        .dummy = ""
    124252};
    125253
    126 /*
    127  * This structure describes global (ie., server-wide) parameters.
    128  */
    129 struct global {
    130         int ConfigBackend;
    131         char *smb_ports;
    132         char *dos_charset;
    133         char *unix_charset;
    134         char *display_charset;
    135         char *szPrintcapname;
    136         char *szAddPortCommand;
    137         char *szEnumPortsCommand;
    138         char *szAddPrinterCommand;
    139         char *szDeletePrinterCommand;
    140         char *szOs2DriverMap;
    141         char *szLockDir;
    142         char *szStateDir;
    143         char *szCacheDir;
    144         char *szPidDir;
    145         char *szRootdir;
    146         char *szDefaultService;
    147         char *szGetQuota;
    148         char *szSetQuota;
    149         char *szMsgCommand;
    150         char *szServerString;
    151         char *szAutoServices;
    152         char *szPasswdProgram;
    153         char *szPasswdChat;
    154         char *szLogFile;
    155         char *szConfigFile;
    156         char *szSMBPasswdFile;
    157         char *szPrivateDir;
    158         char *szPassdbBackend;
    159         char **szPreloadModules;
    160         char *szPasswordServer;
    161         char *szSocketOptions;
    162         char *szRealm;
    163         char *szAfsUsernameMap;
    164         int iAfsTokenLifetime;
    165         char *szLogNtTokenCommand;
    166         char *szUsernameMap;
    167         char *szLogonScript;
    168         char *szLogonPath;
    169         char *szLogonDrive;
    170         char *szLogonHome;
    171         char **szWINSservers;
    172         char **szInterfaces;
    173         char *szRemoteAnnounce;
    174         char *szRemoteBrowseSync;
    175         char *szSocketAddress;
    176         bool bNmbdBindExplicitBroadcast;
    177         char *szNISHomeMapName;
    178         char *szAnnounceVersion;        /* This is initialised in init_globals */
    179         char *szWorkgroup;
    180         char *szNetbiosName;
    181         char **szNetbiosAliases;
    182         char *szNetbiosScope;
    183         char *szNameResolveOrder;
    184         char *szPanicAction;
    185         char *szAddUserScript;
    186         char *szRenameUserScript;
    187         char *szDelUserScript;
    188         char *szAddGroupScript;
    189         char *szDelGroupScript;
    190         char *szAddUserToGroupScript;
    191         char *szDelUserFromGroupScript;
    192         char *szSetPrimaryGroupScript;
    193         char *szAddMachineScript;
    194         char *szShutdownScript;
    195         char *szAbortShutdownScript;
    196         char *szUsernameMapScript;
    197         int iUsernameMapCacheTime;
    198         char *szCheckPasswordScript;
    199         char *szWINSHook;
    200         char *szUtmpDir;
    201         char *szWtmpDir;
    202         bool bUtmp;
    203         char *szIdmapUID;
    204         char *szIdmapGID;
    205         bool bPassdbExpandExplicit;
    206         int AlgorithmicRidBase;
    207         char *szTemplateHomedir;
    208         char *szTemplateShell;
    209         char *szWinbindSeparator;
    210         bool bWinbindEnumUsers;
    211         bool bWinbindEnumGroups;
    212         bool bWinbindUseDefaultDomain;
    213         bool bWinbindTrustedDomainsOnly;
    214         bool bWinbindNestedGroups;
    215         int  winbind_expand_groups;
    216         bool bWinbindRefreshTickets;
    217         bool bWinbindOfflineLogon;
    218         bool bWinbindSealedPipes;
    219         bool bWinbindNormalizeNames;
    220         bool bWinbindRpcOnly;
    221         bool bCreateKrb5Conf;
    222         int winbindMaxDomainConnections;
    223         char *szIdmapBackend;
    224         bool bIdmapReadOnly;
    225         char *szAddShareCommand;
    226         char *szChangeShareCommand;
    227         char *szDeleteShareCommand;
    228         char **szEventLogs;
    229         char *szGuestaccount;
    230         char *szManglingMethod;
    231         char **szServicesList;
    232         char *szUsersharePath;
    233         char *szUsershareTemplateShare;
    234         char **szUsersharePrefixAllowList;
    235         char **szUsersharePrefixDenyList;
    236         int mangle_prefix;
    237         int max_log_size;
    238         char *szLogLevel;
    239         int max_xmit;
    240         int max_mux;
    241         int max_open_files;
    242         int open_files_db_hash_size;
    243         int pwordlevel;
    244         int unamelevel;
    245         int deadtime;
    246         bool getwd_cache;
    247         int maxprotocol;
    248         int minprotocol;
    249         int security;
    250         char **AuthMethods;
    251         bool paranoid_server_security;
    252         int maxdisksize;
    253         int lpqcachetime;
    254         int iMaxSmbdProcesses;
    255         bool bDisableSpoolss;
    256         int syslog;
    257         int os_level;
    258         bool enhanced_browsing;
    259         int max_ttl;
    260         int max_wins_ttl;
    261         int min_wins_ttl;
    262         int lm_announce;
    263         int lm_interval;
    264         int announce_as;        /* This is initialised in init_globals */
    265         int machine_password_timeout;
    266         int map_to_guest;
    267         int oplock_break_wait_time;
    268         int winbind_cache_time;
    269         int winbind_reconnect_delay;
    270         int winbind_max_clients;
    271         char **szWinbindNssInfo;
    272         int iLockSpinTime;
    273         char *szLdapMachineSuffix;
    274         char *szLdapUserSuffix;
    275         char *szLdapIdmapSuffix;
    276         char *szLdapGroupSuffix;
    277         int ldap_ssl;
    278         bool ldap_ssl_ads;
    279         int ldap_deref;
    280         int ldap_follow_referral;
    281         char *szLdapSuffix;
    282         char *szLdapAdminDn;
    283         int ldap_debug_level;
    284         int ldap_debug_threshold;
    285         int iAclCompat;
    286         char *szCupsServer;
    287         int CupsEncrypt;
    288         char *szIPrintServer;
    289         char *ctdbdSocket;
    290         char **szClusterAddresses;
    291         bool clustering;
    292         int ctdb_timeout;
    293         int ctdb_locktime_warn_threshold;
    294         int ldap_passwd_sync;
    295         int ldap_replication_sleep;
    296         int ldap_timeout; /* This is initialised in init_globals */
    297         int ldap_connection_timeout;
    298         int ldap_page_size;
    299         bool ldap_delete_dn;
    300         bool bMsAddPrinterWizard;
    301         bool bDNSproxy;
    302         bool bWINSsupport;
    303         bool bWINSproxy;
    304         bool bLocalMaster;
    305         int  iPreferredMaster;
    306         int iDomainMaster;
    307         bool bDomainLogons;
    308         char **szInitLogonDelayedHosts;
    309         int InitLogonDelay;
    310         bool bEncryptPasswords;
    311         bool bUpdateEncrypt;
    312         int  clientSchannel;
    313         int  serverSchannel;
    314         bool bNullPasswords;
    315         bool bObeyPamRestrictions;
    316         bool bLoadPrinters;
    317         int PrintcapCacheTime;
    318         bool bLargeReadwrite;
    319         bool bReadRaw;
    320         bool bWriteRaw;
    321         bool bSyslogOnly;
    322         bool bBrowseList;
    323         bool bNISHomeMap;
    324         bool bTimeServer;
    325         bool bBindInterfacesOnly;
    326         bool bPamPasswordChange;
    327         bool bUnixPasswdSync;
    328         bool bPasswdChatDebug;
    329         int iPasswdChatTimeout;
    330         bool bTimestampLogs;
    331         bool bNTSmbSupport;
    332         bool bNTPipeSupport;
    333         bool bNTStatusSupport;
    334         bool bStatCache;
    335         int iMaxStatCacheSize;
    336         bool bKernelOplocks;
    337         bool bAllowTrustedDomains;
    338         bool bLanmanAuth;
    339         bool bNTLMAuth;
    340         bool bRawNTLMv2Auth;
    341         bool bUseSpnego;
    342         bool bClientLanManAuth;
    343         bool bClientNTLMv2Auth;
    344         bool bClientPlaintextAuth;
    345         bool bClientUseSpnego;
    346         bool client_use_spnego_principal;
    347         bool send_spnego_principal;
    348         bool bDebugPrefixTimestamp;
    349         bool bDebugHiresTimestamp;
    350         bool bDebugPid;
    351         bool bDebugUid;
    352         bool bDebugClass;
    353         bool bEnableCoreFiles;
    354         bool bHostMSDfs;
    355         bool bUseMmap;
    356         bool bHostnameLookups;
    357         bool bUnixExtensions;
    358         bool bAllowDcerpcAuthLevelConnect;
    359         bool bDisableNetbios;
    360         char * szDedicatedKeytabFile;
    361         int  iKerberosMethod;
    362         bool bDeferSharingViolations;
    363         bool bEnablePrivileges;
    364         bool bASUSupport;
    365         bool bUsershareOwnerOnly;
    366         bool bUsershareAllowGuests;
    367         bool bRegistryShares;
    368         int restrict_anonymous;
    369         int name_cache_timeout;
    370         int client_signing;
    371         int client_ipc_signing;
    372         int server_signing;
    373         int client_ldap_sasl_wrapping;
    374         int iUsershareMaxShares;
    375         int iIdmapCacheTime;
    376         int iIdmapNegativeCacheTime;
    377         bool bResetOnZeroVC;
    378         bool bLogWriteableFilesOnExit;
    379         int iKeepalive;
    380         int iminreceivefile;
    381         struct param_opt_struct *param_opt;
    382         int cups_connection_timeout;
    383         char *szSMBPerfcountModule;
    384         bool bMapUntrustedToDomain;
    385         bool bAsyncSMBEchoHandler;
    386         bool bMulticastDnsRegister;
    387         bool bAllowInsecureWidelinks;
    388         int ismb2_max_read;
    389         int ismb2_max_write;
    390         int ismb2_max_trans;
    391         int ismb2_max_credits;
    392         char *ncalrpc_dir;
    393 };
    394 
    395 static struct global Globals;
    396 
    397 /*
    398  * This structure describes a single service.
    399  */
    400 struct service {
    401         bool valid;
    402         bool autoloaded;
    403         int usershare;
    404         struct timespec usershare_last_mod;
    405         char *szService;
    406         char *szPath;
    407         char *szUsername;
    408         char **szInvalidUsers;
    409         char **szValidUsers;
    410         char **szAdminUsers;
    411         char *szCopy;
    412         char *szInclude;
    413         char *szPreExec;
    414         char *szPostExec;
    415         char *szRootPreExec;
    416         char *szRootPostExec;
    417         char *szCupsOptions;
    418         char *szPrintcommand;
    419         char *szLpqcommand;
    420         char *szLprmcommand;
    421         char *szLppausecommand;
    422         char *szLpresumecommand;
    423         char *szQueuepausecommand;
    424         char *szQueueresumecommand;
    425         char *szPrintername;
    426         char *szPrintjobUsername;
    427         char *szDontdescend;
    428         char **szHostsallow;
    429         char **szHostsdeny;
    430         char *szMagicScript;
    431         char *szMagicOutput;
    432         char *szVetoFiles;
    433         char *szHideFiles;
    434         char *szVetoOplockFiles;
    435         char *comment;
    436         char *force_user;
    437         char *force_group;
    438         char **readlist;
    439         char **writelist;
    440         char **printer_admin;
    441         char *volume;
    442         char *fstype;
    443         char **szVfsObjects;
    444         char *szMSDfsProxy;
    445         char *szAioWriteBehind;
    446         char *szDfree;
    447         int iMinPrintSpace;
    448         int iMaxPrintJobs;
    449         int iMaxReportedPrintJobs;
    450         int iWriteCacheSize;
    451         int iCreate_mask;
    452         int iCreate_force_mode;
    453         int iSecurity_mask;
    454         int iSecurity_force_mode;
    455         int iDir_mask;
    456         int iDir_force_mode;
    457         int iDir_Security_mask;
    458         int iDir_Security_force_mode;
    459         int iMaxConnections;
    460         int iDefaultCase;
    461         int iPrinting;
    462         int iOplockContentionLimit;
    463         int iCSCPolicy;
    464         int iBlock_size;
    465         int iDfreeCacheTime;
    466         bool bPreexecClose;
    467         bool bRootpreexecClose;
    468         int  iCaseSensitive;
    469         bool bCasePreserve;
    470         bool bShortCasePreserve;
    471         bool bHideDotFiles;
    472         bool bHideSpecialFiles;
    473         bool bHideUnReadable;
    474         bool bHideUnWriteableFiles;
    475         bool bBrowseable;
    476         bool bAccessBasedShareEnum;
    477         bool bAvailable;
    478         bool bRead_only;
    479         bool bNo_set_dir;
    480         bool bGuest_only;
    481         bool bAdministrative_share;
    482         bool bGuest_ok;
    483         bool bPrint_ok;
    484         bool bPrintNotifyBackchannel;
    485         bool bMap_system;
    486         bool bMap_hidden;
    487         bool bMap_archive;
    488         bool bStoreDosAttributes;
    489         bool bDmapiSupport;
    490         bool bLocking;
    491         int iStrictLocking;
    492         bool bPosixLocking;
    493         bool bShareModes;
    494         bool bOpLocks;
    495         bool bLevel2OpLocks;
    496         bool bOnlyUser;
    497         bool bMangledNames;
    498         bool bWidelinks;
    499         bool bSymlinks;
    500         bool bSyncAlways;
    501         bool bStrictAllocate;
    502         bool bStrictSync;
    503         char magic_char;
    504         struct bitmap *copymap;
    505         bool bDeleteReadonly;
    506         bool bFakeOplocks;
    507         bool bDeleteVetoFiles;
    508         bool bDosFilemode;
    509         bool bDosFiletimes;
    510         bool bDosFiletimeResolution;
    511         bool bFakeDirCreateTimes;
    512         bool bBlockingLocks;
    513         bool bInheritPerms;
    514         bool bInheritACLS;
    515         bool bInheritOwner;
    516         bool bMSDfsRoot;
    517         bool bUseClientDriver;
    518         bool bDefaultDevmode;
    519         bool bForcePrintername;
    520         bool bNTAclSupport;
    521         bool bForceUnknownAclUser;
    522         bool bUseSendfile;
    523         bool bProfileAcls;
    524         bool bMap_acl_inherit;
    525         bool bAfs_Share;
    526         bool bEASupport;
    527         bool bAclCheckPermissions;
    528         bool bAclMapFullControl;
    529         bool bAclGroupControl;
    530         bool bChangeNotify;
    531         bool bKernelChangeNotify;
    532         int iallocation_roundup_size;
    533         int iAioReadSize;
    534         int iAioWriteSize;
    535         int iMap_readonly;
    536         int iDirectoryNameCacheSize;
    537         int ismb_encrypt;
    538         struct param_opt_struct *param_opt;
    539 
    540         char dummy[3];          /* for alignment */
    541 };
    542 
    543 
    544 /* This is a default service used to prime a services structure */
    545 static struct service sDefault = {
    546         True,                   /* valid */
    547         False,                  /* not autoloaded */
    548         0,                      /* not a usershare */
    549         {0, },                  /* No last mod time */
    550         NULL,                   /* szService */
    551         NULL,                   /* szPath */
    552         NULL,                   /* szUsername */
    553         NULL,                   /* szInvalidUsers */
    554         NULL,                   /* szValidUsers */
    555         NULL,                   /* szAdminUsers */
    556         NULL,                   /* szCopy */
    557         NULL,                   /* szInclude */
    558         NULL,                   /* szPreExec */
    559         NULL,                   /* szPostExec */
    560         NULL,                   /* szRootPreExec */
    561         NULL,                   /* szRootPostExec */
    562         NULL,                   /* szCupsOptions */
    563         NULL,                   /* szPrintcommand */
    564         NULL,                   /* szLpqcommand */
    565         NULL,                   /* szLprmcommand */
    566         NULL,                   /* szLppausecommand */
    567         NULL,                   /* szLpresumecommand */
    568         NULL,                   /* szQueuepausecommand */
    569         NULL,                   /* szQueueresumecommand */
    570         NULL,                   /* szPrintername */
    571         NULL,                   /* szPrintjobUsername */
    572         NULL,                   /* szDontdescend */
    573         NULL,                   /* szHostsallow */
    574         NULL,                   /* szHostsdeny */
    575         NULL,                   /* szMagicScript */
    576         NULL,                   /* szMagicOutput */
    577         NULL,                   /* szVetoFiles */
    578         NULL,                   /* szHideFiles */
    579         NULL,                   /* szVetoOplockFiles */
    580         NULL,                   /* comment */
    581         NULL,                   /* force user */
    582         NULL,                   /* force group */
    583         NULL,                   /* readlist */
    584         NULL,                   /* writelist */
    585         NULL,                   /* printer admin */
    586         NULL,                   /* volume */
    587         NULL,                   /* fstype */
    588         NULL,                   /* vfs objects */
    589         NULL,                   /* szMSDfsProxy */
    590         NULL,                   /* szAioWriteBehind */
    591         NULL,                   /* szDfree */
    592         0,                      /* iMinPrintSpace */
    593         1000,                   /* iMaxPrintJobs */
    594         0,                      /* iMaxReportedPrintJobs */
    595         0,                      /* iWriteCacheSize */
    596         0744,                   /* iCreate_mask */
    597         0000,                   /* iCreate_force_mode */
    598         0777,                   /* iSecurity_mask */
    599         0,                      /* iSecurity_force_mode */
    600         0755,                   /* iDir_mask */
    601         0000,                   /* iDir_force_mode */
    602         0777,                   /* iDir_Security_mask */
    603         0,                      /* iDir_Security_force_mode */
    604         0,                      /* iMaxConnections */
    605         CASE_LOWER,             /* iDefaultCase */
    606         DEFAULT_PRINTING,       /* iPrinting */
    607         2,                      /* iOplockContentionLimit */
    608         0,                      /* iCSCPolicy */
    609         1024,                   /* iBlock_size */
    610         0,                      /* iDfreeCacheTime */
    611         False,                  /* bPreexecClose */
    612         False,                  /* bRootpreexecClose */
    613         Auto,                   /* case sensitive */
    614         True,                   /* case preserve */
    615         True,                   /* short case preserve */
    616         True,                   /* bHideDotFiles */
    617         False,                  /* bHideSpecialFiles */
    618         False,                  /* bHideUnReadable */
    619         False,                  /* bHideUnWriteableFiles */
    620         True,                   /* bBrowseable */
    621         False,                  /* bAccessBasedShareEnum */
    622         True,                   /* bAvailable */
    623         True,                   /* bRead_only */
    624         True,                   /* bNo_set_dir */
    625         False,                  /* bGuest_only */
    626         False,                  /* bAdministrative_share */
    627         False,                  /* bGuest_ok */
    628         False,                  /* bPrint_ok */
    629         True,                   /* bPrintNotifyBackchannel */
    630         False,                  /* bMap_system */
    631         False,                  /* bMap_hidden */
    632         True,                   /* bMap_archive */
    633         False,                  /* bStoreDosAttributes */
    634         False,                  /* bDmapiSupport */
    635         True,                   /* bLocking */
    636         Auto,                   /* iStrictLocking */
    637         True,                   /* bPosixLocking */
    638         True,                   /* bShareModes */
    639         True,                   /* bOpLocks */
    640         True,                   /* bLevel2OpLocks */
    641         False,                  /* bOnlyUser */
    642         True,                   /* bMangledNames */
    643         false,                  /* bWidelinks */
    644         True,                   /* bSymlinks */
    645         False,                  /* bSyncAlways */
    646         False,                  /* bStrictAllocate */
    647         False,                  /* bStrictSync */
    648         '~',                    /* magic char */
    649         NULL,                   /* copymap */
    650         False,                  /* bDeleteReadonly */
    651         False,                  /* bFakeOplocks */
    652         False,                  /* bDeleteVetoFiles */
    653         False,                  /* bDosFilemode */
    654         True,                   /* bDosFiletimes */
    655         False,                  /* bDosFiletimeResolution */
    656         False,                  /* bFakeDirCreateTimes */
    657         True,                   /* bBlockingLocks */
    658         False,                  /* bInheritPerms */
    659         False,                  /* bInheritACLS */
    660         False,                  /* bInheritOwner */
    661         False,                  /* bMSDfsRoot */
    662         False,                  /* bUseClientDriver */
    663         True,                   /* bDefaultDevmode */
    664         False,                  /* bForcePrintername */
    665         True,                   /* bNTAclSupport */
    666         False,                  /* bForceUnknownAclUser */
    667         False,                  /* bUseSendfile */
    668         False,                  /* bProfileAcls */
    669         False,                  /* bMap_acl_inherit */
    670         False,                  /* bAfs_Share */
    671         False,                  /* bEASupport */
    672         True,                   /* bAclCheckPermissions */
    673         True,                   /* bAclMapFullControl */
    674         False,                  /* bAclGroupControl */
    675         True,                   /* bChangeNotify */
    676         True,                   /* bKernelChangeNotify */
    677         SMB_ROUNDUP_ALLOCATION_SIZE,            /* iallocation_roundup_size */
    678         0,                      /* iAioReadSize */
    679         0,                      /* iAioWriteSize */
    680         MAP_READONLY_YES,       /* iMap_readonly */
    681 #ifdef BROKEN_DIRECTORY_HANDLING
    682         0,                      /* iDirectoryNameCacheSize */
    683 #else
    684         100,                    /* iDirectoryNameCacheSize */
    685 #endif
    686         Auto,                   /* ismb_encrypt */
    687         NULL,                   /* Parametric options */
    688 
    689         ""                      /* dummy */
    690 };
    691 
    692254/* local variables */
    693 static struct service **ServicePtrs = NULL;
     255static struct loadparm_service **ServicePtrs = NULL;
    694256static int iNumServices = 0;
    695257static int iServiceIndex = 0;
    696258static struct db_context *ServiceHash;
    697 static int *invalid_services = NULL;
    698 static int num_invalid_services = 0;
    699 static bool bInGlobalSection = True;
    700 static bool bGlobalOnly = False;
    701 static int default_server_announce;
    702 
    703 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
    704 
    705 /* prototypes for the special type handlers */
    706 static bool handle_include( int snum, const char *pszParmValue, char **ptr);
    707 static bool handle_copy( int snum, const char *pszParmValue, char **ptr);
    708 static bool handle_netbios_name( int snum, const char *pszParmValue, char **ptr);
    709 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr);
    710 static bool handle_idmap_uid( int snum, const char *pszParmValue, char **ptr);
    711 static bool handle_idmap_gid( int snum, const char *pszParmValue, char **ptr);
    712 static bool handle_debug_list( int snum, const char *pszParmValue, char **ptr );
    713 static bool handle_workgroup( int snum, const char *pszParmValue, char **ptr );
    714 static bool handle_netbios_aliases( int snum, const char *pszParmValue, char **ptr );
    715 static bool handle_netbios_scope( int snum, const char *pszParmValue, char **ptr );
    716 static bool handle_charset( int snum, const char *pszParmValue, char **ptr );
    717 static bool handle_dos_charset( int snum, const char *pszParmValue, char **ptr );
    718 static bool handle_printing( int snum, const char *pszParmValue, char **ptr);
    719 static bool handle_ldap_debug_level( int snum, const char *pszParmValue, char **ptr);
    720 
    721 static void set_default_server_announce_type(void);
     259static bool bInGlobalSection = true;
     260static bool bGlobalOnly = false;
     261static struct file_lists *file_lists = NULL;
     262static unsigned int *flags_list = NULL;
     263
    722264static void set_allowed_client_auth(void);
    723265
    724 static void *lp_local_ptr(struct service *service, void *ptr);
    725 
    726 static void add_to_file_list(const char *fname, const char *subfname);
    727 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values);
    728 
    729 static const struct enum_list enum_protocol[] = {
    730         {PROTOCOL_SMB2, "SMB2"},
    731         {PROTOCOL_NT1, "NT1"},
    732         {PROTOCOL_LANMAN2, "LANMAN2"},
    733         {PROTOCOL_LANMAN1, "LANMAN1"},
    734         {PROTOCOL_CORE, "CORE"},
    735         {PROTOCOL_COREPLUS, "COREPLUS"},
    736         {PROTOCOL_COREPLUS, "CORE+"},
    737         {-1, NULL}
    738 };
    739 
    740 static const struct enum_list enum_security[] = {
    741         {SEC_SHARE, "SHARE"},
    742         {SEC_USER, "USER"},
    743         {SEC_SERVER, "SERVER"},
    744         {SEC_DOMAIN, "DOMAIN"},
    745 #ifdef HAVE_ADS
    746         {SEC_ADS, "ADS"},
    747 #endif
    748         {-1, NULL}
    749 };
    750 
    751 static const struct enum_list enum_printing[] = {
    752         {PRINT_SYSV, "sysv"},
    753         {PRINT_AIX, "aix"},
    754         {PRINT_HPUX, "hpux"},
    755         {PRINT_BSD, "bsd"},
    756         {PRINT_QNX, "qnx"},
    757         {PRINT_PLP, "plp"},
    758         {PRINT_LPRNG, "lprng"},
    759         {PRINT_CUPS, "cups"},
    760         {PRINT_IPRINT, "iprint"},
    761         {PRINT_LPRNT, "nt"},
    762         {PRINT_LPROS2, "os2"},
    763 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
    764         {PRINT_TEST, "test"},
    765         {PRINT_VLP, "vlp"},
    766 #endif /* DEVELOPER */
    767         {-1, NULL}
    768 };
    769 
    770 static const struct enum_list enum_ldap_sasl_wrapping[] = {
    771         {0, "plain"},
    772         {ADS_AUTH_SASL_SIGN, "sign"},
    773         {ADS_AUTH_SASL_SEAL, "seal"},
    774         {-1, NULL}
    775 };
    776 
    777 static const struct enum_list enum_ldap_ssl[] = {
    778         {LDAP_SSL_OFF, "no"},
    779         {LDAP_SSL_OFF, "off"},
    780         {LDAP_SSL_START_TLS, "start tls"},
    781         {LDAP_SSL_START_TLS, "start_tls"},
    782         {-1, NULL}
    783 };
    784 
    785 /* LDAP Dereferencing Alias types */
    786 #define SAMBA_LDAP_DEREF_NEVER          0
    787 #define SAMBA_LDAP_DEREF_SEARCHING      1
    788 #define SAMBA_LDAP_DEREF_FINDING        2
    789 #define SAMBA_LDAP_DEREF_ALWAYS         3
    790 
    791 static const struct enum_list enum_ldap_deref[] = {
    792         {SAMBA_LDAP_DEREF_NEVER, "never"},
    793         {SAMBA_LDAP_DEREF_SEARCHING, "searching"},
    794         {SAMBA_LDAP_DEREF_FINDING, "finding"},
    795         {SAMBA_LDAP_DEREF_ALWAYS, "always"},
    796         {-1, "auto"}
    797 };
    798 
    799 static const struct enum_list enum_ldap_passwd_sync[] = {
    800         {LDAP_PASSWD_SYNC_OFF, "no"},
    801         {LDAP_PASSWD_SYNC_OFF, "off"},
    802         {LDAP_PASSWD_SYNC_ON, "yes"},
    803         {LDAP_PASSWD_SYNC_ON, "on"},
    804         {LDAP_PASSWD_SYNC_ONLY, "only"},
    805         {-1, NULL}
    806 };
    807 
    808 /* Types of machine we can announce as. */
    809 #define ANNOUNCE_AS_NT_SERVER 1
    810 #define ANNOUNCE_AS_WIN95 2
    811 #define ANNOUNCE_AS_WFW 3
    812 #define ANNOUNCE_AS_NT_WORKSTATION 4
    813 
    814 static const struct enum_list enum_announce_as[] = {
    815         {ANNOUNCE_AS_NT_SERVER, "NT"},
    816         {ANNOUNCE_AS_NT_SERVER, "NT Server"},
    817         {ANNOUNCE_AS_NT_WORKSTATION, "NT Workstation"},
    818         {ANNOUNCE_AS_WIN95, "win95"},
    819         {ANNOUNCE_AS_WFW, "WfW"},
    820         {-1, NULL}
    821 };
    822 
    823 static const struct enum_list enum_map_readonly[] = {
    824         {MAP_READONLY_NO, "no"},
    825         {MAP_READONLY_NO, "false"},
    826         {MAP_READONLY_NO, "0"},
    827         {MAP_READONLY_YES, "yes"},
    828         {MAP_READONLY_YES, "true"},
    829         {MAP_READONLY_YES, "1"},
    830         {MAP_READONLY_PERMISSIONS, "permissions"},
    831         {MAP_READONLY_PERMISSIONS, "perms"},
    832         {-1, NULL}
    833 };
    834 
    835 static const struct enum_list enum_case[] = {
    836         {CASE_LOWER, "lower"},
    837         {CASE_UPPER, "upper"},
    838         {-1, NULL}
    839 };
    840 
    841 
    842 
    843 static const struct enum_list enum_bool_auto[] = {
    844         {False, "No"},
    845         {False, "False"},
    846         {False, "0"},
    847         {True, "Yes"},
    848         {True, "True"},
    849         {True, "1"},
    850         {Auto, "Auto"},
    851         {-1, NULL}
    852 };
    853 
    854 static const struct enum_list enum_csc_policy[] = {
    855         {CSC_POLICY_MANUAL, "manual"},
    856         {CSC_POLICY_DOCUMENTS, "documents"},
    857         {CSC_POLICY_PROGRAMS, "programs"},
    858         {CSC_POLICY_DISABLE, "disable"},
    859         {-1, NULL}
    860 };
    861 
    862 /* SMB signing types. */
    863 static const struct enum_list enum_smb_signing_vals[] = {
    864         {False, "No"},
    865         {False, "False"},
    866         {False, "0"},
    867         {False, "Off"},
    868         {False, "disabled"},
    869         {True, "Yes"},
    870         {True, "True"},
    871         {True, "1"},
    872         {True, "On"},
    873         {True, "enabled"},
    874         {Auto, "auto"},
    875         {Required, "required"},
    876         {Required, "mandatory"},
    877         {Required, "force"},
    878         {Required, "forced"},
    879         {Required, "enforced"},
    880         {-1, NULL}
    881 };
    882 
    883 /* ACL compatibility options. */
    884 static const struct enum_list enum_acl_compat_vals[] = {
    885     { ACL_COMPAT_AUTO, "auto" },
    886     { ACL_COMPAT_WINNT, "winnt" },
    887     { ACL_COMPAT_WIN2K, "win2k" },
    888     { -1, NULL}
    889 };
    890 
    891 /*
    892    Do you want session setups at user level security with a invalid
    893    password to be rejected or allowed in as guest? WinNT rejects them
    894    but it can be a pain as it means "net view" needs to use a password
    895 
    896    You have 3 choices in the setting of map_to_guest:
    897 
    898    "Never" means session setups with an invalid password
    899    are rejected. This is the default.
    900 
    901    "Bad User" means session setups with an invalid password
    902    are rejected, unless the username does not exist, in which case it
    903    is treated as a guest login
    904 
    905    "Bad Password" means session setups with an invalid password
    906    are treated as a guest login
    907 
    908    Note that map_to_guest only has an effect in user or server
    909    level security.
    910 */
    911 
    912 static const struct enum_list enum_map_to_guest[] = {
    913         {NEVER_MAP_TO_GUEST, "Never"},
    914         {MAP_TO_GUEST_ON_BAD_USER, "Bad User"},
    915         {MAP_TO_GUEST_ON_BAD_PASSWORD, "Bad Password"},
    916         {MAP_TO_GUEST_ON_BAD_UID, "Bad Uid"},
    917         {-1, NULL}
    918 };
    919 
    920 /* Config backend options */
    921 
    922 static const struct enum_list enum_config_backend[] = {
    923         {CONFIG_BACKEND_FILE, "file"},
    924         {CONFIG_BACKEND_REGISTRY, "registry"},
    925         {-1, NULL}
    926 };
    927 
    928 /* ADS kerberos ticket verification options */
    929 
    930 static const struct enum_list enum_kerberos_method[] = {
    931         {KERBEROS_VERIFY_SECRETS, "default"},
    932         {KERBEROS_VERIFY_SECRETS, "secrets only"},
    933         {KERBEROS_VERIFY_SYSTEM_KEYTAB, "system keytab"},
    934         {KERBEROS_VERIFY_DEDICATED_KEYTAB, "dedicated keytab"},
    935         {KERBEROS_VERIFY_SECRETS_AND_KEYTAB, "secrets and keytab"},
    936         {-1, NULL}
    937 };
    938 
    939 /* Note: We do not initialise the defaults union - it is not allowed in ANSI C
    940  *
    941  * The FLAG_HIDE is explicit. Parameters set this way do NOT appear in any edit
    942  * screen in SWAT. This is used to exclude parameters as well as to squash all
    943  * parameters that have been duplicated by pseudonyms.
    944  *
    945  * NOTE: To display a parameter in BASIC view set FLAG_BASIC
    946  *       Any parameter that does NOT have FLAG_ADVANCED will not disply at all
    947  *       Set FLAG_SHARE and FLAG_PRINT to specifically display parameters in
    948  *        respective views.
    949  *
    950  * NOTE2: Handling of duplicated (synonym) parameters:
    951  *      Only the first occurance of a parameter should be enabled by FLAG_BASIC
    952  *      and/or FLAG_ADVANCED. All duplicates following the first mention should be
    953  *      set to FLAG_HIDE. ie: Make you must place the parameter that has the preferred
    954  *      name first, and all synonyms must follow it with the FLAG_HIDE attribute.
    955  */
    956 
    957 static struct parm_struct parm_table[] = {
    958         {N_("Base Options"), P_SEP, P_SEPARATOR},
    959 
    960         {
    961                 .label          = "dos charset",
    962                 .type           = P_STRING,
    963                 .p_class        = P_GLOBAL,
    964                 .ptr            = &Globals.dos_charset,
    965                 .special        = handle_dos_charset,
    966                 .enum_list      = NULL,
    967                 .flags          = FLAG_ADVANCED
    968         },
    969         {
    970                 .label          = "unix charset",
    971                 .type           = P_STRING,
    972                 .p_class        = P_GLOBAL,
    973                 .ptr            = &Globals.unix_charset,
    974                 .special        = handle_charset,
    975                 .enum_list      = NULL,
    976                 .flags          = FLAG_ADVANCED
    977         },
    978         {
    979                 .label          = "display charset",
    980                 .type           = P_STRING,
    981                 .p_class        = P_GLOBAL,
    982                 .ptr            = &Globals.display_charset,
    983                 .special        = handle_charset,
    984                 .enum_list      = NULL,
    985                 .flags          = FLAG_ADVANCED
    986         },
    987         {
    988                 .label          = "comment",
    989                 .type           = P_STRING,
    990                 .p_class        = P_LOCAL,
    991                 .ptr            = &sDefault.comment,
    992                 .special        = NULL,
    993                 .enum_list      = NULL,
    994                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT
    995         },
    996         {
    997                 .label          = "path",
    998                 .type           = P_STRING,
    999                 .p_class        = P_LOCAL,
    1000                 .ptr            = &sDefault.szPath,
    1001                 .special        = NULL,
    1002                 .enum_list      = NULL,
    1003                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    1004         },
    1005         {
    1006                 .label          = "directory",
    1007                 .type           = P_STRING,
    1008                 .p_class        = P_LOCAL,
    1009                 .ptr            = &sDefault.szPath,
    1010                 .special        = NULL,
    1011                 .enum_list      = NULL,
    1012                 .flags          = FLAG_HIDE,
    1013         },
    1014         {
    1015                 .label          = "workgroup",
    1016                 .type           = P_USTRING,
    1017                 .p_class        = P_GLOBAL,
    1018                 .ptr            = &Globals.szWorkgroup,
    1019                 .special        = handle_workgroup,
    1020                 .enum_list      = NULL,
    1021                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1022         },
    1023 #ifdef WITH_ADS
    1024         {
    1025                 .label          = "realm",
    1026                 .type           = P_USTRING,
    1027                 .p_class        = P_GLOBAL,
    1028                 .ptr            = &Globals.szRealm,
    1029                 .special        = NULL,
    1030                 .enum_list      = NULL,
    1031                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1032         },
    1033 #endif
    1034         {
    1035                 .label          = "netbios name",
    1036                 .type           = P_USTRING,
    1037                 .p_class        = P_GLOBAL,
    1038                 .ptr            = &Globals.szNetbiosName,
    1039                 .special        = handle_netbios_name,
    1040                 .enum_list      = NULL,
    1041                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1042         },
    1043         {
    1044                 .label          = "netbios aliases",
    1045                 .type           = P_LIST,
    1046                 .p_class        = P_GLOBAL,
    1047                 .ptr            = &Globals.szNetbiosAliases,
    1048                 .special        = handle_netbios_aliases,
    1049                 .enum_list      = NULL,
    1050                 .flags          = FLAG_ADVANCED,
    1051         },
    1052         {
    1053                 .label          = "netbios scope",
    1054                 .type           = P_USTRING,
    1055                 .p_class        = P_GLOBAL,
    1056                 .ptr            = &Globals.szNetbiosScope,
    1057                 .special        = handle_netbios_scope,
    1058                 .enum_list      = NULL,
    1059                 .flags          = FLAG_ADVANCED,
    1060         },
    1061         {
    1062                 .label          = "server string",
    1063                 .type           = P_STRING,
    1064                 .p_class        = P_GLOBAL,
    1065                 .ptr            = &Globals.szServerString,
    1066                 .special        = NULL,
    1067                 .enum_list      = NULL,
    1068                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    1069         },
    1070         {
    1071                 .label          = "interfaces",
    1072                 .type           = P_LIST,
    1073                 .p_class        = P_GLOBAL,
    1074                 .ptr            = &Globals.szInterfaces,
    1075                 .special        = NULL,
    1076                 .enum_list      = NULL,
    1077                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1078         },
    1079         {
    1080                 .label          = "bind interfaces only",
    1081                 .type           = P_BOOL,
    1082                 .p_class        = P_GLOBAL,
    1083                 .ptr            = &Globals.bBindInterfacesOnly,
    1084                 .special        = NULL,
    1085                 .enum_list      = NULL,
    1086                 .flags          = FLAG_ADVANCED | FLAG_WIZARD,
    1087         },
    1088         {
    1089                 .label          = "config backend",
    1090                 .type           = P_ENUM,
    1091                 .p_class        = P_GLOBAL,
    1092                 .ptr            = &Globals.ConfigBackend,
    1093                 .special        = NULL,
    1094                 .enum_list      = enum_config_backend,
    1095                 .flags          = FLAG_HIDE|FLAG_ADVANCED|FLAG_META,
    1096         },
    1097 
    1098         {N_("Security Options"), P_SEP, P_SEPARATOR},
    1099 
    1100         {
    1101                 .label          = "security",
    1102                 .type           = P_ENUM,
    1103                 .p_class        = P_GLOBAL,
    1104                 .ptr            = &Globals.security,
    1105                 .special        = NULL,
    1106                 .enum_list      = enum_security,
    1107                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1108         },
    1109         {
    1110                 .label          = "auth methods",
    1111                 .type           = P_LIST,
    1112                 .p_class        = P_GLOBAL,
    1113                 .ptr            = &Globals.AuthMethods,
    1114                 .special        = NULL,
    1115                 .enum_list      = NULL,
    1116                 .flags          = FLAG_ADVANCED,
    1117         },
    1118         {
    1119                 .label          = "encrypt passwords",
    1120                 .type           = P_BOOL,
    1121                 .p_class        = P_GLOBAL,
    1122                 .ptr            = &Globals.bEncryptPasswords,
    1123                 .special        = NULL,
    1124                 .enum_list      = NULL,
    1125                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    1126         },
    1127         {
    1128                 .label          = "client schannel",
    1129                 .type           = P_ENUM,
    1130                 .p_class        = P_GLOBAL,
    1131                 .ptr            = &Globals.clientSchannel,
    1132                 .special        = NULL,
    1133                 .enum_list      = enum_bool_auto,
    1134                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    1135         },
    1136         {
    1137                 .label          = "server schannel",
    1138                 .type           = P_ENUM,
    1139                 .p_class        = P_GLOBAL,
    1140                 .ptr            = &Globals.serverSchannel,
    1141                 .special        = NULL,
    1142                 .enum_list      = enum_bool_auto,
    1143                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    1144         },
    1145         {
    1146                 .label          = "allow trusted domains",
    1147                 .type           = P_BOOL,
    1148                 .p_class        = P_GLOBAL,
    1149                 .ptr            = &Globals.bAllowTrustedDomains,
    1150                 .special        = NULL,
    1151                 .enum_list      = NULL,
    1152                 .flags          = FLAG_ADVANCED,
    1153         },
    1154         {
    1155                 .label          = "map to guest",
    1156                 .type           = P_ENUM,
    1157                 .p_class        = P_GLOBAL,
    1158                 .ptr            = &Globals.map_to_guest,
    1159                 .special        = NULL,
    1160                 .enum_list      = enum_map_to_guest,
    1161                 .flags          = FLAG_ADVANCED,
    1162         },
    1163         {
    1164                 .label          = "null passwords",
    1165                 .type           = P_BOOL,
    1166                 .p_class        = P_GLOBAL,
    1167                 .ptr            = &Globals.bNullPasswords,
    1168                 .special        = NULL,
    1169                 .enum_list      = NULL,
    1170                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    1171         },
    1172         {
    1173                 .label          = "obey pam restrictions",
    1174                 .type           = P_BOOL,
    1175                 .p_class        = P_GLOBAL,
    1176                 .ptr            = &Globals.bObeyPamRestrictions,
    1177                 .special        = NULL,
    1178                 .enum_list      = NULL,
    1179                 .flags          = FLAG_ADVANCED,
    1180         },
    1181         {
    1182                 .label          = "password server",
    1183                 .type           = P_STRING,
    1184                 .p_class        = P_GLOBAL,
    1185                 .ptr            = &Globals.szPasswordServer,
    1186                 .special        = NULL,
    1187                 .enum_list      = NULL,
    1188                 .flags          = FLAG_ADVANCED | FLAG_WIZARD,
    1189         },
    1190         {
    1191                 .label          = "smb passwd file",
    1192                 .type           = P_STRING,
    1193                 .p_class        = P_GLOBAL,
    1194                 .ptr            = &Globals.szSMBPasswdFile,
    1195                 .special        = NULL,
    1196                 .enum_list      = NULL,
    1197                 .flags          = FLAG_ADVANCED,
    1198         },
    1199         {
    1200                 .label          = "private dir",
    1201                 .type           = P_STRING,
    1202                 .p_class        = P_GLOBAL,
    1203                 .ptr            = &Globals.szPrivateDir,
    1204                 .special        = NULL,
    1205                 .enum_list      = NULL,
    1206                 .flags          = FLAG_ADVANCED,
    1207         },
    1208         {
    1209                 .label          = "passdb backend",
    1210                 .type           = P_STRING,
    1211                 .p_class        = P_GLOBAL,
    1212                 .ptr            = &Globals.szPassdbBackend,
    1213                 .special        = NULL,
    1214                 .enum_list      = NULL,
    1215                 .flags          = FLAG_ADVANCED | FLAG_WIZARD,
    1216         },
    1217         {
    1218                 .label          = "algorithmic rid base",
    1219                 .type           = P_INTEGER,
    1220                 .p_class        = P_GLOBAL,
    1221                 .ptr            = &Globals.AlgorithmicRidBase,
    1222                 .special        = NULL,
    1223                 .enum_list      = NULL,
    1224                 .flags          = FLAG_ADVANCED,
    1225         },
    1226         {
    1227                 .label          = "root directory",
    1228                 .type           = P_STRING,
    1229                 .p_class        = P_GLOBAL,
    1230                 .ptr            = &Globals.szRootdir,
    1231                 .special        = NULL,
    1232                 .enum_list      = NULL,
    1233                 .flags          = FLAG_ADVANCED,
    1234         },
    1235         {
    1236                 .label          = "root dir",
    1237                 .type           = P_STRING,
    1238                 .p_class        = P_GLOBAL,
    1239                 .ptr            = &Globals.szRootdir,
    1240                 .special        = NULL,
    1241                 .enum_list      = NULL,
    1242                 .flags          = FLAG_HIDE,
    1243         },
    1244         {
    1245                 .label          = "root",
    1246                 .type           = P_STRING,
    1247                 .p_class        = P_GLOBAL,
    1248                 .ptr            = &Globals.szRootdir,
    1249                 .special        = NULL,
    1250                 .enum_list      = NULL,
    1251                 .flags          = FLAG_HIDE,
    1252         },
    1253         {
    1254                 .label          = "guest account",
    1255                 .type           = P_STRING,
    1256                 .p_class        = P_GLOBAL,
    1257                 .ptr            = &Globals.szGuestaccount,
    1258                 .special        = NULL,
    1259                 .enum_list      = NULL,
    1260                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    1261         },
    1262         {
    1263                 .label          = "enable privileges",
    1264                 .type           = P_BOOL,
    1265                 .p_class        = P_GLOBAL,
    1266                 .ptr            = &Globals.bEnablePrivileges,
    1267                 .special        = NULL,
    1268                 .enum_list      = NULL,
    1269                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    1270         },
    1271 
    1272         {
    1273                 .label          = "pam password change",
    1274                 .type           = P_BOOL,
    1275                 .p_class        = P_GLOBAL,
    1276                 .ptr            = &Globals.bPamPasswordChange,
    1277                 .special        = NULL,
    1278                 .enum_list      = NULL,
    1279                 .flags          = FLAG_ADVANCED,
    1280         },
    1281         {
    1282                 .label          = "passwd program",
    1283                 .type           = P_STRING,
    1284                 .p_class        = P_GLOBAL,
    1285                 .ptr            = &Globals.szPasswdProgram,
    1286                 .special        = NULL,
    1287                 .enum_list      = NULL,
    1288                 .flags          = FLAG_ADVANCED,
    1289         },
    1290         {
    1291                 .label          = "passwd chat",
    1292                 .type           = P_STRING,
    1293                 .p_class        = P_GLOBAL,
    1294                 .ptr            = &Globals.szPasswdChat,
    1295                 .special        = NULL,
    1296                 .enum_list      = NULL,
    1297                 .flags          = FLAG_ADVANCED,
    1298         },
    1299         {
    1300                 .label          = "passwd chat debug",
    1301                 .type           = P_BOOL,
    1302                 .p_class        = P_GLOBAL,
    1303                 .ptr            = &Globals.bPasswdChatDebug,
    1304                 .special        = NULL,
    1305                 .enum_list      = NULL,
    1306                 .flags          = FLAG_ADVANCED,
    1307         },
    1308         {
    1309                 .label          = "passwd chat timeout",
    1310                 .type           = P_INTEGER,
    1311                 .p_class        = P_GLOBAL,
    1312                 .ptr            = &Globals.iPasswdChatTimeout,
    1313                 .special        = NULL,
    1314                 .enum_list      = NULL,
    1315                 .flags          = FLAG_ADVANCED,
    1316         },
    1317         {
    1318                 .label          = "check password script",
    1319                 .type           = P_STRING,
    1320                 .p_class        = P_GLOBAL,
    1321                 .ptr            = &Globals.szCheckPasswordScript,
    1322                 .special        = NULL,
    1323                 .enum_list      = NULL,
    1324                 .flags          = FLAG_ADVANCED,
    1325         },
    1326         {
    1327                 .label          = "username map",
    1328                 .type           = P_STRING,
    1329                 .p_class        = P_GLOBAL,
    1330                 .ptr            = &Globals.szUsernameMap,
    1331                 .special        = NULL,
    1332                 .enum_list      = NULL,
    1333                 .flags          = FLAG_ADVANCED,
    1334         },
    1335         {
    1336                 .label          = "password level",
    1337                 .type           = P_INTEGER,
    1338                 .p_class        = P_GLOBAL,
    1339                 .ptr            = &Globals.pwordlevel,
    1340                 .special        = NULL,
    1341                 .enum_list      = NULL,
    1342                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    1343         },
    1344         {
    1345                 .label          = "username level",
    1346                 .type           = P_INTEGER,
    1347                 .p_class        = P_GLOBAL,
    1348                 .ptr            = &Globals.unamelevel,
    1349                 .special        = NULL,
    1350                 .enum_list      = NULL,
    1351                 .flags          = FLAG_ADVANCED,
    1352         },
    1353         {
    1354                 .label          = "unix password sync",
    1355                 .type           = P_BOOL,
    1356                 .p_class        = P_GLOBAL,
    1357                 .ptr            = &Globals.bUnixPasswdSync,
    1358                 .special        = NULL,
    1359                 .enum_list      = NULL,
    1360                 .flags          = FLAG_ADVANCED,
    1361         },
    1362         {
    1363                 .label          = "restrict anonymous",
    1364                 .type           = P_INTEGER,
    1365                 .p_class        = P_GLOBAL,
    1366                 .ptr            = &Globals.restrict_anonymous,
    1367                 .special        = NULL,
    1368                 .enum_list      = NULL,
    1369                 .flags          = FLAG_ADVANCED,
    1370         },
    1371         {
    1372                 .label          = "lanman auth",
    1373                 .type           = P_BOOL,
    1374                 .p_class        = P_GLOBAL,
    1375                 .ptr            = &Globals.bLanmanAuth,
    1376                 .special        = NULL,
    1377                 .enum_list      = NULL,
    1378                 .flags          = FLAG_ADVANCED,
    1379         },
    1380         {
    1381                 .label          = "ntlm auth",
    1382                 .type           = P_BOOL,
    1383                 .p_class        = P_GLOBAL,
    1384                 .ptr            = &Globals.bNTLMAuth,
    1385                 .special        = NULL,
    1386                 .enum_list      = NULL,
    1387                 .flags          = FLAG_ADVANCED,
    1388         },
    1389         {
    1390                 .label          = "raw NTLMv2 auth",
    1391                 .type           = P_BOOL,
    1392                 .p_class        = P_GLOBAL,
    1393                 .ptr            = &Globals.bRawNTLMv2Auth,
    1394                 .special        = NULL,
    1395                 .enum_list      = NULL,
    1396                 .flags          = FLAG_ADVANCED,
    1397         },
    1398         {
    1399                 .label          = "client NTLMv2 auth",
    1400                 .type           = P_BOOL,
    1401                 .p_class        = P_GLOBAL,
    1402                 .ptr            = &Globals.bClientNTLMv2Auth,
    1403                 .special        = NULL,
    1404                 .enum_list      = NULL,
    1405                 .flags          = FLAG_ADVANCED,
    1406         },
    1407         {
    1408                 .label          = "client lanman auth",
    1409                 .type           = P_BOOL,
    1410                 .p_class        = P_GLOBAL,
    1411                 .ptr            = &Globals.bClientLanManAuth,
    1412                 .special        = NULL,
    1413                 .enum_list      = NULL,
    1414                 .flags          = FLAG_ADVANCED,
    1415         },
    1416         {
    1417                 .label          = "client plaintext auth",
    1418                 .type           = P_BOOL,
    1419                 .p_class        = P_GLOBAL,
    1420                 .ptr            = &Globals.bClientPlaintextAuth,
    1421                 .special        = NULL,
    1422                 .enum_list      = NULL,
    1423                 .flags          = FLAG_ADVANCED,
    1424         },
    1425         {
    1426                 .label          = "client use spnego principal",
    1427                 .type           = P_BOOL,
    1428                 .p_class        = P_GLOBAL,
    1429                 .ptr            = &Globals.client_use_spnego_principal,
    1430                 .special        = NULL,
    1431                 .enum_list      = NULL,
    1432                 .flags          = FLAG_ADVANCED,
    1433         },
    1434         {
    1435                 .label          = "send spnego principal",
    1436                 .type           = P_BOOL,
    1437                 .p_class        = P_GLOBAL,
    1438                 .ptr            = &Globals.send_spnego_principal,
    1439                 .special        = NULL,
    1440                 .enum_list      = NULL,
    1441                 .flags          = FLAG_ADVANCED,
    1442         },
    1443         {
    1444                 .label          = "username",
    1445                 .type           = P_STRING,
    1446                 .p_class        = P_LOCAL,
    1447                 .ptr            = &sDefault.szUsername,
    1448                 .special        = NULL,
    1449                 .enum_list      = NULL,
    1450                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE | FLAG_DEPRECATED,
    1451         },
    1452         {
    1453                 .label          = "user",
    1454                 .type           = P_STRING,
    1455                 .p_class        = P_LOCAL,
    1456                 .ptr            = &sDefault.szUsername,
    1457                 .special        = NULL,
    1458                 .enum_list      = NULL,
    1459                 .flags          = FLAG_HIDE,
    1460         },
    1461         {
    1462                 .label          = "users",
    1463                 .type           = P_STRING,
    1464                 .p_class        = P_LOCAL,
    1465                 .ptr            = &sDefault.szUsername,
    1466                 .special        = NULL,
    1467                 .enum_list      = NULL,
    1468                 .flags          = FLAG_HIDE,
    1469         },
    1470         {
    1471                 .label          = "invalid users",
    1472                 .type           = P_LIST,
    1473                 .p_class        = P_LOCAL,
    1474                 .ptr            = &sDefault.szInvalidUsers,
    1475                 .special        = NULL,
    1476                 .enum_list      = NULL,
    1477                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1478         },
    1479         {
    1480                 .label          = "valid users",
    1481                 .type           = P_LIST,
    1482                 .p_class        = P_LOCAL,
    1483                 .ptr            = &sDefault.szValidUsers,
    1484                 .special        = NULL,
    1485                 .enum_list      = NULL,
    1486                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1487         },
    1488         {
    1489                 .label          = "admin users",
    1490                 .type           = P_LIST,
    1491                 .p_class        = P_LOCAL,
    1492                 .ptr            = &sDefault.szAdminUsers,
    1493                 .special        = NULL,
    1494                 .enum_list      = NULL,
    1495                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1496         },
    1497         {
    1498                 .label          = "read list",
    1499                 .type           = P_LIST,
    1500                 .p_class        = P_LOCAL,
    1501                 .ptr            = &sDefault.readlist,
    1502                 .special        = NULL,
    1503                 .enum_list      = NULL,
    1504                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1505         },
    1506         {
    1507                 .label          = "write list",
    1508                 .type           = P_LIST,
    1509                 .p_class        = P_LOCAL,
    1510                 .ptr            = &sDefault.writelist,
    1511                 .special        = NULL,
    1512                 .enum_list      = NULL,
    1513                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1514         },
    1515         {
    1516                 .label          = "printer admin",
    1517                 .type           = P_LIST,
    1518                 .p_class        = P_LOCAL,
    1519                 .ptr            = &sDefault.printer_admin,
    1520                 .special        = NULL,
    1521                 .enum_list      = NULL,
    1522                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_PRINT | FLAG_DEPRECATED,
    1523         },
    1524         {
    1525                 .label          = "force user",
    1526                 .type           = P_STRING,
    1527                 .p_class        = P_LOCAL,
    1528                 .ptr            = &sDefault.force_user,
    1529                 .special        = NULL,
    1530                 .enum_list      = NULL,
    1531                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1532         },
    1533         {
    1534                 .label          = "force group",
    1535                 .type           = P_STRING,
    1536                 .p_class        = P_LOCAL,
    1537                 .ptr            = &sDefault.force_group,
    1538                 .special        = NULL,
    1539                 .enum_list      = NULL,
    1540                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1541         },
    1542         {
    1543                 .label          = "group",
    1544                 .type           = P_STRING,
    1545                 .p_class        = P_LOCAL,
    1546                 .ptr            = &sDefault.force_group,
    1547                 .special        = NULL,
    1548                 .enum_list      = NULL,
    1549                 .flags          = FLAG_ADVANCED,
    1550         },
    1551         {
    1552                 .label          = "read only",
    1553                 .type           = P_BOOL,
    1554                 .p_class        = P_LOCAL,
    1555                 .ptr            = &sDefault.bRead_only,
    1556                 .special        = NULL,
    1557                 .enum_list      = NULL,
    1558                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE,
    1559         },
    1560         {
    1561                 .label          = "write ok",
    1562                 .type           = P_BOOLREV,
    1563                 .p_class        = P_LOCAL,
    1564                 .ptr            = &sDefault.bRead_only,
    1565                 .special        = NULL,
    1566                 .enum_list      = NULL,
    1567                 .flags          = FLAG_HIDE,
    1568         },
    1569         {
    1570                 .label          = "writeable",
    1571                 .type           = P_BOOLREV,
    1572                 .p_class        = P_LOCAL,
    1573                 .ptr            = &sDefault.bRead_only,
    1574                 .special        = NULL,
    1575                 .enum_list      = NULL,
    1576                 .flags          = FLAG_HIDE,
    1577         },
    1578         {
    1579                 .label          = "writable",
    1580                 .type           = P_BOOLREV,
    1581                 .p_class        = P_LOCAL,
    1582                 .ptr            = &sDefault.bRead_only,
    1583                 .special        = NULL,
    1584                 .enum_list      = NULL,
    1585                 .flags          = FLAG_HIDE,
    1586         },
    1587         {
    1588                 .label          = "acl check permissions",
    1589                 .type           = P_BOOL,
    1590                 .p_class        = P_LOCAL,
    1591                 .ptr            = &sDefault.bAclCheckPermissions,
    1592                 .special        = NULL,
    1593                 .enum_list      = NULL,
    1594                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1595         },
    1596         {
    1597                 .label          = "acl group control",
    1598                 .type           = P_BOOL,
    1599                 .p_class        = P_LOCAL,
    1600                 .ptr            = &sDefault.bAclGroupControl,
    1601                 .special        = NULL,
    1602                 .enum_list      = NULL,
    1603                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1604         },
    1605         {
    1606                 .label          = "acl map full control",
    1607                 .type           = P_BOOL,
    1608                 .p_class        = P_LOCAL,
    1609                 .ptr            = &sDefault.bAclMapFullControl,
    1610                 .special        = NULL,
    1611                 .enum_list      = NULL,
    1612                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1613         },
    1614         {
    1615                 .label          = "create mask",
    1616                 .type           = P_OCTAL,
    1617                 .p_class        = P_LOCAL,
    1618                 .ptr            = &sDefault.iCreate_mask,
    1619                 .special        = NULL,
    1620                 .enum_list      = NULL,
    1621                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1622         },
    1623         {
    1624                 .label          = "create mode",
    1625                 .type           = P_OCTAL,
    1626                 .p_class        = P_LOCAL,
    1627                 .ptr            = &sDefault.iCreate_mask,
    1628                 .special        = NULL,
    1629                 .enum_list      = NULL,
    1630                 .flags          = FLAG_HIDE,
    1631         },
    1632         {
    1633                 .label          = "force create mode",
    1634                 .type           = P_OCTAL,
    1635                 .p_class        = P_LOCAL,
    1636                 .ptr            = &sDefault.iCreate_force_mode,
    1637                 .special        = NULL,
    1638                 .enum_list      = NULL,
    1639                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1640         },
    1641         {
    1642                 .label          = "security mask",
    1643                 .type           = P_OCTAL,
    1644                 .p_class        = P_LOCAL,
    1645                 .ptr            = &sDefault.iSecurity_mask,
    1646                 .special        = NULL,
    1647                 .enum_list      = NULL,
    1648                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1649         },
    1650         {
    1651                 .label          = "force security mode",
    1652                 .type           = P_OCTAL,
    1653                 .p_class        = P_LOCAL,
    1654                 .ptr            = &sDefault.iSecurity_force_mode,
    1655                 .special        = NULL,
    1656                 .enum_list      = NULL,
    1657                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1658         },
    1659         {
    1660                 .label          = "directory mask",
    1661                 .type           = P_OCTAL,
    1662                 .p_class        = P_LOCAL,
    1663                 .ptr            = &sDefault.iDir_mask,
    1664                 .special        = NULL,
    1665                 .enum_list      = NULL,
    1666                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1667         },
    1668         {
    1669                 .label          = "directory mode",
    1670                 .type           = P_OCTAL,
    1671                 .p_class        = P_LOCAL,
    1672                 .ptr            = &sDefault.iDir_mask,
    1673                 .special        = NULL,
    1674                 .enum_list      = NULL,
    1675                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    1676         },
    1677         {
    1678                 .label          = "force directory mode",
    1679                 .type           = P_OCTAL,
    1680                 .p_class        = P_LOCAL,
    1681                 .ptr            = &sDefault.iDir_force_mode,
    1682                 .special        = NULL,
    1683                 .enum_list      = NULL,
    1684                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1685         },
    1686         {
    1687                 .label          = "directory security mask",
    1688                 .type           = P_OCTAL,
    1689                 .p_class        = P_LOCAL,
    1690                 .ptr            = &sDefault.iDir_Security_mask,
    1691                 .special        = NULL,
    1692                 .enum_list      = NULL,
    1693                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1694         },
    1695         {
    1696                 .label          = "force directory security mode",
    1697                 .type           = P_OCTAL,
    1698                 .p_class        = P_LOCAL,
    1699                 .ptr            = &sDefault.iDir_Security_force_mode,
    1700                 .special        = NULL,
    1701                 .enum_list      = NULL,
    1702                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1703         },
    1704         {
    1705                 .label          = "force unknown acl user",
    1706                 .type           = P_BOOL,
    1707                 .p_class        = P_LOCAL,
    1708                 .ptr            = &sDefault.bForceUnknownAclUser,
    1709                 .special        = NULL,
    1710                 .enum_list      = NULL,
    1711                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    1712         },
    1713         {
    1714                 .label          = "inherit permissions",
    1715                 .type           = P_BOOL,
    1716                 .p_class        = P_LOCAL,
    1717                 .ptr            = &sDefault.bInheritPerms,
    1718                 .special        = NULL,
    1719                 .enum_list      = NULL,
    1720                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1721         },
    1722         {
    1723                 .label          = "inherit acls",
    1724                 .type           = P_BOOL,
    1725                 .p_class        = P_LOCAL,
    1726                 .ptr            = &sDefault.bInheritACLS,
    1727                 .special        = NULL,
    1728                 .enum_list      = NULL,
    1729                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1730         },
    1731         {
    1732                 .label          = "inherit owner",
    1733                 .type           = P_BOOL,
    1734                 .p_class        = P_LOCAL,
    1735                 .ptr            = &sDefault.bInheritOwner,
    1736                 .special        = NULL,
    1737                 .enum_list      = NULL,
    1738                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1739         },
    1740         {
    1741                 .label          = "guest only",
    1742                 .type           = P_BOOL,
    1743                 .p_class        = P_LOCAL,
    1744                 .ptr            = &sDefault.bGuest_only,
    1745                 .special        = NULL,
    1746                 .enum_list      = NULL,
    1747                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    1748         },
    1749         {
    1750                 .label          = "only guest",
    1751                 .type           = P_BOOL,
    1752                 .p_class        = P_LOCAL,
    1753                 .ptr            = &sDefault.bGuest_only,
    1754                 .special        = NULL,
    1755                 .enum_list      = NULL,
    1756                 .flags          = FLAG_HIDE,
    1757         },
    1758         {
    1759                 .label          = "administrative share",
    1760                 .type           = P_BOOL,
    1761                 .p_class        = P_LOCAL,
    1762                 .ptr            = &sDefault.bAdministrative_share,
    1763                 .special        = NULL,
    1764                 .enum_list      = NULL,
    1765                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    1766         },
    1767 
    1768         {
    1769                 .label          = "guest ok",
    1770                 .type           = P_BOOL,
    1771                 .p_class        = P_LOCAL,
    1772                 .ptr            = &sDefault.bGuest_ok,
    1773                 .special        = NULL,
    1774                 .enum_list      = NULL,
    1775                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    1776         },
    1777         {
    1778                 .label          = "public",
    1779                 .type           = P_BOOL,
    1780                 .p_class        = P_LOCAL,
    1781                 .ptr            = &sDefault.bGuest_ok,
    1782                 .special        = NULL,
    1783                 .enum_list      = NULL,
    1784                 .flags          = FLAG_HIDE,
    1785         },
    1786         {
    1787                 .label          = "only user",
    1788                 .type           = P_BOOL,
    1789                 .p_class        = P_LOCAL,
    1790                 .ptr            = &sDefault.bOnlyUser,
    1791                 .special        = NULL,
    1792                 .enum_list      = NULL,
    1793                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_DEPRECATED,
    1794         },
    1795         {
    1796                 .label          = "hosts allow",
    1797                 .type           = P_LIST,
    1798                 .p_class        = P_LOCAL,
    1799                 .ptr            = &sDefault.szHostsallow,
    1800                 .special        = NULL,
    1801                 .enum_list      = NULL,
    1802                 .flags          = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    1803         },
    1804         {
    1805                 .label          = "allow hosts",
    1806                 .type           = P_LIST,
    1807                 .p_class        = P_LOCAL,
    1808                 .ptr            = &sDefault.szHostsallow,
    1809                 .special        = NULL,
    1810                 .enum_list      = NULL,
    1811                 .flags          = FLAG_HIDE,
    1812         },
    1813         {
    1814                 .label          = "hosts deny",
    1815                 .type           = P_LIST,
    1816                 .p_class        = P_LOCAL,
    1817                 .ptr            = &sDefault.szHostsdeny,
    1818                 .special        = NULL,
    1819                 .enum_list      = NULL,
    1820                 .flags          = FLAG_GLOBAL | FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    1821         },
    1822         {
    1823                 .label          = "deny hosts",
    1824                 .type           = P_LIST,
    1825                 .p_class        = P_LOCAL,
    1826                 .ptr            = &sDefault.szHostsdeny,
    1827                 .special        = NULL,
    1828                 .enum_list      = NULL,
    1829                 .flags          = FLAG_HIDE,
    1830         },
    1831         {
    1832                 .label          = "preload modules",
    1833                 .type           = P_LIST,
    1834                 .p_class        = P_GLOBAL,
    1835                 .ptr            = &Globals.szPreloadModules,
    1836                 .special        = NULL,
    1837                 .enum_list      = NULL,
    1838                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    1839         },
    1840         {
    1841                 .label          = "dedicated keytab file",
    1842                 .type           = P_STRING,
    1843                 .p_class        = P_GLOBAL,
    1844                 .ptr            = &Globals.szDedicatedKeytabFile,
    1845                 .special        = NULL,
    1846                 .enum_list      = NULL,
    1847                 .flags          = FLAG_ADVANCED,
    1848         },
    1849         {
    1850                 .label          = "kerberos method",
    1851                 .type           = P_ENUM,
    1852                 .p_class        = P_GLOBAL,
    1853                 .ptr            = &Globals.iKerberosMethod,
    1854                 .special        = NULL,
    1855                 .enum_list      = enum_kerberos_method,
    1856                 .flags          = FLAG_ADVANCED,
    1857         },
    1858         {
    1859                 .label          = "map untrusted to domain",
    1860                 .type           = P_BOOL,
    1861                 .p_class        = P_GLOBAL,
    1862                 .ptr            = &Globals.bMapUntrustedToDomain,
    1863                 .special        = NULL,
    1864                 .enum_list      = NULL,
    1865                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    1866         },
    1867 
    1868 
    1869         {N_("Logging Options"), P_SEP, P_SEPARATOR},
    1870 
    1871         {
    1872                 .label          = "log level",
    1873                 .type           = P_STRING,
    1874                 .p_class        = P_GLOBAL,
    1875                 .ptr            = &Globals.szLogLevel,
    1876                 .special        = handle_debug_list,
    1877                 .enum_list      = NULL,
    1878                 .flags          = FLAG_ADVANCED,
    1879         },
    1880         {
    1881                 .label          = "debuglevel",
    1882                 .type           = P_STRING,
    1883                 .p_class        = P_GLOBAL,
    1884                 .ptr            = &Globals.szLogLevel,
    1885                 .special        = handle_debug_list,
    1886                 .enum_list      = NULL,
    1887                 .flags          = FLAG_HIDE,
    1888         },
    1889         {
    1890                 .label          = "syslog",
    1891                 .type           = P_INTEGER,
    1892                 .p_class        = P_GLOBAL,
    1893                 .ptr            = &Globals.syslog,
    1894                 .special        = NULL,
    1895                 .enum_list      = NULL,
    1896                 .flags          = FLAG_ADVANCED,
    1897         },
    1898         {
    1899                 .label          = "syslog only",
    1900                 .type           = P_BOOL,
    1901                 .p_class        = P_GLOBAL,
    1902                 .ptr            = &Globals.bSyslogOnly,
    1903                 .special        = NULL,
    1904                 .enum_list      = NULL,
    1905                 .flags          = FLAG_ADVANCED,
    1906         },
    1907         {
    1908                 .label          = "log file",
    1909                 .type           = P_STRING,
    1910                 .p_class        = P_GLOBAL,
    1911                 .ptr            = &Globals.szLogFile,
    1912                 .special        = NULL,
    1913                 .enum_list      = NULL,
    1914                 .flags          = FLAG_ADVANCED,
    1915         },
    1916         {
    1917                 .label          = "max log size",
    1918                 .type           = P_INTEGER,
    1919                 .p_class        = P_GLOBAL,
    1920                 .ptr            = &Globals.max_log_size,
    1921                 .special        = NULL,
    1922                 .enum_list      = NULL,
    1923                 .flags          = FLAG_ADVANCED,
    1924         },
    1925         {
    1926                 .label          = "debug timestamp",
    1927                 .type           = P_BOOL,
    1928                 .p_class        = P_GLOBAL,
    1929                 .ptr            = &Globals.bTimestampLogs,
    1930                 .special        = NULL,
    1931                 .enum_list      = NULL,
    1932                 .flags          = FLAG_ADVANCED,
    1933         },
    1934         {
    1935                 .label          = "timestamp logs",
    1936                 .type           = P_BOOL,
    1937                 .p_class        = P_GLOBAL,
    1938                 .ptr            = &Globals.bTimestampLogs,
    1939                 .special        = NULL,
    1940                 .enum_list      = NULL,
    1941                 .flags          = FLAG_ADVANCED,
    1942         },
    1943         {
    1944                 .label          = "debug prefix timestamp",
    1945                 .type           = P_BOOL,
    1946                 .p_class        = P_GLOBAL,
    1947                 .ptr            = &Globals.bDebugPrefixTimestamp,
    1948                 .special        = NULL,
    1949                 .enum_list      = NULL,
    1950                 .flags          = FLAG_ADVANCED,
    1951         },
    1952         {
    1953                 .label          = "debug hires timestamp",
    1954                 .type           = P_BOOL,
    1955                 .p_class        = P_GLOBAL,
    1956                 .ptr            = &Globals.bDebugHiresTimestamp,
    1957                 .special        = NULL,
    1958                 .enum_list      = NULL,
    1959                 .flags          = FLAG_ADVANCED,
    1960         },
    1961         {
    1962                 .label          = "debug pid",
    1963                 .type           = P_BOOL,
    1964                 .p_class        = P_GLOBAL,
    1965                 .ptr            = &Globals.bDebugPid,
    1966                 .special        = NULL,
    1967                 .enum_list      = NULL,
    1968                 .flags          = FLAG_ADVANCED,
    1969         },
    1970         {
    1971                 .label          = "debug uid",
    1972                 .type           = P_BOOL,
    1973                 .p_class        = P_GLOBAL,
    1974                 .ptr            = &Globals.bDebugUid,
    1975                 .special        = NULL,
    1976                 .enum_list      = NULL,
    1977                 .flags          = FLAG_ADVANCED,
    1978         },
    1979         {
    1980                 .label          = "debug class",
    1981                 .type           = P_BOOL,
    1982                 .p_class        = P_GLOBAL,
    1983                 .ptr            = &Globals.bDebugClass,
    1984                 .special        = NULL,
    1985                 .enum_list      = NULL,
    1986                 .flags          = FLAG_ADVANCED,
    1987         },
    1988         {
    1989                 .label          = "enable core files",
    1990                 .type           = P_BOOL,
    1991                 .p_class        = P_GLOBAL,
    1992                 .ptr            = &Globals.bEnableCoreFiles,
    1993                 .special        = NULL,
    1994                 .enum_list      = NULL,
    1995                 .flags          = FLAG_ADVANCED,
    1996         },
    1997 
    1998         {N_("Protocol Options"), P_SEP, P_SEPARATOR},
    1999 
    2000         {
    2001                 .label          = "allocation roundup size",
    2002                 .type           = P_INTEGER,
    2003                 .p_class        = P_LOCAL,
    2004                 .ptr            = &sDefault.iallocation_roundup_size,
    2005                 .special        = NULL,
    2006                 .enum_list      = NULL,
    2007                 .flags          = FLAG_ADVANCED,
    2008         },
    2009         {
    2010                 .label          = "aio read size",
    2011                 .type           = P_INTEGER,
    2012                 .p_class        = P_LOCAL,
    2013                 .ptr            = &sDefault.iAioReadSize,
    2014                 .special        = NULL,
    2015                 .enum_list      = NULL,
    2016                 .flags          = FLAG_ADVANCED,
    2017         },
    2018         {
    2019                 .label          = "aio write size",
    2020                 .type           = P_INTEGER,
    2021                 .p_class        = P_LOCAL,
    2022                 .ptr            = &sDefault.iAioWriteSize,
    2023                 .special        = NULL,
    2024                 .enum_list      = NULL,
    2025                 .flags          = FLAG_ADVANCED,
    2026         },
    2027         {
    2028                 .label          = "aio write behind",
    2029                 .type           = P_STRING,
    2030                 .p_class        = P_LOCAL,
    2031                 .ptr            = &sDefault.szAioWriteBehind,
    2032                 .special        = NULL,
    2033                 .enum_list      = NULL,
    2034                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2035         },
    2036         {
    2037                 .label          = "smb ports",
    2038                 .type           = P_STRING,
    2039                 .p_class        = P_GLOBAL,
    2040                 .ptr            = &Globals.smb_ports,
    2041                 .special        = NULL,
    2042                 .enum_list      = NULL,
    2043                 .flags          = FLAG_ADVANCED,
    2044         },
    2045         {
    2046                 .label          = "large readwrite",
    2047                 .type           = P_BOOL,
    2048                 .p_class        = P_GLOBAL,
    2049                 .ptr            = &Globals.bLargeReadwrite,
    2050                 .special        = NULL,
    2051                 .enum_list      = NULL,
    2052                 .flags          = FLAG_ADVANCED,
    2053         },
    2054         {
    2055                 .label          = "max protocol",
    2056                 .type           = P_ENUM,
    2057                 .p_class        = P_GLOBAL,
    2058                 .ptr            = &Globals.maxprotocol,
    2059                 .special        = NULL,
    2060                 .enum_list      = enum_protocol,
    2061                 .flags          = FLAG_ADVANCED,
    2062         },
    2063         {
    2064                 .label          = "protocol",
    2065                 .type           = P_ENUM,
    2066                 .p_class        = P_GLOBAL,
    2067                 .ptr            = &Globals.maxprotocol,
    2068                 .special        = NULL,
    2069                 .enum_list      = enum_protocol,
    2070                 .flags          = FLAG_ADVANCED,
    2071         },
    2072         {
    2073                 .label          = "min protocol",
    2074                 .type           = P_ENUM,
    2075                 .p_class        = P_GLOBAL,
    2076                 .ptr            = &Globals.minprotocol,
    2077                 .special        = NULL,
    2078                 .enum_list      = enum_protocol,
    2079                 .flags          = FLAG_ADVANCED,
    2080         },
    2081         {
    2082                 .label          = "min receivefile size",
    2083                 .type           = P_INTEGER,
    2084                 .p_class        = P_GLOBAL,
    2085                 .ptr            = &Globals.iminreceivefile,
    2086                 .special        = NULL,
    2087                 .enum_list      = NULL,
    2088                 .flags          = FLAG_ADVANCED,
    2089         },
    2090         {
    2091                 .label          = "read raw",
    2092                 .type           = P_BOOL,
    2093                 .p_class        = P_GLOBAL,
    2094                 .ptr            = &Globals.bReadRaw,
    2095                 .special        = NULL,
    2096                 .enum_list      = NULL,
    2097                 .flags          = FLAG_ADVANCED,
    2098         },
    2099         {
    2100                 .label          = "write raw",
    2101                 .type           = P_BOOL,
    2102                 .p_class        = P_GLOBAL,
    2103                 .ptr            = &Globals.bWriteRaw,
    2104                 .special        = NULL,
    2105                 .enum_list      = NULL,
    2106                 .flags          = FLAG_ADVANCED,
    2107         },
    2108         {
    2109                 .label          = "disable netbios",
    2110                 .type           = P_BOOL,
    2111                 .p_class        = P_GLOBAL,
    2112                 .ptr            = &Globals.bDisableNetbios,
    2113                 .special        = NULL,
    2114                 .enum_list      = NULL,
    2115                 .flags          = FLAG_ADVANCED,
    2116         },
    2117         {
    2118                 .label          = "reset on zero vc",
    2119                 .type           = P_BOOL,
    2120                 .p_class        = P_GLOBAL,
    2121                 .ptr            = &Globals.bResetOnZeroVC,
    2122                 .special        = NULL,
    2123                 .enum_list      = NULL,
    2124                 .flags          = FLAG_ADVANCED,
    2125         },
    2126         {
    2127                 .label          = "log writeable files on exit",
    2128                 .type           = P_BOOL,
    2129                 .p_class        = P_GLOBAL,
    2130                 .ptr            = &Globals.bLogWriteableFilesOnExit,
    2131                 .special        = NULL,
    2132                 .enum_list      = NULL,
    2133                 .flags          = FLAG_ADVANCED,
    2134         },
    2135         {
    2136                 .label          = "acl compatibility",
    2137                 .type           = P_ENUM,
    2138                 .p_class        = P_GLOBAL,
    2139                 .ptr            = &Globals.iAclCompat,
    2140                 .special        = NULL,
    2141                 .enum_list      = enum_acl_compat_vals,
    2142                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2143         },
    2144         {
    2145                 .label          = "defer sharing violations",
    2146                 .type           = P_BOOL,
    2147                 .p_class        = P_GLOBAL,
    2148                 .ptr            = &Globals.bDeferSharingViolations,
    2149                 .special        = NULL,
    2150                 .enum_list      = NULL,
    2151                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2152         },
    2153         {
    2154                 .label          = "ea support",
    2155                 .type           = P_BOOL,
    2156                 .p_class        = P_LOCAL,
    2157                 .ptr            = &sDefault.bEASupport,
    2158                 .special        = NULL,
    2159                 .enum_list      = NULL,
    2160                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2161         },
    2162         {
    2163                 .label          = "nt acl support",
    2164                 .type           = P_BOOL,
    2165                 .p_class        = P_LOCAL,
    2166                 .ptr            = &sDefault.bNTAclSupport,
    2167                 .special        = NULL,
    2168                 .enum_list      = NULL,
    2169                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2170         },
    2171         {
    2172                 .label          = "nt pipe support",
    2173                 .type           = P_BOOL,
    2174                 .p_class        = P_GLOBAL,
    2175                 .ptr            = &Globals.bNTPipeSupport,
    2176                 .special        = NULL,
    2177                 .enum_list      = NULL,
    2178                 .flags          = FLAG_ADVANCED,
    2179         },
    2180         {
    2181                 .label          = "nt status support",
    2182                 .type           = P_BOOL,
    2183                 .p_class        = P_GLOBAL,
    2184                 .ptr            = &Globals.bNTStatusSupport,
    2185                 .special        = NULL,
    2186                 .enum_list      = NULL,
    2187                 .flags          = FLAG_ADVANCED,
    2188         },
    2189         {
    2190                 .label          = "profile acls",
    2191                 .type           = P_BOOL,
    2192                 .p_class        = P_LOCAL,
    2193                 .ptr            = &sDefault.bProfileAcls,
    2194                 .special        = NULL,
    2195                 .enum_list      = NULL,
    2196                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    2197         },
    2198         {
    2199                 .label          = "announce version",
    2200                 .type           = P_STRING,
    2201                 .p_class        = P_GLOBAL,
    2202                 .ptr            = &Globals.szAnnounceVersion,
    2203                 .special        = NULL,
    2204                 .enum_list      = NULL,
    2205                 .flags          = FLAG_ADVANCED,
    2206         },
    2207         {
    2208                 .label          = "announce as",
    2209                 .type           = P_ENUM,
    2210                 .p_class        = P_GLOBAL,
    2211                 .ptr            = &Globals.announce_as,
    2212                 .special        = NULL,
    2213                 .enum_list      = enum_announce_as,
    2214                 .flags          = FLAG_ADVANCED,
    2215         },
    2216         {
    2217                 .label          = "map acl inherit",
    2218                 .type           = P_BOOL,
    2219                 .p_class        = P_LOCAL,
    2220                 .ptr            = &sDefault.bMap_acl_inherit,
    2221                 .special        = NULL,
    2222                 .enum_list      = NULL,
    2223                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2224         },
    2225         {
    2226                 .label          = "afs share",
    2227                 .type           = P_BOOL,
    2228                 .p_class        = P_LOCAL,
    2229                 .ptr            = &sDefault.bAfs_Share,
    2230                 .special        = NULL,
    2231                 .enum_list      = NULL,
    2232                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2233         },
    2234         {
    2235                 .label          = "max mux",
    2236                 .type           = P_INTEGER,
    2237                 .p_class        = P_GLOBAL,
    2238                 .ptr            = &Globals.max_mux,
    2239                 .special        = NULL,
    2240                 .enum_list      = NULL,
    2241                 .flags          = FLAG_ADVANCED,
    2242         },
    2243         {
    2244                 .label          = "max xmit",
    2245                 .type           = P_INTEGER,
    2246                 .p_class        = P_GLOBAL,
    2247                 .ptr            = &Globals.max_xmit,
    2248                 .special        = NULL,
    2249                 .enum_list      = NULL,
    2250                 .flags          = FLAG_ADVANCED,
    2251         },
    2252         {
    2253                 .label          = "name resolve order",
    2254                 .type           = P_STRING,
    2255                 .p_class        = P_GLOBAL,
    2256                 .ptr            = &Globals.szNameResolveOrder,
    2257                 .special        = NULL,
    2258                 .enum_list      = NULL,
    2259                 .flags          = FLAG_ADVANCED | FLAG_WIZARD,
    2260         },
    2261         {
    2262                 .label          = "max ttl",
    2263                 .type           = P_INTEGER,
    2264                 .p_class        = P_GLOBAL,
    2265                 .ptr            = &Globals.max_ttl,
    2266                 .special        = NULL,
    2267                 .enum_list      = NULL,
    2268                 .flags          = FLAG_ADVANCED,
    2269         },
    2270         {
    2271                 .label          = "max wins ttl",
    2272                 .type           = P_INTEGER,
    2273                 .p_class        = P_GLOBAL,
    2274                 .ptr            = &Globals.max_wins_ttl,
    2275                 .special        = NULL,
    2276                 .enum_list      = NULL,
    2277                 .flags          = FLAG_ADVANCED,
    2278         },
    2279         {
    2280                 .label          = "min wins ttl",
    2281                 .type           = P_INTEGER,
    2282                 .p_class        = P_GLOBAL,
    2283                 .ptr            = &Globals.min_wins_ttl,
    2284                 .special        = NULL,
    2285                 .enum_list      = NULL,
    2286                 .flags          = FLAG_ADVANCED,
    2287         },
    2288         {
    2289                 .label          = "time server",
    2290                 .type           = P_BOOL,
    2291                 .p_class        = P_GLOBAL,
    2292                 .ptr            = &Globals.bTimeServer,
    2293                 .special        = NULL,
    2294                 .enum_list      = NULL,
    2295                 .flags          = FLAG_ADVANCED,
    2296         },
    2297         {
    2298                 .label          = "unix extensions",
    2299                 .type           = P_BOOL,
    2300                 .p_class        = P_GLOBAL,
    2301                 .ptr            = &Globals.bUnixExtensions,
    2302                 .special        = NULL,
    2303                 .enum_list      = NULL,
    2304                 .flags          = FLAG_ADVANCED,
    2305         },
    2306         {
    2307                 .label          = "allow dcerpc auth level connect",
    2308                 .type           = P_BOOL,
    2309                 .p_class        = P_GLOBAL,
    2310                 .ptr            = &Globals.bAllowDcerpcAuthLevelConnect,
    2311                 .special        = NULL,
    2312                 .enum_list      = NULL,
    2313                 .flags          = FLAG_ADVANCED,
    2314         },
    2315         {
    2316                 .label          = "use spnego",
    2317                 .type           = P_BOOL,
    2318                 .p_class        = P_GLOBAL,
    2319                 .ptr            = &Globals.bUseSpnego,
    2320                 .special        = NULL,
    2321                 .enum_list      = NULL,
    2322                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    2323         },
    2324         {
    2325                 .label          = "client signing",
    2326                 .type           = P_ENUM,
    2327                 .p_class        = P_GLOBAL,
    2328                 .ptr            = &Globals.client_signing,
    2329                 .special        = NULL,
    2330                 .enum_list      = enum_smb_signing_vals,
    2331                 .flags          = FLAG_ADVANCED,
    2332         },
    2333         {
    2334                 .label          = "client ipc signing",
    2335                 .type           = P_ENUM,
    2336                 .p_class        = P_GLOBAL,
    2337                 .ptr            = &Globals.client_ipc_signing,
    2338                 .special        = NULL,
    2339                 .enum_list      = enum_smb_signing_vals,
    2340                 .flags          = FLAG_ADVANCED,
    2341         },
    2342         {
    2343                 .label          = "server signing",
    2344                 .type           = P_ENUM,
    2345                 .p_class        = P_GLOBAL,
    2346                 .ptr            = &Globals.server_signing,
    2347                 .special        = NULL,
    2348                 .enum_list      = enum_smb_signing_vals,
    2349                 .flags          = FLAG_ADVANCED,
    2350         },
    2351         {
    2352                 .label          = "smb encrypt",
    2353                 .type           = P_ENUM,
    2354                 .p_class        = P_LOCAL,
    2355                 .ptr            = &sDefault.ismb_encrypt,
    2356                 .special        = NULL,
    2357                 .enum_list      = enum_smb_signing_vals,
    2358                 .flags          = FLAG_ADVANCED,
    2359         },
    2360         {
    2361                 .label          = "client use spnego",
    2362                 .type           = P_BOOL,
    2363                 .p_class        = P_GLOBAL,
    2364                 .ptr            = &Globals.bClientUseSpnego,
    2365                 .special        = NULL,
    2366                 .enum_list      = NULL,
    2367                 .flags          = FLAG_ADVANCED,
    2368         },
    2369         {
    2370                 .label          = "client ldap sasl wrapping",
    2371                 .type           = P_ENUM,
    2372                 .p_class        = P_GLOBAL,
    2373                 .ptr            = &Globals.client_ldap_sasl_wrapping,
    2374                 .special        = NULL,
    2375                 .enum_list      = enum_ldap_sasl_wrapping,
    2376                 .flags          = FLAG_ADVANCED,
    2377         },
    2378         {
    2379                 .label          = "enable asu support",
    2380                 .type           = P_BOOL,
    2381                 .p_class        = P_GLOBAL,
    2382                 .ptr            = &Globals.bASUSupport,
    2383                 .special        = NULL,
    2384                 .enum_list      = NULL,
    2385                 .flags          = FLAG_ADVANCED,
    2386         },
    2387         {
    2388                 .label          = "svcctl list",
    2389                 .type           = P_LIST,
    2390                 .p_class        = P_GLOBAL,
    2391                 .ptr            = &Globals.szServicesList,
    2392                 .special        = NULL,
    2393                 .enum_list      = NULL,
    2394                 .flags          = FLAG_ADVANCED,
    2395         },
    2396 
    2397         {N_("Tuning Options"), P_SEP, P_SEPARATOR},
    2398 
    2399         {
    2400                 .label          = "block size",
    2401                 .type           = P_INTEGER,
    2402                 .p_class        = P_LOCAL,
    2403                 .ptr            = &sDefault.iBlock_size,
    2404                 .special        = NULL,
    2405                 .enum_list      = NULL,
    2406                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    2407         },
    2408         {
    2409                 .label          = "deadtime",
    2410                 .type           = P_INTEGER,
    2411                 .p_class        = P_GLOBAL,
    2412                 .ptr            = &Globals.deadtime,
    2413                 .special        = NULL,
    2414                 .enum_list      = NULL,
    2415                 .flags          = FLAG_ADVANCED,
    2416         },
    2417         {
    2418                 .label          = "getwd cache",
    2419                 .type           = P_BOOL,
    2420                 .p_class        = P_GLOBAL,
    2421                 .ptr            = &Globals.getwd_cache,
    2422                 .special        = NULL,
    2423                 .enum_list      = NULL,
    2424                 .flags          = FLAG_ADVANCED,
    2425         },
    2426         {
    2427                 .label          = "keepalive",
    2428                 .type           = P_INTEGER,
    2429                 .p_class        = P_GLOBAL,
    2430                 .ptr            = &Globals.iKeepalive,
    2431                 .special        = NULL,
    2432                 .enum_list      = NULL,
    2433                 .flags          = FLAG_ADVANCED,
    2434         },
    2435         {
    2436                 .label          = "change notify",
    2437                 .type           = P_BOOL,
    2438                 .p_class        = P_LOCAL,
    2439                 .ptr            = &sDefault.bChangeNotify,
    2440                 .special        = NULL,
    2441                 .enum_list      = NULL,
    2442                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2443         },
    2444         {
    2445                 .label          = "directory name cache size",
    2446                 .type           = P_INTEGER,
    2447                 .p_class        = P_LOCAL,
    2448                 .ptr            = &sDefault.iDirectoryNameCacheSize,
    2449                 .special        = NULL,
    2450                 .enum_list      = NULL,
    2451                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2452         },
    2453         {
    2454                 .label          = "kernel change notify",
    2455                 .type           = P_BOOL,
    2456                 .p_class        = P_LOCAL,
    2457                 .ptr            = &sDefault.bKernelChangeNotify,
    2458                 .special        = NULL,
    2459                 .enum_list      = NULL,
    2460                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2461         },
    2462         {
    2463                 .label          = "lpq cache time",
    2464                 .type           = P_INTEGER,
    2465                 .p_class        = P_GLOBAL,
    2466                 .ptr            = &Globals.lpqcachetime,
    2467                 .special        = NULL,
    2468                 .enum_list      = NULL,
    2469                 .flags          = FLAG_ADVANCED,
    2470         },
    2471         {
    2472                 .label          = "max smbd processes",
    2473                 .type           = P_INTEGER,
    2474                 .p_class        = P_GLOBAL,
    2475                 .ptr            = &Globals.iMaxSmbdProcesses,
    2476                 .special        = NULL,
    2477                 .enum_list      = NULL,
    2478                 .flags          = FLAG_ADVANCED,
    2479         },
    2480         {
    2481                 .label          = "max connections",
    2482                 .type           = P_INTEGER,
    2483                 .p_class        = P_LOCAL,
    2484                 .ptr            = &sDefault.iMaxConnections,
    2485                 .special        = NULL,
    2486                 .enum_list      = NULL,
    2487                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2488         },
    2489         {
    2490                 .label          = "paranoid server security",
    2491                 .type           = P_BOOL,
    2492                 .p_class        = P_GLOBAL,
    2493                 .ptr            = &Globals.paranoid_server_security,
    2494                 .special        = NULL,
    2495                 .enum_list      = NULL,
    2496                 .flags          = FLAG_ADVANCED,
    2497         },
    2498         {
    2499                 .label          = "max disk size",
    2500                 .type           = P_INTEGER,
    2501                 .p_class        = P_GLOBAL,
    2502                 .ptr            = &Globals.maxdisksize,
    2503                 .special        = NULL,
    2504                 .enum_list      = NULL,
    2505                 .flags          = FLAG_ADVANCED,
    2506         },
    2507         {
    2508                 .label          = "max open files",
    2509                 .type           = P_INTEGER,
    2510                 .p_class        = P_GLOBAL,
    2511                 .ptr            = &Globals.max_open_files,
    2512                 .special        = NULL,
    2513                 .enum_list      = NULL,
    2514                 .flags          = FLAG_ADVANCED,
    2515         },
    2516         {
    2517                 .label          = "min print space",
    2518                 .type           = P_INTEGER,
    2519                 .p_class        = P_LOCAL,
    2520                 .ptr            = &sDefault.iMinPrintSpace,
    2521                 .special        = NULL,
    2522                 .enum_list      = NULL,
    2523                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2524         },
    2525         {
    2526                 .label          = "socket options",
    2527                 .type           = P_STRING,
    2528                 .p_class        = P_GLOBAL,
    2529                 .ptr            = &Globals.szSocketOptions,
    2530                 .special        = NULL,
    2531                 .enum_list      = NULL,
    2532                 .flags          = FLAG_ADVANCED,
    2533         },
    2534         {
    2535                 .label          = "strict allocate",
    2536                 .type           = P_BOOL,
    2537                 .p_class        = P_LOCAL,
    2538                 .ptr            = &sDefault.bStrictAllocate,
    2539                 .special        = NULL,
    2540                 .enum_list      = NULL,
    2541                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2542         },
    2543         {
    2544                 .label          = "strict sync",
    2545                 .type           = P_BOOL,
    2546                 .p_class        = P_LOCAL,
    2547                 .ptr            = &sDefault.bStrictSync,
    2548                 .special        = NULL,
    2549                 .enum_list      = NULL,
    2550                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2551         },
    2552         {
    2553                 .label          = "sync always",
    2554                 .type           = P_BOOL,
    2555                 .p_class        = P_LOCAL,
    2556                 .ptr            = &sDefault.bSyncAlways,
    2557                 .special        = NULL,
    2558                 .enum_list      = NULL,
    2559                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2560         },
    2561         {
    2562                 .label          = "use mmap",
    2563                 .type           = P_BOOL,
    2564                 .p_class        = P_GLOBAL,
    2565                 .ptr            = &Globals.bUseMmap,
    2566                 .special        = NULL,
    2567                 .enum_list      = NULL,
    2568                 .flags          = FLAG_ADVANCED,
    2569         },
    2570         {
    2571                 .label          = "use sendfile",
    2572                 .type           = P_BOOL,
    2573                 .p_class        = P_LOCAL,
    2574                 .ptr            = &sDefault.bUseSendfile,
    2575                 .special        = NULL,
    2576                 .enum_list      = NULL,
    2577                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2578         },
    2579         {
    2580                 .label          = "hostname lookups",
    2581                 .type           = P_BOOL,
    2582                 .p_class        = P_GLOBAL,
    2583                 .ptr            = &Globals.bHostnameLookups,
    2584                 .special        = NULL,
    2585                 .enum_list      = NULL,
    2586                 .flags          = FLAG_ADVANCED,
    2587         },
    2588         {
    2589                 .label          = "write cache size",
    2590                 .type           = P_INTEGER,
    2591                 .p_class        = P_LOCAL,
    2592                 .ptr            = &sDefault.iWriteCacheSize,
    2593                 .special        = NULL,
    2594                 .enum_list      = NULL,
    2595                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    2596         },
    2597         {
    2598                 .label          = "name cache timeout",
    2599                 .type           = P_INTEGER,
    2600                 .p_class        = P_GLOBAL,
    2601                 .ptr            = &Globals.name_cache_timeout,
    2602                 .special        = NULL,
    2603                 .enum_list      = NULL,
    2604                 .flags          = FLAG_ADVANCED,
    2605         },
    2606         {
    2607                 .label          = "ctdbd socket",
    2608                 .type           = P_STRING,
    2609                 .p_class        = P_GLOBAL,
    2610                 .ptr            = &Globals.ctdbdSocket,
    2611                 .special        = NULL,
    2612                 .enum_list      = NULL,
    2613                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2614         },
    2615         {
    2616                 .label          = "cluster addresses",
    2617                 .type           = P_LIST,
    2618                 .p_class        = P_GLOBAL,
    2619                 .ptr            = &Globals.szClusterAddresses,
    2620                 .special        = NULL,
    2621                 .enum_list      = NULL,
    2622                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2623         },
    2624         {
    2625                 .label          = "clustering",
    2626                 .type           = P_BOOL,
    2627                 .p_class        = P_GLOBAL,
    2628                 .ptr            = &Globals.clustering,
    2629                 .special        = NULL,
    2630                 .enum_list      = NULL,
    2631                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2632         },
    2633         {
    2634                 .label          = "ctdb timeout",
    2635                 .type           = P_INTEGER,
    2636                 .p_class        = P_GLOBAL,
    2637                 .ptr            = &Globals.ctdb_timeout,
    2638                 .special        = NULL,
    2639                 .enum_list      = NULL,
    2640                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2641         },
    2642         {
    2643                 .label          = "ctdb locktime warn threshold",
    2644                 .type           = P_INTEGER,
    2645                 .p_class        = P_GLOBAL,
    2646                 .ptr            = &Globals.ctdb_locktime_warn_threshold,
    2647                 .special        = NULL,
    2648                 .enum_list      = NULL,
    2649                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    2650         },
    2651         {
    2652                 .label          = "smb2 max read",
    2653                 .type           = P_INTEGER,
    2654                 .p_class        = P_GLOBAL,
    2655                 .ptr            = &Globals.ismb2_max_read,
    2656                 .special        = NULL,
    2657                 .enum_list      = NULL,
    2658                 .flags          = FLAG_ADVANCED,
    2659         },
    2660         {
    2661                 .label          = "smb2 max write",
    2662                 .type           = P_INTEGER,
    2663                 .p_class        = P_GLOBAL,
    2664                 .ptr            = &Globals.ismb2_max_write,
    2665                 .special        = NULL,
    2666                 .enum_list      = NULL,
    2667                 .flags          = FLAG_ADVANCED,
    2668         },
    2669         {
    2670                 .label          = "smb2 max trans",
    2671                 .type           = P_INTEGER,
    2672                 .p_class        = P_GLOBAL,
    2673                 .ptr            = &Globals.ismb2_max_trans,
    2674                 .special        = NULL,
    2675                 .enum_list      = NULL,
    2676                 .flags          = FLAG_ADVANCED,
    2677         },
    2678         {
    2679                 .label          = "smb2 max credits",
    2680                 .type           = P_INTEGER,
    2681                 .p_class        = P_GLOBAL,
    2682                 .ptr            = &Globals.ismb2_max_credits,
    2683                 .special        = NULL,
    2684                 .enum_list      = NULL,
    2685                 .flags          = FLAG_ADVANCED,
    2686         },
    2687 
    2688         {N_("Printing Options"), P_SEP, P_SEPARATOR},
    2689 
    2690         {
    2691                 .label          = "max reported print jobs",
    2692                 .type           = P_INTEGER,
    2693                 .p_class        = P_LOCAL,
    2694                 .ptr            = &sDefault.iMaxReportedPrintJobs,
    2695                 .special        = NULL,
    2696                 .enum_list      = NULL,
    2697                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2698         },
    2699         {
    2700                 .label          = "max print jobs",
    2701                 .type           = P_INTEGER,
    2702                 .p_class        = P_LOCAL,
    2703                 .ptr            = &sDefault.iMaxPrintJobs,
    2704                 .special        = NULL,
    2705                 .enum_list      = NULL,
    2706                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2707         },
    2708         {
    2709                 .label          = "load printers",
    2710                 .type           = P_BOOL,
    2711                 .p_class        = P_GLOBAL,
    2712                 .ptr            = &Globals.bLoadPrinters,
    2713                 .special        = NULL,
    2714                 .enum_list      = NULL,
    2715                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2716         },
    2717         {
    2718                 .label          = "printcap cache time",
    2719                 .type           = P_INTEGER,
    2720                 .p_class        = P_GLOBAL,
    2721                 .ptr            = &Globals.PrintcapCacheTime,
    2722                 .special        = NULL,
    2723                 .enum_list      = NULL,
    2724                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2725         },
    2726         {
    2727                 .label          = "printcap name",
    2728                 .type           = P_STRING,
    2729                 .p_class        = P_GLOBAL,
    2730                 .ptr            = &Globals.szPrintcapname,
    2731                 .special        = NULL,
    2732                 .enum_list      = NULL,
    2733                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2734         },
    2735         {
    2736                 .label          = "printcap",
    2737                 .type           = P_STRING,
    2738                 .p_class        = P_GLOBAL,
    2739                 .ptr            = &Globals.szPrintcapname,
    2740                 .special        = NULL,
    2741                 .enum_list      = NULL,
    2742                 .flags          = FLAG_HIDE,
    2743         },
    2744         {
    2745                 .label          = "printable",
    2746                 .type           = P_BOOL,
    2747                 .p_class        = P_LOCAL,
    2748                 .ptr            = &sDefault.bPrint_ok,
    2749                 .special        = NULL,
    2750                 .enum_list      = NULL,
    2751                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2752         },
    2753         {
    2754                 .label          = "print notify backchannel",
    2755                 .type           = P_BOOL,
    2756                 .p_class        = P_LOCAL,
    2757                 .ptr            = &sDefault.bPrintNotifyBackchannel,
    2758                 .special        = NULL,
    2759                 .enum_list      = NULL,
    2760                 .flags          = FLAG_ADVANCED,
    2761         },
    2762         {
    2763                 .label          = "print ok",
    2764                 .type           = P_BOOL,
    2765                 .p_class        = P_LOCAL,
    2766                 .ptr            = &sDefault.bPrint_ok,
    2767                 .special        = NULL,
    2768                 .enum_list      = NULL,
    2769                 .flags          = FLAG_HIDE,
    2770         },
    2771         {
    2772                 .label          = "printing",
    2773                 .type           = P_ENUM,
    2774                 .p_class        = P_LOCAL,
    2775                 .ptr            = &sDefault.iPrinting,
    2776                 .special        = handle_printing,
    2777                 .enum_list      = enum_printing,
    2778                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2779         },
    2780         {
    2781                 .label          = "cups options",
    2782                 .type           = P_STRING,
    2783                 .p_class        = P_LOCAL,
    2784                 .ptr            = &sDefault.szCupsOptions,
    2785                 .special        = NULL,
    2786                 .enum_list      = NULL,
    2787                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2788         },
    2789         {
    2790                 .label          = "cups server",
    2791                 .type           = P_STRING,
    2792                 .p_class        = P_GLOBAL,
    2793                 .ptr            = &Globals.szCupsServer,
    2794                 .special        = NULL,
    2795                 .enum_list      = NULL,
    2796                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2797         },
    2798         {
    2799                 .label          = "cups encrypt",
    2800                 .type           = P_ENUM,
    2801                 .p_class        = P_GLOBAL,
    2802                 .ptr            = &Globals.CupsEncrypt,
    2803                 .special        = NULL,
    2804                 .enum_list      = enum_bool_auto,
    2805                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2806         },
    2807         {
    2808 
    2809                 .label          = "cups connection timeout",
    2810                 .type           = P_INTEGER,
    2811                 .p_class        = P_GLOBAL,
    2812                 .ptr            = &Globals.cups_connection_timeout,
    2813                 .special        = NULL,
    2814                 .enum_list      = NULL,
    2815                 .flags          = FLAG_ADVANCED,
    2816         },
    2817         {
    2818                 .label          = "iprint server",
    2819                 .type           = P_STRING,
    2820                 .p_class        = P_GLOBAL,
    2821                 .ptr            = &Globals.szIPrintServer,
    2822                 .special        = NULL,
    2823                 .enum_list      = NULL,
    2824                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2825         },
    2826         {
    2827                 .label          = "print command",
    2828                 .type           = P_STRING,
    2829                 .p_class        = P_LOCAL,
    2830                 .ptr            = &sDefault.szPrintcommand,
    2831                 .special        = NULL,
    2832                 .enum_list      = NULL,
    2833                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2834         },
    2835         {
    2836                 .label          = "disable spoolss",
    2837                 .type           = P_BOOL,
    2838                 .p_class        = P_GLOBAL,
    2839                 .ptr            = &Globals.bDisableSpoolss,
    2840                 .special        = NULL,
    2841                 .enum_list      = NULL,
    2842                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2843         },
    2844         {
    2845                 .label          = "enable spoolss",
    2846                 .type           = P_BOOLREV,
    2847                 .p_class        = P_GLOBAL,
    2848                 .ptr            = &Globals.bDisableSpoolss,
    2849                 .special        = NULL,
    2850                 .enum_list      = NULL,
    2851                 .flags          = FLAG_HIDE,
    2852         },
    2853         {
    2854                 .label          = "lpq command",
    2855                 .type           = P_STRING,
    2856                 .p_class        = P_LOCAL,
    2857                 .ptr            = &sDefault.szLpqcommand,
    2858                 .special        = NULL,
    2859                 .enum_list      = NULL,
    2860                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2861         },
    2862         {
    2863                 .label          = "lprm command",
    2864                 .type           = P_STRING,
    2865                 .p_class        = P_LOCAL,
    2866                 .ptr            = &sDefault.szLprmcommand,
    2867                 .special        = NULL,
    2868                 .enum_list      = NULL,
    2869                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2870         },
    2871         {
    2872                 .label          = "lppause command",
    2873                 .type           = P_STRING,
    2874                 .p_class        = P_LOCAL,
    2875                 .ptr            = &sDefault.szLppausecommand,
    2876                 .special        = NULL,
    2877                 .enum_list      = NULL,
    2878                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2879         },
    2880         {
    2881                 .label          = "lpresume command",
    2882                 .type           = P_STRING,
    2883                 .p_class        = P_LOCAL,
    2884                 .ptr            = &sDefault.szLpresumecommand,
    2885                 .special        = NULL,
    2886                 .enum_list      = NULL,
    2887                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2888         },
    2889         {
    2890                 .label          = "queuepause command",
    2891                 .type           = P_STRING,
    2892                 .p_class        = P_LOCAL,
    2893                 .ptr            = &sDefault.szQueuepausecommand,
    2894                 .special        = NULL,
    2895                 .enum_list      = NULL,
    2896                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2897         },
    2898         {
    2899                 .label          = "queueresume command",
    2900                 .type           = P_STRING,
    2901                 .p_class        = P_LOCAL,
    2902                 .ptr            = &sDefault.szQueueresumecommand,
    2903                 .special        = NULL,
    2904                 .enum_list      = NULL,
    2905                 .flags          = FLAG_ADVANCED | FLAG_PRINT | FLAG_GLOBAL,
    2906         },
    2907         {
    2908                 .label          = "addport command",
    2909                 .type           = P_STRING,
    2910                 .p_class        = P_GLOBAL,
    2911                 .ptr            = &Globals.szAddPortCommand,
    2912                 .special        = NULL,
    2913                 .enum_list      = NULL,
    2914                 .flags          = FLAG_ADVANCED,
    2915         },
    2916         {
    2917                 .label          = "enumports command",
    2918                 .type           = P_STRING,
    2919                 .p_class        = P_GLOBAL,
    2920                 .ptr            = &Globals.szEnumPortsCommand,
    2921                 .special        = NULL,
    2922                 .enum_list      = NULL,
    2923                 .flags          = FLAG_ADVANCED,
    2924         },
    2925         {
    2926                 .label          = "addprinter command",
    2927                 .type           = P_STRING,
    2928                 .p_class        = P_GLOBAL,
    2929                 .ptr            = &Globals.szAddPrinterCommand,
    2930                 .special        = NULL,
    2931                 .enum_list      = NULL,
    2932                 .flags          = FLAG_ADVANCED,
    2933         },
    2934         {
    2935                 .label          = "deleteprinter command",
    2936                 .type           = P_STRING,
    2937                 .p_class        = P_GLOBAL,
    2938                 .ptr            = &Globals.szDeletePrinterCommand,
    2939                 .special        = NULL,
    2940                 .enum_list      = NULL,
    2941                 .flags          = FLAG_ADVANCED,
    2942         },
    2943         {
    2944                 .label          = "show add printer wizard",
    2945                 .type           = P_BOOL,
    2946                 .p_class        = P_GLOBAL,
    2947                 .ptr            = &Globals.bMsAddPrinterWizard,
    2948                 .special        = NULL,
    2949                 .enum_list      = NULL,
    2950                 .flags          = FLAG_ADVANCED,
    2951         },
    2952         {
    2953                 .label          = "os2 driver map",
    2954                 .type           = P_STRING,
    2955                 .p_class        = P_GLOBAL,
    2956                 .ptr            = &Globals.szOs2DriverMap,
    2957                 .special        = NULL,
    2958                 .enum_list      = NULL,
    2959                 .flags          = FLAG_ADVANCED,
    2960         },
    2961 
    2962         {
    2963                 .label          = "printer name",
    2964                 .type           = P_STRING,
    2965                 .p_class        = P_LOCAL,
    2966                 .ptr            = &sDefault.szPrintername,
    2967                 .special        = NULL,
    2968                 .enum_list      = NULL,
    2969                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2970         },
    2971         {
    2972                 .label          = "printer",
    2973                 .type           = P_STRING,
    2974                 .p_class        = P_LOCAL,
    2975                 .ptr            = &sDefault.szPrintername,
    2976                 .special        = NULL,
    2977                 .enum_list      = NULL,
    2978                 .flags          = FLAG_HIDE,
    2979         },
    2980         {
    2981                 .label          = "use client driver",
    2982                 .type           = P_BOOL,
    2983                 .p_class        = P_LOCAL,
    2984                 .ptr            = &sDefault.bUseClientDriver,
    2985                 .special        = NULL,
    2986                 .enum_list      = NULL,
    2987                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2988         },
    2989         {
    2990                 .label          = "default devmode",
    2991                 .type           = P_BOOL,
    2992                 .p_class        = P_LOCAL,
    2993                 .ptr            = &sDefault.bDefaultDevmode,
    2994                 .special        = NULL,
    2995                 .enum_list      = NULL,
    2996                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    2997         },
    2998         {
    2999                 .label          = "force printername",
    3000                 .type           = P_BOOL,
    3001                 .p_class        = P_LOCAL,
    3002                 .ptr            = &sDefault.bForcePrintername,
    3003                 .special        = NULL,
    3004                 .enum_list      = NULL,
    3005                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    3006         },
    3007         {
    3008                 .label          = "printjob username",
    3009                 .type           = P_STRING,
    3010                 .p_class        = P_LOCAL,
    3011                 .ptr            = &sDefault.szPrintjobUsername,
    3012                 .special        = NULL,
    3013                 .enum_list      = NULL,
    3014                 .flags          = FLAG_ADVANCED | FLAG_PRINT,
    3015         },
    3016 
    3017         {N_("Filename Handling"), P_SEP, P_SEPARATOR},
    3018 
    3019         {
    3020                 .label          = "mangling method",
    3021                 .type           = P_STRING,
    3022                 .p_class        = P_GLOBAL,
    3023                 .ptr            = &Globals.szManglingMethod,
    3024                 .special        = NULL,
    3025                 .enum_list      = NULL,
    3026                 .flags          = FLAG_ADVANCED,
    3027         },
    3028         {
    3029                 .label          = "mangle prefix",
    3030                 .type           = P_INTEGER,
    3031                 .p_class        = P_GLOBAL,
    3032                 .ptr            = &Globals.mangle_prefix,
    3033                 .special        = NULL,
    3034                 .enum_list      = NULL,
    3035                 .flags          = FLAG_ADVANCED,
    3036         },
    3037 
    3038         {
    3039                 .label          = "default case",
    3040                 .type           = P_ENUM,
    3041                 .p_class        = P_LOCAL,
    3042                 .ptr            = &sDefault.iDefaultCase,
    3043                 .special        = NULL,
    3044                 .enum_list      = enum_case,
    3045                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    3046         },
    3047         {
    3048                 .label          = "case sensitive",
    3049                 .type           = P_ENUM,
    3050                 .p_class        = P_LOCAL,
    3051                 .ptr            = &sDefault.iCaseSensitive,
    3052                 .special        = NULL,
    3053                 .enum_list      = enum_bool_auto,
    3054                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3055         },
    3056         {
    3057                 .label          = "casesignames",
    3058                 .type           = P_ENUM,
    3059                 .p_class        = P_LOCAL,
    3060                 .ptr            = &sDefault.iCaseSensitive,
    3061                 .special        = NULL,
    3062                 .enum_list      = enum_bool_auto,
    3063                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_HIDE,
    3064         },
    3065         {
    3066                 .label          = "preserve case",
    3067                 .type           = P_BOOL,
    3068                 .p_class        = P_LOCAL,
    3069                 .ptr            = &sDefault.bCasePreserve,
    3070                 .special        = NULL,
    3071                 .enum_list      = NULL,
    3072                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3073         },
    3074         {
    3075                 .label          = "short preserve case",
    3076                 .type           = P_BOOL,
    3077                 .p_class        = P_LOCAL,
    3078                 .ptr            = &sDefault.bShortCasePreserve,
    3079                 .special        = NULL,
    3080                 .enum_list      = NULL,
    3081                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3082         },
    3083         {
    3084                 .label          = "mangling char",
    3085                 .type           = P_CHAR,
    3086                 .p_class        = P_LOCAL,
    3087                 .ptr            = &sDefault.magic_char,
    3088                 .special        = NULL,
    3089                 .enum_list      = NULL,
    3090                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3091         },
    3092         {
    3093                 .label          = "hide dot files",
    3094                 .type           = P_BOOL,
    3095                 .p_class        = P_LOCAL,
    3096                 .ptr            = &sDefault.bHideDotFiles,
    3097                 .special        = NULL,
    3098                 .enum_list      = NULL,
    3099                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3100         },
    3101         {
    3102                 .label          = "hide special files",
    3103                 .type           = P_BOOL,
    3104                 .p_class        = P_LOCAL,
    3105                 .ptr            = &sDefault.bHideSpecialFiles,
    3106                 .special        = NULL,
    3107                 .enum_list      = NULL,
    3108                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3109         },
    3110         {
    3111                 .label          = "hide unreadable",
    3112                 .type           = P_BOOL,
    3113                 .p_class        = P_LOCAL,
    3114                 .ptr            = &sDefault.bHideUnReadable,
    3115                 .special        = NULL,
    3116                 .enum_list      = NULL,
    3117                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3118         },
    3119         {
    3120                 .label          = "hide unwriteable files",
    3121                 .type           = P_BOOL,
    3122                 .p_class        = P_LOCAL,
    3123                 .ptr            = &sDefault.bHideUnWriteableFiles,
    3124                 .special        = NULL,
    3125                 .enum_list      = NULL,
    3126                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3127         },
    3128         {
    3129                 .label          = "delete veto files",
    3130                 .type           = P_BOOL,
    3131                 .p_class        = P_LOCAL,
    3132                 .ptr            = &sDefault.bDeleteVetoFiles,
    3133                 .special        = NULL,
    3134                 .enum_list      = NULL,
    3135                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3136         },
    3137         {
    3138                 .label          = "veto files",
    3139                 .type           = P_STRING,
    3140                 .p_class        = P_LOCAL,
    3141                 .ptr            = &sDefault.szVetoFiles,
    3142                 .special        = NULL,
    3143                 .enum_list      = NULL,
    3144                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3145         },
    3146         {
    3147                 .label          = "hide files",
    3148                 .type           = P_STRING,
    3149                 .p_class        = P_LOCAL,
    3150                 .ptr            = &sDefault.szHideFiles,
    3151                 .special        = NULL,
    3152                 .enum_list      = NULL,
    3153                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3154         },
    3155         {
    3156                 .label          = "veto oplock files",
    3157                 .type           = P_STRING,
    3158                 .p_class        = P_LOCAL,
    3159                 .ptr            = &sDefault.szVetoOplockFiles,
    3160                 .special        = NULL,
    3161                 .enum_list      = NULL,
    3162                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3163         },
    3164         {
    3165                 .label          = "map archive",
    3166                 .type           = P_BOOL,
    3167                 .p_class        = P_LOCAL,
    3168                 .ptr            = &sDefault.bMap_archive,
    3169                 .special        = NULL,
    3170                 .enum_list      = NULL,
    3171                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3172         },
    3173         {
    3174                 .label          = "map hidden",
    3175                 .type           = P_BOOL,
    3176                 .p_class        = P_LOCAL,
    3177                 .ptr            = &sDefault.bMap_hidden,
    3178                 .special        = NULL,
    3179                 .enum_list      = NULL,
    3180                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3181         },
    3182         {
    3183                 .label          = "map system",
    3184                 .type           = P_BOOL,
    3185                 .p_class        = P_LOCAL,
    3186                 .ptr            = &sDefault.bMap_system,
    3187                 .special        = NULL,
    3188                 .enum_list      = NULL,
    3189                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3190         },
    3191         {
    3192                 .label          = "map readonly",
    3193                 .type           = P_ENUM,
    3194                 .p_class        = P_LOCAL,
    3195                 .ptr            = &sDefault.iMap_readonly,
    3196                 .special        = NULL,
    3197                 .enum_list      = enum_map_readonly,
    3198                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3199         },
    3200         {
    3201                 .label          = "mangled names",
    3202                 .type           = P_BOOL,
    3203                 .p_class        = P_LOCAL,
    3204                 .ptr            = &sDefault.bMangledNames,
    3205                 .special        = NULL,
    3206                 .enum_list      = NULL,
    3207                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3208         },
    3209         {
    3210                 .label          = "max stat cache size",
    3211                 .type           = P_INTEGER,
    3212                 .p_class        = P_GLOBAL,
    3213                 .ptr            = &Globals.iMaxStatCacheSize,
    3214                 .special        = NULL,
    3215                 .enum_list      = NULL,
    3216                 .flags          = FLAG_ADVANCED,
    3217         },
    3218         {
    3219                 .label          = "stat cache",
    3220                 .type           = P_BOOL,
    3221                 .p_class        = P_GLOBAL,
    3222                 .ptr            = &Globals.bStatCache,
    3223                 .special        = NULL,
    3224                 .enum_list      = NULL,
    3225                 .flags          = FLAG_ADVANCED,
    3226         },
    3227         {
    3228                 .label          = "store dos attributes",
    3229                 .type           = P_BOOL,
    3230                 .p_class        = P_LOCAL,
    3231                 .ptr            = &sDefault.bStoreDosAttributes,
    3232                 .special        = NULL,
    3233                 .enum_list      = NULL,
    3234                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3235         },
    3236         {
    3237                 .label          = "dmapi support",
    3238                 .type           = P_BOOL,
    3239                 .p_class        = P_LOCAL,
    3240                 .ptr            = &sDefault.bDmapiSupport,
    3241                 .special        = NULL,
    3242                 .enum_list      = NULL,
    3243                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3244         },
    3245 
    3246 
    3247         {N_("Domain Options"), P_SEP, P_SEPARATOR},
    3248 
    3249         {
    3250                 .label          = "machine password timeout",
    3251                 .type           = P_INTEGER,
    3252                 .p_class        = P_GLOBAL,
    3253                 .ptr            = &Globals.machine_password_timeout,
    3254                 .special        = NULL,
    3255                 .enum_list      = NULL,
    3256                 .flags          = FLAG_ADVANCED | FLAG_WIZARD,
    3257         },
    3258 
    3259         {N_("Logon Options"), P_SEP, P_SEPARATOR},
    3260 
    3261         {
    3262                 .label          = "add user script",
    3263                 .type           = P_STRING,
    3264                 .p_class        = P_GLOBAL,
    3265                 .ptr            = &Globals.szAddUserScript,
    3266                 .special        = NULL,
    3267                 .enum_list      = NULL,
    3268                 .flags          = FLAG_ADVANCED,
    3269         },
    3270         {
    3271                 .label          = "rename user script",
    3272                 .type           = P_STRING,
    3273                 .p_class        = P_GLOBAL,
    3274                 .ptr            = &Globals.szRenameUserScript,
    3275                 .special        = NULL,
    3276                 .enum_list      = NULL,
    3277                 .flags          = FLAG_ADVANCED,
    3278         },
    3279         {
    3280                 .label          = "delete user script",
    3281                 .type           = P_STRING,
    3282                 .p_class        = P_GLOBAL,
    3283                 .ptr            = &Globals.szDelUserScript,
    3284                 .special        = NULL,
    3285                 .enum_list      = NULL,
    3286                 .flags          = FLAG_ADVANCED,
    3287         },
    3288         {
    3289                 .label          = "add group script",
    3290                 .type           = P_STRING,
    3291                 .p_class        = P_GLOBAL,
    3292                 .ptr            = &Globals.szAddGroupScript,
    3293                 .special        = NULL,
    3294                 .enum_list      = NULL,
    3295                 .flags          = FLAG_ADVANCED,
    3296         },
    3297         {
    3298                 .label          = "delete group script",
    3299                 .type           = P_STRING,
    3300                 .p_class        = P_GLOBAL,
    3301                 .ptr            = &Globals.szDelGroupScript,
    3302                 .special        = NULL,
    3303                 .enum_list      = NULL,
    3304                 .flags          = FLAG_ADVANCED,
    3305         },
    3306         {
    3307                 .label          = "add user to group script",
    3308                 .type           = P_STRING,
    3309                 .p_class        = P_GLOBAL,
    3310                 .ptr            = &Globals.szAddUserToGroupScript,
    3311                 .special        = NULL,
    3312                 .enum_list      = NULL,
    3313                 .flags          = FLAG_ADVANCED,
    3314         },
    3315         {
    3316                 .label          = "delete user from group script",
    3317                 .type           = P_STRING,
    3318                 .p_class        = P_GLOBAL,
    3319                 .ptr            = &Globals.szDelUserFromGroupScript,
    3320                 .special        = NULL,
    3321                 .enum_list      = NULL,
    3322                 .flags          = FLAG_ADVANCED,
    3323         },
    3324         {
    3325                 .label          = "set primary group script",
    3326                 .type           = P_STRING,
    3327                 .p_class        = P_GLOBAL,
    3328                 .ptr            = &Globals.szSetPrimaryGroupScript,
    3329                 .special        = NULL,
    3330                 .enum_list      = NULL,
    3331                 .flags          = FLAG_ADVANCED,
    3332         },
    3333         {
    3334                 .label          = "add machine script",
    3335                 .type           = P_STRING,
    3336                 .p_class        = P_GLOBAL,
    3337                 .ptr            = &Globals.szAddMachineScript,
    3338                 .special        = NULL,
    3339                 .enum_list      = NULL,
    3340                 .flags          = FLAG_ADVANCED,
    3341         },
    3342         {
    3343                 .label          = "shutdown script",
    3344                 .type           = P_STRING,
    3345                 .p_class        = P_GLOBAL,
    3346                 .ptr            = &Globals.szShutdownScript,
    3347                 .special        = NULL,
    3348                 .enum_list      = NULL,
    3349                 .flags          = FLAG_ADVANCED,
    3350         },
    3351         {
    3352                 .label          = "abort shutdown script",
    3353                 .type           = P_STRING,
    3354                 .p_class        = P_GLOBAL,
    3355                 .ptr            = &Globals.szAbortShutdownScript,
    3356                 .special        = NULL,
    3357                 .enum_list      = NULL,
    3358                 .flags          = FLAG_ADVANCED,
    3359         },
    3360         {
    3361                 .label          = "username map script",
    3362                 .type           = P_STRING,
    3363                 .p_class        = P_GLOBAL,
    3364                 .ptr            = &Globals.szUsernameMapScript,
    3365                 .special        = NULL,
    3366                 .enum_list      = NULL,
    3367                 .flags          = FLAG_ADVANCED,
    3368         },
    3369         {
    3370                 .label          = "username map cache time",
    3371                 .type           = P_INTEGER,
    3372                 .p_class        = P_GLOBAL,
    3373                 .ptr            = &Globals.iUsernameMapCacheTime,
    3374                 .special        = NULL,
    3375                 .enum_list      = NULL,
    3376                 .flags          = FLAG_ADVANCED,
    3377         },
    3378         {
    3379                 .label          = "logon script",
    3380                 .type           = P_STRING,
    3381                 .p_class        = P_GLOBAL,
    3382                 .ptr            = &Globals.szLogonScript,
    3383                 .special        = NULL,
    3384                 .enum_list      = NULL,
    3385                 .flags          = FLAG_ADVANCED,
    3386         },
    3387         {
    3388                 .label          = "logon path",
    3389                 .type           = P_STRING,
    3390                 .p_class        = P_GLOBAL,
    3391                 .ptr            = &Globals.szLogonPath,
    3392                 .special        = NULL,
    3393                 .enum_list      = NULL,
    3394                 .flags          = FLAG_ADVANCED,
    3395         },
    3396         {
    3397                 .label          = "logon drive",
    3398                 .type           = P_STRING,
    3399                 .p_class        = P_GLOBAL,
    3400                 .ptr            = &Globals.szLogonDrive,
    3401                 .special        = NULL,
    3402                 .enum_list      = NULL,
    3403                 .flags          = FLAG_ADVANCED,
    3404         },
    3405         {
    3406                 .label          = "logon home",
    3407                 .type           = P_STRING,
    3408                 .p_class        = P_GLOBAL,
    3409                 .ptr            = &Globals.szLogonHome,
    3410                 .special        = NULL,
    3411                 .enum_list      = NULL,
    3412                 .flags          = FLAG_ADVANCED,
    3413         },
    3414         {
    3415                 .label          = "domain logons",
    3416                 .type           = P_BOOL,
    3417                 .p_class        = P_GLOBAL,
    3418                 .ptr            = &Globals.bDomainLogons,
    3419                 .special        = NULL,
    3420                 .enum_list      = NULL,
    3421                 .flags          = FLAG_ADVANCED,
    3422         },
    3423 
    3424         {
    3425                 .label          = "init logon delayed hosts",
    3426                 .type           = P_LIST,
    3427                 .p_class        = P_GLOBAL,
    3428                 .ptr            = &Globals.szInitLogonDelayedHosts,
    3429                 .special        = NULL,
    3430                 .enum_list      = NULL,
    3431                 .flags          = FLAG_ADVANCED,
    3432         },
    3433 
    3434         {
    3435                 .label          = "init logon delay",
    3436                 .type           = P_INTEGER,
    3437                 .p_class        = P_GLOBAL,
    3438                 .ptr            = &Globals.InitLogonDelay,
    3439                 .special        = NULL,
    3440                 .enum_list      = NULL,
    3441                 .flags          = FLAG_ADVANCED,
    3442 
    3443         },
    3444 
    3445         {N_("Browse Options"), P_SEP, P_SEPARATOR},
    3446 
    3447         {
    3448                 .label          = "os level",
    3449                 .type           = P_INTEGER,
    3450                 .p_class        = P_GLOBAL,
    3451                 .ptr            = &Globals.os_level,
    3452                 .special        = NULL,
    3453                 .enum_list      = NULL,
    3454                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    3455         },
    3456         {
    3457                 .label          = "lm announce",
    3458                 .type           = P_ENUM,
    3459                 .p_class        = P_GLOBAL,
    3460                 .ptr            = &Globals.lm_announce,
    3461                 .special        = NULL,
    3462                 .enum_list      = enum_bool_auto,
    3463                 .flags          = FLAG_ADVANCED,
    3464         },
    3465         {
    3466                 .label          = "lm interval",
    3467                 .type           = P_INTEGER,
    3468                 .p_class        = P_GLOBAL,
    3469                 .ptr            = &Globals.lm_interval,
    3470                 .special        = NULL,
    3471                 .enum_list      = NULL,
    3472                 .flags          = FLAG_ADVANCED,
    3473         },
    3474         {
    3475                 .label          = "preferred master",
    3476                 .type           = P_ENUM,
    3477                 .p_class        = P_GLOBAL,
    3478                 .ptr            = &Globals.iPreferredMaster,
    3479                 .special        = NULL,
    3480                 .enum_list      = enum_bool_auto,
    3481                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    3482         },
    3483         {
    3484                 .label          = "prefered master",
    3485                 .type           = P_ENUM,
    3486                 .p_class        = P_GLOBAL,
    3487                 .ptr            = &Globals.iPreferredMaster,
    3488                 .special        = NULL,
    3489                 .enum_list      = enum_bool_auto,
    3490                 .flags          = FLAG_HIDE,
    3491         },
    3492         {
    3493                 .label          = "local master",
    3494                 .type           = P_BOOL,
    3495                 .p_class        = P_GLOBAL,
    3496                 .ptr            = &Globals.bLocalMaster,
    3497                 .special        = NULL,
    3498                 .enum_list      = NULL,
    3499                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    3500         },
    3501         {
    3502                 .label          = "domain master",
    3503                 .type           = P_ENUM,
    3504                 .p_class        = P_GLOBAL,
    3505                 .ptr            = &Globals.iDomainMaster,
    3506                 .special        = NULL,
    3507                 .enum_list      = enum_bool_auto,
    3508                 .flags          = FLAG_BASIC | FLAG_ADVANCED,
    3509         },
    3510         {
    3511                 .label          = "browse list",
    3512                 .type           = P_BOOL,
    3513                 .p_class        = P_GLOBAL,
    3514                 .ptr            = &Globals.bBrowseList,
    3515                 .special        = NULL,
    3516                 .enum_list      = NULL,
    3517                 .flags          = FLAG_ADVANCED,
    3518         },
    3519         {
    3520                 .label          = "browseable",
    3521                 .type           = P_BOOL,
    3522                 .p_class        = P_LOCAL,
    3523                 .ptr            = &sDefault.bBrowseable,
    3524                 .special        = NULL,
    3525                 .enum_list      = NULL,
    3526                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    3527         },
    3528         {
    3529                 .label          = "browsable",
    3530                 .type           = P_BOOL,
    3531                 .p_class        = P_LOCAL,
    3532                 .ptr            = &sDefault.bBrowseable,
    3533                 .special        = NULL,
    3534                 .enum_list      = NULL,
    3535                 .flags          = FLAG_HIDE,
    3536         },
    3537         {
    3538                 .label          = "access based share enum",
    3539                 .type           = P_BOOL,
    3540                 .p_class        = P_LOCAL,
    3541                 .ptr            = &sDefault.bAccessBasedShareEnum,
    3542                 .special        = NULL,
    3543                 .enum_list      = NULL,
    3544                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE
    3545         },
    3546         {
    3547                 .label          = "enhanced browsing",
    3548                 .type           = P_BOOL,
    3549                 .p_class        = P_GLOBAL,
    3550                 .ptr            = &Globals.enhanced_browsing,
    3551                 .special        = NULL,
    3552                 .enum_list      = NULL,
    3553                 .flags          = FLAG_ADVANCED,
    3554         },
    3555 
    3556         {N_("WINS Options"), P_SEP, P_SEPARATOR},
    3557 
    3558         {
    3559                 .label          = "dns proxy",
    3560                 .type           = P_BOOL,
    3561                 .p_class        = P_GLOBAL,
    3562                 .ptr            = &Globals.bDNSproxy,
    3563                 .special        = NULL,
    3564                 .enum_list      = NULL,
    3565                 .flags          = FLAG_ADVANCED,
    3566         },
    3567         {
    3568                 .label          = "wins proxy",
    3569                 .type           = P_BOOL,
    3570                 .p_class        = P_GLOBAL,
    3571                 .ptr            = &Globals.bWINSproxy,
    3572                 .special        = NULL,
    3573                 .enum_list      = NULL,
    3574                 .flags          = FLAG_ADVANCED,
    3575         },
    3576         {
    3577                 .label          = "wins server",
    3578                 .type           = P_LIST,
    3579                 .p_class        = P_GLOBAL,
    3580                 .ptr            = &Globals.szWINSservers,
    3581                 .special        = NULL,
    3582                 .enum_list      = NULL,
    3583                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    3584         },
    3585         {
    3586                 .label          = "wins support",
    3587                 .type           = P_BOOL,
    3588                 .p_class        = P_GLOBAL,
    3589                 .ptr            = &Globals.bWINSsupport,
    3590                 .special        = NULL,
    3591                 .enum_list      = NULL,
    3592                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_WIZARD,
    3593         },
    3594         {
    3595                 .label          = "wins hook",
    3596                 .type           = P_STRING,
    3597                 .p_class        = P_GLOBAL,
    3598                 .ptr            = &Globals.szWINSHook,
    3599                 .special        = NULL,
    3600                 .enum_list      = NULL,
    3601                 .flags          = FLAG_ADVANCED,
    3602         },
    3603 
    3604         {N_("Locking Options"), P_SEP, P_SEPARATOR},
    3605 
    3606         {
    3607                 .label          = "blocking locks",
    3608                 .type           = P_BOOL,
    3609                 .p_class        = P_LOCAL,
    3610                 .ptr            = &sDefault.bBlockingLocks,
    3611                 .special        = NULL,
    3612                 .enum_list      = NULL,
    3613                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3614         },
    3615         {
    3616                 .label          = "csc policy",
    3617                 .type           = P_ENUM,
    3618                 .p_class        = P_LOCAL,
    3619                 .ptr            = &sDefault.iCSCPolicy,
    3620                 .special        = NULL,
    3621                 .enum_list      = enum_csc_policy,
    3622                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3623         },
    3624         {
    3625                 .label          = "fake oplocks",
    3626                 .type           = P_BOOL,
    3627                 .p_class        = P_LOCAL,
    3628                 .ptr            = &sDefault.bFakeOplocks,
    3629                 .special        = NULL,
    3630                 .enum_list      = NULL,
    3631                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    3632         },
    3633         {
    3634                 .label          = "kernel oplocks",
    3635                 .type           = P_BOOL,
    3636                 .p_class        = P_GLOBAL,
    3637                 .ptr            = &Globals.bKernelOplocks,
    3638                 .special        = NULL,
    3639                 .enum_list      = NULL,
    3640                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    3641         },
    3642         {
    3643                 .label          = "locking",
    3644                 .type           = P_BOOL,
    3645                 .p_class        = P_LOCAL,
    3646                 .ptr            = &sDefault.bLocking,
    3647                 .special        = NULL,
    3648                 .enum_list      = NULL,
    3649                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3650         },
    3651         {
    3652                 .label          = "lock spin time",
    3653                 .type           = P_INTEGER,
    3654                 .p_class        = P_GLOBAL,
    3655                 .ptr            = &Globals.iLockSpinTime,
    3656                 .special        = NULL,
    3657                 .enum_list      = NULL,
    3658                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    3659         },
    3660         {
    3661                 .label          = "oplocks",
    3662                 .type           = P_BOOL,
    3663                 .p_class        = P_LOCAL,
    3664                 .ptr            = &sDefault.bOpLocks,
    3665                 .special        = NULL,
    3666                 .enum_list      = NULL,
    3667                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3668         },
    3669         {
    3670                 .label          = "level2 oplocks",
    3671                 .type           = P_BOOL,
    3672                 .p_class        = P_LOCAL,
    3673                 .ptr            = &sDefault.bLevel2OpLocks,
    3674                 .special        = NULL,
    3675                 .enum_list      = NULL,
    3676                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3677         },
    3678         {
    3679                 .label          = "oplock break wait time",
    3680                 .type           = P_INTEGER,
    3681                 .p_class        = P_GLOBAL,
    3682                 .ptr            = &Globals.oplock_break_wait_time,
    3683                 .special        = NULL,
    3684                 .enum_list      = NULL,
    3685                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    3686         },
    3687         {
    3688                 .label          = "oplock contention limit",
    3689                 .type           = P_INTEGER,
    3690                 .p_class        = P_LOCAL,
    3691                 .ptr            = &sDefault.iOplockContentionLimit,
    3692                 .special        = NULL,
    3693                 .enum_list      = NULL,
    3694                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3695         },
    3696         {
    3697                 .label          = "posix locking",
    3698                 .type           = P_BOOL,
    3699                 .p_class        = P_LOCAL,
    3700                 .ptr            = &sDefault.bPosixLocking,
    3701                 .special        = NULL,
    3702                 .enum_list      = NULL,
    3703                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3704         },
    3705         {
    3706                 .label          = "strict locking",
    3707                 .type           = P_ENUM,
    3708                 .p_class        = P_LOCAL,
    3709                 .ptr            = &sDefault.iStrictLocking,
    3710                 .special        = NULL,
    3711                 .enum_list      = enum_bool_auto,
    3712                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    3713         },
    3714         {
    3715                 .label          = "share modes",
    3716                 .type           = P_BOOL,
    3717                 .p_class        = P_LOCAL,
    3718                 .ptr            = &sDefault.bShareModes,
    3719                 .special        = NULL,
    3720                 .enum_list      = NULL,
    3721                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL | FLAG_DEPRECATED,
    3722         },
    3723 
    3724         {N_("Ldap Options"), P_SEP, P_SEPARATOR},
    3725 
    3726         {
    3727                 .label          = "ldap admin dn",
    3728                 .type           = P_STRING,
    3729                 .p_class        = P_GLOBAL,
    3730                 .ptr            = &Globals.szLdapAdminDn,
    3731                 .special        = NULL,
    3732                 .enum_list      = NULL,
    3733                 .flags          = FLAG_ADVANCED,
    3734         },
    3735         {
    3736                 .label          = "ldap delete dn",
    3737                 .type           = P_BOOL,
    3738                 .p_class        = P_GLOBAL,
    3739                 .ptr            = &Globals.ldap_delete_dn,
    3740                 .special        = NULL,
    3741                 .enum_list      = NULL,
    3742                 .flags          = FLAG_ADVANCED,
    3743         },
    3744         {
    3745                 .label          = "ldap group suffix",
    3746                 .type           = P_STRING,
    3747                 .p_class        = P_GLOBAL,
    3748                 .ptr            = &Globals.szLdapGroupSuffix,
    3749                 .special        = NULL,
    3750                 .enum_list      = NULL,
    3751                 .flags          = FLAG_ADVANCED,
    3752         },
    3753         {
    3754                 .label          = "ldap idmap suffix",
    3755                 .type           = P_STRING,
    3756                 .p_class        = P_GLOBAL,
    3757                 .ptr            = &Globals.szLdapIdmapSuffix,
    3758                 .special        = NULL,
    3759                 .enum_list      = NULL,
    3760                 .flags          = FLAG_ADVANCED,
    3761         },
    3762         {
    3763                 .label          = "ldap machine suffix",
    3764                 .type           = P_STRING,
    3765                 .p_class        = P_GLOBAL,
    3766                 .ptr            = &Globals.szLdapMachineSuffix,
    3767                 .special        = NULL,
    3768                 .enum_list      = NULL,
    3769                 .flags          = FLAG_ADVANCED,
    3770         },
    3771         {
    3772                 .label          = "ldap passwd sync",
    3773                 .type           = P_ENUM,
    3774                 .p_class        = P_GLOBAL,
    3775                 .ptr            = &Globals.ldap_passwd_sync,
    3776                 .special        = NULL,
    3777                 .enum_list      = enum_ldap_passwd_sync,
    3778                 .flags          = FLAG_ADVANCED,
    3779         },
    3780         {
    3781                 .label          = "ldap password sync",
    3782                 .type           = P_ENUM,
    3783                 .p_class        = P_GLOBAL,
    3784                 .ptr            = &Globals.ldap_passwd_sync,
    3785                 .special        = NULL,
    3786                 .enum_list      = enum_ldap_passwd_sync,
    3787                 .flags          = FLAG_HIDE,
    3788         },
    3789         {
    3790                 .label          = "ldap replication sleep",
    3791                 .type           = P_INTEGER,
    3792                 .p_class        = P_GLOBAL,
    3793                 .ptr            = &Globals.ldap_replication_sleep,
    3794                 .special        = NULL,
    3795                 .enum_list      = NULL,
    3796                 .flags          = FLAG_ADVANCED,
    3797         },
    3798         {
    3799                 .label          = "ldap suffix",
    3800                 .type           = P_STRING,
    3801                 .p_class        = P_GLOBAL,
    3802                 .ptr            = &Globals.szLdapSuffix,
    3803                 .special        = NULL,
    3804                 .enum_list      = NULL,
    3805                 .flags          = FLAG_ADVANCED,
    3806         },
    3807         {
    3808                 .label          = "ldap ssl",
    3809                 .type           = P_ENUM,
    3810                 .p_class        = P_GLOBAL,
    3811                 .ptr            = &Globals.ldap_ssl,
    3812                 .special        = NULL,
    3813                 .enum_list      = enum_ldap_ssl,
    3814                 .flags          = FLAG_ADVANCED,
    3815         },
    3816         {
    3817                 .label          = "ldap ssl ads",
    3818                 .type           = P_BOOL,
    3819                 .p_class        = P_GLOBAL,
    3820                 .ptr            = &Globals.ldap_ssl_ads,
    3821                 .special        = NULL,
    3822                 .enum_list      = NULL,
    3823                 .flags          = FLAG_ADVANCED,
    3824         },
    3825         {
    3826                 .label          = "ldap deref",
    3827                 .type           = P_ENUM,
    3828                 .p_class        = P_GLOBAL,
    3829                 .ptr            = &Globals.ldap_deref,
    3830                 .special        = NULL,
    3831                 .enum_list      = enum_ldap_deref,
    3832                 .flags          = FLAG_ADVANCED,
    3833         },
    3834         {
    3835                 .label          = "ldap follow referral",
    3836                 .type           = P_ENUM,
    3837                 .p_class        = P_GLOBAL,
    3838                 .ptr            = &Globals.ldap_follow_referral,
    3839                 .special        = NULL,
    3840                 .enum_list      = enum_bool_auto,
    3841                 .flags          = FLAG_ADVANCED,
    3842         },
    3843         {
    3844                 .label          = "ldap timeout",
    3845                 .type           = P_INTEGER,
    3846                 .p_class        = P_GLOBAL,
    3847                 .ptr            = &Globals.ldap_timeout,
    3848                 .special        = NULL,
    3849                 .enum_list      = NULL,
    3850                 .flags          = FLAG_ADVANCED,
    3851         },
    3852         {
    3853                 .label          = "ldap connection timeout",
    3854                 .type           = P_INTEGER,
    3855                 .p_class        = P_GLOBAL,
    3856                 .ptr            = &Globals.ldap_connection_timeout,
    3857                 .special        = NULL,
    3858                 .enum_list      = NULL,
    3859                 .flags          = FLAG_ADVANCED,
    3860         },
    3861         {
    3862                 .label          = "ldap page size",
    3863                 .type           = P_INTEGER,
    3864                 .p_class        = P_GLOBAL,
    3865                 .ptr            = &Globals.ldap_page_size,
    3866                 .special        = NULL,
    3867                 .enum_list      = NULL,
    3868                 .flags          = FLAG_ADVANCED,
    3869         },
    3870         {
    3871                 .label          = "ldap user suffix",
    3872                 .type           = P_STRING,
    3873                 .p_class        = P_GLOBAL,
    3874                 .ptr            = &Globals.szLdapUserSuffix,
    3875                 .special        = NULL,
    3876                 .enum_list      = NULL,
    3877                 .flags          = FLAG_ADVANCED,
    3878         },
    3879         {
    3880                 .label          = "ldap debug level",
    3881                 .type           = P_INTEGER,
    3882                 .p_class        = P_GLOBAL,
    3883                 .ptr            = &Globals.ldap_debug_level,
    3884                 .special        = handle_ldap_debug_level,
    3885                 .enum_list      = NULL,
    3886                 .flags          = FLAG_ADVANCED,
    3887         },
    3888         {
    3889                 .label          = "ldap debug threshold",
    3890                 .type           = P_INTEGER,
    3891                 .p_class        = P_GLOBAL,
    3892                 .ptr            = &Globals.ldap_debug_threshold,
    3893                 .special        = NULL,
    3894                 .enum_list      = NULL,
    3895                 .flags          = FLAG_ADVANCED,
    3896         },
    3897 
    3898         {N_("EventLog Options"), P_SEP, P_SEPARATOR},
    3899 
    3900         {
    3901                 .label          = "eventlog list",
    3902                 .type           = P_LIST,
    3903                 .p_class        = P_GLOBAL,
    3904                 .ptr            = &Globals.szEventLogs,
    3905                 .special        = NULL,
    3906                 .enum_list      = NULL,
    3907                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL | FLAG_SHARE,
    3908         },
    3909 
    3910         {N_("Miscellaneous Options"), P_SEP, P_SEPARATOR},
    3911 
    3912         {
    3913                 .label          = "add share command",
    3914                 .type           = P_STRING,
    3915                 .p_class        = P_GLOBAL,
    3916                 .ptr            = &Globals.szAddShareCommand,
    3917                 .special        = NULL,
    3918                 .enum_list      = NULL,
    3919                 .flags          = FLAG_ADVANCED,
    3920         },
    3921         {
    3922                 .label          = "change share command",
    3923                 .type           = P_STRING,
    3924                 .p_class        = P_GLOBAL,
    3925                 .ptr            = &Globals.szChangeShareCommand,
    3926                 .special        = NULL,
    3927                 .enum_list      = NULL,
    3928                 .flags          = FLAG_ADVANCED,
    3929         },
    3930         {
    3931                 .label          = "delete share command",
    3932                 .type           = P_STRING,
    3933                 .p_class        = P_GLOBAL,
    3934                 .ptr            = &Globals.szDeleteShareCommand,
    3935                 .special        = NULL,
    3936                 .enum_list      = NULL,
    3937                 .flags          = FLAG_ADVANCED,
    3938         },
    3939         {
    3940                 .label          = "config file",
    3941                 .type           = P_STRING,
    3942                 .p_class        = P_GLOBAL,
    3943                 .ptr            = &Globals.szConfigFile,
    3944                 .special        = NULL,
    3945                 .enum_list      = NULL,
    3946                 .flags          = FLAG_HIDE|FLAG_META,
    3947         },
    3948         {
    3949                 .label          = "preload",
    3950                 .type           = P_STRING,
    3951                 .p_class        = P_GLOBAL,
    3952                 .ptr            = &Globals.szAutoServices,
    3953                 .special        = NULL,
    3954                 .enum_list      = NULL,
    3955                 .flags          = FLAG_ADVANCED,
    3956         },
    3957         {
    3958                 .label          = "auto services",
    3959                 .type           = P_STRING,
    3960                 .p_class        = P_GLOBAL,
    3961                 .ptr            = &Globals.szAutoServices,
    3962                 .special        = NULL,
    3963                 .enum_list      = NULL,
    3964                 .flags          = FLAG_ADVANCED,
    3965         },
    3966         {
    3967                 .label          = "lock directory",
    3968                 .type           = P_STRING,
    3969                 .p_class        = P_GLOBAL,
    3970                 .ptr            = &Globals.szLockDir,
    3971                 .special        = NULL,
    3972                 .enum_list      = NULL,
    3973                 .flags          = FLAG_ADVANCED,
    3974         },
    3975         {
    3976                 .label          = "lock dir",
    3977                 .type           = P_STRING,
    3978                 .p_class        = P_GLOBAL,
    3979                 .ptr            = &Globals.szLockDir,
    3980                 .special        = NULL,
    3981                 .enum_list      = NULL,
    3982                 .flags          = FLAG_HIDE,
    3983         },
    3984         {
    3985                 .label          = "state directory",
    3986                 .type           = P_STRING,
    3987                 .p_class        = P_GLOBAL,
    3988                 .ptr            = &Globals.szStateDir,
    3989                 .special        = NULL,
    3990                 .enum_list      = NULL,
    3991                 .flags          = FLAG_ADVANCED,
    3992         },
    3993         {
    3994                 .label          = "cache directory",
    3995                 .type           = P_STRING,
    3996                 .p_class        = P_GLOBAL,
    3997                 .ptr            = &Globals.szCacheDir,
    3998                 .special        = NULL,
    3999                 .enum_list      = NULL,
    4000                 .flags          = FLAG_ADVANCED,
    4001         },
    4002         {
    4003                 .label          = "pid directory",
    4004                 .type           = P_STRING,
    4005                 .p_class        = P_GLOBAL,
    4006                 .ptr            = &Globals.szPidDir,
    4007                 .special        = NULL,
    4008                 .enum_list      = NULL,
    4009                 .flags          = FLAG_ADVANCED,
    4010         },
    4011 #ifdef WITH_UTMP
    4012         {
    4013                 .label          = "utmp directory",
    4014                 .type           = P_STRING,
    4015                 .p_class        = P_GLOBAL,
    4016                 .ptr            = &Globals.szUtmpDir,
    4017                 .special        = NULL,
    4018                 .enum_list      = NULL,
    4019                 .flags          = FLAG_ADVANCED,
    4020         },
    4021         {
    4022                 .label          = "wtmp directory",
    4023                 .type           = P_STRING,
    4024                 .p_class        = P_GLOBAL,
    4025                 .ptr            = &Globals.szWtmpDir,
    4026                 .special        = NULL,
    4027                 .enum_list      = NULL,
    4028                 .flags          = FLAG_ADVANCED,
    4029         },
    4030         {
    4031                 .label          = "utmp",
    4032                 .type           = P_BOOL,
    4033                 .p_class        = P_GLOBAL,
    4034                 .ptr            = &Globals.bUtmp,
    4035                 .special        = NULL,
    4036                 .enum_list      = NULL,
    4037                 .flags          = FLAG_ADVANCED,
    4038         },
    4039 #endif
    4040         {
    4041                 .label          = "default service",
    4042                 .type           = P_STRING,
    4043                 .p_class        = P_GLOBAL,
    4044                 .ptr            = &Globals.szDefaultService,
    4045                 .special        = NULL,
    4046                 .enum_list      = NULL,
    4047                 .flags          = FLAG_ADVANCED,
    4048         },
    4049         {
    4050                 .label          = "default",
    4051                 .type           = P_STRING,
    4052                 .p_class        = P_GLOBAL,
    4053                 .ptr            = &Globals.szDefaultService,
    4054                 .special        = NULL,
    4055                 .enum_list      = NULL,
    4056                 .flags          = FLAG_ADVANCED,
    4057         },
    4058         {
    4059                 .label          = "message command",
    4060                 .type           = P_STRING,
    4061                 .p_class        = P_GLOBAL,
    4062                 .ptr            = &Globals.szMsgCommand,
    4063                 .special        = NULL,
    4064                 .enum_list      = NULL,
    4065                 .flags          = FLAG_ADVANCED,
    4066         },
    4067         {
    4068                 .label          = "dfree cache time",
    4069                 .type           = P_INTEGER,
    4070                 .p_class        = P_LOCAL,
    4071                 .ptr            = &sDefault.iDfreeCacheTime,
    4072                 .special        = NULL,
    4073                 .enum_list      = NULL,
    4074                 .flags          = FLAG_ADVANCED,
    4075         },
    4076         {
    4077                 .label          = "dfree command",
    4078                 .type           = P_STRING,
    4079                 .p_class        = P_LOCAL,
    4080                 .ptr            = &sDefault.szDfree,
    4081                 .special        = NULL,
    4082                 .enum_list      = NULL,
    4083                 .flags          = FLAG_ADVANCED,
    4084         },
    4085         {
    4086                 .label          = "get quota command",
    4087                 .type           = P_STRING,
    4088                 .p_class        = P_GLOBAL,
    4089                 .ptr            = &Globals.szGetQuota,
    4090                 .special        = NULL,
    4091                 .enum_list      = NULL,
    4092                 .flags          = FLAG_ADVANCED,
    4093         },
    4094         {
    4095                 .label          = "set quota command",
    4096                 .type           = P_STRING,
    4097                 .p_class        = P_GLOBAL,
    4098                 .ptr            = &Globals.szSetQuota,
    4099                 .special        = NULL,
    4100                 .enum_list      = NULL,
    4101                 .flags          = FLAG_ADVANCED,
    4102         },
    4103         {
    4104                 .label          = "remote announce",
    4105                 .type           = P_STRING,
    4106                 .p_class        = P_GLOBAL,
    4107                 .ptr            = &Globals.szRemoteAnnounce,
    4108                 .special        = NULL,
    4109                 .enum_list      = NULL,
    4110                 .flags          = FLAG_ADVANCED,
    4111         },
    4112         {
    4113                 .label          = "remote browse sync",
    4114                 .type           = P_STRING,
    4115                 .p_class        = P_GLOBAL,
    4116                 .ptr            = &Globals.szRemoteBrowseSync,
    4117                 .special        = NULL,
    4118                 .enum_list      = NULL,
    4119                 .flags          = FLAG_ADVANCED,
    4120         },
    4121         {
    4122                 .label          = "socket address",
    4123                 .type           = P_STRING,
    4124                 .p_class        = P_GLOBAL,
    4125                 .ptr            = &Globals.szSocketAddress,
    4126                 .special        = NULL,
    4127                 .enum_list      = NULL,
    4128                 .flags          = FLAG_ADVANCED,
    4129         },
    4130         {
    4131                 .label          = "nmbd bind explicit broadcast",
    4132                 .type           = P_BOOL,
    4133                 .p_class        = P_GLOBAL,
    4134                 .ptr            = &Globals.bNmbdBindExplicitBroadcast,
    4135                 .special        = NULL,
    4136                 .enum_list      = NULL,
    4137                 .flags          = FLAG_ADVANCED,
    4138         },
    4139         {
    4140                 .label          = "homedir map",
    4141                 .type           = P_STRING,
    4142                 .p_class        = P_GLOBAL,
    4143                 .ptr            = &Globals.szNISHomeMapName,
    4144                 .special        = NULL,
    4145                 .enum_list      = NULL,
    4146                 .flags          = FLAG_ADVANCED,
    4147         },
    4148         {
    4149                 .label          = "afs username map",
    4150                 .type           = P_STRING,
    4151                 .p_class        = P_GLOBAL,
    4152                 .ptr            = &Globals.szAfsUsernameMap,
    4153                 .special        = NULL,
    4154                 .enum_list      = NULL,
    4155                 .flags          = FLAG_ADVANCED,
    4156         },
    4157         {
    4158                 .label          = "afs token lifetime",
    4159                 .type           = P_INTEGER,
    4160                 .p_class        = P_GLOBAL,
    4161                 .ptr            = &Globals.iAfsTokenLifetime,
    4162                 .special        = NULL,
    4163                 .enum_list      = NULL,
    4164                 .flags          = FLAG_ADVANCED,
    4165         },
    4166         {
    4167                 .label          = "log nt token command",
    4168                 .type           = P_STRING,
    4169                 .p_class        = P_GLOBAL,
    4170                 .ptr            = &Globals.szLogNtTokenCommand,
    4171                 .special        = NULL,
    4172                 .enum_list      = NULL,
    4173                 .flags          = FLAG_ADVANCED,
    4174         },
    4175         {
    4176                 .label          = "time offset",
    4177                 .type           = P_INTEGER,
    4178                 .p_class        = P_GLOBAL,
    4179                 .ptr            = &extra_time_offset,
    4180                 .special        = NULL,
    4181                 .enum_list      = NULL,
    4182                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    4183         },
    4184         {
    4185                 .label          = "NIS homedir",
    4186                 .type           = P_BOOL,
    4187                 .p_class        = P_GLOBAL,
    4188                 .ptr            = &Globals.bNISHomeMap,
    4189                 .special        = NULL,
    4190                 .enum_list      = NULL,
    4191                 .flags          = FLAG_ADVANCED,
    4192         },
    4193         {
    4194                 .label          = "-valid",
    4195                 .type           = P_BOOL,
    4196                 .p_class        = P_LOCAL,
    4197                 .ptr            = &sDefault.valid,
    4198                 .special        = NULL,
    4199                 .enum_list      = NULL,
    4200                 .flags          = FLAG_HIDE,
    4201         },
    4202         {
    4203                 .label          = "copy",
    4204                 .type           = P_STRING,
    4205                 .p_class        = P_LOCAL,
    4206                 .ptr            = &sDefault.szCopy,
    4207                 .special        = handle_copy,
    4208                 .enum_list      = NULL,
    4209                 .flags          = FLAG_HIDE,
    4210         },
    4211         {
    4212                 .label          = "include",
    4213                 .type           = P_STRING,
    4214                 .p_class        = P_LOCAL,
    4215                 .ptr            = &sDefault.szInclude,
    4216                 .special        = handle_include,
    4217                 .enum_list      = NULL,
    4218                 .flags          = FLAG_HIDE|FLAG_META,
    4219         },
    4220         {
    4221                 .label          = "preexec",
    4222                 .type           = P_STRING,
    4223                 .p_class        = P_LOCAL,
    4224                 .ptr            = &sDefault.szPreExec,
    4225                 .special        = NULL,
    4226                 .enum_list      = NULL,
    4227                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    4228         },
    4229         {
    4230                 .label          = "exec",
    4231                 .type           = P_STRING,
    4232                 .p_class        = P_LOCAL,
    4233                 .ptr            = &sDefault.szPreExec,
    4234                 .special        = NULL,
    4235                 .enum_list      = NULL,
    4236                 .flags          = FLAG_ADVANCED,
    4237         },
    4238         {
    4239                 .label          = "preexec close",
    4240                 .type           = P_BOOL,
    4241                 .p_class        = P_LOCAL,
    4242                 .ptr            = &sDefault.bPreexecClose,
    4243                 .special        = NULL,
    4244                 .enum_list      = NULL,
    4245                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4246         },
    4247         {
    4248                 .label          = "postexec",
    4249                 .type           = P_STRING,
    4250                 .p_class        = P_LOCAL,
    4251                 .ptr            = &sDefault.szPostExec,
    4252                 .special        = NULL,
    4253                 .enum_list      = NULL,
    4254                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    4255         },
    4256         {
    4257                 .label          = "root preexec",
    4258                 .type           = P_STRING,
    4259                 .p_class        = P_LOCAL,
    4260                 .ptr            = &sDefault.szRootPreExec,
    4261                 .special        = NULL,
    4262                 .enum_list      = NULL,
    4263                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    4264         },
    4265         {
    4266                 .label          = "root preexec close",
    4267                 .type           = P_BOOL,
    4268                 .p_class        = P_LOCAL,
    4269                 .ptr            = &sDefault.bRootpreexecClose,
    4270                 .special        = NULL,
    4271                 .enum_list      = NULL,
    4272                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4273         },
    4274         {
    4275                 .label          = "root postexec",
    4276                 .type           = P_STRING,
    4277                 .p_class        = P_LOCAL,
    4278                 .ptr            = &sDefault.szRootPostExec,
    4279                 .special        = NULL,
    4280                 .enum_list      = NULL,
    4281                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    4282         },
    4283         {
    4284                 .label          = "available",
    4285                 .type           = P_BOOL,
    4286                 .p_class        = P_LOCAL,
    4287                 .ptr            = &sDefault.bAvailable,
    4288                 .special        = NULL,
    4289                 .enum_list      = NULL,
    4290                 .flags          = FLAG_BASIC | FLAG_ADVANCED | FLAG_SHARE | FLAG_PRINT,
    4291         },
    4292         {
    4293                 .label          = "registry shares",
    4294                 .type           = P_BOOL,
    4295                 .p_class        = P_GLOBAL,
    4296                 .ptr            = &Globals.bRegistryShares,
    4297                 .special        = NULL,
    4298                 .enum_list      = NULL,
    4299                 .flags          = FLAG_ADVANCED,
    4300         },
    4301         {
    4302                 .label          = "usershare allow guests",
    4303                 .type           = P_BOOL,
    4304                 .p_class        = P_GLOBAL,
    4305                 .ptr            = &Globals.bUsershareAllowGuests,
    4306                 .special        = NULL,
    4307                 .enum_list      = NULL,
    4308                 .flags          = FLAG_ADVANCED,
    4309         },
    4310         {
    4311                 .label          = "usershare max shares",
    4312                 .type           = P_INTEGER,
    4313                 .p_class        = P_GLOBAL,
    4314                 .ptr            = &Globals.iUsershareMaxShares,
    4315                 .special        = NULL,
    4316                 .enum_list      = NULL,
    4317                 .flags          = FLAG_ADVANCED,
    4318         },
    4319         {
    4320                 .label          = "usershare owner only",
    4321                 .type           = P_BOOL,
    4322                 .p_class        = P_GLOBAL,
    4323                 .ptr            = &Globals.bUsershareOwnerOnly,
    4324                 .special        = NULL,
    4325                 .enum_list      = NULL,
    4326                 .flags          = FLAG_ADVANCED,
    4327         },
    4328         {
    4329                 .label          = "usershare path",
    4330                 .type           = P_STRING,
    4331                 .p_class        = P_GLOBAL,
    4332                 .ptr            = &Globals.szUsersharePath,
    4333                 .special        = NULL,
    4334                 .enum_list      = NULL,
    4335                 .flags          = FLAG_ADVANCED,
    4336         },
    4337         {
    4338                 .label          = "usershare prefix allow list",
    4339                 .type           = P_LIST,
    4340                 .p_class        = P_GLOBAL,
    4341                 .ptr            = &Globals.szUsersharePrefixAllowList,
    4342                 .special        = NULL,
    4343                 .enum_list      = NULL,
    4344                 .flags          = FLAG_ADVANCED,
    4345         },
    4346         {
    4347                 .label          = "usershare prefix deny list",
    4348                 .type           = P_LIST,
    4349                 .p_class        = P_GLOBAL,
    4350                 .ptr            = &Globals.szUsersharePrefixDenyList,
    4351                 .special        = NULL,
    4352                 .enum_list      = NULL,
    4353                 .flags          = FLAG_ADVANCED,
    4354         },
    4355         {
    4356                 .label          = "usershare template share",
    4357                 .type           = P_STRING,
    4358                 .p_class        = P_GLOBAL,
    4359                 .ptr            = &Globals.szUsershareTemplateShare,
    4360                 .special        = NULL,
    4361                 .enum_list      = NULL,
    4362                 .flags          = FLAG_ADVANCED,
    4363         },
    4364         {
    4365                 .label          = "volume",
    4366                 .type           = P_STRING,
    4367                 .p_class        = P_LOCAL,
    4368                 .ptr            = &sDefault.volume,
    4369                 .special        = NULL,
    4370                 .enum_list      = NULL,
    4371                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4372         },
    4373         {
    4374                 .label          = "fstype",
    4375                 .type           = P_STRING,
    4376                 .p_class        = P_LOCAL,
    4377                 .ptr            = &sDefault.fstype,
    4378                 .special        = NULL,
    4379                 .enum_list      = NULL,
    4380                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4381         },
    4382         {
    4383                 .label          = "set directory",
    4384                 .type           = P_BOOLREV,
    4385                 .p_class        = P_LOCAL,
    4386                 .ptr            = &sDefault.bNo_set_dir,
    4387                 .special        = NULL,
    4388                 .enum_list      = NULL,
    4389                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4390         },
    4391         {
    4392                 .label          = "allow insecure wide links",
    4393                 .type           = P_BOOL,
    4394                 .p_class        = P_GLOBAL,
    4395                 .ptr            = &Globals.bAllowInsecureWidelinks,
    4396                 .special        = NULL,
    4397                 .enum_list      = NULL,
    4398                 .flags          = FLAG_ADVANCED,
    4399         },
    4400         {
    4401                 .label          = "wide links",
    4402                 .type           = P_BOOL,
    4403                 .p_class        = P_LOCAL,
    4404                 .ptr            = &sDefault.bWidelinks,
    4405                 .special        = NULL,
    4406                 .enum_list      = NULL,
    4407                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4408         },
    4409         {
    4410                 .label          = "follow symlinks",
    4411                 .type           = P_BOOL,
    4412                 .p_class        = P_LOCAL,
    4413                 .ptr            = &sDefault.bSymlinks,
    4414                 .special        = NULL,
    4415                 .enum_list      = NULL,
    4416                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4417         },
    4418         {
    4419                 .label          = "dont descend",
    4420                 .type           = P_STRING,
    4421                 .p_class        = P_LOCAL,
    4422                 .ptr            = &sDefault.szDontdescend,
    4423                 .special        = NULL,
    4424                 .enum_list      = NULL,
    4425                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4426         },
    4427         {
    4428                 .label          = "magic script",
    4429                 .type           = P_STRING,
    4430                 .p_class        = P_LOCAL,
    4431                 .ptr            = &sDefault.szMagicScript,
    4432                 .special        = NULL,
    4433                 .enum_list      = NULL,
    4434                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4435         },
    4436         {
    4437                 .label          = "magic output",
    4438                 .type           = P_STRING,
    4439                 .p_class        = P_LOCAL,
    4440                 .ptr            = &sDefault.szMagicOutput,
    4441                 .special        = NULL,
    4442                 .enum_list      = NULL,
    4443                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4444         },
    4445         {
    4446                 .label          = "delete readonly",
    4447                 .type           = P_BOOL,
    4448                 .p_class        = P_LOCAL,
    4449                 .ptr            = &sDefault.bDeleteReadonly,
    4450                 .special        = NULL,
    4451                 .enum_list      = NULL,
    4452                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4453         },
    4454         {
    4455                 .label          = "dos filemode",
    4456                 .type           = P_BOOL,
    4457                 .p_class        = P_LOCAL,
    4458                 .ptr            = &sDefault.bDosFilemode,
    4459                 .special        = NULL,
    4460                 .enum_list      = NULL,
    4461                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4462         },
    4463         {
    4464                 .label          = "dos filetimes",
    4465                 .type           = P_BOOL,
    4466                 .p_class        = P_LOCAL,
    4467                 .ptr            = &sDefault.bDosFiletimes,
    4468                 .special        = NULL,
    4469                 .enum_list      = NULL,
    4470                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4471         },
    4472         {
    4473                 .label          = "dos filetime resolution",
    4474                 .type           = P_BOOL,
    4475                 .p_class        = P_LOCAL,
    4476                 .ptr            = &sDefault.bDosFiletimeResolution,
    4477                 .special        = NULL,
    4478                 .enum_list      = NULL,
    4479                 .flags          = FLAG_ADVANCED | FLAG_SHARE | FLAG_GLOBAL,
    4480         },
    4481         {
    4482                 .label          = "fake directory create times",
    4483                 .type           = P_BOOL,
    4484                 .p_class        = P_LOCAL,
    4485                 .ptr            = &sDefault.bFakeDirCreateTimes,
    4486                 .special        = NULL,
    4487                 .enum_list      = NULL,
    4488                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    4489         },
    4490         {
    4491                 .label          = "async smb echo handler",
    4492                 .type           = P_BOOL,
    4493                 .p_class        = P_GLOBAL,
    4494                 .ptr            = &Globals.bAsyncSMBEchoHandler,
    4495                 .special        = NULL,
    4496                 .enum_list      = NULL,
    4497                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    4498         },
    4499         {
    4500                 .label          = "multicast dns register",
    4501                 .type           = P_BOOL,
    4502                 .p_class        = P_GLOBAL,
    4503                 .ptr            = &Globals.bMulticastDnsRegister,
    4504                 .special        = NULL,
    4505                 .enum_list      = NULL,
    4506                 .flags          = FLAG_ADVANCED | FLAG_GLOBAL,
    4507         },
    4508         {
    4509                 .label          = "panic action",
    4510                 .type           = P_STRING,
    4511                 .p_class        = P_GLOBAL,
    4512                 .ptr            = &Globals.szPanicAction,
    4513                 .special        = NULL,
    4514                 .enum_list      = NULL,
    4515                 .flags          = FLAG_ADVANCED,
    4516         },
    4517         {
    4518                 .label          = "perfcount module",
    4519                 .type           = P_STRING,
    4520                 .p_class        = P_GLOBAL,
    4521                 .ptr            = &Globals.szSMBPerfcountModule,
    4522                 .special        = NULL,
    4523                 .enum_list      = NULL,
    4524                 .flags          = FLAG_ADVANCED,
    4525         },
    4526 
    4527         {N_("VFS module options"), P_SEP, P_SEPARATOR},
    4528 
    4529         {
    4530                 .label          = "vfs objects",
    4531                 .type           = P_LIST,
    4532                 .p_class        = P_LOCAL,
    4533                 .ptr            = &sDefault.szVfsObjects,
    4534                 .special        = NULL,
    4535                 .enum_list      = NULL,
    4536                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4537         },
    4538         {
    4539                 .label          = "vfs object",
    4540                 .type           = P_LIST,
    4541                 .p_class        = P_LOCAL,
    4542                 .ptr            = &sDefault.szVfsObjects,
    4543                 .special        = NULL,
    4544                 .enum_list      = NULL,
    4545                 .flags          = FLAG_HIDE,
    4546         },
    4547 
    4548 
    4549         {N_("MSDFS options"), P_SEP, P_SEPARATOR},
    4550 
    4551         {
    4552                 .label          = "msdfs root",
    4553                 .type           = P_BOOL,
    4554                 .p_class        = P_LOCAL,
    4555                 .ptr            = &sDefault.bMSDfsRoot,
    4556                 .special        = NULL,
    4557                 .enum_list      = NULL,
    4558                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4559         },
    4560         {
    4561                 .label          = "msdfs proxy",
    4562                 .type           = P_STRING,
    4563                 .p_class        = P_LOCAL,
    4564                 .ptr            = &sDefault.szMSDfsProxy,
    4565                 .special        = NULL,
    4566                 .enum_list      = NULL,
    4567                 .flags          = FLAG_ADVANCED | FLAG_SHARE,
    4568         },
    4569         {
    4570                 .label          = "host msdfs",
    4571                 .type           = P_BOOL,
    4572                 .p_class        = P_GLOBAL,
    4573                 .ptr            = &Globals.bHostMSDfs,
    4574                 .special        = NULL,
    4575                 .enum_list      = NULL,
    4576                 .flags          = FLAG_ADVANCED,
    4577         },
    4578 
    4579         {N_("Winbind options"), P_SEP, P_SEPARATOR},
    4580 
    4581         {
    4582                 .label          = "passdb expand explicit",
    4583                 .type           = P_BOOL,
    4584                 .p_class        = P_GLOBAL,
    4585                 .ptr            = &Globals.bPassdbExpandExplicit,
    4586                 .special        = NULL,
    4587                 .enum_list      = NULL,
    4588                 .flags          = FLAG_ADVANCED,
    4589         },
    4590         {
    4591                 .label          = "idmap backend",
    4592                 .type           = P_STRING,
    4593                 .p_class        = P_GLOBAL,
    4594                 .ptr            = &Globals.szIdmapBackend,
    4595                 .special        = handle_idmap_backend,
    4596                 .enum_list      = NULL,
    4597                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    4598         },
    4599         {
    4600                 .label          = "idmap cache time",
    4601                 .type           = P_INTEGER,
    4602                 .p_class        = P_GLOBAL,
    4603                 .ptr            = &Globals.iIdmapCacheTime,
    4604                 .special        = NULL,
    4605                 .enum_list      = NULL,
    4606                 .flags          = FLAG_ADVANCED,
    4607         },
    4608         {
    4609                 .label          = "idmap negative cache time",
    4610                 .type           = P_INTEGER,
    4611                 .p_class        = P_GLOBAL,
    4612                 .ptr            = &Globals.iIdmapNegativeCacheTime,
    4613                 .special        = NULL,
    4614                 .enum_list      = NULL,
    4615                 .flags          = FLAG_ADVANCED,
    4616         },
    4617         {
    4618                 .label          = "idmap uid",
    4619                 .type           = P_STRING,
    4620                 .p_class        = P_GLOBAL,
    4621                 .ptr            = &Globals.szIdmapUID,
    4622                 .special        = handle_idmap_uid,
    4623                 .enum_list      = NULL,
    4624                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    4625         },
    4626         {
    4627                 .label          = "winbind uid",
    4628                 .type           = P_STRING,
    4629                 .p_class        = P_GLOBAL,
    4630                 .ptr            = &Globals.szIdmapUID,
    4631                 .special        = handle_idmap_uid,
    4632                 .enum_list      = NULL,
    4633                 .flags          = FLAG_HIDE,
    4634         },
    4635         {
    4636                 .label          = "idmap gid",
    4637                 .type           = P_STRING,
    4638                 .p_class        = P_GLOBAL,
    4639                 .ptr            = &Globals.szIdmapGID,
    4640                 .special        = handle_idmap_gid,
    4641                 .enum_list      = NULL,
    4642                 .flags          = FLAG_ADVANCED | FLAG_DEPRECATED,
    4643         },
    4644         {
    4645                 .label          = "winbind gid",
    4646                 .type           = P_STRING,
    4647                 .p_class        = P_GLOBAL,
    4648                 .ptr            = &Globals.szIdmapGID,
    4649                 .special        = handle_idmap_gid,
    4650                 .enum_list      = NULL,
    4651                 .flags          = FLAG_HIDE,
    4652         },
    4653         {
    4654                 .label          = "template homedir",
    4655                 .type           = P_STRING,
    4656                 .p_class        = P_GLOBAL,
    4657                 .ptr            = &Globals.szTemplateHomedir,
    4658                 .special        = NULL,
    4659                 .enum_list      = NULL,
    4660                 .flags          = FLAG_ADVANCED,
    4661         },
    4662         {
    4663                 .label          = "template shell",
    4664                 .type           = P_STRING,
    4665                 .p_class        = P_GLOBAL,
    4666                 .ptr            = &Globals.szTemplateShell,
    4667                 .special        = NULL,
    4668                 .enum_list      = NULL,
    4669                 .flags          = FLAG_ADVANCED,
    4670         },
    4671         {
    4672                 .label          = "winbind separator",
    4673                 .type           = P_STRING,
    4674                 .p_class        = P_GLOBAL,
    4675                 .ptr            = &Globals.szWinbindSeparator,
    4676                 .special        = NULL,
    4677                 .enum_list      = NULL,
    4678                 .flags          = FLAG_ADVANCED,
    4679         },
    4680         {
    4681                 .label          = "winbind cache time",
    4682                 .type           = P_INTEGER,
    4683                 .p_class        = P_GLOBAL,
    4684                 .ptr            = &Globals.winbind_cache_time,
    4685                 .special        = NULL,
    4686                 .enum_list      = NULL,
    4687                 .flags          = FLAG_ADVANCED,
    4688         },
    4689         {
    4690                 .label          = "winbind reconnect delay",
    4691                 .type           = P_INTEGER,
    4692                 .p_class        = P_GLOBAL,
    4693                 .ptr            = &Globals.winbind_reconnect_delay,
    4694                 .special        = NULL,
    4695                 .enum_list      = NULL,
    4696                 .flags          = FLAG_ADVANCED,
    4697         },
    4698         {
    4699                 .label          = "winbind max clients",
    4700                 .type           = P_INTEGER,
    4701                 .p_class        = P_GLOBAL,
    4702                 .ptr            = &Globals.winbind_max_clients,
    4703                 .special        = NULL,
    4704                 .enum_list      = NULL,
    4705                 .flags          = FLAG_ADVANCED,
    4706         },
    4707         {
    4708                 .label          = "winbind enum users",
    4709                 .type           = P_BOOL,
    4710                 .p_class        = P_GLOBAL,
    4711                 .ptr            = &Globals.bWinbindEnumUsers,
    4712                 .special        = NULL,
    4713                 .enum_list      = NULL,
    4714                 .flags          = FLAG_ADVANCED,
    4715         },
    4716         {
    4717                 .label          = "winbind enum groups",
    4718                 .type           = P_BOOL,
    4719                 .p_class        = P_GLOBAL,
    4720                 .ptr            = &Globals.bWinbindEnumGroups,
    4721                 .special        = NULL,
    4722                 .enum_list      = NULL,
    4723                 .flags          = FLAG_ADVANCED,
    4724         },
    4725         {
    4726                 .label          = "winbind use default domain",
    4727                 .type           = P_BOOL,
    4728                 .p_class        = P_GLOBAL,
    4729                 .ptr            = &Globals.bWinbindUseDefaultDomain,
    4730                 .special        = NULL,
    4731                 .enum_list      = NULL,
    4732                 .flags          = FLAG_ADVANCED,
    4733         },
    4734         {
    4735                 .label          = "winbind trusted domains only",
    4736                 .type           = P_BOOL,
    4737                 .p_class        = P_GLOBAL,
    4738                 .ptr            = &Globals.bWinbindTrustedDomainsOnly,
    4739                 .special        = NULL,
    4740                 .enum_list      = NULL,
    4741                 .flags          = FLAG_ADVANCED,
    4742         },
    4743         {
    4744                 .label          = "winbind nested groups",
    4745                 .type           = P_BOOL,
    4746                 .p_class        = P_GLOBAL,
    4747                 .ptr            = &Globals.bWinbindNestedGroups,
    4748                 .special        = NULL,
    4749                 .enum_list      = NULL,
    4750                 .flags          = FLAG_ADVANCED,
    4751         },
    4752         {
    4753                 .label          = "winbind expand groups",
    4754                 .type           = P_INTEGER,
    4755                 .p_class        = P_GLOBAL,
    4756                 .ptr            = &Globals.winbind_expand_groups,
    4757                 .special        = NULL,
    4758                 .enum_list      = NULL,
    4759                 .flags          = FLAG_ADVANCED,
    4760         },
    4761         {
    4762                 .label          = "winbind nss info",
    4763                 .type           = P_LIST,
    4764                 .p_class        = P_GLOBAL,
    4765                 .ptr            = &Globals.szWinbindNssInfo,
    4766                 .special        = NULL,
    4767                 .enum_list      = NULL,
    4768                 .flags          = FLAG_ADVANCED,
    4769         },
    4770         {
    4771                 .label          = "winbind refresh tickets",
    4772                 .type           = P_BOOL,
    4773                 .p_class        = P_GLOBAL,
    4774                 .ptr            = &Globals.bWinbindRefreshTickets,
    4775                 .special        = NULL,
    4776                 .enum_list      = NULL,
    4777                 .flags          = FLAG_ADVANCED,
    4778         },
    4779         {
    4780                 .label          = "winbind offline logon",
    4781                 .type           = P_BOOL,
    4782                 .p_class        = P_GLOBAL,
    4783                 .ptr            = &Globals.bWinbindOfflineLogon,
    4784                 .special        = NULL,
    4785                 .enum_list      = NULL,
    4786                 .flags          = FLAG_ADVANCED,
    4787         },
    4788         {
    4789                 .label          = "winbind sealed pipes",
    4790                 .type           = P_BOOL,
    4791                 .p_class        = P_GLOBAL,
    4792                 .ptr            = &Globals.bWinbindSealedPipes,
    4793                 .special        = NULL,
    4794                 .enum_list      = NULL,
    4795                 .flags          = FLAG_ADVANCED,
    4796         },
    4797         {
    4798                 .label          = "winbind normalize names",
    4799                 .type           = P_BOOL,
    4800                 .p_class        = P_GLOBAL,
    4801                 .ptr            = &Globals.bWinbindNormalizeNames,
    4802                 .special        = NULL,
    4803                 .enum_list      = NULL,
    4804                 .flags          = FLAG_ADVANCED,
    4805         },
    4806         {
    4807                 .label          = "winbind rpc only",
    4808                 .type           = P_BOOL,
    4809                 .p_class        = P_GLOBAL,
    4810                 .ptr            = &Globals.bWinbindRpcOnly,
    4811                 .special        = NULL,
    4812                 .enum_list      = NULL,
    4813                 .flags          = FLAG_ADVANCED,
    4814         },
    4815         {
    4816                 .label          = "create krb5 conf",
    4817                 .type           = P_BOOL,
    4818                 .p_class        = P_GLOBAL,
    4819                 .ptr            = &Globals.bCreateKrb5Conf,
    4820                 .special        = NULL,
    4821                 .enum_list      = NULL,
    4822                 .flags          = FLAG_ADVANCED,
    4823         },
    4824         {
    4825                 .label          = "ncalrpc dir",
    4826                 .type           = P_STRING,
    4827                 .p_class        = P_GLOBAL,
    4828                 .ptr            = &Globals.ncalrpc_dir,
    4829                 .special        = NULL,
    4830                 .enum_list      = NULL,
    4831                 .flags          = FLAG_ADVANCED,
    4832         },
    4833         {
    4834                 .label          = "winbind max domain connections",
    4835                 .type           = P_INTEGER,
    4836                 .p_class        = P_GLOBAL,
    4837                 .ptr            = &Globals.winbindMaxDomainConnections,
    4838                 .special        = NULL,
    4839                 .enum_list      = NULL,
    4840                 .flags          = FLAG_ADVANCED,
    4841         },
    4842 
    4843         {NULL,  P_BOOL,  P_NONE,  NULL,  NULL,  NULL,  0}
    4844 };
    4845 
    4846 /***************************************************************************
    4847  Initialise the sDefault parameter structure for the printer values.
    4848 ***************************************************************************/
    4849 
    4850 static void init_printer_values(struct service *pService)
    4851 {
    4852         /* choose defaults depending on the type of printing */
    4853         switch (pService->iPrinting) {
    4854                 case PRINT_BSD:
    4855                 case PRINT_AIX:
    4856                 case PRINT_LPRNT:
    4857                 case PRINT_LPROS2:
    4858                         string_set(&pService->szLpqcommand, "lpq -P'%p'");
    4859                         string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
    4860                         string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
    4861                         break;
    4862 
    4863                 case PRINT_LPRNG:
    4864                 case PRINT_PLP:
    4865                         string_set(&pService->szLpqcommand, "lpq -P'%p'");
    4866                         string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
    4867                         string_set(&pService->szPrintcommand, "lpr -r -P'%p' %s");
    4868                         string_set(&pService->szQueuepausecommand, "lpc stop '%p'");
    4869                         string_set(&pService->szQueueresumecommand, "lpc start '%p'");
    4870                         string_set(&pService->szLppausecommand, "lpc hold '%p' %j");
    4871                         string_set(&pService->szLpresumecommand, "lpc release '%p' %j");
    4872                         break;
    4873 
    4874                 case PRINT_CUPS:
    4875                 case PRINT_IPRINT:
    4876 #ifdef HAVE_CUPS
    4877                         /* set the lpq command to contain the destination printer
    4878                            name only.  This is used by cups_queue_get() */
    4879                         string_set(&pService->szLpqcommand, "%p");
    4880                         string_set(&pService->szLprmcommand, "");
    4881                         string_set(&pService->szPrintcommand, "");
    4882                         string_set(&pService->szLppausecommand, "");
    4883                         string_set(&pService->szLpresumecommand, "");
    4884                         string_set(&pService->szQueuepausecommand, "");
    4885                         string_set(&pService->szQueueresumecommand, "");
    4886 #else
    4887                         string_set(&pService->szLpqcommand, "lpq -P'%p'");
    4888                         string_set(&pService->szLprmcommand, "lprm -P'%p' %j");
    4889                         string_set(&pService->szPrintcommand, "lpr -P'%p' %s; rm %s");
    4890                         string_set(&pService->szLppausecommand, "lp -i '%p-%j' -H hold");
    4891                         string_set(&pService->szLpresumecommand, "lp -i '%p-%j' -H resume");
    4892                         string_set(&pService->szQueuepausecommand, "disable '%p'");
    4893                         string_set(&pService->szQueueresumecommand, "enable '%p'");
    4894 #endif /* HAVE_CUPS */
    4895                         break;
    4896 
    4897                 case PRINT_SYSV:
    4898                 case PRINT_HPUX:
    4899                         string_set(&pService->szLpqcommand, "lpstat -o%p");
    4900                         string_set(&pService->szLprmcommand, "cancel %p-%j");
    4901                         string_set(&pService->szPrintcommand, "lp -c -d%p %s; rm %s");
    4902                         string_set(&pService->szQueuepausecommand, "disable %p");
    4903                         string_set(&pService->szQueueresumecommand, "enable %p");
    4904 #ifndef HPUX
    4905                         string_set(&pService->szLppausecommand, "lp -i %p-%j -H hold");
    4906                         string_set(&pService->szLpresumecommand, "lp -i %p-%j -H resume");
    4907 #endif /* HPUX */
    4908                         break;
    4909 
    4910                 case PRINT_QNX:
    4911                         string_set(&pService->szLpqcommand, "lpq -P%p");
    4912                         string_set(&pService->szLprmcommand, "lprm -P%p %j");
    4913                         string_set(&pService->szPrintcommand, "lp -r -P%p %s");
    4914                         break;
    4915 
    4916 #if defined(DEVELOPER) || defined(ENABLE_BUILD_FARM_HACKS)
    4917 
    4918         case PRINT_TEST:
    4919         case PRINT_VLP: {
    4920                 const char *tdbfile;
    4921                 char *tmp;
    4922 
    4923                 tdbfile = talloc_asprintf(
    4924                         talloc_tos(), "tdbfile=%s",
    4925                         lp_parm_const_string(-1, "vlp", "tdbfile",
    4926                                              "/tmp/vlp.tdb"));
    4927                 if (tdbfile == NULL) {
    4928                         tdbfile="tdbfile=/tmp/vlp.tdb";
    4929                 }
    4930 
    4931                 tmp = talloc_asprintf(talloc_tos(), "vlp %s print %%p %%s",
    4932                                       tdbfile);
    4933                 string_set(&pService->szPrintcommand,
    4934                            tmp ? tmp : "vlp print %p %s");
    4935                 TALLOC_FREE(tmp);
    4936 
    4937                 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpq %%p",
    4938                                       tdbfile);
    4939                 string_set(&pService->szLpqcommand,
    4940                            tmp ? tmp : "vlp lpq %p");
    4941                 TALLOC_FREE(tmp);
    4942 
    4943                 tmp = talloc_asprintf(talloc_tos(), "vlp %s lprm %%p %%j",
    4944                                       tdbfile);
    4945                 string_set(&pService->szLprmcommand,
    4946                            tmp ? tmp : "vlp lprm %p %j");
    4947                 TALLOC_FREE(tmp);
    4948 
    4949                 tmp = talloc_asprintf(talloc_tos(), "vlp %s lppause %%p %%j",
    4950                                       tdbfile);
    4951                 string_set(&pService->szLppausecommand,
    4952                            tmp ? tmp : "vlp lppause %p %j");
    4953                 TALLOC_FREE(tmp);
    4954 
    4955                 tmp = talloc_asprintf(talloc_tos(), "vlp %s lpresume %%p %%j",
    4956                                       tdbfile);
    4957                 string_set(&pService->szLpresumecommand,
    4958                            tmp ? tmp : "vlp lpresume %p %j");
    4959                 TALLOC_FREE(tmp);
    4960 
    4961                 tmp = talloc_asprintf(talloc_tos(), "vlp %s queuepause %%p",
    4962                                       tdbfile);
    4963                 string_set(&pService->szQueuepausecommand,
    4964                            tmp ? tmp : "vlp queuepause %p");
    4965                 TALLOC_FREE(tmp);
    4966 
    4967                 tmp = talloc_asprintf(talloc_tos(), "vlp %s queueresume %%p",
    4968                                       tdbfile);
    4969                 string_set(&pService->szQueueresumecommand,
    4970                            tmp ? tmp : "vlp queueresume %p");
    4971                 TALLOC_FREE(tmp);
    4972 
    4973                 break;
    4974         }
    4975 #endif /* DEVELOPER */
    4976 
    4977         }
    4978 }
     266static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue);
     267static void free_param_opts(struct parmlist_entry **popts);
     268
    4979269/**
    4980270 *  Function to return the default value for the maximum number of open
     
    5040330            (parm.type == P_USTRING))
    5041331        {
    5042                 string_free((char**)parm_ptr);
    5043         } else if (parm.type == P_LIST) {
     332                lpcfg_string_free((char**)parm_ptr);
     333        } else if (parm.type == P_LIST || parm.type == P_CMDLIST) {
    5044334                TALLOC_FREE(*((char***)parm_ptr));
    5045335        }
     
    5050340 * given as a service struct.
    5051341 */
    5052 static void free_one_parameter(struct service *service,
     342static void free_one_parameter(struct loadparm_service *service,
    5053343                               struct parm_struct parm)
    5054344{
     
    5059349        }
    5060350
    5061         parm_ptr = lp_local_ptr(service, parm.ptr);
     351        parm_ptr = lp_parm_ptr(service, &parm);
    5062352
    5063353        free_one_parameter_common(parm_ptr, parm);
     
    5068358 * as a service struct.
    5069359 */
    5070 static void free_parameters(struct service *service)
     360static void free_parameters(struct loadparm_service *service)
    5071361{
    5072362        uint32_t i;
     
    5085375        void *parm_ptr;
    5086376
    5087         if (parm.ptr == NULL) {
    5088                 return;
    5089         }
    5090 
    5091377        if (snum < 0) {
    5092                 parm_ptr = parm.ptr;
     378                parm_ptr = lp_parm_ptr(NULL, &parm);
    5093379        } else if (parm.p_class != P_LOCAL) {
    5094380                return;
    5095381        } else {
    5096                 parm_ptr = lp_local_ptr_by_snum(snum, parm.ptr);
     382                parm_ptr = lp_parm_ptr(ServicePtrs[snum], &parm);
    5097383        }
    5098384
     
    5118404static void free_global_parameters(void)
    5119405{
     406        uint32_t i;
     407        struct parm_struct *parm;
     408
     409        free_param_opts(&Globals.param_opt);
    5120410        free_parameters_by_snum(GLOBAL_SECTION_SNUM);
    5121 }
    5122 
    5123 static int map_parameter(const char *pszParmName);
     411
     412        /* Reset references in the defaults because the context is going to be freed */
     413        for (i=0; parm_table[i].label; i++) {
     414                parm = &parm_table[i];
     415                if ((parm->type == P_STRING) ||
     416                    (parm->type == P_USTRING)) {
     417                        if ((parm->def.svalue != NULL) &&
     418                            (*(parm->def.svalue) != '\0')) {
     419                                if (talloc_parent(parm->def.svalue) == Globals.ctx) {
     420                                        parm->def.svalue = NULL;
     421                                }
     422                        }
     423                }
     424        }
     425        TALLOC_FREE(Globals.ctx);
     426}
    5124427
    5125428struct lp_stored_option {
     
    5136439  are sticky across reloads of smb.conf
    5137440 */
    5138 static bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
     441bool store_lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
    5139442{
    5140443        struct lp_stored_option *entry, *entry_next;
     
    5165468        }
    5166469
    5167         DLIST_ADD_END(stored_options, entry, struct lp_stored_option);
     470        DLIST_ADD_END(stored_options, entry);
    5168471
    5169472        return true;
     
    5174477        struct lp_stored_option *entry = NULL;
    5175478        for (entry = stored_options; entry != NULL; entry = entry->next) {
    5176                 if (!lp_set_cmdline_helper(entry->label, entry->value, false)) {
     479                if (!lp_set_cmdline_helper(entry->label, entry->value)) {
    5177480                        DEBUG(0, ("Failed to re-apply cmdline parameter %s = %s\n",
    5178481                                  entry->label, entry->value));
     
    5187490***************************************************************************/
    5188491
    5189 static void init_globals(bool reinit_globals)
    5190 {
    5191         static bool done_init = False;
     492static void init_globals(struct loadparm_context *lp_ctx, bool reinit_globals)
     493{
     494        static bool done_init = false;
    5192495        char *s = NULL;
    5193496        int i;
     
    5201504        if (!done_init) {
    5202505                /* The logfile can be set before this is invoked. Free it if so. */
    5203                 if (Globals.szLogFile != NULL) {
    5204                         string_free(&Globals.szLogFile);
    5205                         Globals.szLogFile = NULL;
    5206                 }
    5207                 done_init = True;
     506                lpcfg_string_free(&Globals.logfile);
     507                done_init = true;
    5208508        } else {
    5209509                free_global_parameters();
     
    5214514         * apply_lp_set_cmdline() call puts these values back in the
    5215515         * table once the defaults are set */
    5216         memset((void *)&Globals, '\0', sizeof(Globals));
     516        ZERO_STRUCT(Globals);
     517
     518        Globals.ctx = talloc_pooled_object(NULL, char, 272, 2048);
     519
     520        /* Initialize the flags list if necessary */
     521        if (flags_list == NULL) {
     522                get_flags();
     523        }
    5217524
    5218525        for (i = 0; parm_table[i].label; i++) {
    5219526                if ((parm_table[i].type == P_STRING ||
    5220                      parm_table[i].type == P_USTRING) &&
    5221                     parm_table[i].ptr)
     527                     parm_table[i].type == P_USTRING))
    5222528                {
    5223                         string_set((char **)parm_table[i].ptr, "");
    5224                 }
    5225         }
    5226 
    5227         string_set(&sDefault.fstype, FSTYPE_STRING);
    5228         string_set(&sDefault.szPrintjobUsername, "%U");
    5229 
    5230         init_printer_values(&sDefault);
    5231 
     529                        lpcfg_string_set(
     530                                Globals.ctx,
     531                                (char **)lp_parm_ptr(NULL, &parm_table[i]),
     532                                "");
     533                }
     534        }
     535
     536
     537        lpcfg_string_set(Globals.ctx, &sDefault.fstype, FSTYPE_STRING);
     538        lpcfg_string_set(Globals.ctx, &sDefault.printjob_username, "%U");
     539
     540        init_printer_values(lp_ctx, Globals.ctx, &sDefault);
     541
     542        sDefault.ntvfs_handler = str_list_make_v3_const(NULL, "unixuid default", NULL);
    5232543
    5233544        DEBUG(3, ("Initialising global parameters\n"));
    5234545
    5235         string_set(&Globals.szSMBPasswdFile, get_dyn_SMB_PASSWD_FILE());
    5236         string_set(&Globals.szPrivateDir, get_dyn_PRIVATE_DIR());
     546        /* Must manually force to upper case here, as this does not go via the handler */
     547        lpcfg_string_set(Globals.ctx, &Globals.netbios_name,
     548                         myhostname_upper());
     549
     550        lpcfg_string_set(Globals.ctx, &Globals.smb_passwd_file,
     551                         get_dyn_SMB_PASSWD_FILE());
     552        lpcfg_string_set(Globals.ctx, &Globals.private_dir,
     553                         get_dyn_PRIVATE_DIR());
    5237554
    5238555        /* use the new 'hash2' method by default, with a prefix of 1 */
    5239         string_set(&Globals.szManglingMethod, "hash2");
     556        lpcfg_string_set(Globals.ctx, &Globals.mangling_method, "hash2");
    5240557        Globals.mangle_prefix = 1;
    5241558
    5242         string_set(&Globals.szGuestaccount, GUEST_ACCOUNT);
     559        lpcfg_string_set(Globals.ctx, &Globals.guest_account, GUEST_ACCOUNT);
    5243560
    5244561        /* using UTF8 by default allows us to support all chars */
    5245         string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
    5246 
    5247 #if defined(HAVE_NL_LANGINFO) && defined(CODESET)
    5248         /* If the system supports nl_langinfo(), try to grab the value
    5249            from the user's locale */
    5250         string_set(&Globals.display_charset, "LOCALE");
    5251 #else
    5252         string_set(&Globals.display_charset, DEFAULT_DISPLAY_CHARSET);
    5253 #endif
     562        lpcfg_string_set(Globals.ctx, &Globals.unix_charset,
     563                         DEFAULT_UNIX_CHARSET);
    5254564
    5255565        /* Use codepage 850 as a default for the dos character set */
    5256         string_set(&Globals.dos_charset, DEFAULT_DOS_CHARSET);
     566        lpcfg_string_set(Globals.ctx, &Globals.dos_charset,
     567                         DEFAULT_DOS_CHARSET);
    5257568
    5258569        /*
    5259570         * Allow the default PASSWD_CHAT to be overridden in local.h.
    5260571         */
    5261         string_set(&Globals.szPasswdChat, DEFAULT_PASSWD_CHAT);
    5262 
    5263         set_global_myname(myhostname());
    5264         string_set(&Globals.szNetbiosName,global_myname());
    5265 
    5266         set_global_myworkgroup(WORKGROUP);
    5267         string_set(&Globals.szWorkgroup, lp_workgroup());
    5268 
    5269         string_set(&Globals.szPasswdProgram, "");
    5270         string_set(&Globals.szLockDir, get_dyn_LOCKDIR());
    5271         string_set(&Globals.szStateDir, get_dyn_STATEDIR());
    5272         string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
    5273         string_set(&Globals.szPidDir, get_dyn_PIDDIR());
    5274         string_set(&Globals.szSocketAddress, "0.0.0.0");
     572        lpcfg_string_set(Globals.ctx, &Globals.passwd_chat,
     573                         DEFAULT_PASSWD_CHAT);
     574
     575        lpcfg_string_set(Globals.ctx, &Globals.workgroup, DEFAULT_WORKGROUP);
     576
     577        lpcfg_string_set(Globals.ctx, &Globals.passwd_program, "");
     578        lpcfg_string_set(Globals.ctx, &Globals.lock_directory,
     579                         get_dyn_LOCKDIR());
     580        lpcfg_string_set(Globals.ctx, &Globals.state_directory,
     581                         get_dyn_STATEDIR());
     582        lpcfg_string_set(Globals.ctx, &Globals.cache_directory,
     583                         get_dyn_CACHEDIR());
     584        lpcfg_string_set(Globals.ctx, &Globals.pid_directory,
     585                         get_dyn_PIDDIR());
     586        lpcfg_string_set(Globals.ctx, &Globals.nbt_client_socket_address,
     587                         "0.0.0.0");
    5275588        /*
    5276589         * By default support explicit binding to broadcast
    5277590         * addresses.
    5278591         */
    5279         Globals.bNmbdBindExplicitBroadcast = true;
    5280 
    5281         if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
     592        Globals.nmbd_bind_explicit_broadcast = true;
     593
     594        s = talloc_asprintf(talloc_tos(), "Samba %s", samba_version_string());
     595        if (s == NULL) {
    5282596                smb_panic("init_globals: ENOMEM");
    5283597        }
    5284         string_set(&Globals.szServerString, s);
    5285         SAFE_FREE(s);
    5286         if (asprintf(&s, "%d.%d", DEFAULT_MAJOR_VERSION,
    5287                         DEFAULT_MINOR_VERSION) < 0) {
    5288                 smb_panic("init_globals: ENOMEM");
    5289         }
    5290         string_set(&Globals.szAnnounceVersion, s);
    5291         SAFE_FREE(s);
     598        lpcfg_string_set(Globals.ctx, &Globals.server_string, s);
     599        TALLOC_FREE(s);
    5292600#ifdef DEVELOPER
    5293         string_set(&Globals.szPanicAction, "/bin/sleep 999999999");
     601        lpcfg_string_set(Globals.ctx, &Globals.panic_action,
     602                         "/bin/sleep 999999999");
    5294603#endif
    5295604
    5296         string_set(&Globals.szSocketOptions, DEFAULT_SOCKET_OPTIONS);
    5297 
    5298         string_set(&Globals.szLogonDrive, "");
     605        lpcfg_string_set(Globals.ctx, &Globals.socket_options,
     606                         DEFAULT_SOCKET_OPTIONS);
     607
     608        lpcfg_string_set(Globals.ctx, &Globals.logon_drive, "");
    5299609        /* %N is the NIS auto.home server if -DAUTOHOME is used, else same as %L */
    5300         string_set(&Globals.szLogonHome, "\\\\%N\\%U");
    5301         string_set(&Globals.szLogonPath, "\\\\%N\\%U\\profile");
    5302 
    5303         string_set(&Globals.szNameResolveOrder, "lmhosts wins host bcast");
    5304         string_set(&Globals.szPasswordServer, "*");
    5305 
    5306         Globals.AlgorithmicRidBase = BASE_RID;
    5307 
    5308         Globals.bLoadPrinters = True;
    5309         Globals.PrintcapCacheTime = 750;        /* 12.5 minutes */
    5310 
    5311         Globals.ConfigBackend = config_backend;
     610        lpcfg_string_set(Globals.ctx, &Globals.logon_home, "\\\\%N\\%U");
     611        lpcfg_string_set(Globals.ctx, &Globals.logon_path,
     612                         "\\\\%N\\%U\\profile");
     613
     614        Globals.name_resolve_order = str_list_make_v3_const(NULL, "lmhosts wins host bcast", NULL);
     615        lpcfg_string_set(Globals.ctx, &Globals.password_server, "*");
     616
     617        Globals.algorithmic_rid_base = BASE_RID;
     618
     619        Globals.load_printers = true;
     620        Globals.printcap_cache_time = 750;      /* 12.5 minutes */
     621
     622        Globals.config_backend = config_backend;
     623        Globals._server_role = ROLE_AUTO;
    5312624
    5313625        /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
     
    5315627        Globals.max_xmit = 0x4104;
    5316628        Globals.max_mux = 50;   /* This is *needed* for profile support. */
    5317         Globals.lpqcachetime = 30;      /* changed to handle large print servers better -- jerry */
    5318         Globals.bDisableSpoolss = False;
    5319         Globals.iMaxSmbdProcesses = 0;/* no limit specified */
    5320         Globals.pwordlevel = 0;
    5321         Globals.unamelevel = 0;
     629        Globals.lpq_cache_time = 30;    /* changed to handle large print servers better -- jerry */
     630        Globals._disable_spoolss = false;
     631        Globals.max_smbd_processes = 0;/* no limit specified */
     632        Globals.username_level = 0;
    5322633        Globals.deadtime = 0;
    5323634        Globals.getwd_cache = true;
    5324         Globals.bLargeReadwrite = True;
     635        Globals.large_readwrite = true;
    5325636        Globals.max_log_size = 5000;
    5326637        Globals.max_open_files = max_open_files();
    5327         Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
    5328         Globals.maxprotocol = PROTOCOL_NT1;
    5329         Globals.minprotocol = PROTOCOL_CORE;
    5330         Globals.security = SEC_USER;
    5331         Globals.paranoid_server_security = True;
    5332         Globals.bEncryptPasswords = True;
    5333         Globals.bUpdateEncrypt = False;
    5334         Globals.clientSchannel = Auto;
    5335         Globals.serverSchannel = Auto;
    5336         Globals.bReadRaw = True;
    5337         Globals.bWriteRaw = True;
    5338         Globals.bNullPasswords = False;
    5339         Globals.bObeyPamRestrictions = False;
     638        Globals.server_max_protocol = PROTOCOL_SMB3_11;
     639        Globals.server_min_protocol = PROTOCOL_LANMAN1;
     640        Globals._client_max_protocol = PROTOCOL_DEFAULT;
     641        Globals.client_min_protocol = PROTOCOL_CORE;
     642        Globals._client_ipc_max_protocol = PROTOCOL_DEFAULT;
     643        Globals._client_ipc_min_protocol = PROTOCOL_DEFAULT;
     644        Globals._security = SEC_AUTO;
     645        Globals.encrypt_passwords = true;
     646        Globals.client_schannel = Auto;
     647        Globals.winbind_sealed_pipes = true;
     648        Globals.require_strong_key = true;
     649        Globals.server_schannel = Auto;
     650        Globals.read_raw = true;
     651        Globals.write_raw = true;
     652        Globals.null_passwords = false;
     653        Globals.old_password_allowed_period = 60;
     654        Globals.obey_pam_restrictions = false;
    5340655        Globals.syslog = 1;
    5341         Globals.bSyslogOnly = False;
    5342         Globals.bTimestampLogs = True;
    5343         string_set(&Globals.szLogLevel, "0");
    5344         Globals.bDebugPrefixTimestamp = False;
    5345         Globals.bDebugHiresTimestamp = true;
    5346         Globals.bDebugPid = False;
    5347         Globals.bDebugUid = False;
    5348         Globals.bDebugClass = False;
    5349         Globals.bEnableCoreFiles = True;
     656        Globals.syslog_only = false;
     657        Globals.timestamp_logs = true;
     658        lpcfg_string_set(Globals.ctx, &Globals.log_level, "0");
     659        Globals.debug_prefix_timestamp = false;
     660        Globals.debug_hires_timestamp = true;
     661        Globals.debug_pid = false;
     662        Globals.debug_uid = false;
     663        Globals.debug_class = false;
     664        Globals.enable_core_files = true;
    5350665        Globals.max_ttl = 60 * 60 * 24 * 3;     /* 3 days default. */
    5351666        Globals.max_wins_ttl = 60 * 60 * 24 * 6;        /* 6 days default. */
    5352667        Globals.min_wins_ttl = 60 * 60 * 6;     /* 6 hours default. */
    5353668        Globals.machine_password_timeout = 60 * 60 * 24 * 7;    /* 7 days default. */
    5354         Globals.lm_announce = 2;        /* = Auto: send only if LM clients found */
     669        Globals.lm_announce = Auto;     /* = Auto: send only if LM clients found */
    5355670        Globals.lm_interval = 60;
    5356         Globals.announce_as = ANNOUNCE_AS_NT_SERVER;
    5357671#if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
    5358         Globals.bNISHomeMap = False;
     672        Globals.nis_homedir = false;
    5359673#ifdef WITH_NISPLUS_HOME
    5360         string_set(&Globals.szNISHomeMapName, "auto_home.org_dir");
     674        lpcfg_string_set(Globals.ctx, &Globals.homedir_map,
     675                         "auto_home.org_dir");
    5361676#else
    5362         string_set(&Globals.szNISHomeMapName, "auto.home");
     677        lpcfg_string_set(Globals.ctx, &Globals.homedir_map, "auto.home");
    5363678#endif
    5364679#endif
    5365         Globals.bTimeServer = False;
    5366         Globals.bBindInterfacesOnly = False;
    5367         Globals.bUnixPasswdSync = False;
    5368         Globals.bPamPasswordChange = False;
    5369         Globals.bPasswdChatDebug = False;
    5370         Globals.iPasswdChatTimeout = 2; /* 2 second default. */
    5371         Globals.bNTPipeSupport = True;  /* Do NT pipes by default. */
    5372         Globals.bNTStatusSupport = True; /* Use NT status by default. */
    5373         Globals.bStatCache = True;      /* use stat cache by default */
    5374         Globals.iMaxStatCacheSize = 256; /* 256k by default */
     680        Globals.time_server = false;
     681        Globals.bind_interfaces_only = false;
     682        Globals.unix_password_sync = false;
     683        Globals.pam_password_change = false;
     684        Globals.passwd_chat_debug = false;
     685        Globals.passwd_chat_timeout = 2; /* 2 second default. */
     686        Globals.nt_pipe_support = true; /* Do NT pipes by default. */
     687        Globals.nt_status_support = true; /* Use NT status by default. */
     688        Globals.smbd_profiling_level = 0;
     689        Globals.stat_cache = true;      /* use stat cache by default */
     690        Globals.max_stat_cache_size = 256; /* 256k by default */
    5375691        Globals.restrict_anonymous = 0;
    5376         Globals.bClientLanManAuth = False;      /* Do NOT use the LanMan hash if it is available */
    5377         Globals.bClientPlaintextAuth = False;   /* Do NOT use a plaintext password even if is requested by the server */
    5378         Globals.bLanmanAuth = False;    /* Do NOT use the LanMan hash, even if it is supplied */
    5379         Globals.bNTLMAuth = True;       /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
    5380         Globals.bRawNTLMv2Auth = false; /* Allow NTLMv2 without NTLMSSP */
    5381         Globals.bClientNTLMv2Auth = True; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
     692        Globals.client_lanman_auth = false;     /* Do NOT use the LanMan hash if it is available */
     693        Globals.client_plaintext_auth = false;  /* Do NOT use a plaintext password even if is requested by the server */
     694        Globals.lanman_auth = false;    /* Do NOT use the LanMan hash, even if it is supplied */
     695        Globals.ntlm_auth = true;       /* Do use NTLMv1 if it is supplied by the client (otherwise NTLMv2) */
     696        Globals.raw_ntlmv2_auth = false; /* Reject NTLMv2 without NTLMSSP */
     697        Globals.client_ntlmv2_auth = true; /* Client should always use use NTLMv2, as we can't tell that the server supports it, but most modern servers do */
    5382698        /* Note, that we will also use NTLM2 session security (which is different), if it is available */
    5383699
    5384         Globals.bAllowDcerpcAuthLevelConnect = false; /* we don't allow this by default */
     700        Globals.allow_dcerpc_auth_level_connect = false; /* we don't allow this by default */
    5385701
    5386702        Globals.map_to_guest = 0;       /* By Default, "Never" */
    5387703        Globals.oplock_break_wait_time = 0;     /* By Default, 0 msecs. */
    5388704        Globals.enhanced_browsing = true;
    5389         Globals.iLockSpinTime = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
     705        Globals.lock_spin_time = WINDOWS_MINIMUM_LOCK_TIMEOUT_MS; /* msec. */
    5390706#ifdef MMAP_BLACKLIST
    5391         Globals.bUseMmap = False;
     707        Globals.use_mmap = false;
    5392708#else
    5393         Globals.bUseMmap = True;
     709        Globals.use_mmap = true;
    5394710#endif
    5395         Globals.bUnixExtensions = True;
    5396         Globals.bResetOnZeroVC = False;
    5397         Globals.bLogWriteableFilesOnExit = False;
    5398         Globals.bCreateKrb5Conf = true;
    5399         Globals.winbindMaxDomainConnections = 1;
     711        Globals.unicode = true;
     712        Globals.unix_extensions = true;
     713        Globals.reset_on_zero_vc = false;
     714        Globals.log_writeable_files_on_exit = false;
     715        Globals.create_krb5_conf = true;
     716        Globals._winbind_max_domain_connections = 1;
    5400717
    5401718        /* hostname lookups can be very expensive and are broken on
    5402719           a large number of sites (tridge) */
    5403         Globals.bHostnameLookups = False;
    5404 
    5405         string_set(&Globals.szPassdbBackend, "tdbsam");
    5406         string_set(&Globals.szLdapSuffix, "");
    5407         string_set(&Globals.szLdapMachineSuffix, "");
    5408         string_set(&Globals.szLdapUserSuffix, "");
    5409         string_set(&Globals.szLdapGroupSuffix, "");
    5410         string_set(&Globals.szLdapIdmapSuffix, "");
    5411 
    5412         string_set(&Globals.szLdapAdminDn, "");
     720        Globals.hostname_lookups = false;
     721
     722        Globals.change_notify = true,
     723        Globals.kernel_change_notify = true,
     724
     725        lpcfg_string_set(Globals.ctx, &Globals.passdb_backend, "tdbsam");
     726        lpcfg_string_set(Globals.ctx, &Globals.ldap_suffix, "");
     727        lpcfg_string_set(Globals.ctx, &Globals._ldap_machine_suffix, "");
     728        lpcfg_string_set(Globals.ctx, &Globals._ldap_user_suffix, "");
     729        lpcfg_string_set(Globals.ctx, &Globals._ldap_group_suffix, "");
     730        lpcfg_string_set(Globals.ctx, &Globals._ldap_idmap_suffix, "");
     731
     732        lpcfg_string_set(Globals.ctx, &Globals.ldap_admin_dn, "");
    5413733        Globals.ldap_ssl = LDAP_SSL_START_TLS;
    5414         Globals.ldap_ssl_ads = False;
     734        Globals.ldap_ssl_ads = false;
    5415735        Globals.ldap_deref = -1;
    5416736        Globals.ldap_passwd_sync = LDAP_PASSWD_SYNC_OFF;
    5417         Globals.ldap_delete_dn = False;
     737        Globals.ldap_delete_dn = false;
    5418738        Globals.ldap_replication_sleep = 1000; /* wait 1 sec for replication */
    5419739        Globals.ldap_follow_referral = Auto;
     
    5427747        Globals.client_ldap_sasl_wrapping = ADS_AUTH_SASL_SIGN;
    5428748
     749        Globals.ldap_server_require_strong_auth =
     750                LDAP_SERVER_REQUIRE_STRONG_AUTH_YES;
     751
    5429752        /* This is what we tell the afs client. in reality we set the token
    5430753         * to never expire, though, when this runs out the afs client will
    5431754         * forget the token. Set to 0 to get NEVERDATE.*/
    5432         Globals.iAfsTokenLifetime = 604800;
     755        Globals.afs_token_lifetime = 604800;
    5433756        Globals.cups_connection_timeout = CUPS_DEFAULT_CONNECTION_TIMEOUT;
    5434757
     
    5437760
    5438761   as a member of the workgroup, that will possibly become a
    5439    _local_ master browser (lm = True).  this is opposed to a forced
    5440    local master browser startup (pm = True).
    5441 
    5442    doesn't provide WINS server service by default (wsupp = False),
     762   _local_ master browser (lm = true).  this is opposed to a forced
     763   local master browser startup (pm = true).
     764
     765   doesn't provide WINS server service by default (wsupp = false),
    5443766   and doesn't provide domain master browser services by default, either.
    5444767
    5445768*/
    5446769
    5447         Globals.bMsAddPrinterWizard = True;
     770        Globals.show_add_printer_wizard = true;
    5448771        Globals.os_level = 20;
    5449         Globals.bLocalMaster = True;
    5450         Globals.iDomainMaster = Auto;   /* depending on bDomainLogons */
    5451         Globals.bDomainLogons = False;
    5452         Globals.bBrowseList = True;
    5453         Globals.bWINSsupport = False;
    5454         Globals.bWINSproxy = False;
    5455 
    5456         TALLOC_FREE(Globals.szInitLogonDelayedHosts);
    5457         Globals.InitLogonDelay = 100; /* 100 ms default delay */
    5458 
    5459         Globals.bDNSproxy = True;
    5460 
    5461         /* this just means to use them if they exist */
    5462         Globals.bKernelOplocks = True;
    5463 
    5464         Globals.bAllowTrustedDomains = True;
    5465         string_set(&Globals.szIdmapBackend, "tdb");
    5466         Globals.bIdmapReadOnly = false;
    5467 
    5468         string_set(&Globals.szTemplateShell, "/bin/false");
    5469         string_set(&Globals.szTemplateHomedir, "/home/%D/%U");
    5470         string_set(&Globals.szWinbindSeparator, "\\");
    5471 
    5472         string_set(&Globals.szCupsServer, "");
    5473         string_set(&Globals.szIPrintServer, "");
    5474 
    5475         string_set(&Globals.ctdbdSocket, "");
    5476         Globals.szClusterAddresses = NULL;
    5477         Globals.clustering = False;
     772        Globals.local_master = true;
     773        Globals._domain_master = Auto;  /* depending on _domain_logons */
     774        Globals._domain_logons = false;
     775        Globals.browse_list = true;
     776        Globals.we_are_a_wins_server = false;
     777        Globals.wins_proxy = false;
     778
     779        TALLOC_FREE(Globals.init_logon_delayed_hosts);
     780        Globals.init_logon_delay = 100; /* 100 ms default delay */
     781
     782        Globals.wins_dns_proxy = true;
     783
     784        Globals.allow_trusted_domains = true;
     785        lpcfg_string_set(Globals.ctx, &Globals.idmap_backend, "tdb");
     786
     787        lpcfg_string_set(Globals.ctx, &Globals.template_shell, "/bin/false");
     788        lpcfg_string_set(Globals.ctx, &Globals.template_homedir,
     789                         "/home/%D/%U");
     790        lpcfg_string_set(Globals.ctx, &Globals.winbind_separator, "\\");
     791        lpcfg_string_set(Globals.ctx, &Globals.winbindd_socket_directory,
     792                         dyn_WINBINDD_SOCKET_DIR);
     793
     794        lpcfg_string_set(Globals.ctx, &Globals.cups_server, "");
     795        lpcfg_string_set(Globals.ctx, &Globals.iprint_server, "");
     796
     797        lpcfg_string_set(Globals.ctx, &Globals._ctdbd_socket, "");
     798
     799        Globals.cluster_addresses = NULL;
     800        Globals.clustering = false;
    5478801        Globals.ctdb_timeout = 0;
    5479802        Globals.ctdb_locktime_warn_threshold = 0;
     
    5481804        Globals.winbind_cache_time = 300;       /* 5 minutes */
    5482805        Globals.winbind_reconnect_delay = 30;   /* 30 seconds */
     806        Globals.winbind_request_timeout = 60;   /* 60 seconds */
    5483807        Globals.winbind_max_clients = 200;
    5484         Globals.bWinbindEnumUsers = False;
    5485         Globals.bWinbindEnumGroups = False;
    5486         Globals.bWinbindUseDefaultDomain = False;
    5487         Globals.bWinbindTrustedDomainsOnly = False;
    5488         Globals.bWinbindNestedGroups = True;
    5489         Globals.winbind_expand_groups = 1;
    5490         Globals.szWinbindNssInfo = str_list_make_v3(NULL, "template", NULL);
    5491         Globals.bWinbindRefreshTickets = False;
    5492         Globals.bWinbindOfflineLogon = False;
    5493         Globals.bWinbindSealedPipes = True;
    5494 
    5495         Globals.iIdmapCacheTime = 86400 * 7; /* a week by default */
    5496         Globals.iIdmapNegativeCacheTime = 120; /* 2 minutes by default */
    5497 
    5498         Globals.bPassdbExpandExplicit = False;
     808        Globals.winbind_enum_users = false;
     809        Globals.winbind_enum_groups = false;
     810        Globals.winbind_use_default_domain = false;
     811        Globals.winbind_trusted_domains_only = false;
     812        Globals.winbind_nested_groups = true;
     813        Globals.winbind_expand_groups = 0;
     814        Globals.winbind_nss_info = str_list_make_v3_const(NULL, "template", NULL);
     815        Globals.winbind_refresh_tickets = false;
     816        Globals.winbind_offline_logon = false;
     817
     818        Globals.idmap_cache_time = 86400 * 7; /* a week by default */
     819        Globals.idmap_negative_cache_time = 120; /* 2 minutes by default */
     820
     821        Globals.passdb_expand_explicit = false;
    5499822
    5500823        Globals.name_cache_timeout = 660; /* In seconds */
    5501824
    5502         Globals.bUseSpnego = True;
    5503         Globals.bClientUseSpnego = True;
    5504 
    5505         Globals.client_signing = Auto;
    5506         Globals.client_ipc_signing = Required;
    5507         Globals.server_signing = False;
    5508 
    5509         Globals.bDeferSharingViolations = True;
    5510         string_set(&Globals.smb_ports, SMB_PORTS);
    5511 
    5512         Globals.bEnablePrivileges = True;
    5513         Globals.bHostMSDfs        = True;
    5514         Globals.bASUSupport       = False;
     825        Globals.use_spnego = true;
     826        Globals.client_use_spnego = true;
     827
     828        Globals.client_signing = SMB_SIGNING_DEFAULT;
     829        Globals._client_ipc_signing = SMB_SIGNING_DEFAULT;
     830        Globals.server_signing = SMB_SIGNING_DEFAULT;
     831
     832        Globals.defer_sharing_violations = true;
     833        Globals.smb_ports = str_list_make_v3_const(NULL, SMB_PORTS, NULL);
     834
     835        Globals.enable_privileges = true;
     836        Globals.host_msdfs        = true;
     837        Globals.enable_asu_support       = false;
    5515838
    5516839        /* User defined shares. */
    5517         if (asprintf(&s, "%s/usershares", get_dyn_STATEDIR()) < 0) {
     840        s = talloc_asprintf(talloc_tos(), "%s/usershares", get_dyn_STATEDIR());
     841        if (s == NULL) {
    5518842                smb_panic("init_globals: ENOMEM");
    5519843        }
    5520         string_set(&Globals.szUsersharePath, s);
    5521         SAFE_FREE(s);
    5522         string_set(&Globals.szUsershareTemplateShare, "");
    5523         Globals.iUsershareMaxShares = 0;
     844        lpcfg_string_set(Globals.ctx, &Globals.usershare_path, s);
     845        TALLOC_FREE(s);
     846        lpcfg_string_set(Globals.ctx, &Globals.usershare_template_share, "");
     847        Globals.usershare_max_shares = 0;
    5524848        /* By default disallow sharing of directories not owned by the sharer. */
    5525         Globals.bUsershareOwnerOnly = True;
     849        Globals.usershare_owner_only = true;
    5526850        /* By default disallow guest access to usershares. */
    5527         Globals.bUsershareAllowGuests = False;
    5528 
    5529         Globals.iKeepalive = DEFAULT_KEEPALIVE;
     851        Globals.usershare_allow_guests = false;
     852
     853        Globals.keepalive = DEFAULT_KEEPALIVE;
    5530854
    5531855        /* By default no shares out of the registry */
    5532         Globals.bRegistryShares = False;
    5533 
    5534         Globals.iminreceivefile = 0;
    5535 
    5536         Globals.bMapUntrustedToDomain = false;
    5537         Globals.bMulticastDnsRegister = true;
    5538 
    5539         Globals.ismb2_max_read = DEFAULT_SMB2_MAX_READ;
    5540         Globals.ismb2_max_write = DEFAULT_SMB2_MAX_WRITE;
    5541         Globals.ismb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
    5542         Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
    5543 
    5544         string_set(&Globals.ncalrpc_dir, get_dyn_NCALRPCDIR());
     856        Globals.registry_shares = false;
     857
     858        Globals.min_receivefile_size = 0;
     859
     860        Globals.map_untrusted_to_domain = false;
     861        Globals.multicast_dns_register = true;
     862
     863        Globals.smb2_max_read = DEFAULT_SMB2_MAX_READ;
     864        Globals.smb2_max_write = DEFAULT_SMB2_MAX_WRITE;
     865        Globals.smb2_max_trans = DEFAULT_SMB2_MAX_TRANSACT;
     866        Globals.smb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
     867        Globals.smb2_leases = false;
     868
     869        lpcfg_string_set(Globals.ctx, &Globals.ncalrpc_dir,
     870                         get_dyn_NCALRPCDIR());
     871
     872        Globals.server_services = str_list_make_v3_const(NULL, "s3fs rpc nbt wrepl ldap cldap kdc drepl winbindd ntp_signd kcc dnsupdate dns", NULL);
     873
     874        Globals.dcerpc_endpoint_servers = str_list_make_v3_const(NULL, "epmapper wkssvc rpcecho samr netlogon lsarpc spoolss drsuapi dssetup unixinfo browser eventlog6 backupkey dnsserver", NULL);
     875
     876        Globals.tls_enabled = true;
     877        Globals.tls_verify_peer = TLS_VERIFY_PEER_AS_STRICT_AS_POSSIBLE;
     878
     879        lpcfg_string_set(Globals.ctx, &Globals._tls_keyfile, "tls/key.pem");
     880        lpcfg_string_set(Globals.ctx, &Globals._tls_certfile, "tls/cert.pem");
     881        lpcfg_string_set(Globals.ctx, &Globals._tls_cafile, "tls/ca.pem");
     882        lpcfg_string_set(Globals.ctx, &Globals.tls_priority,
     883                         "NORMAL:-VERS-SSL3.0");
     884
     885        lpcfg_string_set(Globals.ctx, &Globals.share_backend, "classic");
     886
     887        Globals._preferred_master = Auto;
     888
     889        Globals.allow_dns_updates = DNS_UPDATE_SIGNED;
     890
     891        lpcfg_string_set(Globals.ctx, &Globals.ntp_signd_socket_directory,
     892                         get_dyn_NTP_SIGND_SOCKET_DIR());
     893
     894        lpcfg_string_set(Globals.ctx,
     895                         &Globals.winbindd_privileged_socket_directory,
     896                         get_dyn_WINBINDD_PRIVILEGED_SOCKET_DIR());
     897
     898        s = talloc_asprintf(talloc_tos(), "%s/samba_kcc", get_dyn_SCRIPTSBINDIR());
     899        if (s == NULL) {
     900                smb_panic("init_globals: ENOMEM");
     901        }
     902        Globals.samba_kcc_command = str_list_make_v3_const(NULL, s, NULL);
     903        TALLOC_FREE(s);
     904
     905        s = talloc_asprintf(talloc_tos(), "%s/samba_dnsupdate", get_dyn_SCRIPTSBINDIR());
     906        if (s == NULL) {
     907                smb_panic("init_globals: ENOMEM");
     908        }
     909        Globals.dns_update_command = str_list_make_v3_const(NULL, s, NULL);
     910        TALLOC_FREE(s);
     911
     912        s = talloc_asprintf(talloc_tos(), "%s/samba_spnupdate", get_dyn_SCRIPTSBINDIR());
     913        if (s == NULL) {
     914                smb_panic("init_globals: ENOMEM");
     915        }
     916        Globals.spn_update_command = str_list_make_v3_const(NULL, s, NULL);
     917        TALLOC_FREE(s);
     918
     919        Globals.nsupdate_command = str_list_make_v3_const(NULL, "/usr/bin/nsupdate -g", NULL);
     920
     921        Globals.rndc_command = str_list_make_v3_const(NULL, "/usr/sbin/rndc", NULL);
     922
     923        Globals.cldap_port = 389;
     924
     925        Globals.dgram_port = NBT_DGRAM_SERVICE_PORT;
     926
     927        Globals.nbt_port = NBT_NAME_SERVICE_PORT;
     928
     929        Globals.krb5_port = 88;
     930
     931        Globals.kpasswd_port = 464;
     932
     933        Globals.web_port = 901;
     934
     935        Globals.aio_max_threads = 100;
    5545936
    5546937        /* Now put back the settings that were set with lp_set_cmdline() */
     
    5548939}
    5549940
     941/* Convenience routine to setup an lp_context with additional s3 variables */
     942static struct loadparm_context *setup_lp_context(TALLOC_CTX *mem_ctx)
     943{
     944        struct loadparm_context *lp_ctx;
     945
     946        lp_ctx = loadparm_init_s3(mem_ctx,
     947                                  loadparm_s3_helpers());
     948        if (lp_ctx == NULL) {
     949                DEBUG(0, ("loadparm_init_s3 failed\n"));
     950                return NULL;
     951        }
     952
     953        lp_ctx->sDefault = &sDefault;
     954        lp_ctx->services = NULL; /* We do not want to access this directly */
     955        lp_ctx->bInGlobalSection = bInGlobalSection;
     956        lp_ctx->flags = flags_list;
     957
     958        return lp_ctx;
     959}
     960
    5550961/*******************************************************************
    5551  Convenience routine to grab string parameters into temporary memory
     962 Convenience routine to grab string parameters into talloced memory
    5552963 and run standard_sub_basic on them. The buffers can be written to by
    5553964 callers without affecting the source string.
    5554965********************************************************************/
    5555966
    5556 static char *lp_string(const char *s)
     967char *lp_string(TALLOC_CTX *ctx, const char *s)
    5557968{
    5558969        char *ret;
    5559         TALLOC_CTX *ctx = talloc_tos();
    5560970
    5561971        /* The follow debug is useful for tracking down memory problems
     
    55931003
    55941004#define FN_GLOBAL_STRING(fn_name,ptr) \
    5595  char *fn_name(void) {return(lp_string(*(char **)(ptr) ? *(char **)(ptr) : ""));}
     1005char *lp_ ## fn_name(TALLOC_CTX *ctx) {return(lp_string((ctx), *(char **)(&Globals.ptr) ? *(char **)(&Globals.ptr) : ""));}
    55961006#define FN_GLOBAL_CONST_STRING(fn_name,ptr) \
    5597  const char *fn_name(void) {return(*(const char **)(ptr) ? *(const char **)(ptr) : "");}
     1007 const char *lp_ ## fn_name(void) {return(*(const char * const *)(&Globals.ptr) ? *(const char * const *)(&Globals.ptr) : "");}
    55981008#define FN_GLOBAL_LIST(fn_name,ptr) \
    5599  const char **fn_name(void) {return(*(const char ***)(ptr));}
     1009 const char **lp_ ## fn_name(void) {return(*(const char ***)(&Globals.ptr));}
    56001010#define FN_GLOBAL_BOOL(fn_name,ptr) \
    5601  bool fn_name(void) {return(*(bool *)(ptr));}
     1011 bool lp_ ## fn_name(void) {return(*(bool *)(&Globals.ptr));}
    56021012#define FN_GLOBAL_CHAR(fn_name,ptr) \
    5603  char fn_name(void) {return(*(char *)(ptr));}
     1013 char lp_ ## fn_name(void) {return(*(char *)(&Globals.ptr));}
    56041014#define FN_GLOBAL_INTEGER(fn_name,ptr) \
    5605  int fn_name(void) {return(*(int *)(ptr));}
     1015 int lp_ ## fn_name(void) {return(*(int *)(&Globals.ptr));}
    56061016
    56071017#define FN_LOCAL_STRING(fn_name,val) \
    5608  char *fn_name(int i) {return(lp_string((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
     1018char *lp_ ## fn_name(TALLOC_CTX *ctx,int i) {return(lp_string((ctx), (LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val));}
    56091019#define FN_LOCAL_CONST_STRING(fn_name,val) \
    5610  const char *fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
     1020 const char *lp_ ## fn_name(int i) {return (const char *)((LP_SNUM_OK(i) && ServicePtrs[(i)]->val) ? ServicePtrs[(i)]->val : sDefault.val);}
    56111021#define FN_LOCAL_LIST(fn_name,val) \
    5612  const char **fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
     1022 const char **lp_ ## fn_name(int i) {return(const char **)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
    56131023#define FN_LOCAL_BOOL(fn_name,val) \
    5614  bool fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
     1024 bool lp_ ## fn_name(int i) {return(bool)(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
    56151025#define FN_LOCAL_INTEGER(fn_name,val) \
    5616  int fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
     1026 int lp_ ## fn_name(int i) {return(LP_SNUM_OK(i)? ServicePtrs[(i)]->val : sDefault.val);}
    56171027
    56181028#define FN_LOCAL_PARM_BOOL(fn_name,val) \
    5619  bool fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
     1029 bool lp_ ## fn_name(const struct share_params *p) {return(bool)(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
    56201030#define FN_LOCAL_PARM_INTEGER(fn_name,val) \
    5621  int fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
    5622 #define FN_LOCAL_CHAR(fn_name,val) \
    5623  char fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
    5624 
    5625 FN_GLOBAL_STRING(lp_smb_ports, &Globals.smb_ports)
    5626 FN_GLOBAL_CONST_STRING(lp_dos_charset, &Globals.dos_charset)
    5627 FN_GLOBAL_CONST_STRING(lp_unix_charset, &Globals.unix_charset)
    5628 FN_GLOBAL_CONST_STRING(lp_display_charset, &Globals.display_charset)
    5629 FN_GLOBAL_STRING(lp_logfile, &Globals.szLogFile)
    5630 FN_GLOBAL_STRING(lp_configfile, &Globals.szConfigFile)
    5631 FN_GLOBAL_STRING(lp_smb_passwd_file, &Globals.szSMBPasswdFile)
    5632 FN_GLOBAL_STRING(lp_private_dir, &Globals.szPrivateDir)
    5633 FN_GLOBAL_STRING(lp_serverstring, &Globals.szServerString)
    5634 FN_GLOBAL_INTEGER(lp_printcap_cache_time, &Globals.PrintcapCacheTime)
    5635 FN_GLOBAL_STRING(lp_addport_cmd, &Globals.szAddPortCommand)
    5636 FN_GLOBAL_STRING(lp_enumports_cmd, &Globals.szEnumPortsCommand)
    5637 FN_GLOBAL_STRING(lp_addprinter_cmd, &Globals.szAddPrinterCommand)
    5638 FN_GLOBAL_STRING(lp_deleteprinter_cmd, &Globals.szDeletePrinterCommand)
    5639 FN_GLOBAL_STRING(lp_os2_driver_map, &Globals.szOs2DriverMap)
    5640 FN_GLOBAL_STRING(lp_lockdir, &Globals.szLockDir)
    5641 /* If lp_statedir() and lp_cachedir() are explicitely set during the
    5642  * build process or in smb.conf, we use that value.  Otherwise they
    5643  * default to the value of lp_lockdir(). */
    5644 char *lp_statedir(void) {
    5645         if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
    5646             (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
    5647                 return(lp_string(*(char **)(&Globals.szStateDir) ?
    5648                     *(char **)(&Globals.szStateDir) : ""));
    5649         else
    5650                 return(lp_string(*(char **)(&Globals.szLockDir) ?
    5651                     *(char **)(&Globals.szLockDir) : ""));
    5652 }
    5653 char *lp_cachedir(void) {
    5654         if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
    5655             (strcmp(get_dyn_CACHEDIR(), Globals.szCacheDir) != 0))
    5656                 return(lp_string(*(char **)(&Globals.szCacheDir) ?
    5657                     *(char **)(&Globals.szCacheDir) : ""));
    5658         else
    5659                 return(lp_string(*(char **)(&Globals.szLockDir) ?
    5660                     *(char **)(&Globals.szLockDir) : ""));
    5661 }
    5662 FN_GLOBAL_STRING(lp_piddir, &Globals.szPidDir)
    5663 FN_GLOBAL_STRING(lp_mangling_method, &Globals.szManglingMethod)
    5664 FN_GLOBAL_INTEGER(lp_mangle_prefix, &Globals.mangle_prefix)
    5665 FN_GLOBAL_STRING(lp_utmpdir, &Globals.szUtmpDir)
    5666 FN_GLOBAL_STRING(lp_wtmpdir, &Globals.szWtmpDir)
    5667 FN_GLOBAL_BOOL(lp_utmp, &Globals.bUtmp)
    5668 FN_GLOBAL_STRING(lp_rootdir, &Globals.szRootdir)
    5669 FN_GLOBAL_STRING(lp_perfcount_module, &Globals.szSMBPerfcountModule)
    5670 FN_GLOBAL_STRING(lp_defaultservice, &Globals.szDefaultService)
    5671 FN_GLOBAL_STRING(lp_msg_command, &Globals.szMsgCommand)
    5672 FN_GLOBAL_STRING(lp_get_quota_command, &Globals.szGetQuota)
    5673 FN_GLOBAL_STRING(lp_set_quota_command, &Globals.szSetQuota)
    5674 FN_GLOBAL_STRING(lp_auto_services, &Globals.szAutoServices)
    5675 FN_GLOBAL_STRING(lp_passwd_program, &Globals.szPasswdProgram)
    5676 FN_GLOBAL_STRING(lp_passwd_chat, &Globals.szPasswdChat)
    5677 FN_GLOBAL_STRING(lp_passwordserver, &Globals.szPasswordServer)
    5678 FN_GLOBAL_STRING(lp_name_resolve_order, &Globals.szNameResolveOrder)
    5679 FN_GLOBAL_STRING(lp_realm, &Globals.szRealm)
    5680 FN_GLOBAL_CONST_STRING(lp_afs_username_map, &Globals.szAfsUsernameMap)
    5681 FN_GLOBAL_INTEGER(lp_afs_token_lifetime, &Globals.iAfsTokenLifetime)
    5682 FN_GLOBAL_STRING(lp_log_nt_token_command, &Globals.szLogNtTokenCommand)
    5683 FN_GLOBAL_STRING(lp_username_map, &Globals.szUsernameMap)
    5684 FN_GLOBAL_CONST_STRING(lp_logon_script, &Globals.szLogonScript)
    5685 FN_GLOBAL_CONST_STRING(lp_logon_path, &Globals.szLogonPath)
    5686 FN_GLOBAL_CONST_STRING(lp_logon_drive, &Globals.szLogonDrive)
    5687 FN_GLOBAL_CONST_STRING(lp_logon_home, &Globals.szLogonHome)
    5688 FN_GLOBAL_STRING(lp_remote_announce, &Globals.szRemoteAnnounce)
    5689 FN_GLOBAL_STRING(lp_remote_browse_sync, &Globals.szRemoteBrowseSync)
    5690 FN_GLOBAL_BOOL(lp_nmbd_bind_explicit_broadcast, &Globals.bNmbdBindExplicitBroadcast)
    5691 FN_GLOBAL_LIST(lp_wins_server_list, &Globals.szWINSservers)
    5692 FN_GLOBAL_LIST(lp_interfaces, &Globals.szInterfaces)
    5693 FN_GLOBAL_STRING(lp_nis_home_map_name, &Globals.szNISHomeMapName)
    5694 static FN_GLOBAL_STRING(lp_announce_version, &Globals.szAnnounceVersion)
    5695 FN_GLOBAL_LIST(lp_netbios_aliases, &Globals.szNetbiosAliases)
    5696 /* FN_GLOBAL_STRING(lp_passdb_backend, &Globals.szPassdbBackend)
    5697  * lp_passdb_backend() should be replace by the this macro again after
    5698  * some releases.
    5699  * */
    5700 const char *lp_passdb_backend(void)
    5701 {
    5702         char *delim, *quote;
    5703 
    5704         delim = strchr( Globals.szPassdbBackend, ' ');
    5705         /* no space at all */
    5706         if (delim == NULL) {
    5707                 goto out;
    5708         }
    5709 
    5710         quote = strchr(Globals.szPassdbBackend, '"');
    5711         /* no quote char or non in the first part */
    5712         if (quote == NULL || quote > delim) {
    5713                 *delim = '\0';
    5714                 goto warn;
    5715         }
    5716 
    5717         quote = strchr(quote+1, '"');
    5718         if (quote == NULL) {
    5719                 DEBUG(0, ("WARNING: Your 'passdb backend' configuration is invalid due to a missing second \" char.\n"));
    5720                 goto out;
    5721         } else if (*(quote+1) == '\0') {
    5722                 /* space, fitting quote char, and one backend only */
    5723                 goto out;
    5724         } else {
    5725                 /* terminate string after the fitting quote char */
    5726                 *(quote+1) = '\0';
    5727         }
    5728 
    5729 warn:
    5730         DEBUG(0, ("WARNING: Your 'passdb backend' configuration includes multiple backends.  This\n"
    5731                 "is deprecated since Samba 3.0.23.  Please check WHATSNEW.txt or the section 'Passdb\n"
    5732                 "Changes' from the ChangeNotes as part of the Samba HOWTO collection.  Only the first\n"
    5733                 "backend (%s) is used.  The rest is ignored.\n", Globals.szPassdbBackend));
    5734 
    5735 out:
    5736         return Globals.szPassdbBackend;
    5737 }
    5738 FN_GLOBAL_LIST(lp_preload_modules, &Globals.szPreloadModules)
    5739 FN_GLOBAL_STRING(lp_panic_action, &Globals.szPanicAction)
    5740 FN_GLOBAL_STRING(lp_adduser_script, &Globals.szAddUserScript)
    5741 FN_GLOBAL_STRING(lp_renameuser_script, &Globals.szRenameUserScript)
    5742 FN_GLOBAL_STRING(lp_deluser_script, &Globals.szDelUserScript)
    5743 
    5744 FN_GLOBAL_CONST_STRING(lp_guestaccount, &Globals.szGuestaccount)
    5745 FN_GLOBAL_STRING(lp_addgroup_script, &Globals.szAddGroupScript)
    5746 FN_GLOBAL_STRING(lp_delgroup_script, &Globals.szDelGroupScript)
    5747 FN_GLOBAL_STRING(lp_addusertogroup_script, &Globals.szAddUserToGroupScript)
    5748 FN_GLOBAL_STRING(lp_deluserfromgroup_script, &Globals.szDelUserFromGroupScript)
    5749 FN_GLOBAL_STRING(lp_setprimarygroup_script, &Globals.szSetPrimaryGroupScript)
    5750 
    5751 FN_GLOBAL_STRING(lp_addmachine_script, &Globals.szAddMachineScript)
    5752 
    5753 FN_GLOBAL_STRING(lp_shutdown_script, &Globals.szShutdownScript)
    5754 FN_GLOBAL_STRING(lp_abort_shutdown_script, &Globals.szAbortShutdownScript)
    5755 FN_GLOBAL_STRING(lp_username_map_script, &Globals.szUsernameMapScript)
    5756 FN_GLOBAL_INTEGER(lp_username_map_cache_time, &Globals.iUsernameMapCacheTime)
    5757 
    5758 FN_GLOBAL_STRING(lp_check_password_script, &Globals.szCheckPasswordScript)
    5759 
    5760 FN_GLOBAL_BOOL(lp_allow_dcerpc_auth_level_connect, &Globals.bAllowDcerpcAuthLevelConnect)
    5761 FN_GLOBAL_STRING(lp_wins_hook, &Globals.szWINSHook)
    5762 FN_GLOBAL_CONST_STRING(lp_template_homedir, &Globals.szTemplateHomedir)
    5763 FN_GLOBAL_CONST_STRING(lp_template_shell, &Globals.szTemplateShell)
    5764 FN_GLOBAL_CONST_STRING(lp_winbind_separator, &Globals.szWinbindSeparator)
    5765 FN_GLOBAL_INTEGER(lp_acl_compatibility, &Globals.iAclCompat)
    5766 FN_GLOBAL_BOOL(lp_winbind_enum_users, &Globals.bWinbindEnumUsers)
    5767 FN_GLOBAL_BOOL(lp_winbind_enum_groups, &Globals.bWinbindEnumGroups)
    5768 FN_GLOBAL_BOOL(lp_winbind_use_default_domain, &Globals.bWinbindUseDefaultDomain)
    5769 FN_GLOBAL_BOOL(lp_winbind_trusted_domains_only, &Globals.bWinbindTrustedDomainsOnly)
    5770 FN_GLOBAL_BOOL(lp_winbind_nested_groups, &Globals.bWinbindNestedGroups)
    5771 FN_GLOBAL_INTEGER(lp_winbind_expand_groups, &Globals.winbind_expand_groups)
    5772 FN_GLOBAL_BOOL(lp_winbind_refresh_tickets, &Globals.bWinbindRefreshTickets)
    5773 FN_GLOBAL_BOOL(lp_winbind_offline_logon, &Globals.bWinbindOfflineLogon)
    5774 FN_GLOBAL_BOOL(lp_winbind_sealed_pipes, &Globals.bWinbindSealedPipes)
    5775 FN_GLOBAL_BOOL(lp_winbind_normalize_names, &Globals.bWinbindNormalizeNames)
    5776 FN_GLOBAL_BOOL(lp_winbind_rpc_only, &Globals.bWinbindRpcOnly)
    5777 FN_GLOBAL_BOOL(lp_create_krb5_conf, &Globals.bCreateKrb5Conf)
    5778 static FN_GLOBAL_INTEGER(lp_winbind_max_domain_connections_int,
    5779                   &Globals.winbindMaxDomainConnections)
     1031 int lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
     1032#define FN_LOCAL_PARM_CHAR(fn_name,val) \
     1033 char lp_ ## fn_name(const struct share_params *p) {return(LP_SNUM_OK(p->service)? ServicePtrs[(p->service)]->val : sDefault.val);}
    57801034
    57811035int lp_winbind_max_domain_connections(void)
    57821036{
    57831037        if (lp_winbind_offline_logon() &&
    5784             lp_winbind_max_domain_connections_int() > 1) {
     1038            lp__winbind_max_domain_connections() > 1) {
    57851039                DEBUG(1, ("offline logons active, restricting max domain "
    57861040                          "connections to 1\n"));
    57871041                return 1;
    57881042        }
    5789         return MAX(1, lp_winbind_max_domain_connections_int());
    5790 }
    5791 
    5792 FN_GLOBAL_CONST_STRING(lp_idmap_backend, &Globals.szIdmapBackend)
    5793 FN_GLOBAL_INTEGER(lp_idmap_cache_time, &Globals.iIdmapCacheTime)
    5794 FN_GLOBAL_INTEGER(lp_idmap_negative_cache_time, &Globals.iIdmapNegativeCacheTime)
    5795 FN_GLOBAL_INTEGER(lp_keepalive, &Globals.iKeepalive)
    5796 FN_GLOBAL_BOOL(lp_passdb_expand_explicit, &Globals.bPassdbExpandExplicit)
    5797 
    5798 FN_GLOBAL_STRING(lp_ldap_suffix, &Globals.szLdapSuffix)
    5799 FN_GLOBAL_STRING(lp_ldap_admin_dn, &Globals.szLdapAdminDn)
    5800 FN_GLOBAL_INTEGER(lp_ldap_ssl, &Globals.ldap_ssl)
    5801 FN_GLOBAL_BOOL(lp_ldap_ssl_ads, &Globals.ldap_ssl_ads)
    5802 FN_GLOBAL_INTEGER(lp_ldap_deref, &Globals.ldap_deref)
    5803 FN_GLOBAL_INTEGER(lp_ldap_follow_referral, &Globals.ldap_follow_referral)
    5804 FN_GLOBAL_INTEGER(lp_ldap_passwd_sync, &Globals.ldap_passwd_sync)
    5805 FN_GLOBAL_BOOL(lp_ldap_delete_dn, &Globals.ldap_delete_dn)
    5806 FN_GLOBAL_INTEGER(lp_ldap_replication_sleep, &Globals.ldap_replication_sleep)
    5807 FN_GLOBAL_INTEGER(lp_ldap_timeout, &Globals.ldap_timeout)
    5808 FN_GLOBAL_INTEGER(lp_ldap_connection_timeout, &Globals.ldap_connection_timeout)
    5809 FN_GLOBAL_INTEGER(lp_ldap_page_size, &Globals.ldap_page_size)
    5810 FN_GLOBAL_INTEGER(lp_ldap_debug_level, &Globals.ldap_debug_level)
    5811 FN_GLOBAL_INTEGER(lp_ldap_debug_threshold, &Globals.ldap_debug_threshold)
    5812 FN_GLOBAL_STRING(lp_add_share_cmd, &Globals.szAddShareCommand)
    5813 FN_GLOBAL_STRING(lp_change_share_cmd, &Globals.szChangeShareCommand)
    5814 FN_GLOBAL_STRING(lp_delete_share_cmd, &Globals.szDeleteShareCommand)
    5815 FN_GLOBAL_STRING(lp_usershare_path, &Globals.szUsersharePath)
    5816 FN_GLOBAL_LIST(lp_usershare_prefix_allow_list, &Globals.szUsersharePrefixAllowList)
    5817 FN_GLOBAL_LIST(lp_usershare_prefix_deny_list, &Globals.szUsersharePrefixDenyList)
    5818 
    5819 FN_GLOBAL_LIST(lp_eventlog_list, &Globals.szEventLogs)
    5820 
    5821 FN_GLOBAL_BOOL(lp_registry_shares, &Globals.bRegistryShares)
    5822 FN_GLOBAL_BOOL(lp_usershare_allow_guests, &Globals.bUsershareAllowGuests)
    5823 FN_GLOBAL_BOOL(lp_usershare_owner_only, &Globals.bUsershareOwnerOnly)
    5824 FN_GLOBAL_BOOL(lp_disable_netbios, &Globals.bDisableNetbios)
    5825 FN_GLOBAL_BOOL(lp_reset_on_zero_vc, &Globals.bResetOnZeroVC)
    5826 FN_GLOBAL_BOOL(lp_log_writeable_files_on_exit,
    5827                &Globals.bLogWriteableFilesOnExit)
    5828 FN_GLOBAL_BOOL(lp_ms_add_printer_wizard, &Globals.bMsAddPrinterWizard)
    5829 FN_GLOBAL_BOOL(lp_dns_proxy, &Globals.bDNSproxy)
    5830 FN_GLOBAL_BOOL(lp_wins_support, &Globals.bWINSsupport)
    5831 FN_GLOBAL_BOOL(lp_we_are_a_wins_server, &Globals.bWINSsupport)
    5832 FN_GLOBAL_BOOL(lp_wins_proxy, &Globals.bWINSproxy)
    5833 FN_GLOBAL_BOOL(lp_local_master, &Globals.bLocalMaster)
    5834 FN_GLOBAL_BOOL(lp_domain_logons, &Globals.bDomainLogons)
    5835 FN_GLOBAL_LIST(lp_init_logon_delayed_hosts, &Globals.szInitLogonDelayedHosts)
    5836 FN_GLOBAL_INTEGER(lp_init_logon_delay, &Globals.InitLogonDelay)
    5837 FN_GLOBAL_BOOL(lp_load_printers, &Globals.bLoadPrinters)
    5838 FN_GLOBAL_BOOL(_lp_readraw, &Globals.bReadRaw)
    5839 FN_GLOBAL_BOOL(lp_large_readwrite, &Globals.bLargeReadwrite)
    5840 FN_GLOBAL_BOOL(_lp_writeraw, &Globals.bWriteRaw)
    5841 FN_GLOBAL_BOOL(lp_null_passwords, &Globals.bNullPasswords)
    5842 FN_GLOBAL_BOOL(lp_obey_pam_restrictions, &Globals.bObeyPamRestrictions)
    5843 FN_GLOBAL_BOOL(lp_encrypted_passwords, &Globals.bEncryptPasswords)
    5844 FN_GLOBAL_INTEGER(lp_client_schannel, &Globals.clientSchannel)
    5845 FN_GLOBAL_INTEGER(lp_server_schannel, &Globals.serverSchannel)
    5846 FN_GLOBAL_BOOL(lp_syslog_only, &Globals.bSyslogOnly)
    5847 FN_GLOBAL_BOOL(lp_timestamp_logs, &Globals.bTimestampLogs)
    5848 FN_GLOBAL_BOOL(lp_debug_prefix_timestamp, &Globals.bDebugPrefixTimestamp)
    5849 FN_GLOBAL_BOOL(lp_debug_hires_timestamp, &Globals.bDebugHiresTimestamp)
    5850 FN_GLOBAL_BOOL(lp_debug_pid, &Globals.bDebugPid)
    5851 FN_GLOBAL_BOOL(lp_debug_uid, &Globals.bDebugUid)
    5852 FN_GLOBAL_BOOL(lp_debug_class, &Globals.bDebugClass)
    5853 FN_GLOBAL_BOOL(lp_enable_core_files, &Globals.bEnableCoreFiles)
    5854 FN_GLOBAL_BOOL(lp_browse_list, &Globals.bBrowseList)
    5855 FN_GLOBAL_BOOL(lp_nis_home_map, &Globals.bNISHomeMap)
    5856 static FN_GLOBAL_BOOL(lp_time_server, &Globals.bTimeServer)
    5857 FN_GLOBAL_BOOL(lp_bind_interfaces_only, &Globals.bBindInterfacesOnly)
    5858 FN_GLOBAL_BOOL(lp_pam_password_change, &Globals.bPamPasswordChange)
    5859 FN_GLOBAL_BOOL(lp_unix_password_sync, &Globals.bUnixPasswdSync)
    5860 FN_GLOBAL_BOOL(lp_passwd_chat_debug, &Globals.bPasswdChatDebug)
    5861 FN_GLOBAL_INTEGER(lp_passwd_chat_timeout, &Globals.iPasswdChatTimeout)
    5862 FN_GLOBAL_BOOL(lp_nt_pipe_support, &Globals.bNTPipeSupport)
    5863 FN_GLOBAL_BOOL(lp_nt_status_support, &Globals.bNTStatusSupport)
    5864 FN_GLOBAL_BOOL(lp_stat_cache, &Globals.bStatCache)
    5865 FN_GLOBAL_INTEGER(lp_max_stat_cache_size, &Globals.iMaxStatCacheSize)
    5866 FN_GLOBAL_BOOL(lp_allow_trusted_domains, &Globals.bAllowTrustedDomains)
    5867 FN_GLOBAL_BOOL(lp_map_untrusted_to_domain, &Globals.bMapUntrustedToDomain)
    5868 FN_GLOBAL_INTEGER(lp_restrict_anonymous, &Globals.restrict_anonymous)
    5869 FN_GLOBAL_BOOL(lp_lanman_auth, &Globals.bLanmanAuth)
    5870 FN_GLOBAL_BOOL(lp_ntlm_auth, &Globals.bNTLMAuth)
    5871 FN_GLOBAL_BOOL(lp_raw_ntlmv2_auth, &Globals.bRawNTLMv2Auth)
    5872 FN_GLOBAL_BOOL(lp_client_plaintext_auth, &Globals.bClientPlaintextAuth)
    5873 FN_GLOBAL_BOOL(lp_client_lanman_auth, &Globals.bClientLanManAuth)
    5874 FN_GLOBAL_BOOL(lp_client_ntlmv2_auth, &Globals.bClientNTLMv2Auth)
    5875 FN_GLOBAL_BOOL(lp_host_msdfs, &Globals.bHostMSDfs)
    5876 FN_GLOBAL_BOOL(lp_kernel_oplocks, &Globals.bKernelOplocks)
    5877 FN_GLOBAL_BOOL(lp_enhanced_browsing, &Globals.enhanced_browsing)
    5878 FN_GLOBAL_BOOL(lp_use_mmap, &Globals.bUseMmap)
    5879 FN_GLOBAL_BOOL(lp_unix_extensions, &Globals.bUnixExtensions)
    5880 FN_GLOBAL_BOOL(lp_use_spnego, &Globals.bUseSpnego)
    5881 FN_GLOBAL_BOOL(lp_client_use_spnego, &Globals.bClientUseSpnego)
    5882 FN_GLOBAL_BOOL(lp_client_use_spnego_principal, &Globals.client_use_spnego_principal)
    5883 FN_GLOBAL_BOOL(lp_send_spnego_principal, &Globals.send_spnego_principal)
    5884 FN_GLOBAL_BOOL(lp_hostname_lookups, &Globals.bHostnameLookups)
    5885 FN_LOCAL_PARM_BOOL(lp_change_notify, bChangeNotify)
    5886 FN_LOCAL_PARM_BOOL(lp_kernel_change_notify, bKernelChangeNotify)
    5887 FN_GLOBAL_STRING(lp_dedicated_keytab_file, &Globals.szDedicatedKeytabFile)
    5888 FN_GLOBAL_INTEGER(lp_kerberos_method, &Globals.iKerberosMethod)
    5889 FN_GLOBAL_BOOL(lp_defer_sharing_violations, &Globals.bDeferSharingViolations)
    5890 FN_GLOBAL_BOOL(lp_enable_privileges, &Globals.bEnablePrivileges)
    5891 FN_GLOBAL_BOOL(lp_enable_asu_support, &Globals.bASUSupport)
    5892 FN_GLOBAL_INTEGER(lp_os_level, &Globals.os_level)
    5893 FN_GLOBAL_INTEGER(lp_max_ttl, &Globals.max_ttl)
    5894 FN_GLOBAL_INTEGER(lp_max_wins_ttl, &Globals.max_wins_ttl)
    5895 FN_GLOBAL_INTEGER(lp_min_wins_ttl, &Globals.min_wins_ttl)
    5896 FN_GLOBAL_INTEGER(lp_max_log_size, &Globals.max_log_size)
    5897 FN_GLOBAL_INTEGER(lp_max_open_files, &Globals.max_open_files)
    5898 FN_GLOBAL_INTEGER(lp_open_files_db_hash_size, &Globals.open_files_db_hash_size)
    5899 FN_GLOBAL_INTEGER(lp_maxxmit, &Globals.max_xmit)
    5900 FN_GLOBAL_INTEGER(lp_maxmux, &Globals.max_mux)
    5901 FN_GLOBAL_INTEGER(lp_passwordlevel, &Globals.pwordlevel)
    5902 FN_GLOBAL_INTEGER(lp_usernamelevel, &Globals.unamelevel)
    5903 FN_GLOBAL_INTEGER(lp_deadtime, &Globals.deadtime)
    5904 FN_GLOBAL_BOOL(lp_getwd_cache, &Globals.getwd_cache)
    5905 static FN_GLOBAL_INTEGER(_lp_maxprotocol, &Globals.maxprotocol)
    5906 int lp_maxprotocol(void)
    5907 {
    5908         int ret = _lp_maxprotocol();
    5909         if ((ret == PROTOCOL_SMB2) && (lp_security() == SEC_SHARE)) {
    5910                 DEBUG(2,("WARNING!!: \"security = share\" is incompatible "
    5911                         "with the SMB2 protocol. Resetting to SMB1.\n" ));
    5912                         lp_do_parameter(-1, "max protocol", "NT1");
    5913                 return PROTOCOL_NT1;
    5914         }
    5915         return ret;
    5916 }
    5917 FN_GLOBAL_INTEGER(lp_minprotocol, &Globals.minprotocol)
    5918 FN_GLOBAL_INTEGER(lp_security, &Globals.security)
    5919 FN_GLOBAL_LIST(lp_auth_methods, &Globals.AuthMethods)
    5920 FN_GLOBAL_BOOL(lp_paranoid_server_security, &Globals.paranoid_server_security)
    5921 FN_GLOBAL_INTEGER(lp_maxdisksize, &Globals.maxdisksize)
    5922 FN_GLOBAL_INTEGER(lp_lpqcachetime, &Globals.lpqcachetime)
    5923 FN_GLOBAL_INTEGER(lp_max_smbd_processes, &Globals.iMaxSmbdProcesses)
    5924 FN_GLOBAL_BOOL(_lp_disable_spoolss, &Globals.bDisableSpoolss)
    5925 FN_GLOBAL_INTEGER(lp_syslog, &Globals.syslog)
    5926 static FN_GLOBAL_INTEGER(lp_announce_as, &Globals.announce_as)
    5927 FN_GLOBAL_INTEGER(lp_lm_announce, &Globals.lm_announce)
    5928 FN_GLOBAL_INTEGER(lp_lm_interval, &Globals.lm_interval)
    5929 FN_GLOBAL_INTEGER(lp_machine_password_timeout, &Globals.machine_password_timeout)
    5930 FN_GLOBAL_INTEGER(lp_map_to_guest, &Globals.map_to_guest)
    5931 FN_GLOBAL_INTEGER(lp_oplock_break_wait_time, &Globals.oplock_break_wait_time)
    5932 FN_GLOBAL_INTEGER(lp_lock_spin_time, &Globals.iLockSpinTime)
    5933 FN_GLOBAL_INTEGER(lp_usershare_max_shares, &Globals.iUsershareMaxShares)
    5934 FN_GLOBAL_CONST_STRING(lp_socket_options, &Globals.szSocketOptions)
    5935 FN_GLOBAL_INTEGER(lp_config_backend, &Globals.ConfigBackend)
    5936 FN_GLOBAL_INTEGER(lp_smb2_max_read, &Globals.ismb2_max_read)
    5937 FN_GLOBAL_INTEGER(lp_smb2_max_write, &Globals.ismb2_max_write)
    5938 FN_GLOBAL_INTEGER(lp_smb2_max_trans, &Globals.ismb2_max_trans)
    5939 int lp_smb2_max_credits(void)
    5940 {
    5941         if (Globals.ismb2_max_credits == 0) {
    5942                 Globals.ismb2_max_credits = DEFAULT_SMB2_MAX_CREDITS;
    5943         }
    5944         return Globals.ismb2_max_credits;
    5945 }
    5946 FN_LOCAL_STRING(lp_preexec, szPreExec)
    5947 FN_LOCAL_STRING(lp_postexec, szPostExec)
    5948 FN_LOCAL_STRING(lp_rootpreexec, szRootPreExec)
    5949 FN_LOCAL_STRING(lp_rootpostexec, szRootPostExec)
    5950 FN_LOCAL_STRING(lp_servicename, szService)
    5951 FN_LOCAL_CONST_STRING(lp_const_servicename, szService)
    5952 FN_LOCAL_STRING(lp_pathname, szPath)
    5953 FN_LOCAL_STRING(lp_dontdescend, szDontdescend)
    5954 FN_LOCAL_STRING(lp_username, szUsername)
    5955 FN_LOCAL_LIST(lp_invalid_users, szInvalidUsers)
    5956 FN_LOCAL_LIST(lp_valid_users, szValidUsers)
    5957 FN_LOCAL_LIST(lp_admin_users, szAdminUsers)
    5958 FN_GLOBAL_LIST(lp_svcctl_list, &Globals.szServicesList)
    5959 FN_LOCAL_STRING(lp_cups_options, szCupsOptions)
    5960 FN_GLOBAL_STRING(lp_cups_server, &Globals.szCupsServer)
    5961 int lp_cups_encrypt(void)
    5962 {
    5963         int result = 0;
    5964 #ifdef HAVE_HTTPCONNECTENCRYPT
    5965         switch (Globals.CupsEncrypt) {
    5966                 case Auto:
    5967                         result = HTTP_ENCRYPT_REQUIRED;
    5968                         break;
    5969                 case True:
    5970                         result = HTTP_ENCRYPT_ALWAYS;
    5971                         break;
    5972                 case False:
    5973                         result = HTTP_ENCRYPT_NEVER;
    5974                         break;
    5975         }
    5976 #endif
    5977         return result;
    5978 }
    5979 FN_GLOBAL_STRING(lp_iprint_server, &Globals.szIPrintServer)
    5980 FN_GLOBAL_INTEGER(lp_cups_connection_timeout, &Globals.cups_connection_timeout)
    5981 FN_GLOBAL_CONST_STRING(lp_ctdbd_socket, &Globals.ctdbdSocket)
    5982 FN_GLOBAL_LIST(lp_cluster_addresses, &Globals.szClusterAddresses)
    5983 FN_GLOBAL_BOOL(lp_clustering, &Globals.clustering)
    5984 FN_GLOBAL_INTEGER(lp_ctdb_timeout, &Globals.ctdb_timeout)
    5985 FN_GLOBAL_INTEGER(lp_ctdb_locktime_warn_threshold, &Globals.ctdb_locktime_warn_threshold)
    5986 FN_LOCAL_STRING(lp_printcommand, szPrintcommand)
    5987 FN_LOCAL_STRING(lp_lpqcommand, szLpqcommand)
    5988 FN_LOCAL_STRING(lp_lprmcommand, szLprmcommand)
    5989 FN_LOCAL_STRING(lp_lppausecommand, szLppausecommand)
    5990 FN_LOCAL_STRING(lp_lpresumecommand, szLpresumecommand)
    5991 FN_LOCAL_STRING(lp_queuepausecommand, szQueuepausecommand)
    5992 FN_LOCAL_STRING(lp_queueresumecommand, szQueueresumecommand)
    5993 static FN_LOCAL_STRING(_lp_printername, szPrintername)
    5994 FN_LOCAL_CONST_STRING(lp_printjob_username, szPrintjobUsername)
    5995 FN_LOCAL_LIST(lp_hostsallow, szHostsallow)
    5996 FN_LOCAL_LIST(lp_hostsdeny, szHostsdeny)
    5997 FN_LOCAL_STRING(lp_magicscript, szMagicScript)
    5998 FN_LOCAL_STRING(lp_magicoutput, szMagicOutput)
    5999 FN_LOCAL_STRING(lp_comment, comment)
    6000 FN_LOCAL_STRING(lp_force_user, force_user)
    6001 FN_LOCAL_STRING(lp_force_group, force_group)
    6002 FN_LOCAL_LIST(lp_readlist, readlist)
    6003 FN_LOCAL_LIST(lp_writelist, writelist)
    6004 FN_LOCAL_LIST(lp_printer_admin, printer_admin)
    6005 FN_LOCAL_STRING(lp_fstype, fstype)
    6006 FN_LOCAL_LIST(lp_vfs_objects, szVfsObjects)
    6007 FN_LOCAL_STRING(lp_msdfs_proxy, szMSDfsProxy)
    6008 static FN_LOCAL_STRING(lp_volume, volume)
    6009 FN_LOCAL_STRING(lp_veto_files, szVetoFiles)
    6010 FN_LOCAL_STRING(lp_hide_files, szHideFiles)
    6011 FN_LOCAL_STRING(lp_veto_oplocks, szVetoOplockFiles)
    6012 FN_LOCAL_BOOL(lp_msdfs_root, bMSDfsRoot)
    6013 FN_LOCAL_STRING(lp_aio_write_behind, szAioWriteBehind)
    6014 FN_LOCAL_STRING(lp_dfree_command, szDfree)
    6015 FN_LOCAL_BOOL(lp_autoloaded, autoloaded)
    6016 FN_LOCAL_BOOL(lp_preexec_close, bPreexecClose)
    6017 FN_LOCAL_BOOL(lp_rootpreexec_close, bRootpreexecClose)
    6018 FN_LOCAL_INTEGER(lp_casesensitive, iCaseSensitive)
    6019 FN_LOCAL_BOOL(lp_preservecase, bCasePreserve)
    6020 FN_LOCAL_BOOL(lp_shortpreservecase, bShortCasePreserve)
    6021 FN_LOCAL_BOOL(lp_hide_dot_files, bHideDotFiles)
    6022 FN_LOCAL_BOOL(lp_hide_special_files, bHideSpecialFiles)
    6023 FN_LOCAL_BOOL(lp_hideunreadable, bHideUnReadable)
    6024 FN_LOCAL_BOOL(lp_hideunwriteable_files, bHideUnWriteableFiles)
    6025 FN_LOCAL_BOOL(lp_browseable, bBrowseable)
    6026 FN_LOCAL_BOOL(lp_access_based_share_enum, bAccessBasedShareEnum)
    6027 FN_LOCAL_BOOL(lp_readonly, bRead_only)
    6028 FN_LOCAL_BOOL(lp_no_set_dir, bNo_set_dir)
    6029 FN_LOCAL_BOOL(lp_guest_ok, bGuest_ok)
    6030 FN_LOCAL_BOOL(lp_guest_only, bGuest_only)
    6031 FN_LOCAL_BOOL(lp_administrative_share, bAdministrative_share)
    6032 FN_LOCAL_BOOL(lp_print_ok, bPrint_ok)
    6033 FN_LOCAL_BOOL(lp_print_notify_backchannel, bPrintNotifyBackchannel)
    6034 FN_LOCAL_BOOL(lp_map_hidden, bMap_hidden)
    6035 FN_LOCAL_BOOL(lp_map_archive, bMap_archive)
    6036 FN_LOCAL_BOOL(lp_store_dos_attributes, bStoreDosAttributes)
    6037 FN_LOCAL_BOOL(lp_dmapi_support, bDmapiSupport)
    6038 FN_LOCAL_PARM_BOOL(lp_locking, bLocking)
    6039 FN_LOCAL_PARM_INTEGER(lp_strict_locking, iStrictLocking)
    6040 FN_LOCAL_PARM_BOOL(lp_posix_locking, bPosixLocking)
    6041 FN_LOCAL_BOOL(lp_share_modes, bShareModes)
    6042 FN_LOCAL_BOOL(lp_oplocks, bOpLocks)
    6043 FN_LOCAL_BOOL(lp_level2_oplocks, bLevel2OpLocks)
    6044 FN_LOCAL_BOOL(lp_onlyuser, bOnlyUser)
    6045 FN_LOCAL_PARM_BOOL(lp_manglednames, bMangledNames)
    6046 FN_LOCAL_BOOL(lp_symlinks, bSymlinks)
    6047 FN_LOCAL_BOOL(lp_syncalways, bSyncAlways)
    6048 FN_LOCAL_BOOL(lp_strict_allocate, bStrictAllocate)
    6049 FN_LOCAL_BOOL(lp_strict_sync, bStrictSync)
    6050 FN_LOCAL_BOOL(lp_map_system, bMap_system)
    6051 FN_LOCAL_BOOL(lp_delete_readonly, bDeleteReadonly)
    6052 FN_LOCAL_BOOL(lp_fake_oplocks, bFakeOplocks)
    6053 FN_LOCAL_BOOL(lp_recursive_veto_delete, bDeleteVetoFiles)
    6054 FN_LOCAL_BOOL(lp_dos_filemode, bDosFilemode)
    6055 FN_LOCAL_BOOL(lp_dos_filetimes, bDosFiletimes)
    6056 FN_LOCAL_BOOL(lp_dos_filetime_resolution, bDosFiletimeResolution)
    6057 FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes)
    6058 FN_GLOBAL_BOOL(lp_async_smb_echo_handler, &Globals.bAsyncSMBEchoHandler)
    6059 FN_GLOBAL_BOOL(lp_multicast_dns_register, &Globals.bMulticastDnsRegister)
    6060 FN_GLOBAL_BOOL(lp_allow_insecure_widelinks, &Globals.bAllowInsecureWidelinks)
    6061 FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks)
    6062 FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms)
    6063 FN_LOCAL_BOOL(lp_inherit_acls, bInheritACLS)
    6064 FN_LOCAL_BOOL(lp_inherit_owner, bInheritOwner)
    6065 FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver)
    6066 FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode)
    6067 FN_LOCAL_BOOL(lp_force_printername, bForcePrintername)
    6068 FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport)
    6069 FN_LOCAL_BOOL(lp_force_unknown_acl_user, bForceUnknownAclUser)
    6070 FN_LOCAL_BOOL(lp_ea_support, bEASupport)
    6071 FN_LOCAL_BOOL(_lp_use_sendfile, bUseSendfile)
    6072 FN_LOCAL_BOOL(lp_profile_acls, bProfileAcls)
    6073 FN_LOCAL_BOOL(lp_map_acl_inherit, bMap_acl_inherit)
    6074 FN_LOCAL_BOOL(lp_afs_share, bAfs_Share)
    6075 FN_LOCAL_BOOL(lp_acl_check_permissions, bAclCheckPermissions)
    6076 FN_LOCAL_BOOL(lp_acl_group_control, bAclGroupControl)
    6077 FN_LOCAL_BOOL(lp_acl_map_full_control, bAclMapFullControl)
    6078 FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask)
    6079 FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode)
    6080 FN_LOCAL_INTEGER(lp_security_mask, iSecurity_mask)
    6081 FN_LOCAL_INTEGER(lp_force_security_mode, iSecurity_force_mode)
    6082 FN_LOCAL_INTEGER(lp_dir_mask, iDir_mask)
    6083 FN_LOCAL_INTEGER(lp_force_dir_mode, iDir_force_mode)
    6084 FN_LOCAL_INTEGER(lp_dir_security_mask, iDir_Security_mask)
    6085 FN_LOCAL_INTEGER(lp_force_dir_security_mode, iDir_Security_force_mode)
    6086 FN_LOCAL_INTEGER(lp_max_connections, iMaxConnections)
    6087 FN_LOCAL_INTEGER(lp_defaultcase, iDefaultCase)
    6088 FN_LOCAL_INTEGER(lp_minprintspace, iMinPrintSpace)
    6089 FN_LOCAL_INTEGER(lp_printing, iPrinting)
    6090 FN_LOCAL_INTEGER(lp_max_reported_jobs, iMaxReportedPrintJobs)
    6091 FN_LOCAL_INTEGER(lp_oplock_contention_limit, iOplockContentionLimit)
    6092 FN_LOCAL_INTEGER(lp_csc_policy, iCSCPolicy)
    6093 FN_LOCAL_INTEGER(lp_write_cache_size, iWriteCacheSize)
    6094 FN_LOCAL_INTEGER(lp_block_size, iBlock_size)
    6095 FN_LOCAL_INTEGER(lp_dfree_cache_time, iDfreeCacheTime)
    6096 FN_LOCAL_INTEGER(lp_allocation_roundup_size, iallocation_roundup_size)
    6097 FN_LOCAL_INTEGER(lp_aio_read_size, iAioReadSize)
    6098 FN_LOCAL_INTEGER(lp_aio_write_size, iAioWriteSize)
    6099 FN_LOCAL_INTEGER(lp_map_readonly, iMap_readonly)
    6100 FN_LOCAL_INTEGER(lp_directory_name_cache_size, iDirectoryNameCacheSize)
    6101 FN_LOCAL_INTEGER(lp_smb_encrypt, ismb_encrypt)
    6102 FN_LOCAL_CHAR(lp_magicchar, magic_char)
    6103 FN_GLOBAL_INTEGER(lp_winbind_cache_time, &Globals.winbind_cache_time)
    6104 FN_GLOBAL_INTEGER(lp_winbind_reconnect_delay, &Globals.winbind_reconnect_delay)
    6105 FN_GLOBAL_INTEGER(lp_winbind_max_clients, &Globals.winbind_max_clients)
    6106 FN_GLOBAL_LIST(lp_winbind_nss_info, &Globals.szWinbindNssInfo)
    6107 FN_GLOBAL_INTEGER(lp_algorithmic_rid_base, &Globals.AlgorithmicRidBase)
    6108 FN_GLOBAL_INTEGER(lp_name_cache_timeout, &Globals.name_cache_timeout)
    6109 FN_GLOBAL_INTEGER(lp_client_signing, &Globals.client_signing)
    6110 FN_GLOBAL_INTEGER(lp_client_ipc_signing, &Globals.client_ipc_signing)
    6111 FN_GLOBAL_INTEGER(lp_server_signing, &Globals.server_signing)
    6112 FN_GLOBAL_INTEGER(lp_client_ldap_sasl_wrapping, &Globals.client_ldap_sasl_wrapping)
    6113 
    6114 FN_GLOBAL_STRING(lp_ncalrpc_dir, &Globals.ncalrpc_dir)
     1043        return MAX(1, lp__winbind_max_domain_connections());
     1044}
     1045
     1046/* These functions remain in source3/param for now */
     1047
     1048#include "lib/param/param_functions.c"
     1049
     1050FN_LOCAL_STRING(servicename, szService)
     1051FN_LOCAL_CONST_STRING(const_servicename, szService)
     1052
     1053/* These functions cannot be auto-generated */
     1054FN_LOCAL_BOOL(autoloaded, autoloaded)
     1055FN_GLOBAL_CONST_STRING(dnsdomain, dnsdomain)
    61151056
    61161057/* local prototypes */
     
    61181059static int map_parameter_canonical(const char *pszParmName, bool *inverse);
    61191060static const char *get_boolean(bool bool_value);
    6120 static int getservicebyname(const char *pszServiceName,
    6121                             struct service *pserviceDest);
    6122 static void copy_service(struct service *pserviceDest,
    6123                          struct service *pserviceSource,
    6124                          struct bitmap *pcopymapDest);
    61251061static bool do_parameter(const char *pszParmName, const char *pszParmValue,
    61261062                         void *userdata);
    6127 static bool do_section(const char *pszSectionName, void *userdata);
    6128 static void init_copymap(struct service *pservice);
    61291063static bool hash_a_service(const char *name, int number);
    61301064static void free_service_byindex(int iService);
    6131 static void free_param_opts(struct param_opt_struct **popts);
    61321065static void show_parameter(int parmIndex);
    61331066static bool is_synonym_of(int parm1, int parm2, bool *inverse);
     
    61381071 * parametrical functions are quite simple
    61391072 */
    6140 static struct param_opt_struct *get_parametrics(int snum, const char *type,
     1073static struct parmlist_entry *get_parametrics(int snum, const char *type,
    61411074                                                const char *option)
    61421075{
    6143         bool global_section = False;
    6144         char* param_key;
    6145         struct param_opt_struct *data;
    6146 
    61471076        if (snum >= iNumServices) return NULL;
    61481077
    6149         if (snum < 0) {
    6150                 data = Globals.param_opt;
    6151                 global_section = True;
     1078        if (snum < 0) {
     1079                return get_parametric_helper(NULL, type, option, Globals.param_opt);
    61521080        } else {
    6153                 data = ServicePtrs[snum]->param_opt;
    6154         }
    6155 
    6156         if (asprintf(&param_key, "%s:%s", type, option) == -1) {
    6157                 DEBUG(0,("asprintf failed!\n"));
    6158                 return NULL;
    6159         }
    6160 
    6161         while (data) {
    6162                 if (strwicmp(data->key, param_key) == 0) {
    6163                         string_free(&param_key);
    6164                         return data;
    6165                 }
    6166                 data = data->next;
    6167         }
    6168 
    6169         if (!global_section) {
    6170                 /* Try to fetch the same option but from globals */
    6171                 /* but only if we are not already working with Globals */
    6172                 data = Globals.param_opt;
    6173                 while (data) {
    6174                         if (strwicmp(data->key, param_key) == 0) {
    6175                                 string_free(&param_key);
    6176                                 return data;
    6177                         }
    6178                         data = data->next;
    6179                 }
    6180         }
    6181 
    6182         string_free(&param_key);
    6183 
    6184         return NULL;
     1081                return get_parametric_helper(ServicePtrs[snum],
     1082                                             type, option, Globals.param_opt);
     1083        }
     1084}
     1085
     1086static void discard_whitespace(char *str)
     1087{
     1088        size_t len = strlen(str);
     1089        size_t i = 0;
     1090
     1091        while (i < len) {
     1092                if (isspace(str[i])) {
     1093                        memmove(&str[i], &str[i+1], len-i);
     1094                        len -= 1;
     1095                        continue;
     1096                }
     1097                i += 1;
     1098        }
     1099}
     1100
     1101/**
     1102 * @brief Go through all global parametric parameters
     1103 *
     1104 * @param regex_str     A regular expression to scan param for
     1105 * @param max_matches   Max number of submatches the regexp expects
     1106 * @param cb            Function to call on match. Should return true
     1107 *                      when it wants wi_scan_global_parametrics to stop
     1108 *                      scanning
     1109 * @param private_data  Anonymous pointer passed to cb
     1110 *
     1111 * @return              0: success, regcomp/regexec return value on error.
     1112 *                      See "man regexec" for possible errors
     1113 */
     1114
     1115int lp_wi_scan_global_parametrics(
     1116        const char *regex_str, size_t max_matches,
     1117        bool (*cb)(const char *string, regmatch_t matches[],
     1118                   void *private_data),
     1119        void *private_data)
     1120{
     1121        struct parmlist_entry *data;
     1122        regex_t regex;
     1123        int ret;
     1124
     1125        ret = regcomp(&regex, regex_str, REG_ICASE);
     1126        if (ret != 0) {
     1127                return ret;
     1128        }
     1129
     1130        for (data = Globals.param_opt; data != NULL; data = data->next) {
     1131                size_t keylen = strlen(data->key);
     1132                char key[keylen+1];
     1133                regmatch_t matches[max_matches];
     1134                bool stop;
     1135
     1136                memcpy(key, data->key, sizeof(key));
     1137                discard_whitespace(key);
     1138
     1139                ret = regexec(&regex, key, max_matches, matches, 0);
     1140                if (ret == REG_NOMATCH) {
     1141                        continue;
     1142                }
     1143                if (ret != 0) {
     1144                        goto fail;
     1145                }
     1146
     1147                stop = cb(key, matches, private_data);
     1148                if (stop) {
     1149                        break;
     1150                }
     1151        }
     1152
     1153        ret = 0;
     1154fail:
     1155        regfree(&regex);
     1156        return ret;
    61851157}
    61861158
     
    61881160#define MISSING_PARAMETER(name) \
    61891161    DEBUG(0, ("%s(): value is NULL or empty!\n", #name))
    6190 
    6191 /*******************************************************************
    6192 convenience routine to return int parameters.
    6193 ********************************************************************/
    6194 static int lp_int(const char *s)
    6195 {
    6196 
    6197         if (!s || !*s) {
    6198                 MISSING_PARAMETER(lp_int);
    6199                 return (-1);
    6200         }
    6201 
    6202         return (int)strtol(s, NULL, 0);
    6203 }
    6204 
    6205 /*******************************************************************
    6206 convenience routine to return unsigned long parameters.
    6207 ********************************************************************/
    6208 static unsigned long lp_ulong(const char *s)
    6209 {
    6210 
    6211         if (!s || !*s) {
    6212                 MISSING_PARAMETER(lp_ulong);
    6213                 return (0);
    6214         }
    6215 
    6216         return strtoul(s, NULL, 0);
    6217 }
    6218 
    6219 /*******************************************************************
    6220 convenience routine to return boolean parameters.
    6221 ********************************************************************/
    6222 static bool lp_bool(const char *s)
    6223 {
    6224         bool ret = False;
    6225 
    6226         if (!s || !*s) {
    6227                 MISSING_PARAMETER(lp_bool);
    6228                 return False;
    6229         }
    6230 
    6231         if (!set_boolean(s, &ret)) {
    6232                 DEBUG(0,("lp_bool(%s): value is not boolean!\n",s));
    6233                 return False;
    6234         }
    6235 
    6236         return ret;
    6237 }
    62381162
    62391163/*******************************************************************
     
    62601184#undef MISSING_PARAMETER
    62611185
    6262 /* DO NOT USE lp_parm_string ANYMORE!!!!
    6263  * use lp_parm_const_string or lp_parm_talloc_string
    6264  *
    6265  * lp_parm_string is only used to let old modules find this symbol
    6266  */
    6267 #undef lp_parm_string
    6268  char *lp_parm_string(const char *servicename, const char *type, const char *option);
    6269  char *lp_parm_string(const char *servicename, const char *type, const char *option)
    6270 {
    6271         return lp_parm_talloc_string(lp_servicenumber(servicename), type, option, NULL);
    6272 }
    6273 
    62741186/* Return parametric option from a given service. Type is a part of option before ':' */
    62751187/* Parametric option has following syntax: 'Type: option = value' */
    6276 /* the returned value is talloced on the talloc_tos() */
    6277 char *lp_parm_talloc_string(int snum, const char *type, const char *option, const char *def)
    6278 {
    6279         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1188char *lp_parm_talloc_string(TALLOC_CTX *ctx, int snum, const char *type, const char *option, const char *def)
     1189{
     1190        struct parmlist_entry *data = get_parametrics(snum, type, option);
    62801191
    62811192        if (data == NULL||data->value==NULL) {
    62821193                if (def) {
    6283                         return lp_string(def);
     1194                        return lp_string(ctx, def);
    62841195                } else {
    62851196                        return NULL;
     
    62871198        }
    62881199
    6289         return lp_string(data->value);
     1200        return lp_string(ctx, data->value);
    62901201}
    62911202
     
    62941205const char *lp_parm_const_string(int snum, const char *type, const char *option, const char *def)
    62951206{
    6296         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1207        struct parmlist_entry *data = get_parametrics(snum, type, option);
    62971208
    62981209        if (data == NULL||data->value==NULL)
     
    63021213}
    63031214
     1215
    63041216/* Return parametric option from a given service. Type is a part of option before ':' */
    63051217/* Parametric option has following syntax: 'Type: option = value' */
     
    63071219const char **lp_parm_string_list(int snum, const char *type, const char *option, const char **def)
    63081220{
    6309         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1221        struct parmlist_entry *data = get_parametrics(snum, type, option);
    63101222
    63111223        if (data == NULL||data->value==NULL)
     
    63161228        }
    63171229
    6318         return (const char **)data->list;
     1230        return discard_const_p(const char *, data->list);
    63191231}
    63201232
     
    63241236int lp_parm_int(int snum, const char *type, const char *option, int def)
    63251237{
    6326         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1238        struct parmlist_entry *data = get_parametrics(snum, type, option);
    63271239
    63281240        if (data && data->value && *data->value)
     
    63371249unsigned long lp_parm_ulong(int snum, const char *type, const char *option, unsigned long def)
    63381250{
    6339         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1251        struct parmlist_entry *data = get_parametrics(snum, type, option);
    63401252
    63411253        if (data && data->value && *data->value)
     
    63481260/* Parametric option has following syntax: 'Type: option = value' */
    63491261
     1262unsigned long long lp_parm_ulonglong(int snum, const char *type,
     1263                                     const char *option, unsigned long long def)
     1264{
     1265        struct parmlist_entry *data = get_parametrics(snum, type, option);
     1266
     1267        if (data && data->value && *data->value) {
     1268                return lp_ulonglong(data->value);
     1269        }
     1270
     1271        return def;
     1272}
     1273
     1274/* Return parametric option from a given service. Type is a part of option
     1275 * before ':' */
     1276/* Parametric option has following syntax: 'Type: option = value' */
     1277
    63501278bool lp_parm_bool(int snum, const char *type, const char *option, bool def)
    63511279{
    6352         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1280        struct parmlist_entry *data = get_parametrics(snum, type, option);
    63531281
    63541282        if (data && data->value && *data->value)
     
    63641292                 const struct enum_list *_enum, int def)
    63651293{
    6366         struct param_opt_struct *data = get_parametrics(snum, type, option);
     1294        struct parmlist_entry *data = get_parametrics(snum, type, option);
    63671295
    63681296        if (data && data->value && *data->value && _enum)
     
    63711299        return def;
    63721300}
    6373 
    6374 
    6375 /***************************************************************************
    6376  Initialise a service to the defaults.
    6377 ***************************************************************************/
    6378 
    6379 static void init_service(struct service *pservice)
    6380 {
    6381         memset((char *)pservice, '\0', sizeof(struct service));
    6382         copy_service(pservice, &sDefault, NULL);
    6383 }
    6384 
    63851301
    63861302/**
     
    63901306 */
    63911307
    6392 static void free_param_opts(struct param_opt_struct **popts)
    6393 {
    6394         struct param_opt_struct *opt, *next_opt;
    6395 
    6396         if (popts == NULL) {
    6397                 return;
    6398         }
     1308static void free_param_opts(struct parmlist_entry **popts)
     1309{
     1310        struct parmlist_entry *opt, *next_opt;
    63991311
    64001312        if (*popts != NULL) {
     
    64031315        opt = *popts;
    64041316        while (opt != NULL) {
    6405                 string_free(&opt->key);
    6406                 string_free(&opt->value);
     1317                lpcfg_string_free(&opt->key);
     1318                lpcfg_string_free(&opt->value);
    64071319                TALLOC_FREE(opt->list);
    64081320                next_opt = opt->next;
    6409                 SAFE_FREE(opt);
     1321                TALLOC_FREE(opt);
    64101322                opt = next_opt;
    64111323        }
     
    64171329***************************************************************************/
    64181330
    6419 static void free_service(struct service *pservice)
     1331static void free_service(struct loadparm_service *pservice)
    64201332{
    64211333        if (!pservice)
     
    64281340        free_parameters(pservice);
    64291341
    6430         string_free(&pservice->szService);
     1342        lpcfg_string_free(&pservice->szService);
    64311343        TALLOC_FREE(pservice->copymap);
    64321344
     
    64471359                return;
    64481360
    6449         ServicePtrs[idx]->valid = False;
    6450         invalid_services[num_invalid_services++] = idx;
     1361        ServicePtrs[idx]->valid = false;
    64511362
    64521363        /* we have to cleanup the hash record */
     
    64621373
    64631374        free_service(ServicePtrs[idx]);
     1375        TALLOC_FREE(ServicePtrs[idx]);
    64641376}
    64651377
     
    64691381***************************************************************************/
    64701382
    6471 static int add_a_service(const struct service *pservice, const char *name)
     1383static int add_a_service(const struct loadparm_service *pservice, const char *name)
    64721384{
    64731385        int i;
    6474         struct service tservice;
    64751386        int num_to_alloc = iNumServices + 1;
    6476 
    6477         tservice = *pservice;
     1387        struct loadparm_service **tsp = NULL;
    64781388
    64791389        /* it might already exist */
     
    64851395        }
    64861396
    6487         /* find an invalid one */
    6488         i = iNumServices;
    6489         if (num_invalid_services > 0) {
    6490                 i = invalid_services[--num_invalid_services];
    6491         }
    6492 
    6493         /* if not, then create one */
     1397        /* Re use empty slots if any before allocating new one.*/
     1398        for (i=0; i < iNumServices; i++) {
     1399                if (ServicePtrs[i] == NULL) {
     1400                        break;
     1401                }
     1402        }
    64941403        if (i == iNumServices) {
    6495                 struct service **tsp;
    6496                 int *tinvalid;
    6497 
    6498                 tsp = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(ServicePtrs, struct service *, num_to_alloc);
     1404                /* if not, then create one */
     1405                tsp = talloc_realloc(NULL, ServicePtrs,
     1406                                     struct loadparm_service *,
     1407                                    num_to_alloc);
    64991408                if (tsp == NULL) {
    6500                         DEBUG(0,("add_a_service: failed to enlarge ServicePtrs!\n"));
     1409                        DEBUG(0, ("add_a_service: failed to enlarge "
     1410                                  "ServicePtrs!\n"));
    65011411                        return (-1);
    65021412                }
    65031413                ServicePtrs = tsp;
    6504                 ServicePtrs[iNumServices] = SMB_MALLOC_P(struct service);
    6505                 if (!ServicePtrs[iNumServices]) {
    6506                         DEBUG(0,("add_a_service: out of memory!\n"));
    6507                         return (-1);
    6508                 }
    65091414                iNumServices++;
    6510 
    6511                 /* enlarge invalid_services here for now... */
    6512                 tinvalid = SMB_REALLOC_ARRAY_KEEP_OLD_ON_ERROR(invalid_services, int,
    6513                                              num_to_alloc);
    6514                 if (tinvalid == NULL) {
    6515                         DEBUG(0,("add_a_service: failed to enlarge "
    6516                                  "invalid_services!\n"));
    6517                         return (-1);
    6518                 }
    6519                 invalid_services = tinvalid;
    6520         } else {
    6521                 free_service_byindex(i);
    6522         }
    6523 
    6524         ServicePtrs[i]->valid = True;
    6525 
    6526         init_service(ServicePtrs[i]);
    6527         copy_service(ServicePtrs[i], &tservice, NULL);
     1415        }
     1416        ServicePtrs[i] = talloc_zero(ServicePtrs, struct loadparm_service);
     1417        if (!ServicePtrs[i]) {
     1418                DEBUG(0,("add_a_service: out of memory!\n"));
     1419                return (-1);
     1420        }
     1421
     1422        ServicePtrs[i]->valid = true;
     1423
     1424        copy_service(ServicePtrs[i], pservice, NULL);
    65281425        if (name)
    6529                 string_set(&ServicePtrs[i]->szService, name);
     1426                lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->szService,
     1427                                 name);
    65301428
    65311429        DEBUG(8,("add_a_service: Creating snum = %d for %s\n",
     
    65551453        SMB_ASSERT(result != NULL);
    65561454
    6557         strlower_m(result);
     1455        if (!strlower_m(result)) {
     1456                TALLOC_FREE(result);
     1457                return NULL;
     1458        }
    65581459        return result;
    65591460}
     
    65721473                if ( !ServiceHash ) {
    65731474                        DEBUG(0,("hash_a_service: open tdb servicehash failed!\n"));
    6574                         return False;
     1475                        return false;
    65751476                }
    65761477        }
     
    65821483
    65831484        dbwrap_store_bystring(ServiceHash, canon_name,
    6584                               make_tdb_data((uint8 *)&idx, sizeof(idx)),
     1485                              make_tdb_data((uint8_t *)&idx, sizeof(idx)),
    65851486                              TDB_REPLACE);
    65861487
    65871488        TALLOC_FREE(canon_name);
    65881489
    6589         return True;
     1490        return true;
    65901491}
    65911492
     
    66081509
    66091510        if (i < 0)
    6610                 return (False);
    6611 
    6612         if (!(*(ServicePtrs[iDefaultService]->szPath))
    6613             || strequal(ServicePtrs[iDefaultService]->szPath, lp_pathname(GLOBAL_SECTION_SNUM))) {
    6614                 string_set(&ServicePtrs[i]->szPath, pszHomedir);
     1511                return false;
     1512
     1513        if (!(*(ServicePtrs[iDefaultService]->path))
     1514            || strequal(ServicePtrs[iDefaultService]->path,
     1515                        lp_path(talloc_tos(), GLOBAL_SECTION_SNUM))) {
     1516                lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->path,
     1517                                 pszHomedir);
    66151518        }
    66161519
    66171520        if (!(*(ServicePtrs[i]->comment))) {
    6618                 char *comment = NULL;
    6619                 if (asprintf(&comment, "Home directory of %s", user) < 0) {
     1521                char *comment = talloc_asprintf(talloc_tos(), "Home directory of %s", user);
     1522                if (comment == NULL) {
    66201523                        return false;
    66211524                }
    6622                 string_set(&ServicePtrs[i]->comment, comment);
    6623                 SAFE_FREE(comment);
     1525                lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->comment,
     1526                                 comment);
     1527                TALLOC_FREE(comment);
    66241528        }
    66251529
    66261530        /* set the browseable flag from the global default */
    66271531
    6628         ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
    6629         ServicePtrs[i]->bAccessBasedShareEnum = sDefault.bAccessBasedShareEnum;
    6630 
    6631         ServicePtrs[i]->autoloaded = True;
     1532        ServicePtrs[i]->browseable = sDefault.browseable;
     1533        ServicePtrs[i]->access_based_share_enum = sDefault.access_based_share_enum;
     1534
     1535        ServicePtrs[i]->autoloaded = true;
    66321536
    66331537        DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename,
    6634                user, ServicePtrs[i]->szPath ));
    6635 
    6636         return (True);
     1538               user, ServicePtrs[i]->path ));
     1539
     1540        return true;
    66371541}
    66381542
     
    66601564
    66611565        if (i < 0)
    6662                 return (False);
    6663 
    6664         if (asprintf(&comment, "IPC Service (%s)",
    6665                                 Globals.szServerString) < 0) {
    6666                 return (False);
    6667         }
    6668 
    6669         string_set(&ServicePtrs[i]->szPath, tmpdir());
    6670         string_set(&ServicePtrs[i]->szUsername, "");
    6671         string_set(&ServicePtrs[i]->comment, comment);
    6672         string_set(&ServicePtrs[i]->fstype, "IPC");
    6673         ServicePtrs[i]->iMaxConnections = 0;
    6674         ServicePtrs[i]->bAvailable = True;
    6675         ServicePtrs[i]->bRead_only = True;
    6676         ServicePtrs[i]->bGuest_only = False;
    6677         ServicePtrs[i]->bAdministrative_share = True;
    6678         ServicePtrs[i]->bGuest_ok = guest_ok;
    6679         ServicePtrs[i]->bPrint_ok = False;
    6680         ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
     1566                return false;
     1567
     1568        comment = talloc_asprintf(talloc_tos(), "IPC Service (%s)",
     1569                                  Globals.server_string);
     1570        if (comment == NULL) {
     1571                return false;
     1572        }
     1573
     1574        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->path, tmpdir());
     1575        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->username, "");
     1576        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->comment, comment);
     1577        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->fstype, "IPC");
     1578        ServicePtrs[i]->max_connections = 0;
     1579        ServicePtrs[i]->available = true;
     1580        ServicePtrs[i]->read_only = true;
     1581        ServicePtrs[i]->guest_only = false;
     1582        ServicePtrs[i]->administrative_share = true;
     1583        ServicePtrs[i]->guest_ok = guest_ok;
     1584        ServicePtrs[i]->printable = false;
     1585        ServicePtrs[i]->browseable = sDefault.browseable;
     1586        ServicePtrs[i]->autoloaded = true;
    66811587
    66821588        DEBUG(3, ("adding IPC service\n"));
    66831589
    6684         SAFE_FREE(comment);
    6685         return (True);
     1590        TALLOC_FREE(comment);
     1591        return true;
    66861592}
    66871593
     
    66961602
    66971603        if (i < 0)
    6698                 return (False);
    6699 
    6700         /* note that we do NOT default the availability flag to True - */
     1604                return false;
     1605
     1606        /* note that we do NOT default the availability flag to true - */
    67011607        /* we take it from the default service passed. This allows all */
    67021608        /* dynamic printers to be disabled by disabling the [printers] */
     
    67041610
    67051611        /* the printer name is set to the service name. */
    6706         string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
    6707         string_set(&ServicePtrs[i]->comment, comment);
     1612        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->_printername,
     1613                         pszPrintername);
     1614        lpcfg_string_set(ServicePtrs[i], &ServicePtrs[i]->comment, comment);
    67081615
    67091616        /* set the browseable flag from the gloabl default */
    6710         ServicePtrs[i]->bBrowseable = sDefault.bBrowseable;
     1617        ServicePtrs[i]->browseable = sDefault.browseable;
    67111618
    67121619        /* Printers cannot be read_only. */
    6713         ServicePtrs[i]->bRead_only = False;
    6714         /* No share modes on printer services. */
    6715         ServicePtrs[i]->bShareModes = False;
     1620        ServicePtrs[i]->read_only = false;
    67161621        /* No oplocks on printer services. */
    6717         ServicePtrs[i]->bOpLocks = False;
     1622        ServicePtrs[i]->oplocks = false;
    67181623        /* Printer services must be printable. */
    6719         ServicePtrs[i]->bPrint_ok = True;
     1624        ServicePtrs[i]->printable = true;
    67201625
    67211626        DEBUG(3, ("adding printer service %s\n", pszPrintername));
    67221627
    6723         return (True);
     1628        return true;
    67241629}
    67251630
     
    67321637bool lp_parameter_is_valid(const char *pszParmName)
    67331638{
    6734         return ((map_parameter(pszParmName) != -1) ||
     1639        return ((lpcfg_map_parameter(pszParmName) != -1) ||
    67351640                (strchr(pszParmName, ':') != NULL));
    67361641}
     
    67381643/***************************************************************************
    67391644 Check whether the given name is the name of a global parameter.
    6740  Returns True for strings belonging to parameters of class
    6741  P_GLOBAL, False for all other strings, also for parametric options
     1645 Returns true for strings belonging to parameters of class
     1646 P_GLOBAL, false for all other strings, also for parametric options
    67421647 and strings not belonging to any option.
    67431648***************************************************************************/
     
    67451650bool lp_parameter_is_global(const char *pszParmName)
    67461651{
    6747         int num = map_parameter(pszParmName);
     1652        int num = lpcfg_map_parameter(pszParmName);
    67481653
    67491654        if (num >= 0) {
     
    67511656        }
    67521657
    6753         return False;
    6754 }
    6755 
    6756 /**************************************************************************
    6757  Check whether the given name is the canonical name of a parameter.
    6758  Returns False if it is not a valid parameter Name.
    6759  For parametric options, True is returned.
    6760 **************************************************************************/
    6761 
    6762 bool lp_parameter_is_canonical(const char *parm_name)
    6763 {
    6764         if (!lp_parameter_is_valid(parm_name)) {
    6765                 return False;
    6766         }
    6767 
    6768         return (map_parameter(parm_name) ==
    6769                 map_parameter_canonical(parm_name, NULL));
     1658        return false;
    67701659}
    67711660
     
    67831672        if (!lp_parameter_is_valid(parm_name)) {
    67841673                *canon_parm = NULL;
    6785                 return False;
     1674                return false;
    67861675        }
    67871676
     
    67941683        }
    67951684
    6796         return True;
     1685        return true;
    67971686
    67981687}
     
    68031692 the synonym is an invers boolean synonym.
    68041693
    6805  Return True if parm_name is a valid parameter name and
     1694 Return true if parm_name is a valid parameter name and
    68061695 in case it is an invers boolean synonym, if the val string could
    68071696 successfully be converted to the reverse bool.
     
    68201709                *canon_parm = NULL;
    68211710                *canon_val = NULL;
    6822                 return False;
     1711                return false;
    68231712        }
    68241713
     
    68331722                        if (!lp_invert_boolean(val, canon_val)) {
    68341723                                *canon_val = NULL;
    6835                                 return False;
     1724                                return false;
    68361725                        }
    68371726                } else {
     
    68401729        }
    68411730
    6842         return True;
    6843 }
    6844 
    6845 /***************************************************************************
    6846  Map a parameter's string representation to something we can use.
    6847  Returns False if the parameter string is not recognised, else TRUE.
    6848 ***************************************************************************/
    6849 
    6850 static int map_parameter(const char *pszParmName)
    6851 {
    6852         int iIndex;
    6853 
    6854         if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
    6855                 return (-1);
    6856 
    6857         for (iIndex = 0; parm_table[iIndex].label; iIndex++)
    6858                 if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
    6859                         return (iIndex);
    6860 
    6861         /* Warn only if it isn't parametric option */
    6862         if (strchr(pszParmName, ':') == NULL)
    6863                 DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
    6864         /* We do return 'fail' for parametric options as well because they are
    6865            stored in different storage
    6866          */
    6867         return (-1);
     1731        return true;
    68681732}
    68691733
     
    68771741{
    68781742        int parm_num, canon_num;
    6879         bool loc_inverse = False;
    6880 
    6881         parm_num = map_parameter(pszParmName);
    6882         if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
     1743        bool loc_inverse = false;
     1744
     1745        parm_num = lpcfg_map_parameter(pszParmName);
     1746        if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_SYNONYM)) {
    68831747                /* invalid, parametric or no canidate for synonyms ... */
    68841748                goto done;
     
    69021766 return true if parameter number parm1 is a synonym of parameter
    69031767 number parm2 (parm2 being the principal name).
    6904  set inverse to True if parm1 is P_BOOLREV and parm2 is P_BOOL,
    6905  False otherwise.
     1768 set inverse to true if parm1 is P_BOOLREV and parm2 is P_BOOL,
     1769 false otherwise.
    69061770***************************************************************************/
    69071771
    69081772static bool is_synonym_of(int parm1, int parm2, bool *inverse)
    69091773{
    6910         if ((parm_table[parm1].ptr == parm_table[parm2].ptr) &&
    6911             (parm_table[parm1].flags & FLAG_HIDE) &&
    6912             !(parm_table[parm2].flags & FLAG_HIDE))
     1774        if ((parm_table[parm1].offset == parm_table[parm2].offset) &&
     1775            (parm_table[parm1].p_class == parm_table[parm2].p_class) &&
     1776            (parm_table[parm1].flags & FLAG_SYNONYM) &&
     1777            !(parm_table[parm2].flags & FLAG_SYNONYM))
    69131778        {
    69141779                if (inverse != NULL) {
     
    69161781                            (parm_table[parm2].type == P_BOOL))
    69171782                        {
    6918                                 *inverse = True;
     1783                                *inverse = true;
    69191784                        } else {
    6920                                 *inverse = False;
     1785                                *inverse = false;
    69211786                        }
    69221787                }
    6923                 return True;
    6924         }
    6925         return False;
     1788                return true;
     1789        }
     1790        return false;
    69261791}
    69271792
     
    69401805        const char *type[] = { "P_BOOL", "P_BOOLREV", "P_CHAR", "P_INTEGER",
    69411806                "P_OCTAL", "P_LIST", "P_STRING", "P_USTRING",
    6942                 "P_ENUM", "P_SEP"};
    6943         unsigned flags[] = { FLAG_BASIC, FLAG_SHARE, FLAG_PRINT, FLAG_GLOBAL,
    6944                 FLAG_WIZARD, FLAG_ADVANCED, FLAG_DEVELOPER, FLAG_DEPRECATED,
    6945                 FLAG_HIDE, FLAG_DOS_STRING};
    6946         const char *flag_names[] = { "FLAG_BASIC", "FLAG_SHARE", "FLAG_PRINT",
    6947                 "FLAG_GLOBAL", "FLAG_WIZARD", "FLAG_ADVANCED", "FLAG_DEVELOPER",
    6948                 "FLAG_DEPRECATED", "FLAG_HIDE", "FLAG_DOS_STRING", NULL};
     1807                "P_ENUM", "P_BYTES", "P_CMDLIST" };
     1808        unsigned flags[] = { FLAG_DEPRECATED, FLAG_SYNONYM };
     1809        const char *flag_names[] = { "FLAG_DEPRECATED", "FLAG_SYNONYM", NULL};
    69491810
    69501811        printf("%s=%s", parm_table[parmIndex].label,
     
    69621823        }
    69631824        printf(",");
    6964         hadFlag = False;
     1825        hadFlag = false;
    69651826        for (flagIndex=0; flag_names[flagIndex]; flagIndex++) {
    69661827                if (parm_table[parmIndex].flags & flags[flagIndex]) {
     
    69681829                                hadFlag ? "|" : "",
    69691830                                flag_names[flagIndex]);
    6970                         hadFlag = True;
     1831                        hadFlag = true;
    69711832                }
    69721833        }
    69731834
    69741835        /* output synonyms */
    6975         hadSyn = False;
     1836        hadSyn = false;
    69761837        for (parmIndex2=0; parm_table[parmIndex2].label; parmIndex2++) {
    69771838                if (is_synonym_of(parmIndex, parmIndex2, &inverse)) {
     
    69811842                        if (!hadSyn) {
    69821843                                printf(" (synonyms: ");
    6983                                 hadSyn = True;
     1844                                hadSyn = true;
    69841845                        } else {
    69851846                                printf(", ");
     
    70161877
    70171878/***************************************************************************
    7018  Check if a given string correctly represents a boolean value.
    7019 ***************************************************************************/
    7020 
    7021 bool lp_string_is_valid_boolean(const char *parm_value)
    7022 {
    7023         return set_boolean(parm_value, NULL);
    7024 }
    7025 
    7026 /***************************************************************************
    70271879 Get the standard string representation of a boolean value ("yes" or "no")
    70281880***************************************************************************/
     
    70381890/***************************************************************************
    70391891 Provide the string of the negated boolean value associated to the boolean
    7040  given as a string. Returns False if the passed string does not correctly
     1892 given as a string. Returns false if the passed string does not correctly
    70411893 represent a boolean.
    70421894***************************************************************************/
     
    70471899
    70481900        if (!set_boolean(str, &val)) {
    7049                 return False;
     1901                return false;
    70501902        }
    70511903
    70521904        *inverse_str = get_boolean(!val);
    7053         return True;
     1905        return true;
    70541906}
    70551907
    70561908/***************************************************************************
    70571909 Provide the canonical string representation of a boolean value given
    7058  as a string. Return True on success, False if the string given does
     1910 as a string. Return true on success, false if the string given does
    70591911 not correctly represent a boolean.
    70601912***************************************************************************/
     
    70651917
    70661918        if (!set_boolean(str, &val)) {
    7067                 return False;
     1919                return false;
    70681920        }
    70691921
    70701922        *canon_str = get_boolean(val);
    7071         return True;
     1923        return true;
    70721924}
    70731925
     
    70761928***************************************************************************/
    70771929
    7078 static int getservicebyname(const char *pszServiceName, struct service *pserviceDest)
     1930int getservicebyname(const char *pszServiceName, struct loadparm_service *pserviceDest)
    70791931{
    70801932        int iService = -1;
    70811933        char *canon_name;
    70821934        TDB_DATA data;
     1935        NTSTATUS status;
    70831936
    70841937        if (ServiceHash == NULL) {
     
    70881941        canon_name = canonicalize_servicename(talloc_tos(), pszServiceName);
    70891942
    7090         data = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name);
    7091 
    7092         if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
     1943        status = dbwrap_fetch_bystring(ServiceHash, canon_name, canon_name,
     1944                                       &data);
     1945
     1946        if (NT_STATUS_IS_OK(status) &&
     1947            (data.dptr != NULL) &&
     1948            (data.dsize == sizeof(iService)))
     1949        {
    70931950                iService = *(int *)data.dptr;
    70941951        }
     
    71041961}
    71051962
    7106 /***************************************************************************
    7107  Copy a service structure to another.
    7108  If pcopymapDest is NULL then copy all fields
    7109 ***************************************************************************/
    7110 
    7111 /**
    7112  * Add a parametric option to a param_opt_struct,
    7113  * replacing old value, if already present.
    7114  */
    7115 static void set_param_opt(struct param_opt_struct **opt_list,
    7116                           const char *opt_name,
    7117                           const char *opt_value,
    7118                           unsigned flags)
    7119 {
    7120         struct param_opt_struct *new_opt, *opt;
    7121         bool not_added;
    7122 
    7123         if (opt_list == NULL) {
    7124                 return;
    7125         }
    7126 
    7127         opt = *opt_list;
    7128         not_added = true;
    7129 
    7130         /* Traverse destination */
    7131         while (opt) {
    7132                 /* If we already have same option, override it */
    7133                 if (strwicmp(opt->key, opt_name) == 0) {
    7134                         if ((opt->flags & FLAG_CMDLINE) &&
    7135                             !(flags & FLAG_CMDLINE)) {
    7136                                 /* it's been marked as not to be
    7137                                    overridden */
    7138                                 return;
    7139                         }
    7140                         string_free(&opt->value);
    7141                         TALLOC_FREE(opt->list);
    7142                         opt->value = SMB_STRDUP(opt_value);
    7143                         opt->flags = flags;
    7144                         not_added = false;
    7145                         break;
    7146                 }
    7147                 opt = opt->next;
    7148         }
    7149         if (not_added) {
    7150             new_opt = SMB_XMALLOC_P(struct param_opt_struct);
    7151             new_opt->key = SMB_STRDUP(opt_name);
    7152             new_opt->value = SMB_STRDUP(opt_value);
    7153             new_opt->list = NULL;
    7154             new_opt->flags = flags;
    7155             DLIST_ADD(*opt_list, new_opt);
    7156         }
    7157 }
    7158 
    7159 static void copy_service(struct service *pserviceDest, struct service *pserviceSource,
    7160                          struct bitmap *pcopymapDest)
    7161 {
    7162         int i;
    7163         bool bcopyall = (pcopymapDest == NULL);
    7164         struct param_opt_struct *data;
    7165 
    7166         for (i = 0; parm_table[i].label; i++)
    7167                 if (parm_table[i].ptr && parm_table[i].p_class == P_LOCAL &&
    7168                     (bcopyall || bitmap_query(pcopymapDest,i))) {
    7169                         void *def_ptr = parm_table[i].ptr;
    7170                         void *src_ptr =
    7171                                 ((char *)pserviceSource) + PTR_DIFF(def_ptr,
    7172                                                                     &sDefault);
    7173                         void *dest_ptr =
    7174                                 ((char *)pserviceDest) + PTR_DIFF(def_ptr,
    7175                                                                   &sDefault);
    7176 
    7177                         switch (parm_table[i].type) {
    7178                                 case P_BOOL:
    7179                                 case P_BOOLREV:
    7180                                         *(bool *)dest_ptr = *(bool *)src_ptr;
    7181                                         break;
    7182 
    7183                                 case P_INTEGER:
    7184                                 case P_ENUM:
    7185                                 case P_OCTAL:
    7186                                         *(int *)dest_ptr = *(int *)src_ptr;
    7187                                         break;
    7188 
    7189                                 case P_CHAR:
    7190                                         *(char *)dest_ptr = *(char *)src_ptr;
    7191                                         break;
    7192 
    7193                                 case P_STRING:
    7194                                         string_set((char **)dest_ptr,
    7195                                                    *(char **)src_ptr);
    7196                                         break;
    7197 
    7198                                 case P_USTRING:
    7199                                         string_set((char **)dest_ptr,
    7200                                                    *(char **)src_ptr);
    7201                                         strupper_m(*(char **)dest_ptr);
    7202                                         break;
    7203                                 case P_LIST:
    7204                                         TALLOC_FREE(*((char ***)dest_ptr));
    7205                                         *((char ***)dest_ptr) = str_list_copy(NULL,
    7206                                                       *(const char ***)src_ptr);
    7207                                         break;
    7208                                 default:
    7209                                         break;
    7210                         }
    7211                 }
    7212 
    7213         if (bcopyall) {
    7214                 init_copymap(pserviceDest);
    7215                 if (pserviceSource->copymap)
    7216                         bitmap_copy(pserviceDest->copymap,
    7217                                     pserviceSource->copymap);
    7218         }
    7219 
    7220         data = pserviceSource->param_opt;
    7221         while (data) {
    7222                 set_param_opt(&pserviceDest->param_opt, data->key, data->value, data->flags);
    7223                 data = data->next;
    7224         }
    7225 }
    7226 
    7227 /***************************************************************************
    7228 Check a service for consistency. Return False if the service is in any way
    7229 incomplete or faulty, else True.
    7230 ***************************************************************************/
    7231 
    7232 bool service_ok(int iService)
    7233 {
    7234         bool bRetval;
    7235 
    7236         bRetval = True;
    7237         if (ServicePtrs[iService]->szService[0] == '\0') {
    7238                 DEBUG(0, ("The following message indicates an internal error:\n"));
    7239                 DEBUG(0, ("No service name in service entry.\n"));
    7240                 bRetval = False;
    7241         }
    7242 
    7243         /* The [printers] entry MUST be printable. I'm all for flexibility, but */
    7244         /* I can't see why you'd want a non-printable printer service...        */
    7245         if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
    7246                 if (!ServicePtrs[iService]->bPrint_ok) {
    7247                         DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
    7248                                ServicePtrs[iService]->szService));
    7249                         ServicePtrs[iService]->bPrint_ok = True;
    7250                 }
    7251                 /* [printers] service must also be non-browsable. */
    7252                 if (ServicePtrs[iService]->bBrowseable)
    7253                         ServicePtrs[iService]->bBrowseable = False;
    7254         }
    7255 
    7256         if (ServicePtrs[iService]->szPath[0] == '\0' &&
    7257             strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
    7258             ServicePtrs[iService]->szMSDfsProxy[0] == '\0'
    7259             ) {
    7260                 DEBUG(0, ("WARNING: No path in service %s - making it unavailable!\n",
    7261                         ServicePtrs[iService]->szService));
    7262                 ServicePtrs[iService]->bAvailable = False;
    7263         }
    7264 
    7265         /* If a service is flagged unavailable, log the fact at level 1. */
    7266         if (!ServicePtrs[iService]->bAvailable)
    7267                 DEBUG(1, ("NOTE: Service %s is flagged unavailable.\n",
    7268                           ServicePtrs[iService]->szService));
    7269 
    7270         return (bRetval);
     1963/* Return a pointer to a service by name.  Unlike getservicebyname, it does not copy the service */
     1964struct loadparm_service *lp_service(const char *pszServiceName)
     1965{
     1966        int iService = getservicebyname(pszServiceName, NULL);
     1967        if (iService == -1 || !LP_SNUM_OK(iService)) {
     1968                return NULL;
     1969        }
     1970        return ServicePtrs[iService];
     1971}
     1972
     1973struct loadparm_service *lp_servicebynum(int snum)
     1974{
     1975        if ((snum == -1) || !LP_SNUM_OK(snum)) {
     1976                return NULL;
     1977        }
     1978        return ServicePtrs[snum];
     1979}
     1980
     1981struct loadparm_service *lp_default_loadparm_service()
     1982{
     1983        return &sDefault;
    72711984}
    72721985
     
    72972010        }
    72982011
    7299         ret = do_section(service->name, NULL);
     2012        ret = lp_do_section(service->name, NULL);
    73002013        if (ret != true) {
    73012014                return false;
    73022015        }
    73032016        for (count = 0; count < service->num_params; count++) {
    7304                 ret = do_parameter(service->param_names[count],
    7305                                    service->param_values[count],
    7306                                    NULL);
     2017
     2018                if (!bInGlobalSection && bGlobalOnly) {
     2019                        ret = true;
     2020                } else {
     2021                        const char *pszParmName = service->param_names[count];
     2022                        const char *pszParmValue = service->param_values[count];
     2023
     2024                        DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
     2025
     2026                        ret = lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
     2027                                              pszParmName, pszParmValue);
     2028                }
     2029
    73072030                if (ret != true) {
    73082031                        return false;
     
    73102033        }
    73112034        if (iServiceIndex >= 0) {
    7312                 return service_ok(iServiceIndex);
     2035                return lpcfg_service_ok(ServicePtrs[iServiceIndex]);
    73132036        }
    73142037        return true;
     
    73662089        bool ret;
    73672090
    7368         add_to_file_list(INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
    7369 
    7370         ret = do_parameter("registry shares", "yes", NULL);
     2091        add_to_file_list(NULL, &file_lists, INCLUDE_REGISTRY_NAME, INCLUDE_REGISTRY_NAME);
     2092
     2093        if (!bInGlobalSection && bGlobalOnly) {
     2094                ret = true;
     2095        } else {
     2096                const char *pszParmName = "registry shares";
     2097                const char *pszParmValue = "yes";
     2098
     2099                DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
     2100
     2101                ret = lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
     2102                                      pszParmName, pszParmValue);
     2103        }
     2104
    73712105        if (!ret) {
    73722106                return ret;
     
    74482182static uint8_t include_depth;
    74492183
    7450 static struct file_lists {
    7451         struct file_lists *next;
    7452         char *name;
    7453         char *subfname;
    7454         time_t modtime;
    7455 } *file_lists = NULL;
    7456 
    7457 /*******************************************************************
    7458  Keep a linked list of all config files so we know when one has changed
    7459  it's date and needs to be reloaded.
    7460 ********************************************************************/
    7461 
    7462 static void add_to_file_list(const char *fname, const char *subfname)
    7463 {
    7464         struct file_lists *f = file_lists;
    7465 
    7466         while (f) {
    7467                 if (f->name && !strcmp(f->name, fname))
    7468                         break;
    7469                 f = f->next;
    7470         }
    7471 
    7472         if (!f) {
    7473                 f = SMB_MALLOC_P(struct file_lists);
    7474                 if (!f)
    7475                         return;
    7476                 f->next = file_lists;
    7477                 f->name = SMB_STRDUP(fname);
    7478                 if (!f->name) {
    7479                         SAFE_FREE(f);
    7480                         return;
    7481                 }
    7482                 f->subfname = SMB_STRDUP(subfname);
    7483                 if (!f->subfname) {
    7484                         SAFE_FREE(f->name);
    7485                         SAFE_FREE(f);
    7486                         return;
    7487                 }
    7488                 file_lists = f;
    7489                 f->modtime = file_modtime(subfname);
    7490         } else {
    7491                 time_t t = file_modtime(subfname);
    7492                 if (t)
    7493                         f->modtime = t;
    7494         }
    7495         return;
    7496 }
    7497 
    74982184/**
    74992185 * Free the file lists
     
    75072193        while( f ) {
    75082194                next = f->next;
    7509                 SAFE_FREE( f->name );
    7510                 SAFE_FREE( f->subfname );
    7511                 SAFE_FREE( f );
     2195                TALLOC_FREE( f );
    75122196                f = next;
    75132197        }
     
    75432227
    75442228        while (f) {
    7545                 time_t mod_time;
    7546 
    75472229                if (strequal(f->name, INCLUDE_REGISTRY_NAME)) {
    75482230                        struct smbconf_ctx *conf_ctx = lp_smbconf_ctx();
     
    75582240                        }
    75592241                } else {
     2242                        time_t mod_time;
    75602243                        char *n2 = NULL;
     2244
    75612245                        n2 = talloc_sub_basic(talloc_tos(),
    75622246                                              get_current_username(),
     
    75802264                                          ctime(&mod_time)));
    75812265                                f->modtime = mod_time;
    7582                                 SAFE_FREE(f->subfname);
    7583                                 f->subfname = SMB_STRDUP(n2);
     2266                                TALLOC_FREE(f->subfname);
     2267                                f->subfname = talloc_strdup(f, n2);
     2268                                if (f->subfname == NULL) {
     2269                                        smb_panic("talloc_strdup failed");
     2270                                }
    75842271                                TALLOC_FREE(n2);
    75852272                                return true;
     
    75892276                f = f->next;
    75902277        }
    7591         return (False);
    7592 }
    7593 
    7594 
    7595 /***************************************************************************
    7596  Run standard_sub_basic on netbios name... needed because global_myname
    7597  is not accessed through any lp_ macro.
    7598  Note: We must *NOT* use string_set() here as ptr points to global_myname.
    7599 ***************************************************************************/
    7600 
    7601 static bool handle_netbios_name(int snum, const char *pszParmValue, char **ptr)
    7602 {
    7603         bool ret;
    7604         char *netbios_name = talloc_sub_basic(
    7605                 talloc_tos(), get_current_username(), current_user_info.domain,
    7606                 pszParmValue);
    7607 
    7608         ret = set_global_myname(netbios_name);
    7609         TALLOC_FREE(netbios_name);
    7610         string_set(&Globals.szNetbiosName,global_myname());
    7611 
    7612         DEBUG(4, ("handle_netbios_name: set global_myname to: %s\n",
    7613                global_myname()));
    7614 
    7615         return ret;
    7616 }
    7617 
    7618 static bool handle_charset(int snum, const char *pszParmValue, char **ptr)
    7619 {
    7620         if (strcmp(*ptr, pszParmValue) != 0) {
    7621                 string_set(ptr, pszParmValue);
    7622                 init_iconv();
    7623         }
    7624         return True;
    7625 }
    7626 
    7627 static bool handle_dos_charset(int snum, const char *pszParmValue, char **ptr)
    7628 {
    7629         bool is_utf8 = false;
    7630         size_t len = strlen(pszParmValue);
    7631 
    7632         if (len == 4 || len == 5) {
    7633                 /* Don't use StrCaseCmp here as we don't want to
    7634                    initialize iconv. */
    7635                 if ((toupper_m(pszParmValue[0]) == 'U') &&
    7636                     (toupper_m(pszParmValue[1]) == 'T') &&
    7637                     (toupper_m(pszParmValue[2]) == 'F')) {
    7638                         if (len == 4) {
    7639                                 if (pszParmValue[3] == '8') {
    7640                                         is_utf8 = true;
    7641                                 }
    7642                         } else {
    7643                                 if (pszParmValue[3] == '-' &&
    7644                                     pszParmValue[4] == '8') {
    7645                                         is_utf8 = true;
    7646                                 }
    7647                         }
    7648                 }
    7649         }
    7650 
    7651         if (strcmp(*ptr, pszParmValue) != 0) {
    7652                 if (is_utf8) {
    7653                         DEBUG(0,("ERROR: invalid DOS charset: 'dos charset' must not "
    7654                                 "be UTF8, using (default value) %s instead.\n",
    7655                                 DEFAULT_DOS_CHARSET));
    7656                         pszParmValue = DEFAULT_DOS_CHARSET;
    7657                 }
    7658                 string_set(ptr, pszParmValue);
    7659                 init_iconv();
    7660         }
    7661         return True;
    7662 }
    7663 
    7664 
    7665 
    7666 static bool handle_workgroup(int snum, const char *pszParmValue, char **ptr)
    7667 {
    7668         bool ret;
    7669 
    7670         ret = set_global_myworkgroup(pszParmValue);
    7671         string_set(&Globals.szWorkgroup,lp_workgroup());
    7672 
    7673         return ret;
    7674 }
    7675 
    7676 static bool handle_netbios_scope(int snum, const char *pszParmValue, char **ptr)
    7677 {
    7678         bool ret;
    7679 
    7680         ret = set_global_scope(pszParmValue);
    7681         string_set(&Globals.szNetbiosScope,global_scope());
    7682 
    7683         return ret;
    7684 }
    7685 
    7686 static bool handle_netbios_aliases(int snum, const char *pszParmValue, char **ptr)
    7687 {
    7688         TALLOC_FREE(Globals.szNetbiosAliases);
    7689         Globals.szNetbiosAliases = str_list_make_v3(NULL, pszParmValue, NULL);
    7690         return set_netbios_aliases((const char **)Globals.szNetbiosAliases);
     2278        return false;
     2279}
     2280
     2281
     2282/**
     2283 * Initialize iconv conversion descriptors.
     2284 *
     2285 * This is called the first time it is needed, and also called again
     2286 * every time the configuration is reloaded, because the charset or
     2287 * codepage might have changed.
     2288 **/
     2289static void init_iconv(void)
     2290{
     2291        global_iconv_handle = smb_iconv_handle_reinit(NULL, lp_dos_charset(),
     2292                                                      lp_unix_charset(),
     2293                                                      true, global_iconv_handle);
    76912294}
    76922295
     
    76962299static bool bAllowIncludeRegistry = true;
    76972300
    7698 static bool handle_include(int snum, const char *pszParmValue, char **ptr)
     2301bool lp_include(struct loadparm_context *lp_ctx, struct loadparm_service *service,
     2302                const char *pszParmValue, char **ptr)
    76992303{
    77002304        char *fname;
     
    77102314                        return true;
    77112315                }
    7712                 if (bInGlobalSection) {
     2316                if (lp_ctx->bInGlobalSection) {
    77132317                        bool ret;
    77142318                        include_depth++;
     
    77272331                                 pszParmValue);
    77282332
    7729         add_to_file_list(pszParmValue, fname);
    7730 
    7731         string_set(ptr, fname);
     2333        add_to_file_list(NULL, &file_lists, pszParmValue, fname);
     2334
     2335        if (service == NULL) {
     2336                lpcfg_string_set(Globals.ctx, ptr, fname);
     2337        } else {
     2338                lpcfg_string_set(service, ptr, fname);
     2339        }
    77322340
    77332341        if (file_exist(fname)) {
    77342342                bool ret;
    77352343                include_depth++;
    7736                 ret = pm_process(fname, do_section, do_parameter, NULL);
     2344                ret = pm_process(fname, lp_do_section, do_parameter, lp_ctx);
    77372345                include_depth--;
    77382346                TALLOC_FREE(fname);
     
    77452353}
    77462354
    7747 /***************************************************************************
    7748  Handle the interpretation of the copy parameter.
    7749 ***************************************************************************/
    7750 
    7751 static bool handle_copy(int snum, const char *pszParmValue, char **ptr)
    7752 {
    7753         bool bRetval;
    7754         int iTemp;
    7755         struct service serviceTemp;
    7756 
    7757         string_set(ptr, pszParmValue);
    7758 
    7759         init_service(&serviceTemp);
    7760 
    7761         bRetval = False;
    7762 
    7763         DEBUG(3, ("Copying service from service %s\n", pszParmValue));
    7764 
    7765         if ((iTemp = getservicebyname(pszParmValue, &serviceTemp)) >= 0) {
    7766                 if (iTemp == iServiceIndex) {
    7767                         DEBUG(0, ("Can't copy service %s - unable to copy self!\n", pszParmValue));
    7768                 } else {
    7769                         copy_service(ServicePtrs[iServiceIndex],
    7770                                      &serviceTemp,
    7771                                      ServicePtrs[iServiceIndex]->copymap);
    7772                         bRetval = True;
    7773                 }
    7774         } else {
    7775                 DEBUG(0, ("Unable to copy service - source not found: %s\n", pszParmValue));
    7776                 bRetval = False;
    7777         }
    7778 
    7779         free_service(&serviceTemp);
    7780         return (bRetval);
    7781 }
    7782 
    7783 static bool handle_ldap_debug_level(int snum, const char *pszParmValue, char **ptr)
    7784 {
    7785         Globals.ldap_debug_level = lp_int(pszParmValue);
    7786         init_ldap_debugging();
    7787         return true;
    7788 }
    7789 
    7790 /***************************************************************************
    7791  Handle idmap/non unix account uid and gid allocation parameters.  The format of these
    7792  parameters is:
    7793 
    7794  [global]
    7795 
    7796         idmap uid = 1000-1999
    7797         idmap gid = 700-899
    7798 
    7799  We only do simple parsing checks here.  The strings are parsed into useful
    7800  structures in the idmap daemon code.
    7801 
    7802 ***************************************************************************/
    7803 
    7804 /* Some lp_ routines to return idmap [ug]id information */
    7805 
    7806 static uid_t idmap_uid_low, idmap_uid_high;
    7807 static gid_t idmap_gid_low, idmap_gid_high;
    7808 
    7809 bool lp_idmap_uid(uid_t *low, uid_t *high)
    7810 {
    7811         if (idmap_uid_low == 0 || idmap_uid_high == 0)
    7812                 return False;
    7813 
    7814         if (low)
    7815                 *low = idmap_uid_low;
    7816 
    7817         if (high)
    7818                 *high = idmap_uid_high;
    7819 
    7820         return True;
    7821 }
    7822 
    7823 bool lp_idmap_gid(gid_t *low, gid_t *high)
    7824 {
    7825         if (idmap_gid_low == 0 || idmap_gid_high == 0)
    7826                 return False;
    7827 
    7828         if (low)
    7829                 *low = idmap_gid_low;
    7830 
    7831         if (high)
    7832                 *high = idmap_gid_high;
    7833 
    7834         return True;
    7835 }
    7836 
    7837 static bool handle_idmap_backend(int snum, const char *pszParmValue, char **ptr)
    7838 {
    7839         lp_do_parameter(snum, "idmap config * : backend", pszParmValue);
    7840 
    7841         return true;
    7842 }
    7843 
    7844 /* Do some simple checks on "idmap [ug]id" parameter values */
    7845 
    7846 static bool handle_idmap_uid(int snum, const char *pszParmValue, char **ptr)
    7847 {
    7848         lp_do_parameter(snum, "idmap config * : range", pszParmValue);
    7849 
    7850         return True;
    7851 }
    7852 
    7853 static bool handle_idmap_gid(int snum, const char *pszParmValue, char **ptr)
    7854 {
    7855         lp_do_parameter(snum, "idmap config * : range", pszParmValue);
    7856 
    7857         return True;
    7858 }
    7859 
    7860 /***************************************************************************
    7861  Handle the DEBUG level list.
    7862 ***************************************************************************/
    7863 
    7864 static bool handle_debug_list( int snum, const char *pszParmValueIn, char **ptr )
    7865 {
    7866         string_set(ptr, pszParmValueIn);
    7867         return debug_parse_levels(pszParmValueIn);
     2355bool lp_idmap_range(const char *domain_name, uint32_t *low, uint32_t *high)
     2356{
     2357        char *config_option = NULL;
     2358        const char *range = NULL;
     2359        bool ret = false;
     2360
     2361        SMB_ASSERT(low != NULL);
     2362        SMB_ASSERT(high != NULL);
     2363
     2364        if ((domain_name == NULL) || (domain_name[0] == '\0')) {
     2365                domain_name = "*";
     2366        }
     2367
     2368        config_option = talloc_asprintf(talloc_tos(), "idmap config %s",
     2369                                        domain_name);
     2370        if (config_option == NULL) {
     2371                DEBUG(0, ("out of memory\n"));
     2372                return false;
     2373        }
     2374
     2375        range = lp_parm_const_string(-1, config_option, "range", NULL);
     2376        if (range == NULL) {
     2377                DEBUG(1, ("idmap range not specified for domain '%s'\n", domain_name));
     2378                goto done;
     2379        }
     2380
     2381        if (sscanf(range, "%u - %u", low, high) != 2) {
     2382                DEBUG(1, ("error parsing idmap range '%s' for domain '%s'\n",
     2383                          range, domain_name));
     2384                goto done;
     2385        }
     2386
     2387        ret = true;
     2388
     2389done:
     2390        talloc_free(config_option);
     2391        return ret;
     2392
     2393}
     2394
     2395bool lp_idmap_default_range(uint32_t *low, uint32_t *high)
     2396{
     2397        return lp_idmap_range("*", low, high);
     2398}
     2399
     2400const char *lp_idmap_backend(const char *domain_name)
     2401{
     2402        char *config_option = NULL;
     2403        const char *backend = NULL;
     2404
     2405        if ((domain_name == NULL) || (domain_name[0] == '\0')) {
     2406                domain_name = "*";
     2407        }
     2408
     2409        config_option = talloc_asprintf(talloc_tos(), "idmap config %s",
     2410                                        domain_name);
     2411        if (config_option == NULL) {
     2412                DEBUG(0, ("out of memory\n"));
     2413                return false;
     2414        }
     2415
     2416        backend = lp_parm_const_string(-1, config_option, "backend", NULL);
     2417        if (backend == NULL) {
     2418                DEBUG(1, ("idmap backend not specified for domain '%s'\n", domain_name));
     2419                goto done;
     2420        }
     2421
     2422done:
     2423        talloc_free(config_option);
     2424        return backend;
     2425}
     2426
     2427const char *lp_idmap_default_backend(void)
     2428{
     2429        return lp_idmap_backend("*");
    78682430}
    78692431
     
    78722434***************************************************************************/
    78732435
    7874 static const char *append_ldap_suffix( const char *str )
     2436static const char *append_ldap_suffix(TALLOC_CTX *ctx, const char *str )
    78752437{
    78762438        const char *suffix_string;
    78772439
    7878 
    7879         suffix_string = talloc_asprintf(talloc_tos(), "%s,%s", str,
    7880                                         Globals.szLdapSuffix );
     2440        suffix_string = talloc_asprintf(ctx, "%s,%s", str,
     2441                                        Globals.ldap_suffix );
    78812442        if ( !suffix_string ) {
    78822443                DEBUG(0,("append_ldap_suffix: talloc_asprintf() failed!\n"));
     
    78872448}
    78882449
    7889 const char *lp_ldap_machine_suffix(void)
    7890 {
    7891         if (Globals.szLdapMachineSuffix[0])
    7892                 return append_ldap_suffix(Globals.szLdapMachineSuffix);
    7893 
    7894         return lp_string(Globals.szLdapSuffix);
    7895 }
    7896 
    7897 const char *lp_ldap_user_suffix(void)
    7898 {
    7899         if (Globals.szLdapUserSuffix[0])
    7900                 return append_ldap_suffix(Globals.szLdapUserSuffix);
    7901 
    7902         return lp_string(Globals.szLdapSuffix);
    7903 }
    7904 
    7905 const char *lp_ldap_group_suffix(void)
    7906 {
    7907         if (Globals.szLdapGroupSuffix[0])
    7908                 return append_ldap_suffix(Globals.szLdapGroupSuffix);
    7909 
    7910         return lp_string(Globals.szLdapSuffix);
    7911 }
    7912 
    7913 const char *lp_ldap_idmap_suffix(void)
    7914 {
    7915         if (Globals.szLdapIdmapSuffix[0])
    7916                 return append_ldap_suffix(Globals.szLdapIdmapSuffix);
    7917 
    7918         return lp_string(Globals.szLdapSuffix);
    7919 }
    7920 
    7921 /****************************************************************************
    7922  set the value for a P_ENUM
    7923  ***************************************************************************/
    7924 
    7925 static void lp_set_enum_parm( struct parm_struct *parm, const char *pszParmValue,
    7926                               int *ptr )
    7927 {
    7928         int i;
    7929 
    7930         for (i = 0; parm->enum_list[i].name; i++) {
    7931                 if ( strequal(pszParmValue, parm->enum_list[i].name)) {
    7932                         *ptr = parm->enum_list[i].value;
    7933                         return;
    7934                 }
    7935         }
    7936         DEBUG(0, ("WARNING: Ignoring invalid value '%s' for parameter '%s'\n",
    7937                   pszParmValue, parm->label));
    7938 }
    7939 
    7940 /***************************************************************************
    7941 ***************************************************************************/
    7942 
    7943 static bool handle_printing(int snum, const char *pszParmValue, char **ptr)
    7944 {
    7945         static int parm_num = -1;
    7946         struct service *s;
    7947 
    7948         if ( parm_num == -1 )
    7949                 parm_num = map_parameter( "printing" );
    7950 
    7951         lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
    7952 
    7953         if ( snum < 0 )
    7954                 s = &sDefault;
    7955         else
    7956                 s = ServicePtrs[snum];
    7957 
    7958         init_printer_values( s );
    7959 
    7960         return True;
    7961 }
    7962 
    7963 
    7964 /***************************************************************************
    7965  Initialise a copymap.
    7966 ***************************************************************************/
    7967 
    7968 static void init_copymap(struct service *pservice)
    7969 {
    7970         int i;
    7971 
    7972         TALLOC_FREE(pservice->copymap);
    7973 
    7974         pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
    7975         if (!pservice->copymap)
    7976                 DEBUG(0,
    7977                       ("Couldn't allocate copymap!! (size %d)\n",
    7978                        (int)NUMPARAMETERS));
    7979         else
    7980                 for (i = 0; i < NUMPARAMETERS; i++)
    7981                         bitmap_set(pservice->copymap, i);
    7982 }
    7983 
    7984 /***************************************************************************
    7985  Return the local pointer to a parameter given a service struct and the
    7986  pointer into the default structure.
    7987 ***************************************************************************/
    7988 
    7989 static void *lp_local_ptr(struct service *service, void *ptr)
    7990 {
    7991         return (void *)(((char *)service) + PTR_DIFF(ptr, &sDefault));
    7992 }
    7993 
    7994 /***************************************************************************
    7995  Return the local pointer to a parameter given the service number and the
    7996  pointer into the default structure.
    7997 ***************************************************************************/
    7998 
    7999 void *lp_local_ptr_by_snum(int snum, void *ptr)
    8000 {
    8001         return lp_local_ptr(ServicePtrs[snum], ptr);
     2450const char *lp_ldap_machine_suffix(TALLOC_CTX *ctx)
     2451{
     2452        if (Globals._ldap_machine_suffix[0])
     2453                return append_ldap_suffix(ctx, Globals._ldap_machine_suffix);
     2454
     2455        return lp_string(ctx, Globals.ldap_suffix);
     2456}
     2457
     2458const char *lp_ldap_user_suffix(TALLOC_CTX *ctx)
     2459{
     2460        if (Globals._ldap_user_suffix[0])
     2461                return append_ldap_suffix(ctx, Globals._ldap_user_suffix);
     2462
     2463        return lp_string(ctx, Globals.ldap_suffix);
     2464}
     2465
     2466const char *lp_ldap_group_suffix(TALLOC_CTX *ctx)
     2467{
     2468        if (Globals._ldap_group_suffix[0])
     2469                return append_ldap_suffix(ctx, Globals._ldap_group_suffix);
     2470
     2471        return lp_string(ctx, Globals.ldap_suffix);
     2472}
     2473
     2474const char *lp_ldap_idmap_suffix(TALLOC_CTX *ctx)
     2475{
     2476        if (Globals._ldap_idmap_suffix[0])
     2477                return append_ldap_suffix(ctx, Globals._ldap_idmap_suffix);
     2478
     2479        return lp_string(ctx, Globals.ldap_suffix);
     2480}
     2481
     2482/**
     2483  return the parameter pointer for a parameter
     2484*/
     2485void *lp_parm_ptr(struct loadparm_service *service, struct parm_struct *parm)
     2486{
     2487        if (service == NULL) {
     2488                if (parm->p_class == P_LOCAL)
     2489                        return (void *)(((char *)&sDefault)+parm->offset);
     2490                else if (parm->p_class == P_GLOBAL)
     2491                        return (void *)(((char *)&Globals)+parm->offset);
     2492                else return NULL;
     2493        } else {
     2494                return (void *)(((char *)service) + parm->offset);
     2495        }
    80022496}
    80032497
     
    80092503bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue)
    80102504{
    8011         int parmnum, i;
    8012         void *parm_ptr = NULL;  /* where we are going to store the result */
    8013         void *def_ptr = NULL;
    8014         struct param_opt_struct **opt_list;
    8015 
    8016         parmnum = map_parameter(pszParmName);
    8017 
    8018         if (parmnum < 0) {
    8019                 if (strchr(pszParmName, ':') == NULL) {
    8020                         DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",
    8021                                   pszParmName));
    8022                         return (True);
    8023                 }
    8024 
    8025                 /*
    8026                  * We've got a parametric option
    8027                  */
    8028 
    8029                 opt_list = (snum < 0)
    8030                         ? &Globals.param_opt : &ServicePtrs[snum]->param_opt;
    8031                 set_param_opt(opt_list, pszParmName, pszParmValue, 0);
    8032 
    8033                 return (True);
    8034         }
    8035 
    8036         /* if it's already been set by the command line, then we don't
    8037            override here */
    8038         if (parm_table[parmnum].flags & FLAG_CMDLINE) {
    8039                 return true;
    8040         }
    8041 
    8042         if (parm_table[parmnum].flags & FLAG_DEPRECATED) {
    8043                 DEBUG(1, ("WARNING: The \"%s\" option is deprecated\n",
    8044                           pszParmName));
    8045         }
    8046 
    8047         def_ptr = parm_table[parmnum].ptr;
    8048 
    8049         /* we might point at a service, the default service or a global */
     2505        TALLOC_CTX *frame = talloc_stackframe();
     2506        struct loadparm_context *lp_ctx;
     2507        bool ok;
     2508
     2509        lp_ctx = setup_lp_context(frame);
     2510        if (lp_ctx == NULL) {
     2511                TALLOC_FREE(frame);
     2512                return false;
     2513        }
     2514
    80502515        if (snum < 0) {
    8051                 parm_ptr = def_ptr;
     2516                ok = lpcfg_do_global_parameter(lp_ctx, pszParmName, pszParmValue);
    80522517        } else {
    8053                 if (parm_table[parmnum].p_class == P_GLOBAL) {
    8054                         DEBUG(0,
    8055                               ("Global parameter %s found in service section!\n",
    8056                                pszParmName));
    8057                         return (True);
    8058                 }
    8059                 parm_ptr = lp_local_ptr_by_snum(snum, def_ptr);
    8060         }
    8061 
    8062         if (snum >= 0) {
    8063                 if (!ServicePtrs[snum]->copymap)
    8064                         init_copymap(ServicePtrs[snum]);
    8065 
    8066                 /* this handles the aliases - set the copymap for other entries with
    8067                    the same data pointer */
    8068                 for (i = 0; parm_table[i].label; i++)
    8069                         if (parm_table[i].ptr == parm_table[parmnum].ptr)
    8070                                 bitmap_clear(ServicePtrs[snum]->copymap, i);
    8071         }
    8072 
    8073         /* if it is a special case then go ahead */
    8074         if (parm_table[parmnum].special) {
    8075                 return parm_table[parmnum].special(snum, pszParmValue,
    8076                                                    (char **)parm_ptr);
    8077         }
    8078 
    8079         /* now switch on the type of variable it is */
    8080         switch (parm_table[parmnum].type)
    8081         {
    8082                 case P_BOOL:
    8083                         *(bool *)parm_ptr = lp_bool(pszParmValue);
    8084                         break;
    8085 
    8086                 case P_BOOLREV:
    8087                         *(bool *)parm_ptr = !lp_bool(pszParmValue);
    8088                         break;
    8089 
    8090                 case P_INTEGER:
    8091                         *(int *)parm_ptr = lp_int(pszParmValue);
    8092                         break;
    8093 
    8094                 case P_CHAR:
    8095                         *(char *)parm_ptr = *pszParmValue;
    8096                         break;
    8097 
    8098                 case P_OCTAL:
    8099                         i = sscanf(pszParmValue, "%o", (int *)parm_ptr);
    8100                         if ( i != 1 ) {
    8101                             DEBUG ( 0, ("Invalid octal number %s\n", pszParmName ));
    8102                         }
    8103                         break;
    8104 
    8105                 case P_LIST:
    8106                         TALLOC_FREE(*((char ***)parm_ptr));
    8107                         *(char ***)parm_ptr = str_list_make_v3(
    8108                                 NULL, pszParmValue, NULL);
    8109                         break;
    8110 
    8111                 case P_STRING:
    8112                         string_set((char **)parm_ptr, pszParmValue);
    8113                         break;
    8114 
    8115                 case P_USTRING:
    8116                         string_set((char **)parm_ptr, pszParmValue);
    8117                         strupper_m(*(char **)parm_ptr);
    8118                         break;
    8119 
    8120                 case P_ENUM:
    8121                         lp_set_enum_parm( &parm_table[parmnum], pszParmValue, (int*)parm_ptr );
    8122                         break;
    8123                 case P_SEP:
    8124                         break;
    8125         }
    8126 
    8127         return (True);
     2518                ok = lpcfg_do_service_parameter(lp_ctx, ServicePtrs[snum],
     2519                                                pszParmName, pszParmValue);
     2520        }
     2521
     2522        TALLOC_FREE(frame);
     2523
     2524        return ok;
    81282525}
    81292526
     
    81332530***************************************************************************/
    81342531
    8135 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
     2532static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue)
    81362533{
    81372534        int parmnum, i;
    8138         parmnum = map_parameter(pszParmName);
     2535        parmnum = lpcfg_map_parameter(pszParmName);
    81392536        if (parmnum >= 0) {
    8140                 parm_table[parmnum].flags &= ~FLAG_CMDLINE;
     2537                flags_list[parmnum] &= ~FLAG_CMDLINE;
    81412538                if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
    81422539                        return false;
    81432540                }
    8144                 parm_table[parmnum].flags |= FLAG_CMDLINE;
     2541                flags_list[parmnum] |= FLAG_CMDLINE;
    81452542
    81462543                /* we have to also set FLAG_CMDLINE on aliases.  Aliases must
    81472544                 * be grouped in the table, so we don't have to search the
    81482545                 * whole table */
    8149                 for (i=parmnum-1;i>=0 && parm_table[i].ptr == parm_table[parmnum].ptr;i--) {
    8150                         parm_table[i].flags |= FLAG_CMDLINE;
    8151                 }
    8152                 for (i=parmnum+1;i<NUMPARAMETERS && parm_table[i].ptr == parm_table[parmnum].ptr;i++) {
    8153                         parm_table[i].flags |= FLAG_CMDLINE;
    8154                 }
    8155 
    8156                 if (store_values) {
    8157                         store_lp_set_cmdline(pszParmName, pszParmValue);
    8158                 }
     2546                for (i=parmnum-1;
     2547                     i>=0 && parm_table[i].offset == parm_table[parmnum].offset
     2548                             && parm_table[i].p_class == parm_table[parmnum].p_class;
     2549                     i--) {
     2550                        flags_list[i] |= FLAG_CMDLINE;
     2551                }
     2552                for (i=parmnum+1;i<num_parameters() && parm_table[i].offset == parm_table[parmnum].offset
     2553                             && parm_table[i].p_class == parm_table[parmnum].p_class;i++) {
     2554                        flags_list[i] |= FLAG_CMDLINE;
     2555                }
     2556
    81592557                return true;
    81602558        }
     
    81622560        /* it might be parametric */
    81632561        if (strchr(pszParmName, ':') != NULL) {
    8164                 set_param_opt(&Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
    8165                 if (store_values) {
    8166                         store_lp_set_cmdline(pszParmName, pszParmValue);
    8167                 }
     2562                set_param_opt(NULL, &Globals.param_opt, pszParmName, pszParmValue, FLAG_CMDLINE);
    81682563                return true;
    81692564        }
    81702565
    81712566        DEBUG(0, ("Ignoring unknown parameter \"%s\"\n",  pszParmName));
    8172         return true;
     2567        return false;
    81732568}
    81742569
    81752570bool lp_set_cmdline(const char *pszParmName, const char *pszParmValue)
    81762571{
    8177         return lp_set_cmdline_helper(pszParmName, pszParmValue, true);
     2572        bool ret;
     2573        TALLOC_CTX *frame = talloc_stackframe();
     2574        struct loadparm_context *lp_ctx;
     2575
     2576        lp_ctx = setup_lp_context(frame);
     2577        if (lp_ctx == NULL) {
     2578                TALLOC_FREE(frame);
     2579                return false;
     2580        }
     2581
     2582        ret = lpcfg_set_cmdline(lp_ctx, pszParmName, pszParmValue);
     2583
     2584        TALLOC_FREE(frame);
     2585        return ret;
    81782586}
    81792587
     
    81862594{
    81872595        if (!bInGlobalSection && bGlobalOnly)
    8188                 return (True);
     2596                return true;
    81892597
    81902598        DEBUGADD(4, ("doing parameter %s = %s\n", pszParmName, pszParmValue));
    81912599
    8192         return (lp_do_parameter(bInGlobalSection ? -2 : iServiceIndex,
    8193                                 pszParmName, pszParmValue));
    8194 }
    8195 
    8196 /*
    8197   set a option from the commandline in 'a=b' format. Use to support --option
    8198 */
    8199 bool lp_set_option(const char *option)
    8200 {
    8201         char *p, *s;
    8202         bool ret;
    8203 
    8204         s = talloc_strdup(NULL, option);
    8205         if (!s) {
    8206                 return false;
    8207         }
    8208 
    8209         p = strchr(s, '=');
    8210         if (!p) {
    8211                 talloc_free(s);
    8212                 return false;
    8213         }
    8214 
    8215         *p = 0;
    8216 
    8217         /* skip white spaces after the = sign */
    8218         do {
    8219                 p++;
    8220         } while (*p == ' ');
    8221 
    8222         ret = lp_set_cmdline(s, p);
    8223         talloc_free(s);
    8224         return ret;
    8225 }
    8226 
    8227 /**************************************************************************
    8228  Print a parameter of the specified type.
    8229 ***************************************************************************/
    8230 
    8231 static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
    8232 {
    8233         int i;
    8234         switch (p->type)
    8235         {
    8236                 case P_ENUM:
    8237                         for (i = 0; p->enum_list[i].name; i++) {
    8238                                 if (*(int *)ptr == p->enum_list[i].value) {
    8239                                         fprintf(f, "%s",
    8240                                                 p->enum_list[i].name);
    8241                                         break;
    8242                                 }
     2600        if (bInGlobalSection) {
     2601                return lpcfg_do_global_parameter(userdata, pszParmName, pszParmValue);
     2602        } else {
     2603                return lpcfg_do_service_parameter(userdata, ServicePtrs[iServiceIndex],
     2604                                                  pszParmName, pszParmValue);
     2605        }
     2606}
     2607
     2608/***************************************************************************
     2609 Initialize any local variables in the sDefault table, after parsing a
     2610 [globals] section.
     2611***************************************************************************/
     2612
     2613static void init_locals(void)
     2614{
     2615        /*
     2616         * We run this check once the [globals] is parsed, to force
     2617         * the VFS objects and other per-share settings we need for
     2618         * the standard way a AD DC is operated.  We may change these
     2619         * as our code evolves, which is why we force these settings.
     2620         *
     2621         * We can't do this at the end of lp_load_ex(), as by that
     2622         * point the services have been loaded and they will already
     2623         * have "" as their vfs objects.
     2624         */
     2625        if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC) {
     2626                const char **vfs_objects = lp_vfs_objects(-1);
     2627                if (!vfs_objects || !vfs_objects[0]) {
     2628                        if (lp_parm_const_string(-1, "xattr_tdb", "file", NULL)) {
     2629                                lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr xattr_tdb");
     2630                        } else if (lp_parm_const_string(-1, "posix", "eadb", NULL)) {
     2631                                lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr posix_eadb");
     2632                        } else {
     2633                                lp_do_parameter(-1, "vfs objects", "dfs_samba4 acl_xattr");
    82432634                        }
    8244                         break;
    8245 
    8246                 case P_BOOL:
    8247                         fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
    8248                         break;
    8249 
    8250                 case P_BOOLREV:
    8251                         fprintf(f, "%s", BOOLSTR(!*(bool *)ptr));
    8252                         break;
    8253 
    8254                 case P_INTEGER:
    8255                         fprintf(f, "%d", *(int *)ptr);
    8256                         break;
    8257 
    8258                 case P_CHAR:
    8259                         fprintf(f, "%c", *(char *)ptr);
    8260                         break;
    8261 
    8262                 case P_OCTAL: {
    8263                         char *o = octal_string(*(int *)ptr);
    8264                         fprintf(f, "%s", o);
    8265                         TALLOC_FREE(o);
    8266                         break;
    8267                 }
    8268 
    8269                 case P_LIST:
    8270                         if ((char ***)ptr && *(char ***)ptr) {
    8271                                 char **list = *(char ***)ptr;
    8272                                 for (; *list; list++) {
    8273                                         /* surround strings with whitespace in double quotes */
    8274                                         if ( strchr_m( *list, ' ' ) )
    8275                                                 fprintf(f, "\"%s\"%s", *list, ((*(list+1))?", ":""));
    8276                                         else
    8277                                                 fprintf(f, "%s%s", *list, ((*(list+1))?", ":""));
    8278                                 }
    8279                         }
    8280                         break;
    8281 
    8282                 case P_STRING:
    8283                 case P_USTRING:
    8284                         if (*(char **)ptr) {
    8285                                 fprintf(f, "%s", *(char **)ptr);
    8286                         }
    8287                         break;
    8288                 case P_SEP:
    8289                         break;
    8290         }
    8291 }
    8292 
    8293 /***************************************************************************
    8294  Check if two parameters are equal.
    8295 ***************************************************************************/
    8296 
    8297 static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
    8298 {
    8299         switch (type) {
    8300                 case P_BOOL:
    8301                 case P_BOOLREV:
    8302                         return (*((bool *)ptr1) == *((bool *)ptr2));
    8303 
    8304                 case P_INTEGER:
    8305                 case P_ENUM:
    8306                 case P_OCTAL:
    8307                         return (*((int *)ptr1) == *((int *)ptr2));
    8308 
    8309                 case P_CHAR:
    8310                         return (*((char *)ptr1) == *((char *)ptr2));
    8311 
    8312                 case P_LIST:
    8313                         return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
    8314 
    8315                 case P_STRING:
    8316                 case P_USTRING:
    8317                 {
    8318                         char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
    8319                         if (p1 && !*p1)
    8320                                 p1 = NULL;
    8321                         if (p2 && !*p2)
    8322                                 p2 = NULL;
    8323                         return (p1 == p2 || strequal(p1, p2));
    8324                 }
    8325                 case P_SEP:
    8326                         break;
    8327         }
    8328         return (False);
    8329 }
    8330 
    8331 /***************************************************************************
    8332  Initialize any local varients in the sDefault table.
    8333 ***************************************************************************/
    8334 
    8335 void init_locals(void)
    8336 {
    8337         /* None as yet. */
     2635                }
     2636
     2637                lp_do_parameter(-1, "map hidden", "no");
     2638                lp_do_parameter(-1, "map system", "no");
     2639                lp_do_parameter(-1, "map readonly", "no");
     2640                lp_do_parameter(-1, "map archive", "no");
     2641                lp_do_parameter(-1, "store dos attributes", "yes");
     2642        }
    83382643}
    83392644
     
    83412646 Process a new section (service). At this stage all sections are services.
    83422647 Later we'll have special sections that permit server parameters to be set.
    8343  Returns True on success, False on failure.
    8344 ***************************************************************************/
    8345 
    8346 static bool do_section(const char *pszSectionName, void *userdata)
    8347 {
     2648 Returns true on success, false on failure.
     2649***************************************************************************/
     2650
     2651bool lp_do_section(const char *pszSectionName, void *userdata)
     2652{
     2653        struct loadparm_context *lp_ctx = (struct loadparm_context *)userdata;
    83482654        bool bRetval;
    83492655        bool isglobal = ((strwicmp(pszSectionName, GLOBAL_NAME) == 0) ||
    83502656                         (strwicmp(pszSectionName, GLOBAL_NAME2) == 0));
    8351         bRetval = False;
     2657        bRetval = false;
    83522658
    83532659        /* if we were in a global section then do the local inits */
     
    83572663        /* if we've just struck a global section, note the fact. */
    83582664        bInGlobalSection = isglobal;
     2665        if (lp_ctx != NULL) {
     2666                lp_ctx->bInGlobalSection = isglobal;
     2667        }
    83592668
    83602669        /* check for multiple global sections */
    83612670        if (bInGlobalSection) {
    83622671                DEBUG(3, ("Processing section \"[%s]\"\n", pszSectionName));
    8363                 return (True);
     2672                return true;
    83642673        }
    83652674
    83662675        if (!bInGlobalSection && bGlobalOnly)
    8367                 return (True);
     2676                return true;
    83682677
    83692678        /* if we have a current service, tidy it up before moving on */
    8370         bRetval = True;
     2679        bRetval = true;
    83712680
    83722681        if (iServiceIndex >= 0)
    8373                 bRetval = service_ok(iServiceIndex);
     2682                bRetval = lpcfg_service_ok(ServicePtrs[iServiceIndex]);
    83742683
    83752684        /* if all is still well, move to the next record in the services array */
     
    83792688                DEBUG(2, ("Processing section \"[%s]\"\n", pszSectionName));
    83802689
    8381                 if ((iServiceIndex = add_a_service(&sDefault, pszSectionName))
    8382                     < 0) {
     2690                iServiceIndex = add_a_service(&sDefault, pszSectionName);
     2691                if (iServiceIndex < 0) {
    83832692                        DEBUG(0, ("Failed to add a new service\n"));
    8384                         return (False);
     2693                        return false;
    83852694                }
    83862695                /* Clean all parametric options for service */
     
    83892698        }
    83902699
    8391         return (bRetval);
    8392 }
    8393 
    8394 
    8395 /***************************************************************************
    8396  Determine if a partcular base parameter is currentl set to the default value.
    8397 ***************************************************************************/
    8398 
    8399 static bool is_default(int i)
    8400 {
    8401         if (!defaults_saved)
    8402                 return False;
    8403         switch (parm_table[i].type) {
    8404                 case P_LIST:
    8405                         return str_list_equal((const char **)parm_table[i].def.lvalue,
    8406                                                 *(const char ***)parm_table[i].ptr);
    8407                 case P_STRING:
    8408                 case P_USTRING:
    8409                         return strequal(parm_table[i].def.svalue,
    8410                                         *(char **)parm_table[i].ptr);
    8411                 case P_BOOL:
    8412                 case P_BOOLREV:
    8413                         return parm_table[i].def.bvalue ==
    8414                                 *(bool *)parm_table[i].ptr;
    8415                 case P_CHAR:
    8416                         return parm_table[i].def.cvalue ==
    8417                                 *(char *)parm_table[i].ptr;
    8418                 case P_INTEGER:
    8419                 case P_OCTAL:
    8420                 case P_ENUM:
    8421                         return parm_table[i].def.ivalue ==
    8422                                 *(int *)parm_table[i].ptr;
    8423                 case P_SEP:
    8424                         break;
    8425         }
    8426         return False;
    8427 }
    8428 
    8429 /***************************************************************************
    8430 Display the contents of the global structure.
    8431 ***************************************************************************/
    8432 
    8433 static void dump_globals(FILE *f)
    8434 {
    8435         int i;
    8436         struct param_opt_struct *data;
    8437 
    8438         fprintf(f, "[global]\n");
    8439 
    8440         for (i = 0; parm_table[i].label; i++)
    8441                 if (parm_table[i].p_class == P_GLOBAL &&
    8442                     !(parm_table[i].flags & FLAG_META) &&
    8443                     parm_table[i].ptr &&
    8444                     (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr))) {
    8445                         if (defaults_saved && is_default(i))
    8446                                 continue;
    8447                         fprintf(f, "\t%s = ", parm_table[i].label);
    8448                         print_parameter(&parm_table[i], parm_table[i].ptr, f);
    8449                         fprintf(f, "\n");
    8450         }
    8451         if (Globals.param_opt != NULL) {
    8452                 data = Globals.param_opt;
    8453                 while(data) {
    8454                         fprintf(f, "\t%s = %s\n", data->key, data->value);
    8455                         data = data->next;
    8456                 }
    8457         }
    8458 
    8459 }
    8460 
    8461 /***************************************************************************
    8462  Return True if a local parameter is currently set to the global default.
    8463 ***************************************************************************/
    8464 
    8465 bool lp_is_default(int snum, struct parm_struct *parm)
    8466 {
    8467         int pdiff = PTR_DIFF(parm->ptr, &sDefault);
    8468 
    8469         return equal_parameter(parm->type,
    8470                                ((char *)ServicePtrs[snum]) + pdiff,
    8471                                ((char *)&sDefault) + pdiff);
    8472 }
    8473 
    8474 /***************************************************************************
    8475  Display the contents of a single services record.
    8476 ***************************************************************************/
    8477 
    8478 static void dump_a_service(struct service *pService, FILE * f)
    8479 {
    8480         int i;
    8481         struct param_opt_struct *data;
    8482 
    8483         if (pService != &sDefault)
    8484                 fprintf(f, "[%s]\n", pService->szService);
    8485 
    8486         for (i = 0; parm_table[i].label; i++) {
    8487 
    8488                 if (parm_table[i].p_class == P_LOCAL &&
    8489                     !(parm_table[i].flags & FLAG_META) &&
    8490                     parm_table[i].ptr &&
    8491                     (*parm_table[i].label != '-') &&
    8492                     (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
    8493                 {
    8494                         int pdiff = PTR_DIFF(parm_table[i].ptr, &sDefault);
    8495 
    8496                         if (pService == &sDefault) {
    8497                                 if (defaults_saved && is_default(i))
    8498                                         continue;
    8499                         } else {
    8500                                 if (equal_parameter(parm_table[i].type,
    8501                                                     ((char *)pService) +
    8502                                                     pdiff,
    8503                                                     ((char *)&sDefault) +
    8504                                                     pdiff))
    8505                                         continue;
    8506                         }
    8507 
    8508                         fprintf(f, "\t%s = ", parm_table[i].label);
    8509                         print_parameter(&parm_table[i],
    8510                                         ((char *)pService) + pdiff, f);
    8511                         fprintf(f, "\n");
    8512                 }
    8513         }
    8514 
    8515                 if (pService->param_opt != NULL) {
    8516                         data = pService->param_opt;
    8517                         while(data) {
    8518                                 fprintf(f, "\t%s = %s\n", data->key, data->value);
    8519                                 data = data->next;
    8520                         }
    8521                 }
     2700        return bRetval;
    85222701}
    85232702
     
    85282707bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
    85292708{
    8530         int i;
    8531         bool result = False;
    8532         parm_class p_class;
    8533         unsigned flag = 0;
    8534         fstring local_parm_name;
    8535         char *parm_opt;
    8536         const char *parm_opt_value;
    8537 
    8538         /* check for parametrical option */
    8539         fstrcpy( local_parm_name, parm_name);
    8540         parm_opt = strchr( local_parm_name, ':');
    8541 
    8542         if (parm_opt) {
    8543                 *parm_opt = '\0';
    8544                 parm_opt++;
    8545                 if (strlen(parm_opt)) {
    8546                         parm_opt_value = lp_parm_const_string( snum,
    8547                                 local_parm_name, parm_opt, NULL);
    8548                         if (parm_opt_value) {
    8549                                 printf( "%s\n", parm_opt_value);
    8550                                 result = True;
    8551                         }
    8552                 }
    8553                 return result;
    8554         }
    8555 
    8556         /* check for a key and print the value */
     2709        bool result = false;
     2710        struct loadparm_context *lp_ctx;
     2711
     2712        lp_ctx = setup_lp_context(talloc_tos());
     2713        if (lp_ctx == NULL) {
     2714                return false;
     2715        }
     2716
    85572717        if (isGlobal) {
    8558                 p_class = P_GLOBAL;
    8559                 flag = FLAG_GLOBAL;
    8560         } else
    8561                 p_class = P_LOCAL;
    8562 
    8563         for (i = 0; parm_table[i].label; i++) {
    8564                 if (strwicmp(parm_table[i].label, parm_name) == 0 &&
    8565                     !(parm_table[i].flags & FLAG_META) &&
    8566                     (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
    8567                     parm_table[i].ptr &&
    8568                     (*parm_table[i].label != '-') &&
    8569                     (i == 0 || (parm_table[i].ptr != parm_table[i - 1].ptr)))
    8570                 {
    8571                         void *ptr;
    8572 
    8573                         if (isGlobal) {
    8574                                 ptr = parm_table[i].ptr;
    8575                         } else {
    8576                                 struct service *pService = ServicePtrs[snum];
    8577                                 ptr = ((char *)pService) +
    8578                                         PTR_DIFF(parm_table[i].ptr, &sDefault);
    8579                         }
    8580 
    8581                         print_parameter(&parm_table[i],
    8582                                         ptr, f);
    8583                         fprintf(f, "\n");
    8584                         result = True;
    8585                         break;
    8586                 }
    8587         }
    8588 
     2718                result = lpcfg_dump_a_parameter(lp_ctx, NULL, parm_name, f);
     2719        } else {
     2720                result = lpcfg_dump_a_parameter(lp_ctx, ServicePtrs[snum], parm_name, f);
     2721        }
     2722        TALLOC_FREE(lp_ctx);
    85892723        return result;
    85902724}
    8591 
    8592 /***************************************************************************
    8593  Return info about the requested parameter (given as a string).
    8594  Return NULL when the string is not a valid parameter name.
    8595 ***************************************************************************/
    8596 
    8597 struct parm_struct *lp_get_parameter(const char *param_name)
    8598 {
    8599         int num = map_parameter(param_name);
    8600 
    8601         if (num < 0) {
    8602                 return NULL;
    8603         }
    8604 
    8605         return &parm_table[num];
    8606 }
    8607 
    8608 /***************************************************************************
    8609  Return info about the next parameter in a service.
    8610  snum==GLOBAL_SECTION_SNUM gives the globals.
    8611  Return NULL when out of parameters.
    8612 ***************************************************************************/
    8613 
    8614 struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
    8615 {
    8616         if (snum < 0) {
    8617                 /* do the globals */
    8618                 for (; parm_table[*i].label; (*i)++) {
    8619                         if (parm_table[*i].p_class == P_SEPARATOR)
    8620                                 return &parm_table[(*i)++];
    8621 
    8622                         if (!parm_table[*i].ptr
    8623                             || (*parm_table[*i].label == '-'))
    8624                                 continue;
    8625 
    8626                         if ((*i) > 0
    8627                             && (parm_table[*i].ptr ==
    8628                                 parm_table[(*i) - 1].ptr))
    8629                                 continue;
    8630 
    8631                         if (is_default(*i) && !allparameters)
    8632                                 continue;
    8633 
    8634                         return &parm_table[(*i)++];
    8635                 }
    8636         } else {
    8637                 struct service *pService = ServicePtrs[snum];
    8638 
    8639                 for (; parm_table[*i].label; (*i)++) {
    8640                         if (parm_table[*i].p_class == P_SEPARATOR)
    8641                                 return &parm_table[(*i)++];
    8642 
    8643                         if (parm_table[*i].p_class == P_LOCAL &&
    8644                             parm_table[*i].ptr &&
    8645                             (*parm_table[*i].label != '-') &&
    8646                             ((*i) == 0 ||
    8647                              (parm_table[*i].ptr !=
    8648                               parm_table[(*i) - 1].ptr)))
    8649                         {
    8650                                 int pdiff =
    8651                                         PTR_DIFF(parm_table[*i].ptr,
    8652                                                  &sDefault);
    8653 
    8654                                 if (allparameters ||
    8655                                     !equal_parameter(parm_table[*i].type,
    8656                                                      ((char *)pService) +
    8657                                                      pdiff,
    8658                                                      ((char *)&sDefault) +
    8659                                                      pdiff))
    8660                                 {
    8661                                         return &parm_table[(*i)++];
    8662                                 }
    8663                         }
    8664                 }
    8665         }
    8666 
    8667         return NULL;
    8668 }
    8669 
    86702725
    86712726#if 0
     
    86972752bool lp_snum_ok(int iService)
    86982753{
    8699         return (LP_SNUM_OK(iService) && ServicePtrs[iService]->bAvailable);
     2754        return (LP_SNUM_OK(iService) && ServicePtrs[iService]->available);
    87002755}
    87012756
     
    87142769                return;
    87152770
    8716         s = SMB_STRDUP(str);
    8717         if (!s)
     2771        s = talloc_strdup(talloc_tos(), str);
     2772        if (!s) {
     2773                smb_panic("talloc_strdup failed");
    87182774                return;
     2775        }
    87192776
    87202777        homes = lp_servicenumber(HOMES_NAME);
     
    87342791                TALLOC_FREE(home);
    87352792        }
    8736         SAFE_FREE(s);
     2793        TALLOC_FREE(s);
    87372794}
    87382795
     
    87502807                lp_add_printer(name, printers);
    87512808                if ((i = lp_servicenumber(name)) >= 0) {
    8752                         string_set(&ServicePtrs[i]->comment, comment);
    8753                         ServicePtrs[i]->autoloaded = True;
     2809                        lpcfg_string_set(ServicePtrs[i],
     2810                                         &ServicePtrs[i]->comment, comment);
     2811                        ServicePtrs[i]->autoloaded = true;
    87542812                }
    87552813        }
     
    87692827***************************************************************************/
    87702828
    8771 void lp_killunused(bool (*snumused) (int))
     2829void lp_killunused(struct smbd_server_connection *sconn,
     2830                   bool (*snumused) (struct smbd_server_connection *, int))
    87722831{
    87732832        int i;
     
    87822841                }
    87832842
    8784                 if (!snumused || !snumused(i)) {
     2843                if (!snumused || !snumused(sconn, i)) {
    87852844                        free_service_byindex(i);
    87862845                }
     
    87932852void lp_kill_all_services(void)
    87942853{
    8795         lp_killunused(NULL);
     2854        lp_killunused(NULL, NULL);
    87962855}
    87972856
     
    88092868/***************************************************************************
    88102869 Save the curent values of all global and sDefault parameters into the
    8811  defaults union. This allows swat and testparm to show only the
     2870 defaults union. This allows testparm to show only the
    88122871 changed (ie. non-default) parameters.
    88132872***************************************************************************/
     
    88162875{
    88172876        int i;
     2877        struct parmlist_entry * parm;
    88182878        for (i = 0; parm_table[i].label; i++) {
    8819                 if (i > 0 && parm_table[i].ptr == parm_table[i - 1].ptr)
     2879                if (!(flags_list[i] & FLAG_CMDLINE)) {
     2880                        flags_list[i] |= FLAG_DEFAULT;
     2881                }
     2882
     2883                if (i > 0 && parm_table[i].offset == parm_table[i - 1].offset
     2884                    && parm_table[i].p_class == parm_table[i - 1].p_class)
    88202885                        continue;
    88212886                switch (parm_table[i].type) {
    88222887                        case P_LIST:
     2888                        case P_CMDLIST:
    88232889                                parm_table[i].def.lvalue = str_list_copy(
    8824                                         NULL, *(const char ***)parm_table[i].ptr);
     2890                                        NULL, *(const char ***)lp_parm_ptr(NULL, &parm_table[i]));
    88252891                                break;
    88262892                        case P_STRING:
    88272893                        case P_USTRING:
    8828                                 if (parm_table[i].ptr) {
    8829                                         parm_table[i].def.svalue = SMB_STRDUP(*(char **)parm_table[i].ptr);
    8830                                 } else {
    8831                                         parm_table[i].def.svalue = NULL;
     2894                                lpcfg_string_set(
     2895                                        Globals.ctx,
     2896                                        &parm_table[i].def.svalue,
     2897                                        *(char **)lp_parm_ptr(
     2898                                                NULL, &parm_table[i]));
     2899                                if (parm_table[i].def.svalue == NULL) {
     2900                                        smb_panic("lpcfg_string_set() failed");
    88322901                                }
    88332902                                break;
     
    88352904                        case P_BOOLREV:
    88362905                                parm_table[i].def.bvalue =
    8837                                         *(bool *)parm_table[i].ptr;
     2906                                        *(bool *)lp_parm_ptr(NULL, &parm_table[i]);
    88382907                                break;
    88392908                        case P_CHAR:
    88402909                                parm_table[i].def.cvalue =
    8841                                         *(char *)parm_table[i].ptr;
     2910                                        *(char *)lp_parm_ptr(NULL, &parm_table[i]);
    88422911                                break;
    88432912                        case P_INTEGER:
    88442913                        case P_OCTAL:
    88452914                        case P_ENUM:
     2915                        case P_BYTES:
    88462916                                parm_table[i].def.ivalue =
    8847                                         *(int *)parm_table[i].ptr;
     2917                                        *(int *)lp_parm_ptr(NULL, &parm_table[i]);
    88482918                                break;
    8849                         case P_SEP:
    8850                                 break;
    8851                 }
    8852         }
    8853         defaults_saved = True;
     2919                }
     2920        }
     2921
     2922        for (parm=Globals.param_opt; parm; parm=parm->next) {
     2923                if (!(parm->priority & FLAG_CMDLINE)) {
     2924                        parm->priority |= FLAG_DEFAULT;
     2925                }
     2926        }
     2927
     2928        for (parm=sDefault.param_opt; parm; parm=parm->next) {
     2929                if (!(parm->priority & FLAG_CMDLINE)) {
     2930                        parm->priority |= FLAG_DEFAULT;
     2931                }
     2932        }
     2933
     2934        defaults_saved = true;
    88542935}
    88552936
     
    88602941static void set_allowed_client_auth(void)
    88612942{
    8862         if (Globals.bClientNTLMv2Auth) {
    8863                 Globals.bClientLanManAuth = False;
    8864         }
    8865         if (!Globals.bClientLanManAuth) {
    8866                 Globals.bClientPlaintextAuth = False;
     2943        if (Globals.client_ntlmv2_auth) {
     2944                Globals.client_lanman_auth = false;
     2945        }
     2946        if (!Globals.client_lanman_auth) {
     2947                Globals.client_plaintext_auth = false;
    88672948        }
    88682949}
     
    88942975                        "not a regular file\n",
    88952976                        fname, (unsigned int)psbuf->st_ex_uid ));
    8896                 return False;
     2977                return false;
    88972978        }
    88982979
     
    89022983                        "public write. Refusing to allow as a usershare file.\n",
    89032984                        fname, (unsigned int)psbuf->st_ex_uid ));
    8904                 return False;
     2985                return false;
    89052986        }
    89062987
     
    89112992                        fname, (unsigned int)psbuf->st_ex_uid,
    89122993                        (unsigned int)psbuf->st_ex_size ));
    8913                 return False;
    8914         }
    8915 
    8916         return True;
     2994                return false;
     2995        }
     2996
     2997        return true;
    89172998}
    89182999
     
    89363017        const char **prefixdenylist = lp_usershare_prefix_deny_list();
    89373018        int us_vers;
    8938         SMB_STRUCT_DIR *dp;
     3019        DIR *dp;
    89393020        SMB_STRUCT_STAT sbuf;
    89403021        char *sharepath = NULL;
     
    89443025        *pp_comment = NULL;
    89453026
    8946         *pallow_guest = False;
     3027        *pallow_guest = false;
    89473028
    89483029        if (numlines < 4) {
     
    89953076                }
    89963077                if (lines[4][9] == 'y') {
    8997                         *pallow_guest = True;
     3078                        *pallow_guest = true;
    89983079                }
    89993080
     
    90203101        }
    90213102
    9022         if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->szPath) == 0)) {
     3103        if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->path) == 0)) {
    90233104                /* Path didn't change, no checks needed. */
    90243105                *pp_sharepath = sharepath;
     
    90713152
    90723153        /* Ensure this is pointing to a directory. */
    9073         dp = sys_opendir(sharepath);
     3154        dp = opendir(sharepath);
    90743155
    90753156        if (!dp) {
     
    90853166                DEBUG(2,("parse_usershare_file: share %s : stat failed on path %s. %s\n",
    90863167                        servicename, sharepath, strerror(errno) ));
    9087                 sys_closedir(dp);
     3168                closedir(dp);
    90883169                return USERSHARE_POSIX_ERR;
    90893170        }
    90903171
    9091         sys_closedir(dp);
     3172        closedir(dp);
    90923173
    90933174        if (!S_ISDIR(sbuf.st_ex_mode)) {
     
    91363217        TALLOC_CTX *ctx = talloc_stackframe();
    91373218        struct security_descriptor *psd = NULL;
    9138         bool guest_ok = False;
     3219        bool guest_ok = false;
    91393220        char *canon_name = NULL;
    91403221        bool added_service = false;
     
    91753256
    91763257        {
    9177                 TDB_DATA data = dbwrap_fetch_bystring(
    9178                         ServiceHash, canon_name, canon_name);
     3258                TDB_DATA data;
     3259                NTSTATUS status;
     3260
     3261                status = dbwrap_fetch_bystring(ServiceHash, canon_name,
     3262                                               canon_name, &data);
    91793263
    91803264                iService = -1;
    91813265
    9182                 if ((data.dptr != NULL) && (data.dsize == sizeof(iService))) {
    9183                         iService = *(int *)data.dptr;
     3266                if (NT_STATUS_IS_OK(status) &&
     3267                    (data.dptr != NULL) &&
     3268                    (data.dsize == sizeof(iService))) {
     3269                        memcpy(&iService, data.dptr, sizeof(iService));
    91843270                }
    91853271        }
     
    91983284        /* Try and open the file read only - no symlinks allowed. */
    91993285#ifdef O_NOFOLLOW
    9200         fd = sys_open(fname, O_RDONLY|O_NOFOLLOW, 0);
     3286        fd = open(fname, O_RDONLY|O_NOFOLLOW, 0);
    92013287#else
    9202         fd = sys_open(fname, O_RDONLY, 0);
     3288        fd = open(fname, O_RDONLY, 0);
    92033289#endif
    92043290
     
    92183304
    92193305        /* Is it the same dev/inode as was lstated ? */
    9220         if (lsbuf.st_ex_dev != sbuf.st_ex_dev || lsbuf.st_ex_ino != sbuf.st_ex_ino) {
     3306        if (!check_same_stat(&lsbuf, &sbuf)) {
    92213307                close(fd);
    92223308                DEBUG(0,("process_usershare_file: fstat of %s is a different file from lstat. "
     
    92283314           other strange filetype. */
    92293315        if (!check_usershare_stat(fname, &sbuf)) {
     3316                close(fd);
    92303317                goto out;
    92313318        }
     
    92493336        /* Everything ok - add the service possibly using a template. */
    92503337        if (iService < 0) {
    9251                 const struct service *sp = &sDefault;
     3338                const struct loadparm_service *sp = &sDefault;
    92523339                if (snum_template != -1) {
    92533340                        sp = ServicePtrs[snum_template];
     
    92633350
    92643351                /* Read only is controlled by usershare ACL below. */
    9265                 ServicePtrs[iService]->bRead_only = False;
     3352                ServicePtrs[iService]->read_only = false;
    92663353        }
    92673354
     
    92753362
    92763363        /* If from a template it may be marked invalid. */
    9277         ServicePtrs[iService]->valid = True;
     3364        ServicePtrs[iService]->valid = true;
    92783365
    92793366        /* Set the service as a valid usershare. */
     
    92823369        /* Set guest access. */
    92833370        if (lp_usershare_allow_guests()) {
    9284                 ServicePtrs[iService]->bGuest_ok = guest_ok;
     3371                ServicePtrs[iService]->guest_ok = guest_ok;
    92853372        }
    92863373
    92873374        /* And note when it was loaded. */
    92883375        ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
    9289         string_set(&ServicePtrs[iService]->szPath, sharepath);
    9290         string_set(&ServicePtrs[iService]->comment, comment);
     3376        lpcfg_string_set(ServicePtrs[iService], &ServicePtrs[iService]->path,
     3377                         sharepath);
     3378        lpcfg_string_set(ServicePtrs[iService],
     3379                         &ServicePtrs[iService]->comment, comment);
    92913380
    92923381        ret = iService;
     
    93103399{
    93113400        SMB_STRUCT_STAT lsbuf;
    9312         const char *usersharepath = Globals.szUsersharePath;
     3401        const char *usersharepath = Globals.usershare_path;
    93133402        char *fname;
    93143403
    9315         if (asprintf(&fname, "%s/%s",
     3404        fname = talloc_asprintf(talloc_tos(),
     3405                                "%s/%s",
    93163406                                usersharepath,
    9317                                 ServicePtrs[iService]->szService) < 0) {
     3407                                ServicePtrs[iService]->szService);
     3408        if (fname == NULL) {
    93183409                return false;
    93193410        }
    93203411
    93213412        if (sys_lstat(fname, &lsbuf, false) != 0) {
    9322                 SAFE_FREE(fname);
     3413                TALLOC_FREE(fname);
    93233414                return false;
    93243415        }
    93253416
    93263417        if (!S_ISREG(lsbuf.st_ex_mode)) {
    9327                 SAFE_FREE(fname);
     3418                TALLOC_FREE(fname);
    93283419                return false;
    93293420        }
    93303421
    9331         SAFE_FREE(fname);
     3422        TALLOC_FREE(fname);
    93323423        *last_mod = lsbuf.st_ex_mtime;
    93333424        return true;
     
    93413432{
    93423433        SMB_STRUCT_STAT sbuf;
    9343         const char *usersharepath = Globals.szUsersharePath;
    9344         int max_user_shares = Globals.iUsershareMaxShares;
     3434        const char *usersharepath = Globals.usershare_path;
     3435        int max_user_shares = Globals.usershare_max_shares;
    93453436        int snum_template = -1;
    93463437
     
    93783469
    93793470        /* Ensure the template share exists if it's set. */
    9380         if (Globals.szUsershareTemplateShare[0]) {
     3471        if (Globals.usershare_template_share[0]) {
    93813472                /* We can't use lp_servicenumber here as we are recommending that
    9382                    template shares have -valid=False set. */
     3473                   template shares have -valid=false set. */
    93833474                for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
    93843475                        if (ServicePtrs[snum_template]->szService &&
    93853476                                        strequal(ServicePtrs[snum_template]->szService,
    9386                                                 Globals.szUsershareTemplateShare)) {
     3477                                                Globals.usershare_template_share)) {
    93873478                                break;
    93883479                        }
     
    93923483                        DEBUG(0,("load_usershare_service: usershare template share %s "
    93933484                                "does not exist.\n",
    9394                                 Globals.szUsershareTemplateShare ));
     3485                                Globals.usershare_template_share ));
    93953486                        return -1;
    93963487                }
     
    94073498***************************************************************************/
    94083499
    9409 int load_usershare_shares(void)
    9410 {
    9411         SMB_STRUCT_DIR *dp;
     3500int load_usershare_shares(struct smbd_server_connection *sconn,
     3501                          bool (*snumused) (struct smbd_server_connection *, int))
     3502{
     3503        DIR *dp;
    94123504        SMB_STRUCT_STAT sbuf;
    9413         SMB_STRUCT_DIRENT *de;
     3505        struct dirent *de;
    94143506        int num_usershares = 0;
    9415         int max_user_shares = Globals.iUsershareMaxShares;
     3507        int max_user_shares = Globals.usershare_max_shares;
    94163508        unsigned int num_dir_entries, num_bad_dir_entries, num_tmp_dir_entries;
    94173509        unsigned int allowed_bad_entries = ((2*max_user_shares)/10);
     
    94193511        int iService;
    94203512        int snum_template = -1;
    9421         const char *usersharepath = Globals.szUsersharePath;
     3513        const char *usersharepath = Globals.usershare_path;
    94223514        int ret = lp_numservices();
     3515        TALLOC_CTX *tmp_ctx;
    94233516
    94243517        if (max_user_shares == 0 || *usersharepath == '\0') {
     
    94493542
    94503543        /* Ensure the template share exists if it's set. */
    9451         if (Globals.szUsershareTemplateShare[0]) {
     3544        if (Globals.usershare_template_share[0]) {
    94523545                /* We can't use lp_servicenumber here as we are recommending that
    9453                    template shares have -valid=False set. */
     3546                   template shares have -valid=false set. */
    94543547                for (snum_template = iNumServices - 1; snum_template >= 0; snum_template--) {
    94553548                        if (ServicePtrs[snum_template]->szService &&
    94563549                                        strequal(ServicePtrs[snum_template]->szService,
    9457                                                 Globals.szUsershareTemplateShare)) {
     3550                                                Globals.usershare_template_share)) {
    94583551                                break;
    94593552                        }
     
    94633556                        DEBUG(0,("load_usershare_shares: usershare template share %s "
    94643557                                "does not exist.\n",
    9465                                 Globals.szUsershareTemplateShare ));
     3558                                Globals.usershare_template_share ));
    94663559                        return ret;
    94673560                }
     
    94753568        }
    94763569
    9477         dp = sys_opendir(usersharepath);
     3570        dp = opendir(usersharepath);
    94783571        if (!dp) {
    94793572                DEBUG(0,("load_usershare_shares:: failed to open directory %s. %s\n",
     
    94833576
    94843577        for (num_dir_entries = 0, num_bad_dir_entries = 0, num_tmp_dir_entries = 0;
    9485                         (de = sys_readdir(dp));
     3578                        (de = readdir(dp));
    94863579                        num_dir_entries++ ) {
    94873580                int r;
     
    95393632        }
    95403633
    9541         sys_closedir(dp);
     3634        closedir(dp);
    95423635
    95433636        /* Sweep through and delete any non-refreshed usershares that are
    95443637           not currently in use. */
     3638        tmp_ctx = talloc_stackframe();
    95453639        for (iService = iNumServices - 1; iService >= 0; iService--) {
    95463640                if (VALID(iService) && (ServicePtrs[iService]->usershare == USERSHARE_PENDING_DELETE)) {
    9547                         if (conn_snum_used(iService)) {
     3641                        char *servname;
     3642
     3643                        if (snumused && snumused(sconn, iService)) {
    95483644                                continue;
    95493645                        }
     3646
     3647                        servname = lp_servicename(tmp_ctx, iService);
     3648
    95503649                        /* Remove from the share ACL db. */
    95513650                        DEBUG(10,("load_usershare_shares: Removing deleted usershare %s\n",
    9552                                 lp_servicename(iService) ));
    9553                         delete_share_security(lp_servicename(iService));
     3651                                  servname ));
     3652                        delete_share_security(servname);
    95543653                        free_service_byindex(iService);
    95553654                }
    95563655        }
     3656        talloc_free(tmp_ctx);
    95573657
    95583658        return lp_numservices();
     
    95773677        }
    95783678
    9579         SAFE_FREE( ServicePtrs );
     3679        TALLOC_FREE( ServicePtrs );
    95803680        iNumServices = 0;
    95813681
     
    95903690 Allow client apps to specify that they are a client
    95913691***************************************************************************/
    9592 void lp_set_in_client(bool b)
     3692static void lp_set_in_client(bool b)
    95933693{
    95943694    in_client = b;
     
    95993699 Determine if we're running in a client app
    96003700***************************************************************************/
    9601 bool lp_is_in_client(void)
     3701static bool lp_is_in_client(void)
    96023702{
    96033703    return in_client;
    96043704}
    96053705
    9606 /***************************************************************************
    9607  Load the services array from the services file. Return True on success,
    9608  False on failure.
     3706static void lp_enforce_ad_dc_settings(void)
     3707{
     3708        lp_do_parameter(GLOBAL_SECTION_SNUM, "passdb backend", "samba_dsdb");
     3709        lp_do_parameter(GLOBAL_SECTION_SNUM,
     3710                        "winbindd:use external pipes", "true");
     3711        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:default", "external");
     3712        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:svcctl", "embedded");
     3713        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:srvsvc", "embedded");
     3714        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:eventlog", "embedded");
     3715        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:ntsvcs", "embedded");
     3716        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:winreg", "embedded");
     3717        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:spoolss", "embedded");
     3718        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_daemon:spoolssd", "embedded");
     3719        lp_do_parameter(GLOBAL_SECTION_SNUM, "rpc_server:tcpip", "no");
     3720}
     3721
     3722/***************************************************************************
     3723 Load the services array from the services file. Return true on success,
     3724 false on failure.
    96093725***************************************************************************/
    96103726
     
    96133729                       bool save_defaults,
    96143730                       bool add_ipc,
    9615                        bool initialize_globals,
     3731                       bool reinit_globals,
    96163732                       bool allow_include_registry,
    9617                        bool allow_registry_shares)
     3733                       bool load_all_shares)
    96183734{
    96193735        char *n2 = NULL;
    96203736        bool bRetval;
    9621 
    9622         bRetval = False;
     3737        TALLOC_CTX *frame = talloc_stackframe();
     3738        struct loadparm_context *lp_ctx;
     3739
     3740        bRetval = false;
    96233741
    96243742        DEBUG(3, ("lp_load_ex: refreshing parameters\n"));
    96253743
    9626         bInGlobalSection = True;
     3744        bInGlobalSection = true;
    96273745        bGlobalOnly = global_only;
    96283746        bAllowIncludeRegistry = allow_include_registry;
    96293747
    9630         init_globals(initialize_globals);
     3748        lp_ctx = setup_lp_context(talloc_tos());
     3749
     3750        init_globals(lp_ctx, reinit_globals);
    96313751
    96323752        free_file_list();
     
    96373757        }
    96383758
    9639         free_param_opts(&Globals.param_opt);
    9640 
    9641         lp_do_parameter(-1, "idmap config * : backend", Globals.szIdmapBackend);
     3759        if (!reinit_globals) {
     3760                free_param_opts(&Globals.param_opt);
     3761                apply_lp_set_cmdline();
     3762        }
     3763
     3764        lp_do_parameter(-1, "idmap config * : backend", Globals.idmap_backend);
    96423765
    96433766        /* We get sections first, so have to start 'behind' to make up */
     
    96523775                }
    96533776
    9654                 add_to_file_list(pszFname, n2);
    9655 
    9656                 bRetval = pm_process(n2, do_section, do_parameter, NULL);
     3777                add_to_file_list(NULL, &file_lists, pszFname, n2);
     3778
     3779                bRetval = pm_process(n2, lp_do_section, do_parameter, lp_ctx);
    96573780                TALLOC_FREE(n2);
    96583781
     
    96613784                if (bRetval) {
    96623785                        if (iServiceIndex >= 0) {
    9663                                 bRetval = service_ok(iServiceIndex);
     3786                                bRetval = lpcfg_service_ok(ServicePtrs[iServiceIndex]);
    96643787                        }
    96653788                }
    96663789
    96673790                if (lp_config_backend_is_registry()) {
     3791                        bool ok;
    96683792                        /* config backend changed to registry in config file */
    96693793                        /*
    96703794                         * We need to use this extra global variable here to
    96713795                         * survive restart: init_globals uses this as a default
    9672                          * for ConfigBackend. Otherwise, init_globals would
     3796                         * for config_backend. Otherwise, init_globals would
    96733797                         *  send us into an endless loop here.
    96743798                         */
     3799
    96753800                        config_backend = CONFIG_BACKEND_REGISTRY;
    96763801                        /* start over */
    96773802                        DEBUG(1, ("lp_load_ex: changing to config backend "
    96783803                                  "registry\n"));
    9679                         init_globals(true);
     3804                        init_globals(lp_ctx, true);
     3805
     3806                        TALLOC_FREE(lp_ctx);
     3807
    96803808                        lp_kill_all_services();
    9681                         return lp_load_ex(pszFname, global_only, save_defaults,
    9682                                           add_ipc, initialize_globals,
    9683                                           allow_include_registry,
    9684                                           allow_registry_shares);
     3809                        ok = lp_load_ex(pszFname, global_only, save_defaults,
     3810                                        add_ipc, reinit_globals,
     3811                                        allow_include_registry,
     3812                                        load_all_shares);
     3813                        TALLOC_FREE(frame);
     3814                        return ok;
    96853815                }
    96863816        } else if (lp_config_backend_is_registry()) {
     
    96933823
    96943824        if (bRetval && lp_registry_shares()) {
    9695                 if (allow_registry_shares) {
     3825                if (load_all_shares) {
    96963826                        bRetval = process_registry_shares();
    96973827                } else {
     
    97013831
    97023832        {
    9703                 char *serv = lp_auto_services();
     3833                char *serv = lp_auto_services(talloc_tos());
    97043834                lp_add_auto_services(serv);
    97053835                TALLOC_FREE(serv);
     
    97153845        }
    97163846
    9717         set_server_role();
    9718         set_default_server_announce_type();
    97193847        set_allowed_client_auth();
    97203848
    9721         if (lp_security() == SEC_SHARE) {
    9722                 DEBUG(1, ("WARNING: The security=share option is deprecated\n"));
    9723         } else if (lp_security() == SEC_SERVER) {
    9724                 DEBUG(1, ("WARNING: The security=server option is deprecated\n"));
    9725         }
    9726 
    9727         if (lp_security() == SEC_ADS && strchr(lp_passwordserver(), ':')) {
     3849        if (lp_security() == SEC_ADS && strchr(lp_password_server(), ':')) {
    97283850                DEBUG(1, ("WARNING: The optional ':port' in password server = %s is deprecated\n",
    9729                           lp_passwordserver()));
    9730         }
    9731 
    9732         bLoaded = True;
    9733 
    9734         /* Now we check bWINSsupport and set szWINSserver to 127.0.0.1 */
    9735         /* if bWINSsupport is true and we are in the client            */
    9736         if (lp_is_in_client() && Globals.bWINSsupport) {
     3851                          lp_password_server()));
     3852        }
     3853
     3854        bLoaded = true;
     3855
     3856        /* Now we check we_are_a_wins_server and set szWINSserver to 127.0.0.1 */
     3857        /* if we_are_a_wins_server is true and we are in the client            */
     3858        if (lp_is_in_client() && Globals.we_are_a_wins_server) {
    97373859                lp_do_parameter(GLOBAL_SECTION_SNUM, "wins server", "127.0.0.1");
    97383860        }
    97393861
    9740         if (!lp_is_in_client()) {
    9741                 switch (lp_client_ipc_signing()) {
    9742                 case Required:
    9743                         lp_set_cmdline("client signing", "mandatory");
    9744                         break;
    9745                 case Auto:
    9746                         lp_set_cmdline("client signing", "auto");
    9747                         break;
    9748                 case False:
    9749                         lp_set_cmdline("client signing", "disabled");
    9750                         break;
    9751                 }
    9752         }
    9753 
    97543862        init_iconv();
    97553863
     3864        fault_configure(smb_panic_s3);
     3865
     3866        /*
     3867         * We run this check once the whole smb.conf is parsed, to
     3868         * force some settings for the standard way a AD DC is
     3869         * operated.  We may change these as our code evolves, which
     3870         * is why we force these settings.
     3871         */
     3872        if (lp_server_role() == ROLE_ACTIVE_DIRECTORY_DC) {
     3873                lp_enforce_ad_dc_settings();
     3874        }
     3875
    97563876        bAllowIncludeRegistry = true;
    97573877
     3878        TALLOC_FREE(frame);
    97583879        return (bRetval);
    97593880}
    97603881
    9761 bool lp_load(const char *pszFname,
    9762              bool global_only,
    9763              bool save_defaults,
    9764              bool add_ipc,
    9765              bool initialize_globals)
     3882static bool lp_load(const char *pszFname,
     3883                    bool global_only,
     3884                    bool save_defaults,
     3885                    bool add_ipc,
     3886                    bool reinit_globals)
    97663887{
    97673888        return lp_load_ex(pszFname,
     
    97693890                          save_defaults,
    97703891                          add_ipc,
    9771                           initialize_globals,
     3892                          reinit_globals,
    97723893                          true,   /* allow_include_registry */
    9773                           false); /* allow_registry_shares*/
     3894                          false); /* load_all_shares*/
    97743895}
    97753896
     
    97783899        return lp_load_ex(pszFname,
    97793900                          true,   /* global only */
    9780                           false,  /* save_defaults */
     3901                          true,   /* save_defaults */
    97813902                          false,  /* add_ipc */
    9782                           true,   /* initialize_globals */
     3903                          true,   /* reinit_globals */
    97833904                          false,  /* allow_include_registry */
    9784                           false); /* allow_registry_shares*/
    9785 }
    9786 
    9787 bool lp_load_with_registry_shares(const char *pszFname,
    9788                                   bool global_only,
    9789                                   bool save_defaults,
    9790                                   bool add_ipc,
    9791                                   bool initialize_globals)
     3905                          false); /* load_all_shares*/
     3906}
     3907
     3908/**
     3909 * most common lp_load wrapper, loading only the globals
     3910 */
     3911bool lp_load_global(const char *file_name)
     3912{
     3913        return lp_load(file_name,
     3914                       true,   /* global_only */
     3915                       false,  /* save_defaults */
     3916                       false,  /* add_ipc */
     3917                       true);  /* reinit_globals */
     3918}
     3919
     3920/**
     3921 * The typical lp_load wrapper with shares, loads global and
     3922 * shares, including IPC, but does not force immediate
     3923 * loading of all shares from registry.
     3924 */
     3925bool lp_load_with_shares(const char *file_name)
     3926{
     3927        return lp_load(file_name,
     3928                       false,  /* global_only */
     3929                       false,  /* save_defaults */
     3930                       true,   /* add_ipc */
     3931                       true);  /* reinit_globals */
     3932}
     3933
     3934/**
     3935 * lp_load wrapper, especially for clients
     3936 */
     3937bool lp_load_client(const char *file_name)
     3938{
     3939        lp_set_in_client(true);
     3940
     3941        return lp_load_global(file_name);
     3942}
     3943
     3944/**
     3945 * lp_load wrapper, loading only globals, but intended
     3946 * for subsequent calls, not reinitializing the globals
     3947 * to default values
     3948 */
     3949bool lp_load_global_no_reinit(const char *file_name)
     3950{
     3951        return lp_load(file_name,
     3952                       true,   /* global_only */
     3953                       false,  /* save_defaults */
     3954                       false,  /* add_ipc */
     3955                       false); /* reinit_globals */
     3956}
     3957
     3958/**
     3959 * lp_load wrapper, loading globals and shares,
     3960 * intended for subsequent calls, i.e. not reinitializing
     3961 * the globals to default values.
     3962 */
     3963bool lp_load_no_reinit(const char *file_name)
     3964{
     3965        return lp_load(file_name,
     3966                       false,  /* global_only */
     3967                       false,  /* save_defaults */
     3968                       false,  /* add_ipc */
     3969                       false); /* reinit_globals */
     3970}
     3971
     3972
     3973/**
     3974 * lp_load wrapper, especially for clients, no reinitialization
     3975 */
     3976bool lp_load_client_no_reinit(const char *file_name)
     3977{
     3978        lp_set_in_client(true);
     3979
     3980        return lp_load_global_no_reinit(file_name);
     3981}
     3982
     3983bool lp_load_with_registry_shares(const char *pszFname)
    97923984{
    97933985        return lp_load_ex(pszFname,
    9794                           global_only,
    9795                           save_defaults,
    9796                           add_ipc,
    9797                           initialize_globals,
     3986                          false, /* global_only */
     3987                          true,  /* save_defaults */
     3988                          false, /* add_ipc */
     3989                          false, /* reinit_globals */
    97983990                          true,  /* allow_include_registry */
    9799                           true); /* allow_registry_shares*/
     3991                          true); /* load_all_shares*/
    98003992}
    98013993
     
    98164008{
    98174009        int iService;
     4010        struct loadparm_context *lp_ctx;
    98184011
    98194012        if (show_defaults)
    9820                 defaults_saved = False;
    9821 
    9822         dump_globals(f);
    9823 
    9824         dump_a_service(&sDefault, f);
     4013                defaults_saved = false;
     4014
     4015        lp_ctx = setup_lp_context(talloc_tos());
     4016        if (lp_ctx == NULL) {
     4017                return;
     4018        }
     4019
     4020        lpcfg_dump_globals(lp_ctx, f, !defaults_saved);
     4021
     4022        lpcfg_dump_a_service(&sDefault, &sDefault, f, flags_list, show_defaults);
    98254023
    98264024        for (iService = 0; iService < maxtoprint; iService++) {
     
    98394037                if (ServicePtrs[snum]->szService[0] == '\0')
    98404038                        return;
    9841                 dump_a_service(ServicePtrs[snum], f);
     4039                lpcfg_dump_a_service(ServicePtrs[snum], &sDefault, f,
     4040                                     flags_list, show_defaults);
    98424041        }
    98434042}
     
    98624061                if (VALID(iService) && ServicePtrs[iService]->szService) {
    98634062                        /*
    9864                          * The substitution here is used to support %U is
     4063                         * The substitution here is used to support %U in
    98654064                         * service names
    98664065                         */
     
    98804079                if (!usershare_exists(iService, &last_mod)) {
    98814080                        /* Remove the share security tdb entry for it. */
    9882                         delete_share_security(lp_servicename(iService));
     4081                        delete_share_security(lp_servicename(talloc_tos(), iService));
    98834082                        /* Remove it from the array. */
    98844083                        free_service_byindex(iService);
     
    99054104}
    99064105
    9907 bool share_defined(const char *service_name)
    9908 {
    9909         return (lp_servicenumber(service_name) != -1);
    9910 }
    9911 
    9912 struct share_params *get_share_params(TALLOC_CTX *mem_ctx,
    9913                                       const char *sharename)
    9914 {
    9915         struct share_params *result;
    9916         char *sname = NULL;
    9917         int snum;
    9918 
    9919         snum = find_service(mem_ctx, sharename, &sname);
    9920         if (snum < 0 || sname == NULL) {
    9921                 return NULL;
    9922         }
    9923 
    9924         if (!(result = TALLOC_P(mem_ctx, struct share_params))) {
    9925                 DEBUG(0, ("talloc failed\n"));
    9926                 return NULL;
    9927         }
    9928 
    9929         result->service = snum;
    9930         return result;
    9931 }
    9932 
    9933 struct share_iterator *share_list_all(TALLOC_CTX *mem_ctx)
    9934 {
    9935         struct share_iterator *result;
    9936 
    9937         if (!(result = TALLOC_P(mem_ctx, struct share_iterator))) {
    9938                 DEBUG(0, ("talloc failed\n"));
    9939                 return NULL;
    9940         }
    9941 
    9942         result->next_id = 0;
    9943         return result;
    9944 }
    9945 
    9946 struct share_params *next_share(struct share_iterator *list)
    9947 {
    9948         struct share_params *result;
    9949 
    9950         while (!lp_snum_ok(list->next_id) &&
    9951                (list->next_id < lp_numservices())) {
    9952                 list->next_id += 1;
    9953         }
    9954 
    9955         if (list->next_id >= lp_numservices()) {
    9956                 return NULL;
    9957         }
    9958 
    9959         if (!(result = TALLOC_P(list, struct share_params))) {
    9960                 DEBUG(0, ("talloc failed\n"));
    9961                 return NULL;
    9962         }
    9963 
    9964         result->service = list->next_id;
    9965         list->next_id += 1;
    9966         return result;
    9967 }
    9968 
    9969 struct share_params *next_printer(struct share_iterator *list)
    9970 {
    9971         struct share_params *result;
    9972 
    9973         while ((result = next_share(list)) != NULL) {
    9974                 if (lp_print_ok(result->service)) {
    9975                         break;
    9976                 }
    9977         }
    9978         return result;
    9979 }
    9980 
    9981 /*
    9982  * This is a hack for a transition period until we transformed all code from
    9983  * service numbers to struct share_params.
    9984  */
    9985 
    9986 struct share_params *snum2params_static(int snum)
    9987 {
    9988         static struct share_params result;
    9989         result.service = snum;
    9990         return &result;
    9991 }
    9992 
    99934106/*******************************************************************
    99944107 A useful volume label function.
    99954108********************************************************************/
    99964109
    9997 const char *volume_label(int snum)
     4110const char *volume_label(TALLOC_CTX *ctx, int snum)
    99984111{
    99994112        char *ret;
    10000         const char *label = lp_volume(snum);
     4113        const char *label = lp_volume(ctx, snum);
    100014114        if (!*label) {
    10002                 label = lp_servicename(snum);
     4115                label = lp_servicename(ctx, snum);
    100034116        }
    100044117
    100054118        /* This returns a 33 byte guarenteed null terminated string. */
    10006         ret = talloc_strndup(talloc_tos(), label, 32);
     4119        ret = talloc_strndup(ctx, label, 32);
    100074120        if (!ret) {
    100084121                return "";
     
    100124125
    100134126/*******************************************************************
    10014  Set the server type we will announce as via nmbd.
     4127 Get the default server type we will announce as via nmbd.
    100154128********************************************************************/
    100164129
    10017 static void set_default_server_announce_type(void)
    10018 {
    10019         default_server_announce = 0;
     4130int lp_default_server_announce(void)
     4131{
     4132        int default_server_announce = 0;
    100204133        default_server_announce |= SV_TYPE_WORKSTATION;
    100214134        default_server_announce |= SV_TYPE_SERVER;
     
    100284141        default_server_announce |= SV_TYPE_PRINTQ_SERVER;
    100294142
    10030         switch (lp_announce_as()) {
    10031                 case ANNOUNCE_AS_NT_SERVER:
    10032                         default_server_announce |= SV_TYPE_SERVER_NT;
    10033                         /* fall through... */
    10034                 case ANNOUNCE_AS_NT_WORKSTATION:
    10035                         default_server_announce |= SV_TYPE_NT;
    10036                         break;
    10037                 case ANNOUNCE_AS_WIN95:
    10038                         default_server_announce |= SV_TYPE_WIN95_PLUS;
    10039                         break;
    10040                 case ANNOUNCE_AS_WFW:
    10041                         default_server_announce |= SV_TYPE_WFW;
    10042                         break;
    10043                 default:
    10044                         break;
    10045         }
     4143        default_server_announce |= SV_TYPE_SERVER_NT;
     4144        default_server_announce |= SV_TYPE_NT;
    100464145
    100474146        switch (lp_server_role()) {
     
    100644163        if (lp_host_msdfs())
    100654164                default_server_announce |= SV_TYPE_DFS_SERVER;
     4165
     4166        return default_server_announce;
    100664167}
    100674168
     
    100724173bool lp_domain_master(void)
    100734174{
    10074         if (Globals.iDomainMaster == Auto)
     4175        if (Globals._domain_master == Auto)
    100754176                return (lp_server_role() == ROLE_DOMAIN_PDC);
    100764177
    10077         return (bool)Globals.iDomainMaster;
     4178        return (bool)Globals._domain_master;
    100784179}
    100794180
     
    100824183************************************************************/
    100834184
    10084 bool lp_domain_master_true_or_auto(void)
    10085 {
    10086         if (Globals.iDomainMaster) /* auto or yes */
     4185static bool lp_domain_master_true_or_auto(void)
     4186{
     4187        if (Globals._domain_master) /* auto or yes */
    100874188                return true;
    100884189
     
    100964197bool lp_preferred_master(void)
    100974198{
    10098         if (Globals.iPreferredMaster == Auto)
     4199        int preferred_master = lp__preferred_master();
     4200
     4201        if (preferred_master == Auto)
    100994202                return (lp_local_master() && lp_domain_master());
    101004203
    10101         return (bool)Globals.iPreferredMaster;
     4204        return (bool)preferred_master;
    101024205}
    101034206
     
    101084211void lp_remove_service(int snum)
    101094212{
    10110         ServicePtrs[snum]->valid = False;
    10111         invalid_services[num_invalid_services++] = snum;
    10112 }
    10113 
    10114 /*******************************************************************
    10115  Copy a service.
    10116 ********************************************************************/
    10117 
    10118 void lp_copy_service(int snum, const char *new_name)
    10119 {
    10120         do_section(new_name, NULL);
    10121         if (snum >= 0) {
    10122                 snum = lp_servicenumber(new_name);
    10123                 if (snum >= 0)
    10124                         lp_do_parameter(snum, "copy", lp_servicename(snum));
    10125         }
    10126 }
    10127 
    10128 
    10129 /*******************************************************************
    10130  Get the default server type we will announce as via nmbd.
    10131 ********************************************************************/
    10132 
    10133 int lp_default_server_announce(void)
    10134 {
    10135         return default_server_announce;
    10136 }
    10137 
    10138 /*******************************************************************
    10139  Split the announce version into major and minor numbers.
    10140 ********************************************************************/
    10141 
    10142 int lp_major_announce_version(void)
    10143 {
    10144         static bool got_major = False;
    10145         static int major_version = DEFAULT_MAJOR_VERSION;
    10146         char *vers;
    10147         char *p;
    10148 
    10149         if (got_major)
    10150                 return major_version;
    10151 
    10152         got_major = True;
    10153         if ((vers = lp_announce_version()) == NULL)
    10154                 return major_version;
    10155 
    10156         if ((p = strchr_m(vers, '.')) == 0)
    10157                 return major_version;
    10158 
    10159         *p = '\0';
    10160         major_version = atoi(vers);
    10161         return major_version;
    10162 }
    10163 
    10164 int lp_minor_announce_version(void)
    10165 {
    10166         static bool got_minor = False;
    10167         static int minor_version = DEFAULT_MINOR_VERSION;
    10168         char *vers;
    10169         char *p;
    10170 
    10171         if (got_minor)
    10172                 return minor_version;
    10173 
    10174         got_minor = True;
    10175         if ((vers = lp_announce_version()) == NULL)
    10176                 return minor_version;
    10177 
    10178         if ((p = strchr_m(vers, '.')) == 0)
    10179                 return minor_version;
    10180 
    10181         p++;
    10182         minor_version = atoi(p);
    10183         return minor_version;
    10184 }
    10185 
    10186 /***********************************************************
    10187  Set the global name resolution order (used in smbclient).
    10188 ************************************************************/
    10189 
    10190 void lp_set_name_resolve_order(const char *new_order)
    10191 {
    10192         string_set(&Globals.szNameResolveOrder, new_order);
    10193 }
    10194 
    10195 const char *lp_printername(int snum)
    10196 {
    10197         const char *ret = _lp_printername(snum);
    10198         if (ret == NULL || (ret != NULL && *ret == '\0'))
     4213        ServicePtrs[snum]->valid = false;
     4214}
     4215
     4216const char *lp_printername(TALLOC_CTX *ctx, int snum)
     4217{
     4218        const char *ret = lp__printername(ctx, snum);
     4219        if (ret == NULL || *ret == '\0') {
    101994220                ret = lp_const_servicename(snum);
     4221        }
    102004222
    102014223        return ret;
     
    102094231void lp_set_logfile(const char *name)
    102104232{
    10211         string_set(&Globals.szLogFile, name);
     4233        lpcfg_string_set(Globals.ctx, &Globals.logfile, name);
    102124234        debug_set_logfile(name);
    102134235}
     
    102194241int lp_maxprintjobs(int snum)
    102204242{
    10221         int maxjobs = LP_SNUM_OK(snum) ? ServicePtrs[snum]->iMaxPrintJobs : sDefault.iMaxPrintJobs;
     4243        int maxjobs = lp_max_print_jobs(snum);
     4244
    102224245        if (maxjobs <= 0 || maxjobs >= PRINT_MAX_JOBID)
    102234246                maxjobs = PRINT_MAX_JOBID - 1;
     
    102284251const char *lp_printcapname(void)
    102294252{
    10230         if ((Globals.szPrintcapname != NULL) &&
    10231             (Globals.szPrintcapname[0] != '\0'))
    10232                 return Globals.szPrintcapname;
    10233 
    10234         if (sDefault.iPrinting == PRINT_CUPS) {
    10235 #ifdef HAVE_CUPS
     4253        const char *printcap_name = lp_printcap_name();
     4254
     4255        if ((printcap_name != NULL) &&
     4256            (printcap_name[0] != '\0'))
     4257                return printcap_name;
     4258
     4259        if (sDefault.printing == PRINT_CUPS) {
    102364260                return "cups";
    10237 #else
    10238                 return "lpstat";
    10239 #endif
    10240         }
    10241 
    10242         if (sDefault.iPrinting == PRINT_BSD)
     4261        }
     4262
     4263        if (sDefault.printing == PRINT_BSD)
    102434264                return "/etc/printcap";
    102444265
     
    102464267}
    102474268
    10248 static uint32 spoolss_state;
     4269static uint32_t spoolss_state;
    102494270
    102504271bool lp_disable_spoolss( void )
    102514272{
    102524273        if ( spoolss_state == SVCCTL_STATE_UNKNOWN )
    10253                 spoolss_state = _lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
    10254 
    10255         return spoolss_state == SVCCTL_STOPPED ? True : False;
    10256 }
    10257 
    10258 void lp_set_spoolss_state( uint32 state )
     4274                spoolss_state = lp__disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
     4275
     4276        return spoolss_state == SVCCTL_STOPPED ? true : false;
     4277}
     4278
     4279void lp_set_spoolss_state( uint32_t state )
    102594280{
    102604281        SMB_ASSERT( (state == SVCCTL_STOPPED) || (state == SVCCTL_RUNNING) );
     
    102634284}
    102644285
    10265 uint32 lp_get_spoolss_state( void )
     4286uint32_t lp_get_spoolss_state( void )
    102664287{
    102674288        return lp_disable_spoolss() ? SVCCTL_STOPPED : SVCCTL_RUNNING;
     
    102834304                sign_active = smb_signing_is_active(signing_state);
    102844305        }
    10285         return (_lp_use_sendfile(snum) &&
     4306        return (lp__use_sendfile(snum) &&
    102864307                        (get_remote_arch() != RA_WIN95) &&
    102874308                        !sign_active);
     
    102954316{
    102964317        if (LP_SNUM_OK(snum))
    10297                 ServicePtrs[snum]->bUseSendfile = val;
     4318                ServicePtrs[snum]->_use_sendfile = val;
    102984319        else
    10299                 sDefault.bUseSendfile = val;
    10300 }
    10301 
    10302 /*******************************************************************
    10303  Turn off storing DOS attributes if this share doesn't support it.
    10304 ********************************************************************/
    10305 
    10306 void set_store_dos_attributes(int snum, bool val)
    10307 {
    10308         if (!LP_SNUM_OK(snum))
    10309                 return;
    10310         ServicePtrs[(snum)]->bStoreDosAttributes = val;
     4320                sDefault._use_sendfile = val;
    103114321}
    103124322
    103134323void lp_set_mangling_method(const char *new_method)
    103144324{
    10315         string_set(&Globals.szManglingMethod, new_method);
     4325        lpcfg_string_set(Globals.ctx, &Globals.mangling_method, new_method);
    103164326}
    103174327
     
    103344344void lp_set_posix_pathnames(void)
    103354345{
    10336         posix_pathnames = True;
     4346        posix_pathnames = true;
    103374347}
    103384348
     
    103494359                return posix_cifsx_locktype;
    103504360        } else {
    10351                 return fsp->posix_open ? POSIX_LOCK : WINDOWS_LOCK;
     4361                return (fsp->posix_flags & FSP_POSIX_FLAGS_OPEN) ?
     4362                        POSIX_LOCK : WINDOWS_LOCK;
    103524363        }
    103534364}
     
    103584369void lp_set_posix_default_cifsx_readwrite_locktype(enum brl_flavour val)
    103594370{
    10360         posix_default_lock_was_set = True;
     4371        posix_default_lock_was_set = true;
    103614372        posix_cifsx_locktype = val;
    103624373}
     
    103644375int lp_min_receive_file_size(void)
    103654376{
    10366         if (Globals.iminreceivefile < 0) {
     4377        int min_receivefile_size = lp_min_receivefile_size();
     4378
     4379        if (min_receivefile_size < 0) {
    103674380                return 0;
    103684381        }
    10369         return MIN(Globals.iminreceivefile, BUFFER_SIZE);
    10370 }
    10371 
    10372 /*******************************************************************
    10373  If socket address is an empty character string, it is necessary to
    10374  define it as "0.0.0.0".
    10375 ********************************************************************/
    10376 
    10377 const char *lp_socket_address(void)
    10378 {
    10379         char *sock_addr = Globals.szSocketAddress;
    10380 
    10381         if (sock_addr[0] == '\0'){
    10382                 string_set(&Globals.szSocketAddress, "0.0.0.0");
    10383         }
    10384         return  Globals.szSocketAddress;
    10385 }
    10386 
    10387 void lp_set_passdb_backend(const char *backend)
    10388 {
    10389         string_set(&Globals.szPassdbBackend, backend);
     4382        return min_receivefile_size;
    103904383}
    103914384
     
    103964389********************************************************************/
    103974390
    10398 static bool lp_widelinks_internal(int snum)
    10399 {
    10400         return (bool)(LP_SNUM_OK(snum)? ServicePtrs[(snum)]->bWidelinks :
    10401                         sDefault.bWidelinks);
    10402 }
    10403 
    104044391void widelinks_warning(int snum)
    104054392{
    10406         if (lp_allow_insecure_widelinks()) {
     4393        if (lp_allow_insecure_wide_links()) {
    104074394                return;
    104084395        }
    104094396
    10410         if (lp_unix_extensions() && lp_widelinks_internal(snum)) {
     4397        if (lp_unix_extensions() && lp_wide_links(snum)) {
    104114398                DEBUG(0,("Share '%s' has wide links and unix extensions enabled. "
    104124399                        "These parameters are incompatible. "
    104134400                        "Wide links will be disabled for this share.\n",
    10414                         lp_servicename(snum) ));
     4401                         lp_servicename(talloc_tos(), snum) ));
    104154402        }
    104164403}
     
    104244411                 * turned on.
    104254412                 */
    10426                 if (!lp_allow_insecure_widelinks()) {
     4413                if (!lp_allow_insecure_wide_links()) {
    104274414                        return false;
    104284415                }
    104294416        }
    104304417
    10431         return lp_widelinks_internal(snum);
    10432 }
    10433 
    10434 bool lp_writeraw(void)
    10435 {
    10436         if (lp_async_smb_echo_handler()) {
    10437                 return false;
    10438         }
    10439         return _lp_writeraw();
    10440 }
    10441 
    10442 bool lp_readraw(void)
    10443 {
    10444         if (lp_async_smb_echo_handler()) {
    10445                 return false;
    10446         }
    10447         return _lp_readraw();
    10448 }
     4418        return lp_wide_links(snum);
     4419}
     4420
     4421int lp_server_role(void)
     4422{
     4423        return lp_find_server_role(lp__server_role(),
     4424                                   lp__security(),
     4425                                   lp__domain_logons(),
     4426                                   lp_domain_master_true_or_auto());
     4427}
     4428
     4429int lp_security(void)
     4430{
     4431        return lp_find_security(lp__server_role(),
     4432                                lp__security());
     4433}
     4434
     4435int lp_client_max_protocol(void)
     4436{
     4437        int client_max_protocol = lp__client_max_protocol();
     4438        if (client_max_protocol == PROTOCOL_DEFAULT) {
     4439                return PROTOCOL_NT1;
     4440        }
     4441        return client_max_protocol;
     4442}
     4443
     4444int lp_client_ipc_min_protocol(void)
     4445{
     4446        int client_ipc_min_protocol = lp__client_ipc_min_protocol();
     4447        if (client_ipc_min_protocol == PROTOCOL_DEFAULT) {
     4448                client_ipc_min_protocol = lp_client_min_protocol();
     4449        }
     4450        if (client_ipc_min_protocol < PROTOCOL_NT1) {
     4451                return PROTOCOL_NT1;
     4452        }
     4453        return client_ipc_min_protocol;
     4454}
     4455
     4456int lp_client_ipc_max_protocol(void)
     4457{
     4458        int client_ipc_max_protocol = lp__client_ipc_max_protocol();
     4459        if (client_ipc_max_protocol == PROTOCOL_DEFAULT) {
     4460                return PROTOCOL_LATEST;
     4461        }
     4462        if (client_ipc_max_protocol < PROTOCOL_NT1) {
     4463                return PROTOCOL_NT1;
     4464        }
     4465        return client_ipc_max_protocol;
     4466}
     4467
     4468int lp_client_ipc_signing(void)
     4469{
     4470        int client_ipc_signing = lp__client_ipc_signing();
     4471        if (client_ipc_signing == SMB_SIGNING_DEFAULT) {
     4472                return SMB_SIGNING_REQUIRED;
     4473        }
     4474        return client_ipc_signing;
     4475}
     4476
     4477struct loadparm_global * get_globals(void)
     4478{
     4479        return &Globals;
     4480}
     4481
     4482unsigned int * get_flags(void)
     4483{
     4484        if (flags_list == NULL) {
     4485                flags_list = talloc_zero_array(NULL, unsigned int, num_parameters());
     4486        }
     4487
     4488        return flags_list;
     4489}
  • vendor/current/source3/param/test_lp_load.c

    r740 r988  
    3939        TALLOC_CTX *frame = talloc_stackframe();
    4040
    41         load_case_tables();
     41        smb_init_locale();
    4242        lp_set_cmdline("log level", "0");
    4343
     
    6262        for (i=0; i < count; i++) {
    6363                printf("call lp_load() #%d: ", i+1);
    64                 if (!lp_load_with_registry_shares(config_file,
    65                                                   False, /* global only */
    66                                                   True,  /* save defaults */
    67                                                   False, /*add_ipc */
    68                                                   True)) /*init globals */
    69                 {
     64                if (!lp_load_with_registry_shares(config_file)) {
    7065                        printf("ERROR.\n");
    7166                        ret = 1;
  • vendor/current/source3/param/util.c

    r414 r988  
    2424 "parameter = value"
    2525**********************************************************/
    26 uint32 get_int_param( const char* param )
     26uint32_t get_int_param( const char* param )
    2727{
    2828        char *p;
Note: See TracChangeset for help on using the changeset viewer.