Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake4
authorJelmer Vernooij <jelmer@samba.org>
Mon, 14 Apr 2008 18:00:32 +0000 (20:00 +0200)
committerJelmer Vernooij <jelmer@samba.org>
Mon, 14 Apr 2008 18:00:32 +0000 (20:00 +0200)
(This used to be commit 1ef3830bb0d6e91e3b00e880784ca0741d9b4d49)

38 files changed:
source4/Makefile
source4/lib/events/events.c
source4/libnet/libnet.c
source4/libnet/libnet_vampire.c
source4/libnet/py_net.c
source4/param/provision.c
source4/scripting/bin/subunitrun
source4/scripting/python/misc.i
source4/scripting/python/misc.py
source4/scripting/python/misc_wrap.c
source4/scripting/python/samba/getopt.py
source4/scripting/python/samba/idmap.py
source4/scripting/python/samba/samdb.py
source4/scripting/python/samba/tests/__init__.py
source4/scripting/python/samba/tests/dcerpc/registry.py
source4/selftest/samba4_tests.sh
source4/setup/newuser
source4/setup/setpassword
source4/setup/tests/blackbox_provision.sh
source4/torture/libnet/libnet_domain.c
source4/torture/libnet/libnet_group.c
source4/torture/libnet/libnet_lookup.c
source4/torture/libnet/libnet_rpc.c
source4/torture/libnet/libnet_share.c
source4/torture/libnet/libnet_user.c
source4/torture/rpc/dfs.c
source4/torture/rpc/testjoin.c
source4/torture/smbtorture.c
source4/torture/ui.c
source4/torture/ui.h
source4/torture/util_smb.c
source4/utils/net/net.c
source4/utils/net/net.h
source4/utils/net/net_join.c
source4/utils/net/net_password.c
source4/utils/net/net_time.c
source4/utils/net/net_user.c
source4/utils/net/net_vampire.c

index 8c74b4899d8e74097544f0d9812492552ff736cd..98c45a34ad8649f281513272a34c5459ade24428 100644 (file)
@@ -24,7 +24,7 @@ $(srcdir)/version.h: $(srcdir)/VERSION
 
 .DEFAULT_GOAL := all
 
-ifneq ($(automatic_deps),yes)
+ifneq ($(automatic_dependencies),yes)
 ALL_PREDEP = proto
 .NOTPARALLEL:
 endif
index 5d43a9116117cb3cee6070d2c7b2c030e50fd675..568aadc31e1f1e6c3c2398cd8216860b950e2c07 100644 (file)
@@ -105,6 +105,7 @@ static void event_backend_init(void)
        NTSTATUS s4_events_standard_init(void);
        NTSTATUS s4_events_select_init(void);
        NTSTATUS s4_events_epoll_init(void);
+       NTSTATUS s4_events_aio_init(void);
        init_module_fn static_init[] = { STATIC_LIBEVENTS_MODULES };
        if (event_backends) return;
        run_init_functions(static_init);
index d1605bc17d45d9cbe82c3d1036c484e13a7986f9..c966898ceea03a7ae5c3ac57a0a5823a07fbb324 100644 (file)
@@ -28,20 +28,17 @@ struct libnet_context *libnet_context_init(struct event_context *ev,
 {
        struct libnet_context *ctx;
 
+       /* We require an event context here */
+       if (!ev) {
+               return NULL;
+       }
+
        /* create brand new libnet context */ 
        ctx = talloc(ev, struct libnet_context);
        if (!ctx) {
                return NULL;
        }
 
-       /* events */
-       if (ev == NULL) {
-               ev = event_context_find(ctx);
-               if (ev == NULL) {
-                       talloc_free(ctx);
-                       return NULL;
-               }
-       }
        ctx->event_ctx = ev;
        ctx->lp_ctx = lp_ctx;
 
index 9d32088fe620600acee9f169ecf620c40f30e64b..1cc63a3fb0cbe8404c92be131d0db2985675252d 100644 (file)
@@ -586,6 +586,8 @@ NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
+       s->lp_ctx = ctx->lp_ctx;
+
        join = talloc_zero(s, struct libnet_JoinDomain);
        if (!join) {
                return NT_STATUS_NO_MEMORY;
index 2fcbc5d156cbe67d7741ef26a2db73ed0ae85c72..cf81d8070dc239622a995b25339d8c1ee5611bd8 100644 (file)
 #include "libnet.h"
 #include "param/param.h"
 #include "libcli/security/security.h"
+#include "lib/events/events.h"
 
-struct libnet_context *py_net_ctx(PyObject *obj)
+struct libnet_context *py_net_ctx(PyObject *obj, struct event_context *ev)
 {
        /* FIXME: Use obj */
-       return libnet_context_init(NULL, global_loadparm);
+       return libnet_context_init(ev, global_loadparm);
 }
 
 static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs)
@@ -35,6 +36,7 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs)
        NTSTATUS status;
        PyObject *result;
        TALLOC_CTX *mem_ctx;
+       struct event_context *ev;
        struct libnet_context *libnet_ctx;
        const char *kwnames[] = { "domain_name", "netbios_name", "join_type", "level", NULL };
 
@@ -43,9 +45,12 @@ static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs)
                                         &r.in.join_type, &r.in.level))
                return NULL;
 
