From 6b266b85cf34145ac1f03d8f787b81121e4ec92b Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 16 Jul 2010 14:32:42 +1000 Subject: s4-loadparm: 2nd half of lp_ to lpcfg_ conversion this converts all callers that use the Samba4 loadparm lp_ calling convention to use the lpcfg_ prefix. Signed-off-by: Andrew Bartlett --- source4/param/generic.c | 8 ++--- source4/param/provision.c | 6 ++-- source4/param/pyparam.c | 48 +++++++++++++-------------- source4/param/pyparam.h | 2 +- source4/param/pyparam_util.c | 8 ++--- source4/param/secrets.c | 2 +- source4/param/share_classic.c | 74 +++++++++++++++++++++--------------------- source4/param/share_ldb.c | 2 +- source4/param/tests/loadparm.c | 66 ++++++++++++++++++------------------- source4/param/util.c | 42 ++++++++++++------------ 10 files changed, 129 insertions(+), 129 deletions(-) (limited to 'source4/param') diff --git a/source4/param/generic.c b/source4/param/generic.c index 29b97bc09e..8becffbce5 100644 --- a/source4/param/generic.c +++ b/source4/param/generic.c @@ -233,14 +233,14 @@ int param_use(struct loadparm_context *lp_ctx, struct param_context *ctx) bool isglobal = strcmp(section->name, "global") == 0; for (param = section->parameters->entries; param; param = param->next) { if (isglobal) - lp_do_global_parameter(lp_ctx, param->key, + lpcfg_do_global_parameter(lp_ctx, param->key, param->value); else { struct loadparm_service *service = - lp_service(lp_ctx, section->name); + lpcfg_service(lp_ctx, section->name); if (service == NULL) - service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), section->name); - lp_do_service_parameter(lp_ctx, service, param->key, param->value); + service = lpcfg_add_service(lp_ctx, lpcfg_default_service(lp_ctx), section->name); + lpcfg_do_service_parameter(lp_ctx, service, param->key, param->value); } } } diff --git a/source4/param/provision.c b/source4/param/provision.c index 0df370b4c2..b0387869b5 100644 --- a/source4/param/provision.c +++ b/source4/param/provision.c @@ -126,7 +126,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, settings->targetdir)); parameters = PyDict_New(); - configfile = lp_configfile(lp_ctx); + configfile = lpcfg_configfile(lp_ctx); if (configfile != NULL) { PyDict_SetItemString(parameters, "smbconf", PyString_FromString(configfile)); @@ -193,7 +193,7 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx, result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn"))); /* FIXME paths */ - result->lp_ctx = lp_from_py_object(result, PyObject_GetAttrString(py_result, "lp")); + result->lp_ctx = lpcfg_from_py_object(result, PyObject_GetAttrString(py_result, "lp")); result->samdb = PyLdb_AsLdbContext(PyObject_GetAttrString(py_result, "samdb")); return NT_STATUS_OK; @@ -373,7 +373,7 @@ struct ldb_context *provision_get_schema(TALLOC_CTX *mem_ctx, struct loadparm_co parameters = PyDict_New(); - setupdir = lp_setupdir(lp_ctx); + setupdir = lpcfg_setupdir(lp_ctx); PyDict_SetItemString(parameters, "setup_dir", PyString_FromString(setupdir)); if (override_prefixmap) { diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c index a648f65d4e..b1e0d7df0e 100644 --- a/source4/param/pyparam.c +++ b/source4/param/pyparam.c @@ -50,51 +50,51 @@ static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const cha strwicmp(service_name, GLOBAL_NAME2)) { struct loadparm_service *service; /* its a share parameter */ - service = lp_service(lp_ctx, service_name); + service = lpcfg_service(lp_ctx, service_name); if (service == NULL) { return NULL; } if (strchr(param_name, ':')) { /* its a parametric option on a share */ - const char *type = talloc_strndup(lp_ctx, param_name, + const char *type = talloc_strndup(lp_ctx, param_name, strcspn(param_name, ":")); const char *option = strchr(param_name, ':') + 1; const char *value; if (type == NULL || option == NULL) { return NULL; } - value = lp_get_parametric(lp_ctx, service, type, option); + value = lpcfg_get_parametric(lp_ctx, service, type, option); if (value == NULL) { return NULL; } return PyString_FromString(value); } - parm = lp_parm_struct(param_name); + parm = lpcfg_parm_struct(param_name); if (parm == NULL || parm->pclass == P_GLOBAL) { return NULL; } - parm_ptr = lp_parm_ptr(lp_ctx, service, parm); + parm_ptr = lpcfg_parm_ptr(lp_ctx, service, parm); } else if (strchr(param_name, ':')) { /* its a global parametric option */ - const char *type = talloc_strndup(lp_ctx, + const char *type = talloc_strndup(lp_ctx, param_name, strcspn(param_name, ":")); const char *option = strchr(param_name, ':') + 1; const char *value; if (type == NULL || option == NULL) { return NULL; } - value = lp_get_parametric(lp_ctx, NULL, type, option); + value = lpcfg_get_parametric(lp_ctx, NULL, type, option); if (value == NULL) return NULL; return PyString_FromString(value); } else { /* its a global parameter */ - parm = lp_parm_struct(param_name); + parm = lpcfg_parm_struct(param_name); if (parm == NULL) { return NULL; } - parm_ptr = lp_parm_ptr(lp_ctx, NULL, parm); + parm_ptr = lpcfg_parm_ptr(lp_ctx, NULL, parm); } if (parm == NULL || parm_ptr == NULL) { @@ -149,7 +149,7 @@ static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &filename)) return NULL; - ret = lp_load(PyLoadparmContext_AsLoadparmContext(self), filename); + ret = lpcfg_load(PyLoadparmContext_AsLoadparmContext(self), filename); if (!ret) { PyErr_Format(PyExc_RuntimeError, "Unable to load file %s", filename); @@ -161,7 +161,7 @@ static PyObject *py_lp_ctx_load(py_talloc_Object *self, PyObject *args) static PyObject *py_lp_ctx_load_default(py_talloc_Object *self) { bool ret; - ret = lp_load_default(PyLoadparmContext_AsLoadparmContext(self)); + ret = lpcfg_load_default(PyLoadparmContext_AsLoadparmContext(self)); if (!ret) { PyErr_SetString(PyExc_RuntimeError, "Unable to load default file"); @@ -190,7 +190,7 @@ static PyObject *py_lp_ctx_is_myname(py_talloc_Object *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - return PyBool_FromLong(lp_is_myname(PyLoadparmContext_AsLoadparmContext(self), name)); + return PyBool_FromLong(lpcfg_is_myname(PyLoadparmContext_AsLoadparmContext(self), name)); } static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args) @@ -199,7 +199,7 @@ static PyObject *py_lp_ctx_is_mydomain(py_talloc_Object *self, PyObject *args) if (!PyArg_ParseTuple(args, "s", &name)) return NULL; - return PyBool_FromLong(lp_is_mydomain(PyLoadparmContext_AsLoadparmContext(self), name)); + return PyBool_FromLong(lpcfg_is_mydomain(PyLoadparmContext_AsLoadparmContext(self), name)); } static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args) @@ -209,7 +209,7 @@ static PyObject *py_lp_ctx_set(py_talloc_Object *self, PyObject *args) if (!PyArg_ParseTuple(args, "ss", &name, &value)) return NULL; - ret = lp_set_cmdline(PyLoadparmContext_AsLoadparmContext(self), name, value); + ret = lpcfg_set_cmdline(PyLoadparmContext_AsLoadparmContext(self), name, value); if (!ret) { PyErr_SetString(PyExc_RuntimeError, "Unable to set parameter"); return NULL; @@ -237,11 +237,11 @@ static PyObject *py_lp_ctx_services(py_talloc_Object *self) struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self); PyObject *ret; int i; - ret = PyList_New(lp_numservices(lp_ctx)); - for (i = 0; i < lp_numservices(lp_ctx); i++) { - struct loadparm_service *service = lp_servicebynum(lp_ctx, i); + ret = PyList_New(lpcfg_numservices(lp_ctx)); + for (i = 0; i < lpcfg_numservices(lp_ctx); i++) { + struct loadparm_service *service = lpcfg_servicebynum(lp_ctx, i); if (service != NULL) { - PyList_SetItem(ret, i, PyString_FromString(lp_servicename(service))); + PyList_SetItem(ret, i, PyString_FromString(lpcfg_servicename(service))); } } return ret; @@ -263,7 +263,7 @@ static PyObject *py_lp_dump(PyObject *self, PyObject *args) return NULL; } - lp_dump(lp_ctx, f, show_defaults, lp_numservices(lp_ctx)); + lpcfg_dump(lp_ctx, f, show_defaults, lpcfg_numservices(lp_ctx)); Py_RETURN_NONE; } @@ -299,12 +299,12 @@ static PyMethodDef py_lp_ctx_methods[] = { static PyObject *py_lp_ctx_default_service(py_talloc_Object *self, void *closure) { - return PyLoadparmService_FromService(lp_default_service(PyLoadparmContext_AsLoadparmContext(self))); + return PyLoadparmService_FromService(lpcfg_default_service(PyLoadparmContext_AsLoadparmContext(self))); } static PyObject *py_lp_ctx_config_file(py_talloc_Object *self, void *closure) { - const char *configfile = lp_configfile(PyLoadparmContext_AsLoadparmContext(self)); + const char *configfile = lpcfg_configfile(PyLoadparmContext_AsLoadparmContext(self)); if (configfile == NULL) Py_RETURN_NONE; else @@ -336,7 +336,7 @@ static PyObject *py_lp_ctx_new(PyTypeObject *type, PyObject *args, PyObject *kwa static Py_ssize_t py_lp_ctx_len(py_talloc_Object *self) { - return lp_numservices(PyLoadparmContext_AsLoadparmContext(self)); + return lpcfg_numservices(PyLoadparmContext_AsLoadparmContext(self)); } static PyObject *py_lp_ctx_getitem(py_talloc_Object *self, PyObject *name) @@ -346,7 +346,7 @@ static PyObject *py_lp_ctx_getitem(py_talloc_Object *self, PyObject *name) PyErr_SetString(PyExc_TypeError, "Only string subscripts are supported"); return NULL; } - service = lp_service(PyLoadparmContext_AsLoadparmContext(self), PyString_AsString(name)); + service = lpcfg_service(PyLoadparmContext_AsLoadparmContext(self), PyString_AsString(name)); if (service == NULL) { PyErr_SetString(PyExc_KeyError, "No such section"); return NULL; @@ -396,7 +396,7 @@ static PyObject *py_lp_service_dump(PyObject *self, PyObject *args) default_service = PyLoadparmService_AsLoadparmService(py_default_service); - lp_dump_one(f, show_defaults, service, default_service); + lpcfg_dump_one(f, show_defaults, service, default_service); Py_RETURN_NONE; } diff --git a/source4/param/pyparam.h b/source4/param/pyparam.h index 4657dbafdf..e8944f5fa1 100644 --- a/source4/param/pyparam.h +++ b/source4/param/pyparam.h @@ -22,7 +22,7 @@ #include "param/param.h" -_PUBLIC_ struct loadparm_context *lp_from_py_object(TALLOC_CTX *mem_ctx, PyObject *py_obj); +_PUBLIC_ struct loadparm_context *lpcfg_from_py_object(TALLOC_CTX *mem_ctx, PyObject *py_obj); _PUBLIC_ struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx); #endif /* _PYPARAM_H_ */ diff --git a/source4/param/pyparam_util.c b/source4/param/pyparam_util.c index 8136746f52..8c98cbcbfe 100644 --- a/source4/param/pyparam_util.c +++ b/source4/param/pyparam_util.c @@ -25,13 +25,13 @@ #define PyLoadparmContext_AsLoadparmContext(obj) py_talloc_get_type(obj, struct loadparm_context) -_PUBLIC_ struct loadparm_context *lp_from_py_object(TALLOC_CTX *mem_ctx, PyObject *py_obj) +_PUBLIC_ struct loadparm_context *lpcfg_from_py_object(TALLOC_CTX *mem_ctx, PyObject *py_obj) { struct loadparm_context *lp_ctx; if (PyString_Check(py_obj)) { lp_ctx = loadparm_init(mem_ctx); - if (!lp_load(lp_ctx, PyString_AsString(py_obj))) { + if (!lpcfg_load(lp_ctx, PyString_AsString(py_obj))) { talloc_free(lp_ctx); PyErr_Format(PyExc_RuntimeError, "Unable to load %s", PyString_AsString(py_obj)); @@ -43,7 +43,7 @@ _PUBLIC_ struct loadparm_context *lp_from_py_object(TALLOC_CTX *mem_ctx, PyObjec if (py_obj == Py_None) { lp_ctx = loadparm_init(mem_ctx); /* We're not checking that loading the file succeeded *on purpose */ - lp_load_default(lp_ctx); + lpcfg_load_default(lp_ctx); return lp_ctx; } @@ -54,7 +54,7 @@ struct loadparm_context *py_default_loadparm_context(TALLOC_CTX *mem_ctx) { struct loadparm_context *ret; ret = loadparm_init(mem_ctx); - if (!lp_load_default(ret)) + if (!lpcfg_load_default(ret)) return NULL; return ret; } diff --git a/source4/param/secrets.c b/source4/param/secrets.c index 8c135dc2c6..d17c5f71ce 100644 --- a/source4/param/secrets.c +++ b/source4/param/secrets.c @@ -93,7 +93,7 @@ struct ldb_context *secrets_db_connect(TALLOC_CTX *mem_ctx, struct tevent_context *ev_ctx, struct loadparm_context *lp_ctx) { - return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_secrets_url(lp_ctx), + return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lpcfg_secrets_url(lp_ctx), NULL, NULL, 0); } diff --git a/source4/param/share_classic.c b/source4/param/share_classic.c index d732372f45..fcfe548649 100644 --- a/source4/param/share_classic.c +++ b/source4/param/share_classic.c @@ -47,7 +47,7 @@ static const char *sclassic_string_option(struct share_config *scfg, { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); - struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, struct loadparm_context); char *parm, *val; const char *ret; @@ -61,7 +61,7 @@ static const char *sclassic_string_option(struct share_config *scfg, *val = '\0'; val++; - ret = lp_parm_string(lp_ctx, s, parm, val); + ret = lpcfg_parm_string(lp_ctx, s, parm, val); if (!ret) { ret = defval; } @@ -74,25 +74,25 @@ static const char *sclassic_string_option(struct share_config *scfg, } if (strcmp(opt_name, SHARE_PATH) == 0) { - return lp_pathname(s, lp_default_service(lp_ctx)); + return lpcfg_pathname(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_COMMENT) == 0) { - return lp_comment(s, lp_default_service(lp_ctx)); + return lpcfg_comment(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_VOLUME) == 0) { - return volume_label(s, lp_default_service(lp_ctx)); + return volume_label(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_TYPE) == 0) { - if (lp_print_ok(s, lp_default_service(lp_ctx))) { + if (lpcfg_print_ok(s, lpcfg_default_service(lp_ctx))) { return "PRINTER"; } - if (strcmp("NTFS", lp_fstype(s, lp_default_service(lp_ctx))) == 0) { + if (strcmp("NTFS", lpcfg_fstype(s, lpcfg_default_service(lp_ctx))) == 0) { return "DISK"; } - return lp_fstype(s, lp_default_service(lp_ctx)); + return lpcfg_fstype(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_PASSWORD) == 0) { @@ -109,7 +109,7 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); - struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, struct loadparm_context); char *parm, *val; int ret; @@ -123,7 +123,7 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, *val = '\0'; val++; - ret = lp_parm_int(lp_ctx, s, parm, val, defval); + ret = lpcfg_parm_int(lp_ctx, s, parm, val, defval); if (!ret) { ret = defval; } @@ -132,27 +132,27 @@ static int sclassic_int_option(struct share_config *scfg, const char *opt_name, } if (strcmp(opt_name, SHARE_CSC_POLICY) == 0) { - return lp_csc_policy(s, lp_default_service(lp_ctx)); + return lpcfg_csc_policy(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAX_CONNECTIONS) == 0) { - return lp_max_connections(s, lp_default_service(lp_ctx)); + return lpcfg_max_connections(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CREATE_MASK) == 0) { - return lp_create_mask(s, lp_default_service(lp_ctx)); + return lpcfg_create_mask(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_DIR_MASK) == 0) { - return lp_dir_mask(s, lp_default_service(lp_ctx)); + return lpcfg_dir_mask(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_DIR_MODE) == 0) { - return lp_force_dir_mode(s, lp_default_service(lp_ctx)); + return lpcfg_force_dir_mode(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_FORCE_CREATE_MODE) == 0) { - return lp_force_create_mode(s, lp_default_service(lp_ctx)); + return lpcfg_force_create_mode(s, lpcfg_default_service(lp_ctx)); } @@ -167,7 +167,7 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); - struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, struct loadparm_context); char *parm, *val; bool ret; @@ -181,7 +181,7 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name *val = '\0'; val++; - ret = lp_parm_bool(lp_ctx, s, parm, val, defval); + ret = lpcfg_parm_bool(lp_ctx, s, parm, val, defval); talloc_free(parm); return ret; } @@ -191,43 +191,43 @@ static bool sclassic_bool_option(struct share_config *scfg, const char *opt_name } if (strcmp(opt_name, SHARE_BROWSEABLE) == 0) { - return lp_browseable(s, lp_default_service(lp_ctx)); + return lpcfg_browseable(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_READONLY) == 0) { - return lp_readonly(s, lp_default_service(lp_ctx)); + return lpcfg_readonly(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_SYSTEM) == 0) { - return lp_map_system(s, lp_default_service(lp_ctx)); + return lpcfg_map_system(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_HIDDEN) == 0) { - return lp_map_hidden(s, lp_default_service(lp_ctx)); + return lpcfg_map_hidden(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MAP_ARCHIVE) == 0) { - return lp_map_archive(s, lp_default_service(lp_ctx)); + return lpcfg_map_archive(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_LOCKING) == 0) { - return lp_strict_locking(s, lp_default_service(lp_ctx)); + return lpcfg_strict_locking(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_OPLOCKS) == 0) { - return lp_oplocks(s, lp_default_service(lp_ctx)); + return lpcfg_oplocks(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_STRICT_SYNC) == 0) { - return lp_strict_sync(s, lp_default_service(lp_ctx)); + return lpcfg_strict_sync(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_MSDFS_ROOT) == 0) { - return lp_msdfs_root(s, lp_default_service(lp_ctx)); + return lpcfg_msdfs_root(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_CI_FILESYSTEM) == 0) { - return lp_ci_filesystem(s, lp_default_service(lp_ctx)); + return lpcfg_ci_filesystem(s, lpcfg_default_service(lp_ctx)); } DEBUG(0,("request for unknown share bool option '%s'\n", @@ -240,7 +240,7 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar { struct loadparm_service *s = talloc_get_type(scfg->opaque, struct loadparm_service); - struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, + struct loadparm_context *lp_ctx = talloc_get_type(scfg->ctx->priv_data, struct loadparm_context); char *parm, *val; const char **ret; @@ -254,21 +254,21 @@ static const char **sclassic_string_list_option(TALLOC_CTX *mem_ctx, struct shar *val = '\0'; val++; - ret = lp_parm_string_list(mem_ctx, lp_ctx, s, parm, val, ",;"); + ret = lpcfg_parm_string_list(mem_ctx, lp_ctx, s, parm, val, ",;"); talloc_free(parm); return ret; } if (strcmp(opt_name, SHARE_HOSTS_ALLOW) == 0) { - return lp_hostsallow(s, lp_default_service(lp_ctx)); + return lpcfg_hostsallow(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_HOSTS_DENY) == 0) { - return lp_hostsdeny(s, lp_default_service(lp_ctx)); + return lpcfg_hostsdeny(s, lpcfg_default_service(lp_ctx)); } if (strcmp(opt_name, SHARE_NTVFS_HANDLER) == 0) { - return lp_ntvfs_handler(s, lp_default_service(lp_ctx)); + return lpcfg_ntvfs_handler(s, lpcfg_default_service(lp_ctx)); } DEBUG(0,("request for unknown share list option '%s'\n", @@ -286,7 +286,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, int num_services; const char **n; - num_services = lp_numservices((struct loadparm_context *)ctx->priv_data); + num_services = lpcfg_numservices((struct loadparm_context *)ctx->priv_data); n = talloc_array(mem_ctx, const char *, num_services); if (!n) { @@ -295,7 +295,7 @@ static NTSTATUS sclassic_list_all(TALLOC_CTX *mem_ctx, } for (i = 0; i < num_services; i++) { - n[i] = talloc_strdup(n, lp_servicename(lp_servicebynum((struct loadparm_context *)ctx->priv_data, i))); + n[i] = talloc_strdup(n, lpcfg_servicename(lpcfg_servicebynum((struct loadparm_context *)ctx->priv_data, i))); if (!n[i]) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(n); @@ -317,7 +317,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, struct share_config *s; struct loadparm_service *service; - service = lp_service((struct loadparm_context *)ctx->priv_data, name); + service = lpcfg_service((struct loadparm_context *)ctx->priv_data, name); if (service == NULL) { return NT_STATUS_OBJECT_NAME_NOT_FOUND; @@ -329,7 +329,7 @@ static NTSTATUS sclassic_get_config(TALLOC_CTX *mem_ctx, return NT_STATUS_NO_MEMORY; } - s->name = talloc_strdup(s, lp_servicename(service)); + s->name = talloc_strdup(s, lpcfg_servicename(service)); if (!s->name) { DEBUG(0,("ERROR: Out of memory!\n")); talloc_free(s); diff --git a/source4/param/share_ldb.c b/source4/param/share_ldb.c index 1d9f77421e..4517661c66 100644 --- a/source4/param/share_ldb.c +++ b/source4/param/share_ldb.c @@ -40,7 +40,7 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, return NT_STATUS_NO_MEMORY; } - sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx, + sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx, private_path(*ctx, lp_ctx, "share.ldb"), system_session(lp_ctx), NULL, 0); diff --git a/source4/param/tests/loadparm.c b/source4/param/tests/loadparm.c index 49fcdf7249..2e44a29eed 100644 --- a/source4/param/tests/loadparm.c +++ b/source4/param/tests/loadparm.c @@ -32,26 +32,26 @@ static bool test_create(struct torture_context *tctx) static bool test_set_option(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "workgroup=werkgroep"), "lp_set_option failed"); - torture_assert_str_equal(tctx, "WERKGROEP", lp_workgroup(lp_ctx), "workgroup"); + torture_assert(tctx, lpcfg_set_option(lp_ctx, "workgroup=werkgroep"), "lpcfg_set_option failed"); + torture_assert_str_equal(tctx, "WERKGROEP", lpcfg_workgroup(lp_ctx), "workgroup"); return true; } static bool test_set_cmdline(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_cmdline(lp_ctx, "workgroup", "werkgroep"), "lp_set_cmdline failed"); - torture_assert(tctx, lp_do_global_parameter(lp_ctx, "workgroup", "barbla"), "lp_set_option failed"); - torture_assert_str_equal(tctx, "WERKGROEP", lp_workgroup(lp_ctx), "workgroup"); + torture_assert(tctx, lpcfg_set_cmdline(lp_ctx, "workgroup", "werkgroep"), "lpcfg_set_cmdline failed"); + torture_assert(tctx, lpcfg_do_global_parameter(lp_ctx, "workgroup", "barbla"), "lpcfg_set_option failed"); + torture_assert_str_equal(tctx, "WERKGROEP", lpcfg_workgroup(lp_ctx), "workgroup"); return true; } static bool test_do_global_parameter(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_do_global_parameter(lp_ctx, "workgroup", "werkgroep42"), - "lp_set_cmdline failed"); - torture_assert_str_equal(tctx, lp_workgroup(lp_ctx), "WERKGROEP42", "workgroup"); + torture_assert(tctx, lpcfg_do_global_parameter(lp_ctx, "workgroup", "werkgroep42"), + "lpcfg_set_cmdline failed"); + torture_assert_str_equal(tctx, lpcfg_workgroup(lp_ctx), "WERKGROEP42", "workgroup"); return true; } @@ -59,9 +59,9 @@ static bool test_do_global_parameter(struct torture_context *tctx) static bool test_do_global_parameter_var(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_do_global_parameter_var(lp_ctx, "workgroup", "werk%s%d", "groep", 42), - "lp_set_cmdline failed"); - torture_assert_str_equal(tctx, lp_workgroup(lp_ctx), "WERKGROEP42", "workgroup"); + torture_assert(tctx, lpcfg_do_global_parameter_var(lp_ctx, "workgroup", "werk%s%d", "groep", 42), + "lpcfg_set_cmdline failed"); + torture_assert_str_equal(tctx, lpcfg_workgroup(lp_ctx), "WERKGROEP42", "workgroup"); return true; } @@ -69,15 +69,15 @@ static bool test_do_global_parameter_var(struct torture_context *tctx) static bool test_set_option_invalid(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, !lp_set_option(lp_ctx, "workgroup"), "lp_set_option succeeded"); + torture_assert(tctx, !lpcfg_set_option(lp_ctx, "workgroup"), "lpcfg_set_option succeeded"); return true; } static bool test_set_option_parametric(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "some:thing=blaat"), "lp_set_option failed"); - torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, NULL, "some", "thing"), "blaat", + torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=blaat"), "lpcfg_set_option failed"); + torture_assert_str_equal(tctx, lpcfg_parm_string(lp_ctx, NULL, "some", "thing"), "blaat", "invalid parametric option"); return true; } @@ -85,10 +85,10 @@ static bool test_set_option_parametric(struct torture_context *tctx) static bool test_lp_parm_double(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "some:thing=3.4"), "lp_set_option failed"); - torture_assert(tctx, lp_parm_double(lp_ctx, NULL, "some", "thing", 2.0) == 3.4, + torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=3.4"), "lpcfg_set_option failed"); + torture_assert(tctx, lpcfg_parm_double(lp_ctx, NULL, "some", "thing", 2.0) == 3.4, "invalid parametric option"); - torture_assert(tctx, lp_parm_double(lp_ctx, NULL, "some", "bla", 2.0) == 2.0, + torture_assert(tctx, lpcfg_parm_double(lp_ctx, NULL, "some", "bla", 2.0) == 2.0, "invalid parametric option"); return true; } @@ -96,10 +96,10 @@ static bool test_lp_parm_double(struct torture_context *tctx) static bool test_lp_parm_bool(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "some:thing=true"), "lp_set_option failed"); - torture_assert(tctx, lp_parm_bool(lp_ctx, NULL, "some", "thing", false) == true, + torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=true"), "lpcfg_set_option failed"); + torture_assert(tctx, lpcfg_parm_bool(lp_ctx, NULL, "some", "thing", false) == true, "invalid parametric option"); - torture_assert(tctx, lp_parm_bool(lp_ctx, NULL, "some", "bla", true) == true, + torture_assert(tctx, lpcfg_parm_bool(lp_ctx, NULL, "some", "bla", true) == true, "invalid parametric option"); return true; } @@ -107,10 +107,10 @@ static bool test_lp_parm_bool(struct torture_context *tctx) static bool test_lp_parm_int(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "some:thing=34"), "lp_set_option failed"); - torture_assert_int_equal(tctx, lp_parm_int(lp_ctx, NULL, "some", "thing", 20), 34, + torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=34"), "lpcfg_set_option failed"); + torture_assert_int_equal(tctx, lpcfg_parm_int(lp_ctx, NULL, "some", "thing", 20), 34, "invalid parametric option"); - torture_assert_int_equal(tctx, lp_parm_int(lp_ctx, NULL, "some", "bla", 42), 42, + torture_assert_int_equal(tctx, lpcfg_parm_int(lp_ctx, NULL, "some", "bla", 42), 42, "invalid parametric option"); return true; } @@ -118,10 +118,10 @@ static bool test_lp_parm_int(struct torture_context *tctx) static bool test_lp_parm_bytes(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - torture_assert(tctx, lp_set_option(lp_ctx, "some:thing=16K"), "lp_set_option failed"); - torture_assert_int_equal(tctx, lp_parm_bytes(lp_ctx, NULL, "some", "thing", 20), 16 * 1024, + torture_assert(tctx, lpcfg_set_option(lp_ctx, "some:thing=16K"), "lpcfg_set_option failed"); + torture_assert_int_equal(tctx, lpcfg_parm_bytes(lp_ctx, NULL, "some", "thing", 20), 16 * 1024, "invalid parametric option"); - torture_assert_int_equal(tctx, lp_parm_bytes(lp_ctx, NULL, "some", "bla", 42), 42, + torture_assert_int_equal(tctx, lpcfg_parm_bytes(lp_ctx, NULL, "some", "bla", 42), 42, "invalid parametric option"); return true; } @@ -129,10 +129,10 @@ static bool test_lp_parm_bytes(struct torture_context *tctx) static bool test_lp_do_service_parameter(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - struct loadparm_service *service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), "foo"); - torture_assert(tctx, lp_do_service_parameter(lp_ctx, service, - "some:thing", "foo"), "lp_set_option failed"); - torture_assert_str_equal(tctx, lp_parm_string(lp_ctx, service, "some", "thing"), "foo", + struct loadparm_service *service = lpcfg_add_service(lp_ctx, lpcfg_default_service(lp_ctx), "foo"); + torture_assert(tctx, lpcfg_do_service_parameter(lp_ctx, service, + "some:thing", "foo"), "lpcfg_set_option failed"); + torture_assert_str_equal(tctx, lpcfg_parm_string(lp_ctx, service, "some", "thing"), "foo", "invalid parametric option"); return true; } @@ -140,8 +140,8 @@ static bool test_lp_do_service_parameter(struct torture_context *tctx) static bool test_lp_service(struct torture_context *tctx) { struct loadparm_context *lp_ctx = loadparm_init(tctx); - struct loadparm_service *service = lp_add_service(lp_ctx, lp_default_service(lp_ctx), "foo"); - torture_assert(tctx, service == lp_service(lp_ctx, "foo"), "invalid service"); + struct loadparm_service *service = lpcfg_add_service(lp_ctx, lpcfg_default_service(lp_ctx), "foo"); + torture_assert(tctx, service == lpcfg_service(lp_ctx, "foo"), "invalid service"); return true; } @@ -159,7 +159,7 @@ struct torture_suite *torture_local_loadparm(TALLOC_CTX *mem_ctx) torture_suite_add_simple_test(suite, "set_lp_parm_int", test_lp_parm_int); torture_suite_add_simple_test(suite, "set_lp_parm_bytes", test_lp_parm_bytes); torture_suite_add_simple_test(suite, "service_parameter", test_lp_do_service_parameter); - torture_suite_add_simple_test(suite, "lp_service", test_lp_service); + torture_suite_add_simple_test(suite, "lpcfg_service", test_lp_service); torture_suite_add_simple_test(suite, "do_global_parameter_var", test_do_global_parameter_var); torture_suite_add_simple_test(suite, "do_global_parameter", test_do_global_parameter); diff --git a/source4/param/util.c b/source4/param/util.c index bbe4c87293..dd1d3193f3 100644 --- a/source4/param/util.c +++ b/source4/param/util.c @@ -35,33 +35,33 @@ */ -bool lp_is_mydomain(struct loadparm_context *lp_ctx, +bool lpcfg_is_mydomain(struct loadparm_context *lp_ctx, const char *domain) { - return strequal(lp_workgroup(lp_ctx), domain); + return strequal(lpcfg_workgroup(lp_ctx), domain); } -bool lp_is_my_domain_or_realm(struct loadparm_context *lp_ctx, +bool lpcfg_is_my_domain_or_realm(struct loadparm_context *lp_ctx, const char *domain) { - return strequal(lp_workgroup(lp_ctx), domain) || - strequal(lp_realm(lp_ctx), domain); + return strequal(lpcfg_workgroup(lp_ctx), domain) || + strequal(lpcfg_realm(lp_ctx), domain); } /** see if a string matches either our primary or one of our secondary netbios aliases. do a case insensitive match */ -bool lp_is_myname(struct loadparm_context *lp_ctx, const char *name) +bool lpcfg_is_myname(struct loadparm_context *lp_ctx, const char *name) { const char **aliases; int i; - if (strcasecmp(name, lp_netbios_name(lp_ctx)) == 0) { + if (strcasecmp(name, lpcfg_netbios_name(lp_ctx)) == 0) { return true; } - aliases = lp_netbios_aliases(lp_ctx); + aliases = lpcfg_netbios_aliases(lp_ctx); for (i=0; aliases && aliases[i]; i++) { if (strcasecmp(name, aliases[i]) == 0) { return true; @@ -86,7 +86,7 @@ char *lock_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, return talloc_strdup(mem_ctx, name); } - dname = talloc_strdup(mem_ctx, lp_lockdir(lp_ctx)); + dname = talloc_strdup(mem_ctx, lpcfg_lockdir(lp_ctx)); trim_string(dname,"","/"); if (!directory_exist(dname)) { @@ -112,7 +112,7 @@ char *config_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, const char *name) { char *fname, *config_dir, *p; - config_dir = talloc_strdup(mem_ctx, lp_configfile(lp_ctx)); + config_dir = talloc_strdup(mem_ctx, lpcfg_configfile(lp_ctx)); if (config_dir == NULL) { config_dir = talloc_strdup(mem_ctx, lp_default_path()); } @@ -150,7 +150,7 @@ char *private_path(TALLOC_CTX* mem_ctx, if (name[0] == 0 || name[0] == '/' || strstr(name, ":/")) { return talloc_strdup(mem_ctx, name); } - fname = talloc_asprintf(mem_ctx, "%s/%s", lp_private_dir(lp_ctx), name); + fname = talloc_asprintf(mem_ctx, "%s/%s", lpcfg_private_dir(lp_ctx), name); return fname; } @@ -160,7 +160,7 @@ char *private_path(TALLOC_CTX* mem_ctx, path itself */ char *smbd_tmp_path(TALLOC_CTX *mem_ctx, - struct loadparm_context *lp_ctx, + struct loadparm_context *lp_ctx, const char *name) { char *fname, *dname; @@ -271,7 +271,7 @@ static char *modules_path(TALLOC_CTX* mem_ctx, struct loadparm_context *lp_ctx, { const char *env_moduledir = getenv("LD_SAMBA_MODULE_PATH"); return talloc_asprintf(mem_ctx, "%s/%s", - env_moduledir?env_moduledir:lp_modulesdir(lp_ctx), + env_moduledir?env_moduledir:lpcfg_modulesdir(lp_ctx), name); } @@ -293,7 +293,7 @@ init_module_fn *load_samba_modules(TALLOC_CTX *mem_ctx, struct loadparm_context return ret; } -const char *lp_messaging_path(TALLOC_CTX *mem_ctx, +const char *lpcfg_messaging_path(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx) { return smbd_tmp_path(mem_ctx, lp_ctx, "messaging"); @@ -303,20 +303,20 @@ struct smb_iconv_convenience *smb_iconv_convenience_reinit_lp(TALLOC_CTX *mem_ct struct loadparm_context *lp_ctx, struct smb_iconv_convenience *old_ic) { - return smb_iconv_convenience_reinit(mem_ctx, lp_dos_charset(lp_ctx), - lp_unix_charset(lp_ctx), - lp_parm_bool(lp_ctx, NULL, "iconv", "native", true), + return smb_iconv_convenience_reinit(mem_ctx, lpcfg_dos_charset(lp_ctx), + lpcfg_unix_charset(lp_ctx), + lpcfg_parm_bool(lp_ctx, NULL, "iconv", "native", true), old_ic); } -const char *lp_sam_name(struct loadparm_context *lp_ctx) +const char *lpcfg_sam_name(struct loadparm_context *lp_ctx) { - switch (lp_server_role(lp_ctx)) { + switch (lpcfg_server_role(lp_ctx)) { case ROLE_DOMAIN_CONTROLLER: - return lp_workgroup(lp_ctx); + return lpcfg_workgroup(lp_ctx); default: - return lp_netbios_name(lp_ctx); + return lpcfg_netbios_name(lp_ctx); } } -- cgit