[SCM] Samba Shared Repository - branch master updated
Jelmer Vernooij
jelmer at samba.org
Sun Jun 20 07:23:35 MDT 2010
The branch, master has been updated
via 9e02764... pydsdb: Mark all SamDB and Schema methods that are in pydsdb as private, to discourage them being called directly.
via 7b32f65... testparm: Check netbios name and workgroup characters and length.
via 5f3d5a3... provision: Properly cancel transactions on the secrets ldb.
via 237ab66... selftest: Use scripted testparm.
via 7a064b9... pyparam: Support Loadparm.get(p, "global")
via a2540fb... ldb: Add ABI file for use when including ildap in the build.
via 08a3e8b... testparm: Simplify default option handling.
via 338315f... pyparam: Allow specifying None as section name to LoadparmContext.get() to mean default section.
via f0ab450... testparm: Fix suppress prompt option.
via c0e9a41... testparm: Fix exit value, install.
via de3f9e3... s4-python: Add LoadparmService.dump()
via 74c66c9... s4-python: Implement LoadParm.dump().
via f051a85... testparm: Split up functions that do multiple things.
via 0a07b8e... testparm: Convert to Python.
via 8f383fc... s4-python: Remove more unused imports, fix use of sets in upgradehelpers.
via 1e35ec4... setnttoken: Remove empty utility.
via 3795358... Use standard Python syntax, booleans and set()'s where appropriate.
via 66e27e5... Remove unnecessary use of transactions.
via 9bcd0da... ldb: Change LDBSAMBA back to subsystem, update comments, use different ABI file based on whether ldb_ildap is included.
from 44c01a5... s4:ldb-samba: fix the build without a system ldb
http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master
- Log -----------------------------------------------------------------
commit 9e02764f7c34fd5c9686c7a754a30e9a6ae95769
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 15:22:49 2010 +0200
pydsdb: Mark all SamDB and Schema methods that are in pydsdb as
private, to discourage them being called directly.
commit 7b32f65600988421dc8c825109e225612a3b6166
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 15:04:42 2010 +0200
testparm: Check netbios name and workgroup characters and length.
commit 5f3d5a3ad873feca66e118e020ed77189a7f2f9c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 14:24:54 2010 +0200
provision: Properly cancel transactions on the secrets ldb.
commit 237ab66f6c292b62b37af05771913b693b32d885
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 14:14:47 2010 +0200
selftest: Use scripted testparm.
commit 7a064b9960ab3cfb4ef76a939da7670aa34519a6
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 14:14:01 2010 +0200
pyparam: Support Loadparm.get(p, "global")
commit a2540fb3cbf8f288b106b03589d097212629b386
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:54:51 2010 +0200
ldb: Add ABI file for use when including ildap in the build.
commit 08a3e8b9f4d4d99cfca65752b0b516e0ec3f8651
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:51:39 2010 +0200
testparm: Simplify default option handling.
commit 338315f4d713e2648419f2eda805748901435204
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:51:14 2010 +0200
pyparam: Allow specifying None as section name to LoadparmContext.get()
to mean default section.
commit f0ab4503d6204ede46fad1d7586ad5d655c1c6fa
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:47:36 2010 +0200
testparm: Fix suppress prompt option.
commit c0e9a41f67f787f4fecec69dd661d92ecd24e608
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:41:38 2010 +0200
testparm: Fix exit value, install.
commit de3f9e31d34eac6ddc17e298299d5065f9a86e7c
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:40:49 2010 +0200
s4-python: Add LoadparmService.dump()
commit 74c66c9a3f6aedbbcdbce66a1d72a3c3b74137f8
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:29:35 2010 +0200
s4-python: Implement LoadParm.dump().
commit f051a8557f29352b4ec76ab6a8ed4de083f0816f
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:22:26 2010 +0200
testparm: Split up functions that do multiple things.
commit 0a07b8ebfe797f062e50fbb901cd8040513af6d2
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:16:30 2010 +0200
testparm: Convert to Python.
commit 8f383fc5c8ca7190c719e58473d609cf9dce9444
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 13:15:09 2010 +0200
s4-python: Remove more unused imports, fix use of sets in upgradehelpers.
commit 1e35ec43f2dcf08446bdeb62aa6a03827666b154
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 12:19:08 2010 +0200
setnttoken: Remove empty utility.
commit 3795358aca56f0c961f48b84ffeea4dd286ab914
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 12:06:50 2010 +0200
Use standard Python syntax, booleans and set()'s where appropriate.
commit 66e27e5214180b473b848201d2dcc7ccc3ad2b04
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 11:59:49 2010 +0200
Remove unnecessary use of transactions.
commit 9bcd0daba2cdd2acd6fc0e3de44f5138f2f3303f
Author: Jelmer Vernooij <jelmer at samba.org>
Date: Sun Jun 20 11:49:08 2010 +0200
ldb: Change LDBSAMBA back to subsystem, update comments, use different
ABI file based on whether ldb_ildap is included.
-----------------------------------------------------------------------
Summary of changes:
selftest/target/Samba4.pm | 4 +-
source4/dsdb/pydsdb.c | 30 ++--
source4/lib/ldb-samba/wscript_build | 14 +-
...db-samba4-0.9.11.sigs => ldb-ildap-0.9.12.sigs} | 0
source4/lib/ldb/wscript | 9 +-
source4/param/pyparam.c | 169 +++++++++----
source4/scripting/bin/fullschema | 3 +-
source4/scripting/bin/get-descriptors | 7 +-
source4/scripting/bin/testparm | 219 ++++++++++++++++
source4/scripting/python/samba/__init__.py | 4 +-
source4/scripting/python/samba/provision.py | 255 ++++++++++---------
source4/scripting/python/samba/samdb.py | 40 ++--
source4/scripting/python/samba/schema.py | 4 +-
.../python/samba/tests/upgradeprovisionneeddc.py | 25 ++-
source4/scripting/python/samba/upgradehelpers.py | 26 +-
source4/scripting/wscript_build | 2 +-
source4/setup/provision | 3 +-
source4/utils/setnttoken.c | 28 --
source4/utils/testparm.c | 260 --------------------
source4/utils/wscript_build | 12 -
20 files changed, 554 insertions(+), 560 deletions(-)
copy source4/lib/ldb/ABI/{ldb-samba4-0.9.11.sigs => ldb-ildap-0.9.12.sigs} (100%)
create mode 100755 source4/scripting/bin/testparm
delete mode 100644 source4/utils/setnttoken.c
delete mode 100644 source4/utils/testparm.c
Changeset truncated at 500 lines:
diff --git a/selftest/target/Samba4.pm b/selftest/target/Samba4.pm
index cd88a93..c19f162 100644
--- a/selftest/target/Samba4.pm
+++ b/selftest/target/Samba4.pm
@@ -669,13 +669,13 @@ nogroup:x:65534:nobody
my $configuration = "--configfile=$ctx->{smb_conf}";
#Ensure the config file is valid before we start
- my $testparm = $self->bindir_path("testparm");
+ my $testparm = $self->bindir_path("../scripting/bin/testparm");
if (system("$testparm $configuration -v --suppress-prompt >/dev/null 2>&1") != 0) {
system("$testparm -v --suppress-prompt $configuration >&2");
die("Failed to create a valid smb.conf configuration $testparm!");
}
- (system("($testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global 2> /dev/null | grep -i \"^$ctx->{netbiosname}\" ) >/dev/null 2>&1") == 0) or die("Failed to create a valid smb.conf configuration! $self->{bindir}/testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global");
+ (system("($testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global 2> /dev/null | grep -i \"^$ctx->{netbiosname}\" ) >/dev/null 2>&1") == 0) or die("Failed to create a valid smb.conf configuration! $testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global");
my $ret = {
KRB5_CONFIG => $ctx->{krb5_conf},
diff --git a/source4/dsdb/pydsdb.c b/source4/dsdb/pydsdb.c
index a911afc..bddda8d 100644
--- a/source4/dsdb/pydsdb.c
+++ b/source4/dsdb/pydsdb.c
@@ -462,46 +462,46 @@ static PyObject *py_dsdb_write_prefixes_from_schema_to_ldb(PyObject *self, PyObj
static PyMethodDef py_dsdb_methods[] = {
- { "samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
+ { "_samdb_server_site_name", (PyCFunction)py_samdb_server_site_name,
METH_VARARGS, "Get the server site name as a string"},
- { "dsdb_convert_schema_to_openldap",
+ { "_dsdb_convert_schema_to_openldap",
(PyCFunction)py_dsdb_convert_schema_to_openldap, METH_VARARGS,
"dsdb_convert_schema_to_openldap(ldb, target_str, mapping) -> str\n"
"Create an OpenLDAP schema from a schema." },
- { "samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
+ { "_samdb_set_domain_sid", (PyCFunction)py_samdb_set_domain_sid,
METH_VARARGS,
"samdb_set_domain_sid(samdb, sid)\n"
"Set SID of domain to use." },
- { "samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
+ { "_samdb_get_domain_sid", (PyCFunction)py_samdb_get_domain_sid,
METH_VARARGS,
"samdb_get_domain_sid(samdb)\n"
"Get SID of domain in use." },
- { "samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
+ { "_samdb_ntds_invocation_id", (PyCFunction)py_samdb_ntds_invocation_id,
METH_VARARGS, "get the NTDS invocation ID GUID as a string"},
- { "samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
+ { "_samdb_set_ntds_settings_dn", (PyCFunction)py_samdb_set_ntds_settings_dn,
METH_VARARGS,
"samdb_set_ntds_settings_dn(samdb, ntds_settings_dn)\n"
"Set NTDS Settings DN for this LDB (allows it to be set before the DB fully exists)." },
- { "dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
+ { "_dsdb_get_oid_from_attid", (PyCFunction)py_dsdb_get_oid_from_attid,
METH_VARARGS, NULL },
- { "dsdb_set_ntds_invocation_id",
+ { "_dsdb_set_ntds_invocation_id",
(PyCFunction)py_dsdb_set_ntds_invocation_id, METH_VARARGS,
NULL },
- { "samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
+ { "_samdb_ntds_objectGUID", (PyCFunction)py_samdb_ntds_objectGUID,
METH_VARARGS, "get the NTDS objectGUID as a string"},
- { "dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
+ { "_dsdb_set_global_schema", (PyCFunction)py_dsdb_set_global_schema,
METH_VARARGS, NULL },
- { "dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
+ { "_dsdb_load_partition_usn", (PyCFunction)py_dsdb_load_partition_usn,
METH_VARARGS,
"get uSNHighest and uSNUrgent from the partition @REPLCHANGED"},
- { "dsdb_set_am_rodc",
+ { "_dsdb_set_am_rodc",
(PyCFunction)py_dsdb_set_am_rodc, METH_VARARGS,
NULL },
- { "dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
+ { "_dsdb_set_schema_from_ldif", (PyCFunction)py_dsdb_set_schema_from_ldif, METH_VARARGS,
NULL },
- { "dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
+ { "_dsdb_set_schema_from_ldb", (PyCFunction)py_dsdb_set_schema_from_ldb, METH_VARARGS,
NULL },
- { "dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
+ { "_dsdb_write_prefixes_from_schema_to_ldb", (PyCFunction)py_dsdb_write_prefixes_from_schema_to_ldb, METH_VARARGS,
NULL },
{ NULL }
};
diff --git a/source4/lib/ldb-samba/wscript_build b/source4/lib/ldb-samba/wscript_build
index 717a846..970f495 100644
--- a/source4/lib/ldb-samba/wscript_build
+++ b/source4/lib/ldb-samba/wscript_build
@@ -1,11 +1,15 @@
#!/usr/bin/env python
+# LDBSAMBA gets included in the ldb build when we are building ldb_ildap
+# as a built-in module and this delutes the symbols in the ldb library with
+# the symbols of all of ldb_ildap's dependencies.
-# It is important that this is a library!
-# Otherwise samba specific symbols end up in
-# 'ldb' and we fail the ABI check, when not using
-# a system 'ldb'.
-bld.SAMBA_LIBRARY('LDBSAMBA',
+# However, LDBSAMBA has to be a subsystem, otherwise we end up with an unusable
+# build when building against the system ldb.
+
+# When adding/modifying public symbols in LDBSAMBA, please make sure that
+# lib/ldb/ABI/ldb-samba-X.sigs gets updated.
+bld.SAMBA_SUBSYSTEM('LDBSAMBA',
source='ldif_handlers.c ldb_wrap.c',
autoproto='ldif_handlers_proto.h',
public_deps='ldb',
diff --git a/source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs b/source4/lib/ldb/ABI/ldb-ildap-0.9.12.sigs
similarity index 100%
copy from source4/lib/ldb/ABI/ldb-samba4-0.9.11.sigs
copy to source4/lib/ldb/ABI/ldb-ildap-0.9.12.sigs
diff --git a/source4/lib/ldb/wscript b/source4/lib/ldb/wscript
index 6f6c9a1..df2245f 100644
--- a/source4/lib/ldb/wscript
+++ b/source4/lib/ldb/wscript
@@ -74,13 +74,15 @@ def build(bld):
ldb_attributes.c attrib_handlers.c ldb_controls.c qsort.c''')
if s4_build:
+ builtin_ildap = not bld.CONFIG_SET('USING_SYSTEM_LDB')
# this is only in the s4 build
bld.SAMBA_MODULE('ldb_ildap', 'ldb_ildap/ldb_ildap.c',
init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
deps='talloc LIBCLI_LDAP CREDENTIALS',
- internal_module=not bld.CONFIG_SET('USING_SYSTEM_LDB'),
+ internal_module=builtin_ildap,
subsystem='ldb')
else:
+ builtin_ildap = False
# this is not included in the s4 build
bld.SAMBA_MODULE('ldb_ldap', 'ldb_ldap/ldb_ldap.c',
init_function='LDB_BACKEND(ldapi),LDB_BACKEND(ldaps),LDB_BACKEND(ldap)',
@@ -96,7 +98,10 @@ def build(bld):
bld.env.PACKAGE_VERSION = VERSION
bld.env.PKGCONFIGDIR = '${LIBDIR}/pkgconfig'
- abi_file = 'ABI/ldb-%s.sigs' % VERSION
+ if builtin_ildap:
+ abi_file = 'ABI/ldb-ildap-%s.sigs' % VERSION
+ else:
+ abi_file = 'ABI/ldb-%s.sigs' % VERSION
bld.SAMBA_SUBSYSTEM('pyldb_util', deps='ldb',
source='pyldb_util.c', needs_python=True)
diff --git a/source4/param/pyparam.c b/source4/param/pyparam.c
index 40d25f7..a648f65 100644
--- a/source4/param/pyparam.c
+++ b/source4/param/pyparam.c
@@ -30,6 +30,7 @@ typedef inquiry lenfunc;
#endif
#define PyLoadparmContext_AsLoadparmContext(obj) py_talloc_get_type(obj, struct loadparm_context)
+#define PyLoadparmService_AsLoadparmService(obj) py_talloc_get_type(obj, struct loadparm_service)
PyAPI_DATA(PyTypeObject) PyLoadparmContext;
PyAPI_DATA(PyTypeObject) PyLoadparmService;
@@ -41,63 +42,63 @@ PyObject *PyLoadparmService_FromService(struct loadparm_service *service)
static PyObject *py_lp_ctx_get_helper(struct loadparm_context *lp_ctx, const char *service_name, const char *param_name)
{
- struct parm_struct *parm = NULL;
- void *parm_ptr = NULL;
- int i;
+ struct parm_struct *parm = NULL;
+ void *parm_ptr = NULL;
+ int i;
- if (service_name != NULL) {
- struct loadparm_service *service;
- /* its a share parameter */
- service = lp_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,
- 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);
- if (value == NULL) {
- return NULL;
- }
- return PyString_FromString(value);
- }
+ if (service_name != NULL && strwicmp(service_name, GLOBAL_NAME) &&
+ strwicmp(service_name, GLOBAL_NAME2)) {
+ struct loadparm_service *service;
+ /* its a share parameter */
+ service = lp_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,
+ 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);
+ if (value == NULL) {
+ return NULL;
+ }
+ return PyString_FromString(value);
+ }
- parm = lp_parm_struct(param_name);
- if (parm == NULL || parm->pclass == P_GLOBAL) {
- return NULL;
- }
- parm_ptr = lp_parm_ptr(lp_ctx, service, parm);
+ parm = lp_parm_struct(param_name);
+ if (parm == NULL || parm->pclass == P_GLOBAL) {
+ return NULL;
+ }
+ parm_ptr = lp_parm_ptr(lp_ctx, service, parm);
} else if (strchr(param_name, ':')) {
- /* its a global parametric option */
- 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);
- if (value == NULL)
- return NULL;
- return PyString_FromString(value);
- } else {
- /* its a global parameter */
- parm = lp_parm_struct(param_name);
- if (parm == NULL) {
- return NULL;
+ /* its a global parametric option */
+ 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);
+ if (value == NULL)
+ return NULL;
+ return PyString_FromString(value);
+ } else {
+ /* its a global parameter */
+ parm = lp_parm_struct(param_name);
+ if (parm == NULL) {
+ return NULL;
+ }
+ parm_ptr = lp_parm_ptr(lp_ctx, NULL, parm);
}
- parm_ptr = lp_parm_ptr(lp_ctx, NULL, parm);
- }
- if (parm == NULL || parm_ptr == NULL) {
- return NULL;
+ if (parm == NULL || parm_ptr == NULL) {
+ return NULL;
}
/* construct and return the right type of python object */
@@ -174,7 +175,7 @@ static PyObject *py_lp_ctx_get(py_talloc_Object *self, PyObject *args)
char *param_name;
char *section_name = NULL;
PyObject *ret;
- if (!PyArg_ParseTuple(args, "s|s", ¶m_name, §ion_name))
+ if (!PyArg_ParseTuple(args, "s|z", ¶m_name, §ion_name))
return NULL;
ret = py_lp_ctx_get_helper(PyLoadparmContext_AsLoadparmContext(self), section_name, param_name);
@@ -246,6 +247,28 @@ static PyObject *py_lp_ctx_services(py_talloc_Object *self)
return ret;
}
+static PyObject *py_lp_dump(PyObject *self, PyObject *args)
+{
+ PyObject *py_stream;
+ bool show_defaults = false;
+ FILE *f;
+ struct loadparm_context *lp_ctx = PyLoadparmContext_AsLoadparmContext(self);
+
+ if (!PyArg_ParseTuple(args, "O|b", &py_stream, &show_defaults))
+ return NULL;
+
+ f = PyFile_AsFile(py_stream);
+ if (f == NULL) {
+ PyErr_SetString(PyExc_TypeError, "Not a file stream");
+ return NULL;
+ }
+
+ lp_dump(lp_ctx, f, show_defaults, lp_numservices(lp_ctx));
+
+ Py_RETURN_NONE;
+}
+
+
static PyMethodDef py_lp_ctx_methods[] = {
{ "load", (PyCFunction)py_lp_ctx_load, METH_VARARGS,
"S.load(filename) -> None\n"
@@ -269,6 +292,8 @@ static PyMethodDef py_lp_ctx_methods[] = {
"S.private_path(name) -> path\n" },
{ "services", (PyCFunction)py_lp_ctx_services, METH_NOARGS,
"S.services() -> list" },
+ { "dump", (PyCFunction)py_lp_dump, METH_VARARGS,
+ "S.dump(stream, show_defaults=False)" },
{ NULL }
};
@@ -345,10 +370,48 @@ PyTypeObject PyLoadparmContext = {
.tp_flags = Py_TPFLAGS_DEFAULT,
};
+static PyObject *py_lp_service_dump(PyObject *self, PyObject *args)
+{
+ PyObject *py_stream;
+ bool show_defaults = false;
+ FILE *f;
+ struct loadparm_service *service = PyLoadparmService_AsLoadparmService(self);
+ struct loadparm_service *default_service;
+ PyObject *py_default_service;
+
+ if (!PyArg_ParseTuple(args, "OO|b", &py_stream, &py_default_service,
+ &show_defaults))
+ return NULL;
+
+ f = PyFile_AsFile(py_stream);
+ if (f == NULL) {
+ PyErr_SetString(PyExc_TypeError, "Not a file stream");
+ return NULL;
+ }
+
+ if (!PyObject_TypeCheck(py_default_service, &PyLoadparmService)) {
+ PyErr_SetNone(PyExc_TypeError);
+ return NULL;
+ }
+
+ default_service = PyLoadparmService_AsLoadparmService(py_default_service);
+
+ lp_dump_one(f, show_defaults, service, default_service);
+
+ Py_RETURN_NONE;
+}
+
+static PyMethodDef py_lp_service_methods[] = {
+ { "dump", (PyCFunction)py_lp_service_dump, METH_VARARGS,
+ "S.dump(f, default_service, show_defaults=False)" },
+ { NULL }
+};
+
PyTypeObject PyLoadparmService = {
.tp_name = "LoadparmService",
.tp_dealloc = py_talloc_dealloc,
.tp_basicsize = sizeof(py_talloc_Object),
+ .tp_methods = py_lp_service_methods,
.tp_flags = Py_TPFLAGS_DEFAULT,
};
diff --git a/source4/scripting/bin/fullschema b/source4/scripting/bin/fullschema
index 2f7d32c..2987136 100755
--- a/source4/scripting/bin/fullschema
+++ b/source4/scripting/bin/fullschema
@@ -5,7 +5,6 @@
import base64
import optparse
-import os
import sys
# Find right directory when running from source tree
@@ -13,7 +12,7 @@ sys.path.insert(0, "bin/python")
import samba
from samba import getopt as options, Ldb
-from ldb import SCOPE_SUBTREE, SCOPE_BASE, LdbError
+from ldb import SCOPE_SUBTREE, SCOPE_BASE
import sys
parser = optparse.OptionParser("fullschema <URL>")
diff --git a/source4/scripting/bin/get-descriptors b/source4/scripting/bin/get-descriptors
index 65be2fe..73295b0 100755
--- a/source4/scripting/bin/get-descriptors
+++ b/source4/scripting/bin/get-descriptors
@@ -27,24 +27,20 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
-import getopt
import optparse
import sys
-import os
import base64
-import re
sys.path.insert(0, "bin/python")
import samba
from samba.auth import system_session
import samba.getopt as options
-from samba import param
from samba.ndr import ndr_pack, ndr_unpack
from samba.dcerpc import security
from samba import Ldb
from samba.samdb import SamDB
-from ldb import SCOPE_SUBTREE, SCOPE_ONELEVEL, SCOPE_BASE, LdbError
+from ldb import SCOPE_SUBTREE, SCOPE_BASE
parser = optparse.OptionParser("get-descriptor [options]")
sambaopts = options.SambaOptions(parser)
@@ -65,6 +61,7 @@ creds = credopts.get_credentials(lp)
opts = parser.parse_args()[0]
class DescrGetter:
+
def __init__(self, localdomain, remotedomain):
self.samdb = SamDB(session_info=system_session(), lp=lp, options=["modules:paged_searches"])
self.remote_ldb= Ldb("ldap://" + opts.host + ":389", credentials=creds, lp=lp,
diff --git a/source4/scripting/bin/testparm b/source4/scripting/bin/testparm
new file mode 100755
index 0000000..471d9e0
--- /dev/null
+++ b/source4/scripting/bin/testparm
@@ -0,0 +1,219 @@
+#!/usr/bin/python
+# vim: expandtab ft=python
+#
+# Unix SMB/CIFS implementation.
+# Test validity of smb.conf
+# Copyright (C) Karl Auer 1993, 1994-1998
+#
+# Extensively modified by Andrew Tridgell, 1995
+# Converted to popt by Jelmer Vernooij (jelmer at nl.linux.org), 2002
+# Updated for Samba4 by Andrew Bartlett <abartlet at samba.org> 2006
+# Converted to Python by Jelmer Vernooij <jelmer at samba.org> 2010
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+#
+# Testbed for loadparm.c/params.c
+#
+# This module simply loads a specified configuration file and
+# if successful, dumps it's contents to stdout. Note that the
+# operation is performed with DEBUGLEVEL at 3.
+#
+# Useful for a quick 'syntax check' of a configuration file.
+#
+
+import logging
+import optparse
+import os
+import sys
+
+# Find right directory when running from source tree
+sys.path.insert(0, "bin/python")
+
+import samba
+from samba import getopt as options
+
+# Here we do a set of 'hard coded' checks for bad
+# configuration settings.
+
+def do_global_checks(lp, logger):
+ valid = True
+
+ netbios_name = lp.get("netbios name")
+ if not samba.valid_netbios_name(netbios_name):
+ logger.error("netbios name %s is not a valid netbios name",
+ netbios_name)
+ valid = False
+
+ workgroup = lp.get("workgroup")
+ if not samba.valid_netbios_name(workgroup):
+ logger.error("workgroup name %s is not a valid netbios name",
+ workgroup)
+ valid = False
+
--
Samba Shared Repository
More information about the samba-cvs
mailing list