s4-provision set passdb backend to 'samba4' in template smb.conf files
[amitay/samba.git] / source4 / param / loadparm.c
index cbe579c7a5661eddcc312ca97368de41fc7f3eaa..74c05505222fea9c03fda6a5f4eeeaec46ec2fda 100644 (file)
@@ -61,7 +61,6 @@
 #include "smb_server/smb_server.h"
 #include "libcli/raw/signing.h"
 #include "../lib/util/dlinklist.h"
-#include "../lib/util/parmlist.h"
 #include "param/param.h"
 #include "param/loadparm.h"
 #include "libcli/raw/libcliraw.h"
@@ -69,6 +68,7 @@
 #include "lib/socket/socket.h"
 #include "auth/gensec/gensec.h"
 #include "s3_param.h"
+#include "../lib/util/bitmap.h"
 
 #define standard_sub_basic talloc_strdup
 
@@ -85,22 +85,9 @@ static bool defaults_saved = false;
        char *tls_dhpfile;                                              \
        char *loglevel;                                                 \
        char *panic_action;                                             \
-       int bPreferredMaster;                                           \
-       char *szAnnounceVersion;        /* This is initialised in init_globals */
-#define LOADPARM_EXTRA_LOCALS                          \
-       struct parmlist_entry *param_opt;               \
-       char *szService;                                \
-       char *szCopy;                                   \
-       char *szInclude;                                \
-       char *szPrintername;                            \
-       int bAvailable;                                 \
-       int iMaxPrintJobs;                              \
-       char *volume;                                   \
-       int *copymap;                                   \
-       char dummy[3];          /* for alignment */
+       int bPreferredMaster;
 
 #include "param_global.h"
-#include "param_local.h"
 
 #define NUMPARAMETERS (sizeof(parm_table) / sizeof(struct parm_struct))
 
