[SCM] Samba Shared Repository - branch master updated

Jelmer Vernooij jelmer at samba.org
Mon Feb 6 18:46:02 MST 2012


The branch, master has been updated
       via  f2903e0 provision: Make sure target directory is created early.
       via  8dca1a0 samba-tool user password: Re-add support for option groups.
       via  7c8476b samba-tool: Add optiongroups, necessary for 'samba-tool domain ...'
       via  8443e15 crypto: Use libbsd md5 header, if available.
       via  634f827 crypto/md5: Change prototypes to match BSD.
       via  a0ff4c3 Revert "samba-tool: moved takes_optiongroups definition to Command base class"
       via  d6b4701 charset/tests: Add prototypes for test functions.
       via  e92302d smb_server: Preserve signedness of string push return value.
       via  8f6d7d6 loadparm: handle P_SEP in switches (silences warning with clang).
       via  a05a910 pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt'
       via  1c1b10f torture/libnet: Include prototype headers.
       via  6b1e83c pyxattr_tdb: Remove pointless check for blob.length < 0.
       via  9c000f1 crypto: Add prototype for main torture functions.
       via  fa0c2ab Use named argument 'dir' instead of 'prefix' on NamedTemporaryFile for domain.py
       via  7e02757 Use named argument 'dir' instead of 'prefix' on NamedTemporaryFile for source4/setup/provision
      from  523d5a8 s3-winbind: Remove unused bool "local"

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


- Log -----------------------------------------------------------------
commit f2903e0c4f9fc3931415144e72b6b898c4fdbf49
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Tue Feb 7 01:09:41 2012 +0100

    provision: Make sure target directory is created early.
    
    This is necessary when using the target directory to store temporary
    files.
    
    Autobuild-User: Jelmer Vernooij <jelmer at samba.org>
    Autobuild-Date: Tue Feb  7 02:45:37 CET 2012 on sn-devel-104

commit 8dca1a022242d69e6d35c10ddb796081a6b497a2
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 23:26:36 2012 +0100

    samba-tool user password: Re-add support for option groups.

commit 7c8476b434a9e305ecb90712d800e6560b45200f
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 22:06:09 2012 +0100

    samba-tool: Add optiongroups, necessary for 'samba-tool domain ...'

commit 8443e15eee28603bf427abc03ac1a8d86d23b12a
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 17:47:25 2012 +0100

    crypto: Use libbsd md5 header, if available.

commit 634f8276dd85872aa2d4f90b5f7b37c56ca5aff9
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 16:53:52 2012 +0100

    crypto/md5: Change prototypes to match BSD.

commit a0ff4c349c6b75f9e5fa6b4ad0e69a4aa8e471b0
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 16:33:38 2012 +0100

    Revert "samba-tool: moved takes_optiongroups definition to Command base class"
    
    This reverts commit f6fa8684896b8f3f9f8b7bd3742c99906973274c.
    
    This keeps the main command class fairly slim, and makes it a bit
    more obvious where the arguments to run() are coming from.
    
    Conflicts:
    
    	source4/scripting/python/samba/netcmd/__init__.py
    	source4/scripting/python/samba/netcmd/domain.py
    	source4/scripting/python/samba/netcmd/gpo.py
    	source4/scripting/python/samba/netcmd/newuser.py
    	source4/scripting/python/samba/netcmd/testparm.py
    	source4/scripting/python/samba/netcmd/user.py
    	source4/scripting/python/samba/tests/samba_tool/__init__.py

commit d6b47015037cbdebc3cd1c1f352cf7c6109bead3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Mon Feb 6 12:20:54 2012 +0100

    charset/tests: Add prototypes for test functions.

commit e92302d7077ec452a95021d5b69789d455955293
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 20:18:59 2012 +0100

    smb_server: Preserve signedness of string push return value.

commit 8f6d7d6cbf6c1443533e02dc7349c796785f90b7
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 20:12:23 2012 +0100

    loadparm: handle P_SEP in switches (silences warning with clang).

commit a05a9101b69250bde49e365fef74af08497ab6fd
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 16:42:41 2012 +0100

    pysocketwrapper: fix behaviour to be consistent with 'socket.getsockopt'
    
    socklen_t is unsigned

commit 1c1b10f1d916e6d335aeb1e6f1425455f8662d7e
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 15:35:12 2012 +0100

    torture/libnet: Include prototype headers.

