Merge branch 'v4-0-test' of ssh://git.samba.org/data/git/samba into v4-0-gmake3
authorJelmer Vernooij <jelmer@samba.org>
Fri, 25 Apr 2008 09:04:20 +0000 (10:04 +0100)
committerJelmer Vernooij <jelmer@samba.org>
Fri, 25 Apr 2008 09:04:20 +0000 (10:04 +0100)
Conflicts:

source/Makefile
source/auth/config.mk
source/auth/gensec/config.mk
source/build/m4/public.m4
source/build/make/python.mk
source/build/make/rules.mk
source/build/smb_build/header.pm
source/build/smb_build/main.pl
source/build/smb_build/makefile.pm
source/dsdb/config.mk
source/dsdb/samdb/ldb_modules/config.mk
source/kdc/config.mk
source/lib/events/config.mk
source/lib/events/events.c
source/lib/ldb/config.mk
source/lib/nss_wrapper/config.mk
source/lib/policy/config.mk
source/lib/util/config.mk
source/libcli/smb2/config.mk
source/libnet/config.mk
source/librpc/config.mk
source/nbt_server/config.mk
source/ntptr/ntptr_base.c
source/ntvfs/posix/config.mk
source/ntvfs/sysdep/config.mk
source/param/config.mk
source/rpc_server/config.mk
source/rpc_server/service_rpc.c
source/scripting/ejs/config.mk
source/scripting/python/config.mk
source/smb_server/config.mk
source/smbd/server.c
source/torture/config.mk
source/torture/smb2/config.mk
source/wrepl_server/config.mk
(This used to be commit 13bbd420681519894a4036729c43273912c9b402)

361 files changed:
source4/Makefile
source4/auth/auth_sam.c
source4/auth/auth_simple.c
source4/auth/config.mk
source4/auth/credentials/credentials.c
source4/auth/credentials/credentials.h
source4/auth/credentials/credentials.i
source4/auth/credentials/credentials.py
source4/auth/credentials/credentials_files.c
source4/auth/credentials/credentials_krb5.c
source4/auth/credentials/credentials_krb5.h
source4/auth/credentials/credentials_wrap.c
source4/auth/gensec/gensec.c
source4/auth/gensec/gensec_gssapi.c
source4/auth/gensec/gensec_krb5.c
source4/auth/gensec/schannel.c
source4/auth/gensec/schannel_state.c
source4/auth/ntlmssp/ntlmssp_server.c
source4/auth/sam.c
source4/auth/session.c
source4/auth/session.h
source4/build/m4/public.m4
source4/build/make/python.mk
source4/build/make/rules.mk
source4/build/smb_build/input.pm
source4/build/smb_build/main.pl
source4/build/smb_build/makefile.pm
source4/cldap_server/cldap_server.c
source4/cldap_server/netlogon.c
source4/client/cifsdd.c
source4/client/cifsdd.h
source4/client/cifsddio.c
source4/client/client.c
source4/cluster/ctdb/include/includes.h
source4/dsdb/common/sidmap.c
source4/dsdb/repl/drepl_service.c
source4/dsdb/samdb/cracknames.c
source4/dsdb/samdb/ldb_modules/config.mk
source4/dsdb/samdb/ldb_modules/rootdse.c
source4/dsdb/samdb/ldb_modules/samldb.c
source4/dsdb/samdb/ldb_modules/update_keytab.c
source4/dsdb/samdb/samdb.c
source4/dsdb/samdb/samdb.h
source4/dsdb/samdb/samdb_privilege.c
source4/kdc/hdb-ldb.c
source4/kdc/kdc.c
source4/kdc/kpasswdd.c
source4/ldap_server/ldap_backend.c
source4/ldap_server/ldap_bind.c
source4/ldap_server/ldap_server.c
source4/lib/appweb/mpr/miniMpr.c
source4/lib/appweb/mpr/miniMpr.h
source4/lib/basic.mk
source4/lib/events/config.mk
source4/lib/events/events.c
source4/lib/ldb/ldb.i
source4/lib/ldb/ldb.py
source4/lib/ldb/ldb_ildap/ldb_ildap.c
source4/lib/ldb/ldb_tdb/ldb_index.c
source4/lib/ldb/ldb_wrap.c
source4/lib/ldb_wrap.c
source4/lib/ldb_wrap.h
source4/lib/messaging/messaging.c
source4/lib/messaging/tests/messaging.c
source4/lib/policy/adm.h [deleted file]
source4/lib/policy/config.mk [deleted file]
source4/lib/policy/dumpadm.c [deleted file]
source4/lib/policy/lex.c [deleted file]
source4/lib/policy/lex.l [deleted file]
source4/lib/policy/parse_adm.c [deleted file]
source4/lib/policy/parse_adm.h [deleted file]
source4/lib/policy/parse_adm.y [deleted file]
source4/lib/registry/hive.c
source4/lib/registry/ldb.c
source4/lib/registry/local.c
source4/lib/registry/registry.h
source4/lib/registry/registry.i
source4/lib/registry/registry.py
source4/lib/registry/registry_wrap.c
source4/lib/registry/samba.c
source4/lib/registry/tests/hive.c
source4/lib/registry/tests/registry.c
source4/lib/registry/tools/common.c
source4/lib/registry/tools/regdiff.c
source4/lib/registry/tools/regpatch.c
source4/lib/registry/tools/regshell.c
source4/lib/registry/tools/regtree.c
source4/lib/replace/libreplace_cc.m4
source4/lib/replace/replace.c
source4/lib/replace/replace.h
source4/lib/socket/testsuite.c
source4/lib/talloc/testsuite.c
source4/lib/util/config.mk
source4/lib/util/tests/file.c
source4/lib/util/util.h
source4/libcli/cldap/cldap.c
source4/libcli/cliconnect.c
source4/libcli/composite/composite.c
source4/libcli/dgram/dgramsocket.c
source4/libcli/ldap/ldap_bind.c
source4/libcli/ldap/ldap_client.c
source4/libcli/ldap/ldap_ndr.h
source4/libcli/nbt/libnbt.h
source4/libcli/nbt/nbtsocket.c
source4/libcli/raw/clisocket.c
source4/libcli/raw/interfaces.h
source4/libcli/raw/rawrequest.c
source4/libcli/raw/rawtrans.c
source4/libcli/resolve/host.c
source4/libcli/resolve/nbtlist.c
source4/libcli/resolve/resolve.c
source4/libcli/smb2/break.c [new file with mode: 0644]
source4/libcli/smb2/config.mk
source4/libcli/smb2/connect.c
source4/libcli/smb2/create.c
source4/libcli/smb2/read.c
source4/libcli/smb2/request.c
source4/libcli/smb2/smb2.h
source4/libcli/smb2/transport.c
source4/libcli/smb_composite/connect.c
source4/libcli/smb_composite/fetchfile.c
source4/libcli/smb_composite/fsinfo.c
source4/libcli/wbclient/config.mk
source4/libcli/wrepl/winsrepl.c
source4/libnet/config.mk
source4/libnet/libnet.c
source4/libnet/libnet.h
source4/libnet/libnet_become_dc.c
source4/libnet/libnet_join.c
source4/libnet/libnet_join.h
source4/libnet/libnet_samdump_keytab.c
source4/libnet/libnet_samsync.c [new file with mode: 0644]
source4/libnet/libnet_samsync.h [new file with mode: 0644]
source4/libnet/libnet_samsync_ldb.c
source4/libnet/libnet_site.c
source4/libnet/libnet_unbecome_dc.c
source4/libnet/libnet_user.c
source4/libnet/libnet_user.h
source4/libnet/libnet_vampire.c
source4/libnet/libnet_vampire.h
source4/libnet/net.i [deleted file]
source4/libnet/net.py [deleted file]
source4/libnet/net_wrap.c [deleted file]
source4/libnet/py_net.c [new file with mode: 0644]
source4/librpc/config.mk
source4/librpc/idl/drsuapi.idl
source4/librpc/idl/nbt.idl
source4/librpc/idl/policyagent.idl
source4/librpc/idl/security.idl
source4/librpc/ndr/libndr.h
source4/librpc/ndr/ndr_basic.c
source4/librpc/ndr/ndr_sec_helper.c
source4/librpc/rpc/binding.c [new file with mode: 0644]
source4/librpc/rpc/dcerpc.c
source4/librpc/rpc/dcerpc_connect.c
source4/librpc/rpc/dcerpc_util.c
source4/nbt_server/dgram/netlogon.c
source4/nbt_server/nbt_server.c
source4/nbt_server/wins/winsdb.c
source4/nbt_server/wins/winsserver.c
source4/ntptr/ntptr.h
source4/ntptr/ntptr_base.c
source4/ntptr/simple_ldb/ntptr_simple_ldb.c
source4/ntvfs/cifs/vfs_cifs.c
source4/ntvfs/common/notify.c
source4/ntvfs/ipc/ipc_rap.c
source4/ntvfs/ipc/rap_server.c
source4/ntvfs/ipc/vfs_ipc.c
source4/ntvfs/ntvfs_generic.c
source4/ntvfs/posix/config.mk
source4/ntvfs/posix/pvfs_acl.c
source4/ntvfs/posix/vfs_posix.c
source4/ntvfs/sysdep/sys_lease.c
source4/ntvfs/sysdep/sys_notify.c
source4/param/config.mk
source4/param/param.i
source4/param/param.py
source4/param/param_wrap.c
source4/param/provision.c [moved from source4/torture/util_provision.c with 78% similarity]
source4/param/provision.h [new file with mode: 0644]
source4/param/share.c
source4/param/share.h
source4/param/share_classic.c
source4/param/share_ldb.c
source4/param/tests/share.c
source4/pidl/config.mk
source4/pidl/lib/Parse/Pidl/Samba3/ClientNDR.pm
source4/pidl/lib/Parse/Pidl/Samba4/NDR/Client.pm
source4/pidl/lib/Parse/Pidl/Samba4/Python.pm
source4/pidl/tests/samba3-cli.pl
source4/rpc_server/common/server_info.c
source4/rpc_server/drsuapi/dcesrv_drsuapi.c
source4/rpc_server/lsa/lsa_init.c
source4/rpc_server/lsa/lsa_lookup.c
source4/rpc_server/netlogon/dcerpc_netlogon.c
source4/rpc_server/samr/dcesrv_samr.c
source4/rpc_server/samr/samr_password.c
source4/rpc_server/service_rpc.c
source4/rpc_server/spoolss/dcesrv_spoolss.c
source4/rpc_server/srvsvc/dcesrv_srvsvc.c
source4/rpc_server/srvsvc/srvsvc_ntvfs.c
source4/rpc_server/winreg/rpc_winreg.c
source4/samba4-knownfail
source4/samba4-skip
source4/scripting/bin/subunitrun
source4/scripting/ejs/config.mk
source4/scripting/ejs/ejsnet/net_ctx.c
source4/scripting/ejs/ejsnet/net_user.c
source4/scripting/ejs/smbcalls_auth.c
source4/scripting/ejs/smbcalls_ldb.c
source4/scripting/ejs/smbcalls_nbt.c
source4/scripting/ejs/smbcalls_reg.c
source4/scripting/ejs/smbcalls_rpc.c
source4/scripting/python/config.mk
source4/scripting/python/misc.i
source4/scripting/python/misc.py
source4/scripting/python/misc_wrap.c
source4/scripting/python/modules.c
source4/scripting/python/pyrpc.h
source4/scripting/python/pytalloc.c
source4/scripting/python/samba/getopt.py
source4/scripting/python/samba/idmap.py
source4/scripting/python/samba/provision.py
source4/scripting/python/samba/samdb.py
source4/scripting/python/samba/tests/__init__.py
source4/scripting/python/samba/tests/dcerpc/registry.py
source4/scripting/python/samba/tests/dcerpc/rpcecho.py
source4/scripting/python/samba/tests/dcerpc/sam.py
source4/scripting/python/samba/tests/dcerpc/unix.py
source4/scripting/python/samba/tests/provision.py
source4/scripting/python/samba/tests/samdb.py
source4/scripting/python/uuidmodule.c
source4/selftest/README
source4/selftest/Subunit.pm
source4/selftest/output/plain.pm
source4/selftest/samba4_tests.sh
source4/selftest/selftest.pl
source4/selftest/target/Samba4.pm
source4/setup/idmap_init.ldif
source4/setup/newuser
source4/setup/provision
source4/setup/provision-backend
source4/setup/provision.ldif
source4/setup/provision_basedn_modify.ldif
source4/setup/provision_configuration.ldif
source4/setup/provision_rootdse_add.ldif
source4/setup/provision_schema_basedn_modify.ldif
source4/setup/provision_self_join.ldif
source4/setup/setpassword
source4/setup/tests/blackbox_provision.sh
source4/smb_server/smb/receive.c
source4/smb_server/smb/request.c
source4/smb_server/smb/sesssetup.c
source4/smb_server/smb2/fileio.c
source4/smb_server/smb2/negprot.c
source4/smb_server/smb_server.c
source4/static_deps.mk
source4/torture/auth/ntlmssp.c
source4/torture/basic/base.c
source4/torture/basic/delaywrite.c
source4/torture/config.mk
source4/torture/gentest.c
source4/torture/ldap/cldap.c
source4/torture/ldap/cldapbench.c
source4/torture/ldap/common.c
source4/torture/ldap/schema.c
source4/torture/ldap/uptodatevector.c
source4/torture/libnet/domain.c
source4/torture/libnet/libnet_BecomeDC.c
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/local/dbspeed.c
source4/torture/local/torture.c
source4/torture/locktest.c
source4/torture/locktest2.c
source4/torture/masktest.c
source4/torture/nbt/browse.c
source4/torture/nbt/dgram.c
source4/torture/nbt/nbt.c
source4/torture/nbt/query.c
source4/torture/nbt/register.c
source4/torture/nbt/wins.c
source4/torture/nbt/winsbench.c
source4/torture/nbt/winsreplication.c
source4/torture/ndr/netlogon.c
source4/torture/raw/composite.c
source4/torture/raw/lockbench.c
source4/torture/raw/lookuprate.c [new file with mode: 0644]
source4/torture/raw/offline.c
source4/torture/raw/open.c
source4/torture/raw/openbench.c
source4/torture/raw/oplock.c
source4/torture/raw/raw.c
source4/torture/raw/samba3hide.c
source4/torture/raw/samba3misc.c
source4/torture/rpc/async_bind.c
source4/torture/rpc/dfs.c
source4/torture/rpc/dssync.c
source4/torture/rpc/join.c
source4/torture/rpc/rpc.c
source4/torture/rpc/samba3rpc.c
source4/torture/rpc/samlogon.c
source4/torture/rpc/samsync.c
source4/torture/rpc/schannel.c
source4/torture/rpc/session_key.c
source4/torture/rpc/testjoin.c
source4/torture/smb2/config.mk
source4/torture/smb2/oplocks.c [new file with mode: 0644]
source4/torture/smb2/persistent_handles.c [new file with mode: 0644]
source4/torture/smb2/scan.c
source4/torture/smb2/smb2.c
source4/torture/smb2/util.c
source4/torture/smbtorture.c
source4/torture/ui.c
source4/torture/ui.h
source4/torture/unix/unix_info2.c
source4/torture/unix/whoami.c
source4/torture/util.h
source4/torture/util_smb.c
source4/torture/winbind/struct_based.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
source4/utils/nmblookup.c
source4/utils/ntlm_auth.c
source4/winbind/idmap.c
source4/winbind/idmap.h
source4/winbind/wb_async_helpers.c
source4/winbind/wb_cmd_getpwnam.c
source4/winbind/wb_cmd_getpwuid.c
source4/winbind/wb_cmd_list_trustdom.c
source4/winbind/wb_connect_lsa.c
source4/winbind/wb_init_domain.c
source4/winbind/wb_pam_auth.c
source4/winbind/wb_samba3_cmd.c
source4/winbind/wb_samba3_protocol.c
source4/winbind/wb_server.c
source4/winbind/wb_sids2xids.c
source4/winbind/wb_xids2sids.c
source4/wrepl_server/wrepl_server.c
testdata/samba3/provision_samba3sam_templates.ldif
testprogs/blackbox/ndrdump/samr-CreateUser-in.dat [new file with mode: 0644]
testprogs/blackbox/ndrdump/samr-CreateUser-out.dat [new file with mode: 0644]
testprogs/blackbox/subunit.sh [new file with mode: 0755]
testprogs/blackbox/test_cifsdd.sh
testprogs/blackbox/test_gentest.sh
testprogs/blackbox/test_kinit.sh
testprogs/blackbox/test_ldb.sh
testprogs/blackbox/test_locktest.sh
testprogs/blackbox/test_masktest.sh
testprogs/blackbox/test_ndrdump.sh [new file with mode: 0755]
testprogs/blackbox/test_smbclient.sh
testprogs/blackbox/test_wbinfo.sh [new file with mode: 0755]

index 8c74b4899d8e74097544f0d9812492552ff736cd..f2567e6ac4a36704dd371af1ef945a6b3c85840a 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
@@ -51,6 +51,8 @@ include data.mk
 
 BINARIES += $(BIN_PROGS) $(SBIN_PROGS)
 
+pythonmods:: $(PYTHON_PYS) $(PYTHON_SO)
+
 DEP_FILES = $(patsubst %.ho,%.hd,$(patsubst %.o,%.d,$(ALL_OBJS))) \
                   include/includes.d
 
index 4b467cee75bd2d3dbcbd3a433cd9f4fe6210ce27..731e489ba0fc470d851ecd49c052a777ad92cd88 100644 (file)
@@ -289,7 +289,7 @@ static NTSTATUS authsam_check_password_internals(struct auth_method_context *ctx
                return NT_STATUS_NO_MEMORY;
        }
 
-       sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
+       sam_ctx = samdb_connect(tmp_ctx, ctx->auth_ctx->event_ctx, ctx->auth_ctx->lp_ctx, system_session(mem_ctx, ctx->auth_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                talloc_free(tmp_ctx);
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
index 50be02a35334e86c549ca254d41e92cf49e22a7b..e7039c36575fb529e3ede16318eb017636438f6c 100644 (file)
@@ -90,7 +90,7 @@ _PUBLIC_ NTSTATUS authenticate_username_pw(TALLOC_CTX *mem_ctx,
        }
 
        if (session_info) {
-               nt_status = auth_generate_session_info(tmp_ctx, lp_ctx, server_info, session_info);
+               nt_status = auth_generate_session_info(tmp_ctx, ev, lp_ctx, server_info, session_info);
 
                if (NT_STATUS_IS_OK(nt_status)) {
                        talloc_steal(mem_ctx, *session_info);
index 14f5da0eb706c58ffcc755b176aed820f3e87ac8..dd5507118691adeb7a8e72ba4498d25b3670be3f 100644 (file)
@@ -87,13 +87,13 @@ PRIVATE_PROTO_HEADER = pam_errors.h
 
 PAM_ERRORS_OBJ_FILES = $(addprefix auth/, pam_errors.o)
 
-[MODULE::service_auth]
+[MODULE::auth]
 INIT_FUNCTION = server_service_auth_init
 SUBSYSTEM = smbd
 PRIVATE_PROTO_HEADER = auth_proto.h
 PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSECURITY SAMDB CREDENTIALS 
 
-service_auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o)
+auth_OBJ_FILES = $(addprefix auth/, auth.o auth_util.o auth_simple.o)
 
 # PUBLIC_HEADERS += auth/auth.h
 
index 89dddc9e0585408dde0bfa412030e68ebb363ad3..bfed451689233911758a84e0b5d064cc1a09520a 100644 (file)
@@ -65,7 +65,6 @@ _PUBLIC_ struct cli_credentials *cli_credentials_init(TALLOC_CTX *mem_ctx)
 
        cred->tries = 3;
        cred->callback_running = false;
-       cred->ev = NULL;
 
        cli_credentials_set_kerberos_state(cred, CRED_AUTO_USE_KERBEROS);
        cli_credentials_set_gensec_features(cred, 0);
@@ -675,7 +674,7 @@ _PUBLIC_ void cli_credentials_guess(struct cli_credentials *cred,
        }
        
        if (cli_credentials_get_kerberos_state(cred) != CRED_DONT_USE_KERBEROS) {
-               cli_credentials_set_ccache(cred, lp_ctx, NULL, CRED_GUESS_FILE);
+               cli_credentials_set_ccache(cred, event_context_find(cred), lp_ctx, NULL, CRED_GUESS_FILE);
        }
 }
 
@@ -775,22 +774,3 @@ _PUBLIC_ bool cli_credentials_wrong_password(struct cli_credentials *cred)
 
        return (cred->tries > 0);
 }
-
-/*
-  set the common event context for this set of credentials
- */
-_PUBLIC_ void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev)
-{
-       cred->ev = ev;
-}
-
-/*
-  set the common event context for this set of credentials
- */
-_PUBLIC_ struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred)
-{
-       if (cred->ev == NULL) {
-               cred->ev = event_context_find(cred);
-       }
-       return cred->ev;
-}
index afcb300638388d19f43f5047e7bbb7fee9a8aa6a..2514b5b1ce6793f9a83ada564d8853bc54149550 100644 (file)
@@ -26,6 +26,7 @@
 #include "librpc/gen_ndr/misc.h"
 
 struct ccache_container;
+struct event_context;
 
 /* In order of priority */
 enum credentials_obtained { 
@@ -121,9 +122,6 @@ struct cli_credentials {
 
        /* Whether any callback is currently running */
        bool callback_running;
-
-       /* an event context for anyone wanting to use the credentials */
-       struct event_context *ev;
 };
 
 struct ldb_context;
@@ -152,12 +150,15 @@ NTSTATUS cli_credentials_get_ntlm_response(struct cli_credentials *cred, TALLOC_
 const char *cli_credentials_get_realm(struct cli_credentials *cred);
 const char *cli_credentials_get_username(struct cli_credentials *cred);
 int cli_credentials_get_krb5_context(struct cli_credentials *cred, 
+                                    struct event_context *event_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct smb_krb5_context **smb_krb5_context);
 int cli_credentials_get_ccache(struct cli_credentials *cred, 
+                              struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               struct ccache_container **ccc);
 int cli_credentials_get_keytab(struct cli_credentials *cred, 
+                              struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               struct keytab_container **_ktc);
 const char *cli_credentials_get_domain(struct cli_credentials *cred);
@@ -168,15 +169,15 @@ void cli_credentials_set_conf(struct cli_credentials *cred,
                              struct loadparm_context *lp_ctx);
 const char *cli_credentials_get_principal(struct cli_credentials *cred, TALLOC_CTX *mem_ctx);
 int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, 
+                                        struct event_context *event_ctx,
                                         struct loadparm_context *lp_ctx,
                                         struct gssapi_creds_container **_gcc);
 int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, 
+                                        struct event_context *event_ctx,
                                         struct loadparm_context *lp_ctx,
                                         struct gssapi_creds_container **_gcc);
-void cli_credentials_set_event_context(struct cli_credentials *cred, struct event_context *ev);
 void cli_credentials_set_kerberos_state(struct cli_credentials *creds, 
                                        enum credentials_use_kerberos use_kerberos);
-struct event_context *cli_credentials_get_event_context(struct cli_credentials *cred);
 bool cli_credentials_set_domain(struct cli_credentials *cred, 
                                const char *val, 
                                enum credentials_obtained obtained);
@@ -199,6 +200,7 @@ void cli_credentials_set_netlogon_creds(struct cli_credentials *cred,
 NTSTATUS cli_credentials_set_krb5_context(struct cli_credentials *cred, 
                                          struct smb_krb5_context *smb_krb5_context);
 NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
+                                             struct event_context *event_ctx,
                                              struct loadparm_context *lp_ctx,
                                              const char *serviceprincipal);
 NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred,
@@ -220,14 +222,17 @@ bool cli_credentials_set_nt_hash(struct cli_credentials *cred,
                                 const struct samr_Password *nt_hash, 
                                 enum credentials_obtained obtained);
 int cli_credentials_set_keytab_name(struct cli_credentials *cred, 
+                                   struct event_context *event_ctx,
                                    struct loadparm_context *lp_ctx,
                                    const char *keytab_name, 
                                    enum credentials_obtained obtained);
 int cli_credentials_update_keytab(struct cli_credentials *cred, 
+                                 struct event_context *event_ctx,
                                  struct loadparm_context *lp_ctx);
 void cli_credentials_set_gensec_features(struct cli_credentials *creds, uint32_t gensec_features);
 uint32_t cli_credentials_get_gensec_features(struct cli_credentials *creds);
 int cli_credentials_set_ccache(struct cli_credentials *cred, 
+                              struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               const char *name, 
                               enum credentials_obtained obtained);
@@ -239,6 +244,7 @@ void cli_credentials_invalidate_ccache(struct cli_credentials *cred,
 void cli_credentials_set_salt_principal(struct cli_credentials *cred, const char *principal);
 enum credentials_use_kerberos cli_credentials_get_kerberos_state(struct cli_credentials *creds);
 NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, 
+                                    struct event_context *event_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct ldb_context *ldb,
                                     const char *base,
index 0a604cf0020364c2108e4c8444d24a37bd9cb6dd..152d2e673ccd84c1b5ab2fabea7ed7b2c1690b6b 100644 (file)
@@ -95,6 +95,8 @@ typedef struct cli_credentials {
         bool set_workstation(const char *workstation, 
                              enum credentials_obtained obtained=CRED_SPECIFIED);
 
+        NTSTATUS set_machine_account(struct loadparm_context *lp_ctx);
+
         void guess(struct loadparm_context *lp_ctx);
         bool is_anonymous(void);
 
index 2b40fbeeadfd074fbdbab8535115ae058013864d..ba0000dcda889236189d555154e2fc202830b44d 100644 (file)
@@ -82,6 +82,7 @@ Credentials.set_bind_dn = new_instancemethod(_credentials.Credentials_set_bind_d
 Credentials.set_anonymous = new_instancemethod(_credentials.Credentials_set_anonymous,None,Credentials)
 Credentials.get_workstation = new_instancemethod(_credentials.Credentials_get_workstation,None,Credentials)
 Credentials.set_workstation = new_instancemethod(_credentials.Credentials_set_workstation,None,Credentials)
+Credentials.set_machine_account = new_instancemethod(_credentials.Credentials_set_machine_account,None,Credentials)
 Credentials.guess = new_instancemethod(_credentials.Credentials_guess,None,Credentials)
 Credentials.is_anonymous = new_instancemethod(_credentials.Credentials_is_anonymous,None,Credentials)
 Credentials.get_nt_hash = new_instancemethod(_credentials.Credentials_get_nt_hash,None,Credentials)
index 8bcbc655750906d403ef56fd7e970d7114d01900..ab76ea2cdec0564c70690f2bada995840f03b5f8 100644 (file)
@@ -30,6 +30,7 @@
 #include "auth/credentials/credentials.h"
 #include "auth/credentials/credentials_krb5.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 /**
  * Read a file descriptor, and parse it for a password (eg from a file or stdin)
@@ -169,6 +170,7 @@ _PUBLIC_ bool cli_credentials_parse_file(struct cli_credentials *cred, const cha
  * @retval NTSTATUS error detailing any failure
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred, 
+                                             struct event_context *event_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct ldb_context *ldb,
                                     const char *base,
@@ -305,13 +307,13 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
         * (chewing CPU time) from the password */
        keytab = ldb_msg_find_attr_as_string(msgs[0], "krb5Keytab", NULL);
        if (keytab) {
-               cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
+               cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
        } else {
                keytab = ldb_msg_find_attr_as_string(msgs[0], "privateKeytab", NULL);
                if (keytab) {
                        keytab = talloc_asprintf(mem_ctx, "FILE:%s", private_path(mem_ctx, lp_ctx, keytab));
                        if (keytab) {
-                               cli_credentials_set_keytab_name(cred, lp_ctx, keytab, CRED_SPECIFIED);
+                               cli_credentials_set_keytab_name(cred, event_ctx, lp_ctx, keytab, CRED_SPECIFIED);
                        }
                }
        }
@@ -327,7 +329,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_secrets(struct cli_credentials *cred,
  * @retval NTSTATUS error detailing any failure
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cred,
-                                            struct loadparm_context *lp_ctx)
+                                                     struct loadparm_context *lp_ctx)
 {
        char *filter;
        /* Bleh, nasty recursion issues: We are setting a machine
@@ -336,7 +338,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
        cred->machine_account_pending = false;
        filter = talloc_asprintf(cred, SECRETS_PRIMARY_DOMAIN_FILTER, 
                                       cli_credentials_get_domain(cred));
-       return cli_credentials_set_secrets(cred, lp_ctx, NULL, 
+       return cli_credentials_set_secrets(cred, event_context_find(cred), lp_ctx, NULL, 
                                           SECRETS_PRIMARY_DOMAIN_DN,
                                           filter);
 }
@@ -348,6 +350,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_machine_account(struct cli_credentials *cr
  * @retval NTSTATUS error detailing any failure
  */
 NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
+                                   struct event_context *event_ctx,
                                    struct loadparm_context *lp_ctx)
 {
        char *filter;
@@ -358,7 +361,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
        filter = talloc_asprintf(cred, SECRETS_KRBTGT_SEARCH,
                                       cli_credentials_get_realm(cred),
                                       cli_credentials_get_domain(cred));
-       return cli_credentials_set_secrets(cred, lp_ctx, NULL, 
+       return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL, 
                                           SECRETS_PRINCIPALS_DN,
                                           filter);
 }
@@ -370,6 +373,7 @@ NTSTATUS cli_credentials_set_krbtgt(struct cli_credentials *cred,
  * @retval NTSTATUS error detailing any failure
  */
 _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *cred,
+                                                      struct event_context *event_ctx,
                                              struct loadparm_context *lp_ctx,
                                              const char *serviceprincipal)
 {
@@ -382,7 +386,7 @@ _PUBLIC_ NTSTATUS cli_credentials_set_stored_principal(struct cli_credentials *c
                                 cli_credentials_get_realm(cred),
                                 cli_credentials_get_domain(cred),
                                 serviceprincipal);
-       return cli_credentials_set_secrets(cred, lp_ctx, NULL, 
+       return cli_credentials_set_secrets(cred, event_ctx, lp_ctx, NULL, 
                                           SECRETS_PRINCIPALS_DN, filter);
 }
 
index cd9285b09d0592edafe6d10aff3c0692717ac9fa..3bc17644488a090aaf81619ad2fa106fcdfde99c 100644 (file)
@@ -30,6 +30,7 @@
 #include "param/param.h"
 
 _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred, 
+                                             struct event_context *event_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct smb_krb5_context **smb_krb5_context) 
 {
@@ -39,8 +40,7 @@ _PUBLIC_ int cli_credentials_get_krb5_context(struct cli_credentials *cred,
                return 0;
        }
 
-       ret = smb_krb5_init_context(cred, cli_credentials_get_event_context(cred), 
-                                   lp_ctx, &cred->smb_krb5_context);
+       ret = smb_krb5_init_context(cred, event_ctx, lp_ctx, &cred->smb_krb5_context);
        if (ret) {
                cred->smb_krb5_context = NULL;
                return ret;
@@ -128,6 +128,7 @@ static int free_dccache(struct ccache_container *ccc) {
 }
 
 _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred, 
+                                       struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               const char *name, 
                               enum credentials_obtained obtained)
@@ -144,7 +145,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
                return ENOMEM;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, 
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, 
                                               &ccc->smb_krb5_context);
        if (ret) {
                talloc_free(ccc);
@@ -203,6 +204,7 @@ _PUBLIC_ int cli_credentials_set_ccache(struct cli_credentials *cred,
 
 
 static int cli_credentials_new_ccache(struct cli_credentials *cred, 
+                                     struct event_context *event_ctx,
                                      struct loadparm_context *lp_ctx,
                                      struct ccache_container **_ccc)
 {
@@ -221,7 +223,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
                return ENOMEM;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, 
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, 
                                               &ccc->smb_krb5_context);
        if (ret) {
                talloc_free(ccc);
@@ -253,6 +255,7 @@ static int cli_credentials_new_ccache(struct cli_credentials *cred,
 }
 
 _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred, 
+                                       struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               struct ccache_container **ccc)
 {
@@ -271,7 +274,7 @@ _PUBLIC_ int cli_credentials_get_ccache(struct cli_credentials *cred,
                return EINVAL;
        }
 
-       ret = cli_credentials_new_ccache(cred, lp_ctx, ccc);
+       ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, ccc);
        if (ret) {
                return ret;
        }
@@ -348,6 +351,7 @@ static int free_gssapi_creds(struct gssapi_creds_container *gcc)
 }
 
 _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred, 
+                                        struct event_context *event_ctx,
                                         struct loadparm_context *lp_ctx,
                                         struct gssapi_creds_container **_gcc) 
 {
@@ -360,7 +364,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
                *_gcc = cred->client_gss_creds;
                return 0;
        }
-       ret = cli_credentials_get_ccache(cred, lp_ctx, 
+       ret = cli_credentials_get_ccache(cred, event_ctx, lp_ctx, 
                                         &ccache);
        if (ret) {
                DEBUG(1, ("Failed to get CCACHE for GSSAPI client: %s\n", error_message(ret)));
@@ -402,6 +406,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
 */
 
  int cli_credentials_set_client_gss_creds(struct cli_credentials *cred, 
+                                         struct event_context *event_ctx,
                                          struct loadparm_context *lp_ctx,
                                          gss_cred_id_t gssapi_cred,
                                          enum credentials_obtained obtained) 
@@ -419,7 +424,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
                return ENOMEM;
        }
 
-       ret = cli_credentials_new_ccache(cred, lp_ctx, &ccc);
+       ret = cli_credentials_new_ccache(cred, event_ctx, lp_ctx, &ccc);
        if (ret != 0) {
                return ret;
        }
@@ -456,6 +461,7 @@ _PUBLIC_ int cli_credentials_get_client_gss_creds(struct cli_credentials *cred,
  * it will be generated from the password.
  */
 _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred, 
+                                       struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               struct keytab_container **_ktc)
 {
@@ -475,7 +481,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
                return EINVAL;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, 
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, 
                                               &smb_krb5_context);
        if (ret) {
                return ret;
@@ -510,6 +516,7 @@ _PUBLIC_ int cli_credentials_get_keytab(struct cli_credentials *cred,
  * FILE:/etc/krb5.keytab), open it and attach it */
 
 _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred, 
+                                            struct event_context *event_ctx,
                                    struct loadparm_context *lp_ctx,
                                    const char *keytab_name, 
                                    enum credentials_obtained obtained) 
@@ -523,7 +530,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
                return 0;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
        if (ret) {
                return ret;
        }
@@ -549,6 +556,7 @@ _PUBLIC_ int cli_credentials_set_keytab_name(struct cli_credentials *cred,
 }
 
 _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred, 
+                                          struct event_context *event_ctx,
                                  struct loadparm_context *lp_ctx) 
 {
        krb5_error_code ret;
@@ -562,7 +570,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
                return ENOMEM;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
        if (ret) {
                talloc_free(mem_ctx);
                return ret;
@@ -570,7 +578,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
 
        enctype_strings = cli_credentials_get_enctype_strings(cred);
        
-       ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
+       ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
        if (ret != 0) {
                talloc_free(mem_ctx);
                return ret;
@@ -585,6 +593,7 @@ _PUBLIC_ int cli_credentials_update_keytab(struct cli_credentials *cred,
 /* Get server gss credentials (in gsskrb5, this means the keytab) */
 
 _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred, 
+                                                 struct event_context *event_ctx,
                                         struct loadparm_context *lp_ctx,
                                         struct gssapi_creds_container **_gcc) 
 {
@@ -603,12 +612,12 @@ _PUBLIC_ int cli_credentials_get_server_gss_creds(struct cli_credentials *cred,
                return 0;
        }
 
-       ret = cli_credentials_get_krb5_context(cred, lp_ctx, &smb_krb5_context);
+       ret = cli_credentials_get_krb5_context(cred, event_ctx, lp_ctx, &smb_krb5_context);
        if (ret) {
                return ret;
        }
 
-       ret = cli_credentials_get_keytab(cred, lp_ctx, &ktc);
+       ret = cli_credentials_get_keytab(cred, event_ctx, lp_ctx, &ktc);
        if (ret) {
                DEBUG(1, ("Failed to get keytab for GSSAPI server: %s\n", error_message(ret)));
                return ret;
index aaa7d7f0da1c2d6ecd444e903f1cecdc93f66edc..f672b0ad9ad4c9421e64dbe303c90d8eaaafa131 100644 (file)
@@ -32,6 +32,7 @@ struct gssapi_creds_container {
 
 /* Manually prototyped here to avoid needing gss headers in most callers */
 int cli_credentials_set_client_gss_creds(struct cli_credentials *cred, 
+                                        struct event_context *event_ctx,
                                         struct loadparm_context *lp_ctx,
                                         gss_cred_id_t gssapi_cred,
                                         enum credentials_obtained obtained);
index 909233aaff9e41c5caa9a1afb0f8aa782bb2de75..6c99802b09ddf56f2741d0389d4d0cff7583e7bb 100644 (file)
@@ -2456,24 +2456,25 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 
 /* -------- TYPES TABLE (BEGIN) -------- */
 
-#define SWIGTYPE_p_TALLOC_CTX swig_types[0]
-#define SWIGTYPE_p_char swig_types[1]
-#define SWIGTYPE_p_cli_credentials swig_types[2]
-#define SWIGTYPE_p_int swig_types[3]
-#define SWIGTYPE_p_loadparm_context swig_types[4]
-#define SWIGTYPE_p_loadparm_service swig_types[5]
-#define SWIGTYPE_p_long swig_types[6]
-#define SWIGTYPE_p_param_context swig_types[7]
-#define SWIGTYPE_p_param_opt swig_types[8]
-#define SWIGTYPE_p_param_section swig_types[9]
-#define SWIGTYPE_p_short swig_types[10]
-#define SWIGTYPE_p_signed_char swig_types[11]
-#define SWIGTYPE_p_unsigned_char swig_types[12]
-#define SWIGTYPE_p_unsigned_int swig_types[13]
-#define SWIGTYPE_p_unsigned_long swig_types[14]
-#define SWIGTYPE_p_unsigned_short swig_types[15]
-static swig_type_info *swig_types[17];
-static swig_module_info swig_module = {swig_types, 16, 0, 0, 0, 0};
+#define SWIGTYPE_p_NTSTATUS swig_types[0]
+#define SWIGTYPE_p_TALLOC_CTX swig_types[1]
+#define SWIGTYPE_p_char swig_types[2]
+#define SWIGTYPE_p_cli_credentials swig_types[3]
+#define SWIGTYPE_p_int swig_types[4]
+#define SWIGTYPE_p_loadparm_context swig_types[5]
+#define SWIGTYPE_p_loadparm_service swig_types[6]
+#define SWIGTYPE_p_long_long swig_types[7]
+#define SWIGTYPE_p_param_context swig_types[8]
+#define SWIGTYPE_p_param_opt swig_types[9]
+#define SWIGTYPE_p_param_section swig_types[10]
+#define SWIGTYPE_p_short swig_types[11]
+#define SWIGTYPE_p_signed_char swig_types[12]
+#define SWIGTYPE_p_unsigned_char swig_types[13]
+#define SWIGTYPE_p_unsigned_int swig_types[14]
+#define SWIGTYPE_p_unsigned_long_long swig_types[15]
+#define SWIGTYPE_p_unsigned_short swig_types[16]
+static swig_type_info *swig_types[18];
+static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -3409,6 +3410,46 @@ fail:
 }
 
 
+SWIGINTERN PyObject *_wrap_Credentials_set_machine_account(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+  PyObject *resultobj = 0;
+  cli_credentials *arg1 = (cli_credentials *) 0 ;
+  struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
+  NTSTATUS result;
+  void *argp1 = 0 ;
+  int res1 = 0 ;
+  void *argp2 = 0 ;
+  int res2 = 0 ;
+  PyObject * obj0 = 0 ;
+  PyObject * obj1 = 0 ;
+  char *  kwnames[] = {
+    (char *) "self",(char *) "lp_ctx", NULL 
+  };
+  
+  arg1 = NULL;
+  arg2 = loadparm_init(NULL);
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Credentials_set_machine_account",kwnames,&obj0,&obj1)) SWIG_fail;
+  if (obj0) {
+    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_cli_credentials, 0 |  0 );
+    if (!SWIG_IsOK(res1)) {
+      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "Credentials_set_machine_account" "', argument " "1"" of type '" "cli_credentials *""'"); 
+    }
+    arg1 = (cli_credentials *)(argp1);
+  }
+  if (obj1) {
+    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res2)) {
+      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "Credentials_set_machine_account" "', argument " "2"" of type '" "struct loadparm_context *""'"); 
+    }
+    arg2 = (struct loadparm_context *)(argp2);
+  }
+  result = cli_credentials_set_machine_account(arg1,arg2);
+  resultobj = SWIG_NewPointerObj((NTSTATUS *)memcpy((NTSTATUS *)malloc(sizeof(NTSTATUS)),&result,sizeof(NTSTATUS)), SWIGTYPE_p_NTSTATUS, SWIG_POINTER_OWN |  0 );
+  return resultobj;
+fail:
+  return NULL;
+}
+
+
 SWIGINTERN PyObject *_wrap_Credentials_guess(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
   PyObject *resultobj = 0;
   cli_credentials *arg1 = (cli_credentials *) 0 ;
@@ -3646,6 +3687,7 @@ static PyMethodDef SwigMethods[] = {
         { (char *)"Credentials_set_anonymous", (PyCFunction) _wrap_Credentials_set_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_get_workstation", (PyCFunction) _wrap_Credentials_get_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_set_workstation", (PyCFunction) _wrap_Credentials_set_workstation, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Credentials_set_machine_account", (PyCFunction) _wrap_Credentials_set_machine_account, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_guess", (PyCFunction) _wrap_Credentials_guess, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_is_anonymous", (PyCFunction) _wrap_Credentials_is_anonymous, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"Credentials_get_nt_hash", (PyCFunction) _wrap_Credentials_get_nt_hash, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -3661,31 +3703,33 @@ static PyMethodDef SwigMethods[] = {
 
 /* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
 
+static swig_type_info _swigt__p_NTSTATUS = {"_p_NTSTATUS", "NTSTATUS *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
 
 static swig_type_info *swig_type_initial[] = {
+  &_swigt__p_NTSTATUS,
   &_swigt__p_TALLOC_CTX,
   &_swigt__p_char,
   &_swigt__p_cli_credentials,
   &_swigt__p_int,
   &_swigt__p_loadparm_context,
   &_swigt__p_loadparm_service,
-  &_swigt__p_long,
+  &_swigt__p_long_long,
   &_swigt__p_param_context,
   &_swigt__p_param_opt,
   &_swigt__p_param_section,
@@ -3693,17 +3737,18 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_signed_char,
   &_swigt__p_unsigned_char,
   &_swigt__p_unsigned_int,
-  &_swigt__p_unsigned_long,
+  &_swigt__p_unsigned_long_long,
   &_swigt__p_unsigned_short,
 };
 
+static swig_cast_info _swigc__p_NTSTATUS[] = {  {&_swigt__p_NTSTATUS, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_TALLOC_CTX[] = {  {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_cli_credentials[] = {  {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_loadparm_context[] = {  {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_loadparm_service[] = {  {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_long[] = {  {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_long_long[] = {  {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_param_context[] = {  {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_param_opt[] = {  {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_param_section[] = {  {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
@@ -3711,17 +3756,18 @@ static swig_cast_info _swigc__p_short[] = {  {&_swigt__p_short, 0, 0, 0},{0, 0,
 static swig_cast_info _swigc__p_signed_char[] = {  {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_long[] = {  {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_long_long[] = {  {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_short[] = {  {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
 
 static swig_cast_info *swig_cast_initial[] = {
+  _swigc__p_NTSTATUS,
   _swigc__p_TALLOC_CTX,
   _swigc__p_char,
   _swigc__p_cli_credentials,
   _swigc__p_int,
   _swigc__p_loadparm_context,
   _swigc__p_loadparm_service,
-  _swigc__p_long,
+  _swigc__p_long_long,
   _swigc__p_param_context,
   _swigc__p_param_opt,
   _swigc__p_param_section,
@@ -3729,7 +3775,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_signed_char,
   _swigc__p_unsigned_char,
   _swigc__p_unsigned_int,
-  _swigc__p_unsigned_long,
+  _swigc__p_unsigned_long_long,
   _swigc__p_unsigned_short,
 };
 
index 3393ce01784b0f9e85d75e815a4c5c436c033cd9..0edb34d7403fc7d048314ac3d005bf2128bb202f 100644 (file)
@@ -481,6 +481,11 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
                             struct messaging_context *msg,
                             struct gensec_security **gensec_security)
 {
+       if (ev == NULL) {
+               DEBUG(0, ("No event context available!\n"));
+               return NT_STATUS_INTERNAL_ERROR;
+       }
+
        (*gensec_security) = talloc(mem_ctx, struct gensec_security);
        NT_STATUS_HAVE_NO_MEMORY(*gensec_security);
 
@@ -492,14 +497,6 @@ static NTSTATUS gensec_start(TALLOC_CTX *mem_ctx,
 
        (*gensec_security)->subcontext = false;
        (*gensec_security)->want_features = 0;
-       
-       if (ev == NULL) {
-               ev = event_context_init(*gensec_security);
-               if (ev == NULL) {
-                       talloc_free(*gensec_security);
-                       return NT_STATUS_NO_MEMORY;
-               }
-       }
 
        (*gensec_security)->event_ctx = ev;
        (*gensec_security)->msg_ctx = msg;
@@ -547,20 +544,11 @@ _PUBLIC_ NTSTATUS gensec_client_start(TALLOC_CTX *mem_ctx,
                             struct loadparm_context *lp_ctx)
 {
        NTSTATUS status;
-       struct event_context *new_ev = NULL;
-
-       if (ev == NULL) {
-               new_ev = event_context_init(mem_ctx);
-               NT_STATUS_HAVE_NO_MEMORY(new_ev);
-               ev = new_ev;
-       }
 
        status = gensec_start(mem_ctx, ev, lp_ctx, NULL, gensec_security);
        if (!NT_STATUS_IS_OK(status)) {
-               talloc_free(new_ev);
                return status;
        }
-       talloc_steal((*gensec_security), new_ev);
        (*gensec_security)->gensec_role = GENSEC_CLIENT;
 
        return status;
index e7dcb4ea688d41ae561516f9a1f0a1f5e2b56c8a..cc0d40469e529099113c12233fdc52f1cc04d1de 100644 (file)
@@ -273,7 +273,9 @@ static NTSTATUS gensec_gssapi_server_start(struct gensec_security *gensec_securi
                DEBUG(3, ("No machine account credentials specified\n"));
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        } else {
-               ret = cli_credentials_get_server_gss_creds(machine_account, gensec_security->lp_ctx, &gcc);
+               ret = cli_credentials_get_server_gss_creds(machine_account, 
+                                                          gensec_security->event_ctx, 
+                                                          gensec_security->lp_ctx, &gcc);
                if (ret) {
                        DEBUG(1, ("Aquiring acceptor credentials failed: %s\n", 
                                  error_message(ret)));
@@ -359,7 +361,9 @@ static NTSTATUS gensec_gssapi_client_start(struct gensec_security *gensec_securi
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       ret = cli_credentials_get_client_gss_creds(creds, gensec_security->lp_ctx, &gcc);
+       ret = cli_credentials_get_client_gss_creds(creds, 
+                                                  gensec_security->event_ctx, 
+                                                  gensec_security->lp_ctx, &gcc);
        switch (ret) {
        case 0:
                break;
@@ -1323,7 +1327,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
        } else if (!lp_parm_bool(gensec_security->lp_ctx, NULL, "gensec", "require_pac", false)) {
                DEBUG(1, ("Unable to find PAC, resorting to local user lookup: %s\n",
                          gssapi_error_string(mem_ctx, maj_stat, min_stat, gensec_gssapi_state->gss_oid)));
-               nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
+               nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
                                                          &server_info);
 
                if (!NT_STATUS_IS_OK(nt_status)) {
@@ -1338,7 +1342,7 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(mem_ctx);
                return nt_status;
@@ -1361,12 +1365,12 @@ static NTSTATUS gensec_gssapi_session_info(struct gensec_security *gensec_securi
                        return NT_STATUS_NO_MEMORY;
                }
 
-               cli_credentials_set_event_context(session_info->credentials, gensec_security->event_ctx);
                cli_credentials_set_conf(session_info->credentials, gensec_security->lp_ctx);
                /* Just so we don't segfault trying to get at a username */
                cli_credentials_set_anonymous(session_info->credentials);
                
                ret = cli_credentials_set_client_gss_creds(session_info->credentials, 
+                                                          gensec_security->event_ctx,
                                                           gensec_security->lp_ctx, 
                                                           gensec_gssapi_state->delegated_cred_handle,
                                                           CRED_SPECIFIED);
index ae601b19c25e60fa21f0beaf0b906f42dffd516b..47df2ccfcc27835b920b6751dfc389bd9081ef5e 100644 (file)
@@ -118,7 +118,9 @@ static NTSTATUS gensec_krb5_start(struct gensec_security *gensec_security)
 
        talloc_set_destructor(gensec_krb5_state, gensec_krb5_destroy); 
 
-       if (cli_credentials_get_krb5_context(creds, gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
+       if (cli_credentials_get_krb5_context(creds, 
+                                            gensec_security->event_ctx, 
+                                            gensec_security->lp_ctx, &gensec_krb5_state->smb_krb5_context)) {
                talloc_free(gensec_krb5_state);
                return NT_STATUS_INTERNAL_ERROR;
        }
@@ -248,7 +250,9 @@ static NTSTATUS gensec_krb5_client_start(struct gensec_security *gensec_security
 
        principal = gensec_get_target_principal(gensec_security);
 
-       ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &ccache_container);
+       ret = cli_credentials_get_ccache(gensec_get_credentials(gensec_security), 
+                                        gensec_security->event_ctx, 
+                                        gensec_security->lp_ctx, &ccache_container);
        switch (ret) {
        case 0:
                break;
@@ -446,7 +450,9 @@ static NTSTATUS gensec_krb5_update(struct gensec_security *gensec_security,
                }       
 
                /* Grab the keytab, however generated */
-               ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), gensec_security->lp_ctx, &keytab);
+               ret = cli_credentials_get_keytab(gensec_get_credentials(gensec_security), 
+                                                gensec_security->event_ctx, 
+                                                gensec_security->lp_ctx, &keytab);
                if (ret) {
                        return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
                }
@@ -597,7 +603,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
                DEBUG(5, ("krb5_ticket_get_authorization_data_type failed to find PAC: %s\n", 
                          smb_get_krb5_error_message(context, 
                                                     ret, mem_ctx)));
-               nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->lp_ctx, principal_string,
+               nt_status = sam_get_server_info_principal(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, principal_string,
                                                          &server_info);
                krb5_free_principal(context, client_principal);
                free(principal_string);
@@ -645,7 +651,7 @@ static NTSTATUS gensec_krb5_session_info(struct gensec_security *gensec_security
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(mem_ctx, gensec_security->lp_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(mem_ctx, gensec_security->event_ctx, gensec_security->lp_ctx, server_info, &session_info);
 
        if (!NT_STATUS_IS_OK(nt_status)) {
                talloc_free(mem_ctx);
index b3117ee9b2e00d0b86a27c31a424bce8cbaad1ee..f21202b86f5486e46a94898adf518d73ba90ae2d 100644 (file)
@@ -125,7 +125,8 @@ static NTSTATUS schannel_update(struct gensec_security *gensec_security, TALLOC_
                }
                
                /* pull the session key for this client */
-               status = schannel_fetch_session_key(out_mem_ctx, gensec_security->lp_ctx, workstation, 
+               status = schannel_fetch_session_key(out_mem_ctx, gensec_security->event_ctx, 
+                                                   gensec_security->lp_ctx, workstation, 
                                                    domain, &creds);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3, ("Could not find session key for attempted schannel connection from %s: %s\n",
@@ -189,7 +190,7 @@ static NTSTATUS schannel_session_info(struct gensec_security *gensec_security,
                                         struct auth_session_info **_session_info) 
 {
        struct schannel_state *state = talloc_get_type(gensec_security->private_data, struct schannel_state);
-       return auth_anonymous_session_info(state, gensec_security->lp_ctx, _session_info);
+       return auth_anonymous_session_info(state, gensec_security->event_ctx, gensec_security->lp_ctx, _session_info);
 }
 
 static NTSTATUS schannel_start(struct gensec_security *gensec_security)
index 0c7c509954f6a03b1c108927c629264e4c3b5c13..0f7c4ca11d7f9c75b283e901dc65a73c59721d17 100644 (file)
@@ -32,7 +32,8 @@
 /**
   connect to the schannel ldb
 */
-struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
+                                       struct loadparm_context *lp_ctx)
 {
        char *path;
        struct ldb_context *ldb;
@@ -49,7 +50,7 @@ struct ldb_context *schannel_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_con
 
        existed = file_exist(path);
        
-       ldb = ldb_wrap_connect(mem_ctx, lp_ctx, path, 
+       ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, path, 
                               system_session(mem_ctx, lp_ctx), 
                               NULL, LDB_FLG_NOSYNC, NULL);
        talloc_free(path);
@@ -137,6 +138,7 @@ NTSTATUS schannel_store_session_key_ldb(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
+                                   struct event_context *ev_ctx,
                                    struct loadparm_context *lp_ctx,
                                    struct creds_CredentialState *creds)
 {
@@ -144,7 +146,7 @@ NTSTATUS schannel_store_session_key(TALLOC_CTX *mem_ctx,
        NTSTATUS nt_status;
        int ret;
                
-       ldb = schannel_db_connect(mem_ctx, lp_ctx);
+       ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
        if (!ldb) {
                return NT_STATUS_ACCESS_DENIED;
        }
@@ -268,6 +270,7 @@ NTSTATUS schannel_fetch_session_key_ldb(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
+                                   struct event_context *ev_ctx,
                                    struct loadparm_context *lp_ctx,
                                        const char *computer_name, 
                                        const char *domain, 
@@ -276,7 +279,7 @@ NTSTATUS schannel_fetch_session_key(TALLOC_CTX *mem_ctx,
        NTSTATUS nt_status;
        struct ldb_context *ldb;
 
-       ldb = schannel_db_connect(mem_ctx, lp_ctx);
+       ldb = schannel_db_connect(mem_ctx, ev_ctx, lp_ctx);
        if (!ldb) {
                return NT_STATUS_ACCESS_DENIED;
        }
index 12802b7e79c0d9b90e4130006676a377ed79032a..d8ef2a20b828f63fe224fd132343e8c13d1865bd 100644 (file)
@@ -725,7 +725,7 @@ NTSTATUS gensec_ntlmssp_session_info(struct gensec_security *gensec_security,
        NTSTATUS nt_status;
        struct gensec_ntlmssp_state *gensec_ntlmssp_state = (struct gensec_ntlmssp_state *)gensec_security->private_data;
 
-       nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
+       nt_status = auth_generate_session_info(gensec_ntlmssp_state, gensec_security->event_ctx, gensec_security->lp_ctx, gensec_ntlmssp_state->server_info, session_info);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
        (*session_info)->session_key = data_blob_talloc(*session_info, 
index ed44754993b36e9fedf1130d1d2012b10b6a8208..a2090afcdc53372ee1e1e559b2b668ccaa4506a0 100644 (file)
@@ -428,6 +428,7 @@ NTSTATUS sam_get_results_principal(struct ldb_context *sam_ctx,
                                   
 /* Used in the gensec_gssapi and gensec_krb5 server-side code, where the PAC isn't available */
 NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx, 
+                                      struct event_context *event_ctx,
                                       struct loadparm_context *lp_ctx,
                                       const char *principal,
                                       struct auth_serversupplied_info **server_info)
@@ -445,7 +446,7 @@ NTSTATUS sam_get_server_info_principal(TALLOC_CTX *mem_ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       sam_ctx = samdb_connect(tmp_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
+       sam_ctx = samdb_connect(tmp_ctx, event_ctx, lp_ctx, system_session(tmp_ctx, lp_ctx));
        if (sam_ctx == NULL) {
                talloc_free(tmp_ctx);
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
index 112eac95d84aec38c4a60c526a7cff1058f8846a..8f5e8d6c5612685b7c04512cd733efad4b0d2025 100644 (file)
 #include "auth/session_proto.h"
 
 _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, 
+                                           struct event_context *event_ctx, 
                                            struct loadparm_context *lp_ctx) 
 {
        NTSTATUS nt_status;
        struct auth_session_info *session_info = NULL;
-       nt_status = auth_anonymous_session_info(mem_ctx, lp_ctx, &session_info);
+       nt_status = auth_anonymous_session_info(mem_ctx, event_ctx, lp_ctx, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                return NULL;
        }
@@ -43,6 +44,7 @@ _PUBLIC_ struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx,
 }
 
 _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, 
+                                    struct event_context *event_ctx, 
                                     struct loadparm_context *lp_ctx,
                                     struct auth_session_info **_session_info) 
 {
@@ -60,7 +62,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx,
        }
 
        /* references the server_info into the session_info */
-       nt_status = auth_generate_session_info(parent_ctx, lp_ctx, server_info, &session_info);
+       nt_status = auth_generate_session_info(parent_ctx, event_ctx, lp_ctx, server_info, &session_info);
        talloc_free(mem_ctx);
 
        NT_STATUS_NOT_OK_RETURN(nt_status);
@@ -151,6 +153,7 @@ _PUBLIC_ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
 }
 
 _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, 
+                                   struct event_context *event_ctx, 
                                    struct loadparm_context *lp_ctx,
                                    struct auth_serversupplied_info *server_info, 
                                    struct auth_session_info **_session_info) 
@@ -168,6 +171,7 @@ _PUBLIC_ NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx,
        session_info->session_key = server_info->user_session_key;
 
        nt_status = security_token_create(session_info,
+                                         event_ctx,
                                          lp_ctx,
                                          server_info->account_sid,
                                          server_info->primary_group_sid,
index 87fc47791a9e446dd7569e3f2bfd4eef007886ca..9b5fba7f39b14693340fef88e4268b91c4464b5f 100644 (file)
@@ -36,6 +36,7 @@ NTSTATUS auth_anonymous_server_info(TALLOC_CTX *mem_ctx,
                                    const char *netbios_name,
                                    struct auth_serversupplied_info **_server_info) ;
 NTSTATUS auth_generate_session_info(TALLOC_CTX *mem_ctx, 
+                                   struct event_context *event_ctx,
                                    struct loadparm_context *lp_ctx,
                                    struct auth_serversupplied_info *server_info, 
                                    struct auth_session_info **_session_info) ;
@@ -46,10 +47,12 @@ NTSTATUS make_server_info_netlogon_validation(TALLOC_CTX *mem_ctx,
                                              union netr_Validation *validation,
                                              struct auth_serversupplied_info **_server_info);
 NTSTATUS auth_anonymous_session_info(TALLOC_CTX *parent_ctx, 
+                                    struct event_context *ev_ctx,
                                     struct loadparm_context *lp_ctx,
                                     struct auth_session_info **_session_info);
 
 struct auth_session_info *anonymous_session(TALLOC_CTX *mem_ctx, 
+                                           struct event_context *event_ctx,
                                            struct loadparm_context *lp_ctx);
 
 
index 0058afe2b51ec48c140e4c63622eba60b1ec166c..ba8251e65d21e56b18dc396c027f6ceb392f6582 100644 (file)
@@ -4,8 +4,6 @@ dnl Copyright (C) 2004 Stefan Metzmacher
 dnl Copyright (C) 2004-2005 Jelmer Vernooij
 dnl Published under the GPL
 dnl
-dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems)
-dnl
 dnl SMB_EXT_LIB_FROM_PKGCONFIG(name,pkg-config name,[ACTION-IF-FOUND],[ACTION-IF-NOT-FOUND])
 dnl
 dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags)
@@ -22,9 +20,9 @@ dnl SMB_SUBSYSTEM(name,obj_files,required_subsystems,cflags)
 AC_DEFUN([SMB_SUBSYSTEM],
 [
 MAKE_SETTINGS="$MAKE_SETTINGS
-$1_OBJ_FILES = $2
 $1_CFLAGS = $4
 $1_ENABLE = YES
+$1_OBJ_FILES = $2
 "
 
 SMB_INFO_SUBSYSTEMS="$SMB_INFO_SUBSYSTEMS
@@ -43,10 +41,10 @@ dnl SMB_LIBRARY(name,obj_files,required_subsystems,cflags,ldflags)
 AC_DEFUN([SMB_LIBRARY],
 [
 MAKE_SETTINGS="$MAKE_SETTINGS
+$1_CFLAGS = $6
+$1_LDFLAGS = $7
+n1_ENABLE = YES
 $1_OBJ_FILES = $2
-$1_CFLAGS = $4
-$1_LDFLAGS = $5
-$1_ENABLE = YES
 "
 
 SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES
index 57bf0169fe7cea1dd8ec87493274e1771654bdcb..6c1798212e89d557f019062d580375f093d307bd 100644 (file)
@@ -56,3 +56,7 @@ clean::
 
 pydoctor:: pythonmods
        LD_LIBRARY_PATH=bin/shared PYTHONPATH=$(pythonbuilddir) pydoctor --project-name=Samba --project-url=http://www.samba.org --make-html --docformat=restructuredtext --add-package $(pythonbuilddir)/samba
+
+bin/python/%.py: 
+       mkdir -p $(@D)
+       cp $< $@
index faefb4e323ea2604e428802cb04c7ffb7df0ca70..078f5d9295b007ebc1382aae695658e48a232b46 100644 (file)
@@ -211,8 +211,9 @@ include/includes.d: include/includes.h
        @echo "Compiling $<"
        @-mkdir -p `dirname $@`
        @$(COMPILE) && exit 0 ; \
-       $(COMPILE) 
-
+               echo "The following command failed:" 1>&2;\
+               echo "$(COMPILE)" 1>&2;\
+               $(COMPILE) >/dev/null 2>&1
 
 
 .c.ho:
index eb20a686c1dd8c2db0e794d497b93d8a225b3117..3ca2f22f0c1991987213f7f628f8aa6d8fa0c6a7 100644 (file)
@@ -84,13 +84,19 @@ sub check_module($$$)
 
        return if ($mod->{ENABLE} ne "YES");
 
+
        if (exists($INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE})) {
                $mod->{INIT_FUNCTION_TYPE} = $INPUT->{$mod->{SUBSYSTEM}}{INIT_FUNCTION_TYPE};
        } else {
                $mod->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)";
        }
 
+       unless (defined($mod->{INIT_FUNCTION_SENTINEL})) { $mod->{INIT_FUNCTION_SENTINEL} = "NULL"; }
+
        if (not defined($mod->{OUTPUT_TYPE})) {
+               if (not defined($INPUT->{$mod->{SUBSYSTEM}}->{TYPE})) {
+                       die("Invalid type for subsystem $mod->{SUBSYSTEM}");
+               }
                if ($INPUT->{$mod->{SUBSYSTEM}}->{TYPE} eq "EXT_LIB") {
                        $mod->{OUTPUT_TYPE} = undef;
                } else {
@@ -119,16 +125,6 @@ sub check_library($$$)
 
        unless (defined($lib->{OUTPUT_TYPE})) { $lib->{OUTPUT_TYPE} = $default_ot; }
 
-       if (defined($lib->{VERSION}) and not defined($lib->{SO_VERSION})) {
-               print "$lib->{NAME}: Please specify SO_VERSION when specifying VERSION\n";
-               return;
-       }
-
-       if (defined($lib->{SO_VERSION}) and not defined($lib->{VERSION})) {
-               print "$lib->{NAME}: Please specify VERSION when specifying SO_VERSION\n";
-               return;
-       }
-
        unless (defined($lib->{INIT_FUNCTION_TYPE})) { $lib->{INIT_FUNCTION_TYPE} = "NTSTATUS (*) (void)"; }
        unless (defined($lib->{INIT_FUNCTION_SENTINEL})) { $lib->{INIT_FUNCTION_SENTINEL} = "NULL"; }
        unless (defined($lib->{INSTALLDIR})) { $lib->{INSTALLDIR} = "LIBDIR"; }
index a6abee6106c9621b2b05dffeebf391f7b076f7e4..ccaac0b6fcae08e73e77291512abb0d862ce53c5 100644 (file)
@@ -43,8 +43,7 @@ my $mkenv = new smb_build::makefile(\%config::config, $mkfile);
 
 my $shared_libs_used = 0;
 foreach my $key (values %$OUTPUT) {
-       $mkenv->_prepare_list($key, "OBJ_LIST");
-       push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_LIST)");
+       push(@{$mkenv->{all_objs}}, "\$($key->{NAME}_OBJ_FILES)");
 }
 
 foreach my $key (values %$OUTPUT) {
@@ -52,7 +51,7 @@ foreach my $key (values %$OUTPUT) {
 
        $mkenv->StaticLibraryPrimitives($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        $mkenv->MergedObj($key) if grep(/MERGED_OBJ/, @{$key->{OUTPUT_TYPE}});
-       $mkenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
+       $kenv->SharedLibraryPrimitives($key) if ($key->{TYPE} eq "LIBRARY") and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        if ($key->{TYPE} eq "LIBRARY" and 
            ${$key->{OUTPUT_TYPE}}[0] eq "SHARED_LIBRARY") {
@@ -68,21 +67,20 @@ foreach my $key (values %$OUTPUT) {
 foreach my $key (values %$OUTPUT) {
        next unless defined $key->{OUTPUT_TYPE};
 
-       $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
+       $mkenv->Integrated($key) if grep(/INTEGRATED/, @{$key->{OUTPUT_TYPE}});
 }
 
 foreach my $key (values %$OUTPUT) {
        next unless defined $key->{OUTPUT_TYPE};
-
        $mkenv->StaticLibrary($key) if grep(/STATIC_LIBRARY/, @{$key->{OUTPUT_TYPE}});
+
        $mkenv->SharedLibrary($key) if ($key->{TYPE} eq "LIBRARY") and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}});
        $mkenv->SharedModule($key) if ($key->{TYPE} eq "MODULE" and
                                        grep(/SHARED_LIBRARY/, @{$key->{OUTPUT_TYPE}}));
        $mkenv->PythonModule($key) if ($key->{TYPE} eq "PYTHON");
        $mkenv->Binary($key) if grep(/BINARY/, @{$key->{OUTPUT_TYPE}});
-       $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER}) or 
-                                        defined($key->{PUBLIC_PROTO_HEADER});
+       $mkenv->ProtoHeader($key) if defined($key->{PRIVATE_PROTO_HEADER});
        $mkenv->InitFunctions($key) if defined($key->{INIT_FUNCTIONS});
 }
 
index 1f66fabf726fac5d5732a9b9cbae1bebedf67d40..c56fdbf8cca6f13d8dd235b5ecbf3b5374b0d60b 100644 (file)
@@ -139,6 +139,14 @@ sub SharedModule($$)
        }
 }
 
+sub StaticLibraryPrimitives($$)
+{
+       my ($self,$ctx) = @_;
+       $self->output("$ctx->{NAME}_OUTPUT = $ctx->{OUTPUT}\n");
+       $self->_prepare_list($ctx, "FULL_OBJ_LIST");
+}
+
 sub SharedLibraryPrimitives($$)
 {
        my ($self,$ctx) = @_;
index 783e31d1ae622267ba55ed65a59f891d8157fb49..58e9e2d89b53af56db9002fac2d322e749af27e5 100644 (file)
@@ -187,7 +187,7 @@ static void cldapd_task_init(struct task_server *task)
        }
 
        cldapd->task = task;
-       cldapd->samctx = samdb_connect(cldapd, task->lp_ctx, anonymous_session(cldapd, task->lp_ctx));
+       cldapd->samctx = samdb_connect(cldapd, task->event_ctx, task->lp_ctx, anonymous_session(cldapd, task->event_ctx, task->lp_ctx));
        if (cldapd->samctx == NULL) {
                task_server_terminate(task, "cldapd failed to open samdb");
                return;
index 32a71e43afb3433bae332a2b4dd4c1f507a7672f..a524a6f8bdb3c1551ee28b44724dbaa85f0aa804 100644 (file)
@@ -20,7 +20,6 @@
 */
 
 #include "includes.h"
-#include "libcli/ldap/ldap_ndr.h"
 #include "lib/ldb/include/ldb.h"
 #include "lib/ldb/include/ldb_errors.h"
 #include "lib/events/events.h"
@@ -28,6 +27,7 @@
 #include "smbd/service_task.h"
 #include "cldap_server/cldap_server.h"
 #include "librpc/gen_ndr/ndr_misc.h"
+#include "libcli/ldap/ldap_ndr.h"
 #include "dsdb/samdb/samdb.h"
 #include "auth/auth.h"
 #include "ldb_wrap.h"
index 8e25dab92756969622859717438e297b4bf502ba..ce48c7bad1f7f73422b6bbb8038bdf7a6e6e22b4 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "libcli/resolve/resolve.h"
 #include "libcli/raw/libcliraw.h"
+#include "lib/events/events.h"
 
 #include "cifsdd.h"
 #include "param/param.h"
@@ -354,6 +355,7 @@ static void print_transfer_stats(void)
 }
 
 static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx, 
+                                     struct event_context *ev,
                                      const char * which, const char **ports,
                                      struct smbcli_options *smb_options)
 {
@@ -375,13 +377,13 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
 
        if (strcmp(which, "if") == 0) {
                path = check_arg_pathname("if");
-               handle = dd_open_path(resolve_ctx, path, ports, 
+               handle = dd_open_path(resolve_ctx, ev, path, ports,
                                      check_arg_numeric("ibs"), options,
                                      smb_options);
        } else if (strcmp(which, "of") == 0) {
                options |= DD_WRITE;
                path = check_arg_pathname("of");
-               handle = dd_open_path(resolve_ctx, path, ports, 
+               handle = dd_open_path(resolve_ctx, ev, path, ports,
                                      check_arg_numeric("obs"), options,
                                      smb_options);
        } else {
@@ -396,7 +398,7 @@ static struct dd_iohandle * open_file(struct resolve_context *resolve_ctx,
        return(handle);
 }
 
-static int copy_files(struct loadparm_context *lp_ctx)
+static int copy_files(struct event_context *ev, struct loadparm_context *lp_ctx)
 {
        uint8_t *       iobuf;  /* IO buffer. */
        uint64_t        iomax;  /* Size of the IO buffer. */
@@ -433,12 +435,12 @@ static int copy_files(struct loadparm_context *lp_ctx)
        DEBUG(4, ("IO buffer size is %llu, max xmit is %d\n",
                        (unsigned long long)iomax, options.max_xmit));
 
-       if (!(ifile = open_file(lp_resolve_context(lp_ctx), "if", 
+       if (!(ifile = open_file(lp_resolve_context(lp_ctx), ev, "if",
                                lp_smb_ports(lp_ctx), &options))) {
                return(FILESYS_EXIT_CODE);
        }
 
-       if (!(ofile = open_file(lp_resolve_context(lp_ctx), "of", 
+       if (!(ofile = open_file(lp_resolve_context(lp_ctx), ev, "of",
                                lp_smb_ports(lp_ctx), &options))) {
                return(FILESYS_EXIT_CODE);
        }
@@ -528,6 +530,7 @@ int main(int argc, const char ** argv)
 {
        int i;
        const char ** dd_args;
+       struct event_context *ev;
 
        poptContext pctx;
        struct poptOption poptions[] = {
@@ -578,6 +581,8 @@ int main(int argc, const char ** argv)
                }
        }
 
+       ev = event_context_init(talloc_autofree_context());
+
        gensec_init(cmdline_lp_ctx);
        dump_args();
 
@@ -599,7 +604,7 @@ int main(int argc, const char ** argv)
 
        CatchSignal(SIGINT, dd_handle_signal);
        CatchSignal(SIGUSR1, dd_handle_signal);
-       return(copy_files(cmdline_lp_ctx));
+       return(copy_files(ev, cmdline_lp_ctx));
 }
 
 /* vim: set sw=8 sts=8 ts=8 tw=79 : */
index 810c882ea9afb4502378c0eb2d5c386050fcb13c..21a4ad488222048da96c650a219b3ab6533fb7e1 100644 (file)
@@ -89,8 +89,10 @@ struct dd_iohandle
 #define DD_OPLOCK              0x00000008
 
 struct smbcli_options;
+struct event_context;
 
 struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
+                                 struct event_context *ev,
                                  const char * path,
                                  const char **ports,
                                uint64_t io_size, int options, 
index 7028e8507887e8a97d57a04fd9f74cbe528d579f..4297c300121ef6c4f57b379caa9005975619efb8 100644 (file)
@@ -221,6 +221,7 @@ static bool smb_write_func(void * handle, uint8_t * buf, uint64_t wanted,
 }
 
 static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ctx,
+                                             struct event_context *ev,
                                              const char * host,
                                              const char **ports,
                                              const char * share,
@@ -233,8 +234,9 @@ static struct smbcli_state * init_smb_session(struct resolve_context *resolve_ct
         * each connection, but for now, we just use the same one for both.
         */
        ret = smbcli_full_connection(NULL, &cli, host, ports, share,
-                        NULL /* devtype */, cmdline_credentials, resolve_ctx, 
-                        NULL /* events */, options);
+                                    NULL /* devtype */,
+                                    cmdline_credentials, resolve_ctx,
+                                    ev, options);
 
        if (!NT_STATUS_IS_OK(ret)) {
                fprintf(stderr, "%s: connecting to //%s/%s: %s\n",
@@ -293,6 +295,7 @@ static int open_smb_file(struct smbcli_state * cli,
 }
 
 static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx,
+                                            struct event_context *ev,
                                             const char * host,
                                        const char **ports,
                                        const char * share,
@@ -319,7 +322,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
        smbh->h.io_write = smb_write_func;
        smbh->h.io_seek = smb_seek_func;
 
-       if ((smbh->cli = init_smb_session(resolve_ctx, host, ports, share,
+       if ((smbh->cli = init_smb_session(resolve_ctx, ev, host, ports, share,
                                          smb_options)) == NULL) {
                return(NULL);
        }
@@ -336,6 +339,7 @@ static struct dd_iohandle * open_cifs_handle(struct resolve_context *resolve_ctx
 /* ------------------------------------------------------------------------- */
 
 struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx, 
+                                 struct event_context *ev,
                                  const char * path,
                                  const char **ports,
                                uint64_t io_size,
@@ -355,7 +359,7 @@ struct dd_iohandle * dd_open_path(struct resolve_context *resolve_ctx,
                        /* Skip over leading directory separators. */
                        while (*remain == '/' || *remain == '\\') { remain++; }
 
-                       return(open_cifs_handle(resolve_ctx, host, ports, 
+                       return(open_cifs_handle(resolve_ctx, ev, host, ports,
                                                share, remain,
                                                io_size, options, smb_options));
                }
index 775aa69d37d404e1e1d7f29c3c8499169a152525..79cc1b53820a4512f37147a15de5fbd78f217d88 100644 (file)
@@ -32,6 +32,7 @@
 #include "includes.h"
 #include "version.h"
 #include "libcli/libcli.h"
+#include "lib/events/events.h"
 #include "lib/cmdline/popt_common.h"
 #include "librpc/gen_ndr/ndr_srvsvc_c.h"
 #include "librpc/gen_ndr/ndr_lsa.h"
@@ -2545,7 +2546,9 @@ static void display_share_result(struct srvsvc_NetShareCtr1 *ctr1)
 /****************************************************************************
 try and browse available shares on a host
 ****************************************************************************/
-static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
+static bool browse_host(struct loadparm_context *lp_ctx,
+                       struct event_context *ev_ctx,
+                       const char *query_host)
 {
        struct dcerpc_pipe *p;
        char *binding;
@@ -2559,7 +2562,7 @@ static bool browse_host(struct loadparm_context *lp_ctx, const char *query_host)
 
        status = dcerpc_pipe_connect(mem_ctx, &p, binding, 
                                         &ndr_table_srvsvc,
-                                    cmdline_credentials, NULL,
+                                    cmdline_credentials, ev_ctx,
                                     lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Failed to connect to %s - %s\n", 
@@ -3021,6 +3024,7 @@ static int process_stdin(struct smbclient_context *ctx)
 return a connection to a server
 *******************************************************/
 static bool do_connect(struct smbclient_context *ctx, 
+                      struct event_context *ev_ctx,
                       struct resolve_context *resolve_ctx,
                       const char *specified_server, const char **ports, 
                       const char *specified_share, 
@@ -3044,8 +3048,7 @@ static bool do_connect(struct smbclient_context *ctx,
        
        status = smbcli_full_connection(ctx, &ctx->cli, server, ports,
                                        share, NULL, cred, resolve_ctx, 
-                                       cli_credentials_get_event_context(cred),
-                                       options);
+                                       ev_ctx, options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("Connection to \\\\%s\\%s failed - %s\n", 
                         server, share, nt_errstr(status));
@@ -3059,9 +3062,12 @@ static bool do_connect(struct smbclient_context *ctx,
 /****************************************************************************
 handle a -L query
 ****************************************************************************/
-static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host, const char *workgroup)
+static int do_host_query(struct loadparm_context *lp_ctx,
+                        struct event_context *ev_ctx,
+                        const char *query_host,
+                        const char *workgroup)
 {
-       browse_host(lp_ctx, query_host);
+       browse_host(lp_ctx, ev_ctx, query_host);
        list_servers(workgroup);
        return(0);
 }
@@ -3070,7 +3076,12 @@ static int do_host_query(struct loadparm_context *lp_ctx, const char *query_host
 /****************************************************************************
 handle a message operation
 ****************************************************************************/
-static int do_message_op(const char *netbios_name, const char *desthost, const char **destports, const char *destip, int name_type, struct resolve_context *resolve_ctx, struct smbcli_options *options)
+static int do_message_op(const char *netbios_name, const char *desthost,
+                        const char **destports, const char *destip,
+                        int name_type,
+                        struct event_context *ev_ctx,
+                        struct resolve_context *resolve_ctx,
+                        struct smbcli_options *options)
 {
        struct nbt_name called, calling;
        const char *server_name;
@@ -3082,7 +3093,9 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
 
        server_name = destip ? destip : desthost;
 
-       if (!(cli=smbcli_state_init(NULL)) || !smbcli_socket_connect(cli, server_name, destports, resolve_ctx, options)) {
+       if (!(cli = smbcli_state_init(NULL)) ||
+           !smbcli_socket_connect(cli, server_name, destports,
+                                  ev_ctx, resolve_ctx, options)) {
                d_printf("Connection to %s failed\n", server_name);
                return 1;
        }
@@ -3123,6 +3136,7 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
        int rc = 0;
        int name_type = 0x20;
        TALLOC_CTX *mem_ctx;
+       struct event_context *ev_ctx;
        struct smbclient_context *ctx;
        const char *cmdstr = NULL;
        struct smbcli_options smb_options;
@@ -3220,6 +3234,8 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
 
        lp_smbcli_options(cmdline_lp_ctx, &smb_options);
 
+       ev_ctx = event_context_init(talloc_autofree_context());
+
        DEBUG( 3, ( "Client started (version %s).\n", SAMBA_VERSION_STRING ) );
 
        if (query_host && (p=strchr_m(query_host,'#'))) {
@@ -3229,14 +3245,23 @@ static int do_message_op(const char *netbios_name, const char *desthost, const c
        }
   
        if (query_host) {
-               return do_host_query(cmdline_lp_ctx, query_host, lp_workgroup(cmdline_lp_ctx));
+               rc = do_host_query(cmdline_lp_ctx, ev_ctx, query_host,
+                                  lp_workgroup(cmdline_lp_ctx));
+               return rc;
        }
 
        if (message) {
-               return do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), dest_ip, name_type, lp_resolve_context(cmdline_lp_ctx), &smb_options);
+               rc = do_message_op(lp_netbios_name(cmdline_lp_ctx), desthost,
+                                  lp_smb_ports(cmdline_lp_ctx), dest_ip,
+                                  name_type, ev_ctx,
+                                  lp_resolve_context(cmdline_lp_ctx),
+                                  &smb_options);
+               return rc;
        }
        
-       if (!do_connect(ctx, lp_resolve_context(cmdline_lp_ctx), desthost, lp_smb_ports(cmdline_lp_ctx), service, cmdline_credentials, &smb_options))
+       if (!do_connect(ctx, ev_ctx, lp_resolve_context(cmdline_lp_ctx),
+                       desthost, lp_smb_ports(cmdline_lp_ctx), service,
+                       cmdline_credentials, &smb_options))
                return 1;
 
        if (base_directory) 
index 48c3c2ea4cf0f8fd61e00b5b84a6329de79d9959..0ed44cbad031611e96713d7c6a32491433c840bf 100644 (file)
@@ -21,7 +21,7 @@ extern int LogLevel;
 #define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
 
 #ifndef discard_const
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 #endif
 
 struct timeval timeval_zero(void);
index 2144d61dfcab0ec26486ef5c000b008a4c13ed4f..20bba7a0d93aa413955509da1537e58eca08261f 100644 (file)
@@ -49,14 +49,15 @@ struct sidmap_context {
 /*
   open a sidmap context - use talloc_free to close
 */
-struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+struct sidmap_context *sidmap_open(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, 
+                                  struct loadparm_context *lp_ctx)
 {
        struct sidmap_context *sidmap;
        sidmap = talloc(mem_ctx, struct sidmap_context);
        if (sidmap == NULL) {
                return NULL;
        }
-       sidmap->samctx = samdb_connect(sidmap, lp_ctx, system_session(sidmap, lp_ctx));
+       sidmap->samctx = samdb_connect(sidmap, ev_ctx, lp_ctx, system_session(sidmap, lp_ctx));
        if (sidmap->samctx == NULL) {
                talloc_free(sidmap);
                return NULL;
index 3375059e99e00e58976f4a0af4e59105ad4dcd63..e485c50a473d5e94f0199adc37bbeceb4c492508 100644 (file)
@@ -51,7 +51,7 @@ static WERROR dreplsrv_connect_samdb(struct dreplsrv_service *service, struct lo
        const struct GUID *ntds_guid;
        struct drsuapi_DsBindInfo28 *bind_info28;
 
-       service->samdb = samdb_connect(service, lp_ctx, service->system_session_info);
+       service->samdb = samdb_connect(service, service->task->event_ctx, lp_ctx, service->system_session_info);
        if (!service->samdb) {
                return WERR_DS_SERVICE_UNAVAILABLE;
        }
index b9333e451bade34a437f63b53f749673cb0977d0..da10cbb0577fda7032ceab332e6bdbd02567605f 100644 (file)
@@ -1197,6 +1197,7 @@ NTSTATUS crack_service_principal_name(struct ldb_context *sam_ctx,
 }
 
 NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx, 
+                               struct event_context *ev_ctx, 
                                struct loadparm_context *lp_ctx,
                                uint32_t format_offered,
                                const char *name, 
@@ -1214,7 +1215,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
                return NT_STATUS_OK;
        }
 
-       ldb = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
+       ldb = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
        if (ldb == NULL) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
@@ -1259,6 +1260,7 @@ NTSTATUS crack_name_to_nt4_name(TALLOC_CTX *mem_ctx,
 }
 
 NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
+                                    struct event_context *ev_ctx, 
                                     struct loadparm_context *lp_ctx,
                                     const char *name,
                                     const char **nt4_domain,
@@ -1283,5 +1285,5 @@ NTSTATUS crack_auto_name_to_nt4_name(TALLOC_CTX *mem_ctx,
                format_offered = DRSUAPI_DS_NAME_FORMAT_CANONICAL;
        }
 
-       return crack_name_to_nt4_name(mem_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
+       return crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, format_offered, name, nt4_domain, nt4_account);
 }
index 1708c66d4471c96b77c0d46f0f4c466e69af9623..69bfa14da09ed6db4094c4d3b1a8eb2dc5c9f2b6 100644 (file)
@@ -4,7 +4,11 @@
 SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LIBNDR NDR_MISC
+<<<<<<< HEAD:source/dsdb/samdb/ldb_modules/config.mk
 INIT_FUNCTION = LDB_MODULE(objectguid)
+=======
+INIT_FUNCTION = objectguid_module_module_ops
+>>>>>>> 5f3a70f285ad8a412105c0e498e486f93fc279bc:source/dsdb/samdb/ldb_modules/config.mk
 # End MODULE ldb_objectguid
 ################################################
 
@@ -21,7 +25,8 @@ INIT_FUNCTION = LDB_MODULE(repl_meta_data)
 # End MODULE ldb_repl_meta_data
 ################################################
 
-ldb_repl_meta_data_OBJ_FILES = dsdb/samdb/ldb_modules/repl_meta_data.o
+ldb_repl_meta_data_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/repl_meta_data.o
 
 ################################################
 # Start MODULE ldb_dsdb_cache
@@ -33,7 +38,8 @@ INIT_FUNCTION = LDB_MODULE(dsdb_cache)
 # End MODULE ldb_dsdb_cache
 ################################################
 
-ldb_dsdb_cache_OBJ_FILES = dsdb/samdb/ldb_modules/dsdb_cache.o
+ldb_dsdb_cache_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/dsdb_cache.o
 
 ################################################
 # Start MODULE ldb_schema_fsmo
@@ -45,7 +51,8 @@ INIT_FUNCTION = LDB_MODULE(schema_fsmo)
 # End MODULE ldb_schema_fsmo
 ################################################
 
-ldb_schema_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/schema_fsmo.o
+ldb_schema_fsmo_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/schema_fsmo.o
 
 ################################################
 # Start MODULE ldb_naming_fsmo
@@ -57,7 +64,8 @@ INIT_FUNCTION = LDB_MODULE(naming_fsmo)
 # End MODULE ldb_naming_fsmo
 ################################################
 
-ldb_naming_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/naming_fsmo.o
+ldb_naming_fsmo_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/naming_fsmo.o
 
 ################################################
 # Start MODULE ldb_pdc_fsmo
@@ -69,7 +77,8 @@ INIT_FUNCTION = LDB_MODULE(pdc_fsmo)
 # End MODULE ldb_pdc_fsmo
 ################################################
 
-ldb_pdc_fsmo_OBJ_FILES = dsdb/samdb/ldb_modules/pdc_fsmo.o
+ldb_pdc_fsmo_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/pdc_fsmo.o
 
 ################################################
 # Start MODULE ldb_samldb
@@ -78,10 +87,12 @@ SUBSYSTEM = LIBLDB
 OUTPUT_TYPE = SHARED_LIBRARY
 PRIVATE_DEPENDENCIES = LIBTALLOC LDAP_ENCODE NDR_MISC SAMDB
 INIT_FUNCTION = LDB_MODULE(samldb)
+#
 # End MODULE ldb_samldb
 ################################################
 
-ldb_samldb_OBJ_FILES = dsdb/samdb/ldb_modules/samldb.o
+ldb_samldb_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/samldb.o
 
 ################################################
 # Start MODULE ldb_samba3sam
@@ -94,7 +105,8 @@ PRIVATE_DEPENDENCIES = LIBTALLOC ldb_map SMBPASSWD NSS_WRAPPER LIBSECURITY \
 # End MODULE ldb_samldb
 ################################################
 
-ldb_samba3sam_OBJ_FILES = dsdb/samdb/ldb_modules/samba3sam.o
+ldb_samba3sam_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/samba3sam.o
 
 ################################################
 # Start MODULE ldb_simple_ldap_map
@@ -108,7 +120,8 @@ ALIASES = entryuuid nsuniqueid
 # End MODULE ldb_entryuuid
 ################################################
 
-ldb_simple_ldap_map_OBJ_FILES = dsdb/samdb/ldb_modules/simple_ldap_map.o
+ldb_simple_ldap_map_OBJ_FILES = \
+               dsdb/samdb/ldb_modules/simple_ldap_map.o
 
 # ################################################
 # # Start MODULE ldb_proxy
index 3235b24ef90a4ce71dc4f0de67b1f1c0f2dc14c5..50f333d09572bfd6d70150641f748ff5be174531 100644 (file)
@@ -26,6 +26,7 @@
 #include "lib/ldb/include/ldb_private.h"
 #include "system/time.h"
 #include "dsdb/samdb/samdb.h"
+#include "version.h"
 
 struct private_data {
        int num_controls;
@@ -202,6 +203,13 @@ static int rootdse_add_dynamic(struct ldb_module *module, struct ldb_message *ms
                }
        }
 
+       if (schema && do_attribute_explicit(attrs, "vendorVersion")) {
+               if (ldb_msg_add_fmt(msg, "vendorVersion", 
+                                   "%s", SAMBA_VERSION_STRING) != 0) {
+                       goto failed;
+               }
+       }
+
        /* TODO: lots more dynamic attributes should be added here */
 
        return LDB_SUCCESS;
index 3b67ca19d35b2c55434770ebba90cfa07a0feb60..88590f306beddbf2a6712f5ca49202f727b2af39 100644 (file)
@@ -484,8 +484,7 @@ static int samldb_fill_group_object(struct ldb_module *module, const struct ldb_
        return ret;
 }
 
-static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg,
-                                                              struct ldb_message **ret_msg)
+static int samldb_fill_user_or_computer_object(struct ldb_module *module, const struct ldb_message *msg, struct ldb_message **ret_msg)
 {
        int ret;
        char *name;
index 54362dcfd47157b4fac33f57cddd4de6969e5cf1..b36c2c9b71443f20ef0454b9142c79df7f0b69da 100644 (file)
@@ -90,7 +90,7 @@ static int add_modified(struct ldb_module *module, struct ldb_dn *dn, bool delet
        }
 
        cli_credentials_set_conf(item->creds, ldb_get_opaque(module->ldb, "loadparm"));
-       status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
+       status = cli_credentials_set_secrets(item->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"), module->ldb, NULL, filter);
        talloc_free(filter);
        if (NT_STATUS_IS_OK(status)) {
                if (delete) {
@@ -158,7 +158,7 @@ static int update_kt_end_trans(struct ldb_module *module)
        struct dn_list *p;
        for (p=data->changed_dns; p; p = p->next) {
                int kret;
-               kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "loadparm"));
+               kret = cli_credentials_update_keytab(p->creds, ldb_get_opaque(module->ldb, "EventContext"), ldb_get_opaque(module->ldb, "loadparm"));
                if (kret != 0) {
                        talloc_free(data->changed_dns);
                        data->changed_dns = NULL;
index a01e4425878a4e134c75b6b6f55f6d9fb5fb8eb7..9154f5382ba6eebd7ef93598247be6a4c9e68414 100644 (file)
@@ -37,6 +37,7 @@
 #include "dsdb/samdb/samdb.h"
 #include "dsdb/common/flags.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 char *samdb_relative_path(struct ldb_context *ldb,
                                 TALLOC_CTX *mem_ctx, 
@@ -71,11 +72,12 @@ char *samdb_relative_path(struct ldb_context *ldb,
   return an opaque context pointer on success, or NULL on failure
  */
 struct ldb_context *samdb_connect(TALLOC_CTX *mem_ctx, 
+                                 struct event_context *ev_ctx,
                                  struct loadparm_context *lp_ctx,
                                  struct auth_session_info *session_info)
 {
        struct ldb_context *ldb;
-       ldb = ldb_wrap_connect(mem_ctx, lp_ctx, 
+       ldb = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, 
                               lp_sam_url(lp_ctx), session_info,
                               NULL, 0, NULL);
        if (!ldb) {
@@ -98,6 +100,8 @@ int samdb_copy_template(struct ldb_context *ldb,
        struct ldb_context *templates_ldb;
        char *templates_ldb_path; 
        struct ldb_dn *basedn;
+       struct event_context *event_ctx;
+       struct loadparm_context *lp_ctx;
 
        templates_ldb = talloc_get_type(ldb_get_opaque(ldb, "templates_ldb"), struct ldb_context);
 
@@ -109,8 +113,17 @@ int samdb_copy_template(struct ldb_context *ldb,
                        *errstring = talloc_asprintf(msg, "samdb_copy_template: ERROR: Failed to contruct path for template db");
                        return LDB_ERR_OPERATIONS_ERROR;
                }
+               
+               event_ctx = (struct event_context *)ldb_get_opaque(ldb, "EventContext");
+               lp_ctx = (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm");
+
+               /* FIXME: need to remove this wehn we finally pass the event
+                * context around in ldb */
+               if (event_ctx == NULL) {
+                       event_ctx = event_context_init(templates_ldb);
+               }
 
-               templates_ldb = ldb_wrap_connect(ldb, (struct loadparm_context *)ldb_get_opaque(ldb, "loadparm")
+               templates_ldb = ldb_wrap_connect(ldb, event_ctx, lp_ctx
                                                templates_ldb_path, NULL,
                                                NULL, 0, NULL);
                talloc_free(templates_ldb_path);
@@ -184,6 +197,7 @@ int samdb_copy_template(struct ldb_context *ldb,
  Create the SID list for this user.
 ****************************************************************************/
 NTSTATUS security_token_create(TALLOC_CTX *mem_ctx, 
+                              struct event_context *ev_ctx, 
                               struct loadparm_context *lp_ctx,
                               struct dom_sid *user_sid,
                               struct dom_sid *group_sid, 
@@ -242,7 +256,7 @@ NTSTATUS security_token_create(TALLOC_CTX *mem_ctx,
        }
 
        /* setup the privilege mask for this token */
-       status = samdb_privilege_setup(lp_ctx, ptoken);
+       status = samdb_privilege_setup(ev_ctx, lp_ctx, ptoken);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(ptoken);
                return status;
index 5d8694d2d499fbc839a790f2ebd2b0fe4b4296d2..9e02ef76c6271e6a9649aef8099ae107b2c23162 100644 (file)
@@ -27,6 +27,7 @@ struct dsdb_control_current_partition;
 struct dsdb_extended_replicated_object;
 struct dsdb_extended_replicated_objects;
 struct loadparm_context;
+struct event_context;
 
 #include "librpc/gen_ndr/security.h"
 #include "lib/ldb/include/ldb.h"
index 5c2de81816c97b26e8a92328a37badd1eebe4da6..688d1ef9de3da4586d3337f2fbee4573a85c7c48 100644 (file)
@@ -73,7 +73,8 @@ static NTSTATUS samdb_privilege_setup_sid(void *samctx, TALLOC_CTX *mem_ctx,
   setup the privilege mask for this security token based on our
   local SAM
 */
-NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_token *token)
+NTSTATUS samdb_privilege_setup(struct event_context *ev_ctx, 
+                              struct loadparm_context *lp_ctx, struct security_token *token)
 {
        void *samctx;
        TALLOC_CTX *mem_ctx;
@@ -97,7 +98,7 @@ NTSTATUS samdb_privilege_setup(struct loadparm_context *lp_ctx, struct security_
        }
 
        mem_ctx = talloc_new(token);
-       samctx = samdb_connect(mem_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
+       samctx = samdb_connect(mem_ctx, ev_ctx, lp_ctx, system_session(mem_ctx, lp_ctx));
        if (samctx == NULL) {
                talloc_free(mem_ctx);
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
index d983b77b40dc01efaa1610b01457faa4ed9da994..9c7b1f6457a85dbec24008f67de1bfb435220d6f 100644 (file)
@@ -50,6 +50,7 @@
 #include "librpc/gen_ndr/ndr_drsblobs.h"
 #include "libcli/auth/libcli_auth.h"
 #include "param/param.h"
+#include "events/events.h"
 
 enum hdb_ldb_ent_type 
 { HDB_LDB_ENT_TYPE_CLIENT, HDB_LDB_ENT_TYPE_SERVER, 
@@ -1106,6 +1107,7 @@ static krb5_error_code LDB_destroy(krb5_context context, HDB *db)
  * code */
 
 NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx, 
+                           struct event_context *ev_ctx, 
                            struct loadparm_context *lp_ctx,
                            krb5_context context, struct HDB **db, const char *arg)
 {
@@ -1137,7 +1139,7 @@ NTSTATUS kdc_hdb_ldb_create(TALLOC_CTX *mem_ctx,
                                           CRED_DONT_USE_KERBEROS);
 
        /* Setup the link to LDB */
-       (*db)->hdb_db = samdb_connect(*db, lp_ctx, session_info);
+       (*db)->hdb_db = samdb_connect(*db, ev_ctx, lp_ctx, session_info);
        if ((*db)->hdb_db == NULL) {
                DEBUG(1, ("hdb_ldb_create: Cannot open samdb for KDC backend!"));
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
@@ -1168,7 +1170,7 @@ krb5_error_code hdb_ldb_create(krb5_context context, struct HDB **db, const char
 {
        NTSTATUS nt_status;
        /* The global kdc_mem_ctx and kdc_lp_ctx, Disgusting, ugly hack, but it means one less private hook */
-       nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, kdc_lp_ctx, 
+       nt_status = kdc_hdb_ldb_create(kdc_mem_ctx, event_context_find(kdc_mem_ctx), kdc_lp_ctx, 
                                       context, db, arg);
 
        if (NT_STATUS_IS_OK(nt_status)) {
index 72b5bb14a93c531b266d67a105def35e45632119..84d9d45f5768310705877707a41dbf33f3d578d8 100644 (file)
@@ -624,7 +624,7 @@ static void kdc_task_init(struct task_server *task)
        }
        kdc->config->num_db = 1;
                
-       status = kdc_hdb_ldb_create(kdc, task->lp_ctx, 
+       status = kdc_hdb_ldb_create(kdc, task->event_ctx, task->lp_ctx, 
                                    kdc->smb_krb5_context->krb5_context, 
                                    &kdc->config->db[0], NULL);
        if (!NT_STATUS_IS_OK(status)) {
index f468fea6c4466a532c0116ceb15c05a09ca01953..1d49a8a4bd23d726fe56754cd6fd6cd3fbfe63b1 100644 (file)
@@ -180,7 +180,7 @@ static bool kpasswdd_change_password(struct kdc_server *kdc,
        struct samr_DomInfo1 *dominfo;
        struct ldb_context *samdb;
 
-       samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
+       samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, system_session(mem_ctx, kdc->task->lp_ctx));
        if (!samdb) {
                return kpasswdd_make_error_reply(kdc, mem_ctx, 
                                                KRB5_KPASSWD_HARDERROR,
@@ -310,7 +310,7 @@ static bool kpasswd_process_request(struct kdc_server *kdc,
                
                krb5_free_principal(context, principal);
                
-               samdb = samdb_connect(mem_ctx, kdc->task->lp_ctx, session_info);
+               samdb = samdb_connect(mem_ctx, kdc->task->event_ctx, kdc->task->lp_ctx, session_info);
                if (!samdb) {
                        return kpasswdd_make_error_reply(kdc, mem_ctx, 
                                                         KRB5_KPASSWD_HARDERROR,
@@ -474,7 +474,7 @@ bool kpasswdd_process(struct kdc_server *kdc,
         * we already have, rather than a new context */        
        cli_credentials_set_krb5_context(server_credentials, kdc->smb_krb5_context);
        cli_credentials_set_conf(server_credentials, kdc->task->lp_ctx);
-       nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->lp_ctx, "kadmin/changepw");
+       nt_status = cli_credentials_set_stored_principal(server_credentials, kdc->task->event_ctx, kdc->task->lp_ctx, "kadmin/changepw");
        if (!NT_STATUS_IS_OK(nt_status)) {
                ret = kpasswdd_make_unauth_error_reply(kdc, mem_ctx, 
                                                       KRB5_KPASSWD_HARDERROR,
index 9b43d7bd742ca757cc76089d1ab5c214b2bb60fe..9047773529906a5a55a138e3d3a8c3095b90a303 100644 (file)
@@ -27,6 +27,7 @@
 #include "auth/credentials/credentials.h"
 #include "auth/gensec/gensec.h"
 #include "param/param.h"
+#include "smbd/service_stream.h"
 
 #define VALID_DN_SYNTAX(dn,i) do {\
        if (!(dn)) {\
@@ -56,6 +57,7 @@ static int map_ldb_error(struct ldb_context *ldb, int err, const char **errstrin
 NTSTATUS ldapsrv_backend_Init(struct ldapsrv_connection *conn) 
 {
        conn->ldb = ldb_wrap_connect(conn, 
+                                    conn->connection->event.ctx,
                                     conn->lp_ctx,
                                     lp_sam_url(conn->lp_ctx), 
                                     conn->session_info,
index f2c974ae3f76eab52f89f82a409e772e8dabc88e..f37ef31c0adb15057e77e75bfca0a449072e5384 100644 (file)
@@ -44,7 +44,7 @@ static NTSTATUS ldapsrv_BindSimple(struct ldapsrv_call *call)
 
        DEBUG(10, ("BindSimple dn: %s\n",req->dn));
 
-       status = crack_auto_name_to_nt4_name(call, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
+       status = crack_auto_name_to_nt4_name(call, call->conn->connection->event.ctx, call->conn->lp_ctx, req->dn, &nt4_domain, &nt4_account);
        if (NT_STATUS_IS_OK(status)) {
                status = authenticate_username_pw(call,
                                                  call->conn->connection->event.ctx,
index 11cb63e07bf2f3d753b11c9cfb576f345cb5f349..197f84692c14bb82cdce6cdba01acc61b3dc7110 100644 (file)
@@ -409,7 +409,7 @@ static void ldapsrv_accept(struct stream_connection *c)
        conn->server_credentials = server_credentials;
 
        /* Connections start out anonymous */
-       if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, conn->lp_ctx, &conn->session_info))) {
+       if (!NT_STATUS_IS_OK(auth_anonymous_session_info(conn, c->event.ctx, conn->lp_ctx, &conn->session_info))) {
                ldapsrv_terminate_connection(conn, "failed to setup anonymous session info");
                return;
        }
@@ -478,7 +478,8 @@ static NTSTATUS add_socket(struct event_context *event_context,
        }
 
        /* Load LDAP database */
-       ldb = samdb_connect(ldap_service, lp_ctx, system_session(ldap_service, lp_ctx));
+       ldb = samdb_connect(ldap_service, ldap_service->task->event_ctx, 
+                           lp_ctx, system_session(ldap_service, lp_ctx));
        if (!ldb) {
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
index 52b23608aa7e403846355e4be88c67c2b747f35b..381815eb231a9c83cdabdc73def1d6c7bbf3bcc4 100644 (file)
@@ -31,6 +31,7 @@
 
 #include       "miniMpr.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 /************************************ Code ************************************/
 #if !BLD_APPWEB
@@ -50,6 +51,11 @@ void *mprMemCtx(void)
        return mpr_ctx;
 }
 
+struct event_context *mprEventCtx(void)
+{
+       return event_context_find(mprMemCtx());
+}
+
 /* return the loadparm context being used for all ejs variables */
 struct loadparm_context *mprLpCtx(void)
 {
index 15ce30c8df9d52eef3d723ee41d888fe197465dc..2b8ff0af6a98c79682ec980d0b3a5573c3efcff2 100644 (file)
@@ -274,6 +274,8 @@ extern void mprSetCtx(void *ctx);
 extern void *mprMemCtx(void);
 struct loadparm_context;
 extern struct loadparm_context *mprLpCtx(void);
+struct event_context;
+extern struct event_context *mprEventCtx(void);
 
 /* This function needs to be provided by anyone using ejs */
 void ejs_exception(const char *reason);
index f9c0ee06658536bdc3230b06d482b62ac215ab70..71acb944923e5f6cf09879683a3a78c2ff4e1f8a 100644 (file)
@@ -5,7 +5,6 @@ mkinclude charset/config.mk
 mkinclude ldb-samba/config.mk
 mkinclude tls/config.mk
 mkinclude registry/config.mk
-mkinclude policy/config.mk
 mkinclude messaging/config.mk
 mkinclude events/config.mk
 mkinclude cmdline/config.mk
@@ -41,3 +40,5 @@ PUBLIC_DEPENDENCIES = LIBTDB
 
 TDB_WRAP_OBJ_FILES = lib/tdb_wrap.o
 PUBLIC_HEADERS += lib/tdb_wrap.h
+
+SMBREADLINE_OBJ_LIST = $(SMBREADLINE_OBJ_FILES)
index da92036342c5903067e6ff43406e685135222f44..e5a1316c47064318b6a607c625a07221a8e6f3da 100644 (file)
@@ -33,10 +33,8 @@ EVENTS_STANDARD_OBJ_FILES = lib/events/events_standard.o
 
 ##############################
 # Start SUBSYSTEM LIBEVENTS
-[LIBRARY::LIBEVENTS]
+[SUBSYSTEM::LIBEVENTS]
 PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL
-SO_VERSION = 0
-VERSION = 0.0.1
 # End SUBSYSTEM LIBEVENTS
 ##############################
 
index 969abeae468e14aad13bc0d608322f2e1b2cd234..6f45db512a1b3aecd7143433f0646d2f71e541aa 100644 (file)
@@ -102,6 +102,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 e01a1107d25c42f3d3488b4f7cd3e0e00e57032e..6b94f19cb5b565f68e07cb87abc68f9e63ba618e 100644 (file)
@@ -251,6 +251,14 @@ fail:
 
 #ifdef SWIGPYTHON
 %{
+struct ldb_context *ldb_context_from_py_object(PyObject *py_obj)
+{
+        struct ldb_context *ldb_ctx;
+    if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 |  0 ) < 0)
+        return NULL;
+    return ldb_ctx;
+}
+
 int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, 
                          struct ldb_context *ldb_ctx, ldb_dn **dn)
 {
index 0bcfd36779b806cac759448b86e0d58ad763a596..b148782c63aac297bfc286f193f1cb3e6b2bb601 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -99,7 +99,7 @@ Dn_swigregister(Dn)
 
 class ldb_msg_element(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    def __init__(self): raise AttributeError, "No constructor defined"
+    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
     __swig_destroy__ = _ldb.delete_ldb_msg_element
     def __getitem__(self, i):
index 79958a86eba121d6f7dc5dc9bfde6ea806757c18..6b50b2f5eba73a050f243d6d745c078a66a7cfb1 100644 (file)
@@ -737,6 +737,7 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
        struct ildb_private *ildb;
        NTSTATUS status;
        struct cli_credentials *creds;
+       struct event_context *event_ctx;
 
        module = talloc(ldb, struct ldb_module);
        if (!module) {
@@ -756,8 +757,19 @@ static int ildb_connect(struct ldb_context *ldb, const char *url,
        }
        module->private_data    = ildb;
        ildb->module            = module;
-       ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"), 
-                                         ldb_get_opaque(ldb, "EventContext"));
+
+       event_ctx = ldb_get_opaque(ldb, "EventContext");
+
+       /* FIXME: We must make the event context an explicit parameter, but we
+        * need to build the events library separately first. Hack a new event
+        * context so that CMD line utilities work until we have libevents for
+        * standalone builds ready */
+       if (event_ctx == NULL) {
+               event_ctx = event_context_init(NULL);
+       }
+
+       ildb->ldap = ldap4_new_connection(ildb, ldb_get_opaque(ldb, "loadparm"),
+                                         event_ctx);
        if (!ildb->ldap) {
                ldb_oom(ldb);
                goto failed;
index d8776f48e254a53df309754a44f67acb3e1d98ac..1b6d9feed6117cd5175176c347540e560af54ca6 100644 (file)
@@ -545,7 +545,7 @@ static int ltdb_index_dn_one(struct ldb_module *module,
 
        /* the attribute is indexed. Pull the list of DNs that match the 
           search criterion */
-       val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(parent_dn));
+       val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(parent_dn));
        val.length = strlen((char *)val.data);
        key = ltdb_index_key(ldb, LTDB_IDXONE, &val);
        if (!key) {
@@ -1140,7 +1140,7 @@ int ltdb_index_one(struct ldb_module *module, const struct ldb_message *msg, int
                return LDB_ERR_OPERATIONS_ERROR;
        }
 
-       val.data = (uint8_t *)((intptr_t)ldb_dn_get_casefold(pdn));
+       val.data = (uint8_t *)((uintptr_t)ldb_dn_get_casefold(pdn));
        if (val.data == NULL) {
                talloc_free(pdn);
                return LDB_ERR_OPERATIONS_ERROR;
index 082c6d9cad538548b02a5c70e4f74854d21fe7e0..390652eebe60db8ac125fe04109276fee106ed17 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
-    PyErr_Format(PyExc_RuntimeError, mesg);
+    PyErr_SetString(PyExc_RuntimeError, mesg);
   }
 }
 
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
 {
   PySwigObject *sobj = (PySwigObject *) v;
   PyObject *next = sobj->next;
-  if (sobj->own) {
+  if (sobj->own == SWIG_POINTER_OWN) {
     swig_type_info *ty = sobj->ty;
     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
     PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
        res = ((*meth)(mself, v));
       }
       Py_XDECREF(res);
-    } else {
-      const char *name = SWIG_TypePrettyName(ty);
+    } 
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
     }
+#endif
   } 
   Py_XDECREF(next);
   PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
 
 SWIGRUNTIME int
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own) {
+  if (own == SWIG_POINTER_OWN) {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
     if (sobj) {
       int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
     return SWIG_OK;
   } else {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
     while (sobj) {
       void *vptr = sobj->ptr;
       if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
          if (!tc) {
            sobj = (PySwigObject *)sobj->next;
          } else {
-           if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+           if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
            break;
          }
        }
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
       }
     }
     if (sobj) {
-      if (own) *own = sobj->own;
+      if (own)
+        *own = *own | sobj->own;
       if (flags & SWIG_POINTER_DISOWN) {
        sobj->own = 0;
       }
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
     }
     if (ty) {
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (!tc) return SWIG_ERROR;
-      *ptr = SWIG_TypeCast(tc,vptr);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
     } else {
       *ptr = vptr;
     }
@@ -2471,7 +2489,7 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_ldb_module_ops swig_types[9]
 #define SWIGTYPE_p_ldb_result swig_types[10]
 #define SWIGTYPE_p_ldb_val swig_types[11]
-#define SWIGTYPE_p_long swig_types[12]
+#define SWIGTYPE_p_long_long swig_types[12]
 #define SWIGTYPE_p_p_char swig_types[13]
 #define SWIGTYPE_p_p_ldb_control swig_types[14]
 #define SWIGTYPE_p_p_ldb_result swig_types[15]
@@ -2480,10 +2498,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_unsigned_char swig_types[18]
 #define SWIGTYPE_p_unsigned_int swig_types[19]
 #define SWIGTYPE_p_unsigned_long swig_types[20]
-#define SWIGTYPE_p_unsigned_short swig_types[21]
-#define SWIGTYPE_p_void swig_types[22]
-static swig_type_info *swig_types[24];
-static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
+#define SWIGTYPE_p_unsigned_long_long swig_types[21]
+#define SWIGTYPE_p_unsigned_short swig_types[22]
+#define SWIGTYPE_p_void swig_types[23]
+static swig_type_info *swig_types[25];
+static swig_module_info swig_module = {swig_types, 24, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2515,7 +2534,7 @@ static swig_module_info swig_module = {swig_types, 23, 0, 0, 0, 0};
 
 #define SWIG_name    "_ldb"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2706,6 +2725,14 @@ SWIGINTERN ldb_dn *ldb_dn___add__(ldb_dn *self,ldb_dn *other){
             return ret;
         }
 
+struct ldb_context *ldb_context_from_py_object(PyObject *py_obj)
+{
+        struct ldb_context *ldb_ctx;
+    if (SWIG_ConvertPtr(py_obj, (void *)&ldb_ctx, SWIGTYPE_p_ldb_context, 0 |  0 ) < 0)
+        return NULL;
+    return ldb_ctx;
+}
+
 int ldb_dn_from_pyobject(TALLOC_CTX *mem_ctx, PyObject *object, 
                          struct ldb_context *ldb_ctx, ldb_dn **dn)
 {
@@ -4193,7 +4220,10 @@ check_1:
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n  Possible C/C++ prototypes are:\n""    __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n""    __setitem__(ldb_msg *,char const *,PyObject *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'Message___setitem__'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    __setitem__(ldb_msg *,char const *,ldb_msg_element *)\n"
+    "    __setitem__(ldb_msg *,char const *,PyObject *)\n");
   return NULL;
 }
 
@@ -5711,7 +5741,7 @@ static PyMethodDef SwigMethods[] = {
 static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void = {"_p_f_p_void_enum_ldb_debug_level_p_q_const__char_va_list__void", "void (*)(void *,enum ldb_debug_level,char const *,va_list)", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "int *|int_least32_t *|int32_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *|ldb *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_dn = {"_p_ldb_dn", "struct ldb_dn *|ldb_dn *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_ldif = {"_p_ldb_ldif", "struct ldb_ldif *|ldb_ldif *", 0, 0, (void*)0, 0};
@@ -5720,15 +5750,16 @@ static swig_type_info _swigt__p_ldb_message_element = {"_p_ldb_message_element",
 static swig_type_info _swigt__p_ldb_module_ops = {"_p_ldb_module_ops", "struct ldb_module_ops *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_result = {"_p_ldb_result", "struct ldb_result *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_ldb_val = {"_p_ldb_val", "struct ldb_val *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_long = {"_p_long", "intptr_t *|int_least64_t *|int_fast32_t *|int_fast64_t *|int64_t *|long *|int_fast16_t *|intmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_ldb_control = {"_p_p_ldb_control", "struct ldb_control **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_p_ldb_result = {"_p_p_ldb_result", "struct ldb_result **", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uint_least32_t *|uint32_t *|unsigned int *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "uintptr_t *|uint_least64_t *|uint_fast32_t *|uint_fast64_t *|uint64_t *|unsigned long *|time_t *|uint_fast16_t *|uintmax_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_long = {"_p_unsigned_long", "unsigned long *|time_t *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_void = {"_p_void", "void *", 0, 0, (void*)0, 0};
 
@@ -5745,7 +5776,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_ldb_module_ops,
   &_swigt__p_ldb_result,
   &_swigt__p_ldb_val,
-  &_swigt__p_long,
+  &_swigt__p_long_long,
   &_swigt__p_p_char,
   &_swigt__p_p_ldb_control,
   &_swigt__p_p_ldb_result,
@@ -5754,6 +5785,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_unsigned_char,
   &_swigt__p_unsigned_int,
   &_swigt__p_unsigned_long,
+  &_swigt__p_unsigned_long_long,
   &_swigt__p_unsigned_short,
   &_swigt__p_void,
 };
@@ -5770,7 +5802,7 @@ static swig_cast_info _swigc__p_ldb_message_element[] = {  {&_swigt__p_ldb_messa
 static swig_cast_info _swigc__p_ldb_module_ops[] = {  {&_swigt__p_ldb_module_ops, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ldb_result[] = {  {&_swigt__p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_ldb_val[] = {  {&_swigt__p_ldb_val, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_long[] = {  {&_swigt__p_long, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_long_long[] = {  {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_char[] = {  {&_swigt__p_p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_ldb_control[] = {  {&_swigt__p_p_ldb_control, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_p_ldb_result[] = {  {&_swigt__p_p_ldb_result, 0, 0, 0},{0, 0, 0, 0}};
@@ -5779,6 +5811,7 @@ static swig_cast_info _swigc__p_signed_char[] = {  {&_swigt__p_signed_char, 0, 0
 static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_long[] = {  {&_swigt__p_unsigned_long, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_unsigned_long_long[] = {  {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_unsigned_short[] = {  {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_void[] = {  {&_swigt__p_void, 0, 0, 0},{0, 0, 0, 0}};
 
@@ -5795,7 +5828,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_ldb_module_ops,
   _swigc__p_ldb_result,
   _swigc__p_ldb_val,
-  _swigc__p_long,
+  _swigc__p_long_long,
   _swigc__p_p_char,
   _swigc__p_p_ldb_control,
   _swigc__p_p_ldb_result,
@@ -5804,6 +5837,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_unsigned_char,
   _swigc__p_unsigned_int,
   _swigc__p_unsigned_long,
+  _swigc__p_unsigned_long_long,
   _swigc__p_unsigned_short,
   _swigc__p_void,
 };
@@ -5874,7 +5908,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -5884,6 +5918,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -5912,6 +5949,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
index 71ba37b4797300cc5f1d3bae133699f4087b9faf..b564976524f940870c2cec58c10e493885cf498e 100644 (file)
@@ -94,6 +94,7 @@ static int ldb_wrap_destructor(struct ldb_context *ldb)
   TODO:  We need an error_string parameter
  */
 struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+                                    struct event_context *ev,
                                     struct loadparm_context *lp_ctx,
                                     const char *url,
                                     struct auth_session_info *session_info,
@@ -103,7 +104,6 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
 {
        struct ldb_context *ldb;
        int ret;
-       struct event_context *ev;
        char *real_url = NULL;
        size_t *startup_blocks;
 
@@ -115,10 +115,9 @@ struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
        ldb_set_modules_dir(ldb, 
                            talloc_asprintf(ldb, "%s/ldb", lp_modulesdir(lp_ctx)));
 
-       /* we want to use the existing event context if possible. This
-          relies on the fact that in smbd, everything is a child of
-          the main event_context */
-       ev = event_context_find(ldb);
+       if (ev == NULL) {
+               return NULL;
+       }
 
        if (ldb_set_opaque(ldb, "EventContext", ev)) {
                talloc_free(ldb);
index d3ff04b8808b0cd7eb8907043e50ab7197341e1d..e626b6ef8aa7d0797e59e4117553ed5a0a219365 100644 (file)
@@ -27,10 +27,12 @@ struct ldb_message;
 struct ldb_dn;
 struct cli_credentials;
 struct loadparm_context;
+struct event_context;
 
 char *wrap_casefold(void *context, void *mem_ctx, const char *s);
 
 struct ldb_context *ldb_wrap_connect(TALLOC_CTX *mem_ctx,
+                                    struct event_context *ev,
                                     struct loadparm_context *lp_ctx,
                                     const char *url,
                                     struct auth_session_info *session_info,
index 29d6e002477bc1376e5b1d004f88a765a4cb8bbe..19284461ee4d11649ca2d6cbd57e0773cbbbab8e 100644 (file)
@@ -544,6 +544,10 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
        NTSTATUS status;
        struct socket_address *path;
 
+       if (ev == NULL) {
+               return NULL;
+       }
+
        msg = talloc_zero(mem_ctx, struct messaging_context);
        if (msg == NULL) {
                return NULL;
@@ -556,10 +560,6 @@ struct messaging_context *messaging_init(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       if (ev == NULL) {
-               ev = event_context_init(msg);
-       }
-
        /* create the messaging directory if needed */
        mkdir(dir, 0700);
 
index 45b573518cc87d691b81c90686dda96c6af77bb7..f66b3a5b438728af4bc1c39222fbcb992740c66d 100644 (file)
@@ -134,7 +134,6 @@ static bool test_ping_speed(struct torture_context *tctx)
        talloc_free(msg_client_ctx);
        talloc_free(msg_server_ctx);
 
-       talloc_free(ev);
        return true;
 }
 
diff --git a/source4/lib/policy/adm.h b/source4/lib/policy/adm.h
deleted file mode 100644 (file)
index c541ced..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
-   Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
-   
-   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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __ADM_H__
-#define __ADM_H__
-
-struct adm_file {
-       struct adm_class *classes;
-};
-
-struct adm_class {
-       struct adm_category *categories;
-};
-
-struct adm_category {
-       struct adm_category *subcategories;
-       struct adm_policy *policies;
-};
-
-struct adm_policy {
-       struct adm_part *parts;
-};
-
-struct adm_part {
-       int dummy;      
-};
-
-struct adm_file *adm_read_file(const char *);
-
-#endif /* __ADM_H__ */
diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk
deleted file mode 100644 (file)
index 9a8e60b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-[SUBSYSTEM::LIBPOLICY]
-CFLAGS = -Iheimdal/lib/roken
-PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG LIBTALLOC CHARSET 
-
-LIBPOLICY_OBJ_FILES = lib/policy/lex.o lib/policy/parse_adm.o 
-
-lib/policy/lex.l: lib/policy/parse_adm.h
-
-lib/policy/parse_adm.h: lib/policy/parse_adm.c
-
-[BINARY::dumpadm]
-PRIVATE_DEPENDENCIES = LIBPOLICY LIBPOPT LIBSAMBA-HOSTCONFIG LIBTALLOC LIBSAMBA-UTIL CHARSET
-
-dumpadm_OBJ_FILES = lib/policy/dumpadm.o
diff --git a/source4/lib/policy/dumpadm.c b/source4/lib/policy/dumpadm.c
deleted file mode 100644 (file)
index 2ed5abf..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
-   Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
-   
-   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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "includes.h"
-#include "lib/popt/popt.h"
-#include "lib/policy/adm.h"
-
-int main(int argc, char **argv) 
-{
-       bool ret = true;
-       poptContext pc;
-       struct poptOption long_options[] = {
-               POPT_AUTOHELP
-               { 0, 0, 0, 0 }
-       };
-       
-       pc = poptGetContext(argv[0], argc, (const char **)argv, long_options, 0);
-       
-       poptSetOtherOptionHelp(pc, "<ADM-FILE> ...");
-
-       while ((poptGetNextOpt(pc) != -1)) 
-
-       if(!poptPeekArg(pc)) { 
-               poptPrintUsage(pc, stderr, 0);
-               exit(1);
-       }
-       
-       while (poptPeekArg(pc)) {
-               const char *name = poptGetArg(pc);
-
-               adm_read_file(name);
-       }
-
-       poptFreeContext(pc);
-
-       return ret;
-}
diff --git a/source4/lib/policy/lex.c b/source4/lib/policy/lex.c
deleted file mode 100644 (file)
index 6d52444..0000000
+++ /dev/null
@@ -1,2085 +0,0 @@
-#include "config.h"
-
-#line 3 "lex.yy.c"
-
-#define  YY_INT_ALIGNED short int
-
-/* A lexical scanner generated by flex */
-
-#define FLEX_SCANNER
-#define YY_FLEX_MAJOR_VERSION 2
-#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 33
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with  platform-specific or compiler-specific issues. */
-
-/* begin standard C headers. */
-#include <stdio.h>
-#include <string.h>
-#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if __STDC_VERSION__ >= 199901L
-
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types. 
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t; 
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-#endif /* ! C99 */
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN               (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN              (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN              (-2147483647-1)
-#endif
-#ifndef INT8_MAX
-#define INT8_MAX               (127)
-#endif
-#ifndef INT16_MAX
-#define INT16_MAX              (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX              (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX              (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX             (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX             (4294967295U)
-#endif
-
-#endif /* ! FLEXINT_H */
-
-#ifdef __cplusplus
-
-/* The "const" storage-class-modifier is valid. */
-#define YY_USE_CONST
-
-#else  /* ! __cplusplus */
-
-#if __STDC__
-
-#define YY_USE_CONST
-
-#endif /* __STDC__ */
-#endif /* ! __cplusplus */
-
-#ifdef YY_USE_CONST
-#define yyconst const
-#else
-#define yyconst
-#endif
-
-/* Returned upon end-of-file. */
-#define YY_NULL 0
-
-/* Promotes a possibly negative, possibly signed char to an unsigned
- * integer for use as an array index.  If the signed char is negative,
- * we want to instead treat it as an 8-bit unsigned char, hence the
- * double cast.
- */
-#define YY_SC_TO_UI(c) ((unsigned int) (unsigned char) c)
-
-/* Enter a start condition.  This macro really ought to take a parameter,
- * but we do it the disgusting crufty way forced on us by the ()-less
- * definition of BEGIN.
- */
-#define BEGIN (yy_start) = 1 + 2 *
-
-/* Translate the current start state into a value that can be later handed
- * to BEGIN to return to the state.  The YYSTATE alias is for lex
- * compatibility.
- */
-#define YY_START (((yy_start) - 1) / 2)
-#define YYSTATE YY_START
-
-/* Action number for EOF rule of a given start state. */
-#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
-
-/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart(yyin  )
-
-#define YY_END_OF_BUFFER_CHAR 0
-
-/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
-#define YY_BUF_SIZE 16384
-#endif
-
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE   ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
-typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-extern int yyleng;
-
-extern FILE *yyin, *yyout;
-
-#define EOB_ACT_CONTINUE_SCAN 0
-#define EOB_ACT_END_OF_FILE 1
-#define EOB_ACT_LAST_MATCH 2
-
-    #define YY_LESS_LINENO(n)
-    
-/* Return all but the first "n" matched characters back to the input stream. */
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               *yy_cp = (yy_hold_char); \
-               YY_RESTORE_YY_MORE_OFFSET \
-               (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
-               YY_DO_BEFORE_ACTION; /* set up yytext again */ \
-               } \
-       while ( 0 )
-
-#define unput(c) yyunput( c, (yytext_ptr)  )
-
-/* The following is because we cannot portably get our hands on size_t
- * (without autoconf's help, which isn't available because we want
- * flex-generated scanners to compile on their own).
- */
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef unsigned int yy_size_t;
-#endif
-
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
-struct yy_buffer_state
-       {
-       FILE *yy_input_file;
-
-       char *yy_ch_buf;                /* input buffer */
-       char *yy_buf_pos;               /* current position in input buffer */
-
-       /* Size of input buffer in bytes, not including room for EOB
-        * characters.
-        */
-       yy_size_t yy_buf_size;
-
-       /* Number of characters read into yy_ch_buf, not including EOB
-        * characters.
-        */
-       int yy_n_chars;
-
-       /* Whether we "own" the buffer - i.e., we know we created it,
-        * and can realloc() it to grow it, and should free() it to
-        * delete it.
-        */
-       int yy_is_our_buffer;
-
-       /* Whether this is an "interactive" input source; if so, and
-        * if we're using stdio for input, then we want to use getc()
-        * instead of fread(), to make sure we stop fetching input after
-        * each newline.
-        */
-       int yy_is_interactive;
-
-       /* Whether we're considered to be at the beginning of a line.
-        * If so, '^' rules will be active on the next match, otherwise
-        * not.
-        */
-       int yy_at_bol;
-
-    int yy_bs_lineno; /**< The line count. */
-    int yy_bs_column; /**< The column count. */
-    
-       /* Whether to try to fill the input buffer when we reach the
-        * end of it.
-        */
-       int yy_fill_buffer;
-
-       int yy_buffer_status;
-
-#define YY_BUFFER_NEW 0
-#define YY_BUFFER_NORMAL 1
-       /* When an EOF's been seen but there's still some text to process
-        * then we mark the buffer as YY_EOF_PENDING, to indicate that we
-        * shouldn't try reading from the input source any more.  We might
-        * still have a bunch of tokens to match, though, because of
-        * possible backing-up.
-        *
-        * When we actually see the EOF, we change the status to "new"
-        * (via yyrestart()), so that the user can continue scanning by
-        * just pointing yyin at a new input file.
-        */
-#define YY_BUFFER_EOF_PENDING 2
-
-       };
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-
-/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
-
-/* We provide macros for accessing buffer states in case in the
- * future we want to put the buffer states in a more general
- * "scanner state".
- *
- * Returns the top of the stack, or NULL.
- */
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
-                          ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
-                          : NULL)
-
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
-
-/* yy_hold_char holds the character lost when yytext is formed. */
-static char yy_hold_char;
-static int yy_n_chars;         /* number of characters read into yy_ch_buf */
-int yyleng;
-
-/* Points to current character in buffer. */
-static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0;                /* whether we need to initialize */
-static int yy_start = 0;       /* start state number */
-
-/* Flag which is used to allow yywrap()'s to do buffer switches
- * instead of setting up a fresh yyin.  A bit of a hack ...
- */
-static int yy_did_buffer_switch_on_eof;
-
-void yyrestart (FILE *input_file  );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer  );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size  );
-void yy_delete_buffer (YY_BUFFER_STATE b  );
-void yy_flush_buffer (YY_BUFFER_STATE b  );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer  );
-void yypop_buffer_state (void );
-
-static void yyensure_buffer_stack (void );
-static void yy_load_buffer_state (void );
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file  );
-
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
-
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size  );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str  );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,int len  );
-
-void *yyalloc (yy_size_t  );
-void *yyrealloc (void *,yy_size_t  );
-void yyfree (void *  );
-
-#define yy_new_buffer yy_create_buffer
-
-#define yy_set_interactive(is_interactive) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){ \
-        yyensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
-       }
-
-#define yy_set_bol(at_bol) \
-       { \
-       if ( ! YY_CURRENT_BUFFER ){\
-        yyensure_buffer_stack (); \
-               YY_CURRENT_BUFFER_LVALUE =    \
-            yy_create_buffer(yyin,YY_BUF_SIZE ); \
-       } \
-       YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
-       }
-
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
-
-typedef unsigned char YY_CHAR;
-
-FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-
-typedef int yy_state_type;
-
-extern int yylineno;
-
-int yylineno = 1;
-
-extern char *yytext;
-#define yytext_ptr yytext
-
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state  );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[]  );
-
-/* Done after the current pattern has been matched and before the
- * corresponding action - sets up yytext.
- */
-#define YY_DO_BEFORE_ACTION \
-       (yytext_ptr) = yy_bp; \
-       yyleng = (size_t) (yy_cp - yy_bp); \
-       (yy_hold_char) = *yy_cp; \
-       *yy_cp = '\0'; \
-       (yy_c_buf_p) = yy_cp;
-
-#define YY_NUM_RULES 38
-#define YY_END_OF_BUFFER 39
-/* This struct is not used in this scanner,
-   but its presence is necessary. */
-struct yy_trans_info
-       {
-       flex_int32_t yy_verify;
-       flex_int32_t yy_nxt;
-       };
-static yyconst flex_int16_t yy_accept[185] =
-    {   0,
-        0,    0,   39,   38,   34,   35,   38,   38,   31,   38,
-       29,   32,   32,   32,   32,   32,   32,   32,   32,   32,
-       32,   32,   32,   32,   32,   32,   38,   34,    0,    0,
-       31,    0,   36,   32,   32,   32,   32,   32,   32,   32,
-       32,   32,   32,   32,   32,   32,   32,   32,   32,   32,
-       32,   32,   32,   32,   32,   32,   32,    0,   33,   37,
-       32,   32,   32,   32,   32,   32,   32,   32,    9,   32,
-       32,   32,   32,   15,   14,   32,   32,   32,   32,   32,
-       32,   32,   32,   32,   32,    0,   33,   32,   32,   32,
-       32,   32,   32,   32,   32,   32,   32,   32,   32,   16,
-
-       32,   18,   32,   32,   21,   32,   23,   24,   32,    0,
-       32,   32,   32,    4,   32,   32,   32,   32,   32,   32,
-       32,   32,   32,   32,   32,   32,   25,    0,   32,   32,
-       32,   32,    5,   32,   32,   32,   32,   32,   32,   32,
-       19,   32,   32,   32,   32,    0,   32,   32,   32,    6,
-       32,   32,   10,   32,   12,   13,   17,   32,   32,   32,
-       32,   27,    0,   32,    2,    3,   32,    8,   11,   20,
-       32,   32,   28,    0,   32,   32,   22,   26,   30,    1,
-       32,   32,    7,    0
-    } ;
-
-static yyconst flex_int32_t yy_ec[256] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    2,    3,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    2,    4,    5,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    6,    1,    1,    7,    7,    7,
-        7,    7,    7,    7,    7,    7,    7,    1,    8,    1,
-        9,    1,    1,    1,   10,   11,   12,   13,   14,   15,
-       16,   17,   18,   19,   20,   21,   22,   23,   24,   25,
-       26,   27,   28,   29,   30,   31,   32,   33,   34,   19,
-       35,   36,   37,    1,    6,    1,   19,   19,   19,   19,
-
-       19,   19,   38,   19,   39,   19,   19,   19,   19,   40,
-       19,   19,   19,   41,   42,   43,   19,   19,   19,   19,
-       19,   19,   36,    1,   36,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1
-    } ;
-
-static yyconst flex_int32_t yy_meta[44] =
-    {   0,
-        1,    1,    2,    1,    1,    3,    3,    1,    1,    4,
-        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
-        4,    4,    4,    4,    4,    4,    4,    4,    4,    4,
-        4,    4,    4,    4,    1,    5,    1,    4,    4,    4,
-        4,    4,    4
-    } ;
-
-static yyconst flex_int16_t yy_base[190] =
-    {   0,
-        0,    0,  213,  214,  210,  214,  207,    0,  203,  206,
-      214,  196,    0,   34,   31,   33,  178,  192,   39,   37,
-       38,  191,   29,  190,  175,  192,  159,  198,    0,  196,
-      191,  194,  214,    0,  167,  166,  180,  183,   48,  168,
-      173,  177,  164,  174,  153,   38,  163,  163,  162,  156,
-      161,  155,  162,  154,  145,  163,  155,  132,    0,  214,
-      156,  159,  160,  143,  160,  155,  143,  138,    0,  145,
-      143,  141,  146,    0,    0,  148,  147,  131,  141,  128,
-      134,  131,  126,  127,  123,  111,    0,  127,  134,  129,
-      120,  117,  117,  132,  115,  133,  121,  131,  122,    0,
-
-      112,    0,  126,  119,    0,  112,    0,    0,  121,   95,
-      110,  108,  120,    0,  109,  115,  104,  113,  108,  107,
-      102,  100,  104,   87,   93,   92,   29,   78,   96,   89,
-       91,   85,    0,   81,   79,   88,   82,   95,   94,   95,
-        0,   92,   76,   94,   45,   65,   84,   67,   67,    0,
-       76,   69,    0,   68,    0,    0,    0,   83,   81,   72,
-       78,    0,   50,   63,    0,    0,   69,    0,    0,    0,
-       76,   74,    0,   50,   44,   52,    0,    0,  214,    0,
-       37,   35,    0,  214,   71,   76,   79,   57,   82
-    } ;
-
-static yyconst flex_int16_t yy_def[190] =
-    {   0,
-      184,    1,  184,  184,  184,  184,  184,  185,  184,  186,
-      184,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  184,  184,  188,  185,
-      184,  186,  184,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  184,  189,  184,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  184,  189,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  184,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  184,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  184,  187,  187,  187,  187,
-      187,  187,  187,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  184,  187,  187,  187,  187,  187,  187,  187,
-      187,  187,  187,  184,  187,  187,  187,  187,  184,  187,
-      187,  187,  187,    0,  184,  184,  184,  184,  184
-    } ;
-
-static yyconst flex_int16_t yy_nxt[258] =
-    {   0,
-        4,    5,    6,    7,    8,    4,    9,   10,   11,   12,
-       13,   14,   15,   16,   13,   13,   13,   17,   13,   18,
-       13,   19,   20,   13,   21,   13,   22,   23,   24,   25,
-       26,   13,   13,   13,   27,   13,    4,   13,   13,   13,
-       13,   13,   13,   36,   39,   41,   48,   50,   46,   73,
-       37,  144,  145,   53,   38,   42,   47,   40,   54,  161,
-       59,   51,   65,  183,  182,   43,   49,  162,   66,  181,
-       74,   30,  180,   30,   30,   30,   32,   32,   32,   32,
-       32,   34,   34,   34,   87,   87,  179,  178,  177,  176,
-      175,  174,  173,  172,  171,  170,  169,  168,  167,  166,
-
-      165,  164,  163,  160,  159,  158,  157,  156,  155,  154,
-      153,  152,  151,  150,  149,  148,  147,  146,  143,  142,
-      141,  140,  139,  138,  137,  136,  135,  134,  133,  132,
-      131,  130,  129,  128,  127,  126,  125,  124,  123,  122,
-      121,  120,  119,  118,  117,  116,  115,  114,  113,  112,
-      111,  110,  109,  108,  107,  106,  105,  104,  103,  102,
-      101,  100,   99,   98,   97,   96,   95,   94,   93,   92,
-       91,   90,   89,   88,   86,   85,   84,   83,   82,   81,
-       80,   79,   78,   77,   76,   75,   72,   71,   70,   69,
-       68,   67,   64,   63,   62,   61,   33,   31,   60,   28,
-
-       58,   57,   56,   55,   52,   45,   44,   35,   33,   31,
-       29,   28,  184,    3,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184
-    } ;
-
-static yyconst flex_int16_t yy_chk[258] =
-    {   0,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,    1,    1,    1,    1,    1,    1,    1,
-        1,    1,    1,   14,   15,   16,   20,   21,   19,   46,
-       14,  127,  127,   23,   14,   16,   19,   15,   23,  145,
-      188,   21,   39,  182,  181,   16,   20,  145,   39,  176,
-       46,  185,  175,  185,  185,  185,  186,  186,  186,  186,
-      186,  187,  187,  187,  189,  189,  174,  172,  171,  167,
-      164,  163,  161,  160,  159,  158,  154,  152,  151,  149,
-
-      148,  147,  146,  144,  143,  142,  140,  139,  138,  137,
-      136,  135,  134,  132,  131,  130,  129,  128,  126,  125,
-      124,  123,  122,  121,  120,  119,  118,  117,  116,  115,
-      113,  112,  111,  110,  109,  106,  104,  103,  101,   99,
-       98,   97,   96,   95,   94,   93,   92,   91,   90,   89,
-       88,   86,   85,   84,   83,   82,   81,   80,   79,   78,
-       77,   76,   73,   72,   71,   70,   68,   67,   66,   65,
-       64,   63,   62,   61,   58,   57,   56,   55,   54,   53,
-       52,   51,   50,   49,   48,   47,   45,   44,   43,   42,
-       41,   40,   38,   37,   36,   35,   32,   31,   30,   28,
-
-       27,   26,   25,   24,   22,   18,   17,   12,   10,    9,
-        7,    5,    3,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184,  184,  184,  184,
-      184,  184,  184,  184,  184,  184,  184
-    } ;
-
-static yy_state_type yy_last_accepting_state;
-static char *yy_last_accepting_cpos;
-
-extern int yy_flex_debug;
-int yy_flex_debug = 0;
-
-/* The intent behind this definition is that it'll catch
- * any uses of REJECT which flex missed.
- */
-#define REJECT reject_used_but_not_detected
-#define yymore() yymore_used_but_not_detected
-#define YY_MORE_ADJ 0
-#define YY_RESTORE_YY_MORE_OFFSET
-char *yytext;
-#line 1 "lex.l"
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
-   Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
-   
-   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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-#line 23 "lex.l"
-#include "includes.h"
-#include "lib/policy/parse_adm.h"
-#include "param/param.h"
-void error_message (const char *format, ...);
-int yyparse (void);
-
-static int lineno = 1;
-static bool utf16 = false;
-
-#define YY_INPUT(buf,result,max_size) \
-{ \
-       if (utf16) { \
-               uint16_t v; \
-               if (fread(&v, 2, 1, yyin) < 1) \
-                       result = YY_NULL; \
-               else \
-                       result = push_codepoint(lp_iconv_convenience(global_loadparm), buf, v); \
-       } else { \
-               int c = getc(yyin); \
-               result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
-       } \
-}
-
-#line 610 "lex.yy.c"
-
-#define INITIAL 0
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-static int yy_init_globals (void );
-
-/* Macros after this point can all be overridden by user definitions in
- * section 1.
- */
-
-#ifndef YY_SKIP_YYWRAP
-#ifdef __cplusplus
-extern "C" int yywrap (void );
-#else
-extern int yywrap (void );
-#endif
-#endif
-
-    static void yyunput (int c,char *buf_ptr  );
-    
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
-#endif
-
-#ifndef YY_NO_INPUT
-
-#ifdef __cplusplus
-static int yyinput (void );
-#else
-static int input (void );
-#endif
-
-#endif
-
-/* Amount of stuff to slurp up with each read. */
-#ifndef YY_READ_BUF_SIZE
-#define YY_READ_BUF_SIZE 8192
-#endif
-
-/* Copy whatever the last rule matched to the standard output. */
-#ifndef ECHO
-/* This used to be an fputs(), but since the string might contain NUL's,
- * we now use fwrite().
- */
-#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
-#endif
-
-/* Gets input and stuffs it into "buf".  number of characters read, or YY_NULL,
- * is returned in "result".
- */
-#ifndef YY_INPUT
-#define YY_INPUT(buf,result,max_size) \
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
-               { \
-               int c = '*'; \
-               size_t n; \
-               for ( n = 0; n < max_size && \
-                            (c = getc( yyin )) != EOF && c != '\n'; ++n ) \
-                       buf[n] = (char) c; \
-               if ( c == '\n' ) \
-                       buf[n++] = (char) c; \
-               if ( c == EOF && ferror( yyin ) ) \
-                       YY_FATAL_ERROR( "input in flex scanner failed" ); \
-               result = n; \
-               } \
-       else \
-               { \
-               errno=0; \
-               while ( (result = fread(buf, 1, max_size, yyin))==0 && ferror(yyin)) \
-                       { \
-                       if( errno != EINTR) \
-                               { \
-                               YY_FATAL_ERROR( "input in flex scanner failed" ); \
-                               break; \
-                               } \
-                       errno=0; \
-                       clearerr(yyin); \
-                       } \
-               }\
-\
-
-#endif
-
-/* No semi-colon after return; correct usage is to write "yyterminate();" -
- * we don't want an extra ';' after the "return" because that will cause
- * some compilers to complain about unreachable statements.
- */
-#ifndef yyterminate
-#define yyterminate() return YY_NULL
-#endif
-
-/* Number of entries by which start-condition stack grows. */
-#ifndef YY_START_STACK_INCR
-#define YY_START_STACK_INCR 25
-#endif
-
-/* Report a fatal error. */
-#ifndef YY_FATAL_ERROR
-#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
-#endif
-
-/* end tables serialization structures and prototypes */
-
-/* Default declaration of generated scanner - a define so the user can
- * easily add parameters.
- */
-#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int yylex (void);
-
-#define YY_DECL int yylex (void)
-#endif /* !YY_DECL */
-
-/* Code executed at the beginning of each rule, after yytext and yyleng
- * have been set up.
- */
-#ifndef YY_USER_ACTION
-#define YY_USER_ACTION
-#endif
-
-/* Code executed at the end of each rule. */
-#ifndef YY_BREAK
-#define YY_BREAK break;
-#endif
-
-#define YY_RULE_SETUP \
-       YY_USER_ACTION
-
-/** The main scanner function which does all the work.
- */
-YY_DECL
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp, *yy_bp;
-       register int yy_act;
-    
-#line 47 "lex.l"
-
-
-#line 766 "lex.yy.c"
-
-       if ( !(yy_init) )
-               {
-               (yy_init) = 1;
-
-#ifdef YY_USER_INIT
-               YY_USER_INIT;
-#endif
-
-               if ( ! (yy_start) )
-                       (yy_start) = 1; /* first start state */
-
-               if ( ! yyin )
-                       yyin = stdin;
-
-               if ( ! yyout )
-                       yyout = stdout;
-
-               if ( ! YY_CURRENT_BUFFER ) {
-                       yyensure_buffer_stack ();
-                       YY_CURRENT_BUFFER_LVALUE =
-                               yy_create_buffer(yyin,YY_BUF_SIZE );
-               }
-
-               yy_load_buffer_state( );
-               }
-
-       while ( 1 )             /* loops until end-of-file is reached */
-               {
-               yy_cp = (yy_c_buf_p);
-
-               /* Support of yytext. */
-               *yy_cp = (yy_hold_char);
-
-               /* yy_bp points to the position in yy_ch_buf of the start of
-                * the current run.
-                */
-               yy_bp = yy_cp;
-
-               yy_current_state = (yy_start);
-yy_match:
-               do
-                       {
-                       register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
-                       if ( yy_accept[yy_current_state] )
-                               {
-                               (yy_last_accepting_state) = yy_current_state;
-                               (yy_last_accepting_cpos) = yy_cp;
-                               }
-                       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                               {
-                               yy_current_state = (int) yy_def[yy_current_state];
-                               if ( yy_current_state >= 185 )
-                                       yy_c = yy_meta[(unsigned int) yy_c];
-                               }
-                       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-                       ++yy_cp;
-                       }
-               while ( yy_base[yy_current_state] != 214 );
-
-yy_find_action:
-               yy_act = yy_accept[yy_current_state];
-               if ( yy_act == 0 )
-                       { /* have to back up */
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       yy_act = yy_accept[yy_current_state];
-                       }
-
-               YY_DO_BEFORE_ACTION;
-
-do_action:     /* This label is used only to access EOF actions. */
-
-               switch ( yy_act )
-       { /* beginning of action switch */
-                       case 0: /* must back up */
-                       /* undo the effects of YY_DO_BEFORE_ACTION */
-                       *yy_cp = (yy_hold_char);
-                       yy_cp = (yy_last_accepting_cpos);
-                       yy_current_state = (yy_last_accepting_state);
-                       goto yy_find_action;
-
-case 1:
-YY_RULE_SETUP
-#line 49 "lex.l"
-{ return ACTIONLIST; }
-       YY_BREAK
-case 2:
-YY_RULE_SETUP
-#line 50 "lex.l"
-{ return CATEGORY; }
-       YY_BREAK
-case 3:
-YY_RULE_SETUP
-#line 51 "lex.l"
-{ return CHECKBOX; }
-       YY_BREAK
-case 4:
-YY_RULE_SETUP
-#line 52 "lex.l"
-{ return CLASS; }
-       YY_BREAK
-case 5:
-YY_RULE_SETUP
-#line 53 "lex.l"
-{ return DEL; }
-       YY_BREAK
-case 6:
-YY_RULE_SETUP
-#line 54 "lex.l"
-{ return DEFAULT; }
-       YY_BREAK
-case 7:
-YY_RULE_SETUP
-#line 55 "lex.l"
-{ return DROPDOWNLIST; }
-       YY_BREAK
-case 8:
-YY_RULE_SETUP
-#line 56 "lex.l"
-{ return EDITTEXT; }
-       YY_BREAK
-case 9:
-YY_RULE_SETUP
-#line 57 "lex.l"
-{ return END; }
-       YY_BREAK
-case 10:
-YY_RULE_SETUP
-#line 58 "lex.l"
-{ return EXPLAIN; }
-       YY_BREAK
-case 11:
-YY_RULE_SETUP
-#line 59 "lex.l"
-{ return ITEMLIST; }
-       YY_BREAK
-case 12:
-YY_RULE_SETUP
-#line 60 "lex.l"
-{ return KEYNAME; }
-       YY_BREAK
-case 13:
-YY_RULE_SETUP
-#line 61 "lex.l"
-{ return CLASS_MACHINE; }
-       YY_BREAK
-case 14:
-YY_RULE_SETUP
-#line 62 "lex.l"
-{ return MINIMUM; }
-       YY_BREAK
-case 15:
-YY_RULE_SETUP
-#line 63 "lex.l"
-{ return MAXIMUM; }
-       YY_BREAK
-case 16:
-YY_RULE_SETUP
-#line 64 "lex.l"
-{ return NAME; }
-       YY_BREAK
-case 17:
-YY_RULE_SETUP
-#line 65 "lex.l"
-{ return NUMERIC; }
-       YY_BREAK
-case 18:
-YY_RULE_SETUP
-#line 66 "lex.l"
-{ return PART; }
-       YY_BREAK
-case 19:
-YY_RULE_SETUP
-#line 67 "lex.l"
-{ return POLICY; }
-       YY_BREAK
-case 20:
-YY_RULE_SETUP
-#line 68 "lex.l"
-{ return REQUIRED; }
-       YY_BREAK
-case 21:
-YY_RULE_SETUP
-#line 69 "lex.l"
-{ return SPIN; }
-       YY_BREAK
-case 22:
-YY_RULE_SETUP
-#line 70 "lex.l"
-{ return SUPPORTED; }
-       YY_BREAK
-case 23:
-YY_RULE_SETUP
-#line 71 "lex.l"
-{ return TEXT; }
-       YY_BREAK
-case 24:
-YY_RULE_SETUP
-#line 72 "lex.l"
-{ return CLASS_USER; }
-       YY_BREAK
-case 25:
-YY_RULE_SETUP
-#line 73 "lex.l"
-{ return VALUE; }
-       YY_BREAK
-case 26:
-YY_RULE_SETUP
-#line 74 "lex.l"
-{ return VALUENAME; }
-       YY_BREAK
-case 27:
-YY_RULE_SETUP
-#line 75 "lex.l"
-{ return VALUEON; }
-       YY_BREAK
-case 28:
-YY_RULE_SETUP
-#line 76 "lex.l"
-{ return VALUEOFF; }
-       YY_BREAK
-case 29:
-YY_RULE_SETUP
-#line 77 "lex.l"
-{ return EQUALS; }
-       YY_BREAK
-case 30:
-YY_RULE_SETUP
-#line 78 "lex.l"
-{ return STRINGSSECTION; }
-       YY_BREAK
-case 31:
-YY_RULE_SETUP
-#line 80 "lex.l"
-{
-       char *e, *y = yytext;
-       yylval.integer = strtol((const char *)yytext, &e, 0);
-       if(e == y)
-               error_message("malformed constant (%s)", yytext);
-       else
-               return INTEGER;
-               }
-       YY_BREAK
-case 32:
-YY_RULE_SETUP
-#line 89 "lex.l"
-{ 
-       yylval.text = strdup ((const char *)yytext);
-       return LITERAL;
-       }
-       YY_BREAK
-case 33:
-YY_RULE_SETUP
-#line 94 "lex.l"
-{
-       yylval.text = strdup ((const char *)yytext);
-       return LOOKUPLITERAL;
-       }
-       YY_BREAK
-case 34:
-YY_RULE_SETUP
-#line 98 "lex.l"
-
-       YY_BREAK
-case 35:
-/* rule 35 can match eol */
-YY_RULE_SETUP
-#line 99 "lex.l"
-{ lineno++; }
-       YY_BREAK
-case 36:
-/* rule 36 can match eol */
-YY_RULE_SETUP
-#line 100 "lex.l"
-{ lineno++; }
-       YY_BREAK
-case 37:
-/* rule 37 can match eol */
-YY_RULE_SETUP
-#line 101 "lex.l"
-{ lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; }
-       YY_BREAK
-case 38:
-YY_RULE_SETUP
-#line 102 "lex.l"
-ECHO;
-       YY_BREAK
-#line 1055 "lex.yy.c"
-case YY_STATE_EOF(INITIAL):
-       yyterminate();
-
-       case YY_END_OF_BUFFER:
-               {
-               /* Amount of text matched not including the EOB char. */
-               int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
-
-               /* Undo the effects of YY_DO_BEFORE_ACTION. */
-               *yy_cp = (yy_hold_char);
-               YY_RESTORE_YY_MORE_OFFSET
-
-               if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
-                       {
-                       /* We're scanning a new file or input source.  It's
-                        * possible that this happened because the user
-                        * just pointed yyin at a new source and called
-                        * yylex().  If so, then we have to assure
-                        * consistency between YY_CURRENT_BUFFER and our
-                        * globals.  Here is the right place to do so, because
-                        * this is the first action (other than possibly a
-                        * back-up) that will match for the new input source.
-                        */
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-                       YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
-                       }
-
-               /* Note that here we test for yy_c_buf_p "<=" to the position
-                * of the first EOB in the buffer, since yy_c_buf_p will
-                * already have been incremented past the NUL character
-                * (since all states make transitions on EOB to the
-                * end-of-buffer state).  Contrast this with the test
-                * in input().
-                */
-               if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       { /* This was really a NUL. */
-                       yy_state_type yy_next_state;
-
-                       (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
-
-                       yy_current_state = yy_get_previous_state(  );
-
-                       /* Okay, we're now positioned to make the NUL
-                        * transition.  We couldn't have
-                        * yy_get_previous_state() go ahead and do it
-                        * for us because it doesn't know how to deal
-                        * with the possibility of jamming (and we don't
-                        * want to build jamming into it because then it
-                        * will run more slowly).
-                        */
-
-                       yy_next_state = yy_try_NUL_trans( yy_current_state );
-
-                       yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-
-                       if ( yy_next_state )
-                               {
-                               /* Consume the NUL. */
-                               yy_cp = ++(yy_c_buf_p);
-                               yy_current_state = yy_next_state;
-                               goto yy_match;
-                               }
-
-                       else
-                               {
-                               yy_cp = (yy_c_buf_p);
-                               goto yy_find_action;
-                               }
-                       }
-
-               else switch ( yy_get_next_buffer(  ) )
-                       {
-                       case EOB_ACT_END_OF_FILE:
-                               {
-                               (yy_did_buffer_switch_on_eof) = 0;
-
-                               if ( yywrap( ) )
-                                       {
-                                       /* Note: because we've taken care in
-                                        * yy_get_next_buffer() to have set up
-                                        * yytext, we can now set up
-                                        * yy_c_buf_p so that if some total
-                                        * hoser (like flex itself) wants to
-                                        * call the scanner after we return the
-                                        * YY_NULL, it'll still work - another
-                                        * YY_NULL will get returned.
-                                        */
-                                       (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
-
-                                       yy_act = YY_STATE_EOF(YY_START);
-                                       goto do_action;
-                                       }
-
-                               else
-                                       {
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-                                       }
-                               break;
-                               }
-
-                       case EOB_ACT_CONTINUE_SCAN:
-                               (yy_c_buf_p) =
-                                       (yytext_ptr) + yy_amount_of_matched_text;
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_match;
-
-                       case EOB_ACT_LAST_MATCH:
-                               (yy_c_buf_p) =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
-
-                               yy_current_state = yy_get_previous_state(  );
-
-                               yy_cp = (yy_c_buf_p);
-                               yy_bp = (yytext_ptr) + YY_MORE_ADJ;
-                               goto yy_find_action;
-                       }
-               break;
-               }
-
-       default:
-               YY_FATAL_ERROR(
-                       "fatal flex scanner internal error--no action found" );
-       } /* end of action switch */
-               } /* end of scanning one token */
-} /* end of yylex */
-
-/* yy_get_next_buffer - try to read in a new buffer
- *
- * Returns a code representing an action:
- *     EOB_ACT_LAST_MATCH -
- *     EOB_ACT_CONTINUE_SCAN - continue scanning from current position
- *     EOB_ACT_END_OF_FILE - end of file
- */
-static int yy_get_next_buffer (void)
-{
-       register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
-       register char *source = (yytext_ptr);
-       register int number_to_move, i;
-       int ret_val;
-
-       if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
-               YY_FATAL_ERROR(
-               "fatal flex scanner internal error--end of buffer missed" );
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
-               { /* Don't try to fill the buffer, so this is an EOF. */
-               if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
-                       {
-                       /* We matched a single character, the EOB, so
-                        * treat this as a final EOF.
-                        */
-                       return EOB_ACT_END_OF_FILE;
-                       }
-
-               else
-                       {
-                       /* We matched some text prior to the EOB, first
-                        * process it.
-                        */
-                       return EOB_ACT_LAST_MATCH;
-                       }
-               }
-
-       /* Try to read more data. */
-
-       /* First move last chars to start of buffer. */
-       number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
-
-       for ( i = 0; i < number_to_move; ++i )
-               *(dest++) = *(source++);
-
-       if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
-               /* don't do the read, it's not guaranteed to return an EOF,
-                * just force an EOF
-                */
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
-
-       else
-               {
-                       int num_to_read =
-                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
-
-               while ( num_to_read <= 0 )
-                       { /* Not enough room in the buffer - grow it. */
-
-                       /* just a shorter name for the current buffer */
-                       YY_BUFFER_STATE b = YY_CURRENT_BUFFER;
-
-                       int yy_c_buf_p_offset =
-                               (int) ((yy_c_buf_p) - b->yy_ch_buf);
-
-                       if ( b->yy_is_our_buffer )
-                               {
-                               int new_size = b->yy_buf_size * 2;
-
-                               if ( new_size <= 0 )
-                                       b->yy_buf_size += b->yy_buf_size / 8;
-                               else
-                                       b->yy_buf_size *= 2;
-
-                               b->yy_ch_buf = (char *)
-                                       /* Include room in for 2 EOB chars. */
-                                       yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2  );
-                               }
-                       else
-                               /* Can't grow it, we don't own it. */
-                               b->yy_ch_buf = 0;
-
-                       if ( ! b->yy_ch_buf )
-                               YY_FATAL_ERROR(
-                               "fatal error - scanner input buffer overflow" );
-
-                       (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
-
-                       num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
-                                               number_to_move - 1;
-
-                       }
-
-               if ( num_to_read > YY_READ_BUF_SIZE )
-                       num_to_read = YY_READ_BUF_SIZE;
-
-               /* Read in more data. */
-               YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
-                       (yy_n_chars), (size_t) num_to_read );
-
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       if ( (yy_n_chars) == 0 )
-               {
-               if ( number_to_move == YY_MORE_ADJ )
-                       {
-                       ret_val = EOB_ACT_END_OF_FILE;
-                       yyrestart(yyin  );
-                       }
-
-               else
-                       {
-                       ret_val = EOB_ACT_LAST_MATCH;
-                       YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
-                               YY_BUFFER_EOF_PENDING;
-                       }
-               }
-
-       else
-               ret_val = EOB_ACT_CONTINUE_SCAN;
-
-       (yy_n_chars) += number_to_move;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
-       YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
-
-       (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
-
-       return ret_val;
-}
-
-/* yy_get_previous_state - get the state just before the EOB char was reached */
-
-    static yy_state_type yy_get_previous_state (void)
-{
-       register yy_state_type yy_current_state;
-       register char *yy_cp;
-    
-       yy_current_state = (yy_start);
-
-       for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
-               {
-               register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
-               if ( yy_accept[yy_current_state] )
-                       {
-                       (yy_last_accepting_state) = yy_current_state;
-                       (yy_last_accepting_cpos) = yy_cp;
-                       }
-               while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-                       {
-                       yy_current_state = (int) yy_def[yy_current_state];
-                       if ( yy_current_state >= 185 )
-                               yy_c = yy_meta[(unsigned int) yy_c];
-                       }
-               yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-               }
-
-       return yy_current_state;
-}
-
-/* yy_try_NUL_trans - try to make a transition on the NUL character
- *
- * synopsis
- *     next_state = yy_try_NUL_trans( current_state );
- */
-    static yy_state_type yy_try_NUL_trans  (yy_state_type yy_current_state )
-{
-       register int yy_is_jam;
-       register char *yy_cp = (yy_c_buf_p);
-
-       register YY_CHAR yy_c = 1;
-       if ( yy_accept[yy_current_state] )
-               {
-               (yy_last_accepting_state) = yy_current_state;
-               (yy_last_accepting_cpos) = yy_cp;
-               }
-       while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
-               {
-               yy_current_state = (int) yy_def[yy_current_state];
-               if ( yy_current_state >= 185 )
-                       yy_c = yy_meta[(unsigned int) yy_c];
-               }
-       yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
-       yy_is_jam = (yy_current_state == 184);
-
-       return yy_is_jam ? 0 : yy_current_state;
-}
-
-    static void yyunput (int c, register char * yy_bp )
-{
-       register char *yy_cp;
-    
-    yy_cp = (yy_c_buf_p);
-
-       /* undo effects of setting up yytext */
-       *yy_cp = (yy_hold_char);
-
-       if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-               { /* need to shift things up to make room */
-               /* +2 for EOB chars. */
-               register int number_to_move = (yy_n_chars) + 2;
-               register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
-                                       YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
-               register char *source =
-                               &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
-
-               while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
-                       *--dest = *--source;
-
-               yy_cp += (int) (dest - source);
-               yy_bp += (int) (dest - source);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
-                       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
-
-               if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
-                       YY_FATAL_ERROR( "flex scanner push-back overflow" );
-               }
-
-       *--yy_cp = (char) c;
-
-       (yytext_ptr) = yy_bp;
-       (yy_hold_char) = *yy_cp;
-       (yy_c_buf_p) = yy_cp;
-}
-
-#ifndef YY_NO_INPUT
-#ifdef __cplusplus
-    static int yyinput (void)
-#else
-    static int input  (void)
-#endif
-
-{
-       int c;
-    
-       *(yy_c_buf_p) = (yy_hold_char);
-
-       if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
-               {
-               /* yy_c_buf_p now points to the character we want to return.
-                * If this occurs *before* the EOB characters, then it's a
-                * valid NUL; if not, then we've hit the end of the buffer.
-                */
-               if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
-                       /* This was really a NUL. */
-                       *(yy_c_buf_p) = '\0';
-
-               else
-                       { /* need more input */
-                       int offset = (yy_c_buf_p) - (yytext_ptr);
-                       ++(yy_c_buf_p);
-
-                       switch ( yy_get_next_buffer(  ) )
-                               {
-                               case EOB_ACT_LAST_MATCH:
-                                       /* This happens because yy_g_n_b()
-                                        * sees that we've accumulated a
-                                        * token and flags that we need to
-                                        * try matching the token before
-                                        * proceeding.  But for input(),
-                                        * there's no matching to consider.
-                                        * So convert the EOB_ACT_LAST_MATCH
-                                        * to EOB_ACT_END_OF_FILE.
-                                        */
-
-                                       /* Reset buffer status. */
-                                       yyrestart(yyin );
-
-                                       /*FALLTHROUGH*/
-
-                               case EOB_ACT_END_OF_FILE:
-                                       {
-                                       if ( yywrap( ) )
-                                               return EOF;
-
-                                       if ( ! (yy_did_buffer_switch_on_eof) )
-                                               YY_NEW_FILE;
-#ifdef __cplusplus
-                                       return yyinput();
-#else
-                                       return input();
-#endif
-                                       }
-
-                               case EOB_ACT_CONTINUE_SCAN:
-                                       (yy_c_buf_p) = (yytext_ptr) + offset;
-                                       break;
-                               }
-                       }
-               }
-
-       c = *(unsigned char *) (yy_c_buf_p);    /* cast for 8-bit char's */
-       *(yy_c_buf_p) = '\0';   /* preserve yytext */
-       (yy_hold_char) = *++(yy_c_buf_p);
-
-       return c;
-}
-#endif /* ifndef YY_NO_INPUT */
-
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- * 
- * @note This function does not reset the start condition to @c INITIAL .
- */
-    void yyrestart  (FILE * input_file )
-{
-    
-       if ( ! YY_CURRENT_BUFFER ){
-        yyensure_buffer_stack ();
-               YY_CURRENT_BUFFER_LVALUE =
-            yy_create_buffer(yyin,YY_BUF_SIZE );
-       }
-
-       yy_init_buffer(YY_CURRENT_BUFFER,input_file );
-       yy_load_buffer_state( );
-}
-
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- * 
- */
-    void yy_switch_to_buffer  (YY_BUFFER_STATE  new_buffer )
-{
-    
-       /* TODO. We should be able to replace this entire function body
-        * with
-        *              yypop_buffer_state();
-        *              yypush_buffer_state(new_buffer);
-     */
-       yyensure_buffer_stack ();
-       if ( YY_CURRENT_BUFFER == new_buffer )
-               return;
-
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-       yy_load_buffer_state( );
-
-       /* We don't actually know whether we did this switch during
-        * EOF (yywrap()) processing, but the only time this flag
-        * is looked at is after yywrap() is called, so it's safe
-        * to go ahead and always set it.
-        */
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-static void yy_load_buffer_state  (void)
-{
-       (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
-       (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
-       yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
-       (yy_hold_char) = *(yy_c_buf_p);
-}
-
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- * 
- * @return the allocated buffer state.
- */
-    YY_BUFFER_STATE yy_create_buffer  (FILE * file, int  size )
-{
-       YY_BUFFER_STATE b;
-    
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
-       b->yy_buf_size = size;
-
-       /* yy_ch_buf has to be 2 characters longer than the size given because
-        * we need to put in 2 end-of-buffer characters.
-        */
-       b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2  );
-       if ( ! b->yy_ch_buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
-
-       b->yy_is_our_buffer = 1;
-
-       yy_init_buffer(b,file );
-
-       return b;
-}
-
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- * 
- */
-    void yy_delete_buffer (YY_BUFFER_STATE  b )
-{
-    
-       if ( ! b )
-               return;
-
-       if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
-               YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
-
-       if ( b->yy_is_our_buffer )
-               yyfree((void *) b->yy_ch_buf  );
-
-       yyfree((void *) b  );
-}
-
-#ifndef __cplusplus
-extern int isatty (int );
-#endif /* __cplusplus */
-    
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
-    static void yy_init_buffer  (YY_BUFFER_STATE  b, FILE * file )
-
-{
-       int oerrno = errno;
-    
-       yy_flush_buffer(b );
-
-       b->yy_input_file = file;
-       b->yy_fill_buffer = 1;
-
-    /* If b is the current buffer, then yy_init_buffer was _probably_
-     * called from yyrestart() or through yy_get_next_buffer.
-     * In that case, we don't want to reset the lineno or column.
-     */
-    if (b != YY_CURRENT_BUFFER){
-        b->yy_bs_lineno = 1;
-        b->yy_bs_column = 0;
-    }
-
-        b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-    
-       errno = oerrno;
-}
-
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- * 
- */
-    void yy_flush_buffer (YY_BUFFER_STATE  b )
-{
-       if ( ! b )
-               return;
-
-       b->yy_n_chars = 0;
-
-       /* We always need two end-of-buffer characters.  The first causes
-        * a transition to the end-of-buffer state.  The second causes
-        * a jam in that state.
-        */
-       b->yy_ch_buf[0] = YY_END_OF_BUFFER_CHAR;
-       b->yy_ch_buf[1] = YY_END_OF_BUFFER_CHAR;
-
-       b->yy_buf_pos = &b->yy_ch_buf[0];
-
-       b->yy_at_bol = 1;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       if ( b == YY_CURRENT_BUFFER )
-               yy_load_buffer_state( );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- *  the current state. This function will allocate the stack
- *  if necessary.
- *  @param new_buffer The new state.
- *  
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
-{
-       if (new_buffer == NULL)
-               return;
-
-       yyensure_buffer_stack();
-
-       /* This block is copied from yy_switch_to_buffer. */
-       if ( YY_CURRENT_BUFFER )
-               {
-               /* Flush out information for old buffer. */
-               *(yy_c_buf_p) = (yy_hold_char);
-               YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
-               YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
-               }
-
-       /* Only push if top exists. Otherwise, replace top. */
-       if (YY_CURRENT_BUFFER)
-               (yy_buffer_stack_top)++;
-       YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
-       /* copied from yy_switch_to_buffer. */
-       yy_load_buffer_state( );
-       (yy_did_buffer_switch_on_eof) = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- *  The next element becomes the new top.
- *  
- */
-void yypop_buffer_state (void)
-{
-       if (!YY_CURRENT_BUFFER)
-               return;
-
-       yy_delete_buffer(YY_CURRENT_BUFFER );
-       YY_CURRENT_BUFFER_LVALUE = NULL;
-       if ((yy_buffer_stack_top) > 0)
-               --(yy_buffer_stack_top);
-
-       if (YY_CURRENT_BUFFER) {
-               yy_load_buffer_state( );
-               (yy_did_buffer_switch_on_eof) = 1;
-       }
-}
-
-/* Allocates the stack if it does not exist.
- *  Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (void)
-{
-       int num_to_alloc;
-    
-       if (!(yy_buffer_stack)) {
-
-               /* First allocation is just for 2 elements, since we don't know if this
-                * scanner will even need a stack. We use 2 instead of 1 to avoid an
-                * immediate realloc on the next call.
-         */
-               num_to_alloc = 1;
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
-                                                               (num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-               
-               memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-                               
-               (yy_buffer_stack_max) = num_to_alloc;
-               (yy_buffer_stack_top) = 0;
-               return;
-       }
-
-       if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
-               /* Increase the buffer to prepare for a possible push. */
-               int grow_size = 8 /* arbitrary grow size */;
-
-               num_to_alloc = (yy_buffer_stack_max) + grow_size;
-               (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
-                                                               ((yy_buffer_stack),
-                                                               num_to_alloc * sizeof(struct yy_buffer_state*)
-                                                               );
-
-               /* zero only the new slots.*/
-               memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
-               (yy_buffer_stack_max) = num_to_alloc;
-       }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- * 
- * @return the newly allocated buffer state object. 
- */
-YY_BUFFER_STATE yy_scan_buffer  (char * base, yy_size_t  size )
-{
-       YY_BUFFER_STATE b;
-    
-       if ( size < 2 ||
-            base[size-2] != YY_END_OF_BUFFER_CHAR ||
-            base[size-1] != YY_END_OF_BUFFER_CHAR )
-               /* They forgot to leave room for the EOB's. */
-               return 0;
-
-       b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state )  );
-       if ( ! b )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
-
-       b->yy_buf_size = size - 2;      /* "- 2" to take care of EOB's */
-       b->yy_buf_pos = b->yy_ch_buf = base;
-       b->yy_is_our_buffer = 0;
-       b->yy_input_file = 0;
-       b->yy_n_chars = b->yy_buf_size;
-       b->yy_is_interactive = 0;
-       b->yy_at_bol = 1;
-       b->yy_fill_buffer = 0;
-       b->yy_buffer_status = YY_BUFFER_NEW;
-
-       yy_switch_to_buffer(b  );
-
-       return b;
-}
-
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- * 
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- *       yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
-{
-    
-       return yy_scan_bytes(yystr,strlen(yystr) );
-}
-
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param bytes the byte buffer to scan
- * @param len the number of bytes in the buffer pointed to by @a bytes.
- * 
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes  (yyconst char * yybytes, int  _yybytes_len )
-{
-       YY_BUFFER_STATE b;
-       char *buf;
-       yy_size_t n;
-       int i;
-    
-       /* Get memory for full buffer, including space for trailing EOB's. */
-       n = _yybytes_len + 2;
-       buf = (char *) yyalloc(n  );
-       if ( ! buf )
-               YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
-
-       for ( i = 0; i < _yybytes_len; ++i )
-               buf[i] = yybytes[i];
-
-       buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
-
-       b = yy_scan_buffer(buf,n );
-       if ( ! b )
-               YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
-
-       /* It's okay to grow etc. this buffer, and we should throw it
-        * away when we're done.
-        */
-       b->yy_is_our_buffer = 1;
-
-       return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
-#endif
-
-static void yy_fatal_error (yyconst char* msg )
-{
-       (void) fprintf( stderr, "%s\n", msg );
-       exit( YY_EXIT_FAILURE );
-}
-
-/* Redefine yyless() so it works in section 3 code. */
-
-#undef yyless
-#define yyless(n) \
-       do \
-               { \
-               /* Undo effects of setting up yytext. */ \
-        int yyless_macro_arg = (n); \
-        YY_LESS_LINENO(yyless_macro_arg);\
-               yytext[yyleng] = (yy_hold_char); \
-               (yy_c_buf_p) = yytext + yyless_macro_arg; \
-               (yy_hold_char) = *(yy_c_buf_p); \
-               *(yy_c_buf_p) = '\0'; \
-               yyleng = yyless_macro_arg; \
-               } \
-       while ( 0 )
-
-/* Accessor  methods (get/set functions) to struct members. */
-
-/** Get the current line number.
- * 
- */
-int yyget_lineno  (void)
-{
-        
-    return yylineno;
-}
-
-/** Get the input stream.
- * 
- */
-FILE *yyget_in  (void)
-{
-        return yyin;
-}
-
-/** Get the output stream.
- * 
- */
-FILE *yyget_out  (void)
-{
-        return yyout;
-}
-
-/** Get the length of the current token.
- * 
- */
-int yyget_leng  (void)
-{
-        return yyleng;
-}
-
-/** Get the current token.
- * 
- */
-
-char *yyget_text  (void)
-{
-        return yytext;
-}
-
-/** Set the current line number.
- * @param line_number
- * 
- */
-void yyset_lineno (int  line_number )
-{
-    
-    yylineno = line_number;
-}
-
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- * 
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE *  in_str )
-{
-        yyin = in_str ;
-}
-
-void yyset_out (FILE *  out_str )
-{
-        yyout = out_str ;
-}
-
-int yyget_debug  (void)
-{
-        return yy_flex_debug;
-}
-
-void yyset_debug (int  bdebug )
-{
-        yy_flex_debug = bdebug ;
-}
-
-static int yy_init_globals (void)
-{
-        /* Initialization is the same as for the non-reentrant scanner.
-     * This function is called from yylex_destroy(), so don't allocate here.
-     */
-
-    (yy_buffer_stack) = 0;
-    (yy_buffer_stack_top) = 0;
-    (yy_buffer_stack_max) = 0;
-    (yy_c_buf_p) = (char *) 0;
-    (yy_init) = 0;
-    (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
-    yyin = stdin;
-    yyout = stdout;
-#else
-    yyin = (FILE *) 0;
-    yyout = (FILE *) 0;
-#endif
-
-    /* For future reference: Set errno on error, since we are called by
-     * yylex_init()
-     */
-    return 0;
-}
-
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy  (void)
-{
-    
-    /* Pop the buffer stack, destroying each element. */
-       while(YY_CURRENT_BUFFER){
-               yy_delete_buffer(YY_CURRENT_BUFFER  );
-               YY_CURRENT_BUFFER_LVALUE = NULL;
-               yypop_buffer_state();
-       }
-
-       /* Destroy the stack itself. */
-       yyfree((yy_buffer_stack) );
-       (yy_buffer_stack) = NULL;
-
-    /* Reset the globals. This is important in a non-reentrant scanner so the next time
-     * yylex() is called, initialization will occur. */
-    yy_init_globals( );
-
-    return 0;
-}
-
-/*
- * Internal utility routines.
- */
-
-#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
-{
-       register int i;
-       for ( i = 0; i < n; ++i )
-               s1[i] = s2[i];
-}
-#endif
-
-#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
-{
-       register int n;
-       for ( n = 0; s[n]; ++n )
-               ;
-
-       return n;
-}
-#endif
-
-void *yyalloc (yy_size_t  size )
-{
-       return (void *) malloc( size );
-}
-
-void *yyrealloc  (void * ptr, yy_size_t  size )
-{
-       /* The cast to (char *) in the following accommodates both
-        * implementations that use char* generic pointers, and those
-        * that use void* generic pointers.  It works with the latter
-        * because both ANSI C and C++ allow castless assignment from
-        * any pointer type to void*, and deal with argument conversions
-        * as though doing an assignment.
-        */
-       return (void *) realloc( (char *) ptr, size );
-}
-
-void yyfree (void * ptr )
-{
-       free( (char *) ptr );   /* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
-
-#line 102 "lex.l"
-
-
-
-#ifndef yywrap /* XXX */
-int
-yywrap () 
-{
-     return 1;
-}
-#endif
-
-
-void
-error_message (const char *format, ...)
-{
-       va_list args;
-
-       va_start (args, format);
-       fprintf (stderr, "%d:", lineno);
-       vfprintf (stderr, format, args);
-       va_end (args);
-}
-
-struct adm_file *adm_read_file(const char *file)
-{
-       uint8_t c[2];
-       yyin = fopen(file, "r");
-       if (yyin == NULL)
-               return NULL;
-
-       c[0] = getc(yyin);
-       c[1] = getc(yyin);
-       if (c[0] == 0xff && c[1] == 0xfe) {
-               utf16 = true;
-       } else {
-               rewind(yyin);
-       }
-
-       yyparse();
-
-       return NULL; /* FIXME */
-}
-
diff --git a/source4/lib/policy/lex.l b/source4/lib/policy/lex.l
deleted file mode 100644 (file)
index dc1f0aa..0000000
+++ /dev/null
@@ -1,142 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
-   Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
-   
-   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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-
-%{
-#include "includes.h"
-#include "lib/policy/parse_adm.h"
-void error_message (const char *format, ...);
-int yyparse (void);
-
-static int lineno = 1;
-static bool utf16 = false;
-
-#define YY_INPUT(buf,result,max_size) \
-{ \
-       if (utf16) { \
-               uint16_t v; \
-               if (fread(&v, 2, 1, yyin) < 1) \
-                       result = YY_NULL; \
-               else \
-                       result = push_codepoint(buf, v); \
-       } else { \
-               int c = getc(yyin); \
-               result = (c == EOF) ? YY_NULL : (buf[0] = c, 1); \
-       } \
-}
-
-%}
-
-%%
-
-ACTIONLIST { return ACTIONLIST; }
-CATEGORY { return CATEGORY; }
-CHECKBOX { return CHECKBOX; }
-CLASS { return CLASS; }
-DELETE { return DEL; }
-DEFAULT { return DEFAULT; }
-DROPDOWNLIST { return DROPDOWNLIST; }
-EDITTEXT { return EDITTEXT; }
-END { return END; }
-EXPLAIN { return EXPLAIN; }
-ITEMLIST { return ITEMLIST; }
-KEYNAME { return KEYNAME; }
-MACHINE { return CLASS_MACHINE; }
-MIN { return MINIMUM; }
-MAX { return MAXIMUM; }
-NAME { return NAME; }
-NUMERIC { return NUMERIC; }
-PART { return PART; }
-POLICY { return POLICY; }
-REQUIRED { return REQUIRED; }
-SPIN { return SPIN; }
-SUPPORTED { return SUPPORTED; }
-TEXT { return TEXT; }
-USER { return CLASS_USER; }
-VALUE { return VALUE; }
-VALUENAME { return VALUENAME; }
-VALUEON { return VALUEON; }
-VALUEOFF { return VALUEOFF; }
-=              { return EQUALS; }
-\[strings\]    { return STRINGSSECTION; }
-
-[0-9]+ {
-       char *e, *y = yytext;
-       yylval.integer = strtol((const char *)yytext, &e, 0);
-       if(e == y)
-               error_message("malformed constant (%s)", yytext);
-       else
-               return INTEGER;
-               }
-
-[A-Za-z\\{}][{}\-\\A-Za-z0-9_]* { 
-       yylval.text = strdup ((const char *)yytext);
-       return LITERAL;
-       }
-
-"!!"[A-Za-z][-A-Za-z0-9_]*  {
-       yylval.text = strdup ((const char *)yytext);
-       return LOOKUPLITERAL;
-       }
-[ \t]+
-\n                     { lineno++; }
-;[^\n]*\n              { lineno++; }
-\"([^\n]+)\n           { lineno++; yylval.text = strdup((const char *)yytext); return LITERAL; }
-%%
-
-#ifndef yywrap /* XXX */
-int
-yywrap () 
-{
-     return 1;
-}
-#endif
-
-
-void
-error_message (const char *format, ...)
-{
-       va_list args;
-
-       va_start (args, format);
-       fprintf (stderr, "%d:", lineno);
-       vfprintf (stderr, format, args);
-       va_end (args);
-}
-
-struct adm_file *adm_read_file(const char *file)
-{
-       uint8_t c[2];
-       yyin = fopen(file, "r");
-       if (yyin == NULL)
-               return NULL;
-
-       c[0] = getc(yyin);
-       c[1] = getc(yyin);
-       if (c[0] == 0xff && c[1] == 0xfe) {
-               utf16 = true;
-       } else {
-               rewind(yyin);
-       }
-
-       yyparse();
-
-       return NULL; /* FIXME */
-}
diff --git a/source4/lib/policy/parse_adm.c b/source4/lib/policy/parse_adm.c
deleted file mode 100644 (file)
index c68e2db..0000000
+++ /dev/null
@@ -1,1726 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
-
-/* Skeleton implementation for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
-
-   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 2, 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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
-   simplifying the original so-called "semantic" parser.  */
-
-/* All symbols defined below should begin with yy or YY, to avoid
-   infringing on user name space.  This should be done even for local
-   variables, as they might otherwise be expanded by user macros.
-   There are some unavoidable exceptions within include files to
-   define necessary library symbols; they are noted "INFRINGES ON
-   USER NAME SPACE" below.  */
-
-/* Identify Bison output.  */
-#define YYBISON 1
-
-/* Bison version.  */
-#define YYBISON_VERSION "2.3"
-
-/* Skeleton name.  */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers.  */
-#define YYPURE 0
-
-/* Using locations.  */
-#define YYLSP_NEEDED 0
-
-
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     CATEGORY = 258,
-     CLASS = 259,
-     CLASS_USER = 260,
-     CLASS_MACHINE = 261,
-     POLICY = 262,
-     KEYNAME = 263,
-     EXPLAIN = 264,
-     VALUENAME = 265,
-     VALUEON = 266,
-     VALUEOFF = 267,
-     PART = 268,
-     ITEMLIST = 269,
-     NAME = 270,
-     VALUE = 271,
-     NUMERIC = 272,
-     EDITTEXT = 273,
-     TEXT = 274,
-     DROPDOWNLIST = 275,
-     CHECKBOX = 276,
-     MINIMUM = 277,
-     MAXIMUM = 278,
-     DEFAULT = 279,
-     END = 280,
-     ACTIONLIST = 281,
-     DEL = 282,
-     SUPPORTED = 283,
-     LITERAL = 284,
-     INTEGER = 285,
-     LOOKUPLITERAL = 286,
-     CLIENTEXT = 287,
-     REQUIRED = 288,
-     NOSORT = 289,
-     SPIN = 290,
-     EQUALS = 291,
-     STRINGSSECTION = 292
-   };
-#endif
-/* Tokens.  */
-#define CATEGORY 258
-#define CLASS 259
-#define CLASS_USER 260
-#define CLASS_MACHINE 261
-#define POLICY 262
-#define KEYNAME 263
-#define EXPLAIN 264
-#define VALUENAME 265
-#define VALUEON 266
-#define VALUEOFF 267
-#define PART 268
-#define ITEMLIST 269
-#define NAME 270
-#define VALUE 271
-#define NUMERIC 272
-#define EDITTEXT 273
-#define TEXT 274
-#define DROPDOWNLIST 275
-#define CHECKBOX 276
-#define MINIMUM 277
-#define MAXIMUM 278
-#define DEFAULT 279
-#define END 280
-#define ACTIONLIST 281
-#define DEL 282
-#define SUPPORTED 283
-#define LITERAL 284
-#define INTEGER 285
-#define LOOKUPLITERAL 286
-#define CLIENTEXT 287
-#define REQUIRED 288
-#define NOSORT 289
-#define SPIN 290
-#define EQUALS 291
-#define STRINGSSECTION 292
-
-
-
-
-/* Copy the first part of user declarations.  */
-#line 24 "lib/policy/parse_adm.y"
-
-#include "config.h"
-void error_message (const char *format, ...);
-int yyparse (void);
-void yyerror (const char *s);
-extern int yylex (void);
-
-
-
-/* Enabling traces.  */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-
-/* Enabling verbose error messages.  */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* Enabling the token table.  */
-#ifndef YYTOKEN_TABLE
-# define YYTOKEN_TABLE 0
-#endif
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 33 "lib/policy/parse_adm.y"
-{
-       char *text;
-       int integer;
-}
-/* Line 187 of yacc.c.  */
-#line 184 "lib/policy/parse_adm.y"
-       YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-
-
-/* Copy the second part of user declarations.  */
-
-
-/* Line 216 of yacc.c.  */
-#line 197 "lib/policy/parse_adm.y"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-#  define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-#  define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-#  include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYSIZE_T size_t
-# else
-#  define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if YYENABLE_NLS
-#  if ENABLE_NLS
-#   include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-#   define YY_(msgid) dgettext ("bison-runtime", msgid)
-#  endif
-# endif
-# ifndef YY_
-#  define YY_(msgid) msgid
-# endif
-#endif
-
-/* Suppress unused-variable warnings by "using" E.  */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(e) ((void) (e))
-#else
-# define YYUSE(e) /* empty */
-#endif
-
-/* Identity function, used to suppress warnings about constant conditions.  */
-#ifndef lint
-# define YYID(n) (n)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int i)
-#else
-static int
-YYID (i)
-    int i;
-#endif
-{
-  return i;
-}
-#endif
-
-#if ! defined yyoverflow || YYERROR_VERBOSE
-
-/* The parser invokes alloca or malloc; define the necessary symbols.  */
-
-# ifdef YYSTACK_USE_ALLOCA
-#  if YYSTACK_USE_ALLOCA
-#   ifdef __GNUC__
-#    define YYSTACK_ALLOC __builtin_alloca
-#   elif defined __BUILTIN_VA_ARG_INCR
-#    include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-#   elif defined _AIX
-#    define YYSTACK_ALLOC __alloca
-#   elif defined _MSC_VER
-#    include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-#    define alloca _alloca
-#   else
-#    define YYSTACK_ALLOC alloca
-#    if ! defined _ALLOCA_H && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-#     include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#     ifndef _STDLIB_H
-#      define _STDLIB_H 1
-#     endif
-#    endif
-#   endif
-#  endif
-# endif
-
-# ifdef YYSTACK_ALLOC
-   /* Pacify GCC's `empty if-body' warning.  */
-#  define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-    /* The OS might guarantee only one guard page at the bottom of the stack,
-       and a page size can be as small as 4096 bytes.  So we cannot safely
-       invoke alloca (N) if N exceeds 4096.  Use a slightly smaller number
-       to allow for a few compiler-allocated temporary stack slots.  */
-#   define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-#  endif
-# else
-#  define YYSTACK_ALLOC YYMALLOC
-#  define YYSTACK_FREE YYFREE
-#  ifndef YYSTACK_ALLOC_MAXIMUM
-#   define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-#  endif
-#  if (defined __cplusplus && ! defined _STDLIB_H \
-       && ! ((defined YYMALLOC || defined malloc) \
-            && (defined YYFREE || defined free)))
-#   include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-#   ifndef _STDLIB_H
-#    define _STDLIB_H 1
-#   endif
-#  endif
-#  ifndef YYMALLOC
-#   define YYMALLOC malloc
-#   if ! defined malloc && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-#  ifndef YYFREE
-#   define YYFREE free
-#   if ! defined free && ! defined _STDLIB_H && (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-#   endif
-#  endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
-     && (! defined __cplusplus \
-        || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member.  */
-union yyalloc
-{
-  yytype_int16 yyss;
-  YYSTYPE yyvs;
-  };
-
-/* The size of the maximum gap between one aligned stack and the next.  */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
-   N elements.  */
-# define YYSTACK_BYTES(N) \
-     ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
-      + YYSTACK_GAP_MAXIMUM)
-
-/* Copy COUNT objects from FROM to TO.  The source and destination do
-   not overlap.  */
-# ifndef YYCOPY
-#  if defined __GNUC__ && 1 < __GNUC__
-#   define YYCOPY(To, From, Count) \
-      __builtin_memcpy (To, From, (Count) * sizeof (*(From)))
-#  else
-#   define YYCOPY(To, From, Count)             \
-      do                                       \
-       {                                       \
-         YYSIZE_T yyi;                         \
-         for (yyi = 0; yyi < (Count); yyi++)   \
-           (To)[yyi] = (From)[yyi];            \
-       }                                       \
-      while (YYID (0))
-#  endif
-# endif
-
-/* Relocate STACK from its old location to the new one.  The
-   local variables YYSIZE and YYSTACKSIZE give the old and new number of
-   elements in the stack, and YYPTR gives the new location of the
-   stack.  Advance YYPTR to a properly aligned location for the next
-   stack.  */
-# define YYSTACK_RELOCATE(Stack)                                       \
-    do                                                                 \
-      {                                                                        \
-       YYSIZE_T yynewbytes;                                            \
-       YYCOPY (&yyptr->Stack, Stack, yysize);                          \
-       Stack = &yyptr->Stack;                                          \
-       yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
-       yyptr += yynewbytes / sizeof (*yyptr);                          \
-      }                                                                        \
-    while (YYID (0))
-
-#endif
-
-/* YYFINAL -- State number of the termination state.  */
-#define YYFINAL  8
-/* YYLAST -- Last index in YYTABLE.  */
-#define YYLAST   112
-
-/* YYNTOKENS -- Number of terminals.  */
-#define YYNTOKENS  38
-/* YYNNTS -- Number of nonterminals.  */
-#define YYNNTS  38
-/* YYNRULES -- Number of rules.  */
-#define YYNRULES  78
-/* YYNRULES -- Number of states.  */
-#define YYNSTATES  119
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX.  */
-#define YYUNDEFTOK  2
-#define YYMAXUTOK   292
-
-#define YYTRANSLATE(YYX)                                               \
-  ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX.  */
-static const yytype_uint8 yytranslate[] =
-{
-       0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
-       2,     2,     2,     2,     2,     2,     1,     2,     3,     4,
-       5,     6,     7,     8,     9,    10,    11,    12,    13,    14,
-      15,    16,    17,    18,    19,    20,    21,    22,    23,    24,
-      25,    26,    27,    28,    29,    30,    31,    32,    33,    34,
-      35,    36,    37
-};
-
-#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
-   YYRHS.  */
-static const yytype_uint8 yyprhs[] =
-{
-       0,     0,     3,     6,     7,    10,    14,    16,    18,    19,
-      22,    24,    26,    32,    34,    36,    38,    40,    43,    44,
-      50,    52,    54,    56,    58,    60,    62,    64,    66,    68,
-      70,    73,    74,    76,    78,    80,    82,    84,    91,    94,
-      96,    98,   100,   102,   104,   106,   108,   110,   112,   114,
-     117,   118,   121,   124,   127,   130,   132,   135,   138,   141,
-     144,   147,   152,   155,   158,   160,   162,   164,   166,   167,
-     170,   173,   178,   181,   184,   185,   189,   192,   193
-};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS.  */
-static const yytype_int8 yyrhs[] =
-{
-      39,     0,    -1,    40,    75,    -1,    -1,    41,    40,    -1,
-       4,    42,    43,    -1,     5,    -1,     6,    -1,    -1,    45,
-      43,    -1,    29,    -1,    31,    -1,     3,    44,    47,    25,
-       3,    -1,    59,    -1,    45,    -1,    48,    -1,    64,    -1,
-      46,    47,    -1,    -1,     7,    44,    50,    25,     7,    -1,
-      59,    -1,    64,    -1,    63,    -1,    61,    -1,    62,    -1,
-      56,    -1,    57,    -1,    58,    -1,    70,    -1,    52,    -1,
-      49,    50,    -1,    -1,    17,    -1,    18,    -1,    19,    -1,
-      20,    -1,    21,    -1,    13,    44,    51,    55,    25,    13,
-      -1,    35,    30,    -1,    64,    -1,    63,    -1,    61,    -1,
-      62,    -1,    56,    -1,    57,    -1,    58,    -1,    65,    -1,
-      33,    -1,    53,    -1,    54,    55,    -1,    -1,    22,    30,
-      -1,    23,    30,    -1,    24,    30,    -1,     9,    44,    -1,
-      27,    -1,    17,    30,    -1,    11,    60,    -1,    12,    60,
-      -1,    10,    44,    -1,     8,    44,    -1,    14,    69,    25,
-      14,    -1,    15,    44,    -1,    16,    60,    -1,    66,    -1,
-      67,    -1,    24,    -1,    71,    -1,    -1,    68,    69,    -1,
-      28,    44,    -1,    26,    72,    25,    26,    -1,    63,    72,
-      -1,    67,    72,    -1,    -1,    29,    36,    29,    -1,    73,
-      74,    -1,    -1,    37,    74,    -1
-};
-
-/* YYRLINE[YYN] -- source line where rule number YYN was defined.  */
-static const yytype_uint8 yyrline[] =
-{
-       0,    71,    71,    73,    73,    75,    76,    76,    78,    78,
-      80,    80,    82,    84,    84,    84,    84,    85,    85,    87,
-      88,    88,    88,    88,    88,    88,    88,    88,    88,    88,
-      89,    89,    91,    91,    91,    91,    91,    93,    95,    97,
-      97,    97,    97,    97,    97,    97,    97,    97,    97,    98,
-      98,   100,   101,   102,   104,   105,   105,   107,   108,   110,
-     111,   113,   114,   115,   117,   117,   117,   117,   118,   118,
-     120,   122,   123,   123,   123,   125,   126,   126,   127
-};
-#endif
-
-#if YYDEBUG || YYERROR_VERBOSE || YYTOKEN_TABLE
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
-   First, the terminals, then, starting at YYNTOKENS, nonterminals.  */
-static const char *const yytname[] =
-{
-  "$end", "error", "$undefined", "CATEGORY", "CLASS", "CLASS_USER",
-  "CLASS_MACHINE", "POLICY", "KEYNAME", "EXPLAIN", "VALUENAME", "VALUEON",
-  "VALUEOFF", "PART", "ITEMLIST", "NAME", "VALUE", "NUMERIC", "EDITTEXT",
-  "TEXT", "DROPDOWNLIST", "CHECKBOX", "MINIMUM", "MAXIMUM", "DEFAULT",
-  "END", "ACTIONLIST", "DEL", "SUPPORTED", "LITERAL", "INTEGER",
-  "LOOKUPLITERAL", "CLIENTEXT", "REQUIRED", "NOSORT", "SPIN", "EQUALS",
-  "STRINGSSECTION", "$accept", "admfile", "classes", "class", "classvalue",
-  "categories", "string", "category", "categoryitem", "categoryitems",
-  "policy", "policyitem", "policyitems", "valuetype", "part", "spin",
-  "partitem", "partitems", "min", "max", "defaultvalue", "explain",
-  "value", "valueon", "valueoff", "valuename", "keyname", "itemlist",
-  "itemname", "itemvalue", "item", "items", "supported", "actionlist",
-  "actions", "variable", "variables", "strings", 0
-};
-#endif
-
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
-   token YYLEX-NUM.  */
-static const yytype_uint16 yytoknum[] =
-{
-       0,   256,   257,   258,   259,   260,   261,   262,   263,   264,
-     265,   266,   267,   268,   269,   270,   271,   272,   273,   274,
-     275,   276,   277,   278,   279,   280,   281,   282,   283,   284,
-     285,   286,   287,   288,   289,   290,   291,   292
-};
-# endif
-
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives.  */
-static const yytype_uint8 yyr1[] =
-{
-       0,    38,    39,    40,    40,    41,    42,    42,    43,    43,
-      44,    44,    45,    46,    46,    46,    46,    47,    47,    48,
-      49,    49,    49,    49,    49,    49,    49,    49,    49,    49,
-      50,    50,    51,    51,    51,    51,    51,    52,    53,    54,
-      54,    54,    54,    54,    54,    54,    54,    54,    54,    55,
-      55,    56,    57,    58,    59,    60,    60,    61,    62,    63,
-      64,    65,    66,    67,    68,    68,    68,    68,    69,    69,
-      70,    71,    72,    72,    72,    73,    74,    74,    75
-};
-
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN.  */
-static const yytype_uint8 yyr2[] =
-{
-       0,     2,     2,     0,     2,     3,     1,     1,     0,     2,
-       1,     1,     5,     1,     1,     1,     1,     2,     0,     5,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     1,
-       2,     0,     1,     1,     1,     1,     1,     6,     2,     1,
-       1,     1,     1,     1,     1,     1,     1,     1,     1,     2,
-       0,     2,     2,     2,     2,     1,     2,     2,     2,     2,
-       2,     4,     2,     2,     1,     1,     1,     1,     0,     2,
-       2,     4,     2,     2,     0,     3,     2,     0,     2
-};
-
-/* YYDEFACT[STATE-NAME] -- Default rule to reduce with in state
-   STATE-NUM when YYTABLE doesn't specify something else to do.  Zero
-   means the default is an error.  */
-static const yytype_uint8 yydefact[] =
-{
-       3,     0,     0,     0,     3,     6,     7,     8,     1,    77,
-       2,     4,     0,     5,     8,     0,    77,    78,    10,    11,
-      18,     9,     0,    76,     0,     0,     0,    14,    18,     0,
-      15,    13,    16,    75,    31,    60,    54,    17,     0,     0,
-       0,     0,     0,     0,     0,     0,     0,    31,     0,    29,
-      25,    26,    27,    20,    23,    24,    22,    21,    28,    12,
-      59,     0,    55,    57,    58,     0,    51,    52,    53,    70,
-      30,     0,    56,    32,    33,    34,    35,    36,    50,    19,
-      68,    47,     0,    48,    50,     0,    43,    44,    45,    41,
-      42,    40,    39,    46,     0,     0,    66,    74,    64,    65,
-      68,     0,    67,    38,    49,     0,    62,    63,    74,    74,
-       0,    69,     0,    37,    72,    73,     0,    61,    71
-};
-
-/* YYDEFGOTO[NTERM-NUM].  */
-static const yytype_int8 yydefgoto[] =
-{
-      -1,     2,     3,     4,     7,    13,    20,    14,    28,    29,
-      30,    47,    48,    78,    49,    83,    84,    85,    50,    51,
-      52,    31,    63,    54,    55,   108,    32,    93,    98,   109,
-     100,   101,    58,   102,   110,    16,    17,    10
-};
-
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
-   STATE-NUM.  */
-#define YYPACT_NINF -61
-static const yytype_int8 yypact[] =
-{
-      30,    46,    36,    12,    30,   -61,   -61,    70,   -61,    10,
-     -61,   -61,   -22,   -61,    70,    45,    10,   -61,   -61,   -61,
-      55,   -61,    53,   -61,   -22,   -22,   -22,   -61,    55,    58,
-     -61,   -61,   -61,   -61,    19,   -61,   -61,   -61,    81,   -22,
-       6,     6,   -22,    56,    57,    60,   -22,    19,    63,   -61,
-     -61,   -61,   -61,   -61,   -61,   -61,   -61,   -61,   -61,   -61,
-     -61,    61,   -61,   -61,   -61,    59,   -61,   -61,   -61,   -61,
-     -61,    78,   -61,   -61,   -61,   -61,   -61,   -61,     2,   -61,
-      29,   -61,    62,   -61,     2,    64,   -61,   -61,   -61,   -61,
-     -61,   -61,   -61,   -61,   -22,     6,   -61,    -5,   -61,   -61,
-      29,    68,   -61,   -61,   -61,    82,   -61,   -61,    -5,    -5,
-      69,   -61,    83,   -61,   -61,   -61,    72,   -61,   -61
-};
-
-/* YYPGOTO[NTERM-NUM].  */
-static const yytype_int8 yypgoto[] =
-{
-     -61,   -61,    92,   -61,   -61,    85,   -24,    18,   -61,    73,
-     -61,   -61,    65,   -61,   -61,   -61,   -61,    16,   -19,   -18,
-     -17,   -26,   -38,   -10,    -9,   -30,   -28,   -61,   -61,   -60,
-     -61,     3,   -61,   -61,   -37,   -61,    86,   -61
-};
-
-/* YYTABLE[YYPACT[STATE-NUM]].  What to do in state STATE-NUM.  If
-   positive, shift that token.  If negative, reduce the rule which
-   number is the opposite.  If zero, do what YYDEFACT says.
-   If YYTABLE_NINF, syntax error.  */
-#define YYTABLE_NINF -1
-static const yytype_uint8 yytable[] =
-{
-      34,    35,    36,    64,    56,    39,    57,    18,    53,    19,
-      25,    95,    39,    40,    41,    60,    80,    56,    65,    57,
-      99,    53,    69,    61,    43,    44,    45,    25,    26,    39,
-      40,    41,    42,    62,     1,    81,     8,    82,    27,    15,
-      99,    43,    44,    45,    94,    95,    27,    46,    91,     9,
-      92,     5,     6,    96,    91,    97,    92,   107,    12,    86,
-      87,    88,    24,    25,    26,    86,    87,    88,    89,    90,
-     106,   114,   115,    12,    89,    90,    73,    74,    75,    76,
-      77,    22,    33,    38,    59,    79,    66,    67,    71,   105,
-      68,    72,   103,   112,   116,   113,    11,   117,   118,    21,
-     104,    37,    23,   111,     0,     0,     0,     0,     0,     0,
-       0,     0,    70
-};
-
-static const yytype_int8 yycheck[] =
-{
-      24,    25,    26,    41,    34,    10,    34,    29,    34,    31,
-       8,    16,    10,    11,    12,    39,    14,    47,    42,    47,
-      80,    47,    46,    17,    22,    23,    24,     8,     9,    10,
-      11,    12,    13,    27,     4,    33,     0,    35,    20,    29,
-     100,    22,    23,    24,    15,    16,    28,    28,    78,    37,
-      78,     5,     6,    24,    84,    26,    84,    95,     3,    78,
-      78,    78,     7,     8,     9,    84,    84,    84,    78,    78,
-      94,   108,   109,     3,    84,    84,    17,    18,    19,    20,
-      21,    36,    29,    25,     3,     7,    30,    30,    25,    25,
-      30,    30,    30,    25,    25,    13,     4,    14,    26,    14,
-      84,    28,    16,   100,    -1,    -1,    -1,    -1,    -1,    -1,
-      -1,    -1,    47
-};
-
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
-   symbol of state STATE-NUM.  */
-static const yytype_uint8 yystos[] =
-{
-       0,     4,    39,    40,    41,     5,     6,    42,     0,    37,
-      75,    40,     3,    43,    45,    29,    73,    74,    29,    31,
-      44,    43,    36,    74,     7,     8,     9,    45,    46,    47,
-      48,    59,    64,    29,    44,    44,    44,    47,    25,    10,
-      11,    12,    13,    22,    23,    24,    28,    49,    50,    52,
-      56,    57,    58,    59,    61,    62,    63,    64,    70,     3,
-      44,    17,    27,    60,    60,    44,    30,    30,    30,    44,
-      50,    25,    30,    17,    18,    19,    20,    21,    51,     7,
-      14,    33,    35,    53,    54,    55,    56,    57,    58,    61,
-      62,    63,    64,    65,    15,    16,    24,    26,    66,    67,
-      68,    69,    71,    30,    55,    25,    44,    60,    63,    67,
-      72,    69,    25,    13,    72,    72,    25,    14,    26
-};
-
-#define yyerrok                (yyerrstatus = 0)
-#define yyclearin      (yychar = YYEMPTY)
-#define YYEMPTY                (-2)
-#define YYEOF          0
-
-#define YYACCEPT       goto yyacceptlab
-#define YYABORT                goto yyabortlab
-#define YYERROR                goto yyerrorlab
-
-
-/* Like YYERROR except do call yyerror.  This remains here temporarily
-   to ease the transition to the new meaning of YYERROR, for GCC.
-   Once GCC version 2 has supplanted version 1, this can go.  */
-
-#define YYFAIL         goto yyerrlab
-
-#define YYRECOVERING()  (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value)                                 \
-do                                                             \
-  if (yychar == YYEMPTY && yylen == 1)                         \
-    {                                                          \
-      yychar = (Token);                                                \
-      yylval = (Value);                                                \
-      yytoken = YYTRANSLATE (yychar);                          \
-      YYPOPSTACK (1);                                          \
-      goto yybackup;                                           \
-    }                                                          \
-  else                                                         \
-    {                                                          \
-      yyerror (YY_("syntax error: cannot back up")); \
-      YYERROR;                                                 \
-    }                                                          \
-while (YYID (0))
-
-
-#define YYTERROR       1
-#define YYERRCODE      256
-
-
-/* YYLLOC_DEFAULT -- Set CURRENT to span from RHS[1] to RHS[N].
-   If N is 0, then set CURRENT to the empty location which ends
-   the previous symbol: RHS[0] (always defined).  */
-
-#define YYRHSLOC(Rhs, K) ((Rhs)[K])
-#ifndef YYLLOC_DEFAULT
-# define YYLLOC_DEFAULT(Current, Rhs, N)                               \
-    do                                                                 \
-      if (YYID (N))                                                    \
-       {                                                               \
-         (Current).first_line   = YYRHSLOC (Rhs, 1).first_line;        \
-         (Current).first_column = YYRHSLOC (Rhs, 1).first_column;      \
-         (Current).last_line    = YYRHSLOC (Rhs, N).last_line;         \
-         (Current).last_column  = YYRHSLOC (Rhs, N).last_column;       \
-       }                                                               \
-      else                                                             \
-       {                                                               \
-         (Current).first_line   = (Current).last_line   =              \
-           YYRHSLOC (Rhs, 0).last_line;                                \
-         (Current).first_column = (Current).last_column =              \
-           YYRHSLOC (Rhs, 0).last_column;                              \
-       }                                                               \
-    while (YYID (0))
-#endif
-
-
-/* YY_LOCATION_PRINT -- Print the location on the stream.
-   This macro was not mandated originally: define only if we know
-   we won't break user code: when these are the locations we know.  */
-
-#ifndef YY_LOCATION_PRINT
-# if YYLTYPE_IS_TRIVIAL
-#  define YY_LOCATION_PRINT(File, Loc)                 \
-     fprintf (File, "%d.%d-%d.%d",                     \
-             (Loc).first_line, (Loc).first_column,     \
-             (Loc).last_line,  (Loc).last_column)
-# else
-#  define YY_LOCATION_PRINT(File, Loc) ((void) 0)
-# endif
-#endif
-
-
-/* YYLEX -- calling `yylex' with the right arguments.  */
-
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
-
-/* Enable debugging if requested.  */
-#if YYDEBUG
-
-# ifndef YYFPRINTF
-#  include <stdio.h> /* INFRINGES ON USER NAME SPACE */
-#  define YYFPRINTF fprintf
-# endif
-
-# define YYDPRINTF(Args)                       \
-do {                                           \
-  if (yydebug)                                 \
-    YYFPRINTF Args;                            \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)                   \
-do {                                                                     \
-  if (yydebug)                                                           \
-    {                                                                    \
-      YYFPRINTF (stderr, "%s ", Title);                                          \
-      yy_symbol_print (stderr,                                           \
-                 Type, Value); \
-      YYFPRINTF (stderr, "\n");                                                  \
-    }                                                                    \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
-{
-  if (!yyvaluep)
-    return;
-# ifdef YYPRINT
-  if (yytype < YYNTOKENS)
-    YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
-  YYUSE (yyoutput);
-# endif
-  switch (yytype)
-    {
-      default:
-       break;
-    }
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT.  |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
-    FILE *yyoutput;
-    int yytype;
-    YYSTYPE const * const yyvaluep;
-#endif
-{
-  if (yytype < YYNTOKENS)
-    YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
-  else
-    YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
-  yy_symbol_value_print (yyoutput, yytype, yyvaluep);
-  YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included).                                                   |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *bottom, yytype_int16 *top)
-#else
-static void
-yy_stack_print (bottom, top)
-    yytype_int16 *bottom;
-    yytype_int16 *top;
-#endif
-{
-  YYFPRINTF (stderr, "Stack now");
-  for (; bottom <= top; ++bottom)
-    YYFPRINTF (stderr, " %d", *bottom);
-  YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top)                           \
-do {                                                           \
-  if (yydebug)                                                 \
-    yy_stack_print ((Bottom), (Top));                          \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced.  |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule)
-    YYSTYPE *yyvsp;
-    int yyrule;
-#endif
-{
-  int yynrhs = yyr2[yyrule];
-  int yyi;
-  unsigned long int yylno = yyrline[yyrule];
-  YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
-            yyrule - 1, yylno);
-  /* The symbols being reduced.  */
-  for (yyi = 0; yyi < yynrhs; yyi++)
-    {
-      fprintf (stderr, "   $%d = ", yyi + 1);
-      yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
-                      &(yyvsp[(yyi + 1) - (yynrhs)])
-                                      );
-      fprintf (stderr, "\n");
-    }
-}
-
-# define YY_REDUCE_PRINT(Rule)         \
-do {                                   \
-  if (yydebug)                         \
-    yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
-
-/* Nonzero means print parse trace.  It is left uninitialized so that
-   multiple parsers can coexist.  */
-int yydebug;
-#else /* !YYDEBUG */
-# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
-#endif /* !YYDEBUG */
-
-
-/* YYINITDEPTH -- initial size of the parser's stacks.  */
-#ifndef        YYINITDEPTH
-# define YYINITDEPTH 200
-#endif
-
-/* YYMAXDEPTH -- maximum size the stacks can grow to (effective only
-   if the built-in stack extension method is used).
-
-   Do not make this value too large; the results are undefined if
-   YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
-   evaluated with infinite-precision integer arithmetic.  */
-
-#ifndef YYMAXDEPTH
-# define YYMAXDEPTH 10000
-#endif
-
-\f
-
-#if YYERROR_VERBOSE
-
-# ifndef yystrlen
-#  if defined __GLIBC__ && defined _STRING_H
-#   define yystrlen strlen
-#  else
-/* Return the length of YYSTR.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static YYSIZE_T
-yystrlen (const char *yystr)
-#else
-static YYSIZE_T
-yystrlen (yystr)
-    const char *yystr;
-#endif
-{
-  YYSIZE_T yylen;
-  for (yylen = 0; yystr[yylen]; yylen++)
-    continue;
-  return yylen;
-}
-#  endif
-# endif
-
-# ifndef yystpcpy
-#  if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
-#   define yystpcpy stpcpy
-#  else
-/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
-   YYDEST.  */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static char *
-yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
-yystpcpy (yydest, yysrc)
-    char *yydest;
-    const char *yysrc;
-#endif
-{
-  char *yyd = yydest;
-  const char *yys = yysrc;
-
-  while ((*yyd++ = *yys++) != '\0')
-    continue;
-
-  return yyd - 1;
-}
-#  endif
-# endif
-
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
-   quotes and backslashes, so that it's suitable for yyerror.  The
-   heuristic is that double-quoting is unnecessary unless the string
-   contains an apostrophe, a comma, or backslash (other than
-   backslash-backslash).  YYSTR is taken from yytname.  If YYRES is
-   null, do not copy; instead, return the length of what the result
-   would have been.  */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
-  if (*yystr == '"')
-    {
-      YYSIZE_T yyn = 0;
-      char const *yyp = yystr;
-
-      for (;;)
-       switch (*++yyp)
-         {
-         case '\'':
-         case ',':
-           goto do_not_strip_quotes;
-
-         case '\\':
-           if (*++yyp != '\\')
-             goto do_not_strip_quotes;
-           /* Fall through.  */
-         default:
-           if (yyres)
-             yyres[yyn] = *yyp;
-           yyn++;
-           break;
-
-         case '"':
-           if (yyres)
-             yyres[yyn] = '\0';
-           return yyn;
-         }
-    do_not_strip_quotes: ;
-    }
-
-  if (! yyres)
-    return yystrlen (yystr);
-
-  return yystpcpy (yyres, yystr) - yyres;
-}
-# endif
-
-/* Copy into YYRESULT an error message about the unexpected token
-   YYCHAR while in state YYSTATE.  Return the number of bytes copied,
-   including the terminating null byte.  If YYRESULT is null, do not
-   copy anything; just return the number of bytes that would be
-   copied.  As a special case, return 0 if an ordinary "syntax error"
-   message will do.  Return YYSIZE_MAXIMUM if overflow occurs during
-   size calculation.  */
-static YYSIZE_T
-yysyntax_error (char *yyresult, int yystate, int yychar)
-{
-  int yyn = yypact[yystate];
-
-  if (! (YYPACT_NINF < yyn && yyn <= YYLAST))
-    return 0;
-  else
-    {
-      int yytype = YYTRANSLATE (yychar);
-      YYSIZE_T yysize0 = yytnamerr (0, yytname[yytype]);
-      YYSIZE_T yysize = yysize0;
-      YYSIZE_T yysize1;
-      int yysize_overflow = 0;
-      enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
-      char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
-      int yyx;
-
-# if 0
-      /* This is so xgettext sees the translatable formats that are
-        constructed on the fly.  */
-      YY_("syntax error, unexpected %s");
-      YY_("syntax error, unexpected %s, expecting %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s");
-      YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s");
-# endif
-      char *yyfmt;
-      char const *yyf;
-      static char const yyunexpected[] = "syntax error, unexpected %s";
-      static char const yyexpecting[] = ", expecting %s";
-      static char const yyor[] = " or %s";
-      char yyformat[sizeof yyunexpected
-                   + sizeof yyexpecting - 1
-                   + ((YYERROR_VERBOSE_ARGS_MAXIMUM - 2)
-                      * (sizeof yyor - 1))];
-      char const *yyprefix = yyexpecting;
-
-      /* Start YYX at -YYN if negative to avoid negative indexes in
-        YYCHECK.  */
-      int yyxbegin = yyn < 0 ? -yyn : 0;
-
-      /* Stay within bounds of both yycheck and yytname.  */
-      int yychecklim = YYLAST - yyn + 1;
-      int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
-      int yycount = 1;
-
-      yyarg[0] = yytname[yytype];
-      yyfmt = yystpcpy (yyformat, yyunexpected);
-
-      for (yyx = yyxbegin; yyx < yyxend; ++yyx)
-       if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR)
-         {
-           if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
-             {
-               yycount = 1;
-               yysize = yysize0;
-               yyformat[sizeof yyunexpected - 1] = '\0';
-               break;
-             }
-           yyarg[yycount++] = yytname[yyx];
-           yysize1 = yysize + yytnamerr (0, yytname[yyx]);
-           yysize_overflow |= (yysize1 < yysize);
-           yysize = yysize1;
-           yyfmt = yystpcpy (yyfmt, yyprefix);
-           yyprefix = yyor;
-         }
-
-      yyf = YY_(yyformat);
-      yysize1 = yysize + yystrlen (yyf);
-      yysize_overflow |= (yysize1 < yysize);
-      yysize = yysize1;
-
-      if (yysize_overflow)
-       return YYSIZE_MAXIMUM;
-
-      if (yyresult)
-       {
-         /* Avoid sprintf, as that infringes on the user's name space.
-            Don't have undefined behavior even if the translation
-            produced a string with the wrong number of "%s"s.  */
-         char *yyp = yyresult;
-         int yyi = 0;
-         while ((*yyp = *yyf) != '\0')
-           {
-             if (*yyp == '%' && yyf[1] == 's' && yyi < yycount)
-               {
-                 yyp += yytnamerr (yyp, yyarg[yyi++]);
-                 yyf += 2;
-               }
-             else
-               {
-                 yyp++;
-                 yyf++;
-               }
-           }
-       }
-      return yysize;
-    }
-}
-#endif /* YYERROR_VERBOSE */
-\f
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol.  |
-`-----------------------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
-#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
-    const char *yymsg;
-    int yytype;
-    YYSTYPE *yyvaluep;
-#endif
-{
-  YYUSE (yyvaluep);
-
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
-  switch (yytype)
-    {
-
-      default:
-       break;
-    }
-}
-\f
-
-/* Prevent warnings from -Wmissing-prototypes.  */
-
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-
-
-/* The look-ahead symbol.  */
-int yychar;
-
-/* The semantic value of the look-ahead symbol.  */
-YYSTYPE yylval;
-
-/* Number of syntax errors so far.  */
-int yynerrs;
-
-
-
-/*----------.
-| yyparse.  |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
-#else
-int
-yyparse (YYPARSE_PARAM)
-    void *YYPARSE_PARAM;
-#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
-     || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
-  
-  int yystate;
-  int yyn;
-  int yyresult;
-  /* Number of tokens to shift before error messages enabled.  */
-  int yyerrstatus;
-  /* Look-ahead token as an internal (translated) token number.  */
-  int yytoken = 0;
-#if YYERROR_VERBOSE
-  /* Buffer for error messages, and its allocated size.  */
-  char yymsgbuf[128];
-  char *yymsg = yymsgbuf;
-  YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
-#endif
-
-  /* Three stacks and their tools:
-     `yyss': related to states,
-     `yyvs': related to semantic values,
-     `yyls': related to locations.
-
-     Refer to the stacks thru separate pointers, to allow yyoverflow
-     to reallocate them elsewhere.  */
-
-  /* The state stack.  */
-  yytype_int16 yyssa[YYINITDEPTH];
-  yytype_int16 *yyss = yyssa;
-  yytype_int16 *yyssp;
-
-  /* The semantic value stack.  */
-  YYSTYPE yyvsa[YYINITDEPTH];
-  YYSTYPE *yyvs = yyvsa;
-  YYSTYPE *yyvsp;
-
-
-
-#define YYPOPSTACK(N)   (yyvsp -= (N), yyssp -= (N))
-
-  YYSIZE_T yystacksize = YYINITDEPTH;
-
-  /* The variables used to return semantic value and location from the
-     action routines.  */
-  YYSTYPE yyval;
-
-
-  /* The number of symbols on the RHS of the reduced rule.
-     Keep to zero when no symbol should be popped.  */
-  int yylen = 0;
-
-  YYDPRINTF ((stderr, "Starting parse\n"));
-
-  yystate = 0;
-  yyerrstatus = 0;
-  yynerrs = 0;
-  yychar = YYEMPTY;            /* Cause a token to be read.  */
-
-  /* Initialize stack pointers.
-     Waste one element of value and location stack
-     so that they stay on the same level as the state stack.
-     The wasted elements are never initialized.  */
-
-  yyssp = yyss;
-  yyvsp = yyvs;
-
-  goto yysetstate;
-
-/*------------------------------------------------------------.
-| yynewstate -- Push a new state, which is found in yystate.  |
-`------------------------------------------------------------*/
- yynewstate:
-  /* In all cases, when you get here, the value and location stacks
-     have just been pushed.  So pushing a state here evens the stacks.  */
-  yyssp++;
-
- yysetstate:
-  *yyssp = yystate;
-
-  if (yyss + yystacksize - 1 <= yyssp)
-    {
-      /* Get the current used size of the three stacks, in elements.  */
-      YYSIZE_T yysize = yyssp - yyss + 1;
-
-#ifdef yyoverflow
-      {
-       /* Give user a chance to reallocate the stack.  Use copies of
-          these so that the &'s don't force the real ones into
-          memory.  */
-       YYSTYPE *yyvs1 = yyvs;
-       yytype_int16 *yyss1 = yyss;
-
-
-       /* Each stack pointer address is followed by the size of the
-          data in use in that stack, in bytes.  This used to be a
-          conditional around just the two extra args, but that might
-          be undefined if yyoverflow is a macro.  */
-       yyoverflow (YY_("memory exhausted"),
-                   &yyss1, yysize * sizeof (*yyssp),
-                   &yyvs1, yysize * sizeof (*yyvsp),
-
-                   &yystacksize);
-
-       yyss = yyss1;
-       yyvs = yyvs1;
-      }
-#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
-      goto yyexhaustedlab;
-# else
-      /* Extend the stack our own way.  */
-      if (YYMAXDEPTH <= yystacksize)
-       goto yyexhaustedlab;
-      yystacksize *= 2;
-      if (YYMAXDEPTH < yystacksize)
-       yystacksize = YYMAXDEPTH;
-
-      {
-       yytype_int16 *yyss1 = yyss;
-       union yyalloc *yyptr =
-         (union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
-       if (! yyptr)
-         goto yyexhaustedlab;
-       YYSTACK_RELOCATE (yyss);
-       YYSTACK_RELOCATE (yyvs);
-
-#  undef YYSTACK_RELOCATE
-       if (yyss1 != yyssa)
-         YYSTACK_FREE (yyss1);
-      }
-# endif
-#endif /* no yyoverflow */
-
-      yyssp = yyss + yysize - 1;
-      yyvsp = yyvs + yysize - 1;
-
-
-      YYDPRINTF ((stderr, "Stack size increased to %lu\n",
-                 (unsigned long int) yystacksize));
-
-      if (yyss + yystacksize - 1 <= yyssp)
-       YYABORT;
-    }
-
-  YYDPRINTF ((stderr, "Entering state %d\n", yystate));
-
-  goto yybackup;
-
-/*-----------.
-| yybackup.  |
-`-----------*/
-yybackup:
-
-  /* Do appropriate processing given the current state.  Read a
-     look-ahead token if we need one and don't already have one.  */
-
-  /* First try to decide what to do without reference to look-ahead token.  */
-  yyn = yypact[yystate];
-  if (yyn == YYPACT_NINF)
-    goto yydefault;
-
-  /* Not known => get a look-ahead token if don't already have one.  */
-
-  /* YYCHAR is either YYEMPTY or YYEOF or a valid look-ahead symbol.  */
-  if (yychar == YYEMPTY)
-    {
-      YYDPRINTF ((stderr, "Reading a token: "));
-      yychar = YYLEX;
-    }
-
-  if (yychar <= YYEOF)
-    {
-      yychar = yytoken = YYEOF;
-      YYDPRINTF ((stderr, "Now at end of input.\n"));
-    }
-  else
-    {
-      yytoken = YYTRANSLATE (yychar);
-      YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
-    }
-
-  /* If the proper action on seeing token YYTOKEN is to reduce or to
-     detect an error, take that action.  */
-  yyn += yytoken;
-  if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
-    goto yydefault;
-  yyn = yytable[yyn];
-  if (yyn <= 0)
-    {
-      if (yyn == 0 || yyn == YYTABLE_NINF)
-       goto yyerrlab;
-      yyn = -yyn;
-      goto yyreduce;
-    }
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  /* Count tokens shifted since error; after three, turn off error
-     status.  */
-  if (yyerrstatus)
-    yyerrstatus--;
-
-  /* Shift the look-ahead token.  */
-  YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
-
-  /* Discard the shifted token unless it is eof.  */
-  if (yychar != YYEOF)
-    yychar = YYEMPTY;
-
-  yystate = yyn;
-  *++yyvsp = yylval;
-
-  goto yynewstate;
-
-
-/*-----------------------------------------------------------.
-| yydefault -- do the default action for the current state.  |
-`-----------------------------------------------------------*/
-yydefault:
-  yyn = yydefact[yystate];
-  if (yyn == 0)
-    goto yyerrlab;
-  goto yyreduce;
-
-
-/*-----------------------------.
-| yyreduce -- Do a reduction.  |
-`-----------------------------*/
-yyreduce:
-  /* yyn is the number of a rule to reduce with.  */
-  yylen = yyr2[yyn];
-
-  /* If YYLEN is nonzero, implement the default value of the action:
-     `$$ = $1'.
-
-     Otherwise, the following line sets YYVAL to garbage.
-     This behavior is undocumented and Bison
-     users should not rely upon it.  Assigning to YYVAL
-     unconditionally makes the parser a bit smaller, and it avoids a
-     GCC warning that YYVAL may be used uninitialized.  */
-  yyval = yyvsp[1-yylen];
-
-
-  YY_REDUCE_PRINT (yyn);
-  switch (yyn)
-    {
-      
-/* Line 1267 of yacc.c.  */
-#line 1502 "lib/policy/parse_adm.y"
-      default: break;
-    }
-  YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-
-  *++yyvsp = yyval;
-
-
-  /* Now `shift' the result of the reduction.  Determine what state
-     that goes to, based on the state we popped back to and the rule
-     number reduced by.  */
-
-  yyn = yyr1[yyn];
-
-  yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
-  if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
-    yystate = yytable[yystate];
-  else
-    yystate = yydefgoto[yyn - YYNTOKENS];
-
-  goto yynewstate;
-
-
-/*------------------------------------.
-| yyerrlab -- here on detecting error |
-`------------------------------------*/
-yyerrlab:
-  /* If not already recovering from an error, report this error.  */
-  if (!yyerrstatus)
-    {
-      ++yynerrs;
-#if ! YYERROR_VERBOSE
-      yyerror (YY_("syntax error"));
-#else
-      {
-       YYSIZE_T yysize = yysyntax_error (0, yystate, yychar);
-       if (yymsg_alloc < yysize && yymsg_alloc < YYSTACK_ALLOC_MAXIMUM)
-         {
-           YYSIZE_T yyalloc = 2 * yysize;
-           if (! (yysize <= yyalloc && yyalloc <= YYSTACK_ALLOC_MAXIMUM))
-             yyalloc = YYSTACK_ALLOC_MAXIMUM;
-           if (yymsg != yymsgbuf)
-             YYSTACK_FREE (yymsg);
-           yymsg = (char *) YYSTACK_ALLOC (yyalloc);
-           if (yymsg)
-             yymsg_alloc = yyalloc;
-           else
-             {
-               yymsg = yymsgbuf;
-               yymsg_alloc = sizeof yymsgbuf;
-             }
-         }
-
-       if (0 < yysize && yysize <= yymsg_alloc)
-         {
-           (void) yysyntax_error (yymsg, yystate, yychar);
-           yyerror (yymsg);
-         }
-       else
-         {
-           yyerror (YY_("syntax error"));
-           if (yysize != 0)
-             goto yyexhaustedlab;
-         }
-      }
-#endif
-    }
-
-
-
-  if (yyerrstatus == 3)
-    {
-      /* If just tried and failed to reuse look-ahead token after an
-        error, discard it.  */
-
-      if (yychar <= YYEOF)
-       {
-         /* Return failure if at end of input.  */
-         if (yychar == YYEOF)
-           YYABORT;
-       }
-      else
-       {
-         yydestruct ("Error: discarding",
-                     yytoken, &yylval);
-         yychar = YYEMPTY;
-       }
-    }
-
-  /* Else will try to reuse look-ahead token after shifting the error
-     token.  */
-  goto yyerrlab1;
-
-
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR.  |
-`---------------------------------------------------*/
-yyerrorlab:
-
-  /* Pacify compilers like GCC when the user code never invokes
-     YYERROR and the label yyerrorlab therefore never appears in user
-     code.  */
-  if (/*CONSTCOND*/ 0)
-     goto yyerrorlab;
-
-  /* Do not reclaim the symbols of the rule which action triggered
-     this YYERROR.  */
-  YYPOPSTACK (yylen);
-  yylen = 0;
-  YY_STACK_PRINT (yyss, yyssp);
-  yystate = *yyssp;
-  goto yyerrlab1;
-
-
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR.  |
-`-------------------------------------------------------------*/
-yyerrlab1:
-  yyerrstatus = 3;     /* Each real token shifted decrements this.  */
-
-  for (;;)
-    {
-      yyn = yypact[yystate];
-      if (yyn != YYPACT_NINF)
-       {
-         yyn += YYTERROR;
-         if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
-           {
-             yyn = yytable[yyn];
-             if (0 < yyn)
-               break;
-           }
-       }
-
-      /* Pop the current state because it cannot handle the error token.  */
-      if (yyssp == yyss)
-       YYABORT;
-
-
-      yydestruct ("Error: popping",
-                 yystos[yystate], yyvsp);
-      YYPOPSTACK (1);
-      yystate = *yyssp;
-      YY_STACK_PRINT (yyss, yyssp);
-    }
-
-  if (yyn == YYFINAL)
-    YYACCEPT;
-
-  *++yyvsp = yylval;
-
-
-  /* Shift the error token.  */
-  YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
-
-  yystate = yyn;
-  goto yynewstate;
-
-
-/*-------------------------------------.
-| yyacceptlab -- YYACCEPT comes here.  |
-`-------------------------------------*/
-yyacceptlab:
-  yyresult = 0;
-  goto yyreturn;
-
-/*-----------------------------------.
-| yyabortlab -- YYABORT comes here.  |
-`-----------------------------------*/
-yyabortlab:
-  yyresult = 1;
-  goto yyreturn;
-
-#ifndef yyoverflow
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here.  |
-`-------------------------------------------------*/
-yyexhaustedlab:
-  yyerror (YY_("memory exhausted"));
-  yyresult = 2;
-  /* Fall through.  */
-#endif
-
-yyreturn:
-  if (yychar != YYEOF && yychar != YYEMPTY)
-     yydestruct ("Cleanup: discarding lookahead",
-                yytoken, &yylval);
-  /* Do not reclaim the symbols of the rule which action triggered
-     this YYABORT or YYACCEPT.  */
-  YYPOPSTACK (yylen);
-  YY_STACK_PRINT (yyss, yyssp);
-  while (yyssp != yyss)
-    {
-      yydestruct ("Cleanup: popping",
-                 yystos[*yyssp], yyvsp);
-      YYPOPSTACK (1);
-    }
-#ifndef yyoverflow
-  if (yyss != yyssa)
-    YYSTACK_FREE (yyss);
-#endif
-#if YYERROR_VERBOSE
-  if (yymsg != yymsgbuf)
-    YYSTACK_FREE (yymsg);
-#endif
-  /* Make sure YYID is used.  */
-  return YYID (yyresult);
-}
-
-
-#line 129 "lib/policy/parse_adm.y"
-
-
-void
-yyerror (const char *s)
-{
-     error_message ("%s\n", s);
-}
-
-
-
-
diff --git a/source4/lib/policy/parse_adm.h b/source4/lib/policy/parse_adm.h
deleted file mode 100644 (file)
index 372e4b9..0000000
+++ /dev/null
@@ -1,135 +0,0 @@
-/* A Bison parser, made by GNU Bison 2.3.  */
-
-/* Skeleton interface for Bison's Yacc-like parsers in C
-
-   Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
-   Free Software Foundation, Inc.
-
-   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 2, 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, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
-
-/* As a special exception, you may create a larger work that contains
-   part or all of the Bison parser skeleton and distribute that work
-   under terms of your choice, so long as that work isn't itself a
-   parser generator using the skeleton or a modified version thereof
-   as a parser skeleton.  Alternatively, if you modify or redistribute
-   the parser skeleton itself, you may (at your option) remove this
-   special exception, which will cause the skeleton and the resulting
-   Bison output files to be licensed under the GNU General Public
-   License without this special exception.
-
-   This special exception was added by the Free Software Foundation in
-   version 2.2 of Bison.  */
-
-/* Tokens.  */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
-   /* Put the tokens into the symbol table, so that GDB and other debuggers
-      know about them.  */
-   enum yytokentype {
-     CATEGORY = 258,
-     CLASS = 259,
-     CLASS_USER = 260,
-     CLASS_MACHINE = 261,
-     POLICY = 262,
-     KEYNAME = 263,
-     EXPLAIN = 264,
-     VALUENAME = 265,
-     VALUEON = 266,
-     VALUEOFF = 267,
-     PART = 268,
-     ITEMLIST = 269,
-     NAME = 270,
-     VALUE = 271,
-     NUMERIC = 272,
-     EDITTEXT = 273,
-     TEXT = 274,
-     DROPDOWNLIST = 275,
-     CHECKBOX = 276,
-     MINIMUM = 277,
-     MAXIMUM = 278,
-     DEFAULT = 279,
-     END = 280,
-     ACTIONLIST = 281,
-     DEL = 282,
-     SUPPORTED = 283,
-     LITERAL = 284,
-     INTEGER = 285,
-     LOOKUPLITERAL = 286,
-     CLIENTEXT = 287,
-     REQUIRED = 288,
-     NOSORT = 289,
-     SPIN = 290,
-     EQUALS = 291,
-     STRINGSSECTION = 292
-   };
-#endif
-/* Tokens.  */
-#define CATEGORY 258
-#define CLASS 259
-#define CLASS_USER 260
-#define CLASS_MACHINE 261
-#define POLICY 262
-#define KEYNAME 263
-#define EXPLAIN 264
-#define VALUENAME 265
-#define VALUEON 266
-#define VALUEOFF 267
-#define PART 268
-#define ITEMLIST 269
-#define NAME 270
-#define VALUE 271
-#define NUMERIC 272
-#define EDITTEXT 273
-#define TEXT 274
-#define DROPDOWNLIST 275
-#define CHECKBOX 276
-#define MINIMUM 277
-#define MAXIMUM 278
-#define DEFAULT 279
-#define END 280
-#define ACTIONLIST 281
-#define DEL 282
-#define SUPPORTED 283
-#define LITERAL 284
-#define INTEGER 285
-#define LOOKUPLITERAL 286
-#define CLIENTEXT 287
-#define REQUIRED 288
-#define NOSORT 289
-#define SPIN 290
-#define EQUALS 291
-#define STRINGSSECTION 292
-
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-#line 33 "lib/policy/parse_adm.y"
-{
-       char *text;
-       int integer;
-}
-/* Line 1489 of yacc.c.  */
-#line 128 "lib/policy/parse_adm.y"
-       YYSTYPE;
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-# define YYSTYPE_IS_TRIVIAL 1
-#endif
-
-extern YYSTYPE yylval;
-
diff --git a/source4/lib/policy/parse_adm.y b/source4/lib/policy/parse_adm.y
deleted file mode 100644 (file)
index 23c5e77..0000000
+++ /dev/null
@@ -1,138 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) 2006 Wilco Baan Hofman <wilco@baanhofman.nl>
-   Copyright (C) 2006 Jelmer Vernooij <jelmer@samba.org>
-   
-   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, write to the Free Software
-   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-   For more information on the .ADM file format:
-   http://msdn2.microsoft.com/en-us/library/aa372405.aspx 
-*/
-
-%{
-#include "config.h"
-void error_message (const char *format, ...);
-int yyparse (void);
-void yyerror (const char *s);
-extern int yylex (void);
-
-%}
-
-%union {
-       char *text;
-       int integer;
-}
-
-%token CATEGORY
-%token CLASS
-%token CLASS_USER
-%token CLASS_MACHINE
-%token POLICY
-%token KEYNAME
-%token EXPLAIN
-%token VALUENAME
-%token VALUEON VALUEOFF
-%token PART
-%token ITEMLIST
-%token NAME
-%token VALUE
-%token NUMERIC EDITTEXT TEXT DROPDOWNLIST CHECKBOX
-%token MINIMUM MAXIMUM DEFAULT
-%token END
-%token ACTIONLIST
-%token DEL
-%token SUPPORTED
-%token <text> LITERAL
-%token <integer> INTEGER
-%token <text> LOOKUPLITERAL
-%token CLIENTEXT
-%token REQUIRED
-%token NOSORT
-%token SPIN
-%token EQUALS
-%token STRINGSSECTION
-
-%start admfile
-
-%% 
-
-admfile: classes strings;
-
-classes: /* empty */ | class classes;
-
-class: CLASS classvalue categories;
-classvalue: CLASS_USER|CLASS_MACHINE;
-
-categories: /* empty */ | category categories;
-
-string: LITERAL | LOOKUPLITERAL;
-
-category: CATEGORY string categoryitems END CATEGORY;
-
-categoryitem: explain | category | policy | keyname;
-categoryitems: categoryitem categoryitems | /* empty */ ;
-
-policy: POLICY string policyitems END POLICY;
-policyitem: explain | keyname | valuename | valueon | valueoff | min | max | defaultvalue | supported | part;
-policyitems: policyitem policyitems | /* empty */;
-
-valuetype: NUMERIC | EDITTEXT | TEXT | DROPDOWNLIST | CHECKBOX;
-
-part: PART string valuetype partitems END PART;
-
-spin: SPIN INTEGER;
-
-partitem: keyname | valuename | valueon | valueoff | min | max | defaultvalue | itemlist | REQUIRED | spin;
-partitems: partitem partitems | /* empty */;
-
-min: MINIMUM INTEGER;
-max: MAXIMUM INTEGER;
-defaultvalue: DEFAULT INTEGER;
-
-explain: EXPLAIN string;
-value: DEL | NUMERIC INTEGER;
-
-valueon: VALUEON value;
-valueoff: VALUEOFF value;
-
-valuename: VALUENAME string;
-keyname: KEYNAME string;
-
-itemlist: ITEMLIST items END ITEMLIST;
-itemname: NAME string;
-itemvalue: VALUE value;
-
-item: itemname | itemvalue | DEFAULT | actionlist;
-items: /* empty */ | item items;
-
-supported: SUPPORTED string;
-
-actionlist: ACTIONLIST actions END ACTIONLIST;
-actions: valuename actions | itemvalue actions | /* empty */;
-
-variable: LITERAL EQUALS LITERAL;
-variables: variable variables | /* empty */;
-strings: STRINGSSECTION variables;
-
-%%
-
-void
-yyerror (const char *s)
-{
-     error_message ("%s\n", s);
-}
-
-
-
index 2a9b1a59ceff6d91cfaf679b16d7c94f7a03abc0..4a2309faeee00fb3fd67cde30d824c1b03220112 100644 (file)
@@ -28,6 +28,7 @@
 _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                              struct auth_session_info *session_info,
                              struct cli_credentials *credentials,
+                             struct event_context *ev_ctx,
                              struct loadparm_context *lp_ctx,
                              struct hive_key **root)
 {
@@ -57,7 +58,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
        } else if (!strncmp(peek, "TDB file", 8)) {
                close(fd);
                return reg_open_ldb_file(parent_ctx, location, session_info,
-                                        credentials, lp_ctx, root);
+                                        credentials, ev_ctx, lp_ctx, root);
        }
 
        return WERR_BADFILE;
index a764ca6235322885b4d4049f4a0cfb2d66f41d72..a8a9ed597e47db51bdea97cc208aec5b62255055 100644 (file)
@@ -357,6 +357,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h,
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
                         struct auth_session_info *session_info,
                         struct cli_credentials *credentials,
+                        struct event_context *ev_ctx,
                         struct loadparm_context *lp_ctx,
                         struct hive_key **k)
 {
@@ -367,7 +368,7 @@ WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
        if (location == NULL)
                return WERR_INVALID_PARAM;
 
-       wrap = ldb_wrap_connect(parent_ctx, lp_ctx,
+       wrap = ldb_wrap_connect(parent_ctx, ev_ctx, lp_ctx,
                                location, session_info, credentials, 0, NULL);
 
        if (wrap == NULL) {
index af235e7b04afad4eeb597188974f0743b97ce259..47d6d4cd32692224316e7d6f7fd7b489878d9480 100644 (file)
@@ -36,9 +36,6 @@ struct registry_local {
                struct hive_key *key;
                struct mountpoint *prev, *next;
        } *mountpoints;
-
-       struct auth_session_info *session_info;
-       struct cli_credentials *credentials;
 };
 
 struct local_key {
@@ -293,9 +290,7 @@ const static struct registry_operations local_ops = {
        .get_key_info = local_get_key_info,
 };
 
-WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx,
-                     struct auth_session_info *session_info,
-                     struct cli_credentials *credentials)
+WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx)
 {
        struct registry_local *ret = talloc_zero(mem_ctx,
                                                 struct registry_local);
@@ -303,8 +298,6 @@ WERROR reg_open_local(TALLOC_CTX *mem_ctx, struct registry_context **ctx,
        W_ERROR_HAVE_NO_MEMORY(ret);
 
        ret->ops = &local_ops;
-       ret->session_info = session_info;
-       ret->credentials = credentials;
 
        *ctx = (struct registry_context *)ret;
 
index a86294bf4656c1ab996a6c9d027d093c53560089..9c0f66b6d6ea9db922fa184b91e52aad2c9cb7b7 100644 (file)
@@ -149,10 +149,12 @@ struct hive_operations {
 
 struct cli_credentials;
 struct auth_session_info;
+struct event_context;
 
 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                     struct auth_session_info *session_info,
                     struct cli_credentials *credentials,
+                    struct event_context *ev_ctx,
                     struct loadparm_context *lp_ctx,
                     struct hive_key **root);
 WERROR hive_key_get_info(TALLOC_CTX *mem_ctx, const struct hive_key *key,
@@ -199,6 +201,7 @@ WERROR reg_open_regf_file(TALLOC_CTX *parent_ctx,
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
                         struct auth_session_info *session_info,
                         struct cli_credentials *credentials,
+                        struct event_context *ev_ctx,
                         struct loadparm_context *lp_ctx,
                         struct hive_key **k);
 
@@ -355,12 +358,11 @@ struct loadparm_context;
  * Open the locally defined registry.
  */
 WERROR reg_open_local(TALLOC_CTX *mem_ctx,
-                     struct registry_context **ctx,
-                     struct auth_session_info *session_info,
-                     struct cli_credentials *credentials);
+                     struct registry_context **ctx);
 
 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                      struct registry_context **ctx,
+                     struct event_context *ev_ctx,
                      struct loadparm_context *lp_ctx,
                      struct auth_session_info *session_info,
                      struct cli_credentials *credentials);
index 8ab402d57d133d8929cc6cf9d8eee3bf937c0e4c..5ffee4bb3dab341537d5bdf388eb6f1915ed3135 100644 (file)
@@ -26,6 +26,7 @@
 #include "includes.h"
 #include "registry.h"
 #include "param/param.h"
+#include "events/events.h"
 
 typedef struct registry_context reg;
 typedef struct hive_key hive_key;
@@ -41,6 +42,7 @@ typedef struct hive_key hive_key;
 %import "../../auth/credentials/credentials.i"
 %import "../../libcli/util/errors.i"
 %import "../../param/param.i"
+%import "../events/events.i"
 
 /* Utility functions */
 
@@ -57,9 +59,7 @@ const char *str_regtype(int type);
 }
 
 %rename(Registry) reg_open_local;
-WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx,
-                      struct auth_session_info *session_info,
-                      struct cli_credentials *credentials);
+WERROR reg_open_local(TALLOC_CTX *parent_ctx, struct registry_context **ctx);
 
 %typemap(in,noblock=1) const char ** {
   /* Check if is a list */
@@ -134,6 +134,7 @@ typedef struct registry_context {
 WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
                      struct auth_session_info *session_info,
                      struct cli_credentials *credentials,
+                     struct event_context *ev_ctx,
                      struct loadparm_context *lp_ctx,
                      struct hive_key **root);
 
@@ -141,6 +142,7 @@ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location,
 WERROR reg_open_ldb_file(TALLOC_CTX *parent_ctx, const char *location,
              struct auth_session_info *session_info,
              struct cli_credentials *credentials,
+             struct event_context *ev_ctx,
              struct loadparm_context *lp_ctx,
              struct hive_key **k);
 
@@ -167,6 +169,7 @@ typedef struct hive_key {
 
 WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                       struct registry_context **ctx,
+                      struct event_context *ev_ctx,
                       struct loadparm_context *lp_ctx,
                       struct auth_session_info *session_info,
                       struct cli_credentials *credentials);
index bf8ac604981537d0958b5aed2b430942c4a7bd20..cb20d6039ddded2a6069b8c29afa82d696c142d1 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -59,6 +59,7 @@ def _swig_setattr_nondynamic_method(set):
 
 import credentials
 import param
+import events
 reg_get_predef_name = _registry.reg_get_predef_name
 str_regtype = _registry.str_regtype
 Registry = _registry.Registry
index da09ecbe08dc68abda707c2930600646aaa13699..d9b85ee9375ae89c3ca8a92d382c07636f05cef9 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
-    PyErr_Format(PyExc_RuntimeError, mesg);
+    PyErr_SetString(PyExc_RuntimeError, mesg);
   }
 }
 
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
 {
   PySwigObject *sobj = (PySwigObject *) v;
   PyObject *next = sobj->next;
-  if (sobj->own) {
+  if (sobj->own == SWIG_POINTER_OWN) {
     swig_type_info *ty = sobj->ty;
     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
     PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
        res = ((*meth)(mself, v));
       }
       Py_XDECREF(res);
-    } else {
-      const char *name = SWIG_TypePrettyName(ty);
+    } 
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
     }
+#endif
   } 
   Py_XDECREF(next);
   PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
 
 SWIGRUNTIME int
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own) {
+  if (own == SWIG_POINTER_OWN) {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
     if (sobj) {
       int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
     return SWIG_OK;
   } else {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
     while (sobj) {
       void *vptr = sobj->ptr;
       if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
          if (!tc) {
            sobj = (PySwigObject *)sobj->next;
          } else {
-           if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+           if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
            break;
          }
        }
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
       }
     }
     if (sobj) {
-      if (own) *own = sobj->own;
+      if (own)
+        *own = *own | sobj->own;
       if (flags & SWIG_POINTER_DISOWN) {
        sobj->own = 0;
       }
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
     }
     if (ty) {
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (!tc) return SWIG_ERROR;
-      *ptr = SWIG_TypeCast(tc,vptr);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
     } else {
       *ptr = vptr;
     }
@@ -2460,29 +2478,30 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags)
 #define SWIGTYPE_p_auth_session_info swig_types[1]
 #define SWIGTYPE_p_char swig_types[2]
 #define SWIGTYPE_p_cli_credentials swig_types[3]
-#define SWIGTYPE_p_hive_key swig_types[4]
-#define SWIGTYPE_p_int swig_types[5]
-#define SWIGTYPE_p_loadparm_context swig_types[6]
-#define SWIGTYPE_p_loadparm_service swig_types[7]
-#define SWIGTYPE_p_long_long swig_types[8]
-#define SWIGTYPE_p_p_char swig_types[9]
-#define SWIGTYPE_p_p_hive_key swig_types[10]
-#define SWIGTYPE_p_p_registry_context swig_types[11]
-#define SWIGTYPE_p_p_registry_key swig_types[12]
-#define SWIGTYPE_p_param_context swig_types[13]
-#define SWIGTYPE_p_param_opt swig_types[14]
-#define SWIGTYPE_p_param_section swig_types[15]
-#define SWIGTYPE_p_reg_diff_callbacks swig_types[16]
-#define SWIGTYPE_p_registry_context swig_types[17]
-#define SWIGTYPE_p_registry_key swig_types[18]
-#define SWIGTYPE_p_short swig_types[19]
-#define SWIGTYPE_p_signed_char swig_types[20]
-#define SWIGTYPE_p_unsigned_char swig_types[21]
-#define SWIGTYPE_p_unsigned_int swig_types[22]
-#define SWIGTYPE_p_unsigned_long_long swig_types[23]
-#define SWIGTYPE_p_unsigned_short swig_types[24]
-static swig_type_info *swig_types[26];
-static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
+#define SWIGTYPE_p_event_context swig_types[4]
+#define SWIGTYPE_p_hive_key swig_types[5]
+#define SWIGTYPE_p_int swig_types[6]
+#define SWIGTYPE_p_loadparm_context swig_types[7]
+#define SWIGTYPE_p_loadparm_service swig_types[8]
+#define SWIGTYPE_p_long_long swig_types[9]
+#define SWIGTYPE_p_p_char swig_types[10]
+#define SWIGTYPE_p_p_hive_key swig_types[11]
+#define SWIGTYPE_p_p_registry_context swig_types[12]
+#define SWIGTYPE_p_p_registry_key swig_types[13]
+#define SWIGTYPE_p_param_context swig_types[14]
+#define SWIGTYPE_p_param_opt swig_types[15]
+#define SWIGTYPE_p_param_section swig_types[16]
+#define SWIGTYPE_p_reg_diff_callbacks swig_types[17]
+#define SWIGTYPE_p_registry_context swig_types[18]
+#define SWIGTYPE_p_registry_key swig_types[19]
+#define SWIGTYPE_p_short swig_types[20]
+#define SWIGTYPE_p_signed_char swig_types[21]
+#define SWIGTYPE_p_unsigned_char swig_types[22]
+#define SWIGTYPE_p_unsigned_int swig_types[23]
+#define SWIGTYPE_p_unsigned_long_long swig_types[24]
+#define SWIGTYPE_p_unsigned_short swig_types[25]
+static swig_type_info *swig_types[27];
+static swig_module_info swig_module = {swig_types, 26, 0, 0, 0, 0};
 #define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
 #define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
 
@@ -2514,7 +2533,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 
 #define SWIG_name    "_registry"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2529,6 +2548,7 @@ static swig_module_info swig_module = {swig_types, 25, 0, 0, 0, 0};
 #include "includes.h"
 #include "registry.h"
 #include "param/param.h"
+#include "events/events.h"
 
 typedef struct registry_context reg;
 typedef struct hive_key hive_key;
@@ -2910,44 +2930,17 @@ fail:
 }
 
 
-SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
+SWIGINTERN PyObject *_wrap_Registry(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
   PyObject *resultobj = 0;
   TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
   struct registry_context **arg2 = (struct registry_context **) 0 ;
-  struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
-  struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
   WERROR result;
   struct registry_context *tmp2 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  void *argp4 = 0 ;
-  int res4 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "session_info",(char *) "credentials", NULL 
-  };
   
-  arg3 = NULL;
-  arg4 = NULL;
   arg1 = NULL;
   arg2 = &tmp2;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:Registry",kwnames,&obj0,&obj1)) SWIG_fail;
-  if (obj0) {
-    res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_auth_session_info, 0 |  0 );
-    if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "Registry" "', argument " "3"" of type '" "struct auth_session_info *""'"); 
-    }
-    arg3 = (struct auth_session_info *)(argp3);
-  }
-  if (obj1) {
-    res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_cli_credentials, 0 |  0 );
-    if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "Registry" "', argument " "4"" of type '" "struct cli_credentials *""'"); 
-    }
-    arg4 = (struct cli_credentials *)(argp4);
-  }
-  result = reg_open_local(arg1,arg2,arg3,arg4);
+  if (!SWIG_Python_UnpackTuple(args,"Registry",0,0,0)) SWIG_fail;
+  result = reg_open_local(arg1,arg2);
   if (!W_ERROR_IS_OK(result)) {
     PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
     PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3410,7 +3403,10 @@ check_1:
   }
   
 fail:
-  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n  Possible C/C++ prototypes are:\n""    mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n""    mount_hive(reg *,struct hive_key *,char const *)\n");
+  SWIG_SetErrorMsg(PyExc_NotImplementedError,"Wrong number of arguments for overloaded function 'reg_mount_hive'.\n"
+    "  Possible C/C++ prototypes are:\n"
+    "    mount_hive(reg *,struct hive_key *,uint32_t,char const **)\n"
+    "    mount_hive(reg *,struct hive_key *,char const *)\n");
   return NULL;
 }
 
@@ -3420,7 +3416,7 @@ SWIGINTERN PyObject *_wrap_new_reg(PyObject *SWIGUNUSEDPARM(self), PyObject *arg
   reg *result = 0 ;
   
   if (!SWIG_Python_UnpackTuple(args,"new_reg",0,0,0)) SWIG_fail;
-  result = (reg *)(reg *) calloc(1, sizeof(reg));
+  result = (reg *)calloc(1, sizeof(reg));
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_registry_context, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
@@ -3468,8 +3464,9 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
   char *arg2 = (char *) 0 ;
   struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
   struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
-  struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
-  struct hive_key **arg6 = (struct hive_key **) 0 ;
+  struct event_context *arg5 = (struct event_context *) 0 ;
+  struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
+  struct hive_key **arg7 = (struct hive_key **) 0 ;
   WERROR result;
   int res2 ;
   char *buf2 = 0 ;
@@ -3480,21 +3477,25 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
   int res4 = 0 ;
   void *argp5 = 0 ;
   int res5 = 0 ;
-  struct hive_key *tmp6 ;
+  void *argp6 = 0 ;
+  int res6 = 0 ;
+  struct hive_key *tmp7 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
   char *  kwnames[] = {
-    (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL 
+    (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL 
   };
   
   arg3 = NULL;
   arg4 = NULL;
-  arg5 = loadparm_init(NULL);
+  arg5 = event_context_init(NULL);
+  arg6 = loadparm_init(NULL);
   arg1 = NULL;
-  arg6 = &tmp6;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  arg7 = &tmp7;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:hive_key",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
   res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "hive_key" "', argument " "2"" of type '" "char const *""'");
@@ -3515,13 +3516,20 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
     arg4 = (struct cli_credentials *)(argp4);
   }
   if (obj3) {
-    res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 |  0 );
     if (!SWIG_IsOK(res5)) {
-      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct loadparm_context *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "hive_key" "', argument " "5"" of type '" "struct event_context *""'"); 
+    }
+    arg5 = (struct event_context *)(argp5);
+  }
+  if (obj4) {
+    res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "hive_key" "', argument " "6"" of type '" "struct loadparm_context *""'"); 
     }
-    arg5 = (struct loadparm_context *)(argp5);
+    arg6 = (struct loadparm_context *)(argp6);
   }
-  result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+  result = reg_open_hive(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
   if (!W_ERROR_IS_OK(result)) {
     PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
     PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3530,7 +3538,7 @@ SWIGINTERN PyObject *_wrap_hive_key(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
     resultobj = Py_None;
   }
   Py_XDECREF(resultobj);
-  resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
+  resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   return resultobj;
 fail:
@@ -3545,8 +3553,9 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
   char *arg2 = (char *) 0 ;
   struct auth_session_info *arg3 = (struct auth_session_info *) 0 ;
   struct cli_credentials *arg4 = (struct cli_credentials *) 0 ;
-  struct loadparm_context *arg5 = (struct loadparm_context *) 0 ;
-  struct hive_key **arg6 = (struct hive_key **) 0 ;
+  struct event_context *arg5 = (struct event_context *) 0 ;
+  struct loadparm_context *arg6 = (struct loadparm_context *) 0 ;
+  struct hive_key **arg7 = (struct hive_key **) 0 ;
   WERROR result;
   int res2 ;
   char *buf2 = 0 ;
@@ -3557,21 +3566,25 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
   int res4 = 0 ;
   void *argp5 = 0 ;
   int res5 = 0 ;
-  struct hive_key *tmp6 ;
+  void *argp6 = 0 ;
+  int res6 = 0 ;
+  struct hive_key *tmp7 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
   PyObject * obj3 = 0 ;
+  PyObject * obj4 = 0 ;
   char *  kwnames[] = {
-    (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "lp_ctx", NULL 
+    (char *) "location",(char *) "session_info",(char *) "credentials",(char *) "ev_ctx",(char *) "lp_ctx", NULL 
   };
   
   arg3 = NULL;
   arg4 = NULL;
-  arg5 = loadparm_init(NULL);
+  arg5 = event_context_init(NULL);
+  arg6 = loadparm_init(NULL);
   arg1 = NULL;
-  arg6 = &tmp6;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
+  arg7 = &tmp7;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"O|OOOO:open_ldb",kwnames,&obj0,&obj1,&obj2,&obj3,&obj4)) SWIG_fail;
   res2 = SWIG_AsCharPtrAndSize(obj0, &buf2, NULL, &alloc2);
   if (!SWIG_IsOK(res2)) {
     SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "open_ldb" "', argument " "2"" of type '" "char const *""'");
@@ -3592,13 +3605,20 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
     arg4 = (struct cli_credentials *)(argp4);
   }
   if (obj3) {
-    res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 |  0 );
     if (!SWIG_IsOK(res5)) {
-      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct loadparm_context *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_ldb" "', argument " "5"" of type '" "struct event_context *""'"); 
+    }
+    arg5 = (struct event_context *)(argp5);
+  }
+  if (obj4) {
+    res6 = SWIG_ConvertPtr(obj4, &argp6,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_ldb" "', argument " "6"" of type '" "struct loadparm_context *""'"); 
     }
-    arg5 = (struct loadparm_context *)(argp5);
+    arg6 = (struct loadparm_context *)(argp6);
   }
-  result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6);
+  result = reg_open_ldb_file(arg1,(char const *)arg2,arg3,arg4,arg5,arg6,arg7);
   if (!W_ERROR_IS_OK(result)) {
     PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
     PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3607,7 +3627,7 @@ SWIGINTERN PyObject *_wrap_open_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *ar
     resultobj = Py_None;
   }
   Py_XDECREF(resultobj);
-  resultobj = SWIG_NewPointerObj(*arg6, SWIGTYPE_p_hive_key, 0);
+  resultobj = SWIG_NewPointerObj(*arg7, SWIGTYPE_p_hive_key, 0);
   if (alloc2 == SWIG_NEWOBJ) free((char*)buf2);
   return resultobj;
 fail:
@@ -3702,9 +3722,10 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
   PyObject *resultobj = 0;
   TALLOC_CTX *arg1 = (TALLOC_CTX *) 0 ;
   struct registry_context **arg2 = (struct registry_context **) 0 ;
-  struct loadparm_context *arg3 = (struct loadparm_context *) 0 ;
-  struct auth_session_info *arg4 = (struct auth_session_info *) 0 ;
-  struct cli_credentials *arg5 = (struct cli_credentials *) 0 ;
+  struct event_context *arg3 = (struct event_context *) 0 ;
+  struct loadparm_context *arg4 = (struct loadparm_context *) 0 ;
+  struct auth_session_info *arg5 = (struct auth_session_info *) 0 ;
+  struct cli_credentials *arg6 = (struct cli_credentials *) 0 ;
   WERROR result;
   struct registry_context *tmp2 ;
   void *argp3 = 0 ;
@@ -3713,41 +3734,52 @@ SWIGINTERN PyObject *_wrap_open_samba(PyObject *SWIGUNUSEDPARM(self), PyObject *
   int res4 = 0 ;
   void *argp5 = 0 ;
   int res5 = 0 ;
+  void *argp6 = 0 ;
+  int res6 = 0 ;
   PyObject * obj0 = 0 ;
   PyObject * obj1 = 0 ;
   PyObject * obj2 = 0 ;
+  PyObject * obj3 = 0 ;
   char *  kwnames[] = {
-    (char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL 
+    (char *) "ev_ctx",(char *) "lp_ctx",(char *) "session_info",(char *) "credentials", NULL 
   };
   
-  arg3 = loadparm_init(NULL);
-  arg4 = NULL;
+  arg3 = event_context_init(NULL);
+  arg4 = loadparm_init(NULL);
   arg5 = NULL;
+  arg6 = NULL;
   arg1 = NULL;
   arg2 = &tmp2;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOO:open_samba",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
+  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OOOO:open_samba",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail;
   if (obj0) {
-    res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_loadparm_context, 0 |  0 );
+    res3 = SWIG_ConvertPtr(obj0, &argp3,SWIGTYPE_p_event_context, 0 |  0 );
     if (!SWIG_IsOK(res3)) {
-      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct loadparm_context *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "open_samba" "', argument " "3"" of type '" "struct event_context *""'"); 
     }
-    arg3 = (struct loadparm_context *)(argp3);
+    arg3 = (struct event_context *)(argp3);
   }
   if (obj1) {
-    res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_auth_session_info, 0 |  0 );
+    res4 = SWIG_ConvertPtr(obj1, &argp4,SWIGTYPE_p_loadparm_context, 0 |  0 );
     if (!SWIG_IsOK(res4)) {
-      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct auth_session_info *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "open_samba" "', argument " "4"" of type '" "struct loadparm_context *""'"); 
     }
-    arg4 = (struct auth_session_info *)(argp4);
+    arg4 = (struct loadparm_context *)(argp4);
   }
   if (obj2) {
-    res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_cli_credentials, 0 |  0 );
+    res5 = SWIG_ConvertPtr(obj2, &argp5,SWIGTYPE_p_auth_session_info, 0 |  0 );
     if (!SWIG_IsOK(res5)) {
-      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct cli_credentials *""'"); 
+      SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "open_samba" "', argument " "5"" of type '" "struct auth_session_info *""'"); 
     }
-    arg5 = (struct cli_credentials *)(argp5);
+    arg5 = (struct auth_session_info *)(argp5);
   }
-  result = reg_open_samba(arg1,arg2,arg3,arg4,arg5);
+  if (obj3) {
+    res6 = SWIG_ConvertPtr(obj3, &argp6,SWIGTYPE_p_cli_credentials, 0 |  0 );
+    if (!SWIG_IsOK(res6)) {
+      SWIG_exception_fail(SWIG_ArgError(res6), "in method '" "open_samba" "', argument " "6"" of type '" "struct cli_credentials *""'"); 
+    }
+    arg6 = (struct cli_credentials *)(argp6);
+  }
+  result = reg_open_samba(arg1,arg2,arg3,arg4,arg5,arg6);
   if (!W_ERROR_IS_OK(result)) {
     PyObject *obj = Py_BuildValue((char *)"(i,s)", W_ERROR_V(result), win_errstr(result));
     PyErr_SetObject(PyExc_RuntimeError, obj);
@@ -3765,7 +3797,7 @@ fail:
 static PyMethodDef SwigMethods[] = {
         { (char *)"reg_get_predef_name", (PyCFunction) _wrap_reg_get_predef_name, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"str_regtype", (PyCFunction) _wrap_str_regtype, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"Registry", (PyCFunction) _wrap_Registry, METH_VARARGS | METH_KEYWORDS, NULL},
+        { (char *)"Registry", (PyCFunction)_wrap_Registry, METH_NOARGS, NULL},
         { (char *)"reg_get_predefined_key_by_name", (PyCFunction) _wrap_reg_get_predefined_key_by_name, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"reg_key_del_abs", (PyCFunction) _wrap_reg_key_del_abs, METH_VARARGS | METH_KEYWORDS, NULL},
         { (char *)"reg_get_predefined_key", (PyCFunction) _wrap_reg_get_predefined_key, METH_VARARGS | METH_KEYWORDS, NULL},
@@ -3792,6 +3824,7 @@ static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0
 static swig_type_info _swigt__p_auth_session_info = {"_p_auth_session_info", "struct auth_session_info *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *|cli_credentials *", 0, 0, (void*)0, 0};
+static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_hive_key = {"_p_hive_key", "struct hive_key *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
 static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
@@ -3819,6 +3852,7 @@ static swig_type_info *swig_type_initial[] = {
   &_swigt__p_auth_session_info,
   &_swigt__p_char,
   &_swigt__p_cli_credentials,
+  &_swigt__p_event_context,
   &_swigt__p_hive_key,
   &_swigt__p_int,
   &_swigt__p_loadparm_context,
@@ -3846,6 +3880,7 @@ static swig_cast_info _swigc__p_TALLOC_CTX[] = {  {&_swigt__p_TALLOC_CTX, 0, 0,
 static swig_cast_info _swigc__p_auth_session_info[] = {  {&_swigt__p_auth_session_info, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_cli_credentials[] = {  {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
+static swig_cast_info _swigc__p_event_context[] = {  {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_hive_key[] = {  {&_swigt__p_hive_key, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
 static swig_cast_info _swigc__p_loadparm_context[] = {  {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
@@ -3873,6 +3908,7 @@ static swig_cast_info *swig_cast_initial[] = {
   _swigc__p_auth_session_info,
   _swigc__p_char,
   _swigc__p_cli_credentials,
+  _swigc__p_event_context,
   _swigc__p_hive_key,
   _swigc__p_int,
   _swigc__p_loadparm_context,
@@ -3962,7 +3998,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -3972,6 +4008,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -4000,6 +4039,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
index 599385e73c210819a59d539aae946966fe4421ed..84a8112f17952c45233203fd061e35c3bb2a0a9c 100644 (file)
@@ -26,6 +26,7 @@
  */
 
 static WERROR mount_samba_hive(struct registry_context *ctx,
+                              struct event_context *event_ctx,
                               struct loadparm_context *lp_ctx,
                               struct auth_session_info *auth_info,
                               struct cli_credentials *creds,
@@ -40,11 +41,11 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
                                   lp_private_dir(lp_ctx),
                                   name);
 
-       error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive);
+       error = reg_open_hive(ctx, location, auth_info, creds, event_ctx, lp_ctx, &hive);
 
        if (W_ERROR_EQUAL(error, WERR_BADFILE))
                error = reg_open_ldb_file(ctx, location, auth_info,
-                                         creds, lp_ctx, &hive);
+                                         creds, event_ctx, lp_ctx, &hive);
 
        if (!W_ERROR_IS_OK(error))
                return error;
@@ -55,29 +56,30 @@ static WERROR mount_samba_hive(struct registry_context *ctx,
 
 _PUBLIC_ WERROR reg_open_samba(TALLOC_CTX *mem_ctx,
                               struct registry_context **ctx,
+                              struct event_context *ev_ctx,
                               struct loadparm_context *lp_ctx,
                               struct auth_session_info *session_info,
                               struct cli_credentials *credentials)
 {
        WERROR result;
 
-       result = reg_open_local(mem_ctx, ctx, session_info, credentials);
+       result = reg_open_local(mem_ctx, ctx);
        if (!W_ERROR_IS_OK(result)) {
                return result;
        }
 
-       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+       mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
                         "hklm", HKEY_LOCAL_MACHINE);
 
-       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+       mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
                         "hkcr", HKEY_CLASSES_ROOT);
 
        /* FIXME: Should be mounted from NTUSER.DAT in the home directory of the
         * current user */
-       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+       mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
                         "hkcu", HKEY_CURRENT_USER);
 
-       mount_samba_hive(*ctx, lp_ctx, session_info, credentials,
+       mount_samba_hive(*ctx, ev_ctx, lp_ctx, session_info, credentials,
                         "hku", HKEY_USERS);
 
        /* FIXME: Different hive backend for HKEY_CLASSES_ROOT: merged view of HKEY_LOCAL_MACHINE\Software\Classes
index 70b0241b043a241c575075f3acd0479bf585b7fc..29f7e685c102faadf0e15cdedcfa5b8269d7d540 100644 (file)
@@ -68,14 +68,15 @@ static bool test_keyinfo_nums(struct torture_context *tctx, void *test_data)
        struct hive_key *root = (struct hive_key *)test_data;
        WERROR error;
        struct hive_key *subkey;
-       uint32_t data = 42;
+       char data[4];
+       SIVAL(data, 0, 42);
 
        error = hive_key_add_name(tctx, root, "Nested Keyll", NULL,
                                  NULL, &subkey);
        torture_assert_werr_ok(tctx, error, "hive_key_add_name");
 
        error = hive_key_set_value(root, "Answer", REG_DWORD,
-                              data_blob_talloc(tctx, &data, sizeof(data)));
+                              data_blob_talloc(tctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        /* This is a new backend. There should be no subkeys and no
@@ -119,7 +120,8 @@ static bool test_del_recursive(struct torture_context *tctx,
        struct hive_key *subkey2;
        const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
-       uint32_t data = 42;
+       char data[4];
+       SIVAL(data, 0, 42);
 
        /* Create a new key under the root */
        error = hive_key_add_name(mem_ctx, root, "Parent Key", NULL,
@@ -133,7 +135,7 @@ static bool test_del_recursive(struct torture_context *tctx,
 
        /* Create a new value under "Child Key" */
        error = hive_key_set_value(subkey2, "Answer Recursive", REG_DWORD,
-                              data_blob_talloc(mem_ctx, &data, sizeof(data)));
+                              data_blob_talloc(mem_ctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        /* Deleting "Parent Key" will also delete "Child Key" and the value. */
@@ -179,14 +181,15 @@ static bool test_set_value(struct torture_context *tctx,
        struct hive_key *subkey;
        const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
-       uint32_t data = 42;
+       char data[4];
+       SIVAL(data, 0, 42);
 
        error = hive_key_add_name(mem_ctx, root, "YA Nested Key", NULL,
                                  NULL, &subkey);
        torture_assert_werr_ok(tctx, error, "hive_key_add_name");
 
        error = hive_key_set_value(subkey, "Answer", REG_DWORD,
-                              data_blob_talloc(mem_ctx, &data, sizeof(data)));
+                              data_blob_talloc(mem_ctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        return true;
@@ -198,10 +201,12 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
        struct hive_key *subkey;
        const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
-       uint32_t data = 42;
+       char data[4];
        uint32_t type;
        DATA_BLOB value;
 
+       SIVAL(data, 0, 42);
+
        error = hive_key_add_name(mem_ctx, root, "EYA Nested Key", NULL,
                                  NULL, &subkey);
        torture_assert_werr_ok(tctx, error, "hive_key_add_name");
@@ -211,7 +216,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
                                  "getting missing value");
 
        error = hive_key_set_value(subkey, "Answer", REG_DWORD,
-                              data_blob_talloc(mem_ctx, &data, sizeof(data)));
+                              data_blob_talloc(mem_ctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value);
@@ -220,7 +225,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data)
        torture_assert_int_equal(tctx, value.length, 4, "value length");
        torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
 
-       torture_assert_int_equal(tctx, data, IVAL(value.data, 0),
+       torture_assert_mem_equal(tctx, &data, value.data, sizeof(uint32_t),
                                 "value data");
 
        return true;
@@ -232,16 +237,18 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data)
        struct hive_key *subkey;
        const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
-       uint32_t data = 42;
+       char data[4];
        uint32_t type;
        DATA_BLOB value;
 
+       SIVAL(data, 0, 42);
+
        error = hive_key_add_name(mem_ctx, root, "EEYA Nested Key", NULL,
                                                         NULL, &subkey);
        torture_assert_werr_ok(tctx, error, "hive_key_add_name");
 
        error = hive_key_set_value(subkey, "Answer", REG_DWORD,
-                              data_blob_talloc(mem_ctx, &data, sizeof(data)));
+                              data_blob_talloc(mem_ctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        error = hive_key_del_value(subkey, "Answer");
@@ -264,17 +271,19 @@ static bool test_list_values(struct torture_context *tctx,
        struct hive_key *subkey;
        const struct hive_key *root = (const struct hive_key *)test_data;
        TALLOC_CTX *mem_ctx = tctx;
-       uint32_t data = 42;
+       char data[4];
        uint32_t type;
        DATA_BLOB value;
        const char *name;
+       int data_val = 42;
+       SIVAL(data, 0, data_val);
 
        error = hive_key_add_name(mem_ctx, root, "AYAYA Nested Key", NULL,
                                  NULL, &subkey);
        torture_assert_werr_ok(tctx, error, "hive_key_add_name");
 
        error = hive_key_set_value(subkey, "Answer", REG_DWORD,
-                              data_blob_talloc(mem_ctx, &data, sizeof(data)));
+                              data_blob_talloc(mem_ctx, data, sizeof(data)));
        torture_assert_werr_ok(tctx, error, "hive_key_set_value");
 
        error = hive_get_value_by_index(mem_ctx, subkey, 0, &name,
@@ -287,7 +296,7 @@ static bool test_list_values(struct torture_context *tctx,
        torture_assert_int_equal(tctx, type, REG_DWORD, "value type");
        
        
-       torture_assert_int_equal(tctx, data, IVAL(value.data, 0), "value data");
+       torture_assert_int_equal(tctx, data_val, IVAL(value.data, 0), "value data");
 
        error = hive_get_value_by_index(mem_ctx, subkey, 1, &name,
                                        &type, &value);
@@ -363,7 +372,7 @@ static bool hive_setup_ldb(struct torture_context *tctx, void **data)
 
        rmdir(dirname);
 
-       error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->lp_ctx, &key);
+       error = reg_open_ldb_file(tctx, dirname, NULL, NULL, tctx->ev, tctx->lp_ctx, &key);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to initialize ldb hive\n");
                return false;
index e5e34c11e0bd2368845b0f347db28b16ddedb8be..661d7c2c6985ba16d0a87f70911511750479be05 100644 (file)
@@ -281,7 +281,8 @@ static bool test_query_key_nums(struct torture_context *tctx, void *_data)
        struct registry_key *root, *subkey1, *subkey2;
        WERROR error;
        uint32_t num_subkeys, num_values;
-       uint32_t data = 42;
+       char data[4];
+       SIVAL(data, 0, 42);
 
        if (!create_test_key(tctx, rctx, "Berlin", &root, &subkey1))
                return false;
@@ -353,13 +354,15 @@ static bool test_set_value(struct torture_context *tctx, void *_data)
        struct registry_context *rctx = (struct registry_context *)_data;
        struct registry_key *subkey = NULL, *root;
        WERROR error;
-       uint32_t data = 42;
+       char data[4];
+
+       SIVAL(data, 0, 42);
 
        if (!create_test_key(tctx, rctx, "Dusseldorf", &root, &subkey))
                return false;
 
        error = reg_val_set(subkey, "Answer", REG_DWORD,
-                           data_blob_talloc(tctx, &data, sizeof(data)));
+                           data_blob_talloc(tctx, data, sizeof(data)));
        torture_assert_werr_ok (tctx, error, "setting value");
 
        return true;
@@ -408,8 +411,9 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
-       uint32_t value = 42;
+       char value[4];
        uint32_t type;
+       SIVAL(value, 0, 42);
 
        if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey))
                return false;
@@ -420,16 +424,16 @@ static bool test_get_value(struct torture_context *tctx, void *_data)
                                  "getting missing value");
 
        error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
-                           data_blob_talloc(tctx, &value, 4));
+                           data_blob_talloc(tctx, value, sizeof(value)));
        torture_assert_werr_ok(tctx, error, "setting value");
 
        error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type,
                                          &data);
        torture_assert_werr_ok(tctx, error, "getting value");
 
-       torture_assert_int_equal(tctx, 4, data.length, "value length ok");
-       torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
-                                   "value content ok");
+       torture_assert_int_equal(tctx, sizeof(value), data.length, "value length ok");
+       torture_assert_mem_equal(tctx, data.data, value, sizeof(value),
+                                "value content ok");
        torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
 
        return true;
@@ -444,8 +448,9 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
-       uint32_t value = 42;
        uint32_t type;
+       char value[4];
+       SIVAL(value, 0, 42);
 
        if (!create_test_key(tctx, rctx, "Warschau", &root, &subkey))
                return false;
@@ -456,7 +461,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data)
                                  "getting missing value");
 
        error = reg_val_set(subkey, __FUNCTION__, REG_DWORD,
-                           data_blob_talloc(tctx, &value, 4));
+                           data_blob_talloc(tctx, value, sizeof(value)));
        torture_assert_werr_ok (tctx, error, "setting value");
 
        error = reg_del_value(subkey, __FUNCTION__);
@@ -479,15 +484,16 @@ static bool test_list_values(struct torture_context *tctx, void *_data)
        struct registry_key *subkey = NULL, *root;
        WERROR error;
        DATA_BLOB data;
-       uint32_t value = 42;
        uint32_t type;
        const char *name;
+       char value[4];
+       SIVAL(value, 0, 42);
 
        if (!create_test_key(tctx, rctx, "Bonn", &root, &subkey))
                return false;
 
        error = reg_val_set(subkey, "bar", REG_DWORD,
-                           data_blob_talloc(tctx, &value, 4));
+                           data_blob_talloc(tctx, value, sizeof(value)));
        torture_assert_werr_ok (tctx, error, "setting value");
 
        error = reg_key_get_value_by_index(tctx, subkey, 0, &name,
@@ -495,8 +501,8 @@ static bool test_list_values(struct torture_context *tctx, void *_data)
        torture_assert_werr_ok(tctx, error, "getting value");
 
        torture_assert_str_equal(tctx, name, "bar", "value name");
-       torture_assert_int_equal(tctx, 4, data.length, "value length");
-       torture_assert(tctx, memcmp(data.data, &value, 4) == 0,
+       torture_assert_int_equal(tctx, sizeof(value), data.length, "value length");
+       torture_assert_mem_equal(tctx, data.data, value, sizeof(value),
                       "value content");
        torture_assert_int_equal(tctx, REG_DWORD, type, "value type");
 
@@ -517,14 +523,14 @@ static bool setup_local_registry(struct torture_context *tctx, void **data)
        struct hive_key *hive_key;
        const char *filename;
 
-       error = reg_open_local(tctx, &rctx, NULL, NULL);
+       error = reg_open_local(tctx, &rctx);
        torture_assert_werr_ok(tctx, error, "Opening local registry failed");
 
        status = torture_temp_dir(tctx, "registry-local", &tempdir);
        torture_assert_ntstatus_ok(tctx, status, "Creating temp dir failed");
 
        filename = talloc_asprintf(tctx, "%s/classes_root.ldb", tempdir);
-       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->lp_ctx, &hive_key);
+       error = reg_open_ldb_file(tctx, filename, NULL, NULL, tctx->ev, tctx->lp_ctx, &hive_key);
        torture_assert_werr_ok(tctx, error, "Opening classes_root file failed");
 
        error = reg_mount_hive(rctx, hive_key, HKEY_CLASSES_ROOT, NULL);
index cec0f8b9066c31f65bccff63f0a786053ea0d355..3ea780de60ae22f15702de95d7e9838601461eb6 100644 (file)
@@ -42,6 +42,7 @@ struct registry_context *reg_common_open_remote(const char *remote,
 }
 
 struct registry_key *reg_common_open_file(const char *path,
+                                         struct event_context *ev_ctx,
                                          struct loadparm_context *lp_ctx,
                                          struct cli_credentials *creds)
 {
@@ -49,7 +50,7 @@ struct registry_key *reg_common_open_file(const char *path,
        struct registry_context *h = NULL;
        WERROR error;
 
-       error = reg_open_hive(NULL, path, NULL, creds, lp_ctx, &hive_root);
+       error = reg_open_hive(NULL, path, NULL, creds, ev_ctx, lp_ctx, &hive_root);
 
        if(!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to open '%s': %s \n",
@@ -57,7 +58,7 @@ struct registry_key *reg_common_open_file(const char *path,
                return NULL;
        }
 
-       error = reg_open_local(NULL, &h, NULL, creds);
+       error = reg_open_local(NULL, &h);
        if (!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to initialize local registry: %s\n",
                        win_errstr(error));
@@ -67,12 +68,14 @@ struct registry_key *reg_common_open_file(const char *path,
        return reg_import_hive_key(h, hive_root, -1, NULL);
 }
 
-struct registry_context *reg_common_open_local(struct cli_credentials *creds, struct loadparm_context *lp_ctx)
+struct registry_context *reg_common_open_local(struct cli_credentials *creds, 
+                                              struct event_context *ev_ctx, 
+                                              struct loadparm_context *lp_ctx)
 {
        WERROR error;
        struct registry_context *h = NULL;
 
-       error = reg_open_samba(NULL, &h, lp_ctx, NULL, creds);
+       error = reg_open_samba(NULL, &h, ev_ctx, lp_ctx, NULL, creds);
 
        if(!W_ERROR_IS_OK(error)) {
                fprintf(stderr, "Unable to open local registry:%s \n",
index c94380efd2b0be46febaedbb11a81f953df77b32..9b49799bed90f7b7003cd492d8711d868c61ea75 100644 (file)
@@ -29,6 +29,7 @@
 enum reg_backend { REG_UNKNOWN, REG_LOCAL, REG_REMOTE, REG_NULL };
 
 static struct registry_context *open_backend(poptContext pc,
+                                            struct event_context *ev_ctx,
                                             struct loadparm_context *lp_ctx,
                                             enum reg_backend backend,
                                             const char *remote_host)
@@ -41,14 +42,14 @@ static struct registry_context *open_backend(poptContext pc,
                poptPrintUsage(pc, stderr, 0);
                return NULL;
        case REG_LOCAL:
-               error = reg_open_samba(NULL, &ctx, lp_ctx, NULL, cmdline_credentials);
+               error = reg_open_samba(NULL, &ctx, ev_ctx, lp_ctx, NULL, cmdline_credentials);
                break;
        case REG_REMOTE:
                error = reg_open_remote(&ctx, NULL, cmdline_credentials, lp_ctx,
                                        remote_host, NULL);
                break;
        case REG_NULL:
-               error = reg_open_local(NULL, &ctx, NULL, cmdline_credentials);
+               error = reg_open_local(NULL, &ctx);
                break;
        }
 
@@ -82,6 +83,7 @@ int main(int argc, const char **argv)
        };
        TALLOC_CTX *ctx;
        void *callback_data;
+       struct event_context *ev_ctx;
        struct reg_diff_callbacks *callbacks;
 
        ctx = talloc_init("regdiff");
@@ -116,11 +118,13 @@ int main(int argc, const char **argv)
 
        }
 
-       h1 = open_backend(pc, cmdline_lp_ctx, backend1, remote1);
+       ev_ctx = event_context_init(NULL);
+
+       h1 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend1, remote1);
        if (h1 == NULL)
                return 1;
 
-       h2 = open_backend(pc, cmdline_lp_ctx, backend2, remote2);
+       h2 = open_backend(pc, ev_ctx, cmdline_lp_ctx, backend2, remote2);
        if (h2 == NULL)
                return 1;
 
index 98443e64566593ccb1001c9f26fbebc98e6436d8..9285459d8501db55b3fecbbaeb1525e5a1567ee7 100644 (file)
@@ -24,6 +24,7 @@
 #include "lib/cmdline/popt_common.h"
 #include "lib/registry/tools/common.h"
 #include "param/param.h"
+#include "events/events.h"
 
 int main(int argc, char **argv)
 {
@@ -33,6 +34,7 @@ int main(int argc, char **argv)
        struct registry_context *h;
        const char *file = NULL;
        const char *remote = NULL;
+       struct event_context *ev;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
                {"remote", 'R', POPT_ARG_STRING, &remote, 0, "connect to specified remote server", NULL},
@@ -47,10 +49,12 @@ int main(int argc, char **argv)
        while((opt = poptGetNextOpt(pc)) != -1) {
        }
 
+       ev = event_context_init(NULL);
+
        if (remote) {
                h = reg_common_open_remote (remote, cmdline_lp_ctx, cmdline_credentials);
        } else {
-               h = reg_common_open_local (cmdline_credentials, cmdline_lp_ctx);
+               h = reg_common_open_local (cmdline_credentials, ev, cmdline_lp_ctx);
        }
 
        if (h == NULL)
index 58f64cb049b2f292d64ac81e0aa9f586800db6c0..80eafcc4a29a69edfed366c5293b53f0cbc77956 100644 (file)
@@ -498,6 +498,7 @@ int main(int argc, char **argv)
        poptContext pc;
        const char *remote = NULL;
        struct regshell_context *ctx;
+       struct event_context *ev_ctx;
        bool ret = true;
        struct poptOption long_options[] = {
                POPT_AUTOHELP
@@ -516,17 +517,19 @@ int main(int argc, char **argv)
 
        ctx = talloc_zero(NULL, struct regshell_context);
 
+       ev_ctx = event_context_init(ctx);
+
        if (remote != NULL) {
                ctx->registry = reg_common_open_remote(remote, cmdline_lp_ctx, 
                                                       cmdline_credentials);
        } else if (file != NULL) {
-               ctx->current = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
+               ctx->current = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
                if (ctx->current == NULL)
                        return 1;
                ctx->registry = ctx->current->context;
                ctx->path = talloc_strdup(ctx, "");
        } else {
-               ctx->registry = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
+               ctx->registry = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
        }
 
        if (ctx->registry == NULL)
index 424d3515e0cd2d5f0315977a2f234014887b738c..440399f7645470f8e761a63904a6e13816c6cf6f 100644 (file)
@@ -109,6 +109,7 @@ int main(int argc, char **argv)
        poptContext pc;
        struct registry_context *h = NULL;
        struct registry_key *start_key = NULL;
+       struct event_context *ev_ctx;
        WERROR error;
        bool fullpath = false, no_values = false;
        struct poptOption long_options[] = {
@@ -128,12 +129,14 @@ int main(int argc, char **argv)
        while((opt = poptGetNextOpt(pc)) != -1) {
        }
 
+       ev_ctx = event_context_init(NULL);
+
        if (remote != NULL) {
                h = reg_common_open_remote(remote, cmdline_lp_ctx, cmdline_credentials);
        } else if (file != NULL) {
-               start_key = reg_common_open_file(file, cmdline_lp_ctx, cmdline_credentials);
+               start_key = reg_common_open_file(file, ev_ctx, cmdline_lp_ctx, cmdline_credentials);
        } else {
-               h = reg_common_open_local(cmdline_credentials, cmdline_lp_ctx);
+               h = reg_common_open_local(cmdline_credentials, ev_ctx, cmdline_lp_ctx);
        }
 
        if (h == NULL && start_key == NULL)
index bf5056838d0ca2a30539ca5bc75f1104f38bf562..0ce0958a96d34f8f8c066486d6ccfa69a254986f 100644 (file)
@@ -132,7 +132,8 @@ AC_CHECK_SIZEOF(off_t)
 AC_CHECK_SIZEOF(size_t)
 AC_CHECK_SIZEOF(ssize_t)
 
-AC_CHECK_TYPE(intptr_t, unsigned long long)
+AC_CHECK_TYPE(intptr_t, long long)
+AC_CHECK_TYPE(uintptr_t, unsigned long long)
 AC_CHECK_TYPE(ptrdiff_t, unsigned long long)
 
 if test x"$ac_cv_type_long_long" != x"yes";then
index 6930f9b0791c057deeb8045be91b085d25f662ff..443da2ab24e1894c376cbe1181fbbe7567b554be 100644 (file)
@@ -458,7 +458,7 @@ char *rep_strcasestr(const char *haystack, const char *needle)
        for (s=haystack;*s;s++) {
                if (toupper(*needle) == toupper(*s) &&
                    strncasecmp(s, needle, nlen) == 0) {
-                       return (char *)((intptr_t)s);
+                       return (char *)((uintptr_t)s);
                }
        }
        return NULL;
index 5fe79394ebf63fd4bb1d7bfeb96e9a163e38cfed..bf95169352ecb9cebde68b3abcdc31a9da36efec 100644 (file)
@@ -499,7 +499,7 @@ typedef int bool;
   Also, please call this via the discard_const_p() macro interface, as that
   makes the return type safe.
 */
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 
 /** Type-safe version of discard_const */
 #define discard_const_p(type, ptr) ((type *)discard_const(ptr))
index 6d4d81a884bb5b167efb99d775fc37ea533e39fd..2c25d8f491191f9533bb907b72cfe2c157bbd5b2 100644 (file)
@@ -86,7 +86,7 @@ static bool test_udp(struct torture_context *tctx)
 
        torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
 
-       torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0,
+       torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
                "Bad data in recvfrom");
 
        generate_random_buffer(blob.data, blob.length);
@@ -104,7 +104,7 @@ static bool test_udp(struct torture_context *tctx)
        torture_assert_int_equal(tctx, from_addr->port, srv_addr->port, 
                                   "Unexpected recvfrom port");
 
-       torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0, 
+       torture_assert_mem_equal(tctx, blob2.data, blob.data, size,
                "Bad data in recvfrom");
 
        talloc_free(sock1);
@@ -124,7 +124,7 @@ static bool test_tcp(struct torture_context *tctx)
        DATA_BLOB blob, blob2;
        size_t sent, nread;
        TALLOC_CTX *mem_ctx = tctx;
-       struct event_context *ev = event_context_init(mem_ctx);
+       struct event_context *ev = tctx->ev;
        struct interface *ifaces;
 
        status = socket_create("ip", SOCKET_TYPE_STREAM, &sock1, 0);
@@ -181,7 +181,7 @@ static bool test_tcp(struct torture_context *tctx)
 
        torture_assert_int_equal(tctx, nread, size, "Unexpected recvfrom size");
 
-       torture_assert(tctx, memcmp(blob2.data, blob.data, size) == 0
+       torture_assert_mem_equal(tctx, blob2.data, blob.data, size
                                   "Bad data in recv");
        return true;
 }
index fedbda95aac23dbb86d2701a43385df04dbb023e..3f06eee5667d4b285afdcdbf6c1c986c297c6815 100644 (file)
@@ -48,7 +48,8 @@ static double timeval_elapsed(struct timeval *tv)
 }
 
 #define torture_assert_str_equal(test, arg1, arg2, desc) \
-       if (strcmp(arg1, arg2)) { \
+       if (arg1 == NULL && arg2 == NULL) {                             \
+       } else if (strcmp(arg1, arg2)) {                        \
                printf("failure: %s [\n%s: Expected %s, got %s: %s\n]\n", \
                   test, __location__, arg1, arg2, desc); \
                return false; \
index ab6b23dd6ba6738c877ea5fdde5d2a9b5799fbff..5a4b831ed5047c084f8ca15d852b67ad261dd057 100644 (file)
@@ -23,7 +23,7 @@ LIBSAMBA-UTIL_OBJ_FILES = $(addprefix lib/util/, \
                mutex.o \
                idtree.o \
                become_daemon.o \
-               params.o
+               params.o)
 
 PUBLIC_HEADERS += $(addprefix lib/util/, util.h \
                                 attr.h \
index fe87293671ec82613e646e4257e42a37da580e5a..3377e833dc3e038fcb135c385967dc4946705a7a 100644 (file)
@@ -45,9 +45,9 @@ static bool test_file_load_save(struct torture_context *tctx)
        data = file_load(TEST_FILENAME, &len, mem_ctx);
        torture_assert(tctx, data, "loading file");
 
-       torture_assert(tctx, len == strlen(TEST_DATA), "Length");
+       torture_assert_int_equal(tctx, len, strlen(TEST_DATA), "Length");
        
-       torture_assert(tctx, memcmp(data, TEST_DATA, len) == 0, "Contents");
+       torture_assert_mem_equal(tctx, data, TEST_DATA, len, "Contents");
 
        unlink(TEST_FILENAME);
        return true;
index 3bf6b98d2fb3f247ce9800ab5b835aab271935c3..ffe83c14b297d9573fc669e9b03fcaa4321b82cf 100644 (file)
@@ -64,7 +64,7 @@ extern const char *panic_action;
   makes the return type safe.
 */
 #ifndef discard_const
-#define discard_const(ptr) ((void *)((intptr_t)(ptr)))
+#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
 #endif
 
 /** Type-safe version of discard_const */
index d10eeb8ffd7e7e4f36bdc53aca76e7e4a4444e76..614bd51d2af928085d7505402c0b4a77efb56fdd 100644 (file)
@@ -250,11 +250,7 @@ struct cldap_socket *cldap_socket_init(TALLOC_CTX *mem_ctx,
        cldap = talloc(mem_ctx, struct cldap_socket);
        if (cldap == NULL) goto failed;
 
-       if (event_ctx == NULL) {
-               cldap->event_ctx = event_context_init(cldap);
-       } else {
-               cldap->event_ctx = talloc_reference(cldap, event_ctx);
-       }
+       cldap->event_ctx = talloc_reference(cldap, event_ctx);
        if (cldap->event_ctx == NULL) goto failed;
 
        cldap->idr = idr_init(cldap);
@@ -601,8 +597,11 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
        NTSTATUS status;
        enum ndr_err_code ndr_err;
        struct cldap_search search;
+       struct cldap_socket *cldap;
        DATA_BLOB *data;
 
+       cldap = req->cldap;
+
        status = cldap_search_recv(req, mem_ctx, &search);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
@@ -620,7 +619,7 @@ NTSTATUS cldap_netlogon_recv(struct cldap_request *req,
        data = search.out.response->attributes[0].values;
 
        ndr_err = ndr_pull_union_blob_all(data, mem_ctx, 
-                                         req->cldap->iconv_convenience,
+                                         cldap->iconv_convenience,
                                          &io->out.netlogon,
                                          io->in.version & 0xF,
                                          (ndr_pull_flags_fn_t)ndr_pull_nbt_cldap_netlogon);
index 4858a96110b7a46df9b3e99e88edeacdbcad7560..c20a7fd9353f9572f804c394463bbe939aaebbb9 100644 (file)
 */
 bool smbcli_socket_connect(struct smbcli_state *cli, const char *server, 
                           const char **ports, 
+                          struct event_context *ev_ctx,
                           struct resolve_context *resolve_ctx,
                           struct smbcli_options *options)
 {
        struct smbcli_socket *sock;
 
-       sock = smbcli_sock_connect_byname(server, ports, NULL, resolve_ctx, 
-                                         NULL);
+       sock = smbcli_sock_connect_byname(server, ports, NULL,
+                                         resolve_ctx, ev_ctx);
 
        if (sock == NULL) return false;
        
index 26169e7838949aae14c88472cc9d86539d914c39..966f56cba8235b41a41826b78556a7778cab8ce8 100644 (file)
@@ -42,7 +42,11 @@ _PUBLIC_ struct composite_context *composite_create(TALLOC_CTX *mem_ctx,
        c = talloc_zero(mem_ctx, struct composite_context);
        if (!c) return NULL;
        c->state = COMPOSITE_STATE_IN_PROGRESS;
-       c->event_ctx = ev;
+       c->event_ctx = talloc_reference(c, ev);
+       if (!c->event_ctx) {
+               talloc_free(c);
+               return NULL;
+       }
 
        return c;
 }
index 130d8ae870949df276fca6d4a419ac32ed0bc1f8..06b7bd57714bab1415dd379121a3f4b6d03a6021 100644 (file)
@@ -167,11 +167,7 @@ struct nbt_dgram_socket *nbt_dgram_socket_init(TALLOC_CTX *mem_ctx,
        dgmsock = talloc(mem_ctx, struct nbt_dgram_socket);
        if (dgmsock == NULL) goto failed;
 
-       if (event_ctx == NULL) {
-               dgmsock->event_ctx = event_context_init(dgmsock);
-       } else {
-               dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
-       }
+       dgmsock->event_ctx = talloc_reference(dgmsock, event_ctx);
        if (dgmsock->event_ctx == NULL) goto failed;
 
        status = socket_create("ip", SOCKET_TYPE_DGRAM, &dgmsock->sock, 0);
index 2c04edf9505ba5150de6bf3ebb5b49c075493ca0..e1569e72963b0a869294bca2a1e9fccba05039c1 100644 (file)
@@ -200,7 +200,7 @@ static struct ldap_message *new_ldap_sasl_bind_msg(struct ldap_connection *conn,
 /*
   perform a sasl bind using the given credentials
 */
-_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn, 
+_PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
                        struct cli_credentials *creds,
                        struct loadparm_context *lp_ctx)
 {
@@ -223,7 +223,8 @@ _PUBLIC_ NTSTATUS ldap_bind_sasl(struct ldap_connection *conn,
 
        gensec_init(lp_ctx);
 
-       status = gensec_client_start(conn, &conn->gensec, NULL, lp_ctx);
+       status = gensec_client_start(conn, &conn->gensec,
+                                    conn->event.event_ctx, lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("Failed to start GENSEC engine (%s)\n", nt_errstr(status)));
                goto failed;
index 296a7b11f26905672a612454857e0fba4195e886..bca867b0332694db9720297a14a8afccd9cb5dd9 100644 (file)
@@ -48,17 +48,13 @@ _PUBLIC_ struct ldap_connection *ldap4_new_connection(TALLOC_CTX *mem_ctx,
 {
        struct ldap_connection *conn;
 
-       conn = talloc_zero(mem_ctx, struct ldap_connection);
-       if (conn == NULL) {
+       if (ev == NULL) {
                return NULL;
        }
 
-       if (ev == NULL) {
-               ev = event_context_init(conn);
-               if (ev == NULL) {
-                       talloc_free(conn);
-                       return NULL;
-               }
+       conn = talloc_zero(mem_ctx, struct ldap_connection);
+       if (conn == NULL) {
+               return NULL;
        }
 
        conn->next_messageid  = 1;
index dfbb723c36604843563c3907de6d1c1814abdfe7..ee1f702c7893524ed9a2172ce9e87f19e5ec76cc 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef __LIBCLI_LDAP_LDAP_NDR_H__
 #define __LIBCLI_LDAP_LDAP_NDR_H__
 
+#include "librpc/gen_ndr/ndr_misc.h"
+
 char *ldap_encode_ndr_uint32(TALLOC_CTX *mem_ctx, uint32_t value);
 char *ldap_encode_ndr_dom_sid(TALLOC_CTX *mem_ctx, const struct dom_sid *sid);
 char *ldap_encode_ndr_GUID(TALLOC_CTX *mem_ctx, struct GUID *guid);
index 14cec3a024b3229b966dfe5e0ec6710bddbbd63a..0b013655103c81228f99d04b2f3586fecf66753d 100644 (file)
@@ -330,7 +330,7 @@ NTSTATUS nbt_name_reply_send(struct nbt_name_socket *nbtsock,
 
 
 NDR_SCALAR_PROTO(wrepl_nbt_name, const struct nbt_name *)
-NDR_SCALAR_PROTO(nbt_string, const char *);
+NDR_SCALAR_PROTO(nbt_string, const char *)
 NDR_BUFFER_PROTO(nbt_name, struct nbt_name)
 NTSTATUS nbt_rcode_to_ntstatus(uint8_t rcode);
 
index 747127980ab14ead0336bfc0e5323e03c7a9a978..5d4611e2d95a32c508d3dd0b676889ec6f667906 100644 (file)
@@ -318,11 +318,7 @@ _PUBLIC_ struct nbt_name_socket *nbt_name_socket_init(TALLOC_CTX *mem_ctx,
        nbtsock = talloc(mem_ctx, struct nbt_name_socket);
        if (nbtsock == NULL) goto failed;
 
-       if (event_ctx == NULL) {
-               nbtsock->event_ctx = event_context_init(nbtsock);
-       } else {
-               nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx);
-       }
+       nbtsock->event_ctx = talloc_reference(nbtsock, event_ctx);
        if (nbtsock->event_ctx == NULL) goto failed;
 
        status = socket_create("ip", SOCKET_TYPE_DGRAM, &nbtsock->sock, 0);
index 1dcf2d1c539151a302e7ea0d5de80549ecfd2d77..49838e8a1c1f1e41743f4ee11daf3ea7ceb6bf7f 100644 (file)
@@ -59,12 +59,7 @@ struct composite_context *smbcli_sock_connect_send(TALLOC_CTX *mem_ctx,
        if (result == NULL) goto failed;
        result->state = COMPOSITE_STATE_IN_PROGRESS;
 
-       if (event_ctx != NULL) {
-               result->event_ctx = talloc_reference(result, event_ctx);
-       } else {
-               result->event_ctx = event_context_init(result);
-       }
-
+       result->event_ctx = talloc_reference(result, event_ctx);
        if (result->event_ctx == NULL) goto failed;
 
        state = talloc(result, struct sock_connect_state);
@@ -202,6 +197,11 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons
        TALLOC_CTX *tmp_ctx = talloc_new(mem_ctx);
        struct smbcli_socket *result;
 
+       if (event_ctx == NULL) {
+               DEBUG(0, ("Invalid NULL event context passed in as parameter\n"));
+               return NULL;
+       }
+
        if (tmp_ctx == NULL) {
                DEBUG(0, ("talloc_new failed\n"));
                return NULL;
@@ -214,16 +214,6 @@ _PUBLIC_ struct smbcli_socket *smbcli_sock_connect_byname(const char *host, cons
                return NULL;
        }
 
-       if (event_ctx == NULL) {
-               event_ctx = event_context_init(mem_ctx);
-       }
-
-       if (event_ctx == NULL) {
-               DEBUG(0, ("event_context_init failed\n"));
-               talloc_free(tmp_ctx);
-               return NULL;
-       }
-
        /* allow hostnames of the form NAME#xx and do a netbios lookup */
        if ((p = strchr(name, '#'))) {
                name_type = strtol(p+1, NULL, 16);
index 3965c58204ce1da16e3dd11e5691ff22c9844d28..bad37437216edb416d291a0685d4502471cc8b46 100644 (file)
@@ -1587,6 +1587,14 @@ union smb_open {
 
                        /* optional list of extended attributes */
                        struct smb_ea_list eas;
+
+                       struct smb2_create_blobs {
+                               uint32_t num_blobs;
+                               struct smb2_create_blob {
+                                       const char *tag;
+                                       DATA_BLOB data;
+                               } *blobs;
+                       } blobs;
                } in;
                struct {
                        union smb_handle file;
@@ -1706,19 +1714,27 @@ union smb_read {
 
                        /* static body buffer 48 (0x30) bytes */
                        /* uint16_t buffer_code;  0x31 = 0x30 + 1 */
-                       uint16_t _pad;
+                       uint8_t _pad;
+                       uint8_t reserved;
                        uint32_t length;
                        uint64_t offset;
                        /* struct smb2_handle handle; */
-                       uint64_t unknown1; /* 0x0000000000000000 */
-                       uint64_t unknown2; /* 0x0000000000000000 */
+                       uint32_t min_count;
+                       uint32_t channel;
+                       uint32_t remaining;
+                       /* the docs give no indication of what
+                          these channel variables are for */
+                       uint16_t channel_offset;
+                       uint16_t channel_length;
                } in;
                struct {
                        /* static body buffer 16 (0x10) bytes */
                        /* uint16_t buffer_code;  0x11 = 0x10 + 1 */
-                       /* uint16_t data_ofs; */
+                       /* uint8_t data_ofs; */
+                       /* uint8_t reserved; */
                        /* uint32_t data_size; */
-                       uint64_t unknown1; /* 0x0000000000000000 */
+                       uint32_t remaining;
+                       uint32_t reserved;
 
                        /* dynamic body */
                        DATA_BLOB data;
@@ -1846,7 +1862,8 @@ enum smb_lock_level {
        RAW_LOCK_LOCK,
        RAW_LOCK_UNLOCK,
        RAW_LOCK_LOCKX,
-       RAW_LOCK_SMB2
+       RAW_LOCK_SMB2,
+       RAW_LOCK_SMB2_BREAK
 };
 
 /* the generic interface is defined to be equal to the lockingX interface */
@@ -1909,6 +1926,20 @@ union smb_lock {
                        uint16_t unknown1;
                } out;
        } smb2;
+
+       /* SMB2 Break */
+       struct smb2_break {
+               enum smb_lock_level level;
+               struct {
+                       union smb_handle file;
+
+                       /* static body buffer 24 (0x18) bytes */
+                       uint8_t oplock_level;
+                       uint8_t reserved;
+                       uint32_t reserved2;
+                       /* struct smb2_handle handle; */
+               } in, out;
+       } smb2_break;
 };
 
 
index a42c71054718b1fb67268cbb31beda22498ba8e9..ef856c6ea1d0c5799d72d879694d2f3aa7dcc6e2 100644 (file)
@@ -700,10 +700,10 @@ DATA_BLOB smbcli_req_pull_blob(struct request_bufinfo *bufinfo, TALLOC_CTX *mem_
 static bool smbcli_req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t count)
 {
        /* be careful with wraparound! */
-       if (ptr < bufinfo->data ||
-           ptr >= bufinfo->data + bufinfo->data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)bufinfo->data ||
+           (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size ||
            count > bufinfo->data_size ||
-           ptr + count > bufinfo->data + bufinfo->data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) {
                return true;
        }
        return false;
index 29881afd2bc2ff7be350842ef36304a50b63c9e9..0f15b2151b6046452b0a1519c3e780875b9d7386 100644 (file)
@@ -40,10 +40,10 @@ static bool raw_trans_oob(struct smbcli_request *req,
        ptr = req->in.hdr + offset;
        
        /* be careful with wraparound! */
-       if (ptr < req->in.data ||
-           ptr >= req->in.data + req->in.data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)req->in.data ||
+           (uintptr_t)ptr >= (uintptr_t)req->in.data + req->in.data_size ||
            count > req->in.data_size ||
-           ptr + count > req->in.data + req->in.data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)req->in.data + req->in.data_size) {
                return true;
        }
        return false;   
index 4b8f3f955388e83d93b83df6de02915106873add..1a695432eecbd2b3b13932bec3f69d2a700b8bde 100644 (file)
@@ -135,7 +135,6 @@ struct composite_context *resolve_name_host_send(TALLOC_CTX *mem_ctx,
        c = composite_create(mem_ctx, event_ctx);
        if (c == NULL) return NULL;
 
-       c->event_ctx = talloc_reference(c, event_ctx);
        if (composite_nomem(c->event_ctx, c)) return c;
 
        state = talloc(c, struct host_state);
index 887bdd7ecf7376568c5d32b5e95d453c7fb9164f..8f085c5404078a16ef0c6742d800373b5ef3d864 100644 (file)
@@ -110,10 +110,9 @@ struct composite_context *resolve_name_nbtlist_send(TALLOC_CTX *mem_ctx,
        struct nbtlist_state *state;
        int i;
 
-       c = composite_create(event_ctx, event_ctx);
+       c = composite_create(mem_ctx, event_ctx);
        if (c == NULL) return NULL;
 
-       c->event_ctx = talloc_reference(c, event_ctx);
        if (composite_nomem(c->event_ctx, c)) return c;
 
        state = talloc(c, struct nbtlist_state);
index 33ace094432a261726926cbaf30fb4c3220d172e..aaf9ff1f8db2ecf108beb8ecb00d3481b51f686a 100644 (file)
@@ -136,19 +136,14 @@ struct composite_context *resolve_name_send(struct resolve_context *ctx,
        struct composite_context *c;
        struct resolve_state *state;
 
-       c = composite_create(event_ctx, event_ctx);
-       if (c == NULL) return NULL;
-
-       if (ctx == NULL) {
+       if (ctx == NULL || event_ctx == NULL) {
                composite_error(c, NT_STATUS_INVALID_PARAMETER);
                return c;
        }
 
-       if (event_ctx == NULL) {
-               c->event_ctx = event_context_init(c);
-       } else {
-               c->event_ctx = talloc_reference(c, event_ctx);
-       }
+       c = composite_create(ctx, event_ctx);
+       if (c == NULL) return NULL;
+
        if (composite_nomem(c->event_ctx, c)) return c;
 
        state = talloc(c, struct resolve_state);
diff --git a/source4/libcli/smb2/break.c b/source4/libcli/smb2/break.c
new file mode 100644 (file)
index 0000000..fe0cceb
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   SMB2 client oplock break handling
+
+   Copyright (C) Stefan Metzmacher 2008
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+
+/*
+  send a break request
+*/
+struct smb2_request *smb2_break_send(struct smb2_tree *tree, struct smb2_break *io)
+{
+       struct smb2_request *req;
+
+       req = smb2_request_init_tree(tree, SMB2_OP_BREAK, 0x18, false, 0);
+       if (req == NULL) return NULL;
+
+       SCVAL(req->out.body, 0x02, io->in.oplock_level);
+       SCVAL(req->out.body, 0x03, io->in.reserved);
+       SIVAL(req->out.body, 0x04, io->in.reserved2);
+       smb2_push_handle(req->out.body+0x08, &io->in.file.handle);
+
+       smb2_transport_send(req);
+
+       return req;
+}
+
+
+/*
+  recv a break reply
+*/
+NTSTATUS smb2_break_recv(struct smb2_request *req, struct smb2_break *io)
+{
+       if (!smb2_request_receive(req) ||
+           !smb2_request_is_ok(req)) {
+               return smb2_request_destroy(req);
+       }
+
+       SMB2_CHECK_PACKET_RECV(req, 0x18, false);
+
+       io->out.oplock_level    = CVAL(req->in.body, 0x02);
+       io->out.reserved        = CVAL(req->in.body, 0x03);
+       io->out.reserved2       = IVAL(req->in.body, 0x04);
+       smb2_pull_handle(req->in.body+0x08, &io->out.file.handle);
+
+       return smb2_request_destroy(req);
+}
+
+/*
+  sync flush request
+*/
+NTSTATUS smb2_break(struct smb2_tree *tree, struct smb2_break *io)
+{
+       struct smb2_request *req = smb2_break_send(tree, io);
+       return smb2_break_recv(req, io);
+}
index e95997db54980b4cb1f95a8ee60a8a43bc6c4d7c..18f6245a3eb07cec03fd93cb17b51f917662a5b2 100644 (file)
@@ -6,5 +6,5 @@ LIBCLI_SMB2_OBJ_FILES = $(addprefix libcli/smb2/, \
        transport.o request.o negprot.o session.o tcon.o \
        create.o close.o connect.o getinfo.o write.o read.o \
        setinfo.o find.o ioctl.o logoff.o tdis.o flush.o \
-       lock.o notify.o cancel.o keepalive.o)
+       lock.o notify.o cancel.o keepalive.o break.o)
 
index d68b85ad540fd3684380c1e94bc831cfe17e6ff3..59d4e6ea2d5625b743e75a7405ec8d427bd23692 100644 (file)
@@ -121,7 +121,7 @@ static void continue_socket(struct composite_context *creq)
        struct smbcli_socket *sock;
        struct smb2_transport *transport;
        struct smb2_request *req;
-       uint16_t dialects[1];
+       uint16_t dialects[2];
 
        c->status = smbcli_sock_connect_recv(creq, state, &sock);
        if (!composite_is_ok(c)) return;
@@ -130,11 +130,12 @@ static void continue_socket(struct composite_context *creq)
        if (composite_nomem(transport, c)) return;
 
        ZERO_STRUCT(state->negprot);
-       state->negprot.in.dialect_count = 1;
+       state->negprot.in.dialect_count = 2;
        state->negprot.in.security_mode = 0;
        state->negprot.in.capabilities  = 0;
        unix_to_nt_time(&state->negprot.in.start_time, time(NULL));
-       dialects[0] = SMB2_DIALECT_REVISION;
+       dialects[0] = 0;
+       dialects[1] = SMB2_DIALECT_REVISION;
        state->negprot.in.dialects = dialects;
 
        req = smb2_negprot_send(transport, &state->negprot);
index 999c10ab085c44b37c5146e41bf77fd08435eacc..6ac32a494fcae747bcd9442dc97d9f6aed8db5a4 100644 (file)
 /*
   add a blob to a smb2_create attribute blob
 */
-NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, DATA_BLOB *blob, 
-                             const char *tag,
-                             DATA_BLOB add, bool last)
+static NTSTATUS smb2_create_blob_push_one(TALLOC_CTX *mem_ctx, DATA_BLOB *buffer,
+                                         const struct smb2_create_blob *blob,
+                                         bool last)
 {
-       uint32_t ofs = blob->length;
-       size_t tag_length = strlen(tag);
-       uint8_t pad = smb2_padding_size(add.length+tag_length, 8);
-       if (!data_blob_realloc(mem_ctx, blob, 
-                              blob->length + 0x14 + tag_length + add.length + pad))
+       uint32_t ofs = buffer->length;
+       size_t tag_length = strlen(blob->tag);
+       uint8_t pad = smb2_padding_size(blob->data.length+tag_length, 4);
+
+       if (!data_blob_realloc(mem_ctx, buffer,
+                              buffer->length + 0x14 + tag_length + blob->data.length + pad))
                return NT_STATUS_NO_MEMORY;
-       
+
        if (last) {
-               SIVAL(blob->data, ofs+0x00, 0);
+               SIVAL(buffer->data, ofs+0x00, 0);
        } else {
-               SIVAL(blob->data, ofs+0x00, 0x14 + tag_length + add.length + pad);
+               SIVAL(buffer->data, ofs+0x00, 0x14 + tag_length + blob->data.length + pad);
        }
-       SSVAL(blob->data, ofs+0x04, 0x10); /* offset of tag */
-       SIVAL(blob->data, ofs+0x06, tag_length); /* tag length */
-       SSVAL(blob->data, ofs+0x0A, 0x14 + tag_length); /* offset of data */
-       SIVAL(blob->data, ofs+0x0C, add.length);
-       memcpy(blob->data+ofs+0x10, tag, tag_length);
-       SIVAL(blob->data, ofs+0x10+tag_length, 0); /* pad? */
-       memcpy(blob->data+ofs+0x14+tag_length, add.data, add.length);
-       memset(blob->data+ofs+0x14+tag_length+add.length, 0, pad);
+       SSVAL(buffer->data, ofs+0x04, 0x10); /* offset of tag */
+       SIVAL(buffer->data, ofs+0x06, tag_length); /* tag length */
+       SSVAL(buffer->data, ofs+0x0A, 0x14 + tag_length); /* offset of data */
+       SIVAL(buffer->data, ofs+0x0C, blob->data.length);
+       memcpy(buffer->data+ofs+0x10, blob->tag, tag_length);
+       SIVAL(buffer->data, ofs+0x10+tag_length, 0); /* pad? */
+       memcpy(buffer->data+ofs+0x14+tag_length, blob->data.data, blob->data.length);
+       memset(buffer->data+ofs+0x14+tag_length+blob->data.length, 0, pad);
+
+       return NT_STATUS_OK;
+}
+
+NTSTATUS smb2_create_blob_add(TALLOC_CTX *mem_ctx, struct smb2_create_blobs *b,
+                             const char *tag, DATA_BLOB data)
+{
+       struct smb2_create_blob *array;
+
+       array = talloc_realloc(mem_ctx, b->blobs,
+                              struct smb2_create_blob,
+                              b->num_blobs + 1);
+       NT_STATUS_HAVE_NO_MEMORY(array);
+       b->blobs = array;
+
+       b->blobs[b->num_blobs].tag = talloc_strdup(b->blobs, tag);
+       NT_STATUS_HAVE_NO_MEMORY(b->blobs[b->num_blobs].tag);
+
+       if (data.data) {
+               b->blobs[b->num_blobs].data = data_blob_talloc(b->blobs,
+                                                              data.data,
+                                                              data.length);
+               NT_STATUS_HAVE_NO_MEMORY(b->blobs[b->num_blobs].data.data);
+       } else {
+               b->blobs[b->num_blobs].data = data_blob(NULL, 0);
+       }
+
+       b->num_blobs += 1;
 
        return NT_STATUS_OK;
 }
@@ -64,6 +93,7 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
        struct smb2_request *req;
        NTSTATUS status;
        DATA_BLOB blob = data_blob(NULL, 0);
+       uint32_t i;
 
        req = smb2_request_init_tree(tree, SMB2_OP_CREATE, 0x38, true, 0);
        if (req == NULL) return NULL;
@@ -89,7 +119,8 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
                DATA_BLOB b = data_blob_talloc(req, NULL, 
                                               ea_list_size_chained(io->in.eas.num_eas, io->in.eas.eas));
                ea_put_list_chained(b.data, io->in.eas.num_eas, io->in.eas.eas);
-               status = smb2_create_blob_add(req, &blob, SMB2_CREATE_TAG_EXTA, b, false);
+               status = smb2_create_blob_add(req, &io->in.blobs,
+                                             SMB2_CREATE_TAG_EXTA, b);
                if (!NT_STATUS_IS_OK(status)) {
                        talloc_free(req);
                        return NULL;
@@ -99,13 +130,30 @@ struct smb2_request *smb2_create_send(struct smb2_tree *tree, struct smb2_create
 
        /* an empty MxAc tag seems to be used to ask the server to
           return the maximum access mask allowed on the file */
-       status = smb2_create_blob_add(req, &blob, SMB2_CREATE_TAG_MXAC, 
-                                     data_blob(NULL, 0), true);
-
+       status = smb2_create_blob_add(req, &io->in.blobs,
+                                     SMB2_CREATE_TAG_MXAC, data_blob(NULL, 0));
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(req);
                return NULL;
        }
+
+       for (i=0; i < io->in.blobs.num_blobs; i++) {
+               bool last = false;
+               const struct smb2_create_blob *c;
+
+               if ((i + 1) == io->in.blobs.num_blobs) {
+                       last = true;
+               }
+
+               c = &io->in.blobs.blobs[i];
+               status = smb2_create_blob_push_one(req, &blob,
+                                                  c, last);
+               if (!NT_STATUS_IS_OK(status)) {
+                       talloc_free(req);
+                       return NULL;
+               }
+       }
+
        status = smb2_push_o32s32_blob(&req->out, 0x30, blob);
        if (!NT_STATUS_IS_OK(status)) {
                talloc_free(req);
index b61f91848109f35482a3a0bdd50ac212be852f0d..9d40e32a4d767766c57093d8262d4aab51893581 100644 (file)
@@ -33,12 +33,16 @@ struct smb2_request *smb2_read_send(struct smb2_tree *tree, struct smb2_read *io
        req = smb2_request_init_tree(tree, SMB2_OP_READ, 0x30, true, 0);
        if (req == NULL) return NULL;
 
-       SSVAL(req->out.body, 0x02, 0); /* pad */
+       SCVAL(req->out.body, 0x02, 0); /* pad */
+       SCVAL(req->out.body, 0x03, 0); /* reserved */
        SIVAL(req->out.body, 0x04, io->in.length);
        SBVAL(req->out.body, 0x08, io->in.offset);
        smb2_push_handle(req->out.body+0x10, &io->in.file.handle);
-       SBVAL(req->out.body, 0x20, io->in.unknown1);
-       SBVAL(req->out.body, 0x28, io->in.unknown2);
+       SIVAL(req->out.body, 0x20, io->in.min_count);
+       SIVAL(req->out.body, 0x24, io->in.channel);
+       SIVAL(req->out.body, 0x28, io->in.remaining);
+       SSVAL(req->out.body, 0x2C, io->in.channel_offset);
+       SSVAL(req->out.body, 0x2E, io->in.channel_length);
 
        smb2_transport_send(req);
 
@@ -67,7 +71,8 @@ NTSTATUS smb2_read_recv(struct smb2_request *req,
                return status;
        }
 
-       io->out.unknown1 = BVAL(req->in.body, 0x08);
+       io->out.remaining = IVAL(req->in.body, 0x08);
+       io->out.reserved  = IVAL(req->in.body, 0x0C);
 
        return smb2_request_destroy(req);
 }
index 2471fcaa4ddae7342679e789153b101fb18c74e5..f52b0ceef2586ab17f22fbfcc639c51134078854 100644 (file)
@@ -211,10 +211,10 @@ bool smb2_oob(struct smb2_request_buffer *buf, const uint8_t *ptr, size_t size)
                return false;
        }
        /* be careful with wraparound! */
-       if (ptr < buf->body ||
-           ptr >= buf->body + buf->body_size ||
+       if ((uintptr_t)ptr < (uintptr_t)buf->body ||
+           (uintptr_t)ptr >= (uintptr_t)buf->body + buf->body_size ||
            size > buf->body_size ||
-           ptr + size > buf->body + buf->body_size) {
+           (uintptr_t)ptr + size > (uintptr_t)buf->body + buf->body_size) {
                return true;
        }
        return false;
@@ -669,7 +669,7 @@ NTSTATUS smb2_push_o16s16_string(struct smb2_request_buffer *buf,
        }
 
        if (*str == 0) {
-               blob.data = str;
+               blob.data = discard_const(str);
                blob.length = 0;
                return smb2_push_o16s16_blob(buf, ofs, blob);
        }
index 726df64090f318c823f9e49e1eeea6fe63b75e09..ae66a6e0d3bd898916fcc36bf03d2924797b0b38 100644 (file)
@@ -21,6 +21,8 @@
 
 #include "libcli/raw/request.h"
 
+struct smb2_handle;
+
 struct smb2_options {
        uint32_t timeout;
 };
@@ -58,6 +60,15 @@ struct smb2_transport {
                void *private;
                uint_t period;
        } idle;
+
+       struct {
+               /* a oplock break request handler */
+               bool (*handler)(struct smb2_transport *transport,
+                               const struct smb2_handle *handle,
+                               uint8_t level, void *private_data);
+               /* private data passed to the oplock handler */
+               void *private_data;
+       } oplock;
 };
 
 
index af19fcb0a9cbd0489d853f80a4097fa09cc1f5a3..8eb60a06f132c9a76216d762cc63bae093c76970 100644 (file)
@@ -140,6 +140,44 @@ void smb2_transport_dead(struct smb2_transport *transport, NTSTATUS status)
        }
 }
 
+static bool smb2_handle_oplock_break(struct smb2_transport *transport,
+                                    const DATA_BLOB *blob)
+{
+       uint8_t *hdr;
+       uint16_t opcode;
+       uint64_t seqnum;
+
+       hdr = blob->data+NBT_HDR_SIZE;
+
+       if (blob->length < (SMB2_MIN_SIZE+0x18)) {
+               DEBUG(1,("Discarding smb2 oplock reply of size %u\n",
+                        blob->length));
+               return false;
+       }
+
+       opcode  = SVAL(hdr, SMB2_HDR_OPCODE);
+       seqnum  = BVAL(hdr, SMB2_HDR_MESSAGE_ID);
+
+       if ((opcode != SMB2_OP_BREAK) ||
+           (seqnum != UINT64_MAX)) {
+               return false;
+       }
+
+       if (transport->oplock.handler) {
+               uint8_t *body = hdr+SMB2_HDR_BODY;
+               struct smb2_handle h;
+               uint8_t level;
+
+               level = CVAL(body, 0x02);
+               smb2_pull_handle(body+0x08, &h);
+
+               transport->oplock.handler(transport, &h, level,
+                                         transport->oplock.private_data);
+       }
+
+       return true;
+}
+
 /*
   we have a full request in our receive buffer - match it to a pending request
   and process
@@ -167,6 +205,11 @@ static NTSTATUS smb2_transport_finish_recv(void *private, DATA_BLOB blob)
                goto error;
        }
 
+       if (smb2_handle_oplock_break(transport, &blob)) {
+               talloc_free(buffer);
+               return NT_STATUS_OK;
+       }
+
        flags   = IVAL(hdr, SMB2_HDR_FLAGS);
        seqnum  = BVAL(hdr, SMB2_HDR_MESSAGE_ID);
 
index c44c62f86899f877db5178b82c60d838c0c3894b..c4abfa5e370133763d8ee3da765417cbb9456c80 100644 (file)
@@ -451,17 +451,15 @@ struct composite_context *smb_composite_connect_send(struct smb_composite_connec
        c = talloc_zero(mem_ctx, struct composite_context);
        if (c == NULL) goto failed;
 
+       c->event_ctx = talloc_reference(c, event_ctx);
+       if (c->event_ctx == NULL) goto failed;
+
        state = talloc_zero(c, struct connect_state);
        if (state == NULL) goto failed;
 
-       if (event_ctx == NULL) {
-               event_ctx = event_context_init(mem_ctx);
-       }
-
        state->io = io;
 
        c->state = COMPOSITE_STATE_IN_PROGRESS;
-       c->event_ctx = talloc_reference(c, event_ctx);
        c->private_data = state;
 
        state->stage = CONNECT_RESOLVE;
index d8d7481270fbb573367e2fc8c49a171dc2c76fde..9cd02a51f457b5f45299b2147418b0e52ac428fd 100644 (file)
@@ -62,7 +62,6 @@ static NTSTATUS fetchfile_connect(struct composite_context *c,
        state->creq->async.fn = fetchfile_composite_handler;
 
        state->stage = FETCHFILE_READ;
-       c->event_ctx = talloc_reference(c, state->creq->event_ctx);
 
        return NT_STATUS_OK;
 }
@@ -158,7 +157,6 @@ struct composite_context *smb_composite_fetchfile_send(struct smb_composite_fetc
 
        c->state = COMPOSITE_STATE_IN_PROGRESS;
        state->stage = FETCHFILE_CONNECT;
-       c->event_ctx = talloc_reference(c, state->creq->event_ctx);
        c->private_data = state;
 
        return c;
index 2ec13df9b6bf79edf87e363fa8675d83fcdcd647..270d71f5185be629951f6e1ca588010e6971a054 100644 (file)
@@ -52,7 +52,6 @@ static NTSTATUS fsinfo_connect(struct composite_context *c,
        state->req->async.fn = fsinfo_raw_handler;
 
        state->stage = FSINFO_QUERY;
-       c->event_ctx = talloc_reference(c, state->req->session->transport->socket->event.ctx);
 
        return NT_STATUS_OK;
 }
@@ -158,7 +157,6 @@ struct composite_context *smb_composite_fsinfo_send(struct smbcli_tree *tree,
 
        c->state = COMPOSITE_STATE_IN_PROGRESS;
        state->stage = FSINFO_CONNECT;
-       c->event_ctx = talloc_reference(c, tree->session->transport->socket->event.ctx);
        c->private_data = state;
 
        state->creq = smb_composite_connect_send(state->connect, state,
index 9384a172ff879bb7ef0233a6d4fa819bb066b8a8..94e30d44f11a70dcfd7b79e4c50b1d81a14d0b8d 100644 (file)
@@ -1,4 +1,5 @@
 [SUBSYSTEM::LIBWBCLIENT]
-OBJ_FILES = wbclient.o
 PUBLIC_DEPENDENCIES = LIBSAMBA-ERRORS LIBEVENTS
 PRIVATE_DEPENDENCIES = NDR_WINBIND MESSAGING
+
+LIBWBCLIENT_OBJ_FILES = libcli/wbclient/wbclient.o
index 3e7793c0c7113750ad31765e518aed8d878b548e..0a4e52bd7baff71c912d89262516cb6458cf8e2e 100644 (file)
@@ -172,11 +172,7 @@ struct wrepl_socket *wrepl_socket_init(TALLOC_CTX *mem_ctx,
        wrepl_socket = talloc_zero(mem_ctx, struct wrepl_socket);
        if (!wrepl_socket) return NULL;
 
-       if (event_ctx == NULL) {
-               wrepl_socket->event.ctx = event_context_init(wrepl_socket);
-       } else {
-               wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
-       }
+       wrepl_socket->event.ctx = talloc_reference(wrepl_socket, event_ctx);
        if (!wrepl_socket->event.ctx) goto failed;
 
        wrepl_socket->iconv_convenience = iconv_convenience;
index 1f4ab0621fe6de98e8d3fd43ed7548e1f39929d8..243fc1813a0da5206363fc93c28cc421ec134afb 100644 (file)
@@ -1,6 +1,6 @@
 [SUBSYSTEM::LIBSAMBA-NET]
 PRIVATE_PROTO_HEADER = libnet_proto.h
-PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR SMBPASSWD
+PUBLIC_DEPENDENCIES = CREDENTIALS dcerpc dcerpc_samr RPC_NDR_LSA RPC_NDR_SRVSVC RPC_NDR_DRSUAPI LIBCLI_COMPOSITE LIBCLI_RESOLVE LIBCLI_FINDDCS LIBCLI_CLDAP LIBCLI_FINDDCS gensec_schannel LIBCLI_AUTH LIBNDR SMBPASSWD PROVISION
 
 LIBSAMBA-NET_OBJ_FILES = $(addprefix libnet/, \
        libnet.o libnet_passwd.o libnet_time.o libnet_rpc.o \
@@ -8,10 +8,9 @@ LIBSAMBA-NET_OBJ_FILES = $(addprefix libnet/, \
        libnet_vampire.o libnet_samdump.o libnet_samdump_keytab.o \
        libnet_samsync_ldb.o libnet_user.o libnet_group.o libnet_share.o \
        libnet_lookup.o libnet_domain.o userinfo.o groupinfo.o userman.o \
-       groupman.o prereq_domain.o)
+       groupman.o prereq_domain.o libnet_samsync.o)
 
-[PYTHON::swig_net]
+[PYTHON::python_net]
 PRIVATE_DEPENDENCIES = LIBSAMBA-NET
-SWIG_FILE = net.i
 
-swig_net_OBJ_FILES = libnet/net_wrap.o
+python_net_OBJ_FILES = libnet/py_net.o
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 015661a074d3e5aa31725064e7ef1838cf89ee54..b65a13ce370e0ae83cfcf7b8c7e2145a1cb3ff92 100644 (file)
@@ -68,6 +68,7 @@ struct libnet_context {
 #include "libnet/libnet_site.h"
 #include "libnet/libnet_become_dc.h"
 #include "libnet/libnet_unbecome_dc.h"
+#include "libnet/libnet_samsync.h"
 #include "libnet/libnet_vampire.h"
 #include "libnet/libnet_user.h"
 #include "libnet/libnet_group.h"
index c4f9cabb1166411c0284a3a119c7c7e9fc78b9c4..e8a5329985aa8f8fb5acbd02213debde12e22c4c 100644 (file)
@@ -793,7 +793,7 @@ static NTSTATUS becomeDC_ldap_connect(struct libnet_BecomeDC_state *s,
        url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
        NT_STATUS_HAVE_NO_MEMORY(url);
 
-       ldap->ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
+       ldap->ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url,
                                     NULL,
                                     s->libnet->cred,
                                     0, NULL);
index 22134518d695a15b6c4625e2de7eea6fe58c8fb6..b5b28df81d128385822c2f195e68d9e7d9a8c0c2 100644 (file)
@@ -230,7 +230,7 @@ static NTSTATUS libnet_JoinADSDomain(struct libnet_context *ctx, struct libnet_J
                return NT_STATUS_NO_MEMORY;
        }
 
-       remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->lp_ctx, 
+       remote_ldb = ldb_wrap_connect(tmp_ctx, ctx->event_ctx, ctx->lp_ctx, 
                                      remote_ldb_url, 
                                      NULL, ctx->cred, 0, NULL);
        if (!remote_ldb) {
@@ -839,13 +839,11 @@ NTSTATUS libnet_JoinDomain(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, stru
        return status;
 }
 
-static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, 
-                                          TALLOC_CTX *mem_ctx, 
-                                          struct libnet_Join *r)
+NTSTATUS libnet_set_join_secrets(struct libnet_context *ctx, 
+                                TALLOC_CTX *mem_ctx, 
+                                struct libnet_set_join_secrets *r)
 {
-       NTSTATUS status;
        TALLOC_CTX *tmp_mem;
-       struct libnet_JoinDomain *r2;
        int ret, rtn;
        struct ldb_context *ldb;
        struct ldb_dn *base_dn;
@@ -860,56 +858,13 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                "privateKeytab",
                NULL
        };
-       uint32_t acct_type = 0;
-       const char *account_name;
-       const char *netbios_name;
-       
-       r->out.error_string = NULL;
 
        tmp_mem = talloc_new(mem_ctx);
        if (!tmp_mem) {
                return NT_STATUS_NO_MEMORY;
        }
 
-       r2 = talloc(tmp_mem, struct libnet_JoinDomain);
-       if (!r2) {
-               r->out.error_string = NULL;
-               talloc_free(tmp_mem);
-               return NT_STATUS_NO_MEMORY;
-       }
-       
-       if (r->in.join_type == SEC_CHAN_BDC) {
-               acct_type = ACB_SVRTRUST;
-       } else if (r->in.join_type == SEC_CHAN_WKSTA) {
-               acct_type = ACB_WSTRUST;
-       } else {
-               r->out.error_string = NULL;
-               talloc_free(tmp_mem);   
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       if (r->in.netbios_name != NULL) {
-               netbios_name = r->in.netbios_name;
-       } else {
-               netbios_name = talloc_reference(tmp_mem, lp_netbios_name(ctx->lp_ctx));
-               if (!netbios_name) {
-                       r->out.error_string = NULL;
-                       talloc_free(tmp_mem);
-                       return NT_STATUS_NO_MEMORY;
-               }
-       }
-
-       account_name = talloc_asprintf(tmp_mem, "%s$", netbios_name);
-       if (!account_name) {
-               r->out.error_string = NULL;
-               talloc_free(tmp_mem);
-               return NT_STATUS_NO_MEMORY;
-       }
-       
-       /*
-        * Local secrets are stored in secrets.ldb 
-        * open it to make sure we can write the info into it after the join
-        */
+       /* Open the secrets database */
        ldb = secrets_db_connect(tmp_mem, ctx->lp_ctx);
        if (!ldb) {
                r->out.error_string
@@ -919,23 +874,6 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
        }
 
-       /*
-        * join the domain
-        */
-       ZERO_STRUCTP(r2);
-       r2->in.domain_name      = r->in.domain_name;
-       r2->in.account_name     = account_name;
-       r2->in.netbios_name     = netbios_name;
-       r2->in.level            = LIBNET_JOINDOMAIN_AUTOMATIC;
-       r2->in.acct_type        = acct_type;
-       r2->in.recreate_account = false;
-       status = libnet_JoinDomain(ctx, r2, r2);
-       if (!NT_STATUS_IS_OK(status)) {
-               r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string);
-               talloc_free(tmp_mem);
-               return status;
-       }
-       
        /*
         * now prepare the record for secrets.ldb
         */
@@ -961,21 +899,21 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
        }
 
        msg->dn = ldb_dn_copy(tmp_mem, base_dn);
-       if ( ! ldb_dn_add_child_fmt(msg->dn, "flatname=%s", r2->out.domain_name)) {
+       if ( ! ldb_dn_add_child_fmt(msg->dn, "flatname=%s", r->in.domain_name)) {
                r->out.error_string = NULL;
                talloc_free(tmp_mem);
                return NT_STATUS_NO_MEMORY;
        }
        
-       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "flatname", r2->out.domain_name);
+       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "flatname", r->in.domain_name);
        if (rtn == -1) {
                r->out.error_string = NULL;
                talloc_free(tmp_mem);
                return NT_STATUS_NO_MEMORY;
        }
 
-       if (r2->out.realm) {
-               rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "realm", r2->out.realm);
+       if (r->in.realm) {
+               rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "realm", r->in.realm);
                if (rtn == -1) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -997,14 +935,14 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "secret", r2->out.join_password);
+       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "secret", r->in.join_password);
        if (rtn == -1) {
                r->out.error_string = NULL;
                talloc_free(tmp_mem);
                return NT_STATUS_NO_MEMORY;
        }
 
-       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "samAccountName", r2->in.account_name);
+       rtn = samdb_msg_add_string(ldb, tmp_mem, msg, "samAccountName", r->in.account_name);
        if (rtn == -1) {
                r->out.error_string = NULL;
                talloc_free(tmp_mem);
@@ -1018,9 +956,9 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                return NT_STATUS_NO_MEMORY;
        }
 
-       if (r2->out.kvno) {
+       if (r->in.kvno) {
                rtn = samdb_msg_add_uint(ldb, tmp_mem, msg, "msDS-KeyVersionNumber",
-                                        r2->out.kvno);
+                                        r->in.kvno);
                if (rtn == -1) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -1028,9 +966,9 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                }
        }
 
-       if (r2->out.domain_sid) {
+       if (r->in.domain_sid) {
                rtn = samdb_msg_add_dom_sid(ldb, tmp_mem, msg, "objectSid",
-                                           r2->out.domain_sid);
+                                           r->in.domain_sid);
                if (rtn == -1) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -1047,7 +985,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                           tmp_mem, base_dn,
                           &msgs, attrs,
                           "(|" SECRETS_PRIMARY_DOMAIN_FILTER "(realm=%s))",
-                          r2->out.domain_name, r2->out.realm);
+                          r->in.domain_name, r->in.realm);
        if (ret == 0) {
                rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secretsKeytab", "secrets.keytab");
                if (rtn == -1) {
@@ -1059,7 +997,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                r->out.error_string
                        = talloc_asprintf(mem_ctx, 
                                          "Search for domain: %s and realm: %s failed: %s", 
-                                         r2->out.domain_name, r2->out.realm, ldb_errstring(ldb));
+                                         r->in.domain_name, r->in.realm, ldb_errstring(ldb));
                talloc_free(tmp_mem);
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        } else {
@@ -1082,7 +1020,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                                return NT_STATUS_NO_MEMORY;
                        }
                }
-               rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secret", r2->out.join_password);
+               rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "secret", r->in.join_password);
                if (rtn == -1) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -1101,7 +1039,7 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                        }
                }
 
-               rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "samAccountName", r2->in.account_name);
+               rtn = samdb_msg_set_string(ldb, tmp_mem, msg, "samAccountName", r->in.account_name);
                if (rtn == -1) {
                        r->out.error_string = NULL;
                        talloc_free(tmp_mem);
@@ -1146,6 +1084,104 @@ static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx,
                return NT_STATUS_INTERNAL_DB_CORRUPTION;
        }
 
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS libnet_Join_primary_domain(struct libnet_context *ctx, 
+                                          TALLOC_CTX *mem_ctx, 
+                                          struct libnet_Join *r)
+{
+       NTSTATUS status;
+       TALLOC_CTX *tmp_mem;
+       struct libnet_JoinDomain *r2;
+       struct libnet_set_join_secrets *r3;
+       uint32_t acct_type = 0;
+       const char *account_name;
+       const char *netbios_name;
+       
+       r->out.error_string = NULL;
+
+       tmp_mem = talloc_new(mem_ctx);
+       if (!tmp_mem) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       r2 = talloc(tmp_mem, struct libnet_JoinDomain);
+       if (!r2) {
+               r->out.error_string = NULL;
+               talloc_free(tmp_mem);
+               return NT_STATUS_NO_MEMORY;
+       }
+       
+       if (r->in.join_type == SEC_CHAN_BDC) {
+               acct_type = ACB_SVRTRUST;
+       } else if (r->in.join_type == SEC_CHAN_WKSTA) {
+               acct_type = ACB_WSTRUST;
+       } else {
+               r->out.error_string = NULL;
+               talloc_free(tmp_mem);   
+               return NT_STATUS_INVALID_PARAMETER;
+       }
+
+       if (r->in.netbios_name != NULL) {
+               netbios_name = r->in.netbios_name;
+       } else {
+               netbios_name = talloc_reference(tmp_mem, lp_netbios_name(ctx->lp_ctx));
+               if (!netbios_name) {
+                       r->out.error_string = NULL;
+                       talloc_free(tmp_mem);
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
+
+       account_name = talloc_asprintf(tmp_mem, "%s$", netbios_name);
+       if (!account_name) {
+               r->out.error_string = NULL;
+               talloc_free(tmp_mem);
+               return NT_STATUS_NO_MEMORY;
+       }
+       
+       /*
+        * join the domain
+        */
+       ZERO_STRUCTP(r2);
+       r2->in.domain_name      = r->in.domain_name;
+       r2->in.account_name     = account_name;
+       r2->in.netbios_name     = netbios_name;
+       r2->in.level            = LIBNET_JOINDOMAIN_AUTOMATIC;
+       r2->in.acct_type        = acct_type;
+       r2->in.recreate_account = false;
+       status = libnet_JoinDomain(ctx, r2, r2);
+       if (!NT_STATUS_IS_OK(status)) {
+               r->out.error_string = talloc_steal(mem_ctx, r2->out.error_string);
+               talloc_free(tmp_mem);
+               return status;
+       }
+
+       r3 = talloc(tmp_mem, struct libnet_set_join_secrets);
+       if (!r3) {
+               r->out.error_string = NULL;
+               talloc_free(tmp_mem);
+               return NT_STATUS_NO_MEMORY;
+       }
+       
+       ZERO_STRUCTP(r3);
+       r3->in.domain_name = r2->out.domain_name;
+       r3->in.realm = r2->out.realm;
+       r3->in.account_name = account_name;
+       r3->in.netbios_name = netbios_name;
+       r3->in.join_type = r->in.join_type;
+       r3->in.join_password = r2->out.join_password;
+       r3->in.kvno = r2->out.kvno;
+       r3->in.domain_sid = r2->out.domain_sid;
+       
+       status = libnet_set_join_secrets(ctx, r3, r3);
+       if (!NT_STATUS_IS_OK(status)) {
+               r->out.error_string = talloc_steal(mem_ctx, r3->out.error_string);
+               talloc_free(tmp_mem);
+               return status;
+       }
+
        /* move all out parameter to the callers TALLOC_CTX */
        r->out.error_string     = NULL;
        r->out.join_password    = r2->out.join_password;
index 6da4564cb37065d1984e1e5c4e9728df3825fcc4..79884130d8a48743ac40ed5db6cfc3d38bd5a8a2 100644 (file)
@@ -79,5 +79,22 @@ struct libnet_Join {
        } out;
 };
 
+struct libnet_set_join_secrets {
+       struct {
+               const char *domain_name;
+               const char *realm;
+               const char *netbios_name;
+               const char *account_name;
+               enum netr_SchannelType join_type;
+               const char *join_password;
+               int kvno;
+               struct dom_sid *domain_sid;
+       } in;
+       
+       struct {
+               const char *error_string;
+       } out;
+};
+
 
 #endif /* __LIBNET_JOIN_H__ */
index c25cb4d9c56fbf3c83b762ebda33c0ff7762f177..0c4d3e5c595342720675227f4988f63a43a297f8 100644 (file)
 #include "auth/credentials/credentials.h"
 #include "auth/credentials/credentials_krb5.h"
 #include "param/param.h"
+#include "lib/events/events.h"
 
 static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx,
+                                          struct event_context *event_ctx,
                                           struct loadparm_context *lp_ctx,
                                            const char *keytab_name,
                                            struct netr_DELTA_ENUM *delta) 
@@ -53,12 +55,12 @@ static NTSTATUS samdump_keytab_handle_user(TALLOC_CTX *mem_ctx,
         * pass a value in here */
        cli_credentials_set_kvno(credentials, 0);
        cli_credentials_set_nt_hash(credentials, &user->ntpassword, CRED_SPECIFIED);
-       ret = cli_credentials_set_keytab_name(credentials, lp_ctx, keytab_name, CRED_SPECIFIED);
+       ret = cli_credentials_set_keytab_name(credentials, event_ctx, lp_ctx, keytab_name, CRED_SPECIFIED);
        if (ret) {
                return NT_STATUS_UNSUCCESSFUL;
        }
 
-       ret = cli_credentials_update_keytab(credentials, lp_ctx);
+       ret = cli_credentials_update_keytab(credentials, event_ctx, lp_ctx);
        if (ret) {
                return NT_STATUS_UNSUCCESSFUL;
        }
@@ -82,6 +84,7 @@ static NTSTATUS libnet_samdump_keytab_fn(TALLOC_CTX *mem_ctx,
                /* not interested in builtin users */
                if (database == SAM_DATABASE_DOMAIN) {
                        nt_status = samdump_keytab_handle_user(mem_ctx, 
+                                                              event_context_find(mem_ctx),
                                                               global_loadparm,
                                                               keytab_name,
                                                               delta);
diff --git a/source4/libnet/libnet_samsync.c b/source4/libnet/libnet_samsync.c
new file mode 100644 (file)
index 0000000..0f82d98
--- /dev/null
@@ -0,0 +1,399 @@
+/* 
+   Unix SMB/CIFS implementation.
+   
+   Extract the user/system database from a remote SamSync server
+
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
+   
+   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/>.
+*/
+
+
+#include "includes.h"
+#include "libnet/libnet.h"
+#include "libcli/auth/libcli_auth.h"
+#include "auth/gensec/gensec.h"
+#include "auth/credentials/credentials.h"
+#include "auth/gensec/schannel_proto.h"
+#include "librpc/gen_ndr/ndr_netlogon.h"
+#include "librpc/gen_ndr/ndr_netlogon_c.h"
+#include "param/param.h"
+
+
+/**
+ * Decrypt and extract the user's passwords.  
+ * 
+ * The writes decrypted (no longer 'RID encrypted' or arcfour encrypted) passwords back into the structure
+ */
+static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
+                        struct creds_CredentialState *creds,
+                        bool rid_crypt,
+                        enum netr_SamDatabaseID database,
+                        struct netr_DELTA_ENUM *delta,
+                        char **error_string) 
+{
+
+       uint32_t rid = delta->delta_id_union.rid;
+       struct netr_DELTA_USER *user = delta->delta_union.user;
+       struct samr_Password lm_hash;
+       struct samr_Password nt_hash;
+       const char *username = user->account_name.string;
+
+       if (rid_crypt) {
+               if (user->lm_password_present) {
+                       sam_rid_crypt(rid, user->lmpassword.hash, lm_hash.hash, 0);
+                       user->lmpassword = lm_hash;
+               }
+               
+               if (user->nt_password_present) {
+                       sam_rid_crypt(rid, user->ntpassword.hash, nt_hash.hash, 0);
+                       user->ntpassword = nt_hash;
+               }
+       }
+
+       if (user->user_private_info.SensitiveData) {
+               DATA_BLOB data;
+               struct netr_USER_KEYS keys;
+               enum ndr_err_code ndr_err;
+               data.data = user->user_private_info.SensitiveData;
+               data.length = user->user_private_info.DataLength;
+               creds_arcfour_crypt(creds, data.data, data.length);
+               user->user_private_info.SensitiveData = data.data;
+               user->user_private_info.DataLength = data.length;
+
+               ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
+               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+                       *error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username);
+                       dump_data(10, data.data, data.length);
+                       return ndr_map_error2ntstatus(ndr_err);
+               }
+
+               if (keys.keys.keys2.lmpassword.length == 16) {
+                       if (rid_crypt) {
+                               sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
+                               user->lmpassword = lm_hash;
+                       } else {
+                               user->lmpassword = keys.keys.keys2.lmpassword.pwd;
+                       }
+                       user->lm_password_present = true;
+               }
+               if (keys.keys.keys2.ntpassword.length == 16) {
+                       if (rid_crypt) {
+                               sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0);
+                               user->ntpassword = nt_hash;
+                       } else {
+                               user->ntpassword = keys.keys.keys2.ntpassword.pwd;
+                       }
+                       user->nt_password_present = true;
+               }
+               /* TODO: rid decrypt history fields */
+       }
+       return NT_STATUS_OK;
+}
+
+/**
+ * Decrypt and extract the secrets
+ * 
+ * The writes decrypted secrets back into the structure
+ */
+static NTSTATUS fix_secret(TALLOC_CTX *mem_ctx,
+                          struct creds_CredentialState *creds,
+                          enum netr_SamDatabaseID database,
+                          struct netr_DELTA_ENUM *delta,
+                          char **error_string) 
+{
+       struct netr_DELTA_SECRET *secret = delta->delta_union.secret;
+       creds_arcfour_crypt(creds, secret->current_cipher.cipher_data, 
+                           secret->current_cipher.maxlen); 
+
+       creds_arcfour_crypt(creds, secret->old_cipher.cipher_data, 
+                           secret->old_cipher.maxlen); 
+
+       return NT_STATUS_OK;
+}
+
+/**
+ * Fix up the delta, dealing with encryption issues so that the final
+ * callback need only do the printing or application logic
+ */
+
+static NTSTATUS fix_delta(TALLOC_CTX *mem_ctx,                 
+                         struct creds_CredentialState *creds,
+                         bool rid_crypt,
+                         enum netr_SamDatabaseID database,
+                         struct netr_DELTA_ENUM *delta,
+                         char **error_string)
+{
+       NTSTATUS nt_status = NT_STATUS_OK;
+       *error_string = NULL;
+       switch (delta->delta_type) {
+       case NETR_DELTA_USER:
+       {
+               nt_status = fix_user(mem_ctx, 
+                                    creds,
+                                    rid_crypt,
+                                    database,
+                                    delta,
+                                    error_string);
+               break;
+       }
+       case NETR_DELTA_SECRET:
+       {
+               nt_status = fix_secret(mem_ctx, 
+                                      creds,
+                                      database,
+                                      delta,
+                                      error_string);
+               break;
+       }
+       default:
+               break;
+       }
+       return nt_status;
+}
+
+NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamSync *r)
+{
+       NTSTATUS nt_status, dbsync_nt_status;
+       TALLOC_CTX *samsync_ctx, *loop_ctx, *delta_ctx;
+       struct creds_CredentialState *creds;
+       struct netr_DatabaseSync dbsync;
+       struct cli_credentials *machine_account;
+       struct dcerpc_pipe *p;
+       struct libnet_context *machine_net_ctx;
+       struct libnet_RpcConnect *c;
+       struct libnet_SamSync_state *state;
+       const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; 
+       int i;
+
+       samsync_ctx = talloc_named(mem_ctx, 0, "SamSync top context");
+
+       if (!r->in.machine_account) { 
+               machine_account = cli_credentials_init(samsync_ctx);
+               if (!machine_account) {
+                       talloc_free(samsync_ctx);
+                       return NT_STATUS_NO_MEMORY;
+               }
+               cli_credentials_set_conf(machine_account, ctx->lp_ctx);
+               nt_status = cli_credentials_set_machine_account(machine_account, ctx->lp_ctx);
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?");
+                       talloc_free(samsync_ctx);
+                       return nt_status;
+               }
+       } else {
+               machine_account = r->in.machine_account;
+       }
+
+       /* We cannot do this unless we are a BDC.  Check, before we get odd errors later */
+       if (cli_credentials_get_secure_channel_type(machine_account) != SEC_CHAN_BDC) {
+               r->out.error_string
+                       = talloc_asprintf(mem_ctx, 
+                                         "Our join to domain %s is not as a BDC (%d), please rejoin as a BDC",
+                                         cli_credentials_get_domain(machine_account),
+                                         cli_credentials_get_secure_channel_type(machine_account));
+               talloc_free(samsync_ctx);
+               return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+       }
+
+       c = talloc(samsync_ctx, struct libnet_RpcConnect);
+       if (!c) {
+               r->out.error_string = NULL;
+               talloc_free(samsync_ctx);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       c->level              = LIBNET_RPC_CONNECT_DC_INFO;
+       if (r->in.binding_string) {
+               c->in.binding = r->in.binding_string;
+               c->in.name    = NULL;
+       } else {
+               c->in.binding = NULL;
+               c->in.name    = cli_credentials_get_domain(machine_account);
+       }
+       
+       /* prepare connect to the NETLOGON pipe of PDC */
+       c->in.dcerpc_iface      = &ndr_table_netlogon;
+
+       /* We must do this as the machine, not as any command-line
+        * user.  So we override the credentials in the
+        * libnet_context */
+       machine_net_ctx = talloc(samsync_ctx, struct libnet_context);
+       if (!machine_net_ctx) {
+               r->out.error_string = NULL;
+               talloc_free(samsync_ctx);
+               return NT_STATUS_NO_MEMORY;
+       }
+       *machine_net_ctx = *ctx;
+       machine_net_ctx->cred = machine_account;
+
+       /* connect to the NETLOGON pipe of the PDC */
+       nt_status = libnet_RpcConnect(machine_net_ctx, samsync_ctx, c);
+       if (!NT_STATUS_IS_OK(nt_status)) {
+               if (r->in.binding_string) {
+                       r->out.error_string = talloc_asprintf(mem_ctx,
+                                                             "Connection to NETLOGON pipe of DC %s failed: %s",
+                                                             r->in.binding_string, c->out.error_string);
+               } else {
+                       r->out.error_string = talloc_asprintf(mem_ctx,
+                                                             "Connection to NETLOGON pipe of DC for %s failed: %s",
+                                                             c->in.name, c->out.error_string);
+               }
+               talloc_free(samsync_ctx);
+               return nt_status;
+       }
+
+       /* This makes a new pipe, on which we can do schannel.  We
+        * should do this in the RpcConnect code, but the abstaction
+        * layers do not suit yet */
+
+       nt_status = dcerpc_secondary_connection(c->out.dcerpc_pipe, &p,
+                                               c->out.dcerpc_pipe->binding);
+
+       if (!NT_STATUS_IS_OK(nt_status)) {
+               r->out.error_string = talloc_asprintf(mem_ctx,
+                                                     "Secondary connection to NETLOGON pipe of DC %s failed: %s",
+                                                     dcerpc_server_name(p), nt_errstr(nt_status));
+               talloc_free(samsync_ctx);
+               return nt_status;
+       }
+
+       nt_status = dcerpc_bind_auth_schannel(samsync_ctx, p, &ndr_table_netlogon,
+                                             machine_account, ctx->lp_ctx, DCERPC_AUTH_LEVEL_PRIVACY);
+
+       if (!NT_STATUS_IS_OK(nt_status)) {
+               r->out.error_string = talloc_asprintf(mem_ctx,
+                                                     "SCHANNEL authentication to NETLOGON pipe of DC %s failed: %s",
+                                                     dcerpc_server_name(p), nt_errstr(nt_status));
+               talloc_free(samsync_ctx);
+               return nt_status;
+       }
+
+       state = talloc(samsync_ctx, struct libnet_SamSync_state);
+       if (!state) {
+               r->out.error_string = NULL;
+               talloc_free(samsync_ctx);
+               return nt_status;
+       }               
+
+       state->domain_name     = c->out.domain_name;
+       state->domain_sid      = c->out.domain_sid;
+       state->realm           = c->out.realm;
+       state->domain_guid     = c->out.guid;
+       state->machine_net_ctx = machine_net_ctx;
+       state->netlogon_pipe   = p;
+
+       /* initialise the callback layer.  It may wish to contact the
+        * server with ldap, now we know the name */
+       
+       if (r->in.init_fn) {
+               char *error_string;
+               nt_status = r->in.init_fn(samsync_ctx, 
+                                         r->in.fn_ctx,
+                                         state, 
+                                         &error_string); 
+               if (!NT_STATUS_IS_OK(nt_status)) {
+                       r->out.error_string = talloc_steal(mem_ctx, error_string);
+                       talloc_free(samsync_ctx);
+                       return nt_status;
+               }
+       }
+
+       /* get NETLOGON credentials */
+
+       nt_status = dcerpc_schannel_creds(p->conn->security_state.generic_state, samsync_ctx, &creds);
+       if (!NT_STATUS_IS_OK(nt_status)) {
+               r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain NETLOGON credentials from DCERPC/GENSEC layer");
+               talloc_free(samsync_ctx);
+               return nt_status;
+       }
+
+       /* Setup details for the synchronisation */
+       dbsync.in.logon_server = talloc_asprintf(samsync_ctx, "\\\\%s", dcerpc_server_name(p));
+       dbsync.in.computername = cli_credentials_get_workstation(machine_account);
+       dbsync.in.preferredmaximumlength = (uint32_t)-1;
+       ZERO_STRUCT(dbsync.in.return_authenticator);
+
+       for (i=0;i< ARRAY_SIZE(database_ids); i++) { 
+               dbsync.in.sync_context = 0;
+               dbsync.in.database_id = database_ids[i]; 
+               
+               do {
+                       int d;
+                       loop_ctx = talloc_named(samsync_ctx, 0, "DatabaseSync loop context");
+                       creds_client_authenticator(creds, &dbsync.in.credential);
+                       
+                       dbsync_nt_status = dcerpc_netr_DatabaseSync(p, loop_ctx, &dbsync);
+                       if (!NT_STATUS_IS_OK(dbsync_nt_status) &&
+                           !NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)) {
+                               r->out.error_string = talloc_asprintf(mem_ctx, "DatabaseSync failed - %s", nt_errstr(nt_status));
+                               talloc_free(samsync_ctx);
+                               return nt_status;
+                       }
+                       
+                       if (!creds_client_check(creds, &dbsync.out.return_authenticator.cred)) {
+                               r->out.error_string = talloc_strdup(mem_ctx, "Credential chaining on incoming DatabaseSync failed");
+                               talloc_free(samsync_ctx);
+                               return NT_STATUS_ACCESS_DENIED;
+                       }
+                       
+                       dbsync.in.sync_context = dbsync.out.sync_context;
+                       
+                       /* For every single remote 'delta' entry: */
+                       for (d=0; d < dbsync.out.delta_enum_array->num_deltas; d++) {
+                               char *error_string = NULL;
+                               delta_ctx = talloc_named(loop_ctx, 0, "DatabaseSync delta context");
+                               /* 'Fix' elements, by decrypting and
+                                * de-obfuscating the data */
+                               nt_status = fix_delta(delta_ctx, 
+                                                     creds, 
+                                                     r->in.rid_crypt,
+                                                     dbsync.in.database_id,
+                                                     &dbsync.out.delta_enum_array->delta_enum[d], 
+                                                     &error_string);
+                               if (!NT_STATUS_IS_OK(nt_status)) {
+                                       r->out.error_string = talloc_steal(mem_ctx, error_string);
+                                       talloc_free(samsync_ctx);
+                                       return nt_status;
+                               }
+
+                               /* Now call the callback.  This will
+                                * do something like print the data or
+                                * write to an ldb */
+                               nt_status = r->in.delta_fn(delta_ctx, 
+                                                          r->in.fn_ctx,
+                                                          dbsync.in.database_id,
+                                                          &dbsync.out.delta_enum_array->delta_enum[d], 
+                                                          &error_string);
+                               if (!NT_STATUS_IS_OK(nt_status)) {
+                                       r->out.error_string = talloc_steal(mem_ctx, error_string);
+                                       talloc_free(samsync_ctx);
+                                       return nt_status;
+                               }
+                               talloc_free(delta_ctx);
+                       }
+                       talloc_free(loop_ctx);
+               } while (NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES));
+               
+               if (!NT_STATUS_IS_OK(dbsync_nt_status)) {
+                       r->out.error_string = talloc_asprintf(mem_ctx, "libnet_SamSync_netlogon failed: unexpected inconsistancy. Should not get error %s here", nt_errstr(nt_status));
+                       talloc_free(samsync_ctx);
+                       return dbsync_nt_status;
+               }
+               nt_status = NT_STATUS_OK;
+       }
+       talloc_free(samsync_ctx);
+       return nt_status;
+}
+
diff --git a/source4/libnet/libnet_samsync.h b/source4/libnet/libnet_samsync.h
new file mode 100644 (file)
index 0000000..d2ac30f
--- /dev/null
@@ -0,0 +1,84 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
+   
+   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/>.
+*/
+
+#include "librpc/gen_ndr/netlogon.h"
+
+struct libnet_SamSync_state {
+       struct libnet_context *machine_net_ctx;
+       struct dcerpc_pipe *netlogon_pipe;
+       const char *domain_name;
+       const struct dom_sid *domain_sid;
+       const char *realm;
+       struct GUID *domain_guid;
+};
+
+/* struct and enum for doing a remote domain vampire dump */
+struct libnet_SamSync {
+       struct {
+               const char *binding_string;
+               bool rid_crypt;
+               NTSTATUS (*init_fn)(TALLOC_CTX *mem_ctx,                
+                                   void *private,
+                                   struct libnet_SamSync_state *samsync_state,
+                                   char **error_string);
+               NTSTATUS (*delta_fn)(TALLOC_CTX *mem_ctx,               
+                                    void *private,                     
+                                    enum netr_SamDatabaseID database,
+                                    struct netr_DELTA_ENUM *delta,
+                                    char **error_string);
+               void *fn_ctx;
+               struct cli_credentials *machine_account;
+       } in;
+       struct {
+               const char *error_string;
+       } out;
+};
+
+struct libnet_SamDump {
+       struct {
+               const char *binding_string;
+               struct cli_credentials *machine_account;
+       } in;
+       struct {
+               const char *error_string;
+       } out;
+};
+
+struct libnet_SamDump_keytab {
+       struct {
+               const char *binding_string;
+               const char *keytab_name;
+               struct cli_credentials *machine_account;
+       } in;
+       struct {
+               const char *error_string;
+       } out;
+};
+
+struct libnet_samsync_ldb {
+       struct {
+               const char *binding_string;
+               struct cli_credentials *machine_account;
+               struct auth_session_info *session_info;
+       } in;
+       struct {
+               const char *error_string;
+       } out;
+};
+
index a60b05189b0bcff5f5c3d6ce900219ecb2f370ec..85e5dea2d72cac6215c8086474df1ba89214c443 100644 (file)
@@ -1194,6 +1194,7 @@ static NTSTATUS libnet_samsync_ldb_init(TALLOC_CTX *mem_ctx,
                ldap_url = talloc_asprintf(state, "ldap://%s", server);
                
                state->remote_ldb = ldb_wrap_connect(mem_ctx, 
+                                                    state->samsync_state->machine_net_ctx->event_ctx,
                                                     state->samsync_state->machine_net_ctx->lp_ctx, 
                                                     ldap_url, 
                                                     NULL, state->samsync_state->machine_net_ctx->cred,
@@ -1222,6 +1223,7 @@ NTSTATUS libnet_samsync_ldb(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, str
        state->trusted_domains = NULL;
 
        state->sam_ldb         = ldb_wrap_connect(mem_ctx, 
+                                                 ctx->event_ctx,
                                                  ctx->lp_ctx, 
                                                  lp_sam_url(ctx->lp_ctx), 
                                                  r->in.session_info,
index dabd23a5bee7594249327f564ec0f4b7e3673fd5..f39d9e039cb5788c95cb94b068d864eff5f5df9d 100644 (file)
@@ -30,7 +30,7 @@
  * 1. Setup a CLDAP socket.
  * 2. Lookup the default Site-Name.
  */
-NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
+NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_context *lctx, struct libnet_JoinSite *r)
 {
        NTSTATUS status;
        TALLOC_CTX *tmp_ctx;
@@ -55,7 +55,7 @@ NTSTATUS libnet_FindSite(TALLOC_CTX *ctx, struct libnet_JoinSite *r)
        search.in.acct_control = -1;
        search.in.version = 6;
 
-       cldap = cldap_socket_init(tmp_ctx, NULL, lp_iconv_convenience(global_loadparm));
+       cldap = cldap_socket_init(tmp_ctx, lctx->event_ctx, lp_iconv_convenience(global_loadparm));
        status = cldap_netlogon(cldap, tmp_ctx, &search);
        if (!NT_STATUS_IS_OK(status)) {
                /*
@@ -148,7 +148,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        }
 
        make_nbt_name_client(&name, libnet_r->out.samr_binding->host);
-       status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, NULL);
+       status = resolve_name(lp_resolve_context(ctx->lp_ctx), &name, r, &dest_addr, ctx->event_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                libnet_r->out.error_string = NULL;
                talloc_free(tmp_ctx);
@@ -161,7 +161,7 @@ NTSTATUS libnet_JoinSite(struct libnet_context *ctx,
        r->in.domain_dn_str = libnet_r->out.domain_dn_str;
        r->in.cldap_port = lp_cldap_port(ctx->lp_ctx);
 
-       status = libnet_FindSite(tmp_ctx, r);
+       status = libnet_FindSite(tmp_ctx, ctx, r);
        if (!NT_STATUS_IS_OK(status)) {
                libnet_r->out.error_string =
                        talloc_steal(libnet_r, r->out.error_string);
index 5d346ac166fdd0c0df20c31f3fe049f8e81be822..6f065858804dbf4e23ca7fdb6b497812e53d5224 100644 (file)
@@ -310,7 +310,7 @@ static NTSTATUS unbecomeDC_ldap_connect(struct libnet_UnbecomeDC_state *s)
        url = talloc_asprintf(s, "ldap://%s/", s->source_dsa.dns_name);
        NT_STATUS_HAVE_NO_MEMORY(url);
 
-       s->ldap.ldb = ldb_wrap_connect(s, s->libnet->lp_ctx, url,
+       s->ldap.ldb = ldb_wrap_connect(s, s->libnet->event_ctx, s->libnet->lp_ctx, url,
                                       NULL,
                                       s->libnet->cred,
                                       0, NULL);
index 678c7a226e601ce96f1c21913bcceb500b18156f..dce7320c736061980e7340463254e0bbad73a825 100644 (file)
@@ -597,7 +597,9 @@ NTSTATUS libnet_ModifyUser(struct libnet_context *ctx, TALLOC_CTX *mem_ctx,
 struct user_info_state {
        struct libnet_context *ctx;
        const char *domain_name;
+       enum libnet_UserInfo_level level;
        const char *user_name;
+       const char *sid_string;
        struct libnet_LookupName lookup;
        struct libnet_DomainOpen domopen;
        struct libnet_rpc_userinfo userinfo;
@@ -628,7 +630,7 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
 {
        struct composite_context *c;
        struct user_info_state *s;
-       struct composite_context *lookup_req;
+       struct composite_context *lookup_req, *info_req;
        bool prereq_met = false;
 
        /* composite context allocation and setup */
@@ -644,23 +646,54 @@ struct composite_context* libnet_UserInfo_send(struct libnet_context *ctx,
        s->monitor_fn = monitor;
        s->ctx = ctx;
        s->domain_name = talloc_strdup(c, r->in.domain_name);
-       s->user_name = talloc_strdup(c, r->in.user_name);
+       s->level = r->in.level;
+       switch (s->level) {
+       case USER_INFO_BY_NAME:
+               s->user_name = talloc_strdup(c, r->in.data.user_name);
+               s->sid_string = NULL;
+               break;
+       case USER_INFO_BY_SID:
+               s->user_name = NULL;
+               s->sid_string = dom_sid_string(c, r->in.data.user_sid);
+               break;
+       }
 
        /* prerequisite: make sure the domain is opened */
        prereq_met = samr_domain_opened(ctx, s->domain_name, &c, &s->domopen,
                                        continue_domain_open_info, monitor);
        if (!prereq_met) return c;
 
-       /* prepare arguments for LookupName call */
-       s->lookup.in.domain_name = s->domain_name;
-       s->lookup.in.name        = s->user_name;
-
-       /* send the request */
-       lookup_req = libnet_LookupName_send(ctx, c, &s->lookup, s->monitor_fn);
-       if (composite_nomem(lookup_req, c)) return c;
+       switch (s->level) {
+       case USER_INFO_BY_NAME:
+               /* prepare arguments for LookupName call */
+               s->lookup.in.domain_name = s->domain_name;
+               s->lookup.in.name        = s->user_name;
+
+               /* send the request */
+               lookup_req = libnet_LookupName_send(ctx, c, &s->lookup,
+                                                   s->monitor_fn);
+               if (composite_nomem(lookup_req, c)) return c;
+
+               /* set the next stage */
+               composite_continue(c, lookup_req, continue_name_found, c);
+               break;
+       case USER_INFO_BY_SID:
+               /* prepare arguments for UserInfo call */
+               s->userinfo.in.domain_handle = s->ctx->samr.handle;
+               s->userinfo.in.sid = s->sid_string;
+               s->userinfo.in.level = 21;
+
+               /* send the request */
+               info_req = libnet_rpc_userinfo_send(s->ctx->samr.pipe,
+                                                   &s->userinfo,
+                                                   s->monitor_fn);
+               if (composite_nomem(info_req, c)) return c;
+
+               /* set the next stage */
+               composite_continue(c, info_req, continue_info_received, c);
+               break;
+       }
 
-       /* set the next stage */
-       composite_continue(c, lookup_req, continue_name_found, c);
        return c;
 }
 
@@ -673,7 +706,7 @@ static void continue_domain_open_info(struct composite_context *ctx)
 {
        struct composite_context *c;
        struct user_info_state *s;
-       struct composite_context *lookup_req;
+       struct composite_context *lookup_req, *info_req;
        struct monitor_msg msg;
 
        c = talloc_get_type(ctx->async.private_data, struct composite_context);
@@ -686,16 +719,36 @@ static void continue_domain_open_info(struct composite_context *ctx)
        /* send monitor message */
        if (s->monitor_fn) s->monitor_fn(&msg);
 
-       /* prepare arguments for LookupName call */
-       s->lookup.in.domain_name = s->domain_name;
-       s->lookup.in.name        = s->user_name;
-       
-       /* send the request */
-       lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn);
-       if (composite_nomem(lookup_req, c)) return;
-
-       /* set the next stage */
-       composite_continue(c, lookup_req, continue_name_found, c);
+       switch (s->level) {
+       case USER_INFO_BY_NAME:
+               /* prepare arguments for LookupName call */
+               s->lookup.in.domain_name = s->domain_name;
+               s->lookup.in.name        = s->user_name;
+
+               /* send the request */
+               lookup_req = libnet_LookupName_send(s->ctx, c, &s->lookup, s->monitor_fn);
+               if (composite_nomem(lookup_req, c)) return;
+
+               /* set the next stage */
+               composite_continue(c, lookup_req, continue_name_found, c);
+               break;
+
+       case USER_INFO_BY_SID:
+               /* prepare arguments for UserInfo call */
+               s->userinfo.in.domain_handle = s->ctx->samr.handle;
+               s->userinfo.in.sid = s->sid_string;
+               s->userinfo.in.level = 21;
+
+               /* send the request */
+               info_req = libnet_rpc_userinfo_send(s->ctx->samr.pipe,
+                                                   &s->userinfo,
+                                                   s->monitor_fn);
+               if (composite_nomem(info_req, c)) return;
+
+               /* set the next stage */
+               composite_continue(c, info_req, continue_info_received, c);
+               break;
+       }
 }
 
 
index 94aa38464f649eaf982599d7fe97132ce9381e19..7095160004541c6da79d4087bb95035559c7abf5 100644 (file)
@@ -99,11 +99,19 @@ struct libnet_ModifyUser {
                }                                       \
        }
 
+enum libnet_UserInfo_level {
+       USER_INFO_BY_NAME=0,
+       USER_INFO_BY_SID
+};
 
 struct libnet_UserInfo {
        struct {
-               const char *user_name;
                const char *domain_name;
+               enum libnet_UserInfo_level level;
+               union {
+                       const char *user_name;
+                       const struct dom_sid *user_sid;
+               } data;
        } in;
        struct {
                struct dom_sid *user_sid;
@@ -123,7 +131,6 @@ struct libnet_UserInfo {
                struct timeval *last_logoff;
                struct timeval *last_password_change;
                uint32_t acct_flags;
-               
                const char *error_string;
        } out;
 };
index 0f82d98673831fbacfcec1646fe9a92647ff7930..56a8ebe034c386467feacfb176678a711f619c58 100644 (file)
@@ -1,9 +1,11 @@
 /* 
    Unix SMB/CIFS implementation.
    
-   Extract the user/system database from a remote SamSync server
+   Extract the user/system database from a remote server
 
-   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2004-2005
+   Copyright (C) Stefan Metzmacher     2004-2006
+   Copyright (C) Brad Henry 2005
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005-2008
    
    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
 
 #include "includes.h"
 #include "libnet/libnet.h"
-#include "libcli/auth/libcli_auth.h"
-#include "auth/gensec/gensec.h"
-#include "auth/credentials/credentials.h"
-#include "auth/gensec/schannel_proto.h"
-#include "librpc/gen_ndr/ndr_netlogon.h"
-#include "librpc/gen_ndr/ndr_netlogon_c.h"
+#include "lib/events/events.h"
+#include "dsdb/samdb/samdb.h"
+#include "lib/util/dlinklist.h"
+#include "lib/ldb/include/ldb.h"
+#include "lib/ldb/include/ldb_errors.h"
+#include "librpc/ndr/libndr.h"
+#include "librpc/gen_ndr/ndr_drsuapi.h"
+#include "librpc/gen_ndr/ndr_drsblobs.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+#include "system/time.h"
+#include "lib/ldb_wrap.h"
+#include "auth/auth.h"
 #include "param/param.h"
+#include "param/provision.h"
 
+/* 
+List of tasks vampire.py must perform:
+- Domain Join
+ - but don't write the secrets.ldb
+ - results for this should be enough to handle the provision
+- if vampire method is samsync 
+ - Provision using these results 
+  - do we still want to support this NT4 technology?
+- Start samsync with libnet code
+ - provision in the callback 
+- Write out the secrets database, using the code from libnet_Join
+
+*/
+struct vampire_state {
+       const char *netbios_name;
+       struct libnet_JoinDomain *join;
+       struct cli_credentials *machine_account;
+       struct dsdb_schema *self_made_schema;
+       const struct dsdb_schema *schema;
+
+       struct ldb_context *ldb;
 
-/**
- * Decrypt and extract the user's passwords.  
- * 
- * The writes decrypted (no longer 'RID encrypted' or arcfour encrypted) passwords back into the structure
- */
-static NTSTATUS fix_user(TALLOC_CTX *mem_ctx,
-                        struct creds_CredentialState *creds,
-                        bool rid_crypt,
-                        enum netr_SamDatabaseID database,
-                        struct netr_DELTA_ENUM *delta,
-                        char **error_string) 
+       struct {
+               uint32_t object_count;
+               struct drsuapi_DsReplicaObjectListItemEx *first_object;
+               struct drsuapi_DsReplicaObjectListItemEx *last_object;
+       } schema_part;
+
+       const char *targetdir;
+
+       struct loadparm_context *lp_ctx;
+       struct event_context *event_ctx;
+};
+
+static NTSTATUS vampire_prepare_db(void *private_data,
+                                             const struct libnet_BecomeDC_PrepareDB *p)
 {
+       struct vampire_state *s = talloc_get_type(private_data, struct vampire_state);
+       struct provision_settings settings;
+       struct provision_result result;
+       NTSTATUS status;
+
+       settings.site_name = p->dest_dsa->site_name;
+       settings.root_dn_str = p->forest->root_dn_str;
+       settings.domain_dn_str = p->domain->dn_str;
+       settings.config_dn_str = p->forest->config_dn_str;
+       settings.schema_dn_str = p->forest->schema_dn_str;
+       settings.netbios_name = p->dest_dsa->netbios_name;
+       settings.realm = s->join->out.realm;
+       settings.domain = s->join->out.domain_name;
+       settings.server_dn_str = p->dest_dsa->server_dn_str;
+       settings.machine_password = generate_random_str(s, 16);
+       settings.targetdir = s->targetdir;
+
+       status = provision_bare(s, s->lp_ctx, &settings, &result);
+
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
 
-       uint32_t rid = delta->delta_id_union.rid;
-       struct netr_DELTA_USER *user = delta->delta_union.user;
-       struct samr_Password lm_hash;
-       struct samr_Password nt_hash;
-       const char *username = user->account_name.string;
+       s->ldb = result.samdb;
+       s->lp_ctx = result.lp_ctx;
 
-       if (rid_crypt) {
-               if (user->lm_password_present) {
-                       sam_rid_crypt(rid, user->lmpassword.hash, lm_hash.hash, 0);
-                       user->lmpassword = lm_hash;
-               }
-               
-               if (user->nt_password_present) {
-                       sam_rid_crypt(rid, user->ntpassword.hash, nt_hash.hash, 0);
-                       user->ntpassword = nt_hash;
-               }
+        return NT_STATUS_OK;
+
+
+}
+
+static NTSTATUS vampire_check_options(void *private_data,
+                                            const struct libnet_BecomeDC_CheckOptions *o)
+{
+       struct vampire_state *s = talloc_get_type(private_data, struct vampire_state);
+
+       DEBUG(0,("Become DC [%s] of Domain[%s]/[%s]\n",
+               s->netbios_name,
+               o->domain->netbios_name, o->domain->dns_name));
+
+       DEBUG(0,("Promotion Partner is Server[%s] from Site[%s]\n",
+               o->source_dsa->dns_name, o->source_dsa->site_name));
+
+       DEBUG(0,("Options:crossRef behavior_version[%u]\n"
+                      "\tschema object_version[%u]\n"
+                      "\tdomain behavior_version[%u]\n"
+                      "\tdomain w2k3_update_revision[%u]\n", 
+               o->forest->crossref_behavior_version,
+               o->forest->schema_object_version,
+               o->domain->behavior_version,
+               o->domain->w2k3_update_revision));
+
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS vampire_apply_schema(struct vampire_state *s,
+                                 const struct libnet_BecomeDC_StoreChunk *c)
+{
+       WERROR status;
+       const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
+       uint32_t total_object_count;
+       uint32_t object_count;
+       struct drsuapi_DsReplicaObjectListItemEx *first_object;
+       struct drsuapi_DsReplicaObjectListItemEx *cur;
+       uint32_t linked_attributes_count;
+       struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
+       const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
+       struct dsdb_extended_replicated_objects *objs;
+       struct repsFromTo1 *s_dsa;
+       char *tmp_dns_name;
+       struct ldb_message *msg;
+       struct ldb_val prefixMap_val;
+       struct ldb_message_element *prefixMap_el;
+       struct ldb_val schemaInfo_val;
+       uint32_t i;
+       int ret;
+       bool ok;
+
+       DEBUG(0,("Analyze and apply schema objects\n"));
+
+       s_dsa                   = talloc_zero(s, struct repsFromTo1);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+       s_dsa->other_info       = talloc(s_dsa, struct repsFromTo1OtherInfo);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
+       switch (c->ctr_level) {
+       case 1:
+               mapping_ctr                     = &c->ctr1->mapping_ctr;
+               total_object_count              = c->ctr1->total_object_count;
+               object_count                    = s->schema_part.object_count;
+               first_object                    = s->schema_part.first_object;
+               linked_attributes_count         = 0;
+               linked_attributes               = NULL;
+               s_dsa->highwatermark            = c->ctr1->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr1->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
+               uptodateness_vector             = NULL; /* TODO: map it */
+               break;
+       case 6:
+               mapping_ctr                     = &c->ctr6->mapping_ctr;
+               total_object_count              = c->ctr6->total_object_count;
+               object_count                    = s->schema_part.object_count;
+               first_object                    = s->schema_part.first_object;
+               linked_attributes_count         = 0; /* TODO: ! */
+               linked_attributes               = NULL; /* TODO: ! */;
+               s_dsa->highwatermark            = c->ctr6->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr6->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
+               uptodateness_vector             = c->ctr6->uptodateness_vector;
+               break;
+       default:
+               return NT_STATUS_INVALID_PARAMETER;
        }
 
-       if (user->user_private_info.SensitiveData) {
-               DATA_BLOB data;
-               struct netr_USER_KEYS keys;
-               enum ndr_err_code ndr_err;
-               data.data = user->user_private_info.SensitiveData;
-               data.length = user->user_private_info.DataLength;
-               creds_arcfour_crypt(creds, data.data, data.length);
-               user->user_private_info.SensitiveData = data.data;
-               user->user_private_info.DataLength = data.length;
-
-               ndr_err = ndr_pull_struct_blob(&data, mem_ctx, NULL, &keys, (ndr_pull_flags_fn_t)ndr_pull_netr_USER_KEYS);
-               if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-                       *error_string = talloc_asprintf(mem_ctx, "Failed to parse Sensitive Data for %s:", username);
-                       dump_data(10, data.data, data.length);
-                       return ndr_map_error2ntstatus(ndr_err);
+       s_dsa->replica_flags            = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+                                       | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                       | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+       memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+       tmp_dns_name    = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       tmp_dns_name    = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       s_dsa->other_info->dns_name = tmp_dns_name;
+
+       for (cur = first_object; cur; cur = cur->next_object) {
+               bool is_attr = false;
+               bool is_class = false;
+
+               for (i=0; i < cur->object.attribute_ctr.num_attributes; i++) {
+                       struct drsuapi_DsReplicaAttribute *a;
+                       uint32_t j;
+                       const char *oid = NULL;
+
+                       a = &cur->object.attribute_ctr.attributes[i];
+                       status = dsdb_map_int2oid(s->self_made_schema, a->attid, s, &oid);
+                       if (!W_ERROR_IS_OK(status)) {
+                               return werror_to_ntstatus(status);
+                       }
+
+                       switch (a->attid) {
+                       case DRSUAPI_ATTRIBUTE_objectClass:
+                               for (j=0; j < a->value_ctr.num_values; j++) {
+                                       uint32_t val = 0xFFFFFFFF;
+
+                                       if (a->value_ctr.values[i].blob
+                                           && a->value_ctr.values[i].blob->length == 4) {
+                                               val = IVAL(a->value_ctr.values[i].blob->data,0);
+                                       }
+
+                                       if (val == DRSUAPI_OBJECTCLASS_attributeSchema) {
+                                               is_attr = true;
+                                       }
+                                       if (val == DRSUAPI_OBJECTCLASS_classSchema) {
+                                               is_class = true;
+                                       }
+                               }
+
+                               break;
+                       default:
+                               break;
+                       }
                }
 
-               if (keys.keys.keys2.lmpassword.length == 16) {
-                       if (rid_crypt) {
-                               sam_rid_crypt(rid, keys.keys.keys2.lmpassword.pwd.hash, lm_hash.hash, 0);
-                               user->lmpassword = lm_hash;
-                       } else {
-                               user->lmpassword = keys.keys.keys2.lmpassword.pwd;
+               if (is_attr) {
+                       struct dsdb_attribute *sa;
+
+                       sa = talloc_zero(s->self_made_schema, struct dsdb_attribute);
+                       NT_STATUS_HAVE_NO_MEMORY(sa);
+
+                       status = dsdb_attribute_from_drsuapi(s->self_made_schema, &cur->object, s, sa);
+                       if (!W_ERROR_IS_OK(status)) {
+                               return werror_to_ntstatus(status);
                        }
-                       user->lm_password_present = true;
+
+                       DLIST_ADD_END(s->self_made_schema->attributes, sa, struct dsdb_attribute *);
                }
-               if (keys.keys.keys2.ntpassword.length == 16) {
-                       if (rid_crypt) {
-                               sam_rid_crypt(rid, keys.keys.keys2.ntpassword.pwd.hash, nt_hash.hash, 0);
-                               user->ntpassword = nt_hash;
-                       } else {
-                               user->ntpassword = keys.keys.keys2.ntpassword.pwd;
+
+               if (is_class) {
+                       struct dsdb_class *sc;
+
+                       sc = talloc_zero(s->self_made_schema, struct dsdb_class);
+                       NT_STATUS_HAVE_NO_MEMORY(sc);
+
+                       status = dsdb_class_from_drsuapi(s->self_made_schema, &cur->object, s, sc);
+                       if (!W_ERROR_IS_OK(status)) {
+                               return werror_to_ntstatus(status);
                        }
-                       user->nt_password_present = true;
+
+                       DLIST_ADD_END(s->self_made_schema->classes, sc, struct dsdb_class *);
                }
-               /* TODO: rid decrypt history fields */
        }
-       return NT_STATUS_OK;
-}
 
-/**
- * Decrypt and extract the secrets
- * 
- * The writes decrypted secrets back into the structure
- */
-static NTSTATUS fix_secret(TALLOC_CTX *mem_ctx,
-                          struct creds_CredentialState *creds,
-                          enum netr_SamDatabaseID database,
-                          struct netr_DELTA_ENUM *delta,
-                          char **error_string) 
-{
-       struct netr_DELTA_SECRET *secret = delta->delta_union.secret;
-       creds_arcfour_crypt(creds, secret->current_cipher.cipher_data, 
-                           secret->current_cipher.maxlen); 
+       /* attach the schema to the ldb */
+       ret = dsdb_set_schema(s->ldb, s->self_made_schema);
+       if (ret != LDB_SUCCESS) {
+               return NT_STATUS_FOOBAR;
+       }
+       /* we don't want to access the self made schema anymore */
+       s->self_made_schema = NULL;
+       s->schema = dsdb_get_schema(s->ldb);
+
+       status = dsdb_extended_replicated_objects_commit(s->ldb,
+                                                        c->partition->nc.dn,
+                                                        mapping_ctr,
+                                                        object_count,
+                                                        first_object,
+                                                        linked_attributes_count,
+                                                        linked_attributes,
+                                                        s_dsa,
+                                                        uptodateness_vector,
+                                                        c->gensec_skey,
+                                                        s, &objs);
+       if (!W_ERROR_IS_OK(status)) {
+               DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
+               return werror_to_ntstatus(status);
+       }
+
+       if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) {
+               for (i=0; i < objs->num_objects; i++) {
+                       struct ldb_ldif ldif;
+                       fprintf(stdout, "#\n");
+                       ldif.changetype = LDB_CHANGETYPE_NONE;
+                       ldif.msg = objs->objects[i].msg;
+                       ldb_ldif_write_file(s->ldb, stdout, &ldif);
+                       NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
+               }
+       }
+
+       msg = ldb_msg_new(objs);
+       NT_STATUS_HAVE_NO_MEMORY(msg);
+       msg->dn = objs->partition_dn;
+
+       status = dsdb_get_oid_mappings_ldb(s->schema, msg, &prefixMap_val, &schemaInfo_val);
+       if (!W_ERROR_IS_OK(status)) {
+               DEBUG(0,("Failed dsdb_get_oid_mappings_ldb(%s)\n", win_errstr(status)));
+               return werror_to_ntstatus(status);
+       }
+
+       /* we only add prefixMap here, because schemaInfo is a replicated attribute and already applied */
+       ret = ldb_msg_add_value(msg, "prefixMap", &prefixMap_val, &prefixMap_el);
+       if (ret != LDB_SUCCESS) {
+               return NT_STATUS_FOOBAR;
+       }
+       prefixMap_el->flags = LDB_FLAG_MOD_REPLACE;
+
+       ret = ldb_modify(s->ldb, msg);
+       if (ret != LDB_SUCCESS) {
+               DEBUG(0,("Failed to add prefixMap and schemaInfo %s\n", ldb_strerror(ret)));
+               return NT_STATUS_FOOBAR;
+       }
+
+       talloc_free(s_dsa);
+       talloc_free(objs);
+
+       /* reopen the ldb */
+       talloc_free(s->ldb); /* this also free's the s->schema, because dsdb_set_schema() steals it */
+       s->schema = NULL;
+
+       DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema\n"));
+       s->ldb = samdb_connect(s, s->event_ctx, s->lp_ctx, 
+                              system_session(s, s->lp_ctx));
+       if (!s->ldb) {
+               DEBUG(0,("Failed to reopen sam.ldb\n"));
+               return NT_STATUS_INTERNAL_DB_ERROR;
+       }
 
-       creds_arcfour_crypt(creds, secret->old_cipher.cipher_data, 
-                           secret->old_cipher.maxlen); 
+       /* We must set these up to ensure the replMetaData is written correctly, before our NTDS Settings entry is replicated */
+       ok = samdb_set_ntds_invocation_id(s->ldb, &c->dest_dsa->invocation_id);
+       if (!ok) {
+               DEBUG(0,("Failed to set cached ntds invocationId\n"));
+               return NT_STATUS_FOOBAR;
+       }
+       ok = samdb_set_ntds_objectGUID(s->ldb, &c->dest_dsa->ntds_guid);
+       if (!ok) {
+               DEBUG(0,("Failed to set cached ntds objectGUID\n"));
+               return NT_STATUS_FOOBAR;
+       }
+
+       s->schema = dsdb_get_schema(s->ldb);
+       if (!s->schema) {
+               DEBUG(0,("Failed to get loaded dsdb_schema\n"));
+               return NT_STATUS_FOOBAR;
+       }
 
        return NT_STATUS_OK;
 }
 
-/**
- * Fix up the delta, dealing with encryption issues so that the final
- * callback need only do the printing or application logic
- */
-
-static NTSTATUS fix_delta(TALLOC_CTX *mem_ctx,                 
-                         struct creds_CredentialState *creds,
-                         bool rid_crypt,
-                         enum netr_SamDatabaseID database,
-                         struct netr_DELTA_ENUM *delta,
-                         char **error_string)
+static NTSTATUS vampire_schema_chunk(void *private_data,
+                                           const struct libnet_BecomeDC_StoreChunk *c)
 {
-       NTSTATUS nt_status = NT_STATUS_OK;
-       *error_string = NULL;
-       switch (delta->delta_type) {
-       case NETR_DELTA_USER:
-       {
-               nt_status = fix_user(mem_ctx, 
-                                    creds,
-                                    rid_crypt,
-                                    database,
-                                    delta,
-                                    error_string);
+       struct vampire_state *s = talloc_get_type(private_data, struct vampire_state);
+       WERROR status;
+       const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
+       uint32_t total_object_count;
+       uint32_t object_count;
+       struct drsuapi_DsReplicaObjectListItemEx *first_object;
+       struct drsuapi_DsReplicaObjectListItemEx *cur;
+
+       switch (c->ctr_level) {
+       case 1:
+               mapping_ctr             = &c->ctr1->mapping_ctr;
+               total_object_count      = c->ctr1->total_object_count;
+               object_count            = c->ctr1->object_count;
+               first_object            = c->ctr1->first_object;
                break;
-       }
-       case NETR_DELTA_SECRET:
-       {
-               nt_status = fix_secret(mem_ctx, 
-                                      creds,
-                                      database,
-                                      delta,
-                                      error_string);
+       case 6:
+               mapping_ctr             = &c->ctr6->mapping_ctr;
+               total_object_count      = c->ctr6->total_object_count;
+               object_count            = c->ctr6->object_count;
+               first_object            = c->ctr6->first_object;
                break;
-       }
        default:
-               break;
+               return NT_STATUS_INVALID_PARAMETER;
        }
-       return nt_status;
-}
 
-NTSTATUS libnet_SamSync_netlogon(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, struct libnet_SamSync *r)
-{
-       NTSTATUS nt_status, dbsync_nt_status;
-       TALLOC_CTX *samsync_ctx, *loop_ctx, *delta_ctx;
-       struct creds_CredentialState *creds;
-       struct netr_DatabaseSync dbsync;
-       struct cli_credentials *machine_account;
-       struct dcerpc_pipe *p;
-       struct libnet_context *machine_net_ctx;
-       struct libnet_RpcConnect *c;
-       struct libnet_SamSync_state *state;
-       const enum netr_SamDatabaseID database_ids[] = {SAM_DATABASE_DOMAIN, SAM_DATABASE_BUILTIN, SAM_DATABASE_PRIVS}; 
-       int i;
-
-       samsync_ctx = talloc_named(mem_ctx, 0, "SamSync top context");
-
-       if (!r->in.machine_account) { 
-               machine_account = cli_credentials_init(samsync_ctx);
-               if (!machine_account) {
-                       talloc_free(samsync_ctx);
-                       return NT_STATUS_NO_MEMORY;
+       if (total_object_count) {
+               DEBUG(0,("Schema-DN[%s] objects[%u/%u]\n",
+                       c->partition->nc.dn, object_count, total_object_count));
+       } else {
+               DEBUG(0,("Schema-DN[%s] objects[%u]\n",
+               c->partition->nc.dn, object_count));
+       }
+
+       if (!s->schema) {
+               s->self_made_schema = dsdb_new_schema(s, lp_iconv_convenience(s->lp_ctx));
+
+               NT_STATUS_HAVE_NO_MEMORY(s->self_made_schema);
+
+               status = dsdb_load_oid_mappings_drsuapi(s->self_made_schema, mapping_ctr);
+               if (!W_ERROR_IS_OK(status)) {
+                       return werror_to_ntstatus(status);
                }
-               cli_credentials_set_conf(machine_account, ctx->lp_ctx);
-               nt_status = cli_credentials_set_machine_account(machine_account, ctx->lp_ctx);
-               if (!NT_STATUS_IS_OK(nt_status)) {
-                       r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain machine account password - are we joined to the domain?");
-                       talloc_free(samsync_ctx);
-                       return nt_status;
+
+               s->schema = s->self_made_schema;
+       } else {
+               status = dsdb_verify_oid_mappings_drsuapi(s->schema, mapping_ctr);
+               if (!W_ERROR_IS_OK(status)) {
+                       return werror_to_ntstatus(status);
                }
+       }
+
+       if (!s->schema_part.first_object) {
+               s->schema_part.object_count = object_count;
+               s->schema_part.first_object = talloc_steal(s, first_object);
        } else {
-               machine_account = r->in.machine_account;
+               s->schema_part.object_count             += object_count;
+               s->schema_part.last_object->next_object = talloc_steal(s->schema_part.last_object,
+                                                                      first_object);
        }
+       for (cur = first_object; cur->next_object; cur = cur->next_object) {}
+       s->schema_part.last_object = cur;
 
-       /* We cannot do this unless we are a BDC.  Check, before we get odd errors later */
-       if (cli_credentials_get_secure_channel_type(machine_account) != SEC_CHAN_BDC) {
-               r->out.error_string
-                       = talloc_asprintf(mem_ctx, 
-                                         "Our join to domain %s is not as a BDC (%d), please rejoin as a BDC",
-                                         cli_credentials_get_domain(machine_account),
-                                         cli_credentials_get_secure_channel_type(machine_account));
-               talloc_free(samsync_ctx);
-               return NT_STATUS_CANT_ACCESS_DOMAIN_INFO;
+       if (c->partition->highwatermark.tmp_highest_usn == c->partition->highwatermark.highest_usn) {
+               return vampire_apply_schema(s, c);
        }
 
-       c = talloc(samsync_ctx, struct libnet_RpcConnect);
-       if (!c) {
-               r->out.error_string = NULL;
-               talloc_free(samsync_ctx);
-               return NT_STATUS_NO_MEMORY;
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS vampire_store_chunk(void *private_data,
+                                          const struct libnet_BecomeDC_StoreChunk *c)
+{
+       struct vampire_state *s = talloc_get_type(private_data, struct vampire_state);
+       WERROR status;
+       const struct drsuapi_DsReplicaOIDMapping_Ctr *mapping_ctr;
+       uint32_t total_object_count;
+       uint32_t object_count;
+       struct drsuapi_DsReplicaObjectListItemEx *first_object;
+       uint32_t linked_attributes_count;
+       struct drsuapi_DsReplicaLinkedAttribute *linked_attributes;
+       const struct drsuapi_DsReplicaCursor2CtrEx *uptodateness_vector;
+       struct dsdb_extended_replicated_objects *objs;
+       struct repsFromTo1 *s_dsa;
+       char *tmp_dns_name;
+       uint32_t i;
+
+       s_dsa                   = talloc_zero(s, struct repsFromTo1);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa);
+       s_dsa->other_info       = talloc(s_dsa, struct repsFromTo1OtherInfo);
+       NT_STATUS_HAVE_NO_MEMORY(s_dsa->other_info);
+
+       switch (c->ctr_level) {
+       case 1:
+               mapping_ctr                     = &c->ctr1->mapping_ctr;
+               total_object_count              = c->ctr1->total_object_count;
+               object_count                    = c->ctr1->object_count;
+               first_object                    = c->ctr1->first_object;
+               linked_attributes_count         = 0;
+               linked_attributes               = NULL;
+               s_dsa->highwatermark            = c->ctr1->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr1->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = c->ctr1->source_dsa_invocation_id;
+               uptodateness_vector             = NULL; /* TODO: map it */
+               break;
+       case 6:
+               mapping_ctr                     = &c->ctr6->mapping_ctr;
+               total_object_count              = c->ctr6->total_object_count;
+               object_count                    = c->ctr6->object_count;
+               first_object                    = c->ctr6->first_object;
+               linked_attributes_count         = c->ctr6->linked_attributes_count;
+               linked_attributes               = c->ctr6->linked_attributes;
+               s_dsa->highwatermark            = c->ctr6->new_highwatermark;
+               s_dsa->source_dsa_obj_guid      = c->ctr6->source_dsa_guid;
+               s_dsa->source_dsa_invocation_id = c->ctr6->source_dsa_invocation_id;
+               uptodateness_vector             = c->ctr6->uptodateness_vector;
+               break;
+       default:
+               return NT_STATUS_INVALID_PARAMETER;
        }
 
-       c->level              = LIBNET_RPC_CONNECT_DC_INFO;
-       if (r->in.binding_string) {
-               c->in.binding = r->in.binding_string;
-               c->in.name    = NULL;
+       s_dsa->replica_flags            = DRSUAPI_DS_REPLICA_NEIGHBOUR_WRITEABLE
+                                       | DRSUAPI_DS_REPLICA_NEIGHBOUR_SYNC_ON_STARTUP
+                                       | DRSUAPI_DS_REPLICA_NEIGHBOUR_DO_SCHEDULED_SYNCS;
+       memset(s_dsa->schedule, 0x11, sizeof(s_dsa->schedule));
+
+       tmp_dns_name    = GUID_string(s_dsa->other_info, &s_dsa->source_dsa_obj_guid);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       tmp_dns_name    = talloc_asprintf_append_buffer(tmp_dns_name, "._msdcs.%s", c->forest->dns_name);
+       NT_STATUS_HAVE_NO_MEMORY(tmp_dns_name);
+       s_dsa->other_info->dns_name = tmp_dns_name;
+
+       if (total_object_count) {
+               DEBUG(0,("Partition[%s] objects[%u/%u]\n",
+                       c->partition->nc.dn, object_count, total_object_count));
        } else {
-               c->in.binding = NULL;
-               c->in.name    = cli_credentials_get_domain(machine_account);
+               DEBUG(0,("Partition[%s] objects[%u]\n",
+               c->partition->nc.dn, object_count));
        }
-       
-       /* prepare connect to the NETLOGON pipe of PDC */
-       c->in.dcerpc_iface      = &ndr_table_netlogon;
-
-       /* We must do this as the machine, not as any command-line
-        * user.  So we override the credentials in the
-        * libnet_context */
-       machine_net_ctx = talloc(samsync_ctx, struct libnet_context);
-       if (!machine_net_ctx) {
-               r->out.error_string = NULL;
-               talloc_free(samsync_ctx);
-               return NT_STATUS_NO_MEMORY;
+
+       status = dsdb_extended_replicated_objects_commit(s->ldb,
+                                                        c->partition->nc.dn,
+                                                        mapping_ctr,
+                                                        object_count,
+                                                        first_object,
+                                                        linked_attributes_count,
+                                                        linked_attributes,
+                                                        s_dsa,
+                                                        uptodateness_vector,
+                                                        c->gensec_skey,
+                                                        s, &objs);
+       if (!W_ERROR_IS_OK(status)) {
+               DEBUG(0,("Failed to commit objects: %s\n", win_errstr(status)));
+               return werror_to_ntstatus(status);
        }
-       *machine_net_ctx = *ctx;
-       machine_net_ctx->cred = machine_account;
-
-       /* connect to the NETLOGON pipe of the PDC */
-       nt_status = libnet_RpcConnect(machine_net_ctx, samsync_ctx, c);
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               if (r->in.binding_string) {
-                       r->out.error_string = talloc_asprintf(mem_ctx,
-                                                             "Connection to NETLOGON pipe of DC %s failed: %s",
-                                                             r->in.binding_string, c->out.error_string);
-               } else {
-                       r->out.error_string = talloc_asprintf(mem_ctx,
-                                                             "Connection to NETLOGON pipe of DC for %s failed: %s",
-                                                             c->in.name, c->out.error_string);
+
+       if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) {
+               for (i=0; i < objs->num_objects; i++) {
+                       struct ldb_ldif ldif;
+                       fprintf(stdout, "#\n");
+                       ldif.changetype = LDB_CHANGETYPE_NONE;
+                       ldif.msg = objs->objects[i].msg;
+                       ldb_ldif_write_file(s->ldb, stdout, &ldif);
+                       NDR_PRINT_DEBUG(replPropertyMetaDataBlob, objs->objects[i].meta_data);
                }
-               talloc_free(samsync_ctx);
-               return nt_status;
        }
+       talloc_free(s_dsa);
+       talloc_free(objs);
 
-       /* This makes a new pipe, on which we can do schannel.  We
-        * should do this in the RpcConnect code, but the abstaction
-        * layers do not suit yet */
+       for (i=0; i < linked_attributes_count; i++) {
+               const struct dsdb_attribute *sa;
+
+               if (!linked_attributes[i].identifier) {
+                       return NT_STATUS_FOOBAR;                
+               }
+
+               if (!linked_attributes[i].value.blob) {
+                       return NT_STATUS_FOOBAR;                
+               }
 
-       nt_status = dcerpc_secondary_connection(c->out.dcerpc_pipe, &p,
-                                               c->out.dcerpc_pipe->binding);
+               sa = dsdb_attribute_by_attributeID_id(s->schema,
+                                                     linked_attributes[i].attid);
+               if (!sa) {
+                       return NT_STATUS_FOOBAR;
+               }
 
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               r->out.error_string = talloc_asprintf(mem_ctx,
-                                                     "Secondary connection to NETLOGON pipe of DC %s failed: %s",
-                                                     dcerpc_server_name(p), nt_errstr(nt_status));
-               talloc_free(samsync_ctx);
-               return nt_status;
+               if (lp_parm_bool(s->lp_ctx, NULL, "become dc", "dump objects", false)) {
+                       DEBUG(0,("# %s\n", sa->lDAPDisplayName));
+                       NDR_PRINT_DEBUG(drsuapi_DsReplicaLinkedAttribute, &linked_attributes[i]);
+                       dump_data(0,
+                               linked_attributes[i].value.blob->data,
+                               linked_attributes[i].value.blob->length);
+               }
        }
 
-       nt_status = dcerpc_bind_auth_schannel(samsync_ctx, p, &ndr_table_netlogon,
-                                             machine_account, ctx->lp_ctx, DCERPC_AUTH_LEVEL_PRIVACY);
+       return NT_STATUS_OK;
+}
 
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               r->out.error_string = talloc_asprintf(mem_ctx,
-                                                     "SCHANNEL authentication to NETLOGON pipe of DC %s failed: %s",
-                                                     dcerpc_server_name(p), nt_errstr(nt_status));
-               talloc_free(samsync_ctx);
-               return nt_status;
+NTSTATUS libnet_Vampire(struct libnet_context *ctx, TALLOC_CTX *mem_ctx, 
+                       struct libnet_Vampire *r)
+{
+       struct libnet_JoinDomain *join;
+       struct libnet_set_join_secrets *set_secrets;
+       struct libnet_BecomeDC b;
+       struct vampire_state *s;
+       struct ldb_message *msg;
+       int ldb_ret;
+       uint32_t i;
+       NTSTATUS status;
+
+       const char *account_name;
+       const char *netbios_name;
+       
+       r->out.error_string = NULL;
+
+       s = talloc_zero(mem_ctx, struct vampire_state);
+       if (!s) {
+               return NT_STATUS_NO_MEMORY;
        }
 
-       state = talloc(samsync_ctx, struct libnet_SamSync_state);
-       if (!state) {
+       s->lp_ctx = ctx->lp_ctx;
+       s->event_ctx = ctx->event_ctx;
+
+       join = talloc_zero(s, struct libnet_JoinDomain);
+       if (!join) {
+               return NT_STATUS_NO_MEMORY;
+       }
+               
+       if (r->in.netbios_name != NULL) {
+               netbios_name = r->in.netbios_name;
+       } else {
+               netbios_name = talloc_reference(join, lp_netbios_name(ctx->lp_ctx));
+               if (!netbios_name) {
+                       r->out.error_string = NULL;
+                       talloc_free(s);
+                       return NT_STATUS_NO_MEMORY;
+               }
+       }
+
+       account_name = talloc_asprintf(join, "%s$", netbios_name);
+       if (!account_name) {
                r->out.error_string = NULL;
-               talloc_free(samsync_ctx);
-               return nt_status;
-       }               
-
-       state->domain_name     = c->out.domain_name;
-       state->domain_sid      = c->out.domain_sid;
-       state->realm           = c->out.realm;
-       state->domain_guid     = c->out.guid;
-       state->machine_net_ctx = machine_net_ctx;
-       state->netlogon_pipe   = p;
-
-       /* initialise the callback layer.  It may wish to contact the
-        * server with ldap, now we know the name */
+               talloc_free(s);
+               return NT_STATUS_NO_MEMORY;
+       }
        
-       if (r->in.init_fn) {
-               char *error_string;
-               nt_status = r->in.init_fn(samsync_ctx, 
-                                         r->in.fn_ctx,
-                                         state, 
-                                         &error_string); 
-               if (!NT_STATUS_IS_OK(nt_status)) {
-                       r->out.error_string = talloc_steal(mem_ctx, error_string);
-                       talloc_free(samsync_ctx);
-                       return nt_status;
-               }
+       join->in.domain_name    = r->in.domain_name;
+       join->in.account_name   = account_name;
+       join->in.netbios_name   = netbios_name;
+       join->in.level          = LIBNET_JOINDOMAIN_AUTOMATIC;
+       join->in.acct_type      = ACB_WSTRUST;
+       join->in.recreate_account = false;
+       status = libnet_JoinDomain(ctx, join, join);
+       if (!NT_STATUS_IS_OK(status)) {
+               r->out.error_string = talloc_steal(mem_ctx, join->out.error_string);
+               talloc_free(s);
+               return status;
+       }
+       
+       s->join = join;
+
+       s->targetdir = r->in.targetdir;
+
+       ZERO_STRUCT(b);
+       b.in.domain_dns_name            = join->out.realm;
+       b.in.domain_netbios_name        = join->out.domain_name;
+       b.in.domain_sid                 = join->out.domain_sid;
+       b.in.source_dsa_address         = join->out.samr_binding->host;
+       b.in.dest_dsa_netbios_name      = netbios_name;
+
+       b.in.callbacks.private_data     = s;
+       b.in.callbacks.check_options    = vampire_check_options;
+       b.in.callbacks.prepare_db       = vampire_prepare_db;
+       b.in.callbacks.schema_chunk     = vampire_schema_chunk;
+       b.in.callbacks.config_chunk     = vampire_store_chunk;
+       b.in.callbacks.domain_chunk     = vampire_store_chunk;
+
+       status = libnet_BecomeDC(ctx, s, &b);
+       if (!NT_STATUS_IS_OK(status)) {
+               printf("libnet_BecomeDC() failed - %s\n", nt_errstr(status));
+               talloc_free(s);
+               return status;
        }
 
-       /* get NETLOGON credentials */
+       msg = ldb_msg_new(s);
+       if (!msg) {
+               printf("ldb_msg_new() failed\n");
+               talloc_free(s);
+               return NT_STATUS_NO_MEMORY;
+       }
+       msg->dn = ldb_dn_new(msg, s->ldb, "@ROOTDSE");
+       if (!msg->dn) {
+               printf("ldb_msg_new(@ROOTDSE) failed\n");
+               talloc_free(s);
+               return NT_STATUS_NO_MEMORY;
+       }
 
-       nt_status = dcerpc_schannel_creds(p->conn->security_state.generic_state, samsync_ctx, &creds);
-       if (!NT_STATUS_IS_OK(nt_status)) {
-               r->out.error_string = talloc_strdup(mem_ctx, "Could not obtain NETLOGON credentials from DCERPC/GENSEC layer");
-               talloc_free(samsync_ctx);
-               return nt_status;
+       ldb_ret = ldb_msg_add_string(msg, "isSynchronized", "TRUE");
+       if (ldb_ret != LDB_SUCCESS) {
+               printf("ldb_msg_add_string(msg, isSynchronized, TRUE) failed: %d\n", ldb_ret);
+               talloc_free(s);
+               return NT_STATUS_NO_MEMORY;
        }
 
-       /* Setup details for the synchronisation */
-       dbsync.in.logon_server = talloc_asprintf(samsync_ctx, "\\\\%s", dcerpc_server_name(p));
-       dbsync.in.computername = cli_credentials_get_workstation(machine_account);
-       dbsync.in.preferredmaximumlength = (uint32_t)-1;
-       ZERO_STRUCT(dbsync.in.return_authenticator);
+       for (i=0; i < msg->num_elements; i++) {
+               msg->elements[i].flags = LDB_FLAG_MOD_REPLACE;
+       }
 
-       for (i=0;i< ARRAY_SIZE(database_ids); i++) { 
-               dbsync.in.sync_context = 0;
-               dbsync.in.database_id = database_ids[i]; 
-               
-               do {
-                       int d;
-                       loop_ctx = talloc_named(samsync_ctx, 0, "DatabaseSync loop context");
-                       creds_client_authenticator(creds, &dbsync.in.credential);
-                       
-                       dbsync_nt_status = dcerpc_netr_DatabaseSync(p, loop_ctx, &dbsync);
-                       if (!NT_STATUS_IS_OK(dbsync_nt_status) &&
-                           !NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES)) {
-                               r->out.error_string = talloc_asprintf(mem_ctx, "DatabaseSync failed - %s", nt_errstr(nt_status));
-                               talloc_free(samsync_ctx);
-                               return nt_status;
-                       }
-                       
-                       if (!creds_client_check(creds, &dbsync.out.return_authenticator.cred)) {
-                               r->out.error_string = talloc_strdup(mem_ctx, "Credential chaining on incoming DatabaseSync failed");
-                               talloc_free(samsync_ctx);
-                               return NT_STATUS_ACCESS_DENIED;
-                       }
-                       
-                       dbsync.in.sync_context = dbsync.out.sync_context;
-                       
-                       /* For every single remote 'delta' entry: */
-                       for (d=0; d < dbsync.out.delta_enum_array->num_deltas; d++) {
-                               char *error_string = NULL;
-                               delta_ctx = talloc_named(loop_ctx, 0, "DatabaseSync delta context");
-                               /* 'Fix' elements, by decrypting and
-                                * de-obfuscating the data */
-                               nt_status = fix_delta(delta_ctx, 
-                                                     creds, 
-                                                     r->in.rid_crypt,
-                                                     dbsync.in.database_id,
-                                                     &dbsync.out.delta_enum_array->delta_enum[d], 
-                                                     &error_string);
-                               if (!NT_STATUS_IS_OK(nt_status)) {
-                                       r->out.error_string = talloc_steal(mem_ctx, error_string);
-                                       talloc_free(samsync_ctx);
-                                       return nt_status;
-                               }
+       printf("mark ROOTDSE with isSynchronized=TRUE\n");
+       ldb_ret = ldb_modify(s->ldb, msg);
+       if (ldb_ret != LDB_SUCCESS) {
+               printf("ldb_modify() failed: %d\n", ldb_ret);
+               talloc_free(s);
+               return NT_STATUS_INTERNAL_DB_ERROR;
+       }
 
-                               /* Now call the callback.  This will
-                                * do something like print the data or
-                                * write to an ldb */
-                               nt_status = r->in.delta_fn(delta_ctx, 
-                                                          r->in.fn_ctx,
-                                                          dbsync.in.database_id,
-                                                          &dbsync.out.delta_enum_array->delta_enum[d], 
-                                                          &error_string);
-                               if (!NT_STATUS_IS_OK(nt_status)) {
-                                       r->out.error_string = talloc_steal(mem_ctx, error_string);
-                                       talloc_free(samsync_ctx);
-                                       return nt_status;
-                               }
-                               talloc_free(delta_ctx);
-                       }
-                       talloc_free(loop_ctx);
-               } while (NT_STATUS_EQUAL(dbsync_nt_status, STATUS_MORE_ENTRIES));
+       set_secrets = talloc_zero(s, struct libnet_set_join_secrets);
+       if (!set_secrets) {
+               return NT_STATUS_NO_MEMORY;
+       }
                
-               if (!NT_STATUS_IS_OK(dbsync_nt_status)) {
-                       r->out.error_string = talloc_asprintf(mem_ctx, "libnet_SamSync_netlogon failed: unexpected inconsistancy. Should not get error %s here", nt_errstr(nt_status));
-                       talloc_free(samsync_ctx);
-                       return dbsync_nt_status;
-               }
-               nt_status = NT_STATUS_OK;
+       set_secrets->in.domain_name = join->out.domain_name;
+       set_secrets->in.realm = join->out.realm;
+       set_secrets->in.account_name = account_name;
+       set_secrets->in.netbios_name = netbios_name;
+       set_secrets->in.join_type = SEC_CHAN_BDC;
+       set_secrets->in.join_password = join->out.join_password;
+       set_secrets->in.kvno = join->out.kvno;
+       set_secrets->in.domain_sid = join->out.domain_sid;
+       
+       status = libnet_set_join_secrets(ctx, set_secrets, set_secrets);
+       if (!NT_STATUS_IS_OK(status)) {
+               r->out.error_string = talloc_steal(mem_ctx, set_secrets->out.error_string);
+               talloc_free(s);
+               return status;
        }
-       talloc_free(samsync_ctx);
-       return nt_status;
-}
 
+       r->out.domain_name = talloc_steal(r, join->out.domain_name);
+       r->out.domain_sid = talloc_steal(r, join->out.domain_sid);
+       talloc_free(s);
+       
+       return NT_STATUS_OK;
+
+}
index d2ac30fe1499a45a2d0dda1eb730433fe27f40b9..5e0c7594b20f8aff5597e33df380d0c4b8841b65 100644 (file)
@@ -1,7 +1,9 @@
 /* 
    Unix SMB/CIFS implementation.
-
+   
+   Copyright (C) Stefan Metzmacher     2004
    Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
+   Copyright (C) Brad Henry 2005
    
    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
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
-#include "librpc/gen_ndr/netlogon.h"
-
-struct libnet_SamSync_state {
-       struct libnet_context *machine_net_ctx;
-       struct dcerpc_pipe *netlogon_pipe;
-       const char *domain_name;
-       const struct dom_sid *domain_sid;
-       const char *realm;
-       struct GUID *domain_guid;
-};
-
-/* struct and enum for doing a remote domain vampire dump */
-struct libnet_SamSync {
-       struct {
-               const char *binding_string;
-               bool rid_crypt;
-               NTSTATUS (*init_fn)(TALLOC_CTX *mem_ctx,                
-                                   void *private,
-                                   struct libnet_SamSync_state *samsync_state,
-                                   char **error_string);
-               NTSTATUS (*delta_fn)(TALLOC_CTX *mem_ctx,               
-                                    void *private,                     
-                                    enum netr_SamDatabaseID database,
-                                    struct netr_DELTA_ENUM *delta,
-                                    char **error_string);
-               void *fn_ctx;
-               struct cli_credentials *machine_account;
-       } in;
-       struct {
-               const char *error_string;
-       } out;
-};
-
-struct libnet_SamDump {
-       struct {
-               const char *binding_string;
-               struct cli_credentials *machine_account;
-       } in;
-       struct {
-               const char *error_string;
-       } out;
-};
+#ifndef __LIBNET_VAMPIRE_H__
+#define __LIBNET_VAMPIRE_H__
 
-struct libnet_SamDump_keytab {
+struct libnet_Vampire {
        struct {
-               const char *binding_string;
-               const char *keytab_name;
-               struct cli_credentials *machine_account;
+               const char *domain_name;
+               const char *netbios_name;
+               const char *targetdir;
        } in;
+       
        struct {
+               struct dom_sid *domain_sid;
+               const char *domain_name;
                const char *error_string;
        } out;
 };
 
-struct libnet_samsync_ldb {
-       struct {
-               const char *binding_string;
-               struct cli_credentials *machine_account;
-               struct auth_session_info *session_info;
-       } in;
-       struct {
-               const char *error_string;
-       } out;
-};
 
+#endif /* __LIBNET_VAMPIRE_H__ */
diff --git a/source4/libnet/net.i b/source4/libnet/net.i
deleted file mode 100644 (file)
index aad0089..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/* 
-   Unix SMB/CIFS implementation.
-   Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2007
-   
-   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/>.
-*/
-
-%module(package="samba.net") net
-
-%{
-#include "includes.h"
-#include "libnet/libnet.h"
-#include "lib/events/events.h"
-#include "param/param.h"
-typedef struct libnet_context libnet;
-%}
-
-%import "../libcli/util/errors.i"
-%import "../lib/events/events.i"
-%import "../lib/talloc/talloc.i"
-%import "../param/param.i"
-
-%talloctype(libnet_context);
-
-typedef struct libnet_context {
-    struct cli_credentials *cred;
-    %extend { 
-        libnet(struct event_context *ev, struct loadparm_context *lp_ctx) {
-            return libnet_context_init(ev, lp_ctx);
-        }
-        NTSTATUS samsync_ldb(TALLOC_CTX *mem_ctx, struct libnet_samsync_ldb *r);
-        NTSTATUS DomainList(TALLOC_CTX *mem_ctx, struct libnet_DomainList *io);
-        NTSTATUS DomainClose(TALLOC_CTX *mem_ctx, struct libnet_DomainClose *io);
-        NTSTATUS DomainOpen(TALLOC_CTX *mem_ctx, struct libnet_DomainOpen *io);
-        NTSTATUS LookupName(TALLOC_CTX *mem_ctx, struct libnet_LookupName *io);
-        NTSTATUS LookupDCs(TALLOC_CTX *mem_ctx, struct libnet_LookupDCs *io);
-        NTSTATUS LookupHost(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io);
-        NTSTATUS Lookup(TALLOC_CTX *mem_ctx, struct libnet_Lookup *io);
-        NTSTATUS ListShares(TALLOC_CTX *mem_ctx, struct libnet_ListShares *r);
-        NTSTATUS AddShare(TALLOC_CTX *mem_ctx, struct libnet_AddShare *r);
-        NTSTATUS DelShare(TALLOC_CTX *mem_ctx, struct libnet_DelShare *r);
-        NTSTATUS GroupList(TALLOC_CTX *mem_ctx, struct libnet_GroupList *io);
-        NTSTATUS GroupInfo(TALLOC_CTX *mem_ctx, struct libnet_GroupInfo *io);
-        NTSTATUS UserList(TALLOC_CTX *mem_ctx, struct libnet_UserList *r);
-        NTSTATUS UserInfo(TALLOC_CTX *mem_ctx, struct libnet_UserInfo *r);
-        NTSTATUS ModifyUser(TALLOC_CTX *mem_ctx, struct libnet_ModifyUser *r);
-        NTSTATUS DeleteUser(TALLOC_CTX *mem_ctx, struct libnet_DeleteUser *r);
-        NTSTATUS CreateUser(TALLOC_CTX *mem_ctx, struct libnet_CreateUser *r);
-        NTSTATUS SamDump_keytab(TALLOC_CTX *mem_ctx, struct libnet_SamDump_keytab *r);
-        NTSTATUS SamDump(TALLOC_CTX *mem_ctx, struct libnet_SamDump *r);
-        NTSTATUS SamSync_netlogon(TALLOC_CTX *mem_ctx, struct libnet_SamSync *r);
-        NTSTATUS UnbecomeDC(TALLOC_CTX *mem_ctx, struct libnet_UnbecomeDC *r);
-        NTSTATUS BecomeDC(TALLOC_CTX *mem_ctx, struct libnet_BecomeDC *r);
-        NTSTATUS JoinSite(struct ldb_context *remote_ldb, struct libnet_JoinDomain *libnet_r);
-        NTSTATUS JoinDomain(TALLOC_CTX *mem_ctx, struct libnet_JoinDomain *r);
-        NTSTATUS Join(TALLOC_CTX *mem_ctx, struct libnet_Join *r);
-        NTSTATUS RpcConnect(TALLOC_CTX *mem_ctx, struct libnet_RpcConnect *r);
-        NTSTATUS RemoteTOD(TALLOC_CTX *mem_ctx, union libnet_RemoteTOD *r);
-        NTSTATUS ChangePassword(TALLOC_CTX *mem_ctx, union libnet_ChangePassword *r);
-        NTSTATUS SetPassword(TALLOC_CTX *mem_ctx, union libnet_SetPassword *r);
-    }
-} libnet;
diff --git a/source4/libnet/net.py b/source4/libnet/net.py
deleted file mode 100644 (file)
index ae659b8..0000000
+++ /dev/null
@@ -1,103 +0,0 @@
-# This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
-#
-# Don't modify this file, modify the SWIG interface instead.
-
-import _net
-import new
-new_instancemethod = new.instancemethod
-try:
-    _swig_property = property
-except NameError:
-    pass # Python < 2.2 doesn't have 'property'.
-def _swig_setattr_nondynamic(self,class_type,name,value,static=1):
-    if (name == "thisown"): return self.this.own(value)
-    if (name == "this"):
-        if type(value).__name__ == 'PySwigObject':
-            self.__dict__[name] = value
-            return
-    method = class_type.__swig_setmethods__.get(name,None)
-    if method: return method(self,value)
-    if (not static) or hasattr(self,name):
-        self.__dict__[name] = value
-    else:
-        raise AttributeError("You cannot add attributes to %s" % self)
-
-def _swig_setattr(self,class_type,name,value):
-    return _swig_setattr_nondynamic(self,class_type,name,value,0)
-
-def _swig_getattr(self,class_type,name):
-    if (name == "thisown"): return self.this.own()
-    method = class_type.__swig_getmethods__.get(name,None)
-    if method: return method(self)
-    raise AttributeError,name
-
-def _swig_repr(self):
-    try: strthis = "proxy of " + self.this.__repr__()
-    except: strthis = ""
-    return "<%s.%s; %s >" % (self.__class__.__module__, self.__class__.__name__, strthis,)
-
-import types
-try:
-    _object = types.ObjectType
-    _newclass = 1
-except AttributeError:
-    class _object : pass
-    _newclass = 0
-del types
-
-
-def _swig_setattr_nondynamic_method(set):
-    def set_attr(self,name,value):
-        if (name == "thisown"): return self.this.own(value)
-        if hasattr(self,name) or (name == "this"):
-            set(self,name,value)
-        else:
-            raise AttributeError("You cannot add attributes to %s" % self)
-    return set_attr
-
-
-import events
-import param
-class libnet(object):
-    thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    __repr__ = _swig_repr
-    cred = _swig_property(_net.libnet_cred_get, _net.libnet_cred_set)
-    def __init__(self, *args, **kwargs): 
-        _net.libnet_swiginit(self,_net.new_libnet(*args, **kwargs))
-    __swig_destroy__ = _net.delete_libnet
-libnet.samsync_ldb = new_instancemethod(_net.libnet_samsync_ldb,None,libnet)
-libnet.DomainList = new_instancemethod(_net.libnet_DomainList,None,libnet)
-libnet.DomainClose = new_instancemethod(_net.libnet_DomainClose,None,libnet)
-libnet.DomainOpen = new_instancemethod(_net.libnet_DomainOpen,None,libnet)
-libnet.LookupName = new_instancemethod(_net.libnet_LookupName,None,libnet)
-libnet.LookupDCs = new_instancemethod(_net.libnet_LookupDCs,None,libnet)
-libnet.LookupHost = new_instancemethod(_net.libnet_LookupHost,None,libnet)
-libnet.Lookup = new_instancemethod(_net.libnet_Lookup,None,libnet)
-libnet.ListShares = new_instancemethod(_net.libnet_ListShares,None,libnet)
-libnet.AddShare = new_instancemethod(_net.libnet_AddShare,None,libnet)
-libnet.DelShare = new_instancemethod(_net.libnet_DelShare,None,libnet)
-libnet.GroupList = new_instancemethod(_net.libnet_GroupList,None,libnet)
-libnet.GroupInfo = new_instancemethod(_net.libnet_GroupInfo,None,libnet)
-libnet.UserList = new_instancemethod(_net.libnet_UserList,None,libnet)
-libnet.UserInfo = new_instancemethod(_net.libnet_UserInfo,None,libnet)
-libnet.ModifyUser = new_instancemethod(_net.libnet_ModifyUser,None,libnet)
-libnet.DeleteUser = new_instancemethod(_net.libnet_DeleteUser,None,libnet)
-libnet.CreateUser = new_instancemethod(_net.libnet_CreateUser,None,libnet)
-libnet.SamDump_keytab = new_instancemethod(_net.libnet_SamDump_keytab,None,libnet)
-libnet.SamDump = new_instancemethod(_net.libnet_SamDump,None,libnet)
-libnet.SamSync_netlogon = new_instancemethod(_net.libnet_SamSync_netlogon,None,libnet)
-libnet.UnbecomeDC = new_instancemethod(_net.libnet_UnbecomeDC,None,libnet)
-libnet.BecomeDC = new_instancemethod(_net.libnet_BecomeDC,None,libnet)
-libnet.JoinSite = new_instancemethod(_net.libnet_JoinSite,None,libnet)
-libnet.JoinDomain = new_instancemethod(_net.libnet_JoinDomain,None,libnet)
-libnet.Join = new_instancemethod(_net.libnet_Join,None,libnet)
-libnet.RpcConnect = new_instancemethod(_net.libnet_RpcConnect,None,libnet)
-libnet.RemoteTOD = new_instancemethod(_net.libnet_RemoteTOD,None,libnet)
-libnet.ChangePassword = new_instancemethod(_net.libnet_ChangePassword,None,libnet)
-libnet.SetPassword = new_instancemethod(_net.libnet_SetPassword,None,libnet)
-libnet_swigregister = _net.libnet_swigregister
-libnet_swigregister(libnet)
-
-
-
diff --git a/source4/libnet/net_wrap.c b/source4/libnet/net_wrap.c
deleted file mode 100644 (file)
index 29b30a8..0000000
+++ /dev/null
@@ -1,4711 +0,0 @@
-/* ----------------------------------------------------------------------------
- * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
- * 
- * This file is not intended to be easily readable and contains a number of 
- * coding conventions designed to improve portability and efficiency. Do not make
- * changes to this file unless you know what you are doing--modify the SWIG 
- * interface file instead. 
- * ----------------------------------------------------------------------------- */
-
-#define SWIGPYTHON
-#define SWIG_PYTHON_NO_BUILD_NONE
-/* -----------------------------------------------------------------------------
- *  This section contains generic SWIG labels for method/variable
- *  declarations/attributes, and other compiler dependent labels.
- * ----------------------------------------------------------------------------- */
-
-/* template workaround for compilers that cannot correctly implement the C++ standard */
-#ifndef SWIGTEMPLATEDISAMBIGUATOR
-# if defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x560)
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# elif defined(__HP_aCC)
-/* Needed even with `aCC -AA' when `aCC -V' reports HP ANSI C++ B3910B A.03.55 */
-/* If we find a maximum version that requires this, the test would be __HP_aCC <= 35500 for A.03.55 */
-#  define SWIGTEMPLATEDISAMBIGUATOR template
-# else
-#  define SWIGTEMPLATEDISAMBIGUATOR
-# endif
-#endif
-
-/* inline attribute */
-#ifndef SWIGINLINE
-# if defined(__cplusplus) || (defined(__GNUC__) && !defined(__STRICT_ANSI__))
-#   define SWIGINLINE inline
-# else
-#   define SWIGINLINE
-# endif
-#endif
-
-/* attribute recognised by some compilers to avoid 'unused' warnings */
-#ifndef SWIGUNUSED
-# if defined(__GNUC__)
-#   if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4))
-#     define SWIGUNUSED __attribute__ ((__unused__)) 
-#   else
-#     define SWIGUNUSED
-#   endif
-# elif defined(__ICC)
-#   define SWIGUNUSED __attribute__ ((__unused__)) 
-# else
-#   define SWIGUNUSED 
-# endif
-#endif
-
-#ifndef SWIGUNUSEDPARM
-# ifdef __cplusplus
-#   define SWIGUNUSEDPARM(p)
-# else
-#   define SWIGUNUSEDPARM(p) p SWIGUNUSED 
-# endif
-#endif
-
-/* internal SWIG method */
-#ifndef SWIGINTERN
-# define SWIGINTERN static SWIGUNUSED
-#endif
-
-/* internal inline SWIG method */
-#ifndef SWIGINTERNINLINE
-# define SWIGINTERNINLINE SWIGINTERN SWIGINLINE
-#endif
-
-/* exporting methods */
-#if (__GNUC__ >= 4) || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)
-#  ifndef GCC_HASCLASSVISIBILITY
-#    define GCC_HASCLASSVISIBILITY
-#  endif
-#endif
-
-#ifndef SWIGEXPORT
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   if defined(STATIC_LINKED)
-#     define SWIGEXPORT
-#   else
-#     define SWIGEXPORT __declspec(dllexport)
-#   endif
-# else
-#   if defined(__GNUC__) && defined(GCC_HASCLASSVISIBILITY)
-#     define SWIGEXPORT __attribute__ ((visibility("default")))
-#   else
-#     define SWIGEXPORT
-#   endif
-# endif
-#endif
-
-/* calling conventions for Windows */
-#ifndef SWIGSTDCALL
-# if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#   define SWIGSTDCALL __stdcall
-# else
-#   define SWIGSTDCALL
-# endif 
-#endif
-
-/* Deal with Microsoft's attempt at deprecating C standard runtime functions */
-#if !defined(SWIG_NO_CRT_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_CRT_SECURE_NO_DEPRECATE)
-# define _CRT_SECURE_NO_DEPRECATE
-#endif
-
-/* Deal with Microsoft's attempt at deprecating methods in the standard C++ library */
-#if !defined(SWIG_NO_SCL_SECURE_NO_DEPRECATE) && defined(_MSC_VER) && !defined(_SCL_SECURE_NO_DEPRECATE)
-# define _SCL_SECURE_NO_DEPRECATE
-#endif
-
-
-
-/* Python.h has to appear first */
-#include <Python.h>
-
-/* -----------------------------------------------------------------------------
- * swigrun.swg
- *
- * This file contains generic CAPI SWIG runtime support for pointer
- * type checking.
- * ----------------------------------------------------------------------------- */
-
-/* This should only be incremented when either the layout of swig_type_info changes,
-   or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
-
-/* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
-#ifdef SWIG_TYPE_TABLE
-# define SWIG_QUOTE_STRING(x) #x
-# define SWIG_EXPAND_AND_QUOTE_STRING(x) SWIG_QUOTE_STRING(x)
-# define SWIG_TYPE_TABLE_NAME SWIG_EXPAND_AND_QUOTE_STRING(SWIG_TYPE_TABLE)
-#else
-# define SWIG_TYPE_TABLE_NAME
-#endif
-
-/*
-  You can use the SWIGRUNTIME and SWIGRUNTIMEINLINE macros for
-  creating a static or dynamic library from the swig runtime code.
-  In 99.9% of the cases, swig just needs to declare them as 'static'.
-  
-  But only do this if is strictly necessary, ie, if you have problems
-  with your compiler or so.
-*/
-
-#ifndef SWIGRUNTIME
-# define SWIGRUNTIME SWIGINTERN
-#endif
-
-#ifndef SWIGRUNTIMEINLINE
-# define SWIGRUNTIMEINLINE SWIGRUNTIME SWIGINLINE
-#endif
-
-/*  Generic buffer size */
-#ifndef SWIG_BUFFER_SIZE
-# define SWIG_BUFFER_SIZE 1024
-#endif
-
-/* Flags for pointer conversions */
-#define SWIG_POINTER_DISOWN        0x1
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_OWN           0x1
-
-
-/* 
-   Flags/methods for returning states.
-   
-   The swig conversion methods, as ConvertPtr, return and integer 
-   that tells if the conversion was successful or not. And if not,
-   an error code can be returned (see swigerrors.swg for the codes).
-   
-   Use the following macros/flags to set or process the returning
-   states.
-   
-   In old swig versions, you usually write code as:
-
-     if (SWIG_ConvertPtr(obj,vptr,ty.flags) != -1) {
-       // success code
-     } else {
-       //fail code
-     }
-
-   Now you can be more explicit as:
-
-    int res = SWIG_ConvertPtr(obj,vptr,ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-    } else {
-      // fail code
-    }
-
-   that seems to be the same, but now you can also do
-
-    Type *ptr;
-    int res = SWIG_ConvertPtr(obj,(void **)(&ptr),ty.flags);
-    if (SWIG_IsOK(res)) {
-      // success code
-      if (SWIG_IsNewObj(res) {
-        ...
-       delete *ptr;
-      } else {
-        ...
-      }
-    } else {
-      // fail code
-    }
-    
-   I.e., now SWIG_ConvertPtr can return new objects and you can
-   identify the case and take care of the deallocation. Of course that
-   requires also to SWIG_ConvertPtr to return new result values, as
-
-      int SWIG_ConvertPtr(obj, ptr,...) {         
-        if (<obj is ok>) {                            
-          if (<need new object>) {                    
-            *ptr = <ptr to new allocated object>; 
-            return SWIG_NEWOBJ;                       
-          } else {                                    
-            *ptr = <ptr to old object>;               
-            return SWIG_OLDOBJ;                       
-          }                                   
-        } else {                                      
-          return SWIG_BADOBJ;                 
-        }                                             
-      }
-
-   Of course, returning the plain '0(success)/-1(fail)' still works, but you can be
-   more explicit by returning SWIG_BADOBJ, SWIG_ERROR or any of the
-   swig errors code.
-
-   Finally, if the SWIG_CASTRANK_MODE is enabled, the result code
-   allows to return the 'cast rank', for example, if you have this
-
-       int food(double)
-       int fooi(int);
-
-   and you call
-      food(1)   // cast rank '1'  (1 -> 1.0)
-      fooi(1)   // cast rank '0'
-
-   just use the SWIG_AddCast()/SWIG_CheckState()
-
-
- */
-#define SWIG_OK                    (0) 
-#define SWIG_ERROR                 (-1)
-#define SWIG_IsOK(r)               (r >= 0)
-#define SWIG_ArgError(r)           ((r != SWIG_ERROR) ? r : SWIG_TypeError)  
-
-/* The CastRankLimit says how many bits are used for the cast rank */
-#define SWIG_CASTRANKLIMIT         (1 << 8)
-/* The NewMask denotes the object was created (using new/malloc) */
-#define SWIG_NEWOBJMASK            (SWIG_CASTRANKLIMIT  << 1)
-/* The TmpMask is for in/out typemaps that use temporal objects */
-#define SWIG_TMPOBJMASK            (SWIG_NEWOBJMASK << 1)
-/* Simple returning values */
-#define SWIG_BADOBJ                (SWIG_ERROR)
-#define SWIG_OLDOBJ                (SWIG_OK)
-#define SWIG_NEWOBJ                (SWIG_OK | SWIG_NEWOBJMASK)
-#define SWIG_TMPOBJ                (SWIG_OK | SWIG_TMPOBJMASK)
-/* Check, add and del mask methods */
-#define SWIG_AddNewMask(r)         (SWIG_IsOK(r) ? (r | SWIG_NEWOBJMASK) : r)
-#define SWIG_DelNewMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_NEWOBJMASK) : r)
-#define SWIG_IsNewObj(r)           (SWIG_IsOK(r) && (r & SWIG_NEWOBJMASK))
-#define SWIG_AddTmpMask(r)         (SWIG_IsOK(r) ? (r | SWIG_TMPOBJMASK) : r)
-#define SWIG_DelTmpMask(r)         (SWIG_IsOK(r) ? (r & ~SWIG_TMPOBJMASK) : r)
-#define SWIG_IsTmpObj(r)           (SWIG_IsOK(r) && (r & SWIG_TMPOBJMASK))
-
-
-/* Cast-Rank Mode */
-#if defined(SWIG_CASTRANK_MODE)
-#  ifndef SWIG_TypeRank
-#    define SWIG_TypeRank             unsigned long
-#  endif
-#  ifndef SWIG_MAXCASTRANK            /* Default cast allowed */
-#    define SWIG_MAXCASTRANK          (2)
-#  endif
-#  define SWIG_CASTRANKMASK          ((SWIG_CASTRANKLIMIT) -1)
-#  define SWIG_CastRank(r)           (r & SWIG_CASTRANKMASK)
-SWIGINTERNINLINE int SWIG_AddCast(int r) { 
-  return SWIG_IsOK(r) ? ((SWIG_CastRank(r) < SWIG_MAXCASTRANK) ? (r + 1) : SWIG_ERROR) : r;
-}
-SWIGINTERNINLINE int SWIG_CheckState(int r) { 
-  return SWIG_IsOK(r) ? SWIG_CastRank(r) + 1 : 0; 
-}
-#else /* no cast-rank mode */
-#  define SWIG_AddCast
-#  define SWIG_CheckState(r) (SWIG_IsOK(r) ? 1 : 0)
-#endif
-
-
-
-
-#include <string.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void *(*swig_converter_func)(void *);
-typedef struct swig_type_info *(*swig_dycast_func)(void **);
-
-/* Structure to store inforomation on one type */
-typedef struct swig_type_info {
-  const char             *name;                        /* mangled name of this type */
-  const char             *str;                 /* human readable name of this type */
-  swig_dycast_func        dcast;               /* dynamic cast function down a hierarchy */
-  struct swig_cast_info  *cast;                        /* linked list of types that can cast into this type */
-  void                   *clientdata;          /* language specific type data */
-  int                    owndata;              /* flag if the structure owns the clientdata */
-} swig_type_info;
-
-/* Structure to store a type and conversion function used for casting */
-typedef struct swig_cast_info {
-  swig_type_info         *type;                        /* pointer to type that is equivalent to this type */
-  swig_converter_func     converter;           /* function to cast the void pointers */
-  struct swig_cast_info  *next;                        /* pointer to next cast in linked list */
-  struct swig_cast_info  *prev;                        /* pointer to the previous cast */
-} swig_cast_info;
-
-/* Structure used to store module information
- * Each module generates one structure like this, and the runtime collects
- * all of these structures and stores them in a circularly linked list.*/
-typedef struct swig_module_info {
-  swig_type_info         **types;              /* Array of pointers to swig_type_info structures that are in this module */
-  size_t                 size;                 /* Number of types in this module */
-  struct swig_module_info *next;               /* Pointer to next element in circularly linked list */
-  swig_type_info         **type_initial;       /* Array of initially generated type structures */
-  swig_cast_info         **cast_initial;       /* Array of initially generated casting structures */
-  void                    *clientdata;         /* Language specific module data */
-} swig_module_info;
-
-/* 
-  Compare two type names skipping the space characters, therefore
-  "char*" == "char *" and "Class<int>" == "Class<int >", etc.
-
-  Return 0 when the two name types are equivalent, as in
-  strncmp, but skipping ' '.
-*/
-SWIGRUNTIME int
-SWIG_TypeNameComp(const char *f1, const char *l1,
-                 const char *f2, const char *l2) {
-  for (;(f1 != l1) && (f2 != l2); ++f1, ++f2) {
-    while ((*f1 == ' ') && (f1 != l1)) ++f1;
-    while ((*f2 == ' ') && (f2 != l2)) ++f2;
-    if (*f1 != *f2) return (*f1 > *f2) ? 1 : -1;
-  }
-  return (int)((l1 - f1) - (l2 - f2));
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if not equal, 1 if equal
-*/
-SWIGRUNTIME int
-SWIG_TypeEquiv(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-/*
-  Check type equivalence in a name list like <name1>|<name2>|...
-  Return 0 if equal, -1 if nb < tb, 1 if nb > tb
-*/
-SWIGRUNTIME int
-SWIG_TypeCompare(const char *nb, const char *tb) {
-  int equiv = 0;
-  const char* te = tb + strlen(tb);
-  const char* ne = nb;
-  while (!equiv && *ne) {
-    for (nb = ne; *ne; ++ne) {
-      if (*ne == '|') break;
-    }
-    equiv = (SWIG_TypeNameComp(nb, ne, tb, te) == 0) ? 1 : 0;
-    if (*ne) ++ne;
-  }
-  return equiv;
-}
-
-
-/* think of this as a c++ template<> or a scheme macro */
-#define SWIG_TypeCheck_Template(comparison, ty)         \
-  if (ty) {                                             \
-    swig_cast_info *iter = ty->cast;                    \
-    while (iter) {                                      \
-      if (comparison) {                                 \
-        if (iter == ty->cast) return iter;              \
-        /* Move iter to the top of the linked list */   \
-        iter->prev->next = iter->next;                  \
-        if (iter->next)                                 \
-          iter->next->prev = iter->prev;                \
-        iter->next = ty->cast;                          \
-        iter->prev = 0;                                 \
-        if (ty->cast) ty->cast->prev = iter;            \
-        ty->cast = iter;                                \
-        return iter;                                    \
-      }                                                 \
-      iter = iter->next;                                \
-    }                                                   \
-  }                                                     \
-  return 0
-
-/*
-  Check the typename
-*/
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheck(const char *c, swig_type_info *ty) {
-  SWIG_TypeCheck_Template(strcmp(iter->type->name, c) == 0, ty);
-}
-
-/* Same as previous function, except strcmp is replaced with a pointer comparison */
-SWIGRUNTIME swig_cast_info *
-SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
-  SWIG_TypeCheck_Template(iter->type == from, into);
-}
-
-/*
-  Cast a pointer up an inheritance hierarchy
-*/
-SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
-}
-
-/* 
-   Dynamic pointer casting. Down an inheritance hierarchy
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeDynamicCast(swig_type_info *ty, void **ptr) {
-  swig_type_info *lastty = ty;
-  if (!ty || !ty->dcast) return ty;
-  while (ty && (ty->dcast)) {
-    ty = (*ty->dcast)(ptr);
-    if (ty) lastty = ty;
-  }
-  return lastty;
-}
-
-/*
-  Return the name associated with this type
-*/
-SWIGRUNTIMEINLINE const char *
-SWIG_TypeName(const swig_type_info *ty) {
-  return ty->name;
-}
-
-/*
-  Return the pretty name associated with this type,
-  that is an unmangled type name in a form presentable to the user.
-*/
-SWIGRUNTIME const char *
-SWIG_TypePrettyName(const swig_type_info *type) {
-  /* The "str" field contains the equivalent pretty names of the
-     type, separated by vertical-bar characters.  We choose
-     to print the last name, as it is often (?) the most
-     specific. */
-  if (!type) return NULL;
-  if (type->str != NULL) {
-    const char *last_name = type->str;
-    const char *s;
-    for (s = type->str; *s; s++)
-      if (*s == '|') last_name = s+1;
-    return last_name;
-  }
-  else
-    return type->name;
-}
-
-/* 
-   Set the clientdata field for a type
-*/
-SWIGRUNTIME void
-SWIG_TypeClientData(swig_type_info *ti, void *clientdata) {
-  swig_cast_info *cast = ti->cast;
-  /* if (ti->clientdata == clientdata) return; */
-  ti->clientdata = clientdata;
-  
-  while (cast) {
-    if (!cast->converter) {
-      swig_type_info *tc = cast->type;
-      if (!tc->clientdata) {
-       SWIG_TypeClientData(tc, clientdata);
-      }
-    }    
-    cast = cast->next;
-  }
-}
-SWIGRUNTIME void
-SWIG_TypeNewClientData(swig_type_info *ti, void *clientdata) {
-  SWIG_TypeClientData(ti, clientdata);
-  ti->owndata = 1;
-}
-  
-/*
-  Search for a swig_type_info structure only by mangled name
-  Search is a O(log #types)
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_MangledTypeQueryModule(swig_module_info *start, 
-                            swig_module_info *end, 
-                           const char *name) {
-  swig_module_info *iter = start;
-  do {
-    if (iter->size) {
-      register size_t l = 0;
-      register size_t r = iter->size - 1;
-      do {
-       /* since l+r >= 0, we can (>> 1) instead (/ 2) */
-       register size_t i = (l + r) >> 1; 
-       const char *iname = iter->types[i]->name;
-       if (iname) {
-         register int compare = strcmp(name, iname);
-         if (compare == 0) {       
-           return iter->types[i];
-         } else if (compare < 0) {
-           if (i) {
-             r = i - 1;
-           } else {
-             break;
-           }
-         } else if (compare > 0) {
-           l = i + 1;
-         }
-       } else {
-         break; /* should never happen */
-       }
-      } while (l <= r);
-    }
-    iter = iter->next;
-  } while (iter != end);
-  return 0;
-}
-
-/*
-  Search for a swig_type_info structure for either a mangled name or a human readable name.
-  It first searches the mangled names of the types, which is a O(log #types)
-  If a type is not found it then searches the human readable names, which is O(#types).
-  
-  We start searching at module start, and finish searching when start == end.  
-  Note: if start == end at the beginning of the function, we go all the way around
-  the circular list.
-*/
-SWIGRUNTIME swig_type_info *
-SWIG_TypeQueryModule(swig_module_info *start, 
-                     swig_module_info *end, 
-                    const char *name) {
-  /* STEP 1: Search the name field using binary search */
-  swig_type_info *ret = SWIG_MangledTypeQueryModule(start, end, name);
-  if (ret) {
-    return ret;
-  } else {
-    /* STEP 2: If the type hasn't been found, do a complete search
-       of the str field (the human readable name) */
-    swig_module_info *iter = start;
-    do {
-      register size_t i = 0;
-      for (; i < iter->size; ++i) {
-       if (iter->types[i]->str && (SWIG_TypeEquiv(iter->types[i]->str, name)))
-         return iter->types[i];
-      }
-      iter = iter->next;
-    } while (iter != end);
-  }
-  
-  /* neither found a match */
-  return 0;
-}
-
-/* 
-   Pack binary data into a string
-*/
-SWIGRUNTIME char *
-SWIG_PackData(char *c, void *ptr, size_t sz) {
-  static const char hex[17] = "0123456789abcdef";
-  register const unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu =  u + sz;
-  for (; u != eu; ++u) {
-    register unsigned char uu = *u;
-    *(c++) = hex[(uu & 0xf0) >> 4];
-    *(c++) = hex[uu & 0xf];
-  }
-  return c;
-}
-
-/* 
-   Unpack binary data from a string
-*/
-SWIGRUNTIME const char *
-SWIG_UnpackData(const char *c, void *ptr, size_t sz) {
-  register unsigned char *u = (unsigned char *) ptr;
-  register const unsigned char *eu = u + sz;
-  for (; u != eu; ++u) {
-    register char d = *(c++);
-    register unsigned char uu;
-    if ((d >= '0') && (d <= '9'))
-      uu = ((d - '0') << 4);
-    else if ((d >= 'a') && (d <= 'f'))
-      uu = ((d - ('a'-10)) << 4);
-    else 
-      return (char *) 0;
-    d = *(c++);
-    if ((d >= '0') && (d <= '9'))
-      uu |= (d - '0');
-    else if ((d >= 'a') && (d <= 'f'))
-      uu |= (d - ('a'-10));
-    else 
-      return (char *) 0;
-    *u = uu;
-  }
-  return c;
-}
-
-/* 
-   Pack 'void *' into a string buffer.
-*/
-SWIGRUNTIME char *
-SWIG_PackVoidPtr(char *buff, void *ptr, const char *name, size_t bsz) {
-  char *r = buff;
-  if ((2*sizeof(void *) + 2) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,&ptr,sizeof(void *));
-  if (strlen(name) + 1 > (bsz - (r - buff))) return 0;
-  strcpy(r,name);
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackVoidPtr(const char *c, void **ptr, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      *ptr = (void *) 0;
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sizeof(void *));
-}
-
-SWIGRUNTIME char *
-SWIG_PackDataName(char *buff, void *ptr, size_t sz, const char *name, size_t bsz) {
-  char *r = buff;
-  size_t lname = (name ? strlen(name) : 0);
-  if ((2*sz + 2 + lname) > bsz) return 0;
-  *(r++) = '_';
-  r = SWIG_PackData(r,ptr,sz);
-  if (lname) {
-    strncpy(r,name,lname+1);
-  } else {
-    *r = 0;
-  }
-  return buff;
-}
-
-SWIGRUNTIME const char *
-SWIG_UnpackDataName(const char *c, void *ptr, size_t sz, const char *name) {
-  if (*c != '_') {
-    if (strcmp(c,"NULL") == 0) {
-      memset(ptr,0,sz);
-      return name;
-    } else {
-      return 0;
-    }
-  }
-  return SWIG_UnpackData(++c,ptr,sz);
-}
-
-#ifdef __cplusplus
-}
-#endif
-
-/*  Errors in SWIG */
-#define  SWIG_UnknownError        -1 
-#define  SWIG_IOError             -2 
-#define  SWIG_RuntimeError        -3 
-#define  SWIG_IndexError          -4 
-#define  SWIG_TypeError           -5 
-#define  SWIG_DivisionByZero      -6 
-#define  SWIG_OverflowError       -7 
-#define  SWIG_SyntaxError         -8 
-#define  SWIG_ValueError          -9 
-#define  SWIG_SystemError         -10
-#define  SWIG_AttributeError      -11
-#define  SWIG_MemoryError         -12 
-#define  SWIG_NullReferenceError   -13
-
-
-
-
-/* Add PyOS_snprintf for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# if defined(_MSC_VER) || defined(__BORLANDC__) || defined(_WATCOM)
-#  define PyOS_snprintf _snprintf
-# else
-#  define PyOS_snprintf snprintf
-# endif
-#endif
-
-/* A crude PyString_FromFormat implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-
-#ifndef SWIG_PYBUFFER_SIZE
-# define SWIG_PYBUFFER_SIZE 1024
-#endif
-
-static PyObject *
-PyString_FromFormat(const char *fmt, ...) {
-  va_list ap;
-  char buf[SWIG_PYBUFFER_SIZE * 2];
-  int res;
-  va_start(ap, fmt);
-  res = vsnprintf(buf, sizeof(buf), fmt, ap);
-  va_end(ap);
-  return (res < 0 || res >= (int)sizeof(buf)) ? 0 : PyString_FromString(buf);
-}
-#endif
-
-/* Add PyObject_Del for old Pythons */
-#if PY_VERSION_HEX < 0x01060000
-# define PyObject_Del(op) PyMem_DEL((op))
-#endif
-#ifndef PyObject_DEL
-# define PyObject_DEL PyObject_Del
-#endif
-
-/* A crude PyExc_StopIteration exception for old Pythons */
-#if PY_VERSION_HEX < 0x02020000
-# ifndef PyExc_StopIteration
-#  define PyExc_StopIteration PyExc_RuntimeError
-# endif
-# ifndef PyObject_GenericGetAttr
-#  define PyObject_GenericGetAttr 0
-# endif
-#endif
-/* Py_NotImplemented is defined in 2.1 and up. */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef Py_NotImplemented
-#  define Py_NotImplemented PyExc_RuntimeError
-# endif
-#endif
-
-
-/* A crude PyString_AsStringAndSize implementation for old Pythons */
-#if PY_VERSION_HEX < 0x02010000
-# ifndef PyString_AsStringAndSize
-#  define PyString_AsStringAndSize(obj, s, len) {*s = PyString_AsString(obj); *len = *s ? strlen(*s) : 0;}
-# endif
-#endif
-
-/* PySequence_Size for old Pythons */
-#if PY_VERSION_HEX < 0x02000000
-# ifndef PySequence_Size
-#  define PySequence_Size PySequence_Length
-# endif
-#endif
-
-
-/* PyBool_FromLong for old Pythons */
-#if PY_VERSION_HEX < 0x02030000
-static
-PyObject *PyBool_FromLong(long ok)
-{
-  PyObject *result = ok ? Py_True : Py_False;
-  Py_INCREF(result);
-  return result;
-}
-#endif
-
-/* Py_ssize_t for old Pythons */
-/* This code is as recommended by: */
-/* http://www.python.org/dev/peps/pep-0353/#conversion-guidelines */
-#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
-typedef int Py_ssize_t;
-# define PY_SSIZE_T_MAX INT_MAX
-# define PY_SSIZE_T_MIN INT_MIN
-#endif
-
-/* -----------------------------------------------------------------------------
- * error manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGRUNTIME PyObject*
-SWIG_Python_ErrorType(int code) {
-  PyObject* type = 0;
-  switch(code) {
-  case SWIG_MemoryError:
-    type = PyExc_MemoryError;
-    break;
-  case SWIG_IOError:
-    type = PyExc_IOError;
-    break;
-  case SWIG_RuntimeError:
-    type = PyExc_RuntimeError;
-    break;
-  case SWIG_IndexError:
-    type = PyExc_IndexError;
-    break;
-  case SWIG_TypeError:
-    type = PyExc_TypeError;
-    break;
-  case SWIG_DivisionByZero:
-    type = PyExc_ZeroDivisionError;
-    break;
-  case SWIG_OverflowError:
-    type = PyExc_OverflowError;
-    break;
-  case SWIG_SyntaxError:
-    type = PyExc_SyntaxError;
-    break;
-  case SWIG_ValueError:
-    type = PyExc_ValueError;
-    break;
-  case SWIG_SystemError:
-    type = PyExc_SystemError;
-    break;
-  case SWIG_AttributeError:
-    type = PyExc_AttributeError;
-    break;
-  default:
-    type = PyExc_RuntimeError;
-  }
-  return type;
-}
-
-
-SWIGRUNTIME void
-SWIG_Python_AddErrorMsg(const char* mesg)
-{
-  PyObject *type = 0;
-  PyObject *value = 0;
-  PyObject *traceback = 0;
-
-  if (PyErr_Occurred()) PyErr_Fetch(&type, &value, &traceback);
-  if (value) {
-    PyObject *old_str = PyObject_Str(value);
-    PyErr_Clear();
-    Py_XINCREF(type);
-    PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-    Py_DECREF(old_str);
-    Py_DECREF(value);
-  } else {
-    PyErr_Format(PyExc_RuntimeError, mesg);
-  }
-}
-
-
-
-#if defined(SWIG_PYTHON_NO_THREADS)
-#  if defined(SWIG_PYTHON_THREADS)
-#    undef SWIG_PYTHON_THREADS
-#  endif
-#endif
-#if defined(SWIG_PYTHON_THREADS) /* Threading support is enabled */
-#  if !defined(SWIG_PYTHON_USE_GIL) && !defined(SWIG_PYTHON_NO_USE_GIL)
-#    if (PY_VERSION_HEX >= 0x02030000) /* For 2.3 or later, use the PyGILState calls */
-#      define SWIG_PYTHON_USE_GIL
-#    endif
-#  endif
-#  if defined(SWIG_PYTHON_USE_GIL) /* Use PyGILState threads calls */
-#    ifndef SWIG_PYTHON_INITIALIZE_THREADS
-#     define SWIG_PYTHON_INITIALIZE_THREADS  PyEval_InitThreads() 
-#    endif
-#    ifdef __cplusplus /* C++ code */
-       class SWIG_Python_Thread_Block {
-         bool status;
-         PyGILState_STATE state;
-       public:
-         void end() { if (status) { PyGILState_Release(state); status = false;} }
-         SWIG_Python_Thread_Block() : status(true), state(PyGILState_Ensure()) {}
-         ~SWIG_Python_Thread_Block() { end(); }
-       };
-       class SWIG_Python_Thread_Allow {
-         bool status;
-         PyThreadState *save;
-       public:
-         void end() { if (status) { PyEval_RestoreThread(save); status = false; }}
-         SWIG_Python_Thread_Allow() : status(true), save(PyEval_SaveThread()) {}
-         ~SWIG_Python_Thread_Allow() { end(); }
-       };
-#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   SWIG_Python_Thread_Block _swig_thread_block
-#      define SWIG_PYTHON_THREAD_END_BLOCK     _swig_thread_block.end()
-#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   SWIG_Python_Thread_Allow _swig_thread_allow
-#      define SWIG_PYTHON_THREAD_END_ALLOW     _swig_thread_allow.end()
-#    else /* C code */
-#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK   PyGILState_STATE _swig_thread_block = PyGILState_Ensure()
-#      define SWIG_PYTHON_THREAD_END_BLOCK     PyGILState_Release(_swig_thread_block)
-#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW   PyThreadState *_swig_thread_allow = PyEval_SaveThread()
-#      define SWIG_PYTHON_THREAD_END_ALLOW     PyEval_RestoreThread(_swig_thread_allow)
-#    endif
-#  else /* Old thread way, not implemented, user must provide it */
-#    if !defined(SWIG_PYTHON_INITIALIZE_THREADS)
-#      define SWIG_PYTHON_INITIALIZE_THREADS
-#    endif
-#    if !defined(SWIG_PYTHON_THREAD_BEGIN_BLOCK)
-#      define SWIG_PYTHON_THREAD_BEGIN_BLOCK
-#    endif
-#    if !defined(SWIG_PYTHON_THREAD_END_BLOCK)
-#      define SWIG_PYTHON_THREAD_END_BLOCK
-#    endif
-#    if !defined(SWIG_PYTHON_THREAD_BEGIN_ALLOW)
-#      define SWIG_PYTHON_THREAD_BEGIN_ALLOW
-#    endif
-#    if !defined(SWIG_PYTHON_THREAD_END_ALLOW)
-#      define SWIG_PYTHON_THREAD_END_ALLOW
-#    endif
-#  endif
-#else /* No thread support */
-#  define SWIG_PYTHON_INITIALIZE_THREADS
-#  define SWIG_PYTHON_THREAD_BEGIN_BLOCK
-#  define SWIG_PYTHON_THREAD_END_BLOCK
-#  define SWIG_PYTHON_THREAD_BEGIN_ALLOW
-#  define SWIG_PYTHON_THREAD_END_ALLOW
-#endif
-
-/* -----------------------------------------------------------------------------
- * Python API portion that goes into the runtime
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* cc-mode */
-#endif
-#endif
-
-/* -----------------------------------------------------------------------------
- * Constant declarations
- * ----------------------------------------------------------------------------- */
-
-/* Constant Types */
-#define SWIG_PY_POINTER 4
-#define SWIG_PY_BINARY  5
-
-/* Constant information structure */
-typedef struct swig_const_info {
-  int type;
-  char *name;
-  long lvalue;
-  double dvalue;
-  void   *pvalue;
-  swig_type_info **ptype;
-} swig_const_info;
-
-#ifdef __cplusplus
-#if 0
-{ /* cc-mode */
-#endif
-}
-#endif
-
-
-/* -----------------------------------------------------------------------------
- * See the LICENSE file for information on copyright, usage and redistribution
- * of SWIG, and the README file for authors - http://www.swig.org/release.html.
- *
- * pyrun.swg
- *
- * This file contains the runtime support for Python modules
- * and includes code for managing global variables and pointer
- * type checking.
- *
- * ----------------------------------------------------------------------------- */
-
-/* Common SWIG API */
-
-/* for raw pointers */
-#define SWIG_Python_ConvertPtr(obj, pptr, type, flags)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, 0)
-#define SWIG_ConvertPtr(obj, pptr, type, flags)         SWIG_Python_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_ConvertPtrAndOwn(obj,pptr,type,flags,own)  SWIG_Python_ConvertPtrAndOwn(obj, pptr, type, flags, own)
-#define SWIG_NewPointerObj(ptr, type, flags)            SWIG_Python_NewPointerObj(ptr, type, flags)
-#define SWIG_CheckImplicit(ty)                          SWIG_Python_CheckImplicit(ty) 
-#define SWIG_AcquirePtr(ptr, src)                       SWIG_Python_AcquirePtr(ptr, src)
-#define swig_owntype                                    int
-
-/* for raw packed data */
-#define SWIG_ConvertPacked(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewPackedObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
-
-/* for class or struct pointers */
-#define SWIG_ConvertInstance(obj, pptr, type, flags)    SWIG_ConvertPtr(obj, pptr, type, flags)
-#define SWIG_NewInstanceObj(ptr, type, flags)           SWIG_NewPointerObj(ptr, type, flags)
-
-/* for C or C++ function pointers */
-#define SWIG_ConvertFunctionPtr(obj, pptr, type)        SWIG_Python_ConvertFunctionPtr(obj, pptr, type)
-#define SWIG_NewFunctionPtrObj(ptr, type)               SWIG_Python_NewPointerObj(ptr, type, 0)
-
-/* for C++ member pointers, ie, member methods */
-#define SWIG_ConvertMember(obj, ptr, sz, ty)            SWIG_Python_ConvertPacked(obj, ptr, sz, ty)
-#define SWIG_NewMemberObj(ptr, sz, type)                SWIG_Python_NewPackedObj(ptr, sz, type)
-
-
-/* Runtime API */
-
-#define SWIG_GetModule(clientdata)                      SWIG_Python_GetModule()
-#define SWIG_SetModule(clientdata, pointer)             SWIG_Python_SetModule(pointer)
-#define SWIG_NewClientData(obj)                         PySwigClientData_New(obj)
-
-#define SWIG_SetErrorObj                                SWIG_Python_SetErrorObj                            
-#define SWIG_SetErrorMsg                               SWIG_Python_SetErrorMsg                            
-#define SWIG_ErrorType(code)                           SWIG_Python_ErrorType(code)                        
-#define SWIG_Error(code, msg)                          SWIG_Python_SetErrorMsg(SWIG_ErrorType(code), msg) 
-#define SWIG_fail                                      goto fail                                          
-
-
-/* Runtime API implementation */
-
-/* Error manipulation */
-
-SWIGINTERN void 
-SWIG_Python_SetErrorObj(PyObject *errtype, PyObject *obj) {
-  SWIG_PYTHON_THREAD_BEGIN_BLOCK; 
-  PyErr_SetObject(errtype, obj);
-  Py_DECREF(obj);
-  SWIG_PYTHON_THREAD_END_BLOCK;
-}
-
-SWIGINTERN void 
-SWIG_Python_SetErrorMsg(PyObject *errtype, const char *msg) {
-  SWIG_PYTHON_THREAD_BEGIN_BLOCK;
-  PyErr_SetString(errtype, (char *) msg);
-  SWIG_PYTHON_THREAD_END_BLOCK;
-}
-
-#define SWIG_Python_Raise(obj, type, desc)  SWIG_Python_SetErrorObj(SWIG_Python_ExceptionType(desc), obj)
-
-/* Set a constant value */
-
-SWIGINTERN void
-SWIG_Python_SetConstant(PyObject *d, const char *name, PyObject *obj) {   
-  PyDict_SetItemString(d, (char*) name, obj);
-  Py_DECREF(obj);                            
-}
-
-/* Append a value to the result obj */
-
-SWIGINTERN PyObject*
-SWIG_Python_AppendOutput(PyObject* result, PyObject* obj) {
-#if !defined(SWIG_PYTHON_OUTPUT_TUPLE)
-  if (!result) {
-    result = obj;
-  } else if (result == Py_None) {
-    Py_DECREF(result);
-    result = obj;
-  } else {
-    if (!PyList_Check(result)) {
-      PyObject *o2 = result;
-      result = PyList_New(1);
-      PyList_SetItem(result, 0, o2);
-    }
-    PyList_Append(result,obj);
-    Py_DECREF(obj);
-  }
-  return result;
-#else
-  PyObject*   o2;
-  PyObject*   o3;
-  if (!result) {
-    result = obj;
-  } else if (result == Py_None) {
-    Py_DECREF(result);
-    result = obj;
-  } else {
-    if (!PyTuple_Check(result)) {
-      o2 = result;
-      result = PyTuple_New(1);
-      PyTuple_SET_ITEM(result, 0, o2);
-    }
-    o3 = PyTuple_New(1);
-    PyTuple_SET_ITEM(o3, 0, obj);
-    o2 = result;
-    result = PySequence_Concat(o2, o3);
-    Py_DECREF(o2);
-    Py_DECREF(o3);
-  }
-  return result;
-#endif
-}
-
-/* Unpack the argument tuple */
-
-SWIGINTERN int
-SWIG_Python_UnpackTuple(PyObject *args, const char *name, Py_ssize_t min, Py_ssize_t max, PyObject **objs)
-{
-  if (!args) {
-    if (!min && !max) {
-      return 1;
-    } else {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got none", 
-                  name, (min == max ? "" : "at least "), (int)min);
-      return 0;
-    }
-  }  
-  if (!PyTuple_Check(args)) {
-    PyErr_SetString(PyExc_SystemError, "UnpackTuple() argument list is not a tuple");
-    return 0;
-  } else {
-    register Py_ssize_t l = PyTuple_GET_SIZE(args);
-    if (l < min) {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-                  name, (min == max ? "" : "at least "), (int)min, (int)l);
-      return 0;
-    } else if (l > max) {
-      PyErr_Format(PyExc_TypeError, "%s expected %s%d arguments, got %d", 
-                  name, (min == max ? "" : "at most "), (int)max, (int)l);
-      return 0;
-    } else {
-      register int i;
-      for (i = 0; i < l; ++i) {
-       objs[i] = PyTuple_GET_ITEM(args, i);
-      }
-      for (; l < max; ++l) {
-       objs[l] = 0;
-      }
-      return i + 1;
-    }    
-  }
-}
-
-/* A functor is a function object with one single object argument */
-#if PY_VERSION_HEX >= 0x02020000
-#define SWIG_Python_CallFunctor(functor, obj)          PyObject_CallFunctionObjArgs(functor, obj, NULL);
-#else
-#define SWIG_Python_CallFunctor(functor, obj)          PyObject_CallFunction(functor, "O", obj);
-#endif
-
-/*
-  Helper for static pointer initialization for both C and C++ code, for example
-  static PyObject *SWIG_STATIC_POINTER(MyVar) = NewSomething(...);
-*/
-#ifdef __cplusplus
-#define SWIG_STATIC_POINTER(var)  var
-#else
-#define SWIG_STATIC_POINTER(var)  var = 0; if (!var) var
-#endif
-
-/* -----------------------------------------------------------------------------
- * Pointer declarations
- * ----------------------------------------------------------------------------- */
-
-/* Flags for new pointer objects */
-#define SWIG_POINTER_NOSHADOW       (SWIG_POINTER_OWN      << 1)
-#define SWIG_POINTER_NEW            (SWIG_POINTER_NOSHADOW | SWIG_POINTER_OWN)
-
-#define SWIG_POINTER_IMPLICIT_CONV  (SWIG_POINTER_DISOWN   << 1)
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* cc-mode */
-#endif
-#endif
-
-/*  How to access Py_None */
-#if defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
-#  ifndef SWIG_PYTHON_NO_BUILD_NONE
-#    ifndef SWIG_PYTHON_BUILD_NONE
-#      define SWIG_PYTHON_BUILD_NONE
-#    endif
-#  endif
-#endif
-
-#ifdef SWIG_PYTHON_BUILD_NONE
-#  ifdef Py_None
-#   undef Py_None
-#   define Py_None SWIG_Py_None()
-#  endif
-SWIGRUNTIMEINLINE PyObject * 
-_SWIG_Py_None(void)
-{
-  PyObject *none = Py_BuildValue((char*)"");
-  Py_DECREF(none);
-  return none;
-}
-SWIGRUNTIME PyObject * 
-SWIG_Py_None(void)
-{
-  static PyObject *SWIG_STATIC_POINTER(none) = _SWIG_Py_None();
-  return none;
-}
-#endif
-
-/* The python void return value */
-
-SWIGRUNTIMEINLINE PyObject * 
-SWIG_Py_Void(void)
-{
-  PyObject *none = Py_None;
-  Py_INCREF(none);
-  return none;
-}
-
-/* PySwigClientData */
-
-typedef struct {
-  PyObject *klass;
-  PyObject *newraw;
-  PyObject *newargs;
-  PyObject *destroy;
-  int delargs;
-  int implicitconv;
-} PySwigClientData;
-
-SWIGRUNTIMEINLINE int 
-SWIG_Python_CheckImplicit(swig_type_info *ty)
-{
-  PySwigClientData *data = (PySwigClientData *)ty->clientdata;
-  return data ? data->implicitconv : 0;
-}
-
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_ExceptionType(swig_type_info *desc) {
-  PySwigClientData *data = desc ? (PySwigClientData *) desc->clientdata : 0;
-  PyObject *klass = data ? data->klass : 0;
-  return (klass ? klass : PyExc_RuntimeError);
-}
-
-
-SWIGRUNTIME PySwigClientData * 
-PySwigClientData_New(PyObject* obj)
-{
-  if (!obj) {
-    return 0;
-  } else {
-    PySwigClientData *data = (PySwigClientData *)malloc(sizeof(PySwigClientData));
-    /* the klass element */
-    data->klass = obj;
-    Py_INCREF(data->klass);
-    /* the newraw method and newargs arguments used to create a new raw instance */
-    if (PyClass_Check(obj)) {
-      data->newraw = 0;
-      data->newargs = obj;
-      Py_INCREF(obj);
-    } else {
-#if (PY_VERSION_HEX < 0x02020000)
-      data->newraw = 0;
-#else
-      data->newraw = PyObject_GetAttrString(data->klass, (char *)"__new__");
-#endif
-      if (data->newraw) {
-       Py_INCREF(data->newraw);
-       data->newargs = PyTuple_New(1);
-       PyTuple_SetItem(data->newargs, 0, obj);
-      } else {
-       data->newargs = obj;
-      }
-      Py_INCREF(data->newargs);
-    }
-    /* the destroy method, aka as the C++ delete method */
-    data->destroy = PyObject_GetAttrString(data->klass, (char *)"__swig_destroy__");
-    if (PyErr_Occurred()) {
-      PyErr_Clear();
-      data->destroy = 0;
-    }
-    if (data->destroy) {
-      int flags;
-      Py_INCREF(data->destroy);
-      flags = PyCFunction_GET_FLAGS(data->destroy);
-#ifdef METH_O
-      data->delargs = !(flags & (METH_O));
-#else
-      data->delargs = 0;
-#endif
-    } else {
-      data->delargs = 0;
-    }
-    data->implicitconv = 0;
-    return data;
-  }
-}
-
-SWIGRUNTIME void 
-PySwigClientData_Del(PySwigClientData* data)
-{
-  Py_XDECREF(data->newraw);
-  Py_XDECREF(data->newargs);
-  Py_XDECREF(data->destroy);
-}
-
-/* =============== PySwigObject =====================*/
-
-typedef struct {
-  PyObject_HEAD
-  void *ptr;
-  swig_type_info *ty;
-  int own;
-  PyObject *next;
-} PySwigObject;
-
-SWIGRUNTIME PyObject *
-PySwigObject_long(PySwigObject *v)
-{
-  return PyLong_FromVoidPtr(v->ptr);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_format(const char* fmt, PySwigObject *v)
-{
-  PyObject *res = NULL;
-  PyObject *args = PyTuple_New(1);
-  if (args) {
-    if (PyTuple_SetItem(args, 0, PySwigObject_long(v)) == 0) {
-      PyObject *ofmt = PyString_FromString(fmt);
-      if (ofmt) {
-       res = PyString_Format(ofmt,args);
-       Py_DECREF(ofmt);
-      }
-      Py_DECREF(args);
-    }
-  }
-  return res;
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_oct(PySwigObject *v)
-{
-  return PySwigObject_format("%o",v);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_hex(PySwigObject *v)
-{
-  return PySwigObject_format("%x",v);
-}
-
-SWIGRUNTIME PyObject *
-#ifdef METH_NOARGS
-PySwigObject_repr(PySwigObject *v)
-#else
-PySwigObject_repr(PySwigObject *v, PyObject *args)
-#endif
-{
-  const char *name = SWIG_TypePrettyName(v->ty);
-  PyObject *hex = PySwigObject_hex(v);    
-  PyObject *repr = PyString_FromFormat("<Swig Object of type '%s' at 0x%s>", name, PyString_AsString(hex));
-  Py_DECREF(hex);
-  if (v->next) {
-#ifdef METH_NOARGS
-    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next);
-#else
-    PyObject *nrep = PySwigObject_repr((PySwigObject *)v->next, args);
-#endif
-    PyString_ConcatAndDel(&repr,nrep);
-  }
-  return repr;  
-}
-
-SWIGRUNTIME int
-PySwigObject_print(PySwigObject *v, FILE *fp, int SWIGUNUSEDPARM(flags))
-{
-#ifdef METH_NOARGS
-  PyObject *repr = PySwigObject_repr(v);
-#else
-  PyObject *repr = PySwigObject_repr(v, NULL);
-#endif
-  if (repr) {
-    fputs(PyString_AsString(repr), fp);
-    Py_DECREF(repr);
-    return 0; 
-  } else {
-    return 1; 
-  }
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_str(PySwigObject *v)
-{
-  char result[SWIG_BUFFER_SIZE];
-  return SWIG_PackVoidPtr(result, v->ptr, v->ty->name, sizeof(result)) ?
-    PyString_FromString(result) : 0;
-}
-
-SWIGRUNTIME int
-PySwigObject_compare(PySwigObject *v, PySwigObject *w)
-{
-  void *i = v->ptr;
-  void *j = w->ptr;
-  return (i < j) ? -1 : ((i > j) ? 1 : 0);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigObject_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigObject_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigObject_type();
-  return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigObject_Check(PyObject *op) {
-  return ((op)->ob_type == PySwigObject_type())
-    || (strcmp((op)->ob_type->tp_name,"PySwigObject") == 0);
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own);
-
-SWIGRUNTIME void
-PySwigObject_dealloc(PyObject *v)
-{
-  PySwigObject *sobj = (PySwigObject *) v;
-  PyObject *next = sobj->next;
-  if (sobj->own) {
-    swig_type_info *ty = sobj->ty;
-    PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-    PyObject *destroy = data ? data->destroy : 0;
-    if (destroy) {
-      /* destroy is always a VARARGS method */
-      PyObject *res;
-      if (data->delargs) {
-       /* we need to create a temporal object to carry the destroy operation */
-       PyObject *tmp = PySwigObject_New(sobj->ptr, ty, 0);
-       res = SWIG_Python_CallFunctor(destroy, tmp);
-       Py_DECREF(tmp);
-      } else {
-       PyCFunction meth = PyCFunction_GET_FUNCTION(destroy);
-       PyObject *mself = PyCFunction_GET_SELF(destroy);
-       res = ((*meth)(mself, v));
-      }
-      Py_XDECREF(res);
-    } else {
-      const char *name = SWIG_TypePrettyName(ty);
-#if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
-    }
-  } 
-  Py_XDECREF(next);
-  PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyObject* 
-PySwigObject_append(PyObject* v, PyObject* next)
-{
-  PySwigObject *sobj = (PySwigObject *) v;
-#ifndef METH_O
-  PyObject *tmp = 0;
-  if (!PyArg_ParseTuple(next,(char *)"O:append", &tmp)) return NULL;
-  next = tmp;
-#endif
-  if (!PySwigObject_Check(next)) {
-    return NULL;
-  }
-  sobj->next = next;
-  Py_INCREF(next);
-  return SWIG_Py_Void();
-}
-
-SWIGRUNTIME PyObject* 
-#ifdef METH_NOARGS
-PySwigObject_next(PyObject* v)
-#else
-PySwigObject_next(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
-  PySwigObject *sobj = (PySwigObject *) v;
-  if (sobj->next) {    
-    Py_INCREF(sobj->next);
-    return sobj->next;
-  } else {
-    return SWIG_Py_Void();
-  }
-}
-
-SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-PySwigObject_disown(PyObject *v)
-#else
-PySwigObject_disown(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
-  PySwigObject *sobj = (PySwigObject *)v;
-  sobj->own = 0;
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject*
-#ifdef METH_NOARGS
-PySwigObject_acquire(PyObject *v)
-#else
-PySwigObject_acquire(PyObject* v, PyObject *SWIGUNUSEDPARM(args))
-#endif
-{
-  PySwigObject *sobj = (PySwigObject *)v;
-  sobj->own = SWIG_POINTER_OWN;
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject*
-PySwigObject_own(PyObject *v, PyObject *args)
-{
-  PyObject *val = 0;
-#if (PY_VERSION_HEX < 0x02020000)
-  if (!PyArg_ParseTuple(args,(char *)"|O:own",&val))
-#else
-  if (!PyArg_UnpackTuple(args, (char *)"own", 0, 1, &val)) 
-#endif
-    {
-      return NULL;
-    } 
-  else
-    {
-      PySwigObject *sobj = (PySwigObject *)v;
-      PyObject *obj = PyBool_FromLong(sobj->own);
-      if (val) {
-#ifdef METH_NOARGS
-       if (PyObject_IsTrue(val)) {
-         PySwigObject_acquire(v);
-       } else {
-         PySwigObject_disown(v);
-       }
-#else
-       if (PyObject_IsTrue(val)) {
-         PySwigObject_acquire(v,args);
-       } else {
-         PySwigObject_disown(v,args);
-       }
-#endif
-      } 
-      return obj;
-    }
-}
-
-#ifdef METH_O
-static PyMethodDef
-swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_NOARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_NOARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS, (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_O,       (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_NOARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,    METH_NOARGS,  (char *)"returns object representation"},
-  {0, 0, 0, 0}  
-};
-#else
-static PyMethodDef
-swigobject_methods[] = {
-  {(char *)"disown",  (PyCFunction)PySwigObject_disown,  METH_VARARGS,  (char *)"releases ownership of the pointer"},
-  {(char *)"acquire", (PyCFunction)PySwigObject_acquire, METH_VARARGS,  (char *)"aquires ownership of the pointer"},
-  {(char *)"own",     (PyCFunction)PySwigObject_own,     METH_VARARGS,  (char *)"returns/sets ownership of the pointer"},
-  {(char *)"append",  (PyCFunction)PySwigObject_append,  METH_VARARGS,  (char *)"appends another 'this' object"},
-  {(char *)"next",    (PyCFunction)PySwigObject_next,    METH_VARARGS,  (char *)"returns the next 'this' object"},
-  {(char *)"__repr__",(PyCFunction)PySwigObject_repr,   METH_VARARGS,  (char *)"returns object representation"},
-  {0, 0, 0, 0}  
-};
-#endif
-
-#if PY_VERSION_HEX < 0x02020000
-SWIGINTERN PyObject *
-PySwigObject_getattr(PySwigObject *sobj,char *name)
-{
-  return Py_FindMethod(swigobject_methods, (PyObject *)sobj, name);
-}
-#endif
-
-SWIGRUNTIME PyTypeObject*
-_PySwigObject_type(void) {
-  static char swigobject_doc[] = "Swig object carries a C/C++ instance pointer";
-  
-  static PyNumberMethods PySwigObject_as_number = {
-    (binaryfunc)0, /*nb_add*/
-    (binaryfunc)0, /*nb_subtract*/
-    (binaryfunc)0, /*nb_multiply*/
-    (binaryfunc)0, /*nb_divide*/
-    (binaryfunc)0, /*nb_remainder*/
-    (binaryfunc)0, /*nb_divmod*/
-    (ternaryfunc)0,/*nb_power*/
-    (unaryfunc)0,  /*nb_negative*/
-    (unaryfunc)0,  /*nb_positive*/
-    (unaryfunc)0,  /*nb_absolute*/
-    (inquiry)0,    /*nb_nonzero*/
-    0,            /*nb_invert*/
-    0,            /*nb_lshift*/
-    0,            /*nb_rshift*/
-    0,            /*nb_and*/
-    0,            /*nb_xor*/
-    0,            /*nb_or*/
-    (coercion)0,   /*nb_coerce*/
-    (unaryfunc)PySwigObject_long, /*nb_int*/
-    (unaryfunc)PySwigObject_long, /*nb_long*/
-    (unaryfunc)0,                 /*nb_float*/
-    (unaryfunc)PySwigObject_oct,  /*nb_oct*/
-    (unaryfunc)PySwigObject_hex,  /*nb_hex*/
-#if PY_VERSION_HEX >= 0x02050000 /* 2.5.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_index */
-#elif PY_VERSION_HEX >= 0x02020000 /* 2.2.0 */
-    0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_true_divide */
-#elif PY_VERSION_HEX >= 0x02000000 /* 2.0.0 */
-    0,0,0,0,0,0,0,0,0,0,0 /* nb_inplace_add -> nb_inplace_or */
-#endif
-  };
-
-  static PyTypeObject pyswigobject_type;  
-  static int type_init = 0;
-  if (!type_init) {
-    const PyTypeObject tmp
-      = {
-       PyObject_HEAD_INIT(NULL)
-       0,                                  /* ob_size */
-       (char *)"PySwigObject",             /* tp_name */
-       sizeof(PySwigObject),               /* tp_basicsize */
-       0,                                  /* tp_itemsize */
-       (destructor)PySwigObject_dealloc,   /* tp_dealloc */
-       (printfunc)PySwigObject_print,      /* tp_print */
-#if PY_VERSION_HEX < 0x02020000
-       (getattrfunc)PySwigObject_getattr,  /* tp_getattr */ 
-#else
-       (getattrfunc)0,                     /* tp_getattr */ 
-#endif
-       (setattrfunc)0,                     /* tp_setattr */ 
-       (cmpfunc)PySwigObject_compare,      /* tp_compare */ 
-       (reprfunc)PySwigObject_repr,        /* tp_repr */    
-       &PySwigObject_as_number,            /* tp_as_number */
-       0,                                  /* tp_as_sequence */
-       0,                                  /* tp_as_mapping */
-       (hashfunc)0,                        /* tp_hash */
-       (ternaryfunc)0,                     /* tp_call */
-       (reprfunc)PySwigObject_str,         /* tp_str */
-       PyObject_GenericGetAttr,            /* tp_getattro */
-       0,                                  /* tp_setattro */
-       0,                                  /* tp_as_buffer */
-       Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-       swigobject_doc,                     /* tp_doc */        
-       0,                                  /* tp_traverse */
-       0,                                  /* tp_clear */
-       0,                                  /* tp_richcompare */
-       0,                                  /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
-       0,                                  /* tp_iter */
-       0,                                  /* tp_iternext */
-       swigobject_methods,                 /* tp_methods */ 
-       0,                                  /* tp_members */
-       0,                                  /* tp_getset */             
-       0,                                  /* tp_base */               
-       0,                                  /* tp_dict */               
-       0,                                  /* tp_descr_get */          
-       0,                                  /* tp_descr_set */          
-       0,                                  /* tp_dictoffset */         
-       0,                                  /* tp_init */               
-       0,                                  /* tp_alloc */              
-       0,                                  /* tp_new */                
-       0,                                  /* tp_free */          
-        0,                                  /* tp_is_gc */  
-       0,                                  /* tp_bases */   
-       0,                                  /* tp_mro */
-       0,                                  /* tp_cache */   
-       0,                                  /* tp_subclasses */
-       0,                                  /* tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
-       0,                                  /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
-       0,0,0,0                             /* tp_alloc -> tp_next */
-#endif
-      };
-    pyswigobject_type = tmp;
-    pyswigobject_type.ob_type = &PyType_Type;
-    type_init = 1;
-  }
-  return &pyswigobject_type;
-}
-
-SWIGRUNTIME PyObject *
-PySwigObject_New(void *ptr, swig_type_info *ty, int own)
-{
-  PySwigObject *sobj = PyObject_NEW(PySwigObject, PySwigObject_type());
-  if (sobj) {
-    sobj->ptr  = ptr;
-    sobj->ty   = ty;
-    sobj->own  = own;
-    sobj->next = 0;
-  }
-  return (PyObject *)sobj;
-}
-
-/* -----------------------------------------------------------------------------
- * Implements a simple Swig Packed type, and use it instead of string
- * ----------------------------------------------------------------------------- */
-
-typedef struct {
-  PyObject_HEAD
-  void *pack;
-  swig_type_info *ty;
-  size_t size;
-} PySwigPacked;
-
-SWIGRUNTIME int
-PySwigPacked_print(PySwigPacked *v, FILE *fp, int SWIGUNUSEDPARM(flags))
-{
-  char result[SWIG_BUFFER_SIZE];
-  fputs("<Swig Packed ", fp); 
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-    fputs("at ", fp); 
-    fputs(result, fp); 
-  }
-  fputs(v->ty->name,fp); 
-  fputs(">", fp);
-  return 0; 
-}
-  
-SWIGRUNTIME PyObject *
-PySwigPacked_repr(PySwigPacked *v)
-{
-  char result[SWIG_BUFFER_SIZE];
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))) {
-    return PyString_FromFormat("<Swig Packed at %s%s>", result, v->ty->name);
-  } else {
-    return PyString_FromFormat("<Swig Packed %s>", v->ty->name);
-  }  
-}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_str(PySwigPacked *v)
-{
-  char result[SWIG_BUFFER_SIZE];
-  if (SWIG_PackDataName(result, v->pack, v->size, 0, sizeof(result))){
-    return PyString_FromFormat("%s%s", result, v->ty->name);
-  } else {
-    return PyString_FromString(v->ty->name);
-  }  
-}
-
-SWIGRUNTIME int
-PySwigPacked_compare(PySwigPacked *v, PySwigPacked *w)
-{
-  size_t i = v->size;
-  size_t j = w->size;
-  int s = (i < j) ? -1 : ((i > j) ? 1 : 0);
-  return s ? s : strncmp((char *)v->pack, (char *)w->pack, 2*v->size);
-}
-
-SWIGRUNTIME PyTypeObject* _PySwigPacked_type(void);
-
-SWIGRUNTIME PyTypeObject*
-PySwigPacked_type(void) {
-  static PyTypeObject *SWIG_STATIC_POINTER(type) = _PySwigPacked_type();
-  return type;
-}
-
-SWIGRUNTIMEINLINE int
-PySwigPacked_Check(PyObject *op) {
-  return ((op)->ob_type == _PySwigPacked_type()) 
-    || (strcmp((op)->ob_type->tp_name,"PySwigPacked") == 0);
-}
-
-SWIGRUNTIME void
-PySwigPacked_dealloc(PyObject *v)
-{
-  if (PySwigPacked_Check(v)) {
-    PySwigPacked *sobj = (PySwigPacked *) v;
-    free(sobj->pack);
-  }
-  PyObject_DEL(v);
-}
-
-SWIGRUNTIME PyTypeObject*
-_PySwigPacked_type(void) {
-  static char swigpacked_doc[] = "Swig object carries a C/C++ instance pointer";
-  static PyTypeObject pyswigpacked_type;
-  static int type_init = 0;  
-  if (!type_init) {
-    const PyTypeObject tmp
-      = {
-       PyObject_HEAD_INIT(NULL)
-       0,                                  /* ob_size */       
-       (char *)"PySwigPacked",             /* tp_name */       
-       sizeof(PySwigPacked),               /* tp_basicsize */  
-       0,                                  /* tp_itemsize */   
-       (destructor)PySwigPacked_dealloc,   /* tp_dealloc */    
-       (printfunc)PySwigPacked_print,      /* tp_print */      
-       (getattrfunc)0,                     /* tp_getattr */    
-       (setattrfunc)0,                     /* tp_setattr */    
-       (cmpfunc)PySwigPacked_compare,      /* tp_compare */    
-       (reprfunc)PySwigPacked_repr,        /* tp_repr */       
-       0,                                  /* tp_as_number */  
-       0,                                  /* tp_as_sequence */
-       0,                                  /* tp_as_mapping */ 
-       (hashfunc)0,                        /* tp_hash */       
-       (ternaryfunc)0,                     /* tp_call */       
-       (reprfunc)PySwigPacked_str,         /* tp_str */        
-       PyObject_GenericGetAttr,            /* tp_getattro */
-       0,                                  /* tp_setattro */
-       0,                                  /* tp_as_buffer */
-       Py_TPFLAGS_DEFAULT,                 /* tp_flags */
-       swigpacked_doc,                     /* tp_doc */
-       0,                                  /* tp_traverse */
-       0,                                  /* tp_clear */
-       0,                                  /* tp_richcompare */
-       0,                                  /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
-       0,                                  /* tp_iter */
-       0,                                  /* tp_iternext */
-       0,                                  /* tp_methods */ 
-       0,                                  /* tp_members */
-       0,                                  /* tp_getset */             
-       0,                                  /* tp_base */               
-       0,                                  /* tp_dict */               
-       0,                                  /* tp_descr_get */          
-       0,                                  /* tp_descr_set */          
-       0,                                  /* tp_dictoffset */         
-       0,                                  /* tp_init */               
-       0,                                  /* tp_alloc */              
-       0,                                  /* tp_new */                
-       0,                                  /* tp_free */          
-        0,                                  /* tp_is_gc */  
-       0,                                  /* tp_bases */   
-       0,                                  /* tp_mro */
-       0,                                  /* tp_cache */   
-       0,                                  /* tp_subclasses */
-       0,                                  /* tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
-       0,                                  /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
-       0,0,0,0                             /* tp_alloc -> tp_next */
-#endif
-      };
-    pyswigpacked_type = tmp;
-    pyswigpacked_type.ob_type = &PyType_Type;
-    type_init = 1;
-  }
-  return &pyswigpacked_type;
-}
-
-SWIGRUNTIME PyObject *
-PySwigPacked_New(void *ptr, size_t size, swig_type_info *ty)
-{
-  PySwigPacked *sobj = PyObject_NEW(PySwigPacked, PySwigPacked_type());
-  if (sobj) {
-    void *pack = malloc(size);
-    if (pack) {
-      memcpy(pack, ptr, size);
-      sobj->pack = pack;
-      sobj->ty   = ty;
-      sobj->size = size;
-    } else {
-      PyObject_DEL((PyObject *) sobj);
-      sobj = 0;
-    }
-  }
-  return (PyObject *) sobj;
-}
-
-SWIGRUNTIME swig_type_info *
-PySwigPacked_UnpackData(PyObject *obj, void *ptr, size_t size)
-{
-  if (PySwigPacked_Check(obj)) {
-    PySwigPacked *sobj = (PySwigPacked *)obj;
-    if (sobj->size != size) return 0;
-    memcpy(ptr, sobj->pack, size);
-    return sobj->ty;
-  } else {
-    return 0;
-  }
-}
-
-/* -----------------------------------------------------------------------------
- * pointers/data manipulation
- * ----------------------------------------------------------------------------- */
-
-SWIGRUNTIMEINLINE PyObject *
-_SWIG_This(void)
-{
-  return PyString_FromString("this");
-}
-
-SWIGRUNTIME PyObject *
-SWIG_This(void)
-{
-  static PyObject *SWIG_STATIC_POINTER(swig_this) = _SWIG_This();
-  return swig_this;
-}
-
-/* #define SWIG_PYTHON_SLOW_GETSET_THIS */
-
-SWIGRUNTIME PySwigObject *
-SWIG_Python_GetSwigThis(PyObject *pyobj) 
-{
-  if (PySwigObject_Check(pyobj)) {
-    return (PySwigObject *) pyobj;
-  } else {
-    PyObject *obj = 0;
-#if (!defined(SWIG_PYTHON_SLOW_GETSET_THIS) && (PY_VERSION_HEX >= 0x02030000))
-    if (PyInstance_Check(pyobj)) {
-      obj = _PyInstance_Lookup(pyobj, SWIG_This());      
-    } else {
-      PyObject **dictptr = _PyObject_GetDictPtr(pyobj);
-      if (dictptr != NULL) {
-       PyObject *dict = *dictptr;
-       obj = dict ? PyDict_GetItem(dict, SWIG_This()) : 0;
-      } else {
-#ifdef PyWeakref_CheckProxy
-       if (PyWeakref_CheckProxy(pyobj)) {
-         PyObject *wobj = PyWeakref_GET_OBJECT(pyobj);
-         return wobj ? SWIG_Python_GetSwigThis(wobj) : 0;
-       }
-#endif
-       obj = PyObject_GetAttr(pyobj,SWIG_This());
-       if (obj) {
-         Py_DECREF(obj);
-       } else {
-         if (PyErr_Occurred()) PyErr_Clear();
-         return 0;
-       }
-      }
-    }
-#else
-    obj = PyObject_GetAttr(pyobj,SWIG_This());
-    if (obj) {
-      Py_DECREF(obj);
-    } else {
-      if (PyErr_Occurred()) PyErr_Clear();
-      return 0;
-    }
-#endif
-    if (obj && !PySwigObject_Check(obj)) {
-      /* a PyObject is called 'this', try to get the 'real this'
-        PySwigObject from it */ 
-      return SWIG_Python_GetSwigThis(obj);
-    }
-    return (PySwigObject *)obj;
-  }
-}
-
-/* Acquire a pointer value */
-
-SWIGRUNTIME int
-SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own) {
-    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-    if (sobj) {
-      int oldown = sobj->own;
-      sobj->own = own;
-      return oldown;
-    }
-  }
-  return 0;
-}
-
-/* Convert a pointer value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int flags, int *own) {
-  if (!obj) return SWIG_ERROR;
-  if (obj == Py_None) {
-    if (ptr) *ptr = 0;
-    return SWIG_OK;
-  } else {
-    PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
-    while (sobj) {
-      void *vptr = sobj->ptr;
-      if (ty) {
-       swig_type_info *to = sobj->ty;
-       if (to == ty) {
-         /* no type cast needed */
-         if (ptr) *ptr = vptr;
-         break;
-       } else {
-         swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
-         if (!tc) {
-           sobj = (PySwigObject *)sobj->next;
-         } else {
-           if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
-           break;
-         }
-       }
-      } else {
-       if (ptr) *ptr = vptr;
-       break;
-      }
-    }
-    if (sobj) {
-      if (own) *own = sobj->own;
-      if (flags & SWIG_POINTER_DISOWN) {
-       sobj->own = 0;
-      }
-      return SWIG_OK;
-    } else {
-      int res = SWIG_ERROR;
-      if (flags & SWIG_POINTER_IMPLICIT_CONV) {
-       PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
-       if (data && !data->implicitconv) {
-         PyObject *klass = data->klass;
-         if (klass) {
-           PyObject *impconv;
-           data->implicitconv = 1; /* avoid recursion and call 'explicit' constructors*/
-           impconv = SWIG_Python_CallFunctor(klass, obj);
-           data->implicitconv = 0;
-           if (PyErr_Occurred()) {
-             PyErr_Clear();
-             impconv = 0;
-           }
-           if (impconv) {
-             PySwigObject *iobj = SWIG_Python_GetSwigThis(impconv);
-             if (iobj) {
-               void *vptr;
-               res = SWIG_Python_ConvertPtrAndOwn((PyObject*)iobj, &vptr, ty, 0, 0);
-               if (SWIG_IsOK(res)) {
-                 if (ptr) {
-                   *ptr = vptr;
-                   /* transfer the ownership to 'ptr' */
-                   iobj->own = 0;
-                   res = SWIG_AddCast(res);
-                   res = SWIG_AddNewMask(res);
-                 } else {
-                   res = SWIG_AddCast(res);                
-                 }
-               }
-             }
-             Py_DECREF(impconv);
-           }
-         }
-       }
-      }
-      return res;
-    }
-  }
-}
-
-/* Convert a function ptr value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
-  if (!PyCFunction_Check(obj)) {
-    return SWIG_ConvertPtr(obj, ptr, ty, 0);
-  } else {
-    void *vptr = 0;
-    
-    /* here we get the method pointer for callbacks */
-    const char *doc = (((PyCFunctionObject *)obj) -> m_ml -> ml_doc);
-    const char *desc = doc ? strstr(doc, "swig_ptr: ") : 0;
-    if (desc) {
-      desc = ty ? SWIG_UnpackVoidPtr(desc + 10, &vptr, ty->name) : 0;
-      if (!desc) return SWIG_ERROR;
-    }
-    if (ty) {
-      swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (!tc) return SWIG_ERROR;
-      *ptr = SWIG_TypeCast(tc,vptr);
-    } else {
-      *ptr = vptr;
-    }
-    return SWIG_OK;
-  }
-}
-
-/* Convert a packed value value */
-
-SWIGRUNTIME int
-SWIG_Python_ConvertPacked(PyObject *obj, void *ptr, size_t sz, swig_type_info *ty) {
-  swig_type_info *to = PySwigPacked_UnpackData(obj, ptr, sz);
-  if (!to) return SWIG_ERROR;
-  if (ty) {
-    if (to != ty) {
-      /* check type cast? */
-      swig_cast_info *tc = SWIG_TypeCheck(to->name,ty);
-      if (!tc) return SWIG_ERROR;
-    }
-  }
-  return SWIG_OK;
-}  
-
-/* -----------------------------------------------------------------------------
- * Create a new pointer object
- * ----------------------------------------------------------------------------- */
-
-/*
-  Create a new instance object, whitout calling __init__, and set the
-  'this' attribute.
-*/
-
-SWIGRUNTIME PyObject* 
-SWIG_Python_NewShadowInstance(PySwigClientData *data, PyObject *swig_this)
-{
-#if (PY_VERSION_HEX >= 0x02020000)
-  PyObject *inst = 0;
-  PyObject *newraw = data->newraw;
-  if (newraw) {
-    inst = PyObject_Call(newraw, data->newargs, NULL);
-    if (inst) {
-#if !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
-      PyObject **dictptr = _PyObject_GetDictPtr(inst);
-      if (dictptr != NULL) {
-       PyObject *dict = *dictptr;
-       if (dict == NULL) {
-         dict = PyDict_New();
-         *dictptr = dict;
-         PyDict_SetItem(dict, SWIG_This(), swig_this);
-       }
-      }
-#else
-      PyObject *key = SWIG_This();
-      PyObject_SetAttr(inst, key, swig_this);
-#endif
-    }
-  } else {
-    PyObject *dict = PyDict_New();
-    PyDict_SetItem(dict, SWIG_This(), swig_this);
-    inst = PyInstance_NewRaw(data->newargs, dict);
-    Py_DECREF(dict);
-  }
-  return inst;
-#else
-#if (PY_VERSION_HEX >= 0x02010000)
-  PyObject *inst;
-  PyObject *dict = PyDict_New();
-  PyDict_SetItem(dict, SWIG_This(), swig_this);
-  inst = PyInstance_NewRaw(data->newargs, dict);
-  Py_DECREF(dict);
-  return (PyObject *) inst;
-#else
-  PyInstanceObject *inst = PyObject_NEW(PyInstanceObject, &PyInstance_Type);
-  if (inst == NULL) {
-    return NULL;
-  }
-  inst->in_class = (PyClassObject *)data->newargs;
-  Py_INCREF(inst->in_class);
-  inst->in_dict = PyDict_New();
-  if (inst->in_dict == NULL) {
-    Py_DECREF(inst);
-    return NULL;
-  }
-#ifdef Py_TPFLAGS_HAVE_WEAKREFS
-  inst->in_weakreflist = NULL;
-#endif
-#ifdef Py_TPFLAGS_GC
-  PyObject_GC_Init(inst);
-#endif
-  PyDict_SetItem(inst->in_dict, SWIG_This(), swig_this);
-  return (PyObject *) inst;
-#endif
-#endif
-}
-
-SWIGRUNTIME void
-SWIG_Python_SetSwigThis(PyObject *inst, PyObject *swig_this)
-{
- PyObject *dict;
-#if (PY_VERSION_HEX >= 0x02020000) && !defined(SWIG_PYTHON_SLOW_GETSET_THIS)
- PyObject **dictptr = _PyObject_GetDictPtr(inst);
- if (dictptr != NULL) {
-   dict = *dictptr;
-   if (dict == NULL) {
-     dict = PyDict_New();
-     *dictptr = dict;
-   }
-   PyDict_SetItem(dict, SWIG_This(), swig_this);
-   return;
- }
-#endif
- dict = PyObject_GetAttrString(inst, (char*)"__dict__");
- PyDict_SetItem(dict, SWIG_This(), swig_this);
- Py_DECREF(dict);
-} 
-
-
-SWIGINTERN PyObject *
-SWIG_Python_InitShadowInstance(PyObject *args) {
-  PyObject *obj[2];
-  if (!SWIG_Python_UnpackTuple(args,(char*)"swiginit", 2, 2, obj)) {
-    return NULL;
-  } else {
-    PySwigObject *sthis = SWIG_Python_GetSwigThis(obj[0]);
-    if (sthis) {
-      PySwigObject_append((PyObject*) sthis, obj[1]);
-    } else {
-      SWIG_Python_SetSwigThis(obj[0], obj[1]);
-    }
-    return SWIG_Py_Void();
-  }
-}
-
-/* Create a new pointer object */
-
-SWIGRUNTIME PyObject *
-SWIG_Python_NewPointerObj(void *ptr, swig_type_info *type, int flags) {
-  if (!ptr) {
-    return SWIG_Py_Void();
-  } else {
-    int own = (flags & SWIG_POINTER_OWN) ? SWIG_POINTER_OWN : 0;
-    PyObject *robj = PySwigObject_New(ptr, type, own);
-    PySwigClientData *clientdata = type ? (PySwigClientData *)(type->clientdata) : 0;
-    if (clientdata && !(flags & SWIG_POINTER_NOSHADOW)) {
-      PyObject *inst = SWIG_Python_NewShadowInstance(clientdata, robj);
-      if (inst) {
-       Py_DECREF(robj);
-       robj = inst;
-      }
-    }
-    return robj;
-  }
-}
-
-/* Create a new packed object */
-
-SWIGRUNTIMEINLINE PyObject *
-SWIG_Python_NewPackedObj(void *ptr, size_t sz, swig_type_info *type) {
-  return ptr ? PySwigPacked_New((void *) ptr, sz, type) : SWIG_Py_Void();
-}
-
-/* -----------------------------------------------------------------------------*
- *  Get type list 
- * -----------------------------------------------------------------------------*/
-
-#ifdef SWIG_LINK_RUNTIME
-void *SWIG_ReturnGlobalTypeList(void *);
-#endif
-
-SWIGRUNTIME swig_module_info *
-SWIG_Python_GetModule(void) {
-  static void *type_pointer = (void *)0;
-  /* first check if module already created */
-  if (!type_pointer) {
-#ifdef SWIG_LINK_RUNTIME
-    type_pointer = SWIG_ReturnGlobalTypeList((void *)0);
-#else
-    type_pointer = PyCObject_Import((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
-                                   (char*)"type_pointer" SWIG_TYPE_TABLE_NAME);
-    if (PyErr_Occurred()) {
-      PyErr_Clear();
-      type_pointer = (void *)0;
-    }
-#endif
-  }
-  return (swig_module_info *) type_pointer;
-}
-
-#if PY_MAJOR_VERSION < 2
-/* PyModule_AddObject function was introduced in Python 2.0.  The following function
-   is copied out of Python/modsupport.c in python version 2.3.4 */
-SWIGINTERN int
-PyModule_AddObject(PyObject *m, char *name, PyObject *o)
-{
-  PyObject *dict;
-  if (!PyModule_Check(m)) {
-    PyErr_SetString(PyExc_TypeError,
-                   "PyModule_AddObject() needs module as first arg");
-    return SWIG_ERROR;
-  }
-  if (!o) {
-    PyErr_SetString(PyExc_TypeError,
-                   "PyModule_AddObject() needs non-NULL value");
-    return SWIG_ERROR;
-  }
-  
-  dict = PyModule_GetDict(m);
-  if (dict == NULL) {
-    /* Internal error -- modules must have a dict! */
-    PyErr_Format(PyExc_SystemError, "module '%s' has no __dict__",
-                PyModule_GetName(m));
-    return SWIG_ERROR;
-  }
-  if (PyDict_SetItemString(dict, name, o))
-    return SWIG_ERROR;
-  Py_DECREF(o);
-  return SWIG_OK;
-}
-#endif
-
-SWIGRUNTIME void
-SWIG_Python_DestroyModule(void *vptr)
-{
-  swig_module_info *swig_module = (swig_module_info *) vptr;
-  swig_type_info **types = swig_module->types;
-  size_t i;
-  for (i =0; i < swig_module->size; ++i) {
-    swig_type_info *ty = types[i];
-    if (ty->owndata) {
-      PySwigClientData *data = (PySwigClientData *) ty->clientdata;
-      if (data) PySwigClientData_Del(data);
-    }
-  }
-  Py_DECREF(SWIG_This());
-}
-
-SWIGRUNTIME void
-SWIG_Python_SetModule(swig_module_info *swig_module) {
-  static PyMethodDef swig_empty_runtime_method_table[] = { {NULL, NULL, 0, NULL} };/* Sentinel */
-
-  PyObject *module = Py_InitModule((char*)"swig_runtime_data" SWIG_RUNTIME_VERSION,
-                                  swig_empty_runtime_method_table);
-  PyObject *pointer = PyCObject_FromVoidPtr((void *) swig_module, SWIG_Python_DestroyModule);
-  if (pointer && module) {
-    PyModule_AddObject(module, (char*)"type_pointer" SWIG_TYPE_TABLE_NAME, pointer);
-  } else {
-    Py_XDECREF(pointer);
-  }
-}
-
-/* The python cached type query */
-SWIGRUNTIME PyObject *
-SWIG_Python_TypeCache(void) {
-  static PyObject *SWIG_STATIC_POINTER(cache) = PyDict_New();
-  return cache;
-}
-
-SWIGRUNTIME swig_type_info *
-SWIG_Python_TypeQuery(const char *type)
-{
-  PyObject *cache = SWIG_Python_TypeCache();
-  PyObject *key = PyString_FromString(type); 
-  PyObject *obj = PyDict_GetItem(cache, key);
-  swig_type_info *descriptor;
-  if (obj) {
-    descriptor = (swig_type_info *) PyCObject_AsVoidPtr(obj);
-  } else {
-    swig_module_info *swig_module = SWIG_Python_GetModule();
-    descriptor = SWIG_TypeQueryModule(swig_module, swig_module, type);
-    if (descriptor) {
-      obj = PyCObject_FromVoidPtr(descriptor, NULL);
-      PyDict_SetItem(cache, key, obj);
-      Py_DECREF(obj);
-    }
-  }
-  Py_DECREF(key);
-  return descriptor;
-}
-
-/* 
-   For backward compatibility only
-*/
-#define SWIG_POINTER_EXCEPTION  0
-#define SWIG_arg_fail(arg)      SWIG_Python_ArgFail(arg)
-#define SWIG_MustGetPtr(p, type, argnum, flags)  SWIG_Python_MustGetPtr(p, type, argnum, flags)
-
-SWIGRUNTIME int
-SWIG_Python_AddErrMesg(const char* mesg, int infront)
-{
-  if (PyErr_Occurred()) {
-    PyObject *type = 0;
-    PyObject *value = 0;
-    PyObject *traceback = 0;
-    PyErr_Fetch(&type, &value, &traceback);
-    if (value) {
-      PyObject *old_str = PyObject_Str(value);
-      Py_XINCREF(type);
-      PyErr_Clear();
-      if (infront) {
-       PyErr_Format(type, "%s %s", mesg, PyString_AsString(old_str));
-      } else {
-       PyErr_Format(type, "%s %s", PyString_AsString(old_str), mesg);
-      }
-      Py_DECREF(old_str);
-    }
-    return 1;
-  } else {
-    return 0;
-  }
-}
-  
-SWIGRUNTIME int
-SWIG_Python_ArgFail(int argnum)
-{
-  if (PyErr_Occurred()) {
-    /* add information about failing argument */
-    char mesg[256];
-    PyOS_snprintf(mesg, sizeof(mesg), "argument number %d:", argnum);
-    return SWIG_Python_AddErrMesg(mesg, 1);
-  } else {
-    return 0;
-  }
-}
-
-SWIGRUNTIMEINLINE const char *
-PySwigObject_GetDesc(PyObject *self)
-{
-  PySwigObject *v = (PySwigObject *)self;
-  swig_type_info *ty = v ? v->ty : 0;
-  return ty ? ty->str : (char*)"";
-}
-
-SWIGRUNTIME void
-SWIG_Python_TypeError(const char *type, PyObject *obj)
-{
-  if (type) {
-#if defined(SWIG_COBJECT_TYPES)
-    if (obj && PySwigObject_Check(obj)) {
-      const char *otype = (const char *) PySwigObject_GetDesc(obj);
-      if (otype) {
-       PyErr_Format(PyExc_TypeError, "a '%s' is expected, 'PySwigObject(%s)' is received",
-                    type, otype);
-       return;
-      }
-    } else 
-#endif      
-    {
-      const char *otype = (obj ? obj->ob_type->tp_name : 0); 
-      if (otype) {
-       PyObject *str = PyObject_Str(obj);
-       const char *cstr = str ? PyString_AsString(str) : 0;
-       if (cstr) {
-         PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s(%s)' is received",
-                      type, otype, cstr);
-       } else {
-         PyErr_Format(PyExc_TypeError, "a '%s' is expected, '%s' is received",
-                      type, otype);
-       }
-       Py_XDECREF(str);
-       return;
-      }
-    }   
-    PyErr_Format(PyExc_TypeError, "a '%s' is expected", type);
-  } else {
-    PyErr_Format(PyExc_TypeError, "unexpected type is received");
-  }
-}
-
-
-/* Convert a pointer value, signal an exception on a type mismatch */
-SWIGRUNTIME void *
-SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) {
-  void *result;
-  if (SWIG_Python_ConvertPtr(obj, &result, ty, flags) == -1) {
-    PyErr_Clear();
-    if (flags & SWIG_POINTER_EXCEPTION) {
-      SWIG_Python_TypeError(SWIG_TypePrettyName(ty), obj);
-      SWIG_Python_ArgFail(argnum);
-    }
-  }
-  return result;
-}
-
-
-#ifdef __cplusplus
-#if 0
-{ /* cc-mode */
-#endif
-}
-#endif
-
-
-
-#define SWIG_exception_fail(code, msg) do { SWIG_Error(code, msg); SWIG_fail; } while(0) 
-
-#define SWIG_contract_assert(expr, msg) if (!(expr)) { SWIG_Error(SWIG_RuntimeError, msg); SWIG_fail; } else 
-
-
-
-/* -------- TYPES TABLE (BEGIN) -------- */
-
-#define SWIGTYPE_p_TALLOC_CTX swig_types[0]
-#define SWIGTYPE_p_char swig_types[1]
-#define SWIGTYPE_p_cli_credentials swig_types[2]
-#define SWIGTYPE_p_event_context swig_types[3]
-#define SWIGTYPE_p_int swig_types[4]
-#define SWIGTYPE_p_ldb_context swig_types[5]
-#define SWIGTYPE_p_libnet_AddShare swig_types[6]
-#define SWIGTYPE_p_libnet_BecomeDC swig_types[7]
-#define SWIGTYPE_p_libnet_ChangePassword swig_types[8]
-#define SWIGTYPE_p_libnet_CreateUser swig_types[9]
-#define SWIGTYPE_p_libnet_DelShare swig_types[10]
-#define SWIGTYPE_p_libnet_DeleteUser swig_types[11]
-#define SWIGTYPE_p_libnet_DomainClose swig_types[12]
-#define SWIGTYPE_p_libnet_DomainList swig_types[13]
-#define SWIGTYPE_p_libnet_DomainOpen swig_types[14]
-#define SWIGTYPE_p_libnet_GroupInfo swig_types[15]
-#define SWIGTYPE_p_libnet_GroupList swig_types[16]
-#define SWIGTYPE_p_libnet_Join swig_types[17]
-#define SWIGTYPE_p_libnet_JoinDomain swig_types[18]
-#define SWIGTYPE_p_libnet_ListShares swig_types[19]
-#define SWIGTYPE_p_libnet_Lookup swig_types[20]
-#define SWIGTYPE_p_libnet_LookupDCs swig_types[21]
-#define SWIGTYPE_p_libnet_LookupName swig_types[22]
-#define SWIGTYPE_p_libnet_ModifyUser swig_types[23]
-#define SWIGTYPE_p_libnet_RemoteTOD swig_types[24]
-#define SWIGTYPE_p_libnet_RpcConnect swig_types[25]
-#define SWIGTYPE_p_libnet_SamDump swig_types[26]
-#define SWIGTYPE_p_libnet_SamDump_keytab swig_types[27]
-#define SWIGTYPE_p_libnet_SamSync swig_types[28]
-#define SWIGTYPE_p_libnet_SetPassword swig_types[29]
-#define SWIGTYPE_p_libnet_UnbecomeDC swig_types[30]
-#define SWIGTYPE_p_libnet_UserInfo swig_types[31]
-#define SWIGTYPE_p_libnet_UserList swig_types[32]
-#define SWIGTYPE_p_libnet_context swig_types[33]
-#define SWIGTYPE_p_libnet_samsync_ldb swig_types[34]
-#define SWIGTYPE_p_loadparm_context swig_types[35]
-#define SWIGTYPE_p_loadparm_service swig_types[36]
-#define SWIGTYPE_p_long_long swig_types[37]
-#define SWIGTYPE_p_param_context swig_types[38]
-#define SWIGTYPE_p_param_opt swig_types[39]
-#define SWIGTYPE_p_param_section swig_types[40]
-#define SWIGTYPE_p_short swig_types[41]
-#define SWIGTYPE_p_signed_char swig_types[42]
-#define SWIGTYPE_p_unsigned_char swig_types[43]
-#define SWIGTYPE_p_unsigned_int swig_types[44]
-#define SWIGTYPE_p_unsigned_long_long swig_types[45]
-#define SWIGTYPE_p_unsigned_short swig_types[46]
-static swig_type_info *swig_types[48];
-static swig_module_info swig_module = {swig_types, 47, 0, 0, 0, 0};
-#define SWIG_TypeQuery(name) SWIG_TypeQueryModule(&swig_module, &swig_module, name)
-#define SWIG_MangledTypeQuery(name) SWIG_MangledTypeQueryModule(&swig_module, &swig_module, name)
-
-/* -------- TYPES TABLE (END) -------- */
-
-#if (PY_VERSION_HEX <= 0x02000000)
-# if !defined(SWIG_PYTHON_CLASSIC)
-#  error "This python version requires swig to be run with the '-classic' option"
-# endif
-#endif
-#if (PY_VERSION_HEX <= 0x02020000)
-# error "This python version requires swig to be run with the '-nomodern' option"
-#endif
-#if (PY_VERSION_HEX <= 0x02020000)
-# error "This python version requires swig to be run with the '-nomodernargs' option"
-#endif
-#ifndef METH_O
-# error "This python version requires swig to be run with the '-nofastunpack' option"
-#endif
-#ifdef SWIG_TypeQuery
-# undef SWIG_TypeQuery
-#endif
-#define SWIG_TypeQuery SWIG_Python_TypeQuery
-
-/*-----------------------------------------------
-              @(target):= _net.so
-  ------------------------------------------------*/
-#define SWIG_init    init_net
-
-#define SWIG_name    "_net"
-
-#define SWIGVERSION 0x010333 
-#define SWIG_VERSION SWIGVERSION
-
-
-#define SWIG_as_voidptr(a) (void *)((const void *)(a)) 
-#define SWIG_as_voidptrptr(a) ((void)SWIG_as_voidptr(*a),(void**)(a)) 
-
-
-#include "includes.h"
-#include "libnet/libnet.h"
-#include "lib/events/events.h"
-#include "param/param.h"
-typedef struct libnet_context libnet;
-
-SWIGINTERN libnet *new_libnet(struct event_context *ev,struct loadparm_context *lp_ctx){
-            return libnet_context_init(ev, lp_ctx);
-        }
-#ifdef __cplusplus
-extern "C" {
-#endif
-SWIGINTERN PyObject *_wrap_libnet_cred_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  struct cli_credentials *arg2 = (struct cli_credentials *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject *swig_obj[2] ;
-  
-  if (!SWIG_Python_UnpackTuple(args,"libnet_cred_set",2,2,swig_obj)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_cred_set" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_cli_credentials, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "libnet_cred_set" "', argument " "2"" of type '" "struct cli_credentials *""'"); 
-  }
-  arg2 = (struct cli_credentials *)(argp2);
-  if (arg1) (arg1)->cred = arg2;
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_cred_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  struct cli_credentials *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_cred_get" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  result = (struct cli_credentials *) ((arg1)->cred);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_cli_credentials, 0 |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_new_libnet(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  struct event_context *arg1 = (struct event_context *) 0 ;
-  struct loadparm_context *arg2 = (struct loadparm_context *) 0 ;
-  libnet *result = 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "ev",(char *) "lp_ctx", NULL 
-  };
-  
-  arg1 = event_context_init(NULL);
-  arg2 = loadparm_init(NULL);
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|OO:new_libnet",kwnames,&obj0,&obj1)) SWIG_fail;
-  if (obj0) {
-    res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_event_context, 0 |  0 );
-    if (!SWIG_IsOK(res1)) {
-      SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "new_libnet" "', argument " "1"" of type '" "struct event_context *""'"); 
-    }
-    arg1 = (struct event_context *)(argp1);
-  }
-  if (obj1) {
-    res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_loadparm_context, 0 |  0 );
-    if (!SWIG_IsOK(res2)) {
-      SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "new_libnet" "', argument " "2"" of type '" "struct loadparm_context *""'"); 
-    }
-    arg2 = (struct loadparm_context *)(argp2);
-  }
-  result = (libnet *)new_libnet(arg1,arg2);
-  resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_libnet_context, SWIG_POINTER_NEW |  0 );
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_samsync_ldb(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_samsync_ldb *arg3 = (struct libnet_samsync_ldb *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_samsync_ldb",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_samsync_ldb" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_samsync_ldb, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_samsync_ldb" "', argument " "3"" of type '" "struct libnet_samsync_ldb *""'"); 
-  }
-  arg3 = (struct libnet_samsync_ldb *)(argp3);
-  result = libnet_samsync_ldb(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_DomainList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_DomainList *arg3 = (struct libnet_DomainList *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainList",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainList" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainList, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainList" "', argument " "3"" of type '" "struct libnet_DomainList *""'"); 
-  }
-  arg3 = (struct libnet_DomainList *)(argp3);
-  result = libnet_DomainList(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_DomainClose(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_DomainClose *arg3 = (struct libnet_DomainClose *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainClose",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainClose" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainClose, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainClose" "', argument " "3"" of type '" "struct libnet_DomainClose *""'"); 
-  }
-  arg3 = (struct libnet_DomainClose *)(argp3);
-  result = libnet_DomainClose(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_DomainOpen(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_DomainOpen *arg3 = (struct libnet_DomainOpen *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DomainOpen",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DomainOpen" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DomainOpen, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DomainOpen" "', argument " "3"" of type '" "struct libnet_DomainOpen *""'"); 
-  }
-  arg3 = (struct libnet_DomainOpen *)(argp3);
-  result = libnet_DomainOpen(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_LookupName(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_LookupName *arg3 = (struct libnet_LookupName *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupName",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupName" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_LookupName, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupName" "', argument " "3"" of type '" "struct libnet_LookupName *""'"); 
-  }
-  arg3 = (struct libnet_LookupName *)(argp3);
-  result = libnet_LookupName(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_LookupDCs(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_LookupDCs *arg3 = (struct libnet_LookupDCs *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupDCs",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupDCs" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_LookupDCs, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupDCs" "', argument " "3"" of type '" "struct libnet_LookupDCs *""'"); 
-  }
-  arg3 = (struct libnet_LookupDCs *)(argp3);
-  result = libnet_LookupDCs(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_LookupHost(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_Lookup *arg3 = (struct libnet_Lookup *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_LookupHost",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_LookupHost" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Lookup, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_LookupHost" "', argument " "3"" of type '" "struct libnet_Lookup *""'"); 
-  }
-  arg3 = (struct libnet_Lookup *)(argp3);
-  result = libnet_LookupHost(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_Lookup(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_Lookup *arg3 = (struct libnet_Lookup *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_Lookup",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_Lookup" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Lookup, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_Lookup" "', argument " "3"" of type '" "struct libnet_Lookup *""'"); 
-  }
-  arg3 = (struct libnet_Lookup *)(argp3);
-  result = libnet_Lookup(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_ListShares(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_ListShares *arg3 = (struct libnet_ListShares *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ListShares",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ListShares" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ListShares, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ListShares" "', argument " "3"" of type '" "struct libnet_ListShares *""'"); 
-  }
-  arg3 = (struct libnet_ListShares *)(argp3);
-  result = libnet_ListShares(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_AddShare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_AddShare *arg3 = (struct libnet_AddShare *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_AddShare",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_AddShare" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_AddShare, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_AddShare" "', argument " "3"" of type '" "struct libnet_AddShare *""'"); 
-  }
-  arg3 = (struct libnet_AddShare *)(argp3);
-  result = libnet_AddShare(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_DelShare(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_DelShare *arg3 = (struct libnet_DelShare *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DelShare",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DelShare" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DelShare, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DelShare" "', argument " "3"" of type '" "struct libnet_DelShare *""'"); 
-  }
-  arg3 = (struct libnet_DelShare *)(argp3);
-  result = libnet_DelShare(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_GroupList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_GroupList *arg3 = (struct libnet_GroupList *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_GroupList",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_GroupList" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_GroupList, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_GroupList" "', argument " "3"" of type '" "struct libnet_GroupList *""'"); 
-  }
-  arg3 = (struct libnet_GroupList *)(argp3);
-  result = libnet_GroupList(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_GroupInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_GroupInfo *arg3 = (struct libnet_GroupInfo *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "io", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_GroupInfo",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_GroupInfo" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_GroupInfo, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_GroupInfo" "', argument " "3"" of type '" "struct libnet_GroupInfo *""'"); 
-  }
-  arg3 = (struct libnet_GroupInfo *)(argp3);
-  result = libnet_GroupInfo(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_UserList(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_UserList *arg3 = (struct libnet_UserList *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UserList",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UserList" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UserList, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UserList" "', argument " "3"" of type '" "struct libnet_UserList *""'"); 
-  }
-  arg3 = (struct libnet_UserList *)(argp3);
-  result = libnet_UserList(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_UserInfo(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_UserInfo *arg3 = (struct libnet_UserInfo *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UserInfo",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UserInfo" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UserInfo, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UserInfo" "', argument " "3"" of type '" "struct libnet_UserInfo *""'"); 
-  }
-  arg3 = (struct libnet_UserInfo *)(argp3);
-  result = libnet_UserInfo(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_ModifyUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_ModifyUser *arg3 = (struct libnet_ModifyUser *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ModifyUser",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ModifyUser" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ModifyUser, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ModifyUser" "', argument " "3"" of type '" "struct libnet_ModifyUser *""'"); 
-  }
-  arg3 = (struct libnet_ModifyUser *)(argp3);
-  result = libnet_ModifyUser(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_DeleteUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_DeleteUser *arg3 = (struct libnet_DeleteUser *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_DeleteUser",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_DeleteUser" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_DeleteUser, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_DeleteUser" "', argument " "3"" of type '" "struct libnet_DeleteUser *""'"); 
-  }
-  arg3 = (struct libnet_DeleteUser *)(argp3);
-  result = libnet_DeleteUser(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_CreateUser(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_CreateUser *arg3 = (struct libnet_CreateUser *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_CreateUser",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_CreateUser" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_CreateUser, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_CreateUser" "', argument " "3"" of type '" "struct libnet_CreateUser *""'"); 
-  }
-  arg3 = (struct libnet_CreateUser *)(argp3);
-  result = libnet_CreateUser(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_SamDump_keytab(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_SamDump_keytab *arg3 = (struct libnet_SamDump_keytab *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamDump_keytab",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamDump_keytab" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamDump_keytab, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamDump_keytab" "', argument " "3"" of type '" "struct libnet_SamDump_keytab *""'"); 
-  }
-  arg3 = (struct libnet_SamDump_keytab *)(argp3);
-  result = libnet_SamDump_keytab(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_SamDump(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_SamDump *arg3 = (struct libnet_SamDump *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamDump",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamDump" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamDump, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamDump" "', argument " "3"" of type '" "struct libnet_SamDump *""'"); 
-  }
-  arg3 = (struct libnet_SamDump *)(argp3);
-  result = libnet_SamDump(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_SamSync_netlogon(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_SamSync *arg3 = (struct libnet_SamSync *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SamSync_netlogon",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SamSync_netlogon" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SamSync, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SamSync_netlogon" "', argument " "3"" of type '" "struct libnet_SamSync *""'"); 
-  }
-  arg3 = (struct libnet_SamSync *)(argp3);
-  result = libnet_SamSync_netlogon(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_UnbecomeDC(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_UnbecomeDC *arg3 = (struct libnet_UnbecomeDC *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_UnbecomeDC",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_UnbecomeDC" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_UnbecomeDC, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_UnbecomeDC" "', argument " "3"" of type '" "struct libnet_UnbecomeDC *""'"); 
-  }
-  arg3 = (struct libnet_UnbecomeDC *)(argp3);
-  result = libnet_UnbecomeDC(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_BecomeDC(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_BecomeDC *arg3 = (struct libnet_BecomeDC *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_BecomeDC",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_BecomeDC" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_BecomeDC, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_BecomeDC" "', argument " "3"" of type '" "struct libnet_BecomeDC *""'"); 
-  }
-  arg3 = (struct libnet_BecomeDC *)(argp3);
-  result = libnet_BecomeDC(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_JoinSite(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  struct ldb_context *arg2 = (struct ldb_context *) 0 ;
-  struct libnet_JoinDomain *arg3 = (struct libnet_JoinDomain *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp2 = 0 ;
-  int res2 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  PyObject * obj2 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "remote_ldb",(char *) "libnet_r", NULL 
-  };
-  
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO:libnet_JoinSite",kwnames,&obj0,&obj1,&obj2)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_JoinSite" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_ldb_context, 0 |  0 );
-  if (!SWIG_IsOK(res2)) {
-    SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "libnet_JoinSite" "', argument " "2"" of type '" "struct ldb_context *""'"); 
-  }
-  arg2 = (struct ldb_context *)(argp2);
-  res3 = SWIG_ConvertPtr(obj2, &argp3,SWIGTYPE_p_libnet_JoinDomain, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_JoinSite" "', argument " "3"" of type '" "struct libnet_JoinDomain *""'"); 
-  }
-  arg3 = (struct libnet_JoinDomain *)(argp3);
-  result = libnet_JoinSite(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_JoinDomain(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_JoinDomain *arg3 = (struct libnet_JoinDomain *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_JoinDomain",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_JoinDomain" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_JoinDomain, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_JoinDomain" "', argument " "3"" of type '" "struct libnet_JoinDomain *""'"); 
-  }
-  arg3 = (struct libnet_JoinDomain *)(argp3);
-  result = libnet_JoinDomain(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_Join(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_Join *arg3 = (struct libnet_Join *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_Join",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_Join" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_Join, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_Join" "', argument " "3"" of type '" "struct libnet_Join *""'"); 
-  }
-  arg3 = (struct libnet_Join *)(argp3);
-  result = libnet_Join(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_RpcConnect(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  struct libnet_RpcConnect *arg3 = (struct libnet_RpcConnect *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_RpcConnect",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_RpcConnect" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_RpcConnect, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_RpcConnect" "', argument " "3"" of type '" "struct libnet_RpcConnect *""'"); 
-  }
-  arg3 = (struct libnet_RpcConnect *)(argp3);
-  result = libnet_RpcConnect(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_RemoteTOD(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  union libnet_RemoteTOD *arg3 = (union libnet_RemoteTOD *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_RemoteTOD",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_RemoteTOD" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_RemoteTOD, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_RemoteTOD" "', argument " "3"" of type '" "union libnet_RemoteTOD *""'"); 
-  }
-  arg3 = (union libnet_RemoteTOD *)(argp3);
-  result = libnet_RemoteTOD(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_ChangePassword(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  union libnet_ChangePassword *arg3 = (union libnet_ChangePassword *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_ChangePassword",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_ChangePassword" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_ChangePassword, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_ChangePassword" "', argument " "3"" of type '" "union libnet_ChangePassword *""'"); 
-  }
-  arg3 = (union libnet_ChangePassword *)(argp3);
-  result = libnet_ChangePassword(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_libnet_SetPassword(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  TALLOC_CTX *arg2 = (TALLOC_CTX *) 0 ;
-  union libnet_SetPassword *arg3 = (union libnet_SetPassword *) 0 ;
-  NTSTATUS result;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  void *argp3 = 0 ;
-  int res3 = 0 ;
-  PyObject * obj0 = 0 ;
-  PyObject * obj1 = 0 ;
-  char *  kwnames[] = {
-    (char *) "self",(char *) "r", NULL 
-  };
-  
-  arg2 = NULL;
-  if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:libnet_SetPassword",kwnames,&obj0,&obj1)) SWIG_fail;
-  res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_libnet_context, 0 |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "libnet_SetPassword" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  res3 = SWIG_ConvertPtr(obj1, &argp3,SWIGTYPE_p_libnet_SetPassword, 0 |  0 );
-  if (!SWIG_IsOK(res3)) {
-    SWIG_exception_fail(SWIG_ArgError(res3), "in method '" "libnet_SetPassword" "', argument " "3"" of type '" "union libnet_SetPassword *""'"); 
-  }
-  arg3 = (union libnet_SetPassword *)(argp3);
-  result = libnet_SetPassword(arg1,arg2,arg3);
-  if (NT_STATUS_IS_ERR(result)) {
-    PyObject *obj = Py_BuildValue((char *)"(i,s)", NT_STATUS_V(result), nt_errstr(result));
-    PyErr_SetObject(PyExc_RuntimeError, obj);
-    SWIG_fail;
-  } else if (resultobj == NULL) {
-    resultobj = Py_None;
-  }
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *_wrap_delete_libnet(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *resultobj = 0;
-  libnet *arg1 = (libnet *) 0 ;
-  void *argp1 = 0 ;
-  int res1 = 0 ;
-  PyObject *swig_obj[1] ;
-  
-  if (!args) SWIG_fail;
-  swig_obj[0] = args;
-  res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_libnet_context, SWIG_POINTER_DISOWN |  0 );
-  if (!SWIG_IsOK(res1)) {
-    SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_libnet" "', argument " "1"" of type '" "libnet *""'"); 
-  }
-  arg1 = (libnet *)(argp1);
-  free((char *) arg1);
-  
-  resultobj = SWIG_Py_Void();
-  return resultobj;
-fail:
-  return NULL;
-}
-
-
-SWIGINTERN PyObject *libnet_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  PyObject *obj;
-  if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL;
-  SWIG_TypeNewClientData(SWIGTYPE_p_libnet_context, SWIG_NewClientData(obj));
-  return SWIG_Py_Void();
-}
-
-SWIGINTERN PyObject *libnet_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) {
-  return SWIG_Python_InitShadowInstance(args);
-}
-
-static PyMethodDef SwigMethods[] = {
-        { (char *)"libnet_cred_set", _wrap_libnet_cred_set, METH_VARARGS, NULL},
-        { (char *)"libnet_cred_get", (PyCFunction)_wrap_libnet_cred_get, METH_O, NULL},
-        { (char *)"new_libnet", (PyCFunction) _wrap_new_libnet, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_samsync_ldb", (PyCFunction) _wrap_libnet_samsync_ldb, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_DomainList", (PyCFunction) _wrap_libnet_DomainList, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_DomainClose", (PyCFunction) _wrap_libnet_DomainClose, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_DomainOpen", (PyCFunction) _wrap_libnet_DomainOpen, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_LookupName", (PyCFunction) _wrap_libnet_LookupName, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_LookupDCs", (PyCFunction) _wrap_libnet_LookupDCs, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_LookupHost", (PyCFunction) _wrap_libnet_LookupHost, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_Lookup", (PyCFunction) _wrap_libnet_Lookup, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_ListShares", (PyCFunction) _wrap_libnet_ListShares, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_AddShare", (PyCFunction) _wrap_libnet_AddShare, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_DelShare", (PyCFunction) _wrap_libnet_DelShare, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_GroupList", (PyCFunction) _wrap_libnet_GroupList, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_GroupInfo", (PyCFunction) _wrap_libnet_GroupInfo, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_UserList", (PyCFunction) _wrap_libnet_UserList, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_UserInfo", (PyCFunction) _wrap_libnet_UserInfo, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_ModifyUser", (PyCFunction) _wrap_libnet_ModifyUser, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_DeleteUser", (PyCFunction) _wrap_libnet_DeleteUser, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_CreateUser", (PyCFunction) _wrap_libnet_CreateUser, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_SamDump_keytab", (PyCFunction) _wrap_libnet_SamDump_keytab, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_SamDump", (PyCFunction) _wrap_libnet_SamDump, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_SamSync_netlogon", (PyCFunction) _wrap_libnet_SamSync_netlogon, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_UnbecomeDC", (PyCFunction) _wrap_libnet_UnbecomeDC, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_BecomeDC", (PyCFunction) _wrap_libnet_BecomeDC, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_JoinSite", (PyCFunction) _wrap_libnet_JoinSite, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_JoinDomain", (PyCFunction) _wrap_libnet_JoinDomain, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_Join", (PyCFunction) _wrap_libnet_Join, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_RpcConnect", (PyCFunction) _wrap_libnet_RpcConnect, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_RemoteTOD", (PyCFunction) _wrap_libnet_RemoteTOD, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_ChangePassword", (PyCFunction) _wrap_libnet_ChangePassword, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"libnet_SetPassword", (PyCFunction) _wrap_libnet_SetPassword, METH_VARARGS | METH_KEYWORDS, NULL},
-        { (char *)"delete_libnet", (PyCFunction)_wrap_delete_libnet, METH_O, NULL},
-        { (char *)"libnet_swigregister", libnet_swigregister, METH_VARARGS, NULL},
-        { (char *)"libnet_swiginit", libnet_swiginit, METH_VARARGS, NULL},
-        { NULL, NULL, 0, NULL }
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (BEGIN) -------- */
-
-static swig_type_info _swigt__p_TALLOC_CTX = {"_p_TALLOC_CTX", "TALLOC_CTX *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_char = {"_p_char", "char *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_cli_credentials = {"_p_cli_credentials", "struct cli_credentials *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_event_context = {"_p_event_context", "struct event_context *|event *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_int = {"_p_int", "intptr_t *|int *|int_least32_t *|int_fast32_t *|int32_t *|int_fast16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_ldb_context = {"_p_ldb_context", "struct ldb_context *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_AddShare = {"_p_libnet_AddShare", "struct libnet_AddShare *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_BecomeDC = {"_p_libnet_BecomeDC", "struct libnet_BecomeDC *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_ChangePassword = {"_p_libnet_ChangePassword", "union libnet_ChangePassword *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_CreateUser = {"_p_libnet_CreateUser", "struct libnet_CreateUser *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_DelShare = {"_p_libnet_DelShare", "struct libnet_DelShare *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_DeleteUser = {"_p_libnet_DeleteUser", "struct libnet_DeleteUser *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_DomainClose = {"_p_libnet_DomainClose", "struct libnet_DomainClose *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_DomainList = {"_p_libnet_DomainList", "struct libnet_DomainList *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_DomainOpen = {"_p_libnet_DomainOpen", "struct libnet_DomainOpen *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_GroupInfo = {"_p_libnet_GroupInfo", "struct libnet_GroupInfo *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_GroupList = {"_p_libnet_GroupList", "struct libnet_GroupList *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_Join = {"_p_libnet_Join", "struct libnet_Join *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_JoinDomain = {"_p_libnet_JoinDomain", "struct libnet_JoinDomain *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_ListShares = {"_p_libnet_ListShares", "struct libnet_ListShares *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_Lookup = {"_p_libnet_Lookup", "struct libnet_Lookup *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_LookupDCs = {"_p_libnet_LookupDCs", "struct libnet_LookupDCs *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_LookupName = {"_p_libnet_LookupName", "struct libnet_LookupName *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_ModifyUser = {"_p_libnet_ModifyUser", "struct libnet_ModifyUser *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_RemoteTOD = {"_p_libnet_RemoteTOD", "union libnet_RemoteTOD *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_RpcConnect = {"_p_libnet_RpcConnect", "struct libnet_RpcConnect *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_SamDump = {"_p_libnet_SamDump", "struct libnet_SamDump *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_SamDump_keytab = {"_p_libnet_SamDump_keytab", "struct libnet_SamDump_keytab *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_SamSync = {"_p_libnet_SamSync", "struct libnet_SamSync *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_SetPassword = {"_p_libnet_SetPassword", "union libnet_SetPassword *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_UnbecomeDC = {"_p_libnet_UnbecomeDC", "struct libnet_UnbecomeDC *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_UserInfo = {"_p_libnet_UserInfo", "struct libnet_UserInfo *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_UserList = {"_p_libnet_UserList", "struct libnet_UserList *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_context = {"_p_libnet_context", "struct libnet_context *|libnet *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_libnet_samsync_ldb = {"_p_libnet_samsync_ldb", "struct libnet_samsync_ldb *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_loadparm_context = {"_p_loadparm_context", "struct loadparm_context *|loadparm_context *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_loadparm_service = {"_p_loadparm_service", "struct loadparm_service *|loadparm_service *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_long_long = {"_p_long_long", "int_least64_t *|int_fast64_t *|int64_t *|long long *|intmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_param_context = {"_p_param_context", "struct param_context *|param *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_param_opt = {"_p_param_opt", "struct param_opt *|param_opt *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_param_section = {"_p_param_section", "struct param_section *|param_section *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_short = {"_p_short", "short *|int_least16_t *|int16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_signed_char = {"_p_signed_char", "signed char *|int_least8_t *|int_fast8_t *|int8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_char = {"_p_unsigned_char", "unsigned char *|uint_least8_t *|uint_fast8_t *|uint8_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_int = {"_p_unsigned_int", "uintptr_t *|uint_least32_t *|uint_fast32_t *|uint32_t *|unsigned int *|uint_fast16_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_long_long = {"_p_unsigned_long_long", "uint_least64_t *|uint_fast64_t *|uint64_t *|unsigned long long *|uintmax_t *", 0, 0, (void*)0, 0};
-static swig_type_info _swigt__p_unsigned_short = {"_p_unsigned_short", "unsigned short *|uint_least16_t *|uint16_t *", 0, 0, (void*)0, 0};
-
-static swig_type_info *swig_type_initial[] = {
-  &_swigt__p_TALLOC_CTX,
-  &_swigt__p_char,
-  &_swigt__p_cli_credentials,
-  &_swigt__p_event_context,
-  &_swigt__p_int,
-  &_swigt__p_ldb_context,
-  &_swigt__p_libnet_AddShare,
-  &_swigt__p_libnet_BecomeDC,
-  &_swigt__p_libnet_ChangePassword,
-  &_swigt__p_libnet_CreateUser,
-  &_swigt__p_libnet_DelShare,
-  &_swigt__p_libnet_DeleteUser,
-  &_swigt__p_libnet_DomainClose,
-  &_swigt__p_libnet_DomainList,
-  &_swigt__p_libnet_DomainOpen,
-  &_swigt__p_libnet_GroupInfo,
-  &_swigt__p_libnet_GroupList,
-  &_swigt__p_libnet_Join,
-  &_swigt__p_libnet_JoinDomain,
-  &_swigt__p_libnet_ListShares,
-  &_swigt__p_libnet_Lookup,
-  &_swigt__p_libnet_LookupDCs,
-  &_swigt__p_libnet_LookupName,
-  &_swigt__p_libnet_ModifyUser,
-  &_swigt__p_libnet_RemoteTOD,
-  &_swigt__p_libnet_RpcConnect,
-  &_swigt__p_libnet_SamDump,
-  &_swigt__p_libnet_SamDump_keytab,
-  &_swigt__p_libnet_SamSync,
-  &_swigt__p_libnet_SetPassword,
-  &_swigt__p_libnet_UnbecomeDC,
-  &_swigt__p_libnet_UserInfo,
-  &_swigt__p_libnet_UserList,
-  &_swigt__p_libnet_context,
-  &_swigt__p_libnet_samsync_ldb,
-  &_swigt__p_loadparm_context,
-  &_swigt__p_loadparm_service,
-  &_swigt__p_long_long,
-  &_swigt__p_param_context,
-  &_swigt__p_param_opt,
-  &_swigt__p_param_section,
-  &_swigt__p_short,
-  &_swigt__p_signed_char,
-  &_swigt__p_unsigned_char,
-  &_swigt__p_unsigned_int,
-  &_swigt__p_unsigned_long_long,
-  &_swigt__p_unsigned_short,
-};
-
-static swig_cast_info _swigc__p_TALLOC_CTX[] = {  {&_swigt__p_TALLOC_CTX, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_char[] = {  {&_swigt__p_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_cli_credentials[] = {  {&_swigt__p_cli_credentials, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_event_context[] = {  {&_swigt__p_event_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_int[] = {  {&_swigt__p_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_ldb_context[] = {  {&_swigt__p_ldb_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_AddShare[] = {  {&_swigt__p_libnet_AddShare, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_BecomeDC[] = {  {&_swigt__p_libnet_BecomeDC, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_ChangePassword[] = {  {&_swigt__p_libnet_ChangePassword, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_CreateUser[] = {  {&_swigt__p_libnet_CreateUser, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_DelShare[] = {  {&_swigt__p_libnet_DelShare, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_DeleteUser[] = {  {&_swigt__p_libnet_DeleteUser, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_DomainClose[] = {  {&_swigt__p_libnet_DomainClose, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_DomainList[] = {  {&_swigt__p_libnet_DomainList, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_DomainOpen[] = {  {&_swigt__p_libnet_DomainOpen, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_GroupInfo[] = {  {&_swigt__p_libnet_GroupInfo, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_GroupList[] = {  {&_swigt__p_libnet_GroupList, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_Join[] = {  {&_swigt__p_libnet_Join, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_JoinDomain[] = {  {&_swigt__p_libnet_JoinDomain, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_ListShares[] = {  {&_swigt__p_libnet_ListShares, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_Lookup[] = {  {&_swigt__p_libnet_Lookup, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_LookupDCs[] = {  {&_swigt__p_libnet_LookupDCs, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_LookupName[] = {  {&_swigt__p_libnet_LookupName, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_ModifyUser[] = {  {&_swigt__p_libnet_ModifyUser, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_RemoteTOD[] = {  {&_swigt__p_libnet_RemoteTOD, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_RpcConnect[] = {  {&_swigt__p_libnet_RpcConnect, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_SamDump[] = {  {&_swigt__p_libnet_SamDump, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_SamDump_keytab[] = {  {&_swigt__p_libnet_SamDump_keytab, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_SamSync[] = {  {&_swigt__p_libnet_SamSync, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_SetPassword[] = {  {&_swigt__p_libnet_SetPassword, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_UnbecomeDC[] = {  {&_swigt__p_libnet_UnbecomeDC, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_UserInfo[] = {  {&_swigt__p_libnet_UserInfo, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_UserList[] = {  {&_swigt__p_libnet_UserList, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_context[] = {  {&_swigt__p_libnet_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_libnet_samsync_ldb[] = {  {&_swigt__p_libnet_samsync_ldb, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_loadparm_context[] = {  {&_swigt__p_loadparm_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_loadparm_service[] = {  {&_swigt__p_loadparm_service, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_long_long[] = {  {&_swigt__p_long_long, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_param_context[] = {  {&_swigt__p_param_context, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_param_opt[] = {  {&_swigt__p_param_opt, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_param_section[] = {  {&_swigt__p_param_section, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_short[] = {  {&_swigt__p_short, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_signed_char[] = {  {&_swigt__p_signed_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_char[] = {  {&_swigt__p_unsigned_char, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_int[] = {  {&_swigt__p_unsigned_int, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_long_long[] = {  {&_swigt__p_unsigned_long_long, 0, 0, 0},{0, 0, 0, 0}};
-static swig_cast_info _swigc__p_unsigned_short[] = {  {&_swigt__p_unsigned_short, 0, 0, 0},{0, 0, 0, 0}};
-
-static swig_cast_info *swig_cast_initial[] = {
-  _swigc__p_TALLOC_CTX,
-  _swigc__p_char,
-  _swigc__p_cli_credentials,
-  _swigc__p_event_context,
-  _swigc__p_int,
-  _swigc__p_ldb_context,
-  _swigc__p_libnet_AddShare,
-  _swigc__p_libnet_BecomeDC,
-  _swigc__p_libnet_ChangePassword,
-  _swigc__p_libnet_CreateUser,
-  _swigc__p_libnet_DelShare,
-  _swigc__p_libnet_DeleteUser,
-  _swigc__p_libnet_DomainClose,
-  _swigc__p_libnet_DomainList,
-  _swigc__p_libnet_DomainOpen,
-  _swigc__p_libnet_GroupInfo,
-  _swigc__p_libnet_GroupList,
-  _swigc__p_libnet_Join,
-  _swigc__p_libnet_JoinDomain,
-  _swigc__p_libnet_ListShares,
-  _swigc__p_libnet_Lookup,
-  _swigc__p_libnet_LookupDCs,
-  _swigc__p_libnet_LookupName,
-  _swigc__p_libnet_ModifyUser,
-  _swigc__p_libnet_RemoteTOD,
-  _swigc__p_libnet_RpcConnect,
-  _swigc__p_libnet_SamDump,
-  _swigc__p_libnet_SamDump_keytab,
-  _swigc__p_libnet_SamSync,
-  _swigc__p_libnet_SetPassword,
-  _swigc__p_libnet_UnbecomeDC,
-  _swigc__p_libnet_UserInfo,
-  _swigc__p_libnet_UserList,
-  _swigc__p_libnet_context,
-  _swigc__p_libnet_samsync_ldb,
-  _swigc__p_loadparm_context,
-  _swigc__p_loadparm_service,
-  _swigc__p_long_long,
-  _swigc__p_param_context,
-  _swigc__p_param_opt,
-  _swigc__p_param_section,
-  _swigc__p_short,
-  _swigc__p_signed_char,
-  _swigc__p_unsigned_char,
-  _swigc__p_unsigned_int,
-  _swigc__p_unsigned_long_long,
-  _swigc__p_unsigned_short,
-};
-
-
-/* -------- TYPE CONVERSION AND EQUIVALENCE RULES (END) -------- */
-
-static swig_const_info swig_const_table[] = {
-{0, 0, 0, 0.0, 0, 0}};
-
-#ifdef __cplusplus
-}
-#endif
-/* -----------------------------------------------------------------------------
- * Type initialization:
- * This problem is tough by the requirement that no dynamic 
- * memory is used. Also, since swig_type_info structures store pointers to 
- * swig_cast_info structures and swig_cast_info structures store pointers back
- * to swig_type_info structures, we need some lookup code at initialization. 
- * The idea is that swig generates all the structures that are needed. 
- * The runtime then collects these partially filled structures. 
- * The SWIG_InitializeModule function takes these initial arrays out of 
- * swig_module, and does all the lookup, filling in the swig_module.types
- * array with the correct data and linking the correct swig_cast_info
- * structures together.
- *
- * The generated swig_type_info structures are assigned staticly to an initial 
- * array. We just loop through that array, and handle each type individually.
- * First we lookup if this type has been already loaded, and if so, use the
- * loaded structure instead of the generated one. Then we have to fill in the
- * cast linked list. The cast data is initially stored in something like a
- * two-dimensional array. Each row corresponds to a type (there are the same
- * number of rows as there are in the swig_type_initial array). Each entry in
- * a column is one of the swig_cast_info structures for that type.
- * The cast_initial array is actually an array of arrays, because each row has
- * a variable number of columns. So to actually build the cast linked list,
- * we find the array of casts associated with the type, and loop through it 
- * adding the casts to the list. The one last trick we need to do is making
- * sure the type pointer in the swig_cast_info struct is correct.
- *
- * First off, we lookup the cast->type name to see if it is already loaded. 
- * There are three cases to handle:
- *  1) If the cast->type has already been loaded AND the type we are adding
- *     casting info to has not been loaded (it is in this module), THEN we
- *     replace the cast->type pointer with the type pointer that has already
- *     been loaded.
- *  2) If BOTH types (the one we are adding casting info to, and the 
- *     cast->type) are loaded, THEN the cast info has already been loaded by
- *     the previous module so we just ignore it.
- *  3) Finally, if cast->type has not already been loaded, then we add that
- *     swig_cast_info to the linked list (because the cast->type) pointer will
- *     be correct.
- * ----------------------------------------------------------------------------- */
-
-#ifdef __cplusplus
-extern "C" {
-#if 0
-} /* c-mode */
-#endif
-#endif
-
-#if 0
-#define SWIGRUNTIME_DEBUG
-#endif
-
-
-SWIGRUNTIME void
-SWIG_InitializeModule(void *clientdata) {
-  size_t i;
-  swig_module_info *module_head, *iter;
-  int found;
-  
-  clientdata = clientdata;
-  
-  /* check to see if the circular list has been setup, if not, set it up */
-  if (swig_module.next==0) {
-    /* Initialize the swig_module */
-    swig_module.type_initial = swig_type_initial;
-    swig_module.cast_initial = swig_cast_initial;
-    swig_module.next = &swig_module;
-  }
-  
-  /* Try and load any already created modules */
-  module_head = SWIG_GetModule(clientdata);
-  if (!module_head) {
-    /* This is the first module loaded for this interpreter */
-    /* so set the swig module into the interpreter */
-    SWIG_SetModule(clientdata, &swig_module);
-    module_head = &swig_module;
-  } else {
-    /* the interpreter has loaded a SWIG module, but has it loaded this one? */
-    found=0;
-    iter=module_head;
-    do {
-      if (iter==&swig_module) {
-        found=1;
-        break;
-      }
-      iter=iter->next;
-    } while (iter!= module_head);
-    
-    /* if the is found in the list, then all is done and we may leave */
-    if (found) return;
-    /* otherwise we must add out module into the list */
-    swig_module.next = module_head->next;
-    module_head->next = &swig_module;
-  }
-  
-  /* Now work on filling in swig_module.types */
-#ifdef SWIGRUNTIME_DEBUG
-  printf("SWIG_InitializeModule: size %d\n", swig_module.size);
-#endif
-  for (i = 0; i < swig_module.size; ++i) {
-    swig_type_info *type = 0;
-    swig_type_info *ret;
-    swig_cast_info *cast;
-    
-#ifdef SWIGRUNTIME_DEBUG
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-#endif
-    
-    /* if there is another module already loaded */
-    if (swig_module.next != &swig_module) {
-      type = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, swig_module.type_initial[i]->name);
-    }
-    if (type) {
-      /* Overwrite clientdata field */
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: found type %s\n", type->name);
-#endif
-      if (swig_module.type_initial[i]->clientdata) {
-        type->clientdata = swig_module.type_initial[i]->clientdata;
-#ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: found and overwrite type %s \n", type->name);
-#endif
-      }
-    } else {
-      type = swig_module.type_initial[i];
-    }
-    
-    /* Insert casting types */
-    cast = swig_module.cast_initial[i];
-    while (cast->type) {
-      /* Don't need to add information already in the list */
-      ret = 0;
-#ifdef SWIGRUNTIME_DEBUG
-      printf("SWIG_InitializeModule: look cast %s\n", cast->type->name);
-#endif
-      if (swig_module.next != &swig_module) {
-        ret = SWIG_MangledTypeQueryModule(swig_module.next, &swig_module, cast->type->name);
-#ifdef SWIGRUNTIME_DEBUG
-        if (ret) printf("SWIG_InitializeModule: found cast %s\n", ret->name);
-#endif
-      }
-      if (ret) {
-        if (type == swig_module.type_initial[i]) {
-#ifdef SWIGRUNTIME_DEBUG
-          printf("SWIG_InitializeModule: skip old type %s\n", ret->name);
-#endif
-          cast->type = ret;
-          ret = 0;
-        } else {
-          /* Check for casting already in the list */
-          swig_cast_info *ocast = SWIG_TypeCheck(ret->name, type);
-#ifdef SWIGRUNTIME_DEBUG
-          if (ocast) printf("SWIG_InitializeModule: skip old cast %s\n", ret->name);
-#endif
-          if (!ocast) ret = 0;
-        }
-      }
-      
-      if (!ret) {
-#ifdef SWIGRUNTIME_DEBUG
-        printf("SWIG_InitializeModule: adding cast %s\n", cast->type->name);
-#endif
-        if (type->cast) {
-          type->cast->prev = cast;
-          cast->next = type->cast;
-        }
-        type->cast = cast;
-      }
-      cast++;
-    }
-    /* Set entry in modules->types array equal to the type */
-    swig_module.types[i] = type;
-  }
-  swig_module.types[i] = 0;
-  
-#ifdef SWIGRUNTIME_DEBUG
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-  for (i = 0; i < swig_module.size; ++i) {
-    int j = 0;
-    swig_cast_info *cast = swig_module.cast_initial[i];
-    printf("SWIG_InitializeModule: type %d %s\n", i, swig_module.type_initial[i]->name);
-    while (cast->type) {
-      printf("SWIG_InitializeModule: cast type %s\n", cast->type->name);
-      cast++;
-      ++j;
-    }
-    printf("---- Total casts: %d\n",j);
-  }
-  printf("**** SWIG_InitializeModule: Cast List ******\n");
-#endif
-}
-
-/* This function will propagate the clientdata field of type to
-* any new swig_type_info structures that have been added into the list
-* of equivalent types.  It is like calling
-* SWIG_TypeClientData(type, clientdata) a second time.
-*/
-SWIGRUNTIME void
-SWIG_PropagateClientData(void) {
-  size_t i;
-  swig_cast_info *equiv;
-  static int init_run = 0;
-  
-  if (init_run) return;
-  init_run = 1;
-  
-  for (i = 0; i < swig_module.size; i++) {
-    if (swig_module.types[i]->clientdata) {
-      equiv = swig_module.types[i]->cast;
-      while (equiv) {
-        if (!equiv->converter) {
-          if (equiv->type && !equiv->type->clientdata)
-          SWIG_TypeClientData(equiv->type, swig_module.types[i]->clientdata);
-        }
-        equiv = equiv->next;
-      }
-    }
-  }
-}
-
-#ifdef __cplusplus
-#if 0
-{
-  /* c-mode */
-#endif
-}
-#endif
-
-
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-  
-  /* Python-specific SWIG API */
-#define SWIG_newvarlink()                             SWIG_Python_newvarlink()
-#define SWIG_addvarlink(p, name, get_attr, set_attr)  SWIG_Python_addvarlink(p, name, get_attr, set_attr)
-#define SWIG_InstallConstants(d, constants)           SWIG_Python_InstallConstants(d, constants)
-  
-  /* -----------------------------------------------------------------------------
-   * global variable support code.
-   * ----------------------------------------------------------------------------- */
-  
-  typedef struct swig_globalvar {
-    char       *name;                  /* Name of global variable */
-    PyObject *(*get_attr)(void);       /* Return the current value */
-    int       (*set_attr)(PyObject *); /* Set the value */
-    struct swig_globalvar *next;
-  } swig_globalvar;
-  
-  typedef struct swig_varlinkobject {
-    PyObject_HEAD
-    swig_globalvar *vars;
-  } swig_varlinkobject;
-  
-  SWIGINTERN PyObject *
-  swig_varlink_repr(swig_varlinkobject *SWIGUNUSEDPARM(v)) {
-    return PyString_FromString("<Swig global variables>");
-  }
-  
-  SWIGINTERN PyObject *
-  swig_varlink_str(swig_varlinkobject *v) {
-    PyObject *str = PyString_FromString("(");
-    swig_globalvar  *var;
-    for (var = v->vars; var; var=var->next) {
-      PyString_ConcatAndDel(&str,PyString_FromString(var->name));
-      if (var->next) PyString_ConcatAndDel(&str,PyString_FromString(", "));
-    }
-    PyString_ConcatAndDel(&str,PyString_FromString(")"));
-    return str;
-  }
-  
-  SWIGINTERN int
-  swig_varlink_print(swig_varlinkobject *v, FILE *fp, int SWIGUNUSEDPARM(flags)) {
-    PyObject *str = swig_varlink_str(v);
-    fprintf(fp,"Swig global variables ");
-    fprintf(fp,"%s\n", PyString_AsString(str));
-    Py_DECREF(str);
-    return 0;
-  }
-  
-  SWIGINTERN void
-  swig_varlink_dealloc(swig_varlinkobject *v) {
-    swig_globalvar *var = v->vars;
-    while (var) {
-      swig_globalvar *n = var->next;
-      free(var->name);
-      free(var);
-      var = n;
-    }
-  }
-  
-  SWIGINTERN PyObject *
-  swig_varlink_getattr(swig_varlinkobject *v, char *n) {
-    PyObject *res = NULL;
-    swig_globalvar *var = v->vars;
-    while (var) {
-      if (strcmp(var->name,n) == 0) {
-        res = (*var->get_attr)();
-        break;
-      }
-      var = var->next;
-    }
-    if (res == NULL && !PyErr_Occurred()) {
-      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
-    }
-    return res;
-  }
-  
-  SWIGINTERN int
-  swig_varlink_setattr(swig_varlinkobject *v, char *n, PyObject *p) {
-    int res = 1;
-    swig_globalvar *var = v->vars;
-    while (var) {
-      if (strcmp(var->name,n) == 0) {
-        res = (*var->set_attr)(p);
-        break;
-      }
-      var = var->next;
-    }
-    if (res == 1 && !PyErr_Occurred()) {
-      PyErr_SetString(PyExc_NameError,"Unknown C global variable");
-    }
-    return res;
-  }
-  
-  SWIGINTERN PyTypeObject*
-  swig_varlink_type(void) {
-    static char varlink__doc__[] = "Swig var link object";
-    static PyTypeObject varlink_type;
-    static int type_init = 0;  
-    if (!type_init) {
-      const PyTypeObject tmp
-      = {
-        PyObject_HEAD_INIT(NULL)
-        0,                                  /* Number of items in variable part (ob_size) */
-        (char *)"swigvarlink",              /* Type name (tp_name) */
-        sizeof(swig_varlinkobject),         /* Basic size (tp_basicsize) */
-        0,                                  /* Itemsize (tp_itemsize) */
-        (destructor) swig_varlink_dealloc,   /* Deallocator (tp_dealloc) */ 
-        (printfunc) swig_varlink_print,     /* Print (tp_print) */
-        (getattrfunc) swig_varlink_getattr, /* get attr (tp_getattr) */
-        (setattrfunc) swig_varlink_setattr, /* Set attr (tp_setattr) */
-        0,                                  /* tp_compare */
-        (reprfunc) swig_varlink_repr,       /* tp_repr */
-        0,                                  /* tp_as_number */
-        0,                                  /* tp_as_sequence */
-        0,                                  /* tp_as_mapping */
-        0,                                  /* tp_hash */
-        0,                                  /* tp_call */
-        (reprfunc)swig_varlink_str,        /* tp_str */
-        0,                                  /* tp_getattro */
-        0,                                  /* tp_setattro */
-        0,                                  /* tp_as_buffer */
-        0,                                  /* tp_flags */
-        varlink__doc__,                     /* tp_doc */
-        0,                                  /* tp_traverse */
-        0,                                  /* tp_clear */
-        0,                                  /* tp_richcompare */
-        0,                                  /* tp_weaklistoffset */
-#if PY_VERSION_HEX >= 0x02020000
-        0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0, /* tp_iter -> tp_weaklist */
-#endif
-#if PY_VERSION_HEX >= 0x02030000
-        0,                                  /* tp_del */
-#endif
-#ifdef COUNT_ALLOCS
-        0,0,0,0                             /* tp_alloc -> tp_next */
-#endif
-      };
-      varlink_type = tmp;
-      varlink_type.ob_type = &PyType_Type;
-      type_init = 1;
-    }
-    return &varlink_type;
-  }
-  
-  /* Create a variable linking object for use later */
-  SWIGINTERN PyObject *
-  SWIG_Python_newvarlink(void) {
-    swig_varlinkobject *result = PyObject_NEW(swig_varlinkobject, swig_varlink_type());
-    if (result) {
-      result->vars = 0;
-    }
-    return ((PyObject*) result);
-  }
-  
-  SWIGINTERN void 
-  SWIG_Python_addvarlink(PyObject *p, char *name, PyObject *(*get_attr)(void), int (*set_attr)(PyObject *p)) {
-    swig_varlinkobject *v = (swig_varlinkobject *) p;
-    swig_globalvar *gv = (swig_globalvar *) malloc(sizeof(swig_globalvar));
-    if (gv) {
-      size_t size = strlen(name)+1;
-      gv->name = (char *)malloc(size);
-      if (gv->name) {
-        strncpy(gv->name,name,size);
-        gv->get_attr = get_attr;
-        gv->set_attr = set_attr;
-        gv->next = v->vars;
-      }
-    }
-    v->vars = gv;
-  }
-  
-  SWIGINTERN PyObject *
-  SWIG_globals(void) {
-    static PyObject *_SWIG_globals = 0; 
-    if (!_SWIG_globals) _SWIG_globals = SWIG_newvarlink();  
-    return _SWIG_globals;
-  }
-  
-  /* -----------------------------------------------------------------------------
-   * constants/methods manipulation
-   * ----------------------------------------------------------------------------- */
-  
-  /* Install Constants */
-  SWIGINTERN void
-  SWIG_Python_InstallConstants(PyObject *d, swig_const_info constants[]) {
-    PyObject *obj = 0;
-    size_t i;
-    for (i = 0; constants[i].type; ++i) {
-      switch(constants[i].type) {
-      case SWIG_PY_POINTER:
-        obj = SWIG_NewPointerObj(constants[i].pvalue, *(constants[i]).ptype,0);
-        break;
-      case SWIG_PY_BINARY:
-        obj = SWIG_NewPackedObj(constants[i].pvalue, constants[i].lvalue, *(constants[i].ptype));
-        break;
-      default:
-        obj = 0;
-        break;
-      }
-      if (obj) {
-        PyDict_SetItemString(d, constants[i].name, obj);
-        Py_DECREF(obj);
-      }
-    }
-  }
-  
-  /* -----------------------------------------------------------------------------*/
-  /* Fix SwigMethods to carry the callback ptrs when needed */
-  /* -----------------------------------------------------------------------------*/
-  
-  SWIGINTERN void
-  SWIG_Python_FixMethods(PyMethodDef *methods,
-    swig_const_info *const_table,
-    swig_type_info **types,
-    swig_type_info **types_initial) {
-    size_t i;
-    for (i = 0; methods[i].ml_name; ++i) {
-      const char *c = methods[i].ml_doc;
-      if (c && (c = strstr(c, "swig_ptr: "))) {
-        int j;
-        swig_const_info *ci = 0;
-        const char *name = c + 10;
-        for (j = 0; const_table[j].type; ++j) {
-          if (strncmp(const_table[j].name, name, 
-              strlen(const_table[j].name)) == 0) {
-            ci = &(const_table[j]);
-            break;
-          }
-        }
-        if (ci) {
-          size_t shift = (ci->ptype) - types;
-          swig_type_info *ty = types_initial[shift];
-          size_t ldoc = (c - methods[i].ml_doc);
-          size_t lptr = strlen(ty->name)+2*sizeof(void*)+2;
-          char *ndoc = (char*)malloc(ldoc + lptr + 10);
-          if (ndoc) {
-            char *buff = ndoc;
-            void *ptr = (ci->type == SWIG_PY_POINTER) ? ci->pvalue : 0;
-            if (ptr) {
-              strncpy(buff, methods[i].ml_doc, ldoc);
-              buff += ldoc;
-              strncpy(buff, "swig_ptr: ", 10);
-              buff += 10;
-              SWIG_PackVoidPtr(buff, ptr, ty->name, lptr);
-              methods[i].ml_doc = ndoc;
-            }
-          }
-        }
-      }
-    }
-  } 
-  
-#ifdef __cplusplus
-}
-#endif
-
-/* -----------------------------------------------------------------------------*
- *  Partial Init method
- * -----------------------------------------------------------------------------*/
-
-#ifdef __cplusplus
-extern "C"
-#endif
-SWIGEXPORT void SWIG_init(void) {
-  PyObject *m, *d;
-  
-  /* Fix SwigMethods to carry the callback ptrs when needed */
-  SWIG_Python_FixMethods(SwigMethods, swig_const_table, swig_types, swig_type_initial);
-  
-  m = Py_InitModule((char *) SWIG_name, SwigMethods);
-  d = PyModule_GetDict(m);
-  
-  SWIG_InitializeModule(0);
-  SWIG_InstallConstants(d,swig_const_table);
-  
-  
-}
-
diff --git a/source4/libnet/py_net.c b/source4/libnet/py_net.c
new file mode 100644 (file)
index 0000000..cf81d80
--- /dev/null
@@ -0,0 +1,82 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+   
+   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/>.
+*/
+
+#include "includes.h"
+#include <Python.h>
+#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 event_context *ev)
+{
+       /* FIXME: Use obj */
+       return libnet_context_init(ev, global_loadparm);
+}
+
+static PyObject *py_net_join(PyObject *cls, PyObject *args, PyObject *kwargs)
+{
+       struct libnet_Join r;
+       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 };
+
+       if (!PyArg_ParseTupleAndKeywords(args, kwargs, "ssii:Join", discard_const_p(char *, kwnames), 
+                                        &r.in.domain_name, &r.in.netbios_name, 
+                                        &r.in.join_type, &r.in.level))
+               return 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, ev);
+
+       status = libnet_Join(libnet_ctx, mem_ctx, &r);
+       if (NT_STATUS_IS_ERR(status)) {
+               PyErr_SetString(PyExc_RuntimeError, r.out.error_string);
+               talloc_free(mem_ctx);
+               return NULL;
+       }
+
+       result = Py_BuildValue("sss", r.out.join_password, 
+                              dom_sid_string(mem_ctx, r.out.domain_sid),
+                              r.out.domain_name);
+
+       talloc_free(mem_ctx);
+
+       if (result == NULL)
+               return NULL;
+
+       return result;
+}
+
+static struct PyMethodDef net_methods[] = {
+       {"Join", (PyCFunction)py_net_join, METH_VARARGS|METH_KEYWORDS},
+       {NULL }
+};
+
+void initnet(void)
+{
+       Py_InitModule("net", net_methods);
+}
index cb679d20bb58684134a0dc42fb61900ddb195f12..c5820619d99013d16602535ff61c7d12376c2bf5 100644 (file)
@@ -459,8 +459,9 @@ PUBLIC_HEADERS += librpc/gen_ndr/ndr_svcctl_c.h
 
 [LIBRARY::dcerpc_atsvc]
 PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC
-VERSION = 0.0.1
-SO_VERSION = 0
+
+dcerpc_atsvc_VERSION = 0.0.1
+dcerpc_atsvc_SOVERSION = 0
 
 dcerpc_atsvc_OBJ_FILES = librpc/gen_ndr/ndr_atsvc_c.o
 PC_FILES += librpc/dcerpc_atsvc.pc
@@ -588,7 +589,7 @@ PC_FILES += librpc/dcerpc.pc
 dcerpc_VERSION = 0.0.1
 dcerpc_SOVERSION = 0
 
-dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o \
+dcerpc_OBJ_FILES = $(addprefix librpc/rpc/, dcerpc.o dcerpc_auth.o dcerpc_schannel.o dcerpc_util.o binding.o \
                                  dcerpc_error.o dcerpc_smb.o dcerpc_smb2.o dcerpc_sock.o dcerpc_connect.o dcerpc_secondary.o)
 
 
@@ -718,73 +719,84 @@ PUBLIC_DEPENDENCIES = LIBCLI_SMB NDR_MISC LIBSAMBA-UTIL LIBSAMBA-HOSTCONFIG dcer
 swig_dcerpc_OBJ_FILES = librpc/rpc/dcerpc_wrap.o
 
 [PYTHON::python_echo]
-PRIVATE_DEPENDENCIES = RPC_NDR_ECHO
+PRIVATE_DEPENDENCIES = RPC_NDR_ECHO PYTALLOC
 
 python_echo_OBJ_FILES = librpc/gen_ndr/py_echo.o
 
 [PYTHON::python_winreg]
-PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc
+PRIVATE_DEPENDENCIES = RPC_NDR_WINREG python_misc PYTALLOC
 
 python_winreg_OBJ_FILES = librpc/gen_ndr/py_winreg.o
 
 [PYTHON::python_dcerpc_misc]
+PRIVATE_DEPENDENCIES = PYTALLOC
 
 python_dcerpc_misc_OBJ_FILES = librpc/gen_ndr/py_misc.o
 
 [PYTHON::python_initshutdown]
-PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN
+PRIVATE_DEPENDENCIES = RPC_NDR_INITSHUTDOWN PYTALLOC
 
 python_initshutdown_OBJ_FILES = librpc/gen_ndr/py_initshutdown.o
 
 [PYTHON::python_epmapper]
+PRIVATE_DEPENDENCIES = PYTALLOC
 
 python_epmapper_OBJ_FILES = librpc/gen_ndr/py_epmapper.o
 
 [PYTHON::python_mgmt]
-PRIVATE_DEPENDENCIES = dcerpc_mgmt
+PRIVATE_DEPENDENCIES = dcerpc_mgmt PYTALLOC
 
 python_mgmt_OBJ_FILES = librpc/gen_ndr/py_mgmt.o
 
 [PYTHON::python_atsvc]
-PRIVATE_DEPENDENCIES = dcerpc_atsvc
+PRIVATE_DEPENDENCIES = dcerpc_atsvc PYTALLOC
 
 python_atsvc_OBJ_FILES = librpc/gen_ndr/py_atsvc.o
 
 [PYTHON::python_samr]
-PRIVATE_DEPENDENCIES = dcerpc_samr
+PRIVATE_DEPENDENCIES = dcerpc_samr PYTALLOC
+
+python_samr_OBJ_FILES = librpc/gen_ndr/py_samr.o
 
 python_samr_OBJ_FILES = librpc/gen_ndr/py_samr.o
 
 [PYTHON::python_svcctl]
-PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL
+PRIVATE_DEPENDENCIES = RPC_NDR_SVCCTL PYTALLOC
 
 python_svcctl_OBJ_FILES = librpc/gen_ndr/py_svcctl.o
 
 [PYTHON::python_lsa]
-PRIVATE_DEPENDENCIES = RPC_NDR_LSA
+PRIVATE_DEPENDENCIES = RPC_NDR_LSA PYTALLOC
+
+python_lsa_OBJ_FILES = librpc/gen_ndr/py_lsa.o
 
 python_lsa_OBJ_FILES = librpc/gen_ndr/py_lsa.o
 
 [PYTHON::python_wkssvc]
-PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC
+PRIVATE_DEPENDENCIES = RPC_NDR_WKSSVC PYTALLOC
 
 python_wkssvc_OBJ_FILES = librpc/gen_ndr/py_wkssvc.o
 
 [PYTHON::python_dfs]
-PRIVATE_DEPENDENCIES = RPC_NDR_DFS
+PRIVATE_DEPENDENCIES = RPC_NDR_DFS PYTALLOC
+
+python_dfs_OBJ_FILES = librpc/gen_ndr/py_dfs.o
 
 python_dfs_OBJ_FILES = gen_ndr/py_dfs.o
 
 [PYTHON::python_unixinfo]
-PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO
+PRIVATE_DEPENDENCIES = RPC_NDR_UNIXINFO PYTALLOC
 
-python_unixinfo_OBJ_FILES = gen_ndr/py_unixinfo.o
+python_unixinfo_OBJ_FILES = librpc/gen_ndr/py_unixinfo.o
 
 [PYTHON::python_drsuapi]
-PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI
+PRIVATE_DEPENDENCIES = RPC_NDR_DRSUAPI PYTALLOC
+
+python_drsuapi_OBJ_FILES = librpc/gen_ndr/py_drsuapi.o
 
 python_drsuapi_OBJ_FILES = gen_ndr/py_drsuapi.o
 
 [PYTHON::python_dcerpc_security]
+PRIVATE_DEPENDENCIES = PYTALLOC
 
 python_dcerpc_security_OBJ_FILES = librpc/gen_ndr/py_security.o
index 96525716689fd1204374dcda98a07661d620a870..2f48287233cf882b59dd811d5fb4f5cc9b16f61a 100644 (file)
@@ -849,7 +849,7 @@ interface drsuapi
                [case(1)] drsuapi_DsNameCtr1 *ctr1;
        } drsuapi_DsNameCtr;
 
-       [todo] WERROR drsuapi_DsCrackNames(
+       WERROR drsuapi_DsCrackNames(
                [in] policy_handle *bind_handle,
                [in, out] int32 level,
                [in,switch_is(level)] drsuapi_DsNameRequest req,
index aa8836088258342a45240273f6c9189bf5166043..dddfa4e1ce7d1a1e9f9b3fdfce8b4e5d3d127a53 100644 (file)
@@ -440,9 +440,8 @@ interface nbt
                nstring          unicode_domain;
                uint32           db_count;
                nbt_db_change    dbchange[db_count];
-               [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
-               [flag(NDR_ALIGN4)] DATA_BLOB _pad2;
-               dom_sid          sid;
+               [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+               [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
                uint32           nt_version;
                uint16           lmnt_token;
                uint16           lm20_token;
@@ -560,9 +559,8 @@ interface nbt
                nstring              user_name;
                astring              mailslot_name;
                uint32               acct_control;
-               [value(ndr_size_dom_sid(&sid, ndr->flags))] uint32 sid_size;
-               [flag(NDR_ALIGN4)]   DATA_BLOB _pad;
-               dom_sid              sid;
+               [value(ndr_size_dom_sid0(&sid, ndr->flags))] uint32 sid_size;
+               [subcontext(0),subcontext_size(sid_size)] dom_sid0 sid;
                uint32               nt_version;
                uint16               lmnt_token;
                uint16               lm20_token;
index 295b70a2a1dddc89550e6290a3511e2434c26b02..ab137faf2798c85bdd671311cc4e75dba2801ec2 100644 (file)
@@ -9,5 +9,5 @@
 {
        /*****************/
        /* Function 0x00 */
-       WERROR policyagent_Dummy();
+       [todo] WERROR policyagent_Dummy();
 }
index 753fad85cf96ee009877fcab00ddcc71d2f38aa9..314846c53f29b2ca00a9c8d1f082396ae5f883a1 100644 (file)
@@ -22,6 +22,9 @@ cpp_quote("#define dom_sid2 dom_sid")
 /* same struct as dom_sid but inside a 28 bytes fixed buffer in NDR */
 cpp_quote("#define dom_sid28 dom_sid")
 
+/* same struct as dom_sid but in a variable byte buffer, which is maybe empty in NDR */
+cpp_quote("#define dom_sid0 dom_sid")
+
 [
        pointer_default(unique)
 ]
index 2439c386db81fe1e3fd3796abd42c9f7afe9e39c..b719be2bab68c064347585c2e6ddcd05050bc1b7 100644 (file)
@@ -336,6 +336,10 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
 enum ndr_err_code ndr_pull_dom_sid28(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
 void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
 size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags);
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid);
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid);
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid);
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags);
 void ndr_print_ipv4_addr(struct ndr_print *ndr, const char *name, const struct in_addr *_ip);
 void ndr_print_GUID(struct ndr_print *ndr, const char *name, const struct GUID *guid);
 enum ndr_err_code ndr_push_struct_blob(DATA_BLOB *blob, TALLOC_CTX *mem_ctx, struct smb_iconv_convenience *iconv_convenience, const void *p, ndr_push_flags_fn_t fn);
index 93a177f94e5f127698e14652cbbe2a02edd53fbd..1d2b47c850b4e246c47f6ad07723fad79c35903b 100644 (file)
@@ -196,7 +196,7 @@ _PUBLIC_ enum ndr_err_code ndr_pull_hyper(struct ndr_pull *ndr, int ndr_flags, u
 */
 _PUBLIC_ enum ndr_err_code ndr_pull_pointer(struct ndr_pull *ndr, int ndr_flags, void* *v)
 {
-       intptr_t h;
+       uintptr_t h;
        NDR_PULL_ALIGN(ndr, sizeof(h));
        NDR_PULL_NEED_BYTES(ndr, sizeof(h));
        memcpy(&h, ndr->data+ndr->offset, sizeof(h));
@@ -393,7 +393,7 @@ _PUBLIC_ enum ndr_err_code ndr_push_hyper(struct ndr_push *ndr, int ndr_flags, u
 */
 _PUBLIC_ enum ndr_err_code ndr_push_pointer(struct ndr_push *ndr, int ndr_flags, void* v)
 {
-       intptr_t h = (intptr_t)v;
+       uintptr_t h = (intptr_t)v;
        NDR_PUSH_ALIGN(ndr, sizeof(h));
        NDR_PUSH_NEED_BYTES(ndr, sizeof(h));
        memcpy(ndr->data+ndr->offset, &h, sizeof(h));
index 5a0178bd25bbee897b5b8731060b0821ce5b2b6e..1256d7dd2d26769948ceaaef7ceeada42fbb351c 100644 (file)
@@ -48,6 +48,11 @@ size_t ndr_size_dom_sid28(const struct dom_sid *sid, int flags)
        return 8 + 4*sid->num_auths;
 }
 
+size_t ndr_size_dom_sid0(const struct dom_sid *sid, int flags)
+{
+       return ndr_size_dom_sid28(sid, flags);
+}
+
 /*
   return the wire size of a security_ace
 */
@@ -128,6 +133,11 @@ void ndr_print_dom_sid28(struct ndr_print *ndr, const char *name, const struct d
        ndr_print_dom_sid(ndr, name, sid);
 }
 
+void ndr_print_dom_sid0(struct ndr_print *ndr, const char *name, const struct dom_sid *sid)
+{
+       ndr_print_dom_sid(ndr, name, sid);
+}
+
 
 /*
   parse a dom_sid2 - this is a dom_sid but with an extra copy of the num_auths field
@@ -225,3 +235,44 @@ enum ndr_err_code ndr_push_dom_sid28(struct ndr_push *ndr, int ndr_flags, const
        return NDR_ERR_SUCCESS;
 }
 
+/*
+  parse a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_pull_dom_sid0(struct ndr_pull *ndr, int ndr_flags, struct dom_sid *sid)
+{
+       if (!(ndr_flags & NDR_SCALARS)) {
+               return NDR_ERR_SUCCESS;
+       }
+
+       if (ndr->data_size == ndr->offset) {
+               ZERO_STRUCTP(sid);
+               return NDR_ERR_SUCCESS;
+       }
+
+       return ndr_pull_dom_sid(ndr, ndr_flags, sid);
+}
+
+/*
+  push a dom_sid0 - this is a dom_sid in a variable byte buffer, which is maybe empty
+*/
+enum ndr_err_code ndr_push_dom_sid0(struct ndr_push *ndr, int ndr_flags, const struct dom_sid *sid)
+{
+       struct dom_sid zero_sid;
+
+       if (!(ndr_flags & NDR_SCALARS)) {
+               return NDR_ERR_SUCCESS;
+       }
+
+       if (!sid) {
+               return NDR_ERR_SUCCESS;
+       }
+
+       ZERO_STRUCT(zero_sid);
+
+       if (memcmp(&zero_sid, sid, sizeof(zero_sid)) == 0) {
+               return NDR_ERR_SUCCESS;
+       }
+
+       return ndr_push_dom_sid(ndr, ndr_flags, sid);
+}
+
diff --git a/source4/librpc/rpc/binding.c b/source4/librpc/rpc/binding.c
new file mode 100644 (file)
index 0000000..ae88dce
--- /dev/null
@@ -0,0 +1,724 @@
+/* 
+   Unix SMB/CIFS implementation.
+
+   dcerpc utility functions
+
+   Copyright (C) Andrew Tridgell 2003
+   Copyright (C) Jelmer Vernooij 2004
+   Copyright (C) Andrew Bartlett <abartlet@samba.org> 2005
+   Copyright (C) Rafal Szczesniak 2006
+   
+   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/>.
+*/
+
+#include "includes.h"
+#include "lib/events/events.h"
+#include "librpc/gen_ndr/ndr_epmapper_c.h"
+#include "librpc/gen_ndr/ndr_dcerpc.h"
+#include "librpc/gen_ndr/ndr_misc.h"
+
+#define MAX_PROTSEQ            10
+
+static const struct {
+       const char *name;
+       enum dcerpc_transport_t transport;
+       int num_protocols;
+       enum epm_protocol protseq[MAX_PROTSEQ];
+} transports[] = {
+       { "ncacn_np",     NCACN_NP, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
+       { "ncacn_ip_tcp", NCACN_IP_TCP, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, 
+       { "ncacn_http", NCACN_HTTP, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, 
+       { "ncadg_ip_udp", NCACN_IP_UDP, 3, 
+               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
+       { "ncalrpc", NCALRPC, 2, 
+               { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } },
+       { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
+       { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, 
+               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
+       { "ncacn_at_dsp", NCACN_AT_DSP, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
+       { "ncadg_at_ddp", NCADG_AT_DDP, 3, 
+               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
+       { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
+       { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, 
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
+       { "ncadg_ipx", NCADG_IPX, 2,
+               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
+       },
+       { "ncacn_spx", NCACN_SPX, 3,
+               /* I guess some MS programmer confused the identifier for 
+                * EPM_PROTOCOL_UUID (0x0D or 13) with the one for 
+                * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
+               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
+       },
+};
+
+static const struct {
+       const char *name;
+       uint32_t flag;
+} ncacn_options[] = {
+       {"sign", DCERPC_SIGN},
+       {"seal", DCERPC_SEAL},
+       {"connect", DCERPC_CONNECT},
+       {"spnego", DCERPC_AUTH_SPNEGO},
+       {"ntlm", DCERPC_AUTH_NTLM},
+       {"krb5", DCERPC_AUTH_KRB5},
+       {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
+       {"print", DCERPC_DEBUG_PRINT_BOTH},
+       {"padcheck", DCERPC_DEBUG_PAD_CHECK},
+       {"bigendian", DCERPC_PUSH_BIGENDIAN},
+       {"smb2", DCERPC_SMB2}
+};
+
+const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
+{
+       struct ndr_syntax_id syntax;
+       NTSTATUS status;
+
+       switch(epm_floor->lhs.protocol) {
+               case EPM_PROTOCOL_UUID:
+                       status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
+                       if (NT_STATUS_IS_OK(status)) {
+                               /* lhs is used: UUID */
+                               char *uuidstr;
+
+                               if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
+                                       return "NDR";
+                               } 
+
+                               if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
+                                       return "NDR64";
+                               } 
+
+                               uuidstr = GUID_string(mem_ctx, &syntax.uuid);
+
+                               return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
+                       } else { /* IPX */
+                               return talloc_asprintf(mem_ctx, "IPX:%s", 
+                                               data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
+                       }
+
+               case EPM_PROTOCOL_NCACN:
+                       return "RPC-C";
+
+               case EPM_PROTOCOL_NCADG:
+                       return "RPC";
+
+               case EPM_PROTOCOL_NCALRPC:
+                       return "NCALRPC";
+
+               case EPM_PROTOCOL_DNET_NSP:
+                       return "DNET/NSP";
+
+               case EPM_PROTOCOL_IP:
+                       return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
+
+               case EPM_PROTOCOL_PIPE:
+                       return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path);
+
+               case EPM_PROTOCOL_SMB:
+                       return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
+
+               case EPM_PROTOCOL_UNIX_DS:
+                       return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
+
+               case EPM_PROTOCOL_NETBIOS:
+                       return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
+
+               case EPM_PROTOCOL_NETBEUI:
+                       return "NETBeui";
+
+               case EPM_PROTOCOL_SPX:
+                       return "SPX";
+
+               case EPM_PROTOCOL_NB_IPX:
+                       return "NB_IPX";
+
+               case EPM_PROTOCOL_HTTP:
+                       return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
+
+               case EPM_PROTOCOL_TCP:
+                       return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
+
+               case EPM_PROTOCOL_UDP:
+                       return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
+
+               default:
+                       return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
+       }
+}
+
+
+/*
+  form a binding string from a binding structure
+*/
+_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
+{
+       char *s = talloc_strdup(mem_ctx, "");
+       int i;
+       const char *t_name = NULL;
+
+       if (b->transport != NCA_UNKNOWN) {
+               for (i=0;i<ARRAY_SIZE(transports);i++) {
+                       if (transports[i].transport == b->transport) {
+                               t_name = transports[i].name;
+                       }
+               }
+               if (!t_name) {
+                       return NULL;
+               }
+       }
+
+       if (!GUID_all_zero(&b->object.uuid)) { 
+               s = talloc_asprintf(s, "%s@",
+                                   GUID_string(mem_ctx, &b->object.uuid));
+       }
+
+       if (t_name != NULL) {
+               s = talloc_asprintf_append_buffer(s, "%s:", t_name);
+               if (s == NULL) {
+                       return NULL;
+               }
+       }
+
+       if (b->host) {
+               s = talloc_asprintf_append_buffer(s, "%s", b->host);
+       }
+
+       if (!b->endpoint && !b->options && !b->flags) {
+               return s;
+       }
+
+       s = talloc_asprintf_append_buffer(s, "[");
+
+       if (b->endpoint) {
+               s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
+       }
+
+       /* this is a *really* inefficent way of dealing with strings,
+          but this is rarely called and the strings are always short,
+          so I don't care */
+       for (i=0;b->options && b->options[i];i++) {
+               s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
+               if (!s) return NULL;
+       }
+
+       for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
+               if (b->flags & ncacn_options[i].flag) {
+                       s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
+                       if (!s) return NULL;
+               }
+       }
+
+       s = talloc_asprintf_append_buffer(s, "]");
+
+       return s;
+}
+
+/*
+  parse a binding string into a dcerpc_binding structure
+*/
+_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out)
+{
+       struct dcerpc_binding *b;
+       char *options;
+       char *p;
+       int i, j, comma_count;
+
+       b = talloc(mem_ctx, struct dcerpc_binding);
+       if (!b) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       p = strchr(s, '@');
+
+       if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
+               NTSTATUS status;
+
+               status = GUID_from_string(s, &b->object.uuid);
+
+               if (NT_STATUS_IS_ERR(status)) {
+                       DEBUG(0, ("Failed parsing UUID\n"));
+                       return status;
+               }
+
+               s = p + 1;
+       } else {
+               ZERO_STRUCT(b->object);
+       }
+
+       b->object.if_version = 0;
+
+       p = strchr(s, ':');
+
+       if (p == NULL) {
+               b->transport = NCA_UNKNOWN;
+       } else {
+               char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
+               if (!type) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+
+               for (i=0;i<ARRAY_SIZE(transports);i++) {
+                       if (strcasecmp(type, transports[i].name) == 0) {
+                               b->transport = transports[i].transport;
+                               break;
+                       }
+               }
+
+               if (i==ARRAY_SIZE(transports)) {
+                       DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+
+               talloc_free(type);
+       
+               s = p+1;
+       }
+
+       p = strchr(s, '[');
+       if (p) {
+               b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
+               options = talloc_strdup(mem_ctx, p+1);
+               if (options[strlen(options)-1] != ']') {
+                       return NT_STATUS_INVALID_PARAMETER;
+               }
+               options[strlen(options)-1] = 0;
+       } else {
+               b->host = talloc_strdup(b, s);
+               options = NULL;
+       }
+       if (!b->host) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       b->target_hostname = b->host;
+
+       b->options = NULL;
+       b->flags = 0;
+       b->assoc_group_id = 0;
+       b->endpoint = NULL;
+
+       if (!options) {
+               *b_out = b;
+               return NT_STATUS_OK;
+       }
+
+       comma_count = count_chars(options, ',');
+
+       b->options = talloc_array(b, const char *, comma_count+2);
+       if (!b->options) {
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       for (i=0; (p = strchr(options, ',')); i++) {
+               b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
+               if (!b->options[i]) {
+                       return NT_STATUS_NO_MEMORY;
+               }
+               options = p+1;
+       }
+       b->options[i] = options;
+       b->options[i+1] = NULL;
+
+       /* some options are pre-parsed for convenience */
+       for (i=0;b->options[i];i++) {
+               for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
+                       if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
+                               int k;
+                               b->flags |= ncacn_options[j].flag;
+                               for (k=i;b->options[k];k++) {
+                                       b->options[k] = b->options[k+1];
+                               }
+                               i--;
+                               break;
+                       }
+               }
+       }
+
+       if (b->options[0]) {
+               /* Endpoint is first option */
+               b->endpoint = b->options[0];
+               if (strlen(b->endpoint) == 0) b->endpoint = NULL;
+
+               for (i=0;b->options[i];i++) {
+                       b->options[i] = b->options[i+1];
+               }
+       }
+
+       if (b->options[0] == NULL)
+               b->options = NULL;
+       
+       *b_out = b;
+       return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
+{
+       TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
+       struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
+       enum ndr_err_code ndr_err;
+       uint16_t if_version=0;
+
+       ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+       ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(mem_ctx);
+               return ndr_map_error2ntstatus(ndr_err);
+       }
+
+       ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
+       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
+               talloc_free(mem_ctx);
+               return ndr_map_error2ntstatus(ndr_err);
+       }
+
+       syntax->if_version = if_version;
+
+       talloc_free(mem_ctx);
+
+       return NT_STATUS_OK;
+}
+
+static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
+{
+       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
+
+       ndr->flags |= LIBNDR_FLAG_NOALIGN;
+
+       ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
+       ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
+
+       return ndr_push_blob(ndr);
+}
+
+const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
+{
+       switch (epm_floor->lhs.protocol) {
+       case EPM_PROTOCOL_TCP:
+               if (epm_floor->rhs.tcp.port == 0) return NULL;
+               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
+               
+       case EPM_PROTOCOL_UDP:
+               if (epm_floor->rhs.udp.port == 0) return NULL;
+               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
+
+       case EPM_PROTOCOL_HTTP:
+               if (epm_floor->rhs.http.port == 0) return NULL;
+               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
+
+       case EPM_PROTOCOL_IP:
+               return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
+
+       case EPM_PROTOCOL_NCACN:
+               return NULL;
+
+       case EPM_PROTOCOL_NCADG:
+               return NULL;
+
+       case EPM_PROTOCOL_SMB:
+               if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
+               return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
+
+       case EPM_PROTOCOL_PIPE:
+               if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
+               return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path);
+
+       case EPM_PROTOCOL_NETBIOS:
+               if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
+               return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
+
+       case EPM_PROTOCOL_NCALRPC:
+               return NULL;
+               
+       case EPM_PROTOCOL_VINES_SPP:
+               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
+               
+       case EPM_PROTOCOL_VINES_IPC:
+               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
+               
+       case EPM_PROTOCOL_STREETTALK:
+               return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
+               
+       case EPM_PROTOCOL_UNIX_DS:
+               if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
+               return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
+               
+       case EPM_PROTOCOL_NULL:
+               return NULL;
+
+       default:
+               DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
+               break;
+       }
+
+       return NULL;
+}
+
+static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, 
+                                         struct epm_floor *epm_floor,  
+                                         const char *data)
+{
+       switch (epm_floor->lhs.protocol) {
+       case EPM_PROTOCOL_TCP:
+               epm_floor->rhs.tcp.port = atoi(data);
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_UDP:
+               epm_floor->rhs.udp.port = atoi(data);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_HTTP:
+               epm_floor->rhs.http.port = atoi(data);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_IP:
+               epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_NCACN:
+               epm_floor->rhs.ncacn.minor_version = 0;
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_NCADG:
+               epm_floor->rhs.ncadg.minor_version = 0;
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_SMB:
+               epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_PIPE:
+               epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_NETBIOS:
+               epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
+               return NT_STATUS_OK;
+
+       case EPM_PROTOCOL_NCALRPC:
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_VINES_SPP:
+               epm_floor->rhs.vines_spp.port = atoi(data);
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_VINES_IPC:
+               epm_floor->rhs.vines_ipc.port = atoi(data);
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_STREETTALK:
+               epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_UNIX_DS:
+               epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
+               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
+               return NT_STATUS_OK;
+               
+       case EPM_PROTOCOL_NULL:
+               return NT_STATUS_OK;
+
+       default:
+               DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
+               break;
+       }
+
+       return NT_STATUS_NOT_SUPPORTED;
+}
+
+enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
+{
+       int i;
+
+       /* Find a transport that has 'prot' as 4th protocol */
+       for (i=0;i<ARRAY_SIZE(transports);i++) {
+               if (transports[i].num_protocols >= 2 && 
+                       transports[i].protseq[1] == prot) {
+                       return transports[i].transport;
+               }
+       }
+       
+       /* Unknown transport */
+       return (unsigned int)-1;
+}
+
+_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
+{
+       int i;
+
+       /* Find a transport that matches this tower */
+       for (i=0;i<ARRAY_SIZE(transports);i++) {
+               int j;
+               if (transports[i].num_protocols != tower->num_floors - 2) {
+                       continue; 
+               }
+
+               for (j = 0; j < transports[i].num_protocols; j++) {
+                       if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
+                               break;
+                       }
+               }
+
+               if (j == transports[i].num_protocols) {
+                       return transports[i].transport;
+               }
+       }
+       
+       /* Unknown transport */
+       return (unsigned int)-1;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, 
+                                  struct epm_tower *tower, 
+                                  struct dcerpc_binding **b_out)
+{
+       NTSTATUS status;
+       struct dcerpc_binding *binding;
+
+       binding = talloc(mem_ctx, struct dcerpc_binding);
+       NT_STATUS_HAVE_NO_MEMORY(binding);
+
+       ZERO_STRUCT(binding->object);
+       binding->options = NULL;
+       binding->host = NULL;
+       binding->target_hostname = NULL;
+       binding->flags = 0;
+       binding->assoc_group_id = 0;
+
+       binding->transport = dcerpc_transport_by_tower(tower);
+
+       if (binding->transport == (unsigned int)-1) {
+               return NT_STATUS_NOT_SUPPORTED;
+       }
+
+       if (tower->num_floors < 1) {
+               return NT_STATUS_OK;
+       }
+
+       /* Set object uuid */
+       status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
+       
+       if (!NT_STATUS_IS_OK(status)) {
+               DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));     
+               return status;
+       }
+
+       /* Ignore floor 1, it contains the NDR version info */
+       
+       binding->options = NULL;
+
+       /* Set endpoint */
+       if (tower->num_floors >= 4) {
+               binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
+       } else {
+               binding->endpoint = NULL;
+       }
+
+       /* Set network address */
+       if (tower->num_floors >= 5) {
+               binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
+               NT_STATUS_HAVE_NO_MEMORY(binding->host);
+               binding->target_hostname = binding->host;
+       }
+       *b_out = binding;
+       return NT_STATUS_OK;
+}
+
+_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
+{
+       const enum epm_protocol *protseq = NULL;
+       int num_protocols = -1, i;
+       NTSTATUS status;
+       
+       /* Find transport */
+       for (i=0;i<ARRAY_SIZE(transports);i++) {
+               if (transports[i].transport == binding->transport) {
+                       protseq = transports[i].protseq;
+                       num_protocols = transports[i].num_protocols;
+                       break;
+               }
+       }
+
+       if (num_protocols == -1) {
+               DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
+               return NT_STATUS_UNSUCCESSFUL;
+       }
+
+       tower->num_floors = 2 + num_protocols;
+       tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
+
+       /* Floor 0 */
+       tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
+
+       tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
+
+       tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
+       
+       /* Floor 1 */
+       tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
+
+       tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, 
+                                                               &ndr_transfer_syntax);
+       
+       tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
+       
+       /* Floor 2 to num_protocols */
+       for (i = 0; i < num_protocols; i++) {
+               tower->floors[2 + i].lhs.protocol = protseq[i];
+               tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
+               ZERO_STRUCT(tower->floors[2 + i].rhs);
+               dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
+       }
+
+       /* The 4th floor contains the endpoint */
+       if (num_protocols >= 2 && binding->endpoint) {
+               status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
+               if (NT_STATUS_IS_ERR(status)) {
+                       return status;
+               }
+       }
+       
+       /* The 5th contains the network address */
+       if (num_protocols >= 3 && binding->host) {
+               if (is_ipaddress(binding->host)) {
+                       status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], 
+                                                          binding->host);
+               } else {
+                       /* note that we don't attempt to resolve the
+                          name here - when we get a hostname here we
+                          are in the client code, and want to put in
+                          a wildcard all-zeros IP for the server to
+                          fill in */
+                       status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], 
+                                                          "0.0.0.0");
+               }
+               if (NT_STATUS_IS_ERR(status)) {
+                       return status;
+               }
+       }
+
+       return NT_STATUS_OK;
+}
index 5e32f6f5bf21ec795cf948e4ca7a3fe9ff7c6a04..4758189d3b38f3cf42d9e1958702ce8d4d2e993b 100644 (file)
@@ -67,22 +67,15 @@ static struct dcerpc_connection *dcerpc_connection_init(TALLOC_CTX *mem_ctx,
                return NULL;
        }
 
-       if (ev == NULL) {
-               ev = event_context_init(c);
-               if (ev == NULL) {
-                       talloc_free(c);
-                       return NULL;
-               }
-       }
-
        c->iconv_convenience = talloc_reference(c, ic);
 
-       c->event_ctx = ev;
-       
-       if (!talloc_reference(c, ev)) {
+       c->event_ctx = talloc_reference(c, ev);
+
+       if (c->event_ctx == NULL) {
                talloc_free(c);
                return NULL;
        }
+
        c->call_id = 1;
        c->security_state.auth_info = NULL;
        c->security_state.session_key = dcerpc_generic_session_key;
index cc7f2ddbaa29b751f00c7667784bc7accbcbce07..a22cad9a4a561bf78687663f6418df96a150e405 100644 (file)
@@ -717,12 +717,6 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_b_send(TALLOC_CTX *parent
        struct pipe_connect_state *s;
        struct event_context *new_ev = NULL;
 
-       if (ev == NULL) {
-               new_ev = event_context_init(parent_ctx);
-               if (new_ev == NULL) return NULL;
-               ev = new_ev;
-       }
-
        /* composite context allocation and setup */
        c = composite_create(parent_ctx, ev);
        if (c == NULL) {
@@ -844,21 +838,12 @@ _PUBLIC_ struct composite_context* dcerpc_pipe_connect_send(TALLOC_CTX *parent_c
        struct pipe_conn_state *s;
        struct dcerpc_binding *b;
        struct composite_context *pipe_conn_req;
-       struct event_context *new_ev = NULL;
-
-       if (ev == NULL) {
-               new_ev = event_context_init(parent_ctx);
-               if (new_ev == NULL) return NULL;
-               ev = new_ev;
-       }
 
        /* composite context allocation and setup */
        c = composite_create(parent_ctx, ev);
        if (c == NULL) {
-               talloc_free(new_ev);
                return NULL;
        }
-       talloc_steal(c, new_ev);
 
        s = talloc_zero(c, struct pipe_conn_state);
        if (composite_nomem(s, c)) return c;
index 3b8768ccc21452b51bcfdf7f2f8cdad4783bca67..71c6d5f2cc85d08e79ca65f972b47d1720d0876a 100644 (file)
@@ -97,701 +97,6 @@ NTSTATUS ncacn_push_auth(DATA_BLOB *blob, TALLOC_CTX *mem_ctx,
        return NT_STATUS_OK;
 }
 
-#define MAX_PROTSEQ            10
-
-static const struct {
-       const char *name;
-       enum dcerpc_transport_t transport;
-       int num_protocols;
-       enum epm_protocol protseq[MAX_PROTSEQ];
-} transports[] = {
-       { "ncacn_np",     NCACN_NP, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_SMB, EPM_PROTOCOL_NETBIOS }},
-       { "ncacn_ip_tcp", NCACN_IP_TCP, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_TCP, EPM_PROTOCOL_IP } }, 
-       { "ncacn_http", NCACN_HTTP, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_HTTP, EPM_PROTOCOL_IP } }, 
-       { "ncadg_ip_udp", NCACN_IP_UDP, 3, 
-               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UDP, EPM_PROTOCOL_IP } },
-       { "ncalrpc", NCALRPC, 2, 
-               { EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_PIPE } },
-       { "ncacn_unix_stream", NCACN_UNIX_STREAM, 2, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_UNIX_DS } },
-       { "ncadg_unix_dgram", NCADG_UNIX_DGRAM, 2, 
-               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_UNIX_DS } },
-       { "ncacn_at_dsp", NCACN_AT_DSP, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DSP } },
-       { "ncadg_at_ddp", NCADG_AT_DDP, 3, 
-               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_APPLETALK, EPM_PROTOCOL_DDP } },
-       { "ncacn_vns_ssp", NCACN_VNS_SPP, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_SPP } },
-       { "ncacn_vns_ipc", NCACN_VNS_IPC, 3, 
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_STREETTALK, EPM_PROTOCOL_VINES_IPC }, },
-       { "ncadg_ipx", NCADG_IPX, 2,
-               { EPM_PROTOCOL_NCADG, EPM_PROTOCOL_IPX },
-       },
-       { "ncacn_spx", NCACN_SPX, 3,
-               /* I guess some MS programmer confused the identifier for 
-                * EPM_PROTOCOL_UUID (0x0D or 13) with the one for 
-                * EPM_PROTOCOL_SPX (0x13) here. -- jelmer*/
-               { EPM_PROTOCOL_NCACN, EPM_PROTOCOL_NCALRPC, EPM_PROTOCOL_UUID },
-       },
-};
-
-static const struct {
-       const char *name;
-       uint32_t flag;
-} ncacn_options[] = {
-       {"sign", DCERPC_SIGN},
-       {"seal", DCERPC_SEAL},
-       {"connect", DCERPC_CONNECT},
-       {"spnego", DCERPC_AUTH_SPNEGO},
-       {"ntlm", DCERPC_AUTH_NTLM},
-       {"krb5", DCERPC_AUTH_KRB5},
-       {"validate", DCERPC_DEBUG_VALIDATE_BOTH},
-       {"print", DCERPC_DEBUG_PRINT_BOTH},
-       {"padcheck", DCERPC_DEBUG_PAD_CHECK},
-       {"bigendian", DCERPC_PUSH_BIGENDIAN},
-       {"smb2", DCERPC_SMB2}
-};
-
-const char *epm_floor_string(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
-       struct ndr_syntax_id syntax;
-       NTSTATUS status;
-
-       switch(epm_floor->lhs.protocol) {
-               case EPM_PROTOCOL_UUID:
-                       status = dcerpc_floor_get_lhs_data(epm_floor, &syntax);
-                       if (NT_STATUS_IS_OK(status)) {
-                               /* lhs is used: UUID */
-                               char *uuidstr;
-
-                               if (GUID_equal(&syntax.uuid, &ndr_transfer_syntax.uuid)) {
-                                       return "NDR";
-                               } 
-
-                               if (GUID_equal(&syntax.uuid, &ndr64_transfer_syntax.uuid)) {
-                                       return "NDR64";
-                               } 
-
-                               uuidstr = GUID_string(mem_ctx, &syntax.uuid);
-
-                               return talloc_asprintf(mem_ctx, " uuid %s/0x%02x", uuidstr, syntax.if_version);
-                       } else { /* IPX */
-                               return talloc_asprintf(mem_ctx, "IPX:%s", 
-                                               data_blob_hex_string(mem_ctx, &epm_floor->rhs.uuid.unknown));
-                       }
-
-               case EPM_PROTOCOL_NCACN:
-                       return "RPC-C";
-
-               case EPM_PROTOCOL_NCADG:
-                       return "RPC";
-
-               case EPM_PROTOCOL_NCALRPC:
-                       return "NCALRPC";
-
-               case EPM_PROTOCOL_DNET_NSP:
-                       return "DNET/NSP";
-
-               case EPM_PROTOCOL_IP:
-                       return talloc_asprintf(mem_ctx, "IP:%s", epm_floor->rhs.ip.ipaddr);
-
-               case EPM_PROTOCOL_PIPE:
-                       return talloc_asprintf(mem_ctx, "PIPE:%s", epm_floor->rhs.pipe.path);
-
-               case EPM_PROTOCOL_SMB:
-                       return talloc_asprintf(mem_ctx, "SMB:%s", epm_floor->rhs.smb.unc);
-
-               case EPM_PROTOCOL_UNIX_DS:
-                       return talloc_asprintf(mem_ctx, "Unix:%s", epm_floor->rhs.unix_ds.path);
-
-               case EPM_PROTOCOL_NETBIOS:
-                       return talloc_asprintf(mem_ctx, "NetBIOS:%s", epm_floor->rhs.netbios.name);
-
-               case EPM_PROTOCOL_NETBEUI:
-                       return "NETBeui";
-
-               case EPM_PROTOCOL_SPX:
-                       return "SPX";
-
-               case EPM_PROTOCOL_NB_IPX:
-                       return "NB_IPX";
-
-               case EPM_PROTOCOL_HTTP:
-                       return talloc_asprintf(mem_ctx, "HTTP:%d", epm_floor->rhs.http.port);
-
-               case EPM_PROTOCOL_TCP:
-                       return talloc_asprintf(mem_ctx, "TCP:%d", epm_floor->rhs.tcp.port);
-
-               case EPM_PROTOCOL_UDP:
-                       return talloc_asprintf(mem_ctx, "UDP:%d", epm_floor->rhs.udp.port);
-
-               default:
-                       return talloc_asprintf(mem_ctx, "UNK(%02x):", epm_floor->lhs.protocol);
-       }
-}
-
-
-/*
-  form a binding string from a binding structure
-*/
-_PUBLIC_ char *dcerpc_binding_string(TALLOC_CTX *mem_ctx, const struct dcerpc_binding *b)
-{
-       char *s = talloc_strdup(mem_ctx, "");
-       int i;
-       const char *t_name = NULL;
-
-       if (b->transport != NCA_UNKNOWN) {
-               for (i=0;i<ARRAY_SIZE(transports);i++) {
-                       if (transports[i].transport == b->transport) {
-                               t_name = transports[i].name;
-                       }
-               }
-               if (!t_name) {
-                       return NULL;
-               }
-       }
-
-       if (!GUID_all_zero(&b->object.uuid)) { 
-               s = talloc_asprintf(s, "%s@",
-                                   GUID_string(mem_ctx, &b->object.uuid));
-       }
-
-       if (t_name != NULL) {
-               s = talloc_asprintf_append_buffer(s, "%s:", t_name);
-               if (s == NULL) {
-                       return NULL;
-               }
-       }
-
-       if (b->host) {
-               s = talloc_asprintf_append_buffer(s, "%s", b->host);
-       }
-
-       if (!b->endpoint && !b->options && !b->flags) {
-               return s;
-       }
-
-       s = talloc_asprintf_append_buffer(s, "[");
-
-       if (b->endpoint) {
-               s = talloc_asprintf_append_buffer(s, "%s", b->endpoint);
-       }
-
-       /* this is a *really* inefficent way of dealing with strings,
-          but this is rarely called and the strings are always short,
-          so I don't care */
-       for (i=0;b->options && b->options[i];i++) {
-               s = talloc_asprintf_append_buffer(s, ",%s", b->options[i]);
-               if (!s) return NULL;
-       }
-
-       for (i=0;i<ARRAY_SIZE(ncacn_options);i++) {
-               if (b->flags & ncacn_options[i].flag) {
-                       s = talloc_asprintf_append_buffer(s, ",%s", ncacn_options[i].name);
-                       if (!s) return NULL;
-               }
-       }
-
-       s = talloc_asprintf_append_buffer(s, "]");
-
-       return s;
-}
-
-/*
-  parse a binding string into a dcerpc_binding structure
-*/
-_PUBLIC_ NTSTATUS dcerpc_parse_binding(TALLOC_CTX *mem_ctx, const char *s, struct dcerpc_binding **b_out)
-{
-       struct dcerpc_binding *b;
-       char *options;
-       char *p;
-       int i, j, comma_count;
-
-       b = talloc(mem_ctx, struct dcerpc_binding);
-       if (!b) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       p = strchr(s, '@');
-
-       if (p && PTR_DIFF(p, s) == 36) { /* 36 is the length of a UUID */
-               NTSTATUS status;
-
-               status = GUID_from_string(s, &b->object.uuid);
-
-               if (NT_STATUS_IS_ERR(status)) {
-                       DEBUG(0, ("Failed parsing UUID\n"));
-                       return status;
-               }
-
-               s = p + 1;
-       } else {
-               ZERO_STRUCT(b->object);
-       }
-
-       b->object.if_version = 0;
-
-       p = strchr(s, ':');
-
-       if (p == NULL) {
-               b->transport = NCA_UNKNOWN;
-       } else {
-               char *type = talloc_strndup(mem_ctx, s, PTR_DIFF(p, s));
-               if (!type) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-
-               for (i=0;i<ARRAY_SIZE(transports);i++) {
-                       if (strcasecmp(type, transports[i].name) == 0) {
-                               b->transport = transports[i].transport;
-                               break;
-                       }
-               }
-
-               if (i==ARRAY_SIZE(transports)) {
-                       DEBUG(0,("Unknown dcerpc transport '%s'\n", type));
-                       return NT_STATUS_INVALID_PARAMETER;
-               }
-
-               talloc_free(type);
-       
-               s = p+1;
-       }
-
-       p = strchr(s, '[');
-       if (p) {
-               b->host = talloc_strndup(b, s, PTR_DIFF(p, s));
-               options = talloc_strdup(mem_ctx, p+1);
-               if (options[strlen(options)-1] != ']') {
-                       return NT_STATUS_INVALID_PARAMETER;
-               }
-               options[strlen(options)-1] = 0;
-       } else {
-               b->host = talloc_strdup(b, s);
-               options = NULL;
-       }
-       if (!b->host) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       b->target_hostname = b->host;
-
-       b->options = NULL;
-       b->flags = 0;
-       b->assoc_group_id = 0;
-       b->endpoint = NULL;
-
-       if (!options) {
-               *b_out = b;
-               return NT_STATUS_OK;
-       }
-
-       comma_count = count_chars(options, ',');
-
-       b->options = talloc_array(b, const char *, comma_count+2);
-       if (!b->options) {
-               return NT_STATUS_NO_MEMORY;
-       }
-
-       for (i=0; (p = strchr(options, ',')); i++) {
-               b->options[i] = talloc_strndup(b, options, PTR_DIFF(p, options));
-               if (!b->options[i]) {
-                       return NT_STATUS_NO_MEMORY;
-               }
-               options = p+1;
-       }
-       b->options[i] = options;
-       b->options[i+1] = NULL;
-
-       /* some options are pre-parsed for convenience */
-       for (i=0;b->options[i];i++) {
-               for (j=0;j<ARRAY_SIZE(ncacn_options);j++) {
-                       if (strcasecmp(ncacn_options[j].name, b->options[i]) == 0) {
-                               int k;
-                               b->flags |= ncacn_options[j].flag;
-                               for (k=i;b->options[k];k++) {
-                                       b->options[k] = b->options[k+1];
-                               }
-                               i--;
-                               break;
-                       }
-               }
-       }
-
-       if (b->options[0]) {
-               /* Endpoint is first option */
-               b->endpoint = b->options[0];
-               if (strlen(b->endpoint) == 0) b->endpoint = NULL;
-
-               for (i=0;b->options[i];i++) {
-                       b->options[i] = b->options[i+1];
-               }
-       }
-
-       if (b->options[0] == NULL)
-               b->options = NULL;
-       
-       *b_out = b;
-       return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_floor_get_lhs_data(struct epm_floor *epm_floor, struct ndr_syntax_id *syntax)
-{
-       TALLOC_CTX *mem_ctx = talloc_init("floor_get_lhs_data");
-       struct ndr_pull *ndr = ndr_pull_init_blob(&epm_floor->lhs.lhs_data, mem_ctx, NULL);
-       enum ndr_err_code ndr_err;
-       uint16_t if_version=0;
-
-       ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
-       ndr_err = ndr_pull_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               talloc_free(mem_ctx);
-               return ndr_map_error2ntstatus(ndr_err);
-       }
-
-       ndr_err = ndr_pull_uint16(ndr, NDR_SCALARS, &if_version);
-       if (!NDR_ERR_CODE_IS_SUCCESS(ndr_err)) {
-               talloc_free(mem_ctx);
-               return ndr_map_error2ntstatus(ndr_err);
-       }
-
-       syntax->if_version = if_version;
-
-       talloc_free(mem_ctx);
-
-       return NT_STATUS_OK;
-}
-
-static DATA_BLOB dcerpc_floor_pack_lhs_data(TALLOC_CTX *mem_ctx, const struct ndr_syntax_id *syntax)
-{
-       struct ndr_push *ndr = ndr_push_init_ctx(mem_ctx, NULL);
-
-       ndr->flags |= LIBNDR_FLAG_NOALIGN;
-
-       ndr_push_GUID(ndr, NDR_SCALARS | NDR_BUFFERS, &syntax->uuid);
-       ndr_push_uint16(ndr, NDR_SCALARS, syntax->if_version);
-
-       return ndr_push_blob(ndr);
-}
-
-const char *dcerpc_floor_get_rhs_data(TALLOC_CTX *mem_ctx, struct epm_floor *epm_floor)
-{
-       switch (epm_floor->lhs.protocol) {
-       case EPM_PROTOCOL_TCP:
-               if (epm_floor->rhs.tcp.port == 0) return NULL;
-               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.tcp.port);
-               
-       case EPM_PROTOCOL_UDP:
-               if (epm_floor->rhs.udp.port == 0) return NULL;
-               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.udp.port);
-
-       case EPM_PROTOCOL_HTTP:
-               if (epm_floor->rhs.http.port == 0) return NULL;
-               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.http.port);
-
-       case EPM_PROTOCOL_IP:
-               return talloc_strdup(mem_ctx, epm_floor->rhs.ip.ipaddr);
-
-       case EPM_PROTOCOL_NCACN:
-               return NULL;
-
-       case EPM_PROTOCOL_NCADG:
-               return NULL;
-
-       case EPM_PROTOCOL_SMB:
-               if (strlen(epm_floor->rhs.smb.unc) == 0) return NULL;
-               return talloc_strdup(mem_ctx, epm_floor->rhs.smb.unc);
-
-       case EPM_PROTOCOL_PIPE:
-               if (strlen(epm_floor->rhs.pipe.path) == 0) return NULL;
-               return talloc_strdup(mem_ctx, epm_floor->rhs.pipe.path);
-
-       case EPM_PROTOCOL_NETBIOS:
-               if (strlen(epm_floor->rhs.netbios.name) == 0) return NULL;
-               return talloc_strdup(mem_ctx, epm_floor->rhs.netbios.name);
-
-       case EPM_PROTOCOL_NCALRPC:
-               return NULL;
-               
-       case EPM_PROTOCOL_VINES_SPP:
-               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_spp.port);
-               
-       case EPM_PROTOCOL_VINES_IPC:
-               return talloc_asprintf(mem_ctx, "%d", epm_floor->rhs.vines_ipc.port);
-               
-       case EPM_PROTOCOL_STREETTALK:
-               return talloc_strdup(mem_ctx, epm_floor->rhs.streettalk.streettalk);
-               
-       case EPM_PROTOCOL_UNIX_DS:
-               if (strlen(epm_floor->rhs.unix_ds.path) == 0) return NULL;
-               return talloc_strdup(mem_ctx, epm_floor->rhs.unix_ds.path);
-               
-       case EPM_PROTOCOL_NULL:
-               return NULL;
-
-       default:
-               DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
-               break;
-       }
-
-       return NULL;
-}
-
-static NTSTATUS dcerpc_floor_set_rhs_data(TALLOC_CTX *mem_ctx, 
-                                         struct epm_floor *epm_floor,  
-                                         const char *data)
-{
-       switch (epm_floor->lhs.protocol) {
-       case EPM_PROTOCOL_TCP:
-               epm_floor->rhs.tcp.port = atoi(data);
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_UDP:
-               epm_floor->rhs.udp.port = atoi(data);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_HTTP:
-               epm_floor->rhs.http.port = atoi(data);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_IP:
-               epm_floor->rhs.ip.ipaddr = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.ip.ipaddr);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_NCACN:
-               epm_floor->rhs.ncacn.minor_version = 0;
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_NCADG:
-               epm_floor->rhs.ncadg.minor_version = 0;
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_SMB:
-               epm_floor->rhs.smb.unc = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.smb.unc);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_PIPE:
-               epm_floor->rhs.pipe.path = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.pipe.path);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_NETBIOS:
-               epm_floor->rhs.netbios.name = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.netbios.name);
-               return NT_STATUS_OK;
-
-       case EPM_PROTOCOL_NCALRPC:
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_VINES_SPP:
-               epm_floor->rhs.vines_spp.port = atoi(data);
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_VINES_IPC:
-               epm_floor->rhs.vines_ipc.port = atoi(data);
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_STREETTALK:
-               epm_floor->rhs.streettalk.streettalk = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.streettalk.streettalk);
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_UNIX_DS:
-               epm_floor->rhs.unix_ds.path = talloc_strdup(mem_ctx, data);
-               NT_STATUS_HAVE_NO_MEMORY(epm_floor->rhs.unix_ds.path);
-               return NT_STATUS_OK;
-               
-       case EPM_PROTOCOL_NULL:
-               return NT_STATUS_OK;
-
-       default:
-               DEBUG(0,("Unsupported lhs protocol %d\n", epm_floor->lhs.protocol));
-               break;
-       }
-
-       return NT_STATUS_NOT_SUPPORTED;
-}
-
-enum dcerpc_transport_t dcerpc_transport_by_endpoint_protocol(int prot)
-{
-       int i;
-
-       /* Find a transport that has 'prot' as 4th protocol */
-       for (i=0;i<ARRAY_SIZE(transports);i++) {
-               if (transports[i].num_protocols >= 2 && 
-                       transports[i].protseq[1] == prot) {
-                       return transports[i].transport;
-               }
-       }
-       
-       /* Unknown transport */
-       return (unsigned int)-1;
-}
-
-_PUBLIC_ enum dcerpc_transport_t dcerpc_transport_by_tower(struct epm_tower *tower)
-{
-       int i;
-
-       /* Find a transport that matches this tower */
-       for (i=0;i<ARRAY_SIZE(transports);i++) {
-               int j;
-               if (transports[i].num_protocols != tower->num_floors - 2) {
-                       continue; 
-               }
-
-               for (j = 0; j < transports[i].num_protocols; j++) {
-                       if (transports[i].protseq[j] != tower->floors[j+2].lhs.protocol) {
-                               break;
-                       }
-               }
-
-               if (j == transports[i].num_protocols) {
-                       return transports[i].transport;
-               }
-       }
-       
-       /* Unknown transport */
-       return (unsigned int)-1;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_from_tower(TALLOC_CTX *mem_ctx, 
-                                  struct epm_tower *tower, 
-                                  struct dcerpc_binding **b_out)
-{
-       NTSTATUS status;
-       struct dcerpc_binding *binding;
-
-       binding = talloc(mem_ctx, struct dcerpc_binding);
-       NT_STATUS_HAVE_NO_MEMORY(binding);
-
-       ZERO_STRUCT(binding->object);
-       binding->options = NULL;
-       binding->host = NULL;
-       binding->target_hostname = NULL;
-       binding->flags = 0;
-       binding->assoc_group_id = 0;
-
-       binding->transport = dcerpc_transport_by_tower(tower);
-
-       if (binding->transport == (unsigned int)-1) {
-               return NT_STATUS_NOT_SUPPORTED;
-       }
-
-       if (tower->num_floors < 1) {
-               return NT_STATUS_OK;
-       }
-
-       /* Set object uuid */
-       status = dcerpc_floor_get_lhs_data(&tower->floors[0], &binding->object);
-       
-       if (!NT_STATUS_IS_OK(status)) {
-               DEBUG(1, ("Error pulling object uuid and version: %s", nt_errstr(status)));     
-               return status;
-       }
-
-       /* Ignore floor 1, it contains the NDR version info */
-       
-       binding->options = NULL;
-
-       /* Set endpoint */
-       if (tower->num_floors >= 4) {
-               binding->endpoint = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[3]);
-       } else {
-               binding->endpoint = NULL;
-       }
-
-       /* Set network address */
-       if (tower->num_floors >= 5) {
-               binding->host = dcerpc_floor_get_rhs_data(mem_ctx, &tower->floors[4]);
-               NT_STATUS_HAVE_NO_MEMORY(binding->host);
-               binding->target_hostname = binding->host;
-       }
-       *b_out = binding;
-       return NT_STATUS_OK;
-}
-
-_PUBLIC_ NTSTATUS dcerpc_binding_build_tower(TALLOC_CTX *mem_ctx, struct dcerpc_binding *binding, struct epm_tower *tower)
-{
-       const enum epm_protocol *protseq = NULL;
-       int num_protocols = -1, i;
-       NTSTATUS status;
-       
-       /* Find transport */
-       for (i=0;i<ARRAY_SIZE(transports);i++) {
-               if (transports[i].transport == binding->transport) {
-                       protseq = transports[i].protseq;
-                       num_protocols = transports[i].num_protocols;
-                       break;
-               }
-       }
-
-       if (num_protocols == -1) {
-               DEBUG(0, ("Unable to find transport with id '%d'\n", binding->transport));
-               return NT_STATUS_UNSUCCESSFUL;
-       }
-
-       tower->num_floors = 2 + num_protocols;
-       tower->floors = talloc_array(mem_ctx, struct epm_floor, tower->num_floors);
-
-       /* Floor 0 */
-       tower->floors[0].lhs.protocol = EPM_PROTOCOL_UUID;
-
-       tower->floors[0].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, &binding->object);
-
-       tower->floors[0].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-       
-       /* Floor 1 */
-       tower->floors[1].lhs.protocol = EPM_PROTOCOL_UUID;
-
-       tower->floors[1].lhs.lhs_data = dcerpc_floor_pack_lhs_data(mem_ctx, 
-                                                               &ndr_transfer_syntax);
-       
-       tower->floors[1].rhs.uuid.unknown = data_blob_talloc_zero(mem_ctx, 2);
-       
-       /* Floor 2 to num_protocols */
-       for (i = 0; i < num_protocols; i++) {
-               tower->floors[2 + i].lhs.protocol = protseq[i];
-               tower->floors[2 + i].lhs.lhs_data = data_blob_talloc(mem_ctx, NULL, 0);
-               ZERO_STRUCT(tower->floors[2 + i].rhs);
-               dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[2 + i], "");
-       }
-
-       /* The 4th floor contains the endpoint */
-       if (num_protocols >= 2 && binding->endpoint) {
-               status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[3], binding->endpoint);
-               if (NT_STATUS_IS_ERR(status)) {
-                       return status;
-               }
-       }
-       
-       /* The 5th contains the network address */
-       if (num_protocols >= 3 && binding->host) {
-               if (is_ipaddress(binding->host)) {
-                       status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], 
-                                                          binding->host);
-               } else {
-                       /* note that we don't attempt to resolve the
-                          name here - when we get a hostname here we
-                          are in the client code, and want to put in
-                          a wildcard all-zeros IP for the server to
-                          fill in */
-                       status = dcerpc_floor_set_rhs_data(mem_ctx, &tower->floors[4], 
-                                                          "0.0.0.0");
-               }
-               if (NT_STATUS_IS_ERR(status)) {
-                       return status;
-               }
-       }
-
-       return NT_STATUS_OK;
-}
-
 
 struct epm_map_binding_state {
        struct dcerpc_binding *binding;
@@ -904,32 +209,20 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
        struct epm_map_binding_state *s;
        struct composite_context *pipe_connect_req;
        struct cli_credentials *anon_creds;
-       struct event_context *new_ev = NULL;
 
        NTSTATUS status;
        struct dcerpc_binding *epmapper_binding;
        int i;
 
-       /* Try to find event context in memory context in case passed
-        * event_context (argument) was NULL. If there's none, just
-        * create a new one.
-        */
        if (ev == NULL) {
-               ev = event_context_find(mem_ctx);
-               if (ev == NULL) {
-                       new_ev = event_context_init(mem_ctx);
-                       if (new_ev == NULL) return NULL;
-                       ev = new_ev;
-               }
+               return NULL;
        }
 
        /* composite context allocation and setup */
        c = composite_create(mem_ctx, ev);
        if (c == NULL) {
-               talloc_free(new_ev);
                return NULL;
        }
-       talloc_steal(c, new_ev);
 
        s = talloc_zero(c, struct epm_map_binding_state);
        if (composite_nomem(s, c)) return c;
@@ -940,7 +233,6 @@ struct composite_context *dcerpc_epm_map_binding_send(TALLOC_CTX *mem_ctx,
 
        /* anonymous credentials for rpc connection used to get endpoint mapping */
        anon_creds = cli_credentials_init(mem_ctx);
-       cli_credentials_set_event_context(anon_creds, ev);
        cli_credentials_set_anonymous(anon_creds);
 
        /*
index 46bfaa9381fbc2f6be3e5d423f45d84392ee195a..7fae6bc1f6c67d8db04e82b9c62a0f01a1b5697c 100644 (file)
@@ -54,7 +54,7 @@ static void nbtd_netlogon_getdc(struct dgram_mailslot_handler *dgmslot,
                return;
        }
 
-       samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx));
+       samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx));
        if (samctx == NULL) {
                DEBUG(2,("Unable to open sam in getdc reply\n"));
                return;
@@ -125,7 +125,7 @@ static void nbtd_netlogon_getdc2(struct dgram_mailslot_handler *dgmslot,
                return;
        }
 
-       samctx = samdb_connect(packet, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->lp_ctx));
+       samctx = samdb_connect(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx, anonymous_session(packet, iface->nbtsrv->task->event_ctx, iface->nbtsrv->task->lp_ctx));
        if (samctx == NULL) {
                DEBUG(2,("Unable to open sam in getdc reply\n"));
                return;
index 2ac1fb4ef3fb2cc766b7507269d1998261e56185..832bbe0103924f30797face6553fee1f6125146c 100644 (file)
@@ -66,7 +66,7 @@ static void nbtd_task_init(struct task_server *task)
                return;
        }
 
-       nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->lp_ctx, anonymous_session(nbtsrv, task->lp_ctx));
+       nbtsrv->sam_ctx = samdb_connect(nbtsrv, task->event_ctx, task->lp_ctx, anonymous_session(nbtsrv, task->event_ctx, task->lp_ctx));
        if (nbtsrv->sam_ctx == NULL) {
                task_server_terminate(task, "nbtd failed to open samdb");
                return;
index 7de5bba468d30289ac426440c8e071dd33c86299..c84b01f2b20571d667162ab27383e5243881f45a 100644 (file)
@@ -945,7 +945,8 @@ failed:
        return NBT_RCODE_SVR;
 }
 
-static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, struct winsdb_handle *h)
+static bool winsdb_check_or_add_module_list(struct event_context *ev_ctx, 
+                                           struct loadparm_context *lp_ctx, struct winsdb_handle *h)
 {
        int trans;
        int ret;
@@ -992,7 +993,7 @@ static bool winsdb_check_or_add_module_list(struct loadparm_context *lp_ctx, str
                flags |= LDB_FLG_NOSYNC;
        }
 
-       h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
+       h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
                                  NULL, NULL, flags, NULL);
        if (!h->ldb) goto failed;
 
@@ -1010,7 +1011,9 @@ failed:
        return false;
 }
 
-struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, 
+                                    struct event_context *ev_ctx,
+                                    struct loadparm_context *lp_ctx,
                                     const char *owner,
                                     enum winsdb_handle_caller caller)
 {
@@ -1026,7 +1029,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
                flags |= LDB_FLG_NOSYNC;
        }
 
-       h->ldb = ldb_wrap_connect(h, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
+       h->ldb = ldb_wrap_connect(h, ev_ctx, lp_ctx, lock_path(h, lp_ctx, lp_wins_url(lp_ctx)),
                                  NULL, NULL, flags, NULL);
        if (!h->ldb) goto failed;       
 
@@ -1037,7 +1040,7 @@ struct winsdb_handle *winsdb_connect(TALLOC_CTX *mem_ctx, struct loadparm_contex
        if (!h->local_owner) goto failed;
 
        /* make sure the module list is available and used */
-       ret = winsdb_check_or_add_module_list(lp_ctx, h);
+       ret = winsdb_check_or_add_module_list(ev_ctx, lp_ctx, h);
        if (!ret) goto failed;
 
        ldb_err = ldb_set_opaque(h->ldb, "winsdb_handle", h);
index f116c458981723e391d6d4d78068e75d1d06afa9..f8901ce09d2943bcb3b3747a56d30f2f0184b5a1 100644 (file)
@@ -985,7 +985,8 @@ NTSTATUS nbtd_winsserver_init(struct nbtd_server *nbtsrv)
                owner = iface_n_ip(ifaces, 0);
        }
 
-       nbtsrv->winssrv->wins_db     = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->lp_ctx,
+       nbtsrv->winssrv->wins_db     = winsdb_connect(nbtsrv->winssrv, nbtsrv->task->event_ctx, 
+                                                     nbtsrv->task->lp_ctx,
                                                      owner, WINSDB_HANDLE_CALLER_NBTD);
        if (!nbtsrv->winssrv->wins_db) {
                return NT_STATUS_INTERNAL_DB_ERROR;
index 3e95c3c5e1c0cca0e6a52eac8ea55d389e38303a..7138a2fdfba81a0a5912dd62b4ad76021e6a6a75 100644 (file)
@@ -220,6 +220,7 @@ struct ntptr_ops {
 struct ntptr_context {
        const struct ntptr_ops *ops;
        void *private_data;
+       struct event_context *ev_ctx;
        struct loadparm_context *lp_ctx;
 };
 
index a26d36854df44857cc0a8e4839d4c9be3b5aa824..a7004be90ba289a25f8e6e0ca912be4870098da1 100644 (file)
@@ -70,7 +70,7 @@ NTSTATUS ntptr_register(const void *_ops)
 
 NTSTATUS ntptr_init(struct loadparm_context *lp_ctx)
 {
-       extern int ntptr_simple_ldb_init(void);
+       extern NTSTATUS ntptr_simple_ldb_init(void);
        init_module_fn static_init[] = { STATIC_ntptr_MODULES };
        init_module_fn *shared_init = load_samba_modules(NULL, lp_ctx, "ntptr");
 
@@ -119,7 +119,8 @@ const struct ntptr_critical_sizes *ntptr_interface_version(void)
 /*
   create a ntptr_context with a specified NTPTR backend
 */
-NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx,
+                           struct loadparm_context *lp_ctx,
                            const char *providor, struct ntptr_context **_ntptr)
 {
        NTSTATUS status;
@@ -133,6 +134,7 @@ NTSTATUS ntptr_init_context(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx
        NT_STATUS_HAVE_NO_MEMORY(ntptr);
        ntptr->private_data     = NULL;
        ntptr->ops              = ntptr_backend_byname(providor);
+       ntptr->ev_ctx           = ev_ctx;
        ntptr->lp_ctx           = lp_ctx;
 
        if (!ntptr->ops) {
index 47f3c0ddf0e326c9143537c2c847996ce64abacc..3573fac3eadcfbd94b272cc2346260bddd34f72d 100644 (file)
@@ -42,9 +42,9 @@
   connect to the SPOOLSS database
   return a ldb_context pointer on success, or NULL on failure
  */
-static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx)
+static struct ldb_context *sptr_db_connect(TALLOC_CTX *mem_ctx, struct event_context *ev_ctx, struct loadparm_context *lp_ctx)
 {
-       return ldb_wrap_connect(mem_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx), 
+       return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, lp_spoolss_url(lp_ctx), system_session(mem_ctx, lp_ctx), 
                                NULL, 0, NULL);
 }
 
@@ -87,7 +87,7 @@ static int sptr_db_search(struct ldb_context *ldb,
 
 static NTSTATUS sptr_init_context(struct ntptr_context *ntptr)
 {
-       struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->lp_ctx);
+       struct ldb_context *sptr_db = sptr_db_connect(ntptr, ntptr->ev_ctx, ntptr->lp_ctx);
        NT_STATUS_HAVE_NO_MEMORY(sptr_db);
 
        ntptr->private_data = sptr_db;
index 2feb1a0efe33a3a8379dcce1a032987e14aa55b9..2b6126873372dfe03fa21a57f6e47a3425ebabfe 100644 (file)
@@ -171,7 +171,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
                if (!credentials) {
                        return NT_STATUS_NO_MEMORY;
                }
-               cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
                cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
                cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
                if (domain) {
@@ -181,7 +180,6 @@ static NTSTATUS cvfs_connect(struct ntvfs_module_context *ntvfs,
        } else if (machine_account) {
                DEBUG(5, ("CIFS backend: Using machine account\n"));
                credentials = cli_credentials_init(private);
-               cli_credentials_set_event_context(credentials, ntvfs->ctx->event_ctx);
                cli_credentials_set_conf(credentials, ntvfs->ctx->lp_ctx);
                if (domain) {
                        cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
index 23aa3fb6687290de637a9941ff64d4b6eb9357af..9055d6ece330304cde63b80a0da369b8d35f9fcc 100644 (file)
@@ -93,6 +93,10 @@ struct notify_context *notify_init(TALLOC_CTX *mem_ctx, struct server_id server,
                return NULL;
        }
 
+       if (ev == NULL) {
+               return NULL;
+       }
+
        notify = talloc(mem_ctx, struct notify_context);
        if (notify == NULL) {
                return NULL;
index faf48705c466cc27630c809fe755de68e33939f5..4969f1a79100f766ef2763be439ee1da45a151dd 100644 (file)
@@ -21,6 +21,7 @@
 #include "includes.h"
 #include "libcli/raw/interfaces.h"
 #include "libcli/rap/rap.h"
+#include "events/events.h"
 #include "ntvfs/ipc/proto.h"
 #include "librpc/ndr/libndr.h"
 #include "param/param.h"
@@ -100,11 +101,14 @@ struct rap_call {
 
        struct ndr_pull *ndr_pull_param;
        struct ndr_pull *ndr_pull_data;
+
+       struct event_context *event_ctx;
 };
 
 #define RAPNDR_FLAGS (LIBNDR_FLAG_NOALIGN|LIBNDR_FLAG_STR_ASCII|LIBNDR_FLAG_STR_NULLTERM);
 
 static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
+                                        struct event_context *ev_ctx,
                                         struct loadparm_context *lp_ctx,
                                         struct smb_trans2 *trans)
 {
@@ -118,6 +122,7 @@ static struct rap_call *new_rap_srv_call(TALLOC_CTX *mem_ctx,
        ZERO_STRUCTP(call);
 
        call->lp_ctx = talloc_reference(call, lp_ctx);
+       call->event_ctx = ev_ctx;
 
        call->mem_ctx = mem_ctx;
 
@@ -271,7 +276,7 @@ static NTSTATUS _rap_netshareenum(struct rap_call *call)
                break;
        }
 
-       result = rap_netshareenum(call, call->lp_ctx, &r);
+       result = rap_netshareenum(call, call->event_ctx, call->lp_ctx, &r);
 
        if (!NT_STATUS_IS_OK(result))
                return result;
@@ -430,7 +435,7 @@ static const struct
        {NULL, -1, api_Unsupported}
 };
 
-NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct loadparm_context *lp_ctx,
                      struct smb_trans2 *trans)
 {
        int i;
@@ -440,7 +445,7 @@ NTSTATUS ipc_rap_call(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
        struct ndr_push *final_param;
        struct ndr_push *final_data;
 
-       call = new_rap_srv_call(mem_ctx, lp_ctx, trans);
+       call = new_rap_srv_call(mem_ctx, event_ctx, lp_ctx, trans);
 
        if (call == NULL)
                return NT_STATUS_NO_MEMORY;
index 633f0bf36e3abb7d27a14db55da2fa2bd0204712..d9fb7e21b23fef2567fe97551cb7b5d188a7247c 100644 (file)
@@ -29,6 +29,7 @@
  * idea. */
 
 NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
+                         struct event_context *event_ctx,
                          struct loadparm_context *lp_ctx,
                          struct rap_NetShareEnum *r)
 {
@@ -42,7 +43,7 @@ NTSTATUS rap_netshareenum(TALLOC_CTX *mem_ctx,
        r->out.available = 0;
        r->out.info = NULL;
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(lp_ctx), event_ctx, lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return nterr;
        }
index 92f0eadae1de74379a97b70b11f3cf6030509bab..ea7b54ae6ac29a4228119df81d3db141b057bb7f 100644 (file)
@@ -805,7 +805,7 @@ static NTSTATUS ipc_trans(struct ntvfs_module_context *ntvfs,
        NTSTATUS status;
 
        if (strequal(trans->in.trans_name, "\\PIPE\\LANMAN"))
-               return ipc_rap_call(req, ntvfs->ctx->lp_ctx, trans);
+               return ipc_rap_call(req, ntvfs->ctx->event_ctx, ntvfs->ctx->lp_ctx, trans);
 
                if (trans->in.setup_count != 2) {
                return NT_STATUS_INVALID_PARAMETER;
index e1a86c07c0468d112f12a291f5c7982032a768fe..3653ad82c1400db0ae6bca350a589e6d000975ab 100644 (file)
@@ -208,7 +208,21 @@ static NTSTATUS ntvfs_map_open_finish(struct ntvfs_module_context *ntvfs,
 
        case RAW_OPEN_SMB2:
                io->smb2.out.file.ntvfs         = io2->generic.out.file.ntvfs;
-               io->smb2.out.oplock_level       = 0;
+               switch (io2->generic.out.oplock_level) {
+               case BATCH_OPLOCK_RETURN:
+                       io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_BATCH;
+                       break;
+               case EXCLUSIVE_OPLOCK_RETURN:
+                       io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_EXCLUSIVE;
+                       break;
+               case LEVEL_II_OPLOCK_RETURN:
+                       io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_II;
+                       break;
+               default:
+                       io->smb2.out.oplock_level = SMB2_OPLOCK_LEVEL_NONE;
+                       break;
+               }
+               io->smb2.out.reserved           = 0;
                io->smb2.out.create_action      = io2->generic.out.create_action;
                io->smb2.out.create_time        = io2->generic.out.create_time;
                io->smb2.out.access_time        = io2->generic.out.access_time;
@@ -484,7 +498,18 @@ NTSTATUS ntvfs_map_open(struct ntvfs_module_context *ntvfs,
                status = ntvfs->ops->open(ntvfs, req, io2);
                break;
        case RAW_OPEN_SMB2:
-               io2->generic.in.flags           = 0;
+               switch (io->smb2.in.oplock_level) {
+               case SMB2_OPLOCK_LEVEL_BATCH:
+                       io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_BATCH_OPLOCK |
+                                               NTCREATEX_FLAGS_REQUEST_OPLOCK;
+                       break;
+               case SMB2_OPLOCK_LEVEL_EXCLUSIVE:
+                       io2->generic.in.flags = NTCREATEX_FLAGS_REQUEST_OPLOCK;
+                       break;
+               default:
+                       io2->generic.in.flags = 0;
+                       break;
+               }
                io2->generic.in.root_fid        = 0;
                io2->generic.in.access_mask     = io->smb2.in.desired_access;
                io2->generic.in.alloc_size      = 0;
@@ -1018,6 +1043,23 @@ NTSTATUS ntvfs_map_lock(struct ntvfs_module_context *ntvfs,
                /* initialize output value */
                lck->smb2.out.unknown1 = 0;
                break;
+
+       case RAW_LOCK_SMB2_BREAK:
+               lck2->generic.level             = RAW_LOCK_GENERIC;
+               lck2->generic.in.file.ntvfs     = lck->smb2_break.in.file.ntvfs;
+               lck2->generic.in.mode           = LOCKING_ANDX_OPLOCK_RELEASE |
+                                                 ((lck->smb2_break.in.oplock_level << 8) & 0xFF00);
+               lck2->generic.in.timeout        = 0;
+               lck2->generic.in.ulock_cnt      = 0;
+               lck2->generic.in.lock_cnt       = 0;
+               lck2->generic.in.locks          = NULL;
+
+               /* initialize output value */
+               lck->smb2_break.out.oplock_level= lck->smb2_break.in.oplock_level;
+               lck->smb2_break.out.reserved    = lck->smb2_break.in.reserved;
+               lck->smb2_break.out.reserved2   = lck->smb2_break.in.reserved2;
+               lck->smb2_break.out.file        = lck->smb2_break.in.file;
+               break;
        }
 
        /* 
@@ -1214,7 +1256,8 @@ static NTSTATUS ntvfs_map_read_finish(struct ntvfs_module_context *ntvfs,
                break;
        case RAW_READ_SMB2:
                rd->smb2.out.data.length= rd2->generic.out.nread;
-               rd->smb2.out.unknown1   = 0;
+               rd->smb2.out.remaining  = 0;
+               rd->smb2.out.reserved   = 0;
                break;
        default:
                return NT_STATUS_INVALID_LEVEL;
index 249f1ba3d87380ec678a8d1cd079f2a3f19330e9..865a0ffd4a3941d67b01eceb8af3f30aaf21edd4 100644 (file)
@@ -36,7 +36,8 @@ OUTPUT_TYPE = MERGED_OBJ
 INIT_FUNCTION = ntvfs_posix_init 
 PRIVATE_PROTO_HEADER = vfs_posix_proto.h
 #PRIVATE_DEPENDENCIES = pvfs_acl_xattr pvfs_acl_nfs4
-PRIVATE_DEPENDENCIES = NDR_XATTR WRAP_XATTR BLKID ntvfs_common MESSAGING pvfs_aio
+PRIVATE_DEPENDENCIES = NDR_XATTR WRAP_XATTR BLKID ntvfs_common MESSAGING pvfs_aio \
+                                          LIBWBCLIENT
 # End MODULE ntvfs_posix
 ################################################
 
index 2393a2e7a3c2d3bb19895c3dcf8c8b14d0cc0323..f1e469f7909fdb9b8b394cd36687fea606fa844f 100644 (file)
@@ -135,7 +135,7 @@ static NTSTATUS pvfs_default_acl(struct pvfs_state *pvfs,
        }
        sd = *psd;
 
-       ids = talloc_array(sd, struct id_mapping, 2);
+       ids = talloc_zero_array(sd, struct id_mapping, 2);
        NT_STATUS_HAVE_NO_MEMORY(ids);
 
        ids[0].unixid = talloc(ids, struct unixid);
index ebc2d88e701034c102ec770b5cdc649c84383ea6..14b5210fd0e6ced1db9d99cd944b5cf13a2e984b 100644 (file)
@@ -219,7 +219,7 @@ static NTSTATUS pvfs_connect(struct ntvfs_module_context *ntvfs,
                                           pvfs->ntvfs->ctx->server_id,  
                                           pvfs->ntvfs->ctx->msg_ctx, 
                                           pvfs->ntvfs->ctx->lp_ctx, 
-                                          event_context_find(pvfs),
+                                          pvfs->ntvfs->ctx->event_ctx,
                                           pvfs->ntvfs->ctx->config);
 
        pvfs->wbc_ctx = wbc_init(pvfs,
index 28dd27a708215fcf844d8b393c20ba2aad0a842b..e6b11c450aba4d583744bc2f06a9715c07979091 100644 (file)
@@ -55,7 +55,7 @@ _PUBLIC_ struct sys_lease_context *sys_lease_context_create(struct share_config
        }
 
        if (ev == NULL) {
-               ev = event_context_find(mem_ctx);
+               return NULL;
        }
 
        ctx = talloc_zero(mem_ctx, struct sys_lease_context);
@@ -112,6 +112,7 @@ _PUBLIC_ NTSTATUS sys_lease_register(const struct sys_lease_ops *backend)
 _PUBLIC_ NTSTATUS sys_lease_init(void)
 {
        static bool initialized = false;
+       extern NTSTATUS sys_lease_linux_init(void);
 
        init_module_fn static_init[] = { STATIC_sys_lease_MODULES };
 
index c628b9068cb8d31510dab9d48ba0dc629166f6bd..9770323c3fa0ec343b9aed4f72098ede9b9cb1a1 100644 (file)
@@ -51,7 +51,7 @@ _PUBLIC_ struct sys_notify_context *sys_notify_context_create(struct share_confi
        }
 
        if (ev == NULL) {
-               ev = event_context_find(mem_ctx);
+               return NULL;
        }
 
        ctx = talloc_zero(mem_ctx, struct sys_notify_context);
index bc8f7a5dc7b69711649e9bd5d0699d9675ea00e6..3e6758db8a90d5f3fc55f518b1442882365aa5a0 100644 (file)
@@ -1,9 +1,14 @@
 [LIBRARY::LIBSAMBA-HOSTCONFIG]
-VERSION = 0.0.1
-SO_VERSION = 1
 PUBLIC_DEPENDENCIES = LIBSAMBA-UTIL 
 PRIVATE_DEPENDENCIES = DYNCONFIG LIBREPLACE_EXT CHARSET
-PRIVATE_PROTO_HEADER = proto.h
+
+LIBSAMBA-HOSTCONFIG_VERSION = 0.0.1
+LIBSAMBA-HOSTCONFIG-SOVERSION = 0
+
+LIBSAMBA-HOSTCONFIG_OBJ_FILES = param/loadparm.o \
+                       param/generic.o \
+                       param/util.o \
+                       lib/version.o
 
 LIBSAMBA-CONFIG_OBJ_FILES = param/loadparm.o \
                        param/params.o \
@@ -15,6 +20,11 @@ PUBLIC_HEADERS += param/param.h
 
 PC_FILES += param/samba-hostconfig.pc
 
+[SUBSYSTEM::PROVISION]
+PRIVATE_DEPENDENCIES = LIBPYTHON
+
+PROVISION_OBJ_FILES = param/provision.o
+
 #################################
 # Start SUBSYSTEM share
 [SUBSYSTEM::share]
index 77d781d6ffe32293e8cb0038636aca330dee7055..2f62cb2f16a1d50e69928dd3a9abcacd5f265eed 100644 (file)
@@ -307,6 +307,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
         return lp_ctx;
     }
 
+    if (py_obj == Py_None) {
+        lp_ctx = loadparm_init(NULL);
+        if (!lp_load_default(lp_ctx)) {
+            talloc_free(lp_ctx);
+            return NULL;
+        }
+        return lp_ctx;
+    }
+
     if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 |  0 ) < 0)
         return NULL;
     return lp_ctx;
index 025acc6be1e556d9cf161cdf67ad93faecb1d23b..0419c75bfa46208872fb9eef744cfc0cd9a7b295 100644 (file)
@@ -1,5 +1,5 @@
 # This file was automatically generated by SWIG (http://www.swig.org).
-# Version 1.3.33
+# Version 1.3.35
 #
 # Don't modify this file, modify the SWIG interface instead.
 
@@ -79,7 +79,7 @@ LoadParm_swigregister(LoadParm)
 
 class loadparm_service(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    def __init__(self): raise AttributeError, "No constructor defined"
+    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
 loadparm_service.volume_label = new_instancemethod(_param.loadparm_service_volume_label,None,loadparm_service)
 loadparm_service.printername = new_instancemethod(_param.loadparm_service_printername,None,loadparm_service)
@@ -137,7 +137,7 @@ ParamFile_swigregister(ParamFile)
 
 class param_opt(object):
     thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag')
-    def __init__(self): raise AttributeError, "No constructor defined"
+    def __init__(self, *args, **kwargs): raise AttributeError, "No constructor defined"
     __repr__ = _swig_repr
     key = _swig_property(_param.param_opt_key_get)
     value = _swig_property(_param.param_opt_value_get)
index e74f902645329fe1cc84134a25f74f09eb57bed8..d07be04a669c1cf3c46042b7753f7483eb999e1c 100644 (file)
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------------
  * This file was automatically generated by SWIG (http://www.swig.org).
- * Version 1.3.33
+ * Version 1.3.35
  * 
  * This file is not intended to be easily readable and contains a number of 
  * coding conventions designed to improve portability and efficiency. Do not make
 
 /* This should only be incremented when either the layout of swig_type_info changes,
    or for whatever reason, the runtime changes incompatibly */
-#define SWIG_RUNTIME_VERSION "3"
+#define SWIG_RUNTIME_VERSION "4"
 
 /* define SWIG_TYPE_TABLE_NAME as "SWIG_TYPE_TABLE" */
 #ifdef SWIG_TYPE_TABLE
 
 /* Flags for pointer conversions */
 #define SWIG_POINTER_DISOWN        0x1
+#define SWIG_CAST_NEW_MEMORY       0x2
 
 /* Flags for new pointer objects */
 #define SWIG_POINTER_OWN           0x1
@@ -301,10 +302,10 @@ SWIGINTERNINLINE int SWIG_CheckState(int r) {
 extern "C" {
 #endif
 
-typedef void *(*swig_converter_func)(void *);
+typedef void *(*swig_converter_func)(void *, int *);
 typedef struct swig_type_info *(*swig_dycast_func)(void **);
 
-/* Structure to store inforomation on one type */
+/* Structure to store information on one type */
 typedef struct swig_type_info {
   const char             *name;                        /* mangled name of this type */
   const char             *str;                 /* human readable name of this type */
@@ -431,8 +432,8 @@ SWIG_TypeCheckStruct(swig_type_info *from, swig_type_info *into) {
   Cast a pointer up an inheritance hierarchy
 */
 SWIGRUNTIMEINLINE void *
-SWIG_TypeCast(swig_cast_info *ty, void *ptr) {
-  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr);
+SWIG_TypeCast(swig_cast_info *ty, void *ptr, int *newmemory) {
+  return ((!ty) || (!ty->converter)) ? ptr : (*ty->converter)(ptr, newmemory);
 }
 
 /* 
@@ -856,7 +857,7 @@ SWIG_Python_AddErrorMsg(const char* mesg)
     Py_DECREF(old_str);
     Py_DECREF(value);
   } else {
-    PyErr_Format(PyExc_RuntimeError, mesg);
+    PyErr_SetString(PyExc_RuntimeError, mesg);
   }
 }
 
@@ -1416,7 +1417,7 @@ PySwigObject_dealloc(PyObject *v)
 {
   PySwigObject *sobj = (PySwigObject *) v;
   PyObject *next = sobj->next;
-  if (sobj->own) {
+  if (sobj->own == SWIG_POINTER_OWN) {
     swig_type_info *ty = sobj->ty;
     PySwigClientData *data = ty ? (PySwigClientData *) ty->clientdata : 0;
     PyObject *destroy = data ? data->destroy : 0;
@@ -1434,12 +1435,13 @@ PySwigObject_dealloc(PyObject *v)
        res = ((*meth)(mself, v));
       }
       Py_XDECREF(res);
-    } else {
-      const char *name = SWIG_TypePrettyName(ty);
+    } 
 #if !defined(SWIG_PYTHON_SILENT_MEMLEAK)
-      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", name);
-#endif
+    else {
+      const char *name = SWIG_TypePrettyName(ty);
+      printf("swig/python detected a memory leak of type '%s', no destructor found.\n", (name ? name : "unknown"));
     }
+#endif
   } 
   Py_XDECREF(next);
   PyObject_DEL(v);
@@ -1944,7 +1946,7 @@ SWIG_Python_GetSwigThis(PyObject *pyobj)
 
 SWIGRUNTIME int
 SWIG_Python_AcquirePtr(PyObject *obj, int own) {
-  if (own) {
+  if (own == SWIG_POINTER_OWN) {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
     if (sobj) {
       int oldown = sobj->own;
@@ -1965,6 +1967,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
     return SWIG_OK;
   } else {
     PySwigObject *sobj = SWIG_Python_GetSwigThis(obj);
+    if (own)
+      *own = 0;
     while (sobj) {
       void *vptr = sobj->ptr;
       if (ty) {
@@ -1978,7 +1982,15 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
          if (!tc) {
            sobj = (PySwigObject *)sobj->next;
          } else {
-           if (ptr) *ptr = SWIG_TypeCast(tc,vptr);
+           if (ptr) {
+              int newmemory = 0;
+              *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+              if (newmemory == SWIG_CAST_NEW_MEMORY) {
+                assert(own);
+                if (own)
+                  *own = *own | SWIG_CAST_NEW_MEMORY;
+              }
+            }
            break;
          }
        }
@@ -1988,7 +2000,8 @@ SWIG_Python_ConvertPtrAndOwn(PyObject *obj, void **ptr, swig_type_info *ty, int
       }
     }
     if (sobj) {
-      if (own) *own = sobj->own;
+      if (own)
+        *own = *own | sobj->own;
       if (flags & SWIG_POINTER_DISOWN) {
        sobj->own = 0;
       }
@@ -2053,8 +2066,13 @@ SWIG_Python_ConvertFunctionPtr(PyObject *obj, void **ptr, swig_type_info *ty) {
     }
     if (ty) {
       swig_cast_info *tc = SWIG_TypeCheck(desc,ty);
-      if (!tc) return SWIG_ERROR;
-      *ptr = SWIG_TypeCast(tc,vptr);
+      if (tc) {
+        int newmemory = 0;
+        *ptr = SWIG_TypeCast(tc,vptr,&newmemory);
+        assert(!newmemory); /* newmemory handling not yet implemented */
+      } else {
+        return SWIG_ERROR;
+      }
     } else {
       *ptr = vptr;
     }
@@ -2504,7 +2522,7 @@ static swig_module_info swig_module = {swig_types, 15, 0, 0, 0, 0};
 
 #define SWIG_name    "_param"
 
-#define SWIGVERSION 0x010333 
+#define SWIGVERSION 0x010335 
 #define SWIG_VERSION SWIGVERSION
 
 
@@ -2776,6 +2794,15 @@ struct loadparm_context *lp_from_py_object(PyObject *py_obj)
         return lp_ctx;
     }
 
+    if (py_obj == Py_None) {
+        lp_ctx = loadparm_init(NULL);
+        if (!lp_load_default(lp_ctx)) {
+            talloc_free(lp_ctx);
+            return NULL;
+        }
+        return lp_ctx;
+    }
+
     if (SWIG_ConvertPtr(py_obj, (void *)&lp_ctx, SWIGTYPE_p_loadparm_context, 0 |  0 ) < 0)
         return NULL;
     return lp_ctx;
@@ -4073,7 +4100,7 @@ SWIGINTERN PyObject *_wrap_new_param_section(PyObject *SWIGUNUSEDPARM(self), PyO
   param_section *result = 0 ;
   
   if (!SWIG_Python_UnpackTuple(args,"new_param_section",0,0,0)) SWIG_fail;
-  result = (param_section *)(param_section *) calloc(1, sizeof(param_section));
+  result = (param_section *)calloc(1, sizeof(param_section));
   resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_param_section, SWIG_POINTER_NEW |  0 );
   return resultobj;
 fail:
@@ -4325,7 +4352,7 @@ SWIGRUNTIME void
 SWIG_InitializeModule(void *clientdata) {
   size_t i;
   swig_module_info *module_head, *iter;
-  int found;
+  int found, init;
   
   clientdata = clientdata;
   
@@ -4335,6 +4362,9 @@ SWIG_InitializeModule(void *clientdata) {
     swig_module.type_initial = swig_type_initial;
     swig_module.cast_initial = swig_cast_initial;
     swig_module.next = &swig_module;
+    init = 1;
+  } else {
+    init = 0;
   }
   
   /* Try and load any already created modules */
@@ -4363,6 +4393,12 @@ SWIG_InitializeModule(void *clientdata) {
     module_head->next = &swig_module;
   }
   
+  /* When multiple interpeters are used, a module could have already been initialized in
+       a different interpreter, but not yet have a pointer in this interpreter.
+       In this case, we do not want to continue adding types... everything should be
+       set up already */
+  if (init == 0) return;
+  
   /* Now work on filling in swig_module.types */
 #ifdef SWIGRUNTIME_DEBUG
   printf("SWIG_InitializeModule: size %d\n", swig_module.size);
similarity index 78%
rename from source4/torture/util_provision.c
rename to source4/param/provision.c
index cce8e18fdcc7772ee1dc5acf607d3aca8935decd..0e54acf9e429b5a4b403eab6c91a817ef7652244 100644 (file)
 #include "includes.h"
 #include "auth/auth.h"
 #include "lib/ldb_wrap.h"
-#include "torture/torture.h"
 #include "libcli/raw/libcliraw.h"
-#include "torture/util.h"
 #include "librpc/ndr/libndr.h"
 
 #include "param/param.h"
+#include "param/provision.h"
 #include <Python.h>
 #include "scripting/python/modules.h"
 
 NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
-                       struct provision_settings *settings)
+                       struct provision_settings *settings, 
+                       struct provision_result *result)
 {
-       PyObject *provision_mod, *provision_dict, *provision_fn, *result, *parameters;
+       extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);
+       struct ldb_context *ldb_context_from_py_object(PyObject *py_obj);
+       PyObject *provision_mod, *provision_dict, *provision_fn, *py_result, *parameters;
        
        DEBUG(0,("Provision for Become-DC test using python\n"));
 
@@ -62,20 +64,21 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
                return NT_STATUS_UNSUCCESSFUL;
        }
        
-       DEBUG(0,("New Server[%s] in Site[%s]\n", settings->dns_name
-                        settings->site_name));
+       DEBUG(0,("New Server in Site[%s]\n"
+                settings->site_name));
 
        DEBUG(0,("DSA Instance [%s]\n"
-               "\tobjectGUID[%s]\n"
                "\tinvocationId[%s]\n",
                settings->ntds_dn_str,
-               settings->ntds_guid == NULL?"None":GUID_string(mem_ctx, settings->ntds_guid),
                settings->invocation_id == NULL?"None":GUID_string(mem_ctx, settings->invocation_id)));
 
        DEBUG(0,("Pathes under targetdir[%s]\n",
                 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)
@@ -105,6 +108,10 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
                PyDict_SetItemString(parameters, "configdn", 
                                     PyString_FromString(settings->config_dn_str));
        
+       if (settings->server_dn_str) 
+               PyDict_SetItemString(parameters, "serverdn", 
+                                    PyString_FromString(settings->server_dn_str));
+       
        if (settings->site_name) 
                PyDict_SetItemString(parameters, "sitename", 
                                     PyString_FromString(settings->site_name));
@@ -112,15 +119,21 @@ NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
        PyDict_SetItemString(parameters, "machinepass", 
                             PyString_FromString(settings->machine_password));
 
-       result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters);
+       py_result = PyEval_CallObjectWithKeywords(provision_fn, NULL, parameters);
 
        Py_DECREF(parameters);
 
-       if (result == NULL) {
+       if (py_result == NULL) {
                PyErr_Print();
                PyErr_Clear();
                return NT_STATUS_UNSUCCESSFUL;
        }
 
+       result->domaindn = talloc_strdup(mem_ctx, PyString_AsString(PyObject_GetAttrString(py_result, "domaindn")));
+
+       /* FIXME paths */
+       result->lp_ctx = lp_from_py_object(PyObject_GetAttrString(py_result, "lp"));
+       result->samdb = ldb_context_from_py_object(PyObject_GetAttrString(py_result, "samdb"));
+
        return NT_STATUS_OK;
 }
diff --git a/source4/param/provision.h b/source4/param/provision.h
new file mode 100644 (file)
index 0000000..af9685d
--- /dev/null
@@ -0,0 +1,51 @@
+/* 
+   Unix SMB/CIFS implementation.
+   Samba utility functions
+   Copyright (C) Jelmer Vernooij <jelmer@samba.org> 2008
+   
+   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/>.
+*/
+
+#ifndef _PROVISION_H_
+#define _PROVISION_H_
+
+struct provision_settings {
+       const char *site_name;
+       const char *root_dn_str; 
+       const char *domain_dn_str;
+       const char *config_dn_str;
+       const char *schema_dn_str;
+       const char *server_dn_str;
+       const struct GUID *invocation_id;
+       const char *netbios_name;
+       const char *host_ip;
+       const char *realm;
+       const char *domain;
+       const char *ntds_dn_str;
+       const char *machine_password;
+       const char *targetdir;
+};
+
+/* FIXME: Rename this to hostconfig ? */
+struct provision_result {
+       const char *domaindn;
+        struct ldb_context *samdb;
+        struct loadparm_context *lp_ctx;
+};
+
+NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
+                                               struct provision_settings *settings,
+                                               struct provision_result *result);
+
+#endif /* _PROVISION_H_ */
index 2727518c0576e578c9d80df141bbc563e14b5ea5..47aea55751b41d687d2efc4ba69d2a6e81c763b3 100644 (file)
@@ -126,6 +126,7 @@ NTSTATUS share_register(const struct share_ops *ops)
 }
 
 NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name,
+                                  struct event_context *event_ctx, 
                                   struct loadparm_context *lp_ctx,
                                   struct share_context **ctx)
 {
@@ -137,7 +138,7 @@ NTSTATUS share_get_context_by_name(TALLOC_CTX *mem_ctx, const char *backend_name
                return NT_STATUS_INTERNAL_ERROR;
        }
 
-       return ops->init(mem_ctx, ops, lp_ctx, ctx);
+       return ops->init(mem_ctx, ops, event_ctx, lp_ctx, ctx);
 }
 
 /*
index 9f9cbdce5bed8ed447f37ffa68c9fa8bb6c97d0d..2a85fd4fbbffb94fed518f4540f17ddb9c237aa9 100644 (file)
@@ -47,9 +47,12 @@ struct share_info {
        void *value;
 };
 
+struct event_context;
+
 struct share_ops {
        const char *name;
-       NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct loadparm_context *lp_ctx,
+       NTSTATUS (*init)(TALLOC_CTX *, const struct share_ops*, struct event_context *ev_ctx,
+                        struct loadparm_context *lp_ctx,
                         struct share_context **);
        const char *(*string_option)(struct share_config *, const char *, const char *);
        int (*int_option)(struct share_config *, const char *, int);
index c3adc4473c789d2a7dc68edae1c5a3cdd240c2a5..bac1aac2d78f33ca82312a53cb8599af31309ad6 100644 (file)
@@ -25,6 +25,7 @@
 
 static NTSTATUS sclassic_init(TALLOC_CTX *mem_ctx, 
                              const struct share_ops *ops, 
+                             struct event_context *event_ctx,
                              struct loadparm_context *lp_ctx,
                              struct share_context **ctx)
 {
index fb40f1e9bfe8be040e3480ea91dd26eccebc1787..eba1665cc9f5654fe22f47e56bb95c005a83eaa7 100644 (file)
@@ -27,7 +27,9 @@
 #include "param/share.h"
 #include "param/param.h"
 
-static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, struct loadparm_context *lp_ctx,
+static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, 
+                         struct event_context *ev_ctx,
+                         struct loadparm_context *lp_ctx,
                          struct share_context **ctx)
 {
        struct ldb_context *sdb;
@@ -38,7 +40,7 @@ static NTSTATUS sldb_init(TALLOC_CTX *mem_ctx, const struct share_ops *ops, stru
                return NT_STATUS_NO_MEMORY;
        }
        
-       sdb = ldb_wrap_connect(*ctx, lp_ctx, 
+       sdb = ldb_wrap_connect(*ctx, ev_ctx, lp_ctx, 
                               private_path(*ctx, lp_ctx, "share.ldb"),
                               system_session(*ctx, lp_ctx),
                               NULL, 0, NULL);
index 6d03b4e0492459afb0e786cc418870979a52d0c5..c64b5c607a53ef13638cd974952dc84c1d814caf 100644 (file)
@@ -182,12 +182,12 @@ static void tcase_add_share_tests(struct torture_tcase *tcase)
 
 static bool setup_ldb(struct torture_context *tctx, void **data)
 {
-       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->lp_ctx, (struct share_context **)data));
+       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "ldb", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
 }
 
 static bool setup_classic(struct torture_context *tctx, void **data)
 {
-       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->lp_ctx, (struct share_context **)data));
+       return NT_STATUS_IS_OK(share_get_context_by_name(tctx, "classic", tctx->ev, tctx->lp_ctx, (struct share_context **)data));
 }
 
 static bool teardown(struct torture_context *tctx, void *data)
index 0d36473ade2c31c2cfcb409aec6a50f63e3a2ed4..25cea495a76d6113141a373efe5511b5d82a82c7 100644 (file)
@@ -1,11 +1,16 @@
 pidl/Makefile: pidl/Makefile.PL
-       cd pidl && $(PERL) Makefile.PL 
+       cd pidl && $(PERL) Makefile.PL PREFIX=$(prefix)
 
 pidl-testcov: pidl/Makefile
        cd pidl && cover -test
 
 installpidl:: pidl/Makefile
-       $(MAKE) -C pidl install_vendor PREFIX=$(prefix)
+       $(MAKE) -C pidl install_vendor VENDORPREFIX=$(prefix) \
+                                          INSTALLVENDORLIB=$(libdir) \
+                                                                  INSTALLVENDORBIN=$(bindir) \
+                                                                  INSTALLVENDORSCRIPT=$(bindir) \
+                                                                  INSTALLVENDORMAN1DIR=$(mandir)/man1 \
+                                                                  INSTALLVENDORMAN3DIR=$(mandir)/man3
 
 ifeq ($(HAVE_PERL_EXTUTILS_MAKEMAKER),1)
 install:: installpidl
index 7a2575b8972203914a2e103da300c33eeffa3886..87ed29b54eb63ff76b1b2deb0af08be09ea0d30d 100644 (file)
@@ -9,7 +9,7 @@ package Parse::Pidl::Samba3::ClientNDR;
 
 use Exporter;
 @ISA = qw(Exporter);
-@EXPORT_OK = qw(ParseFunction $res $res_hdr);
+@EXPORT_OK = qw(ParseFunction $res $res_hdr ParseOutputArgument);
 
 use strict;
 use Parse::Pidl qw(fatal warning);
@@ -73,6 +73,40 @@ sub HeaderProperties($$)
        }
 }
 
+sub ParseOutputArgument($$$)
+{
+       my ($self, $fn, $e) = @_;
+       my $level = 0;
+
+       fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
+
+       if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
+               $level = 1;
+               if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
+                       $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {");
+                       $self->indent;
+               }
+       }
+
+       if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") {
+               # This is a call to GenerateFunctionInEnv intentionally. 
+               # Since the data is being copied into a user-provided data 
+               # structure, the user should be able to know the size beforehand 
+               # to allocate a structure of the right size.
+               my $env = GenerateFunctionInEnv($fn, "r.");
+               my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL});
+               $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is * sizeof(*$e->{NAME}));");
+       } else {
+               $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};");
+       }
+
+       if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
+               if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
+                       $self->deindent;
+                       $self->pidl("}");
+               }
+       }
+}
 
 sub ParseFunction($$$)
 {
@@ -147,36 +181,9 @@ sub ParseFunction($$$)
        $self->pidl("/* Return variables */");
        foreach my $e (@{$fn->{ELEMENTS}}) {
                next unless (grep(/out/, @{$e->{DIRECTION}}));
-               my $level = 0;
 
-               fatal($e->{ORIGINAL}, "[out] argument is not a pointer or array") if ($e->{LEVELS}[0]->{TYPE} ne "POINTER" and $e->{LEVELS}[0]->{TYPE} ne "ARRAY");
-
-               if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
-                       $level = 1;
-                       if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
-                               $self->pidl("if ($e->{NAME} && r.out.$e->{NAME}) {");
-                               $self->indent;
-                       }
-               }
+               $self->ParseOutputArgument($fn, $e);
 
-               if ($e->{LEVELS}[$level]->{TYPE} eq "ARRAY") {
-                       # This is a call to GenerateFunctionInEnv intentionally. 
-                       # Since the data is being copied into a user-provided data 
-                       # structure, the user should be able to know the size beforehand 
-                       # to allocate a structure of the right size.
-                       my $env = GenerateFunctionInEnv($fn, "r.");
-                       my $size_is = ParseExpr($e->{LEVELS}[$level]->{SIZE_IS}, $env, $e->{ORIGINAL});
-                       $self->pidl("memcpy($e->{NAME}, r.out.$e->{NAME}, $size_is);");
-               } else {
-                       $self->pidl("*$e->{NAME} = *r.out.$e->{NAME};");
-               }
-
-               if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
-                       if ($e->{LEVELS}[0]->{POINTER_TYPE} ne "ref") {
-                               $self->deindent;
-                               $self->pidl("}");
-                       }
-               }
        }
 
        $self->pidl("");
index e9c158e93323b93152e7df011f91ad98a7a2cd78..f8209be654b4134ddf06915cf082f70c22970231 100644 (file)
@@ -7,6 +7,7 @@
 package Parse::Pidl::Samba4::NDR::Client;
 
 use Parse::Pidl::Samba4 qw(choose_header is_intree);
+use Parse::Pidl::Util qw(has_property);
 
 use vars qw($VERSION);
 $VERSION = '0.01';
@@ -15,30 +16,45 @@ use strict;
 
 my($res,$res_hdr);
 
-#####################################################################
-# parse a function
-sub ParseFunction($$)
+sub ParseFunctionSend($$$)
 {
-       my ($interface, $fn) = @_;
-       my $name = $fn->{NAME};
+       my ($interface, $fn, $name) = @_;
        my $uname = uc $name;
 
-       $res_hdr .= "\nstruct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);
-NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r);
-";
+       my $proto = "struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)";
 
-       $res .= "
-struct rpc_request *dcerpc_$name\_send(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
-{
+       $res_hdr .= "\n$proto;\n";
+
+       $res .= "$proto\n{\n";
+
+       if (has_property($fn, "todo")) {
+               $res .= "\treturn NULL;\n";
+       } else {
+               $res .= "
        if (p->conn->flags & DCERPC_DEBUG_PRINT_IN) {
                NDR_PRINT_IN_DEBUG($name, r);
        }
        
        return dcerpc_ndr_request_send(p, NULL, &ndr_table_$interface->{NAME}, NDR_$uname, mem_ctx, r);
+";
+       }
+
+       $res .= "}\n\n";
 }
 
-NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)
+sub ParseFunctionSync($$$)
 {
+       my ($interface, $fn, $name) = @_;
+
+       my $proto = "NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *r)";
+
+       $res_hdr .= "\n$proto;\n";
+       $res .= "$proto\n{\n";
+
+       if (has_property($fn, "todo")) {
+               $res .= "\treturn NT_STATUS_NOT_IMPLEMENTED;\n";
+       } else {
+               $res .= "
        struct rpc_request *req;
        NTSTATUS status;
        
@@ -58,8 +74,20 @@ NTSTATUS dcerpc_$name(struct dcerpc_pipe *p, TALLOC_CTX *mem_ctx, struct $name *
        $res .= 
 "
        return status;
-}
 ";
+       }
+
+       $res .= "}\n\n";
+}
+
+#####################################################################
+# parse a function
+sub ParseFunction($$)
+{
+       my ($interface, $fn) = @_;
+
+       ParseFunctionSend($interface, $fn, $fn->{NAME});
+       ParseFunctionSync($interface, $fn, $fn->{NAME});
 }
 
 my %done;
index c04324e99290d2302cb54242e51741d870bbcc0f..884ee1d82244ec4d7fe1267ad7ab32d1e87117d9 100644 (file)
@@ -272,7 +272,28 @@ sub PythonFunctionBody($$$)
 
        my $signature = "S.$prettyname(";
 
+       my $metadata_args = { in => {}, out => {} };
+
+       sub get_var($) { my $x = shift; $x =~ s/\*//g; return $x; }
+
+       # Determine arguments that are metadata for other arguments (size_is/length_is)
+       foreach my $e (@{$fn->{ELEMENTS}}) {
+               foreach my $dir (@{$e->{DIRECTION}}) {
+                        my $main = undef;
+                        if (has_property($e, "length_is")) {
+                               $main = get_var($e->{PROPERTIES}->{length_is});
+                        } elsif (has_property($e, "size_is")) {
+                               $main = get_var($e->{PROPERTIES}->{size_is});
+                        }
+                        if ($main) { 
+                                $metadata_args->{$dir}->{$main} = $e->{NAME}; 
+                        }
+                }
+       }
+
        foreach my $e (@{$fn->{ELEMENTS}}) {
+               next if (($metadata_args->{in}->{$e->{NAME}} and grep(/in/, @{$e->{DIRECTION}})) or 
+                        ($metadata_args->{out}->{$e->{NAME}}) and grep(/out/, @{$e->{DIRECTION}}));
                $self->pidl("PyObject *py_$e->{NAME};");
                if (grep(/out/,@{$e->{DIRECTION}})) {
                        $result_size++;
@@ -301,14 +322,27 @@ sub PythonFunctionBody($$$)
        $self->pidl("return NULL;");
        $self->deindent;
        $self->pidl("}");
+       $self->pidl("");
 
        if ($fn->{RETURN_TYPE}) {
                $result_size++ unless ($fn->{RETURN_TYPE} eq "WERROR" or $fn->{RETURN_TYPE} eq "NTSTATUS");
        }
 
+       my $fail = "talloc_free(mem_ctx); return NULL;";
        foreach my $e (@{$fn->{ELEMENTS}}) {
-               if (grep(/in/,@{$e->{DIRECTION}})) {
-                       $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", "talloc_free(mem_ctx); return NULL;");
+               next unless (grep(/in/,@{$e->{DIRECTION}}));
+               if ($metadata_args->{in}->{$e->{NAME}}) {
+                       my $py_var = "py_".$metadata_args->{in}->{$e->{NAME}};
+                       $self->pidl("PY_CHECK_TYPE(PyList, $py_var, $fail);");
+                       my $val = "PyList_Size($py_var)";
+                       if ($e->{LEVELS}[0]->{TYPE} eq "POINTER") {
+                               $self->pidl("r->in.$e->{NAME} = talloc_ptrtype(mem_ctx, r->in.$e->{NAME});");
+                               $self->pidl("*r->in.$e->{NAME} = $val;");
+                       } else {
+                               $self->pidl("r->in.$e->{NAME} = $val;");
+                       }
+               } else {
+                       $self->ConvertObjectFromPython($env, "mem_ctx", $e, "py_$e->{NAME}", "r->in.$e->{NAME}", $fail);
                }
        }
        $self->pidl("status = dcerpc_$fn->{NAME}(iface->pipe, mem_ctx, r);");
@@ -325,6 +359,7 @@ sub PythonFunctionBody($$$)
        }
 
        foreach my $e (@{$fn->{ELEMENTS}}) {
+               next if ($metadata_args->{out}->{$e->{NAME}});
                my $py_name = "py_$e->{NAME}";
                if (grep(/out/,@{$e->{DIRECTION}})) {
                        $self->ConvertObjectToPython("r", $env, $e, "r->out.$e->{NAME}", $py_name);
@@ -334,7 +369,7 @@ sub PythonFunctionBody($$$)
                                $signature .= "$e->{NAME}, ";
                        } else {
                                $self->pidl("result = $py_name;");
-                               $signature .= "result";
+                               $signature .= $e->{NAME};
                        }
                }
        }
@@ -347,11 +382,10 @@ sub PythonFunctionBody($$$)
                my $conv = $self->ConvertObjectToPythonData("r", $fn->{RETURN_TYPE}, "r->out.result");
                if ($result_size > 1) {
                        $self->pidl("PyTuple_SetItem(result, $i, $conv);");
-                       $signature .= "result";
                } else {
                        $self->pidl("result = $conv;");
-                       $signature .= "result";
                }
+               $signature .= "result";
        }
 
        if (substr($signature, -2) eq ", ") {
@@ -563,8 +597,9 @@ sub Interface($$$)
                $self->pidl("const char *binding_string;");
                $self->pidl("struct cli_credentials *credentials;");
                $self->pidl("struct loadparm_context *lp_ctx = NULL;");
-               $self->pidl("PyObject *py_lp_ctx = NULL, *py_credentials = Py_None;");
+               $self->pidl("PyObject *py_lp_ctx = Py_None, *py_credentials = Py_None;");
                $self->pidl("TALLOC_CTX *mem_ctx = NULL;");
+               $self->pidl("struct event_context *event_ctx;");
                $self->pidl("NTSTATUS status;");
                $self->pidl("");
                $self->pidl("const char *kwnames[] = {");
@@ -575,14 +610,12 @@ sub Interface($$$)
                $self->pidl("extern struct loadparm_context *lp_from_py_object(PyObject *py_obj);");
                $self->pidl("extern struct cli_credentials *cli_credentials_from_py_object(PyObject *py_obj);");
                $self->pidl("");
-               $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"sO|O:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {");
+               $self->pidl("if (!PyArg_ParseTupleAndKeywords(args, kwargs, \"s|OO:$interface->{NAME}\", discard_const_p(char *, kwnames), &binding_string, &py_lp_ctx, &py_credentials)) {");
                $self->indent;
                $self->pidl("return NULL;");
                $self->deindent;
                $self->pidl("}");
                $self->pidl("");
-               $self->pidl("if (py_lp_ctx != NULL) {");
-               $self->indent;
                $self->pidl("lp_ctx = lp_from_py_object(py_lp_ctx);");
                $self->pidl("if (lp_ctx == NULL) {");
                $self->indent;
@@ -590,8 +623,6 @@ sub Interface($$$)
                $self->pidl("return NULL;");
                $self->deindent;
                $self->pidl("}");
-               $self->deindent;
-               $self->pidl("}");
                $self->pidl("");
 
                $self->pidl("credentials = cli_credentials_from_py_object(py_credentials);");
@@ -604,9 +635,11 @@ sub Interface($$$)
 
                $self->pidl("ret = PyObject_New($interface->{NAME}_InterfaceObject, &$interface->{NAME}_InterfaceType);");
                $self->pidl("");
+               $self->pidl("event_ctx = event_context_init(mem_ctx);");
+               $self->pidl("");
 
                $self->pidl("status = dcerpc_pipe_connect(NULL, &ret->pipe, binding_string, ");
-               $self->pidl("             &ndr_table_$interface->{NAME}, credentials, NULL, lp_ctx);");
+               $self->pidl("             &ndr_table_$interface->{NAME}, credentials, event_ctx, lp_ctx);");
                $self->handle_ntstatus("status", "NULL", "mem_ctx");
 
                $self->pidl("ret->pipe->conn->flags |= DCERPC_NDR_REF_ALLOC;");
@@ -918,16 +951,15 @@ sub ConvertObjectToPythonLevel($$$$$)
                        $self->pidl("}");
                }
        } elsif ($l->{TYPE} eq "ARRAY") {
-               if (is_charset_array($e, $l)) {
+               my $pl = GetPrevLevel($e, $l);
+               if ($pl && $pl->{TYPE} eq "POINTER") {
                        $var_name = get_pointer_to($var_name);
+               }
+
+               if (is_charset_array($e, $l)) {
                        # FIXME: Use Unix charset setting rather than utf-8
                        $self->pidl("$py_var = PyUnicode_Decode($var_name, strlen($var_name), \"utf-8\", \"ignore\");");
                } else {
-                       my $pl = GetPrevLevel($e, $l);
-                       if ($pl && $pl->{TYPE} eq "POINTER") {
-                               $var_name = get_pointer_to($var_name);
-                       }
-
                        die("No SIZE_IS for array $var_name") unless (defined($l->{SIZE_IS}));
                        my $length = $l->{SIZE_IS};
                        if (defined($l->{LENGTH_IS})) {
@@ -991,6 +1023,7 @@ sub Parse($$$$$)
 #include \"librpc/rpc/dcerpc.h\"
 #include \"scripting/python/pytalloc.h\"
 #include \"scripting/python/pyrpc.h\"
+#include \"lib/events/events.h\"
 #include \"$hdr\"
 #include \"$ndr_hdr\"
 #include \"$py_hdr\"
index f5b51b7d34b8d5a1f52751b5daf714f4d5539446..80725d28cfe28c6fd3400c3a9be5db34b565f884 100755 (executable)
@@ -4,12 +4,12 @@
 use strict;
 use warnings;
 
-use Test::More tests => 8;
+use Test::More tests => 9;
 use FindBin qw($RealBin);
 use lib "$RealBin";
 use Util;
 use Parse::Pidl::Util qw(MyDumper);
-use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction);
+use Parse::Pidl::Samba3::ClientNDR qw(ParseFunction ParseOutputArgument);
 use Parse::Pidl::Samba4::Header qw(GenerateFunctionInEnv GenerateFunctionOutEnv);
 
 # Make sure GenerateFunctionInEnv and GenerateFunctionOutEnv work
@@ -117,3 +117,12 @@ is($x->{res},
 }
 
 ");
+
+$x = new Parse::Pidl::Samba3::ClientNDR();
+
+$fn = { NAME => "bar", ELEMENTS => [ ], RETURN_TYPE => "WERROR" };
+my $e = { NAME => "foo", ORIGINAL => { FILE => "f", LINE => -1 },
+          LEVELS => [ { TYPE => "ARRAY", SIZE_IS => "mysize" }, { TYPE => "DATA", DATA_TYPE => "int" } ]};
+
+$x->ParseOutputArgument($fn, $e);
+is($x->{res}, "memcpy(foo, r.out.foo, mysize * sizeof(*foo));\n");
index 646879ad0d5ddb9dbaa65698ab27da87dfa5d06e..da034e85ea5c53e69ed14335db99a53dc4f5fda0 100644 (file)
@@ -82,7 +82,7 @@ uint32_t dcesrv_common_get_version_build(TALLOC_CTX *mem_ctx, struct loadparm_co
 }
 
 /* This hardcoded value should go into a ldb database! */
-uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_context *dce_ctx)
+uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct event_context *event_ctx, struct dcesrv_context *dce_ctx)
 {
        int default_server_announce = 0;
        default_server_announce |= SV_TYPE_WORKSTATION;
@@ -118,7 +118,7 @@ uint32_t dcesrv_common_get_server_type(TALLOC_CTX *mem_ctx, struct dcesrv_contex
                                break;
                        }
                        /* open main ldb */
-                       samctx = samdb_connect(tmp_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, dce_ctx->lp_ctx));
+                       samctx = samdb_connect(tmp_ctx, event_ctx, dce_ctx->lp_ctx, anonymous_session(tmp_ctx, event_ctx, dce_ctx->lp_ctx));
                        if (samctx == NULL) {
                                DEBUG(2,("Unable to open samdb in determining server announce flags\n"));
                        } else {
index a97b93a051a3bae29fb6931968f6843ca9091cf6..e0a222e7675be23856c24fa7c54bba80d47ae414 100644 (file)
@@ -58,7 +58,7 @@ static WERROR dcesrv_drsuapi_DsBind(struct dcesrv_call_state *dce_call, TALLOC_C
        /*
         * connect to the samdb
         */
-       b_state->sam_ctx = samdb_connect(b_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
+       b_state->sam_ctx = samdb_connect(b_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (!b_state->sam_ctx) {
                return WERR_FOOBAR;
        }
index 4dcd6064353b1554423ca55f91feb3e3f332dc5c..0dc21fd9c502c2dcdf650b701ede05d31ec8f5d5 100644 (file)
@@ -50,7 +50,7 @@ NTSTATUS dcesrv_lsa_get_policy_state(struct dcesrv_call_state *dce_call, TALLOC_
        }
 
        /* make sure the sam database is accessible */
-       state->sam_ldb = samdb_connect(state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
+       state->sam_ldb = samdb_connect(state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (state->sam_ldb == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index c6b9e3bd406c78eeca6147ab5da4418ae3feff7c..30bceb813903059fd9620ffb1f529fdd48127870 100644 (file)
@@ -195,7 +195,8 @@ static NTSTATUS lookup_well_known_sids(TALLOC_CTX *mem_ctx,
 /*
   lookup a SID for 1 name
 */
-static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
+static NTSTATUS dcesrv_lsa_lookup_name(struct event_context *ev_ctx, 
+                                      struct loadparm_context *lp_ctx,
                                       struct lsa_policy_state *state, TALLOC_CTX *mem_ctx,
                                const char *name, const char **authority_name, 
                                struct dom_sid **sid, enum lsa_SidType *rtype)
@@ -218,7 +219,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
                }
                username = p + 1;
        } else if (strchr_m(name, '@')) {
-               status = crack_name_to_nt4_name(mem_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
+               status = crack_name_to_nt4_name(mem_ctx, ev_ctx, lp_ctx, DRSUAPI_DS_NAME_FORMAT_USER_PRINCIPAL, name, &domain, &username);
                if (!NT_STATUS_IS_OK(status)) {
                        DEBUG(3, ("Failed to crack name %s into an NT4 name: %s\n", name, nt_errstr(status)));
                        return status;
@@ -265,7 +266,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -275,7 +276,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -285,7 +286,7 @@ static NTSTATUS dcesrv_lsa_lookup_name(struct loadparm_context *lp_ctx,
                if (!name) {
                        return NT_STATUS_NO_MEMORY;
                }
-               status = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
+               status = dcesrv_lsa_lookup_name(ev_ctx, lp_ctx, state, mem_ctx, name, authority_name, sid, rtype);
                if (NT_STATUS_IS_OK(status)) {
                        return status;
                }
@@ -721,7 +722,7 @@ NTSTATUS dcesrv_lsa_LookupNames3(struct dcesrv_call_state *dce_call,
                r->out.sids->sids[i].sid_index   = 0xFFFFFFFF;
                r->out.sids->sids[i].unknown     = 0;
 
-               status2 = dcesrv_lsa_lookup_name(lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
+               status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, policy_state, mem_ctx, name, &authority_name, &sid, &rtype);
                if (!NT_STATUS_IS_OK(status2) || sid->num_auths == 0) {
                        continue;
                }
@@ -854,7 +855,7 @@ NTSTATUS dcesrv_lsa_LookupNames2(struct dcesrv_call_state *dce_call,
                r->out.sids->sids[i].sid_index   = 0xFFFFFFFF;
                r->out.sids->sids[i].unknown     = 0;
 
-               status2 = dcesrv_lsa_lookup_name(lp_ctx, state, mem_ctx, name, 
+               status2 = dcesrv_lsa_lookup_name(dce_call->event_ctx, lp_ctx, state, mem_ctx, name, 
                                                 &authority_name, &sid, &rtype);
                if (!NT_STATUS_IS_OK(status2)) {
                        continue;
index 37e6351864093e818895bb788c04837791f28514..d9ae92c0fa7002c918de4c29bf8a53d49b4592f4 100644 (file)
@@ -93,7 +93,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
                return NT_STATUS_ACCESS_DENIED;
        }
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, 
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, 
                                system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -176,7 +176,7 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate3(struct dcesrv_call_state *dce_ca
 
 
        /* remember this session key state */
-       nt_status = schannel_store_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, creds);
+       nt_status = schannel_store_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, creds);
 
        return nt_status;
 }
@@ -236,7 +236,8 @@ static NTSTATUS dcesrv_netr_ServerAuthenticate2(struct dcesrv_call_state *dce_ca
   the caller needs some of that information.
 
 */
-static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_ctx,
+static NTSTATUS dcesrv_netr_creds_server_step_check(struct event_context *event_ctx, 
+                                                   struct loadparm_context *lp_ctx,
                                                    const char *computer_name,
                                             TALLOC_CTX *mem_ctx, 
                                             struct netr_Authenticator *received_authenticator,
@@ -248,7 +249,7 @@ static NTSTATUS dcesrv_netr_creds_server_step_check(struct loadparm_context *lp_
        struct ldb_context *ldb;
        int ret;
 
-       ldb = schannel_db_connect(mem_ctx, lp_ctx);
+       ldb = schannel_db_connect(mem_ctx, event_ctx, lp_ctx);
        if (!ldb) {
                return NT_STATUS_ACCESS_DENIED;
        }
@@ -300,13 +301,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet(struct dcesrv_call_state *dce_call
        struct ldb_context *sam_ctx;
        NTSTATUS nt_status;
 
-       nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+       nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
                                                        r->in.computer_name, mem_ctx, 
                                                 &r->in.credential, &r->out.return_authenticator,
                                                 &creds);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -339,13 +340,13 @@ static NTSTATUS dcesrv_netr_ServerPasswordSet2(struct dcesrv_call_state *dce_cal
 
        struct samr_CryptPassword password_buf;
 
-       nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+       nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
                                                        r->in.computer_name, mem_ctx, 
                                                 &r->in.credential, &r->out.return_authenticator,
                                                 &creds);
        NT_STATUS_NOT_OK_RETURN(nt_status);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -561,7 +562,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonEx(struct dcesrv_call_state *dce_call,
 {
        NTSTATUS nt_status;
        struct creds_CredentialState *creds;
-       nt_status = schannel_fetch_session_key(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds);
+       nt_status = schannel_fetch_session_key(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, r->in.computer_name, lp_workgroup(dce_call->conn->dce_ctx->lp_ctx), &creds);
        if (!NT_STATUS_IS_OK(nt_status)) {
                return nt_status;
        }
@@ -589,7 +590,7 @@ static NTSTATUS dcesrv_netr_LogonSamLogonWithFlags(struct dcesrv_call_state *dce
        return_authenticator = talloc(mem_ctx, struct netr_Authenticator);
        NT_STATUS_HAVE_NO_MEMORY(return_authenticator);
 
-       nt_status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+       nt_status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
                                                        r->in.computer_name, mem_ctx, 
                                                 r->in.credential, return_authenticator,
                                                 &creds);
@@ -891,14 +892,14 @@ static NTSTATUS dcesrv_netr_LogonGetDomainInfo(struct dcesrv_call_state *dce_cal
 
        const char *local_domain;
 
-       status = dcesrv_netr_creds_server_step_check(dce_call->conn->dce_ctx->lp_ctx,
+       status = dcesrv_netr_creds_server_step_check(dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
                                                     r->in.computer_name, mem_ctx, 
                                              r->in.credential, 
                                              r->out.return_authenticator,
                                              NULL);
        NT_STATUS_NOT_OK_RETURN(status);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -1003,7 +1004,7 @@ static WERROR dcesrv_netr_DsRGetDCNameEx2(struct dcesrv_call_state *dce_call, TA
 
        ZERO_STRUCT(r->out);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return WERR_DS_SERVICE_UNAVAILABLE;
        }
@@ -1165,7 +1166,7 @@ static WERROR dcesrv_netr_DsrEnumerateDomainTrusts(struct dcesrv_call_state *dce
 
        ZERO_STRUCT(r->out);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info);
        if (sam_ctx == NULL) {
                return WERR_GENERAL_FAILURE;
        }
index 0aa4d65d8c5ca22973bbed19bfce099b25157c6e..8ee77a6a30068342ed520be9ff5a4e5e854fce98 100644 (file)
@@ -156,7 +156,7 @@ static NTSTATUS dcesrv_samr_Connect(struct dcesrv_call_state *dce_call, TALLOC_C
        }
 
        /* make sure the sam database is accessible */
-       c_state->sam_ctx = samdb_connect(c_state, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
+       c_state->sam_ctx = samdb_connect(c_state, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (c_state->sam_ctx == NULL) {
                talloc_free(c_state);
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
@@ -4135,7 +4135,7 @@ static NTSTATUS dcesrv_samr_GetDomPwInfo(struct dcesrv_call_state *dce_call, TAL
 
        ZERO_STRUCT(r->out.info);
 
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info); 
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index ec91b8eadaf5491ad060becc18c2fb8ecd1d6fac..b78a9ceaa7b46c6cb9583da831f3832f0ac38e2f 100644 (file)
@@ -66,7 +66,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -205,7 +205,7 @@ NTSTATUS dcesrv_samr_OemChangePasswordUser2(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
@@ -343,7 +343,7 @@ NTSTATUS dcesrv_samr_ChangePasswordUser3(struct dcesrv_call_state *dce_call,
        }
 
        /* To change a password we need to open as system */
-       sam_ctx = samdb_connect(mem_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
+       sam_ctx = samdb_connect(mem_ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, system_session(mem_ctx, dce_call->conn->dce_ctx->lp_ctx));
        if (sam_ctx == NULL) {
                return NT_STATUS_INVALID_SYSTEM_SERVICE;
        }
index 4fb38cd1224a5c10d2b52cfe9a292cb7844326e6..00f0d261ca5f0186c3a3538e72379420a1825880 100644 (file)
@@ -106,7 +106,7 @@ static void dcesrv_sock_accept(struct stream_connection *srv_conn)
        struct dcesrv_connection *dcesrv_conn = NULL;
        struct auth_session_info *session_info = NULL;
 
-       status = auth_anonymous_session_info(srv_conn, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info);
+       status = auth_anonymous_session_info(srv_conn, srv_conn->event.ctx, dcesrv_sock->dcesrv_ctx->lp_ctx, &session_info);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0,("dcesrv_sock_accept: auth_anonymous_session_info failed: %s\n", 
                        nt_errstr(status)));
index 7c701ec50a0ec0109bd5ac525fc460fa5957accc..28e30002e2d5d4461da3fac78abf62f528f3563a 100644 (file)
@@ -216,7 +216,7 @@ static NTSTATUS dcerpc_spoolss_bind(struct dcesrv_call_state *dce_call, const st
        NTSTATUS status;
        struct ntptr_context *ntptr;
 
-       status = ntptr_init_context(dce_call->context, dce_call->conn->dce_ctx->lp_ctx,
+       status = ntptr_init_context(dce_call->context, dce_call->conn->event_ctx, dce_call->conn->dce_ctx->lp_ctx,
                                    lp_ntptr_providor(dce_call->conn->dce_ctx->lp_ctx), &ntptr);
        NT_STATUS_NOT_OK_RETURN(status);
 
@@ -1156,7 +1156,8 @@ static WERROR dcesrv_spoolss_RemoteFindFirstPrinterChangeNotifyEx(struct dcesrv_
        creds = cli_credentials_init_anon(mem_ctx); /* FIXME: Use machine credentials instead ? */
 
        status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_spoolss, 
-                                 creds, NULL, dce_call->conn->dce_ctx->lp_ctx);
+                                      creds, dce_call->event_ctx,
+                                      dce_call->conn->dce_ctx->lp_ctx);
 
        if (NT_STATUS_IS_ERR(status)) {
                DEBUG(0, ("unable to call back to %s\n", r->in.str));
index 23e40d997653b95b16665536954f0d3d167b11cd..8dc42bf43b68a9604c85aed00cab5a063b588c1d 100644 (file)
@@ -445,7 +445,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                int count = 8;
                int i;
 
-               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
@@ -543,7 +543,7 @@ static WERROR dcesrv_srvsvc_NetShareAdd(struct dcesrv_call_state *dce_call, TALL
                int count = 10;
                int i;
 
-               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+               nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
                if (!NT_STATUS_IS_OK(nterr)) {
                        return ntstatus_to_werror(nterr);
                }
@@ -735,7 +735,7 @@ static WERROR dcesrv_srvsvc_NetShareEnumAll(struct dcesrv_call_state *dce_call,
        /* TODO: - paging of results 
         */
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -984,7 +984,7 @@ static WERROR dcesrv_srvsvc_NetShareGetInfo(struct dcesrv_call_state *dce_call,
                return WERR_INVALID_PARAM;
        }
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1238,7 +1238,7 @@ static WERROR dcesrv_srvsvc_NetShareSetInfo(struct dcesrv_call_state *dce_call,
                return WERR_INVALID_PARAM;
        }
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1415,7 +1415,7 @@ static WERROR dcesrv_srvsvc_NetShareCheck(struct dcesrv_call_state *dce_call, TA
        }
        all_string_sub(device, "\\", "/", 0);
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -1499,7 +1499,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
 
                info101->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
                info101->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
-               info101->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
+               info101->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx);
                info101->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info101->comment);
 
@@ -1519,7 +1519,7 @@ static WERROR dcesrv_srvsvc_NetSrvGetInfo(struct dcesrv_call_state *dce_call, TA
 
                info102->version_major  = dcesrv_common_get_version_major(mem_ctx, dce_ctx->lp_ctx);
                info102->version_minor  = dcesrv_common_get_version_minor(mem_ctx, dce_ctx->lp_ctx);
-               info102->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_ctx);
+               info102->server_type    = dcesrv_common_get_server_type(mem_ctx, dce_call->event_ctx, dce_ctx);
                info102->comment        = talloc_strdup(mem_ctx, lp_serverstring(dce_ctx->lp_ctx));
                W_ERROR_HAVE_NO_MEMORY(info102->comment);
 
@@ -1829,7 +1829,7 @@ static WERROR dcesrv_srvsvc_NetShareEnum(struct dcesrv_call_state *dce_call, TAL
        /* TODO: - paging of results 
         */
 
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
@@ -2292,7 +2292,7 @@ static WERROR dcesrv_srvsvc_NetShareDel(struct dcesrv_call_state *dce_call, TALL
        NTSTATUS nterr;
        struct share_context *sctx;
                
-       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       nterr = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(nterr)) {
                return ntstatus_to_werror(nterr);
        }
index 43fb24c0c36cc64d8574ffba42ed3ed3ccd2eeb3..f1cb35bdd8978339c3b5da7326d11263f30f90ce 100644 (file)
@@ -62,7 +62,7 @@ NTSTATUS srvsvc_create_ntvfs_context(struct dcesrv_call_state *dce_call,
        struct share_config *scfg;
        const char *sharetype;
 
-       status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->conn->dce_ctx->lp_ctx, &sctx);
+       status = share_get_context_by_name(mem_ctx, lp_share_backend(dce_call->conn->dce_ctx->lp_ctx), dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, &sctx);
        if (!NT_STATUS_IS_OK(status)) {
                return status;
        }
index 9993dc14c116630c4fb38faf3de3131cce7f0b09..22c60c354c5002b14a5469306212c5feb7f86360 100644 (file)
@@ -37,7 +37,7 @@ static NTSTATUS dcerpc_winreg_bind(struct dcesrv_call_state *dce_call,
        WERROR err;
 
        err = reg_open_samba(dce_call->context,
-                            &ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info,
+                            &ctx, dce_call->event_ctx, dce_call->conn->dce_ctx->lp_ctx, dce_call->conn->auth_state.session_info,
                             NULL);
 
        if (!W_ERROR_IS_OK(err)) {
index 496af316ec535bacc2c774dac3ae99c57078a1a5..1d8651c80b5c9e359355d8ea04842be5049cd95a 100644 (file)
@@ -33,3 +33,11 @@ rpc.netlogon.*.GetTrustPasswords
 base.charset.*.Testing partial surrogate
 .*net.api.delshare.*                           # DelShare isn't implemented yet
 rap.*netservergetinfo
+smb2.persistent.handles1
+samba4.winbind.struct.*.LIST_GROUPS       # Not yet working in winbind
+samba4.winbind.struct.*.SHOW_SEQUENCE     # Not yet working in winbind
+samba4.winbind.struct.*.GETPWENT          # Not yet working in winbind
+samba4.winbind.struct.*.SETPWENT          # Not yet working in winbind
+samba4.winbind.struct.*.LOOKUP_NAME_SID   # Not yet working in winbind
+
+
index 19ff924794d3c92969f1c66f418573f24398955d..4ac35a3c786d6ed6016dd79cbaa00c4f55071c14 100644 (file)
@@ -4,12 +4,13 @@ base.iometer
 base.casetable
 base.nttrans
 .*base.bench.holdcon.*                         # Very slow
+raw.bench.lookup       # Very slow
 base.scan.maxfid
-raw.hold.oplock
-raw.ping.pong
+raw.hold.oplock                # Not a test, but a way to block other clients for a test
+raw.ping.pong          # Needs second server to test
 rpc.samr_accessmask
 raw.scan.eamax
-raw.qfileinfo.ipc
+samba4.ntvfs.cifs.raw.qfileinfo.ipc
 base.utable
 base.smb
 smb2.notify
@@ -38,10 +39,14 @@ rpc.initshutdown                                    # Not provided by Samba 4
 rpc.svcctl                                                     # Not provided by Samba 4
 rpc.atsvc                                                      # Not provided by Samba 4
 rpc.frsapi                                                     # Not provided by Samba 4
-.*samba3.*                                                     # Samba3-specific test
+^samba4.base.samba3.*                                          # Samba3-specific test
+^samba4.ntvfs.cifs.base.samba3.*                               # Samba3-specific test
+^samba4.raw.samba3.*                                           # Samba3-specific test
+^samba4.ntvfs.cifs.raw.samba3.*                                        # Samba3-specific test
+samba4.ntvfs.cifs.raw.
+^samba4.rpc..*samba3.*                                         # Samba3-specific test
 ^samba4.net.domopen.*$                         # Hangs for some reason
 ^samba4.net.api.become.dc.*$                   # Fails
-winbind                                                        # FIXME: This should not be skipped
 nss.test                                               # Fails
 samba4.samba3sam.python                # Conversion from EJS not yet finished
 samba4.samdb.python                    # Not finished yet
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 4eef0207f98f9e0c3de74d86fbde6b291d87f29a..896b292e23d0c1a6d45124fec1644f34831e9eb3 100644 (file)
@@ -62,6 +62,8 @@ PRIVATE_DEPENDENCIES = service_auth
 
 smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o
 
+smbcalls_auth_OBJ_FILES = scripting/ejs/smbcalls_auth.o
+
 [MODULE::smbcalls_string]
 SUBSYSTEM = smbcalls
 OUTPUT_TYPE = MERGED_OBJ
@@ -101,7 +103,6 @@ smbcalls_OBJ_FILES = $(addprefix scripting/ejs/, \
 #######################
 # Start BINARY SMBSCRIPT
 [BINARY::smbscript]
-INSTALLDIR = BINDIR
 PRIVATE_DEPENDENCIES = EJS LIBSAMBA-UTIL smbcalls LIBSAMBA-HOSTCONFIG
 # End BINARY SMBSCRIPT
 #######################
index 99be1c4ef8e10166c19a8972c6ea82e795bedbe6..cbe163552e2653704d4abca508f56ca8f9798a5c 100644 (file)
@@ -50,7 +50,7 @@ static int ejs_net_context(MprVarHandle eid, int argc, struct MprVar **argv)
                ejsSetErrorMsg(eid, "talloc_new() failed");
                return -1;
        }
-       ev = event_context_find(event_mem_ctx);
+       ev = mprEventCtx();
 
        ctx = libnet_context_init(ev, mprLpCtx());
        /* IF we generated a new event context, it will be under here,
index 57e538d3b4de725b0476f506defa9c14200fc61a..0c32035c6cb827259ef8b291438047a08540ccb9 100644 (file)
@@ -268,8 +268,9 @@ static int ejs_net_userinfo(MprVarHandle eid, int argc, char **argv)
 
        /* call the libnet function */
        req.in.domain_name = userman_domain;
-       req.in.user_name   = username;
-       
+       req.in.data.user_name   = username;
+       req.in.level = USER_INFO_BY_NAME;
+
        status = libnet_UserInfo(ctx, mem_ctx, &req);
        if (!NT_STATUS_IS_OK(status)) {
                ejsSetErrorMsg(eid, "%s", req.out.error_string);
index 908a009159a09c4a0d118b3ba9401308c04d3940..b67bb7ed5bde10163bdce0f9e4750a5627bf4fd5 100644 (file)
@@ -55,7 +55,7 @@ static int ejs_doauth(MprVarHandle eid,
                msg = c->msg_ctx;
        } else {
                /* Hope we can find the event context somewhere up there... */
-               ev = event_context_find(tmp_ctx);
+               ev = mprEventCtx();
                msg = messaging_client_init(tmp_ctx, lp_messaging_path(tmp_ctx, mprLpCtx()), 
                                            lp_iconv_convenience(mprLpCtx()), ev);
        }
@@ -109,7 +109,7 @@ static int ejs_doauth(MprVarHandle eid,
                goto done;
        }
 
-       nt_status = auth_generate_session_info(tmp_ctx, mprLpCtx(), server_info, &session_info);
+       nt_status = auth_generate_session_info(tmp_ctx, mprEventCtx(), mprLpCtx(), server_info, &session_info);
        if (!NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(auth, "report", mprString("Session Info generation failed"));
                mprSetPropertyValue(auth, "result", mprCreateBoolVar(false));
index f47920b9bb5fd04d306c40ff88fc7ddcfd625f84..4a157945af5cdf9184792e3187addc87e05b2454 100644 (file)
@@ -453,7 +453,7 @@ static int ejs_ldbConnect(MprVarHandle eid, int argc, char **argv)
 
        dbfile = argv[0];
 
-       ldb = ldb_wrap_connect(mprMemCtx(), mprLpCtx(), dbfile, 
+       ldb = ldb_wrap_connect(mprMemCtx(), mprEventCtx(), mprLpCtx(), dbfile, 
                               session_info, creds,
                               0, (const char **)(argv+1));
        if (ldb == NULL) {
index 67a85414caf718fbf110c6203531487688e32da2..8c555bf821ca702b4ae34caa2b68677310b13782 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_resolve_name(MprVarHandle eid, int argc, struct MprVar **argv)
 
        result = 0;
 
-       nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, event_context_find(tmp_ctx));
+       nt_status = resolve_name(lp_resolve_context(mprLpCtx()), &name, tmp_ctx, &reply_addr, mprEventCtx());
 
        if (NT_STATUS_IS_OK(nt_status)) {
                mprSetPropertyValue(argv[0], "value", mprString(reply_addr));
index e20d91ad2eeef7b5dec0566a6f4f78b4cdcd7711..ed8653d3a7b3b46c3faefde2a8c7eb05bc2bb900 100644 (file)
@@ -70,7 +70,7 @@ static int ejs_reg_open(MprVarHandle eid, int argc, struct MprVar **argv)
        struct registry_context *rctx;
        WERROR error;
 
-       error = reg_open_samba(mprMemCtx(), &rctx, mprLpCtx(), NULL, NULL);
+       error = reg_open_samba(mprMemCtx(), &rctx, mprEventCtx(), mprLpCtx(), NULL, NULL);
        SMB_ASSERT(W_ERROR_IS_OK(error));
 
        mprSetPtrChild(reg, "registry", rctx);
index d1e49b4348a97823eab5fc498e4ada7c17a07c3c..94774d708bbb0008a6d9ea650fe4d02e9d9e6676 100644 (file)
@@ -73,7 +73,7 @@ static int ejs_irpc_connect(MprVarHandle eid, int argc, char **argv)
 
        p->server_name = argv[0];
 
-       ev = event_context_find(p);
+       ev = mprEventCtx();
 
        /* create a messaging context, looping as we have no way to
           allocate temporary server ids automatically */
@@ -158,7 +158,7 @@ static int ejs_rpc_connect(MprVarHandle eid, int argc, char **argv)
                cli_credentials_set_anonymous(creds);
        }
 
-       ev = event_context_find(mprMemCtx());
+       ev = mprEventCtx();
 
        status = dcerpc_pipe_connect(this, &p, binding, iface, creds, ev,
                                     mprLpCtx());
index a0f5caad3bde796b4fc6e3d34e6e46342dc052d4..15be4ca3093beebcb8d34372d42480a71258273b 100644 (file)
@@ -23,3 +23,9 @@ python_misc_OBJ_FILES = scripting/python/misc_wrap.o
 _PY_FILES = $(shell find scripting/python -name "*.py")
 
 $(foreach pyfile, $(_PY_FILES),$(eval $(call python_py_module_template,$(patsubst scripting/python/%,%,$(pyfile)),$(pyfile))))
+
+installpython:: pythonmods
+       @$(SHELL) $(srcdir)/script/installpython.sh \
+               $(INSTALLPERMS) \
+               $(DESTDIR)$(PYTHONDIR) \
+               scripting/python bin/python
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 08f3c1156c432dd678e85ff10d3457a35ad62767..cbff14c7088acbe5de057d076392ef79f2864d86 100644 (file)
@@ -41,6 +41,7 @@ extern void initepmapper(void);
 extern void initinitshutdown(void);
 static void initdcerpc_misc(void) {} 
 extern void initmgmt(void);
+extern void initnet(void);
 extern void initatsvc(void);
 extern void initsamr(void);
 static void initdcerpc_security(void) {}
index f4d0f37c39410e00dc565d580be196f0e5ba1fb4..93d583c10a4041c3b6990bcc82372f62a57aaad6 100644 (file)
@@ -17,6 +17,9 @@
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */
 
+#ifndef _PYRPC_H_
+#define _PYRPC_H_
+
 #define PY_CHECK_TYPE(type, var, fail) \
        if (!type ## _Check(var)) {\
                PyErr_Format(PyExc_TypeError, "Expected type %s", type ## _Type.tp_name); \
@@ -32,3 +35,5 @@
 #ifndef PyAPI_DATA
 #   define PyAPI_DATA(RTYPE) extern RTYPE
 #endif
+
+#endif /* _PYRPC_H_ */
index d8d3efe69c15c5b8e1db0376a27c7a817bbc29a8..aa0ae9bf90742864ad4b480279a038eeaf149c3c 100644 (file)
@@ -39,7 +39,7 @@ PyObject *py_talloc_import_ex(PyTypeObject *py_type, TALLOC_CTX *mem_ctx,
 PyObject *py_talloc_default_repr(PyObject *py_obj)
 {
        py_talloc_Object *obj = (py_talloc_Object *)py_obj;
+       PyTypeObject *type = (PyTypeObject*)PyObject_Type((PyObject *)obj);
 
-       return PyString_FromFormat("<talloc: %s>", 
-                                                          talloc_get_name(obj->talloc_ctx));
+       return PyString_FromFormat("<%s>", type->tp_name);
 }
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 6917aa1a543381227e0b4afaf01559d24555cc3f..0e8840646cd652e553e188c9eaf734943e8087ee 100644 (file)
@@ -87,6 +87,7 @@ class ProvisionNames:
         self.domain = None
         self.hostname = None
         self.sitename = None
+        self.smbconf = None
     
 class ProvisionResult:
     def __init__(self):
@@ -262,10 +263,15 @@ def provision_paths_from_lp(lp, dnsdomain):
 
     paths.netlogon = lp.get("path", "netlogon")
 
+    paths.smbconf = lp.configfile()
+
     return paths
 
+
 def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=None,
-              rootdn=None, domaindn=None, configdn=None, schemadn=None, sitename=None):
+                rootdn=None, domaindn=None, configdn=None, schemadn=None, serverdn=None, 
+                sitename=None):
+    """Guess configuration settings to use."""
 
     if hostname is None:
         hostname = socket.gethostname().split(".")[0].lower()
@@ -287,7 +293,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=
 
     if lp.get("realm").upper() != realm:
         raise Exception("realm '%s' in %s must match chosen realm '%s'" %
-                        (lp.get("realm"), smbconf, realm))
+                        (lp.get("realm"), lp.configfile(), realm))
     
     dnsdomain = dnsdomain.lower()
 
@@ -332,6 +338,7 @@ def guess_names(lp=None, hostname=None, domain=None, dnsdomain=None, serverrole=
     names.netbiosname = netbiosname
     names.hostname = hostname
     names.sitename = sitename
+    names.serverdn = "CN=%s,CN=Servers,CN=%s,CN=Sites,%s" % (netbiosname, sitename, configdn)
     
     return names
     
@@ -398,6 +405,7 @@ def load_or_make_smbconf(smbconf, setup_path, hostname, domain, realm, serverrol
 
     return lp
 
+
 def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
                         users_gid, wheel_gid):
     """setup reasonable name mappings for sam names to unix names.
@@ -423,6 +431,7 @@ def setup_name_mappings(samdb, idmap, sid, domaindn, root_uid, nobody_uid,
     idmap.setup_name_mapping(sid + "-500", idmap.TYPE_UID, root_uid)
     idmap.setup_name_mapping(sid + "-513", idmap.TYPE_GID, users_gid)
 
+
 def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info, 
                            credentials, names,
                            serverrole, ldap_backend=None, 
@@ -543,9 +552,7 @@ def setup_samdb_partitions(samdb_path, setup_path, message, lp, session_info,
         samdb.load_ldif_file_add(setup_path("provision_init.ldif"))
 
         message("Setting up sam.ldb rootDSE")
-        setup_samdb_rootdse(samdb, setup_path, names.schemadn, names.domaindn, names.hostname, 
-                            names.dnsdomain, names.realm, names.rootdn, names.configdn, names.netbiosname,
-                            names.sitename)
+        setup_samdb_rootdse(samdb, setup_path, names)
 
         if erase:
             message("Erasing data from partitions")
@@ -637,6 +644,7 @@ def setup_registry(path, setup_path, session_info, credentials, lp):
     assert os.path.exists(provision_reg)
     reg.diff_apply(provision_reg)
 
+
 def setup_idmapdb(path, setup_path, session_info, credentials, lp):
     """Setup the idmap database.
 
@@ -656,25 +664,23 @@ def setup_idmapdb(path, setup_path, session_info, credentials, lp):
     idmap_ldb.load_ldif_file_add(setup_path("idmap_init.ldif"))
     return idmap_ldb
 
-def setup_samdb_rootdse(samdb, setup_path, schemadn, domaindn, hostname, 
-                        dnsdomain, realm, rootdn, configdn, netbiosname,
-                        sitename):
+
+def setup_samdb_rootdse(samdb, setup_path, names):
     """Setup the SamDB rootdse.
 
     :param samdb: Sam Database handle
     :param setup_path: Obtain setup path
     """
     setup_add_ldif(samdb, setup_path("provision_rootdse_add.ldif"), {
-        "SCHEMADN": schemadn, 
-        "NETBIOSNAME": netbiosname,
-        "DNSDOMAIN": dnsdomain,
-        "DEFAULTSITE": sitename,
-        "REALM": realm,
-        "DNSNAME": "%s.%s" % (hostname, dnsdomain),
-        "DOMAINDN": domaindn,
-        "ROOTDN": rootdn,
-        "CONFIGDN": configdn,
-        "VERSION": samba.version(),
+        "SCHEMADN": names.schemadn, 
+        "NETBIOSNAME": names.netbiosname,
+        "DNSDOMAIN": names.dnsdomain,
+        "REALM": names.realm,
+        "DNSNAME": "%s.%s" % (names.hostname, names.dnsdomain),
+        "DOMAINDN": names.domaindn,
+        "ROOTDN": names.rootdn,
+        "CONFIGDN": names.configdn,
+        "SERVERDN": names.serverdn,
         })
         
 
@@ -687,6 +693,7 @@ def setup_self_join(samdb, names,
               "CONFIGDN": names.configdn, 
               "SCHEMADN": names.schemadn,
               "DOMAINDN": names.domaindn,
+              "SERVERDN": names.serverdn,
               "INVOCATIONID": invocationid,
               "NETBIOSNAME": names.netbiosname,
               "DEFAULTSITE": names.sitename,
@@ -734,8 +741,6 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
         return samdb
 
     message("Pre-loading the Samba 4 and AD schema")
-    samdb = SamDB(path, session_info=session_info, 
-                  credentials=credentials, lp=lp)
     samdb.set_domain_sid(domainsid)
     if serverrole == "domain controller":
         samdb.set_invocation_id(invocationid)
@@ -770,6 +775,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "NETBIOSNAME": names.netbiosname,
             "DEFAULTSITE": names.sitename,
             "CONFIGDN": names.configdn,
+            "SERVERDN": names.serverdn,
             "POLICYGUID": policyguid,
             "DOMAINDN": names.domaindn,
             "DOMAINGUID_MOD": domainguid_mod,
@@ -800,6 +806,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "NETBIOSNAME": names.netbiosname,
             "DEFAULTSITE": names.sitename,
             "CONFIGDN": names.configdn,
+            "SERVERDN": names.serverdn
             })
 
         message("Setting up sam.ldb Samba4 schema")
@@ -818,6 +825,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "DOMAIN": names.domain,
             "SCHEMADN": names.schemadn,
             "DOMAINDN": names.domaindn,
+            "SERVERDN": names.serverdn
             })
 
         message("Setting up display specifiers")
@@ -842,6 +850,7 @@ def setup_samdb(path, setup_path, session_info, credentials, lp,
             "NETBIOSNAME": names.netbiosname,
             "DEFAULTSITE": names.sitename,
             "CONFIGDN": names.configdn,
+            "SERVERDN": names.serverdn
             })
 
         if fill == FILL_FULL:
@@ -879,7 +888,8 @@ FILL_DRS = "DRS"
 
 def provision(setup_dir, message, session_info, 
               credentials, smbconf=None, targetdir=None, samdb_fill=FILL_FULL, realm=None, 
-              rootdn=None, domaindn=None, schemadn=None, configdn=None,
+              rootdn=None, domaindn=None, schemadn=None, configdn=None, 
+              serverdn=None,
               domain=None, hostname=None, hostip=None, hostip6=None, 
               domainsid=None, adminpass=None, krbtgtpass=None, domainguid=None, 
               policyguid=None, invocationid=None, machinepass=None, 
@@ -932,7 +942,8 @@ def provision(setup_dir, message, session_info,
 
     names = guess_names(lp=lp, hostname=hostname, domain=domain, 
                         dnsdomain=realm, serverrole=serverrole, sitename=sitename,
-                        rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn)
+                        rootdn=rootdn, domaindn=domaindn, configdn=configdn, schemadn=schemadn,
+                        serverdn=serverdn)
 
     paths = provision_paths_from_lp(lp, names.dnsdomain)
 
@@ -999,20 +1010,25 @@ def provision(setup_dir, message, session_info,
                         ldap_backend_type=ldap_backend_type)
 
     if lp.get("server role") == "domain controller":
-       policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies", 
-                                  "{" + policyguid + "}")
-       os.makedirs(policy_path, 0755)
-       os.makedirs(os.path.join(policy_path, "Machine"), 0755)
-       os.makedirs(os.path.join(policy_path, "User"), 0755)
-       if not os.path.isdir(paths.netlogon):
+        if paths.netlogon is None:
+            message("Existing smb.conf does not have a [netlogon] share, but you are configuring a DC.")
+            message("Please either remove %s or see the template at %s" % 
+                    ( paths.smbconf, setup_path("provision.smb.conf.dc")))
+            assert(paths.netlogon is not None)
+
+        if paths.sysvol is None:
+            message("Existing smb.conf does not have a [sysvol] share, but you are configuring a DC.")
+            message("Please either remove %s or see the template at %s" % 
+                    (paths.smbconf, setup_path("provision.smb.conf.dc")))
+            assert(paths.sysvol is not None)            
+            
+        policy_path = os.path.join(paths.sysvol, names.dnsdomain, "Policies", 
+                                   "{" + policyguid + "}")
+        os.makedirs(policy_path, 0755)
+        os.makedirs(os.path.join(policy_path, "Machine"), 0755)
+        os.makedirs(os.path.join(policy_path, "User"), 0755)
+        if not os.path.isdir(paths.netlogon):
             os.makedirs(paths.netlogon, 0755)
-       secrets_ldb = Ldb(paths.secrets, session_info=session_info, 
-                         credentials=credentials, lp=lp)
-       secretsdb_become_dc(secrets_ldb, setup_path, domain=domain, realm=names.realm,
-                           netbiosname=names.netbiosname, domainsid=domainsid, 
-                           keytab_path=paths.keytab, samdb_url=paths.samdb, 
-                           dns_keytab_path=paths.dns_keytab, dnspass=dnspass, 
-                           machinepass=machinepass, dnsdomain=names.dnsdomain)
 
     if samdb_fill == FILL_FULL:
         setup_name_mappings(samdb, idmap, str(domainsid), names.domaindn,
@@ -1024,6 +1040,14 @@ def provision(setup_dir, message, session_info,
 
         # Only make a zone file on the first DC, it should be replicated with DNS replication
         if serverrole == "domain controller":
+            secrets_ldb = Ldb(paths.secrets, session_info=session_info, 
+                              credentials=credentials, lp=lp)
+            secretsdb_become_dc(secrets_ldb, setup_path, domain=domain, realm=names.realm,
+                                netbiosname=names.netbiosname, domainsid=domainsid, 
+                                keytab_path=paths.keytab, samdb_url=paths.samdb, 
+                                dns_keytab_path=paths.dns_keytab, dnspass=dnspass, 
+                                machinepass=machinepass, dnsdomain=names.dnsdomain)
+
             samdb = SamDB(paths.samdb, session_info=session_info, 
                       credentials=credentials, lp=lp)
 
@@ -1046,8 +1070,8 @@ def provision(setup_dir, message, session_info,
 
     message("Please install the phpLDAPadmin configuration located at %s into /etc/phpldapadmin/config.php" % paths.phpldapadminconfig)
 
-    message("Once the above files are installed, your server will be ready to use")
-    message("Server Type:    %s" % serverrole)
+    message("Once the above files are installed, your Samba4 server will be ready to use")
+    message("Server Role:    %s" % serverrole)
     message("Hostname:       %s" % names.hostname)
     message("NetBIOS Domain: %s" % names.domain)
     message("DNS Domain:     %s" % names.dnsdomain)
@@ -1061,27 +1085,33 @@ def provision(setup_dir, message, session_info,
     result.samdb = samdb
     return result
 
+
 def provision_become_dc(setup_dir=None,
                         smbconf=None, targetdir=None, realm=None, 
                         rootdn=None, domaindn=None, schemadn=None, configdn=None,
+                        serverdn=None,
                         domain=None, hostname=None, domainsid=None, 
                         adminpass=None, krbtgtpass=None, domainguid=None, 
                         policyguid=None, invocationid=None, machinepass=None, 
                         dnspass=None, root=None, nobody=None, nogroup=None, users=None, 
                         wheel=None, backup=None, aci=None, serverrole=None, 
-                        ldap_backend=None, ldap_backend_type=None, sitename=DEFAULTSITE):
+                        ldap_backend=None, ldap_backend_type=None, sitename=None):
 
     def message(text):
        """print a message if quiet is not set."""
         print text
 
-    provision(setup_dir, message, system_session(), None,
+    return provision(setup_dir, message, system_session(), None,
               smbconf=smbconf, targetdir=targetdir, samdb_fill=FILL_DRS, realm=realm, 
-              rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, 
+              rootdn=rootdn, domaindn=domaindn, schemadn=schemadn, configdn=configdn, serverdn=serverdn,
               domain=domain, hostname=hostname, hostip="127.0.0.1", domainsid=domainsid, machinepass=machinepass, serverrole="domain controller", sitename=sitename);
     
 
-def setup_db_config(setup_path, file, dbdir):
+def setup_db_config(setup_path, dbdir):
+    """Setup a Berkeley database.
+    
+    :param setup_path: Setup path function.
+    :param dbdir: Database directory."""
     if not os.path.isdir(os.path.join(dbdir, "bdb-logs")):
         os.makedirs(os.path.join(dbdir, "bdb-logs"), 0700);
     if not os.path.isdir(os.path.join(dbdir, "tmp")):
@@ -1096,7 +1126,7 @@ def provision_backend(setup_dir=None, message=None,
                       smbconf=None, targetdir=None, realm=None, 
                       rootdn=None, domaindn=None, schemadn=None, configdn=None,
                       domain=None, hostname=None, adminpass=None, root=None, serverrole=None, 
-                      ldap_backend_type=None):
+                      ldap_backend_type=None, ldap_backend_port=None):
 
     def setup_path(file):
         return os.path.join(setup_dir, file)
@@ -1136,6 +1166,7 @@ def provision_backend(setup_dir=None, message=None,
                            "NETBIOSNAME": names.netbiosname,
                            "DEFAULTSITE": DEFAULTSITE,
                            "CONFIGDN": names.configdn,
+                           "SERVERDN": names.serverdn
                            })
     
     setup_add_ldif(schemadb, setup_path("schema_samba4.ldif"), 
@@ -1144,7 +1175,12 @@ def provision_backend(setup_dir=None, message=None,
                    {"SCHEMADN": names.schemadn})
 
     if ldap_backend_type == "fedora-ds":
-        setup_file(setup_path("fedora-ds.inf"), paths.fedoradsinf, 
+        if ldap_backend_port is not None:
+            serverport = "ServerPort=%d" % ldap_backend_port
+        else:
+            serverport = ""
+
+        setup_file(setup_path("fedorads.inf"), paths.fedoradsinf, 
                    {"ROOT": root,
                     "HOSTNAME": hostname,
                     "DNSDOMAIN": names.dnsdomain,
@@ -1152,19 +1188,18 @@ def provision_backend(setup_dir=None, message=None,
                     "DOMAINDN": names.domaindn,
                     "LDAPMANAGERDN": names.ldapmanagerdn,
                     "LDAPMANAGERPASS": adminpass, 
-                    "SERVERPORT": ""})
+                    "SERVERPORT": serverport})
         
-        setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions, 
+        setup_file(setup_path("fedorads-partitions.ldif"), paths.fedoradspartitions, 
                    {"CONFIGDN": names.configdn,
                     "SCHEMADN": names.schemadn,
                     })
         
-        setup_file(setup_path("fedora-partitions.ldif"), paths.fedoradspartitions, 
-                   {"CONFIGDN": names.configdn,
-                    "SCHEMADN": names.schemadn,
-                    })
         mapping = "schema-map-fedora-ds-1.0"
         backend_schema = "99_ad.ldif"
+        
+        slapdcommand="Initailise Fedora DS with: setup-ds.pl --file=%s" % paths.fedoradsinf
+       
     elif ldap_backend_type == "openldap":
         attrs = ["linkID", "lDAPDisplayName"]
        res = schemadb.search(expression="(&(&(linkID=*)(!(linkID:1.2.840.113556.1.4.803:=1)))(objectclass=attributeSchema))", base=names.schemadn, scope=SCOPE_SUBTREE, attrs=attrs);
@@ -1207,22 +1242,33 @@ refint_attributes""" + refint_attributes + "\n";
         setup_file(setup_path("modules.conf"), paths.modulesconf,
                    {"REALM": names.realm})
         
-        setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "user"))
-        setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "config"))
-        setup_db_config(setup_path, file, os.path.join(paths.ldapdir, "db", "schema"))
+        setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "user")))
+        setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "config")))
+        setup_db_config(setup_path, os.path.join(paths.ldapdir, os.path.join("db", "schema")))
         mapping = "schema-map-openldap-2.3"
         backend_schema = "backend-schema.schema"
-        
 
         ldapi_uri = "ldapi://" + urllib.quote(os.path.join(paths.private_dir, "ldap", "ldapi"), safe="")
-        message("Start slapd with: slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri)
-                
+        if ldap_backend_port is not None:
+            server_port_string = " -h ldap://0.0.0.0:%d" % ldap_backend_port
+        else:
+            server_port_string = ""
+        slapdcommand="Start slapd with:    slapd -f " + paths.ldapdir + "/slapd.conf -h " + ldapi_uri + server_port_string
 
     schema_command = "bin/ad2oLschema --option=convert:target=" + ldap_backend_type + " -I " + setup_path(mapping) + " -H tdb://" + schemadb_path + " -O " + os.path.join(paths.ldapdir, backend_schema);
 
     os.system(schema_command)
 
 
+    message("Your %s Backend for Samba4 is now configured, and is ready to be started" % ( ldap_backend_type) )
+    message("Server Role:         %s" % serverrole)
+    message("Hostname:            %s" % names.hostname)
+    message("DNS Domain:          %s" % names.dnsdomain)
+    message("Base DN:             %s" % names.domaindn)
+    message("LDAP admin DN:       %s" % names.ldapmanagerdn)
+    message("LDAP admin password: %s" % adminpass)
+    message(slapdcommand)
+
 
 def create_phpldapadmin_config(path, setup_path, ldapi_uri):
     """Create a PHP LDAP admin configuration file.
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..1afdc582a7efccbf031e1924c0a057de73069723 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)
+        self.conn = winreg.winreg("ncalrpc:", self.get_loadparm(), 
+                                  self.get_credentials())
 
     def get_hklm(self):
         return self.conn.OpenHKLM(None, 
index 8c1a8bec71325c94dc1792ac2c74e5f931a34dee..6c43632d970e39f77f1e4dee721a2440d69971b5 100644 (file)
 
 import echo
 import unittest
-from samba.tests import get_loadparm
+from samba.tests import RpcInterfaceTestCase
 
-class RpcEchoTests(unittest.TestCase):
+class RpcEchoTests(RpcInterfaceTestCase):
     def setUp(self):
-        lp_ctx = get_loadparm()
-        self.conn = echo.rpcecho("ncalrpc:", lp_ctx)
+        self.conn = echo.rpcecho("ncalrpc:", self.get_loadparm())
 
     def test_addone(self):
         self.assertEquals(2, self.conn.AddOne(1))
 
     def test_echodata(self):
-        self.assertEquals([1,2,3], self.conn.EchoData(3, [1, 2, 3]))
+        self.assertEquals([1,2,3], self.conn.EchoData([1, 2, 3]))
 
     def test_call(self):
         self.assertEquals(u"foobar", self.conn.TestCall(u"foobar"))
index 96348f2f6968451bea5acb1f737590f89c1e6807..8ef12dad86700720eaf562ca4c439c47bb0ef62c 100644 (file)
 #
 
 import samr
-import unittest
-from samba.tests import get_loadparm
+from samba.tests import RpcInterfaceTestCase
 
-class SamrTests(unittest.TestCase):
+class SamrTests(RpcInterfaceTestCase):
     def setUp(self):
-        self.conn = samr.samr("ncalrpc:", get_loadparm())
+        self.conn = samr.samr("ncalrpc:", self.get_loadparm())
 
     def test_connect5(self):
         (level, info, handle) = self.conn.Connect5(None, 0, 1, samr.ConnectInfo1())
index 99c84c08da62f0332c526c994c89c21454c915d8..78a987cedd8845352722563aff54b5ac9b1a72e6 100644 (file)
 #
 
 import unixinfo
-import unittest
-from samba.tests import get_loadparm
+from samba.tests import RpcInterfaceTestCase
 
-class UnixinfoTests(unittest.TestCase):
+class UnixinfoTests(RpcInterfaceTestCase):
     def setUp(self):
-        self.conn = unixinfo.unixinfo("ncalrpc:", get_loadparm())
+        self.conn = unixinfo.unixinfo("ncalrpc:", self.get_loadparm())
 
     def test_getpwuid(self):
-        (count, infos) = self.conn.GetPWUid(1, [0])
-        self.assertEquals(1, len(infos))
+        infos = self.conn.GetPWUid(range(512))
+        self.assertEquals(512, len(infos))
+        self.assertEquals("/bin/false", infos[0].shell)
+        self.assertTrue(isinstance(infos[0].homedir, unicode))
+
+    def test_gidtosid(self):
+        self.conn.GidToSid(1000)
+
+    def test_uidtosid(self):
+        self.conn.UidToSid(1000)
index 514582cbe42603def08983df3be64c93fd814562..b9e0e16d3cac11142821d71ffec3e1492a9b7dba 100644 (file)
@@ -24,7 +24,7 @@ from ldb import Dn
 import param
 import unittest
 
-lp = samba.tests.get_loadparm()
+lp = samba.tests.cmdline_loadparm
 
 setup_dir = "setup"
 def setup_path(file):
index 3745dba6fc27474312f265ae199b02e3cf8f8745..0e175bf936addc5b77cb4fbcf9882a9e01b1d788 100644 (file)
@@ -21,7 +21,7 @@ from credentials import Credentials
 import os
 from samba.provision import setup_samdb
 from samba.samdb import SamDB
-from samba.tests import get_loadparm, TestCaseInTempDir
+from samba.tests import cmdline_loadparm, TestCaseInTempDir
 import security
 from unittest import TestCase
 import uuid
@@ -43,7 +43,7 @@ class SamDBTestCase(TestCaseInTempDir):
         hostguid = uuid.random()
         path = os.path.join(self.tempdir, "samdb.ldb")
         self.samdb = setup_samdb(path, setup_path, system_session(), creds, 
-                                 get_loadparm(), schemadn, configdn, 
+                                 cmdline_loadparm, schemadn, configdn, 
                                  self.domaindn, "example.com", "EXAMPLE.COM", 
                                  "FOO", lambda x: None, "foo", domaindn, 
                                  False, domainsid, "# no aci", domainguid, 
index cd9a1cb4d52f29ee5c5cb05298e9dd2b07750045..18cfb6ce3295908619b3c940bbde8f9f89543aef 100644 (file)
@@ -27,7 +27,7 @@ static PyObject *uuid_random(PyObject *self, PyObject *args)
        PyObject *pyobj;
        char *str;
 
-       if (!PyArg_ParseTuple(args, (char *)""))
+       if (!PyArg_ParseTuple(args, ""))
                return NULL;
 
        guid = GUID_random();
@@ -52,7 +52,7 @@ static PyMethodDef methods[] = {
 
 void inituuid(void)
 {
-       PyObject *mod = Py_InitModule3((char *)"uuid", methods, "UUID helper routines");
+       PyObject *mod = Py_InitModule3("uuid", methods, "UUID helper routines");
        if (mod == NULL)
                return;
 }
index e8e87c8b3f4b01a823f3d61a88f3aacf3352132e..f8be20a569c787a97ea7d049649093aea345d89e 100644 (file)
@@ -3,15 +3,70 @@
 This directory contains test scripts that are useful for running a
 bunch of tests all at once. 
 
-===============
-Available tests
-===============
-The available tests are obtained from a script, usually 
-selftest/samba{3,4}_tests.sh. This script should for each test output 
+Available testsuites
+====================
+The available testsuites are obtained from a script, usually 
+selftest/samba{3,4}_tests.sh. This script should for each testsuite output 
 the name of the test, the command to run and the environment that should be 
-provided.
+provided. Use the included "plantest" function to generate the required output.
+
+Testsuite behaviour
+================================
+
+Exit code
+------------
+The testsuites should exit with a non-zero exit code if at least one 
+test failed. Skipped tests should not influence the exit code.
+
+Output format
+-------------
+Testsuites can simply use the exit code to indicate whether all of their 
+tests have succeeded or one or more have failed. It is also possible to 
+provide more granular information using the Subunit protocol. 
+
+This protocol works by writing simple messages to standard output. Any 
+messages that can not be interpreted by this protocol are considered comments 
+for the last announced test.
+
+Accepted commands are:
+
+test
+~~~~~~~~~~~~
+test: <NAME>
+
+Announce that a new test with the specified name is starting
+
+success
+~~~~~~~~~~~~~~~
+success: <NAME> 
+
+Announce that the test with the specified name is done and ran successfully.
+
+failure
+~~~~~~~~~~~~~~~
+failure: <NAME> 
+failure: <NAME> [ REASON ]
+
+Announce that the test with the specified name failed. Optionally, it is 
+possible to specify a reason it failed.
+
+skip
+~~~~~~~~~~~~
+skip: <NAME>
+skip: <NAME> [ REASON ]
+
+Announce that the test with the specified name was skipped. Optionally a 
+reason can be specified.
+
+knownfail
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+knownfail: <NAME>
+knownfail: <NAME> [ REASON ]
+
+Announce that the test with the specified name was run and failed as expected.
+Alternatively it is also possible to simply return "failure:" here but 
+specify in the samba4-knownfailures file that it is failing.
 
-============
 Environments
 ============
 Tests often need to run against a server with particular things set up, 
@@ -23,6 +78,7 @@ The following environments are currently available:
  - none: No server set up, no variables set.
  - dc: Domain controller set up. The following environment variables will 
    be set:
+
      * USERNAME: Administrator user name
         * PASSWORD: Administrator password
         * DOMAIN: Domain name
@@ -34,6 +90,7 @@ The following environments are currently available:
 
  - member: Domain controller and member server that is joined to it set up. The
    following environment variables will be set:
+
      * USERNAME: Domain administrator user name
         * PASSWORD: Domain administrator password
         * DOMAIN: Domain name
@@ -41,22 +98,22 @@ The following environments are currently available:
         * SERVER: Name of the member server
 
 
-=============
 Running tests
 =============
 
-To run all the tests use:
+To run all the tests use::
 
    make test
 
-To run a quick subset (aiming for about 1 minute of testing) run:
+To run a quick subset (aiming for about 1 minute of testing) run::
 
    make quicktest
 
-To run a specific test, use this syntax
+To run a specific test, use this syntax::
 
    make test TESTS=testname
 
-for example
+for example::
 
    make test TESTS=samba4.BASE-DELETE
+
index e5c61ca9ba748ce92e0bc2ebc753da45d295e581..05e51da541206ad2c475de4be255fb9c8cc2dc65 100644 (file)
@@ -20,15 +20,22 @@ sub parse_results($$$$$)
                        $msg_ops->control_msg($_);
                        $msg_ops->start_test($open_tests, $1);
                        push (@$open_tests, $1);
-               } elsif (/^(success|successful|failure|skip|error): (.*?)( \[)?([ \t]*)\n/) {
+               } elsif (/^(success|successful|failure|skip|knownfail|error): (.*?)( \[)?([ \t]*)\n/) {
                        $msg_ops->control_msg($_);
                        my $reason = undef;
                        if ($3) {
                                $reason = "";
                                # reason may be specified in next lines
+                               my $terminated = 0;
                                while(<$fh>) {
                                        $msg_ops->control_msg($_);
-                                       if ($_ eq "]\n") { last; } else { $reason .= $_; }
+                                       if ($_ eq "]\n") { $terminated = 1; last; } else { $reason .= $_; }
+                               }
+                               
+                               unless ($terminated) {
+                                       $statistics->{TESTS_ERROR}++;
+                                       $msg_ops->end_test($open_tests, $2, $1, 1, "reason interrupted");
+                                       return 1;
                                }
                        }
                        my $result = $1;
@@ -53,6 +60,10 @@ sub parse_results($$$$$)
                                        $msg_ops->end_test($open_tests, $2, $1, 1, $reason);
                                        $unexpected_fail++;
                                }
+                       } elsif ($1 eq "knownfail") {
+                               pop(@$open_tests); #FIXME: Check that popped value == $2
+                               $statistics->{TESTS_EXPECTED_FAIL}++;
+                               $msg_ops->end_test($open_tests, $2, $1, 0, $reason);
                        } elsif ($1 eq "skip") {
                                $statistics->{TESTS_SKIP}++;
                                pop(@$open_tests); #FIXME: Check that popped value == $2
index 25ff74792e518f01e0a010ab8b8d8fbbdb52419c..f14e26b38d435cfddd5063230be1088d016d593e 100644 (file)
@@ -81,6 +81,9 @@ sub end_testsuite($$$$$)
        my $out = "";
 
        if ($unexpected) {
+               if ($result eq "success" and not defined($reason)) {
+                       $reason = "Expected negative exit code, got positive exit code";
+               } 
                $self->output_msg("ERROR: $reason\n");
                push (@{$self->{suitesfailed}}, $name);
        } else {
index 7e545664d1ff105c4881506284bef03f970c0a91..725fde2c7d45c68ccd48c133829a38f4a537bf9b 100755 (executable)
@@ -219,13 +219,16 @@ plantest "rpc.echo on ncacn_np over smb2" dc $smb4torture ncacn_np:"\$SERVER[smb
 # Tests against the NTVFS POSIX backend
 NTVFSARGS="--option=torture:sharedelay=100000 --option=torture:oplocktimeout=3"
 smb2=`$smb4torture --list | grep "^SMB2-" | xargs`
-raw=`$smb4torture --list | grep "^RAW-" | xargs`
+#The QFILEINFO-IPC test needs to be on ipc$
+raw=`$smb4torture --list | grep "^RAW-" | grep -v "RAW-QFILEINFO-IPC"| xargs`
 base=`$smb4torture --list | grep "^BASE-" | xargs`
 
 for t in $base $raw $smb2; do
     plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/tmp -U"\$USERNAME"%"\$PASSWORD" $NTVFSARGS
 done
 
+plansmbtorturetest "RAW-QFILEINFO-IPC" dc $ADDARGS //\$SERVER/ipc$ -U"\$USERNAME"%"\$PASSWORD"
+
 rap=`$smb4torture --list | grep "^RAP-" | xargs`
 for t in $rap; do
     plansmbtorturetest "$t" dc $ADDARGS //\$SERVER/IPC\\\$ -U"\$USERNAME"%"\$PASSWORD"
@@ -265,6 +268,7 @@ fi
 
 bbdir=$incdir/../../testprogs/blackbox
 
+plantest "blackbox.ndrdump" dc $bbdir/test_ndrdump.sh
 plantest "blackbox.smbclient" dc $bbdir/test_smbclient.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX" 
 plantest "blackbox.kinit" dc $bbdir/test_kinit.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$REALM" "\$DOMAIN" "$PREFIX" $CONFIGURATION 
 plantest "blackbox.cifsdd" dc $bbdir/test_cifsdd.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" 
@@ -273,6 +277,8 @@ plantest "blackbox.nmblookup" member $samba4srcdir/utils/tests/test_nmblookup.sh
 plantest "blackbox.locktest" dc $bbdir/test_locktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
 plantest "blackbox.masktest" dc $bbdir/test_masktest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
 plantest "blackbox.gentest" dc $bbdir/test_gentest.sh "\$SERVER" "\$USERNAME" "\$PASSWORD" "\$DOMAIN" "$PREFIX"
+plantest "blackbox.wbinfo" dc $bbdir/test_wbinfo.sh "\$DOMAIN" "\$USERNAME" "\$PASSWORD" "dc"
+plantest "blackbox.wbinfo" member $bbdir/test_wbinfo.sh "\$DOMAIN" "\$DC_USERNAME" "\$DC_PASSWORD" "member"
 
 # Tests using the "Simple" NTVFS backend
 
@@ -282,7 +288,7 @@ done
 
 DATADIR=$samba4srcdir/../testdata
 
-plantest "js.samba3sam" none $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/
+plantest "js.samba3sam" none $samba4bindir/smbscript $SCRIPTDIR/samba3sam.js $CONFIGURATION `pwd` $DATADIR/samba3/
 
 # Domain Member Tests
 
@@ -291,7 +297,6 @@ plantest "rpc.echo against member server with domain creds" member $VALGRIND $sm
 plantest "rpc.samr against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR" "$*"
 plantest "rpc.samr.users against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-USERS" "$*"
 plantest "rpc.samr.passwords against member server with local creds" member $VALGRIND $smb4torture ncacn_np:"\$NETBIOSNAME" -U"\$NETBIOSNAME/\$USERNAME"%"\$PASSWORD" "RPC-SAMR-PASSWORDS" "$*"
-plantest "wbinfo -a against member server with domain creds" member $VALGRIND $samba4bindir/wbinfo -a "\$DOMAIN/\$DC_USERNAME"%"\$DC_PASSWORD"
 
 NBT_TESTS=`$smb4torture --list | grep "^NBT-" | xargs`
 
@@ -299,9 +304,9 @@ for t in $NBT_TESTS; do
        plansmbtorturetest "$t" dc //\$SERVER/_none_ -U\$USERNAME%\$PASSWORD 
 done
 
-WB_OPTS="--option=\"torture:strict mode=yes\""
+WB_OPTS="--option=\"torture:strict mode=no\""
 WB_OPTS="${WB_OPTS} --option=\"torture:timelimit=1\""
-WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=\\\\\""
+WB_OPTS="${WB_OPTS} --option=\"torture:winbindd separator=/\""
 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd private pipe dir=\$WINBINDD_PRIV_PIPE_DIR\""
 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios name=\$SERVER\""
 WB_OPTS="${WB_OPTS} --option=\"torture:winbindd netbios domain=\$DOMAIN\""
@@ -342,7 +347,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 39a1b5a45089be203d4da12aa4dd4730f3a0b6b6..385d31bbfddced793f0a0f36d10dbab5f363d869 100755 (executable)
@@ -238,7 +238,13 @@ sub run_testsuite($$$$$$)
 
        $msg_ops->start_test([], $name);
 
-       open(RESULT, "$cmd 2>&1|");
+       unless (open(RESULT, "$cmd 2>&1|")) {
+               $statistics->{TESTS_ERROR}++;
+               $msg_ops->end_test([], $name, "error", 1, "Unable to run $cmd: $!");
+               $statistics->{SUITES_FAIL}++;
+               return 0;
+       }
+
        my $expected_ret = parse_results(
                $msg_ops, $statistics, *RESULT, \&expecting_failure, [$name]);
 
@@ -250,17 +256,17 @@ sub run_testsuite($$$$$$)
        my $ret = close(RESULT);
        $ret = 0 unless $ret == 1;
 
+       my $exitcode = $? >> 8;
+
        if ($ret == 1) {
-               $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef);
+               $msg_ops->end_test([], $name, "success", $expected_ret != $ret, undef); 
        } else {
-               $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, 
-                                              "Returned $ret");
+               $msg_ops->end_test([], $name, "failure", $expected_ret != $ret, "Exit code was $exitcode");
        }
 
        cleanup_pcap($pcap_file, $expected_ret, $ret);
 
-       if (not $opt_socket_wrapper_keep_pcap and 
-               defined($pcap_file)) {
+       if (not $opt_socket_wrapper_keep_pcap and defined($pcap_file)) {
                $msg_ops->output_msg("PCAP FILE: $pcap_file\n");
        }
 
index 262c8035f63ce193ab2ae59e057a879b8df1f04d..9488ae3e0404ad63cad0ec84489978419577b414 100644 (file)
@@ -201,8 +201,6 @@ sub mk_fedora_ds($$$)
 
        my $pidfile = "$fedora_ds_dir/logs/slapd-samba4.pid";
 
-       system("$self->{bindir}/ad2oLschema $configuration -H $ldapdir/schema-tmp.ldb --option=convert:target=fedora-ds -I $self->{setupdir}/schema-map-fedora-ds-1.0 -O $ldapdir/99_ad.ldif >&2") == 0 or die("schema conversion for Fedora DS failed");
-
 my $dir = getcwd();
 chdir "$ENV{FEDORA_DS_ROOT}/bin" || die;
        if (system("perl $ENV{FEDORA_DS_ROOT}/sbin/setup-ds.pl --silent --file=$fedora_ds_inf >&2") != 0) {
@@ -222,9 +220,6 @@ sub mk_openldap($$$)
        my $pidfile = "$ldapdir/slapd.pid";
        my $modconf = "$ldapdir/modules.conf";
 
-       #This uses the backend provision we just did, to read out the schema
-       system("$self->{bindir}/ad2oLschema $configuration --option=convert:target=openldap -H $ldapdir/schema-tmp.ldb -I $self->{setupdir}/schema-map-openldap-2.3 -O $ldapdir/backend-schema.schema >&2") == 0 or die("schema conversion for OpenLDAP failed");
-
        my $oldpath = $ENV{PATH};
        my $olpath = "";
        my $olroot = "";
@@ -526,7 +521,7 @@ sub provision($$$$$$)
        my $ncalrpcdir = "$prefix_abs/ncalrpc";
        my $lockdir = "$prefix_abs/lockdir";
        my $winbindd_socket_dir = "$prefix_abs/winbind_socket";
-       my $winbindd_priv_pipe_dir = "$piddir/smbd.tmp/winbind_pipe";
+       my $winbindd_priv_pipe_dir = "$privatedir/smbd.tmp/winbind_pipe";
        my $nsswrap_passwd = "$etcdir/passwd";
        my $nsswrap_group = "$etcdir/group";
 
@@ -700,6 +695,12 @@ nogroup:x:65534:nobody
        my @provision_options = ();
        push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\"");
        push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\"");
+       if (defined($ENV{GDB_PROVISION})) {
+               push (@provision_options, "gdb --args");
+       }
+       if (defined($ENV{VALGRIND_PROVISION})) {
+               push (@provision_options, "valgrind");
+       }
        if (defined($ENV{PROVISION_EJS})) {
                push (@provision_options, "$self->{bindir}/smbscript");
                push (@provision_options, "$self->{setupdir}/provision.js");
index a397cfd0d221a9ccf660a40aabf9529a5719d8e6..43e5b655625932ed7f04dd7a9bd4edebf746c5ea 100644 (file)
@@ -1,5 +1,4 @@
 dn: CN=CONFIG
 cn: CONFIG
-lowerBound: 10000
-upperBound: 20000
-
+lowerBound: 3000000
+upperBound: 4000000
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 259bd814a4be20e07cdd2c48ac4fdb36b947ccbb..b748dab33998cd49dd66ec8579c598ac09bc9032 100755 (executable)
@@ -35,6 +35,8 @@ from samba.provision import (provision,
                              FILL_FULL, FILL_NT4SYNC,
                              FILL_DRS)
 
+# how do we make this case insensitive??
+
 parser = optparse.OptionParser("provision [options]")
 sambaopts = options.SambaOptions(parser)
 parser.add_option_group(sambaopts)
index ada6dcef8dd6a3c78accec78cb59aa300d35f385..4f222c467a197ec0d1b1cfc05d5b01bfd4dde392 100755 (executable)
@@ -54,6 +54,8 @@ parser.add_option("--quiet", help="Be quiet", action="store_true")
 parser.add_option("--ldap-backend-type", type="choice", metavar="LDAP-BACKEND-TYPE", 
                help="LDB mapping module to use for the LDAP backend",
                choices=["fedora-ds", "openldap"])
+parser.add_option("--ldap-backend-port", type="int", metavar="PORT", 
+               help="TCP Port LDAP server should listen to (default ldapi only)")
 parser.add_option("--server-role", type="choice", metavar="ROLE",
                  choices=["domain controller", "dc", "member server", "member", "standalone"],
                help="Set server role to provision for (default standalone)")
@@ -89,10 +91,9 @@ if setup_dir is None:
        setup_dir = "setup"
 
 provision_backend(setup_dir=setup_dir, message=message, smbconf=smbconf, targetdir=opts.targetdir,
-          realm=opts.realm, domain=opts.domain,
-          hostname=opts.host_name,
-          adminpass=opts.ldap_manager_pass,
-          root=opts.root, serverrole=server_role, 
-          ldap_backend_type=opts.ldap_backend_type)
-
-message("All OK")
+                 realm=opts.realm, domain=opts.domain,
+                 hostname=opts.host_name,
+                 adminpass=opts.ldap_manager_pass,
+                 root=opts.root, serverrole=server_role, 
+                 ldap_backend_type=opts.ldap_backend_type,
+                 ldap_backend_port=opts.ldap_backend_port)
index 37b6bdaa600dff254b9a7403eb9c176245f0d527..2f734e83b2b6face716a2c89d7ee222fb461ae25 100644 (file)
@@ -30,7 +30,7 @@ objectclass: rIDManager
 cn: RID Manager$
 systemFlags: 2348810240
 isCriticalSystemObject: TRUE
-fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+fSMORoleOwner: CN=NTDS Settings,${SERVERDN}
 rIDAvailablePool: 4611686014132423217
 
 dn: CN=DomainUpdates,CN=System,${DOMAINDN}
@@ -50,7 +50,7 @@ objectclass: infrastructureUpdate
 cn: Infrastructure
 systemFlags: 2348810240
 isCriticalSystemObject: TRUE
-fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+fSMORoleOwner: CN=NTDS Settings,${SERVERDN}
 
 dn: CN=Builtin,${DOMAINDN}
 objectClass: top
index dadfda720e39c5343a5275cdd1550cedfaf75fee..f5e1bb5add6aef7bbcb413aac797750444763787 100644 (file)
@@ -65,7 +65,7 @@ replace: objectCategory
 objectCategory: CN=Domain-DNS,${SCHEMADN}
 -
 replace: fSMORoleOwner
-fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+fSMORoleOwner: CN=NTDS Settings,${SERVERDN}
 -
 replace: isCriticalSystemObject
 isCriticalSystemObject: TRUE
index 0fe90b07395f19b80d422344a480c496eb02f312..2a7357d7ad675ab208e75107e5085dcd3b73f5a7 100644 (file)
@@ -7,7 +7,7 @@ objectClass: crossRefContainer
 cn: Partitions
 systemFlags: 2147483648
 msDS-Behavior-Version: 0
-fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+fSMORoleOwner: CN=NTDS Settings,${SERVERDN}
 
 dn: CN=Enterprise Configuration,CN=Partitions,${CONFIGDN}
 objectClass: top
index 9f19796ec6c6049caf7ba0601a17a77721010812..14e0d71df6cda8dd48634d7cf3d90d48cbb71059 100644 (file)
@@ -1,7 +1,7 @@
 # the rootDSE module looks in this record for its base data
 dn: @ROOTDSE
 subschemaSubentry: CN=Aggregate,${SCHEMADN}
-dsServiceName: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+dsServiceName: CN=NTDS Settings,${SERVERDN}
 defaultNamingContext: ${DOMAINDN}
 rootDomainNamingContext: ${ROOTDN}
 configurationNamingContext: ${CONFIGDN}
@@ -9,10 +9,9 @@ schemaNamingContext: ${SCHEMADN}
 supportedLDAPVersion: 3
 dnsHostName: ${DNSNAME}
 ldapServiceName: ${DNSDOMAIN}:${NETBIOSNAME}$@${REALM}
-serverName: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+serverName: ${SERVERDN}
 domainFunctionality: 0
 forestFunctionality: 0
 domainControllerFunctionality: 2
 isSynchronized: FALSE
 vendorName: Samba Team (http://samba.org)
-vendorVersion: ${VERSION}
index 4e690376d7b9e1eb86d58f88e1a0a872f43b2964..4e8267a303ef274509ee05036180fe70a52bf034 100644 (file)
@@ -4,7 +4,7 @@
 dn: ${SCHEMADN}
 changetype: modify
 replace: fSMORoleOwner
-fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+fSMORoleOwner: CN=NTDS Settings,${SERVERDN}
 -
 replace: objectVersion
 objectVersion: 30
index a0cfa7eb23ae71ec8efaa4d56b8ab4333e007d9d..c91e2f4c19f11e766e86072593ababaae4d79111 100644 (file)
@@ -36,7 +36,7 @@ isCriticalSystemObject: TRUE
 sambaPassword:: ${DNSPASS_B64}
 showInAdvancedViewOnly: TRUE
 
-dn: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+dn: ${SERVERDN}
 objectClass: top
 objectClass: server
 cn: ${NETBIOSNAME}
@@ -44,7 +44,7 @@ systemFlags: 1375731712
 dNSHostName: ${DNSNAME}
 serverReference: CN=${NETBIOSNAME},OU=Domain Controllers,${DOMAINDN}
 
-dn: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN}
+dn: CN=NTDS Settings,${SERVERDN}
 objectClass: top
 objectClass: applicationSettings
 objectClass: nTDSDSA
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 75d4fcfcb4b30492bfbe44d191b662d7991e7952..19f37cef2df062a026914b199604bc08dd36de45 100755 (executable)
@@ -31,6 +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/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 e3d247cbc08cee893f23f2922fc61c79a3198e07..6cf33cf7c3ef7b18484954ec04f750ba3b6f62d0 100644 (file)
@@ -65,111 +65,16 @@ NTSTATUS smbsrv_send_oplock_break(void *p, struct ntvfs_handle *ntvfs, uint8_t l
 
 static void switch_message(int type, struct smbsrv_request *req);
 
-/****************************************************************************
-receive a SMB request header from the wire, forming a request_context
-from the result
-****************************************************************************/
-NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob)
-{
-       struct smbsrv_connection *smb_conn = talloc_get_type(private, struct smbsrv_connection);
-       struct smbsrv_request *req;
-       struct timeval cur_time = timeval_current();
-       uint8_t command;
-
-       smb_conn->statistics.last_request_time = cur_time;
-
-       /* see if its a special NBT packet */
-       if (CVAL(blob.data, 0) != 0) {
-               req = smbsrv_init_request(smb_conn);
-               NT_STATUS_HAVE_NO_MEMORY(req);
-
-               ZERO_STRUCT(req->in);
-
-               req->in.buffer = talloc_steal(req, blob.data);
-               req->in.size = blob.length;
-               req->request_time = cur_time;
-
-               smbsrv_reply_special(req);
-               return NT_STATUS_OK;
-       }
-
-       if ((NBT_HDR_SIZE + MIN_SMB_SIZE) > blob.length) {
-               DEBUG(2,("Invalid SMB packet: length %ld\n", (long)blob.length));
-               smbsrv_terminate_connection(smb_conn, "Invalid SMB packet");
-               return NT_STATUS_OK;
-       }
-
-       /* Make sure this is an SMB packet */
-       if (IVAL(blob.data, NBT_HDR_SIZE) != SMB_MAGIC) {
-               DEBUG(2,("Non-SMB packet of length %ld. Terminating connection\n",
-                        (long)blob.length));
-               smbsrv_terminate_connection(smb_conn, "Non-SMB packet");
-               return NT_STATUS_OK;
-       }
-
-       req = smbsrv_init_request(smb_conn);
-       NT_STATUS_HAVE_NO_MEMORY(req);
-
-       req->in.buffer = talloc_steal(req, blob.data);
-       req->in.size = blob.length;
-       req->request_time = cur_time;
-       req->chained_fnum = -1;
-       req->in.allocated = req->in.size;
-       req->in.hdr = req->in.buffer + NBT_HDR_SIZE;
-       req->in.vwv = req->in.hdr + HDR_VWV;
-       req->in.wct = CVAL(req->in.hdr, HDR_WCT);
-       if (req->in.vwv + VWV(req->in.wct) <= req->in.buffer + req->in.size) {
-               req->in.data = req->in.vwv + VWV(req->in.wct) + 2;
-               req->in.data_size = SVAL(req->in.vwv, VWV(req->in.wct));
-
-               /* the bcc length is only 16 bits, but some packets
-                  (such as SMBwriteX) can be much larger than 64k. We
-                  detect this by looking for a large non-chained NBT
-                  packet (at least 64k bigger than what is
-                  specified). If it is detected then the NBT size is
-                  used instead of the bcc size */
-               if (req->in.data_size + 0x10000 <= 
-                   req->in.size - PTR_DIFF(req->in.data, req->in.buffer) &&
-                   (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE)) {
-                       /* its an oversized packet! fun for all the family */
-                       req->in.data_size = req->in.size - PTR_DIFF(req->in.data,req->in.buffer);
-               }
-       }
-
-       if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct > req->in.size) {
-               DEBUG(2,("Invalid SMB word count %d\n", req->in.wct));
-               smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet");
-               return NT_STATUS_OK;
-       }
-       if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct + req->in.data_size > req->in.size) {
-               DEBUG(2,("Invalid SMB buffer length count %d\n", 
-                        (int)req->in.data_size));
-               smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet");
-               return NT_STATUS_OK;
-       }
-
-       req->flags2     = SVAL(req->in.hdr, HDR_FLG2);
-
-       /* fix the bufinfo */
-       smbsrv_setup_bufinfo(req);
-
-       if (!smbsrv_signing_check_incoming(req)) {
-               smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED);
-               return NT_STATUS_OK;
-       }
-
-       command = CVAL(req->in.hdr, HDR_COM);
-       switch_message(command, req);
-       return NT_STATUS_OK;
-}
-
 /*
   These flags determine some of the permissions required to do an operation 
 */
 #define NEED_SESS              (1<<0)
 #define NEED_TCON              (1<<1)
 #define SIGNING_NO_REPLY       (1<<2)
+/* does VWV(0) of the request hold chaining information */
+#define AND_X                  (1<<3)
+/* The 64Kb question: are requests > 64K valid? */
+#define LARGE_REQUEST  (1<<4)
 
 /* 
    define a list of possible SMB messages and their corresponding
@@ -180,6 +85,7 @@ static const struct smb_message_struct
 {
        const char *name;
        void (*fn)(struct smbsrv_request *);
+#define message_flags(type) smb_messages[(type) & 0xff].flags
        int flags;
 }
  smb_messages[256] = {
@@ -219,7 +125,7 @@ static const struct smb_message_struct
 /* 0x21 */ { NULL, NULL, 0 },
 /* 0x22 */ { "SMBsetattrE",    smbsrv_reply_setattrE,          NEED_SESS|NEED_TCON },
 /* 0x23 */ { "SMBgetattrE",    smbsrv_reply_getattrE,          NEED_SESS|NEED_TCON },
-/* 0x24 */ { "SMBlockingX",    smbsrv_reply_lockingX,          NEED_SESS|NEED_TCON },
+/* 0x24 */ { "SMBlockingX",    smbsrv_reply_lockingX,          NEED_SESS|NEED_TCON|AND_X },
 /* 0x25 */ { "SMBtrans",       smbsrv_reply_trans,             NEED_SESS|NEED_TCON },
 /* 0x26 */ { "SMBtranss",      smbsrv_reply_transs,            NEED_SESS|NEED_TCON },
 /* 0x27 */ { "SMBioctl",       smbsrv_reply_ioctl,             NEED_SESS|NEED_TCON },
@@ -228,9 +134,9 @@ static const struct smb_message_struct
 /* 0x2a */ { "SMBmove",                NULL,                           NEED_SESS|NEED_TCON },
 /* 0x2b */ { "SMBecho",                smbsrv_reply_echo,              0 },
 /* 0x2c */ { "SMBwriteclose",  smbsrv_reply_writeclose,        NEED_SESS|NEED_TCON },
-/* 0x2d */ { "SMBopenX",       smbsrv_reply_open_and_X,        NEED_SESS|NEED_TCON },
-/* 0x2e */ { "SMBreadX",       smbsrv_reply_read_and_X,        NEED_SESS|NEED_TCON },
-/* 0x2f */ { "SMBwriteX",      smbsrv_reply_write_and_X,       NEED_SESS|NEED_TCON},
+/* 0x2d */ { "SMBopenX",       smbsrv_reply_open_and_X,        NEED_SESS|NEED_TCON|AND_X },
+/* 0x2e */ { "SMBreadX",       smbsrv_reply_read_and_X,        NEED_SESS|NEED_TCON|AND_X },
+/* 0x2f */ { "SMBwriteX",      smbsrv_reply_write_and_X,       NEED_SESS|NEED_TCON|AND_X|LARGE_REQUEST},
 /* 0x30 */ { NULL, NULL, 0 },
 /* 0x31 */ { NULL, NULL, 0 },
 /* 0x32 */ { "SMBtrans2",      smbsrv_reply_trans2,            NEED_SESS|NEED_TCON },
@@ -298,9 +204,9 @@ static const struct smb_message_struct
 /* 0x70 */ { "SMBtcon",                smbsrv_reply_tcon,              NEED_SESS },
 /* 0x71 */ { "SMBtdis",                smbsrv_reply_tdis,              NEED_TCON },
 /* 0x72 */ { "SMBnegprot",     smbsrv_reply_negprot,           0 },
-/* 0x73 */ { "SMBsesssetupX",  smbsrv_reply_sesssetup,         0 },
-/* 0x74 */ { "SMBulogoffX",    smbsrv_reply_ulogoffX,          NEED_SESS }, /* ulogoff doesn't give a valid TID */
-/* 0x75 */ { "SMBtconX",       smbsrv_reply_tcon_and_X,        NEED_SESS },
+/* 0x73 */ { "SMBsesssetupX",  smbsrv_reply_sesssetup,         AND_X },
+/* 0x74 */ { "SMBulogoffX",    smbsrv_reply_ulogoffX,          NEED_SESS|AND_X }, /* ulogoff doesn't give a valid TID */
+/* 0x75 */ { "SMBtconX",       smbsrv_reply_tcon_and_X,        NEED_SESS|AND_X },
 /* 0x76 */ { NULL, NULL, 0 },
 /* 0x77 */ { NULL, NULL, 0 },
 /* 0x78 */ { NULL, NULL, 0 },
@@ -343,9 +249,9 @@ static const struct smb_message_struct
 /* 0x9d */ { NULL, NULL, 0 },
 /* 0x9e */ { NULL, NULL, 0 },
 /* 0x9f */ { NULL, NULL, 0 },
-/* 0xa0 */ { "SMBnttrans",     smbsrv_reply_nttrans,           NEED_SESS|NEED_TCON },
+/* 0xa0 */ { "SMBnttrans",     smbsrv_reply_nttrans,           NEED_SESS|NEED_TCON|LARGE_REQUEST },
 /* 0xa1 */ { "SMBnttranss",    smbsrv_reply_nttranss,          NEED_SESS|NEED_TCON },
-/* 0xa2 */ { "SMBntcreateX",   smbsrv_reply_ntcreate_and_X,    NEED_SESS|NEED_TCON },
+/* 0xa2 */ { "SMBntcreateX",   smbsrv_reply_ntcreate_and_X,    NEED_SESS|NEED_TCON|AND_X },
 /* 0xa3 */ { NULL, NULL, 0 },
 /* 0xa4 */ { "SMBntcancel",    smbsrv_reply_ntcancel,          NEED_SESS|NEED_TCON|SIGNING_NO_REPLY },
 /* 0xa5 */ { "SMBntrename",    smbsrv_reply_ntrename,          NEED_SESS|NEED_TCON },
@@ -441,6 +347,111 @@ static const struct smb_message_struct
 /* 0xff */ { NULL, NULL, 0 }
 };
 
+/****************************************************************************
+receive a SMB request header from the wire, forming a request_context
+from the result
+****************************************************************************/
+NTSTATUS smbsrv_recv_smb_request(void *private, DATA_BLOB blob)
+{
+       struct smbsrv_connection *smb_conn = talloc_get_type(private, struct smbsrv_connection);
+       struct smbsrv_request *req;
+       struct timeval cur_time = timeval_current();
+       uint8_t command;
+
+       smb_conn->statistics.last_request_time = cur_time;
+
+       /* see if its a special NBT packet */
+       if (CVAL(blob.data, 0) != 0) {
+               req = smbsrv_init_request(smb_conn);
+               NT_STATUS_HAVE_NO_MEMORY(req);
+
+               ZERO_STRUCT(req->in);
+
+               req->in.buffer = talloc_steal(req, blob.data);
+               req->in.size = blob.length;
+               req->request_time = cur_time;
+
+               smbsrv_reply_special(req);
+               return NT_STATUS_OK;
+       }
+
+       if ((NBT_HDR_SIZE + MIN_SMB_SIZE) > blob.length) {
+               DEBUG(2,("Invalid SMB packet: length %ld\n", (long)blob.length));
+               smbsrv_terminate_connection(smb_conn, "Invalid SMB packet");
+               return NT_STATUS_OK;
+       }
+
+       /* Make sure this is an SMB packet */
+       if (IVAL(blob.data, NBT_HDR_SIZE) != SMB_MAGIC) {
+               DEBUG(2,("Non-SMB packet of length %ld. Terminating connection\n",
+                        (long)blob.length));
+               smbsrv_terminate_connection(smb_conn, "Non-SMB packet");
+               return NT_STATUS_OK;
+       }
+
+       req = smbsrv_init_request(smb_conn);
+       NT_STATUS_HAVE_NO_MEMORY(req);
+
+       req->in.buffer = talloc_steal(req, blob.data);
+       req->in.size = blob.length;
+       req->request_time = cur_time;
+       req->chained_fnum = -1;
+       req->in.allocated = req->in.size;
+       req->in.hdr = req->in.buffer + NBT_HDR_SIZE;
+       req->in.vwv = req->in.hdr + HDR_VWV;
+       req->in.wct = CVAL(req->in.hdr, HDR_WCT);
+
+       command = CVAL(req->in.hdr, HDR_COM);
+
+       if (req->in.vwv + VWV(req->in.wct) <= req->in.buffer + req->in.size) {
+               req->in.data = req->in.vwv + VWV(req->in.wct) + 2;
+               req->in.data_size = SVAL(req->in.vwv, VWV(req->in.wct));
+
+               /* the bcc length is only 16 bits, but some packets
+                  (such as SMBwriteX) can be much larger than 64k. We
+                  detect this by looking for a large non-chained NBT
+                  packet (at least 64k bigger than what is
+                  specified). If it is detected then the NBT size is
+                  used instead of the bcc size */
+               if (req->in.data_size + 0x10000 <= 
+                   req->in.size - PTR_DIFF(req->in.data, req->in.buffer) &&
+                       ( message_flags(command) & LARGE_REQUEST) &&
+                       ( !(message_flags(command) & AND_X) ||
+                     (req->in.wct < 1 || SVAL(req->in.vwv, VWV(0)) == SMB_CHAIN_NONE) )
+                       ) {
+                       /* its an oversized packet! fun for all the family */
+                       req->in.data_size = req->in.size - PTR_DIFF(req->in.data,req->in.buffer);
+               }
+       }
+
+       if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct > req->in.size) {
+               DEBUG(2,("Invalid SMB word count %d\n", req->in.wct));
+               smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet");
+               return NT_STATUS_OK;
+       }
+       if (NBT_HDR_SIZE + MIN_SMB_SIZE + 2*req->in.wct + req->in.data_size > req->in.size) {
+               DEBUG(2,("Invalid SMB buffer length count %d\n", 
+                        (int)req->in.data_size));
+               smbsrv_terminate_connection(req->smb_conn, "Invalid SMB packet");
+               return NT_STATUS_OK;
+       }
+
+       req->flags2     = SVAL(req->in.hdr, HDR_FLG2);
+
+       /* fix the bufinfo */
+       smbsrv_setup_bufinfo(req);
+
+       if (!smbsrv_signing_check_incoming(req)) {
+               smbsrv_send_error(req, NT_STATUS_ACCESS_DENIED);
+               return NT_STATUS_OK;
+       }
+
+       command = CVAL(req->in.hdr, HDR_COM);
+       switch_message(command, req);
+       return NT_STATUS_OK;
+}
+
 /****************************************************************************
 return a string containing the function name of a SMB command
 ****************************************************************************/
index 87073517ddcdf799d2d230fff8ba8a1935ec708a..c7fa2d7d8abca1959b121b2c961d5c9bc20b90ef 100644 (file)
@@ -651,10 +651,10 @@ bool req_data_oob(struct request_bufinfo *bufinfo, const uint8_t *ptr, uint32_t
        }
        
        /* be careful with wraparound! */
-       if (ptr < bufinfo->data ||
-           ptr >= bufinfo->data + bufinfo->data_size ||
+       if ((uintptr_t)ptr < (uintptr_t)bufinfo->data ||
+           (uintptr_t)ptr >= (uintptr_t)bufinfo->data + bufinfo->data_size ||
            count > bufinfo->data_size ||
-           ptr + count > bufinfo->data + bufinfo->data_size) {
+           (uintptr_t)ptr + count > (uintptr_t)bufinfo->data + bufinfo->data_size) {
                return true;
        }
        return false;
index de2141b8086d2595f42f9c8a8826939e3cf4837e..2c4068bda5f0da029e5fb0c34b7b237914215d99 100644 (file)
@@ -70,7 +70,7 @@ static void sesssetup_old_send(struct auth_check_password_request *areq,
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* This references server_info into session_info */
-       status = auth_generate_session_info(req, req->smb_conn->lp_ctx, 
+       status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx, req->smb_conn->lp_ctx, 
                                            server_info, &session_info);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
@@ -166,7 +166,8 @@ static void sesssetup_nt1_send(struct auth_check_password_request *areq,
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
        /* This references server_info into session_info */
-       status = auth_generate_session_info(req, req->smb_conn->lp_ctx, 
+       status = auth_generate_session_info(req, req->smb_conn->connection->event.ctx, 
+                                           req->smb_conn->lp_ctx, 
                                            server_info, &session_info);
        if (!NT_STATUS_IS_OK(status)) goto failed;
 
index 0e3df56b426c5ffb7adb8975b8cfe6a82a01114d..b6b35d3d892bcf2e8735c31980ad00a64c1e55f2 100644 (file)
@@ -79,6 +79,7 @@ void smb2srv_create_recv(struct smb2srv_request *req)
        SMB2SRV_CHECK(smb2_pull_o32s32_blob(&req->in, io, req->in.body+0x30, &blob));
        /* TODO: parse the blob */
        ZERO_STRUCT(io->smb2.in.eas);
+       ZERO_STRUCT(io->smb2.in.blobs);
 
        /* the VFS backend does not yet handle NULL filenames */
        if (io->smb2.in.fname == NULL) {
@@ -167,7 +168,8 @@ static void smb2srv_read_send(struct ntvfs_request *ntvfs)
 
        /* TODO: avoid the memcpy */
        SMB2SRV_CHECK(smb2_push_o16s32_blob(&req->out, 0x02, io->smb2.out.data));
-       SBVAL(req->out.body,    0x08,   io->smb2.out.unknown1);
+       SIVAL(req->out.body,    0x08,   io->smb2.out.remaining);
+       SIVAL(req->out.body,    0x0C,   io->smb2.out.reserved);
 
        smb2srv_send_reply(req);
 }
@@ -185,8 +187,11 @@ void smb2srv_read_recv(struct smb2srv_request *req)
        io->smb2.in.length              = IVAL(req->in.body, 0x04);
        io->smb2.in.offset              = BVAL(req->in.body, 0x08);
        io->smb2.in.file.ntvfs          = smb2srv_pull_handle(req, req->in.body, 0x10);
-       io->smb2.in.unknown1            = BVAL(req->in.body, 0x20);
-       io->smb2.in.unknown2            = BVAL(req->in.body, 0x28);
+       io->smb2.in.min_count           = IVAL(req->in.body, 0x20);
+       io->smb2.in.channel             = IVAL(req->in.body, 0x24);
+       io->smb2.in.remaining           = IVAL(req->in.body, 0x28);
+       io->smb2.in.channel_offset      = SVAL(req->in.body, 0x2C);
+       io->smb2.in.channel_length      = SVAL(req->in.body, 0x2E);
 
        SMB2SRV_CHECK_FILE_HANDLE(io->smb2.in.file.ntvfs);
 
@@ -405,7 +410,36 @@ void smb2srv_notify_recv(struct smb2srv_request *req)
        SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_notify(req->ntvfs, io));
 }
 
+static void smb2srv_break_send(struct ntvfs_request *ntvfs)
+{
+       struct smb2srv_request *req;
+       union smb_lock *io;
+
+       SMB2SRV_CHECK_ASYNC_STATUS_ERR(io, union smb_lock);
+       SMB2SRV_CHECK(smb2srv_setup_reply(req, 0x18, false, 0));
+
+       SCVAL(req->out.body,    0x02,   io->smb2_break.out.oplock_level);
+       SCVAL(req->out.body,    0x03,   io->smb2_break.out.reserved);
+       SIVAL(req->out.body,    0x04,   io->smb2_break.out.reserved2);
+       smb2srv_push_handle(req->out.body, 0x08,io->smb2_break.out.file.ntvfs);
+
+       smb2srv_send_reply(req);
+}
+
 void smb2srv_break_recv(struct smb2srv_request *req)
 {
-       smb2srv_send_error(req, NT_STATUS_NOT_IMPLEMENTED);
+       union smb_lock *io;
+
+       SMB2SRV_CHECK_BODY_SIZE(req, 0x18, false);
+       SMB2SRV_TALLOC_IO_PTR(io, union smb_lock);
+       SMB2SRV_SETUP_NTVFS_REQUEST(smb2srv_break_send, NTVFS_ASYNC_STATE_MAY_ASYNC);
+
+       io->smb2_break.level            = RAW_LOCK_SMB2_BREAK;
+       io->smb2_break.in.oplock_level  = CVAL(req->in.body, 0x02);
+       io->smb2_break.in.reserved      = CVAL(req->in.body, 0x03);
+       io->smb2_break.in.reserved2     = IVAL(req->in.body, 0x04);
+       io->smb2_break.in.file.ntvfs    = smb2srv_pull_handle(req, req->in.body, 0x08);
+
+       SMB2SRV_CHECK_FILE_HANDLE(io->smb2_break.in.file.ntvfs);
+       SMB2SRV_CALL_NTVFS_BACKEND(ntvfs_lock(req->ntvfs, io));
 }
index e7352f7c423972410fa728d7bdd44c64ce6ac8cb..4479ae2da1d7ff9d234acbc3ffed6118193980f2 100644 (file)
@@ -114,9 +114,12 @@ static NTSTATUS smb2srv_negprot_backend(struct smb2srv_request *req, struct smb2
        io->out.security_mode      = 0; /* no signing yet */
        io->out.dialect_revision   = SMB2_DIALECT_REVISION;
        io->out.capabilities       = 0;
-       io->out.max_transact_size  = 0x10000;
-       io->out.max_read_size      = 0x10000;
-       io->out.max_write_size     = 0x10000;
+       io->out.max_transact_size  = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, 
+                                                  "smb2", "max transaction size", 0x10000);
+       io->out.max_read_size      = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, 
+                                                  "smb2", "max read size", 0x10000);
+       io->out.max_write_size     = lp_parm_ulong(req->smb_conn->lp_ctx, NULL, 
+                                                  "smb2", "max write size", 0x10000);
        io->out.system_time        = timeval_to_nttime(&current_time);
        io->out.server_start_time  = timeval_to_nttime(&boot_time);
        io->out.reserved2          = 0;
index 4f8e628f7414762761c1e10b2cac04d8d4a50c7b..367557dbb7422ff75b556f827ff2a1380b064a2e 100644 (file)
@@ -157,6 +157,7 @@ static void smbsrv_accept(struct stream_connection *conn)
        smbsrv_management_init(smb_conn);
 
        if (!NT_STATUS_IS_OK(share_get_context_by_name(smb_conn, lp_share_backend(smb_conn->lp_ctx), 
+                                                      smb_conn->connection->event.ctx,
                                                       smb_conn->lp_ctx, &(smb_conn->share_context)))) {
                smbsrv_terminate_connection(smb_conn, "share_init failed!");
                return;
@@ -206,7 +207,7 @@ static void smbsrv_preopen_ldb(struct task_server *task)
        /* yes, this looks strange. It is a hack to preload the
           schema. I'd like to share most of the ldb context with the
           child too. That will come later */
-       talloc_free(samdb_connect(task, task->lp_ctx, NULL));
+       talloc_free(samdb_connect(task, task->event_ctx, task->lp_ctx, NULL));
 }
 
 /*
index ade41614c24329f74ce16c14798246f8e7e143da..a442b0102527c086d15d5fb5867e2d207c562244 100644 (file)
@@ -11,7 +11,6 @@ lib/charset/charset.h: lib/charset/charset_proto.h
 include/includes.h: \
                include/config.h \
                lib/charset/charset.h \
-               param/proto.h \
                librpc/gen_ndr/misc.h
 
 heimdal_basics: \
index 9366de986a4918fd9fae488a925eb68963c828fd..739a048d29a790a8ce5c50b6c168e47fba0fd493 100644 (file)
@@ -33,7 +33,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
        TALLOC_CTX *mem_ctx = tctx;
 
        torture_assert_ntstatus_ok(tctx, 
-               gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx),
+               gensec_client_start(mem_ctx, &gensec_security,
+                                   tctx->ev, tctx->lp_ctx),
                "gensec client start");
 
        gensec_set_credentials(gensec_security, cmdline_credentials);
@@ -69,7 +70,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
 
        torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
 
-       torture_assert(tctx, 0 == memcmp(sig.data, expected_sig.data, sig.length),
+       torture_assert_mem_equal(tctx, sig.data, expected_sig.data, sig.length,
                                   "data mismatch");
 
        torture_assert_ntstatus_equal(tctx, 
@@ -87,7 +88,8 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
        talloc_free(gensec_security);
 
        torture_assert_ntstatus_ok(tctx, 
-               gensec_client_start(mem_ctx, &gensec_security, NULL, tctx->lp_ctx),
+               gensec_client_start(mem_ctx, &gensec_security,
+                                   tctx->ev, tctx->lp_ctx),
                "Failed to start GENSEC for NTLMSSP");
 
        gensec_set_credentials(gensec_security, cmdline_credentials);
@@ -123,7 +125,7 @@ static bool torture_ntlmssp_self_check(struct torture_context *tctx)
 
        torture_assert_int_equal(tctx, sig.length, expected_sig.length, "Wrong sig length");
 
-       torture_assert(tctx,  0 == memcmp(sig.data+8, expected_sig.data+8, sig.length-8),
+       torture_assert_mem_equal(tctx, sig.data+8, expected_sig.data+8, sig.length-8,
                                   "data mismatch");
 
        torture_assert_ntstatus_equal(tctx, 
index ac71d14116b1bac0be95440572cf24229ef72386..966d436935ba57fe1ed333cb6b1bc97ff14dc665 100644 (file)
@@ -55,7 +55,8 @@ static struct smbcli_state *open_nbt_connection(struct torture_context *tctx)
 
        lp_smbcli_options(tctx->lp_ctx, &options);
 
-       if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), lp_resolve_context(tctx->lp_ctx), &options)) {
+       if (!smbcli_socket_connect(cli, host, lp_smb_ports(tctx->lp_ctx), tctx->ev,
+                                  lp_resolve_context(tctx->lp_ctx), &options)) {
                torture_comment(tctx, "Failed to connect with %s\n", host);
                goto failed;
        }
@@ -590,7 +591,7 @@ static bool rw_torture2(struct torture_context *tctx,
                        break;
                }
 
-               torture_assert(tctx, memcmp(buf_rd, buf, buf_size) == 0
+               torture_assert_mem_equal(tctx, buf_rd, buf, buf_size
                        "read/write compare failed\n");
        }
 
index e3d63c09ecc74f57a723c37d994579ddbf83c8c5..84adfef61adba42bb7801e0e5c7ec028f328e2fb 100644 (file)
@@ -40,7 +40,12 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl
        int fnum1 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -68,7 +73,7 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl
 
        /* 3 second delay to ensure we get past any 2 second time
           granularity (older systems may have that) */
-       sleep(3);
+       msleep(3 * msec);
 
        written =  smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
 
@@ -78,9 +83,9 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl
                return false;
        }
 
-       t = time(NULL);
-
-       while (time(NULL) < t+120) {
+       start = timeval_current();
+       end = timeval_add(&start, (120*sec), 0);
+       while (!timeval_expired(&end)) {
                status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
 
                if (!NT_STATUS_IS_OK(status)) {
@@ -91,20 +96,22 @@ static bool test_delayed_write_update(struct torture_context *tctx, struct smbcl
                torture_comment(tctx, "write time %s\n", 
                       nt_time_string(tctx, finfo2.basic_info.out.write_time));
                if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) {
-                       int diff = time(NULL) - t;
-                       if (diff < 2) {
-                               torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                                               diff);
+                       double diff = timeval_elapsed(&start);
+                       if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */
+                               torture_comment(tctx, "Server updated write_time after %.2f seconds"
+                                               "(1 sec == %.2f)(wrong!)\n",
+                                               diff, sec);
                                ret = false;
                                break;
                        }
 
-                       torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n",
-                                       diff);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds"
+                                       "(1 sec == %.2f)(correct)\n",
+                                       diff, sec);
                        break;
                }
-               sleep(1);
                fflush(stdout);
+               msleep(1 * msec);
        }
        
        if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -135,7 +142,12 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
        int fnum2 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
        union smb_flush flsh;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
@@ -164,7 +176,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
 
        /* 3 second delay to ensure we get past any 2 second time
           granularity (older systems may have that) */
-       sleep(3);
+       msleep(3 * msec);
 
        {
                /* Try using setfileinfo instead of write to update write time. */
@@ -251,12 +263,11 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                return false;
        }
 
-       t = time(NULL);
-
        /* Once the time was set using setfileinfo then it stays set - writes
           don't have any effect. But make sure. */
-
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, (15*sec), 0);
+       while (!timeval_expired(&end)) {
                status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
 
                if (!NT_STATUS_IS_OK(status)) {
@@ -267,13 +278,15 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                torture_comment(tctx, "write time %s\n", 
                       nt_time_string(tctx, finfo2.basic_info.out.write_time));
                if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds"
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               sleep(1);
                fflush(stdout);
+               msleep(1 * msec);
        }
        
        if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -339,12 +352,11 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                ret = false;
        }
 
-       t = time(NULL);
-
        /* Once the time was set using setfileinfo then it stays set - writes
           don't have any effect. But make sure. */
-
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, (15*sec), 0);
+       while (!timeval_expired(&end)) {
                status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
 
                if (!NT_STATUS_IS_OK(status)) {
@@ -355,13 +367,15 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                torture_comment(tctx, "write time %s\n", 
                       nt_time_string(tctx, finfo2.basic_info.out.write_time));
                if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               sleep(1);
                fflush(stdout);
+               msleep(1 * msec);
        }
        
        if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -393,7 +407,7 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
        torture_comment(tctx, "Second open initial write time %s\n", 
               nt_time_string(tctx, finfo1.basic_info.out.write_time));
 
-       sleep(10);
+       msleep(10 * msec);
        torture_comment(tctx, "Doing a 10 byte write to extend the file to see if this changes the last write time.\n");
 
        written =  smbcli_write(cli->tree, fnum1, 0, "0123456789", 31, 10);
@@ -420,11 +434,10 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                ret = false;
        }
 
-       t = time(NULL);
-
        /* Now the write time should be updated again */
-
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, (15*sec), 0);
+       while (!timeval_expired(&end)) {
                status = smb_raw_fileinfo(cli->tree, tctx, &finfo2);
 
                if (!NT_STATUS_IS_OK(status)) {
@@ -435,20 +448,22 @@ static bool test_delayed_write_update2(struct torture_context *tctx, struct smbc
                torture_comment(tctx, "write time %s\n", 
                       nt_time_string(tctx, finfo2.basic_info.out.write_time));
                if (finfo1.basic_info.out.write_time != finfo2.basic_info.out.write_time) {
-                       int diff = time(NULL) - t;
-                       if (diff < 2) {
-                               torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                                               diff);
+                       double diff = timeval_elapsed(&start);
+                       if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */
+                               torture_comment(tctx, "Server updated write_time after %.2f seconds"
+                                               "(1sec == %.2f) (wrong!)\n",
+                                               diff, sec);
                                ret = false;
                                break;
                        }
 
-                       torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n",
-                                       diff);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds"
+                                       "(1sec == %.2f) (correct)\n",
+                                       diff, sec);
                        break;
                }
-               sleep(1);
                fflush(stdout);
+               msleep(1*msec);
        }
        
        if (finfo1.basic_info.out.write_time == finfo2.basic_info.out.write_time) {
@@ -490,6 +505,10 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s
        int fnum2;
        bool ret = true;
        ssize_t written;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -513,7 +532,7 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s
                goto done;
        }
 
-       msleep(1000);
+       msleep(1 * msec);
 
        written =  smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
 
@@ -613,12 +632,23 @@ static bool test_finfo_after_write(struct torture_context *tctx, struct smbcli_s
 }
 
 #define COMPARE_WRITE_TIME_CMP(given, correct, cmp) do { \
+       uint64_t r = 10*1000*1000; \
        NTTIME g = (given).basic_info.out.write_time; \
+       NTTIME gr = (g / r) * r; \
        NTTIME c = (correct).basic_info.out.write_time; \
-       if (g cmp c) { \
-               torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s %s (%s)%s", \
-                               #given, nt_time_string(tctx, g), \
-                               #cmp, #correct, nt_time_string(tctx, c)); \
+       NTTIME cr = (c / r) * r; \
+       bool strict = torture_setting_bool(tctx, "strict mode", false); \
+       bool err = false; \
+       if (strict && (g cmp c)) { \
+               err = true; \
+       } else if (gr cmp cr) { \
+               /* handle filesystem without high resolution timestamps */ \
+               err = true; \
+       } \
+       if (err) { \
+               torture_result(tctx, TORTURE_FAIL, __location__": wrong write_time (%s)%s(%llu) %s (%s)%s(%llu)", \
+                               #given, nt_time_string(tctx, g), (unsigned long long)g, \
+                               #cmp, #correct, nt_time_string(tctx, c), (unsigned long long)c); \
                ret = false; \
                goto done; \
        } \
@@ -724,7 +754,12 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
        int fnum1 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -760,8 +795,9 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
         * calcuated from the first write
         * (but expect upto 5 seconds extra time for a busy server)
         */
-       t = time(NULL);
-       while (time(NULL) < t+7) {
+       start = timeval_current();
+       end = timeval_add(&start, 7 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* do a write */
                torture_comment(tctx, "Do a write on the file handle\n");
                written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -774,26 +810,29 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
                GET_INFO_FILE(finfo1);
 
                if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) {
-                       int diff = time(NULL) - t;
-                       if (diff < 2) {
-                               torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                                               diff);
+                       double diff = timeval_elapsed(&start);
+                       if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */
+                               torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                               "(1sec == %.2f) (wrong!)\n",
+                                               diff, sec);
                                ret = false;
                                break;
                        }
 
-                       torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n",
-                                       diff);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (correct)\n",
+                                       diff, sec);
                        break;
                }
-               msleep(500);
+               msleep(0.5 * msec);
        }
 
        GET_INFO_BOTH(finfo1,pinfo1);
 
        /* sure any further write doesn't update the write time */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* do a write */
                torture_comment(tctx, "Do a write on the file handle\n");
                written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -806,12 +845,14 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
                GET_INFO_BOTH(finfo2,pinfo2);
 
                if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo2,pinfo2);
@@ -821,7 +862,7 @@ static bool test_delayed_write_update3(struct torture_context *tctx,
        }
 
        /* sleep */
-       msleep(5000);
+       msleep(5 * msec);
 
        GET_INFO_BOTH(finfo3,pinfo3);
        COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -860,7 +901,12 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
        int fnum1 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -892,7 +938,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
        GET_INFO_BOTH(finfo0,pinfo0);
 
        /* sleep a bit */
-       msleep(5000);
+       msleep(5 * msec);
 
        /* do a write */
        torture_comment(tctx, "Do a write on the file handle\n");
@@ -911,32 +957,36 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
         * calcuated from the first write
         * (but expect upto 3 seconds extra time for a busy server)
         */
-       t = time(NULL);
-       while (time(NULL) < t+5) {
+       start = timeval_current();
+       end = timeval_add(&start, 5 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* get the times after the first write */
                GET_INFO_FILE(finfo1);
 
                if (finfo1.basic_info.out.write_time > finfo0.basic_info.out.write_time) {
-                       int diff = time(NULL) - t;
-                       if (diff < 2) {
-                               torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                                               diff);
+                       double diff = timeval_elapsed(&start);
+                       if (diff < (2 * sec * 0.75)) { /* 0.75 to cope with vmware timing */
+                               torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                               "(1sec == %.2f) (wrong!)\n",
+                                               diff, sec);
                                ret = false;
                                break;
                        }
 
-                       torture_comment(tctx, "Server updated write_time after %d seconds (correct)\n",
-                                       diff);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (correct)\n",
+                                       diff, sec);
                        break;
                }
-               msleep(500);
+               msleep(0.5 * msec);
        }
 
        GET_INFO_BOTH(finfo1,pinfo1);
 
        /* sure any further write doesn't update the write time */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* do a write */
                torture_comment(tctx, "Do a write on the file handle\n");
                written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -949,12 +999,14 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
                GET_INFO_BOTH(finfo2,pinfo2);
 
                if (finfo2.basic_info.out.write_time > finfo1.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo2,pinfo2);
@@ -964,7 +1016,7 @@ static bool test_delayed_write_update4(struct torture_context *tctx,
        }
 
        /* sleep */
-       msleep(5000);
+       msleep(5 * msec);
 
        GET_INFO_BOTH(finfo3,pinfo3);
        COMPARE_WRITE_TIME_EQUAL(finfo3, finfo2);
@@ -1003,7 +1055,12 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
        int fnum1 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
                return false;
@@ -1059,19 +1116,22 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
        COMPARE_WRITE_TIME_LESS(finfo2, finfo1);
 
        /* make sure the 2 second delay from the first write are canceled */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
 
                /* get the times after the first write */
                GET_INFO_BOTH(finfo3,pinfo3);
 
                if (finfo3.basic_info.out.write_time > finfo2.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo3,pinfo3);
@@ -1081,8 +1141,9 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
        }
 
        /* sure any further write doesn't update the write time */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* do a write */
                torture_comment(tctx, "Do a write on the file handle\n");
                written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -1095,12 +1156,14 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
                GET_INFO_BOTH(finfo4,pinfo4);
 
                if (finfo4.basic_info.out.write_time > finfo3.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo4,pinfo4);
@@ -1110,7 +1173,7 @@ static bool test_delayed_write_update5(struct torture_context *tctx,
        }
 
        /* sleep */
-       msleep(5000);
+       msleep(5 * msec);
 
        GET_INFO_BOTH(finfo5,pinfo5);
        COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4);
@@ -1149,7 +1212,12 @@ static bool test_delayed_write_update6(struct torture_context *tctx,
        int fnum2 = -1;
        bool ret = true;
        ssize_t written;
-       time_t t;
+       struct timeval start;
+       struct timeval end;
+       int used_delay = torture_setting_int(tctx, "writetimeupdatedelay", 2000000);
+       int normal_delay = 2000000;
+       double sec = ((double)used_delay) / ((double)normal_delay);
+       int msec = 1000 * sec;
        bool first = true;
 
        if (!torture_setup_dir(cli, BASEDIR)) {
@@ -1217,19 +1285,22 @@ again:
        COMPARE_WRITE_TIME_LESS(finfo2, finfo1);
 
        /* make sure the 2 second delay from the first write are canceled */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
 
                /* get the times after the first write */
                GET_INFO_BOTH(finfo3,pinfo3);
 
                if (finfo3.basic_info.out.write_time > finfo2.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo3,pinfo3);
@@ -1239,8 +1310,9 @@ again:
        }
 
        /* sure any further write doesn't update the write time */
-       t = time(NULL);
-       while (time(NULL) < t+15) {
+       start = timeval_current();
+       end = timeval_add(&start, 15 * sec, 0);
+       while (!timeval_expired(&end)) {
                /* do a write */
                torture_comment(tctx, "Do a write on the file handle\n");
                written = smbcli_write(cli->tree, fnum1, 0, "x", 0, 1);
@@ -1253,12 +1325,14 @@ again:
                GET_INFO_BOTH(finfo4,pinfo4);
 
                if (finfo4.basic_info.out.write_time > finfo3.basic_info.out.write_time) {
-                       torture_comment(tctx, "Server updated write_time after %d seconds (wrong!)\n",
-                              (int)(time(NULL) - t));
+                       double diff = timeval_elapsed(&start);
+                       torture_comment(tctx, "Server updated write_time after %.2f seconds "
+                                       "(1sec == %.2f) (wrong!)\n",
+                                       diff, sec);
                        ret = false;
                        break;
                }
-               msleep(2000);
+               msleep(2 * msec);
        }
 
        GET_INFO_BOTH(finfo4,pinfo4);
@@ -1268,7 +1342,7 @@ again:
        }
 
        /* sleep */
-       msleep(5000);
+       msleep(5 * msec);
 
        GET_INFO_BOTH(finfo5,pinfo5);
        COMPARE_WRITE_TIME_EQUAL(finfo5, finfo4);
index 7209838d33a26e46aa03a752a47e9556c94d88e8..1565797609d13e26cdb5d6cc158a57a3c1376fb3 100644 (file)
@@ -13,10 +13,10 @@ torture_OBJ_FILES = $(addprefix torture/, torture.o ui.o)
 PUBLIC_HEADERS += torture/torture.h torture/ui.h
 
 [SUBSYSTEM::TORTURE_UTIL]
-PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls
+PRIVATE_DEPENDENCIES = LIBCLI_RAW LIBPYTHON smbcalls PROVISION
 PUBLIC_DEPENDENCIES = POPT_CREDENTIALS
 
-TORTURE_UTIL_OBJ_FILES = $(addprefix torture/, util_smb.o util_provision.o)
+TORTURE_UTIL_OBJ_FILES = $(addprefix torture/, util_smb.o)
 
 #################################
 # Start SUBSYSTEM TORTURE_BASIC
@@ -86,6 +86,7 @@ TORTURE_RAW_OBJ_FILES = $(addprefix torture/raw/, \
                lock.o \
                pingpong.o \
                lockbench.o \
+               lookuprate.o \
                openbench.o \
                rename.o \
                eas.o \
@@ -313,31 +314,34 @@ locktest_OBJ_FILES = torture/locktest.o
 
 MANPAGES += torture/man/locktest.1
 
-COV_TARGET = test
+GCOV=0
+
+ifeq ($(MAKECMDGOALS),gcov)
+GCOV=1
+endif
+
+ifeq ($(MAKECMDGOALS),lcov)
+GCOV=1
+endif
+
+ifeq ($(MAKECMDGOALS),testcov-html)
+GCOV=1
+endif
 
-COV_VARS = \
-       CFLAGS="$(CFLAGS) --coverage" \
-       LDFLAGS="$(LDFLAGS) --coverage"
+ifeq ($(GCOV),1)
+CFLAGS += --coverage
+LDFLAGS += --coverage
+endif
 
-test_cov:
-       -$(MAKE) $(COV_TARGET) $(COV_VARS)
+COV_TARGET = test
 
-gcov: test_cov
+gcov: test
        for I in $(sort $(dir $(ALL_OBJS))); \
                do $(GCOV) -p -o $$I $$I/*.c; \
        done
 
-lcov-split: 
-       rm -f samba.info
-       @$(MAKE) $(COV_TARGET) $(COV_VARS) \
-               TEST_OPTIONS="--analyse-cmd=\"lcov --base-directory `pwd` --directory . --capture --output-file samba.info -t\""
-       -rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
-       -rm lib/policy/*/{lex,parse}.{gcda,gcno}
-       genhtml -o coverage samba.info
-
-lcov: test_cov
+lcov: test
        -rm heimdal/lib/*/{lex,parse}.{gcda,gcno}
-       -rm lib/policy/*/{lex,parse}.{gcda,gcno}
        lcov --base-directory `pwd` --directory . --capture --output-file samba.info
        genhtml -o coverage samba.info
 
index d5fc855f175fbd32cc9fb4b10349351b59e8d012..ae18fe809c93e55753b52ad8ac2a34408a3c8609 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "lib/cmdline/popt_common.h"
+#include "lib/events/events.h"
 #include "system/time.h"
 #include "system/filesys.h"
 #include "libcli/raw/request.h"
 
 /* global options */
 static struct gentest_options {
-       bool showall;
-       bool analyze;
-       bool analyze_always;
-       bool analyze_continuous;
+       int showall;
+       int analyze;
+       int analyze_always;
+       int analyze_continuous;
        uint_t max_open_handles;
        uint_t seed;
        uint_t numops;
-       bool use_oplocks;
+       int use_oplocks;
        char **ignore_patterns;
        const char *seeds_file;
-       bool use_preset_seeds;
-       bool fast_reconnect;
+       int use_preset_seeds;
+       int fast_reconnect;
 } options;
 
 /* mapping between open handles on the server and local handles */
@@ -154,7 +155,8 @@ static bool connect_servers_fast(void)
 /***************************************************** 
 connect to the servers
 *******************************************************/
-static bool connect_servers(struct loadparm_context *lp_ctx)
+static bool connect_servers(struct event_context *ev,
+                           struct loadparm_context *lp_ctx)
 {
        int i, j;
 
@@ -193,7 +195,7 @@ static bool connect_servers(struct loadparm_context *lp_ctx)
                                                        servers[i].share_name, NULL, 
                                                        servers[i].credentials, 
                                                        lp_resolve_context(lp_ctx), 
-                                                       NULL, &smb_options);
+                                                       ev, &smb_options);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Failed to connect to \\\\%s\\%s - %s\n",
                                       servers[i].server_name, servers[i].share_name,
@@ -1937,11 +1939,11 @@ static struct {
   run the test with the current set of op_parms parameters
   return the number of operations that completed successfully
 */
-static int run_test(struct loadparm_context *lp_ctx)
+static int run_test(struct event_context *ev, struct loadparm_context *lp_ctx)
 {
        int op, i;
 
-       if (!connect_servers(lp_ctx)) {
+       if (!connect_servers(ev, lp_ctx)) {
                printf("Failed to connect to servers\n");
                exit(1);
        }
@@ -2018,7 +2020,8 @@ static int run_test(struct loadparm_context *lp_ctx)
    perform a backtracking analysis of the minimal set of operations
    to generate an error
 */
-static void backtrack_analyze(struct loadparm_context *lp_ctx)
+static void backtrack_analyze(struct event_context *ev,
+                             struct loadparm_context *lp_ctx)
 {
        int chunk, ret;
 
@@ -2039,7 +2042,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
                        }
                        printf("Testing %d ops with %d-%d disabled\n", 
                               options.numops, base, max-1);
-                       ret = run_test(lp_ctx);
+                       ret = run_test(ev, lp_ctx);
                        printf("Completed %d of %d ops\n", ret, options.numops);
                        for (i=base;i<max; i++) {
                                op_parms[i].disabled = false;
@@ -2071,7 +2074,7 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
        } while (chunk > 0);
 
        printf("Reduced to %d ops\n", options.numops);
-       ret = run_test(lp_ctx);
+       ret = run_test(ev, lp_ctx);
        if (ret != options.numops - 1) {
                printf("Inconsistent result? ret=%d numops=%d\n", ret, options.numops);
        }
@@ -2080,7 +2083,8 @@ static void backtrack_analyze(struct loadparm_context *lp_ctx)
 /* 
    start the main gentest process
 */
-static bool start_gentest(struct loadparm_context *lp_ctx)
+static bool start_gentest(struct event_context *ev,
+                         struct loadparm_context *lp_ctx)
 {
        int op;
        int ret;
@@ -2116,15 +2120,15 @@ static bool start_gentest(struct loadparm_context *lp_ctx)
                }
        }
 
-       ret = run_test(lp_ctx);
+       ret = run_test(ev, lp_ctx);
 
        if (ret != options.numops && options.analyze) {
                options.numops = ret+1;
-               backtrack_analyze(lp_ctx);
+               backtrack_analyze(ev, lp_ctx);
        } else if (options.analyze_always) {
-               backtrack_analyze(lp_ctx);
+               backtrack_analyze(ev, lp_ctx);
        } else if (options.analyze_continuous) {
-               while (run_test(lp_ctx) == options.numops) ;
+               while (run_test(ev, lp_ctx) == options.numops) ;
        }
 
        return ret == options.numops;
@@ -2171,6 +2175,7 @@ static bool split_unc_name(const char *unc, char **server, char **share)
        int i, username_count=0;
        bool ret;
        char *ignore_file=NULL;
+       struct event_context *ev;
        struct loadparm_context *lp_ctx;
        poptContext pc;
        int argc_new;
@@ -2278,9 +2283,11 @@ static bool split_unc_name(const char *unc, char **server, char **share)
 
        printf("seed=%u\n", options.seed);
 
+       ev = event_context_init(talloc_autofree_context());
+
        gensec_init(lp_ctx);
 
-       ret = start_gentest(lp_ctx);
+       ret = start_gentest(ev, lp_ctx);
 
        if (ret) {
                printf("gentest completed - no errors\n");
index dbe9d2f9a44a044855b321300b86f442b62e35cc..ca4d9b770540fbda5d777c41b35c5e1c8c6f0c1d 100644 (file)
 */
 static bool test_cldap_netlogon(struct torture_context *tctx, const char *dest)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct cldap_socket *cldap;
        NTSTATUS status;
        struct cldap_netlogon search, empty_search;
        union nbt_cldap_netlogon n1;
        struct GUID guid;
        int i;
 
+       cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
+
        ZERO_STRUCT(search);
        search.in.dest_address = dest;
        search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
@@ -244,13 +246,15 @@ static void cldap_dump_results(struct cldap_search *search)
 */
 static bool test_cldap_generic(struct torture_context *tctx, const char *dest)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct cldap_socket *cldap;
        NTSTATUS status;
        struct cldap_search search;
        const char *attrs1[] = { "currentTime", "highestCommittedUSN", NULL };
        const char *attrs2[] = { "currentTime", "highestCommittedUSN", "netlogon", NULL };
        const char *attrs3[] = { "netlogon", NULL };
 
+       cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
+
        ZERO_STRUCT(search);
        search.in.dest_address = dest;
        search.in.dest_port = lp_cldap_port(tctx->lp_ctx);
index 83e505e164ee0210b607d0304f17c6fe95e757ac..df2a5b0551a47fe07939fba08dd54a3afd3d24d1 100644 (file)
@@ -51,7 +51,7 @@ static void request_handler(struct cldap_request *req)
 */
 static bool bench_cldap(struct torture_context *tctx, const char *address)
 {
-       struct cldap_socket *cldap = cldap_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct cldap_socket *cldap;
        int num_sent=0;
        struct timeval tv = timeval_current();
        bool ret = true;
@@ -59,6 +59,8 @@ static bool bench_cldap(struct torture_context *tctx, const char *address)
        struct cldap_netlogon search;
        struct bench_state *state;
 
+       cldap = cldap_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
+
        state = talloc_zero(tctx, struct bench_state);
 
        ZERO_STRUCT(search);
@@ -116,7 +118,7 @@ bool torture_bench_cldap(struct torture_context *torture)
        make_nbt_name_server(&name, torture_setting_string(torture, "host", NULL));
 
        /* do an initial name resolution to find its IP */
-       status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, event_context_find(torture));
+       status = resolve_name(lp_resolve_context(torture->lp_ctx), &name, torture, &address, torture->ev);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to resolve %s - %s\n",
                       name.name, nt_errstr(status));
index 65b02ed5e8e1fea277b73d546fbdc4eee68bac87..5913163822a01fb6409fd7242987ff21e590b757 100644 (file)
@@ -65,7 +65,7 @@ NTSTATUS torture_ldap_connection(struct torture_context *tctx,
                return NT_STATUS_INVALID_PARAMETER;
        }
 
-       *conn = ldap4_new_connection(tctx, tctx->lp_ctx, NULL);
+       *conn = ldap4_new_connection(tctx, tctx->lp_ctx, tctx->ev);
 
        status = ldap_connect(*conn, url);
        if (!NT_STATUS_IS_OK(status)) {
index 4cfce11eb5b0cacff204075a7d86685766c69d11..8437e7f79db13af5652b04815df1e48fa7b8eae8 100644 (file)
@@ -376,7 +376,7 @@ bool torture_ldap_schema(struct torture_context *torture)
 
        url = talloc_asprintf(torture, "ldap://%s/", host);
 
-       ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+       ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
                               NULL,
                               cmdline_credentials,
                               0, NULL);
index cec330b2f6138b3ff9ad797642a5b73685ccc318..87b7e09e136276d2e13ef49ea5d2f20ba01bbfc8 100644 (file)
@@ -162,7 +162,7 @@ bool torture_ldap_uptodatevector(struct torture_context *torture)
        url = talloc_asprintf(torture, "ldap://%s/", host);
        if (!url) goto failed;
 
-       ldb = ldb_wrap_connect(torture, torture->lp_ctx, url,
+       ldb = ldb_wrap_connect(torture, torture->ev, torture->lp_ctx, url,
                               NULL,
                               cmdline_credentials,
                               0, NULL);
index ff1fbcab7885e11b1a66100d82c46044edb1a56d..ab7846e5e11a04f32b514353fe65a9c92fc23dd3 100644 (file)
@@ -74,7 +74,6 @@ bool torture_domainopen(struct torture_context *torture)
 {
        NTSTATUS status;
        struct libnet_context *net_ctx;
-       struct event_context *evt_ctx;
        TALLOC_CTX *mem_ctx;
        bool ret = true;
        struct policy_handle h;
@@ -82,8 +81,7 @@ bool torture_domainopen(struct torture_context *torture)
 
        mem_ctx = talloc_init("test_domain_open");
 
-       evt_ctx = event_context_find(torture);
-       net_ctx = libnet_context_init(evt_ctx, torture->lp_ctx);
+       net_ctx = libnet_context_init(torture->ev, torture->lp_ctx);
 
        status = torture_rpc_connection(torture, 
                                        &net_ctx->samr.pipe,
index 3f8edd40e845d65215052b64893c7ea155ac4a81..bc92b4ebc2e29edc6a924a8931690e3844e20cfc 100644 (file)
@@ -38,6 +38,7 @@
 #include "auth/auth.h"
 #include "param/param.h"
 #include "torture/util.h"
+#include "param/provision.h"
 
 struct test_become_dc_state {
        struct libnet_context *ctx;
@@ -66,16 +67,9 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
 {
        struct test_become_dc_state *s = talloc_get_type(private_data, struct test_become_dc_state);
        struct provision_settings settings;
+       struct provision_result result;
        NTSTATUS status;
-       bool ok;
-       struct loadparm_context *lp_ctx = loadparm_init(s);
-       char *smbconf;
-
-       if (!lp_ctx) {
-               return NT_STATUS_NO_MEMORY;
-       }
 
-       settings.dns_name = p->dest_dsa->dns_name;
        settings.site_name = p->dest_dsa->site_name;
        settings.root_dn_str = p->forest->root_dn_str;
        settings.domain_dn_str = p->domain->dn_str;
@@ -84,40 +78,14 @@ static NTSTATUS test_become_dc_prepare_db(void *private_data,
        settings.netbios_name = p->dest_dsa->netbios_name;
        settings.realm = torture_join_dom_dns_name(s->tj);
        settings.domain = torture_join_dom_netbios_name(s->tj);
+       settings.server_dn_str = torture_join_server_dn_str(s->tj);
        settings.machine_password = cli_credentials_get_password(s->machine_account);
        settings.targetdir = s->targetdir;
 
-       status = provision_bare(s, s->lp_ctx, &settings);
+       status = provision_bare(s, s->lp_ctx, &settings, &result);
        
-       smbconf = talloc_asprintf(lp_ctx, "%s/%s", s->targetdir, "/etc/smb.conf");
-
-       ok = lp_load(lp_ctx, smbconf);
-       if (!ok) {
-               DEBUG(0,("Failed load freshly generated smb.conf '%s'\n", smbconf));
-               return NT_STATUS_INVALID_PARAMETER;
-       }
-
-       s->ldb = ldb_wrap_connect(s, lp_ctx, lp_sam_url(lp_ctx),
-                                 system_session(s, lp_ctx),
-                                 NULL, 0, NULL);
-       if (!s->ldb) {
-               DEBUG(0,("Failed to open '%s'\n", lp_sam_url(lp_ctx)));
-               return NT_STATUS_INTERNAL_DB_ERROR;
-       }
-       
-       ok = samdb_set_ntds_invocation_id(s->ldb, &p->dest_dsa->invocation_id);
-       if (!ok) {
-               DEBUG(0,("Failed to set cached ntds invocationId\n"));
-               return NT_STATUS_FOOBAR;
-       }
-       ok = samdb_set_ntds_objectGUID(s->ldb, &p->dest_dsa->ntds_guid);
-       if (!ok) {
-               DEBUG(0,("Failed to set cached ntds objectGUID\n"));
-               return NT_STATUS_FOOBAR;
-       }
-       
-       s->lp_ctx = lp_ctx;
-
+       s->ldb = result.samdb;
+       s->lp_ctx = result.lp_ctx;
         return NT_STATUS_OK;
 
 
@@ -354,7 +322,7 @@ static NTSTATUS test_apply_schema(struct test_become_dc_state *s,
 
        sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
        DEBUG(0,("Reopen the SAM LDB with system credentials and a already stored schema: %s\n", sam_ldb_path));
-       s->ldb = ldb_wrap_connect(s, s->tctx->lp_ctx, sam_ldb_path,
+       s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->tctx->lp_ctx, sam_ldb_path,
                                  system_session(s, s->tctx->lp_ctx),
                                  NULL, 0, NULL);
        if (!s->ldb) {
@@ -686,7 +654,7 @@ bool torture_net_become_dc(struct torture_context *torture)
 
        sam_ldb_path = talloc_asprintf(s, "%s/%s", s->targetdir, "private/sam.ldb");
        DEBUG(0,("Reopen the SAM LDB with system credentials and all replicated data: %s\n", sam_ldb_path));
-       s->ldb = ldb_wrap_connect(s, s->lp_ctx, sam_ldb_path,
+       s->ldb = ldb_wrap_connect(s, s->tctx->ev, s->lp_ctx, sam_ldb_path,
                                  system_session(s, s->lp_ctx),
                                  NULL, 0, NULL);
        if (!s->ldb) {
index 3c8d574f0ec61fe4926fb0cf9e0b9264c9c3985c..7d5be368c2cc9a3c0d339b9c65471b9473f7c12b 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;
@@ -201,7 +201,7 @@ bool torture_domain_close_lsa(struct torture_context *torture)
 
        mem_ctx = talloc_init("torture_domain_close_lsa");
        status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_lsarpc,
-                                    cmdline_credentials, NULL, torture->lp_ctx);
+                                    cmdline_credentials, torture->ev, torture->lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("failed to connect to server: %s\n", nt_errstr(status));
                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;
@@ -331,7 +330,7 @@ bool torture_domain_close_samr(struct torture_context *torture)
 
        mem_ctx = talloc_init("torture_domain_close_samr");
        status = dcerpc_pipe_connect_b(mem_ctx, &p, binding, &ndr_table_samr,
-                                    ctx->cred, NULL, torture->lp_ctx);
+                                    ctx->cred, torture->ev, torture->lp_ctx);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("failed to connect to server: %s\n", nt_errstr(status));
                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..6d3e682976f3cceb2c69be68acd6f315d5f1ce9a 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,
@@ -530,7 +530,8 @@ bool torture_modifyuser(struct torture_context *torture)
 
                ZERO_STRUCT(user_req);
                user_req.in.domain_name = lp_workgroup(torture->lp_ctx);
-               user_req.in.user_name = name;
+               user_req.in.data.user_name = name;
+               user_req.in.level = USER_INFO_BY_NAME;
 
                status = libnet_UserInfo(ctx, torture, &user_req);
                if (!NT_STATUS_IS_OK(status)) {
@@ -616,7 +617,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,
@@ -642,7 +643,8 @@ bool torture_userinfo_api(struct torture_context *torture)
        ZERO_STRUCT(req);
        
        req.in.domain_name = domain_name.string;
-       req.in.user_name   = name;
+       req.in.data.user_name   = name;
+       req.in.level = USER_INFO_BY_NAME;
 
        status = libnet_UserInfo(ctx, mem_ctx, &req);
        if (!NT_STATUS_IS_OK(status)) {
@@ -681,7 +683,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 34083cd204fd3039886eed17a51a41021aa1595e..bf88c00e35885d32bbca6912616a86f81cd8e422 100644 (file)
@@ -176,7 +176,7 @@ static bool test_ldb_speed(struct torture_context *torture, const void *_data)
 
        torture_comment(torture, "Testing ldb speed for sidmap\n");
 
-       ldb = ldb_wrap_connect(tmp_ctx, torture->lp_ctx, "tdb://test.ldb", 
+       ldb = ldb_wrap_connect(tmp_ctx, torture->ev, torture->lp_ctx, "tdb://test.ldb", 
                                NULL, NULL, LDB_FLG_NOSYNC, NULL);
        if (!ldb) {
                unlink("./test.ldb");
index bb6e21ed4f7fbb2e8150b19d3eca322d2e785daa..7935f6cc35d3462c45b44fb37353f49294dd7208 100644 (file)
@@ -25,6 +25,7 @@
 #include "lib/events/events.h"
 #include "libcli/raw/libcliraw.h"
 #include "torture/util.h"
+#include "param/provision.h"
 
 static bool test_tempdir(struct torture_context *tctx)
 {
@@ -42,30 +43,34 @@ static bool test_tempdir(struct torture_context *tctx)
 static bool test_provision(struct torture_context *tctx)
 {
        NTSTATUS status;
-       struct provision_settings settings;
-       char *location = NULL;
-       torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &location), 
+       struct provision_settings *settings = talloc_zero(tctx, struct provision_settings);
+       struct provision_result result;
+       char *targetdir = NULL;
+
+       torture_assert_ntstatus_ok(tctx, torture_temp_dir(tctx, "torture_provision", &targetdir), 
                                   "torture_temp_dir should return NT_STATUS_OK" );
+       settings->targetdir = talloc_steal(settings, targetdir);
 
-       settings.dns_name = "example.com";
-       settings.site_name = "SOME-SITE-NAME";
-       settings.root_dn_str = "DC=EXAMPLE,DC=COM";
-       settings.domain_dn_str = "DC=EXAMPLE,DC=COM";
-       settings.config_dn_str = NULL;
-       settings.schema_dn_str = NULL;
-       settings.invocation_id = NULL;
-       settings.netbios_name = "FOO";
-       settings.realm = "EXAMPLE.COM";
-       settings.domain = "EXAMPLE";
-       settings.ntds_guid = NULL;
-       settings.ntds_dn_str = NULL;
-       settings.machine_password = "geheim";
-       settings.targetdir = location;
+       settings->site_name = "SOME-SITE-NAME";
+       settings->root_dn_str = "DC=EXAMPLE,DC=COM";
+       settings->domain_dn_str = "DC=EXAMPLE,DC=COM";
+       settings->config_dn_str = NULL;
+       settings->schema_dn_str = NULL;
+       settings->invocation_id = NULL;
+       settings->netbios_name = "FOO";
+       settings->realm = "EXAMPLE.COM";
+       settings->domain = "EXAMPLE";
+       settings->netbios_name = "torture";
+       settings->ntds_dn_str = NULL;
+       settings->machine_password = "geheim";
 
-       status = provision_bare(tctx, tctx->lp_ctx, &settings);
+       status = provision_bare(settings, tctx->lp_ctx, settings, &result);
                        
        torture_assert_ntstatus_ok(tctx, status, "provision");
 
+       torture_assert_str_equal(tctx, result.domaindn, "DC=EXAMPLE,DC=COM", 
+                                "domaindn incorrect");
+
        return true;
 }
 
index 618568acf9ff138c618dc774109381b950571bac..8959232edb6149d8c6f033dbeb0a0c3bb83c3853 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "lib/cmdline/popt_common.h"
+#include "lib/events/events.h"
 #include "system/filesys.h"
 #include "system/time.h"
 #include "pstring.h"
@@ -107,7 +108,8 @@ static struct record *recorded;
 /***************************************************** 
 return a connection to a server
 *******************************************************/
-static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
+static struct smbcli_state *connect_one(struct event_context *ev,
+                                       struct loadparm_context *lp_ctx,
                                        char *share, int snum, int conn)
 {
        struct smbcli_state *c;
@@ -162,7 +164,7 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
                                                share, NULL,
                                                servers[snum], 
                                                lp_resolve_context(lp_ctx),
-                                               NULL, &options);
+                                               ev, &options);
                if (!NT_STATUS_IS_OK(status)) {
                        sleep(2);
                }
@@ -176,7 +178,8 @@ static struct smbcli_state *connect_one(struct loadparm_context *lp_ctx,
 }
 
 
-static void reconnect(struct loadparm_context *lp_ctx,
+static void reconnect(struct event_context *ev,
+                     struct loadparm_context *lp_ctx,
                      struct smbcli_state *cli[NSERVERS][NCONNECTIONS], int fnum[NSERVERS][NCONNECTIONS][NFILES],
                      char *share[NSERVERS])
 {
@@ -193,7 +196,7 @@ static void reconnect(struct loadparm_context *lp_ctx,
                        }
                        talloc_free(cli[server][conn]);
                }
-               cli[server][conn] = connect_one(lp_ctx, share[server], 
+               cli[server][conn] = connect_one(ev, lp_ctx, share[server], 
                                                server, conn);
                if (!cli[server][conn]) {
                        DEBUG(0,("Failed to connect to %s\n", share[server]));
@@ -396,7 +399,9 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
    we then do random locking ops in tamdem on the 4 fnums from each
    server and ensure that the results match
  */
-static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
+static int test_locks(struct event_context *ev,
+                     struct loadparm_context *lp_ctx,
+                     char *share[NSERVERS])
 {
        struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
        int fnum[NSERVERS][NCONNECTIONS][NFILES];
@@ -447,7 +452,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
 #endif
        }
 
-       reconnect(lp_ctx, cli, fnum, share);
+       reconnect(ev, lp_ctx, cli, fnum, share);
        open_files(cli, fnum);
        n = retest(cli, fnum, numops);
 
@@ -465,7 +470,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
                n1 = n;
 
                close_files(cli, fnum);
-               reconnect(lp_ctx, cli, fnum, share);
+               reconnect(ev, lp_ctx, cli, fnum, share);
                open_files(cli, fnum);
 
                for (i=0;i<n-skip;i+=skip) {
@@ -503,7 +508,7 @@ static int test_locks(struct loadparm_context *lp_ctx, char *share[NSERVERS])
        }
 
        close_files(cli, fnum);
-       reconnect(lp_ctx, cli, fnum, share);
+       reconnect(ev, lp_ctx, cli, fnum, share);
        open_files(cli, fnum);
        showall = true;
        n1 = retest(cli, fnum, n);
@@ -543,6 +548,7 @@ static void usage(poptContext pc)
        int opt;
        int seed, server;
        int username_count=0;
+       struct event_context *ev;
        struct loadparm_context *lp_ctx;
        poptContext pc;
        int argc_new, i;
@@ -631,12 +637,14 @@ static void usage(poptContext pc)
                servers[1] = servers[0];
        }
 
+       ev = event_context_init(talloc_autofree_context());
+
        gensec_init(lp_ctx);
 
        DEBUG(0,("seed=%u base=%d range=%d min_length=%d\n", 
                 seed, lock_base, lock_range, min_length));
        srandom(seed);
 
-       return test_locks(lp_ctx, share);
+       return test_locks(ev, lp_ctx, share);
 }
 
index 0fe37253859fea62ab9e23471e5d62b1541c5c2a..1784a0a729490c11668b311dd20c845b2379b914 100644 (file)
@@ -19,6 +19,7 @@
 
 #include "includes.h"
 #include "system/passwd.h"
+#include "lib/events/events.h"
 
 static fstring password;
 static fstring username;
@@ -137,7 +138,8 @@ static bool try_unlock(struct smbcli_state *c, int fstype,
 return a connection to a server
 *******************************************************/
 static struct smbcli_state *connect_one(char *share, const char **ports,
-                                       struct smb_options *options)
+                                       struct smb_options *optionsi,
+                                       struct event_context *ev)
 {
        struct smbcli_state *c;
        char *server_n;
@@ -165,7 +167,7 @@ static struct smbcli_state *connect_one(char *share, const char **ports,
 
        nt_status = smbcli_full_connection(NULL, 
                           &c, myname, server_n, ports, share, NULL,
-                          username, lp_workgroup(), password, NULL,
+                          username, lp_workgroup(), password, ev,
                           options);
        if (!NT_STATUS_IS_OK(nt_status)) {
                DEBUG(0, ("smbcli_full_connection failed with error %s\n", nt_errstr(nt_status)));
@@ -183,6 +185,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                      int fnum[NSERVERS][NUMFSTYPES][NCONNECTIONS][NFILES],
                      const char **ports,
                      struct smbcli_options *options,
+                     struct event_context *ev,
                      char *share1, char *share2)
 {
        int server, conn, f, fstype;
@@ -201,7 +204,7 @@ static void reconnect(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
                        smbcli_ulogoff(cli[server][conn]);
                        talloc_free(cli[server][conn]);
                }
-               cli[server][conn] = connect_one(share[server], ports, options);
+               cli[server][conn] = connect_one(share[server], ports, options, ev);
                if (!cli[server][conn]) {
                        DEBUG(0,("Failed to connect to %s\n", share[server]));
                        exit(1);
@@ -347,7 +350,11 @@ static int retest(struct smbcli_state *cli[NSERVERS][NCONNECTIONS],
    we then do random locking ops in tamdem on the 4 fnums from each
    server and ensure that the results match
  */
-static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath2, const char **ports, struct smbcli_options *options)
+static void test_locks(char *share1, char *share2,
+                       char *nfspath1, char *nfspath2,
+                       const char **ports,
+                       struct smbcli_options *options,
+                       struct event_context *ev)
 {
        struct smbcli_state *cli[NSERVERS][NCONNECTIONS];
        char *nfs[NSERVERS];
@@ -376,7 +383,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
                recorded[n].needed = true;
        }
 
-       reconnect(cli, nfs, fnum, ports, options, share1, share2);
+       reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
        open_files(cli, nfs, fnum);
        n = retest(cli, nfs, fnum, numops);
 
@@ -387,7 +394,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
                n1 = n;
 
                close_files(cli, nfs, fnum);
-               reconnect(cli, nfs, fnum, ports, options, share1, share2);
+               reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
                open_files(cli, nfs, fnum);
 
                for (i=0;i<n-1;i++) {
@@ -414,7 +421,7 @@ static void test_locks(char *share1, char *share2, char *nfspath1, char *nfspath
        }
 
        close_files(cli, nfs, fnum);
-       reconnect(cli, nfs, fnum, ports, options, share1, share2);
+       reconnect(cli, nfs, fnum, ports, options, ev, share1, share2);
        open_files(cli, nfs, fnum);
        showall = true;
        n1 = retest(cli, nfs, fnum, n);
@@ -466,6 +473,7 @@ static void usage(void)
        char *p;
        int seed;
        struct loadparm_context *lp_ctx;
+       struct event_context *ev;
 
        setlinebuf(stdout);
 
@@ -542,10 +550,12 @@ static void usage(void)
        DEBUG(0,("seed=%u\n", seed));
        srandom(seed);
 
+       ev = event_context_init(talloc_autofree_context());
+
        locking_init(1);
        lp_smbcli_options(lp_ctx, &options);
        test_locks(share1, share2, nfspath1, nfspath2, lp_smb_ports(lp_ctx),
-                  &options);
+                  &options, ev);
 
        return(0);
 }
index ac7029aa50df861391f3956ab368d30567d17f79..39b1296dbe0da573afcc2a3e9e6717a90778e527 100644 (file)
@@ -30,6 +30,7 @@
 #include "param/param.h"
 #include "dynconfig.h"
 #include "libcli/resolve/resolve.h"
+#include "lib/events/events.h"
 
 static bool showall = false;
 static bool old_list = false;
@@ -73,6 +74,7 @@ static char *reg_test(struct smbcli_state *cli, char *pattern, char *long_name,
 return a connection to a server
 *******************************************************/
 static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx, 
+                                       struct event_context *ev,
                                        char *share, const char **ports,
                                        struct smbcli_options *options)
 {
@@ -92,7 +94,7 @@ static struct smbcli_state *connect_one(struct resolve_context *resolve_ctx,
                                        server, 
                                        ports,
                                        share, NULL,
-                                       cmdline_credentials, resolve_ctx, NULL,
+                                       cmdline_credentials, resolve_ctx, ev,
                                        options);
 
        if (!NT_STATUS_IS_OK(status)) {
@@ -291,6 +293,7 @@ static void usage(poptContext pc)
        struct smbcli_state *cli;       
        int opt;
        int seed;
+       struct event_context *ev;
        struct loadparm_context *lp_ctx;
        struct smbcli_options options;
        poptContext pc;
@@ -352,11 +355,13 @@ static void usage(poptContext pc)
 
        lp_ctx = cmdline_lp_ctx;
 
+       ev = event_context_init(talloc_autofree_context());
+
        gensec_init(lp_ctx);
 
        lp_smbcli_options(lp_ctx, &options);
 
-       cli = connect_one(lp_resolve_context(lp_ctx), share, 
+       cli = connect_one(lp_resolve_context(lp_ctx), ev, share, 
                          lp_smb_ports(lp_ctx), &options);
        if (!cli) {
                DEBUG(0,("Failed to connect to %s\n", share));
index e609e7205513d4208a352e79e134def20ddc8818..a0e7b7d9caea75f670a41526dbc2f581ec2e817e 100644 (file)
@@ -40,7 +40,7 @@ bool torture_nbt_browse(struct torture_context *torture)
        name.scope = NULL;
 
        /* do an initial name resolution to find its IP */
-       status = resolve_name(&name, mem_ctx, &address, NULL);
+       status = resolve_name(&name, mem_ctx, &address, torture->ev);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to resolve %s - %s\n",
                       name.name, nt_errstr(status));
index e1680877e89539826c00d0e56e6cc2e66375b31d..a3585896eb4802bbcccd4d5f5c1bf2f15e23039f 100644 (file)
@@ -64,7 +64,7 @@ static void netlogon_handler(struct dgram_mailslot_handler *dgmslot,
 static bool nbt_test_netlogon(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev
                                                                 lp_iconv_convenience(tctx->lp_ctx));
        struct socket_address *dest;
        const char *myaddress;
@@ -87,7 +87,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -147,7 +147,7 @@ static bool nbt_test_netlogon(struct torture_context *tctx)
 static bool nbt_test_netlogon2(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL,
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
                                                                 lp_iconv_convenience(tctx->lp_ctx));
        struct socket_address *dest;
        const char *myaddress;
@@ -170,7 +170,7 @@ static bool nbt_test_netlogon2(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)),
+                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -257,7 +257,7 @@ static void ntlogon_handler(struct dgram_mailslot_handler *dgmslot,
 static bool nbt_test_ntlogon(struct torture_context *tctx)
 {
        struct dgram_mailslot_handler *dgmslot;
-       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, NULL,
+       struct nbt_dgram_socket *dgmsock = nbt_dgram_socket_init(tctx, tctx->ev,
                                                                 lp_iconv_convenience(tctx->lp_ctx));
        struct socket_address *dest;
        struct test_join *join_ctx;
@@ -283,7 +283,7 @@ static bool nbt_test_ntlogon(struct torture_context *tctx)
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, event_context_find(tctx)), 
+                                  resolve_name(lp_resolve_context(tctx->lp_ctx), &name, tctx, &address, tctx->ev),
                                   talloc_asprintf(tctx, "Failed to resolve %s", name.name));
 
        load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
index 6cb9507398fc87844a643acde7c1d3b77243922a..d27a26eb30c34170c7f8a9c5f3a415a1b0e5f37d 100644 (file)
@@ -34,7 +34,7 @@ bool torture_nbt_get_name(struct torture_context *tctx,
 
        /* do an initial name resolution to find its IP */
        torture_assert_ntstatus_ok(tctx, 
-                                  resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, NULL), 
+                                  resolve_name(lp_resolve_context(tctx->lp_ctx), name, tctx, address, tctx->ev), 
                                   talloc_asprintf(tctx, 
                                                   "Failed to resolve %s", name->name));
        
index 1ba6172e5ce50db04b6fa4007766a00de76de9d8..3f3a15cca542b53d8871b9f0f948c629e1be8e72 100644 (file)
@@ -47,7 +47,7 @@ static void increment_handler(struct nbt_name_request *req)
 */
 static bool bench_namequery(struct torture_context *tctx)
 {
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev,
                                                               lp_iconv_convenience(tctx->lp_ctx));
        int num_sent=0;
        struct result_struct *result;
index b9f06c479d0d7b6a2840f34623a1313f85b8eaed..a8681f828f7373e10b20fd5ffb642247f8164a7a 100644 (file)
@@ -44,7 +44,7 @@ static bool nbt_register_own(struct torture_context *tctx)
 {
        struct nbt_name_register io;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev,
                                                               lp_iconv_convenience(tctx->lp_ctx));
        struct socket_address *socket_address;
        struct nbt_name name;
@@ -114,7 +114,7 @@ static bool nbt_refresh_own(struct torture_context *tctx)
 {
        struct nbt_name_refresh io;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL,
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev,
                                                               lp_iconv_convenience(tctx->lp_ctx));
        const char *myaddress;
        struct socket_address *socket_address;
index 059b2dc91922daa01da3515ffea7b669aac60609..ae20de6e2f59244ea62f89e880f9627de834169d 100644 (file)
@@ -53,7 +53,7 @@ static bool nbt_test_wins_name(struct torture_context *tctx, const char *address
        struct nbt_name_refresh_wins refresh;
        struct nbt_name_release release;
        NTSTATUS status;
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        const char *myaddress;
        struct socket_address *socket_address;
        struct interface *ifaces;
index ea4abaf21b5a11c773d422825c3f6e14ca0e067e..a0d90fb65333608f823a0cbd27d0c633f1de7c71 100644 (file)
@@ -225,7 +225,7 @@ static void generate_request(struct nbt_name_socket *nbtsock, struct wins_state
 */
 static bool bench_wins(struct torture_context *tctx)
 {
-       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct nbt_name_socket *nbtsock = nbt_name_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        int num_sent=0;
        struct timeval tv = timeval_current();
        bool ret = true;
index 470eee831003d9c20e66070ab2e530882e5d1977..ee7a1510d5b7347630390f517c5bfe5fdf4dc5c2 100644 (file)
@@ -103,8 +103,8 @@ static bool test_assoc_ctx1(struct torture_context *tctx)
 
        torture_comment(tctx, "Test if assoc_ctx is only valid on the conection it was created on\n");
 
-       wrepl_socket1 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
-       wrepl_socket2 = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket1 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket2 = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
 
        torture_comment(tctx, "Setup 2 wrepl connections\n");
        status = wrepl_connect(wrepl_socket1, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
@@ -186,7 +186,7 @@ static bool test_assoc_ctx2(struct torture_context *tctx)
 
        torture_comment(tctx, "Test if we always get back the same assoc_ctx\n");
 
-       wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        
        torture_comment(tctx, "Setup wrepl connections\n");
        status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
@@ -255,7 +255,7 @@ static bool test_wins_replication(struct torture_context *tctx)
 
        torture_comment(tctx, "Test one pull replication cycle\n");
 
-       wrepl_socket = wrepl_socket_init(tctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket = wrepl_socket_init(tctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        
        torture_comment(tctx, "Setup wrepl connections\n");
        status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, address), address);
@@ -553,7 +553,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        if (!ctx) return NULL;
 
        ctx->address    = address;
-       ctx->pull       = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       ctx->pull       = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->pull) return NULL;
 
        torture_comment(tctx, "Setup wrepl conflict pull connection\n");
@@ -610,7 +610,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
 
        talloc_free(pull_table.out.partners);
 
-       ctx->nbtsock = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       ctx->nbtsock = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->nbtsock) return NULL;
 
        load_interfaces(tctx, lp_interfaces(tctx->lp_ctx), &ifaces);
@@ -628,7 +628,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        status = socket_listen(ctx->nbtsock->sock, ctx->myaddr, 0, 0);
        if (!NT_STATUS_IS_OK(status)) return NULL;
 
-       ctx->nbtsock_srv = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       ctx->nbtsock_srv = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
        if (!ctx->nbtsock_srv) return NULL;
 
        /* Make a port 137 version of ctx->myaddr */
@@ -645,7 +645,7 @@ static struct test_wrepl_conflict_conn *test_create_conflict_ctx(
        }
 
        if (ctx->myaddr2 && ctx->nbtsock_srv) {
-               ctx->nbtsock2 = nbt_name_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+               ctx->nbtsock2 = nbt_name_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
                if (!ctx->nbtsock2) return NULL;
 
                status = socket_listen(ctx->nbtsock2->sock, ctx->myaddr2, 0, 0);
@@ -722,7 +722,7 @@ static bool test_wrepl_update_one(struct torture_context *tctx,
        uint32_t assoc_ctx;
        NTSTATUS status;
 
-       wrepl_socket = wrepl_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       wrepl_socket = wrepl_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
 
        status = wrepl_connect(wrepl_socket, lp_resolve_context(tctx->lp_ctx), wrepl_best_ip(tctx->lp_ctx, ctx->address), ctx->address);
        CHECK_STATUS(tctx, status, NT_STATUS_OK);
index 2f01a9d00903f917e0b61e39f225d7ef48db66a9..a5221f71e96f02d553fe52e92c5cb83ab7be14ef 100644 (file)
@@ -46,7 +46,7 @@ static bool netrserverauthenticate3_in_check(struct torture_context *tctx,
        torture_assert_int_equal(tctx, r->in.secure_channel_type, 2, "secure channel type");
        torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "computer name");
        torture_assert_int_equal(tctx, *r->in.negotiate_flags, 0x6007ffff, "negotiate flags");
-       torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials");
+       torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials");
        return true;
 }
 
@@ -59,7 +59,7 @@ static bool netrserverauthenticate3_out_check(struct torture_context *tctx,
                                                                                        struct netr_ServerAuthenticate3 *r)
 {
        uint8_t cred_expected[8] = { 0x22, 0x0c, 0x86, 0x8a, 0xe9, 0x92, 0x93, 0xc9 };
-       torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials");
+       torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials");
        torture_assert_int_equal(tctx, *r->out.negotiate_flags, 0x6007ffff, "negotiate flags");
        torture_assert_int_equal(tctx, *r->out.rid, 0x454, "rid");
        torture_assert_ntstatus_ok(tctx, r->out.result, "return code");
@@ -80,12 +80,12 @@ static const uint8_t netrserverreqchallenge_in_data[] = {
 };
 
 static bool netrserverreqchallenge_in_check(struct torture_context *tctx,
-                                                                                       struct netr_ServerReqChallenge *r)
+                                           struct netr_ServerReqChallenge *r)
 {
        uint8_t cred_expected[8] = { 0xa3, 0x2c, 0xa2, 0x95, 0x40, 0xcc, 0xb7, 0xbb };
        torture_assert_str_equal(tctx, r->in.server_name, "\\\\NATIVE-DC.NATIVE.BASE", "server name");
        torture_assert_str_equal(tctx, r->in.computer_name, "NATIVE-2K", "account name");
-       torture_assert(tctx, memcmp(cred_expected, r->in.credentials->data, 8) == 0, "credentials");
+       torture_assert_mem_equal(tctx, cred_expected, r->in.credentials->data, 8, "credentials");
 
        return true;
 }
@@ -95,10 +95,10 @@ static const uint8_t netrserverreqchallenge_out_data[] = {
 };
 
 static bool netrserverreqchallenge_out_check(struct torture_context *tctx,
-                                                                                       struct netr_ServerReqChallenge *r)
+                                            struct netr_ServerReqChallenge *r)
 {
        uint8_t cred_expected[8] = { 0x22, 0xfc, 0xc1, 0x17, 0xc0, 0xae, 0x27, 0x8e };
-       torture_assert(tctx, memcmp(cred_expected, r->out.credentials->data, 8) == 0, "credentials");
+       torture_assert_mem_equal(tctx, cred_expected, r->out.credentials->data, 8, "credentials");
        torture_assert_ntstatus_ok(tctx, r->out.result, "return code");
 
        return true;
index 1f31fbc51528e7530966b48164a6adc69d0a1098..d73ac1327e1b80c6556a7d7613846cb4b41688e5 100644 (file)
@@ -296,7 +296,7 @@ static bool test_appendacl(struct smbcli_state *cli, struct torture_context *tct
                c[i]->async.private_data = count;
        }
 
-       event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
+       event_ctx = tctx->ev;
        printf("waiting for completion\n");
        while (*count != num_ops) {
                event_loop_once(event_ctx);
@@ -354,7 +354,7 @@ static bool test_fsinfo(struct smbcli_state *cli, struct torture_context *tctx)
 
        printf("testing parallel queryfsinfo [Object ID] with %d ops\n", torture_numops);
 
-       event_ctx = talloc_reference(tctx, cli->tree->session->transport->socket->event.ctx);
+       event_ctx = tctx->ev;
        c = talloc_array(tctx, struct composite_context *, torture_numops);
 
        for (i=0; i<torture_numops; i++) {
index 86030c538abc3aff66ff4852d8bda88c4b45248e..21541d003b18eb9ad4ee13b496199eeb8881e8f7 100644 (file)
@@ -316,7 +316,6 @@ bool torture_bench_lock(struct torture_context *torture)
        int i;
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        struct timeval tv;
-       struct event_context *ev = event_context_find(mem_ctx);
        struct benchlock_state *state;
        int total = 0, minops=0;
        struct smbcli_state *cli;
@@ -333,8 +332,8 @@ bool torture_bench_lock(struct torture_context *torture)
                state[i].tctx = torture;
                state[i].mem_ctx = talloc_new(state);
                state[i].client_num = i;
-               state[i].ev = ev;
-               if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+               state[i].ev = torture->ev;
+               if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
                        return false;
                }
                talloc_steal(mem_ctx, state);
@@ -375,12 +374,12 @@ bool torture_bench_lock(struct torture_context *torture)
        tv = timeval_current(); 
 
        if (progress) {
-               event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+               event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
        }
 
        printf("Running for %d seconds\n", timelimit);
        while (timeval_elapsed(&tv) < timelimit) {
-               event_loop_once(ev);
+               event_loop_once(torture->ev);
 
                if (lock_failed) {
                        DEBUG(0,("locking failed\n"));
diff --git a/source4/torture/raw/lookuprate.c b/source4/torture/raw/lookuprate.c
new file mode 100644 (file)
index 0000000..0e8f002
--- /dev/null
@@ -0,0 +1,320 @@
+/*
+   File lookup rate test.
+
+   Copyright (C) James Peach 2006
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "param/param.h"
+#include "system/filesys.h"
+#include "torture/torture.h"
+#include "torture/basic/proto.h"
+#include "libcli/libcli.h"
+#include "torture/util.h"
+#include "lib/cmdline/popt_common.h"
+#include "auth/credentials/credentials.h"
+
+#define BASEDIR "\\lookuprate"
+#define MISSINGNAME BASEDIR "\\foo"
+
+#define FUZZ_PERCENT 10
+
+#define usec_to_sec(s) ((s) / 1000000)
+#define sec_to_usec(s) ((s) * 1000000)
+
+struct rate_record
+{
+    unsigned   dirent_count;
+    unsigned   querypath_persec;
+    unsigned   findfirst_persec;
+};
+
+static struct rate_record records[] =
+{
+    { 0, 0, 0 },       /* Base (optimal) lookup rate. */
+    { 100, 0, 0},
+    { 1000, 0, 0},
+    { 10000, 0, 0},
+    { 100000, 0, 0}
+};
+
+typedef NTSTATUS lookup_function(struct smbcli_tree *tree, const char * path);
+
+/* Test whether rhs is within fuzz% of lhs. */
+static bool fuzzily_equal(unsigned lhs, unsigned rhs, int percent)
+{
+       double fuzz = (double)lhs * (double)percent/100.0;
+
+       if (((double)rhs >= ((double)lhs - fuzz)) &&
+           ((double)rhs <= ((double)lhs + fuzz))) {
+               return true;
+       }
+
+       return false;
+
+}
+
+static NTSTATUS fill_directory(struct smbcli_tree *tree,
+           const char * path, unsigned count)
+{
+       NTSTATUS        status;
+       char            *fname = NULL;
+       unsigned        i;
+       unsigned        current;
+
+       struct timeval start;
+       struct timeval now;
+
+       status = smbcli_mkdir(tree, path);
+       if (!NT_STATUS_IS_OK(status)) {
+               return status;
+       }
+
+       printf("filling directory %s with %u files... ", path, count);
+       fflush(stdout);
+
+       current = random();
+       start = timeval_current();
+
+       for (i = 0; i < count; ++i) {
+               int fnum;
+
+               ++current;
+               fname = talloc_asprintf(NULL, "%s\\fill%u",
+                                   path, current);
+
+               fnum = smbcli_open(tree, fname, O_RDONLY|O_CREAT,
+                               OPENX_MODE_DENY_NONE);
+               if (fnum < 0) {
+                       talloc_free(fname);
+                       return smbcli_nt_error(tree);
+               }
+
+               smbcli_close(tree, fnum);
+               talloc_free(fname);
+       }
+
+       if (count) {
+               double rate;
+               now = timeval_current();
+               rate = (double)count / usec_to_sec((double)usec_time_diff(&now, &start));
+               printf("%u/sec\n", (unsigned)rate);
+       } else {
+               printf("done\n");
+       }
+
+       return NT_STATUS_OK;
+}
+
+static NTSTATUS squash_lookup_error(NTSTATUS status)
+{
+       if (NT_STATUS_IS_OK(status)) {
+               return NT_STATUS_OK;
+       }
+
+       /* We don't care if the file isn't there. */
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_PATH_NOT_FOUND)) {
+               return NT_STATUS_OK;
+       }
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_OBJECT_NAME_NOT_FOUND)) {
+               return NT_STATUS_OK;
+       }
+
+       if (NT_STATUS_EQUAL(status, NT_STATUS_NO_SUCH_FILE)) {
+               return NT_STATUS_OK;
+       }
+
+       return status;
+}
+
+/* Look up a pathname using TRANS2_QUERY_PATH_INFORMATION. */
+static NTSTATUS querypath_lookup(struct smbcli_tree *tree, const char * path)
+{
+       NTSTATUS        status;
+       time_t          ftimes[3];
+       size_t          fsize;
+       uint16_t        fmode;
+
+       status = smbcli_qpathinfo(tree, path, &ftimes[0], &ftimes[1], &ftimes[2],
+                       &fsize, &fmode);
+
+       return squash_lookup_error(status);
+}
+
+/* Look up a pathname using TRANS2_FIND_FIRST2. */
+static NTSTATUS findfirst_lookup(struct smbcli_tree *tree, const char * path)
+{
+       NTSTATUS status = NT_STATUS_OK;
+
+       if (smbcli_list(tree, path, 0, NULL, NULL) < 0) {
+               status = smbcli_nt_error(tree);
+       }
+
+       return squash_lookup_error(status);
+}
+
+static NTSTATUS lookup_rate_convert(struct smbcli_tree *tree,
+       lookup_function lookup, const char * path, unsigned * rate)
+{
+       NTSTATUS        status;
+
+       struct timeval  start;
+       struct timeval  now;
+       unsigned        count = 0;
+       int64_t         elapsed = 0;
+
+#define LOOKUP_PERIOD_SEC (2)
+
+       start = timeval_current();
+       while (elapsed < sec_to_usec(LOOKUP_PERIOD_SEC)) {
+
+               status = lookup(tree, path);
+               if (!NT_STATUS_IS_OK(status)) {
+                       return status;
+               }
+
+               ++count;
+               now = timeval_current();
+               elapsed = usec_time_diff(&now, &start);
+       }
+
+#undef LOOKUP_PERIOD_SEC
+
+       *rate = (unsigned)((double)count / (double)usec_to_sec(elapsed));
+       return NT_STATUS_OK;
+}
+
+static bool remove_working_directory(struct smbcli_tree *tree,
+               const char * path)
+{
+       int tries;
+
+       /* Using smbcli_deltree to delete a very large number of files
+        * doesn't work against all servers. Work around this by
+        * retrying.
+        */
+       for (tries = 0; tries < 5; ) {
+               int ret;
+
+               ret = smbcli_deltree(tree, BASEDIR);
+               if (ret == -1) {
+                       tries++;
+                       printf("(%s) failed to deltree %s: %s\n",
+                               __location__, BASEDIR,
+                               smbcli_errstr(tree));
+                       continue;
+               }
+
+               return true;
+       }
+
+       return false;
+
+}
+
+/* Verify that looking up a file name takes constant time.
+ *
+ * This test samples the lookup rate for a non-existant filename in a
+ * directory, while varying the number of files in the directory. The
+ * lookup rate should continue to approximate the lookup rate for the
+ * empty directory case.
+ */
+bool torture_bench_lookup(struct torture_context *torture)
+{
+       NTSTATUS        status;
+       bool            result = false;
+
+       int i, tries;
+       struct smbcli_state *cli = NULL;
+
+       if (!torture_open_connection(&cli, torture, 0)) {
+               goto done;
+       }
+
+       remove_working_directory(cli->tree, BASEDIR);
+
+       for (i = 0; i < ARRAY_SIZE(records); ++i) {
+               printf("testing lookup rate with %u directory entries\n",
+                               records[i].dirent_count);
+
+               status = fill_directory(cli->tree, BASEDIR,
+                               records[i].dirent_count);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("failed to fill directory: %s\n", nt_errstr(status));
+                       goto done;
+               }
+
+               status = lookup_rate_convert(cli->tree, querypath_lookup,
+                       MISSINGNAME, &records[i].querypath_persec);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("querypathinfo of %s failed: %s\n",
+                               MISSINGNAME, nt_errstr(status));
+                       goto done;
+               }
+
+               status = lookup_rate_convert(cli->tree, findfirst_lookup,
+                       MISSINGNAME, &records[i].findfirst_persec);
+               if (!NT_STATUS_IS_OK(status)) {
+                       printf("findfirst of %s failed: %s\n",
+                               MISSINGNAME, nt_errstr(status));
+                       goto done;
+               }
+
+               printf("entries = %u, querypath = %u/sec, findfirst = %u/sec\n",
+                               records[i].dirent_count,
+                               records[i].querypath_persec,
+                               records[i].findfirst_persec);
+
+               if (!remove_working_directory(cli->tree, BASEDIR)) {
+                       goto done;
+               }
+       }
+
+       /* Ok. We have run all our tests. Walk through the records we
+        * accumulated and figure out whether the lookups took constant
+        * time of not.
+        */
+       for (i = 0; i < ARRAY_SIZE(records); ++i) {
+               if (!fuzzily_equal(records[0].querypath_persec,
+                                   records[i].querypath_persec,
+                                   FUZZ_PERCENT)) {
+                       printf("querypath rate for %d entries differed by "
+                               "more than %d%% from base rate\n",
+                               records[i].dirent_count, FUZZ_PERCENT);
+                       result = false;
+               }
+
+               if (!fuzzily_equal(records[0].findfirst_persec,
+                                   records[i].findfirst_persec,
+                                   FUZZ_PERCENT)) {
+                       printf("findfirst rate for %d entries differed by "
+                               "more than %d%% from base rate\n",
+                               records[i].dirent_count, FUZZ_PERCENT);
+                       result = false;
+               }
+       }
+
+done:
+       if (cli) {
+               remove_working_directory(cli->tree, BASEDIR);
+               talloc_free(cli);
+       }
+
+       return result;
+}
+
+/* vim: set sts=8 sw=8 : */
index 1340692faa741c2258535d4db646a17aaca8e10e..9c66c3be9c955b2b62cfc51afc99a60d619b90a5 100644 (file)
@@ -389,7 +389,6 @@ bool torture_test_offline(struct torture_context *torture)
        int i;
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        struct timeval tv;
-       struct event_context *ev = event_context_find(mem_ctx);
        struct offline_state *state;
        struct smbcli_state *cli;
        bool progress;
@@ -404,8 +403,8 @@ bool torture_test_offline(struct torture_context *torture)
        for (i=0;i<nconnections;i++) {
                state[i].tctx = torture;
                state[i].mem_ctx = talloc_new(state);
-               state[i].ev = ev;
-               if (!torture_open_connection_ev(&cli, i, torture, ev)) {
+               state[i].ev = torture->ev;
+               if (!torture_open_connection_ev(&cli, i, torture, torture->ev)) {
                        return false;
                }
                state[i].tree = cli->tree;
@@ -418,7 +417,7 @@ bool torture_test_offline(struct torture_context *torture)
        for (i=nconnections;i<numstates;i++) {
                state[i].tctx = torture;
                state[i].mem_ctx = talloc_new(state);
-               state[i].ev = ev;
+               state[i].ev = torture->ev;
                state[i].tree = state[i % nconnections].tree;
                state[i].client = i;
        }
@@ -468,12 +467,12 @@ bool torture_test_offline(struct torture_context *torture)
        tv = timeval_current(); 
 
        if (progress) {
-               event_add_timed(ev, state, timeval_current_ofs(1, 0), report_rate, state);
+               event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), report_rate, state);
        }
 
        printf("Running for %d seconds\n", timelimit);
        while (timeval_elapsed(&tv) < timelimit) {
-               event_loop_once(ev);
+               event_loop_once(torture->ev);
 
                if (test_failed) {
                        DEBUG(0,("test failed\n"));
@@ -487,7 +486,7 @@ bool torture_test_offline(struct torture_context *torture)
                while (state[i].loadfile || 
                       state[i].savefile ||
                       state[i].req) {
-                       event_loop_once(ev);
+                       event_loop_once(torture->ev);
                }
        }       
 
index d28a8bd14eb562726fddec07c7736b6f97ebe495..c6ba0d2571f361e0943471018c266261b794b7b2 100644 (file)
@@ -1350,21 +1350,19 @@ static bool test_raw_open_multi(struct torture_context *tctx)
        const char *host = torture_setting_string(tctx, "host", NULL);
        const char *share = torture_setting_string(tctx, "share", NULL);
        int i, num_files = 3;
-       struct event_context *ev;
        int num_ok = 0;
        int num_collision = 0;
        
-       ev = cli_credentials_get_event_context(cmdline_credentials);
        clients = talloc_array(mem_ctx, struct smbcli_state *, num_files);
        requests = talloc_array(mem_ctx, struct smbcli_request *, num_files);
        ios = talloc_array(mem_ctx, union smb_open, num_files);
-       if ((ev == NULL) || (clients == NULL) || (requests == NULL) ||
+       if ((tctx->ev == NULL) || (clients == NULL) || (requests == NULL) ||
            (ios == NULL)) {
                DEBUG(0, ("talloc failed\n"));
                return false;
        }
 
-       if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, ev)) {
+       if (!torture_open_connection_share(mem_ctx, &cli, tctx, host, share, tctx->ev)) {
                return false;
        }
 
@@ -1372,7 +1370,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
 
        for (i=0; i<num_files; i++) {
                if (!torture_open_connection_share(mem_ctx, &(clients[i]),
-                                                  tctx, host, share, ev)) {
+                                                  tctx, host, share, tctx->ev)) {
                        DEBUG(0, ("Could not open %d'th connection\n", i));
                        return false;
                }
@@ -1441,7 +1439,7 @@ static bool test_raw_open_multi(struct torture_context *tctx)
                        break;
                }
 
-               if (event_loop_once(ev) != 0) {
+               if (event_loop_once(tctx->ev) != 0) {
                        DEBUG(0, ("event_loop_once failed\n"));
                        return false;
                }
index a5b1434a47417e2a2f27771493ec982ee2ca4b9b..26b862c33f1d1255387ab0fae2e27049e6dcee75 100644 (file)
@@ -369,7 +369,6 @@ bool torture_bench_open(struct torture_context *torture)
        int i;
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        struct timeval tv;
-       struct event_context *ev = event_context_find(mem_ctx);
        struct benchopen_state *state;
        int total = 0;
        int total_retries = 0;
@@ -387,8 +386,8 @@ bool torture_bench_open(struct torture_context *torture)
                state[i].tctx = torture;
                state[i].mem_ctx = talloc_new(state);
                state[i].client_num = i;
-               state[i].ev = ev;
-               if (!torture_open_connection_ev(&state[i].cli, i, torture, ev)) {
+               state[i].ev = torture->ev;
+               if (!torture_open_connection_ev(&state[i].cli, i, torture, torture->ev)) {
                        return false;
                }
                talloc_steal(mem_ctx, state);
@@ -428,13 +427,13 @@ bool torture_bench_open(struct torture_context *torture)
        tv = timeval_current(); 
 
        if (progress) {
-               report_te = event_add_timed(ev, state, timeval_current_ofs(1, 0), 
+               report_te = event_add_timed(torture->ev, state, timeval_current_ofs(1, 0), 
                                            report_rate, state);
        }
 
        printf("Running for %d seconds\n", timelimit);
        while (timeval_elapsed(&tv) < timelimit) {
-               event_loop_once(ev);
+               event_loop_once(torture->ev);
 
                if (open_failed) {
                        DEBUG(0,("open failed\n"));
index 1927a0f027df77b3697275faf3ce426ec78fb296..fd8d292980aa48c13eaf735440b1c7bfa31e2560 100644 (file)
@@ -2841,13 +2841,12 @@ bool torture_bench_oplock(struct torture_context *torture)
        int timelimit = torture_setting_int(torture, "timelimit", 10);
        union smb_open io;
        struct timeval tv;
-       struct event_context *ev = event_context_find(mem_ctx);
 
        cli = talloc_array(mem_ctx, struct smbcli_state *, torture_nprocs);
 
        torture_comment(torture, "Opening %d connections\n", torture_nprocs);
        for (i=0;i<torture_nprocs;i++) {
-               if (!torture_open_connection_ev(&cli[i], i, torture, ev)) {
+               if (!torture_open_connection_ev(&cli[i], i, torture, torture->ev)) {
                        return false;
                }
                talloc_steal(mem_ctx, cli[i]);
index bb3dde728fd44338d67e212b30d26b6abeb83cf2..262ed1384bf6a0ab956367346660b55f90bd0034 100644 (file)
@@ -33,6 +33,8 @@ NTSTATUS torture_raw_init(void)
        torture_suite_add_simple_test(suite, "PING-PONG", torture_ping_pong);
        torture_suite_add_simple_test(suite, "BENCH-LOCK", torture_bench_lock);
        torture_suite_add_simple_test(suite, "BENCH-OPEN", torture_bench_open);
+       torture_suite_add_simple_test(suite, "BENCH-LOOKUP",
+               torture_bench_lookup);
        torture_suite_add_simple_test(suite, "OFFLINE", torture_test_offline);
        torture_suite_add_1smb_test(suite, "QFSINFO", torture_raw_qfsinfo);
        torture_suite_add_1smb_test(suite, "QFILEINFO", torture_raw_qfileinfo);
index 814b5f57f43bdebf1812e297d22299f2b5c1a775..1f1501045c1aab72157cfb4e860999f38db486b0 100644 (file)
@@ -136,7 +136,7 @@ bool torture_samba3_hide(struct torture_context *torture)
 
        if (!torture_open_connection_share(
                    torture, &cli, torture, torture_setting_string(torture, "host", NULL),
-                   torture_setting_string(torture, "share", NULL), NULL)) {
+                   torture_setting_string(torture, "share", NULL), torture->ev)) {
                d_printf("torture_open_connection_share failed\n");
                return false;
        }
index 15a7f6c4a32cbbe6a3bc11af774809600b0b0a91..27b4d42dd808937772dc28165314bcabbbbc896f 100644 (file)
@@ -56,7 +56,7 @@ bool torture_samba3_checkfsp(struct torture_context *torture)
 
        if (!torture_open_connection_share(
                    torture, &cli, torture, torture_setting_string(torture, "host", NULL),
-                   torture_setting_string(torture, "share", NULL), NULL)) {
+                   torture_setting_string(torture, "share", NULL), torture->ev)) {
                d_printf("torture_open_connection_share failed\n");
                ret = false;
                goto done;
index 1ca3c62df0af87b881213a78f70ed2c2889f252d..0ebbef1ce6fd44f03fe915c4b7abe95c2f0e9c4c 100644 (file)
@@ -39,7 +39,6 @@ bool torture_async_bind(struct torture_context *torture)
 {
        NTSTATUS status;
        TALLOC_CTX *mem_ctx;
-       struct event_context *evt_ctx;
        int i;
        const char *binding_string;
        struct cli_credentials *creds;
@@ -70,15 +69,11 @@ bool torture_async_bind(struct torture_context *torture)
        /* credentials */
        creds = cmdline_credentials;
 
-       /* event context */
-       evt_ctx = cli_credentials_get_event_context(creds);
-       if (evt_ctx == NULL) return false;
-
        /* send bind requests */
        for (i = 0; i < torture_numasync; i++) {
                table[i] = &ndr_table_lsarpc;
                bind_req[i] = dcerpc_pipe_connect_send(mem_ctx, binding_string,
-                                                      table[i], creds, evt_ctx, torture->lp_ctx);
+                                                      table[i], creds, torture->ev, torture->lp_ctx);
        }
 
        /* recv bind requests */
index 9cfdd805785053ffd40dec2986ec2c7fe2a0fc60..1c81766ebe31a5db73e713e9fb954d836619985b 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;
        }
 
@@ -124,7 +124,7 @@ static bool test_CreateDir(TALLOC_CTX *mem_ctx,
 {
        printf("Creating directory %s\n", dir);
 
-       if (!torture_open_connection_share(mem_ctx, cli, tctx, host, share, NULL)) {
+       if (!torture_open_connection_share(mem_ctx, cli, tctx, host, share, tctx->ev)) {
                return false;
        }
 
@@ -494,7 +494,7 @@ static void test_cleanup_stdroot(struct dcerpc_pipe *p,
 
        test_RemoveStdRoot(p, mem_ctx, host, sharename);
        test_NetShareDel(mem_ctx, tctx, host, sharename);
-       torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", NULL);
+       torture_open_connection_share(mem_ctx, &cli, tctx, host, "C$", tctx->ev);
        test_DeleteDir(cli, dir);
        torture_close_connection(cli);
 }
index b28e429a75746c4a0b590c25c127070de3cf532e..00617f407268eac4b64718a12f4814680e04a4df 100644 (file)
@@ -178,12 +178,11 @@ static bool _test_DsBind(struct torture_context *tctx,
 {
        NTSTATUS status;
        bool ret = true;
-       struct event_context *event = NULL;
 
        status = dcerpc_pipe_connect_b(ctx,
                                       &b->pipe, ctx->drsuapi_binding, 
                                       &ndr_table_drsuapi,
-                                      credentials, event, tctx->lp_ctx);
+                                      credentials, tctx->ev, tctx->lp_ctx);
        
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@@ -254,10 +253,11 @@ static bool test_GetInfo(struct torture_context *tctx, struct DsSyncTest *ctx)
        struct drsuapi_DsCrackNames r;
        struct drsuapi_DsNameString names[1];
        bool ret = true;
-
-       struct cldap_socket *cldap = cldap_socket_init(ctx, NULL, lp_iconv_convenience(tctx->lp_ctx));
+       struct cldap_socket *cldap;
        struct cldap_netlogon search;
-       
+
+       cldap = cldap_socket_init(ctx, tctx->ev, lp_iconv_convenience(tctx->lp_ctx));
+
        r.in.bind_handle                = &ctx->admin.drsuapi.bind_handle;
        r.in.level                      = 1;
        r.in.req.req1.codepage          = 1252; /* western european */
index 849b9fd1e99904c243a74b2ddee693901f8c10e5..cd5eb32fa8196b6442df46a70709a5eb73f10553 100644 (file)
@@ -39,7 +39,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL, &options);
+                                       torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
@@ -65,7 +65,7 @@ bool torture_rpc_join(struct torture_context *torture)
                                        "IPC$", NULL,
                                        machine_account,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL, &options);
+                                       torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                DEBUG(0, ("%s failed to connect to IPC$ with workstation credentials\n",
                          TORTURE_NETBIOS_NAME));
index 6e38d0465a413d904e8aa7d83df75b647eef5216..7c8e78b160f9486f85e5bc6137f311adcb2f578b 100644 (file)
@@ -83,7 +83,7 @@ _PUBLIC_ NTSTATUS torture_rpc_connection(struct torture_context *tctx,
 
        status = dcerpc_pipe_connect_b(tctx, 
                                     p, binding, table,
-                                    cmdline_credentials, NULL, tctx->lp_ctx);
+                                    cmdline_credentials, tctx->ev, tctx->lp_ctx);
  
        if (NT_STATUS_IS_ERR(status)) {
                printf("Failed to connect to remote server: %s %s\n", 
@@ -113,7 +113,7 @@ NTSTATUS torture_rpc_connection_transport(struct torture_context *tctx,
        binding->assoc_group_id = assoc_group_id;
 
        status = dcerpc_pipe_connect_b(tctx, p, binding, table,
-                                      cmdline_credentials, NULL, tctx->lp_ctx);
+                                      cmdline_credentials, tctx->ev, tctx->lp_ctx);
                                           
        if (NT_STATUS_IS_ERR(status)) {
                *p = NULL;
@@ -147,7 +147,7 @@ static bool torture_rpc_setup_machine(struct torture_context *tctx,
                                &(tcase_data->pipe),
                                binding,
                                tcase->table,
-                               tcase_data->credentials, NULL, tctx->lp_ctx);
+                               tcase_data->credentials, tctx->ev, tctx->lp_ctx);
 
        torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
 
@@ -205,7 +205,7 @@ static bool torture_rpc_setup_anonymous(struct torture_context *tctx,
                                &(tcase_data->pipe),
                                binding,
                                tcase->table,
-                               tcase_data->credentials, NULL, tctx->lp_ctx);
+                               tcase_data->credentials, tctx->ev, tctx->lp_ctx);
 
        torture_assert_ntstatus_ok(tctx, status, "Error connecting to server");
 
index 8eb1f54b4fd3d3bd9223e36e907a4660f108c4fd..1103acaefa55ffedb46af4901eea63ee6c522b74 100644 (file)
@@ -89,7 +89,7 @@ bool torture_bind_authcontext(struct torture_context *torture)
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL, &options);
+                                       torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -303,7 +303,7 @@ bool torture_bind_samba3(struct torture_context *torture)
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, cmdline_credentials,
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL, &options);
+                                       torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1220,7 +1220,7 @@ bool torture_netlogon_samba3(struct torture_context *torture)
                                        lp_smb_ports(torture->lp_ctx),
                                        "IPC$", NULL, anon_creds, 
                                        lp_resolve_context(torture->lp_ctx),
-                                       NULL, &options);
+                                       torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1307,7 +1307,7 @@ static bool test_join3(struct torture_context *tctx,
                                        lp_smb_ports(tctx->lp_ctx),
                                        "IPC$", NULL, smb_creds, 
                                        lp_resolve_context(tctx->lp_ctx),
-                                       NULL, &options);
+                                       tctx->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("smbcli_full_connection failed: %s\n",
                         nt_errstr(status));
@@ -1682,7 +1682,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
                lp_smb_ports(torture->lp_ctx),
                "IPC$", NULL, cmdline_credentials, 
                lp_resolve_context(torture->lp_ctx),
-               NULL, &options);
+               torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1709,7 +1709,7 @@ bool torture_samba3_rpc_getusername(struct torture_context *torture)
                lp_smb_ports(torture->lp_ctx),
                "IPC$", NULL, anon_creds, 
                lp_resolve_context(torture->lp_ctx),
-               NULL, &options);
+               torture->ev, &options);
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("(%s) anon smbcli_full_connection failed: %s\n",
                         __location__, nt_errstr(status));
@@ -1924,7 +1924,7 @@ bool torture_samba3_rpc_srvsvc(struct torture_context *torture)
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                talloc_free(mem_ctx);
                return false;
        }
@@ -1986,7 +1986,7 @@ bool torture_samba3_rpc_randomauth2(struct torture_context *torture)
        if (!(torture_open_connection_share(
                      mem_ctx, &cli,
                      torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                d_printf("IPC$ connection failed\n");
                goto done;
        }
@@ -2281,7 +2281,7 @@ bool torture_samba3_rpc_sharesec(struct torture_context *torture)
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                d_printf("IPC$ connection failed\n");
                talloc_free(mem_ctx);
                return false;
@@ -2329,7 +2329,7 @@ bool torture_samba3_rpc_lsa(struct torture_context *torture)
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                d_printf("IPC$ connection failed\n");
                talloc_free(mem_ctx);
                return false;
@@ -2611,7 +2611,7 @@ bool torture_samba3_rpc_spoolss(struct torture_context *torture)
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                d_printf("IPC$ connection failed\n");
                talloc_free(mem_ctx);
                return false;
@@ -2797,7 +2797,7 @@ bool torture_samba3_rpc_wkssvc(struct torture_context *torture)
 
        if (!(torture_open_connection_share(
                      mem_ctx, &cli, torture, torture_setting_string(torture, "host", NULL),
-                     "IPC$", NULL))) {
+                     "IPC$", torture->ev))) {
                d_printf("IPC$ connection failed\n");
                talloc_free(mem_ctx);
                return false;
index 24b2511bc75e98e77f1ce021ada80e327f6ee2d3..ab3283a952e05c597bdca4d36d8c9329c1514efb 100644 (file)
@@ -1602,7 +1602,7 @@ bool torture_rpc_samlogon(struct torture_context *torture)
 
        status = dcerpc_pipe_connect_b(mem_ctx, &p, b, 
                                       &ndr_table_netlogon,
-                                      machine_credentials, NULL, torture->lp_ctx);
+                                      machine_credentials, torture->ev, torture->lp_ctx);
 
        if (!NT_STATUS_IS_OK(status)) {
                d_printf("RPC pipe connect as domain member failed: %s\n", nt_errstr(status));
index 3b152d92aa739ad083f22b0bc152ddff828747b1..9705f7b0de81d50b1478d47df972838027ac1abb 100644 (file)
@@ -1560,7 +1560,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
        status = dcerpc_pipe_connect_b(samsync_state,
                                       &samsync_state->p, b, 
                                           &ndr_table_netlogon,
-                                      credentials, NULL, torture->lp_ctx);
+                                      credentials, torture->ev, torture->lp_ctx);
        
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to server as a BDC: %s\n", nt_errstr(status));
@@ -1598,7 +1598,7 @@ bool torture_rpc_samsync(struct torture_context *torture)
                                       &samsync_state->p_netlogon_wksta, 
                                       b_netlogon_wksta, 
                                           &ndr_table_netlogon,
-                                      credentials_wksta, NULL, torture->lp_ctx);
+                                      credentials_wksta, torture->ev, torture->lp_ctx);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to server as a Workstation: %s\n", nt_errstr(status));
index 19b871f9c092bb08639ab69ba94e7cdd76f86c4e..c89b71baaf4c68f16599e3b2da44a0bf59ecc565 100644 (file)
@@ -258,7 +258,7 @@ static bool test_schannel(struct torture_context *tctx,
        b->flags |= dcerpc_flags;
 
        status = dcerpc_pipe_connect_b(tctx, &p, b, &ndr_table_samr,
-                                      credentials, NULL, tctx->lp_ctx);
+                                      credentials, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, 
                "Failed to connect with schannel");
 
@@ -270,7 +270,7 @@ static bool test_schannel(struct torture_context *tctx,
         * the second */
 
        /* Swap the binding details from SAMR to NETLOGON */
-       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, "epm map");
 
        status = dcerpc_secondary_connection(p, &p_netlogon, 
@@ -296,7 +296,7 @@ static bool test_schannel(struct torture_context *tctx,
                "Failed to process schannel secured NETLOGON EX ops");
 
        /* Swap the binding details from SAMR to LSARPC */
-       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, NULL, tctx->lp_ctx);
+       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_lsarpc, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, "epm map");
 
        status = dcerpc_secondary_connection(p, &p_lsa, 
@@ -328,7 +328,7 @@ static bool test_schannel(struct torture_context *tctx,
        b->flags |= dcerpc_flags;
 
        status = dcerpc_pipe_connect_b(tctx, &p_samr2, b, &ndr_table_samr,
-                                      credentials, NULL, tctx->lp_ctx);
+                                      credentials, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, 
                "Failed to connect with schannel");
 
@@ -337,7 +337,7 @@ static bool test_schannel(struct torture_context *tctx,
                        "Failed to process schannel secured SAMR ops (on fresh connection)");
 
        /* Swap the binding details from SAMR to NETLOGON */
-       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, NULL, tctx->lp_ctx);
+       status = dcerpc_epm_map_binding(tctx, b, &ndr_table_netlogon, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, "epm");
 
        status = dcerpc_secondary_connection(p_samr2, &p_netlogon2, 
@@ -370,7 +370,7 @@ static bool test_schannel(struct torture_context *tctx,
        b->flags &= ~DCERPC_AUTH_OPTIONS;
 
        status = dcerpc_pipe_connect_b(tctx, &p_netlogon3, b, &ndr_table_netlogon,
-                                      credentials, NULL, tctx->lp_ctx);
+                                      credentials, tctx->ev, tctx->lp_ctx);
        torture_assert_ntstatus_ok(tctx, status, "Failed to connect without schannel");
 
        torture_assert(tctx, !test_netlogon_ex_ops(p_netlogon3, tctx, credentials, creds),
@@ -453,12 +453,12 @@ bool torture_rpc_schannel2(struct torture_context *torture)
 
        printf("Opening first connection\n");
        status = dcerpc_pipe_connect_b(torture, &p1, b, &ndr_table_netlogon,
-                                      credentials1, NULL, torture->lp_ctx);
+                                      credentials1, torture->ev, torture->lp_ctx);
        torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
 
        torture_comment(torture, "Opening second connection\n");
        status = dcerpc_pipe_connect_b(torture, &p2, b, &ndr_table_netlogon,
-                                      credentials2, NULL, torture->lp_ctx);
+                                      credentials2, torture->ev, torture->lp_ctx);
        torture_assert_ntstatus_ok(torture, status, "Failed to connect with schannel");
 
        credentials1->netlogon_creds = NULL;
index fcb828ddb2daa14e4c39b9eff4288bd7680c0048..0df7e576ee9175a66413a425c959186917cce506 100644 (file)
@@ -158,7 +158,11 @@ static bool test_secrets(struct torture_context *torture, const void *_data)
        binding->flags |= settings->bindoptions;
 
        torture_assert_ntstatus_ok(torture, 
-                                  dcerpc_pipe_connect_b(torture, &p, binding, &ndr_table_lsarpc, cmdline_credentials, NULL, torture->lp_ctx),
+                                  dcerpc_pipe_connect_b(torture, &p, binding,
+                                                        &ndr_table_lsarpc,
+                                                        cmdline_credentials,
+                                                        torture->ev,
+                                                        torture->lp_ctx),
                                   "connect");
 
        if (!test_lsa_OpenPolicy2(p, torture, &handle)) {
index 02f04946d6e2adc2f6f56fee4246258a2eef5335..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;
@@ -553,6 +553,14 @@ const char *torture_join_dom_dns_name(struct test_join *join)
        return join->dom_dns_name;
 }
 
+const char *torture_join_server_dn_str(struct test_join *join)
+{
+       if (join->libnet_r) {
+               return join->libnet_r->out.server_dn_str;
+       }
+       return NULL;
+}
+
 
 #if 0 /* Left as the documentation of the join process, but see new implementation in libnet_become_dc.c */
 struct test_join_ads_dc {
index 379632f0e7aba5324c6614ee6a0e820d1efaa36d..f3318bb73603b495d5b5627a4fe610df225ada0c 100644 (file)
@@ -20,5 +20,7 @@ TORTURE_SMB2_OBJ_FILES = $(addprefix torture/smb2/, \
                find.o \
                lock.o \
                notify.o \
-               smb2.o)
+               smb2.o \
+               persistent_handles.o \
+               oplocks.o)
 
diff --git a/source4/torture/smb2/oplocks.c b/source4/torture/smb2/oplocks.c
new file mode 100644 (file)
index 0000000..b0a1b31
--- /dev/null
@@ -0,0 +1,178 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   test suite for SMB2 oplocks
+
+   Copyright (C) Stefan Metzmacher 2008
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/security.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+#include "torture/torture.h"
+#include "torture/smb2/proto.h"
+#include "param/param.h"
+
+#define CHECK_VAL(v, correct) do { \
+       if ((v) != (correct)) { \
+               torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \
+                               __location__, #v, (int)v, (int)correct); \
+               ret = false; \
+       }} while (0)
+
+#define CHECK_STATUS(status, correct) do { \
+       if (!NT_STATUS_EQUAL(status, correct)) { \
+               torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
+                      nt_errstr(status), nt_errstr(correct)); \
+               ret = false; \
+               goto done; \
+       }} while (0)
+
+static struct {
+       struct smb2_handle handle;
+       uint8_t level;
+       struct smb2_break br;
+       int count;
+       int failures;
+} break_info;
+
+static void torture_oplock_break_callback(struct smb2_request *req)
+{
+       NTSTATUS status;
+       struct smb2_break br;
+
+       ZERO_STRUCT(br);
+       status = smb2_break_recv(req, &break_info.br);
+       if (!NT_STATUS_IS_OK(status)) {
+               break_info.failures++;
+       }
+
+       return;
+}
+
+/* a oplock break request handler */
+static bool torture_oplock_handler(struct smb2_transport *transport,
+                                  const struct smb2_handle *handle,
+                                  uint8_t level, void *private_data)
+{
+       struct smb2_tree *tree = private_data;
+       const char *name;
+       struct smb2_request *req;
+
+       break_info.handle       = *handle;
+       break_info.level        = level;
+       break_info.count++;
+
+       switch (level) {
+       case SMB2_OPLOCK_LEVEL_II:
+               name = "level II";
+               break;
+       case SMB2_OPLOCK_LEVEL_NONE:
+               name = "none";
+               break;
+       default:
+               name = "unknown";
+               break_info.failures++;
+       }
+       printf("Acking to %s [0x%02X] in oplock handler\n",
+               name, level);
+
+       ZERO_STRUCT(break_info.br);
+       break_info.br.in.file.handle    = *handle;
+       break_info.br.in.oplock_level   = level;
+       break_info.br.in.reserved       = 0;
+       break_info.br.in.reserved2      = 0;
+
+       req = smb2_break_send(tree, &break_info.br);
+       req->async.fn = torture_oplock_break_callback;
+       req->async.private = NULL;
+
+       return true;
+}
+
+bool torture_smb2_oplock_batch1(struct torture_context *tctx,
+                               struct smb2_tree *tree)
+{
+       TALLOC_CTX *mem_ctx = talloc_new(tctx);
+       struct smb2_handle h1, h2;
+       struct smb2_create io;
+       NTSTATUS status;
+       const char *fname = "oplock.dat";
+       bool ret = true;
+
+       tree->session->transport->oplock.handler        = torture_oplock_handler;
+       tree->session->transport->oplock.private_data   = tree;
+
+       smb2_util_unlink(tree, fname);
+
+       ZERO_STRUCT(break_info);
+
+       ZERO_STRUCT(io);
+       io.in.security_flags            = 0x00;
+       io.in.oplock_level              = SMB2_OPLOCK_LEVEL_BATCH;
+       io.in.impersonation_level       = NTCREATEX_IMPERSONATION_IMPERSONATION;
+       io.in.create_flags              = 0x00000000;
+       io.in.reserved                  = 0x00000000;
+       io.in.desired_access            = SEC_RIGHTS_FILE_ALL;
+       io.in.file_attributes           = FILE_ATTRIBUTE_NORMAL;
+       io.in.share_access              = NTCREATEX_SHARE_ACCESS_READ |
+                                         NTCREATEX_SHARE_ACCESS_WRITE |
+                                         NTCREATEX_SHARE_ACCESS_DELETE;
+       io.in.create_disposition        = NTCREATEX_DISP_OPEN_IF;
+       io.in.create_options            = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
+                                         NTCREATEX_OPTIONS_ASYNC_ALERT |
+                                         NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
+                                         0x00200000;
+       io.in.fname                     = fname;
+
+       status = smb2_create(tree, mem_ctx, &io);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+       /*CHECK_VAL(io.out.reserved, 0);*/
+       CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_CREATED);
+       CHECK_VAL(io.out.alloc_size, 0);
+       CHECK_VAL(io.out.size, 0);
+       CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+       CHECK_VAL(io.out.reserved2, 0);
+       CHECK_VAL(break_info.count, 0);
+
+       h1 = io.out.file.handle;
+
+       ZERO_STRUCT(io.in.blobs);
+       status = smb2_create(tree, mem_ctx, &io);
+       CHECK_VAL(break_info.count, 1);
+       CHECK_VAL(break_info.failures, 0);
+       CHECK_VAL(break_info.level, SMB2_OPLOCK_LEVEL_II);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(io.out.oplock_level, SMB2_OPLOCK_LEVEL_II);
+       /*CHECK_VAL(io.out.reserved, 0);*/
+       CHECK_VAL(io.out.create_action, NTCREATEX_ACTION_EXISTED);
+       CHECK_VAL(io.out.alloc_size, 0);
+       CHECK_VAL(io.out.size, 0);
+       CHECK_VAL(io.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+       CHECK_VAL(io.out.reserved2, 0);
+
+       h2 = io.out.file.handle;
+
+done:
+       talloc_free(mem_ctx);
+
+       smb2_util_close(tree, h1);
+       smb2_util_close(tree, h2);
+       smb2_util_unlink(tree, fname);
+       return ret;
+}
diff --git a/source4/torture/smb2/persistent_handles.c b/source4/torture/smb2/persistent_handles.c
new file mode 100644 (file)
index 0000000..249ddd1
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+   Unix SMB/CIFS implementation.
+
+   test suite for SMB2 persistent file handles
+
+   Copyright (C) Stefan Metzmacher 2008
+
+   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/>.
+*/
+
+#include "includes.h"
+#include "librpc/gen_ndr/security.h"
+#include "libcli/smb2/smb2.h"
+#include "libcli/smb2/smb2_calls.h"
+#include "torture/torture.h"
+#include "torture/smb2/proto.h"
+#include "param/param.h"
+
+#define CHECK_VAL(v, correct) do { \
+       if ((v) != (correct)) { \
+               torture_result(tctx, TORTURE_FAIL, "(%s): wrong value for %s got 0x%x - should be 0x%x\n", \
+                               __location__, #v, (int)v, (int)correct); \
+               ret = false; \
+       }} while (0)
+
+#define CHECK_STATUS(status, correct) do { \
+       if (!NT_STATUS_EQUAL(status, correct)) { \
+               torture_result(tctx, TORTURE_FAIL, __location__": Incorrect status %s - should be %s", \
+                      nt_errstr(status), nt_errstr(correct)); \
+               ret = false; \
+               goto done; \
+       }} while (0)
+
+/* 
+   basic testing of SMB2 persistent file handles
+   regarding the position information on the handle
+*/
+bool torture_smb2_persistent_handles1(struct torture_context *tctx,
+                                     struct smb2_tree *tree1,
+                                     struct smb2_tree *tree2)
+{
+       TALLOC_CTX *mem_ctx = talloc_new(tctx);
+       struct smb2_handle h1, h2;
+       struct smb2_create io1, io2;
+       NTSTATUS status;
+       const char *fname = "persistent_handles.dat";
+       DATA_BLOB b;
+       union smb_fileinfo qfinfo;
+       union smb_setfileinfo sfinfo;
+       bool ret = true;
+       uint64_t pos;
+
+       smb2_util_unlink(tree1, fname);
+
+       ZERO_STRUCT(io1);
+       io1.in.security_flags           = 0x00;
+       io1.in.oplock_level             = SMB2_OPLOCK_LEVEL_BATCH;
+       io1.in.impersonation_level      = NTCREATEX_IMPERSONATION_IMPERSONATION;
+       io1.in.create_flags             = 0x00000000;
+       io1.in.reserved                 = 0x00000000;
+       io1.in.desired_access           = SEC_RIGHTS_FILE_ALL;
+       io1.in.file_attributes          = FILE_ATTRIBUTE_NORMAL;
+       io1.in.share_access             = NTCREATEX_SHARE_ACCESS_READ |
+                                         NTCREATEX_SHARE_ACCESS_WRITE |
+                                         NTCREATEX_SHARE_ACCESS_DELETE;
+       io1.in.create_disposition       = NTCREATEX_DISP_OPEN_IF;
+       io1.in.create_options           = NTCREATEX_OPTIONS_SEQUENTIAL_ONLY |
+                                         NTCREATEX_OPTIONS_ASYNC_ALERT |
+                                         NTCREATEX_OPTIONS_NON_DIRECTORY_FILE |
+                                         0x00200000;
+       io1.in.fname                    = fname;
+
+       b = data_blob_talloc(mem_ctx, NULL, 16);
+       SBVAL(b.data, 0, 0);
+       SBVAL(b.data, 8, 0);
+
+       status = smb2_create_blob_add(tree1, &io1.in.blobs,
+                                     SMB2_CREATE_TAG_DHNQ,
+                                     b);
+       CHECK_STATUS(status, NT_STATUS_OK);
+
+       status = smb2_create(tree1, mem_ctx, &io1);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(io1.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+       /*CHECK_VAL(io1.out.reserved, 0);*/
+       CHECK_VAL(io1.out.create_action, NTCREATEX_ACTION_CREATED);
+       CHECK_VAL(io1.out.alloc_size, 0);
+       CHECK_VAL(io1.out.size, 0);
+       CHECK_VAL(io1.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+       CHECK_VAL(io1.out.reserved2, 0);
+
+       /* TODO: check extra blob content */
+
+       h1 = io1.out.file.handle;
+
+       ZERO_STRUCT(qfinfo);
+       qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
+       qfinfo.generic.in.file.handle = h1;
+       status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(qfinfo.position_information.out.position, 0);
+       pos = qfinfo.position_information.out.position;
+       torture_comment(tctx, "position: %llu\n",
+                       (unsigned long long)pos);
+
+       ZERO_STRUCT(sfinfo);
+       sfinfo.generic.level = RAW_SFILEINFO_POSITION_INFORMATION;
+       sfinfo.generic.in.file.handle = h1;
+       sfinfo.position_information.in.position = 0x1000;
+       status = smb2_setinfo_file(tree1, &sfinfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+
+       ZERO_STRUCT(qfinfo);
+       qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
+       qfinfo.generic.in.file.handle = h1;
+       status = smb2_getinfo_file(tree1, mem_ctx, &qfinfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(qfinfo.position_information.out.position, 0x1000);
+       pos = qfinfo.position_information.out.position;
+       torture_comment(tctx, "position: %llu\n",
+                       (unsigned long long)pos);
+
+       talloc_free(tree1);
+       tree1 = NULL;
+
+       ZERO_STRUCT(qfinfo);
+       qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
+       qfinfo.generic.in.file.handle = h1;
+       status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo);
+       CHECK_STATUS(status, NT_STATUS_FILE_CLOSED);
+
+       ZERO_STRUCT(io2);
+       io2.in.fname = fname;
+
+       b = data_blob_talloc(tctx, NULL, 16);
+       SBVAL(b.data, 0, h1.data[0]);
+       SBVAL(b.data, 8, h1.data[1]);
+
+       status = smb2_create_blob_add(tree2, &io2.in.blobs,
+                                     SMB2_CREATE_TAG_DHNC,
+                                     b);
+       CHECK_STATUS(status, NT_STATUS_OK);
+
+       status = smb2_create(tree2, mem_ctx, &io2);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(io2.out.oplock_level, SMB2_OPLOCK_LEVEL_BATCH);
+       CHECK_VAL(io2.out.reserved, 0x00);
+       CHECK_VAL(io2.out.create_action, NTCREATEX_ACTION_EXISTED);
+       CHECK_VAL(io2.out.alloc_size, 0);
+       CHECK_VAL(io2.out.size, 0);
+       CHECK_VAL(io2.out.file_attr, FILE_ATTRIBUTE_ARCHIVE);
+       CHECK_VAL(io2.out.reserved2, 0);
+
+       h2 = io2.out.file.handle;
+
+       ZERO_STRUCT(qfinfo);
+       qfinfo.generic.level = RAW_FILEINFO_POSITION_INFORMATION;
+       qfinfo.generic.in.file.handle = h2;
+       status = smb2_getinfo_file(tree2, mem_ctx, &qfinfo);
+       CHECK_STATUS(status, NT_STATUS_OK);
+       CHECK_VAL(qfinfo.position_information.out.position, 0x1000);
+       pos = qfinfo.position_information.out.position;
+       torture_comment(tctx, "position: %llu\n",
+                       (unsigned long long)pos);
+
+       smb2_util_close(tree2, h2);
+
+       talloc_free(mem_ctx);
+
+       smb2_util_unlink(tree2, fname);
+done:
+       return ret;
+}
index 0f4c9fefdfea60d51d6ca59e38cf2653999de06e..889d343a497ebe0b3c6c5e3804f8b276563a2617 100644 (file)
@@ -207,7 +207,7 @@ bool torture_smb2_scan(struct torture_context *torture)
        status = smb2_connect(mem_ctx, host, share, 
                              lp_resolve_context(torture->lp_ctx), 
                              credentials, &tree, 
-                             event_context_find(mem_ctx));
+                             torture->ev);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Connection failed - %s\n", nt_errstr(status));
                return false;
@@ -224,7 +224,7 @@ bool torture_smb2_scan(struct torture_context *torture)
                        status = smb2_connect(mem_ctx, host, share, 
                                              lp_resolve_context(torture->lp_ctx), 
                                              credentials, &tree, 
-                                             event_context_find(mem_ctx));
+                                             torture->ev);
                        if (!NT_STATUS_IS_OK(status)) {
                                printf("Connection failed - %s\n", nt_errstr(status));
                                return false;
index d07611264bcca226eb9b1d444f07459988b382a2..f406b7d6e82fd180370cb59dfc1d30507a291967 100644 (file)
@@ -47,9 +47,9 @@ static bool wrap_simple_1smb2_test(struct torture_context *torture_ctx,
 }
 
 struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite,
-                                                          const char *name,
-                                                          bool (*run) (struct torture_context *,
-                                                                       struct smb2_tree *))
+                                                 const char *name,
+                                                 bool (*run)(struct torture_context *,
+                                                             struct smb2_tree *))
 {
        struct torture_test *test; 
        struct torture_tcase *tcase;
@@ -69,6 +69,61 @@ struct torture_test *torture_suite_add_1smb2_test(struct torture_suite *suite,
        return test;
 }
 
+
+static bool wrap_simple_2smb2_test(struct torture_context *torture_ctx,
+                                  struct torture_tcase *tcase,
+                                  struct torture_test *test)
+{
+       bool (*fn) (struct torture_context *, struct smb2_tree *, struct smb2_tree *);
+       bool ret;
+
+       struct smb2_tree *tree1;
+       struct smb2_tree *tree2;
+       TALLOC_CTX *mem_ctx = talloc_new(torture_ctx);
+
+       if (!torture_smb2_connection(torture_ctx, &tree1) ||
+           !torture_smb2_connection(torture_ctx, &tree2)) {
+               return false;
+       }
+
+       talloc_steal(mem_ctx, tree1);
+       talloc_steal(mem_ctx, tree2);
+
+       fn = test->fn;
+
+       ret = fn(torture_ctx, tree1, tree2);
+
+       /* the test may already closed some of the connections */
+       talloc_free(mem_ctx);
+
+       return ret;
+}
+
+
+_PUBLIC_ struct torture_test *torture_suite_add_2smb2_test(struct torture_suite *suite,
+                                                          const char *name,
+                                                          bool (*run)(struct torture_context *,
+                                                                      struct smb2_tree *,
+                                                                      struct smb2_tree *))
+{
+       struct torture_test *test;
+       struct torture_tcase *tcase;
+
+       tcase = torture_suite_add_tcase(suite, name);
+
+       test = talloc(tcase, struct torture_test);
+
+       test->name = talloc_strdup(test, name);
+       test->description = NULL;
+       test->run = wrap_simple_2smb2_test;
+       test->fn = run;
+       test->dangerous = false;
+
+       DLIST_ADD_END(tcase->tests, test, struct torture_test *);
+
+       return test;
+}
+
 NTSTATUS torture_smb2_init(void)
 {
        struct torture_suite *suite = torture_suite_create(talloc_autofree_context(), "SMB2");
@@ -82,6 +137,8 @@ NTSTATUS torture_smb2_init(void)
        torture_suite_add_simple_test(suite, "FIND", torture_smb2_find);
        torture_suite_add_suite(suite, torture_smb2_lock_init());
        torture_suite_add_simple_test(suite, "NOTIFY", torture_smb2_notify);
+       torture_suite_add_2smb2_test(suite, "PERSISTENT-HANDLES1", torture_smb2_persistent_handles1);
+       torture_suite_add_1smb2_test(suite, "OPLOCK-BATCH1", torture_smb2_oplock_batch1);
 
        suite->description = talloc_strdup(suite, "SMB2-specific tests");
 
index f85b1c42ff9c56f6f6133463ceb96fcb8bdff10f..6ac3926c9883ce9b07ab8114798fa13f140aa030 100644 (file)
@@ -314,7 +314,7 @@ bool torture_smb2_connection(struct torture_context *tctx, struct smb2_tree **tr
        status = smb2_connect(tctx, host, share, 
                              lp_resolve_context(tctx->lp_ctx),
                              credentials, tree, 
-                             event_context_find(tctx));
+                             tctx->ev);
        if (!NT_STATUS_IS_OK(status)) {
                printf("Failed to connect to SMB2 share \\\\%s\\%s - %s\n",
                       host, share, nt_errstr(status));
index 8f0b988ab412ac2dd45f58df6aabe0fe229159d2..5c5f96c5058da758de0f943dbd4d2c0eb16735cb 100644 (file)
@@ -35,6 +35,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,
@@ -672,7 +674,7 @@ int main(int argc,char *argv[])
                exit(1);
        }
 
-       torture = torture_context_init(talloc_autofree_context(), ui_ops);
+       torture = torture_context_init(event_context_init(NULL), ui_ops);
        if (basedir != NULL) {
                if (basedir[0] != '/') {
                        fprintf(stderr, "Please specify an absolute path to --basedir\n");
index a7025aac95281f4829a95ddb56fdd2dca9294cec..abbd814747666fc11fc8ced46a02ab73d028b721 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);
@@ -578,6 +578,3 @@ struct torture_test *torture_tcase_add_simple_test(struct torture_tcase *tcase,
 
        return test;
 }
-
-
-
index 6645d9b012852eb9ff52577cded922525235ba3c..15b04c23974c25edc7a5f4f729fc5ee800233498 100644 (file)
@@ -253,6 +253,15 @@ void torture_result(struct torture_context *test,
        } \
        } while(0)
 
+#define torture_assert_mem_equal(torture_ctx,got,expected,len,cmt)\
+       do { const void *__got = (got), *__expected = (expected); \
+       if (memcmp(__got, __expected, len) != 0) { \
+               torture_result(torture_ctx, TORTURE_FAIL, \
+                                          __location__": "#got" of len %d did not match"#expected": %s", len, cmt); \
+               return false; \
+       } \
+       } while(0)
+
 #define torture_assert_file_contains_text(torture_ctx,filename,expected,cmt)\
        do { \
        char *__got; \
@@ -381,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 c14be9e2d0726c38ce735d948f1af848db9b3def..d7482ddcf1f5e98b035435dedce835ce2b098da1 100644 (file)
@@ -63,8 +63,8 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx)
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        cmdline_credentials, 
-                                       lp_resolve_context(tctx->lp_ctx), NULL, 
-                                       &options);
+                                       lp_resolve_context(tctx->lp_ctx),
+                                       tctx->ev, &options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index a1333ac5bdfc91faaf5cbc63c4b16e366f562fd9..d4f19bb57a1ced02656c7a0283ee0294fc49f591 100644 (file)
@@ -84,7 +84,7 @@ static struct smbcli_state *connect_to_server(struct torture_context *tctx,
                                        lp_smb_ports(tctx->lp_ctx),
                                        share, NULL,
                                        creds, lp_resolve_context(tctx->lp_ctx),
-                                       NULL, &options);
+                                       tctx->ev, &options);
 
        if (!NT_STATUS_IS_OK(status)) {
                printf("failed to connect to //%s/%s: %s\n",
index 477a828120173cb97715d11a90f7bf107c443450..1009fcf9f11b120194559e232cb61487e50303f0 100644 (file)
 #ifndef _TORTURE_PROVISION_H_
 #define _TORTURE_PROVISION_H_
 
-struct provision_settings {
-       const char *dns_name;
-       const char *site_name;
-       const char *root_dn_str; 
-       const char *domain_dn_str;
-       const char *config_dn_str;
-       const char *schema_dn_str;
-       const struct GUID *invocation_id;
-       const char *netbios_name;
-       const char *host_ip;
-       const char *realm;
-       const char *domain;
-       const struct GUID *ntds_guid;
-       const char *ntds_dn_str;
-       const char *machine_password;
-       const char *targetdir;
-};
-
-NTSTATUS provision_bare(TALLOC_CTX *mem_ctx, struct loadparm_context *lp_ctx,
-                                               struct provision_settings *settings);
-
-
 /**
   setup a directory ready for a test
 */
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 0fe2148b75116999118676f2aa29fb29d0c02156..87378aadb8a98baa65fed769591b8b052e5f09c2 100644 (file)
@@ -181,7 +181,8 @@ static bool torture_winbind_struct_netbios_name(struct torture_context *torture)
        expected = torture_setting_string(torture,
                                          "winbindd netbios name",
                                          lp_netbios_name(torture->lp_ctx));
-
+       expected = strupper_talloc(torture, expected);
+       
        torture_assert_str_equal(torture,
                                 rep.data.netbios_name, expected,
                                 "winbindd's netbios name doesn't match");
@@ -261,7 +262,7 @@ static bool torture_winbind_struct_check_machacc(struct torture_context *torture
 
        torture_assert_str_equal(torture,
                                 rep.data.auth.error_string,
-                                nt_errstr(NT_STATUS_OK),
+                                get_friendly_nt_error_msg(NT_STATUS_OK),
                                 "WINBINDD_CHECK_MACHACC ok: error_string");
 
        torture_assert_int_equal(torture,
@@ -294,6 +295,10 @@ static bool get_trusted_domains(struct torture_context *torture,
        DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
 
        extra_data = (char *)rep.extra_data.data;
+       if (!extra_data) {
+               return true;
+       }
+
        torture_assert(torture, extra_data, "NULL trust list");
 
        while (next_token(&extra_data, line, "\n", sizeof(fstring))) {
@@ -355,7 +360,6 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture
        DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
 
        list1 = (char *)rep.extra_data.data;
-       torture_assert(torture, list1, "NULL trust list");
 
        torture_comment(torture, "%s\n", list1);
 
@@ -367,7 +371,6 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture
        DO_STRUCT_REQ_REP(WINBINDD_LIST_TRUSTDOM, &req, &rep);
 
        list2 = (char *)rep.extra_data.data;
-       torture_assert(torture, list2, "NULL trust list");
 
        /*
         * The list_all_domains parameter should be ignored
@@ -380,7 +383,7 @@ static bool torture_winbind_struct_list_trustdom(struct torture_context *torture
        ok = get_trusted_domains(torture, &listd);
        torture_assert(torture, ok, "failed to get trust list");
 
-       for (i=0; listd[i].netbios_name; i++) {
+       for (i=0; listd && listd[i].netbios_name; i++) {
                if (i == 0) {
                        struct dom_sid *builtin_sid;
 
@@ -423,7 +426,7 @@ static bool torture_winbind_struct_domain_info(struct torture_context *torture)
        ok = get_trusted_domains(torture, &listd);
        torture_assert(torture, ok, "failed to get trust list");
 
-       for (i=0; listd[i].netbios_name; i++) {
+       for (i=0; listd && listd[i].netbios_name; i++) {
                struct winbindd_request req;
                struct winbindd_response rep;
                struct dom_sid *sid;
@@ -484,14 +487,14 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture)
        bool ok;
        bool strict = torture_setting_bool(torture, "strict mode", false);
        struct torture_trust_domain *listd = NULL;
-       uint32_t i;
+       uint32_t i, count = 0;
 
        torture_comment(torture, "Running WINBINDD_GETDCNAME (struct based)\n");
 
        ok = get_trusted_domains(torture, &listd);
        torture_assert(torture, ok, "failed to get trust list");
 
-       for (i=0; listd[i].netbios_name; i++) {
+       for (i=0; listd && listd[i].netbios_name; i++) {
                struct winbindd_request req;
                struct winbindd_response rep;
 
@@ -511,8 +514,13 @@ static bool torture_winbind_struct_getdcname(struct torture_context *torture)
                /* TODO: check rep.data.dc_name; */
                torture_comment(torture, "DOMAIN '%s' => DCNAME '%s'\n",
                                req.domain_name, rep.data.dc_name);
+               count++;
        }
 
+       if (strict) {
+               torture_assert(torture, count > 0,
+                              "WiNBINDD_GETDCNAME was not tested");
+       }
        return true;
 }
 
@@ -529,7 +537,7 @@ static bool torture_winbind_struct_dsgetdcname(struct torture_context *torture)
        ok = get_trusted_domains(torture, &listd);
        torture_assert(torture, ok, "failed to get trust list");
 
-       for (i=0; listd[i].netbios_name; i++) {
+       for (i=0; listd && listd[i].netbios_name; i++) {
                struct winbindd_request req;
                struct winbindd_response rep;
 
index e0865c441662a2b328a1d8c83edf5bc7ea1f26ac..a87b2665681fa3c33b25f1e4dbe9838e7fb51934 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
@@ -102,7 +104,8 @@ static const struct net_functable net_functable[] = {
        {"time", "get remote server's time\n", net_time, net_time_usage},
        {"join", "join a domain\n", net_join, net_join_usage},
        {"samdump", "dump the sam of a domain\n", net_samdump, net_samdump_usage},
-       {"samsync", "synchronise into the local ldb the sam of a domain\n", net_samsync_ldb, net_samsync_ldb_usage},
+       {"vampire", "join and syncronise an AD domain onto the local server\n", net_vampire, net_vampire_usage},
+       {"samsync", "synchronise into the local ldb the sam of an NT4 domain\n", net_samsync_ldb, net_samsync_ldb_usage},
        {"user", "manage user accounts\n", net_user, net_user_usage},
        {NULL, NULL, NULL, NULL}
 };
@@ -139,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[] = {
@@ -182,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;
+       ctx->event_ctx = ev;
 
        rc = net_run_function(ctx, argc_new-1, argv_new+1, net_functable, net_usage);
 
@@ -200,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..309bee277c3e5214d85ac69164b3bd4f821ae85c 100644 (file)
@@ -22,9 +22,9 @@
 #define _UTIL_NET_H
 
 struct net_context {
-       TALLOC_CTX *mem_ctx;
        struct cli_credentials *credentials;
        struct loadparm_context *lp_ctx;
+       struct event_context *event_ctx;
 };
 
 struct net_functable {
index 08a4fbd4a16bd578994cc88c03044bec286c17cb..ad63340089907b550122218fdd5bb8e2ef440113 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(ctx->event_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;
@@ -100,3 +101,70 @@ int net_join_help(struct net_context *ctx, int argc, const char **argv)
        d_printf("Joins domain as either member or backup domain controller.\n");
        return 0;       
 }
+
+int net_vampire(struct net_context *ctx, int argc, const char **argv) 
+{
+       NTSTATUS status;
+       struct libnet_context *libnetctx;
+       struct libnet_Vampire *r;
+       char *tmp, *targetdir = NULL;
+       const char *domain_name;
+
+       switch (argc) {
+               case 0: /* no args -> fail */
+                       return net_vampire_usage(ctx, argc, argv);
+               case 1: /* only DOMAIN */
+                       tmp = talloc_strdup(ctx, argv[0]);
+                       break;
+               case 2: /* domain and target dir */
+                       tmp = talloc_strdup(ctx, argv[0]);
+                       targetdir = talloc_strdup(ctx, argv[1]);
+                       break;
+               default: /* too many args -> fail */
+                       return net_vampire_usage(ctx, argc, argv);
+       }
+
+       domain_name = tmp;
+
+       libnetctx = libnet_context_init(NULL, ctx->lp_ctx);
+       if (!libnetctx) {
+               return -1;      
+       }
+       libnetctx->cred = ctx->credentials;
+       r = talloc(ctx, struct libnet_Vampire);
+       if (!r) {
+               return -1;
+       }
+       /* prepare parameters for the vampire */
+       r->in.netbios_name  = lp_netbios_name(ctx->lp_ctx);
+       r->in.domain_name   = domain_name;
+       r->in.targetdir     = targetdir;
+       r->out.error_string = NULL;
+
+       /* do the domain vampire */
+       status = libnet_Vampire(libnetctx, r, r);
+       
+       if (!NT_STATUS_IS_OK(status)) {
+               d_fprintf(stderr, "Vampire of domain failed: %s\n",
+                         r->out.error_string ? r->out.error_string : nt_errstr(status));
+               talloc_free(r);
+               talloc_free(libnetctx);
+               return -1;
+       }
+       d_printf("Vampired domain %s (%s)\n", r->out.domain_name, dom_sid_string(ctx, r->out.domain_sid));
+
+       talloc_free(libnetctx);
+       return 0;
+}
+
+int net_vampire_usage(struct net_context *ctx, int argc, const char **argv)
+{
+       d_printf("net vampire <domain> [options]\n");
+       return 0;       
+}
+
+int net_vampire_help(struct net_context *ctx, int argc, const char **argv)
+{
+       d_printf("Vampires domain as either member or backup domain controller.\n");
+       return 0;       
+}
index 1fcb772e4c2b016c2037807906f4358ba741fdee..55f7c3c31d610898eb6b86cf5945fcc907006a15 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(ctx->event_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(ctx->event_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..92e6e7748192bd47a3430366697365bdf6fd0c73 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(ctx->event_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..c4b8ecb0c2b3714baadf871cad0468e2eaeca25a 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(ctx->event_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(ctx->event_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 c798112d7b0eb5f85c95f657d4ace50a4db6db87..14f6a07e4bbe92ffbe5cc4939c5fa3b33c61cef8 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(ctx->event_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(ctx->event_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(ctx->event_ctx, ctx->lp_ctx);
        if (!libnetctx) {
                return -1;      
        }
@@ -169,7 +170,7 @@ int net_samsync_ldb(struct net_context *ctx, int argc, const char **argv)
 
 int net_samsync_ldb_usage(struct net_context *ctx, int argc, const char **argv)
 {
-       d_printf("net samsync_ldb\n");
+       d_printf("net samsync\n");
        return 0;       
 }
 
index fe03e0dbbeb23ddccf97969d05a7753e098160ae..980e06602d91f3be3c9faa6b599f3c17f1af45c5 100644 (file)
@@ -24,6 +24,7 @@
 #include "includes.h"
 #include "lib/cmdline/popt_common.h"
 #include "lib/socket/socket.h"
+#include "lib/events/events.h"
 #include "system/network.h"
 #include "system/locale.h"
 #include "lib/socket/netif.h"
@@ -180,7 +181,7 @@ static NTSTATUS do_node_query(struct nbt_name_socket *nbtsock,
 }
 
 
-static bool process_one(struct loadparm_context *lp_ctx, 
+static bool process_one(struct loadparm_context *lp_ctx, struct event_context *ev,
                        struct interface *ifaces, const char *name, int nbt_port)
 {
        TALLOC_CTX *tmp_ctx = talloc_new(NULL);
@@ -211,7 +212,7 @@ static bool process_one(struct loadparm_context *lp_ctx,
                node_name = talloc_strdup(tmp_ctx, name);
        }
 
-       nbtsock = nbt_name_socket_init(tmp_ctx, NULL, lp_iconv_convenience(lp_ctx));
+       nbtsock = nbt_name_socket_init(tmp_ctx, ev, lp_iconv_convenience(lp_ctx));
        
        if (options.root_port) {
                all_zero_addr = socket_address_from_strings(tmp_ctx, nbtsock->sock->backend_name, 
@@ -271,6 +272,7 @@ int main(int argc, const char *argv[])
 {
        bool ret = true;
        struct interface *ifaces;
+       struct event_context *ev;
        poptContext pc;
        int opt;
        enum {
@@ -356,13 +358,17 @@ int main(int argc, const char *argv[])
        }
 
        load_interfaces(NULL, lp_interfaces(cmdline_lp_ctx), &ifaces);
-       
+
+       ev = event_context_init(talloc_autofree_context());
+
        while (poptPeekArg(pc)) {
                const char *name = poptGetArg(pc);
 
-               ret &= process_one(cmdline_lp_ctx, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
+               ret &= process_one(cmdline_lp_ctx, ev, ifaces, name, lp_nbt_port(cmdline_lp_ctx));
        }
 
+       talloc_free(ev);
+
        talloc_free(ifaces);
 
        poptFreeContext(pc);
index 0c9a41fd70d7143cc550acc5783e7dfd81b3320c..07c0e4f31e175923dab6458563d98010c7446eac 100644 (file)
@@ -461,6 +461,10 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                return;
        }
 
+       ev = event_context_init(state);
+       if (!ev) {
+               exit(1);
+       }
        /* setup gensec */
        if (!(state->gensec_state)) {
                switch (stdio_helper_mode) {
@@ -468,7 +472,7 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                case NTLMSSP_CLIENT_1:
                        /* setup the client side */
 
-                       nt_status = gensec_client_start(NULL, &state->gensec_state, NULL, lp_ctx);
+                       nt_status = gensec_client_start(NULL, &state->gensec_state, ev, lp_ctx);
                        if (!NT_STATUS_IS_OK(nt_status)) {
                                exit(1);
                        }
@@ -476,10 +480,6 @@ static void manage_gensec_request(enum stdio_helper_mode stdio_helper_mode,
                        break;
                case GSS_SPNEGO_SERVER:
                case SQUID_2_5_NTLMSSP:
-                       ev = event_context_init(state);
-                       if (!ev) {
-                               exit(1);
-                       }
                        msg = messaging_client_init(state, lp_messaging_path(state, lp_ctx), 
                                                    lp_iconv_convenience(lp_ctx), ev);
                        if (!msg) {
index 92ac41f1d2522ef4b28f40fff5eb4bafabb61ae5..333a86445a244037ad5340e6c7ad1966b5e6c4b6 100644 (file)
@@ -158,6 +158,7 @@ static struct dom_sid *idmap_msg_get_dom_sid(TALLOC_CTX *mem_ctx,
  * \return allocated idmap_context on success, NULL on error
  */
 struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
+                                struct event_context *ev_ctx,
                struct loadparm_context *lp_ctx)
 {
        struct idmap_context *idmap_ctx;
@@ -169,7 +170,7 @@ struct idmap_context *idmap_init(TALLOC_CTX *mem_ctx,
 
        idmap_ctx->lp_ctx = lp_ctx;
 
-       idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, lp_ctx,
+       idmap_ctx->ldb_ctx = ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx,
                                              lp_idmap_url(lp_ctx),
                                              system_session(mem_ctx, lp_ctx),
                                              NULL, 0, NULL);
@@ -654,7 +655,7 @@ NTSTATUS idmap_xids_to_sids(struct idmap_context *idmap_ctx,
                                                        &id[i].sid);
                }
                if (!NT_STATUS_IS_OK(id[i].status)) {
-                       DEBUG(1, ("idmapping failed for id[%d]\n", i));
+                       DEBUG(1, ("idmapping xid_to_sid failed for id[%d]\n", i));
                        error_count++;
                }
        }
@@ -699,7 +700,7 @@ NTSTATUS idmap_sids_to_xids(struct idmap_context *idmap_ctx,
                                                        &id[i].unixid);
                }
                if (!NT_STATUS_IS_OK(id[i].status)) {
-                       DEBUG(1, ("idmapping failed for id[%d]\n", i));
+                       DEBUG(1, ("idmapping sid_to_xid failed for id[%d]\n", i));
                        error_count++;
                }
        }
index 6eae92cc68c4ed0f7221ace5ecce031c0e7bc1f9..13dbe0b921455a3e8448e66443d4ac32b37c7632 100644 (file)
@@ -31,6 +31,8 @@ struct idmap_context {
        struct dom_sid *unix_users_sid;
 };
 
+struct event_context;
+
 #include "winbind/idmap_proto.h"
 
 #endif
index 662dd111dda95ee2e2a0a48abd68dba8ed38efee..25d52a16b5f900d828253cc8cacaf290beb56392 100644 (file)
@@ -305,73 +305,6 @@ NTSTATUS wb_lsa_lookupnames_recv(struct composite_context *c,
        talloc_free(c);
        return status;
 }
-
-
-#if 0
-
-struct cmd_checkmachacc_state {
-       struct composite_context *ctx;
-       struct wbsrv_call *call;
-       struct wbsrv_domain *domain;
-};
-
-static void cmd_checkmachacc_recv_init(struct composite_context *ctx);
-
- struct composite_context *wb_cmd_checkmachacc_send(struct wbsrv_call *call)
-{
-       struct composite_context *result, *ctx;
-       struct cmd_checkmachacc_state *state;
-       struct wbsrv_service *service = call->wbconn->listen_socket->service;
-
-       result = composite_create(mem_ctx, call->event_ctx;
-       if (result == NULL) goto failed;
-
-       state = talloc(result, struct cmd_checkmachacc_state);
-       if (state == NULL) goto failed;
-       state->ctx = result;
-       result->private_data = state;
-       state->call = call;
-
-       state->domain = service->domains;
-
-       ctx = wb_init_domain_send(service, state->domain);
-       if (ctx == NULL) goto failed;
-       ctx->async.fn = cmd_checkmachacc_recv_init;
-       ctx->async.private_data = state;
-
-       return result;
-
- failed:
-       talloc_free(result);
-       return NULL;
-}
-
-static void cmd_checkmachacc_recv_init(struct composite_context *ctx)
-{
-       struct cmd_checkmachacc_state *state =
-               talloc_get_type(ctx->async.private_data,
-                               struct cmd_checkmachacc_state);
-
-       state->ctx->status = wb_init_domain_recv(ctx);
-       if (!composite_is_ok(state->ctx)) return;
-
-       composite_done(state->ctx);
-}
-
- NTSTATUS wb_cmd_checkmachacc_recv(struct composite_context *c)
-{
-       NTSTATUS status = composite_wait(c);
-       talloc_free(c);
-       return status;
-}
-
- NTSTATUS wb_cmd_checkmachacc(struct wbsrv_call *call)
-{
-       struct composite_context *c = wb_cmd_checkmachacc_send(call);
-       return wb_cmd_checkmachacc_recv(c);
-}
-#endif
-
 struct samr_getuserdomgroups_state {
        struct composite_context *ctx;
        struct dcerpc_pipe *samr_pipe;
index fb2dc197c9edfc4e1367e08c0861ed8e6973b4eb..7d821537f04d117d604abaf542b3879023c44cc7 100644 (file)
@@ -92,7 +92,8 @@ static void cmd_getpwnam_recv_domain(struct composite_context *ctx)
                return;
        }
 
-       user_info->in.user_name = user_name;
+       user_info->in.level = USER_INFO_BY_NAME;
+       user_info->in.data.user_name = user_name;
        user_info->in.domain_name = domain->libnet_ctx->samr.name;
        state->workgroup_name = talloc_strdup(state,
                        domain->libnet_ctx->samr.name);
index c250af1b5650e8745ad9141a9fdc8999ad48d570..15cc592cf69b7c74ed917a7665533aada9272e63 100644 (file)
@@ -34,6 +34,7 @@ struct cmd_getpwuid_state {
        struct composite_context *ctx;
        struct wbsrv_service *service;
        uid_t uid;
+       struct dom_sid *sid;
        char *workgroup;
        struct wbsrv_domain *domain;
 
@@ -81,14 +82,13 @@ static void cmd_getpwuid_recv_sid(struct composite_context *ctx)
        struct cmd_getpwuid_state *state =
                talloc_get_type(ctx->async.private_data,
                                struct cmd_getpwuid_state);
-       struct dom_sid *sid;
 
        DEBUG(5, ("cmd_getpwuid_recv_sid called %p\n", ctx->private_data));
 
-       state->ctx->status = wb_uid2sid_recv(ctx, state, &sid);
+       state->ctx->status = wb_uid2sid_recv(ctx, state, &state->sid);
        if (!composite_is_ok(state->ctx)) return;
 
-       ctx = wb_sid2domain_send(state, state->service, sid);
+       ctx = wb_sid2domain_send(state, state->service, state->sid);
 
        composite_continue(state->ctx, ctx, cmd_getpwuid_recv_domain, state);
 }
@@ -110,7 +110,8 @@ static void cmd_getpwuid_recv_domain(struct composite_context *ctx)
        user_info = talloc(state, struct libnet_UserInfo);
        if (composite_nomem(user_info, state->ctx)) return;
 
-       user_info->in.user_name = state->domain->libnet_ctx->cred->username;
+       user_info->in.level = USER_INFO_BY_SID;
+       user_info->in.data.user_sid = state->sid;
        user_info->in.domain_name = state->domain->libnet_ctx->samr.name;
 
        /* We need the workgroup later, so copy it  */
index 83bd517a02315ea93f6e689c312fab203cbe5b89..8d0c1bd947c17eff426f5cf5ed69b6fe7e74433f 100644 (file)
@@ -143,7 +143,8 @@ static void cmd_list_trustdoms_recv_doms(struct rpc_request *req)
        state->domains = talloc_realloc(state, state->domains,
                                        struct wb_dom_info *,
                                        state->num_domains);
-       if (composite_nomem(state->domains, state->ctx)) return;
+       if (state->num_domains && 
+           composite_nomem(state->domains, state->ctx)) return;
 
        for (i=0; i<state->r.out.domains->count; i++) {
                int j = i+old_num_domains;
index 61b123a5020c9c8e1b79e5584dd15b80a85a1aca..a728f8abe4545116ed99ff3ac950a4f8fe750872 100644 (file)
@@ -62,8 +62,11 @@ struct composite_context *wb_init_lsa_send(TALLOC_CTX *mem_ctx,
 
        /* this will make the secondary connection on the same IPC$ share, 
           secured with SPNEGO or NTLMSSP */
-       ctx = dcerpc_secondary_connection_send(domain->netlogon_pipe,
-                                              domain->lsa_binding);
+       ctx = dcerpc_secondary_auth_connection_send(domain->netlogon_pipe,
+                                                   domain->lsa_binding,
+                                                   &ndr_table_lsarpc,
+                                                   domain->libnet_ctx->cred,
+                                                   domain->libnet_ctx->lp_ctx);
        composite_continue(state->ctx, ctx, init_lsa_recv_pipe, state);
        return result;
        
@@ -79,8 +82,8 @@ static void init_lsa_recv_pipe(struct composite_context *ctx)
                talloc_get_type(ctx->async.private_data,
                                struct init_lsa_state);
 
-       state->ctx->status = dcerpc_secondary_connection_recv(ctx, 
-                                                             &state->lsa_pipe);
+       state->ctx->status = dcerpc_secondary_auth_connection_recv(ctx, state,
+                                                                  &state->lsa_pipe);
        if (!composite_is_ok(state->ctx)) return;
                        
        state->handle = talloc(state, struct policy_handle);
index fc35f11db629ab3f7a29963ef45075bd5b65c055..8b82ab711e366fb86dfdb0cd8402f863308cc826 100644 (file)
@@ -151,8 +151,6 @@ struct composite_context *wb_init_domain_send(TALLOC_CTX *mem_ctx,
        state->domain->libnet_ctx->cred = cli_credentials_init(state->domain);
        if (state->domain->libnet_ctx->cred == NULL) goto failed;
 
-       cli_credentials_set_event_context(state->domain->libnet_ctx->cred, service->task->event_ctx);
-
        cli_credentials_set_conf(state->domain->libnet_ctx->cred, service->task->lp_ctx);
 
        /* Connect the machine account to the credentials */
@@ -211,7 +209,6 @@ static void init_domain_recv_netlogonpipe(struct composite_context *ctx)
                                                   &state->domain->netlogon_pipe);
        
        if (!composite_is_ok(state->ctx)) {
-               talloc_free(state->domain->netlogon_binding);
                return;
        }
        talloc_steal(state->domain->netlogon_pipe, state->domain->netlogon_binding);
index 62744297c64614c681490837e8fe89d1cdb94457..ee54bcd58f7818a1873b53c53e0f0aea007fc9e2 100644 (file)
@@ -214,14 +214,11 @@ NTSTATUS wb_cmd_pam_auth_crap_recv(struct composite_context *c,
 
 struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx,
                                               struct wbsrv_service *service,
-                                              const char *domain,
-                                              const char *user,
-                                              const char *password)
+                                              struct cli_credentials *credentials)
 {
-       struct cli_credentials *credentials;
        const char *workstation;
        NTSTATUS status;
-
+       const char *user, *domain;
        DATA_BLOB chal, nt_resp, lm_resp, names_blob;
        int flags = CLI_CRED_NTLM_AUTH;
        if (lp_client_lanman_auth(service->task->lp_ctx)) {
@@ -234,16 +231,6 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx,
 
        DEBUG(5, ("wbsrv_samba3_pam_auth called\n"));
 
-       credentials = cli_credentials_init(mem_ctx);
-       if (!credentials) {
-               return NULL;
-       }
-       cli_credentials_set_conf(credentials, service->task->lp_ctx);
-       cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
-       cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
-
-       cli_credentials_set_password(credentials, password, CRED_SPECIFIED);
-
        chal = data_blob_talloc(mem_ctx, NULL, 8);
        if (!chal.data) {
                return NULL;
@@ -269,7 +256,7 @@ struct composite_context *wb_cmd_pam_auth_send(TALLOC_CTX *mem_ctx,
                return NULL;
        }
        return wb_cmd_pam_auth_crap_send(mem_ctx, service,
-                                        0 /* logon parameters */, 
+                                        MSV1_0_ALLOW_WORKSTATION_TRUST_ACCOUNT|MSV1_0_ALLOW_SERVER_TRUST_ACCOUNT /* logon parameters */, 
                                         domain, user, workstation,
                                         chal, nt_resp, lm_resp);
 }
index 24074700fcd86c2968c826df8f6cc70ae5167e74..f0aaaa77780ca383e1a1d12615feccfb21ee9a77 100644 (file)
@@ -30,6 +30,8 @@
 #include "librpc/gen_ndr/netlogon.h"
 #include "libcli/security/security.h"
 #include "auth/pam_errors.h"
+#include "auth/credentials/credentials.h"
+#include "smbd/service_task.h"
 
 /* 
    Send off the reply to an async Samba3 query, handling filling in the PAM, NTSTATUS and string errors.
@@ -41,13 +43,14 @@ static void wbsrv_samba3_async_auth_epilogue(NTSTATUS status,
        struct winbindd_response *resp = &s3call->response;
        if (!NT_STATUS_IS_OK(status)) {
                resp->result = WINBINDD_ERROR;
-               WBSRV_SAMBA3_SET_STRING(resp->data.auth.nt_status_string,
-                                       nt_errstr(status));
-               WBSRV_SAMBA3_SET_STRING(resp->data.auth.error_string,
-                                       get_friendly_nt_error_msg(status));
        } else {
                resp->result = WINBINDD_OK;
        }
+       
+       WBSRV_SAMBA3_SET_STRING(resp->data.auth.nt_status_string,
+                               nt_errstr(status));
+       WBSRV_SAMBA3_SET_STRING(resp->data.auth.error_string,
+                               get_friendly_nt_error_msg(status));
 
        resp->data.auth.pam_error = nt_status_to_pam(status);
        resp->data.auth.nt_status = NT_STATUS_V(status);
@@ -110,10 +113,12 @@ NTSTATUS wbsrv_samba3_netbios_name(struct wbsrv_samba3_call *s3call)
 
 NTSTATUS wbsrv_samba3_priv_pipe_dir(struct wbsrv_samba3_call *s3call)
 {
-       s3call->response.result                 = WINBINDD_OK;
-       s3call->response.extra_data.data =
-               smbd_tmp_path(s3call, s3call->wbconn->lp_ctx, WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
-       NT_STATUS_HAVE_NO_MEMORY(s3call->response.extra_data.data);
+       char *path = smbd_tmp_path(s3call, s3call->wbconn->lp_ctx, WINBINDD_SAMBA3_PRIVILEGED_SOCKET);
+       NT_STATUS_HAVE_NO_MEMORY(path);
+       s3call->response.result          = WINBINDD_OK;
+       s3call->response.extra_data.data = path;
+               
+       s3call->response.length += strlen(path) + 1;
        return NT_STATUS_OK;
 }
 
@@ -123,41 +128,65 @@ NTSTATUS wbsrv_samba3_ping(struct wbsrv_samba3_call *s3call)
        return NT_STATUS_OK;
 }
 
-#if 0
-/* 
-   Validate that we have a working pipe to the domain controller.
-   Return any NT error found in the process
+/* Plaintext authentication 
+   
+   This interface is used by ntlm_auth in it's 'basic' authentication
+   mode, as well as by pam_winbind to authenticate users where we are
+   given a plaintext password.
 */
 
-static void checkmachacc_recv_creds(struct composite_context *ctx);
+static void check_machacc_recv(struct composite_context *ctx);
 
 NTSTATUS wbsrv_samba3_check_machacc(struct wbsrv_samba3_call *s3call)
 {
+       NTSTATUS status;
+       struct cli_credentials *creds;
        struct composite_context *ctx;
+       struct wbsrv_service *service =
+               s3call->wbconn->listen_socket->service;
+
+       /* Create a credentials structure */
+       creds = cli_credentials_init(s3call);
+       if (creds == NULL) {
+               return NT_STATUS_NO_MEMORY;
+       }
 
-       DEBUG(5, ("wbsrv_samba3_check_machacc called\n"));
+       cli_credentials_set_conf(creds, service->task->lp_ctx);
 
-       ctx = wb_cmd_checkmachacc_send(s3call->call);
-       NT_STATUS_HAVE_NO_MEMORY(ctx);
+       /* Connect the machine account to the credentials */
+       status = cli_credentials_set_machine_account(creds, service->task->lp_ctx);
+       if (!NT_STATUS_IS_OK(status)) {
+               talloc_free(creds);
+               return status;
+       }
 
-       ctx->async.fn = checkmachacc_recv_creds;
+       ctx = wb_cmd_pam_auth_send(s3call, service, creds);
+
+       if (!ctx) {
+               talloc_free(creds);
+               return NT_STATUS_NO_MEMORY;
+       }
+
+       ctx->async.fn = check_machacc_recv;
        ctx->async.private_data = s3call;
-       s3call->call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC;
+       s3call->flags |= WBSRV_CALL_FLAGS_REPLY_ASYNC;
        return NT_STATUS_OK;
 }
-       
-static void checkmachacc_recv_creds(struct composite_context *ctx)
+
+static void check_machacc_recv(struct composite_context *ctx)
 {
        struct wbsrv_samba3_call *s3call =
                talloc_get_type(ctx->async.private_data,
                                struct wbsrv_samba3_call);
        NTSTATUS status;
 
-       status = wb_cmd_checkmachacc_recv(ctx);
+       status = wb_cmd_pam_auth_recv(ctx);
+
+       if (!NT_STATUS_IS_OK(status)) goto done;
 
+ done:
        wbsrv_samba3_async_auth_epilogue(status, s3call);
 }
-#endif
 
 /*
   Find the name of a suitable domain controller, by query on the
@@ -543,6 +572,7 @@ NTSTATUS wbsrv_samba3_pam_auth(struct wbsrv_samba3_call *s3call)
        struct composite_context *ctx;
        struct wbsrv_service *service =
                s3call->wbconn->listen_socket->service;
+       struct cli_credentials *credentials;
        char *user, *domain;
 
        if (!wb_samba3_split_username(s3call, s3call->wbconn->lp_ctx,
@@ -551,8 +581,17 @@ NTSTATUS wbsrv_samba3_pam_auth(struct wbsrv_samba3_call *s3call)
                return NT_STATUS_NO_SUCH_USER;
        }
 
-       ctx = wb_cmd_pam_auth_send(s3call, service, domain, user,
-                                  s3call->request.data.auth.pass);
+       credentials = cli_credentials_init(s3call);
+       if (!credentials) {
+               return NT_STATUS_NO_MEMORY;
+       }
+       cli_credentials_set_conf(credentials, service->task->lp_ctx);
+       cli_credentials_set_domain(credentials, domain, CRED_SPECIFIED);
+       cli_credentials_set_username(credentials, user, CRED_SPECIFIED);
+
+       cli_credentials_set_password(credentials, s3call->request.data.auth.pass, CRED_SPECIFIED);
+
+       ctx = wb_cmd_pam_auth_send(s3call, service, credentials);
        NT_STATUS_HAVE_NO_MEMORY(ctx);
 
        ctx->async.fn = pam_auth_recv;
@@ -681,6 +720,9 @@ static void list_users_recv(struct composite_context *ctx)
        if (NT_STATUS_IS_OK(status)) {
                s3call->response.extra_data.data = extra_data;
                s3call->response.length += extra_data_len;
+               if (extra_data) {
+                       s3call->response.length += 1;
+               }
        }
 
        wbsrv_samba3_async_epilogue(status, s3call);
index b252273cb63bdbd9eade1e57855e4da3d063c16a..3b97dff27626ad35bcd5bbea5497b77c214b44ae 100644 (file)
@@ -78,10 +78,8 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call)
        case WINBINDD_INTERFACE_VERSION:
                return wbsrv_samba3_interface_version(s3call);
 
-#if 0
        case WINBINDD_CHECK_MACHACC:
                return wbsrv_samba3_check_machacc(s3call);
-#endif
 
        case WINBINDD_PING:
                return wbsrv_samba3_ping(s3call);
@@ -187,7 +185,6 @@ NTSTATUS wbsrv_samba3_handle_call(struct wbsrv_samba3_call *s3call)
        case WINBINDD_SET_MAPPING:
        case WINBINDD_SET_HWM:
        case WINBINDD_DUMP_MAPS:
-       case WINBINDD_CHECK_MACHACC:
        case WINBINDD_DOMAIN_INFO:
        case WINBINDD_SHOW_SEQUENCE:
        case WINBINDD_WINS_BYIP:
index 99191f3c6ce6a957398ec1ec3b0b397d33b1457f..f84dece11c0feb3190950f630949c94f80ede9d4 100644 (file)
@@ -149,7 +149,7 @@ static void winbind_task_init(struct task_server *task)
                return;
        }
 
-       service->idmap_ctx = idmap_init(service, task->lp_ctx);
+       service->idmap_ctx = idmap_init(service, task->event_ctx, task->lp_ctx);
        if (service->idmap_ctx == NULL) {
                task_server_terminate(task, "Failed to load idmap database");
                return;
index 302b915ff5b13518dfa96ed6c37defb7cc732fd4..6b89caf4657fc1cf6757669c16f4a94ed5cf4b5b 100644 (file)
@@ -67,15 +67,13 @@ NTSTATUS wb_sids2xids_recv(struct composite_context *ctx,
                           struct id_mapping **ids)
 {
        NTSTATUS status = composite_wait(ctx);
+       struct sids2xids_state *state = talloc_get_type(ctx->private_data,
+                                                       struct sids2xids_state);
 
        DEBUG(5, ("wb_sids2xids_recv called\n"));
 
-       if (NT_STATUS_IS_OK(status)) {
-               struct sids2xids_state *state =
-                       talloc_get_type(ctx->private_data,
-                               struct sids2xids_state);
-               *ids = state->ids;
-       }
+       *ids = state->ids;
+
        talloc_free(ctx);
        return status;
 }
index 1be394d276a2d8f329ed1639e7e077f3ee1ca37e..a1cf2667ff2baa43e18732324f85798278a2c06e 100644 (file)
@@ -67,15 +67,13 @@ NTSTATUS wb_xids2sids_recv(struct composite_context *ctx,
                           struct id_mapping **ids)
 {
        NTSTATUS status = composite_wait(ctx);
+       struct xids2sids_state *state = talloc_get_type(ctx->private_data,
+                                                       struct xids2sids_state);
 
        DEBUG(5, ("wb_xids2sids_recv called.\n"));
 
-       if (NT_STATUS_IS_OK(status)) {
-               struct xids2sids_state *state =
-                       talloc_get_type(ctx->private_data,
-                               struct xids2sids_state);
-               *ids = state->ids;
-       }
+       *ids = state->ids;
+
        talloc_free(ctx);
        return status;
 }
index e750d9355aeb3f5d6a78b70afcc4103e2bd9d394..b7030669869af7561d64bed1db8e6b73601b3b8d 100644 (file)
 #include "lib/socket/netif.h"
 
 static struct ldb_context *wins_config_db_connect(TALLOC_CTX *mem_ctx, 
+                                                 struct event_context *ev_ctx,
                                                  struct loadparm_context *lp_ctx)
 {
-       return ldb_wrap_connect(mem_ctx, lp_ctx, private_path(mem_ctx, 
+       return ldb_wrap_connect(mem_ctx, ev_ctx, lp_ctx, private_path(mem_ctx, 
                                lp_ctx, lp_wins_config_url(lp_ctx)),
                                system_session(mem_ctx, lp_ctx), NULL, 0, NULL);
 }
@@ -83,12 +84,12 @@ static NTSTATUS wreplsrv_open_winsdb(struct wreplsrv_service *service,
                owner = iface_n_ip(ifaces, 0);
        }
 
-       service->wins_db     = winsdb_connect(service, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL);
+       service->wins_db     = winsdb_connect(service, service->task->event_ctx, lp_ctx, owner, WINSDB_HANDLE_CALLER_WREPL);
        if (!service->wins_db) {
                return NT_STATUS_INTERNAL_DB_ERROR;
        }
 
-       service->config.ldb = wins_config_db_connect(service, lp_ctx);
+       service->config.ldb = wins_config_db_connect(service, service->task->event_ctx, lp_ctx);
        if (!service->config.ldb) {
                return NT_STATUS_INTERNAL_DB_ERROR;
        }
index 368c78d727a1d99938ece6128552819e62d6654f..4fe6571eef89a8c5d5d67aa8b7166fa0a9c013a0 100644 (file)
@@ -33,7 +33,6 @@ pwdLastSet: 0
 primaryGroupID: 513
 accountExpires: -1
 logonCount: 0
-sAMAccountType: 805306368
 objectCategory: CN=Person,CN=Schema,CN=Configuration,${BASEDN}
 
 dn: CN=TemplateComputer,CN=Templates
@@ -55,7 +54,6 @@ pwdLastSet: 0
 primaryGroupID: 513
 accountExpires: -1
 logonCount: 0
-sAMAccountType: 805306369
 objectCategory: CN=Computer,CN=Schema,CN=Configuration,${BASEDN}
 
 dn: CN=TemplateTrustingDomain,CN=Templates
@@ -74,7 +72,6 @@ lastLogon: 0
 primaryGroupID: 513
 accountExpires: -1
 logonCount: 0
-sAMAccountType: 805306370
 
 dn: CN=TemplateGroup,CN=Templates
 objectClass: top
@@ -83,7 +80,6 @@ objectClass: groupTemplate
 cn: TemplateGroup
 instanceType: 4
 groupType: -2147483646
-sAMAccountType: 268435456
 objectCategory: CN=Group,CN=Schema,CN=Configuration,${BASEDN}
 
 # Currently this isn't used, we don't have a way to detect it different from an incoming alias
@@ -95,7 +91,6 @@ objectCategory: CN=Group,CN=Schema,CN=Configuration,${BASEDN}
 # cn: TemplateAlias
 # instanceType: 4
 # groupType: -2147483644
-# sAMAccountType: 268435456
 
 dn: CN=TemplateForeignSecurityPrincipal,CN=Templates
 objectClass: top
diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat
new file mode 100644 (file)
index 0000000..a5840e1
Binary files /dev/null and b/testprogs/blackbox/ndrdump/samr-CreateUser-in.dat differ
diff --git a/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat
new file mode 100644 (file)
index 0000000..cf9131d
Binary files /dev/null and b/testprogs/blackbox/ndrdump/samr-CreateUser-out.dat differ
diff --git a/testprogs/blackbox/subunit.sh b/testprogs/blackbox/subunit.sh
new file mode 100755 (executable)
index 0000000..7a6b21e
--- /dev/null
@@ -0,0 +1,67 @@
+#
+#  subunit.sh: shell functions to report test status via the subunit protocol.
+#  Copyright (C) 2006  Robert Collins <robertc@robertcollins.net>
+#  Copyright (C) 2008  Jelmer Vernooij <jelmer@samba.org>
+#
+#  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 2 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, write to the Free Software
+#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+#
+
+subunit_start_test () {
+  # emit the current protocol start-marker for test $1
+  echo "test: $1"
+}
+
+
+subunit_pass_test () {
+  # emit the current protocol test passed marker for test $1
+  echo "success: $1"
+}
+
+
+subunit_fail_test () {
+  # emit the current protocol fail-marker for test $1, and emit stdin as
+  # the error text.
+  # we use stdin because the failure message can be arbitrarily long, and this
+  # makes it convenient to write in scripts (using <<END syntax.
+  echo "failure: $1 ["
+  cat -
+  echo "]"
+}
+
+
+subunit_error_test () {
+  # emit the current protocol error-marker for test $1, and emit stdin as
+  # the error text.
+  # we use stdin because the failure message can be arbitrarily long, and this
+  # makes it convenient to write in scripts (using <<END syntax.
+  echo "error: $1 ["
+  cat -
+  echo "]"
+}
+
+testit () {
+       name="$1"
+       shift
+       cmdline="$*"
+       subunit_start_test "$name"
+       $cmdline
+       status=$?
+       if [ x$status = x0 ]; then
+               subunit_pass_test "$name"
+       else
+               subunit_fail_test "$name"
+       fi
+       return $status
+}
index 23df04c84c9aef95a3aeb6e9e1459cfe25867645..43564a0c77f3ba9601ecc1c4087e44181dfc535a 100755 (executable)
@@ -14,40 +14,24 @@ USERNAME=$2
 PASSWORD=$3
 DOMAIN=$4
 
+. `dirname $0`/subunit.sh
+
 samba4bindir=`dirname $0`/../../source/bin
 DD=$samba4bindir/cifsdd
 
 SHARE=tmp
 DEBUGLEVEL=1
 
-failed=0
-
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-               failed=`expr $failed + 1`
-       fi
-       return $status
-}
-
 runcopy() {
        message="$1"
        shift
        
        testit "$message" $VALGRIND $DD $CONFIGURATION --debuglevel=$DEBUGLEVEL -W "$DOMAIN" -U "$USERNAME"%"$PASSWORD" \
-           "$@"
+           "$@" || failed=`expr $failed + 1`
 }
 
 compare() {
-    testit "$1" cmp "$2" "$3"
+    testit "$1" cmp "$2" "$3" || failed=`expr $failed + 1`
 }
 
 sourcepath=tempfile.src.$$
index 89cc8c2795b7971ceada30eb5f2bf52a31ea3040..ec6f0e422bc3d44f6c01d184b77201284af51a7e 100755 (executable)
@@ -20,20 +20,7 @@ failed=0
 samba4bindir=`dirname $0`/../../source/bin
 gentest=$samba4bindir/gentest
 
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/subunit.sh
 
 cat <<EOF > st/gentest.ignore
 all_info.out.fname
index dbcdcf11126d193d74e602b04aa0ea1792a818ab..db4b65f327659452201c66095e32f7be78d2e6bc 100755 (executable)
@@ -25,21 +25,7 @@ samba4kinit=$samba4bindir/samba4kinit
 net=$samba4bindir/net
 enableaccount="$samba4bindir/smbpython `dirname $0`/../../source/setup/enableaccount"
 
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
-
+. `dirname $0`/subunit.sh
 
 test_smbclient() {
        name="$1"
@@ -86,6 +72,14 @@ testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tm
 
 test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
 
+NEWUSERPASS=testPaSS@34%
+testit "change user password" $VALGRIND $net password change -W$DOMAIN -U$DOMAIN\\nettestuser%$USERPASS $CONFIGURATION  -k no $NEWUSERPASS $@ || failed=`expr $failed + 1`
+
+echo $NEWUSERPASS > ./tmpuserpassfile
+testit "kinit with user password" $samba4bindir/samba4kinit --password-file=./tmpuserpassfile --request-pac nettestuser@$REALM   || failed=`expr $failed + 1`
+
+test_smbclient "Test login with user kerberos ccache" 'ls' -k yes || failed=`expr $failed + 1`
+
 KRB5CCNAME="$PREFIX/tmpccache"
 export KRB5CCNAME
 
index 4067a7fc4331a873ff2ab3657855705b6b73ad4d..8e1af99719178cf7bf2c32ddc2a9a5d557fd82a6 100755 (executable)
@@ -14,6 +14,8 @@ PREFIX=$3
 shift 2
 options="$*"
 
+. `dirname $0`/subunit.sh
+
 check() {
        name="$1"
        shift
index c08b408107c0073d9d894d29385e9df6c22128e8..88fa0ef89242920d9022990eb8087c733cdcef69 100755 (executable)
@@ -21,20 +21,7 @@ failed=0
 samba4bindir=`dirname $0`/../../source/bin
 locktest=$samba4bindir/locktest
 
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/subunit.sh
 
 testit "locktest" $VALGRIND $locktest //$SERVER/test1 //$SERVER/test2 --num-ops=100  -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
 
index ef429a1fb06b556af787591e5a3cbbff2853d8fe..c1f765c1dd7b2facb43aa208daea0669ac27d45e 100755 (executable)
@@ -21,20 +21,7 @@ failed=0
 samba4bindir=`dirname $0`/../../source/bin
 masktest=$samba4bindir/masktest
 
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/subunit.sh
 
 testit "masktest" $VALGRIND $masktest //$SERVER/tmp --num-ops=200 --dieonerror -W "$DOMAIN" -U"$USERNAME%$PASSWORD" $@ || failed=`expr $failed + 1`
 
diff --git a/testprogs/blackbox/test_ndrdump.sh b/testprogs/blackbox/test_ndrdump.sh
new file mode 100755 (executable)
index 0000000..089a7c3
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+# Blackbox tests for masktest
+# Copyright (C) 2008 Andrew Tridgell
+# Copyright (C) 2008 Andrew Bartlett
+# based on test_smbclient.sh
+
+. `dirname $0`/subunit.sh
+
+failed=0
+
+samba4bindir=`dirname $0`/../../source/bin
+ndrdump=$samba4bindir/ndrdump
+files=`dirname $0`/ndrdump
+
+testit "ndrdump with in" $VALGRIND $ndrdump samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1`
+testit "ndrdump with out" $VALGRIND $ndrdump samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1`
+testit "ndrdump with --context-file" $VALGRIND $ndrdump --context-file $files/samr-CreateUser-in.dat samr samr_CreateUser out $files/samr-CreateUser-out.dat $@ || failed=`expr $failed + 1`
+testit "ndrdump with validate" $VALGRIND $ndrdump --validate samr samr_CreateUser in $files/samr-CreateUser-in.dat $@ || failed=`expr $failed + 1`
+
+exit $failed
index a803d83363ba45729723b5cb4367b9f326b1785b..d2c5c675e2ef7dafee77dac9241471b386453f74 100755 (executable)
@@ -21,20 +21,7 @@ failed=0
 samba4bindir=`dirname $0`/../../source/bin
 smbclient=$samba4bindir/smbclient
 
-testit() {
-       name="$1"
-       shift
-       cmdline="$*"
-       echo "test: $name"
-       $cmdline
-       status=$?
-       if [ x$status = x0 ]; then
-               echo "success: $name"
-       else
-               echo "failure: $name"
-       fi
-       return $status
-}
+. `dirname $0`/subunit.sh
 
 runcmd() {
        name="$1"
@@ -86,11 +73,29 @@ testit "Comparing files" diff tmpfile-old tmpfile || failed=`expr $failed + 1`
 runcmd "Creating directory, Changing directory, Going back" 'mkdir bla; cd bla; cd ..; rmdir bla' || failed=`expr $failed + 1`
 # enable recurse, create nested directory
 runcmd "Creating nested directory" 'mkdir bla/bloe' || failed=`expr $failed + 1`
-# remove parent directory
-runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1`
 # remove child directory
+runcmd "Removing directory" 'rmdir bla/bloe' || failed=`expr $failed + 1`
+# remove parent directory
 runcmd "Removing directory" 'rmdir bla'|| failed=`expr $failed + 1`
+# enable recurse, create nested directory
+runcmd "Creating nested directory" 'mkdir bla' || failed=`expr $failed + 1`
+# rename bla to bla2
+runcmd "rename of nested directory" 'rename bla bla2' || failed=`expr $failed + 1`
+# deltree
+runcmd "deltree of nested directory" 'deltree bla2' || failed=`expr $failed + 1`
 # run fsinfo
+runcmd "Getting file system info" 'fsinfo allocation'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volume'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volumeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo sizeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo deviceinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo attributeinfo'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo volume-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo size-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo device-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo attribute-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo quota-information'|| failed=`expr $failed + 1`
+runcmd "Getting file system info" 'fsinfo fullsize-information'|| failed=`expr $failed + 1`
 runcmd "Getting file system info" 'fsinfo objectid'|| failed=`expr $failed + 1`
 
 # put that file
@@ -98,6 +103,7 @@ runcmd "Putting file" 'put tmpfile'|| failed=`expr $failed + 1`
 # get that file
 mv tmpfile tmpfile-old
 runcmd "Getting file" 'get tmpfile'|| failed=`expr $failed + 1`
+runcmd "Getting file EA info" 'eainfo tmpfile'|| failed=`expr $failed + 1`
 # remove that file
 runcmd "Removing file" 'rm tmpfile' || failed=`expr $failed + 1`
 # compare locally
@@ -111,6 +117,11 @@ testit "Comparing files" diff tmpfilex tmpfile || failed=`expr $failed + 1`
 # remove that file
 runcmd "Removing file" 'rm tmpfilex'|| failed=`expr $failed + 1`
 
+runcmd "Lookup name" "lookup $DOMAIN\\$USERNAME" || failed=`expr $failed + 1`
+
+#Fails unless there are privilages
+#runcmd "Lookup privs of name" "privileges $DOMAIN\\$USERNAME" || failed=`expr $failed + 1`
+
 # do some simple operations using old protocol versions
 runcmd "List directory with LANMAN1" 'ls' -m LANMAN1 || failed=`expr $failed + 1`
 runcmd "List directory with LANMAN2" 'ls' -m LANMAN2 || failed=`expr $failed + 1`
diff --git a/testprogs/blackbox/test_wbinfo.sh b/testprogs/blackbox/test_wbinfo.sh
new file mode 100755 (executable)
index 0000000..ec8b9eb
--- /dev/null
@@ -0,0 +1,187 @@
+#!/bin/sh
+# Blackbox test for wbinfo
+if [ $# -lt 4 ]; then
+cat <<EOF
+Usage: test_wbinfo.sh DOMAIN USERNAME PASSWORD TARGET
+EOF
+exit 1;
+fi
+
+DOMAIN=$1
+USERNAME=$2
+PASSWORD=$3
+TARGET=$4
+shift 4
+
+failed=0
+samba4bindir=`dirname $0`/../../source/bin
+wbinfo=$samba4bindir/wbinfo
+
+. `dirname $0`/subunit.sh
+
+testfail() {
+       name="$1"
+       shift
+       cmdline="$*"
+       echo "test: $name"
+       $cmdline
+       status=$?
+        if [ x$status = x0 ]; then
+                echo "failure: $name"
+        else
+                echo "success: $name"
+        fi
+        return $status
+}
+
+knownfail() {
+        name="$1"
+        shift
+        cmdline="$*"
+        echo "test: $name"
+        $cmdline
+        status=$?
+        if [ x$status = x0 ]; then
+                echo "failure: $name [unexpected success]"
+                               status=1
+        else
+                echo "knownfail: $name"
+                               status=0
+        fi
+        return $status
+}
+
+
+testit "wbinfo -u against $TARGET" $wbinfo -u || failed=`expr $failed + 1`
+# Does not work yet
+knownfail "wbinfo -g against $TARGET" $wbinfo -g || failed=`expr $failed + 1`
+knownfail "wbinfo -N against $TARGET" $wbinfo -N || failed=`expr $failed + 1`
+knownfail "wbinfo -I against $TARGET" $wbinfo -I || failed=`expr $failed + 1`
+testit "wbinfo -n against $TARGET" $wbinfo -n "$DOMAIN/$USERNAME" || failed=`expr $failed + 1`
+admin_sid=`$wbinfo -n "$DOMAIN/$USERNAME" | cut -d " " -f1`
+echo "$DOMAIN/$USERNAME resolved to $admin_sid"
+
+testit "wbinfo -s $admin_sid against $TARGET" $wbinfo -s $admin_sid || failed=`expr $failed + 1`
+admin_name=`wbinfo -s $admin_sid | cut -d " " -f1| tr a-z A-Z`
+echo "$admin_sid resolved to $admin_name"
+
+tested_name=`echo $DOMAIN/$USERNAME | tr a-z A-Z`
+
+echo "test: wbinfo -s check for sane mapping"
+if test x$admin_name != x$tested_name; then
+       echo "$admin_name does not match $tested_name"
+       echo "failure: wbinfo -s check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -s check for sane mapping"
+fi
+
+testit "wbinfo -n on the returned name against $TARGET" $wbinfo -n $admin_name || failed=`expr $failed + 1`
+test_sid=`$wbinfo -n $tested_name | cut -d " " -f1`
+
+echo "test: wbinfo -n check for sane mapping"
+if test x$admin_sid != x$test_sid; then
+       echo "$admin_sid does not match $test_sid"
+       echo "failure: wbinfo -n check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -n check for sane mapping"
+fi
+
+testit "wbinfo -U against $TARGET" $wbinfo -U 30000 || failed=`expr $failed + 1`
+
+echo "test: wbinfo -U check for sane mapping"
+sid_for_30000=`$wbinfo -U 30000`
+if test x$sid_for_30000 != "xS-1-22-1-30000"; then
+       echo "uid 30000 mapped to $sid_for_30000, not S-1-22-1-30000"
+       echo "failure: wbinfo -U check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -U check for sane mapping"
+fi
+
+admin_uid=`wbinfo -U $admin_sid`
+
+testit "wbinfo -G against $TARGET" $wbinfo -G 30000 || failed=`expr $failed + 1`
+
+echo "test: wbinfo -G check for sane mapping"
+sid_for_30000=`$wbinfo -G 30000`
+if test x$sid_for_30000 != "xS-1-22-2-30000"; then
+        echo "gid 30000 mapped to $sid_for_30000, not S-1-22-2-30000"
+       echo "failure: wbinfo -G check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -G check for sane mapping"
+fi
+
+testit "wbinfo -S against $TARGET" $wbinfo -S "S-1-22-1-30000" || failed=`expr $failed + 1`
+
+echo "test: wbinfo -S check for sane mapping"
+uid_for_sid=`$wbinfo -S S-1-22-1-30000`
+if test 0$uid_for_sid -ne 30000; then
+       echo "S-1-22-1-30000 mapped to $uid_for_sid, not 30000"
+       echo "failure: wbinfo -S check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -S check for sane mapping"
+fi
+
+testfail "wbinfo -S against $TARGET using invalid SID" $wbinfo -S "S-1-22-2-30000" && failed=`expr $failed + 1`
+
+testit "wbinfo -Y against $TARGET" $wbinfo -Y "S-1-22-2-30000" || failed=`expr $failed + 1`
+
+echo "test: wbinfo -Y check for sane mapping"
+gid_for_sid=`$wbinfo -Y S-1-22-2-30000`
+if test 0$gid_for_sid -ne 30000; then
+       echo "S-1-22-2-30000 mapped to $gid_for_sid, not 30000"
+       echo "failure: wbinfo -Y check for sane mapping"
+       failed=`expr $failed + 1`
+else
+       echo "success: wbinfo -Y check for sane mapping"
+fi
+
+testfail "wbinfo -Y against $TARGET using invalid SID" $wbinfo -Y "S-1-22-1-30000" && failed=`expr $failed + 1`
+
+testit "wbinfo -t against $TARGET" $wbinfo -t || failed=`expr $failed + 1`
+
+testit "wbinfo  --trusted-domains against $TARGET" $wbinfo --trusted-domains || failed=`expr $failed + 1`
+testit "wbinfo --all-domains against $TARGET" $wbinfo --all-domains || failed=`expr $failed + 1`
+testit "wbinfo --own-domain against $TARGET" $wbinfo --own-domain || failed=`expr $failed + 1`
+
+echo "test: wbinfo --own-domain against $TARGET check output"
+own_domain=`wbinfo --own-domain`
+if test x$own_domain = x$DOMAIN; then
+       echo "success: wbinfo --own-domain against $TARGET check output"
+else
+       echo "Own domain reported as $own_domain instead of $DOMAIN"
+       echo "failure: wbinfo --own-domain against $TARGET check output"
+fi
+
+# this does not work
+knownfail "wbinfo --sequence against $TARGET" $wbinfo --sequence
+knownfail "wbinfo -D against $TARGET" $wbinfo -D $DOMAIN || failed=`expr $failed + 1`
+
+testit "wbinfo -i against $TARGET" $wbinfo -i "$DOMAIN/$USERNAME" || failed=`expr $failed + 1`
+
+# this does not work
+knownfail "wbinfo --uid-info against $TARGET" $wbinfo --uid-info $admin_sid
+knownfail "wbinfo --group-info against $TARGET" $wbinfo --group-info "S-1-22-2-0"
+knownfail "wbinfo -r against $TARGET" $wbinfo -r "$DOMAIN/$USERNAME"
+
+testit "wbinfo --user-domgroups against $TARGET" $wbinfo --user-domgroups $admin_sid || failed=`expr $failed + 1`
+
+testit "wbinfo --user-sids against $TARGET" $wbinfo --user-sids $admin_sid || failed=`expr $failed + 1`
+
+testit "wbinfo -a against $TARGET with domain creds" $wbinfo -a "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1`
+
+# this does not work
+knwonfail "wbinfo --getdcname against $TARGET" $wbinfo --getdcname=$DOMAIN
+
+testit "wbinfo -p against $TARGET" $wbinfo -p || failed=`expr $failed + 1`
+
+testit "wbinfo -K against $TARGET with domain creds" $wbinfo -K "$DOMAIN/$USERNAME"%"$PASSWORD" || failed=`expr $failed + 1`
+
+testit "wbinfo --separator against $TARGET" $wbinfo --separator || failed=`expr $failed + 1`
+
+exit $failed
+