@@ -196,165 +183,1112 @@ static const struct enum_list enum_server_role[] = {
 #define LOCAL_VAR(name) offsetof(struct loadparm_service, name)
 
 static struct parm_struct parm_table[] = {
-       {"server role", P_ENUM, P_GLOBAL, GLOBAL_VAR(server_role), NULL, enum_server_role},
-       {"dos charset", P_STRING, P_GLOBAL, GLOBAL_VAR(dos_charset), NULL, NULL},
-       {"unix charset", P_STRING, P_GLOBAL, GLOBAL_VAR(unix_charset), NULL, NULL},
-       {"ncalrpc dir", P_STRING, P_GLOBAL, GLOBAL_VAR(ncalrpc_dir), NULL, NULL},
-       {"comment", P_STRING, P_LOCAL, LOCAL_VAR(comment), NULL, NULL},
-       {"path", P_STRING, P_LOCAL, LOCAL_VAR(szPath), NULL, NULL},
-       {"directory", P_STRING, P_LOCAL, LOCAL_VAR(szPath), NULL, NULL},
-       {"workgroup", P_USTRING, P_GLOBAL, GLOBAL_VAR(szWorkgroup), NULL, NULL},
-       {"realm", P_STRING, P_GLOBAL, GLOBAL_VAR(szRealm), handle_realm, NULL},
-       {"netbios name", P_USTRING, P_GLOBAL, GLOBAL_VAR(szNetbiosName), NULL, NULL},
-       {"netbios aliases", P_LIST, P_GLOBAL, GLOBAL_VAR(szNetbiosAliases), NULL, NULL},
-       {"netbios scope", P_USTRING, P_GLOBAL, GLOBAL_VAR(szNetbiosScope), NULL, NULL},
-       {"server string", P_STRING, P_GLOBAL, GLOBAL_VAR(szServerString), NULL, NULL},
-       {"interfaces", P_LIST, P_GLOBAL, GLOBAL_VAR(szInterfaces), NULL, NULL},
-       {"bind interfaces only", P_BOOL, P_GLOBAL, GLOBAL_VAR(bBindInterfacesOnly), NULL, NULL},
-       {"ntvfs handler", P_LIST, P_LOCAL, LOCAL_VAR(ntvfs_handler), NULL, NULL},
-       {"ntptr providor", P_STRING, P_GLOBAL, GLOBAL_VAR(ntptr_providor), NULL, NULL},
-       {"dcerpc endpoint servers", P_LIST, P_GLOBAL, GLOBAL_VAR(dcerpc_ep_servers), NULL, NULL},
-       {"server services", P_LIST, P_GLOBAL, GLOBAL_VAR(server_services), NULL, NULL},
-
-       {"security", P_ENUM, P_GLOBAL, GLOBAL_VAR(security), NULL, enum_security},
-       {"encrypt passwords", P_BOOL, P_GLOBAL, GLOBAL_VAR(bEncryptPasswords), NULL, NULL},
-       {"null passwords", P_BOOL, P_GLOBAL, GLOBAL_VAR(bNullPasswords), NULL, NULL},
-       {"obey pam restrictions", P_BOOL, P_GLOBAL, GLOBAL_VAR(bObeyPamRestrictions), NULL, NULL},
-       {"password server", P_LIST, P_GLOBAL, GLOBAL_VAR(szPasswordServers), NULL, NULL},
-       {"spoolss database", P_STRING, P_GLOBAL, GLOBAL_VAR(szSPOOLSS_URL), NULL, NULL},
-       {"wins config database", P_STRING, P_GLOBAL, GLOBAL_VAR(szWINS_CONFIG_URL), NULL, NULL},
-       {"wins database", P_STRING, P_GLOBAL, GLOBAL_VAR(szWINS_URL), NULL, NULL},
-       {"private dir", P_STRING, P_GLOBAL, GLOBAL_VAR(szPrivateDir), NULL, NULL},
-       {"passwd chat", P_STRING, P_GLOBAL, GLOBAL_VAR(szPasswdChat), NULL, NULL},
-       {"password level", P_INTEGER, P_GLOBAL, GLOBAL_VAR(pwordlevel), NULL, NULL},
-       {"lanman auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bLanmanAuth), NULL, NULL},
-       {"ntlm auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bNTLMAuth), NULL, NULL},
-       {"client NTLMv2 auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bClientNTLMv2Auth), NULL, NULL},
-       {"client lanman auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bClientLanManAuth), NULL, NULL},
-       {"client plaintext auth", P_BOOL, P_GLOBAL, GLOBAL_VAR(bClientPlaintextAuth), NULL, NULL},
-       {"client use spnego principal", P_BOOL, P_GLOBAL, GLOBAL_VAR(client_use_spnego_principal), NULL, NULL},
-
-       {"read only", P_BOOL, P_LOCAL, LOCAL_VAR(bRead_only), NULL, NULL},
-
-       {"create mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iCreate_mask), NULL, NULL},
-       {"force create mode", P_OCTAL, P_LOCAL, LOCAL_VAR(iCreate_force_mode), NULL, NULL}, 
-       {"directory mask", P_OCTAL, P_LOCAL, LOCAL_VAR(iDir_mask), NULL, NULL},
-       {"force directory mode", P_OCTAL, P_LOCAL, LOCAL_VAR(iDir_force_mode), NULL, NULL}, 
-
-       {"hosts allow", P_LIST, P_LOCAL, LOCAL_VAR(szHostsallow), NULL, NULL},
-       {"hosts deny", P_LIST, P_LOCAL, LOCAL_VAR(szHostsdeny), NULL, NULL},
-
-       {"log level", P_STRING, P_GLOBAL, GLOBAL_VAR(loglevel), handle_debuglevel, NULL},
-       {"debuglevel", P_STRING, P_GLOBAL, GLOBAL_VAR(loglevel), handle_debuglevel, NULL},
-       {"log file", P_STRING, P_GLOBAL, GLOBAL_VAR(logfile), handle_logfile, NULL},
-
-       {"smb ports", P_LIST, P_GLOBAL, GLOBAL_VAR(smb_ports), NULL, NULL},
-       {"nbt port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(nbt_port), NULL, NULL},
-       {"dgram port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(dgram_port), NULL, NULL},
-       {"cldap port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(cldap_port), NULL, NULL},
-       {"krb5 port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(krb5_port), NULL, NULL},
-       {"kpasswd port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(kpasswd_port), NULL, NULL},
-       {"web port", P_INTEGER, P_GLOBAL, GLOBAL_VAR(web_port), NULL, NULL},
-       {"tls enabled", P_BOOL, P_GLOBAL, GLOBAL_VAR(tls_enabled), NULL, NULL},
-       {"tls keyfile", P_STRING, P_GLOBAL, GLOBAL_VAR(tls_keyfile), NULL, NULL},
-       {"tls certfile", P_STRING, P_GLOBAL, GLOBAL_VAR(tls_certfile), NULL, NULL},
-       {"tls cafile", P_STRING, P_GLOBAL, GLOBAL_VAR(tls_cafile), NULL, NULL},
-       {"tls crlfile", P_STRING, P_GLOBAL, GLOBAL_VAR(tls_crlfile), NULL, NULL},
-       {"tls dh params file", P_STRING, P_GLOBAL, GLOBAL_VAR(tls_dhpfile), NULL, NULL},
-       {"large readwrite", P_BOOL, P_GLOBAL, GLOBAL_VAR(bLargeReadwrite), NULL, NULL},
-       {"server max protocol", P_ENUM, P_GLOBAL, GLOBAL_VAR(srv_maxprotocol), NULL, enum_protocol},
-       {"server min protocol", P_ENUM, P_GLOBAL, GLOBAL_VAR(srv_minprotocol), NULL, enum_protocol},
-       {"client max protocol", P_ENUM, P_GLOBAL, GLOBAL_VAR(cli_maxprotocol), NULL, enum_protocol},
-       {"client min protocol", P_ENUM, P_GLOBAL, GLOBAL_VAR(cli_minprotocol), NULL, enum_protocol},
-       {"unicode", P_BOOL, P_GLOBAL, GLOBAL_VAR(bUnicode), NULL, NULL},
-       {"read raw", P_BOOL, P_GLOBAL, GLOBAL_VAR(bReadRaw), NULL, NULL},
-       {"write raw", P_BOOL, P_GLOBAL, GLOBAL_VAR(bWriteRaw), NULL, NULL},
-       {"disable netbios", P_BOOL, P_GLOBAL, GLOBAL_VAR(bDisableNetbios), NULL, NULL},
-
-       {"nt status support", P_BOOL, P_GLOBAL, GLOBAL_VAR(bNTStatusSupport), NULL, NULL},
-
-       {"announce version", P_STRING, P_GLOBAL, GLOBAL_VAR(szAnnounceVersion), NULL, NULL},
-       {"max mux", P_INTEGER, P_GLOBAL, GLOBAL_VAR(max_mux), NULL, NULL},
-       {"max xmit", P_BYTES, P_GLOBAL, GLOBAL_VAR(max_xmit), NULL, NULL},
-
-       {"name resolve order", P_LIST, P_GLOBAL, GLOBAL_VAR(szNameResolveOrder), NULL, NULL},
-       {"max wins ttl", P_INTEGER, P_GLOBAL, GLOBAL_VAR(max_wins_ttl), NULL, NULL},
-       {"min wins ttl", P_INTEGER, P_GLOBAL, GLOBAL_VAR(min_wins_ttl), NULL, NULL},
-       {"time server", P_BOOL, P_GLOBAL, GLOBAL_VAR(bTimeServer), NULL, NULL},
-       {"unix extensions", P_BOOL, P_GLOBAL, GLOBAL_VAR(bUnixExtensions), NULL, NULL},
-       {"use spnego", P_BOOL, P_GLOBAL, GLOBAL_VAR(bUseSpnego), NULL, NULL},
-       {"server signing", P_ENUM, P_GLOBAL, GLOBAL_VAR(server_signing), NULL, enum_smb_signing_vals}, 
-       {"client signing", P_ENUM, P_GLOBAL, GLOBAL_VAR(client_signing), NULL, enum_smb_signing_vals}, 
-       {"rpc big endian", P_BOOL, P_GLOBAL, GLOBAL_VAR(bRpcBigEndian), NULL, NULL},
-
-       {"max connections", P_INTEGER, P_LOCAL, LOCAL_VAR(iMaxConnections), NULL, NULL},
-       {"paranoid server security", P_BOOL, P_GLOBAL, GLOBAL_VAR(paranoid_server_security), NULL, NULL},
-       {"socket options", P_STRING, P_GLOBAL, GLOBAL_VAR(socket_options), NULL, NULL},
-
-       {"strict sync", P_BOOL, P_LOCAL, LOCAL_VAR(bStrictSync), NULL, NULL},
-       {"case insensitive filesystem", P_BOOL, P_LOCAL, LOCAL_VAR(bCIFileSystem), NULL, NULL}, 
-
-       {"max print jobs", P_INTEGER, P_LOCAL, LOCAL_VAR(iMaxPrintJobs), NULL, NULL},
-       {"printable", P_BOOL, P_LOCAL, LOCAL_VAR(bPrint_ok), NULL, NULL},
-       {"print ok", P_BOOL, P_LOCAL, LOCAL_VAR(bPrint_ok), NULL, NULL},
-
-       {"printer name", P_STRING, P_LOCAL, LOCAL_VAR(szPrintername), NULL, NULL},
-       {"printer", P_STRING, P_LOCAL, LOCAL_VAR(szPrintername), NULL, NULL},
-
-       {"map system", P_BOOL, P_LOCAL, LOCAL_VAR(bMap_system), NULL, NULL},
-       {"map hidden", P_BOOL, P_LOCAL, LOCAL_VAR(bMap_hidden), NULL, NULL},
-       {"map archive", P_BOOL, P_LOCAL, LOCAL_VAR(bMap_archive), NULL, NULL},
-
-       {"preferred master", P_ENUM, P_GLOBAL, GLOBAL_VAR(bPreferredMaster), NULL, enum_bool_auto},
-       {"prefered master", P_ENUM, P_GLOBAL, GLOBAL_VAR(bPreferredMaster), NULL, enum_bool_auto},
-       {"local master", P_BOOL, P_GLOBAL, GLOBAL_VAR(bLocalMaster), NULL, NULL},
-       {"browseable", P_BOOL, P_LOCAL, LOCAL_VAR(bBrowseable), NULL, NULL},
-       {"browsable", P_BOOL, P_LOCAL, LOCAL_VAR(bBrowseable), NULL, NULL},
-
-       {"wins server", P_LIST, P_GLOBAL, GLOBAL_VAR(szWINSservers), NULL, NULL},
-       {"wins support", P_BOOL, P_GLOBAL, GLOBAL_VAR(bWINSsupport), NULL, NULL},
-       {"dns proxy", P_BOOL, P_GLOBAL, GLOBAL_VAR(bWINSdnsProxy), NULL, NULL},
-       {"wins hook", P_STRING, P_GLOBAL, GLOBAL_VAR(szWINSHook), NULL, NULL}, 
-
-       {"csc policy", P_ENUM, P_LOCAL, LOCAL_VAR(iCSCPolicy), NULL, enum_csc_policy},
-
-       {"strict locking", P_BOOL, P_LOCAL, LOCAL_VAR(bStrictLocking), NULL, NULL},
-       {"oplocks", P_BOOL, P_LOCAL, LOCAL_VAR(bOplocks), NULL, NULL},
-
-       {"share backend", P_STRING, P_GLOBAL, GLOBAL_VAR(szShareBackend), NULL, NULL},
-       {"preload", P_STRING, P_GLOBAL, GLOBAL_VAR(szAutoServices), NULL, NULL},
-       {"auto services", P_STRING, P_GLOBAL, GLOBAL_VAR(szAutoServices), NULL, NULL},
-       {"lock dir", P_STRING, P_GLOBAL, GLOBAL_VAR(szLockDir), NULL, NULL}, 
-       {"lock directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szLockDir), NULL, NULL},
-       {"pid directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szPidDir), NULL, NULL}, 
-
-       {"socket address", P_STRING, P_GLOBAL, GLOBAL_VAR(szSocketAddress), NULL, NULL},
-       {"copy", P_STRING, P_LOCAL, LOCAL_VAR(szCopy), handle_copy, NULL},
-       {"include", P_STRING, P_LOCAL, LOCAL_VAR(szInclude), handle_include, NULL},
-
-       {"available", P_BOOL, P_LOCAL, LOCAL_VAR(bAvailable), NULL, NULL},
-       {"volume", P_STRING, P_LOCAL, LOCAL_VAR(volume), NULL, NULL },
-       {"fstype", P_STRING, P_LOCAL, LOCAL_VAR(fstype), NULL, NULL},
-
-       {"panic action", P_STRING, P_GLOBAL, GLOBAL_VAR(panic_action), NULL, NULL},
-
-       {"msdfs root", P_BOOL, P_LOCAL, LOCAL_VAR(bMSDfsRoot), NULL, NULL},
-       {"host msdfs", P_BOOL, P_GLOBAL, GLOBAL_VAR(bHostMSDfs), NULL, NULL},
-       {"winbind separator", P_STRING, P_GLOBAL, GLOBAL_VAR(szWinbindSeparator), NULL, NULL },
-       {"winbindd socket directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szWinbinddSocketDirectory), NULL, NULL },
-       {"winbindd privileged socket directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szWinbinddPrivilegedSocketDirectory), NULL, NULL },
-       {"winbind sealed pipes", P_BOOL, P_GLOBAL, GLOBAL_VAR(bWinbindSealedPipes), NULL, NULL },
-       {"template shell", P_STRING, P_GLOBAL, GLOBAL_VAR(szTemplateShell), NULL, NULL },
-       {"template homedir", P_STRING, P_GLOBAL, GLOBAL_VAR(szTemplateHomedir), NULL, NULL },
-       {"idmap trusted only", P_BOOL, P_GLOBAL, GLOBAL_VAR(bIdmapTrustedOnly), NULL, NULL},
-
-       {"ntp signd socket directory", P_STRING, P_GLOBAL, GLOBAL_VAR(szNTPSignDSocketDirectory), NULL, NULL },
-       {"rndc command", P_CMDLIST, P_GLOBAL, GLOBAL_VAR(szRNDCCommand), NULL, NULL },
-       {"dns update command", P_CMDLIST, P_GLOBAL, GLOBAL_VAR(szDNSUpdateCommand), NULL, NULL },
-       {"spn update command", P_CMDLIST, P_GLOBAL, GLOBAL_VAR(szSPNUpdateCommand), NULL, NULL },
-       {"nsupdate command", P_CMDLIST, P_GLOBAL, GLOBAL_VAR(szNSUpdateCommand), NULL, NULL },
-
-       {NULL, P_BOOL, P_NONE, 0, NULL, NULL}
+       {
+               .label          = "server role",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(server_role),
+               .special        = NULL,
+               .enum_list      = enum_server_role
+       },
+       {
+               .label          = "dos charset",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(dos_charset),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "unix charset",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(unix_charset),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "ncalrpc dir",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(ncalrpc_dir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "comment",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(comment),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "path",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szPath),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "directory",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szPath),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "workgroup",
+               .type           = P_USTRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWorkgroup),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "realm",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szRealm),
+               .special        = handle_realm,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "netbios name",
+               .type           = P_USTRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNetbiosName),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "netbios aliases",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNetbiosAliases),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "netbios scope",
+               .type           = P_USTRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNetbiosScope),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "server string",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szServerString),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "interfaces",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szInterfaces),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "bind interfaces only",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bBindInterfacesOnly),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "ntvfs handler",
+               .type           = P_LIST,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(ntvfs_handler),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "ntptr providor",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(ntptr_providor),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "passdb backend",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(passdb_backend),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "dcerpc endpoint servers",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(dcerpc_ep_servers),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "server services",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(server_services),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "security",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(security),
+               .special        = NULL,
+               .enum_list      = enum_security
+       },
+       {
+               .label          = "encrypt passwords",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bEncryptPasswords),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "null passwords",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bNullPasswords),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "obey pam restrictions",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bObeyPamRestrictions),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "password server",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szPasswordServers),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "spoolss database",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szSPOOLSS_URL),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "wins config database",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWINS_CONFIG_URL),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "wins database",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWINS_URL),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "private dir",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szPrivateDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "passwd chat",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szPasswdChat),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "password level",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(pwordlevel),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "lanman auth",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bLanmanAuth),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "ntlm auth",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bNTLMAuth),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "client NTLMv2 auth",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bClientNTLMv2Auth),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "client lanman auth",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bClientLanManAuth),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "client plaintext auth",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bClientPlaintextAuth),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "client use spnego principal",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(client_use_spnego_principal),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "read only",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bRead_only),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "create mask",
+               .type           = P_OCTAL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iCreate_mask),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "force create mode",
+               .type           = P_OCTAL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iCreate_force_mode),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "directory mask",
+               .type           = P_OCTAL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iDir_mask),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "force directory mode",
+               .type           = P_OCTAL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iDir_force_mode),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "hosts allow",
+               .type           = P_LIST,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szHostsallow),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "hosts deny",
+               .type           = P_LIST,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szHostsdeny),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "log level",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(loglevel),
+               .special        = handle_debuglevel,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "debuglevel",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(loglevel),
+               .special        = handle_debuglevel,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "log file",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(logfile),
+               .special        = handle_logfile,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "smb ports",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(smb_ports),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "nbt port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(nbt_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "dgram port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(dgram_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "cldap port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(cldap_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "krb5 port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(krb5_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "kpasswd port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(kpasswd_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "web port",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(web_port),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls enabled",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_enabled),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls keyfile",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_keyfile),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls certfile",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_certfile),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls cafile",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_cafile),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls crlfile",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_crlfile),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "tls dh params file",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(tls_dhpfile),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "large readwrite",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bLargeReadwrite),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "server max protocol",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(srv_maxprotocol),
+               .special        = NULL,
+               .enum_list      = enum_protocol
+       },
+       {
+               .label          = "server min protocol",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(srv_minprotocol),
+               .special        = NULL,
+               .enum_list      = enum_protocol
+       },
+       {
+               .label          = "client max protocol",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(cli_maxprotocol),
+               .special        = NULL,
+               .enum_list      = enum_protocol
+       },
+       {
+               .label          = "client min protocol",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(cli_minprotocol),
+               .special        = NULL,
+               .enum_list      = enum_protocol
+       },
+       {
+               .label          = "unicode",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bUnicode),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "read raw",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bReadRaw),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "write raw",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bWriteRaw),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "disable netbios",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bDisableNetbios),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "nt status support",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bNTStatusSupport),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "max mux",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(max_mux),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "max xmit",
+               .type           = P_BYTES,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(max_xmit),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "name resolve order",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNameResolveOrder),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "max wins ttl",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(max_wins_ttl),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "min wins ttl",
+               .type           = P_INTEGER,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(min_wins_ttl),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "time server",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bTimeServer),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "unix extensions",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bUnixExtensions),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "use spnego",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bUseSpnego),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "server signing",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(server_signing),
+               .special        = NULL,
+               .enum_list      = enum_smb_signing_vals
+       },
+       {
+               .label          = "client signing",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(client_signing),
+               .special        = NULL,
+               .enum_list      = enum_smb_signing_vals
+       },
+       {
+               .label          = "rpc big endian",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bRpcBigEndian),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "max connections",
+               .type           = P_INTEGER,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iMaxConnections),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "paranoid server security",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(paranoid_server_security),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "socket options",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(socket_options),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "strict sync",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bStrictSync),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "case insensitive filesystem",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bCIFileSystem),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "max print jobs",
+               .type           = P_INTEGER,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iMaxPrintJobs),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "printable",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bPrint_ok),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "print ok",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bPrint_ok),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "printer name",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szPrintername),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "printer",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szPrintername),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "map system",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bMap_system),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "map hidden",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bMap_hidden),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "map archive",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bMap_archive),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "preferred master",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bPreferredMaster),
+               .special        = NULL,
+               .enum_list      = enum_bool_auto
+       },
+       {
+               .label          = "prefered master",
+               .type           = P_ENUM,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bPreferredMaster),
+               .special        = NULL,
+               .enum_list      = enum_bool_auto
+       },
+       {
+               .label          = "local master",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bLocalMaster),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "browseable",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bBrowseable),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "browsable",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bBrowseable),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "wins server",
+               .type           = P_LIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWINSservers),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "wins support",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bWINSsupport),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "dns proxy",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bWINSdnsProxy),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "wins hook",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWINSHook),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "csc policy",
+               .type           = P_ENUM,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iCSCPolicy),
+               .special        = NULL,
+               .enum_list      = enum_csc_policy
+       },
+
+       {
+               .label          = "strict locking",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(iStrictLocking),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "oplocks",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bOpLocks),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "share backend",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szShareBackend),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "preload",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szAutoServices),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "auto services",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szAutoServices),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "lock dir",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szLockDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "lock directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szLockDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "state directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szStateDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "cache directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szCacheDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "pid directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szPidDir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "socket address",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szSocketAddress),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "copy",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szCopy),
+               .special        = handle_copy,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "include",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(szInclude),
+               .special        = handle_include,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "available",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bAvailable),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "volume",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(volume),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "fstype",
+               .type           = P_STRING,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(fstype),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "panic action",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(panic_action),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "msdfs root",
+               .type           = P_BOOL,
+               .p_class        = P_LOCAL,
+               .offset         = LOCAL_VAR(bMSDfsRoot),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "host msdfs",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bHostMSDfs),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "winbind separator",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWinbindSeparator),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "winbindd socket directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWinbinddSocketDirectory),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "winbindd privileged socket directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szWinbinddPrivilegedSocketDirectory),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "winbind sealed pipes",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bWinbindSealedPipes),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "template shell",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szTemplateShell),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "template homedir",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szTemplateHomedir),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "idmap trusted only",
+               .type           = P_BOOL,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(bIdmapTrustedOnly),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {
+               .label          = "ntp signd socket directory",
+               .type           = P_STRING,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNTPSignDSocketDirectory),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "rndc command",
+               .type           = P_CMDLIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szRNDCCommand),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "dns update command",
+               .type           = P_CMDLIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szDNSUpdateCommand),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "spn update command",
+               .type           = P_CMDLIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szSPNUpdateCommand),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+       {
+               .label          = "nsupdate command",
+               .type           = P_CMDLIST,
+               .p_class        = P_GLOBAL,
+               .offset         = GLOBAL_VAR(szNSUpdateCommand),
+               .special        = NULL,
+               .enum_list      = NULL
+       },
+
+       {NULL,  P_BOOL,  P_NONE,  0,  NULL,  NULL,  0}
 };
 
 