-       mem_ctx = talloc_new(NULL);
+       /* FIXME: we really need to get a context from the caller or we may end
+        * up with 2 event contexts */
+       ev = event_context_init(NULL);
+       mem_ctx = talloc_new(ev);
 
-       libnet_ctx = py_net_ctx(cls);
+       libnet_ctx = py_net_ctx(cls, ev);
 
        status = libnet_Join(libnet_ctx, mem_ctx, &r);
        if (NT_STATUS_IS_ERR(status)) {
index 70ef618b6eb6dfa89514442afa42b8677811f028..0e54acf9e429b5a4b403eab6c91a817ef7652244 100644 (file)
@@ -76,6 +76,9 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
                 settings->targetdir));
        parameters = PyDict_New();
 
+       PyDict_SetItemString(parameters, "smbconf", 
+                            PyString_FromString(lp_configfile(lp_ctx)));
+
        PyDict_SetItemString(parameters, "rootdn", 
                                                 PyString_FromString(settings->root_dn_str));
        if (settings->targetdir != NULL)
@@ -129,7 +132,6 @@ 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 */
-       /* FIXME samdb */
        result->lp_ctx = lp_from_py_object(PyObject_GetAttrString(py_result, "lp"));
        result->samdb = ldb_context_from_py_object(PyObject_GetAttrString(py_result, "samdb"));
 
index 11ac426589c718c8b6dbbe7ce8f60a47d26440dd..fbbffde42cd5840473c0307a6bbe3d4c6a9f5155 100755 (executable)
 from subunit import SubunitTestRunner
 import sys
 from unittest import TestProgram
+import optparse
+import os
+import param
+import samba.getopt as options
+import samba.tests
+
+parser = optparse.OptionParser("subunitrun [options] <tests>")
+credopts = options.CredentialsOptions(parser)
+parser.add_option_group(credopts)
+sambaopts = options.SambaOptions(parser)
+parser.add_option_group(sambaopts)
+parser.add_option_group(options.VersionOptions(parser))
+
+args = parser.parse_args()[1]
+
+samba.tests.cmdline_loadparm = sambaopts.get_loadparm()
+samba.tests.cmdline_credentials = credopts.get_credentials(samba.tests.cmdline_loadparm)
+
+param.cvar.default_config = samba.tests.cmdline_loadparm
 
 runner = SubunitTestRunner()
-TestProgram(module=None, argv=sys.argv, testRunner=runner)
+program = TestProgram(module=None, argv=[sys.argv[0]] + args, testRunner=runner)
index e04e6a6906d5681bd90dec4e721ea76bd614fd7b..6fa3bc93e34066f42a5972a673e045f18dad622b 100644 (file)
@@ -78,3 +78,8 @@ bool dsdb_set_ntds_invocation_id(struct ldb_context *ldb, const char *guid)
     return samdb_set_ntds_invocation_id(ldb, &invocation_id_in);
 }
 %}
+
+char *private_path(TALLOC_CTX* mem_ctx, 
+                  struct loadparm_context *lp_ctx,
+                  const char *name);
+
index 2fc7fe37e74d33ae243778250a4d1d55fefc73cf..f1da4c687a1a0529245b3b951ebcce6275542030 100644 (file)
@@ -71,5 +71,6 @@ version = _misc.version
 dsdb_set_global_schema = _misc.dsdb_set_global_schema
 ldb_register_samba_handlers = _misc.ldb_register_samba_handlers
 dsdb_set_ntds_invocation_id = _misc.dsdb_set_ntds_invocation_id
+private_path = _misc.private_path
 
 
index 579d1f379f183fba67f283c6e6a646b7adfcced0..4944515d15e1f202f615fbe3eb45426e405e667b 100644 (file)
@@ -3153,6 +3153,50 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_private_path(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
+  struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
+  char *arg3 = (char *) 0 ;
+  char *result = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  int res3 ;
+  char *buf3 = 0 ;
+  int alloc3 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "lp_ctx",(char *) "name", NULL 
+  };
+  
+  arg2 = loadparm_init(NULL);
+  arg1 = NULL;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:private_path",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (obj0) {
+    res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "private_path" "', argument " "2"" of type '" "struct loadparm_context *""'"); 
+    }
+    arg2 = (struct loadparm_context *)(argp2);
+  }
+  if (obj1) {
+    res3 = SWIG_AsCharPtrAndSize(obj1, &buf3, NULL, &alloc3);
+    if (!SWIG_IsOK(res3)) {
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "private_path" "', argument " "3"" of type '" "char const *""'");
+    }
+    arg3 = (char *)(buf3);
+  }
+  result = (char *)private_path(arg1,arg2,(char const *)arg3);
+  resultobj = SWIG_FromCharPtr((const char *)result);
+  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+  return resultobj;
+fail:
+  if (alloc3 == SWIG_NEWOBJ) free((char*)buf3);
+  return NULL;
+}
+
+
 static PyMethodDef SwigMethods[] = {
         { (char *)"random_password", (PyCFunction) _wrap_random_password, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"ldb_set_credentials", (PyCFunction) _wrap_ldb_set_credentials, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -3164,6 +3208,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"dsdb_set_global_schema", (PyCFunction) _wrap_dsdb_set_global_schema, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"ldb_register_samba_handlers", (PyCFunction) _wrap_ldb_register_samba_handlers, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"dsdb_set_ntds_invocation_id", (PyCFunction) _wrap_dsdb_set_ntds_invocation_id, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"private_path", (PyCFunction) _wrap_private_path, METH_VARARGS | METH_KEYWORDS, NULL},
         { NULL, NULL, 0, NULL }
 };
 
