summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2008-01-31 09:49:15 +1100
committerAndrew Tridgell <tridge@samba.org>2008-01-31 09:49:15 +1100
commit8398982ac998d98cb1184f2b6d2631f1cfc9b3f8 (patch)
treed930f888211ce6f1353b4b41f2b1563957933e2b
parent3a3ff8ebe7b7de24a7d3e2c9dd105d9fbeeb5d42 (diff)
parent1c22c925e5a7f45fbcbf9c2f8e206ee6b2b12192 (diff)
downloadsamba-8398982ac998d98cb1184f2b6d2631f1cfc9b3f8.tar.gz
samba-8398982ac998d98cb1184f2b6d2631f1cfc9b3f8.tar.bz2
samba-8398982ac998d98cb1184f2b6d2631f1cfc9b3f8.zip
Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-test
(This used to be commit f6a5848e5e211d4d4d66b7eca46b4b0ad4c9daab)
-rw-r--r--source4/dsdb/samdb/ldb_modules/extended_dn.c7
-rw-r--r--source4/dsdb/samdb/ldb_modules/instancetype.c2
-rw-r--r--source4/dsdb/samdb/ldb_modules/kludge_acl.c5
-rw-r--r--source4/dsdb/samdb/ldb_modules/samldb.c6
-rw-r--r--source4/librpc/idl/netlogon.idl8
-rw-r--r--source4/librpc/ndr.pc.in2
-rw-r--r--source4/pidl/tests/Util.pm2
-rw-r--r--source4/rpc_server/netlogon/dcerpc_netlogon.c8
-rw-r--r--source4/scripting/python/config.m41
-rw-r--r--source4/scripting/python/pyrpc.h5
-rw-r--r--source4/scripting/python/samba/provision.py9
-rw-r--r--source4/scripting/python/samba/tests/provision.py8
-rw-r--r--source4/torture/libnet/libnet_BecomeDC.c25
-rw-r--r--source4/torture/rpc/spoolss_notify.c11
14 files changed, 73 insertions, 26 deletions
diff --git a/source4/dsdb/samdb/ldb_modules/extended_dn.c b/source4/dsdb/samdb/ldb_modules/extended_dn.c
index b62e806398..802f86570b 100644
--- a/source4/dsdb/samdb/ldb_modules/extended_dn.c
+++ b/source4/dsdb/samdb/ldb_modules/extended_dn.c
@@ -256,6 +256,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
ac = talloc(req, struct extended_context);
if (ac == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -273,6 +274,7 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
down_req = talloc_zero(req, struct ldb_request);
if (down_req == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -291,8 +293,10 @@ static int extended_search(struct ldb_module *module, struct ldb_request *req)
}
if (ac->remove_guid || ac->remove_sid) {
new_attrs = copy_attrs(down_req, req->op.search.attrs);
- if (new_attrs == NULL)
+ if (new_attrs == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
+ }
if (ac->remove_guid) {
if (!add_attrs(down_req, &new_attrs, "objectGUID"))
@@ -339,6 +343,7 @@ static int extended_init(struct ldb_module *module)
req = talloc(module, struct ldb_request);
if (req == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c
index 064c28ec65..65df294e90 100644
--- a/source4/dsdb/samdb/ldb_modules/instancetype.c
+++ b/source4/dsdb/samdb/ldb_modules/instancetype.c
@@ -72,6 +72,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
down_req = talloc(req, struct ldb_request);
if (down_req == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -81,6 +82,7 @@ static int instancetype_add(struct ldb_module *module, struct ldb_request *req)
down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message);
if (msg == NULL) {
talloc_free(down_req);
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
diff --git a/source4/dsdb/samdb/ldb_modules/kludge_acl.c b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
index 97130495a3..ea33548b91 100644
--- a/source4/dsdb/samdb/ldb_modules/kludge_acl.c
+++ b/source4/dsdb/samdb/ldb_modules/kludge_acl.c
@@ -316,6 +316,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req)
ac = talloc(req, struct kludge_acl_context);
if (ac == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -329,6 +330,7 @@ static int kludge_acl_search(struct ldb_module *module, struct ldb_request *req)
down_req = talloc_zero(req, struct ldb_request);
if (down_req == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -417,6 +419,7 @@ static int kludge_acl_init(struct ldb_module *module)
data = talloc(module, struct kludge_private_data);
if (data == NULL) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -424,6 +427,7 @@ static int kludge_acl_init(struct ldb_module *module)
module->private_data = data;
if (!mem_ctx) {
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -453,6 +457,7 @@ static int kludge_acl_init(struct ldb_module *module)
data->password_attrs = talloc_array(data, const char *, password_attributes->num_values + 1);
if (!data->password_attrs) {
talloc_free(mem_ctx);
+ ldb_oom(module->ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
for (i=0; i < password_attributes->num_values; i++) {
diff --git a/source4/dsdb/samdb/ldb_modules/samldb.c b/source4/dsdb/samdb/ldb_modules/samldb.c
index 8a80260a69..baf419c750 100644
--- a/source4/dsdb/samdb/ldb_modules/samldb.c
+++ b/source4/dsdb/samdb/ldb_modules/samldb.c
@@ -72,7 +72,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
if (new_id == 0) {
/* out of IDs ! */
- ldb_debug(ldb, LDB_DEBUG_FATAL, "Are we out of valid IDs ?\n");
+ ldb_set_errstring(ldb, "Are we out of valid IDs ?\n");
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -81,6 +81,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
ZERO_STRUCT(msg);
msg.dn = ldb_dn_copy(mem_ctx, dn);
if (!msg.dn) {
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
msg.num_elements = 2;
@@ -91,6 +92,7 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
els[0].flags = LDB_FLAG_MOD_DELETE;
els[0].name = talloc_strdup(mem_ctx, "nextRid");
if (!els[0].name) {
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
@@ -101,12 +103,14 @@ static int samldb_set_next_rid(struct ldb_context *ldb, TALLOC_CTX *mem_ctx,
vals[0].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", old_id);
if (!vals[0].data) {
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
vals[0].length = strlen((char *)vals[0].data);
vals[1].data = (uint8_t *)talloc_asprintf(mem_ctx, "%u", new_id);
if (!vals[1].data) {
+ ldb_oom(ldb);
return LDB_ERR_OPERATIONS_ERROR;
}
vals[1].length = strlen((char *)vals[1].data);
diff --git a/source4/librpc/idl/netlogon.idl b/source4/librpc/idl/netlogon.idl
index 7f7712edf6..6df8bfd1a4 100644
--- a/source4/librpc/idl/netlogon.idl
+++ b/source4/librpc/idl/netlogon.idl
@@ -1270,7 +1270,13 @@ interface netlogon
/****************/
/* Function 0x29 */
- WERROR netr_DSRDEREGISTERDNSHOSTRECORDS();
+ WERROR netr_DsrDeregisterDNSHostRecords(
+ [in] [string,charset(UTF16)] uint16 *server_name,
+ [in] [string,charset(UTF16)] uint16 *domain,
+ [in] GUID *domain_guid,
+ [in] GUID *dsa_guid,
+ [in,ref] [string,charset(UTF16)] uint16 *dns_host
+ );
/****************/
/* Function 0x2a */
diff --git a/source4/librpc/ndr.pc.in b/source4/librpc/ndr.pc.in
index 4317397dc7..ed4c459214 100644
--- a/source4/librpc/ndr.pc.in
+++ b/source4/librpc/ndr.pc.in
@@ -5,7 +5,7 @@ includedir=@includedir@
Name: ndr
Description: Network Data Representation Core Library
-Requires: talloc
+Requires: samba-config talloc
Version: 0.0.1
Libs: -L${libdir} -lndr
Cflags: -I${includedir} -DHAVE_IMMEDIATE_STRUCTURES=1
diff --git a/source4/pidl/tests/Util.pm b/source4/pidl/tests/Util.pm
index 82ab130e5a..4ad216a6a1 100644
--- a/source4/pidl/tests/Util.pm
+++ b/source4/pidl/tests/Util.pm
@@ -134,7 +134,7 @@ $c
$cc = "cc";
}
- my $flags = `pkg-config --libs --cflags ndr samba-config`;
+ my $flags = `pkg-config --libs --cflags ndr`;
my $cmd = "$cc $cflags -x c - -o $outfile $flags $ldflags";
$cmd =~ s/\n//g;
diff --git a/source4/rpc_server/netlogon/dcerpc_netlogon.c b/source4/rpc_server/netlogon/dcerpc_netlogon.c
index 6a5e0a17a2..4d38dc069e 100644
--- a/source4/rpc_server/netlogon/dcerpc_netlogon.c
+++ b/source4/rpc_server/netlogon/dcerpc_netlogon.c
@@ -1212,11 +1212,11 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
}
-/*
- netr_DSRDEREGISTERDNSHOSTRECORDS
+/*
+ netr_DsrDeregisterDNSHostRecords
*/
-static WERROR dcesrv_netr_DSRDEREGISTERDNSHOSTRECORDS(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
- struct netr_DSRDEREGISTERDNSHOSTRECORDS *r)
+static WERROR dcesrv_netr_DsrDeregisterDNSHostRecords(struct dcesrv_call_state *dce_call, TALLOC_CTX *mem_ctx,
+ struct netr_DsrDeregisterDNSHostRecords *r)
{
DCESRV_FAULT(DCERPC_FAULT_OP_RNG_ERROR);
}
diff --git a/source4/scripting/python/config.m4 b/source4/scripting/python/config.m4
index 4f46f92682..e4a34ece1e 100644
--- a/source4/scripting/python/config.m4
+++ b/source4/scripting/python/config.m4
@@ -66,6 +66,7 @@ if test $working_python = yes; then
SMB_ENABLE(EXT_LIB_PYTHON,YES)
SMB_ENABLE(smbpython,YES)
SMB_ENABLE(LIBPYTHON,YES)
+ dnl AC_DEFINE(HAVE_WORKING_PYTHON, 1, [Whether we have working python support])
AC_MSG_RESULT([yes])
else
SMB_ENABLE(EXT_LIB_PYTHON,NO)
diff --git a/source4/scripting/python/pyrpc.h b/source4/scripting/python/pyrpc.h
index 5390c6923d..3a5d235cfc 100644
--- a/source4/scripting/python/pyrpc.h
+++ b/source4/scripting/python/pyrpc.h
@@ -27,3 +27,8 @@
#define dom_sid28_Type dom_sid_Type
#define dom_sid2_Check dom_sid_Check
#define dom_sid28_Check dom_sid28_Check
+
+/* This macro is only provided by Python >= 2.3 */
+#ifndef PyAPI_DATA
+# define PyAPI_DATA(RTYPE) extern RTYPE
+#endif
diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py
index f244679eb5..d2a4f28b64 100644
--- a/source4/scripting/python/samba/provision.py
+++ b/source4/scripting/python/samba/provision.py
@@ -203,7 +203,13 @@ def provision_paths_from_lp(lp, dnsdomain, private_dir=None):
paths.s4_ldapi_path = os.path.join(private_dir, "ldapi")
paths.phpldapadminconfig = os.path.join(private_dir,
"phpldapadmin-config.php")
- paths.hklm = os.path.join(private_dir, "hklm.ldb")
+ paths.hklm = "hklm.ldb"
+ paths.hkcr = "hkcr.ldb"
+ paths.hkcu = "hkcu.ldb"
+ paths.hku = "hku.ldb"
+ paths.hkpd = "hkpd.ldb"
+ paths.hkpt = "hkpt.ldb"
+
paths.sysvol = lp.get("sysvol", "path")
if paths.sysvol is None:
paths.sysvol = os.path.join(lp.get("lock dir"), "sysvol")
@@ -442,6 +448,7 @@ def setup_registry(path, setup_path, session_info, credentials, lp):
:param lp: Loadparm context
"""
reg = registry.Registry()
+ print path
hive = registry.open_ldb(path, session_info=session_info,
credentials=credentials, lp_ctx=lp)
reg.mount_hive(hive, "HKEY_LOCAL_MACHINE")
diff --git a/source4/scripting/python/samba/tests/provision.py b/source4/scripting/python/samba/tests/provision.py
index 1456b6751c..4e9fa9c3ef 100644
--- a/source4/scripting/python/samba/tests/provision.py
+++ b/source4/scripting/python/samba/tests/provision.py
@@ -21,6 +21,10 @@ import os
from samba.provision import setup_secretsdb, secretsdb_become_dc
import samba.tests
from ldb import Dn
+import param
+
+lp = param.LoadParm()
+lp.load("st/dc/etc/smb.conf")
setup_dir = "setup"
def setup_path(file):
@@ -30,7 +34,7 @@ def setup_path(file):
class ProvisionTestCase(samba.tests.TestCaseInTempDir):
def test_setup_secretsdb(self):
path = os.path.join(self.tempdir, "secrets.ldb")
- ldb = setup_secretsdb(path, setup_path, None, None, None)
+ ldb = setup_secretsdb(path, setup_path, None, None, lp=lp)
try:
self.assertEquals("LSA Secrets",
ldb.searchone(basedn="CN=LSA Secrets", attribute="CN"))
@@ -40,7 +44,7 @@ class ProvisionTestCase(samba.tests.TestCaseInTempDir):
def test_become_dc(self):
path = os.path.join(self.tempdir, "secrets.ldb")
- secrets_ldb = setup_secretsdb(path, setup_path, None, None, None)
+ secrets_ldb = setup_secretsdb(path, setup_path, None, None, lp=lp)
try:
secretsdb_become_dc(secrets_ldb, setup_path, domain="EXAMPLE",
realm="example", netbiosname="myhost",
diff --git a/source4/torture/libnet/libnet_BecomeDC.c b/source4/torture/libnet/libnet_BecomeDC.c
index d9645356e8..0ef6a03a6a 100644
--- a/source4/torture/libnet/libnet_BecomeDC.c
+++ b/source4/torture/libnet/libnet_BecomeDC.c
@@ -90,7 +90,6 @@ static NTSTATUS test_become_dc_check_options(void *private_data,
return NT_STATUS_OK;
}
-#ifndef PROVISION_PYTHON
#include "lib/appweb/ejs/ejs.h"
#include "lib/appweb/ejs/ejsInternal.h"
#include "scripting/ejs/smbcalls.h"
@@ -148,14 +147,16 @@ failed:
return ejs_error;
}
-static NTSTATUS test_become_dc_prepare_db(void *private_data,
- const struct libnet_BecomeDC_PrepareDB *p)
+static NTSTATUS test_become_dc_prepare_db_ejs(void *private_data,
+ const struct libnet_BecomeDC_PrepareDB *p)
{
struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
char *ejs;
int ret;
bool ok;
+ DEBUG(0,("Provision for Become-DC test using EJS\n"));
+
DEBUG(0,("New Server[%s] in Site[%s]\n",
p->dest_dsa->dns_name, p->dest_dsa->site_name));
@@ -274,18 +275,20 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
return NT_STATUS_OK;
}
-#else
+#ifdef HAVE_WORKING_PYTHON
#include "param/param.h"
#include <Python.h>
#include "scripting/python/modules.h"
-static NTSTATUS test_become_dc_prepare_db(void *private_data,
- const struct libnet_BecomeDC_PrepareDB *p)
+static NTSTATUS test_become_dc_prepare_db_py(void *private_data,
+ const struct libnet_BecomeDC_PrepareDB *p)
{
struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
bool ok;
PyObject *provision_fn, *result, *parameters;
+ DEBUG(0,("Provision for Become-DC test using PYTHON\n"));
+
py_load_samba_modules();
Py_Initialize();
@@ -378,8 +381,7 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
return NT_STATUS_OK;
}
-
-#endif
+#endif /* HAVE_WORKING_PYTHON */
static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
const struct libnet_BecomeDC_StoreChunk *c)
@@ -876,7 +878,12 @@ bool torture_net_become_dc(struct torture_context *torture)
b.in.callbacks.private_data = s;
b.in.callbacks.check_options = test_become_dc_check_options;
- b.in.callbacks.prepare_db = test_become_dc_prepare_db;
+ b.in.callbacks.prepare_db = test_become_dc_prepare_db_ejs;
+#ifdef HAVE_WORKING_PYTHON
+ if (getenv("PROVISION_PYTHON")) {
+ b.in.callbacks.prepare_db = test_become_dc_prepare_db_py;
+ }
+#endif
b.in.callbacks.schema_chunk = test_become_dc_schema_chunk;
b.in.callbacks.config_chunk = test_become_dc_store_chunk;
b.in.callbacks.domain_chunk = test_become_dc_store_chunk;
diff --git a/source4/torture/rpc/spoolss_notify.c b/source4/torture/rpc/spoolss_notify.c
index 0065101447..96db7d1ec5 100644
--- a/source4/torture/rpc/spoolss_notify.c
+++ b/source4/torture/rpc/spoolss_notify.c
@@ -69,7 +69,8 @@ static NTSTATUS spoolss__op_ndr_pull(struct dcesrv_call_state *dce_call, TALLOC_
return NT_STATUS_OK;
}
-/* FIXME: What context does this belong in ? -- JRV20070903 */
+/* Note that received_packets are allocated in talloc_autofree_context(),
+ * because no other context appears to stay around long enough. */
static struct received_packet {
uint16_t opnum;
void *r;
@@ -82,9 +83,9 @@ static NTSTATUS spoolss__op_dispatch(struct dcesrv_call_state *dce_call, TALLOC_
uint16_t opnum = dce_call->pkt.u.request.opnum;
struct received_packet *rp;
- rp = talloc_zero(mem_ctx, struct received_packet);
+ rp = talloc_zero(talloc_autofree_context(), struct received_packet);
rp->opnum = opnum;
- rp->r = talloc_reference(mem_ctx, r);
+ rp->r = talloc_reference(rp, r);
DLIST_ADD_END(received_packets, rp, struct received_packet *);
@@ -195,6 +196,8 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
const char *address;
struct interface *ifaces;
+ received_packets = NULL;
+
ntvfs_init(tctx->lp_ctx);
ZERO_STRUCT(q);
@@ -239,7 +242,6 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
torture_assert_ntstatus_ok(tctx, status,
"unable to initialize DCE/RPC server");
-
r.in.flags = 0;
r.in.str = talloc_asprintf(tctx, "\\\\%s", address);
r.in.options = 0;
@@ -261,7 +263,6 @@ static bool test_RFFPCNEx(struct torture_context *tctx,
r.in.t1 = &t1;
r.in.handle = &handle;
-
status = dcerpc_spoolss_RemoteFindFirstPrinterChangeNotifyEx(p, tctx, &r);
torture_assert_ntstatus_ok(tctx, status, "FFPCNEx failed");