@@ -385,17 +1319,12 @@ struct loadparm_context {
 
 struct loadparm_service *lpcfg_default_service(struct loadparm_context *lp_ctx)
 {
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_default_loadparm_service();
+       }
        return lp_ctx->sDefault;
 }
 
-/*
-  return the parameter table
-*/
-struct parm_struct *lpcfg_parm_table(void)
-{
-       return parm_table;
-}
-
 /**
  * Convenience routine to grab string parameters into temporary memory
  * and run standard_sub_basic on them.
@@ -510,18 +1439,25 @@ static struct loadparm_context *global_loadparm_context;
         return lp_ctx->globals->var_name;                              \
  }
 
+/* Local parameters don't need the ->s3_fns because the struct
+ * loadparm_service is shared and lpcfg_service() checks the ->s3_fns
+ * hook */
 #define FN_LOCAL_STRING(fn_name,val) \
  _PUBLIC_ const char *lpcfg_ ## fn_name(struct loadparm_service *service, \
                                        struct loadparm_service *sDefault) { \
         return(lp_string((const char *)((service != NULL && service->val != NULL) ? service->val : sDefault->val))); \
  }
 
+#define FN_LOCAL_CONST_STRING(fn_name,val) FN_LOCAL_STRING(fn_name, val)
+
 #define FN_LOCAL_LIST(fn_name,val) \
  _PUBLIC_ const char **lpcfg_ ## fn_name(struct loadparm_service *service, \
                                         struct loadparm_service *sDefault) {\
         return(const char **)(service != NULL && service->val != NULL? service->val : sDefault->val); \
  }
 
