Re: s3: Avoid a winbind 100% cpu loop

2011-10-19 Thread Stefan (metze) Metzmacher
Hi Volker,

 - Log -
 commit fbf17489844a5cfc6d1da8c431ce0194ed4c3f72
 Author: Volker Lendecke v...@samba.org
 Date:   Tue Oct 18 21:36:44 2011 +0200
 
 s3: Avoid a winbind 100% cpu loop
 
 When a DC goes down hard, winbind can end up in a 100% CPU loop. The next
 (small) RPC request to the DC ends up as a trans2 request. If the 
 connection
 goes down, we end up trying to discard the request via the loop in
 cli_state_notify_pending(). Because this is a trans2 request,
 cli_smb_req_unset_pending will not kick in. Thus the pending array will 
 always
 remain at length 1.
 
 Autobuild-User: Volker Lendecke vlen...@samba.org
 Autobuild-Date: Wed Oct 19 01:39:35 CEST 2011 on sn-devel-104
 
 ---
 
 Summary of changes:
  source3/libsmb/async_smb.c |8 
  1 files changed, 8 insertions(+), 0 deletions(-)
 
 
 Changeset truncated at 500 lines:
 
 diff --git a/source3/libsmb/async_smb.c b/source3/libsmb/async_smb.c
 index efeb328..dce1b74 100644
 --- a/source3/libsmb/async_smb.c
 +++ b/source3/libsmb/async_smb.c
 @@ -287,6 +287,14 @@ static void cli_state_notify_pending(struct cli_state 
 *cli, NTSTATUS status)
   req = cli-conn.pending[0];
   state = tevent_req_data(req, struct cli_smb_state);
  
 + if (NT_STATUS_EQUAL(status, NT_STATUS_PIPE_BROKEN)) {
 + /*
 +  * We're dead. No point waiting for trans2
 +  * replies.
 +  */
 + state-mid = 0;
 + }
 +
   cli_smb_req_unset_pending(req);

Good catch, thanks!

Is there a reason why you only use state-mid = 0; on PIPE_BROKEN?
As cli_state_notify_pending() calls cli_state_disconnect(), I think we
should
always use state-mid = 0; without looking at the status.

metze



signature.asc
Description: OpenPGP digital signature