commit 6b1e83c65c5de68f1f1478e383ee85b0dfbcaae3
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 15:31:31 2012 +0100

    pyxattr_tdb: Remove pointless check for blob.length < 0.

commit 9c000f1def6bb4f4254cca697f2dca143ea40291
Author: Jelmer Vernooij <jelmer at samba.org>
Date:   Sun Feb 5 15:31:05 2012 +0100

    crypto: Add prototype for main torture functions.

commit fa0c2ab5c5c9081bc83787a50bf32ee1ca20a3d3
Author: Horacio G. de Oro <hgdeoro at gmail.com>
Date:   Thu Feb 2 22:52:28 2012 -0300

    Use named argument 'dir' instead of 'prefix' on NamedTemporaryFile for domain.py
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>

commit 7e02757dfcbfb9f582e1b69a92ba4c9283348f9c
Author: Horacio G. de Oro <hgdeoro at gmail.com>
Date:   Thu Feb 2 22:48:26 2012 -0300

    Use named argument 'dir' instead of 'prefix' on NamedTemporaryFile for source4/setup/provision
    
    Signed-off-by: Jelmer Vernooij <jelmer at samba.org>

-----------------------------------------------------------------------

Summary of changes:
 lib/crypto/hmacmd5test.c                           |    1 +
 lib/crypto/md4test.c                               |    1 +
 lib/crypto/md5.h                                   |   18 ++++--
 lib/crypto/md5test.c                               |    2 +
 lib/crypto/wscript_build                           |   11 +++-
 lib/crypto/wscript_configure                       |    2 +
 lib/param/loadparm.c                               |    5 ++
 lib/socket_wrapper/py_socket_wrapper.c             |    4 +-
 lib/util/charset/tests/charset.c                   |    2 +
 lib/util/charset/tests/convert_string.c            |    5 ++
 source4/ntvfs/posix/python/pyxattr_tdb.c           |    2 +-
 source4/scripting/python/samba/netcmd/__init__.py  |    7 +--
 source4/scripting/python/samba/netcmd/dbcheck.py   |    7 ++-
 .../scripting/python/samba/netcmd/delegation.py    |   31 ++++++++-
 source4/scripting/python/samba/netcmd/domain.py    |   72 +++++++++++++++-----
 source4/scripting/python/samba/netcmd/drs.py       |   31 ++++++++-
 source4/scripting/python/samba/netcmd/dsacl.py     |    7 ++-
 source4/scripting/python/samba/netcmd/fsmo.py      |    7 ++-
 source4/scripting/python/samba/netcmd/gpo.py       |   12 +++-
 source4/scripting/python/samba/netcmd/group.py     |   25 +++++++-
 source4/scripting/python/samba/netcmd/ldapcmp.py   |    7 ++-
 source4/scripting/python/samba/netcmd/ntacl.py     |   13 +++-
 source4/scripting/python/samba/netcmd/rodc.py      |    7 ++-
 source4/scripting/python/samba/netcmd/spn.py       |   18 +++++-
 source4/scripting/python/samba/netcmd/testparm.py  |    6 ++-
 source4/scripting/python/samba/netcmd/time.py      |    7 ++-
 source4/scripting/python/samba/netcmd/user.py      |   65 +++++++++++++++---
 source4/scripting/python/samba/netcmd/vampire.py   |    7 ++-
 source4/scripting/python/samba/upgradehelpers.py   |    2 +
 source4/setup/provision                            |   24 ++++---
 source4/smb_server/blob.c                          |    2 +-
 source4/torture/libnet/libnet_share.c              |    1 +
 wscript                                            |    1 +
 33 files changed, 345 insertions(+), 67 deletions(-)
 create mode 100644 lib/crypto/wscript_configure


Changeset truncated at 500 lines:

diff --git a/lib/crypto/hmacmd5test.c b/lib/crypto/hmacmd5test.c
index a951409..6db2526 100644
--- a/lib/crypto/hmacmd5test.c
+++ b/lib/crypto/hmacmd5test.c
@@ -21,6 +21,7 @@
 #include "../lib/crypto/crypto.h"
 
 struct torture_context;