+#define FN_LOCAL_PARM_BOOL(fn_name, val) FN_LOCAL_BOOL(fn_name, val)
+
 #define FN_LOCAL_BOOL(fn_name,val) \
  _PUBLIC_ bool lpcfg_ ## fn_name(struct loadparm_service *service, \
                                 struct loadparm_service *sDefault) {   \
@@ -534,6 +1470,18 @@ static struct loadparm_context *global_loadparm_context;
         return((service != NULL)? service->val : sDefault->val); \
  }
 
+#define FN_LOCAL_PARM_INTEGER(fn_name, val) FN_LOCAL_INTEGER(fn_name, val)
+
+#define FN_LOCAL_PARM_CHAR(fn_name, val) FN_LOCAL_CHAR(fn_name, val)
+
+#define FN_LOCAL_CHAR(fn_name,val) \
+ _PUBLIC_ char lpcfg_ ## fn_name(struct loadparm_service *service, \
+                               struct loadparm_service *sDefault) {    \
+        return((service != NULL)? service->val : sDefault->val); \
+ }
+
+#include "lib/param/param_functions.c"
+
 FN_GLOBAL_INTEGER(server_role, server_role)
 FN_GLOBAL_LIST(smb_ports, smb_ports)
 FN_GLOBAL_INTEGER(nbt_port, nbt_port)
