From e72760b218e60acfc04c6c22a43820683172df09 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Jan 2008 15:14:05 +1100 Subject: Rework linked_attributes module for the REPLACE case. This moves to a smarter 'find the delta' based operation of the linked attributes module, when the caller asks for a 'replace' of the link source. Previously we would spray operations all over the database, even if the net result was just to modify one record. This also means we need the transaction safety less, which may be useful for some LDAP backends that don't provide this functionality on the LDAP server. Andrew Bartlett (This used to be commit 8c88e4eb1c0a606e7899091525260e8d6558ffd0) --- source4/dsdb/samdb/ldb_modules/linked_attributes.c | 92 ++++++++++++++++++++-- 1 file changed, 86 insertions(+), 6 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/linked_attributes.c b/source4/dsdb/samdb/ldb_modules/linked_attributes.c index 803d24e34e..b3fdffe566 100644 --- a/source4/dsdb/samdb/ldb_modules/linked_attributes.c +++ b/source4/dsdb/samdb/ldb_modules/linked_attributes.c @@ -279,6 +279,27 @@ static int linked_attributes_add(struct ldb_module *module, struct ldb_request * return setup_modifies(module->ldb, ac, ac, req->op.add.message, NULL, req->op.add.message->dn); } +struct merge { + struct ldb_dn *dn; + bool add; + bool ignore; +}; + +static int merge_cmp(struct merge *merge1, struct merge *merge2) { + int ret; + ret = ldb_dn_compare(merge1->dn, merge2->dn); + if (ret == 0) { + if (merge1->add == merge2->add) { + return 0; + } + if (merge1->add == true) { + return 1; + } + return -1; + } + return ret; +} + static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb, void *context, struct ldb_reply *ares) { struct replace_context *ac2 = talloc_get_type(context, struct replace_context); @@ -296,16 +317,63 @@ static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb /* See if this element already exists */ if (search_el) { - int ret; + + struct merge *merged_list = NULL; + + int ret, size = 0, i; struct ldb_message *msg = ldb_msg_new(ac); if (!msg) { ldb_oom(ac->module->ldb); return LDB_ERR_OPERATIONS_ERROR; } - /* Lazy option: Delete and add the elements on all members */ - msg->num_elements = 1; - msg->elements = search_el; + /* Add all the existing elements, marking as 'proposed for delete' by setting .add = false */ + for (i=0; i < search_el->num_values; i++) { + merged_list = talloc_realloc(ares, merged_list, struct merge, size + 1); + merged_list[size].dn = ldb_dn_new(merged_list, ldb, (char *)search_el->values[i].data); + merged_list[size].add = false; + merged_list[size].ignore = false; + size++; + } + + /* Add all the new replacement elements, marking as 'proposed for add' by setting .add = true */ + for (i=0; i < ac2->el->num_values; i++) { + merged_list = talloc_realloc(ares, merged_list, struct merge, size + 1); + merged_list[size].dn = ldb_dn_new(merged_list, ldb, (char *)ac2->el->values[i].data); + merged_list[size].add = true; + merged_list[size].ignore = false; + size++; + } + + /* Sort the list, so we can pick out an add and delete for the same DN, and eliminate them */ + qsort(merged_list, size, + sizeof(*merged_list), + (comparison_fn_t)merge_cmp); + + /* Now things are sorted, it is trivial to mark pairs of DNs as 'ignore' */ + for (i=0; i + 1 < size; i++) { + if (ldb_dn_compare(merged_list[i].dn, + merged_list[i+1].dn) == 0 + /* Fortunetly the sort also sorts 'add == false' first */ + && merged_list[i].add == false + && merged_list[i+1].add == true) { + + /* Mark as ignore, so we include neither in the actual operations */ + merged_list[i].ignore = true; + merged_list[i+1].ignore = true; + } + } + + /* Arrange to delete anything the search found that we don't re-add */ + for (i=0; i < size; i++) { + if (merged_list[i].ignore == false + && merged_list[i].add == false) { + ldb_msg_add_steal_string(msg, search_el->name, + ldb_dn_get_linearized(merged_list[i].dn)); + } + } + + /* The DN to set on the linked attributes is the original DN of the modify message */ msg->dn = ac->orig_req->op.mod.message->dn; ret = setup_modifies(ac->module->ldb, ac2, ac, msg, ares->message->dn, NULL); @@ -313,13 +381,21 @@ static int linked_attributes_mod_replace_search_callback(struct ldb_context *ldb return ret; } - msg->elements = ac2->el; + /* Now add links for all the actually new elements */ + for (i=0; i < size; i++) { + if (merged_list[i].ignore == false && merged_list[i].add == true) { + ldb_msg_add_steal_string(msg, search_el->name, + ldb_dn_get_linearized(merged_list[i].dn)); + } + } ret = setup_modifies(ac->module->ldb, ac2, ac, msg, NULL, ares->message->dn); if (ret != LDB_SUCCESS) { return ret; } + talloc_free(merged_list); + } else { /* Looks like it doesn't exist, process like an 'add' */ struct ldb_message *msg = ldb_msg_new(ac); @@ -411,6 +487,7 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques return LDB_ERR_OBJECT_CLASS_VIOLATION; } + /* Replace with new set of values */ if (((el->flags & LDB_FLAG_MOD_MASK) == LDB_FLAG_MOD_REPLACE) && el->num_values > 0) { struct replace_context *ac2 = talloc(ac, struct replace_context); @@ -461,6 +538,8 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques } continue; + + /* Delete all values case */ } else if (((el->flags & LDB_FLAG_MOD_MASK) & (LDB_FLAG_MOD_DELETE|LDB_FLAG_MOD_REPLACE)) && el->num_values == 0) { const char **attrs = talloc_array(ac, const char *, 2); @@ -508,7 +587,8 @@ static int linked_attributes_modify(struct ldb_module *module, struct ldb_reques continue; } - /* Prepare the modify (mod element) on the targets */ + + /* Prepare the modify (mod element) on the targets, for a normal modify request */ /* For each value being moded, we need to setup the modify */ for (j=0; j < el->num_values; j++) { -- cgit From 5df2ac18e7b2e2ab81a6ab5903addaf71b70db4a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Wed, 16 Jan 2008 15:48:28 +1100 Subject: Print out the reason we can't delete the user in SAMR. We need to be far more granular bout this - in particular, we need a decide LDAP -> NTSTATUS conversion. Andrew Bartlett (This used to be commit 30fc3752c7573fcf8b1a41f7b3bc8dad860077f8) --- source4/rpc_server/samr/dcesrv_samr.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source4/rpc_server/samr/dcesrv_samr.c b/source4/rpc_server/samr/dcesrv_samr.c index 03f3601257..760d774f2e 100644 --- a/source4/rpc_server/samr/dcesrv_samr.c +++ b/source4/rpc_server/samr/dcesrv_samr.c @@ -2910,6 +2910,9 @@ static NTSTATUS dcesrv_samr_DeleteUser(struct dcesrv_call_state *dce_call, TALLO ret = ldb_delete(a_state->sam_ctx, a_state->account_dn); if (ret != 0) { + DEBUG(1, ("Failed to delete user: %s: %s\n", + ldb_dn_get_linearized(a_state->account_dn), + ldb_errstring(a_state->sam_ctx))); return NT_STATUS_UNSUCCESSFUL; } -- cgit From ad5bb10f707dddc0cea159af09393520128157d7 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 14 Jan 2008 23:04:57 +0100 Subject: python: Build shared python modules for generic use. (This used to be commit 502424955237ace5a276d4c91c62e95233ecd978) --- source4/build/smb_build/input.pm | 2 +- source4/build/smb_build/makefile.pm | 6 ++++-- source4/scripting/python/config.mk | 10 ++++++++-- 3 files changed, 13 insertions(+), 5 deletions(-) diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 6d5c4f4a1e..0b26aee65e 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -182,7 +182,7 @@ sub check_python($$$) $python->{SUBSYSTEM} = "LIBPYTHON"; - check_module($INPUT, $python, $default_ot); + check_module($INPUT, $python, ["SHARED_LIBRARY", "STATIC_LIBRARY"]); } sub check_binary($$) diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index 0e7771c3f2..ce1e757c61 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -27,6 +27,7 @@ sub new($$$) $self->{torture_progs} = []; $self->{static_libs} = []; $self->{python_dsos} = []; + $self->{python_pys} = []; $self->{shared_libs} = []; $self->{installable_shared_libs} = []; $self->{headers} = []; @@ -345,7 +346,7 @@ sub SharedModule($$) push(@{$self->{all_objs}}, "\$($ctx->{TYPE}_$ctx->{NAME}_FULL_OBJ_LIST)"); - if (defined($ctx->{INIT_FUNCTION})) { + if (defined($ctx->{INIT_FUNCTION}) and $ctx->{TYPE} ne "PYTHON") { my $init_fn = $ctx->{INIT_FUNCTION_TYPE}; $init_fn =~ s/\(\*\)/init_module/; my $proto_fn = $ctx->{INIT_FUNCTION_TYPE}; @@ -539,7 +540,7 @@ sub PythonFiles($$) $self->output("$target: $source\n" . "\tmkdir -p \$(builddir)/bin/python\n" . "\tcp $source \$@\n\n"); - push (@{$self->{python_dsos}}, $target); + push (@{$self->{python_pys}}, $target); } } @@ -714,6 +715,7 @@ sub write($$) $self->output("STATIC_LIBS = " . array2oneperline($self->{static_libs}) . "\n"); $self->output("SHARED_LIBS = " . array2oneperline($self->{shared_libs}) . "\n"); $self->output("PYTHON_DSOS = " . array2oneperline($self->{python_dsos}) . "\n"); + $self->output("PYTHON_PYS = " . array2oneperline($self->{python_pys}) . "\n"); $self->output("INSTALLABLE_SHARED_LIBS = " . array2oneperline($self->{installable_shared_libs}) . "\n"); $self->output("PUBLIC_HEADERS = " . array2oneperline($self->{headers}) . "\n"); $self->output("PC_FILES = " . array2oneperline($self->{pc_files}) . "\n"); diff --git a/source4/scripting/python/config.mk b/source4/scripting/python/config.mk index f00b477919..450da0e90a 100644 --- a/source4/scripting/python/config.mk +++ b/source4/scripting/python/config.mk @@ -16,7 +16,7 @@ PRIVATE_DEPENDENCIES = LIBNDR LIBLDB SAMDB CREDENTIALS SWIG_FILE = misc.i # Swig extensions -swig: pythonmods +swig:: pythonmods .SUFFIXES: _wrap.c .i @@ -28,13 +28,19 @@ realdistclean:: @-rm -f bin/python/* # FIXME: Remove _wrap.c files -pythonmods: $(PYTHON_DSOS) +pythonmods:: $(PYTHON_DSOS) $(PYTHON_PYS) PYDOCTOR_MODULES=bin/python/ldb.py bin/python/auth.py bin/python/credentials.py bin/python/registry.py bin/python/tdb.py bin/python/security.py bin/python/events.py bin/python/net.py pydoctor:: pythonmods LD_LIBRARY_PATH=bin/shared PYTHONPATH=bin/python pydoctor --make-html --docformat=restructuredtext --add-package scripting/python/samba/ $(addprefix --add-module , $(PYDOCTOR_MODULES)) +installpython:: pythonmods + @$(SHELL) $(srcdir)/script/installpython.sh \ + $(INSTALLPERMS) \ + $(DESTDIR)$(PYTHONDIR) \ + scripting/python bin/python + clean:: @echo "Removing python modules" @rm -f bin/python/* -- cgit From 39cc507d1b7b0454d8f380fc3127fa966a0f972c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 14:54:29 +0100 Subject: pidl: Fix imported function for ServerNDR and add test to make sure it doesn't regress again. (This used to be commit 0e036948307c8ca5013e20a17a10d109830e4df1) --- source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 2 +- source4/pidl/tests/samba3-srv.pl | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 source4/pidl/tests/samba3-srv.pl diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index 47312bc83d..ecc43ab896 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -12,7 +12,7 @@ use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); use Parse::Pidl::Util qw(ParseExpr has_property is_constant); use Parse::Pidl::NDR qw(GetNextLevel); use Parse::Pidl::Samba4 qw(ElementStars DeclLong); -use Parse::Pidl::Samba4::NDR::Parser qw(GenerateFunctionOutEnv); +use Parse::Pidl::Samba4::Header qw(GenerateFunctionOutEnv); use vars qw($VERSION); $VERSION = '0.01'; diff --git a/source4/pidl/tests/samba3-srv.pl b/source4/pidl/tests/samba3-srv.pl new file mode 100644 index 0000000000..dc96518fd0 --- /dev/null +++ b/source4/pidl/tests/samba3-srv.pl @@ -0,0 +1,14 @@ +#!/usr/bin/perl +# (C) 2008 Jelmer Vernooij +# Published under the GNU General Public License +use strict; +use warnings; + +use Test::More tests => 0; +use FindBin qw($RealBin); +use lib "$RealBin"; +use Util; +use Parse::Pidl::Util qw(MyDumper); +use Parse::Pidl::Samba3::ServerNDR; + + -- cgit From af163d258cfeee2a908e297256570a2bfcc8b651 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 15:06:46 +0100 Subject: pidl: Fix missing import for fatal(). (This used to be commit 6a9827454aaf4279ee85dc5d99d10f14e4c09eae) --- source4/pidl/lib/Parse/Pidl/Samba4.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/pidl/lib/Parse/Pidl/Samba4.pm b/source4/pidl/lib/Parse/Pidl/Samba4.pm index 5848543a60..d42e01cdb0 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba4.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba4.pm @@ -12,6 +12,7 @@ require Exporter; use Parse::Pidl::Util qw(has_property is_constant); use Parse::Pidl::NDR qw(GetNextLevel); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); +use Parse::Pidl qw(fatal); use strict; use vars qw($VERSION); -- cgit From 3e53ad6f4a5767fd1a26a35a0060b03a6e77161c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 15:07:00 +0100 Subject: pidl: Add simple test for ServerNDR. (This used to be commit 5b2ea43ed8613ac10ebe7feda0cf070c8079137a) --- source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm | 4 ++++ source4/pidl/tests/samba3-srv.pl | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm index ecc43ab896..ca9e7d15db 100644 --- a/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm +++ b/source4/pidl/lib/Parse/Pidl/Samba3/ServerNDR.pm @@ -6,6 +6,10 @@ package Parse::Pidl::Samba3::ServerNDR; +use Exporter; +@ISA = qw(Exporter); +@EXPORT_OK = qw(DeclLevel); + use strict; use Parse::Pidl qw(warning fatal); use Parse::Pidl::Typelist qw(mapTypeName scalar_is_reference); diff --git a/source4/pidl/tests/samba3-srv.pl b/source4/pidl/tests/samba3-srv.pl index dc96518fd0..d1e2bc9545 100644 --- a/source4/pidl/tests/samba3-srv.pl +++ b/source4/pidl/tests/samba3-srv.pl @@ -4,11 +4,15 @@ use strict; use warnings; -use Test::More tests => 0; +use Test::More tests => 1; use FindBin qw($RealBin); use lib "$RealBin"; use Util; -use Parse::Pidl::Util qw(MyDumper); -use Parse::Pidl::Samba3::ServerNDR; +use Parse::Pidl::Util qw(MyDumper has_property); +use Parse::Pidl::Samba3::ServerNDR qw(DeclLevel); +my $l = { TYPE => "DATA", DATA_TYPE => "uint32" }; +my $e = { FILE => "foo", LINE => 0, PROPERTIES => { }, TYPE => "uint32", + LEVELS => [ $l ] }; +is("uint32_t", DeclLevel($e, 0)); -- cgit From e3fb56d183c03a93c2f2bfed1df17cfe8be4f47f Mon Sep 17 00:00:00 2001 From: Günther Deschner Date: Wed, 16 Jan 2008 16:01:50 +0100 Subject: Add lsa_PolicyAuditEventType and lsa_PolicyAuditPolicy enums from samba3 to IDL. Guenther (This used to be commit 1b5706e413f1c6aa1ede15a625929f785ce37272) --- source4/librpc/idl/lsa.idl | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/source4/librpc/idl/lsa.idl b/source4/librpc/idl/lsa.idl index 705c86e39b..8d26ec0aad 100644 --- a/source4/librpc/idl/lsa.idl +++ b/source4/librpc/idl/lsa.idl @@ -138,9 +138,29 @@ import "security.idl"; uint32 unknown; } lsa_AuditLogInfo; + typedef [v1_enum] enum { + LSA_AUDIT_POLICY_NONE=0, + LSA_AUDIT_POLICY_SUCCESS=1, + LSA_AUDIT_POLICY_FAILURE=2, + LSA_AUDIT_POLICY_ALL=(LSA_AUDIT_POLICY_SUCCESS|LSA_AUDIT_POLICY_FAILURE), + LSA_AUDIT_POLICY_CLEAR=4 + } lsa_PolicyAuditPolicy; + + typedef enum { + LSA_AUDIT_CATEGORY_SYSTEM = 0, + LSA_AUDIT_CATEGORY_LOGON = 1, + LSA_AUDIT_CATEGORY_FILE_AND_OBJECT_ACCESS = 2, + LSA_AUDIT_CATEGORY_USE_OF_USER_RIGHTS = 3, + LSA_AUDIT_CATEGORY_PROCCESS_TRACKING = 4, + LSA_AUDIT_CATEGORY_SECURITY_POLICY_CHANGES = 5, + LSA_AUDIT_CATEGORY_ACCOUNT_MANAGEMENT = 6, + LSA_AUDIT_CATEGORY_DIRECTORY_SERVICE_ACCESS = 7, /* only in win2k/2k3 */ + LSA_AUDIT_CATEGORY_ACCOUNT_LOGON = 8 /* only in win2k/2k3 */ + } lsa_PolicyAuditEventType; + typedef struct { uint32 auditing_mode; - [size_is(count)] uint32 *settings; + [size_is(count)] lsa_PolicyAuditPolicy *settings; uint32 count; } lsa_AuditEventsInfo; -- cgit From fa6ce1e4a9d285c82faed49a09bb2bd297bbea39 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 16:53:21 +0100 Subject: Ignore newly generated proto header. (This used to be commit caa0da310da47a48a9add6de3d309984ae14f59c) --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index ccc12650c1..9ed0334ea1 100644 --- a/.gitignore +++ b/.gitignore @@ -67,6 +67,7 @@ source/lib/util/pidfile.h source/lib/util/unix_privs.h source/lib/util/util_proto.h source/lib/util/wrap_xattr.h +source/lib/util/asn1_proto.h source/libcli/finddcs.h source/libcli/libcli_proto.h source/libcli/auth/proto.h @@ -79,7 +80,6 @@ source/libcli/resolve/proto.h source/libcli/security/proto.h source/libcli/smb2/smb2_proto.h source/libcli/smb_composite/proto.h -source/libcli/util/asn1_proto.h source/libcli/util/clilsa.h source/libcli/util/proto.h source/libcli/wrepl/winsrepl_proto.h -- cgit From a760146e73ea0f6bb30f01276f3756d97644722c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 17:40:25 +0100 Subject: selftest: Add some more documentation. Rename env => target to avoid confusion. (This used to be commit 50b8a16d0cb5e1c4352e73900d1e98a812340cca) --- source4/selftest/README | 17 + source4/selftest/env/Samba3.pm | 434 ------------------ source4/selftest/env/Samba4.pm | 915 ------------------------------------- source4/selftest/env/Windows.pm | 40 -- source4/selftest/selftest.pl | 9 +- source4/selftest/target/Samba3.pm | 434 ++++++++++++++++++ source4/selftest/target/Samba4.pm | 915 +++++++++++++++++++++++++++++++++++++ source4/selftest/target/Windows.pm | 40 ++ 8 files changed, 1410 insertions(+), 1394 deletions(-) delete mode 100644 source4/selftest/env/Samba3.pm delete mode 100644 source4/selftest/env/Samba4.pm delete mode 100644 source4/selftest/env/Windows.pm create mode 100644 source4/selftest/target/Samba3.pm create mode 100644 source4/selftest/target/Samba4.pm create mode 100644 source4/selftest/target/Windows.pm diff --git a/source4/selftest/README b/source4/selftest/README index a0afda3d19..3250f32ec7 100644 --- a/source4/selftest/README +++ b/source4/selftest/README @@ -1,6 +1,23 @@ +# vim: ft=rst + 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 +the name of the test, the command to run and the environment that should be +provided. + +============ +Environments +============ +Tests often need to run against a server with particular things set up, +a "environment". This environment is provided by the test "target": Samba 3, +Samba 4 or Windows. + The following environments are currently available: - none: No server set up, no variables set. diff --git a/source4/selftest/env/Samba3.pm b/source4/selftest/env/Samba3.pm deleted file mode 100644 index b0c4eb22bd..0000000000 --- a/source4/selftest/env/Samba3.pm +++ /dev/null @@ -1,434 +0,0 @@ -#!/usr/bin/perl -# Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2005-2007 Jelmer Vernooij -# Published under the GNU GPL, v3 or later. - -package Samba3; - -use strict; -use Cwd qw(abs_path); -use FindBin qw($RealBin); -use POSIX; - -sub binpath($$) -{ - my ($self, $binary) = @_; - - if (defined($self->{bindir})) { - my $path = "$self->{bindir}/$binary"; - -f $path or die("File $path doesn't exist"); - return $path; - } - - return $binary; -} - -sub new($$) { - my ($classname, $bindir) = @_; - my $self = { bindir => $bindir }; - bless $self; - return $self; -} - -sub teardown_env($$) -{ - my ($self, $envvars) = @_; - - my $smbdpid = read_pid($envvars, "smbd"); - my $nmbdpid = read_pid($envvars, "nmbd"); -# my $winbinddpid = read_pid($envvars, "winbindd"); - - $self->stop_sig_term($smbdpid); - $self->stop_sig_term($nmbdpid); -# $self->stop_sig_term($winbinddpid); - $self->stop_sig_kill($smbdpid); - $self->stop_sig_kill($nmbdpid); -# $self->stop_sig_kill($winbinddpid); - - return 0; -} - -sub getlog_env_app($$$) -{ - my ($self, $envvars, $name) = @_; - - my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n"; - my $out = $title; - - open(LOG, "<".$envvars->{$name."_TEST_LOG"}); - - seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET); - while () { - $out .= $_; - } - $envvars->{$name."_TEST_LOG_POS"} = tell(LOG); - close(LOG); - - return "" if $out eq $title; - - return $out; -} - -sub getlog_env($$) -{ - my ($self, $envvars) = @_; - my $ret = ""; - - $ret .= $self->getlog_env_app($envvars, "SMBD"); - $ret .= $self->getlog_env_app($envvars, "NMBD"); -# $ret .= $self->getlog_env_app($envvars, "WINBINDD"); - - return $ret; -} - -sub check_env($$) -{ - my ($self, $envvars) = @_; - - # TODO ... - return 1; -} - -sub setup_env($$$) -{ - my ($self, $envname, $path) = @_; - - if ($envname eq "dc") { - return $self->setup_dc("$path/dc"); - } else { - return undef; - } -} - -sub setup_dc($$) -{ - my ($self, $path) = @_; - - my $vars = $self->provision($path, "dc"); - - $self->check_or_start($vars, - ($ENV{NMBD_MAXTIME} or 2700), - ($ENV{WINBINDD_MAXTIME} or 2700), - ($ENV{SMBD_MAXTIME} or 2700)); - - $self->wait_for_start($vars); - - return $vars; -} - -sub stop($) -{ - my ($self) = @_; -} - -sub stop_sig_term($$) { - my ($self, $pid) = @_; - kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); -} - -sub stop_sig_kill($$) { - my ($self, $pid) = @_; - kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); -} - -sub write_pid($$$) -{ - my ($env_vars, $app, $pid) = @_; - - open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid"); - print PID $pid; - close(PID); -} - -sub read_pid($$) -{ - my ($env_vars, $app) = @_; - - open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid"); - my $pid = ; - close(PID); - return $pid; -} - -sub check_or_start($$$$) { - my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_; - - unlink($env_vars->{NMBD_TEST_LOG}); - print "STARTING NMBD..."; - my $pid = fork(); - if ($pid == 0) { - open STDOUT, ">$env_vars->{NMBD_TEST_LOG}"; - open STDERR, '>&STDOUT'; - - $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; - - my @optargs = ("-d0"); - if (defined($ENV{NMBD_OPTIONS})) { - @optargs = split(/ /, $ENV{NMBD_OPTIONS}); - } - - $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd"); - - my @preargs = ($self->binpath("timelimit"), $nmbd_maxtime); - if(defined($ENV{NMBD_VALGRIND})) { - @preargs = split(/ /, $ENV{NMBD_VALGRIND}); - } - - exec(@preargs, $self->binpath("nmbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!"); - } - write_pid($env_vars, "nmbd", $pid); - print "DONE\n"; - -# disable winbindd until the build-farm faked_users work with it -# unlink($env_vars->{WINBINDD_TEST_LOG}); -# print "STARTING WINBINDD..."; -# $pid = fork(); -# if ($pid == 0) { -# open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}"; -# open STDERR, '>&STDOUT'; -# -# $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; -# -# my @optargs = ("-d0"); -# if (defined($ENV{WINBINDD_OPTIONS})) { -# @optargs = split(/ /, $ENV{WINBINDD_OPTIONS}); -# } -# -# $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd"); -# exec($self->binpath("timelimit"), $winbindd_maxtime, $ENV{WINBINDD_VALGRIND}, $self->binpath("winbindd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!"); -# } -# write_pid($env_vars, "winbindd", $pid); -# print "DONE\n"; - - unlink($env_vars->{SMBD_TEST_LOG}); - print "STARTING SMBD..."; - $pid = fork(); - if ($pid == 0) { - open STDOUT, ">$env_vars->{SMBD_TEST_LOG}"; - open STDERR, '>&STDOUT'; - - $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; - - $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd"); - my @optargs = ("-d0"); - if (defined($ENV{SMBD_OPTIONS})) { - @optargs = split(/ /, $ENV{SMBD_OPTIONS}); - } - my @preargs = ($self->binpath("timelimit"), $smbd_maxtime); - if(defined($ENV{SMBD_VALGRIND})) { - @preargs = split(/ /,$ENV{SMBD_VALGRIND}); - } - exec(@preargs, $self->binpath("smbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!"); - } - write_pid($env_vars, "smbd", $pid); - print "DONE\n"; - - return 0; -} - -sub create_clientconf($$$) -{ - my ($self, $prefix, $domain) = @_; - - my $lockdir = "$prefix/locks"; - my $logdir = "$prefix/logs"; - my $piddir = "$prefix/pid"; - my $privatedir = "$prefix/private"; - my $scriptdir = "$RealBin/.."; - my $conffile = "$prefix/smb.conf"; - - my $torture_interfaces='127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8'; - open(CONF, ">$conffile"); - print CONF " -[global] - workgroup = $domain - - private dir = $privatedir - pid directory = $piddir - lock directory = $lockdir - log file = $logdir/log.\%m - log level = 0 - - name resolve order = bcast - - netbios name = TORTURE_6 - interfaces = $torture_interfaces - panic action = $scriptdir/gdb_backtrace \%d %\$(MAKE_TEST_BINARY) - - passdb backend = tdbsam - "; - close(CONF); -} - -sub provision($$$) -{ - my ($self, $prefix, $role) = @_; - - ## - ## setup the various environment variables we need - ## - - my %ret = (); - my $server = "LOCALHOST2"; - my $server_ip = "127.0.0.2"; - my $domain = "SAMBA-TEST"; - - my $username = `PATH=/usr/ucb:$ENV{PATH} whoami`; - chomp $username; - my $password = "test"; - - my $srcdir="$RealBin/.."; - my $scriptdir="$srcdir/selftest"; - my $prefix_abs = abs_path($prefix); - - my @dirs = (); - - my $shrdir="$prefix_abs/share"; - push(@dirs,$shrdir); - - my $libdir="$prefix_abs/lib"; - push(@dirs,$libdir); - - my $piddir="$prefix_abs/pid"; - push(@dirs,$piddir); - - my $privatedir="$prefix_abs/private"; - push(@dirs,$privatedir); - - my $lockdir="$prefix_abs/lockdir"; - push(@dirs,$lockdir); - - my $logdir="$prefix_abs/logs"; - push(@dirs,$logdir); - - # this gets autocreated by winbindd - my $wbsockdir="$prefix_abs/winbindd"; - my $wbsockprivdir="$lockdir/winbindd_privileged"; - - ## - ## create the test directory layout - ## - mkdir($prefix_abs, 0777); - print "CREATE TEST ENVIRONMENT IN '$prefix'..."; - system("rm -rf $prefix_abs/*"); - mkdir($_, 0777) foreach(@dirs); - - my $conffile="$libdir/server.conf"; - - open(CONF, ">$conffile") or die("Unable to open $conffile"); - print CONF " -[global] - workgroup = $domain - - private dir = $privatedir - pid directory = $piddir - lock directory = $lockdir - log file = $logdir/log.\%m - log level = 0 - - name resolve order = bcast - - netbios name = $server - interfaces = $server_ip/8 - bind interfaces only = yes - panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY) - - passdb backend = tdbsam - - ; Necessary to add the build farm hacks - add user script = /bin/false - add machine script = /bin/false - - kernel oplocks = no - kernel change notify = no - - syslog = no - printing = bsd - printcap name = /dev/null - -"; - - if ($role eq "dc") { - print CONF "\tdomain logons = yes\n"; - print CONF "\tdomain master = yes\n"; - } - -print CONF " - - winbindd:socket dir = $wbsockdir - -[tmp] - path = $shrdir - read only = no - smbd:sharedelay = 100000 - map hidden = yes - map system = yes - create mask = 755 -[hideunread] - copy = tmp - hide unreadable = yes -[hideunwrite] - copy = tmp - hide unwriteable files = yes -[print1] - copy = tmp - printable = yes - printing = test -[print2] - copy = print1 -[print3] - copy = print1 -[print4] - copy = print1 - "; - close(CONF); - - ## - ## create a test account - ## - - open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a $username"); - print PWD "$password\n$password\n"; - close(PWD) or die("Unable to set password for test account"); - - print "DONE\n"; - - $ret{SERVER_IP} = $server_ip; - $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log"; - $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log"; - $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; - $ret{SERVERCONFFILE} = $conffile; - $ret{CONFIGURATION} ="-s $conffile"; - $ret{SERVER} = $server; - $ret{USERNAME} = $username; - $ret{DOMAIN} = $domain; - $ret{NETBIOSNAME} = $server; - $ret{PASSWORD} = $password; - $ret{PIDDIR} = $piddir; - $ret{WINBINDD_SOCKET_DIR} = $wbsockdir; - $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir; - return \%ret; -} - -sub wait_for_start($$) -{ - my ($self, $envvars) = @_; - - # give time for nbt server to register its names - print "delaying for nbt name registration\n"; - sleep(10); - # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init - system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); - system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} __SAMBA__"); - system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__"); - system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}"); - system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} $envvars->{SERVER}"); - # make sure smbd is also up set - print "wait for smbd\n"; - system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2"); - system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2"); - - print $self->getlog_env($envvars); -} - -1; diff --git a/source4/selftest/env/Samba4.pm b/source4/selftest/env/Samba4.pm deleted file mode 100644 index 87a86ef06f..0000000000 --- a/source4/selftest/env/Samba4.pm +++ /dev/null @@ -1,915 +0,0 @@ -#!/usr/bin/perl -# Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2005-2007 Jelmer Vernooij -# Published under the GNU GPL, v3 or later. - -package Samba4; - -use strict; -use Cwd qw(abs_path); -use FindBin qw($RealBin); -use POSIX; - -sub new($$$$) { - my ($classname, $bindir, $ldap, $setupdir) = @_; - my $self = { - vars => {}, - ldap => $ldap, - bindir => $bindir, - setupdir => $setupdir - }; - bless $self; - return $self; -} - -sub openldap_start($$$) { - my ($slapd_conf, $uri, $logs) = @_; - my $oldpath = $ENV{PATH}; - my $olroot = ""; - my $olpath = ""; - if (defined $ENV{OPENLDAP_ROOT}) { - $olroot = "$ENV{OPENLDAP_ROOT}"; - $olpath = "$olroot/libexec:$olroot/sbin:"; - } - $ENV{PATH} = "$olpath/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; - system("slapd -d63 -f $slapd_conf -h $uri > $logs 2>&1 &"); - $ENV{PATH} = $oldpath; -} - -sub slapd_start($$) -{ - my $count = 0; - my ($self, $env_vars) = @_; - - my $uri = $env_vars->{LDAP_URI}; - - # running slapd in the background means it stays in the same process group, so it can be - # killed by timelimit - if ($self->{ldap} eq "fedora-ds") { - system("$ENV{FEDORA_DS_ROOT}/sbin/ns-slapd -D $env_vars->{FEDORA_DS_DIR} -d0 -i $env_vars->{FEDORA_DS_PIDFILE}> $env_vars->{LDAPDIR}/logs 2>&1 &"); - } elsif ($self->{ldap} eq "openldap") { - openldap_start($env_vars->{SLAPD_CONF}, $uri, "$env_vars->{LDAPDIR}/logs"); - } - while (system("$self->{bindir}/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) { - $count++; - if ($count > 40) { - $self->slapd_stop($env_vars); - return 0; - } - sleep(1); - } - return 1; -} - -sub slapd_stop($$) -{ - my ($self, $envvars) = @_; - if ($self->{ldap} eq "fedora-ds") { - system("$envvars->{LDAPDIR}/slapd-samba4/stop-slapd"); - } elsif ($self->{ldap} eq "openldap") { - open(IN, "<$envvars->{OPENLDAP_PIDFILE}") or - die("unable to open slapd pid file: $envvars->{OPENLDAP_PIDFILE}"); - kill 9, ; - close(IN); - } - return 1; -} - -sub check_or_start($$$) -{ - my ($self, $env_vars, $max_time) = @_; - return 0 if ( -p $env_vars->{SMBD_TEST_FIFO}); - - unlink($env_vars->{SMBD_TEST_FIFO}); - POSIX::mkfifo($env_vars->{SMBD_TEST_FIFO}, 0700); - unlink($env_vars->{SMBD_TEST_LOG}); - - print "STARTING SMBD... "; - my $pid = fork(); - if ($pid == 0) { - open STDIN, $env_vars->{SMBD_TEST_FIFO}; - open STDOUT, ">$env_vars->{SMBD_TEST_LOG}"; - open STDERR, '>&STDOUT'; - - SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE}); - - my $valgrind = ""; - if (defined($ENV{SMBD_VALGRIND})) { - $valgrind = $ENV{SMBD_VALGRIND}; - } - - $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG}; - - $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD}; - $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP}; - - # Start slapd before smbd, but with the fifo on stdin - if (defined($self->{ldap})) { - $self->slapd_start($env_vars) or - die("couldn't start slapd (2nd time)"); - } - - my $optarg = ""; - if (defined($max_time)) { - $optarg = "--maximum-runtime=$max_time "; - } - if (defined($ENV{SMBD_OPTIONS})) { - $optarg.= " $ENV{SMBD_OPTIONS}"; - } - my $ret = system("$valgrind $self->{bindir}/smbd $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full"); - if ($? == -1) { - print "Unable to start smbd: $ret: $!\n"; - exit 1; - } - unlink($env_vars->{SMBD_TEST_FIFO}); - my $exit = $? >> 8; - if ( $ret == 0 ) { - print "smbd exits with status $exit\n"; - } elsif ( $ret & 127 ) { - print "smbd got signal ".($ret & 127)." and exits with $exit!\n"; - } else { - $ret = $? >> 8; - print "smbd failed with status $exit!\n"; - } - exit $exit; - } - print "DONE\n"; - - open(DATA, ">$env_vars->{SMBD_TEST_FIFO}"); - - return $pid; -} - -sub wait_for_start($$) -{ - my ($self, $testenv_vars) = @_; - # give time for nbt server to register its names - print "delaying for nbt name registration\n"; - sleep 2; - - # This will return quickly when things are up, but be slow if we - # need to wait for (eg) SSL init - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{SERVER}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSNAME}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSALIAS}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSALIAS}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{SERVER}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSNAME}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSALIAS}"); - system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSALIAS}"); - - print $self->getlog_env($testenv_vars); -} - -sub write_ldb_file($$$) -{ - my ($self, $file, $ldif) = @_; - - open(LDIF, "|$self->{bindir}/ldbadd -H $file >/dev/null"); - print LDIF $ldif; - return close(LDIF); -} - -sub add_wins_config($$) -{ - my ($self, $privatedir) = @_; - - return $self->write_ldb_file("$privatedir/wins_config.ldb", " -dn: name=TORTURE_6,CN=PARTNERS -objectClass: wreplPartner -name: TORTURE_6 -address: 127.0.0.6 -pullInterval: 0 -pushChangeCount: 0 -type: 0x3 -"); -} - -sub mk_fedora_ds($$$) -{ - my ($self, $ldapdir, $configuration) = @_; - - my $fedora_ds_inf = "$ldapdir/fedorads.inf"; - my $fedora_ds_extra_ldif = "$ldapdir/fedorads-partitions.ldif"; - - #Make the subdirectory be as fedora DS would expect - my $fedora_ds_dir = "$ldapdir/slapd-samba4"; - - 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) { - chdir $dir; - die("perl $ENV{FEDORA_DS_ROOT}/sbin/setup-ds.pl --silent --file=$fedora_ds_inf FAILED: $?"); - } - chdir $dir || die; - - return ($fedora_ds_dir, $pidfile); -} - -sub mk_openldap($$$) -{ - my ($self, $ldapdir, $configuration) = @_; - - my $slapd_conf = "$ldapdir/slapd.conf"; - 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 = ""; - if (defined $ENV{OPENLDAP_ROOT}) { - $olroot = "$ENV{OPENLDAP_ROOT}"; - $olpath = "$olroot/libexec:$olroot/sbin:"; - } - $ENV{PATH} = "$olpath/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; - - unlink($modconf); - open(CONF, ">$modconf"); close(CONF); - - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules - print CONF " -modulepath $olroot/libexec/openldap -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules - print CONF " -modulepath $olroot/libexec/openldap -moduleload back_hdb -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules - print CONF " -moduleload back_hdb -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules - print CONF " -modulepath /usr/lib/ldap -moduleload back_hdb -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules (Fedora layout) - print CONF " -modulepath /usr/lib/openldap -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - - if (system("slaptest -u -f $slapd_conf >&2") != 0) { - open(CONF, ">$modconf"); - # enable slapd modules (Fedora x86_64 layout) - print CONF " -modulepath /usr/lib64/openldap -moduleload syncprov -moduleload memberof -moduleload refint -"; - close(CONF); - } - - system("slaptest -u -f $slapd_conf") == 0 or die("slaptest still fails after adding modules"); - - - $ENV{PATH} = $oldpath; - - return ($slapd_conf, $pidfile); -} - -sub mk_keyblobs($$) -{ - my ($self, $tlsdir) = @_; - - #TLS and PKINIT crypto blobs - my $dhfile = "$tlsdir/dhparms.pem"; - my $cafile = "$tlsdir/ca.pem"; - my $certfile = "$tlsdir/cert.pem"; - my $reqkdc = "$tlsdir/req-kdc.der"; - my $kdccertfile = "$tlsdir/kdc.pem"; - my $keyfile = "$tlsdir/key.pem"; - my $adminkeyfile = "$tlsdir/adminkey.pem"; - my $reqadmin = "$tlsdir/req-admin.der"; - my $admincertfile = "$tlsdir/admincert.pem"; - - mkdir($tlsdir, 0777); - - #This is specified here to avoid draining entropy on every run - open(DHFILE, ">$dhfile"); - print DHFILE <$keyfile"); - print KEYFILE <$adminkeyfile"); - - print ADMINKEYFILE <$cafile"); - print CAFILE <$certfile"); - print CERTFILE <$kdccertfile"); - print KDCCERTFILE <$admincertfile"); - print ADMINCERTFILE <; - my $unix_gids_str = $); - my @unix_gids = split(" ", $unix_gids_str); - my $srcdir="$RealBin/.."; - -d $prefix or mkdir($prefix, 0777) or die("Unable to create $prefix"); - my $prefix_abs = abs_path($prefix); - my $tmpdir = "$prefix_abs/tmp"; - my $etcdir = "$prefix_abs/etc"; - my $piddir = "$prefix_abs/pid"; - my $conffile = "$etcdir/smb.conf"; - my $krb5_config = "$etcdir/krb5.conf"; - my $privatedir = "$prefix_abs/private"; - 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 $nsswrap_passwd = "$etcdir/passwd"; - my $nsswrap_group = "$etcdir/group"; - - my $configuration = "--configfile=$conffile"; - my $ldapdir = "$privatedir/ldap"; - - my $tlsdir = "$privatedir/tls"; - - my $ifaceipv4 = "127.0.0.$swiface"; - my $interfaces = "$ifaceipv4/8"; - - (system("rm -rf $prefix/*") == 0) or die("Unable to clean up"); - mkdir($_, 0777) foreach ($privatedir, $etcdir, $piddir, $ncalrpcdir, $lockdir, - $tmpdir); - - - my $localbasedn = $basedn; - $localbasedn = "DC=$netbiosname" if $server_role eq "member server"; - - open(CONFFILE, ">$conffile"); - print CONFFILE " -[global] - netbios name = $netbiosname - netbios aliases = $netbiosalias - workgroup = $domain - realm = $realm - private dir = $privatedir - pid directory = $piddir - ncalrpc dir = $ncalrpcdir - lock dir = $lockdir - setup directory = $self->{setupdir} - modules dir = $self->{bindir}/modules - js include = $srcdir/scripting/libjs - winbindd socket directory = $winbindd_socket_dir - winbind separator = / - name resolve order = bcast - interfaces = $interfaces - tls dh params file = $tlsdir/dhparms.pem - panic action = $srcdir/script/gdb_backtrace \%PID% \%PROG% - wins support = yes - server role = $server_role - max xmit = 32K - server max protocol = SMB2 - notify:inotify = false - ldb:nosync = true - system:anonymous = true -#We don't want to pass our self-tests if the PAC code is wrong - gensec:require_pac = true - log level = $smbd_loglevel - -[tmp] - path = $tmpdir - read only = no - ntvfs handler = posix - posix:sharedelay = 100000 - posix:eadb = $lockdir/eadb.tdb - -[cifs] - read only = no - ntvfs handler = cifs - cifs:server = $netbiosname - cifs:share = tmp -#There is no username specified here, instead the client is expected -#to log in with kerberos, and smbd will used delegated credentials. - -[simple] - path = $tmpdir - read only = no - ntvfs handler = simple - -[cifsposix] - copy = simple - ntvfs handler = cifsposix -"; - close(CONFFILE); - - $self->mk_keyblobs($tlsdir); - - open(KRB5CONF, ">$krb5_config"); - print KRB5CONF " -#Generated krb5.conf for $realm - -[libdefaults] - default_realm = $realm - dns_lookup_realm = false - dns_lookup_kdc = false - ticket_lifetime = 24h - forwardable = yes - -[realms] - $realm = { - kdc = 127.0.0.1:88 - admin_server = 127.0.0.1:88 - default_domain = $dnsname - } - $dnsname = { - kdc = 127.0.0.1:88 - admin_server = 127.0.0.1:88 - default_domain = $dnsname - } - $domain = { - kdc = 127.0.0.1:88 - admin_server = 127.0.0.1:88 - default_domain = $dnsname - } - -[appdefaults] - pkinit_anchors = FILE:$tlsdir/ca.pem - -[kdc] - enable-pkinit = true - pkinit_identity = FILE:$tlsdir/kdc.pem,$tlsdir/key.pem - pkinit_anchors = FILE:$tlsdir/ca.pem - -[domain_realm] - .$dnsname = $realm -"; - close(KRB5CONF); - - open(PWD, ">$nsswrap_passwd"); - print PWD " -root:x:0:0:root gecos:$prefix_abs:/bin/false -$unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false -nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false -"; - close(PWD); - - open(GRP, ">$nsswrap_group"); - print GRP " -root:x:0: -wheel:x:10: -users:x:100: -nobody:x:65533: -nogroup:x:65534:nobody -"; - close(GRP); - -#Ensure the config file is valid before we start - if (system("$self->{bindir}/testparm $configuration -v --suppress-prompt >/dev/null 2>&1") != 0) { - system("$self->{bindir}/testparm -v --suppress-prompt $configuration >&2"); - die("Failed to create a valid smb.conf configuration!"); - } - - (system("($self->{bindir}/testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global 2> /dev/null | grep -i \"^$netbiosname\" ) >/dev/null 2>&1") == 0) or die("Failed to create a valid smb.conf configuration! $self->{bindir}/testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global"); - - my @provision_options = (); - push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\""); - push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\""); - if (defined($ENV{PROVISION_PYTHON})) { - push (@provision_options, "$self->{bindir}/smbpython"); - push (@provision_options, "$self->{setupdir}/provision.py"); - } else { - push (@provision_options, "$self->{bindir}/smbscript"); - push (@provision_options, "$self->{setupdir}/provision"); - } - push (@provision_options, split(' ', $configuration)); - push (@provision_options, "--host-name=$netbiosname"); - push (@provision_options, "--host-ip=$ifaceipv4"); - push (@provision_options, "--quiet"); - push (@provision_options, "--domain=$domain"); - push (@provision_options, "--realm=$realm"); - push (@provision_options, "--adminpass=$password"); - push (@provision_options, "--krbtgtpass=krbtgt$password"); - push (@provision_options, "--machinepass=machine$password"); - push (@provision_options, "--root=$unix_name"); - push (@provision_options, "--simple-bind-dn=cn=Manager,$localbasedn"); - push (@provision_options, "--password=$password"); - push (@provision_options, "--server-role=\"$server_role\""); - - my $ldap_uri= "$ldapdir/ldapi"; - $ldap_uri =~ s|/|%2F|g; - $ldap_uri = "ldapi://$ldap_uri"; - - my $ret = { - KRB5_CONFIG => $krb5_config, - PIDDIR => $piddir, - SERVER => $netbiosname, - SERVER_IP => $ifaceipv4, - NETBIOSNAME => $netbiosname, - NETBIOSALIAS => $netbiosalias, - LDAP_URI => $ldap_uri, - DOMAIN => $domain, - USERNAME => $username, - REALM => $realm, - PASSWORD => $password, - LDAPDIR => $ldapdir, - WINBINDD_SOCKET_DIR => $winbindd_socket_dir, - WINBINDD_PRIV_PIPE_DIR => $winbindd_priv_pipe_dir, - NCALRPCDIR => $ncalrpcdir, - LOCKDIR => $lockdir, - CONFIGURATION => $configuration, - SOCKET_WRAPPER_DEFAULT_IFACE => $swiface, - NSS_WRAPPER_PASSWD => $nsswrap_passwd, - NSS_WRAPPER_GROUP => $nsswrap_group, - }; - - if (defined($self->{ldap})) { - - push (@provision_options, "--ldap-backend=$ldap_uri"); - system("$self->{bindir}/smbscript $self->{setupdir}/provision-backend $configuration --ldap-manager-pass=$password --root=$unix_name --realm=$realm --host-name=$netbiosname --ldap-backend-type=$self->{ldap}>&2") == 0 or die("backend provision failed"); - - if ($self->{ldap} eq "openldap") { - ($ret->{SLAPD_CONF}, $ret->{OPENLDAP_PIDFILE}) = $self->mk_openldap($ldapdir, $configuration) or die("Unable to create openldap directories"); - } elsif ($self->{ldap} eq "fedora-ds") { - ($ret->{FEDORA_DS_DIR}, $ret->{FEDORA_DS_PIDFILE}) = $self->mk_fedora_ds($ldapdir, $configuration) or die("Unable to create fedora ds directories"); - push (@provision_options, "--ldap-module=nsuniqueid"); - push (@provision_options, "'--aci=aci:: KHRhcmdldGF0dHIgPSAiKiIpICh2ZXJzaW9uIDMuMDthY2wgImZ1bGwgYWNjZXNzIHRvIGFsbCBieSBhbGwiO2FsbG93IChhbGwpKHVzZXJkbiA9ICJsZGFwOi8vL2FueW9uZSIpOykK'"); - } - - $self->slapd_start($ret) or - die("couldn't start slapd"); - } - - my $provision_cmd = join(" ", @provision_options); - (system($provision_cmd) == 0) or die("Unable to provision: \n$provision_cmd\n"); - - if (defined($self->{ldap})) { - $self->slapd_stop($ret) or - die("couldn't stop slapd"); - } - - return $ret; -} - -sub provision_member($$$) -{ - my ($self, $prefix, $dcvars) = @_; - print "PROVISIONING MEMBER..."; - - my $ret = $self->provision($prefix, - "member server", - "localmember3", - "localmember", - 3, - "localmemberpass"); - - $ret or die("Unable to provision"); - - my $cmd = ""; - $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; - $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; - $cmd .= "$self->{bindir}/net join $ret->{CONFIGURATION} $dcvars->{DOMAIN} member"; - $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}"; - - system($cmd) == 0 or die("Join failed\n$cmd"); - - $ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo"; - $ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; - $ret->{SMBD_TEST_LOG_POS} = 0; - - $ret->{DC_SERVER} = $dcvars->{SERVER}; - $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP}; - $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME}; - $ret->{DC_NETBIOSALIAS} = $dcvars->{NETBIOSALIAS}; - $ret->{DC_USERNAME} = $dcvars->{USERNAME}; - $ret->{DC_PASSWORD} = $dcvars->{PASSWORD}; - - return $ret; -} - -sub provision_dc($$) -{ - my ($self, $prefix) = @_; - - print "PROVISIONING DC..."; - my $ret = $self->provision($prefix, - "domain controller", - "localdc1", - "localdc", - 1, - "localdcpass"); - - $self->add_wins_config("$prefix/private") or - die("Unable to add wins configuration"); - - $ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo"; - $ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; - $ret->{SMBD_TEST_LOG_POS} = 0; - return $ret; -} - -sub teardown_env($$) -{ - my ($self, $envvars) = @_; - my $pid; - - close(DATA); - - if (-f "$envvars->{PIDDIR}/smbd.pid" ) { - open(IN, "<$envvars->{PIDDIR}/smbd.pid") or die("unable to open smbd pid file"); - $pid = ; - close(IN); - - # Give the process 20 seconds to exit. gcov needs - # this time to write out the covarge data - my $count = 0; - until (kill(0, $pid) == 0) { - # if no process sucessfully signalled, then we are done - sleep(1); - $count++; - last if $count > 20; - } - - # If it is still around, kill it - if ($count > 20) { - print "smbd process $pid took more than $count seconds to exit, killing\n"; - kill 9, $pid; - } - } - - my $failed = $? >> 8; - - $self->slapd_stop($envvars) if ($self->{ldap}); - - print $self->getlog_env($envvars); - - return $failed; -} - -sub getlog_env($$) -{ - my ($self, $envvars) = @_; - my $title = "SMBD LOG of: $envvars->{NETBIOSNAME}\n"; - my $out = $title; - - open(LOG, "<$envvars->{SMBD_TEST_LOG}"); - - seek(LOG, $envvars->{SMBD_TEST_LOG_POS}, SEEK_SET); - while () { - $out .= $_; - } - $envvars->{SMBD_TEST_LOG_POS} = tell(LOG); - close(LOG); - - return "" if $out eq $title; - - return $out; -} - -sub check_env($$) -{ - my ($self, $envvars) = @_; - - return 1 if (-p $envvars->{SMBD_TEST_FIFO}); - - print $self->getlog_env($envvars); - - return 0; -} - -sub setup_env($$$) -{ - my ($self, $envname, $path) = @_; - - if ($envname eq "dc") { - return $self->setup_dc("$path/dc"); - } elsif ($envname eq "member") { - if (not defined($self->{vars}->{dc})) { - $self->setup_dc("$path/dc"); - } - return $self->setup_member("$path/member", $self->{vars}->{dc}); - } else { - die("Samba4 can't provide environment '$envname'"); - } -} - -sub setup_member($$$$) -{ - my ($self, $path, $dc_vars) = @_; - - my $env = $self->provision_member($path, $dc_vars); - - $self->check_or_start($env, ($ENV{SMBD_MAXTIME} or 7500)); - - $self->wait_for_start($env); - - return $env; -} - -sub setup_dc($$) -{ - my ($self, $path) = @_; - - my $env = $self->provision_dc($path); - - $self->check_or_start($env, - ($ENV{SMBD_MAXTIME} or 7500)); - - $self->wait_for_start($env); - - $self->{vars}->{dc} = $env; - - return $env; -} - -sub stop($) -{ - my ($self) = @_; -} - -1; diff --git a/source4/selftest/env/Windows.pm b/source4/selftest/env/Windows.pm deleted file mode 100644 index d0c90d7f7b..0000000000 --- a/source4/selftest/env/Windows.pm +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/perl -# Bootstrap Samba and run a number of tests against it. -# Copyright (C) 2005-2007 Jelmer Vernooij -# Published under the GNU GPL, v3 or later. - -package Windows; - -use strict; -use FindBin qw($RealBin); -use POSIX; - -sub new($) -{ - my ($classname) = @_; - my $self = { }; - bless $self; - return $self; -} - -sub provision($$$) -{ - my ($self, $environment, $prefix) = @_; - - die ("Windows tests will not run without root privileges.") - if (`whoami` ne "root"); - - die("Environment variable WINTESTCONF has not been defined.\n". - "Windows tests will not run unconfigured.") if (not defined($ENV{WINTESTCONF})); - - die ("$ENV{WINTESTCONF} could not be read.") if (! -r $ENV{WINTESTCONF}); - - $ENV{WINTEST_DIR}="$ENV{SRCDIR}/selftest/win"; -} - -sub setup_env($$) -{ - my ($self, $name) = @_; -} - -1; diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 96409558b1..46c3846b54 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -67,7 +67,7 @@ these tests will be counted as successes, successes will be counted as failures. The format for the file is, one entry per line: -TESTSUITE-NAME/TEST-NAME +TESTSUITE-NAME.TEST-NAME The reason for a test can also be specified, by adding a hash sign (#) and the reason after the test name. @@ -130,9 +130,6 @@ use POSIX; use Cwd qw(abs_path); use lib "$RealBin"; use Subunit qw(parse_results); -use env::Samba3; -use env::Samba4; -use env::Windows; use SocketWrapper; my $opt_help = 0; @@ -429,17 +426,20 @@ my $testenv_default = "none"; if ($opt_target eq "samba4") { $testenv_default = "member"; + use target::Samba4; $target = new Samba4($opt_bindir or "$srcdir/bin", $ldap, "$srcdir/setup"); } elsif ($opt_target eq "samba3") { if ($opt_socket_wrapper and `$opt_bindir/smbd -b | grep SOCKET_WRAPPER` eq "") { die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting...."); } $testenv_default = "dc"; + use target::Samba3; $target = new Samba3($opt_bindir); } elsif ($opt_target eq "win") { die("Windows tests will not run with socket wrapper enabled.") if ($opt_socket_wrapper); $testenv_default = "dc"; + use target::Windows; $target = new Windows(); } @@ -741,7 +741,6 @@ sub teardown_env($) delete $running_envs{$envname}; } - if ($opt_no_lazy_setup) { setup_env($_) foreach (keys %required_envs); } diff --git a/source4/selftest/target/Samba3.pm b/source4/selftest/target/Samba3.pm new file mode 100644 index 0000000000..b0c4eb22bd --- /dev/null +++ b/source4/selftest/target/Samba3.pm @@ -0,0 +1,434 @@ +#!/usr/bin/perl +# Bootstrap Samba and run a number of tests against it. +# Copyright (C) 2005-2007 Jelmer Vernooij +# Published under the GNU GPL, v3 or later. + +package Samba3; + +use strict; +use Cwd qw(abs_path); +use FindBin qw($RealBin); +use POSIX; + +sub binpath($$) +{ + my ($self, $binary) = @_; + + if (defined($self->{bindir})) { + my $path = "$self->{bindir}/$binary"; + -f $path or die("File $path doesn't exist"); + return $path; + } + + return $binary; +} + +sub new($$) { + my ($classname, $bindir) = @_; + my $self = { bindir => $bindir }; + bless $self; + return $self; +} + +sub teardown_env($$) +{ + my ($self, $envvars) = @_; + + my $smbdpid = read_pid($envvars, "smbd"); + my $nmbdpid = read_pid($envvars, "nmbd"); +# my $winbinddpid = read_pid($envvars, "winbindd"); + + $self->stop_sig_term($smbdpid); + $self->stop_sig_term($nmbdpid); +# $self->stop_sig_term($winbinddpid); + $self->stop_sig_kill($smbdpid); + $self->stop_sig_kill($nmbdpid); +# $self->stop_sig_kill($winbinddpid); + + return 0; +} + +sub getlog_env_app($$$) +{ + my ($self, $envvars, $name) = @_; + + my $title = "$name LOG of: $envvars->{NETBIOSNAME}\n"; + my $out = $title; + + open(LOG, "<".$envvars->{$name."_TEST_LOG"}); + + seek(LOG, $envvars->{$name."_TEST_LOG_POS"}, SEEK_SET); + while () { + $out .= $_; + } + $envvars->{$name."_TEST_LOG_POS"} = tell(LOG); + close(LOG); + + return "" if $out eq $title; + + return $out; +} + +sub getlog_env($$) +{ + my ($self, $envvars) = @_; + my $ret = ""; + + $ret .= $self->getlog_env_app($envvars, "SMBD"); + $ret .= $self->getlog_env_app($envvars, "NMBD"); +# $ret .= $self->getlog_env_app($envvars, "WINBINDD"); + + return $ret; +} + +sub check_env($$) +{ + my ($self, $envvars) = @_; + + # TODO ... + return 1; +} + +sub setup_env($$$) +{ + my ($self, $envname, $path) = @_; + + if ($envname eq "dc") { + return $self->setup_dc("$path/dc"); + } else { + return undef; + } +} + +sub setup_dc($$) +{ + my ($self, $path) = @_; + + my $vars = $self->provision($path, "dc"); + + $self->check_or_start($vars, + ($ENV{NMBD_MAXTIME} or 2700), + ($ENV{WINBINDD_MAXTIME} or 2700), + ($ENV{SMBD_MAXTIME} or 2700)); + + $self->wait_for_start($vars); + + return $vars; +} + +sub stop($) +{ + my ($self) = @_; +} + +sub stop_sig_term($$) { + my ($self, $pid) = @_; + kill("USR1", $pid) or kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); +} + +sub stop_sig_kill($$) { + my ($self, $pid) = @_; + kill("ALRM", $pid) or warn("Unable to kill $pid: $!"); +} + +sub write_pid($$$) +{ + my ($env_vars, $app, $pid) = @_; + + open(PID, ">$env_vars->{PIDDIR}/timelimit.$app.pid"); + print PID $pid; + close(PID); +} + +sub read_pid($$) +{ + my ($env_vars, $app) = @_; + + open(PID, "<$env_vars->{PIDDIR}/timelimit.$app.pid"); + my $pid = ; + close(PID); + return $pid; +} + +sub check_or_start($$$$) { + my ($self, $env_vars, $nmbd_maxtime, $winbindd_maxtime, $smbd_maxtime) = @_; + + unlink($env_vars->{NMBD_TEST_LOG}); + print "STARTING NMBD..."; + my $pid = fork(); + if ($pid == 0) { + open STDOUT, ">$env_vars->{NMBD_TEST_LOG}"; + open STDERR, '>&STDOUT'; + + $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; + + my @optargs = ("-d0"); + if (defined($ENV{NMBD_OPTIONS})) { + @optargs = split(/ /, $ENV{NMBD_OPTIONS}); + } + + $ENV{MAKE_TEST_BINARY} = $self->binpath("nmbd"); + + my @preargs = ($self->binpath("timelimit"), $nmbd_maxtime); + if(defined($ENV{NMBD_VALGRIND})) { + @preargs = split(/ /, $ENV{NMBD_VALGRIND}); + } + + exec(@preargs, $self->binpath("nmbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start nmbd: $!"); + } + write_pid($env_vars, "nmbd", $pid); + print "DONE\n"; + +# disable winbindd until the build-farm faked_users work with it +# unlink($env_vars->{WINBINDD_TEST_LOG}); +# print "STARTING WINBINDD..."; +# $pid = fork(); +# if ($pid == 0) { +# open STDOUT, ">$env_vars->{WINBINDD_TEST_LOG}"; +# open STDERR, '>&STDOUT'; +# +# $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; +# +# my @optargs = ("-d0"); +# if (defined($ENV{WINBINDD_OPTIONS})) { +# @optargs = split(/ /, $ENV{WINBINDD_OPTIONS}); +# } +# +# $ENV{MAKE_TEST_BINARY} = $self->binpath("winbindd"); +# exec($self->binpath("timelimit"), $winbindd_maxtime, $ENV{WINBINDD_VALGRIND}, $self->binpath("winbindd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start winbindd: $!"); +# } +# write_pid($env_vars, "winbindd", $pid); +# print "DONE\n"; + + unlink($env_vars->{SMBD_TEST_LOG}); + print "STARTING SMBD..."; + $pid = fork(); + if ($pid == 0) { + open STDOUT, ">$env_vars->{SMBD_TEST_LOG}"; + open STDERR, '>&STDOUT'; + + $ENV{WINBINDD_SOCKET_DIR} = $env_vars->{WINBINDD_SOCKET_DIR}; + + $ENV{MAKE_TEST_BINARY} = $self->binpath("smbd"); + my @optargs = ("-d0"); + if (defined($ENV{SMBD_OPTIONS})) { + @optargs = split(/ /, $ENV{SMBD_OPTIONS}); + } + my @preargs = ($self->binpath("timelimit"), $smbd_maxtime); + if(defined($ENV{SMBD_VALGRIND})) { + @preargs = split(/ /,$ENV{SMBD_VALGRIND}); + } + exec(@preargs, $self->binpath("smbd"), "-F", "-S", "--no-process-group", "-s", $env_vars->{SERVERCONFFILE}, @optargs) or die("Unable to start smbd: $!"); + } + write_pid($env_vars, "smbd", $pid); + print "DONE\n"; + + return 0; +} + +sub create_clientconf($$$) +{ + my ($self, $prefix, $domain) = @_; + + my $lockdir = "$prefix/locks"; + my $logdir = "$prefix/logs"; + my $piddir = "$prefix/pid"; + my $privatedir = "$prefix/private"; + my $scriptdir = "$RealBin/.."; + my $conffile = "$prefix/smb.conf"; + + my $torture_interfaces='127.0.0.6/8,127.0.0.7/8,127.0.0.8/8,127.0.0.9/8,127.0.0.10/8,127.0.0.11/8'; + open(CONF, ">$conffile"); + print CONF " +[global] + workgroup = $domain + + private dir = $privatedir + pid directory = $piddir + lock directory = $lockdir + log file = $logdir/log.\%m + log level = 0 + + name resolve order = bcast + + netbios name = TORTURE_6 + interfaces = $torture_interfaces + panic action = $scriptdir/gdb_backtrace \%d %\$(MAKE_TEST_BINARY) + + passdb backend = tdbsam + "; + close(CONF); +} + +sub provision($$$) +{ + my ($self, $prefix, $role) = @_; + + ## + ## setup the various environment variables we need + ## + + my %ret = (); + my $server = "LOCALHOST2"; + my $server_ip = "127.0.0.2"; + my $domain = "SAMBA-TEST"; + + my $username = `PATH=/usr/ucb:$ENV{PATH} whoami`; + chomp $username; + my $password = "test"; + + my $srcdir="$RealBin/.."; + my $scriptdir="$srcdir/selftest"; + my $prefix_abs = abs_path($prefix); + + my @dirs = (); + + my $shrdir="$prefix_abs/share"; + push(@dirs,$shrdir); + + my $libdir="$prefix_abs/lib"; + push(@dirs,$libdir); + + my $piddir="$prefix_abs/pid"; + push(@dirs,$piddir); + + my $privatedir="$prefix_abs/private"; + push(@dirs,$privatedir); + + my $lockdir="$prefix_abs/lockdir"; + push(@dirs,$lockdir); + + my $logdir="$prefix_abs/logs"; + push(@dirs,$logdir); + + # this gets autocreated by winbindd + my $wbsockdir="$prefix_abs/winbindd"; + my $wbsockprivdir="$lockdir/winbindd_privileged"; + + ## + ## create the test directory layout + ## + mkdir($prefix_abs, 0777); + print "CREATE TEST ENVIRONMENT IN '$prefix'..."; + system("rm -rf $prefix_abs/*"); + mkdir($_, 0777) foreach(@dirs); + + my $conffile="$libdir/server.conf"; + + open(CONF, ">$conffile") or die("Unable to open $conffile"); + print CONF " +[global] + workgroup = $domain + + private dir = $privatedir + pid directory = $piddir + lock directory = $lockdir + log file = $logdir/log.\%m + log level = 0 + + name resolve order = bcast + + netbios name = $server + interfaces = $server_ip/8 + bind interfaces only = yes + panic action = $scriptdir/gdb_backtrace %d %\$(MAKE_TEST_BINARY) + + passdb backend = tdbsam + + ; Necessary to add the build farm hacks + add user script = /bin/false + add machine script = /bin/false + + kernel oplocks = no + kernel change notify = no + + syslog = no + printing = bsd + printcap name = /dev/null + +"; + + if ($role eq "dc") { + print CONF "\tdomain logons = yes\n"; + print CONF "\tdomain master = yes\n"; + } + +print CONF " + + winbindd:socket dir = $wbsockdir + +[tmp] + path = $shrdir + read only = no + smbd:sharedelay = 100000 + map hidden = yes + map system = yes + create mask = 755 +[hideunread] + copy = tmp + hide unreadable = yes +[hideunwrite] + copy = tmp + hide unwriteable files = yes +[print1] + copy = tmp + printable = yes + printing = test +[print2] + copy = print1 +[print3] + copy = print1 +[print4] + copy = print1 + "; + close(CONF); + + ## + ## create a test account + ## + + open(PWD, "|".$self->binpath("smbpasswd")." -c $conffile -L -s -a $username"); + print PWD "$password\n$password\n"; + close(PWD) or die("Unable to set password for test account"); + + print "DONE\n"; + + $ret{SERVER_IP} = $server_ip; + $ret{NMBD_TEST_LOG} = "$prefix/nmbd_test.log"; + $ret{WINBINDD_TEST_LOG} = "$prefix/winbindd_test.log"; + $ret{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; + $ret{SERVERCONFFILE} = $conffile; + $ret{CONFIGURATION} ="-s $conffile"; + $ret{SERVER} = $server; + $ret{USERNAME} = $username; + $ret{DOMAIN} = $domain; + $ret{NETBIOSNAME} = $server; + $ret{PASSWORD} = $password; + $ret{PIDDIR} = $piddir; + $ret{WINBINDD_SOCKET_DIR} = $wbsockdir; + $ret{WINBINDD_PRIV_PIPE_DIR} = $wbsockprivdir; + return \%ret; +} + +sub wait_for_start($$) +{ + my ($self, $envvars) = @_; + + # give time for nbt server to register its names + print "delaying for nbt name registration\n"; + sleep(10); + # This will return quickly when things are up, but be slow if we need to wait for (eg) SSL init + system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} __SAMBA__"); + system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} __SAMBA__"); + system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U 127.255.255.255 __SAMBA__"); + system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} -U $envvars->{SERVER_IP} $envvars->{SERVER}"); + system($self->binpath("nmblookup") ." $envvars->{CONFIGURATION} $envvars->{SERVER}"); + # make sure smbd is also up set + print "wait for smbd\n"; + system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2"); + system($self->binpath("smbclient") ." $envvars->{CONFIGURATION} -L $envvars->{SERVER_IP} -U% -p 139 | head -2"); + + print $self->getlog_env($envvars); +} + +1; diff --git a/source4/selftest/target/Samba4.pm b/source4/selftest/target/Samba4.pm new file mode 100644 index 0000000000..87a86ef06f --- /dev/null +++ b/source4/selftest/target/Samba4.pm @@ -0,0 +1,915 @@ +#!/usr/bin/perl +# Bootstrap Samba and run a number of tests against it. +# Copyright (C) 2005-2007 Jelmer Vernooij +# Published under the GNU GPL, v3 or later. + +package Samba4; + +use strict; +use Cwd qw(abs_path); +use FindBin qw($RealBin); +use POSIX; + +sub new($$$$) { + my ($classname, $bindir, $ldap, $setupdir) = @_; + my $self = { + vars => {}, + ldap => $ldap, + bindir => $bindir, + setupdir => $setupdir + }; + bless $self; + return $self; +} + +sub openldap_start($$$) { + my ($slapd_conf, $uri, $logs) = @_; + my $oldpath = $ENV{PATH}; + my $olroot = ""; + my $olpath = ""; + if (defined $ENV{OPENLDAP_ROOT}) { + $olroot = "$ENV{OPENLDAP_ROOT}"; + $olpath = "$olroot/libexec:$olroot/sbin:"; + } + $ENV{PATH} = "$olpath/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; + system("slapd -d63 -f $slapd_conf -h $uri > $logs 2>&1 &"); + $ENV{PATH} = $oldpath; +} + +sub slapd_start($$) +{ + my $count = 0; + my ($self, $env_vars) = @_; + + my $uri = $env_vars->{LDAP_URI}; + + # running slapd in the background means it stays in the same process group, so it can be + # killed by timelimit + if ($self->{ldap} eq "fedora-ds") { + system("$ENV{FEDORA_DS_ROOT}/sbin/ns-slapd -D $env_vars->{FEDORA_DS_DIR} -d0 -i $env_vars->{FEDORA_DS_PIDFILE}> $env_vars->{LDAPDIR}/logs 2>&1 &"); + } elsif ($self->{ldap} eq "openldap") { + openldap_start($env_vars->{SLAPD_CONF}, $uri, "$env_vars->{LDAPDIR}/logs"); + } + while (system("$self->{bindir}/ldbsearch -H $uri -s base -b \"\" supportedLDAPVersion > /dev/null") != 0) { + $count++; + if ($count > 40) { + $self->slapd_stop($env_vars); + return 0; + } + sleep(1); + } + return 1; +} + +sub slapd_stop($$) +{ + my ($self, $envvars) = @_; + if ($self->{ldap} eq "fedora-ds") { + system("$envvars->{LDAPDIR}/slapd-samba4/stop-slapd"); + } elsif ($self->{ldap} eq "openldap") { + open(IN, "<$envvars->{OPENLDAP_PIDFILE}") or + die("unable to open slapd pid file: $envvars->{OPENLDAP_PIDFILE}"); + kill 9, ; + close(IN); + } + return 1; +} + +sub check_or_start($$$) +{ + my ($self, $env_vars, $max_time) = @_; + return 0 if ( -p $env_vars->{SMBD_TEST_FIFO}); + + unlink($env_vars->{SMBD_TEST_FIFO}); + POSIX::mkfifo($env_vars->{SMBD_TEST_FIFO}, 0700); + unlink($env_vars->{SMBD_TEST_LOG}); + + print "STARTING SMBD... "; + my $pid = fork(); + if ($pid == 0) { + open STDIN, $env_vars->{SMBD_TEST_FIFO}; + open STDOUT, ">$env_vars->{SMBD_TEST_LOG}"; + open STDERR, '>&STDOUT'; + + SocketWrapper::set_default_iface($env_vars->{SOCKET_WRAPPER_DEFAULT_IFACE}); + + my $valgrind = ""; + if (defined($ENV{SMBD_VALGRIND})) { + $valgrind = $ENV{SMBD_VALGRIND}; + } + + $ENV{KRB5_CONFIG} = $env_vars->{KRB5_CONFIG}; + + $ENV{NSS_WRAPPER_PASSWD} = $env_vars->{NSS_WRAPPER_PASSWD}; + $ENV{NSS_WRAPPER_GROUP} = $env_vars->{NSS_WRAPPER_GROUP}; + + # Start slapd before smbd, but with the fifo on stdin + if (defined($self->{ldap})) { + $self->slapd_start($env_vars) or + die("couldn't start slapd (2nd time)"); + } + + my $optarg = ""; + if (defined($max_time)) { + $optarg = "--maximum-runtime=$max_time "; + } + if (defined($ENV{SMBD_OPTIONS})) { + $optarg.= " $ENV{SMBD_OPTIONS}"; + } + my $ret = system("$valgrind $self->{bindir}/smbd $optarg $env_vars->{CONFIGURATION} -M single -i --leak-report-full"); + if ($? == -1) { + print "Unable to start smbd: $ret: $!\n"; + exit 1; + } + unlink($env_vars->{SMBD_TEST_FIFO}); + my $exit = $? >> 8; + if ( $ret == 0 ) { + print "smbd exits with status $exit\n"; + } elsif ( $ret & 127 ) { + print "smbd got signal ".($ret & 127)." and exits with $exit!\n"; + } else { + $ret = $? >> 8; + print "smbd failed with status $exit!\n"; + } + exit $exit; + } + print "DONE\n"; + + open(DATA, ">$env_vars->{SMBD_TEST_FIFO}"); + + return $pid; +} + +sub wait_for_start($$) +{ + my ($self, $testenv_vars) = @_; + # give time for nbt server to register its names + print "delaying for nbt name registration\n"; + sleep 2; + + # This will return quickly when things are up, but be slow if we + # need to wait for (eg) SSL init + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{SERVER}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSNAME}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSALIAS}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSALIAS}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{SERVER}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{SERVER}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSNAME}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSNAME}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} $testenv_vars->{NETBIOSALIAS}"); + system("bin/nmblookup $testenv_vars->{CONFIGURATION} -U $testenv_vars->{SERVER_IP} $testenv_vars->{NETBIOSALIAS}"); + + print $self->getlog_env($testenv_vars); +} + +sub write_ldb_file($$$) +{ + my ($self, $file, $ldif) = @_; + + open(LDIF, "|$self->{bindir}/ldbadd -H $file >/dev/null"); + print LDIF $ldif; + return close(LDIF); +} + +sub add_wins_config($$) +{ + my ($self, $privatedir) = @_; + + return $self->write_ldb_file("$privatedir/wins_config.ldb", " +dn: name=TORTURE_6,CN=PARTNERS +objectClass: wreplPartner +name: TORTURE_6 +address: 127.0.0.6 +pullInterval: 0 +pushChangeCount: 0 +type: 0x3 +"); +} + +sub mk_fedora_ds($$$) +{ + my ($self, $ldapdir, $configuration) = @_; + + my $fedora_ds_inf = "$ldapdir/fedorads.inf"; + my $fedora_ds_extra_ldif = "$ldapdir/fedorads-partitions.ldif"; + + #Make the subdirectory be as fedora DS would expect + my $fedora_ds_dir = "$ldapdir/slapd-samba4"; + + 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) { + chdir $dir; + die("perl $ENV{FEDORA_DS_ROOT}/sbin/setup-ds.pl --silent --file=$fedora_ds_inf FAILED: $?"); + } + chdir $dir || die; + + return ($fedora_ds_dir, $pidfile); +} + +sub mk_openldap($$$) +{ + my ($self, $ldapdir, $configuration) = @_; + + my $slapd_conf = "$ldapdir/slapd.conf"; + 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 = ""; + if (defined $ENV{OPENLDAP_ROOT}) { + $olroot = "$ENV{OPENLDAP_ROOT}"; + $olpath = "$olroot/libexec:$olroot/sbin:"; + } + $ENV{PATH} = "$olpath/usr/local/sbin:/usr/sbin:/sbin:$ENV{PATH}"; + + unlink($modconf); + open(CONF, ">$modconf"); close(CONF); + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules + print CONF " +modulepath $olroot/libexec/openldap +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules + print CONF " +modulepath $olroot/libexec/openldap +moduleload back_hdb +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules + print CONF " +moduleload back_hdb +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules + print CONF " +modulepath /usr/lib/ldap +moduleload back_hdb +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules (Fedora layout) + print CONF " +modulepath /usr/lib/openldap +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + + if (system("slaptest -u -f $slapd_conf >&2") != 0) { + open(CONF, ">$modconf"); + # enable slapd modules (Fedora x86_64 layout) + print CONF " +modulepath /usr/lib64/openldap +moduleload syncprov +moduleload memberof +moduleload refint +"; + close(CONF); + } + + system("slaptest -u -f $slapd_conf") == 0 or die("slaptest still fails after adding modules"); + + + $ENV{PATH} = $oldpath; + + return ($slapd_conf, $pidfile); +} + +sub mk_keyblobs($$) +{ + my ($self, $tlsdir) = @_; + + #TLS and PKINIT crypto blobs + my $dhfile = "$tlsdir/dhparms.pem"; + my $cafile = "$tlsdir/ca.pem"; + my $certfile = "$tlsdir/cert.pem"; + my $reqkdc = "$tlsdir/req-kdc.der"; + my $kdccertfile = "$tlsdir/kdc.pem"; + my $keyfile = "$tlsdir/key.pem"; + my $adminkeyfile = "$tlsdir/adminkey.pem"; + my $reqadmin = "$tlsdir/req-admin.der"; + my $admincertfile = "$tlsdir/admincert.pem"; + + mkdir($tlsdir, 0777); + + #This is specified here to avoid draining entropy on every run + open(DHFILE, ">$dhfile"); + print DHFILE <$keyfile"); + print KEYFILE <$adminkeyfile"); + + print ADMINKEYFILE <$cafile"); + print CAFILE <$certfile"); + print CERTFILE <$kdccertfile"); + print KDCCERTFILE <$admincertfile"); + print ADMINCERTFILE <; + my $unix_gids_str = $); + my @unix_gids = split(" ", $unix_gids_str); + my $srcdir="$RealBin/.."; + -d $prefix or mkdir($prefix, 0777) or die("Unable to create $prefix"); + my $prefix_abs = abs_path($prefix); + my $tmpdir = "$prefix_abs/tmp"; + my $etcdir = "$prefix_abs/etc"; + my $piddir = "$prefix_abs/pid"; + my $conffile = "$etcdir/smb.conf"; + my $krb5_config = "$etcdir/krb5.conf"; + my $privatedir = "$prefix_abs/private"; + 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 $nsswrap_passwd = "$etcdir/passwd"; + my $nsswrap_group = "$etcdir/group"; + + my $configuration = "--configfile=$conffile"; + my $ldapdir = "$privatedir/ldap"; + + my $tlsdir = "$privatedir/tls"; + + my $ifaceipv4 = "127.0.0.$swiface"; + my $interfaces = "$ifaceipv4/8"; + + (system("rm -rf $prefix/*") == 0) or die("Unable to clean up"); + mkdir($_, 0777) foreach ($privatedir, $etcdir, $piddir, $ncalrpcdir, $lockdir, + $tmpdir); + + + my $localbasedn = $basedn; + $localbasedn = "DC=$netbiosname" if $server_role eq "member server"; + + open(CONFFILE, ">$conffile"); + print CONFFILE " +[global] + netbios name = $netbiosname + netbios aliases = $netbiosalias + workgroup = $domain + realm = $realm + private dir = $privatedir + pid directory = $piddir + ncalrpc dir = $ncalrpcdir + lock dir = $lockdir + setup directory = $self->{setupdir} + modules dir = $self->{bindir}/modules + js include = $srcdir/scripting/libjs + winbindd socket directory = $winbindd_socket_dir + winbind separator = / + name resolve order = bcast + interfaces = $interfaces + tls dh params file = $tlsdir/dhparms.pem + panic action = $srcdir/script/gdb_backtrace \%PID% \%PROG% + wins support = yes + server role = $server_role + max xmit = 32K + server max protocol = SMB2 + notify:inotify = false + ldb:nosync = true + system:anonymous = true +#We don't want to pass our self-tests if the PAC code is wrong + gensec:require_pac = true + log level = $smbd_loglevel + +[tmp] + path = $tmpdir + read only = no + ntvfs handler = posix + posix:sharedelay = 100000 + posix:eadb = $lockdir/eadb.tdb + +[cifs] + read only = no + ntvfs handler = cifs + cifs:server = $netbiosname + cifs:share = tmp +#There is no username specified here, instead the client is expected +#to log in with kerberos, and smbd will used delegated credentials. + +[simple] + path = $tmpdir + read only = no + ntvfs handler = simple + +[cifsposix] + copy = simple + ntvfs handler = cifsposix +"; + close(CONFFILE); + + $self->mk_keyblobs($tlsdir); + + open(KRB5CONF, ">$krb5_config"); + print KRB5CONF " +#Generated krb5.conf for $realm + +[libdefaults] + default_realm = $realm + dns_lookup_realm = false + dns_lookup_kdc = false + ticket_lifetime = 24h + forwardable = yes + +[realms] + $realm = { + kdc = 127.0.0.1:88 + admin_server = 127.0.0.1:88 + default_domain = $dnsname + } + $dnsname = { + kdc = 127.0.0.1:88 + admin_server = 127.0.0.1:88 + default_domain = $dnsname + } + $domain = { + kdc = 127.0.0.1:88 + admin_server = 127.0.0.1:88 + default_domain = $dnsname + } + +[appdefaults] + pkinit_anchors = FILE:$tlsdir/ca.pem + +[kdc] + enable-pkinit = true + pkinit_identity = FILE:$tlsdir/kdc.pem,$tlsdir/key.pem + pkinit_anchors = FILE:$tlsdir/ca.pem + +[domain_realm] + .$dnsname = $realm +"; + close(KRB5CONF); + + open(PWD, ">$nsswrap_passwd"); + print PWD " +root:x:0:0:root gecos:$prefix_abs:/bin/false +$unix_name:x:$unix_uid:$unix_gids[0]:$unix_name gecos:$prefix_abs:/bin/false +nobody:x:65534:65533:nobody gecos:$prefix_abs:/bin/false +"; + close(PWD); + + open(GRP, ">$nsswrap_group"); + print GRP " +root:x:0: +wheel:x:10: +users:x:100: +nobody:x:65533: +nogroup:x:65534:nobody +"; + close(GRP); + +#Ensure the config file is valid before we start + if (system("$self->{bindir}/testparm $configuration -v --suppress-prompt >/dev/null 2>&1") != 0) { + system("$self->{bindir}/testparm -v --suppress-prompt $configuration >&2"); + die("Failed to create a valid smb.conf configuration!"); + } + + (system("($self->{bindir}/testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global 2> /dev/null | grep -i \"^$netbiosname\" ) >/dev/null 2>&1") == 0) or die("Failed to create a valid smb.conf configuration! $self->{bindir}/testparm $configuration -v --suppress-prompt --parameter-name=\"netbios name\" --section-name=global"); + + my @provision_options = (); + push (@provision_options, "NSS_WRAPPER_PASSWD=\"$nsswrap_passwd\""); + push (@provision_options, "NSS_WRAPPER_GROUP=\"$nsswrap_group\""); + if (defined($ENV{PROVISION_PYTHON})) { + push (@provision_options, "$self->{bindir}/smbpython"); + push (@provision_options, "$self->{setupdir}/provision.py"); + } else { + push (@provision_options, "$self->{bindir}/smbscript"); + push (@provision_options, "$self->{setupdir}/provision"); + } + push (@provision_options, split(' ', $configuration)); + push (@provision_options, "--host-name=$netbiosname"); + push (@provision_options, "--host-ip=$ifaceipv4"); + push (@provision_options, "--quiet"); + push (@provision_options, "--domain=$domain"); + push (@provision_options, "--realm=$realm"); + push (@provision_options, "--adminpass=$password"); + push (@provision_options, "--krbtgtpass=krbtgt$password"); + push (@provision_options, "--machinepass=machine$password"); + push (@provision_options, "--root=$unix_name"); + push (@provision_options, "--simple-bind-dn=cn=Manager,$localbasedn"); + push (@provision_options, "--password=$password"); + push (@provision_options, "--server-role=\"$server_role\""); + + my $ldap_uri= "$ldapdir/ldapi"; + $ldap_uri =~ s|/|%2F|g; + $ldap_uri = "ldapi://$ldap_uri"; + + my $ret = { + KRB5_CONFIG => $krb5_config, + PIDDIR => $piddir, + SERVER => $netbiosname, + SERVER_IP => $ifaceipv4, + NETBIOSNAME => $netbiosname, + NETBIOSALIAS => $netbiosalias, + LDAP_URI => $ldap_uri, + DOMAIN => $domain, + USERNAME => $username, + REALM => $realm, + PASSWORD => $password, + LDAPDIR => $ldapdir, + WINBINDD_SOCKET_DIR => $winbindd_socket_dir, + WINBINDD_PRIV_PIPE_DIR => $winbindd_priv_pipe_dir, + NCALRPCDIR => $ncalrpcdir, + LOCKDIR => $lockdir, + CONFIGURATION => $configuration, + SOCKET_WRAPPER_DEFAULT_IFACE => $swiface, + NSS_WRAPPER_PASSWD => $nsswrap_passwd, + NSS_WRAPPER_GROUP => $nsswrap_group, + }; + + if (defined($self->{ldap})) { + + push (@provision_options, "--ldap-backend=$ldap_uri"); + system("$self->{bindir}/smbscript $self->{setupdir}/provision-backend $configuration --ldap-manager-pass=$password --root=$unix_name --realm=$realm --host-name=$netbiosname --ldap-backend-type=$self->{ldap}>&2") == 0 or die("backend provision failed"); + + if ($self->{ldap} eq "openldap") { + ($ret->{SLAPD_CONF}, $ret->{OPENLDAP_PIDFILE}) = $self->mk_openldap($ldapdir, $configuration) or die("Unable to create openldap directories"); + } elsif ($self->{ldap} eq "fedora-ds") { + ($ret->{FEDORA_DS_DIR}, $ret->{FEDORA_DS_PIDFILE}) = $self->mk_fedora_ds($ldapdir, $configuration) or die("Unable to create fedora ds directories"); + push (@provision_options, "--ldap-module=nsuniqueid"); + push (@provision_options, "'--aci=aci:: KHRhcmdldGF0dHIgPSAiKiIpICh2ZXJzaW9uIDMuMDthY2wgImZ1bGwgYWNjZXNzIHRvIGFsbCBieSBhbGwiO2FsbG93IChhbGwpKHVzZXJkbiA9ICJsZGFwOi8vL2FueW9uZSIpOykK'"); + } + + $self->slapd_start($ret) or + die("couldn't start slapd"); + } + + my $provision_cmd = join(" ", @provision_options); + (system($provision_cmd) == 0) or die("Unable to provision: \n$provision_cmd\n"); + + if (defined($self->{ldap})) { + $self->slapd_stop($ret) or + die("couldn't stop slapd"); + } + + return $ret; +} + +sub provision_member($$$) +{ + my ($self, $prefix, $dcvars) = @_; + print "PROVISIONING MEMBER..."; + + my $ret = $self->provision($prefix, + "member server", + "localmember3", + "localmember", + 3, + "localmemberpass"); + + $ret or die("Unable to provision"); + + my $cmd = ""; + $cmd .= "SOCKET_WRAPPER_DEFAULT_IFACE=\"$ret->{SOCKET_WRAPPER_DEFAULT_IFACE}\" "; + $cmd .= "KRB5_CONFIG=\"$ret->{KRB5_CONFIG}\" "; + $cmd .= "$self->{bindir}/net join $ret->{CONFIGURATION} $dcvars->{DOMAIN} member"; + $cmd .= " -U$dcvars->{USERNAME}\%$dcvars->{PASSWORD}"; + + system($cmd) == 0 or die("Join failed\n$cmd"); + + $ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo"; + $ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; + $ret->{SMBD_TEST_LOG_POS} = 0; + + $ret->{DC_SERVER} = $dcvars->{SERVER}; + $ret->{DC_SERVER_IP} = $dcvars->{SERVER_IP}; + $ret->{DC_NETBIOSNAME} = $dcvars->{NETBIOSNAME}; + $ret->{DC_NETBIOSALIAS} = $dcvars->{NETBIOSALIAS}; + $ret->{DC_USERNAME} = $dcvars->{USERNAME}; + $ret->{DC_PASSWORD} = $dcvars->{PASSWORD}; + + return $ret; +} + +sub provision_dc($$) +{ + my ($self, $prefix) = @_; + + print "PROVISIONING DC..."; + my $ret = $self->provision($prefix, + "domain controller", + "localdc1", + "localdc", + 1, + "localdcpass"); + + $self->add_wins_config("$prefix/private") or + die("Unable to add wins configuration"); + + $ret->{SMBD_TEST_FIFO} = "$prefix/smbd_test.fifo"; + $ret->{SMBD_TEST_LOG} = "$prefix/smbd_test.log"; + $ret->{SMBD_TEST_LOG_POS} = 0; + return $ret; +} + +sub teardown_env($$) +{ + my ($self, $envvars) = @_; + my $pid; + + close(DATA); + + if (-f "$envvars->{PIDDIR}/smbd.pid" ) { + open(IN, "<$envvars->{PIDDIR}/smbd.pid") or die("unable to open smbd pid file"); + $pid = ; + close(IN); + + # Give the process 20 seconds to exit. gcov needs + # this time to write out the covarge data + my $count = 0; + until (kill(0, $pid) == 0) { + # if no process sucessfully signalled, then we are done + sleep(1); + $count++; + last if $count > 20; + } + + # If it is still around, kill it + if ($count > 20) { + print "smbd process $pid took more than $count seconds to exit, killing\n"; + kill 9, $pid; + } + } + + my $failed = $? >> 8; + + $self->slapd_stop($envvars) if ($self->{ldap}); + + print $self->getlog_env($envvars); + + return $failed; +} + +sub getlog_env($$) +{ + my ($self, $envvars) = @_; + my $title = "SMBD LOG of: $envvars->{NETBIOSNAME}\n"; + my $out = $title; + + open(LOG, "<$envvars->{SMBD_TEST_LOG}"); + + seek(LOG, $envvars->{SMBD_TEST_LOG_POS}, SEEK_SET); + while () { + $out .= $_; + } + $envvars->{SMBD_TEST_LOG_POS} = tell(LOG); + close(LOG); + + return "" if $out eq $title; + + return $out; +} + +sub check_env($$) +{ + my ($self, $envvars) = @_; + + return 1 if (-p $envvars->{SMBD_TEST_FIFO}); + + print $self->getlog_env($envvars); + + return 0; +} + +sub setup_env($$$) +{ + my ($self, $envname, $path) = @_; + + if ($envname eq "dc") { + return $self->setup_dc("$path/dc"); + } elsif ($envname eq "member") { + if (not defined($self->{vars}->{dc})) { + $self->setup_dc("$path/dc"); + } + return $self->setup_member("$path/member", $self->{vars}->{dc}); + } else { + die("Samba4 can't provide environment '$envname'"); + } +} + +sub setup_member($$$$) +{ + my ($self, $path, $dc_vars) = @_; + + my $env = $self->provision_member($path, $dc_vars); + + $self->check_or_start($env, ($ENV{SMBD_MAXTIME} or 7500)); + + $self->wait_for_start($env); + + return $env; +} + +sub setup_dc($$) +{ + my ($self, $path) = @_; + + my $env = $self->provision_dc($path); + + $self->check_or_start($env, + ($ENV{SMBD_MAXTIME} or 7500)); + + $self->wait_for_start($env); + + $self->{vars}->{dc} = $env; + + return $env; +} + +sub stop($) +{ + my ($self) = @_; +} + +1; diff --git a/source4/selftest/target/Windows.pm b/source4/selftest/target/Windows.pm new file mode 100644 index 0000000000..d0c90d7f7b --- /dev/null +++ b/source4/selftest/target/Windows.pm @@ -0,0 +1,40 @@ +#!/usr/bin/perl +# Bootstrap Samba and run a number of tests against it. +# Copyright (C) 2005-2007 Jelmer Vernooij +# Published under the GNU GPL, v3 or later. + +package Windows; + +use strict; +use FindBin qw($RealBin); +use POSIX; + +sub new($) +{ + my ($classname) = @_; + my $self = { }; + bless $self; + return $self; +} + +sub provision($$$) +{ + my ($self, $environment, $prefix) = @_; + + die ("Windows tests will not run without root privileges.") + if (`whoami` ne "root"); + + die("Environment variable WINTESTCONF has not been defined.\n". + "Windows tests will not run unconfigured.") if (not defined($ENV{WINTESTCONF})); + + die ("$ENV{WINTESTCONF} could not be read.") if (! -r $ENV{WINTESTCONF}); + + $ENV{WINTEST_DIR}="$ENV{SRCDIR}/selftest/win"; +} + +sub setup_env($$) +{ + my ($self, $name) = @_; +} + +1; -- cgit From 6508824f394ceac5cd16b3e620bffd18fe577fc1 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 17:50:29 +0100 Subject: python: Don't attempt to build shared and static versions of modules, because it's just not going to work with the current build system. (This used to be commit d9b4a5bb172be74db3c16b50426810f1bdedd00e) --- source4/build/smb_build/input.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/build/smb_build/input.pm b/source4/build/smb_build/input.pm index 0b26aee65e..6d5c4f4a1e 100644 --- a/source4/build/smb_build/input.pm +++ b/source4/build/smb_build/input.pm @@ -182,7 +182,7 @@ sub check_python($$$) $python->{SUBSYSTEM} = "LIBPYTHON"; - check_module($INPUT, $python, ["SHARED_LIBRARY", "STATIC_LIBRARY"]); + check_module($INPUT, $python, $default_ot); } sub check_binary($$) -- cgit From 797e8db3ba1e0038db553af6f564e221479ac381 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Wed, 16 Jan 2008 21:30:58 +0100 Subject: selftest: Use "require" rather than "use" keyword so .pm files don't have to be provided until used. (This used to be commit 95872d7db8c9bb1914ab4c9860fd8b09e6695cc7) --- source4/selftest/selftest.pl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/selftest/selftest.pl b/source4/selftest/selftest.pl index 46c3846b54..004332a1fc 100755 --- a/source4/selftest/selftest.pl +++ b/source4/selftest/selftest.pl @@ -426,20 +426,20 @@ my $testenv_default = "none"; if ($opt_target eq "samba4") { $testenv_default = "member"; - use target::Samba4; + require target::Samba4; $target = new Samba4($opt_bindir or "$srcdir/bin", $ldap, "$srcdir/setup"); } elsif ($opt_target eq "samba3") { if ($opt_socket_wrapper and `$opt_bindir/smbd -b | grep SOCKET_WRAPPER` eq "") { die("You must include --enable-socket-wrapper when compiling Samba in order to execute 'make test'. Exiting...."); } $testenv_default = "dc"; - use target::Samba3; + require target::Samba3; $target = new Samba3($opt_bindir); } elsif ($opt_target eq "win") { die("Windows tests will not run with socket wrapper enabled.") if ($opt_socket_wrapper); $testenv_default = "dc"; - use target::Windows; + require target::Windows; $target = new Windows(); } -- cgit From d5fd15005c0cad9e9018e81ab5c30b87cb2f605a Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Jan 2008 08:53:18 +1100 Subject: ldb_map objectClass munging: Don't hard-code 'extensibleObject'. This allows objectClass munging to be removed, or modified to not include adding an objectClass, or for that objectClass to be something different. Andrew Bartlett (This used to be commit ee93b4e2ee1dd1cd38bcf14b2bb62556a13cec4a) --- source4/dsdb/samdb/ldb_modules/samba3sam.c | 2 +- source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 4 +- source4/lib/ldb/ldb_map/ldb_map.c | 80 ++++++++++++++---------- source4/lib/ldb/ldb_map/ldb_map.h | 4 ++ 4 files changed, 55 insertions(+), 35 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/samba3sam.c b/source4/dsdb/samdb/ldb_modules/samba3sam.c index 0bfc9a3dae..3a666b5380 100644 --- a/source4/dsdb/samdb/ldb_modules/samba3sam.c +++ b/source4/dsdb/samdb/ldb_modules/samba3sam.c @@ -918,7 +918,7 @@ static int samba3sam_init(struct ldb_module *module) { int ret; - ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, NULL, "samba3sam"); + ret = ldb_map_init(module, samba3_attributes, samba3_objectclasses, NULL, NULL, "samba3sam"); if (ret != LDB_SUCCESS) return ret; diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 970106787b..6e66d0783a 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -667,7 +667,7 @@ static int entryuuid_init(struct ldb_module *module) struct map_private *map_private; struct entryuuid_private *entryuuid_private; - ret = ldb_map_init(module, entryuuid_attributes, entryuuid_objectclasses, entryuuid_wildcard_attributes, NULL); + ret = ldb_map_init(module, entryuuid_attributes, entryuuid_objectclasses, entryuuid_wildcard_attributes, "extensibleObject", NULL); if (ret != LDB_SUCCESS) return ret; @@ -688,7 +688,7 @@ static int nsuniqueid_init(struct ldb_module *module) struct map_private *map_private; struct entryuuid_private *entryuuid_private; - ret = ldb_map_init(module, nsuniqueid_attributes, NULL, nsuniqueid_wildcard_attributes, NULL); + ret = ldb_map_init(module, nsuniqueid_attributes, NULL, nsuniqueid_wildcard_attributes, "extensibleObject", NULL); if (ret != LDB_SUCCESS) return ret; diff --git a/source4/lib/ldb/ldb_map/ldb_map.c b/source4/lib/ldb/ldb_map/ldb_map.c index 39df427c2c..9582f36130 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.c +++ b/source4/lib/ldb/ldb_map/ldb_map.c @@ -737,6 +737,7 @@ static struct ldb_val map_objectclass_convert_local(struct ldb_module *module, v /* Generate a remote message with a mapped objectClass. */ static void map_objectclass_generate_remote(struct ldb_module *module, const char *local_attr, const struct ldb_message *old, struct ldb_message *remote, struct ldb_message *local) { + const struct ldb_map_context *data = map_get_context(module); struct ldb_message_element *el, *oc; struct ldb_val val; bool found_extensibleObject = false; @@ -770,16 +771,16 @@ static void map_objectclass_generate_remote(struct ldb_module *module, const cha /* Convert all local objectClasses */ for (i = 0; i < el->num_values - 1; i++) { el->values[i] = map_objectclass_convert_local(module, el->values, &oc->values[i]); - if (ldb_attr_cmp((char *)el->values[i].data, "extensibleObject") == 0) { + if (ldb_attr_cmp((char *)el->values[i].data, data->add_objectclass) == 0) { found_extensibleObject = true; } } if (!found_extensibleObject) { - val.data = (uint8_t *)talloc_strdup(el->values, "extensibleObject"); + val.data = (uint8_t *)talloc_strdup(el->values, data->add_objectclass); val.length = strlen((char *)val.data); - /* Append additional objectClass "extensibleObject" */ + /* Append additional objectClass data->add_objectclass */ el->values[i] = val; } else { el->num_values--; @@ -860,6 +861,19 @@ static struct ldb_message_element *map_objectclass_generate_local(struct ldb_mod return el; } +static const struct ldb_map_attribute objectclass_convert_map = { + .local_name = "objectClass", + .type = MAP_CONVERT, + .u = { + .convert = { + .remote_name = "objectClass", + .convert_local = map_objectclass_convert_local, + .convert_remote = map_objectclass_convert_remote, + }, + }, +}; + + /* Mappings for searches on objectClass= assuming a one-to-one * mapping. Needed because this is a generate operator for the * add/modify code */ @@ -867,19 +881,7 @@ static int map_objectclass_convert_operator(struct ldb_module *module, void *mem struct ldb_parse_tree **new, const struct ldb_parse_tree *tree) { - static const struct ldb_map_attribute objectclass_map = { - .local_name = "objectClass", - .type = MAP_CONVERT, - .u = { - .convert = { - .remote_name = "objectClass", - .convert_local = map_objectclass_convert_local, - .convert_remote = map_objectclass_convert_remote, - }, - }, - }; - - return map_subtree_collect_remote_simple(module, mem_ctx, new, tree, &objectclass_map); + return map_subtree_collect_remote_simple(module, mem_ctx, new, tree, &objectclass_convert_map); } /* Auxiliary request construction @@ -1221,23 +1223,25 @@ static const struct ldb_map_attribute builtin_attribute_maps[] = { }, }, }, - { - .local_name = "objectClass", - .type = MAP_GENERATE, - .convert_operator = map_objectclass_convert_operator, - .u = { - .generate = { - .remote_names = { "objectClass", NULL }, - .generate_local = map_objectclass_generate_local, - .generate_remote = map_objectclass_generate_remote, - }, - }, - }, { .local_name = NULL, } }; +static const struct ldb_map_attribute objectclass_attribute_map = { + .local_name = "objectClass", + .type = MAP_GENERATE, + .convert_operator = map_objectclass_convert_operator, + .u = { + .generate = { + .remote_names = { "objectClass", NULL }, + .generate_local = map_objectclass_generate_local, + .generate_remote = map_objectclass_generate_remote, + }, + }, +}; + + /* Find the special 'MAP_DN_NAME' record and store local and remote * base DNs in private data. */ static int map_init_dns(struct ldb_module *module, struct ldb_map_context *data, const char *name) @@ -1302,7 +1306,7 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data for (j = 0; builtin_attribute_maps[j].local_name; j++) /* noop */ ; /* Store list of attribute maps */ - data->attribute_maps = talloc_array(data, struct ldb_map_attribute, i+j+1); + data->attribute_maps = talloc_array(data, struct ldb_map_attribute, i+j+2); if (data->attribute_maps == NULL) { map_oom(module); return LDB_ERR_OPERATIONS_ERROR; @@ -1320,6 +1324,15 @@ static int map_init_maps(struct ldb_module *module, struct ldb_map_context *data last++; } + if (data->add_objectclass) { + /* ObjectClass one is very last, if required */ + data->attribute_maps[last] = objectclass_attribute_map; + last++; + } else if (ocls) { + data->attribute_maps[last] = objectclass_convert_map; + last++; + } + /* Ensure 'local_name == NULL' for the last entry */ memset(&data->attribute_maps[last], 0, sizeof(struct ldb_map_attribute)); @@ -1339,9 +1352,10 @@ _PUBLIC_ struct ldb_module_ops ldb_map_get_ops(void) /* Initialize global private data. */ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, - const struct ldb_map_objectclass *ocls, - const char * const *wildcard_attributes, - const char *name) + const struct ldb_map_objectclass *ocls, + const char * const *wildcard_attributes, + const char *add_objectclass, + const char *name) { struct map_private *data; int ret; @@ -1368,6 +1382,8 @@ _PUBLIC_ int ldb_map_init(struct ldb_module *module, const struct ldb_map_attrib return ret; } + data->context->add_objectclass = add_objectclass; + /* Store list of attribute and objectClass maps */ ret = map_init_maps(module, data->context, attrs, ocls, wildcard_attributes); if (ret != LDB_SUCCESS) { diff --git a/source4/lib/ldb/ldb_map/ldb_map.h b/source4/lib/ldb/ldb_map/ldb_map.h index 7fe9c223b8..ef4da4e654 100644 --- a/source4/lib/ldb/ldb_map/ldb_map.h +++ b/source4/lib/ldb/ldb_map/ldb_map.h @@ -134,6 +134,9 @@ struct ldb_map_context { * to any wildcard search */ const char * const *wildcard_attributes; + /* ObjectClass (if any) to be added to remote attributes on add */ + const char *add_objectclass; + /* struct ldb_context *mapped_ldb; */ struct ldb_dn *local_base_dn; struct ldb_dn *remote_base_dn; @@ -149,6 +152,7 @@ struct map_private { int ldb_map_init(struct ldb_module *module, const struct ldb_map_attribute *attrs, const struct ldb_map_objectclass *ocls, const char * const *wildcard_attributes, + const char *add_objectclass, const char *name); /* get copy of map_ops */ -- cgit From b44f322f5d5940cb61b2f9c9e44fc25ed00e81be Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Jan 2008 10:35:08 +1100 Subject: OpenLDAP backend: Place the refint overlay after the memberof overlay This still doesn't work for me, but is the recommended order. Andrew Bartlett (This used to be commit 4c869c54c2b8125fc88e58bbfddf1975476978a5) --- source4/setup/provision-backend | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/source4/setup/provision-backend b/source4/setup/provision-backend index ba9e67f229..6582587624 100755 --- a/source4/setup/provision-backend +++ b/source4/setup/provision-backend @@ -169,9 +169,10 @@ memberof-dangling-error 32 } } - memberof_config = "overlay refint + memberof_config = memberof_config + " +overlay refint refint_attributes" + refint_attributes + " -" + memberof_config; +"; ok = sys.file_save(subobj.LDAPDIR + "/memberof.conf", memberof_config); if (!ok) { -- cgit From f1e177a7b8e660b245d5fb9b11a66b43c9b69784 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Thu, 17 Jan 2008 12:00:27 +1100 Subject: provision: simplfy by removing old code to manually create baseDNs. Previously, we would create the first record in the DB as an LDIF file, with the expectation that the administrator would use slapadd to create the database. We now do everything over LDAP, which is far simpler, and allows the LDB module chain to do its work, without special cases. Also fix naming of the output schema when suggesting the comamnd line to run ad2oLschema in provision-backend. Andrew Bartlett (This used to be commit e77375758d66e94e5e0b6e61a97c9281c3d9c71f) --- source4/scripting/libjs/provision.js | 38 ++++------------------- source4/setup/provision | 6 +--- source4/setup/provision-backend | 5 ++- source4/setup/provision_basedn.ldif | 1 - source4/setup/provision_configuration_basedn.ldif | 1 - source4/setup/provision_schema_basedn.ldif | 1 - 6 files changed, 9 insertions(+), 43 deletions(-) diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 266bac1a75..381288417a 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -398,9 +398,6 @@ function provision_default_paths(subobj) paths.named_conf = lp.get("private dir") + "/named.conf"; paths.winsdb = "wins.ldb"; paths.ldapdir = lp.get("private dir") + "/ldap"; - paths.ldap_basedn_ldif = paths.ldapdir + "/" + dnsdomain + ".ldif"; - paths.ldap_config_basedn_ldif = paths.ldapdir + "/" + dnsdomain + "-config.ldif"; - paths.ldap_schema_basedn_ldif = paths.ldapdir + "/" + dnsdomain + "-schema.ldif"; paths.s4_ldapi_socket = lp.get("private dir") + "/ldapi"; paths.phpldapadminconfig = lp.get("private dir") + "/phpldapadmin-config.php"; @@ -866,6 +863,12 @@ function provision_schema(subobj, message, tmp_schema_path, paths) /* This will erase anything in the tmp db */ var samdb = open_ldb(info, tmp_schema_path, true); + message("Setting up sam.ldb attributes\n"); + setup_add_ldif("provision_init.ldif", info, samdb, false); + + message("Setting up sam.ldb rootDSE\n"); + setup_add_ldif("provision_rootdse_add.ldif", info, samdb, false); + message("Adding schema container (permitted to fail)\n"); var add_ok = setup_add_ldif("provision_schema_basedn.ldif", info, samdb, true); message("Modifying schema container\n"); @@ -934,34 +937,6 @@ function provision_dns(subobj, message, paths, session_info, credentials) message("Please install the zone located in " + paths.dns + " into your DNS server. A sample BIND configuration snippit is at " + paths.named_conf + "\n"); } -/* Write out a DNS zone file, from the info in the current database */ -function provision_ldapbase(subobj, message, paths) -{ - var ok = provision_fix_subobj(subobj, paths); - assert(ok); - - message("Setting up LDAP base entry: " + subobj.DOMAINDN + " \n"); - var rdns = split(",", subobj.DOMAINDN); - subobj.EXTENSIBLEOBJECT = "objectClass: extensibleObject"; - - subobj.RDN_DC = substr(rdns[0], strlen("DC=")); - - sys.mkdir(paths.ldapdir, 0700); - - setup_file("provision_basedn.ldif", - message, paths.ldap_basedn_ldif, - subobj); - - setup_file("provision_configuration_basedn.ldif", - message, paths.ldap_config_basedn_ldif, - subobj); - - setup_file("provision_schema_basedn.ldif", - message, paths.ldap_schema_basedn_ldif, - subobj); - -} - /* guess reasonably default options for provisioning @@ -1045,7 +1020,6 @@ function provision_guess() subobj.CONFIGDN_MOD2 = ",objectguid"; subobj.SCHEMADN_MOD2 = ",objectguid"; - subobj.EXTENSIBLEOBJECT = "# no objectClass: extensibleObject for local ldb"; subobj.ACI = "# no aci for local ldb"; return subobj; diff --git a/source4/setup/provision b/source4/setup/provision index ce1e8a6b4f..8b24c51040 100755 --- a/source4/setup/provision +++ b/source4/setup/provision @@ -123,7 +123,6 @@ for (r in options) { } var blank = (options["blank"] != undefined); -var ldapbase = (options["ldap-base"] != undefined); var ldapbackend = (options["ldap-backend"] != undefined); var ldapmodule = (options["ldap-module"] != undefined); var partitions_only = (options["partitions-only"] != undefined); @@ -161,10 +160,7 @@ var system_session = system_session(); var creds = options.get_credentials(); message("Provisioning for %s in realm %s\n", subobj.DOMAIN, subobj.REALM); message("Using administrator password: %s\n", subobj.ADMINPASS); -if (ldapbase) { - provision_ldapbase(subobj, message, paths); - message("Please install the LDIF located in " + paths.ldap_basedn_ldif + ", " + paths.ldap_config_basedn_ldif + " and " + paths.ldap_schema_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server\n"); -} else if (partitions_only) { +if (partitions_only) { provision_become_dc(subobj, message, false, paths, system_session); } else { provision(subobj, message, blank, paths, system_session, creds, ldapbackend); diff --git a/source4/setup/provision-backend b/source4/setup/provision-backend index 6582587624..abd1b9a875 100755 --- a/source4/setup/provision-backend +++ b/source4/setup/provision-backend @@ -101,7 +101,7 @@ var backend_schema; var slapd_command; if (options["ldap-backend-type"] == "fedora-ds") { mapping = "schema-map-fedora-ds-1.0"; - backend_schema = "backend-schema.ldif"; + backend_schema = "99_ad.ldif"; if (options["ldap-backend-port"] != undefined) { message("Will listen on TCP port " + options["ldap-backend-port"] + "\n"); subobj.SERVERPORT="ServerPort = " + options["ldap-backend-port"]; @@ -114,9 +114,8 @@ if (options["ldap-backend-type"] == "fedora-ds") { slapd_command = "(see documentation)"; } else if (options["ldap-backend-type"] == "openldap") { - provision_ldapbase(subobj, message, paths); mapping = "schema-map-openldap-2.3"; - backend_schema = "99_ad.ldif"; + backend_schema = "backend-schema.schema"; setup_file("slapd.conf", message, subobj.LDAPDIR + "/slapd.conf", subobj); setup_file("modules.conf", message, subobj.LDAPDIR + "/modules.conf", subobj); sys.mkdir(subobj.LDAPDIR + "/db", 0700); diff --git a/source4/setup/provision_basedn.ldif b/source4/setup/provision_basedn.ldif index 234c1f9e8f..3c7537f013 100644 --- a/source4/setup/provision_basedn.ldif +++ b/source4/setup/provision_basedn.ldif @@ -5,7 +5,6 @@ dn: ${DOMAINDN} objectClass: top objectClass: domain objectClass: domainDNS -${EXTENSIBLEOBJECT} ${ACI} dc: ${RDN_DC} diff --git a/source4/setup/provision_configuration_basedn.ldif b/source4/setup/provision_configuration_basedn.ldif index df1e1b19ba..575f8faa0a 100644 --- a/source4/setup/provision_configuration_basedn.ldif +++ b/source4/setup/provision_configuration_basedn.ldif @@ -4,6 +4,5 @@ dn: ${CONFIGDN} objectClass: top objectClass: configuration -${EXTENSIBLEOBJECT} ${ACI} cn: Configuration diff --git a/source4/setup/provision_schema_basedn.ldif b/source4/setup/provision_schema_basedn.ldif index 7b4f599072..fbfd4c09d6 100644 --- a/source4/setup/provision_schema_basedn.ldif +++ b/source4/setup/provision_schema_basedn.ldif @@ -4,6 +4,5 @@ dn: ${SCHEMADN} objectClass: top objectClass: dMD -${EXTENSIBLEOBJECT} ${ACI} cn: Schema -- cgit From 3115481e32c722645e1974acb3525ea52a5b2d08 Mon Sep 17 00:00:00 2001 From: Michael Adam Date: Thu, 17 Jan 2008 09:24:01 +0100 Subject: Fix an output message in samba3rpc torture test. Michael (This used to be commit bf957bcb835a2c7c903f60dfa8f9a7e41997c5af) --- source4/torture/rpc/samba3rpc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/torture/rpc/samba3rpc.c b/source4/torture/rpc/samba3rpc.c index 3b96140fb2..b08cd05bdb 100644 --- a/source4/torture/rpc/samba3rpc.c +++ b/source4/torture/rpc/samba3rpc.c @@ -529,7 +529,7 @@ static bool create_user(TALLOC_CTX *mem_ctx, struct smbcli_state *cli, username, domain_name, &samr_pipe, &wks_handle, user_sid); if (!NT_STATUS_IS_OK(status)) { - d_printf("get_wks_handle failed: %s\n", nt_errstr(status)); + d_printf("get_usr_handle failed: %s\n", nt_errstr(status)); goto done; } -- cgit From 8d36d43e5258aa80855a9baa707a9fcad77a0d03 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 10:13:43 +1100 Subject: Add in a new module to handle instanceType This code raided from the repl_meta_data module, which probably needs to be downsized to just handling the replication data. Andrew Bartlett (This used to be commit 2a418f33705a792d9d16cf1d4aa3dcda467e6e04) --- source4/dsdb/samdb/ldb_modules/config.mk | 13 +++ source4/dsdb/samdb/ldb_modules/instancetype.c | 128 ++++++++++++++++++++++++++ source4/scripting/libjs/provision.js | 6 +- 3 files changed, 144 insertions(+), 3 deletions(-) create mode 100644 source4/dsdb/samdb/ldb_modules/instancetype.c diff --git a/source4/dsdb/samdb/ldb_modules/config.mk b/source4/dsdb/samdb/ldb_modules/config.mk index a41a29b5dd..dc407fbd8a 100644 --- a/source4/dsdb/samdb/ldb_modules/config.mk +++ b/source4/dsdb/samdb/ldb_modules/config.mk @@ -333,3 +333,16 @@ OBJ_FILES = \ # End MODULE ldb_normalise ################################################ +################################################ +# Start MODULE ldb_instancetype +[MODULE::ldb_instancetype] +INIT_FUNCTION = ldb_instancetype_init +CFLAGS = -Ilib/ldb/include +OUTPUT_TYPE = SHARED_LIBRARY +PRIVATE_DEPENDENCIES = LIBTALLOC +SUBSYSTEM = LIBLDB +OBJ_FILES = \ + instancetype.o +# End MODULE ldb_instancetype +################################################ + diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c new file mode 100644 index 0000000000..ee1f2ff7ba --- /dev/null +++ b/source4/dsdb/samdb/ldb_modules/instancetype.c @@ -0,0 +1,128 @@ +/* + ldb database library + + Copyright (C) Simo Sorce 2004-2006 + Copyright (C) Andrew Bartlett 2005 + Copyright (C) Andrew Tridgell 2005 + Copyright (C) Stefan Metzmacher 2007 + + ** NOTE! The following LGPL license applies to the ldb + ** library. This does NOT imply that all of Samba is released + ** under the LGPL + + This library is free software; you can redistribute it and/or + modify it under the terms of the GNU Lesser General Public + License as published by the Free Software Foundation; either + version 3 of the License, or (at your option) any later version. + + This library 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 + Lesser General Public License for more details. + + You should have received a copy of the GNU Lesser General Public + License along with this library; if not, see . +*/ + +/* + * Name: ldb + * + * Component: ldb instancetype module + * + * Description: add an instanceType onto every new record + * + * Author: Simo Sorce + */ + +#include "includes.h" +#include "ldb/include/ldb_includes.h" +#include "librpc/gen_ndr/ndr_misc.h" +#include "param/param.h" +#include "dsdb/samdb/samdb.h" +#include "dsdb/common/flags.h" + +/* add_record: add instancetype attribute */ +static int instancetype_add(struct ldb_module *module, struct ldb_request *req) +{ + struct ldb_request *down_req; + struct ldb_message *msg; + uint32_t instance_type; + int ret; + const struct ldb_control *partition_ctrl; + const struct dsdb_control_current_partition *partition; + + + ldb_debug(module->ldb, LDB_DEBUG_TRACE, "instancetype_add_record\n"); + + /* do not manipulate our control entries */ + if (ldb_dn_is_special(req->op.add.message->dn)) { + return ldb_next_request(module, req); + } + + partition_ctrl = ldb_request_get_control(req, DSDB_CONTROL_CURRENT_PARTITION_OID); + if (!partition_ctrl) { + ldb_debug_set(module->ldb, LDB_DEBUG_FATAL, + "instancetype_add: no current partition control found"); + return LDB_ERR_CONSTRAINT_VIOLATION; + } + + partition = talloc_get_type(partition_ctrl->data, + struct dsdb_control_current_partition); + SMB_ASSERT(partition && partition->version == DSDB_CONTROL_CURRENT_PARTITION_VERSION); + + down_req = talloc(req, struct ldb_request); + if (down_req == NULL) { + return LDB_ERR_OPERATIONS_ERROR; + } + + *down_req = *req; + + /* we have to copy the message as the caller might have it as a const */ + down_req->op.add.message = msg = ldb_msg_copy_shallow(down_req, req->op.add.message); + if (msg == NULL) { + talloc_free(down_req); + return LDB_ERR_OPERATIONS_ERROR; + } + + /* + * TODO: calculate correct instance type + */ + instance_type = INSTANCE_TYPE_WRITE; + if (ldb_dn_compare(partition->dn, msg->dn) == 0) { + instance_type |= INSTANCE_TYPE_IS_NC_HEAD; + if (ldb_dn_compare(msg->dn, samdb_base_dn(module->ldb)) != 0) { + instance_type |= INSTANCE_TYPE_NC_ABOVE; + } + } + + ret = ldb_msg_add_fmt(msg, "instanceType", "%u", instance_type); + if (ret != LDB_SUCCESS) { + talloc_free(down_req); + ldb_oom(module->ldb); + return LDB_ERR_OPERATIONS_ERROR; + } + + ldb_set_timeout_from_prev_req(module->ldb, req, down_req); + + /* go on with the call chain */ + ret = ldb_next_request(module, down_req); + + /* do not free down_req as the call results may be linked to it, + * it will be freed when the upper level request get freed */ + if (ret == LDB_SUCCESS) { + req->handle = down_req->handle; + } + + return ret; +} + +static const struct ldb_module_ops instancetype_ops = { + .name = "instancetype", + .add = instancetype_add, +}; + + +int ldb_instancetype_init(void) +{ + return ldb_register_module(&instancetype_ops); +} diff --git a/source4/scripting/libjs/provision.js b/source4/scripting/libjs/provision.js index 381288417a..0cca49dec9 100644 --- a/source4/scripting/libjs/provision.js +++ b/source4/scripting/libjs/provision.js @@ -1013,9 +1013,9 @@ function provision_guess() subobj.DOMAINDN_LDB = "users.ldb"; subobj.CONFIGDN_LDB = "configuration.ldb"; subobj.SCHEMADN_LDB = "schema.ldb"; - subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash"; - subobj.CONFIGDN_MOD = "naming_fsmo"; - subobj.SCHEMADN_MOD = "schema_fsmo"; + subobj.DOMAINDN_MOD = "pdc_fsmo,password_hash,instancetype"; + subobj.CONFIGDN_MOD = "naming_fsmo,instancetype"; + subobj.SCHEMADN_MOD = "schema_fsmo,instancetype"; subobj.DOMAINDN_MOD2 = ",objectguid"; subobj.CONFIGDN_MOD2 = ",objectguid"; subobj.SCHEMADN_MOD2 = ",objectguid"; -- cgit From 564e021ed974b4bb3472ec3fc091746663808afd Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 12:16:27 +1100 Subject: Correct authorship of instanceType module Andrew Bartlett (This used to be commit d427cf4fa67e84ccdece9a3fb31d8e89379a86e7) --- source4/dsdb/samdb/ldb_modules/instancetype.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source4/dsdb/samdb/ldb_modules/instancetype.c b/source4/dsdb/samdb/ldb_modules/instancetype.c index ee1f2ff7ba..064c28ec65 100644 --- a/source4/dsdb/samdb/ldb_modules/instancetype.c +++ b/source4/dsdb/samdb/ldb_modules/instancetype.c @@ -31,7 +31,7 @@ * * Description: add an instanceType onto every new record * - * Author: Simo Sorce + * Author: Andrew Bartlett */ #include "includes.h" -- cgit From 064eb82870596e72373c290dfaf0e6b8289303de Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 13:25:01 +1100 Subject: Remove --ldap-base from the python provision script (This is a merge from the ejs script) Andrew Bartlett (This used to be commit d822dfa017b84895222ace8c44935fb872930548) --- source4/scripting/python/samba/provision.py | 32 ----------------------------- source4/setup/provision.py | 10 ++------- 2 files changed, 2 insertions(+), 40 deletions(-) diff --git a/source4/scripting/python/samba/provision.py b/source4/scripting/python/samba/provision.py index 1607cb343b..d59cea121e 100644 --- a/source4/scripting/python/samba/provision.py +++ b/source4/scripting/python/samba/provision.py @@ -180,12 +180,6 @@ def provision_paths_from_lp(lp, dnsdomain): paths.dns_keytab = os.path.join(private_dir, "dns.keytab") paths.dns = os.path.join(private_dir, dnsdomain + ".zone") paths.winsdb = os.path.join(private_dir, "wins.ldb") - paths.ldap_basedn_ldif = os.path.join(private_dir, - dnsdomain + ".ldif") - paths.ldap_config_basedn_ldif = os.path.join(private_dir, - dnsdomain + "-config.ldif") - paths.ldap_schema_basedn_ldif = os.path.join(private_dir, - dnsdomain + "-schema.ldif") paths.s4_ldapi_path = os.path.join(private_dir, "ldapi") paths.phpldapadminconfig = os.path.join(private_dir, "phpldapadmin-config.php") @@ -465,7 +459,6 @@ def setup_samdb(path, setup_path, session_info, credentials, lp, setup_add_ldif(samdb, setup_path("provision_basedn.ldif"), { "DOMAINDN": domaindn, "ACI": aci, - "EXTENSIBLEOBJECT": "# no objectClass: extensibleObject for local ldb", "RDN_DC": rdn_dc, }) @@ -823,31 +816,6 @@ def create_zone_file(path, setup_path, samdb, dnsdomain, domaindn, }) -def provision_ldapbase(setup_dir, message, paths): - """Write out a DNS zone file, from the info in the current database.""" - message("Setting up LDAP base entry: %s" % domaindn) - rdns = domaindn.split(",") - - rdn_dc = rdns[0][len("DC="):] - - def setup_path(file): - return os.path.join(setup_dir, file) - - setup_file(setup_path("provision_basedn.ldif"), - paths.ldap_basedn_ldif) - - setup_file(setup_path("provision_configuration_basedn.ldif"), - paths.ldap_config_basedn_ldif) - - setup_file(setup_path("provision_schema_basedn.ldif"), - paths.ldap_schema_basedn_ldif, { - "SCHEMADN": schemadn, - "ACI": "# no aci for local ldb", - "EXTENSIBLEOBJECT": "objectClass: extensibleObject"}) - - message("Please install the LDIF located in " + paths.ldap_basedn_ldif + ", " + paths.ldap_config_basedn_ldif + " and " + paths.ldap_schema_basedn_ldif + " into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server") - - def load_schema(setup_path, samdb, schemadn, netbiosname, configdn): """Load schema. diff --git a/source4/setup/provision.py b/source4/setup/provision.py index e166d5f3dd..88015ce0a3 100755 --- a/source4/setup/provision.py +++ b/source4/setup/provision.py @@ -34,7 +34,7 @@ from auth import system_session import samba.getopt as options import param from samba.provision import (provision, - provision_paths_from_lp, provision_ldapbase) + provision_paths_from_lp) parser = optparse.OptionParser("provision [options]") parser.add_option_group(options.SambaOptions(parser)) @@ -81,9 +81,6 @@ parser.add_option("--users", type="string", metavar="GROUPNAME", parser.add_option("--quiet", help="Be quiet", action="store_true") parser.add_option("--blank", action="store_true", help="do not add users or groups, just the structure") -parser.add_option("--ldap-base", - help="output only an LDIF file, suitable for creating an LDAP baseDN", - action="store_true") parser.add_option("--ldap-backend", type="string", metavar="LDAPSERVER", help="LDAP server to use for this provision") parser.add_option("--ldap-module=", type="string", metavar="MODULE", @@ -152,10 +149,7 @@ creds = credopts.get_credentials() setup_dir = opts.setupdir if setup_dir is None: setup_dir = "setup" -if opts.ldap_base: - provision_ldapbase(setup_dir, message, paths) - message("Please install the LDIF located in %s, %s and into your LDAP server, and re-run with --ldap-backend=ldap://my.ldap.server" % (paths.ldap_basedn_ldif, paths.ldap_config_basedn_ldif, paths.ldap_schema_basedn_ldif)) -elif opts.partitions_only: +if opts.partitions_only: provision_become_dc(setup_dir, message, False, paths, lp, system_session(), creds) else: -- cgit From f106e67599a02426d5eaf87e9d76bec486427add Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 13:27:05 +1100 Subject: Search for memberOf when clients ask for a wildcard against OpenLDAP The memberOf module in OpenLDAP make this attribute operational, so we need to add it here or clients won't get it when using *. Andrew Bartlett (This used to be commit 35148fd51f22d81fe9f590b7d6f13285c35656a7) --- source4/dsdb/samdb/ldb_modules/simple_ldap_map.c | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c index 6e66d0783a..acf2fd622c 100644 --- a/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c +++ b/source4/dsdb/samdb/ldb_modules/simple_ldap_map.c @@ -448,6 +448,7 @@ static const char * const entryuuid_wildcard_attributes[] = { "whenChanged", "usnCreated", "usnChanged", + "memberOf", NULL }; -- cgit From 958b0e8ad1eb85881a2f7c3d193d121c21e7a258 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 13:28:52 +1100 Subject: Use syncrepl on all OpenLDAP databases (creates contextCSN attribute) This module needs to be loaded on each database, not just the main partition. We use it to create the usn for the entries. Andrew Bartlett (This used to be commit ffb12aad8a80bb90d66dc66baba81b856622a6bb) --- source4/setup/slapd.conf | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source4/setup/slapd.conf b/source4/setup/slapd.conf index e4e86eece9..83f4da3359 100644 --- a/source4/setup/slapd.conf +++ b/source4/setup/slapd.conf @@ -34,6 +34,12 @@ index lDAPDisplayName eq index subClassOf eq index cn eq +#syncprov is stable in OpenLDAP 2.3, and available in 2.2. +#We only need this for the contextCSN attribute anyway.... +overlay syncprov +syncprov-checkpoint 100 10 +syncprov-sessionlog 100 + database hdb suffix ${CONFIGDN} directory ${LDAPDIR}/db/config @@ -48,6 +54,12 @@ index dnsRoot eq index nETBIOSName eq index cn eq +#syncprov is stable in OpenLDAP 2.3, and available in 2.2. +#We only need this for the contextCSN attribute anyway.... +overlay syncprov +syncprov-checkpoint 100 10 +syncprov-sessionlog 100 + database hdb suffix ${DOMAINDN} rootdn ${LDAPMANAGERDN} -- cgit From 873c7457c61584aec8c051849863151af79e2894 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 13:30:20 +1100 Subject: Don't manually specify instanceID in the template files. The instanceid module creates this automaticlly, so we don't need this any more. Andrew Bartlett (This used to be commit f6dbdf34e8a790f460b705100e45ee3928b6b1b3) --- source4/setup/display_specifiers.ldif | 2 -- source4/setup/provision.ldif | 8 -------- source4/setup/provision_computers_modify.ldif | 3 --- source4/setup/provision_configuration.ldif | 12 ------------ source4/setup/provision_configuration_basedn_modify.ldif | 6 ------ source4/setup/provision_schema_basedn_modify.ldif | 3 --- source4/setup/provision_self_join.ldif | 2 -- source4/setup/provision_templates.ldif | 1 - source4/setup/provision_users.ldif | 3 --- source4/setup/provision_users_modify.ldif | 3 --- 10 files changed, 43 deletions(-) diff --git a/source4/setup/display_specifiers.ldif b/source4/setup/display_specifiers.ldif index b76955a0cb..574912b3e8 100644 --- a/source4/setup/display_specifiers.ldif +++ b/source4/setup/display_specifiers.ldif @@ -2,14 +2,12 @@ dn: CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: container showInAdvancedViewOnly: TRUE -instanceType: 4 dn: CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: container cn: 409 name: 409 -instanceType: 4 showInAdvancedViewOnly: TRUE dn: CN=user-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} diff --git a/source4/setup/provision.ldif b/source4/setup/provision.ldif index c6b07c5751..5e15bf347a 100644 --- a/source4/setup/provision.ldif +++ b/source4/setup/provision.ldif @@ -3,7 +3,6 @@ objectClass: top objectClass: organizationalUnit cn: Domain Controllers description: Default container for domain controllers -instanceType: 4 showInAdvancedViewOnly: FALSE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -13,7 +12,6 @@ objectClass: top objectClass: container cn: ForeignSecurityPrincipals description: Default container for security identifiers (SIDs) associated with objects from external, trusted domains -instanceType: 4 showInAdvancedViewOnly: FALSE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -23,7 +21,6 @@ objectClass: top objectClass: container cn: System description: Builtin system settings -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -32,7 +29,6 @@ dn: CN=RID Manager$,CN=System,${DOMAINDN} objectclass: top objectclass: rIDManager cn: RID Manager$ -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -43,14 +39,12 @@ dn: CN=DomainUpdates,CN=System,${DOMAINDN} objectClass: top objectClass: container cn: DomainUpdates -instanceType: 4 showInAdvancedViewOnly: TRUE dn: CN=Windows2003Update,CN=DomainUpdates,CN=System,${DOMAINDN} objectClass: top objectClass: container cn: Windows2003Update -instanceType: 4 showInAdvancedViewOnly: TRUE revision: 8 @@ -58,7 +52,6 @@ dn: CN=Infrastructure,${DOMAINDN} objectclass: top objectclass: infrastructureUpdate cn: Infrastructure -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -68,7 +61,6 @@ dn: CN=Builtin,${DOMAINDN} objectClass: top objectClass: builtinDomain cn: Builtin -instanceType: 4 showInAdvancedViewOnly: FALSE forceLogoff: 9223372036854775808 lockoutDuration: -18000000000 diff --git a/source4/setup/provision_computers_modify.ldif b/source4/setup/provision_computers_modify.ldif index b7502e5107..3bb4074d42 100644 --- a/source4/setup/provision_computers_modify.ldif +++ b/source4/setup/provision_computers_modify.ldif @@ -3,9 +3,6 @@ changetype: modify replace: description description: Default container for upgraded computer accounts - -replace: instanceType -instanceType: 4 -- replace: showInAdvancedViewOnly showInAdvancedViewOnly: FALSE - diff --git a/source4/setup/provision_configuration.ldif b/source4/setup/provision_configuration.ldif index 050f110d9a..750fa1326a 100644 --- a/source4/setup/provision_configuration.ldif +++ b/source4/setup/provision_configuration.ldif @@ -5,7 +5,6 @@ dn: CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRefContainer cn: Partitions -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2147483648 msDS-Behavior-Version: 0 @@ -15,7 +14,6 @@ dn: CN=Enterprise Configuration,CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: Enterprise Configuration -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 1 nCName: ${CONFIGDN} @@ -25,7 +23,6 @@ dn: CN=Enterprise Schema,CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: Enterprise Schema -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 1 nCName: ${SCHEMADN} @@ -35,7 +32,6 @@ dn: CN=${DOMAIN},CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: ${DOMAIN} -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 3 nCName: ${DOMAINDN} @@ -46,7 +42,6 @@ dn: CN=Sites,${CONFIGDN} objectClass: top objectClass: sitesContainer cn: Sites -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2181038080 @@ -54,7 +49,6 @@ dn: CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: site cn: ${DEFAULTSITE} -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2181038080 @@ -62,7 +56,6 @@ dn: CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: serversContainer cn: Servers -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2181038080 @@ -70,7 +63,6 @@ dn: CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Services -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 2147483648 @@ -78,14 +70,12 @@ dn: CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Windows NT -instanceType: 4 showInAdvancedViewOnly: TRUE dn: CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: nTDSService cn: Directory Service -instanceType: 4 showInAdvancedViewOnly: TRUE sPNMappings: host=ldap,dns,cifs,http @@ -93,14 +83,12 @@ dn: CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Query-Policies -instanceType: 4 showInAdvancedViewOnly: TRUE dn: CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: queryPolicy cn: Default Query Policy -instanceType: 4 showInAdvancedViewOnly: TRUE lDAPAdminLimits: MaxValRange=1500 lDAPAdminLimits: MaxReceiveBuffer=10485760 diff --git a/source4/setup/provision_configuration_basedn_modify.ldif b/source4/setup/provision_configuration_basedn_modify.ldif index 46ba4e9649..a72f2c8eca 100644 --- a/source4/setup/provision_configuration_basedn_modify.ldif +++ b/source4/setup/provision_configuration_basedn_modify.ldif @@ -3,14 +3,8 @@ ############################### dn: ${CONFIGDN} changetype: modify -replace: instanceType -instanceType: 13 -- replace: showInAdvancedViewOnly showInAdvancedViewOnly: TRUE - -replace: objectCategory -objectCategory: CN=Configuration,${SCHEMADN} -- replace: subRefs subRefs: ${SCHEMADN} diff --git a/source4/setup/provision_schema_basedn_modify.ldif b/source4/setup/provision_schema_basedn_modify.ldif index 92c5cf1ace..986f0d632c 100644 --- a/source4/setup/provision_schema_basedn_modify.ldif +++ b/source4/setup/provision_schema_basedn_modify.ldif @@ -3,9 +3,6 @@ ############################### dn: ${SCHEMADN} changetype: modify -replace: instanceType -instanceType: 13 -- replace: showInAdvancedViewOnly showInAdvancedViewOnly: TRUE - diff --git a/source4/setup/provision_self_join.ldif b/source4/setup/provision_self_join.ldif index 06230e8d00..1caa62163e 100644 --- a/source4/setup/provision_self_join.ldif +++ b/source4/setup/provision_self_join.ldif @@ -43,7 +43,6 @@ dn: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: server cn: ${NETBIOSNAME} -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 1375731712 dNSHostName: ${DNSNAME} @@ -55,7 +54,6 @@ objectClass: applicationSettings objectClass: nTDSDSA cn: NTDS Settings options: 1 -instanceType: 4 showInAdvancedViewOnly: TRUE systemFlags: 33554432 dMDLocation: ${SCHEMADN} diff --git a/source4/setup/provision_templates.ldif b/source4/setup/provision_templates.ldif index 8797efaf98..04eaabcab7 100644 --- a/source4/setup/provision_templates.ldif +++ b/source4/setup/provision_templates.ldif @@ -66,7 +66,6 @@ sAMAccountType: 268435456 # # dn: CN=TemplateAlias,CN=Templates # cn: TemplateAlias -# instanceType: 4 # groupType: -2147483644 # sAMAccountType: 268435456 diff --git a/source4/setup/provision_users.ldif b/source4/setup/provision_users.ldif index 7c1a438d8e..3e6f717f15 100644 --- a/source4/setup/provision_users.ldif +++ b/source4/setup/provision_users.ldif @@ -134,7 +134,6 @@ objectClass: top objectClass: group cn: RAS and IAS Servers description: Servers in this group can access remote access properties of users -instanceType: 4 objectSid: ${DOMAINSID}-553 sAMAccountName: RAS and IAS Servers sAMAccountType: 536870912 @@ -307,7 +306,6 @@ objectClass: top objectClass: group cn: Server Operators description: Members can administer domain servers -instanceType: 4 objectSid: S-1-5-32-549 adminCount: 1 sAMAccountName: Server Operators @@ -327,7 +325,6 @@ objectClass: top objectClass: group cn: Account Operators description: Members can administer domain user and group accounts -instanceType: 4 objectSid: S-1-5-32-548 adminCount: 1 sAMAccountName: Account Operators diff --git a/source4/setup/provision_users_modify.ldif b/source4/setup/provision_users_modify.ldif index 42dff07080..06954c44f0 100644 --- a/source4/setup/provision_users_modify.ldif +++ b/source4/setup/provision_users_modify.ldif @@ -3,9 +3,6 @@ changetype: modify replace: description description: Default container for upgraded user accounts - -replace: instanceType -instanceType: 4 -- replace: showInAdvancedViewOnly showInAdvancedViewOnly: FALSE - -- cgit From 73626c266c3ea1b477185a428b2c1be64feff598 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 18 Jan 2008 01:47:10 +0100 Subject: registry: Check for more specific LDB return codes, handle changing existing values better. (This used to be commit c8b22ef30c7fc0ccc15e9fc9a38fdc639fc4b976) --- source4/lib/registry/ldb.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 259315cc39..d56b63299d 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -478,13 +478,18 @@ static WERROR ldb_set_value(struct hive_key *parent, ldb_dn_add_child_fmt(msg->dn, "value=%s", name); ret = ldb_add(kd->ldb, msg); - if (ret < 0) { - ret = ldb_modify(kd->ldb, msg); - if (ret < 0) { - DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(kd->ldb))); - talloc_free(mem_ctx); - return WERR_FOOBAR; + if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) { + int i; + for (i = 0; i < msg->num_elements; i++) { + msg->elements[i].flags = LDB_FLAG_MOD_REPLACE; } + ret = ldb_modify(kd->ldb, msg); + } + + if (ret != LDB_SUCCESS) { + DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(kd->ldb))); + talloc_free(mem_ctx); + return WERR_FOOBAR; } talloc_free(mem_ctx); -- cgit From 158a2eed334512c28a7101b3af2c364b4ac1b3fd Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 18 Jan 2008 01:48:48 +0100 Subject: registry: Properly check return values from ldb_*() functions. There were a few cases left that attempted to detect errors from ldb_*() function calls using "(ret < 0)". As all LDB_* error codes are greater than zero, there was no chance any errors would be detected. Changed all such tests to use "(ret != LDB_SUCCESS)". (This used to be commit 0ed6f1b1628da5b922f02a5f9a6c60071b6277f2) --- source4/lib/registry/ldb.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index d56b63299d..d87bc6cf8e 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -400,7 +400,7 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, talloc_strdup(mem_ctx, classname)); ret = ldb_add(parentkd->ldb, msg); - if (ret < 0) { + if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } @@ -432,7 +432,7 @@ static WERROR ldb_del_key(const struct hive_key *key, const char *child) if (ret == LDB_ERR_NO_SUCH_OBJECT) { return WERR_NOT_FOUND; - } else if (ret < 0) { + } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_key: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } @@ -455,7 +455,7 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child) if (ret == LDB_ERR_NO_SUCH_OBJECT) { return WERR_NOT_FOUND; - } else if (ret < 0) { + } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb))); return WERR_FOOBAR; } -- cgit From 4d8a60f617f941ff6481bcfbac73d7ed69e43daa Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 18 Jan 2008 01:50:33 +0100 Subject: When Windows initially creates a new value, the value name is "New Value #1". The '#' character was causing problems, as it was not being escaped for the dn, but the failure returned by ldb_dn_add_child_fmt() was not being caught. This was causing the new value to be added on the parent key, not the current key. When attempting to delete the new value (now on the parent key) the same escaping error was returned by ldb_dn_add_child_fmt(), causing the delete to delete the key and not the value. When attempting to rename a value, Windows first tries to ensure the new name does not already exist. When a value does not exist, Windows expects a return value of WERR_BADFILE, but WERR_NOT_FOUND was being returned instead. Providing the WERR_BADFILE that Windows expects allows values to be renamed. (This used to be commit 94fb39cfd967455ce5a554720c1c7e6183f91056) --- source4/lib/registry/ldb.c | 24 ++++++++++++++++++++++-- source4/rpc_server/winreg/rpc_winreg.c | 10 +++++++++- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index d87bc6cf8e..884aed1579 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -112,6 +112,16 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, } +static char *reg_ldb_escape(TALLOC_CTX *mem_ctx, const char *value) +{ + struct ldb_val val; + + val.data = discard_const_p(uint8_t, value); + val.length = strlen(value); + + return ldb_dn_escape_value(mem_ctx, val); +} + static int reg_close_ldb_key(struct ldb_key_data *key) { if (key->subkeys != NULL) { @@ -447,7 +457,12 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child) struct ldb_dn *childdn; childdn = ldb_dn_copy(kd->ldb, kd->dn); - ldb_dn_add_child_fmt(childdn, "value=%s", child); + if (!ldb_dn_add_child_fmt(childdn, "value=%s", + reg_ldb_escape(childdn, child))) + { + talloc_free(childdn); + return WERR_FOOBAR; + } ret = ldb_delete(kd->ldb, childdn); @@ -475,7 +490,12 @@ static WERROR ldb_set_value(struct hive_key *parent, msg = reg_ldb_pack_value(kd->ldb, mem_ctx, name, type, data); msg->dn = ldb_dn_copy(msg, kd->dn); - ldb_dn_add_child_fmt(msg->dn, "value=%s", name); + if (!ldb_dn_add_child_fmt(msg->dn, "value=%s", + reg_ldb_escape(mem_ctx, name))) + { + talloc_free(mem_ctx); + return WERR_FOOBAR; + } ret = ldb_add(kd->ldb, msg); if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) { diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 681e3b918f..7eba428aef 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -411,7 +411,15 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, &value_type, &value_data); if (!W_ERROR_IS_OK(result)) { - return result; + /* + * Windows expects WERR_BADFILE when a particular value + * is not found. If we receive WERR_NOT_FOUND from the lower + * layer calls, translate it here to return what is expected. + */ + if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) + return WERR_BADFILE; + else + return result; } /* Just asking for the size of the buffer */ -- cgit From 85d60d2d091a2eb6bd4c73c87c94b10ee93167ee Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 18 Jan 2008 02:45:00 +0100 Subject: registry: Improve error codes and update tests. Rather than map the error returned by the registry to the correct error, return the correct error in the first place. Also deal with the fact that the right error code is now returned in a couple of places. (This used to be commit 1e31fcb8a097810a97e2d4bb1f243f1b34cc2415) --- source4/lib/registry/dir.c | 2 +- source4/lib/registry/ldb.c | 9 ++++++--- source4/lib/registry/patchfile.c | 10 +++++----- source4/lib/registry/regf.c | 2 +- source4/lib/registry/tests/hive.c | 4 ++-- source4/lib/registry/tests/registry.c | 16 ++++++++-------- source4/rpc_server/winreg/rpc_winreg.c | 10 +--------- 7 files changed, 24 insertions(+), 29 deletions(-) diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c index a13e3753b7..87d76e5eb7 100644 --- a/source4/lib/registry/dir.c +++ b/source4/lib/registry/dir.c @@ -282,7 +282,7 @@ static WERROR reg_dir_get_value(TALLOC_CTX *mem_ctx, contents = file_load(path, &size, mem_ctx); talloc_free(path); if (contents == NULL) - return WERR_NOT_FOUND; + return WERR_BADFILE; if (type != NULL) *type = 4; /* FIXME */ diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 884aed1579..17fac4abb2 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -111,7 +111,6 @@ static struct ldb_message *reg_ldb_pack_value(struct ldb_context *ctx, return msg; } - static char *reg_ldb_escape(TALLOC_CTX *mem_ctx, const char *value) { struct ldb_val val; @@ -303,7 +302,7 @@ static WERROR ldb_get_value(TALLOC_CTX *mem_ctx, struct hive_key *k, } if (res->count == 0) - return WERR_NOT_FOUND; + return WERR_BADFILE; reg_ldb_unpack_value(mem_ctx, res->msgs[0], NULL, data_type, data); @@ -410,8 +409,12 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, talloc_strdup(mem_ctx, classname)); ret = ldb_add(parentkd->ldb, msg); + if (ret == LDB_ERR_ENTRY_ALREADY_EXISTS) { + return WERR_ALREADY_EXISTS; + } + if (ret != LDB_SUCCESS) { - DEBUG(1, ("ldb_msg_add: %s\n", ldb_errstring(parentkd->ldb))); + DEBUG(1, ("ldb_add: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index b6ad7dfb10..d859bc3134 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -132,10 +132,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, continue; } else { t1 = NULL; - error2 = WERR_DEST_NOT_FOUND; + error2 = WERR_NOT_FOUND; } - if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) { + if (!W_ERROR_EQUAL(error2, WERR_NOT_FOUND)) { DEBUG(0, ("Error occured while getting subkey by name: %s\n", win_errstr(error2))); talloc_free(mem_ctx); @@ -174,10 +174,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, name, &type2, &contents2); } else - error2 = WERR_DEST_NOT_FOUND; + error2 = WERR_BADFILE; if(!W_ERROR_IS_OK(error2) && - !W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) { + !W_ERROR_EQUAL(error2, WERR_BADFILE)) { DEBUG(0, ("Error occured while getting value by name: %s\n", win_errstr(error2))); talloc_free(mem_ctx); @@ -210,7 +210,7 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, if (W_ERROR_IS_OK(error2)) continue; - if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) { + if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) { DEBUG(0, ("Error occured while getting value by name: %s\n", win_errstr(error2))); return error2; diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 9b126cc808..475ec7bb5d 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -575,7 +575,7 @@ static WERROR regf_get_value_by_name(TALLOC_CTX *mem_ctx, } if (W_ERROR_EQUAL(error, WERR_NO_MORE_ITEMS)) - return WERR_NOT_FOUND; + return WERR_BADFILE; return error; } diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index 22b4785222..f72b7d6bf3 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -174,7 +174,7 @@ static bool test_get_value(struct torture_context *tctx, const void *test_data) torture_assert_werr_ok(tctx, error, "hive_key_add_name"); error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting missing value"); error = hive_key_set_value(subkey, "Answer", REG_DWORD, @@ -215,7 +215,7 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data) torture_assert_werr_ok(tctx, error, "deleting value"); error = hive_get_value(mem_ctx, subkey, "Answer", &type, &value); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, "getting value"); + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting value"); error = hive_key_del_value(subkey, "Answer"); torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 75fbe1cbea..59e31f55dc 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -195,15 +195,15 @@ static bool test_del_key(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "getting predefined key failed"); - error = reg_key_add_name(rctx, root, "Hamburg", NULL, NULL, &newkey); + error = reg_key_add_name(rctx, root, "Polen", NULL, NULL, &newkey); torture_assert_werr_ok(tctx, error, "Creating key return code"); torture_assert(tctx, newkey != NULL, "Creating new key"); - error = reg_key_del(root, "Hamburg"); + error = reg_key_del(root, "Polen"); torture_assert_werr_ok(tctx, error, "Delete key"); - error = reg_key_del(root, "Hamburg"); + error = reg_key_del(root, "Polen"); torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, "Delete missing key"); @@ -239,7 +239,7 @@ static bool test_flush_key(struct torture_context *tctx, void *_data) struct registry_key *root, *subkey; WERROR error; - if (!create_test_key(tctx, rctx, "Munchen", &root, &subkey)) + if (!create_test_key(tctx, rctx, "Bremen", &root, &subkey)) return false; error = reg_key_flush(subkey); @@ -416,7 +416,7 @@ static bool test_get_value(struct torture_context *tctx, void *_data) error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type, &data); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting missing value"); error = reg_val_set(subkey, __FUNCTION__, REG_DWORD, @@ -447,12 +447,12 @@ static bool test_del_value(struct torture_context *tctx, void *_data) uint32_t value = 42; uint32_t type; - if (!create_test_key(tctx, rctx, "Duisburg", &root, &subkey)) + if (!create_test_key(tctx, rctx, "Warschau", &root, &subkey)) return false; error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type, &data); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting missing value"); error = reg_val_set(subkey, __FUNCTION__, REG_DWORD, @@ -464,7 +464,7 @@ static bool test_del_value(struct torture_context *tctx, void *_data) error = reg_key_get_value_by_name(tctx, subkey, __FUNCTION__, &type, &data); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting missing value"); return true; diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 7eba428aef..681e3b918f 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -411,15 +411,7 @@ static WERROR dcesrv_winreg_QueryValue(struct dcesrv_call_state *dce_call, &value_type, &value_data); if (!W_ERROR_IS_OK(result)) { - /* - * Windows expects WERR_BADFILE when a particular value - * is not found. If we receive WERR_NOT_FOUND from the lower - * layer calls, translate it here to return what is expected. - */ - if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) - return WERR_BADFILE; - else - return result; + return result; } /* Just asking for the size of the buffer */ -- cgit From e490415e2e300452e152373eb79fb437fb11449d Mon Sep 17 00:00:00 2001 From: Andrew Kroeger Date: Fri, 18 Jan 2008 02:51:51 +0100 Subject: When Windows attempts to create a new key, it looks for an available key name starting with "New Key #1" and iterating up to "New Key #99" before giving up. ldb_open_key() calls reg_path_to_ldb() to build the appropriate dn from the key name. reg_path_to_ldb() was not catching the error returned by ldb_dn_add_base_fmt() due to the unescaped '#' character, causing the returned dn to be that of the parent key, not the potential new key. Additionally, Windows expects a return value of WERR_BADFILE when a key does not exist, but WERR_NOT_FOUND was being returned instead. Correcting the building of the dn and the providing the expected return value allows new key creation to succeed. When attempting to delete a key, Windows passes the complete path to the key, not just the name of the child key to be deleted. Using reg_path_to_ldb() to build the correct dn allows key deletion to succeed. (This used to be commit d57792d67b865ef43e7f21640b158862627f4b45) --- source4/lib/registry/ldb.c | 20 +++++++++++++------- source4/rpc_server/winreg/rpc_winreg.c | 7 +++++++ 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index 17fac4abb2..edfb1f2e59 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -168,7 +168,13 @@ static struct ldb_dn *reg_path_to_ldb(TALLOC_CTX *mem_ctx, else keyname = mypath; if(strlen(keyname)) { - ldb_dn_add_base_fmt(ret, "key=%s", keyname); + if (!ldb_dn_add_base_fmt(ret, "key=%s", + reg_ldb_escape(local_ctx, + keyname))) + { + talloc_free(local_ctx); + return NULL; + } } if(begin) { @@ -430,18 +436,18 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, return WERR_OK; } -static WERROR ldb_del_key(const struct hive_key *key, const char *child) +static WERROR ldb_del_key(const struct hive_key *key, const char *name) { int ret; struct ldb_key_data *parentkd = talloc_get_type(key, struct ldb_key_data); - struct ldb_dn *childdn; + struct ldb_dn *ldap_path; + TALLOC_CTX *mem_ctx = talloc_init("ldb_del_key"); - childdn = ldb_dn_copy(parentkd->ldb, parentkd->dn); - ldb_dn_add_child_fmt(childdn, "key=%s", child); + ldap_path = reg_path_to_ldb(mem_ctx, key, name, NULL); - ret = ldb_delete(parentkd->ldb, childdn); + ret = ldb_delete(parentkd->ldb, ldap_path); - talloc_free(childdn); + talloc_free(mem_ctx); if (ret == LDB_ERR_NO_SUCH_OBJECT) { return WERR_NOT_FOUND; diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 681e3b918f..3c00944d59 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -356,6 +356,13 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, r->out.handle = &newh->wire_handle; } else { talloc_free(newh); + /* + * Windows expects WERR_BADFILE when a particular key + * is not found. If we receive WERR_NOT_FOUND from the lower + * layer calls, translate it here to return what is expected. + */ + if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) + return WERR_BADFILE; } return result; -- cgit From b5ba4910120e5350e48927cc0f5f06742ee02eb8 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 18 Jan 2008 03:00:00 +0100 Subject: registry: Avoid mapping registry return codes: return the right value in the first place. (This used to be commit 434e4857cec17d6d9e8983e151c170eed59fc6d1) --- source4/lib/registry/local.c | 2 +- source4/lib/registry/samba.c | 2 +- source4/lib/registry/tests/registry.c | 2 +- source4/rpc_server/winreg/rpc_winreg.c | 7 ------- 4 files changed, 3 insertions(+), 10 deletions(-) diff --git a/source4/lib/registry/local.c b/source4/lib/registry/local.c index fa59f25596..3e463100c9 100644 --- a/source4/lib/registry/local.c +++ b/source4/lib/registry/local.c @@ -140,7 +140,7 @@ WERROR local_get_predefined_key(struct registry_context *ctx, } if (mp == NULL) - return WERR_NOT_FOUND; + return WERR_BADFILE; *key = reg_import_hive_key(ctx, mp->key, mp->path.predefined_key, diff --git a/source4/lib/registry/samba.c b/source4/lib/registry/samba.c index 02f3363bab..599385e73c 100644 --- a/source4/lib/registry/samba.c +++ b/source4/lib/registry/samba.c @@ -42,7 +42,7 @@ static WERROR mount_samba_hive(struct registry_context *ctx, error = reg_open_hive(ctx, location, auth_info, creds, lp_ctx, &hive); - if (W_ERROR_EQUAL(error, WERR_NOT_FOUND)) + if (W_ERROR_EQUAL(error, WERR_BADFILE)) error = reg_open_ldb_file(ctx, location, auth_info, creds, lp_ctx, &hive); diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 59e31f55dc..06783e6a75 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -53,7 +53,7 @@ static bool test_get_predefined_unknown(struct torture_context *tctx, WERROR error; error = reg_get_predefined_key(rctx, 1337, &root); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting predefined key failed"); return true; } diff --git a/source4/rpc_server/winreg/rpc_winreg.c b/source4/rpc_server/winreg/rpc_winreg.c index 3c00944d59..681e3b918f 100644 --- a/source4/rpc_server/winreg/rpc_winreg.c +++ b/source4/rpc_server/winreg/rpc_winreg.c @@ -356,13 +356,6 @@ static WERROR dcesrv_winreg_OpenKey(struct dcesrv_call_state *dce_call, r->out.handle = &newh->wire_handle; } else { talloc_free(newh); - /* - * Windows expects WERR_BADFILE when a particular key - * is not found. If we receive WERR_NOT_FOUND from the lower - * layer calls, translate it here to return what is expected. - */ - if (W_ERROR_EQUAL(result, WERR_NOT_FOUND)) - return WERR_BADFILE; } return result; -- cgit From 55ad09a01b31f2d2c9503f744b519e089f9f936b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Fri, 18 Jan 2008 03:37:06 +0100 Subject: registry: Use correct return values. (This used to be commit 98ebdbe52fd615ea62a3caa17acfe8bb31b8f85d) --- source4/lib/registry/dir.c | 4 ++-- source4/lib/registry/hive.c | 2 +- source4/lib/registry/ldb.c | 35 ++++++++++++++++++++++++++++------- source4/lib/registry/patchfile.c | 14 +++++++------- source4/lib/registry/regf.c | 22 +++++++++++----------- source4/lib/registry/tests/hive.c | 6 +++--- source4/lib/registry/tests/registry.c | 2 +- 7 files changed, 53 insertions(+), 32 deletions(-) diff --git a/source4/lib/registry/dir.c b/source4/lib/registry/dir.c index 87d76e5eb7..27cae8c490 100644 --- a/source4/lib/registry/dir.c +++ b/source4/lib/registry/dir.c @@ -64,7 +64,7 @@ static WERROR reg_dir_del_key(const struct hive_key *k, const char *name) if (rmdir(child) == 0) ret = WERR_OK; else if (errno == ENOENT) - ret = WERR_NOT_FOUND; + ret = WERR_BADFILE; else ret = WERR_GENERAL_FAILURE; @@ -339,7 +339,7 @@ static WERROR reg_dir_del_value (struct hive_key *key, const char *name) if (unlink(path) < 0) { talloc_free(path); if (errno == ENOENT) - return WERR_NOT_FOUND; + return WERR_BADFILE; return WERR_GENERAL_FAILURE; } talloc_free(path); diff --git a/source4/lib/registry/hive.c b/source4/lib/registry/hive.c index bbe510772c..5d56a30b3e 100644 --- a/source4/lib/registry/hive.c +++ b/source4/lib/registry/hive.c @@ -41,7 +41,7 @@ _PUBLIC_ WERROR reg_open_hive(TALLOC_CTX *parent_ctx, const char *location, fd = open(location, O_RDWR); if (fd == -1) { if (errno == ENOENT) - return WERR_NOT_FOUND; + return WERR_BADFILE; return WERR_BADFILE; } diff --git a/source4/lib/registry/ldb.c b/source4/lib/registry/ldb.c index edfb1f2e59..262859f64b 100644 --- a/source4/lib/registry/ldb.c +++ b/source4/lib/registry/ldb.c @@ -337,7 +337,7 @@ static WERROR ldb_open_key(TALLOC_CTX *mem_ctx, const struct hive_key *h, DEBUG(3, ("Key '%s' not found\n", ldb_dn_get_linearized(ldap_path))); talloc_free(res); - return WERR_NOT_FOUND; + return WERR_BADFILE; } newkd = talloc_zero(mem_ctx, struct ldb_key_data); @@ -400,7 +400,7 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, struct security_descriptor *sd, struct hive_key **newkey) { - const struct ldb_key_data *parentkd = (const struct ldb_key_data *)parent; + struct ldb_key_data *parentkd = (const struct ldb_key_data *)parent; struct ldb_message *msg; struct ldb_key_data *newkd; int ret; @@ -433,6 +433,10 @@ static WERROR ldb_add_key(TALLOC_CTX *mem_ctx, const struct hive_key *parent, *newkey = (struct hive_key *)newkd; + /* reset cache */ + talloc_free(parentkd->subkeys); + parentkd->subkeys = NULL; + return WERR_OK; } @@ -450,12 +454,16 @@ static WERROR ldb_del_key(const struct hive_key *key, const char *name) talloc_free(mem_ctx); if (ret == LDB_ERR_NO_SUCH_OBJECT) { - return WERR_NOT_FOUND; + return WERR_BADFILE; } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_key: %s\n", ldb_errstring(parentkd->ldb))); return WERR_FOOBAR; } + /* reset cache */ + talloc_free(parentkd->subkeys); + parentkd->subkeys = NULL; + return WERR_OK; } @@ -478,12 +486,16 @@ static WERROR ldb_del_value (struct hive_key *key, const char *child) talloc_free(childdn); if (ret == LDB_ERR_NO_SUCH_OBJECT) { - return WERR_NOT_FOUND; + return WERR_BADFILE; } else if (ret != LDB_SUCCESS) { DEBUG(1, ("ldb_del_value: %s\n", ldb_errstring(kd->ldb))); return WERR_FOOBAR; } + /* reset cache */ + talloc_free(kd->values); + kd->values = NULL; + return WERR_OK; } @@ -521,6 +533,10 @@ static WERROR ldb_set_value(struct hive_key *parent, return WERR_FOOBAR; } + /* reset cache */ + talloc_free(kd->values); + kd->values = NULL; + talloc_free(mem_ctx); return WERR_OK; } @@ -537,17 +553,23 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx, { struct ldb_key_data *kd = talloc_get_type(key, struct ldb_key_data); + if (kd->subkeys == NULL) { + W_ERROR_NOT_OK_RETURN(cache_subkeys(kd)); + } + + if (kd->values == NULL) { + W_ERROR_NOT_OK_RETURN(cache_values(kd)); + } + /* FIXME */ if (classname != NULL) *classname = NULL; if (num_subkeys != NULL) { - W_ERROR_NOT_OK_RETURN(cache_subkeys(kd)); *num_subkeys = kd->subkey_count; } if (num_values != NULL) { - W_ERROR_NOT_OK_RETURN(cache_values(kd)); *num_values = kd->value_count; } @@ -557,7 +579,6 @@ static WERROR ldb_get_key_info(TALLOC_CTX *mem_ctx, if (max_subkeynamelen != NULL) { int i; struct ldb_message_element *el; - W_ERROR_NOT_OK_RETURN(cache_subkeys(kd)); *max_subkeynamelen = 0; diff --git a/source4/lib/registry/patchfile.c b/source4/lib/registry/patchfile.c index d859bc3134..fa1367bbd2 100644 --- a/source4/lib/registry/patchfile.c +++ b/source4/lib/registry/patchfile.c @@ -82,11 +82,11 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, if (W_ERROR_IS_OK(error2)) continue; } else { - error2 = WERR_DEST_NOT_FOUND; + error2 = WERR_BADFILE; t2 = NULL; } - if (!W_ERROR_EQUAL(error2, WERR_DEST_NOT_FOUND)) { + if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) { DEBUG(0, ("Error occured while getting subkey by name: %s\n", win_errstr(error2))); talloc_free(mem_ctx); @@ -132,10 +132,10 @@ WERROR reg_generate_diff_key(struct registry_key *oldkey, continue; } else { t1 = NULL; - error2 = WERR_NOT_FOUND; + error2 = WERR_BADFILE; } - if (!W_ERROR_EQUAL(error2, WERR_NOT_FOUND)) { + if (!W_ERROR_EQUAL(error2, WERR_BADFILE)) { DEBUG(0, ("Error occured while getting subkey by name: %s\n", win_errstr(error2))); talloc_free(mem_ctx); @@ -238,14 +238,14 @@ _PUBLIC_ WERROR reg_generate_diff(struct registry_context *ctx1, struct registry_key *r1 = NULL, *r2 = NULL; error = reg_get_predefined_key(ctx1, i, &r1); if (!W_ERROR_IS_OK(error) && - !W_ERROR_EQUAL(error, WERR_NOT_FOUND)) { + !W_ERROR_EQUAL(error, WERR_BADFILE)) { DEBUG(0, ("Unable to open hive %s for backend 1\n", reg_get_predef_name(i))); } error = reg_get_predefined_key(ctx2, i, &r2); if (!W_ERROR_IS_OK(error) && - !W_ERROR_EQUAL(error, WERR_NOT_FOUND)) { + !W_ERROR_EQUAL(error, WERR_BADFILE)) { DEBUG(0, ("Unable to open hive %s for backend 2\n", reg_get_predef_name(i))); } @@ -356,7 +356,7 @@ static WERROR reg_diff_apply_set_value(void *_ctx, const char *path, /* Open key */ error = reg_open_key_abs(ctx, ctx, path, &tmp); - if (W_ERROR_EQUAL(error, WERR_DEST_NOT_FOUND)) { + if (W_ERROR_EQUAL(error, WERR_BADFILE)) { DEBUG(0, ("Error opening key '%s'\n", path)); return error; } diff --git a/source4/lib/registry/regf.c b/source4/lib/registry/regf.c index 475ec7bb5d..15b60745f0 100644 --- a/source4/lib/registry/regf.c +++ b/source4/lib/registry/regf.c @@ -870,7 +870,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx, break; } if (key_off == 0) - return WERR_NOT_FOUND; + return WERR_BADFILE; } else if (!strncmp((char *)data.data, "lf", 2)) { struct lf_block lf; struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience); @@ -905,7 +905,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx, break; } if (key_off == 0) - return WERR_NOT_FOUND; + return WERR_BADFILE; } else if (!strncmp((char *)data.data, "lh", 2)) { struct lh_block lh; struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience); @@ -942,7 +942,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx, break; } if (key_off == 0) - return WERR_NOT_FOUND; + return WERR_BADFILE; } else if (!strncmp((char *)data.data, "ri", 2)) { struct ri_block ri; struct tdr_pull *pull = tdr_pull_init(ctx, private_data->hive->iconv_convenience); @@ -1022,7 +1022,7 @@ static WERROR regf_get_subkey_by_name(TALLOC_CTX *ctx, } talloc_free(pull); if (!key_off) - return WERR_NOT_FOUND; + return WERR_BADFILE; } else { DEBUG(0, ("Unknown subkey list type.\n")); return WERR_GENERAL_FAILURE; @@ -1419,7 +1419,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset, } if (!found_offset) { DEBUG(2, ("Subkey not found\n")); - return WERR_NOT_FOUND; + return WERR_BADFILE; } li.key_count--; @@ -1464,7 +1464,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset, } if (!found_offset) { DEBUG(2, ("Subkey not found\n")); - return WERR_NOT_FOUND; + return WERR_BADFILE; } lf.key_count--; @@ -1510,7 +1510,7 @@ static WERROR regf_sl_del_entry(struct regf_data *regf, uint32_t list_offset, } if (!found_offset) { DEBUG(0, ("Subkey not found\n")); - return WERR_NOT_FOUND; + return WERR_BADFILE; } lh.key_count--; @@ -1548,7 +1548,7 @@ static WERROR regf_del_value (struct hive_key *key, const char *name) uint32_t i; if (nk->values_offset == -1) { - return WERR_NOT_FOUND; + return WERR_BADFILE; } values = hbin_get(regf, nk->values_offset); @@ -1572,7 +1572,7 @@ static WERROR regf_del_value (struct hive_key *key, const char *name) } } if (!found_offset) { - return WERR_NOT_FOUND; + return WERR_BADFILE; } else { nk->num_values--; values.length = (nk->num_values)*4; @@ -1608,14 +1608,14 @@ static WERROR regf_del_key(const struct hive_key *parent, const char *name) if (parent_nk->subkeys_offset == -1) { DEBUG(4, ("Subkey list is empty, this key cannot contain subkeys.\n")); - return WERR_NOT_FOUND; + return WERR_BADFILE; } /* Find the key */ if (!W_ERROR_IS_OK(regf_get_subkey_by_name(parent_nk, parent, name, (struct hive_key **)&key))) { DEBUG(2, ("Key '%s' not found\n", name)); - return WERR_NOT_FOUND; + return WERR_BADFILE; } if (key->nk->subkeys_offset != -1 || diff --git a/source4/lib/registry/tests/hive.c b/source4/lib/registry/tests/hive.c index f72b7d6bf3..4d27e83a74 100644 --- a/source4/lib/registry/tests/hive.c +++ b/source4/lib/registry/tests/hive.c @@ -31,7 +31,7 @@ static bool test_del_nonexistant_key(struct torture_context *tctx, { const struct hive_key *root = (const struct hive_key *)test_data; WERROR error = hive_key_del(root, "bla"); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "invalid return code"); return true; @@ -134,7 +134,7 @@ static bool test_del_key(struct torture_context *tctx, const void *test_data) torture_assert_werr_ok(tctx, error, "reg_key_del"); error = hive_key_del(root, "Nested Key"); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, "reg_key_del"); + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "reg_key_del"); return true; } @@ -218,7 +218,7 @@ static bool test_del_value(struct torture_context *tctx, const void *test_data) torture_assert_werr_equal(tctx, error, WERR_BADFILE, "getting value"); error = hive_key_del_value(subkey, "Answer"); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "deleting value"); return true; diff --git a/source4/lib/registry/tests/registry.c b/source4/lib/registry/tests/registry.c index 06783e6a75..7d14b3a412 100644 --- a/source4/lib/registry/tests/registry.c +++ b/source4/lib/registry/tests/registry.c @@ -204,7 +204,7 @@ static bool test_del_key(struct torture_context *tctx, void *_data) torture_assert_werr_ok(tctx, error, "Delete key"); error = reg_key_del(root, "Polen"); - torture_assert_werr_equal(tctx, error, WERR_NOT_FOUND, + torture_assert_werr_equal(tctx, error, WERR_BADFILE, "Delete missing key"); return true; -- cgit From 524d280ad09c99bcbf63d789e909afdf7edb5860 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Jan 2008 15:33:57 +1100 Subject: merged tdb changes from ctdb (This used to be commit c54c087a19e36e0522eb4546c9425ae446f0628b) --- source4/lib/tdb/common/freelist.c | 85 ++++++++++++++++++------------------ source4/lib/tdb/common/tdb_private.h | 1 - source4/lib/tdb/common/transaction.c | 22 +++------- 3 files changed, 49 insertions(+), 59 deletions(-) diff --git a/source4/lib/tdb/common/freelist.c b/source4/lib/tdb/common/freelist.c index c086c151fa..2f2a4c379b 100644 --- a/source4/lib/tdb/common/freelist.c +++ b/source4/lib/tdb/common/freelist.c @@ -208,62 +208,61 @@ update: } + /* the core of tdb_allocate - called when we have decided which free list entry to use + + Note that we try to allocate by grabbing data from the end of an existing record, + not the beginning. This is so the left merge in a free is more likely to be + able to free up the record without fragmentation */ -static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, tdb_len_t length, tdb_off_t rec_ptr, - struct list_struct *rec, tdb_off_t last_ptr) +static tdb_off_t tdb_allocate_ofs(struct tdb_context *tdb, + tdb_len_t length, tdb_off_t rec_ptr, + struct list_struct *rec, tdb_off_t last_ptr) { - struct list_struct newrec; - tdb_off_t newrec_ptr; +#define MIN_REC_SIZE (sizeof(struct list_struct) + sizeof(tdb_off_t) + 8) - memset(&newrec, '\0', sizeof(newrec)); + if (rec->rec_len < length + MIN_REC_SIZE) { + /* we have to grab the whole record */ - /* found it - now possibly split it up */ - if (rec->rec_len > length + MIN_REC_SIZE) { - /* Length of left piece */ - length = TDB_ALIGN(length, TDB_ALIGNMENT); - - /* Right piece to go on free list */ - newrec.rec_len = rec->rec_len - (sizeof(*rec) + length); - newrec_ptr = rec_ptr + sizeof(*rec) + length; - - /* And left record is shortened */ - rec->rec_len = length; - } else { - newrec_ptr = 0; + /* unlink it from the previous record */ + if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) { + return 0; + } + + /* mark it not free */ + rec->magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; + } + return rec_ptr; + } + + /* we're going to just shorten the existing record */ + rec->rec_len -= (length + sizeof(*rec)); + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { + return 0; } - - /* Remove allocated record from the free list */ - if (tdb_ofs_write(tdb, last_ptr, &rec->next) == -1) { + if (update_tailer(tdb, rec_ptr, rec) == -1) { return 0; } - - /* Update header: do this before we drop alloc - lock, otherwise tdb_free() might try to - merge with us, thinking we're free. - (Thanks Jeremy Allison). */ + + /* and setup the new record */ + rec_ptr += sizeof(*rec) + rec->rec_len; + + memset(rec, '\0', sizeof(*rec)); + rec->rec_len = length; rec->magic = TDB_MAGIC; + if (tdb_rec_write(tdb, rec_ptr, rec) == -1) { return 0; } - - /* Did we create new block? */ - if (newrec_ptr) { - /* Update allocated record tailer (we - shortened it). */ - if (update_tailer(tdb, rec_ptr, rec) == -1) { - return 0; - } - - /* Free new record */ - if (tdb_free(tdb, newrec_ptr, &newrec) == -1) { - return 0; - } + + if (update_tailer(tdb, rec_ptr, rec) == -1) { + return 0; } - - /* all done - return the new record offset */ + return rec_ptr; } @@ -287,6 +286,7 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st /* Extra bytes required for tailer */ length += sizeof(tdb_off_t); + length = TDB_ALIGN(length, TDB_ALIGNMENT); again: last_ptr = FREELIST_TOP; @@ -343,7 +343,8 @@ tdb_off_t tdb_allocate(struct tdb_context *tdb, tdb_len_t length, struct list_st goto fail; } - newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, rec, bestfit.last_ptr); + newrec_ptr = tdb_allocate_ofs(tdb, length, bestfit.rec_ptr, + rec, bestfit.last_ptr); tdb_unlock(tdb, -1, F_WRLCK); return newrec_ptr; } diff --git a/source4/lib/tdb/common/tdb_private.h b/source4/lib/tdb/common/tdb_private.h index 63a6d04e72..0d3f10582e 100644 --- a/source4/lib/tdb/common/tdb_private.h +++ b/source4/lib/tdb/common/tdb_private.h @@ -49,7 +49,6 @@ typedef uint32_t tdb_off_t; #define TDB_DEAD_MAGIC (0xFEE1DEAD) #define TDB_RECOVERY_MAGIC (0xf53bc0e7U) #define TDB_ALIGNMENT 4 -#define MIN_REC_SIZE (2*sizeof(struct list_struct) + TDB_ALIGNMENT) #define DEFAULT_HASH_SIZE 131 #define FREELIST_TOP (sizeof(struct tdb_header)) #define TDB_ALIGN(x,a) (((x) + (a)-1) & ~((a)-1)) diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c index 0ecfb9b7ff..ea0e3a93f3 100644 --- a/source4/lib/tdb/common/transaction.c +++ b/source4/lib/tdb/common/transaction.c @@ -316,25 +316,15 @@ static int transaction_write_existing(struct tdb_context *tdb, tdb_off_t off, return 0; } - /* overwrite part of an existing block */ - if (buf == NULL) { - memset(tdb->transaction->blocks[blk] + off, 0, len); - } else { - memcpy(tdb->transaction->blocks[blk] + off, buf, len); - } - if (blk == tdb->transaction->num_blocks-1) { - if (len + off > tdb->transaction->last_block_size) { - tdb->transaction->last_block_size = len + off; - } + if (blk == tdb->transaction->num_blocks-1 && + off + len > tdb->transaction->last_block_size) { + len = tdb->transaction->last_block_size - off; } - return 0; + /* overwrite part of an existing block */ + memcpy(tdb->transaction->blocks[blk] + off, buf, len); -fail: - TDB_LOG((tdb, TDB_DEBUG_FATAL, "transaction_write: failed at off=%d len=%d\n", - (blk*tdb->transaction->block_size) + off, len)); - tdb->transaction->transaction_error = 1; - return -1; + return 0; } -- cgit From 61a015a786c52008f4471e62750ad93507bce518 Mon Sep 17 00:00:00 2001 From: Andrew Tridgell Date: Fri, 18 Jan 2008 15:45:22 +1100 Subject: merged changes from v3-2-test (This used to be commit 7077df3e2e3f171532f6a5ac87d45201736c9c11) --- source4/lib/tdb/common/open.c | 6 ++---- source4/lib/tdb/common/tdb.c | 42 ------------------------------------ source4/lib/tdb/common/tdb_private.h | 1 + source4/lib/tdb/common/transaction.c | 7 ++++-- source4/lib/tdb/common/traverse.c | 3 +++ source4/lib/tdb/docs/README | 3 +++ source4/lib/tdb/include/tdb.h | 7 +++--- source4/lib/tdb/tools/tdbtool.c | 2 +- 8 files changed, 18 insertions(+), 53 deletions(-) diff --git a/source4/lib/tdb/common/open.c b/source4/lib/tdb/common/open.c index 6bd8fda2bf..b19e4cea29 100644 --- a/source4/lib/tdb/common/open.c +++ b/source4/lib/tdb/common/open.c @@ -179,9 +179,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->page_size = 0x2000; } - if (open_flags & TDB_VOLATILE) { - tdb->max_dead_records = 5; - } + tdb->max_dead_records = (tdb_flags & TDB_VOLATILE) ? 5 : 0; if ((open_flags & O_ACCMODE) == O_WRONLY) { TDB_LOG((tdb, TDB_DEBUG_ERROR, "tdb_open_ex: can't open tdb %s write-only\n", @@ -229,6 +227,7 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, /* we need to zero database if we are the only one with it open */ if ((tdb_flags & TDB_CLEAR_IF_FIRST) && + (!tdb->read_only) && (locked = (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_WRLCK, F_SETLK, 0, 1) == 0))) { open_flags |= O_CREAT; if (ftruncate(tdb->fd, 0) == -1) { @@ -288,7 +287,6 @@ struct tdb_context *tdb_open_ex(const char *name, int hash_size, int tdb_flags, tdb->map_size = st.st_size; tdb->device = st.st_dev; tdb->inode = st.st_ino; - tdb->max_dead_records = 0; tdb_mmap(tdb); if (locked) { if (tdb->methods->tdb_brlock(tdb, ACTIVE_LOCK, F_UNLCK, F_SETLK, 0, 1) == -1) { diff --git a/source4/lib/tdb/common/tdb.c b/source4/lib/tdb/common/tdb.c index fd4e1cc8af..ea5d9ccc60 100644 --- a/source4/lib/tdb/common/tdb.c +++ b/source4/lib/tdb/common/tdb.c @@ -743,45 +743,3 @@ failed: tdb_unlockall(tdb); return -1; } - - -/* - validate the integrity of all tdb hash chains. Useful when debugging - */ -int tdb_validate(struct tdb_context *tdb) -{ - int h; - for (h=-1;h<(int)tdb->header.hash_size;h++) { - tdb_off_t rec_ptr; - uint32_t count = 0; - if (tdb_ofs_read(tdb, TDB_HASH_TOP(h), &rec_ptr) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read at top of hash %d\n", h)); - return -1; - } - while (rec_ptr) { - struct list_struct r; - tdb_off_t size; - - if (tdb_rec_read(tdb, rec_ptr, &r) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed rec_read h=%d rec_ptr=%u count=%u\n", - h, rec_ptr, count)); - return -1; - } - if (tdb_ofs_read(tdb, rec_ptr + sizeof(r) + r.rec_len - sizeof(tdb_off_t), &size) == -1) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed ofs_read h=%d rec_ptr=%u count=%u\n", - h, rec_ptr, count)); - return -1; - } - if (size != r.rec_len + sizeof(r)) { - TDB_LOG((tdb, TDB_DEBUG_FATAL, "tdb_validate: failed size check size=%u h=%d rec_ptr=%u count=%u\n", - size, h, rec_ptr, count)); - return -1; - } - rec_ptr = r.next; - count++; - } - } - return 0; -} - - diff --git a/source4/lib/tdb/common/tdb_private.h b/source4/lib/tdb/common/tdb_private.h index 0d3f10582e..ffac89ff0e 100644 --- a/source4/lib/tdb/common/tdb_private.h +++ b/source4/lib/tdb/common/tdb_private.h @@ -177,6 +177,7 @@ struct tdb_context { int tdb_munmap(struct tdb_context *tdb); void tdb_mmap(struct tdb_context *tdb); int tdb_lock(struct tdb_context *tdb, int list, int ltype); +int tdb_lock_nonblock(struct tdb_context *tdb, int list, int ltype); int tdb_unlock(struct tdb_context *tdb, int list, int ltype); int tdb_brlock(struct tdb_context *tdb, tdb_off_t offset, int rw_type, int lck_type, int probe, size_t len); int tdb_transaction_lock(struct tdb_context *tdb, int ltype); diff --git a/source4/lib/tdb/common/transaction.c b/source4/lib/tdb/common/transaction.c index ea0e3a93f3..c3e7a4e2c0 100644 --- a/source4/lib/tdb/common/transaction.c +++ b/source4/lib/tdb/common/transaction.c @@ -219,9 +219,12 @@ static int transaction_write(struct tdb_context *tdb, tdb_off_t off, uint8_t **new_blocks; /* expand the blocks array */ if (tdb->transaction->blocks == NULL) { - new_blocks = malloc((blk+1)*sizeof(uint8_t *)); + new_blocks = (uint8_t **)malloc( + (blk+1)*sizeof(uint8_t *)); } else { - new_blocks = realloc(tdb->transaction->blocks, (blk+1)*sizeof(uint8_t *)); + new_blocks = (uint8_t **)realloc( + tdb->transaction->blocks, + (blk+1)*sizeof(uint8_t *)); } if (new_blocks == NULL) { tdb->ecode = TDB_ERR_OOM; diff --git a/source4/lib/tdb/common/traverse.c b/source4/lib/tdb/common/traverse.c index 2bde1270a0..07b0c23858 100644 --- a/source4/lib/tdb/common/traverse.c +++ b/source4/lib/tdb/common/traverse.c @@ -223,6 +223,9 @@ int tdb_traverse_read(struct tdb_context *tdb, /* a write style traverse - needs to get the transaction lock to prevent deadlocks + + WARNING: The data buffer given to the callback fn does NOT meet the + alignment restrictions malloc gives you. */ int tdb_traverse(struct tdb_context *tdb, tdb_traverse_func fn, void *private_data) diff --git a/source4/lib/tdb/docs/README b/source4/lib/tdb/docs/README index b31ce36ab1..63fcf5e049 100644 --- a/source4/lib/tdb/docs/README +++ b/source4/lib/tdb/docs/README @@ -130,6 +130,9 @@ int tdb_traverse(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, a non-zero return value from fn() indicates that the traversal should stop. Traversal callbacks may not start transactions. + WARNING: The data buffer given to the callback fn does NOT meet the + alignment restrictions malloc gives you. + ---------------------------------------------------------------------- int tdb_traverse_read(TDB_CONTEXT *tdb, int (*fn)(TDB_CONTEXT *tdb, TDB_DATA key, TDB_DATA dbuf, void *state), void *state); diff --git a/source4/lib/tdb/include/tdb.h b/source4/lib/tdb/include/tdb.h index 0058d55793..0008085de5 100644 --- a/source4/lib/tdb/include/tdb.h +++ b/source4/lib/tdb/include/tdb.h @@ -32,9 +32,9 @@ extern "C" { /* flags to tdb_store() */ -#define TDB_REPLACE 1 -#define TDB_INSERT 2 -#define TDB_MODIFY 3 +#define TDB_REPLACE 1 /* Unused */ +#define TDB_INSERT 2 /* Don't overwrite an existing entry */ +#define TDB_MODIFY 3 /* Don't create an existing entry */ /* flags for tdb_open() */ #define TDB_DEFAULT 0 /* just a readability place holder */ @@ -157,7 +157,6 @@ int tdb_printfreelist(struct tdb_context *tdb); int tdb_validate_freelist(struct tdb_context *tdb, int *pnum_entries); int tdb_wipe_all(struct tdb_context *tdb); int tdb_freelist_size(struct tdb_context *tdb); -int tdb_validate(struct tdb_context *tdb); extern TDB_DATA tdb_null; diff --git a/source4/lib/tdb/tools/tdbtool.c b/source4/lib/tdb/tools/tdbtool.c index 79435a3571..d104ccd7c4 100644 --- a/source4/lib/tdb/tools/tdbtool.c +++ b/source4/lib/tdb/tools/tdbtool.c @@ -135,7 +135,7 @@ static void print_data(const char *buf,int len) if (len<=0) return; printf("[%03X] ",i); for (i=0;i Date: Fri, 18 Jan 2008 16:56:41 +1100 Subject: Add showInAdvancedViewOnly to every new object Unless already set, the default value for this comes from the defaultHidingValue in the schema. Andrew Bartlett (This used to be commit 673f1805006f879fa5302aab8411767a22488e64) --- source4/dsdb/samdb/ldb_modules/objectclass.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index d3beedc689..871c38476b 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -532,6 +532,10 @@ static int objectclass_do_add(struct ldb_handle *h) ldb_msg_add_string(msg, "objectCategory", current->objectclass->defaultObjectCategory); } + if (!ldb_msg_find_element(msg, "showInAdvancedViewOnly")) { + ldb_msg_add_string(msg, "showInAdvancedViewOnly", + current->objectclass->defaultHidingValue ? "TRUE" : "FALSE"); + } if (!ldb_msg_find_element(msg, "nTSecurityDescriptor")) { DATA_BLOB *sd = get_sd(ac->module, mem_ctx, current->objectclass); ldb_msg_add_steal_value(msg, "nTSecurityDescriptor", sd); -- cgit From 53c1cdd11ad56723cd7bada2df0cc2faa88227df Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 17:08:34 +1100 Subject: Don't set 'name' in the LDIF, this is handled by the rdn_name module. Andrew Bartlett (This used to be commit e9003feb1b9eb3d5b82e82910b63306e5ecc2908) --- source4/setup/display_specifiers.ldif | 7 ------- 1 file changed, 7 deletions(-) diff --git a/source4/setup/display_specifiers.ldif b/source4/setup/display_specifiers.ldif index 574912b3e8..b06d89778c 100644 --- a/source4/setup/display_specifiers.ldif +++ b/source4/setup/display_specifiers.ldif @@ -7,14 +7,12 @@ dn: CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: container cn: 409 -name: 409 showInAdvancedViewOnly: TRUE dn: CN=user-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: user-Display -name: user-Display contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103} adminPropertyPages: 9,{FA3E1D55-16DF-446d-872E-BD04D4F39C93} adminPropertyPages: 8,{0910dd01-df8c-11d1-ae27-00c04fa35813} @@ -33,7 +31,6 @@ dn: CN=group-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: group-Display -name: group-Display contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103} adminPropertyPages: 4,{4E40F770-369C-11d0-8922-00A024AB2DBB} adminPropertyPages: 3,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6} @@ -61,7 +58,6 @@ dn: CN=computer-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: computer-Display -name: computer-Display contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103} adminPropertyPages: 10,{0F65B1BF-740F-11d1-BBE6-0060081692B3} adminPropertyPages: 7,{B52C1E50-1DD2-11D1-BC43-00C04FC31FD3} @@ -79,7 +75,6 @@ dn: CN=organizationalUnit-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: organizationalUnit-Display -name: organizationalUnit-Display contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103} adminPropertyPages: 6,{FA3E1D55-16DF-446d-872E-BD04D4F39C93} adminPropertyPages: 5,{4E40F770-369C-11d0-8922-00A024AB2DBB} @@ -95,7 +90,6 @@ dn: CN=container-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: container-Display -name: container-Display contextMenu: 0,{62AE1F9A-126A-11D0-A14B-0800361B1103} adminPropertyPages: 3,{4E40F770-369C-11d0-8922-00A024AB2DBB} adminPropertyPages: 2,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6} @@ -110,7 +104,6 @@ dn: CN=default-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: displaySpecifier cn: default-Display -name: default-Display adminPropertyPages: 3,{4E40F770-369C-11d0-8922-00A024AB2DBB} adminPropertyPages: 2,{6dfe6488-a212-11d0-bcd5-00c04fd8d5b6} adminPropertyPages: 1,{6384e23e-736d-11d1-bd0d-00c04fd8d5b6} -- cgit From 7e2ea67b2118d31d11ed668d081568f7ef2243ae Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 18:08:49 +1100 Subject: Only set showOnlyInAdvancedView: TRUE when adding default values. False is the default, so only set this when the schema requires the hiding behaviour. Andrew Bartlett (This used to be commit 45f6ccefda39e8f0a9820ba55b1924b7cfb12262) --- source4/dsdb/samdb/ldb_modules/objectclass.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/source4/dsdb/samdb/ldb_modules/objectclass.c b/source4/dsdb/samdb/ldb_modules/objectclass.c index 871c38476b..737475ca78 100644 --- a/source4/dsdb/samdb/ldb_modules/objectclass.c +++ b/source4/dsdb/samdb/ldb_modules/objectclass.c @@ -532,9 +532,9 @@ static int objectclass_do_add(struct ldb_handle *h) ldb_msg_add_string(msg, "objectCategory", current->objectclass->defaultObjectCategory); } - if (!ldb_msg_find_element(msg, "showInAdvancedViewOnly")) { + if (!ldb_msg_find_element(msg, "showInAdvancedViewOnly") && (current->objectclass->defaultHidingValue == true)) { ldb_msg_add_string(msg, "showInAdvancedViewOnly", - current->objectclass->defaultHidingValue ? "TRUE" : "FALSE"); + "TRUE"); } if (!ldb_msg_find_element(msg, "nTSecurityDescriptor")) { DATA_BLOB *sd = get_sd(ac->module, mem_ctx, current->objectclass); -- cgit From b39676089e8a4b0f2cca96c15ed21e054a78e8e2 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Fri, 18 Jan 2008 18:10:18 +1100 Subject: Remove default 'showInAdvancedViewOnly' values. This means we only show and set the values when they are not the values the schema and objectclass module would impose. Andrew Bartlett (This used to be commit c2f2e01357c1b087aa1261fb2cac8687426d5a78) --- source4/setup/display_specifiers.ldif | 2 -- source4/setup/provision.ldif | 11 +++------- source4/setup/provision_configuration.ldif | 12 ----------- .../provision_configuration_basedn_modify.ldif | 3 --- source4/setup/provision_schema_basedn_modify.ldif | 3 --- source4/setup/provision_self_join.ldif | 4 +--- source4/setup/provision_templates.ldif | 1 - source4/setup/provision_users.ldif | 25 ---------------------- 8 files changed, 4 insertions(+), 57 deletions(-) diff --git a/source4/setup/display_specifiers.ldif b/source4/setup/display_specifiers.ldif index b06d89778c..7d6633244d 100644 --- a/source4/setup/display_specifiers.ldif +++ b/source4/setup/display_specifiers.ldif @@ -1,13 +1,11 @@ dn: CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: container -showInAdvancedViewOnly: TRUE dn: CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top objectClass: container cn: 409 -showInAdvancedViewOnly: TRUE dn: CN=user-Display,CN=409,CN=DisplaySpecifiers,${CONFIGDN} objectClass: top diff --git a/source4/setup/provision.ldif b/source4/setup/provision.ldif index 5e15bf347a..3fb9361d0b 100644 --- a/source4/setup/provision.ldif +++ b/source4/setup/provision.ldif @@ -3,25 +3,24 @@ objectClass: top objectClass: organizationalUnit cn: Domain Controllers description: Default container for domain controllers -showInAdvancedViewOnly: FALSE systemFlags: 2348810240 isCriticalSystemObject: TRUE +showInAdvancedViewOnly: FALSE dn: CN=ForeignSecurityPrincipals,${DOMAINDN} objectClass: top objectClass: container cn: ForeignSecurityPrincipals description: Default container for security identifiers (SIDs) associated with objects from external, trusted domains -showInAdvancedViewOnly: FALSE systemFlags: 2348810240 isCriticalSystemObject: TRUE +showInAdvancedViewOnly: FALSE dn: CN=System,${DOMAINDN} objectClass: top objectClass: container cn: System description: Builtin system settings -showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE @@ -29,7 +28,6 @@ dn: CN=RID Manager$,CN=System,${DOMAINDN} objectclass: top objectclass: rIDManager cn: RID Manager$ -showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} @@ -39,20 +37,17 @@ dn: CN=DomainUpdates,CN=System,${DOMAINDN} objectClass: top objectClass: container cn: DomainUpdates -showInAdvancedViewOnly: TRUE dn: CN=Windows2003Update,CN=DomainUpdates,CN=System,${DOMAINDN} objectClass: top objectClass: container cn: Windows2003Update -showInAdvancedViewOnly: TRUE revision: 8 dn: CN=Infrastructure,${DOMAINDN} objectclass: top objectclass: infrastructureUpdate cn: Infrastructure -showInAdvancedViewOnly: TRUE systemFlags: 2348810240 isCriticalSystemObject: TRUE fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} @@ -61,7 +56,6 @@ dn: CN=Builtin,${DOMAINDN} objectClass: top objectClass: builtinDomain cn: Builtin -showInAdvancedViewOnly: FALSE forceLogoff: 9223372036854775808 lockoutDuration: -18000000000 lockOutObservationWindow: -18000000000 @@ -78,6 +72,7 @@ serverState: 1 uASCompat: 1 modifiedCount: 1 isCriticalSystemObject: TRUE +showInAdvancedViewOnly: FALSE dn: CN=Policies,CN=System,${DOMAINDN} objectClass: top diff --git a/source4/setup/provision_configuration.ldif b/source4/setup/provision_configuration.ldif index 750fa1326a..0fe90b0739 100644 --- a/source4/setup/provision_configuration.ldif +++ b/source4/setup/provision_configuration.ldif @@ -5,7 +5,6 @@ dn: CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRefContainer cn: Partitions -showInAdvancedViewOnly: TRUE systemFlags: 2147483648 msDS-Behavior-Version: 0 fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} @@ -14,7 +13,6 @@ dn: CN=Enterprise Configuration,CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: Enterprise Configuration -showInAdvancedViewOnly: TRUE systemFlags: 1 nCName: ${CONFIGDN} dnsRoot: ${DNSDOMAIN} @@ -23,7 +21,6 @@ dn: CN=Enterprise Schema,CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: Enterprise Schema -showInAdvancedViewOnly: TRUE systemFlags: 1 nCName: ${SCHEMADN} dnsRoot: ${DNSDOMAIN} @@ -32,7 +29,6 @@ dn: CN=${DOMAIN},CN=Partitions,${CONFIGDN} objectClass: top objectClass: crossRef cn: ${DOMAIN} -showInAdvancedViewOnly: TRUE systemFlags: 3 nCName: ${DOMAINDN} nETBIOSName: ${DOMAIN} @@ -42,54 +38,46 @@ dn: CN=Sites,${CONFIGDN} objectClass: top objectClass: sitesContainer cn: Sites -showInAdvancedViewOnly: TRUE systemFlags: 2181038080 dn: CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: site cn: ${DEFAULTSITE} -showInAdvancedViewOnly: TRUE systemFlags: 2181038080 dn: CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: serversContainer cn: Servers -showInAdvancedViewOnly: TRUE systemFlags: 2181038080 dn: CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Services -showInAdvancedViewOnly: TRUE systemFlags: 2147483648 dn: CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Windows NT -showInAdvancedViewOnly: TRUE dn: CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: nTDSService cn: Directory Service -showInAdvancedViewOnly: TRUE sPNMappings: host=ldap,dns,cifs,http dn: CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: container cn: Query-Policies -showInAdvancedViewOnly: TRUE dn: CN=Default Query Policy,CN=Query-Policies,CN=Directory Service,CN=Windows NT,CN=Services,${CONFIGDN} objectClass: top objectClass: queryPolicy cn: Default Query Policy -showInAdvancedViewOnly: TRUE lDAPAdminLimits: MaxValRange=1500 lDAPAdminLimits: MaxReceiveBuffer=10485760 lDAPAdminLimits: MaxDatagramRecv=4096 diff --git a/source4/setup/provision_configuration_basedn_modify.ldif b/source4/setup/provision_configuration_basedn_modify.ldif index a72f2c8eca..9b87e1cead 100644 --- a/source4/setup/provision_configuration_basedn_modify.ldif +++ b/source4/setup/provision_configuration_basedn_modify.ldif @@ -3,8 +3,5 @@ ############################### dn: ${CONFIGDN} changetype: modify -replace: showInAdvancedViewOnly -showInAdvancedViewOnly: TRUE -- replace: subRefs subRefs: ${SCHEMADN} diff --git a/source4/setup/provision_schema_basedn_modify.ldif b/source4/setup/provision_schema_basedn_modify.ldif index 986f0d632c..4e690376d7 100644 --- a/source4/setup/provision_schema_basedn_modify.ldif +++ b/source4/setup/provision_schema_basedn_modify.ldif @@ -3,9 +3,6 @@ ############################### dn: ${SCHEMADN} changetype: modify -replace: showInAdvancedViewOnly -showInAdvancedViewOnly: TRUE -- replace: fSMORoleOwner fSMORoleOwner: CN=NTDS Settings,CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} - diff --git a/source4/setup/provision_self_join.ldif b/source4/setup/provision_self_join.ldif index 1caa62163e..58669660f4 100644 --- a/source4/setup/provision_self_join.ldif +++ b/source4/setup/provision_self_join.ldif @@ -30,7 +30,6 @@ objectClass: organizationalPerson objectClass: user cn: dns description: DNS Service Account -showInAdvancedViewOnly: TRUE userAccountControl: 514 accountExpires: 9223372036854775807 sAMAccountName: dns @@ -38,12 +37,12 @@ sAMAccountType: 805306368 servicePrincipalName: DNS/${DNSDOMAIN} isCriticalSystemObject: TRUE sambaPassword:: ${DNSPASS_B64} +showInAdvancedViewOnly: TRUE dn: CN=${NETBIOSNAME},CN=Servers,CN=${DEFAULTSITE},CN=Sites,${CONFIGDN} objectClass: top objectClass: server cn: ${NETBIOSNAME} -showInAdvancedViewOnly: TRUE systemFlags: 1375731712 dNSHostName: ${DNSNAME} serverReference: CN=${NETBIOSNAME},OU=Domain Controllers,${DOMAINDN} @@ -54,7 +53,6 @@ objectClass: applicationSettings objectClass: nTDSDSA cn: NTDS Settings options: 1 -showInAdvancedViewOnly: TRUE systemFlags: 33554432 dMDLocation: ${SCHEMADN} invocationId: ${INVOCATIONID} diff --git a/source4/setup/provision_templates.ldif b/source4/setup/provision_templates.ldif index 04eaabcab7..fafedc6966 100644 --- a/source4/setup/provision_templates.ldif +++ b/source4/setup/provision_templates.ldif @@ -70,7 +70,6 @@ sAMAccountType: 268435456 # sAMAccountType: 268435456 dn: CN=TemplateForeignSecurityPrincipal,CN=Templates -showInAdvancedViewOnly: TRUE dn: CN=TemplateSecret,CN=Templates diff --git a/source4/setup/provision_users.ldif b/source4/setup/provision_users.ldif index 3e6f717f15..05fde15974 100644 --- a/source4/setup/provision_users.ldif +++ b/source4/setup/provision_users.ldif @@ -401,173 +401,148 @@ objectClass: top objectClass: container cn: WellKnown Security Principals systemFlags: 2147483648 -showInAdvancedViewOnly: TRUE dn: CN=Anonymous Logon,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Anonymous Logon objectSid: S-1-5-7 -showInAdvancedViewOnly: TRUE dn: CN=Authenticated Users,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Authenticated Users objectSid: S-1-5-11 -showInAdvancedViewOnly: TRUE dn: CN=Batch,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Batch objectSid: S-1-5-3 -showInAdvancedViewOnly: TRUE dn: CN=Creator Group,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Creator Group objectSid: S-1-3-1 -showInAdvancedViewOnly: TRUE dn: CN=Creator Owner,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Creator Owner objectSid: S-1-3-0 -showInAdvancedViewOnly: TRUE dn: CN=Dialup,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Dialup objectSid: S-1-5-1 -showInAdvancedViewOnly: TRUE dn: CN=Digest Authentication,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Digest Authentication objectSid: S-1-5-64-21 -showInAdvancedViewOnly: TRUE dn: CN=Enterprise Domain Controllers,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Enterprise Domain Controllers objectSid: S-1-5-9 -showInAdvancedViewOnly: TRUE dn: CN=Everyone,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Everyone objectSid: S-1-1-0 -showInAdvancedViewOnly: TRUE dn: CN=Interactive,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Interactive objectSid: S-1-5-4 -showInAdvancedViewOnly: TRUE dn: CN=Local Service,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Local Service objectSid: S-1-5-19 -showInAdvancedViewOnly: TRUE dn: CN=Network,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Network objectSid: S-1-5-2 -showInAdvancedViewOnly: TRUE dn: CN=Network Service,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Network Service objectSid: S-1-5-20 -showInAdvancedViewOnly: TRUE dn: CN=NTLM Authentication,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: NTLM Authentication objectSid: S-1-5-64-10 -showInAdvancedViewOnly: TRUE dn: CN=Other Organization,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Other Organization objectSid: S-1-5-1000 -showInAdvancedViewOnly: TRUE dn: CN=Proxy,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Proxy objectSid: S-1-5-8 -showInAdvancedViewOnly: TRUE dn: CN=Remote Interactive Logon,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Remote Interactive Logon objectSid: S-1-5-14 -showInAdvancedViewOnly: TRUE dn: CN=Restricted,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Restricted objectSid: S-1-5-12 -showInAdvancedViewOnly: TRUE dn: CN=SChannel Authentication,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: SChannel Authentication objectSid: S-1-5-64-14 -showInAdvancedViewOnly: TRUE dn: CN=Self,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Self objectSid: S-1-5-10 -showInAdvancedViewOnly: TRUE dn: CN=Service,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Service objectSid: S-1-5-6 -showInAdvancedViewOnly: TRUE dn: CN=Terminal Server User,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Terminal Server User objectSid: S-1-5-13 -showInAdvancedViewOnly: TRUE dn: CN=This Organization,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: This Organization objectSid: S-1-5-15 -showInAdvancedViewOnly: TRUE dn: CN=Well-Known-Security-Id-System,CN=WellKnown Security Principals,${CONFIGDN} objectClass: top objectClass: foreignSecurityPrincipal cn: Well-Known-Security-Id-System objectSid: S-1-5-18 -showInAdvancedViewOnly: TRUE -- cgit From 2cf35f206817bfcc77a3f258fe220aac2b6f19a8 Mon Sep 17 00:00:00 2001 From: Julien Kerihuel Date: Fri, 18 Jan 2008 18:30:00 +0100 Subject: pidl: Add --version argument. (This used to be commit ed1e58e8b35bc971451f4e0a357daa903cd7820d) --- source4/pidl/lib/Parse/Pidl.pm | 2 +- source4/pidl/pidl | 25 +++++++++++++++++++++++-- 2 files changed, 24 insertions(+), 3 deletions(-) diff --git a/source4/pidl/lib/Parse/Pidl.pm b/source4/pidl/lib/Parse/Pidl.pm index 0c6e0e5727..c2c9463d03 100644 --- a/source4/pidl/lib/Parse/Pidl.pm +++ b/source4/pidl/lib/Parse/Pidl.pm @@ -9,7 +9,7 @@ package Parse::Pidl; require Exporter; @ISA = qw(Exporter); -@EXPORT_OK = qw(warning error fatal); +@EXPORT_OK = qw(warning error fatal $VERSION); use strict; diff --git a/source4/pidl/pidl b/source4/pidl/pidl index 4dfd57dc20..220d62cd71 100755 --- a/source4/pidl/pidl +++ b/source4/pidl/pidl @@ -52,6 +52,10 @@ both marshalling/unmarshalling and debugging purposes). =item I<--help> Show list of available options. + +=item I<--version> + +Show pidl version =item I<--outputdir OUTNAME> @@ -403,7 +407,7 @@ use lib "$RealBin"; use lib "$RealBin/lib"; use Getopt::Long; use File::Basename; -use Parse::Pidl; +use Parse::Pidl qw ( $VERSION ); use Parse::Pidl::Util; ##################################################################### @@ -453,6 +457,7 @@ sub FileSave($$) my(@opt_incdirs) = (); my($opt_help) = 0; +my($opt_version) = 0; my($opt_parse_idl_tree) = 0; my($opt_dump_idl_tree); my($opt_dump_ndr_tree); @@ -483,7 +488,9 @@ my($opt_warn_compat) = 0; # display help text sub ShowHelp() { -print "perl IDL parser and code generator +print "perl IDL parser and code generator\n"; +ShowVersion(); +print" Copyright (C) Andrew Tridgell Copyright (C) Jelmer Vernooij @@ -491,6 +498,7 @@ Usage: $Script [options] [--] [...] Generic Options: --help this help page + --version show pidl version --outputdir=OUTDIR put output in OUTDIR/ [.] --warn-compat warn about incompatibility with other compilers --quiet be quiet @@ -528,9 +536,17 @@ Wireshark parsers: exit(0); } +######################################### +# Display version +sub ShowVersion() +{ + print "perl IDL version $VERSION\n"; +} + # main program my $result = GetOptions ( 'help|h|?' => \$opt_help, + 'version' => \$opt_version, 'outputdir=s' => \$opt_outputdir, 'dump-idl' => \$opt_dump_idl, 'dump-idl-tree:s' => \$opt_dump_idl_tree, @@ -565,6 +581,11 @@ if ($opt_help) { exit(0); } +if ($opt_version) { + ShowVersion(); + exit(0); +} + sub process_file($) { my $idl_file = shift; -- cgit From ad5861a795106f544f31d292ab1360e35bc79932 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sat, 19 Jan 2008 21:16:56 +0100 Subject: howto: Update instructions for git, and use ReST formatting. (This used to be commit 8deaaa52d305e799d04fc879c25ccbf82f01287e) --- howto.txt | 59 +++++++++++++++++++++++++++++++++-------------------------- 1 file changed, 33 insertions(+), 26 deletions(-) diff --git a/howto.txt b/howto.txt index 7b10b5960a..654ad658c8 100644 --- a/howto.txt +++ b/howto.txt @@ -1,9 +1,8 @@ Samba4 developer howto ----------------------- +====================== tridge@samba.org, December 2004 - A more up to date version of this howto can be found in the wiki at http://wiki.samba.org/index.php/Samba4/HOWTO. @@ -12,31 +11,32 @@ server. This is aimed at developers who are already familiar with Samba3 and wish to participate in Samba4 development. This is not aimed at production use of Samba4. +.. contents:: Step 1: download Samba4 ----------------------- There are 2 methods of doing this: - method 1: "rsync -avz samba.org::ftp/unpacked/samba4 ." + method 1: "rsync -avz samba.org::ftp/unpacked/samba_4_0_test/ samba4" - method 2: "svn co svn://svnanon.samba.org/samba/branches/SAMBA_4_0 samba4" + method 2: "git clone git://git.samba.org/samba.git samba4; cd samba4; git checkout v4-0-test; cd .." both methods will create a directory called "samba4" in the current -directory. If you don't have rsync or svn then install one of them. +directory. If you don't have rsync or git then install one of them. Since only released versions of Samba contain a pregenerated configure script, -you will have to generate it by hand: +you will have to generate it by hand:: $ cd samba4/source $ ./autogen.sh -Note that the above rsync command will give you a checked out svn -repository. So if you also have svn you can update it to the latest -version at some future date using: +Note that the above rsync command will give you a checked out git +repository. So if you also have git you can update it to the latest +version at some future date using:: $ cd samba4 - $ svn up + $ git pull origin v4-0-test Step 2: compile Samba4 ---------------------- @@ -46,7 +46,7 @@ Recommended optional development libraries: - gnutls - readline -Run this: +Run this:: $ cd samba4/source $ ./configure @@ -61,6 +61,8 @@ Step 3: install Samba4 Run this as a user who have permission to write to the install directory (defaults to /usr/local/samba). Use --prefix option to configure above to change this. + +:: # make install @@ -73,6 +75,8 @@ binary is installed in a directory listed in your PATH environment variable. It is presumed it's available just like any other commands from your shell. Must be run as a user with permission to write to the install directory. +:: + # cd source # ./setup/provision --realm=YOUR.REALM --domain=YOURDOM \ # --adminpass=SOMEPASSWORD --server-role='domain controller' @@ -89,7 +93,7 @@ Step 5: Create a simple smb.conf The provisioning will create a very simple smb.conf with no shares by default. You will need to update it to add at least one share. For -example: +example:: [test] path = /data/test @@ -100,7 +104,7 @@ Step 6: starting Samba4 ----------------------- The simplest is to just run "smbd", but as a developer you may find -the following more useful: +the following more useful:: # smbd -i -M single @@ -119,11 +123,13 @@ in your $PATH. Make sure you run the right version! Step 7: testing Samba4 ---------------------- -try these commands: +try these commands:: - $ smbclient //localhost/test -Uadministrator%SOMEPASSWORD - or - $ ./script/tests/test_posix.sh //localhost/test administrator SOMEPASSWORD + $ smbclient //localhost/test -Uadministrator%SOMEPASSWORD + +or:: + + $ ./script/tests/test_posix.sh //localhost/test administrator SOMEPASSWORD NOTE about filesystem support @@ -133,23 +139,23 @@ To use the advanced features of Samba4 you need a filesystem that supports both the "user" and "system" xattr namespaces. If you run Linux with a 2.6 kernel and ext3 this means you need to -include the option "user_xattr" in your /etc/fstab. For example: +include the option "user_xattr" in your /etc/fstab. For example:: -/dev/hda3 /home ext3 user_xattr 1 1 + /dev/hda3 /home ext3 user_xattr 1 1 You also need to compile your kernel with the XATTR and SECURITY -options for your filesystem. For ext3 that means you need: +options for your filesystem. For ext3 that means you need:: CONFIG_EXT3_FS_XATTR=y CONFIG_EXT3_FS_SECURITY=y If you are running a Linux 2.6 kernel with CONFIG_IKCONFIG_PROC -defined you can check this with the following command: +defined you can check this with the following command:: $ zgrep CONFIG_EXT3_FS /proc/config.gz If you don't have a filesystem with xattr support, then you can -simulate it by using the option: +simulate it by using the option:: posix:eadb = /usr/local/samba/eadb.tdb @@ -161,7 +167,7 @@ Testing your filesystem ----------------------- To test your filesystem support, install the 'attr' package and run -the following 4 commands as root: +the following 4 commands as root:: # touch test.txt # setfattr -n user.test -v test test.txt @@ -169,11 +175,11 @@ the following 4 commands as root: # getfattr -d test.txt # getfattr -n security.test -d test.txt -You should see output like this: +You should see output like this:: # file: test.txt user.test="test" - + # file: test.txt security.test="test2" @@ -184,4 +190,5 @@ with the right options. If you get any "Operation not permitted" errors then it probably means you didn't try the test as root. - +.. + vim: ft=rest -- cgit From b487ecdfad4518936cc542379b7f0102b38b3c62 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 01:19:59 +0100 Subject: build: Fix handling of external pkg-config dependencies when generating pkg-config files. (This used to be commit 88f9e11286bf0f12fc766dbf21f311e5373f0811) --- source4/build/m4/public.m4 | 11 +++++++---- source4/build/smb_build/config_mk.pm | 3 +++ source4/build/smb_build/makefile.pm | 15 ++++++--------- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/source4/build/m4/public.m4 b/source4/build/m4/public.m4 index 9e82e6aaf1..6d693eaeee 100644 --- a/source4/build/m4/public.m4 +++ b/source4/build/m4/public.m4 @@ -8,7 +8,7 @@ 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) +dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname) dnl dnl SMB_ENABLE(name,default_build) dnl @@ -34,7 +34,7 @@ ENABLE = YES " ]) -dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags) +dnl SMB_LIBRARY(name,description,obj_files,required_subsystems,version,so_version,cflags,ldflags,pcname) AC_DEFUN([SMB_LIBRARY], [ SMB_INFO_LIBRARIES="$SMB_INFO_LIBRARIES @@ -48,6 +48,7 @@ VERSION = $5 SO_VERSION = $6 CFLAGS = $7 LDFLAGS = $8 +PC_NAME = $9 ENABLE = YES # End Library $1 ################################### @@ -93,7 +94,8 @@ AC_DEFUN([SMB_EXT_LIB_FROM_PKGCONFIG], [`$PKG_CONFIG --libs-only-l '$2'`], [`$PKG_CONFIG --cflags-only-other '$2'`], [`$PKG_CONFIG --cflags-only-I '$2'`], - [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`]) + [`$PKG_CONFIG --libs-only-other '$2'` `$PKG_CONFIG --libs-only-L '$2'`], + [ $2 ]) ac_cv_$1_found=yes else @@ -125,7 +127,7 @@ include $1 " ]) -dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags) +dnl SMB_EXT_LIB(name,libs,cflags,cppflags,ldflags,pcname) AC_DEFUN([SMB_EXT_LIB], [ @@ -137,6 +139,7 @@ LIBS = $2 CFLAGS = $3 CPPFLAGS = $4 LDFLAGS = $5 +PC_NAME = $6 # End Ext Lib $1 ################################### " diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 7ad6600a8c..2365ca19b2 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -18,6 +18,7 @@ my $section_types = { "CFLAGS" => "list", "CPPFLAGS" => "list", "LDFLAGS" => "list", + "PC_NAME" => "string", }, "PYTHON" => { SWIG_FILE => "string", @@ -87,6 +88,8 @@ my $section_types = { "VERSION" => "string", "SO_VERSION" => "string", "LIBRARY_REALNAME" => "string", + + "PC_NAME" => "string", "INIT_FUNCTION_TYPE" => "string", "INIT_FUNCTION_SENTINEL" => "string", diff --git a/source4/build/smb_build/makefile.pm b/source4/build/smb_build/makefile.pm index ce1e757c61..7e715b47eb 100644 --- a/source4/build/smb_build/makefile.pm +++ b/source4/build/smb_build/makefile.pm @@ -570,24 +570,21 @@ sub PkgConfig($$$) my $pubs; my $privs; my $privlibs; + my $publibs = ""; if (defined($ctx->{PUBLIC_DEPENDENCIES})) { foreach (@{$ctx->{PUBLIC_DEPENDENCIES}}) { next if ($other->{$_}->{ENABLE} eq "NO"); - if ($other->{$_}->{TYPE} eq "EXT_LIB") { + if (defined($other->{$_}->{PC_NAME})) { + $pubs .= "$other->{$_}->{PC_NAME} "; + } elsif ($other->{$_}->{TYPE} eq "EXT_LIB") { my $e = $other->{$_}; - my $ldflags = join(" ", @{$e->{LDFLAGS}}); $ldflags .= " " unless $ldflags eq ""; my $libs = join(" ", @{$e->{LIBS}}); $libs .= " " unless $libs eq ""; - $pubs .= $ldflags.$libs; - } elsif ($other->{$_}->{TYPE} eq "LIBRARY") { - s/^LIB//g; - $_ = lc($_); - - $pubs .= "$_ "; + $publibs .= $ldflags.$libs; } else { s/^LIB//g; $_ = lc($_); @@ -626,7 +623,7 @@ sub PkgConfig($$$) smb_build::env::PkgConfig($self, $path, $link_name, - "-L\${libdir} -l$link_name", + "-L\${libdir} -l$link_name $publibs", $privlibs, "", "$ctx->{VERSION}", -- cgit From 66871f9950f1998c97f97c9a095953c66ab4ab64 Mon Sep 17 00:00:00 2001 From: Volker Lendecke Date: Sun, 20 Jan 2008 15:51:02 +0100 Subject: Add an exception for S3 Doing this correctly would involve a create_file call for qpathinfo (This used to be commit da9a5b571ea87b2e08c74463d3fae58a9eb0828a) --- source4/torture/raw/streams.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/source4/torture/raw/streams.c b/source4/torture/raw/streams.c index bbc0bcae82..ca6b488af5 100644 --- a/source4/torture/raw/streams.c +++ b/source4/torture/raw/streams.c @@ -490,9 +490,16 @@ static bool test_stream_delete(struct torture_context *tctx, status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); CHECK_STATUS(status, NT_STATUS_DELETE_PENDING); - finfo.generic.in.file.path = sname1; - status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); - CHECK_STATUS(status, NT_STATUS_DELETE_PENDING); + if (!torture_setting_bool(tctx, "samba3", false)) { + + /* + * S3 doesn't do this yet + */ + + finfo.generic.in.file.path = sname1; + status = smb_raw_pathinfo(cli->tree, mem_ctx, &finfo); + CHECK_STATUS(status, NT_STATUS_DELETE_PENDING); + } /* * fd-based qfileinfo on the stream still works, the stream does not -- cgit From 078acef0471528685272b7b7ef582c7c32f5ef1c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 16:10:14 +0100 Subject: build: Allow overriding CFLAGS for python packages. (This used to be commit 2c2b16b5aeef83a3adce1859e1fbfd9c4f6ffdd5) --- source4/build/smb_build/config_mk.pm | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/build/smb_build/config_mk.pm b/source4/build/smb_build/config_mk.pm index 2365ca19b2..d07660ba1d 100644 --- a/source4/build/smb_build/config_mk.pm +++ b/source4/build/smb_build/config_mk.pm @@ -27,6 +27,7 @@ my $section_types = { "OBJ_FILES" => "list", "ENABLE" => "bool", "LDFLAGS" => "list", + "CFLAGS" => "list", }, "SUBSYSTEM" => { "OBJ_FILES" => "list", -- cgit From 203d2b10bd5c3ae89f098adba91a5e751a9627af Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 16:10:43 +0100 Subject: ldb: Fix building python modules against system-provided ldb. (This used to be commit 583ea85ae04c0bc2e70ab2e595e05f76f65c3be1) --- source4/lib/ldb/python.mk | 1 + 1 file changed, 1 insertion(+) diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index f81c2e3e16..24ade8f977 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -2,6 +2,7 @@ # Start LIBRARY swig_ldb [PYTHON::swig_ldb] PUBLIC_DEPENDENCIES = LIBLDB +CFLAGS = -Ilib/ldb/include SWIG_FILE = ldb.i # End LIBRARY swig_ldb ####################### -- cgit From b126f1ca4d71b6801032478d8c56453593b27825 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 16:24:11 +0100 Subject: python: Reenable modules for libcli_nbt and libcli_smb. (This used to be commit 4fa8a2789c7a2fa912645f08ca5a3be891d173dd) --- source4/libcli/config.mk | 27 +-- source4/libcli/swig/libcli_nbt.i | 1 + source4/libcli/swig/libcli_nbt.py | 117 ++++------- source4/libcli/swig/libcli_nbt_wrap.c | 375 ++++++++++++++++++---------------- source4/libcli/swig/libcli_smb.i | 3 +- source4/libcli/swig/libcli_smb.py | 11 +- source4/libcli/swig/libcli_smb_wrap.c | 229 +++++---------------- 7 files changed, 317 insertions(+), 446 deletions(-) diff --git a/source4/libcli/config.mk b/source4/libcli/config.mk index eb3c56cf7f..a538d607bb 100644 --- a/source4/libcli/config.mk +++ b/source4/libcli/config.mk @@ -50,17 +50,13 @@ OBJ_FILES = \ PUBLIC_DEPENDENCIES = LIBNDR NDR_NBT LIBCLI_COMPOSITE LIBEVENTS \ NDR_SECURITY samba-socket LIBSAMBA-UTIL -[LIBRARY::swig_libcli_nbt] -LIBRARY_REALNAME = swig/_libcli_nbt.$(SHLIBEXT) -OBJ_FILES = swig/libcli_nbt_wrap.o +[PYTHON::python_libcli_nbt] +SWIG_FILE = swig/libcli_nbt.i PUBLIC_DEPENDENCIES = LIBCLI_NBT DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO -[LIBRARY::swig_libcli_smb] -LIBRARY_REALNAME = swig/_libcli_smb.$(SHLIBEXT) -OBJ_FILES = swig/libcli_smb_wrap.o +[PYTHON::python_libcli_smb] +SWIG_FILE = swig/libcli_smb.i PUBLIC_DEPENDENCIES = LIBCLI_SMB DYNCONFIG LIBSAMBA-CONFIG -ENABLE = NO [SUBSYSTEM::LIBCLI_DGRAM] OBJ_FILES = \ @@ -71,20 +67,14 @@ OBJ_FILES = \ dgram/browse.o PUBLIC_DEPENDENCIES = LIBCLI_NBT LIBNDR LIBCLI_RESOLVE -[LIBRARY::LIBCLI_CLDAP] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = CLDAP client library +[SUBSYSTEM::LIBCLI_CLDAP] OBJ_FILES = cldap/cldap.o PUBLIC_HEADERS = cldap/cldap.h PUBLIC_DEPENDENCIES = LIBCLI_LDAP PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBLDB -[LIBRARY::LIBCLI_WREPL] +[SUBSYSTEM::LIBCLI_WREPL] PRIVATE_PROTO_HEADER = wrepl/winsrepl_proto.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = WINS Replication client library OBJ_FILES = \ wrepl/winsrepl.o PUBLIC_DEPENDENCIES = NDR_WINSREPL samba-socket LIBCLI_RESOLVE LIBEVENTS \ @@ -112,12 +102,9 @@ OBJ_FILES = \ finddcs.o PUBLIC_DEPENDENCIES = LIBCLI_NBT MESSAGING -[LIBRARY::LIBCLI_SMB] +[SUBSYSTEM::LIBCLI_SMB] PUBLIC_HEADERS = libcli.h PUBLIC_PROTO_HEADER = libcli_proto.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = SMB/CIFS client library OBJ_FILES = clireadwrite.o \ cliconnect.o \ clifile.o \ diff --git a/source4/libcli/swig/libcli_nbt.i b/source4/libcli/swig/libcli_nbt.i index 6fd85c2b8c..827230b113 100644 --- a/source4/libcli/swig/libcli_nbt.i +++ b/source4/libcli/swig/libcli_nbt.i @@ -31,6 +31,7 @@ #include "lib/talloc/talloc.h" #include "libcli/nbt/libnbt.h" #include "param/param.h" +#include "lib/events/events.h" /* Undo strcpy safety macro as it's used by swig )-: */ diff --git a/source4/libcli/swig/libcli_nbt.py b/source4/libcli/swig/libcli_nbt.py index 938ab382f6..b49e240bc2 100644 --- a/source4/libcli/swig/libcli_nbt.py +++ b/source4/libcli/swig/libcli_nbt.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _libcli_nbt import new @@ -48,6 +47,16 @@ except AttributeError: 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 nbt_name_socket_init = _libcli_nbt.nbt_name_socket_init NBT_NAME_CLIENT = _libcli_nbt.NBT_NAME_CLIENT @@ -58,106 +67,54 @@ NBT_NAME_PDC = _libcli_nbt.NBT_NAME_PDC NBT_NAME_LOGON = _libcli_nbt.NBT_NAME_LOGON NBT_NAME_MASTER = _libcli_nbt.NBT_NAME_MASTER NBT_NAME_BROWSER = _libcli_nbt.NBT_NAME_BROWSER -class nbt_name(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name, name) +class nbt_name(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set) - __swig_setmethods__["scope"] = _libcli_nbt.nbt_name_scope_set - __swig_getmethods__["scope"] = _libcli_nbt.nbt_name_scope_get - if _newclass:scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set) - __swig_setmethods__["type"] = _libcli_nbt.nbt_name_type_set - __swig_getmethods__["type"] = _libcli_nbt.nbt_name_type_get - if _newclass:type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set) + name = _swig_property(_libcli_nbt.nbt_name_name_get, _libcli_nbt.nbt_name_name_set) + scope = _swig_property(_libcli_nbt.nbt_name_scope_get, _libcli_nbt.nbt_name_scope_set) + type = _swig_property(_libcli_nbt.nbt_name_type_get, _libcli_nbt.nbt_name_type_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_swiginit(self,_libcli_nbt.new_nbt_name(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name - __del__ = lambda self : None; nbt_name_swigregister = _libcli_nbt.nbt_name_swigregister nbt_name_swigregister(nbt_name) -class nbt_name_query(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query, name) +class nbt_name_query(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_getmethods__["data_out"] = _libcli_nbt.nbt_name_query_data_out_get - if _newclass:data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get) - __swig_getmethods__["data_in"] = _libcli_nbt.nbt_name_query_data_in_get - if _newclass:data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get) + data_out = _swig_property(_libcli_nbt.nbt_name_query_data_out_get) + data_in = _swig_property(_libcli_nbt.nbt_name_query_data_in_get) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_swiginit(self,_libcli_nbt.new_nbt_name_query(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query - __del__ = lambda self : None; nbt_name_query_swigregister = _libcli_nbt.nbt_name_query_swigregister nbt_name_query_swigregister(nbt_name_query) -class nbt_name_query_out(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_out, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_out, name) +class nbt_name_query_out(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_set - __swig_getmethods__["reply_from"] = _libcli_nbt.nbt_name_query_out_reply_from_get - if _newclass:reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set) - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_out_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set) - __swig_setmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_set - __swig_getmethods__["num_addrs"] = _libcli_nbt.nbt_name_query_out_num_addrs_get - if _newclass:num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set) - __swig_setmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_set - __swig_getmethods__["reply_addrs"] = _libcli_nbt.nbt_name_query_out_reply_addrs_get - if _newclass:reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set) + reply_from = _swig_property(_libcli_nbt.nbt_name_query_out_reply_from_get, _libcli_nbt.nbt_name_query_out_reply_from_set) + name = _swig_property(_libcli_nbt.nbt_name_query_out_name_get, _libcli_nbt.nbt_name_query_out_name_set) + num_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_num_addrs_get, _libcli_nbt.nbt_name_query_out_num_addrs_set) + reply_addrs = _swig_property(_libcli_nbt.nbt_name_query_out_reply_addrs_get, _libcli_nbt.nbt_name_query_out_reply_addrs_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query_out(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_out_swiginit(self,_libcli_nbt.new_nbt_name_query_out(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query_out - __del__ = lambda self : None; nbt_name_query_out_swigregister = _libcli_nbt.nbt_name_query_out_swigregister nbt_name_query_out_swigregister(nbt_name_query_out) -class nbt_name_query_in(_object): - __swig_setmethods__ = {} - __setattr__ = lambda self, name, value: _swig_setattr(self, nbt_name_query_in, name, value) - __swig_getmethods__ = {} - __getattr__ = lambda self, name: _swig_getattr(self, nbt_name_query_in, name) +class nbt_name_query_in(object): + thisown = _swig_property(lambda x: x.this.own(), lambda x, v: x.this.own(v), doc='The membership flag') __repr__ = _swig_repr - __swig_setmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_set - __swig_getmethods__["name"] = _libcli_nbt.nbt_name_query_in_name_get - if _newclass:name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set) - __swig_setmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_set - __swig_getmethods__["dest_addr"] = _libcli_nbt.nbt_name_query_in_dest_addr_get - if _newclass:dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set) - __swig_setmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_set - __swig_getmethods__["broadcast"] = _libcli_nbt.nbt_name_query_in_broadcast_get - if _newclass:broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set) - __swig_setmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_set - __swig_getmethods__["wins_lookup"] = _libcli_nbt.nbt_name_query_in_wins_lookup_get - if _newclass:wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set) - __swig_setmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_set - __swig_getmethods__["timeout"] = _libcli_nbt.nbt_name_query_in_timeout_get - if _newclass:timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set) - __swig_setmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_set - __swig_getmethods__["retries"] = _libcli_nbt.nbt_name_query_in_retries_get - if _newclass:retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set) + name = _swig_property(_libcli_nbt.nbt_name_query_in_name_get, _libcli_nbt.nbt_name_query_in_name_set) + dest_addr = _swig_property(_libcli_nbt.nbt_name_query_in_dest_addr_get, _libcli_nbt.nbt_name_query_in_dest_addr_set) + broadcast = _swig_property(_libcli_nbt.nbt_name_query_in_broadcast_get, _libcli_nbt.nbt_name_query_in_broadcast_set) + wins_lookup = _swig_property(_libcli_nbt.nbt_name_query_in_wins_lookup_get, _libcli_nbt.nbt_name_query_in_wins_lookup_set) + timeout = _swig_property(_libcli_nbt.nbt_name_query_in_timeout_get, _libcli_nbt.nbt_name_query_in_timeout_set) + retries = _swig_property(_libcli_nbt.nbt_name_query_in_retries_get, _libcli_nbt.nbt_name_query_in_retries_set) def __init__(self, *args, **kwargs): - this = _libcli_nbt.new_nbt_name_query_in(*args, **kwargs) - try: self.this.append(this) - except: self.this = this + _libcli_nbt.nbt_name_query_in_swiginit(self,_libcli_nbt.new_nbt_name_query_in(*args, **kwargs)) __swig_destroy__ = _libcli_nbt.delete_nbt_name_query_in - __del__ = lambda self : None; nbt_name_query_in_swigregister = _libcli_nbt.nbt_name_query_in_swigregister nbt_name_query_in_swigregister(nbt_name_query_in) diff --git a/source4/libcli/swig/libcli_nbt_wrap.c b/source4/libcli/swig/libcli_nbt_wrap.c index 149e63884a..6c1b501359 100644 --- a/source4/libcli/swig/libcli_nbt_wrap.c +++ b/source4/libcli/swig/libcli_nbt_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2485,6 +2485,19 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; # 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):= _libcli_nbt.so @@ -2506,6 +2519,7 @@ static swig_module_info swig_module = {swig_types, 17, 0, 0, 0, 0}; #include "lib/talloc/talloc.h" #include "libcli/nbt/libnbt.h" #include "param/param.h" +#include "lib/events/events.h" /* Undo strcpy safety macro as it's used by swig )-: */ @@ -2912,12 +2926,8 @@ SWIGINTERN PyObject *_wrap_nbt_name_socket_init(PyObject *SWIGUNUSEDPARM(self), (char *) "event_ctx", NULL }; - { - arg2 = event_context_init(NULL); - } - { - arg1 = NULL; - } + arg2 = event_context_init(NULL); + arg1 = NULL; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"|O:nbt_name_socket_init",kwnames,&obj0)) SWIG_fail; if (obj0) { res2 = SWIG_ConvertPtr(obj0, &argp2,SWIGTYPE_p_event_context, 0 | 0 ); @@ -2943,16 +2953,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_set(PyObject *SWIGUNUSEDPARM(self), PyO int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_name_set" "', argument " "2"" of type '" "char const *""'"); } @@ -2978,10 +2987,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_name_get(PyObject *SWIGUNUSEDPARM(self), PyO char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_name_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3003,16 +3013,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_set(PyObject *SWIGUNUSEDPARM(self), Py int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_scope_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_scope_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_scope_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3038,10 +3047,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_scope_get(PyObject *SWIGUNUSEDPARM(self), Py char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_scope_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_scope_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3062,16 +3072,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_set(PyObject *SWIGUNUSEDPARM(self), PyO int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_type_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_type_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_set" "', argument " "1"" of type '" "struct nbt_name *""'"); } arg1 = (struct nbt_name *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_type_set" "', argument " "2"" of type '" "enum nbt_name_type""'"); } @@ -3091,10 +3100,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_type_get(PyObject *SWIGUNUSEDPARM(self), PyO enum nbt_name_type result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_type_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_type_get" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3111,7 +3121,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObject PyObject *resultobj = 0; struct nbt_name *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name",0,0,0)) SWIG_fail; result = (struct nbt_name *)(struct nbt_name *) calloc(1, sizeof(struct nbt_name)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3125,10 +3135,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name(PyObject *SWIGUNUSEDPARM(self), PyObj struct nbt_name *arg1 = (struct nbt_name *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name" "', argument " "1"" of type '" "struct nbt_name *""'"); } @@ -3144,21 +3155,26 @@ fail: SWIGINTERN PyObject *nbt_name_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_data_out_get(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ; nbt_name_query_out *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_out_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_out_get" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3177,10 +3193,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_data_in_get(PyObject *SWIGUNUSEDPARM(s nbt_name_query_in *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_data_in_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_data_in_get" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3197,7 +3214,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), Py PyObject *resultobj = 0; struct nbt_name_query *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query",0,0,0)) SWIG_fail; result = (struct nbt_name_query *)(struct nbt_name_query *) calloc(1, sizeof(struct nbt_name_query)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3211,10 +3228,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), struct nbt_name_query *arg1 = (struct nbt_name_query *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query" "', argument " "1"" of type '" "struct nbt_name_query *""'"); } @@ -3230,11 +3248,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ; @@ -3244,16 +3266,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_set(PyObject *SWIGUNUSE int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_from_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_from_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_from_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3279,10 +3300,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_from_get(PyObject *SWIGUNUSE char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_from_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_from_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3303,16 +3325,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_set(PyObject *SWIGUNUSEDPARM( int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_name_set" "', argument " "2"" of type '" "struct nbt_name *""'"); } @@ -3332,10 +3353,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_name_get(PyObject *SWIGUNUSEDPARM( struct nbt_name *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_name_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3356,16 +3378,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_set(PyObject *SWIGUNUSED int res1 = 0 ; short val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_num_addrs_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_num_addrs_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - ecode2 = SWIG_AsVal_short(obj1, &val2); + ecode2 = SWIG_AsVal_short(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_out_num_addrs_set" "', argument " "2"" of type '" "int16_t""'"); } @@ -3385,10 +3406,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_num_addrs_get(PyObject *SWIGUNUSED int16_t result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_num_addrs_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_num_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3409,16 +3431,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_set(PyObject *SWIGUNUS int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_out_reply_addrs_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_out_reply_addrs_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } arg1 = (nbt_name_query_out *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_p_char, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_out_reply_addrs_set" "', argument " "2"" of type '" "char const **""'"); } @@ -3438,10 +3459,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_out_reply_addrs_get(PyObject *SWIGUNUS char **result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_out_reply_addrs_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_out_reply_addrs_get" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3458,7 +3480,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(self) PyObject *resultobj = 0; nbt_name_query_out *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_out")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_out",0,0,0)) SWIG_fail; result = (nbt_name_query_out *)(nbt_name_query_out *) calloc(1, sizeof(nbt_name_query_out)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3472,10 +3494,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_out(PyObject *SWIGUNUSEDPARM(se nbt_name_query_out *arg1 = (nbt_name_query_out *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_out",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_out, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_out" "', argument " "1"" of type '" "nbt_name_query_out *""'"); } @@ -3491,11 +3514,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_out_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_out, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_out_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *resultobj = 0; nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ; @@ -3504,16 +3531,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_set(PyObject *SWIGUNUSEDPARM(s int res1 = 0 ; void *argp2 = 0 ; int res2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_name_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_name_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); + res2 = SWIG_ConvertPtr(swig_obj[1], &argp2,SWIGTYPE_p_nbt_name, 0 | 0 ); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_name_set" "', argument " "2"" of type '" "struct nbt_name *""'"); } @@ -3533,10 +3559,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_name_get(PyObject *SWIGUNUSEDPARM(s struct nbt_name *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_name_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_name_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3558,16 +3585,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_set(PyObject *SWIGUNUSEDP int res2 ; char *buf2 = 0 ; int alloc2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_dest_addr_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_dest_addr_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - res2 = SWIG_AsCharPtrAndSize(obj1, &buf2, NULL, &alloc2); + res2 = SWIG_AsCharPtrAndSize(swig_obj[1], &buf2, NULL, &alloc2); if (!SWIG_IsOK(res2)) { SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "nbt_name_query_in_dest_addr_set" "', argument " "2"" of type '" "char const *""'"); } @@ -3593,10 +3619,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_dest_addr_get(PyObject *SWIGUNUSEDP char *result = 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_dest_addr_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_dest_addr_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3617,16 +3644,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_set(PyObject *SWIGUNUSEDP int res1 = 0 ; bool val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_broadcast_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_broadcast_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_bool(obj1, &val2); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_broadcast_set" "', argument " "2"" of type '" "bool""'"); } @@ -3646,10 +3672,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_broadcast_get(PyObject *SWIGUNUSEDP bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_broadcast_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_broadcast_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3670,16 +3697,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_set(PyObject *SWIGUNUSE int res1 = 0 ; bool val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_wins_lookup_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_wins_lookup_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_bool(obj1, &val2); + ecode2 = SWIG_AsVal_bool(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_wins_lookup_set" "', argument " "2"" of type '" "bool""'"); } @@ -3699,10 +3725,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_wins_lookup_get(PyObject *SWIGUNUSE bool result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_wins_lookup_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_wins_lookup_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3723,16 +3750,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_set(PyObject *SWIGUNUSEDPAR int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_timeout_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_timeout_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_timeout_set" "', argument " "2"" of type '" "int""'"); } @@ -3752,10 +3778,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_timeout_get(PyObject *SWIGUNUSEDPAR int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_timeout_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_timeout_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3776,16 +3803,15 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_set(PyObject *SWIGUNUSEDPAR int res1 = 0 ; int val2 ; int ecode2 = 0 ; - PyObject * obj0 = 0 ; - PyObject * obj1 = 0 ; + PyObject *swig_obj[2] ; - if (!PyArg_ParseTuple(args,(char *)"OO:nbt_name_query_in_retries_set",&obj0,&obj1)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!SWIG_Python_UnpackTuple(args,"nbt_name_query_in_retries_set",2,2,swig_obj)) SWIG_fail; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_set" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } arg1 = (nbt_name_query_in *)(argp1); - ecode2 = SWIG_AsVal_int(obj1, &val2); + ecode2 = SWIG_AsVal_int(swig_obj[1], &val2); if (!SWIG_IsOK(ecode2)) { SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "nbt_name_query_in_retries_set" "', argument " "2"" of type '" "int""'"); } @@ -3805,10 +3831,11 @@ SWIGINTERN PyObject *_wrap_nbt_name_query_in_retries_get(PyObject *SWIGUNUSEDPAR int result; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:nbt_name_query_in_retries_get",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, 0 | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "nbt_name_query_in_retries_get" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3825,7 +3852,7 @@ SWIGINTERN PyObject *_wrap_new_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(self), PyObject *resultobj = 0; nbt_name_query_in *result = 0 ; - if (!PyArg_ParseTuple(args,(char *)":new_nbt_name_query_in")) SWIG_fail; + if (!SWIG_Python_UnpackTuple(args,"new_nbt_name_query_in",0,0,0)) SWIG_fail; result = (nbt_name_query_in *)(nbt_name_query_in *) calloc(1, sizeof(nbt_name_query_in)); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_NEW | 0 ); return resultobj; @@ -3839,10 +3866,11 @@ SWIGINTERN PyObject *_wrap_delete_nbt_name_query_in(PyObject *SWIGUNUSEDPARM(sel nbt_name_query_in *arg1 = (nbt_name_query_in *) 0 ; void *argp1 = 0 ; int res1 = 0 ; - PyObject * obj0 = 0 ; + PyObject *swig_obj[1] ; - if (!PyArg_ParseTuple(args,(char *)"O:delete_nbt_name_query_in",&obj0)) SWIG_fail; - res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 ); + if (!args) SWIG_fail; + swig_obj[0] = args; + res1 = SWIG_ConvertPtr(swig_obj[0], &argp1,SWIGTYPE_p_nbt_name_query_in, SWIG_POINTER_DISOWN | 0 ); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "delete_nbt_name_query_in" "', argument " "1"" of type '" "nbt_name_query_in *""'"); } @@ -3858,11 +3886,15 @@ fail: SWIGINTERN PyObject *nbt_name_query_in_swigregister(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { PyObject *obj; - if (!PyArg_ParseTuple(args,(char*)"O|swigregister", &obj)) return NULL; + if (!SWIG_Python_UnpackTuple(args,(char*)"swigregister", 1, 1,&obj)) return NULL; SWIG_TypeNewClientData(SWIGTYPE_p_nbt_name_query_in, SWIG_NewClientData(obj)); return SWIG_Py_Void(); } +SWIGINTERN PyObject *nbt_name_query_in_swiginit(PyObject *SWIGUNUSEDPARM(self), PyObject *args) { + return SWIG_Python_InitShadowInstance(args); +} + SWIGINTERN PyObject *_wrap_new_char_ptr_array(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; size_t arg1 ; @@ -4007,9 +4039,7 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO (char *) "nbtsock",(char *) "io", NULL }; - { - arg2 = NULL; - } + arg2 = NULL; if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO:do_nbt_name_query",kwnames,&obj0,&obj1)) SWIG_fail; res1 = SWIG_ConvertPtr(obj0, &argp1,SWIGTYPE_p_nbt_name_socket, 0 | 0 ); if (!SWIG_IsOK(res1)) { @@ -4022,13 +4052,12 @@ SWIGINTERN PyObject *_wrap_do_nbt_name_query(PyObject *SWIGUNUSEDPARM(self), PyO } arg3 = (struct nbt_name_query *)(argp3); result = do_nbt_name_query(arg1,arg2,arg3); - { - if (NT_STATUS_IS_ERR(result)) { - PyObject *obj = Py_BuildValue("(i,s)", (&result)->v, nt_errstr(result)); - PyErr_SetObject(PyExc_RuntimeError, obj); - } else if (resultobj == NULL) { - resultobj = Py_None; - } + if (NT_STATUS_IS_ERR(result)) { + PyObject *obj = Py_BuildValue((char *)"(i,s)", (&result)->v, nt_errstr(result)); + PyErr_SetObject(PyExc_RuntimeError, obj); + SWIG_fail; + } else if (resultobj == NULL) { + resultobj = Py_None; } return resultobj; fail: @@ -4039,45 +4068,49 @@ fail: static PyMethodDef SwigMethods[] = { { (char *)"nbt_name_socket_init", (PyCFunction) _wrap_nbt_name_socket_init, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"nbt_name_name_set", _wrap_nbt_name_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_name_get", _wrap_nbt_name_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_name_get", (PyCFunction)_wrap_nbt_name_name_get, METH_O, NULL}, { (char *)"nbt_name_scope_set", _wrap_nbt_name_scope_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_scope_get", _wrap_nbt_name_scope_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_scope_get", (PyCFunction)_wrap_nbt_name_scope_get, METH_O, NULL}, { (char *)"nbt_name_type_set", _wrap_nbt_name_type_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_type_get", _wrap_nbt_name_type_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name", _wrap_new_nbt_name, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name", _wrap_delete_nbt_name, METH_VARARGS, NULL}, + { (char *)"nbt_name_type_get", (PyCFunction)_wrap_nbt_name_type_get, METH_O, NULL}, + { (char *)"new_nbt_name", (PyCFunction)_wrap_new_nbt_name, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name", (PyCFunction)_wrap_delete_nbt_name, METH_O, NULL}, { (char *)"nbt_name_swigregister", nbt_name_swigregister, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_data_out_get", _wrap_nbt_name_query_data_out_get, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_data_in_get", _wrap_nbt_name_query_data_in_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query", _wrap_new_nbt_name_query, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query", _wrap_delete_nbt_name_query, METH_VARARGS, NULL}, + { (char *)"nbt_name_swiginit", nbt_name_swiginit, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_data_out_get", (PyCFunction)_wrap_nbt_name_query_data_out_get, METH_O, NULL}, + { (char *)"nbt_name_query_data_in_get", (PyCFunction)_wrap_nbt_name_query_data_in_get, METH_O, NULL}, + { (char *)"new_nbt_name_query", (PyCFunction)_wrap_new_nbt_name_query, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query", (PyCFunction)_wrap_delete_nbt_name_query, METH_O, NULL}, { (char *)"nbt_name_query_swigregister", nbt_name_query_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_swiginit", nbt_name_query_swiginit, METH_VARARGS, NULL}, { (char *)"nbt_name_query_out_reply_from_set", _wrap_nbt_name_query_out_reply_from_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_reply_from_get", _wrap_nbt_name_query_out_reply_from_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_reply_from_get", (PyCFunction)_wrap_nbt_name_query_out_reply_from_get, METH_O, NULL}, { (char *)"nbt_name_query_out_name_set", _wrap_nbt_name_query_out_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_name_get", _wrap_nbt_name_query_out_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_name_get", (PyCFunction)_wrap_nbt_name_query_out_name_get, METH_O, NULL}, { (char *)"nbt_name_query_out_num_addrs_set", _wrap_nbt_name_query_out_num_addrs_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_num_addrs_get", _wrap_nbt_name_query_out_num_addrs_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_num_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_num_addrs_get, METH_O, NULL}, { (char *)"nbt_name_query_out_reply_addrs_set", _wrap_nbt_name_query_out_reply_addrs_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_out_reply_addrs_get", _wrap_nbt_name_query_out_reply_addrs_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query_out", _wrap_new_nbt_name_query_out, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query_out", _wrap_delete_nbt_name_query_out, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_reply_addrs_get", (PyCFunction)_wrap_nbt_name_query_out_reply_addrs_get, METH_O, NULL}, + { (char *)"new_nbt_name_query_out", (PyCFunction)_wrap_new_nbt_name_query_out, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query_out", (PyCFunction)_wrap_delete_nbt_name_query_out, METH_O, NULL}, { (char *)"nbt_name_query_out_swigregister", nbt_name_query_out_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_out_swiginit", nbt_name_query_out_swiginit, METH_VARARGS, NULL}, { (char *)"nbt_name_query_in_name_set", _wrap_nbt_name_query_in_name_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_name_get", _wrap_nbt_name_query_in_name_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_name_get", (PyCFunction)_wrap_nbt_name_query_in_name_get, METH_O, NULL}, { (char *)"nbt_name_query_in_dest_addr_set", _wrap_nbt_name_query_in_dest_addr_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_dest_addr_get", _wrap_nbt_name_query_in_dest_addr_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_dest_addr_get", (PyCFunction)_wrap_nbt_name_query_in_dest_addr_get, METH_O, NULL}, { (char *)"nbt_name_query_in_broadcast_set", _wrap_nbt_name_query_in_broadcast_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_broadcast_get", _wrap_nbt_name_query_in_broadcast_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_broadcast_get", (PyCFunction)_wrap_nbt_name_query_in_broadcast_get, METH_O, NULL}, { (char *)"nbt_name_query_in_wins_lookup_set", _wrap_nbt_name_query_in_wins_lookup_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_wins_lookup_get", _wrap_nbt_name_query_in_wins_lookup_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_wins_lookup_get", (PyCFunction)_wrap_nbt_name_query_in_wins_lookup_get, METH_O, NULL}, { (char *)"nbt_name_query_in_timeout_set", _wrap_nbt_name_query_in_timeout_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_timeout_get", _wrap_nbt_name_query_in_timeout_get, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_timeout_get", (PyCFunction)_wrap_nbt_name_query_in_timeout_get, METH_O, NULL}, { (char *)"nbt_name_query_in_retries_set", _wrap_nbt_name_query_in_retries_set, METH_VARARGS, NULL}, - { (char *)"nbt_name_query_in_retries_get", _wrap_nbt_name_query_in_retries_get, METH_VARARGS, NULL}, - { (char *)"new_nbt_name_query_in", _wrap_new_nbt_name_query_in, METH_VARARGS, NULL}, - { (char *)"delete_nbt_name_query_in", _wrap_delete_nbt_name_query_in, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_retries_get", (PyCFunction)_wrap_nbt_name_query_in_retries_get, METH_O, NULL}, + { (char *)"new_nbt_name_query_in", (PyCFunction)_wrap_new_nbt_name_query_in, METH_NOARGS, NULL}, + { (char *)"delete_nbt_name_query_in", (PyCFunction)_wrap_delete_nbt_name_query_in, METH_O, NULL}, { (char *)"nbt_name_query_in_swigregister", nbt_name_query_in_swigregister, METH_VARARGS, NULL}, + { (char *)"nbt_name_query_in_swiginit", nbt_name_query_in_swiginit, METH_VARARGS, NULL}, { (char *)"new_char_ptr_array", (PyCFunction) _wrap_new_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"delete_char_ptr_array", (PyCFunction) _wrap_delete_char_ptr_array, METH_VARARGS | METH_KEYWORDS, NULL}, { (char *)"char_ptr_array_getitem", (PyCFunction) _wrap_char_ptr_array_getitem, METH_VARARGS | METH_KEYWORDS, NULL}, @@ -4091,7 +4124,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_event_context = {"_p_event_context", "struct event_context *", 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_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_nbt_name = {"_p_nbt_name", "struct nbt_name *|nbt_name *", 0, 0, (void*)0, 0}; diff --git a/source4/libcli/swig/libcli_smb.i b/source4/libcli/swig/libcli_smb.i index 32e043b2c6..4125bcf5a9 100644 --- a/source4/libcli/swig/libcli_smb.i +++ b/source4/libcli/swig/libcli_smb.i @@ -9,8 +9,9 @@ #include "libcli/raw/libcliraw.h" %} -struct smbcli_socket *smbcli_sock_connect_byname(const char *host, int port, +struct smbcli_socket *smbcli_sock_connect_byname(const char *host, const char **ports, TALLOC_CTX *mem_ctx, + struct resolve_context *resolve_ctx, struct event_context *event_ctx); void smbcli_sock_dead(struct smbcli_socket *sock); diff --git a/source4/libcli/swig/libcli_smb.py b/source4/libcli/swig/libcli_smb.py index 466a04b9eb..80c4040237 100644 --- a/source4/libcli/swig/libcli_smb.py +++ b/source4/libcli/swig/libcli_smb.py @@ -2,7 +2,6 @@ # Version 1.3.33 # # Don't modify this file, modify the SWIG interface instead. -# This file is compatible with both classic and new-style classes. import _libcli_smb import new @@ -48,6 +47,16 @@ except AttributeError: 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 smbcli_sock_connect_byname = _libcli_smb.smbcli_sock_connect_byname smbcli_sock_dead = _libcli_smb.smbcli_sock_dead diff --git a/source4/libcli/swig/libcli_smb_wrap.c b/source4/libcli/swig/libcli_smb_wrap.c index 313bcfeed3..8b71f2c3be 100644 --- a/source4/libcli/swig/libcli_smb_wrap.c +++ b/source4/libcli/swig/libcli_smb_wrap.c @@ -9,7 +9,7 @@ * ----------------------------------------------------------------------------- */ #define SWIGPYTHON -#define SWIG_PYTHON_DIRECTOR_NO_VTABLE +#define SWIG_PYTHON_NO_BUILD_NONE /* ----------------------------------------------------------------------------- * This section contains generic SWIG labels for method/variable * declarations/attributes, and other compiler dependent labels. @@ -2459,9 +2459,11 @@ SWIG_Python_MustGetPtr(PyObject *obj, swig_type_info *ty, int argnum, int flags) #define SWIGTYPE_p_TALLOC_CTX swig_types[0] #define SWIGTYPE_p_char swig_types[1] #define SWIGTYPE_p_event_context swig_types[2] -#define SWIGTYPE_p_smbcli_socket swig_types[3] -static swig_type_info *swig_types[5]; -static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; +#define SWIGTYPE_p_p_char swig_types[3] +#define SWIGTYPE_p_resolve_context swig_types[4] +#define SWIGTYPE_p_smbcli_socket swig_types[5] +static swig_type_info *swig_types[7]; +static swig_module_info swig_module = {swig_types, 6, 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) @@ -2472,6 +2474,19 @@ static swig_module_info swig_module = {swig_types, 4, 0, 0, 0, 0}; # 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):= _libcli_smb.so @@ -2560,200 +2575,60 @@ SWIG_AsCharPtrAndSize(PyObject *obj, char** cptr, size_t* psize, int *alloc) - -#include -#if !defined(SWIG_NO_LLONG_MAX) -# if !defined(LLONG_MAX) && defined(__GNUC__) && defined (__LONG_LONG_MAX__) -# define LLONG_MAX __LONG_LONG_MAX__ -# define LLONG_MIN (-LLONG_MAX - 1LL) -# define ULLONG_MAX (LLONG_MAX * 2ULL + 1ULL) -# endif -#endif - - -SWIGINTERN int -SWIG_AsVal_double (PyObject *obj, double *val) -{ - int res = SWIG_TypeError; - if (PyFloat_Check(obj)) { - if (val) *val = PyFloat_AsDouble(obj); - return SWIG_OK; - } else if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - double v = PyLong_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - double d = PyFloat_AsDouble(obj); - if (!PyErr_Occurred()) { - if (val) *val = d; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_AddCast(SWIG_OK)); - } else { - PyErr_Clear(); - } - } - } -#endif - return res; -} - - -#include - - -#include - - -SWIGINTERNINLINE int -SWIG_CanCastAsInteger(double *d, double min, double max) { - double x = *d; - if ((min <= x && x <= max)) { - double fx = floor(x); - double cx = ceil(x); - double rd = ((x - fx) < 0.5) ? fx : cx; /* simple rint */ - if ((errno == EDOM) || (errno == ERANGE)) { - errno = 0; - } else { - double summ, reps, diff; - if (rd < x) { - diff = x - rd; - } else if (rd > x) { - diff = rd - x; - } else { - return 1; - } - summ = rd + x; - reps = diff/summ; - if (reps < 8*DBL_EPSILON) { - *d = rd; - return 1; - } - } - } - return 0; -} - - -SWIGINTERN int -SWIG_AsVal_long (PyObject *obj, long* val) -{ - if (PyInt_Check(obj)) { - if (val) *val = PyInt_AsLong(obj); - return SWIG_OK; - } else if (PyLong_Check(obj)) { - long v = PyLong_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_OK; - } else { - PyErr_Clear(); - } - } -#ifdef SWIG_PYTHON_CAST_MODE - { - int dispatch = 0; - long v = PyInt_AsLong(obj); - if (!PyErr_Occurred()) { - if (val) *val = v; - return SWIG_AddCast(SWIG_OK); - } else { - PyErr_Clear(); - } - if (!dispatch) { - double d; - int res = SWIG_AddCast(SWIG_AsVal_double (obj,&d)); - if (SWIG_IsOK(res) && SWIG_CanCastAsInteger(&d, LONG_MIN, LONG_MAX)) { - if (val) *val = (long)(d); - return res; - } - } - } -#endif - return SWIG_TypeError; -} - - -SWIGINTERN int -SWIG_AsVal_int (PyObject * obj, int *val) -{ - long v; - int res = SWIG_AsVal_long (obj, &v); - if (SWIG_IsOK(res)) { - if ((v < INT_MIN || v > INT_MAX)) { - return SWIG_OverflowError; - } else { - if (val) *val = (int)(v); - } - } - return res; -} - #ifdef __cplusplus extern "C" { #endif SWIGINTERN PyObject *_wrap_smbcli_sock_connect_byname(PyObject *SWIGUNUSEDPARM(self), PyObject *args, PyObject *kwargs) { PyObject *resultobj = 0; char *arg1 = (char *) 0 ; - int arg2 ; + char **arg2 = (char **) 0 ; TALLOC_CTX *arg3 = (TALLOC_CTX *) 0 ; - struct event_context *arg4 = (struct event_context *) 0 ; + struct resolve_context *arg4 = (struct resolve_context *) 0 ; + struct event_context *arg5 = (struct event_context *) 0 ; struct smbcli_socket *result = 0 ; int res1 ; char *buf1 = 0 ; int alloc1 = 0 ; - int val2 ; - int ecode2 = 0 ; + void *argp2 = 0 ; + int res2 = 0 ; void *argp4 = 0 ; int res4 = 0 ; + void *argp5 = 0 ; + int res5 = 0 ; PyObject * obj0 = 0 ; PyObject * obj1 = 0 ; PyObject * obj2 = 0 ; + PyObject * obj3 = 0 ; char * kwnames[] = { - (char *) "host",(char *) "port",(char *) "event_ctx", NULL + (char *) "host",(char *) "ports",(char *) "resolve_ctx",(char *) "event_ctx", NULL }; - { - arg4 = event_context_init(NULL); - } - { - arg3 = NULL; - } - if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2)) SWIG_fail; + arg5 = event_context_init(NULL); + arg3 = NULL; + if (!PyArg_ParseTupleAndKeywords(args,kwargs,(char *)"OOO|O:smbcli_sock_connect_byname",kwnames,&obj0,&obj1,&obj2,&obj3)) SWIG_fail; res1 = SWIG_AsCharPtrAndSize(obj0, &buf1, NULL, &alloc1); if (!SWIG_IsOK(res1)) { SWIG_exception_fail(SWIG_ArgError(res1), "in method '" "smbcli_sock_connect_byname" "', argument " "1"" of type '" "char const *""'"); } arg1 = (char *)(buf1); - ecode2 = SWIG_AsVal_int(obj1, &val2); - if (!SWIG_IsOK(ecode2)) { - SWIG_exception_fail(SWIG_ArgError(ecode2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "int""'"); - } - arg2 = (int)(val2); - if (obj2) { - res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_event_context, 0 | 0 ); - if (!SWIG_IsOK(res4)) { - SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct event_context *""'"); + res2 = SWIG_ConvertPtr(obj1, &argp2,SWIGTYPE_p_p_char, 0 | 0 ); + if (!SWIG_IsOK(res2)) { + SWIG_exception_fail(SWIG_ArgError(res2), "in method '" "smbcli_sock_connect_byname" "', argument " "2"" of type '" "char const **""'"); + } + arg2 = (char **)(argp2); + res4 = SWIG_ConvertPtr(obj2, &argp4,SWIGTYPE_p_resolve_context, 0 | 0 ); + if (!SWIG_IsOK(res4)) { + SWIG_exception_fail(SWIG_ArgError(res4), "in method '" "smbcli_sock_connect_byname" "', argument " "4"" of type '" "struct resolve_context *""'"); + } + arg4 = (struct resolve_context *)(argp4); + if (obj3) { + res5 = SWIG_ConvertPtr(obj3, &argp5,SWIGTYPE_p_event_context, 0 | 0 ); + if (!SWIG_IsOK(res5)) { + SWIG_exception_fail(SWIG_ArgError(res5), "in method '" "smbcli_sock_connect_byname" "', argument " "5"" of type '" "struct event_context *""'"); } - arg4 = (struct event_context *)(argp4); + arg5 = (struct event_context *)(argp5); } - result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,arg2,arg3,arg4); + result = (struct smbcli_socket *)smbcli_sock_connect_byname((char const *)arg1,(char const **)arg2,arg3,arg4,arg5); resultobj = SWIG_NewPointerObj(SWIG_as_voidptr(result), SWIGTYPE_p_smbcli_socket, 0 | 0 ); if (alloc1 == SWIG_NEWOBJ) free((char*)buf1); return resultobj; @@ -2798,25 +2673,33 @@ 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_event_context = {"_p_event_context", "struct event_context *", 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_p_char = {"_p_p_char", "char **", 0, 0, (void*)0, 0}; +static swig_type_info _swigt__p_resolve_context = {"_p_resolve_context", "struct resolve_context *", 0, 0, (void*)0, 0}; static swig_type_info _swigt__p_smbcli_socket = {"_p_smbcli_socket", "struct smbcli_socket *", 0, 0, (void*)0, 0}; static swig_type_info *swig_type_initial[] = { &_swigt__p_TALLOC_CTX, &_swigt__p_char, &_swigt__p_event_context, + &_swigt__p_p_char, + &_swigt__p_resolve_context, &_swigt__p_smbcli_socket, }; 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_event_context[] = { {&_swigt__p_event_context, 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_resolve_context[] = { {&_swigt__p_resolve_context, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info _swigc__p_smbcli_socket[] = { {&_swigt__p_smbcli_socket, 0, 0, 0},{0, 0, 0, 0}}; static swig_cast_info *swig_cast_initial[] = { _swigc__p_TALLOC_CTX, _swigc__p_char, _swigc__p_event_context, + _swigc__p_p_char, + _swigc__p_resolve_context, _swigc__p_smbcli_socket, }; -- cgit From 03023c4f7d8c7bc6716982db86e8167f1ac6331b Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 16:28:43 +0100 Subject: build: Demote a bunch of libraries to subsystems. This makes packaging easier and should also make it easier to migrate to a new build system. (This used to be commit 77b400764e3dadfa05407343af649ad9298cc085) --- source4/lib/ldb/python.mk | 4 ---- source4/lib/nss_wrapper/config.mk | 5 +---- source4/lib/policy/config.mk | 2 +- source4/lib/samba3/config.mk | 5 +---- source4/lib/socket_wrapper/config.mk | 5 +---- source4/lib/tdr/config.mk | 5 +---- source4/libnet/config.mk | 5 +---- source4/librpc/config.mk | 15 +++------------ source4/nsswitch/config.mk | 5 +---- source4/ntptr/config.mk | 2 +- source4/ntvfs/config.mk | 5 +---- source4/param/config.mk | 5 +---- source4/scripting/ejs/config.mk | 12 +----------- source4/smbd/config.mk | 6 +----- source4/smbd/process_model.mk | 9 +-------- 15 files changed, 16 insertions(+), 74 deletions(-) diff --git a/source4/lib/ldb/python.mk b/source4/lib/ldb/python.mk index 24ade8f977..bbd4c1c5eb 100644 --- a/source4/lib/ldb/python.mk +++ b/source4/lib/ldb/python.mk @@ -1,8 +1,4 @@ -####################### -# Start LIBRARY swig_ldb [PYTHON::swig_ldb] PUBLIC_DEPENDENCIES = LIBLDB CFLAGS = -Ilib/ldb/include SWIG_FILE = ldb.i -# End LIBRARY swig_ldb -####################### diff --git a/source4/lib/nss_wrapper/config.mk b/source4/lib/nss_wrapper/config.mk index 9751d2bf73..b46f7c3ee7 100644 --- a/source4/lib/nss_wrapper/config.mk +++ b/source4/lib/nss_wrapper/config.mk @@ -1,9 +1,6 @@ ############################## # Start SUBSYSTEM NSS_WRAPPER -[LIBRARY::NSS_WRAPPER] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Wrapper library for testing nss calls without being root +[SUBSYSTEM::NSS_WRAPPER] PUBLIC_HEADERS = nss_wrapper.h OBJ_FILES = nss_wrapper.o # End SUBSYSTEM NSS_WRAPPER diff --git a/source4/lib/policy/config.mk b/source4/lib/policy/config.mk index f404d58377..aae98b86b2 100644 --- a/source4/lib/policy/config.mk +++ b/source4/lib/policy/config.mk @@ -1,4 +1,4 @@ -[LIBRARY::LIBPOLICY] +[SUBSYSTEM::LIBPOLICY] CFLAGS = -Iheimdal/lib/roken OBJ_FILES = lex.o parse_adm.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-CONFIG LIBTALLOC CHARSET diff --git a/source4/lib/samba3/config.mk b/source4/lib/samba3/config.mk index 76f1ce5096..705bdd4002 100644 --- a/source4/lib/samba3/config.mk +++ b/source4/lib/samba3/config.mk @@ -1,9 +1,6 @@ ################################################ # Start SUBSYSTEM LIBSAMBA3 -[LIBRARY::LIBSAMBA3] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Library for reading Samba3 data files +[SUBSYSTEM::LIBSAMBA3] PRIVATE_PROTO_HEADER = samba3_proto.h PUBLIC_HEADERS = samba3.h OBJ_FILES = tdbsam.o policy.o \ diff --git a/source4/lib/socket_wrapper/config.mk b/source4/lib/socket_wrapper/config.mk index 9e194230dc..4c5cf94348 100644 --- a/source4/lib/socket_wrapper/config.mk +++ b/source4/lib/socket_wrapper/config.mk @@ -1,9 +1,6 @@ ############################## # Start SUBSYSTEM SOCKET_WRAPPER -[LIBRARY::SOCKET_WRAPPER] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Wrapper library for testing TCP/IP connections using Unix Sockets +[SUBSYSTEM::SOCKET_WRAPPER] PUBLIC_HEADERS = socket_wrapper.h OBJ_FILES = socket_wrapper.o PRIVATE_DEPENDENCIES = EXT_SOCKET diff --git a/source4/lib/tdr/config.mk b/source4/lib/tdr/config.mk index f0e24c54b4..b8473e5ba8 100644 --- a/source4/lib/tdr/config.mk +++ b/source4/lib/tdr/config.mk @@ -1,9 +1,6 @@ -[LIBRARY::TDR] +[SUBSYSTEM::TDR] CFLAGS = -Ilib/tdr PUBLIC_HEADERS = tdr.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Simple marshall/unmarshall library PUBLIC_PROTO_HEADER = tdr_proto.h PUBLIC_DEPENDENCIES = LIBTALLOC LIBSAMBA-UTIL OBJ_FILES = tdr.o diff --git a/source4/libnet/config.mk b/source4/libnet/config.mk index aadd3b88d0..9041ff5a23 100644 --- a/source4/libnet/config.mk +++ b/source4/libnet/config.mk @@ -1,7 +1,4 @@ -[LIBRARY::LIBSAMBA-NET] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Convenient high level access to Samba management interfaces +[SUBSYSTEM::LIBSAMBA-NET] PRIVATE_PROTO_HEADER = libnet_proto.h PUBLIC_HEADERS = libnet.h libnet_join.h libnet_lookup.h libnet_passwd.h \ libnet_rpc.h libnet_share.h libnet_time.h \ diff --git a/source4/librpc/config.mk b/source4/librpc/config.mk index 8774f2fd17..4d4167ba04 100644 --- a/source4/librpc/config.mk +++ b/source4/librpc/config.mk @@ -36,10 +36,7 @@ MANPAGE = tools/ndrdump.1 ################################################ # Start SUBSYSTEM NDR_COMPRESSION -[LIBRARY::NDR_COMPRESSION] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = NDR support for compressed subcontexts +[SUBSYSTEM::NDR_COMPRESSION] PRIVATE_PROTO_HEADER = ndr/ndr_compression.h OBJ_FILES = \ ndr/ndr_compression.o @@ -370,13 +367,10 @@ OBJ_FILES = gen_ndr/ndr_svcctl_c.o PUBLIC_HEADERS = gen_ndr/ndr_svcctl_c.h PUBLIC_DEPENDENCIES = dcerpc NDR_SVCCTL -[LIBRARY::dcerpc_atsvc] +[SUBSYSTEM::dcerpc_atsvc] OBJ_FILES = gen_ndr/ndr_atsvc_c.o PUBLIC_HEADERS = gen_ndr/ndr_atsvc_c.h PUBLIC_DEPENDENCIES = dcerpc NDR_ATSVC -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = DCE/RPC client library - ATSVC [SUBSYSTEM::RPC_NDR_EVENTLOG] OBJ_FILES = gen_ndr/ndr_eventlog_c.o @@ -410,12 +404,9 @@ PUBLIC_DEPENDENCIES = dcerpc NDR_WINREG OBJ_FILES = gen_ndr/ndr_initshutdown_c.o PUBLIC_DEPENDENCIES = dcerpc NDR_INITSHUTDOWN -[LIBRARY::dcerpc_mgmt] +[SUBSYSTEM::dcerpc_mgmt] OBJ_FILES = gen_ndr/ndr_mgmt_c.o PRIVATE_DEPENDENCIES = NDR_MGMT -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = DCE/RPC client library - MGMT [SUBSYSTEM::RPC_NDR_PROTECTED_STORAGE] OBJ_FILES = gen_ndr/ndr_protected_storage_c.o diff --git a/source4/nsswitch/config.mk b/source4/nsswitch/config.mk index 8982024516..621939256c 100644 --- a/source4/nsswitch/config.mk +++ b/source4/nsswitch/config.mk @@ -1,7 +1,4 @@ -[LIBRARY::LIBWINBIND-CLIENT] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Client library for communicating with winbind +[SUBSYSTEM::LIBWINBIND-CLIENT] OBJ_FILES = wb_common.o PRIVATE_DEPENDENCIES = SOCKET_WRAPPER diff --git a/source4/ntptr/config.mk b/source4/ntptr/config.mk index 38a582291f..4c1f46ff17 100644 --- a/source4/ntptr/config.mk +++ b/source4/ntptr/config.mk @@ -14,7 +14,7 @@ PRIVATE_DEPENDENCIES = \ ################################################ # Start SUBSYSTEM ntptr -[LIBRARY::ntptr] +[SUBSYSTEM::ntptr] PRIVATE_PROTO_HEADER = ntptr_proto.h OBJ_FILES = \ ntptr_base.o \ diff --git a/source4/ntvfs/config.mk b/source4/ntvfs/config.mk index ae8d5d9b4a..017614b7be 100644 --- a/source4/ntvfs/config.mk +++ b/source4/ntvfs/config.mk @@ -79,11 +79,8 @@ OBJ_FILES = \ ################################################ # Start SUBSYSTEM NTVFS -[LIBRARY::ntvfs] +[SUBSYSTEM::ntvfs] PUBLIC_HEADERS = ntvfs.h -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Virtual File System with NTFS semantics PRIVATE_PROTO_HEADER = ntvfs_proto.h OBJ_FILES = \ ntvfs_base.o \ diff --git a/source4/param/config.mk b/source4/param/config.mk index b28f6639c0..f7d5d03d43 100644 --- a/source4/param/config.mk +++ b/source4/param/config.mk @@ -14,10 +14,7 @@ PUBLIC_HEADERS = param.h ################################# # Start SUBSYSTEM share -[LIBRARY::share] -VERSION = 0.0.1 -SO_VERSION = 0 -DESCRIPTION = Services Configuration Library +[SUBSYSTEM::share] PUBLIC_HEADERS = share.h PUBLIC_PROTO_HEADER = share_proto.h OBJ_FILES = share.o diff --git a/source4/scripting/ejs/config.mk b/source4/scripting/ejs/config.mk index 8b680ba973..656ecdae16 100644 --- a/source4/scripting/ejs/config.mk +++ b/source4/scripting/ejs/config.mk @@ -1,10 +1,6 @@ -####################### -# Start LIBRARY EJSRPC [SUBSYSTEM::EJSRPC] OBJ_FILES = \ ejsrpc.o -# End SUBSYSTEM EJSRPC -####################### [MODULE::smbcalls_config] OBJ_FILES = smbcalls_config.o @@ -79,11 +75,7 @@ INIT_FUNCTION = smb_setup_ejs_system include ejsnet/config.mk -####################### -# Start LIBRARY smbcalls -[LIBRARY::smbcalls] -SO_VERSION = 0 -VERSION = 0.0.1 +[SUBSYSTEM::smbcalls] PRIVATE_PROTO_HEADER = proto.h OBJ_FILES = \ smbcalls.o \ @@ -101,8 +93,6 @@ PRIVATE_DEPENDENCIES = \ CREDENTIALS POPT_CREDENTIALS POPT_SAMBA \ dcerpc \ NDR_TABLE -# End SUBSYSTEM smbcalls -####################### ####################### # Start BINARY SMBSCRIPT diff --git a/source4/smbd/config.mk b/source4/smbd/config.mk index ea0df63f32..c4d1070992 100644 --- a/source4/smbd/config.mk +++ b/source4/smbd/config.mk @@ -10,9 +10,7 @@ PRIVATE_DEPENDENCIES = \ # End MODULE server_auth ################################################ -####################### -# Start SUBSERVICE -[LIBRARY::service] +[SUBSYSTEM::service] PRIVATE_PROTO_HEADER = service_proto.h OBJ_FILES = \ service.o \ @@ -20,8 +18,6 @@ OBJ_FILES = \ service_task.o PRIVATE_DEPENDENCIES = \ MESSAGING samba-socket -# End SUBSYSTEM SERVER -####################### [SUBSYSTEM::PIDFILE] OBJ_FILES = pidfile.o diff --git a/source4/smbd/process_model.mk b/source4/smbd/process_model.mk index 4d927a640c..d6b7698e74 100644 --- a/source4/smbd/process_model.mk +++ b/source4/smbd/process_model.mk @@ -32,15 +32,8 @@ PRIVATE_DEPENDENCIES = PTHREAD # End MODULE process_model_thread ################################################ -################################################ -# Start SUBSYSTEM process_model -[LIBRARY::process_model] -VERSION = 0.0.1 -SO_VERSION = 0 +[SUBSYSTEM::process_model] PRIVATE_PROTO_HEADER = process_model_proto.h OBJ_FILES = \ process_model.o PRIVATE_DEPENDENCIES = LIBSAMBA-UTIL LIBSAMBA-CONFIG -# -# End SUBSYSTEM process_model -################################################ -- cgit From 42a793107e79624644ddfcac960b23eae3362002 Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Sun, 20 Jan 2008 18:04:19 +0100 Subject: python: Fix init functions. (This used to be commit 4b057b9bffcef9ecc61fe016746f5ce6f17f6d06) --- source4/scripting/python/modules.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/source4/scripting/python/modules.c b/source4/scripting/python/modules.c index b2dd50b507..fff981e941 100644 --- a/source4/scripting/python/modules.c +++ b/source4/scripting/python/modules.c @@ -46,6 +46,8 @@ static void initdcerpc_security(void) {} extern void initlsa(void); extern void initsvcctl(void); extern void initwkssvc(void); +extern void init_libcli_nbt(void); +extern void init_libcli_smb(void); static struct _inittab py_modules[] = { STATIC_LIBPYTHON_MODULES }; -- cgit From 440b1a1d04bca3027100b3bda84738730ffce71c Mon Sep 17 00:00:00 2001 From: Jelmer Vernooij Date: Mon, 21 Jan 2008 00:50:04 +0100 Subject: build: Don't build heimdal as library. (This used to be commit c04cf0c0520ae35ebe173d733d5dc8ffa5bf4ed9) --- source4/heimdal_build/config.mk | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/source4/heimdal_build/config.mk b/source4/heimdal_build/config.mk index b534c9bc9f..604516ccf6 100644 --- a/source4/heimdal_build/config.mk +++ b/source4/heimdal_build/config.mk @@ -543,9 +543,7 @@ clean:: ####################### # Start SUBSYSTEM HEIMDAL -[LIBRARY::HEIMDAL] -VERSION = 0.0.1 -SO_VERSION = 0 +[SUBSYSTEM::HEIMDAL] CFLAGS = -Iheimdal_build OBJ_FILES = ../heimdal/lib/vers/print_version.o PUBLIC_DEPENDENCIES = \ -- cgit From 8623c981b4a67dafc19234faffced1796f33b975 Mon Sep 17 00:00:00 2001 From: Andrew Bartlett Date: Mon, 21 Jan 2008 20:56:27 +1100 Subject: Be sure to pass iconv handle down to compression subcontexts (fixes segfaults in NET-API-BECOME-DC) Andrew Bartlett (This used to be commit 70c1e918e6bd01946425e2d89cb680f14152f9fc) --- source4/librpc/ndr/ndr_compression.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source4/librpc/ndr/ndr_compression.c b/source4/librpc/ndr/ndr_compression.c index 310f8c4ce4..86a5a2560e 100644 --- a/source4/librpc/ndr/ndr_compression.c +++ b/source4/librpc/ndr/ndr_compression.c @@ -112,6 +112,8 @@ static enum ndr_err_code ndr_pull_compression_mszip(struct ndr_pull *subndr, comndr->data_size = uncompressed.length; comndr->offset = 0; + comndr->iconv_convenience = talloc_reference(comndr, subndr->iconv_convenience); + NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[0])); NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[1])); NDR_CHECK(ndr_pull_uint32(comndr, NDR_SCALARS, &payload_header[2])); @@ -215,6 +217,8 @@ static enum ndr_err_code ndr_pull_compression_xpress(struct ndr_pull *subndr, comndr->data_size = uncompressed.length; comndr->offset = 0; + comndr->iconv_convenience = talloc_reference(comndr, subndr->iconv_convenience); + *_comndr = comndr; return NDR_ERR_SUCCESS; } -- cgit