+bool torture_local_crypto_hmacmd5(struct torture_context *torture);
 
 static DATA_BLOB data_blob_repeat_byte(uint8_t byte, size_t length)
 {
diff --git a/lib/crypto/md4test.c b/lib/crypto/md4test.c
index 4ee05c1..dfdaef5 100644
--- a/lib/crypto/md4test.c
+++ b/lib/crypto/md4test.c
@@ -22,6 +22,7 @@
 #include "../lib/crypto/crypto.h"
 
 struct torture_context;
+bool torture_local_crypto_md4(struct torture_context *torture);
 
 /*
  This uses the test values from rfc1320
diff --git a/lib/crypto/md5.h b/lib/crypto/md5.h
index 4064d6f..bcdf50c 100644
--- a/lib/crypto/md5.h
+++ b/lib/crypto/md5.h
@@ -1,19 +1,27 @@
 #ifndef MD5_H
 #define MD5_H
+
 #ifndef HEADER_MD5_H
 /* Try to avoid clashes with OpenSSL */
 #define HEADER_MD5_H 
 #endif
 
-struct MD5Context {
+#ifdef HAVE_BSD_MD5_H
+/* Try to avoid clashes with BSD MD5 implementation */
+#include <bsd/md5.h>
+#else
+typedef struct MD5Context {
 	uint32_t buf[4];
 	uint32_t bits[2];
 	uint8_t in[64];
-};
+} MD5_CTX;
+
+#define MD5_DIGEST_LENGTH 16
 
-void MD5Init(struct MD5Context *context);
-void MD5Update(struct MD5Context *context, const uint8_t *buf,
+void MD5Init(MD5_CTX *context);
+void MD5Update(MD5_CTX *context, const uint8_t *buf,
 	       size_t len);
-void MD5Final(uint8_t digest[16], struct MD5Context *context);
+void MD5Final(uint8_t digest[MD5_DIGEST_LENGTH], MD5_CTX *context);
+#endif /* HAVE_BSD_MD5_H */
 
 #endif /* !MD5_H */
diff --git a/lib/crypto/md5test.c b/lib/crypto/md5test.c
index 38e6531..38626c3 100644
--- a/lib/crypto/md5test.c
+++ b/lib/crypto/md5test.c
@@ -23,6 +23,8 @@
 
 struct torture_context;
 
+bool torture_local_crypto_md5(struct torture_context *torture);
+
 /*
  This uses the test values from rfc1321
 */
diff --git a/lib/crypto/wscript_build b/lib/crypto/wscript_build
index 7bc4eb7..6ad1cad 100644
--- a/lib/crypto/wscript_build
+++ b/lib/crypto/wscript_build
@@ -1,8 +1,15 @@
 #!/usr/bin/env python
 
+extra_source = ''
+extra_deps = ''
+if bld.CONFIG_SET('HAVE_BSD_MD5_H'):
+	extra_deps += ' bsd'
+else:
+	extra_source += ' md5.c'
+
 bld.SAMBA_SUBSYSTEM('LIBCRYPTO',
-	source='crc32.c md5.c hmacmd5.c md4.c arcfour.c sha256.c hmacsha256.c aes.c rijndael-alg-fst.c',
-	deps='talloc'
+	source='crc32.c hmacmd5.c md4.c arcfour.c sha256.c hmacsha256.c aes.c rijndael-alg-fst.c' + extra_source,
+	deps='talloc' + extra_deps
 	)
 
 
diff --git a/lib/crypto/wscript_configure b/lib/crypto/wscript_configure
new file mode 100644
index 0000000..77d21e9
--- /dev/null
+++ b/lib/crypto/wscript_configure
@@ -0,0 +1,2 @@
+conf.CHECK_FUNCS_IN('MD5Init', 'bsd', headers='bsd/md5.h',
+    checklibc=True)
diff --git a/lib/param/loadparm.c b/lib/param/loadparm.c
index ef1e7d9..44a3329 100644
--- a/lib/param/loadparm.c
+++ b/lib/param/loadparm.c
@@ -2566,6 +2566,9 @@ static bool set_variable(TALLOC_CTX *mem_ctx, int parmnum, void *parm_ptr,
 				return false;
 			}
 			break;
+
+		case P_SEP:
+			break;
 	}
 
 mark_non_default:
@@ -2968,6 +2971,8 @@ static bool is_default(struct loadparm_service *sDefault, int i)
 		case P_ENUM:
 			return parm_table[i].def.ivalue ==
 				*(int *)def_ptr;
+		case P_SEP:
+			break;
 	}
 	return false;
 }