@@ -558,6 +1506,8 @@ FN_GLOBAL_BOOL(idmap_trusted_only, bIdmapTrustedOnly)
 FN_GLOBAL_STRING(private_dir, szPrivateDir)
 FN_GLOBAL_STRING(serverstring, szServerString)
 FN_GLOBAL_STRING(lockdir, szLockDir)
+FN_GLOBAL_STRING(statedir, szStateDir)
+FN_GLOBAL_STRING(cachedir, szCacheDir)
 FN_GLOBAL_STRING(ncalrpc_dir, ncalrpc_dir)
 FN_GLOBAL_STRING(dos_charset, dos_charset)
 FN_GLOBAL_STRING(unix_charset, unix_charset)
@@ -569,6 +1519,7 @@ FN_GLOBAL_LIST(nsupdate_command, szNSUpdateCommand)
 FN_GLOBAL_LIST(dcerpc_endpoint_servers, dcerpc_ep_servers)
 FN_GLOBAL_LIST(server_services, server_services)
 FN_GLOBAL_STRING(ntptr_providor, ntptr_providor)
+FN_GLOBAL_STRING(passdb_backend, passdb_backend)
 FN_GLOBAL_STRING(auto_services, szAutoServices)
 FN_GLOBAL_STRING(passwd_chat, szPasswdChat)
 FN_GLOBAL_LIST(passwordserver, szPasswordServers)
