param: rename lp function and variable from "readlist" to "read_list"
[samba.git] / source3 / param / loadparm.c
index 484cd69ff09be77e225ca1245d73b3fa7df38b63..9df05b68791a930aed3ddd895d7017cf5bcbbf46 100644 (file)
@@ -57,6 +57,7 @@
 #include "system/filesys.h"
 #include "util_tdb.h"
 #include "lib/param/loadparm.h"
+#include "lib/param/param.h"
 #include "printing.h"
 #include "lib/smbconf/smbconf.h"
 #include "lib/smbconf/smbconf_init.h"
@@ -131,8 +132,7 @@ static bool defaults_saved = false;
        char *tls_certfile;                                             \
        char *tls_cafile;                                               \
        char *tls_crlfile;                                              \
-       char *tls_dhpfile;                                              \
-       int bPreferredMaster;
+       char *tls_dhpfile;
 
 #include "param/param_global.h"
 
@@ -146,7 +146,7 @@ static struct loadparm_service sDefault =
        .usershare = 0,
        .usershare_last_mod = {0, 0},
        .szService = NULL,
-       .pathname = NULL,
+       .path = NULL,
        .username = NULL,
        .invalid_users = NULL,
        .valid_users = NULL,
@@ -155,30 +155,30 @@ static struct loadparm_service sDefault =
        .szInclude = NULL,
        .preexec = NULL,
        .postexec = NULL,
-       .rootpreexec = NULL,
-       .rootpostexec = NULL,
+       .root_preexec = NULL,
+       .root_postexec = NULL,
        .cups_options = NULL,
-       .printcommand = NULL,
-       .lpqcommand = NULL,
-       .lprmcommand = NULL,
-       .lppausecommand = NULL,
-       .lpresumecommand = NULL,
-       .queuepausecommand = NULL,
-       .queueresumecommand = NULL,
-       .szPrintername = NULL,
+       .print_command = NULL,
+       .lpq_command = NULL,
+       .lprm_command = NULL,
+       .lppause_command = NULL,
+       .lpresume_command = NULL,
+       .queuepause_command = NULL,
+       .queueresume_command = NULL,
+       ._printername = NULL,
        .printjob_username = NULL,
-       .dontdescend = NULL,
-       .hostsallow = NULL,
-       .hostsdeny = NULL,
-       .magicscript = NULL,
-       .magicoutput = NULL,
+       .dont_descend = NULL,
+       .hosts_allow = NULL,
+       .hosts_deny = NULL,
+       .magic_script = NULL,
+       .magic_output = NULL,
        .veto_files = NULL,
        .hide_files = NULL,
-       .veto_oplocks = NULL,
+       .veto_oplock_files = NULL,
        .comment = NULL,
        .force_user = NULL,
        .force_group = NULL,
-       .readlist = NULL,
+       .read_list = NULL,
        .writelist = NULL,
        .volume = NULL,
        .fstype = NULL,
@@ -188,36 +188,36 @@ static struct loadparm_service sDefault =
        .dfree_command = NULL,
        .minprintspace = 0,
        .iMaxPrintJobs = 1000,
-       .max_reported_jobs = 0,
+       .max_reported_print_jobs = 0,
        .write_cache_size = 0,
        .create_mask = 0744,
        .force_create_mode = 0,
-       .dir_mask = 0755,
-       .force_dir_mode = 0,
+       .directory_mask = 0755,
+       .force_directory_mode = 0,
        .max_connections = 0,
-       .defaultcase = CASE_LOWER,
+       .default_case = CASE_LOWER,
        .printing = DEFAULT_PRINTING,
        .oplock_contention_limit = 2,
        .csc_policy = 0,
        .block_size = 1024,
        .dfree_cache_time = 0,
        .preexec_close = false,
-       .rootpreexec_close = false,
-       .casesensitive = Auto,
-       .preservecase = true,
-       .shortpreservecase = true,
+       .root_preexec_close = false,
+       .case_sensitive = Auto,
+       .preserve_case = true,
+       .short_preserve_case = true,
        .hide_dot_files = true,
        .hide_special_files = false,
-       .hideunreadable = false,
-       .hideunwriteable_files = false,
+       .hide_unreadable = false,
+       .hide_unwriteable_files = false,
        .browseable = true,
        .access_based_share_enum = false,
        .bAvailable = true,
-       .readonly = true,
+       .read_only = true,
        .guest_only = false,
        .administrative_share = false,
        .guest_ok = false,
-       .print_ok = false,
+       .printable = false,
        .print_notify_backchannel = false,
        .map_system = false,
        .map_hidden = false,
@@ -230,24 +230,24 @@ static struct loadparm_service sDefault =
        .oplocks = true,
        .kernel_oplocks = false,
        .level2_oplocks = true,
-       .onlyuser = false,
-       .manglednames = true,
+       .only_user = false,
+       .mangled_names = true,
        .bWidelinks = false,
-       .symlinks = true,
+       .follow_symlinks = true,
        .syncalways = false,
        .strict_allocate = false,
        .strict_sync = false,
-       .magicchar = '~',
+       .mangling_char = '~',
        .copymap = NULL,
        .delete_readonly = false,
        .fake_oplocks = false,