diff --git a/lib/socket_wrapper/py_socket_wrapper.c b/lib/socket_wrapper/py_socket_wrapper.c
index 5c8af03..f5742d3 100644
--- a/lib/socket_wrapper/py_socket_wrapper.c
+++ b/lib/socket_wrapper/py_socket_wrapper.c
@@ -374,7 +374,7 @@ static PyObject *py_socket_getsockopt(pytalloc_Object *self, PyObject *args)
 {
 	int level, optname;
 	int *sock;
-	socklen_t optlen = -1, newlen;
+	socklen_t optlen = 0, newlen;
 	int optval;
 	bool is_integer = false;
 	char *buffer;
@@ -385,7 +385,7 @@ static PyObject *py_socket_getsockopt(pytalloc_Object *self, PyObject *args)
 		return NULL;
 	}
 
-	if (optlen < 0) {
+	if (optlen == 0) {
 		optlen = sizeof(int);
 		is_integer = true;
 	}
diff --git a/lib/util/charset/tests/charset.c b/lib/util/charset/tests/charset.c
index 351b91c..70b6741 100644
--- a/lib/util/charset/tests/charset.c
+++ b/lib/util/charset/tests/charset.c
@@ -21,6 +21,8 @@
 #include "includes.h"
 #include "torture/torture.h"
 
+struct torture_suite *torture_local_charset(TALLOC_CTX *mem_ctx);
+
 static bool test_toupper_m(struct torture_context *tctx)
 {
 	torture_assert_int_equal(tctx, toupper_m('c'), 'C', "c");
diff --git a/lib/util/charset/tests/convert_string.c b/lib/util/charset/tests/convert_string.c
index 918be49..92de702 100644
--- a/lib/util/charset/tests/convert_string.c
+++ b/lib/util/charset/tests/convert_string.c
@@ -23,6 +23,11 @@
 #include "lib/util/charset/charset.h"
 #include "param/param.h"
 
+struct torture_suite *torture_local_convert_string_handle(TALLOC_CTX *mem_ctx);
+struct torture_suite *torture_local_string_case_handle(TALLOC_CTX *mem_ctx);
+struct torture_suite *torture_local_convert_string(TALLOC_CTX *mem_ctx);
+struct torture_suite *torture_local_string_case(TALLOC_CTX *mem_ctx);
+
 /* The text below is in ancient and a latin charset transliteration of
  * greek, and an english translation.  It from Apology by Plato and sourced from
  * http://en.wikipedia.org/w/index.php?title=Ancient_Greek&oldid=421361065#Example_text
diff --git a/source4/ntvfs/posix/python/pyxattr_tdb.c b/source4/ntvfs/posix/python/pyxattr_tdb.c
index 7e59b54..7248560 100644
--- a/source4/ntvfs/posix/python/pyxattr_tdb.c
+++ b/source4/ntvfs/posix/python/pyxattr_tdb.c
@@ -92,7 +92,7 @@ static PyObject *py_wrap_getxattr(PyObject *self, PyObject *args)
 	}
 	status = pull_xattr_blob_tdb_raw(eadb, mem_ctx, attribute, filename, 
 									 -1, 100, &blob);
-	if (!NT_STATUS_IS_OK(status) || blob.length < 0) {
+	if (!NT_STATUS_IS_OK(status)) {
 		PyErr_SetNTSTATUS(status);
 		talloc_free(mem_ctx);
 		return NULL;
diff --git a/source4/scripting/python/samba/netcmd/__init__.py b/source4/scripting/python/samba/netcmd/__init__.py
index 6d7ca43..f0cf780 100644
--- a/source4/scripting/python/samba/netcmd/__init__.py
+++ b/source4/scripting/python/samba/netcmd/__init__.py
@@ -3,7 +3,6 @@
 # Unix SMB/CIFS implementation.
 # Copyright (C) Jelmer Vernooij <jelmer at samba.org> 2009-2011
 # Copyright (C) Theresa Halloran <theresahalloran at gmail.com> 2011
-# Copyright (C) Giampaolo Lauria <lauria2 at yahoo.com> 2011
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -71,11 +70,7 @@ class Command(object):
     synopsis = None
     takes_args = []
     takes_options = []
-    takes_optiongroups = {
-        "sambaopts": options.SambaOptions,
-        "credopts": options.CredentialsOptions,
-        "versionopts": options.VersionOptions,
-        }
+    takes_optiongroups = {}
 
     def __init__(self, outf=sys.stdout, errf=sys.stderr):
         self.outf = outf
diff --git a/source4/scripting/python/samba/netcmd/dbcheck.py b/source4/scripting/python/samba/netcmd/dbcheck.py
index 875b059..72b2f91 100644
--- a/source4/scripting/python/samba/netcmd/dbcheck.py
+++ b/source4/scripting/python/samba/netcmd/dbcheck.py
@@ -3,7 +3,6 @@
 # Samba4 AD database checker
 #
 # Copyright (C) Andrew Tridgell 2011
-# Copyright Giampaolo Lauria 2011 <lauria2 at yahoo.com>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -35,6 +34,12 @@ class cmd_dbcheck(Command):
     """check local AD database for errors"""
     synopsis = "%prog [<DN>] [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "versionopts": options.VersionOptions,
+        "credopts": options.CredentialsOptionsDouble,
+    }
+
     takes_args = ["DN?"]
 
     takes_options = [
diff --git a/source4/scripting/python/samba/netcmd/delegation.py b/source4/scripting/python/samba/netcmd/delegation.py
index 469579e..17901cd 100644
--- a/source4/scripting/python/samba/netcmd/delegation.py
+++ b/source4/scripting/python/samba/netcmd/delegation.py
@@ -5,7 +5,6 @@
 # Copyright Matthieu Patou mat at samba.org 2010
 # Copyright Stefan Metzmacher metze at samba.org 2011
 # Copyright Bjoern Baumbach bb at sernet.de 2011
-# Copyright Giampaolo Lauria 2011 <lauria2 at yahoo.com>
 #
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
@@ -41,6 +40,12 @@ class cmd_delegation_show(Command):
 
     synopsis = "%prog <accountname> [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["accountname"]
 
     def run(self, accountname, credopts=None, sambaopts=None, versionopts=None):
@@ -80,6 +85,12 @@ class cmd_delegation_for_any_service(Command):
 
     synopsis = "%prog <accountname> [(on|off)] [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["accountname", "onoff"]
 
     def run(self, accountname, onoff, credopts=None, sambaopts=None, versionopts=None):
@@ -116,6 +127,12 @@ class cmd_delegation_for_any_protocol(Command):
 
     synopsis = "%prog <accountname> [(on|off)] [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["accountname", "onoff"]
 
     def run(self, accountname, onoff, credopts=None, sambaopts=None, versionopts=None):
@@ -152,6 +169,12 @@ class cmd_delegation_add_service(Command):
 
     synopsis = "%prog <accountname> <principal> [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["accountname", "principal"]
 
     def run(self, accountname, principal, credopts=None, sambaopts=None, versionopts=None):
@@ -189,6 +212,12 @@ class cmd_delegation_del_service(Command):
 
     synopsis = "%prog <accountname> <principal> [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["accountname", "principal"]
 
     def run(self, accountname, principal, credopts=None, sambaopts=None, versionopts=None):
diff --git a/source4/scripting/python/samba/netcmd/domain.py b/source4/scripting/python/samba/netcmd/domain.py
index 1e26850..b0c174b 100644
--- a/source4/scripting/python/samba/netcmd/domain.py
+++ b/source4/scripting/python/samba/netcmd/domain.py
@@ -76,6 +76,12 @@ class cmd_domain_export_keytab(Command):
 
     synopsis = "%prog <keytab> [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_options = [
         Option("--principal", help="extract only this principal", type=str),
         ]
@@ -87,6 +93,7 @@ class cmd_domain_export_keytab(Command):
         net = Net(None, lp)
         net.export_keytab(keytab=keytab, principal=principal)
 
+
 class cmd_domain_info(Command):
     """Print basic info about a domain and the DC passed as parameter"""
 
@@ -95,6 +102,12 @@ class cmd_domain_info(Command):
     takes_options = [
         ]
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_args = ["address"]
 
     def run(self, address, credopts=None, sambaopts=None, versionopts=None):
@@ -112,12 +125,17 @@ class cmd_domain_info(Command):
             raise CommandError("Invalid IP address '" + address + "'!")
 
 
-
 class cmd_domain_join(Command):
     """Joins domain as either member or backup domain controller"""
 
     synopsis = "%prog <dnsdomain> [DC|RODC|MEMBER|SUBDOMAIN] [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "versionopts": options.VersionOptions,
+        "credopts": options.CredentialsOptions,
+    }
+
     takes_options = [
         Option("--server", help="DC to join", type=str),
         Option("--site", help="site to join", type=str),
@@ -190,6 +208,11 @@ class cmd_domain_demote(Command):
         Option("--targetdir", help="where provision is stored", type=str),
         ]
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
 
     def run(self, sambaopts=None, credopts=None,
             versionopts=None, server=None, targetdir=None):
@@ -232,9 +255,6 @@ class cmd_domain_demote(Command):
         print "Using %s as partner server for the demotion" % server
         (drsuapiBind, drsuapi_handle, supportedExtensions) = drsuapi_connect(server, lp, creds)
 
-
-
-
         print "Desactivating inbound replication"
 
         nmsg = ldb.Message()
@@ -407,8 +427,7 @@ class cmd_domain_demote(Command):
             except ldb.LdbError, l:
                 pass
 
-        print "Demote successfull"
-
+        self.outf.write("Demote successfull\n")
 
 
 class cmd_domain_level(Command):
@@ -416,6 +435,12 @@ class cmd_domain_level(Command):
 
     synopsis = "%prog (show|raise <options>) [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "credopts": options.CredentialsOptions,
+        "versionopts": options.VersionOptions,
+        }
+
     takes_options = [
         Option("-H", "--URL", help="LDB URL for database or target server", type=str,
                metavar="URL", dest="H"),
@@ -609,7 +634,6 @@ class cmd_domain_level(Command):
             raise CommandError("invalid argument: '%s' (choose from 'show', 'raise')" % subcommand)
 
 
-
 class cmd_domain_passwordsettings(Command):
     """Sets password settings
 
@@ -619,6 +643,12 @@ class cmd_domain_passwordsettings(Command):
 
     synopsis = "%prog (show|set <options>) [options]"
 
+    takes_optiongroups = {
+        "sambaopts": options.SambaOptions,
+        "versionopts": options.VersionOptions,
+        "credopts": options.CredentialsOptions,
+        }
+
     takes_options = [
         Option("-H", "--URL", help="LDB URL for database or target server", type=str,
                metavar="URL", dest="H"),
@@ -814,7 +844,7 @@ class cmd_domain_samba3upgrade(Command):
 
         if not os.path.exists(smbconf):
             raise CommandError("File %s does not exist" % smbconf)
-        
+
         if testparm and not os.path.exists(testparm):
             raise CommandError("Testparm utility %s does not exist" % testparm)
 
@@ -843,23 +873,29 @@ class cmd_domain_samba3upgrade(Command):
         if sambaopts.realm:
             s3conf.set("realm", sambaopts.realm)
 
+        if targetdir is not None:
+            if not os.path.isdir(targetdir):
+                os.mkdir(targetdir)
+
         eadb = True
         if use_xattrs == "yes":
             eadb = False
         elif use_xattrs == "auto" and not s3conf.get("posix:eadb"):
             if targetdir:
-                tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(targetdir))
+                tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(targetdir))
             else:
-                tmpfile = tempfile.NamedTemporaryFile(prefix=os.path.abspath(os.path.dirname(lp.get("private dir"))))
+                tmpfile = tempfile.NamedTemporaryFile(dir=os.path.abspath(os.path.dirname(lp.get("private dir"))))
             try:
-                samba.ntacls.setntacl(lp, tmpfile.name,
-                            "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
-                eadb = False
-            except Exception:
-                # FIXME: Don't catch all exceptions here
-                logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. "
-                            "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.")
-            tmpfile.close()
+                try:
+                    samba.ntacls.setntacl(lp, tmpfile.name,
+                                "O:S-1-5-32G:S-1-5-32", "S-1-5-32", "native")
+                    eadb = False
+                except Exception:
+                    # FIXME: Don't catch all exceptions here
+                    logger.info("You are not root or your system do not support xattr, using tdb backend for attributes. "
+                                "If you intend to use this provision in production, rerun the script as root on a system supporting xattrs.")
+            finally:
+                tmpfile.close()
 
         # Set correct default values from dbdir or testparm
         paths = {}
diff --git a/source4/scripting/python/samba/netcmd/drs.py b/source4/scripting/python/samba/netcmd/drs.py
index 0d93298..0b367e3 100644
--- a/source4/scripting/python/samba/netcmd/drs.py
+++ b/source4/scripting/python/samba/netcmd/drs.py
@@ -3,7 +3,6 @@
 # implement samba_tool drs commands
 #
 # Copyright Andrew Tridgell 2010
-# Copyright Giampaolo Lauria 2011 <lauria2 at yahoo.com>
 #


-- 
Samba Shared Repository


More information about the samba-cvs mailing list