index 82cb004b621eebd263a17f944a075d92b866d113..7ec684a9d6cb0c3f5ad7ccc4a4517850410b5de4 100644 (file)
@@ -35,12 +35,14 @@ class SambaOptions(optparse.OptionGroup):
         self._configfile = arg
 
     def get_loadparm(self):
-        import param
+        import os, param
         lp = param.LoadParm()
-        if self._configfile is None:
-            lp.load_default()
-        else:
+        if self._configfile is not None:
             lp.load(self._configfile)
+        elif os.getenv("SMB_CONF_PATH") is not None:
+            lp.load(os.getenv("SMB_CONF_PATH"))
+        else:
+            lp.load_default()
         return lp
 
 class VersionOptions(optparse.OptionGroup):
index 355565968a3247675bd49dcc80d08faeec57be77..16efcd04709db45de02446b5ee8ca571611ce4bd 100644 (file)
@@ -21,6 +21,7 @@
 """Convenience functions for using the idmap database."""
 
 import samba
+import misc
 import ldb
 
 class IDmapDB(samba.Ldb):
@@ -37,11 +38,17 @@ class IDmapDB(samba.Ldb):
 
         :param url: URL of the database.
         """
+        self.lp = lp
+
         super(IDmapDB, self).__init__(session_info=session_info, credentials=credentials,
                                     modules_dir=modules_dir, lp=lp)
         if url:
             self.connect(url)
+        else:
+            self.connect(lp.get("idmap database"))
 
+    def connect(self, url):
+        super(IDmapDB, self).connect(misc.private_path(self.lp, url))
 
     def setup_name_mapping(self, sid, type, unixid):
         """Setup a mapping between a sam name and a unix name.
index bc3eef7879c50c04566709ef7fd7186d18cdf729..198d1e9f5cb8c12a0858344754241e6088b45593 100644 (file)
 import samba
 import misc
 import ldb
+from samba.idmap import IDmapDB
+import pwd
 
 class SamDB(samba.Ldb):
     """The SAM database."""
+
     def __init__(self, url=None, session_info=None, credentials=None, 
                  modules_dir=None, lp=None):
         """Open the Sam Database.
 
         :param url: URL of the database.
         """
+        self.lp = lp
         super(SamDB, self).__init__(session_info=session_info, credentials=credentials,
                                     modules_dir=modules_dir, lp=lp)
         assert misc.dsdb_set_global_schema(self) == 0
         if url:
             self.connect(url)
+        else:
+            self.connect(lp.get("sam database"))
+
+    def connect(self, url):
+        super(SamDB, self).connect(misc.private_path(self.lp, url))
 
     def add_foreign(self, domaindn, sid, desc):
         """Add a foreign security principle."""
@@ -101,10 +110,27 @@ userAccountControl: %u
         #  now the real work
         self.add({"dn": user_dn, 
             "sAMAccountName": username,
-            "unixName": unixname,
             "sambaPassword": password,
             "objectClass": "user"})
 
+        res = self.search(user_dn, scope=ldb.SCOPE_BASE,
+                          expression="objectclass=*",
+                          attrs=["objectSid"])
+        assert(len(res) == 1)
+        user_sid = self.schema_format_value("objectSid", res[0]["objectSid"][0])
+        
+        
+        try:
+            idmap = IDmapDB(lp=self.lp)
+
+            user = pwd.getpwnam(unixname)
+            # setup ID mapping for this UID
+            
+            idmap.setup_name_mapping(user_sid, idmap.TYPE_UID, user[2])
+
+        except KeyError:
+            pass
+
         #  modify the userAccountControl to remove the disabled bit
         self.enable_account(user_dn)
         self.transaction_commit()
index c8673d3fae2f7dd555e2005fd64f98d7ef20184c..e29b4a87d5295b018dba7edbdd7b1b553da6c9a2 100644 (file)
@@ -85,8 +85,13 @@ class LdbExtensionTests(TestCaseInTempDir):
             os.unlink(path)
 
 
-def get_loadparm():
-    import param
-    lp = param.LoadParm()
-    lp.load(os.getenv("SMB_CONF_PATH"))
-    return lp
+cmdline_loadparm = None
+cmdline_credentials = None
+
+class RpcInterfaceTestCase(unittest.TestCase):
+    def get_loadparm(self):
+        assert cmdline_loadparm is not None
+        return cmdline_loadparm
+
+    def get_credentials(self):
+        return cmdline_credentials
index 147acc5098402280a6afe5a5b27ea0986f087d2e..05ac7c66ee65677f07560ccb2a3dbb36ecdc4b17 100644 (file)
 #
 
 import winreg
-from param import LoadParm
 import unittest
-from samba.tests import get_loadparm
+from samba.tests import RpcInterfaceTestCase
 
-class WinregTests(unittest.TestCase):
+class WinregTests(RpcInterfaceTestCase):
     def setUp(self):