-       .recursive_veto_delete = false,
+       .delete_veto_files = false,
        .dos_filemode = false,
        .dos_filetimes = true,
        .dos_filetime_resolution = false,
-       .fake_dir_create_times = false,
+       .fake_directory_create_times = false,
        .blocking_locks = true,
-       .inherit_perms = false,
+       .inherit_permissions = false,
        .inherit_acls = false,
        .inherit_owner = false,
        .msdfs_root = false,
@@ -271,11 +271,7 @@ static struct loadparm_service sDefault =
        .aio_read_size = 0,
        .aio_write_size = 0,
        .map_readonly = MAP_READONLY_YES,
-#ifdef BROKEN_DIRECTORY_HANDLING
-       .directory_name_cache_size = 0,
-#else
        .directory_name_cache_size = 100,
-#endif
        .smb_encrypt = SMB_SIGNING_DEFAULT,
        .kernel_share_modes = true,
        .durable_handles = true,
@@ -385,52 +381,52 @@ static void init_printer_values(struct loadparm_service *pService)
                case PRINT_AIX:
                case PRINT_LPRNT:
                case PRINT_LPROS2:
-                       string_set(&pService->lpqcommand, "lpq -P'%p'");
-                       string_set(&pService->lprmcommand, "lprm -P'%p' %j");
-                       string_set(&pService->printcommand, "lpr -r -P'%p' %s");
+                       string_set(&pService->lpq_command, "lpq -P'%p'");
+                       string_set(&pService->lprm_command, "lprm -P'%p' %j");
+                       string_set(&pService->print_command, "lpr -r -P'%p' %s");
                        break;
 
                case PRINT_LPRNG:
                case PRINT_PLP:
-                       string_set(&pService->lpqcommand, "lpq -P'%p'");
-                       string_set(&pService->lprmcommand, "lprm -P'%p' %j");
-                       string_set(&pService->printcommand, "lpr -r -P'%p' %s");
-                       string_set(&pService->queuepausecommand, "lpc stop '%p'");
-                       string_set(&pService->queueresumecommand, "lpc start '%p'");
-                       string_set(&pService->lppausecommand, "lpc hold '%p' %j");
-                       string_set(&pService->lpresumecommand, "lpc release '%p' %j");
+                       string_set(&pService->lpq_command, "lpq -P'%p'");
+                       string_set(&pService->lprm_command, "lprm -P'%p' %j");
+                       string_set(&pService->print_command, "lpr -r -P'%p' %s");
+                       string_set(&pService->queuepause_command, "lpc stop '%p'");
+                       string_set(&pService->queueresume_command, "lpc start '%p'");
+                       string_set(&pService->lppause_command, "lpc hold '%p' %j");
+                       string_set(&pService->lpresume_command, "lpc release '%p' %j");
                        break;
 
                case PRINT_CUPS:
                case PRINT_IPRINT:
                        /* set the lpq command to contain the destination printer
                           name only.  This is used by cups_queue_get() */
-                       string_set(&pService->lpqcommand, "%p");
-                       string_set(&pService->lprmcommand, "");
-                       string_set(&pService->printcommand, "");
-                       string_set(&pService->lppausecommand, "");
-                       string_set(&pService->lpresumecommand, "");
-                       string_set(&pService->queuepausecommand, "");
-                       string_set(&pService->queueresumecommand, "");
+                       string_set(&pService->lpq_command, "%p");
+                       string_set(&pService->lprm_command, "");
+                       string_set(&pService->print_command, "");
+                       string_set(&pService->lppause_command, "");
+                       string_set(&pService->lpresume_command, "");
+                       string_set(&pService->queuepause_command, "");
+                       string_set(&pService->queueresume_command, "");
                        break;
 
                case PRINT_SYSV:
                case PRINT_HPUX:
-                       string_set(&pService->lpqcommand, "lpstat -o%p");
-                       string_set(&pService->lprmcommand, "cancel %p-%j");
-                       string_set(&pService->printcommand, "lp -c -d%p %s; rm %s");
-                       string_set(&pService->queuepausecommand, "disable %p");
-                       string_set(&pService->queueresumecommand, "enable %p");
+                       string_set(&pService->lpq_command, "lpstat -o%p");
+                       string_set(&pService->lprm_command, "cancel %p-%j");
+                       string_set(&pService->print_command, "lp -c -d%p %s; rm %s");
+                       string_set(&pService->queuepause_command, "disable %p");
+                       string_set(&pService->queueresume_command, "enable %p");
 #ifndef HPUX
-                       string_set(&pService->lppausecommand, "lp -i %p-%j -H hold");
-                       string_set(&pService->lpresumecommand, "lp -i %p-%j -H resume");
+                       string_set(&pService->lppause_command, "lp -i %p-%j -H hold");
+                       string_set(&pService->lpresume_command, "lp -i %p-%j -H resume");
 #endif /* HPUX */
                        break;
 
                case PRINT_QNX:
-                       string_set(&pService->lpqcommand, "lpq -P%p");
-                       string_set(&pService->lprmcommand, "lprm -P%p %j");
-                       string_set(&pService->printcommand, "lp -r -P%p %s");
+                       string_set(&pService->lpq_command, "lpq -P%p");
+                       string_set(&pService->lprm_command, "lprm -P%p %j");
+                       string_set(&pService->print_command, "lp -r -P%p %s");
                        break;
 
 #if defined(DEVELOPER) || defined(ENABLE_SELFTEST)