@@ -584,7 +1535,7 @@ FN_GLOBAL_LIST(interfaces, szInterfaces)
 FN_GLOBAL_STRING(socket_address, szSocketAddress)
 FN_GLOBAL_LIST(netbios_aliases, szNetbiosAliases)
 FN_GLOBAL_BOOL(disable_netbios, bDisableNetbios)
-FN_GLOBAL_BOOL(wins_support, bWINSsupport)
+FN_GLOBAL_BOOL(we_are_a_wins_server, bWINSsupport)
 FN_GLOBAL_BOOL(wins_dns_proxy, bWINSdnsProxy)
 FN_GLOBAL_STRING(wins_hook, szWINSHook)
 FN_GLOBAL_BOOL(local_master, bLocalMaster)
@@ -620,29 +1571,6 @@ FN_GLOBAL_INTEGER(cli_minprotocol, cli_minprotocol)
 FN_GLOBAL_INTEGER(security, security)
 FN_GLOBAL_BOOL(paranoid_server_security, paranoid_server_security)
 
-FN_LOCAL_STRING(pathname, szPath)
-FN_LOCAL_LIST(hostsallow, szHostsallow)
-FN_LOCAL_LIST(hostsdeny, szHostsdeny)
-FN_LOCAL_STRING(comment, comment)
-FN_LOCAL_STRING(fstype, fstype)
-FN_LOCAL_LIST(ntvfs_handler, ntvfs_handler)
-FN_LOCAL_BOOL(msdfs_root, bMSDfsRoot)
-FN_LOCAL_BOOL(browseable, bBrowseable)
-FN_LOCAL_BOOL(readonly, bRead_only)
-FN_LOCAL_BOOL(print_ok, bPrint_ok)
-FN_LOCAL_BOOL(map_hidden, bMap_hidden)
-FN_LOCAL_BOOL(map_archive, bMap_archive)
-FN_LOCAL_BOOL(strict_locking, bStrictLocking)
-FN_LOCAL_BOOL(oplocks, bOplocks)
-FN_LOCAL_BOOL(strict_sync, bStrictSync)
-FN_LOCAL_BOOL(ci_filesystem, bCIFileSystem)
-FN_LOCAL_BOOL(map_system, bMap_system)
-FN_LOCAL_INTEGER(max_connections, iMaxConnections)
-FN_LOCAL_INTEGER(csc_policy, iCSCPolicy)
-FN_LOCAL_INTEGER(create_mask, iCreate_mask)
-FN_LOCAL_INTEGER(force_create_mode, iCreate_force_mode)
-FN_LOCAL_INTEGER(dir_mask, iDir_mask)
-FN_LOCAL_INTEGER(force_dir_mode, iDir_force_mode)
 FN_GLOBAL_INTEGER(server_signing, server_signing)
 FN_GLOBAL_INTEGER(client_signing, client_signing)
 
@@ -654,7 +1582,7 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
                                        const char *pszServiceName);
 static void copy_service(struct loadparm_service *pserviceDest,
                         struct loadparm_service *pserviceSource,
-                        int *pcopymapDest);
+                        struct bitmap *pcopymapDest);
 static bool service_ok(struct loadparm_service *service);
 static bool do_section(const char *pszSectionName, void *);
 static void init_copymap(struct loadparm_service *pservice);
@@ -674,8 +1602,7 @@ const char *lpcfg_get_parametric(struct loadparm_context *lp_ctx,
                return NULL;
 
        if (lp_ctx->s3_fns) {
-               SMB_ASSERT(service == NULL);
-               return lp_ctx->s3_fns->get_parametric(type, option);
+               return lp_ctx->s3_fns->get_parametric(service, type, option);
        }
 
        data = (service == NULL ? lp_ctx->globals->param_opt : service->param_opt);
@@ -1124,9 +2051,15 @@ static int map_parameter(const char *pszParmName)
 /**
   return the parameter structure for a parameter
 */
-struct parm_struct *lpcfg_parm_struct(const char *name)
+struct parm_struct *lpcfg_parm_struct(struct loadparm_context *lp_ctx, const char *name)
 {
-       int parmnum = map_parameter(name);
+       int parmnum;
+
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_parm_struct(name);
+       }
+
+       parmnum = map_parameter(name);
        if (parmnum == -1) return NULL;
        return &parm_table[parmnum];
 }