[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Andrew Tridgell
The branch, master has been updated
   via  5c5fc5d build: added deletion of stale .so and .o files
  from  416bf1c samba.getopt: Add some basic tests.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 5c5fc5dde45618b9ec9f41fbb4aa090b161ebf35
Author: Andrew Tridgell tri...@samba.org
Date:   Wed Oct 19 16:34:32 2011 +1100

build: added deletion of stale .so and .o files

when we change our build rules to move a C file, we need to remove the
old ('stale') .so and .o files from the build directory, or they may
be used as part of the new build, which means that old code will be
linked in.

This expands the list of stale files that we remove on rule changes to
include .so and .o files

Pair-Programmed-With: Amitay Isaacs ami...@gmail.com

Autobuild-User: Andrew Tridgell tri...@samba.org
Autobuild-Date: Wed Oct 19 09:02:23 CEST 2011 on sn-devel-104

---

Summary of changes:
 buildtools/wafsamba/stale_files.py |   18 --
 1 files changed, 16 insertions(+), 2 deletions(-)


Changeset truncated at 500 lines:

diff --git a/buildtools/wafsamba/stale_files.py 
b/buildtools/wafsamba/stale_files.py
index 2b94f08..1ee1ff9 100644
--- a/buildtools/wafsamba/stale_files.py
+++ b/buildtools/wafsamba/stale_files.py
@@ -58,7 +58,20 @@ def replace_refill_task_list(self):
 try:
 if getattr(x, 'target'):
 tlist = samba_utils.TO_LIST(getattr(x, 'target'))
+ttype = getattr(x, 'samba_type', None)
+task_list = getattr(x, 'compiled_tasks', [])
+if task_list:
+# this gets all of the .o files, including the task
+# ids, so foo.c maps to foo_3.o for idx=3
+for tsk in task_list:
+for output in tsk.outputs:
+objpath = 
os.path.normpath(output.abspath(bld.env))
+expected.append(objpath)
 for t in tlist:
+if ttype in ['LIBRARY','MODULE']:
+t = samba_utils.apply_pattern(t, 
bld.env.shlib_PATTERN)
+if ttype == 'PYTHON':
+t = samba_utils.apply_pattern(t, 
bld.env.pyext_PATTERN)
 p = os.path.join(x.path.abspath(bld.env), t)
 p = os.path.normpath(p)
 expected.append(p)
@@ -78,13 +91,14 @@ def replace_refill_task_list(self):
 p = link
 if f in ['config.h']:
 continue
-if f[-2:] not in [ '.c', '.h' ]:
+(froot, fext) = os.path.splitext(f)
+if fext not in [ '.c', '.h', '.so', '.o' ]:
 continue
 if f[-7:] == '.inst.h':
 continue
 if p.find(/.conf) != -1:
 continue
-if not p in expected:
+if not p in expected and os.path.exists(p):
 Logs.warn(Removing stale file: %s % p)
 os.unlink(p)
 return iit


-- 
Samba Shared Repository


[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Stefan Metzmacher
The branch, master has been updated
   via  ba08ad5 s4:libcli/raw: remove unused smb_len(), _smb_setlen() and 
_smb2_setlen() macros
   via  8bf1e4c s4:smb_server/smb2: make use of _smb_setlen_tcp()
   via  2fbbf75 s4:smb_server/smb: make use of _smb_setlen_nbt()
   via  8574d50 s4:libcli/smb2: make use of _smb_setlen_tcp()
   via  8eed525 s4:libcli/raw: make use of _smb_setlen_nbt()
   via  b0480f2 s4:lib/stream: make use of smb_len_tcp()
   via  da32fb6 s3:include: use smb_[set]len_[nbt|tcp]() macros
   via  cd22763 libcli/smb: add smb_[set]len_[nbt|tcp]() macros
   via  5e6c477 s3: remove duplicate fsctl fn definitions
   via  b711de2 libcli: Move smb2 fsctl fn defs into common code
   via  d5ea379 s3: Remove duplicate fsctl function definitions
   via  281fc93 libcli: move ioctl function field defs to smb_constants
  from  43f23b5 s4-s3-upgrade rename samba-tool domain samba3upgrade 
--libdir to --dbdir for clarity

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit ba08ad5f3942cbb6afb0b411dfd149fabd1954a6
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:02:57 2011 +0200

s4:libcli/raw: remove unused smb_len(), _smb_setlen() and _smb2_setlen() 
macros

metze

Autobuild-User: Stefan Metzmacher me...@samba.org
Autobuild-Date: Wed Oct 19 17:15:23 CEST 2011 on sn-devel-104

commit 8bf1e4caae0fcf87aa87bce2eaff2aab7ead8746
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:02:30 2011 +0200

s4:smb_server/smb2: make use of _smb_setlen_tcp()

metze

commit 2fbbf751f5afc5e8ed00c9ecb6ac817982f6362b
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:02:09 2011 +0200

s4:smb_server/smb: make use of _smb_setlen_nbt()

metze

commit 8574d509a94ccf44c129d9c5b2a71f631d4fbfb0
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:01:29 2011 +0200

s4:libcli/smb2: make use of _smb_setlen_tcp()

metze

commit 8eed525e0b2b71f5d39657f9c81ce37f819c4a6a
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:01:01 2011 +0200

s4:libcli/raw: make use of _smb_setlen_nbt()

metze

commit b0480f26ca3823d618f85f381700fcd23d299220
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 14:00:12 2011 +0200

s4:lib/stream: make use of smb_len_tcp()

metze

commit da32fb6b404a38b2043bfe55bc97e94e6ae68f7f
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 13:48:09 2011 +0200

s3:include: use smb_[set]len_[nbt|tcp]() macros

metze

commit cd227634408c54a917d7cb5f8877b373a688eb8e
Author: Stefan Metzmacher me...@samba.org
Date:   Wed Oct 19 13:48:09 2011 +0200

libcli/smb: add smb_[set]len_[nbt|tcp]() macros

metze

commit 5e6c477ef8b7f4799e281ed87a3d4c1eda5dc92f
Author: David Disseldorp dd...@suse.de
Date:   Tue Oct 18 13:55:22 2011 +0200

s3: remove duplicate fsctl fn definitions

Signed-off-by: Stefan Metzmacher me...@samba.org

commit b711de287f9318b5de1374c72f0194403e845f79
Author: David Disseldorp dd...@suse.de
Date:   Tue Oct 18 13:54:33 2011 +0200

libcli: Move smb2 fsctl fn defs into common code

Signed-off-by: Stefan Metzmacher me...@samba.org

commit d5ea379428bafbe3f0b26b2dc7906fa6379833a9
Author: David Disseldorp dd...@suse.de
Date:   Tue Oct 18 12:23:26 2011 +0200

s3: Remove duplicate fsctl function definitions

Signed-off-by: Stefan Metzmacher me...@samba.org

commit 281fc93c6bc21039ffedcc8d19084df02b087f24
Author: David Disseldorp dd...@suse.de
Date:   Tue Oct 18 11:47:05 2011 +0200

libcli: move ioctl function field defs to smb_constants

Currently there are a lot of duplicate ioctl function field definitions
between source3 and source4.

Signed-off-by: Stefan Metzmacher me...@samba.org

---

Summary of changes:
 libcli/smb/smb_constants.h   |   59 ++
 source3/include/ntioctl.h|   49 
 source3/include/smb_macros.h |8 ++--
 source3/libsmb/clisymlink.c  |1 -
 source3/smbd/nttrans.c   |1 -
 source3/torture/test_nttrans_fsctl.c |1 -
 source4/lib/stream/packet.c  |8 -
 source4/libcli/raw/clitransport.c|2 +-
 source4/libcli/raw/interfaces.h  |   11 --
 source4/libcli/raw/ioctl.h   |   59 --
 source4/libcli/raw/rawrequest.c  |2 +-
 source4/libcli/raw/rawshadow.c   |2 +-
 source4/libcli/raw/smb.h |6 ---
 source4/libcli/smb2/transport.c  |4 +-
 source4/librpc/rpc/dcerpc_smb2.c |2 +-
 source4/ntvfs/ipc/vfs_ipc.c  |2 +-
 source4/ntvfs/posix/pvfs_ioctl.c |2 +-
 source4/ntvfs/print/vfs_print.c  |2 +-
 

[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Andrew Tridgell
The branch, master has been updated
   via  3712006 dsdb: improve debug message
  from  ce45ae1 s3-waf: make sure we always compile (not install) our 
libsmbclient testcode.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 3712006faacbc468d7df3d577c796508e533617c
Author: Andrew Tridgell tri...@samba.org
Date:   Thu Oct 20 08:02:40 2011 +1100

dsdb: improve debug message

show the reply type in Invalid reply type messages

Autobuild-User: Andrew Tridgell tri...@samba.org
Autobuild-Date: Thu Oct 20 00:57:05 CEST 2011 on sn-devel-104

---

Summary of changes:
 lib/ldb/common/ldb.c|6 +++---
 lib/ldb/ldb_map/ldb_map_inbound.c   |6 +++---
 source4/dsdb/samdb/ldb_modules/new_partition.c  |2 +-
 source4/dsdb/samdb/ldb_modules/repl_meta_data.c |2 +-
 source4/dsdb/samdb/ldb_modules/samldb.c |3 +--
 source4/dsdb/samdb/ldb_modules/subtree_rename.c |2 +-
 6 files changed, 10 insertions(+), 11 deletions(-)


Changeset truncated at 500 lines:

diff --git a/lib/ldb/common/ldb.c b/lib/ldb/common/ldb.c
index cd6172a..a223b87 100644
--- a/lib/ldb/common/ldb.c
+++ b/lib/ldb/common/ldb.c
@@ -1069,7 +1069,7 @@ int ldb_modify_default_callback(struct ldb_request *req, 
struct ldb_reply *ares)
return ldb_request_done(req, LDB_SUCCESS);
default:
talloc_free(ares);
-   ldb_set_errstring(req-handle-ldb, Invalid reply type!);
+   ldb_asprintf_errstring(req-handle-ldb, Invalid LDB reply 
type %d, ares-type);
return ldb_request_done(req, LDB_ERR_OPERATIONS_ERROR);
}
 
@@ -1093,7 +1093,7 @@ int ldb_op_default_callback(struct ldb_request *req, 
struct ldb_reply *ares)
 
if (ares-type != LDB_REPLY_DONE) {
talloc_free(ares);
-   ldb_set_errstring(req-handle-ldb, Invalid reply type!);
+   ldb_asprintf_errstring(req-handle-ldb, Invalid LDB reply 
type %d, ares-type);
return ldb_request_done(req, LDB_ERR_OPERATIONS_ERROR);
}
 
@@ -1399,7 +1399,7 @@ int ldb_extended_default_callback(struct ldb_request *req,
}
 
talloc_free(ares);
-   ldb_set_errstring(req-handle-ldb, Invalid reply type!);
+   ldb_asprintf_errstring(req-handle-ldb, Invalid LDB reply type %d, 
ares-type);
return ldb_request_done(req, LDB_ERR_OPERATIONS_ERROR);
 }
 
diff --git a/lib/ldb/ldb_map/ldb_map_inbound.c 
b/lib/ldb/ldb_map/ldb_map_inbound.c
index b610372..38dd5ac 100644
--- a/lib/ldb/ldb_map/ldb_map_inbound.c
+++ b/lib/ldb/ldb_map/ldb_map_inbound.c
@@ -309,7 +309,7 @@ static int map_op_local_callback(struct ldb_request *req,
}
 
if (ares-type != LDB_REPLY_DONE) {
-   ldb_set_errstring(ldb, Invalid reply type!);
+   ldb_asprintf_errstring(ldb, Invalid LDB reply type %d, 
ares-type);
return ldb_module_done(ac-req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -343,7 +343,7 @@ static int map_op_remote_callback(struct ldb_request *req,
}
 
if (ares-type != LDB_REPLY_DONE) {
-   ldb_set_errstring(ldb, Invalid reply type!);
+   ldb_asprintf_errstring(ldb, Invalid LDB reply type %d, 
ares-type);
return ldb_module_done(ac-req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
@@ -802,7 +802,7 @@ static int map_rename_local_callback(struct ldb_request 
*req,
}
 
if (ares-type != LDB_REPLY_DONE) {
-   ldb_set_errstring(ldb, Invalid reply type!);
+   ldb_asprintf_errstring(ldb, Invalid LDB reply type %d, 
ares-type);
return ldb_module_done(ac-req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
diff --git a/source4/dsdb/samdb/ldb_modules/new_partition.c 
b/source4/dsdb/samdb/ldb_modules/new_partition.c
index 3f730f9..eaf7d43 100644
--- a/source4/dsdb/samdb/ldb_modules/new_partition.c
+++ b/source4/dsdb/samdb/ldb_modules/new_partition.c
@@ -65,7 +65,7 @@ static int np_part_mod_callback(struct ldb_request *req, 
struct ldb_reply *ares)
}
 
if (ares-type != LDB_REPLY_DONE) {
-   ldb_set_errstring(ldb, Invalid reply type!);
+   ldb_asprintf_errstring(ldb, Invalid LDB reply type %d, 
ares-type);
return ldb_module_done(ac-req, NULL, NULL,
LDB_ERR_OPERATIONS_ERROR);
}
diff --git a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c 
b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
index 2be0760..b3126c3 100644
--- a/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
+++ b/source4/dsdb/samdb/ldb_modules/repl_meta_data.c
@@ -3983,7 +3983,7 @@ static int 

[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Jeremy Allison
The branch, master has been updated
   via  019f643 Fix a boatload of warnings in the examples.
   via  f64f91f Fix error return to be NT_STATUS_NOT_A_DIRECTORY.
   via  7b4edc1 Make use of the dir_exists we already have on directory 
open.
  from  3712006 dsdb: improve debug message

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 019f643c693b4c6de3da78159d8c4507b924d93a
Author: Jeremy Allison j...@samba.org
Date:   Wed Oct 19 14:52:41 2011 -0700

Fix a boatload of warnings in the examples.

Autobuild-User: Jeremy Allison j...@samba.org
Autobuild-Date: Thu Oct 20 02:29:52 CEST 2011 on sn-devel-104

commit f64f91f96f71271186b3e171d24f0d0137620cba
Author: Jeremy Allison j...@samba.org
Date:   Wed Oct 19 14:25:45 2011 -0700

Fix error return to be NT_STATUS_NOT_A_DIRECTORY.

commit 7b4edc11e3c0eb9b9a8717e28b70cb00e95cf7ec
Author: Jeremy Allison j...@samba.org
Date:   Wed Oct 19 14:23:38 2011 -0700

Make use of the dir_exists we already have on directory open.

---

Summary of changes:
 examples/libsmbclient/testacl.c  |4 +-
 examples/libsmbclient/testacl2.c |8 +
 examples/libsmbclient/testacl3.c |7 
 examples/libsmbclient/testbrowse.c   |   35 ++
 examples/libsmbclient/testbrowse2.c  |   66 +-
 examples/libsmbclient/testchmod.c|4 +--
 examples/libsmbclient/testfstatvfs.c |1 -
 examples/libsmbclient/testread.c |5 ---
 examples/libsmbclient/teststat.c |   23 ++--
 examples/libsmbclient/teststat2.c|   22 +--
 examples/libsmbclient/teststat3.c|3 --
 examples/libsmbclient/teststatvfs.c  |3 --
 examples/libsmbclient/testtruncate.c |2 -
 examples/libsmbclient/testutime.c|   23 +---
 examples/libsmbclient/testwrite.c|5 ---
 source3/smbd/open.c  |   40 +++-
 16 files changed, 78 insertions(+), 173 deletions(-)


Changeset truncated at 500 lines:

diff --git a/examples/libsmbclient/testacl.c b/examples/libsmbclient/testacl.c
index a57dd4a..b602c5b 100644
--- a/examples/libsmbclient/testacl.c
+++ b/examples/libsmbclient/testacl.c
@@ -27,10 +27,10 @@ int main(int argc, const char *argv[])
 int stat_and_retry = 0;
 int full_time_names = 0;
 enum acl_mode mode = SMB_ACL_LIST;
-static char *the_acl = NULL;
+static const char *the_acl = NULL;
 int ret;
 char *p;
-char *debugstr;
+const char *debugstr;
 char path[1024];
 char value[1024];
 poptContext pc;
diff --git a/examples/libsmbclient/testacl2.c b/examples/libsmbclient/testacl2.c
index d2a97cf..ef044f8 100644
--- a/examples/libsmbclient/testacl2.c
+++ b/examples/libsmbclient/testacl2.c
@@ -19,17 +19,11 @@ enum acl_mode
 
 int main(int argc, const char *argv[])
 {
-int i;
-int opt;
 int flags;
 int debug = 0;
-int numeric = 0;
-int full_time_names = 0;
-enum acl_mode mode = SMB_ACL_GET;
 static char *the_acl = NULL;
 int ret;
-char *p;
-char *debugstr;
+const char *debugstr;
 char value[1024];
 
 if (smbc_init(get_auth_data_fn, debug) != 0)
diff --git a/examples/libsmbclient/testacl3.c b/examples/libsmbclient/testacl3.c
index 4ef6e80..f34e273 100644
--- a/examples/libsmbclient/testacl3.c
+++ b/examples/libsmbclient/testacl3.c
@@ -10,19 +10,12 @@
 
 int main(int argc, char * argv[]) 
 { 
-int i;
-int fd;
 int ret;
 int debug = 0;
-int mode = 0666;
-int savedErrno;
 charvalue[2048]; 
 charpath[2048];
 char *  the_acl;
 char *  p;
-time_t  t0;
-time_t  t1;
-struct stat st; 
 SMBCCTX *   context;
 
 smbc_init(get_auth_data_fn, debug); 
diff --git a/examples/libsmbclient/testbrowse.c 
b/examples/libsmbclient/testbrowse.c
index c3fb394..2ae7ca1 100644
--- a/examples/libsmbclient/testbrowse.c
+++ b/examples/libsmbclient/testbrowse.c
@@ -9,16 +9,6 @@
 #include libsmbclient.h
 #include get_auth_data_fn.h
 
-static void
-no_auth_data_fn(const char * pServer,
-const char * pShare,
-char * pWorkgroup,
-int maxLenWorkgroup,
-char * pUsername,
-int maxLenUsername,
-char * pPassword,
-int maxLenPassword);
-
 static void browse(char * path,
int scan,
int indent);
@@ -44,10 +34,8 @@ main(int argc, char * argv[])
 int context_auth = 0;
 int scan = 0;
 int iterations = -1;
-int again;
 int opt;
 char * 

[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Andrew Tridgell
The branch, master has been updated
   via  8890f70 s4-test: added test suite for common.py code
   via  4f08a29 s4-dsdb: moved dsdb_Dn() into common.py
   via  43e5592 subunitrun: give more useful help
  from  019f643 Fix a boatload of warnings in the examples.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit 8890f709d9c19b515b1bd0b0232b7eddc8ebd7c4
Author: Andrew Tridgell tri...@samba.org
Date:   Thu Oct 20 13:25:22 2011 +1100

s4-test: added test suite for common.py code

this tests the dsdb_Dn() class

Pair-Programmed-With: Amitay Isaacs ami...@gmail.com

Autobuild-User: Andrew Tridgell tri...@samba.org
Autobuild-Date: Thu Oct 20 05:51:28 CEST 2011 on sn-devel-104

commit 4f08a2951a04ba75fdf7b784dcf84059537d7b4c
Author: Andrew Tridgell tri...@samba.org
Date:   Thu Oct 20 13:24:45 2011 +1100

s4-dsdb: moved dsdb_Dn() into common.py

this gives a method for dealing with binary DNs from python

Pair-Programmed-With: Amitay Isaacs ami...@gmail.com

commit 43e5592e9af95f2f2522cf8b015a76b14475729d
Author: Andrew Tridgell tri...@samba.org
Date:   Thu Oct 20 13:24:04 2011 +1100

subunitrun: give more useful help

give some examples and more useful description for subunitrun command

Pair-Programmed-With: Amitay Isaacs ami...@gmail.com

---

Summary of changes:
 source4/scripting/bin/subunitrun   |   27 ++-
 source4/scripting/python/samba/common.py   |   40 ++
 source4/scripting/python/samba/dbchecker.py|   29 ++---
 source4/scripting/python/samba/tests/common.py |   42 
 4 files changed, 110 insertions(+), 28 deletions(-)
 create mode 100644 source4/scripting/python/samba/tests/common.py


Changeset truncated at 500 lines:

diff --git a/source4/scripting/bin/subunitrun b/source4/scripting/bin/subunitrun
index bc7b42c..9c87d2e 100755
--- a/source4/scripting/bin/subunitrun
+++ b/source4/scripting/bin/subunitrun
@@ -31,9 +31,31 @@ import samba.getopt as options
 import samba.tests
 
 
-parser = optparse.OptionParser(subunitrun [options] tests)
+usage = 'subunitrun [options] tests'
+description = '''
+This runs a Samba python test suite. The tests are typically located in
+source4/scripting/python/samba/tests/*.py
+
+To run the tests from one of those modules, specify the test as
+samba.tests.MODULE. For example, to run the tests in common.py:
+
+   subunitrun samba.tests.common
+
+To list the tests in that module, use:
+
+   subunitrun -l samba.tests.common
+'''
+
+def format_description(formatter):
+'''hack to prevent textwrap of the description'''
+return description
+
+parser = optparse.OptionParser(usage=usage, description=description)
+parser.format_description = format_description
 credopts = options.CredentialsOptions(parser)
+sambaopts = options.SambaOptions(parser)
 parser.add_option_group(credopts)
+parser.add_option_group(sambaopts)
 try:
 from subunit.run import TestProgram
 except ImportError:
@@ -45,7 +67,8 @@ else:
 
 opts, args = parser.parse_args()
 
-samba.tests.cmdline_credentials = 
credopts.get_credentials(samba.tests.env_loadparm())
+lp = sambaopts.get_loadparm()
+samba.tests.cmdline_credentials = credopts.get_credentials(lp)
 if getattr(opts, listtests, False):
 args.insert(0, --list)
 
diff --git a/source4/scripting/python/samba/common.py 
b/source4/scripting/python/samba/common.py
index 5a9fae1..9738966 100644
--- a/source4/scripting/python/samba/common.py
+++ b/source4/scripting/python/samba/common.py
@@ -18,6 +18,8 @@
 # along with this program.  If not, see http://www.gnu.org/licenses/.
 #
 
+import ldb, dsdb
+
 def confirm(msg, forced = False, allow_all=False):
 confirm an action with the user
 :param msg: A string to print to the user
@@ -55,3 +57,41 @@ def normalise_int32(ivalue):
 if int(ivalue)  0x8000 and int(ivalue)  0:
 return str(int(ivalue) - 0x1)
 return str(ivalue)
+
+
+class dsdb_Dn(object):
+'''a class for binary DN'''
+
+def __init__(self, samdb, dnstring, syntax_oid=None):
+'''create a dsdb_Dn'''
+if syntax_oid is None:
+# auto-detect based on string
+if dnstring.startswith(B:):
+syntax_oid = dsdb.DSDB_SYNTAX_BINARY_DN
+elif dnstring.startswith(S:):
+syntax_oid = dsdb.DSDB_SYNTAX_STRING_DN
+else:
+syntax_oid = dsdb.DSDB_SYNTAX_OR_NAME
+if syntax_oid in [ dsdb.DSDB_SYNTAX_BINARY_DN, 
dsdb.DSDB_SYNTAX_STRING_DN ]:
+# it is a binary DN
+colons = dnstring.split(':')
+if len(colons)  4:
+raise RuntimeError(Invalid DN %s % dnstring)
+prefix_len = 4 + len(colons[1]) + int(colons[1])
+

[SCM] Samba Shared Repository - branch master updated

2011-10-19 Thread Andrew Tridgell
The branch, master has been updated
   via  dd64f99 build: explain the passing of make options to waf
   via  ab50165 ldb: ldb_errstring() takes ldb_contxt as an argument
   via  2feb81f s4-dns: Update serial number for zone on dns updates
   via  7ca0bed s4-selftest: Add tests for RPC dnsserver
   via  b619705 samba-tool: Added dns command for DNS management
   via  8df2ed4 s4-dns: Added DCERPC dns server for DNS management
   via  a8c7b28 s4-provision: Provision DNS records with correct rank
   via  51855de werror: Added missing DNS error codes
   via  65f9a13 s4-dns: Added support for multiple DNS_RPC_RECORDS 
structures
   via  0f84c63 s4-dns: Added more data types for dnsserver implementation
   via  7ba004d ldb-samba: Added handler to decode dnsProperty attribute
   via  3193e14 dnsp: Added typedefs to interpret dnsProperty attribute for 
dnsZone objectclass
  from  8890f70 s4-test: added test suite for common.py code

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -
commit dd64f99fd17c1cb5aeefda91618111c6702832a7
Author: Andrew Tridgell tri...@samba.org
Date:   Thu Oct 20 14:57:13 2011 +1100

build: explain the passing of make options to waf

add a comment explaining how we pass make command line options into
waf

Autobuild-User: Andrew Tridgell tri...@samba.org
Autobuild-Date: Thu Oct 20 07:24:02 CEST 2011 on sn-devel-104

commit ab50165a0235401d7920e67503c211028f55012d
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Oct 19 10:45:28 2011 +1100

ldb: ldb_errstring() takes ldb_contxt as an argument

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 2feb81f659801444be090b8f90b85a78a59da796
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 18 15:20:14 2011 +1100

s4-dns: Update serial number for zone on dns updates

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 7ca0bed38d35948f05e30f52d2bf4c391bfc1711
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Oct 18 12:44:02 2011 +1100

s4-selftest: Add tests for RPC dnsserver

Signed-off-by: Andrew Tridgell tri...@samba.org

commit b619705c22f62a763a83fe57508b16af24a22ef0
Author: Amitay Isaacs ami...@gmail.com
Date:   Mon Oct 17 13:15:40 2011 +1100

samba-tool: Added dns command for DNS management

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 8df2ed42cc4662bd385ea34169ebd3bcd4d8bc17
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Sep 27 16:53:45 2011 +1000

s4-dns: Added DCERPC dns server for DNS management

dnsserver.h - typedefs and prototypes
dnsserver.c - RPC API and implementation methods
dnsdb.c - samdb operations
dnsdata.c   - functions to manipulate dns structures
dnsutils.c  - function for serverinfo and zoneinfo structures

Signed-off-by: Andrew Tridgell tri...@samba.org

commit a8c7b2843553a3ea6b19c8f9a065b1f54c1ff0d7
Author: Amitay Isaacs ami...@gmail.com
Date:   Fri Oct 7 15:39:58 2011 +1100

s4-provision: Provision DNS records with correct rank

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 51855de6338607b0dcca7b81b7fd4577481af40c
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Sep 28 13:15:02 2011 +1000

werror: Added missing DNS error codes

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 65f9a13dc3f3e26aa3f7a9d90abe94a7b2e6bc77
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Sep 27 17:10:14 2011 +1000

s4-dns: Added support for multiple DNS_RPC_RECORDS structures

Windows returns multiple DNS_RPC_RECORDS structures, but there is
no well defined structure in [MS-DNSP] doc. Added hand-written
code to parse ndr.

Pair-Programmed-With: Andrew Tridgell tri...@samba.org

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 0f84c634fc035f31e284b95b93e66be1a541c680
Author: Amitay Isaacs ami...@gmail.com
Date:   Tue Sep 27 17:07:04 2011 +1000

s4-dns: Added more data types for dnsserver implementation

Windows uses WERROR on dnsserver pipe.

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 7ba004da246ea2a6c4738c6d3ea5dfafdbdbf1d6
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Sep 21 14:56:19 2011 +1000

ldb-samba: Added handler to decode dnsProperty attribute

Signed-off-by: Andrew Tridgell tri...@samba.org

commit 3193e142d40b9dcdbf7cb55f708dae7bba398c3c
Author: Amitay Isaacs ami...@gmail.com
Date:   Wed Sep 21 14:55:06 2011 +1000

dnsp: Added typedefs to interpret dnsProperty attribute for dnsZone 
objectclass

Signed-off-by: Andrew Tridgell tri...@samba.org

---

Summary of changes:
 buildtools/wafsamba/samba_utils.py |7 +
 lib/ldb-samba/ldif_handlers.c  |   21 +
 lib/ldb-samba/ldif_handlers.h  |