@@ -451,37 +447,37 @@ static void init_printer_values(struct loadparm_service *pService)
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s print %%p %%s",
                                      tdbfile);
-               string_set(&pService->printcommand,
+               string_set(&pService->print_command,
                           tmp ? tmp : "vlp print %p %s");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s lpq %%p",
                                      tdbfile);
-               string_set(&pService->lpqcommand,
+               string_set(&pService->lpq_command,
                           tmp ? tmp : "vlp lpq %p");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s lprm %%p %%j",
                                      tdbfile);
-               string_set(&pService->lprmcommand,
+               string_set(&pService->lprm_command,
                           tmp ? tmp : "vlp lprm %p %j");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s lppause %%p %%j",
                                      tdbfile);
-               string_set(&pService->lppausecommand,
+               string_set(&pService->lppause_command,
                           tmp ? tmp : "vlp lppause %p %j");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s lpresume %%p %%j",
                                      tdbfile);
-               string_set(&pService->lpresumecommand,
+               string_set(&pService->lpresume_command,
                           tmp ? tmp : "vlp lpresume %p %j");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s queuepause %%p",
                                      tdbfile);
-               string_set(&pService->queuepausecommand,
+               string_set(&pService->queuepause_command,
                           tmp ? tmp : "vlp queuepause %p");
 
                tmp = talloc_asprintf(tmp_ctx, "vlp %s queueresume %%p",
                                      tdbfile);
-               string_set(&pService->queueresumecommand,
+               string_set(&pService->queueresume_command,
                           tmp ? tmp : "vlp queueresume %p");
                TALLOC_FREE(tmp_ctx);
 
@@ -633,8 +629,6 @@ static void free_global_parameters(void)
        TALLOC_FREE(Globals.ctx);
 }
 
-static int map_parameter(const char *pszParmName);
-
 struct lp_stored_option {
        struct lp_stored_option *prev, *next;
        const char *label;
@@ -758,7 +752,7 @@ static void init_globals(bool reinit_globals)
        string_set(&Globals.mangling_method, "hash2");
        Globals.mangle_prefix = 1;
 
-       string_set(&Globals.guestaccount, GUEST_ACCOUNT);
+       string_set(&Globals.guest_account, GUEST_ACCOUNT);
 
        /* using UTF8 by default allows us to support all chars */
        string_set(&Globals.unix_charset, DEFAULT_UNIX_CHARSET);
@@ -774,10 +768,10 @@ static void init_globals(bool reinit_globals)
        string_set(&Globals.workgroup, DEFAULT_WORKGROUP);
 
        string_set(&Globals.passwd_program, "");
-       string_set(&Globals.lockdir, get_dyn_LOCKDIR());
+       string_set(&Globals.lock_directory, get_dyn_LOCKDIR());
        string_set(&Globals.szStateDir, get_dyn_STATEDIR());
        string_set(&Globals.szCacheDir, get_dyn_CACHEDIR());
-       string_set(&Globals.piddir, get_dyn_PIDDIR());
+       string_set(&Globals.pid_directory, get_dyn_PIDDIR());
        string_set(&Globals.nbt_client_socket_address, "0.0.0.0");
        /*
         * By default support explicit binding to broadcast
@@ -788,7 +782,7 @@ static void init_globals(bool reinit_globals)
        if (asprintf(&s, "Samba %s", samba_version_string()) < 0) {
                smb_panic("init_globals: ENOMEM");
        }
-       string_set(&Globals.serverstring, s);
+       string_set(&Globals.server_string, s);
        SAFE_FREE(s);
 #ifdef DEVELOPER
        string_set(&Globals.panic_action, "/bin/sleep 999999999");
@@ -802,7 +796,7 @@ static void init_globals(bool reinit_globals)
        string_set(&Globals.logon_path, "\\\\%N\\%U\\profile");
 
        Globals.name_resolve_order = (const char **)str_list_make_v3(NULL, "lmhosts wins host bcast", NULL);
-       string_set(&Globals.passwordserver, "*");
+       string_set(&Globals.password_server, "*");
 
        Globals.algorithmic_rid_base = BASE_RID;
 
@@ -810,13 +804,13 @@ static void init_globals(bool reinit_globals)
        Globals.printcap_cache_time = 750;      /* 12.5 minutes */
 
        Globals.config_backend = config_backend;
-       Globals.server_role = ROLE_AUTO;
+       Globals._server_role = ROLE_AUTO;
 
        /* Was 65535 (0xFFFF). 0x4101 matches W2K and causes major speed improvements... */
        /* Discovered by 2 days of pain by Don McCall @ HP :-). */
        Globals.max_xmit = 0x4104;
-       Globals.maxmux = 50;    /* This is *needed* for profile support. */
-       Globals.lpqcachetime = 30;      /* changed to handle large print servers better -- jerry */
+       Globals.max_mux = 50;   /* This is *needed* for profile support. */
+       Globals.lpq_cache_time = 30;    /* changed to handle large print servers better -- jerry */
        Globals._disable_spoolss = false;
        Globals.max_smbd_processes = 0;/* no limit specified */
        Globals.usernamelevel = 0;
@@ -825,13 +819,12 @@ static void init_globals(bool reinit_globals)
        Globals.large_readwrite = true;
        Globals.max_log_size = 5000;
        Globals.max_open_files = max_open_files();
-       Globals.open_files_db_hash_size = SMB_OPEN_DATABASE_TDB_HASH_SIZE;
-       Globals.srv_maxprotocol = PROTOCOL_SMB3_00;
-       Globals.srv_minprotocol = PROTOCOL_LANMAN1;
-       Globals.cli_maxprotocol = PROTOCOL_NT1;
-       Globals.cli_minprotocol = PROTOCOL_CORE;
-       Globals.security = SEC_USER;
-       Globals.encrypted_passwords = true;
+       Globals.server_max_protocol = PROTOCOL_SMB3_00;
+       Globals.server_min_protocol = PROTOCOL_LANMAN1;
+       Globals.client_max_protocol = PROTOCOL_NT1;
+       Globals.client_min_protocol = PROTOCOL_CORE;
+       Globals._security = SEC_AUTO;
+       Globals.encrypt_passwords = true;
        Globals.client_schannel = Auto;
        Globals.winbind_sealed_pipes = true;
        Globals.require_strong_key = true;
@@ -859,9 +852,9 @@ static void init_globals(bool reinit_globals)
 #if (defined(HAVE_NETGROUP) && defined(WITH_AUTOMOUNT))
        Globals.nis_home_map = false;
 #ifdef WITH_NISPLUS_HOME
-       string_set(&Globals.nis_home_map_name, "auto_home.org_dir");
+       string_set(&Globals.homedir_map, "auto_home.org_dir");
 #else
-       string_set(&Globals.nis_home_map_name, "auto.home");
+       string_set(&Globals.homedir_map, "auto.home");
 #endif
 #endif
        Globals.time_server = false;
@@ -942,7 +935,7 @@ static void init_globals(bool reinit_globals)
 
 */
 
-       Globals.ms_add_printer_wizard = true;
+       Globals.show_add_printer_wizard = true;
        Globals.os_level = 20;
        Globals.local_master = true;
        Globals._domain_master = Auto;  /* depending on _domain_logons */
@@ -1079,6 +1072,22 @@ static void init_globals(bool reinit_globals)
        Globals.spn_update_command = (const char **)str_list_make_v3(NULL, s, NULL);
        SAFE_FREE(s);
 
+       Globals.nsupdate_command = (const char **)str_list_make_v3(NULL, "/usr/bin/nsupdate -g", NULL);
+
+       Globals.rndc_command = (const char **)str_list_make_v3(NULL, "/usr/sbin/rndc", NULL);
+
+       Globals.cldap_port = 389;
+
+       Globals.dgram_port = 138;
+
+       Globals.nbt_port = 137;
+
+       Globals.krb5_port = 88;
+
+       Globals.kpasswd_port = 464;
+
+       Globals.web_port = 901;
+
        /* Now put back the settings that were set with lp_set_cmdline() */
        apply_lp_set_cmdline();
 }
@@ -1163,15 +1172,15 @@ static FN_GLOBAL_BOOL(_writeraw, bWriteRaw)
 
 /* If lp_statedir() and lp_cachedir() are explicitely set during the
  * build process or in smb.conf, we use that value.  Otherwise they
- * default to the value of lp_lockdir(). */
+ * default to the value of lp_lock_directory(). */
 const char *lp_statedir(void) {
        if ((strcmp(get_dyn_STATEDIR(), get_dyn_LOCKDIR()) != 0) ||
            (strcmp(get_dyn_STATEDIR(), Globals.szStateDir) != 0))
                return(*(char **)(&Globals.szStateDir) ?
                       *(char **)(&Globals.szStateDir) : "");
        else
-               return(*(char **)(&Globals.lockdir) ?
-                      *(char **)(&Globals.lockdir) : "");
+               return(*(char **)(&Globals.lock_directory) ?
+                      *(char **)(&Globals.lock_directory) : "");
 }
 const char *lp_cachedir(void) {
        if ((strcmp(get_dyn_CACHEDIR(), get_dyn_LOCKDIR()) != 0) ||
@@ -1179,8 +1188,8 @@ const char *lp_cachedir(void) {
                return(*(char **)(&Globals.szCacheDir) ?
                       *(char **)(&Globals.szCacheDir) : "");
        else
-               return(*(char **)(&Globals.lockdir) ?
-                      *(char **)(&Globals.lockdir) : "");
+               return(*(char **)(&Globals.lock_directory) ?
+                      *(char **)(&Globals.lock_directory) : "");
 }
 static FN_GLOBAL_INTEGER(winbind_max_domain_connections_int,
                  winbindMaxDomainConnections)
@@ -1717,10 +1726,10 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
        if (i < 0)
                return false;
 
-       if (!(*(ServicePtrs[iDefaultService]->pathname))
-           || strequal(ServicePtrs[iDefaultService]->pathname,
-                       lp_pathname(talloc_tos(), GLOBAL_SECTION_SNUM))) {
-               string_set(&ServicePtrs[i]->pathname, pszHomedir);
+       if (!(*(ServicePtrs[iDefaultService]->path))
+           || strequal(ServicePtrs[iDefaultService]->path,
+                       lp_path(talloc_tos(), GLOBAL_SECTION_SNUM))) {
+               string_set(&ServicePtrs[i]->path, pszHomedir);
        }
 
        if (!(*(ServicePtrs[i]->comment))) {
@@ -1740,7 +1749,7 @@ bool lp_add_home(const char *pszHomename, int iDefaultService,
        ServicePtrs[i]->autoloaded = true;
 
        DEBUG(3, ("adding home's share [%s] for user '%s' at '%s'\n", pszHomename, 
-              user, ServicePtrs[i]->pathname ));
+              user, ServicePtrs[i]->path ));
 
        return true;
 }
@@ -1771,21 +1780,21 @@ static bool lp_add_ipc(const char *ipc_name, bool guest_ok)
                return false;
 
        if (asprintf(&comment, "IPC Service (%s)",
-                               Globals.serverstring) < 0) {
+                               Globals.server_string) < 0) {
                return false;
        }
 
-       string_set(&ServicePtrs[i]->pathname, tmpdir());
+       string_set(&ServicePtrs[i]->path, tmpdir());
        string_set(&ServicePtrs[i]->username, "");
        string_set(&ServicePtrs[i]->comment, comment);
        string_set(&ServicePtrs[i]->fstype, "IPC");
        ServicePtrs[i]->max_connections = 0;
        ServicePtrs[i]->bAvailable = true;
-       ServicePtrs[i]->readonly = true;
+       ServicePtrs[i]->read_only = true;
        ServicePtrs[i]->guest_only = false;
        ServicePtrs[i]->administrative_share = true;
        ServicePtrs[i]->guest_ok = guest_ok;
-       ServicePtrs[i]->print_ok = false;
+       ServicePtrs[i]->printable = false;
        ServicePtrs[i]->browseable = sDefault.browseable;
 
        DEBUG(3, ("adding IPC service\n"));
@@ -1812,18 +1821,18 @@ bool lp_add_printer(const char *pszPrintername, int iDefaultService)
        /* entry (if/when the 'available' keyword is implemented!).    */
 
        /* the printer name is set to the service name. */
-       string_set(&ServicePtrs[i]->szPrintername, pszPrintername);
+       string_set(&ServicePtrs[i]->_printername, pszPrintername);
        string_set(&ServicePtrs[i]->comment, comment);
 
        /* set the browseable flag from the gloabl default */
        ServicePtrs[i]->browseable = sDefault.browseable;
 
        /* Printers cannot be read_only. */
-       ServicePtrs[i]->readonly = false;
+       ServicePtrs[i]->read_only = false;
        /* No oplocks on printer services. */
        ServicePtrs[i]->oplocks = false;
        /* Printer services must be printable. */
-       ServicePtrs[i]->print_ok = true;
+       ServicePtrs[i]->printable = true;
 
        DEBUG(3, ("adding printer service %s\n", pszPrintername));
 
@@ -1838,7 +1847,7 @@ bool lp_add_printer(const char *pszPrintername, int iDefaultService)
 
 bool lp_parameter_is_valid(const char *pszParmName)
 {
-       return ((map_parameter(pszParmName) != -1) ||
+       return ((lpcfg_map_parameter(pszParmName) != -1) ||
                (strchr(pszParmName, ':') != NULL));
 }
 
@@ -1851,7 +1860,7 @@ bool lp_parameter_is_valid(const char *pszParmName)
 
 bool lp_parameter_is_global(const char *pszParmName)
 {
-       int num = map_parameter(pszParmName);
+       int num = lpcfg_map_parameter(pszParmName);
 
        if (num >= 0) {
                return (parm_table[num].p_class == P_GLOBAL);
@@ -1872,7 +1881,7 @@ bool lp_parameter_is_canonical(const char *parm_name)
                return false;
        }
 
-       return (map_parameter(parm_name) ==
+       return (lpcfg_map_parameter(parm_name) ==
                map_parameter_canonical(parm_name, NULL));
 }
 
@@ -1949,31 +1958,6 @@ bool lp_canonicalize_parameter_with_value(const char *parm_name,
        return true;
 }
 
-/***************************************************************************
- Map a parameter's string representation to something we can use. 
- Returns false if the parameter string is not recognised, else TRUE.
-***************************************************************************/
-
-static int map_parameter(const char *pszParmName)
-{
-       int iIndex;
-
-       if (*pszParmName == '-' && !strequal(pszParmName, "-valid"))
-               return (-1);
-
-       for (iIndex = 0; parm_table[iIndex].label; iIndex++)
-               if (strwicmp(parm_table[iIndex].label, pszParmName) == 0)
-                       return (iIndex);
-
-       /* Warn only if it isn't parametric option */
-       if (strchr(pszParmName, ':') == NULL)
-               DEBUG(1, ("Unknown parameter encountered: \"%s\"\n", pszParmName));
-       /* We do return 'fail' for parametric options as well because they are
-          stored in different storage
-        */
-       return (-1);
-}
-
 /***************************************************************************
  Map a parameter's string representation to the index of the canonical
  form of the parameter (it might be a synonym).
@@ -1985,7 +1969,7 @@ static int map_parameter_canonical(const char *pszParmName, bool *inverse)
        int parm_num, canon_num;
        bool loc_inverse = false;
 
-       parm_num = map_parameter(pszParmName);
+       parm_num = lpcfg_map_parameter(pszParmName);
        if ((parm_num < 0) || !(parm_table[parm_num].flags & FLAG_HIDE)) {
                /* invalid, parametric or no canidate for synonyms ... */
                goto done;
@@ -2376,17 +2360,17 @@ bool service_ok(int iService)
        /* The [printers] entry MUST be printable. I'm all for flexibility, but */
        /* I can't see why you'd want a non-printable printer service...        */
        if (strwicmp(ServicePtrs[iService]->szService, PRINTERS_NAME) == 0) {
-               if (!ServicePtrs[iService]->print_ok) {
+               if (!ServicePtrs[iService]->printable) {
                        DEBUG(0, ("WARNING: [%s] service MUST be printable!\n",
                               ServicePtrs[iService]->szService));
-                       ServicePtrs[iService]->print_ok = true;
+                       ServicePtrs[iService]->printable = true;
                }
                /* [printers] service must also be non-browsable. */
                if (ServicePtrs[iService]->browseable)
                        ServicePtrs[iService]->browseable = false;
        }
 
-       if (ServicePtrs[iService]->pathname[0] == '\0' &&
+       if (ServicePtrs[iService]->path[0] == '\0' &&
            strwicmp(ServicePtrs[iService]->szService, HOMES_NAME) != 0 &&
            ServicePtrs[iService]->msdfs_proxy[0] == '\0'
            ) {
@@ -3094,7 +3078,7 @@ static bool handle_printing(struct loadparm_context *unused, int snum, const cha
        struct loadparm_service *s;
 
        if ( parm_num == -1 )
-               parm_num = map_parameter( "printing" );
+               parm_num = lpcfg_map_parameter( "printing" );
 
        lp_set_enum_parm( &parm_table[parm_num], pszParmValue, (int*)ptr );
 
@@ -3165,7 +3149,7 @@ bool lp_do_parameter(int snum, const char *pszParmName, const char *pszParmValue
        void *parm_ptr = NULL;  /* where we are going to store the result */
        struct parmlist_entry **opt_list;
 
-       parmnum = map_parameter(pszParmName);
+       parmnum = lpcfg_map_parameter(pszParmName);
 
        if (parmnum < 0) {
                if (strchr(pszParmName, ':') == NULL) {
@@ -3307,7 +3291,7 @@ FLAG_CMDLINE won't be overridden by loads from smb.conf.
 static bool lp_set_cmdline_helper(const char *pszParmName, const char *pszParmValue, bool store_values)
 {
        int parmnum, i;
-       parmnum = map_parameter(pszParmName);
+       parmnum = lpcfg_map_parameter(pszParmName);
        if (parmnum >= 0) {
                parm_table[parmnum].flags &= ~FLAG_CMDLINE;
                if (!lp_do_parameter(-1, pszParmName, pszParmValue)) {
@@ -3400,126 +3384,6 @@ bool lp_set_option(const char *option)
        return ret;
 }
 
-/**************************************************************************
- Print a parameter of the specified type.
-***************************************************************************/
-
-static void print_parameter(struct parm_struct *p, void *ptr, FILE * f)
-{
-       /* For the seperation of lists values that we print below */
-       const char *list_sep = ", ";
-       int i;
-       switch (p->type)
-       {
-               case P_ENUM:
-                       for (i = 0; p->enum_list[i].name; i++) {
-                               if (*(int *)ptr == p->enum_list[i].value) {
-                                       fprintf(f, "%s",
-                                               p->enum_list[i].name);
-                                       break;
-                               }
-                       }
-                       break;
-
-               case P_BOOL:
-                       fprintf(f, "%s", BOOLSTR(*(bool *)ptr));
-                       break;
-
-               case P_BOOLREV:
-                       fprintf(f, "%s", BOOLSTR(!*(bool *)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: {
-                       int val = *(int *)ptr; 
-                       if (val == -1) {
-                               fprintf(f, "-1");
-                       } else {
-                               fprintf(f, "0%o", val);
-                       }
-                       break;
-               }
-
-               case P_CMDLIST:
-                       list_sep = " ";
-                       /* fall through */
-               case P_LIST:
-                       if ((char ***)ptr && *(char ***)ptr) {
-                               char **list = *(char ***)ptr;
-                               for (; *list; list++) {
-                                       /* surround strings with whitespace in double quotes */
-                                       if (*(list+1) == NULL) {
-                                               /* last item, no extra separator */
-                                               list_sep = "";
-                                       }
-                                       if ( strchr_m( *list, ' ' ) ) {
-                                               fprintf(f, "\"%s\"%s", *list, list_sep);
-                                       } else {
-                                               fprintf(f, "%s%s", *list, list_sep);
-                                       }
-                               }
-                       }
-                       break;
-
-               case P_STRING:
-               case P_USTRING:
-                       if (*(char **)ptr) {
-                               fprintf(f, "%s", *(char **)ptr);
-                       }
-                       break;
-               case P_SEP:
-                       break;
-       }
-}
-
-/***************************************************************************
- Check if two parameters are equal.
-***************************************************************************/
-
-static bool equal_parameter(parm_type type, void *ptr1, void *ptr2)
-{
-       switch (type) {
-               case P_BOOL:
-               case P_BOOLREV:
-                       return (*((bool *)ptr1) == *((bool *)ptr2));
-
-               case P_INTEGER:
-               case P_ENUM:
-               case P_OCTAL:
-               case P_BYTES:
-                       return (*((int *)ptr1) == *((int *)ptr2));
-
-               case P_CHAR:
-                       return (*((char *)ptr1) == *((char *)ptr2));
-
-               case P_LIST:
-               case P_CMDLIST:
-                       return str_list_equal(*(const char ***)ptr1, *(const char ***)ptr2);
-
-               case P_STRING:
-               case P_USTRING:
-               {
-                       char *p1 = *(char **)ptr1, *p2 = *(char **)ptr2;
-                       if (p1 && !*p1)
-                               p1 = NULL;
-                       if (p2 && !*p2)
-                               p2 = NULL;
-                       return (p1 == p2 || strequal(p1, p2));
-               }
-               case P_SEP:
-                       break;
-       }
-       return false;
-}
-
 /***************************************************************************
  Initialize any local variables in the sDefault table, after parsing a
  [globals] section.
@@ -3618,8 +3482,6 @@ static bool do_section(const char *pszSectionName, void *userdata)
 
 static bool is_default(int i)
 {
-       if (!defaults_saved)
-               return false;
        switch (parm_table[i].type) {
                case P_LIST:
                case P_CMDLIST:
@@ -3671,8 +3533,8 @@ static void dump_globals(FILE *f)
                        if (defaults_saved && is_default(i))
                                continue;
                        fprintf(f, "\t%s = ", parm_table[i].label);
-                       print_parameter(&parm_table[i], lp_parm_ptr(NULL, 
-                                                                   &parm_table[i]),
+                       lpcfg_print_parameter(&parm_table[i], lp_parm_ptr(NULL,
+                                                                         &parm_table[i]),
                                        f);
                        fprintf(f, "\n");
        }
@@ -3686,17 +3548,6 @@ static void dump_globals(FILE *f)
 
 }
 
-/***************************************************************************
- Return true if a local parameter is currently set to the global default.
-***************************************************************************/
-
-bool lp_is_default(int snum, struct parm_struct *parm)
-{
-       return equal_parameter(parm->type,
-                              lp_parm_ptr(ServicePtrs[snum], parm),
-                              lp_parm_ptr(NULL, parm));
-}
-
 /***************************************************************************
  Display the contents of a single services record.
 ***************************************************************************/
@@ -3720,14 +3571,14 @@ static void dump_a_service(struct loadparm_service *pService, FILE * f)
                                if (defaults_saved && is_default(i))
                                        continue;
                        } else {
-                               if (equal_parameter(parm_table[i].type,
-                                                   lp_parm_ptr(pService, &parm_table[i]),
-                                                   lp_parm_ptr(NULL, &parm_table[i])))
+                               if (lpcfg_equal_parameter(parm_table[i].type,
+                                                         lp_parm_ptr(pService, &parm_table[i]),
+                                                         lp_parm_ptr(NULL, &parm_table[i])))
                                        continue;
                        }
 
                        fprintf(f, "\t%s = ", parm_table[i].label);
-                       print_parameter(&parm_table[i],
+                       lpcfg_print_parameter(&parm_table[i],
                                        lp_parm_ptr(pService, &parm_table[i]),
                                        f);
                        fprintf(f, "\n");
@@ -3749,14 +3600,13 @@ static void dump_a_service(struct loadparm_service *pService, FILE * f)
 
 bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
 {
-       int i;
        bool result = false;
-       parm_class p_class;
-       unsigned flag = 0;
        fstring local_parm_name;
        char *parm_opt;
        const char *parm_opt_value;
 
+       struct loadparm_context *lp_ctx;
+
        /* check for parametrical option */
        fstrcpy( local_parm_name, parm_name);
        parm_opt = strchr( local_parm_name, ':');
@@ -3775,38 +3625,17 @@ bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
                return result;
        }
 
-       /* check for a key and print the value */
-       if (isGlobal) {
-               p_class = P_GLOBAL;
-               flag = FLAG_GLOBAL;
-       } else
-               p_class = P_LOCAL;
-
-       for (i = 0; parm_table[i].label; i++) {
-               if (strwicmp(parm_table[i].label, parm_name) == 0 &&
-                   !(parm_table[i].flags & FLAG_META) &&
-                   (parm_table[i].p_class == p_class || parm_table[i].flags & flag) &&
-                   (*parm_table[i].label != '-') &&
-                   (i == 0 || (parm_table[i].offset != parm_table[i - 1].offset))) 
-               {
-                       void *ptr;
-
-                       if (isGlobal) {
-                               ptr = lp_parm_ptr(NULL, 
-                                                 &parm_table[i]);
-                       } else {
-                               ptr = lp_parm_ptr(ServicePtrs[snum], 
-                                                 &parm_table[i]);
-                       }
-
-                       print_parameter(&parm_table[i],
-                                       ptr, f);
-                       fprintf(f, "\n");
-                       result = true;
-                       break;
-               }
+       lp_ctx = loadparm_init_s3(talloc_tos(), loadparm_s3_helpers());
+       if (lp_ctx == NULL) {
+               return false;
        }
 
+       if (isGlobal) {
+               result = lpcfg_dump_a_parameter(lp_ctx, NULL, parm_name, f);
+       } else {
+               result = lpcfg_dump_a_parameter(lp_ctx, ServicePtrs[snum], parm_name, f);
+       }
+       TALLOC_FREE(lp_ctx);
        return result;
 }
 
@@ -3817,7 +3646,7 @@ bool dump_a_parameter(int snum, char *parm_name, FILE * f, bool isGlobal)
 
 struct parm_struct *lp_get_parameter(const char *param_name)
 {
-       int num = map_parameter(param_name);
+       int num = lpcfg_map_parameter(param_name);
 
        if (num < 0) {
                return NULL;
@@ -3826,65 +3655,6 @@ struct parm_struct *lp_get_parameter(const char *param_name)
        return &parm_table[num];
 }
 
-/***************************************************************************
- Return info about the next parameter in a service.
- snum==GLOBAL_SECTION_SNUM gives the globals.
- Return NULL when out of parameters.
-***************************************************************************/
-
-struct parm_struct *lp_next_parameter(int snum, int *i, int allparameters)
-{
-       if (snum < 0) {
-               /* do the globals */
-               for (; parm_table[*i].label; (*i)++) {
-                       if (parm_table[*i].p_class == P_SEPARATOR)
-                               return &parm_table[(*i)++];
-
-                       if ((*parm_table[*i].label == '-'))
-                               continue;
-
-                       if ((*i) > 0
-                           && (parm_table[*i].offset ==
-                               parm_table[(*i) - 1].offset)
-                           && (parm_table[*i].p_class ==
-                               parm_table[(*i) - 1].p_class))
-                               continue;
-
-                       if (is_default(*i) && !allparameters)
-                               continue;
-
-                       return &parm_table[(*i)++];
-               }
-       } else {
-               struct loadparm_service *pService = ServicePtrs[snum];
-
-               for (; parm_table[*i].label; (*i)++) {
-                       if (parm_table[*i].p_class == P_SEPARATOR)
-                               return &parm_table[(*i)++];
-
-                       if (parm_table[*i].p_class == P_LOCAL &&
-                           (*parm_table[*i].label != '-') &&
-                           ((*i) == 0 ||
-                            (parm_table[*i].offset !=
-                             parm_table[(*i) - 1].offset)))
-                       {
-                               if (allparameters ||
-                                   !equal_parameter(parm_table[*i].type,
-                                                    lp_parm_ptr(pService, 
-                                                                &parm_table[*i]),
-                                                    lp_parm_ptr(NULL, 
-                                                                &parm_table[*i])))
-                               {
-                                       return &parm_table[(*i)++];
-                               }
-                       }
-               }
-       }
-
-       return NULL;
-}
-
-
 #if 0
 /***************************************************************************
  Display the contents of a single copy structure.
@@ -4236,7 +4006,7 @@ enum usershare_err parse_usershare_file(TALLOC_CTX *ctx,
                }
        }
 
-       if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->pathname) == 0)) {
+       if (snum != -1 && (strcmp(sharepath, ServicePtrs[snum]->path) == 0)) {
                /* Path didn't change, no checks needed. */
                *pp_sharepath = sharepath;
                *pp_comment = comment;
@@ -4485,7 +4255,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
                added_service = true;
 
                /* Read only is controlled by usershare ACL below. */
-               ServicePtrs[iService]->readonly = false;
+               ServicePtrs[iService]->read_only = false;
        }
 
        /* Write the ACL of the new/modified share. */
@@ -4509,7 +4279,7 @@ static int process_usershare_file(const char *dir_name, const char *file_name, i
 
        /* And note when it was loaded. */
        ServicePtrs[iService]->usershare_last_mod = sbuf.st_ex_mtime;
-       string_set(&ServicePtrs[iService]->pathname, sharepath);
+       string_set(&ServicePtrs[iService]->path, sharepath);
        string_set(&ServicePtrs[iService]->comment, comment);
 
        ret = iService;
@@ -4951,9 +4721,9 @@ static bool lp_load_ex(const char *pszFname,
 
        set_allowed_client_auth();
 
-       if (lp_security() == SEC_ADS && strchr(lp_passwordserver(), ':')) {
+       if (lp_security() == SEC_ADS && strchr(lp_password_server(), ':')) {
                DEBUG(1, ("WARNING: The optional ':port' in password server = %s is deprecated\n",
-                         lp_passwordserver()));
+                         lp_password_server()));
        }
 
        bLoaded = true;
@@ -5501,7 +5271,7 @@ static bool lp_widelinks_internal(int snum)
 
 void widelinks_warning(int snum)
 {
-       if (lp_allow_insecure_widelinks()) {
+       if (lp_allow_insecure_wide_links()) {
                return;
        }
 
@@ -5521,7 +5291,7 @@ bool lp_widelinks(int snum)
                 * Unless we have "allow insecure widelinks"
                 * turned on.
                 */
-               if (!lp_allow_insecure_widelinks()) {
+               if (!lp_allow_insecure_wide_links()) {
                        return false;
                }
        }