@@ -1137,6 +2070,10 @@ struct parm_struct *lpcfg_parm_struct(const char *name)
 void *lpcfg_parm_ptr(struct loadparm_context *lp_ctx,
                  struct loadparm_service *service, struct parm_struct *parm)
 {
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_parm_ptr(service, parm);
+       }
+
        if (service == NULL) {
                if (parm->p_class == P_LOCAL)
                        return ((char *)lp_ctx->sDefault)+parm->offset;
@@ -1157,6 +2094,10 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
 {
        int iService;
 
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_service(pszServiceName);
+       }
+
        for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--)
                if (lp_ctx->services[iService] != NULL &&
                    strwicmp(lp_ctx->services[iService]->szService, pszServiceName) == 0) {
@@ -1173,7 +2114,7 @@ static struct loadparm_service *getservicebyname(struct loadparm_context *lp_ctx
 
 static void copy_service(struct loadparm_service *pserviceDest,
                         struct loadparm_service *pserviceSource,
-                        int *pcopymapDest)
+                        struct bitmap *pcopymapDest)
 {
        int i;
        bool bcopyall = (pcopymapDest == NULL);
@@ -1181,8 +2122,8 @@ static void copy_service(struct loadparm_service *pserviceDest,
        bool not_added;
 
        for (i = 0; parm_table[i].label; i++)
-               if (parm_table[i].offset != -1 && parm_table[i].p_class == P_LOCAL &&
-                   (bcopyall || pcopymapDest[i])) {
+               if (parm_table[i].p_class == P_LOCAL &&
+                   (bcopyall || bitmap_query(pcopymapDest, i))) {
                        void *src_ptr =
                                ((char *)pserviceSource) + parm_table[i].offset;
                        void *dest_ptr =
@@ -1222,9 +2163,8 @@ static void copy_service(struct loadparm_service *pserviceDest,
        if (bcopyall) {
                init_copymap(pserviceDest);
                if (pserviceSource->copymap)
-                       memcpy((void *)pserviceDest->copymap,
-                              (void *)pserviceSource->copymap,
-                              sizeof(int) * NUMPARAMETERS);
+                       bitmap_copy(pserviceDest->copymap,
+                                   pserviceSource->copymap);
        }
 
        data = pserviceSource->param_opt;
@@ -1464,16 +2404,17 @@ static bool handle_logfile(struct loadparm_context *lp_ctx, int unused,
 static void init_copymap(struct loadparm_service *pservice)
 {
        int i;
-       talloc_free(pservice->copymap);
-       pservice->copymap = talloc_array(pservice, int, NUMPARAMETERS);
-       if (pservice->copymap == NULL) {
+
+       TALLOC_FREE(pservice->copymap);
+
+       pservice->copymap = bitmap_talloc(NULL, NUMPARAMETERS);
+       if (!pservice->copymap)
                DEBUG(0,
                      ("Couldn't allocate copymap!! (size %d)\n",
                       (int)NUMPARAMETERS));
-               return;
-       }
-       for (i = 0; i < NUMPARAMETERS; i++)
-               pservice->copymap[i] = true;
+       else
+               for (i = 0; i < NUMPARAMETERS; i++)
+                       bitmap_set(pservice->copymap, i);
 }
 
 /**
@@ -1568,10 +2509,24 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
                        }
                        break;
 
+               case P_BOOLREV: {
+                       bool b;
+                       if (!set_boolean(pszParmValue, &b)) {
+                               DEBUG(0,("lp_do_parameter(%s): value is not boolean!\n", pszParmValue));
+                               return false;
+                       }
+                       *(int *)parm_ptr = !b;
+                       }
+                       break;
+
                case P_INTEGER:
                        *(int *)parm_ptr = atoi(pszParmValue);
                        break;
 
+               case P_CHAR:
+                       *(char *)parm_ptr = *pszParmValue;
+                       break;
+
                case P_OCTAL:
                        *(int *)parm_ptr = strtol(pszParmValue, NULL, 8);
                        break;
@@ -1737,7 +2692,7 @@ bool lpcfg_do_service_parameter(struct loadparm_context *lp_ctx,
        for (i = 0; parm_table[i].label; i++)
                if (parm_table[i].offset == parm_table[parmnum].offset &&
                    parm_table[i].p_class == parm_table[parmnum].p_class)
-                       service->copymap[i] = false;
+                       bitmap_clear(service->copymap, i);
 
        return set_variable(service, parmnum, parm_ptr, pszParmName,
                            pszParmValue, lp_ctx, false);
@@ -1788,9 +2743,15 @@ bool lpcfg_do_global_parameter_var(struct loadparm_context *lp_ctx,
 bool lpcfg_set_cmdline(struct loadparm_context *lp_ctx, const char *pszParmName,
                       const char *pszParmValue)
 {
-       int parmnum = map_parameter(pszParmName);
+       int parmnum;
        int i;
 
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->set_cmdline(pszParmName, pszParmValue);
+       }
+
+       parmnum = map_parameter(pszParmName);
+
        while (isspace((unsigned char)*pszParmValue)) pszParmValue++;
 
 
@@ -1878,11 +2839,19 @@ static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
                        fprintf(f, "%s", BOOLSTR((bool)*(int *)ptr));
                        break;
 
+               case P_BOOLREV:
+                       fprintf(f, "%s", BOOLSTR(!(bool)*(int *)ptr));
+                       break;
+
                case P_INTEGER:
                case P_BYTES:
                        fprintf(f, "%d", *(int *)ptr);
                        break;
 
+               case P_CHAR:
+                       fprintf(f, "%c", *(char *)ptr);
+                       break;
+
                case P_OCTAL:
                        fprintf(f, "0%o", *(int *)ptr);
                        break;
@@ -1921,6 +2890,7 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
 {
        switch (type) {
                case P_BOOL:
+               case P_BOOLREV:
                        return (*((int *)ptr1) == *((int *)ptr2));
 
                case P_INTEGER:
@@ -1929,6 +2899,9 @@ static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
                case P_ENUM:
                        return (*((int *)ptr1) == *((int *)ptr2));
 
+               case P_CHAR:
+                       return (*((char *)ptr1) == *((char *)ptr2));
+
                case P_CMDLIST:
                case P_LIST:
                        return str_list_equal((const char **)(*(char ***)ptr1),
@@ -2016,9 +2989,11 @@ static bool is_default(struct loadparm_service *sDefault, int i)
                        return strequal(parm_table[i].def.svalue,
                                        *(char **)def_ptr);
                case P_BOOL:
+               case P_BOOLREV:
                        return parm_table[i].def.bvalue ==
                                *(int *)def_ptr;
                case P_INTEGER:
+               case P_CHAR:
                case P_OCTAL:
                case P_BYTES:
                case P_ENUM:
@@ -2042,7 +3017,6 @@ static void dump_globals(struct loadparm_context *lp_ctx, FILE *f,
 
        for (i = 0; parm_table[i].label; i++)
                if (parm_table[i].p_class == P_GLOBAL &&
-                   parm_table[i].offset != -1 &&
                    (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset))) {
                        if (!show_defaults && (lp_ctx->flags[i] & FLAG_DEFAULT))
                                continue;
@@ -2077,7 +3051,6 @@ static void dump_a_service(struct loadparm_service * pService, struct loadparm_s
 
        for (i = 0; parm_table[i].label; i++) {
                if (parm_table[i].p_class == P_LOCAL &&
-                   parm_table[i].offset != -1 &&
                    (*parm_table[i].label != '-') &&
                    (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset)))
                {
@@ -2119,7 +3092,7 @@ bool lpcfg_dump_a_parameter(struct loadparm_context *lp_ctx,
        struct parm_struct *parm;
        void *ptr;
 
-       parm = lpcfg_parm_struct(parm_name);
+       parm = lpcfg_parm_struct(lp_ctx, parm_name);
        if (!parm) {
                return false;
        }
@@ -2144,13 +3117,14 @@ struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int sn
        if (snum == -1) {
                /* do the globals */
                for (; parm_table[*i].label; (*i)++) {
-                       if (parm_table[*i].offset == -1
-                           || (*parm_table[*i].label == '-'))
+                       if ((*parm_table[*i].label == '-'))
                                continue;
 
                        if ((*i) > 0
                            && (parm_table[*i].offset ==
-                               parm_table[(*i) - 1].offset))
+                               parm_table[(*i) - 1].offset)
+                           && (parm_table[*i].p_class ==
+                               parm_table[(*i) - 1].p_class))
                                continue;
 
                        return &parm_table[(*i)++];
@@ -2160,7 +3134,6 @@ struct parm_struct *lpcfg_next_parameter(struct loadparm_context *lp_ctx, int sn
 
                for (; parm_table[*i].label; (*i)++) {
                        if (parm_table[*i].p_class == P_LOCAL &&
-                           parm_table[*i].offset != -1 &&
                            (*parm_table[*i].label != '-') &&
                            ((*i) == 0 ||
                             (parm_table[*i].offset !=
@@ -2265,8 +3238,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        lp_ctx->sDefault->bBrowseable = true;
        lp_ctx->sDefault->bRead_only = true;
        lp_ctx->sDefault->bMap_archive = true;
-       lp_ctx->sDefault->bStrictLocking = true;
-       lp_ctx->sDefault->bOplocks = true;
+       lp_ctx->sDefault->iStrictLocking = true;
+       lp_ctx->sDefault->bOpLocks = true;
        lp_ctx->sDefault->iCreate_mask = 0744;
        lp_ctx->sDefault->iCreate_force_mode = 0000;
        lp_ctx->sDefault->iDir_mask = 0755;
@@ -2277,7 +3250,6 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
        for (i = 0; parm_table[i].label; i++) {
                if ((parm_table[i].type == P_STRING ||
                     parm_table[i].type == P_USTRING) &&
-                   parm_table[i].offset != -1 &&
                    !(lp_ctx->flags[i] & FLAG_CMDLINE)) {
                        char **r;
                        if (parm_table[i].p_class == P_LOCAL) {
@@ -2346,6 +3318,8 @@ struct loadparm_context *loadparm_init(TALLOC_CTX *mem_ctx)
 
        lpcfg_do_global_parameter(lp_ctx, "pid directory", dyn_PIDDIR);
        lpcfg_do_global_parameter(lp_ctx, "lock dir", dyn_LOCKDIR);
+       lpcfg_do_global_parameter(lp_ctx, "state directory", dyn_STATEDIR);
+       lpcfg_do_global_parameter(lp_ctx, "cache directory", dyn_CACHEDIR);
        lpcfg_do_global_parameter(lp_ctx, "ncalrpc dir", dyn_NCALRPCDIR);
 
        lpcfg_do_global_parameter(lp_ctx, "socket address", "");
@@ -2553,6 +3527,10 @@ bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename)
 
        lp_ctx->szConfigFile = filename;
 
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->load(filename);
+       }
+
        lp_ctx->bInGlobalSection = true;
        n2 = standard_sub_basic(lp_ctx, lp_ctx->szConfigFile);
        DEBUG(2, ("lpcfg_load: refreshing parameters from %s\n", n2));
@@ -2595,6 +3573,10 @@ bool lpcfg_load(struct loadparm_context *lp_ctx, const char *filename)
 
 int lpcfg_numservices(struct loadparm_context *lp_ctx)
 {
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_numservices();
+       }
+
        return lp_ctx->iNumServices;
 }
 
@@ -2630,8 +3612,12 @@ void lpcfg_dump_one(FILE *f, bool show_defaults, struct loadparm_service *servic
 }
 
 struct loadparm_service *lpcfg_servicebynum(struct loadparm_context *lp_ctx,
-                                        int snum)
+                                           int snum)
 {
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_servicebynum(snum);
+       }
+
        return lp_ctx->services[snum];
 }
 
@@ -2641,6 +3627,10 @@ struct loadparm_service *lpcfg_service(struct loadparm_context *lp_ctx,
        int iService;
         char *serviceName;
 
+       if (lp_ctx->s3_fns) {
+               return lp_ctx->s3_fns->get_service(service_name);
+       }
+
        for (iService = lp_ctx->iNumServices - 1; iService >= 0; iService--) {
                if (lp_ctx->services[iService] &&
                    lp_ctx->services[iService]->szService) {