-        lp_ctx = get_loadparm()
-        self.conn = winreg.winreg("ncalrpc:", lp_ctx)
+        lp = self.get_loadparm()
+        self.conn = winreg.winreg("ncalrpc:", lp, self.get_credentials())
 
     def get_hklm(self):
         return self.conn.OpenHKLM(None, 
index 7e545664d1ff105c4881506284bef03f970c0a91..d52c240b9328aaecae638e1c3a6cbfa4c9d81090 100755 (executable)
@@ -342,7 +342,7 @@ plantest "unixinfo.python" dc $SUBUNITRUN samba.tests.dcerpc.unix
 plantest "events.python" none PYTHONPATH="$PYTHONPATH:lib/events" $SUBUNITRUN tests
 plantest "samba3sam.python" none PYTHONPATH="$PYTHONPATH:dsdb/samdb/ldb_modules/tests" $SUBUNITRUN samba3sam
 plantest "rpcecho.python" dc $SUBUNITRUN samba.tests.dcerpc.rpcecho
-plantest "winreg.python" dc $SUBUNITRUN samba.tests.dcerpc.registry
+plantest "winreg.python" dc $SUBUNITRUN -U\$USERNAME%\$PASSWORD samba.tests.dcerpc.registry
 plantest "ldap.python" dc $PYTHON $samba4srcdir/lib/ldb/tests/python/ldap.py $CONFIGURATION \$SERVER -U\$USERNAME%\$PASSWORD -W \$DOMAIN
 plantest "blackbox.samba3dump" none $PYTHON scripting/bin/samba3dump $samba4srcdir/../testdata/samba3
 rm -rf $PREFIX/upgrade
index f622058a5d0858ecae21c7ce293f10663242fef3..04a5440ee1a205650f7cb3d6f1fd0f0391a25c30 100755 (executable)
@@ -45,15 +45,9 @@ else:
 if opts.unixname is None:
        opts.unixname = username
 
-try:
-       pwd.getpwnam(opts.unixname)
-except KeyError:
-       print "ERROR: Unix user '%s' does not exist" % opts.unixname
-       sys.exit(1)
-
-creds = credopts.get_credentials()
-
 lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
 samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), 
               credentials=creds, lp=lp)
 samdb.newuser(username, opts.unixname, password)
index 31b2f73a256b6078cf3c2efb5de7476f43c1d7c8..977a6a5ee89011c0f540378d3193812ddcbe0188 100644 (file)
@@ -36,7 +36,7 @@ if len(args) == 0:
        parser.print_usage()
        sys.exit(1)
 
-password = opts.password;
+password = opts.newpassword;
 if password is None:
        password = getpass("New Password: ")
 
@@ -47,12 +47,12 @@ if filter is None:
        if username is None:
                print "Either username or --filter must be specified"
 
-       filter = "(&(objectclass=user)(samAccountName=" + username + "))"
+       filter = "(&(objectclass=user)(samAccountName=%s))" % (username)
 
 
-creds = credopts.get_credentials()
-
 lp = sambaopts.get_loadparm()
+creds = credopts.get_credentials(lp)
+
 samdb = SamDB(url=lp.get("sam database"), session_info=system_session(), 
               credentials=creds, lp=lp)
 samdb.setpassword(filter, password)
index 4db226778c4e84c66ac772ef6f5c926189bb75ef..19f37cef2df062a026914b199604bc08dd36de45 100755 (executable)
@@ -31,8 +31,11 @@ testit "simple-default" $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --
 testit "simple-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc
 testit "simple-member" $PYTHON ./setup/provision $CONFIGURATION --server-role="member" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-member
 testit "simple-standalone" $PYTHON ./setup/provision $CONFIGURATION --server-role="standalone" --domain=FOO --realm=foo.example.com --targetdir=$PREFIX/simple-standalone
-testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --blank
-testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/simple-dc --partitions-only
+testit "blank-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/blank-dc --blank
+testit "partitions-only-dc" $PYTHON ./setup/provision $CONFIGURATION --server-role="dc" --domain=FOO --realm=foo.example.com --domain-sid=S-1-5-21-4177067393-1453636373-93818738 --targetdir=$PREFIX/partitions-only-dc --partitions-only
+
+testit "newuser" $PYTHON ./setup/newuser --configfile=$PREFIX/simple-dc/etc/smb.conf testuser testpass
+testit "setpassword" $PYTHON ./setup/setpassword --configfile=$PREFIX/simple-dc/etc/smb.conf testuser --newpassword=testpass
 
 reprovision() {
        $PYTHON ./setup/provision $CONFIGURATION --domain=FOO --realm=foo.example.com --targetdir="$PREFIX/reprovision"
index 3c8d574f0ec61fe4926fb0cf9e0b9264c9c3985c..eb6abc45d5967fab0ac6db815a85ddb418798af1 100644 (file)
@@ -136,7 +136,7 @@ bool torture_domain_open_lsa(struct torture_context *torture)
           of specific server name. */
        domain_name = lp_workgroup(torture->lp_ctx);
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        if (ctx == NULL) {
                d_printf("failed to create libnet context\n");
                return false;
@@ -190,7 +190,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
                return false;
        }
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        if (ctx == NULL) {
                d_printf("failed to create libnet context\n");
                ret = false;
@@ -245,7 +245,6 @@ bool torture_domain_open_samr(struct torture_context *torture)
 {
        NTSTATUS status;
        struct libnet_context *ctx;
-       struct event_context *evt_ctx=NULL;
        TALLOC_CTX *mem_ctx;
        struct policy_handle domain_handle, handle;
        struct libnet_DomainOpen io;
@@ -255,7 +254,7 @@ bool torture_domain_open_samr(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_domainopen_lsa");
 
-       ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        /* we're accessing domain controller so the domain name should be
@@ -320,7 +319,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
                return false;
        }
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        if (ctx == NULL) {
                d_printf("failed to create libnet context\n");
                ret = false;
@@ -388,7 +387,7 @@ bool torture_domain_list(struct torture_context *torture)
                return false;
        }
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        if (ctx == NULL) {
                d_printf("failed to create libnet context\n");
                ret = false;
index cabccdbe66f38b4a6cdf02799f2f5476dd3d58fa..12b8167a865a222559334709f743c415cb272e3e 100644 (file)
@@ -235,7 +235,7 @@ bool torture_groupinfo_api(struct torture_context *torture)
 
        prep_mem_ctx = talloc_init("prepare torture group info");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        status = torture_rpc_connection(torture,
@@ -300,7 +300,7 @@ bool torture_grouplist(struct torture_context *torture)
        struct libnet_GroupList req;
        int i;
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        domain_name.string = lp_workgroup(torture->lp_ctx);
@@ -361,7 +361,7 @@ bool torture_creategroup(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_creategroup");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        req.in.group_name = TEST_GROUPNAME;
index 9167d1de3ec0005f97ebf2cf7c0cafd757091778..b25b51b7d96b18a8638ee88d5bb85517afd2a3b0 100644 (file)
@@ -40,7 +40,7 @@ bool torture_lookup(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_lookup");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        lookup.in.hostname = torture_setting_string(torture, "host", NULL);
@@ -84,7 +84,7 @@ bool torture_lookup_host(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_lookup_host");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        lookup.in.hostname = torture_setting_string(torture, "host", NULL);
@@ -127,7 +127,7 @@ bool torture_lookup_pdc(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_lookup_pdc");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        talloc_steal(ctx, mem_ctx);
@@ -171,7 +171,7 @@ bool torture_lookup_sam_name(struct torture_context *torture)
        struct libnet_context *ctx;
        struct libnet_LookupName r;
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        mem_ctx = talloc_init("torture lookup sam name");
index 282837d3fe9f0779fe4564b0d26d8b61515bc914..f25c1ecc482ebaa5707a0c9d551a91df9edd5488 100644 (file)
@@ -89,7 +89,7 @@ static bool torture_rpc_connect(struct torture_context *torture,
 {
        struct libnet_context *ctx;
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
        
        d_printf("Testing connection to LSA interface\n");
index eb1edff18d48cf89f522907a4916599add6ca744..6bc5be40a668c403da4aebd0f896f4f315a5d573 100644 (file)
@@ -131,7 +131,7 @@ bool torture_listshares(struct torture_context *torture)
                goto done;
        }
 
-       libnetctx = libnet_context_init(NULL, torture->lp_ctx);
+       libnetctx = libnet_context_init(torture->ev, torture->lp_ctx);
        if (!libnetctx) {
                printf("Couldn't allocate libnet context\n");
                ret = false;
@@ -210,7 +210,7 @@ bool torture_delshare(struct torture_context *torture)
        status = torture_rpc_binding(torture, &binding);
        torture_assert_ntstatus_ok(torture, status, "Failed to get binding");
 
-       libnetctx = libnet_context_init(NULL, torture->lp_ctx);
+       libnetctx = libnet_context_init(torture->ev, torture->lp_ctx);
        libnetctx->cred = cmdline_credentials;
 
        status = torture_rpc_connection(torture,
index 5446087034bd66a98a792dab8ae4241309a8c608..15e3f035065d11eeffbb323ff64cf1125925bf8e 100644 (file)
@@ -241,7 +241,7 @@ bool torture_createuser(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_createuser");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        req.in.user_name = TEST_USERNAME;
@@ -287,7 +287,7 @@ bool torture_deleteuser(struct torture_context *torture)
 
        prep_mem_ctx = talloc_init("prepare test_deleteuser");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        req.in.user_name = TEST_USERNAME;
@@ -482,7 +482,7 @@ bool torture_modifyuser(struct torture_context *torture)
 
        prep_mem_ctx = talloc_init("prepare test_deleteuser");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        status = torture_rpc_connection(torture,
@@ -616,7 +616,7 @@ bool torture_userinfo_api(struct torture_context *torture)
 
        prep_mem_ctx = talloc_init("prepare torture user info");
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        status = torture_rpc_connection(torture,
@@ -681,7 +681,7 @@ bool torture_userlist(struct torture_context *torture)
        struct libnet_UserList req;
        int i;
 
-       ctx = libnet_context_init(NULL, torture->lp_ctx);
+       ctx = libnet_context_init(torture->ev, torture->lp_ctx);
        ctx->cred = cmdline_credentials;
 
        domain_name.string = lp_workgroup(torture->lp_ctx);
index 9cfdd805785053ffd40dec2986ec2c7fe2a0fc60..56564769229e210053192cdd4370125731e9168c 100644 (file)
@@ -56,7 +56,7 @@ static bool test_NetShareAdd(TALLOC_CTX *mem_ctx,
 
        printf("Creating share %s\n", sharename);
 
-       if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) {
+       if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) {
                return false;
        }
 
@@ -96,7 +96,7 @@ static bool test_NetShareDel(TALLOC_CTX *mem_ctx,
 
        printf("Deleting share %s\n", sharename);
 
-       if (!(libnetctx = libnet_context_init(NULL, tctx->lp_ctx))) {
+       if (!(libnetctx = libnet_context_init(tctx->ev, tctx->lp_ctx))) {
                return false;
        }
 
index 892886c08c53ceceda7501ac594267bf5cf1394d..100e7cead27ef9981faafccd9b81aa2bd7cb0295 100644 (file)
@@ -311,7 +311,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
        struct samr_SetUserInfo s;
        union samr_UserInfo u;
        
-       tj = talloc(NULL, struct test_join);
+       tj = talloc(tctx, struct test_join);
        if (!tj) return NULL;
 
        libnet_r = talloc(tj, struct libnet_JoinDomain);
@@ -320,7 +320,7 @@ _PUBLIC_ struct test_join *torture_join_domain(struct torture_context *tctx,
                return NULL;
        }
        
-       libnet_ctx = libnet_context_init(NULL, tctx->lp_ctx);   
+       libnet_ctx = libnet_context_init(tctx->ev, tctx->lp_ctx);       
        if (!libnet_ctx) {
                talloc_free(tj);
                return NULL;
index 4eeea73003c329d4cd05c39d7b587c2703de8e53..faae784e4b09db4418f01e16b080670e168f66df 100644 (file)
@@ -36,6 +36,8 @@
 #include "librpc/rpc/dcerpc.h"
 #include "param/param.h"
 
+#include "auth/credentials/credentials.h"
+
 static bool run_matching(struct torture_context *torture,
                                                 const char *prefix, 
                                                 const char *expr,
@@ -673,7 +675,7 @@ int main(int argc,char *argv[])
                exit(1);
        }
 
-       torture = torture_context_init(talloc_autofree_context(), ui_ops);
+       torture = torture_context_init(cli_credentials_get_event_context(cmdline_credentials), ui_ops);
        if (basedir != NULL) {
                if (basedir[0] != '/') {
                        fprintf(stderr, "Please specify an absolute path to --basedir\n");
index a7025aac95281f4829a95ddb56fdd2dca9294cec..efa584ebeaae2735fdc5d9f672c8fe35528d6521 100644 (file)
 #include "auth/credentials/credentials.h"
 #include "lib/cmdline/popt_common.h"
 
-struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, 
+struct torture_context *torture_context_init(struct event_context *event_ctx, 
                                             const struct torture_ui_ops *ui_ops)
 {
-       struct torture_context *torture = talloc_zero(mem_ctx, 
+       struct torture_context *torture = talloc_zero(event_ctx, 
                                                      struct torture_context);
        torture->ui_ops = ui_ops;
        torture->returncode = true;
-       torture->ev = cli_credentials_get_event_context(cmdline_credentials);
+       torture->ev = event_ctx;
 
        if (ui_ops->init)
                ui_ops->init(torture);
index ec4a658d741fffd7d468433e586e43cf9059a451..15b04c23974c25edc7a5f4f729fc5ee800233498 100644 (file)
@@ -390,7 +390,7 @@ bool torture_suite_init_tcase(struct torture_suite *suite,
                              struct torture_tcase *tcase, 
                              const char *name);
 
-struct torture_context *torture_context_init(TALLOC_CTX *mem_ctx, 
+struct torture_context *torture_context_init(struct event_context *event_ctx, 
                                             const struct torture_ui_ops *ui_ops);
 
 #endif /* __TORTURE_UI_H__ */
index 513070500ed78de38960259e746065e9807bb8ca..c1a20094f385e520828823fd1c414df8f9d7c330 100644 (file)
@@ -553,8 +553,7 @@ _PUBLIC_ bool torture_open_connection_ev(struct smbcli_state **c,
 
 _PUBLIC_ bool torture_open_connection(struct smbcli_state **c, struct torture_context *tctx, int conn_index)
 {
-       return torture_open_connection_ev(c, conn_index, tctx,
-                                         cli_credentials_get_event_context(cmdline_credentials));
+       return torture_open_connection_ev(c, conn_index, tctx, tctx->ev);
 }
 
 
index c908ea6279550b6973734126a20183b2a867f03d..6086a4ce32d98836d31aae821453dc7a378aab57 100644 (file)
@@ -46,6 +46,8 @@
 #include "lib/ldb/include/ldb.h"
 #include "librpc/rpc/dcerpc.h"
 #include "param/param.h"
+#include "lib/events/events.h"
+#include "auth/credentials/credentials.h"
 
 /*
   run a function from a function table. If not found then
@@ -140,7 +142,7 @@ static int binary_net(int argc, const char **argv)
        int rc;
        int argc_new;
        const char **argv_new;
-       TALLOC_CTX *mem_ctx;
+       struct event_context *ev;
        struct net_context *ctx = NULL;
        poptContext pc;
        struct poptOption long_options[] = {
@@ -183,17 +185,21 @@ static int binary_net(int argc, const char **argv)
 
        dcerpc_init();
 
-       mem_ctx = talloc_init("net_context");
-       ctx = talloc(mem_ctx, struct net_context);
+       ev = event_context_init(NULL);
+       if (!ev) {
+               d_printf("Failed to create an event context\n");
+               exit(1);
+       }
+       ctx = talloc(ev, struct net_context);
        if (!ctx) {
-               d_printf("talloc_init(net_context) failed\n");
+               d_printf("Failed to talloc a net_context\n");
                exit(1);
        }
 
        ZERO_STRUCTP(ctx);
-       ctx->mem_ctx = mem_ctx;
        ctx->lp_ctx = cmdline_lp_ctx;
        ctx->credentials = cmdline_credentials;
+       cli_credentials_set_event_context(ctx->credentials, ev);
 
        rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);
 
@@ -201,7 +207,7 @@ static int binary_net(int argc, const char **argv)
                DEBUG(0,("return code = %d\n", rc));
        }
 
-       talloc_free(mem_ctx);
+       talloc_free(ev);
        return rc;
 }
 
index 8c4fbd7fddbc766149c7a6b204a7fdb59ad955a0..17388079dd999489f281cda23265a15b2c175f7a 100644 (file)
@@ -22,7 +22,6 @@
 #define _UTIL_NET_H
 
 struct net_context {
-       TALLOC_CTX *mem_ctx;
        struct cli_credentials *credentials;
        struct loadparm_context *lp_ctx;
 };
index abdcbf6027495464d172b73bba7db8cad53621de..2102257c6c8e92cf640b1274e3205926abaef89f 100644 (file)
@@ -24,6 +24,7 @@
 #include "libnet/libnet.h"
 #include "libcli/security/security.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 int net_join(struct net_context *ctx, int argc, const char **argv) 
 {
@@ -38,10 +39,10 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
                case 0: /* no args -> fail */
                        return net_join_usage(ctx, argc, argv);
                case 1: /* only DOMAIN */
-                       tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+                       tmp = talloc_strdup(ctx, argv[0]);
                        break;
                case 2: /* DOMAIN and role */
-                       tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+                       tmp = talloc_strdup(ctx, argv[0]);
                        if (strcasecmp(argv[1], "BDC") == 0) {
                                secure_channel_type = SEC_CHAN_BDC;
                        } else if (strcasecmp(argv[1], "MEMBER") == 0) {
@@ -57,12 +58,12 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
 
        domain_name = tmp;
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
        libnetctx->cred = ctx->credentials;
-       r = talloc(ctx->mem_ctx, struct libnet_Join);
+       r = talloc(ctx, struct libnet_Join);
        if (!r) {
                return -1;
        }
@@ -83,7 +84,7 @@ int net_join(struct net_context *ctx, int argc, const char **argv)
                talloc_free(libnetctx);
                return -1;
        }
-       d_printf("Joined domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx->mem_ctx, r->out.domain_sid));
+       d_printf("Joined domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx, r->out.domain_sid));
 
        talloc_free(libnetctx);
        return 0;
index 1fcb772e4c2b016c2037807906f4358ba741fdee..97bb467facde7c434fcbc0143778f12b47bd6c90 100644 (file)
@@ -22,6 +22,7 @@
 #include "utils/net/net.h"
 #include "libnet/libnet.h"
 #include "system/filesys.h"
+#include "lib/events/events.h"
 #include "auth/credentials/credentials.h"
 
 /*
@@ -46,13 +47,13 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
        if (argc > 0 && argv[0]) {
                new_password = argv[0];
        } else {
-               password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:", 
+               password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:", 
                                                        cli_credentials_get_domain(ctx->credentials), 
                                                        cli_credentials_get_username(ctx->credentials));
                new_password = getpass(password_prompt);
        }
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -66,7 +67,7 @@ static int net_password_change(struct net_context *ctx, int argc, const char **a
        r.generic.in.newpassword        = new_password;
 
        /* do password change */
-       status = libnet_ChangePassword(libnetctx, ctx->mem_ctx, &r);
+       status = libnet_ChangePassword(libnetctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("net_password_change: %s\n",r.generic.out.error_string));
                return -1;
@@ -101,10 +102,10 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
                case 0: /* no args -> fail */
                        return net_password_set_usage(ctx, argc, argv);
                case 1: /* only DOM\\user; prompt for password */
-                       tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+                       tmp = talloc_strdup(ctx, argv[0]);
                        break;
                case 2: /* DOM\\USER and password */
-                       tmp = talloc_strdup(ctx->mem_ctx, argv[0]);
+                       tmp = talloc_strdup(ctx, argv[0]);
                        new_password = argv[1];
                        break;
                default: /* too mayn args -> fail */
@@ -115,19 +116,19 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
        if ((p = strchr_m(tmp,'\\'))) {
                *p = 0;
                domain_name = tmp;
-               account_name = talloc_strdup(ctx->mem_ctx, p+1);
+               account_name = talloc_strdup(ctx, p+1);
        } else {
                account_name = tmp;
                domain_name = cli_credentials_get_domain(ctx->credentials);
        }
 
        if (!new_password) {
-               password_prompt = talloc_asprintf(ctx->mem_ctx, "Enter new password for account [%s\\%s]:", 
+               password_prompt = talloc_asprintf(ctx, "Enter new password for account [%s\\%s]:", 
                                                        domain_name, account_name);
                new_password = getpass(password_prompt);
        }
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -140,7 +141,7 @@ static int net_password_set(struct net_context *ctx, int argc, const char **argv
        r.generic.in.newpassword        = new_password;
 
        /* do password change */
-       status = libnet_SetPassword(libnetctx, ctx->mem_ctx, &r);
+       status = libnet_SetPassword(libnetctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("net_password_set: %s\n",r.generic.out.error_string));
                return -1;
index 1f4bb3ed71ce4435dbd0679cd716a96d8bd55819..12a8132ceaae294384850fbee1c90716832b0f72 100644 (file)
@@ -22,6 +22,7 @@
 #include "libnet/libnet.h"
 #include "utils/net/net.h"
 #include "system/time.h"
+#include "lib/events/events.h"
 
 /*
  * Code for getting the remote time
@@ -42,7 +43,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
                return net_time_usage(ctx, argc, argv);
        }
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -53,7 +54,7 @@ int net_time(struct net_context *ctx, int argc, const char **argv)
        r.generic.in.server_name        = server_name;
 
        /* get the time */
-       status = libnet_RemoteTOD(libnetctx, ctx->mem_ctx, &r);
+       status = libnet_RemoteTOD(libnetctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("net_time: %s\n",r.generic.out.error_string));
                return -1;
index 39d50e7d8bfdace8348091ca12b2a7fae5574b6f..57cef6b383a9620d3ce282ae5371723b1a775573 100644 (file)
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "utils/net/net.h"
 #include "libnet/libnet.h"
+#include "lib/events/events.h"
 #include "auth/credentials/credentials.h"
 
 static int net_user_add(struct net_context *ctx, int argc, const char **argv)
@@ -36,14 +37,14 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
                return net_user_usage(ctx, argc, argv);
                break;
        case 1:
-               user_name = talloc_strdup(ctx->mem_ctx, argv[0]);
+               user_name = talloc_strdup(ctx, argv[0]);
                break;
        default:
                return net_user_usage(ctx, argc, argv);
        }
 
        /* libnet context init and its params */
-       lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx);
+       lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!lnet_ctx) return -1;
 
        lnet_ctx->cred = ctx->credentials;
@@ -52,7 +53,7 @@ static int net_user_add(struct net_context *ctx, int argc, const char **argv)
        r.in.user_name       = user_name;
        r.in.domain_name     = cli_credentials_get_domain(lnet_ctx->cred);
 
-       status = libnet_CreateUser(lnet_ctx, ctx->mem_ctx, &r);
+       status = libnet_CreateUser(lnet_ctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Failed to add user account: %s\n",
                          r.out.error_string));
@@ -76,14 +77,14 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv)
                return net_user_usage(ctx, argc, argv);
                break;
        case 1:
-               user_name = talloc_strdup(ctx->mem_ctx, argv[0]);
+               user_name = talloc_strdup(ctx, argv[0]);
                break;
        default:
                return net_user_usage(ctx, argc, argv);
        }
 
        /* libnet context init and its params */
-       lnet_ctx = libnet_context_init(NULL, ctx->lp_ctx);
+       lnet_ctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!lnet_ctx) return -1;
 
        lnet_ctx->cred = ctx->credentials;
@@ -92,7 +93,7 @@ static int net_user_delete(struct net_context *ctx, int argc, const char **argv)
        r.in.user_name       = user_name;
        r.in.domain_name     = cli_credentials_get_domain(lnet_ctx->cred);
 
-       status = libnet_DeleteUser(lnet_ctx, ctx->mem_ctx, &r);
+       status = libnet_DeleteUser(lnet_ctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Failed to delete user account: %s\n",
                          r.out.error_string));
index 4f6371d617dd553d9ef38847b9c7a681ebd0f0a9..38f05353ed639a306ae50e943eda0af0b56ec197 100644 (file)
@@ -25,6 +25,7 @@
 #include "librpc/gen_ndr/samr.h"
 #include "auth/auth.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 static int net_samdump_keytab_usage(struct net_context *ctx, int argc, const char **argv)
 {
@@ -53,7 +54,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar
                break;
        }
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -63,7 +64,7 @@ static int net_samdump_keytab(struct net_context *ctx, int argc, const char **ar
        r.in.machine_account = NULL;
        r.in.binding_string = NULL;
 
-       status = libnet_SamDump_keytab(libnetctx, ctx->mem_ctx, &r);
+       status = libnet_SamDump_keytab(libnetctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("libnet_SamDump returned %s: %s\n",
                         nt_errstr(status),
@@ -99,7 +100,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
                return rc;
        }
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -109,7 +110,7 @@ int net_samdump(struct net_context *ctx, int argc, const char **argv)
        r.in.machine_account = NULL;
        r.in.binding_string = NULL;
 
-       status = libnet_SamDump(libnetctx, ctx->mem_ctx, &r);
+       status = libnet_SamDump(libnetctx, ctx, &r);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("libnet_SamDump returned %s: %s\n",
                         nt_errstr(status),
@@ -141,7 +142,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv)
        struct libnet_context *libnetctx;
        struct libnet_samsync_ldb r;
 
-       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       libnetctx = libnet_context_init(event_context_find(ctx), ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }