[SCM] Samba Shared Repository - branch v4-3-stable updated

Karolin Seeger kseeger at samba.org
Wed Jun 15 07:07:43 UTC 2016


The branch, v4-3-stable has been updated
       via  65573bb VERSION: Disable git snapshots for the 4.3.10 release.
       via  8935d6e WHATSNEW: Add release notes for Samba 4.3.10.
       via  a23461d lib: replace: snprintf - Fix length calculation for hex/octal 64-bit values.
       via  136ed0e samba-too: Allow 'samba-tool fsmo' to cope with empty or missing fsmo roles
       via  2e81a93 s3:client:smbspool_krb5_wrapper: fix the non clearenv build.
       via  14bd198 Provide fallback code for non-portable clearenv(3)
       via  a304725 s3:selftest add a test for rpcclient --pw-nt-hash option
       via  e469ad2 s3:rpcclient make --pw-nt-hash option work
       via  5f3cfc8 s3-smbd: Support systemd 230
       via  4112991 s3-smbspool: Log to stderr
       via  58ba260 Fix memory leak in share mode locking.
       via  23663df s3-quotas: fix sysquotas_4B quota fetching for BSD
       via  2261c23 s3-net: Convert the key_name to UTF8 during migration
       via  40f1add packaging: Set default limit for core file size in service files
       via  fc385f3 packaging: Set default limit for core file size in init scripts
       via  9b09d3d packaging: Remove ulimit usage for setting core file size limit
       via  73c385c s3: auth: Move the declaration of struct dom_sid tmp_sid to function level scope.
       via  0128c11 s3:rpcclient: make use of SMB_SIGNING_IPC_DEFAULT
       via  6d9dbe9 smbd: Fix an assert
       via  ded212f s3:ntlm_auth: make ntlm_auth_generate_session_info() more complete
       via  f5eeb21 s3:smbd: fix anonymous authentication if signing is mandatory
       via  e44c9b6 libcli/auth: let msrpc_parse() return talloc'ed empty strings
       via  3a69922 s3:libsmb/clifile use correct value for MaxParameterCount for setting EAs
       via  ea96367 pdb: Fix segfault in pdb_ldap for missing gecos
       via  133e196 s3:libnet:libnet_join: add netbios aliases as SPNs
       via  313ba1d init: set core file size to unlimited by default
       via  6d7ed01 source3: Honor the core soft limit of the OS.
       via  568ce3b heimdal: encode/decode kvno as signed integer
       via  d926b8b vfs_fruit: add an option that allows disabling POSIX rename behaviour
       via  7916bd8 s3:smbd/filename remove smelly code
       via  859080c s3:smbd/service apply some code formatting
       via  e21f43a s3:smbd/service disable case-sensitivity for SMB2/3 connections
       via  4598743 Correctly set cli->raw_status for libsmbclient in SMB2 code
       via  a417e10 VERSION: Bump version up to 4.3.10...
      from  8e71328 VERSION: Disable git snapshots for the 4.3.9 release.

https://git.samba.org/?p=samba.git;a=shortlog;h=v4-3-stable


- Log -----------------------------------------------------------------
-----------------------------------------------------------------------

Summary of changes:
 VERSION                                            |   2 +-
 WHATSNEW.txt                                       | 104 ++++++++-
 docs-xml/manpages/vfs_fruit.8.xml                  |  11 +
 lib/replace/snprintf.c                             |   6 +-
 lib/util/become_daemon.c                           |  10 +-
 libcli/auth/msrpc_parse.c                          |  24 ++-
 packaging/RHEL-CTDB/setup/smb.init                 |   2 +
 packaging/RHEL-CTDB/setup/winbind.init             |   2 +
 packaging/RHEL/setup/smb.init                      |   2 +
 packaging/RHEL/setup/winbind.init                  |   2 +
 packaging/systemd/nmb.service                      |   1 +
 packaging/systemd/smb.service                      |   1 +
 packaging/systemd/winbind.service                  |   1 +
 python/samba/netcmd/fsmo.py                        | 233 ++++++++++++---------
 python/samba/tests/{auth.py => samba_tool/fsmo.py} |  22 +-
 source3/auth/token_util.c                          |   2 +-
 source3/client/smbspool.c                          |   2 +-
 source3/client/smbspool_krb5_wrapper.c             |  10 +
 source3/lib/dumpcore.c                             |  15 --
 source3/lib/sysquotas_4B.c                         |   6 +
 source3/libnet/libnet_join.c                       |  60 ++++++
 source3/libsmb/cli_smb2_fnum.c                     |  16 +-
 source3/libsmb/clifile.c                           |   2 +-
 source3/locking/share_mode_lock.c                  |   5 +
 source3/modules/vfs_fruit.c                        |   6 +-
 source3/passdb/pdb_ldap.c                          |   6 +-
 source3/rpcclient/rpcclient.c                      |  16 +-
 source3/script/tests/test_rpcclient_pw_nt_hash.sh  |  27 +++
 source3/selftest/tests.py                          |   5 +
 source3/smbd/filename.c                            |  28 ---
 source3/smbd/oplock.c                              |   1 +
 source3/smbd/service.c                             |  50 +++--
 source3/smbd/sesssetup.c                           |   8 +-
 source3/utils/net_printing.c                       |  90 +++++++-
 source3/utils/ntlm_auth.c                          |  51 ++++-
 source3/wscript                                    |   2 +-
 source4/heimdal/kdc/misc.c                         |   2 +-
 source4/heimdal/lib/asn1/krb5.asn1                 |   2 +-
 source4/selftest/tests.py                          |   4 +
 source4/torture/rpc/lsa.c                          |   2 +-
 40 files changed, 626 insertions(+), 215 deletions(-)
 copy python/samba/tests/{auth.py => samba_tool/fsmo.py} (59%)
 create mode 100755 source3/script/tests/test_rpcclient_pw_nt_hash.sh


Changeset truncated at 500 lines:

diff --git a/VERSION b/VERSION
index 31ec5b1..a907a4b 100644
--- a/VERSION
+++ b/VERSION
@@ -25,7 +25,7 @@
 ########################################################
 SAMBA_VERSION_MAJOR=4
 SAMBA_VERSION_MINOR=3
-SAMBA_VERSION_RELEASE=9
+SAMBA_VERSION_RELEASE=10
 
 ########################################################
 # If a official release has a serious bug              #
diff --git a/WHATSNEW.txt b/WHATSNEW.txt
index 4e461bc..4bad9ab 100644
--- a/WHATSNEW.txt
+++ b/WHATSNEW.txt
@@ -1,3 +1,104 @@
+                   ==============================
+                   Release Notes for Samba 4.3.10
+                            June 15, 2016
+                   ==============================
+
+
+This is the latest stable release of Samba 4.3.
+
+
+Changes since 4.3.9:
+--------------------
+
+o  Jeremy Allison <jra at samba.org>
+   * BUG 10618: Do not ignore supplementary groups.
+
+o  Christian Ambach <ambi at samba.org>
+   * BUG 10796: s3:rpcclient: Make '--pw-nt-hash' option work.
+   * BUG 11354: s3:libsmb/clifile: Use correct value for MaxParameterCount for
+     setting EAs.
+   * BUG 11438: s3:smbd/service disable case-sensitivity for SMB2/3 connections.
+
+o  Ralph Boehme <slow at samba.org>
+   * BUG 1703: s3:libnet:libnet_join: Add netbios aliases as SPNs.
+   * BUG 11721: vfs_fruit: Add an option that allows disabling POSIX rename
+     behaviour.
+
+o  Alexander Bokovoy <ab at samba.org>
+   * BUG 11936: s3-smbd: Support systemd 230.
+
+o  Jérémie Courrèges-Anglas <jca at wxcvbn.org>
+   * BUG 11864: Provide fallback code for non-portable clearenv(3).
+
+o  Günther Deschner <gd at samba.org>
+   * BUG 11864: s3:client:smbspool_krb5_wrapper: fix the non clearenv build.
+
+o  Robin McCorkell <robin at mccorkell.me.uk>
+   * BUG 11276: Correctly set cli->raw_status for libsmbclient in SMB2 code.
+
+o  Stefan Metzmacher <metze at samba.org>
+   * BUG 11910: s3:smbd: Fix anonymous authentication if signing is mandatory.
+   * BUG 11912: libcli/auth: Let msrpc_parse() return talloc'ed empty strings.
+   * BUG 11914: s3:ntlm_auth: Make ntlm_auth_generate_session_info() more
+     complete.
+   * BUG 11927: s3:rpcclient: Make use of SMB_SIGNING_IPC_DEFAULT.
+
+o  Luca Olivetti <luca at wetron.es>
+   * BUG 11530: pdb: Fix segfault in pdb_ldap for missing gecos.
+
+o  Rowland Penny <rpenny at samba.org>
+   * BUG 11613: samba-tool: Allow 'samba-tool fsmo' to cope with empty or missing
+     fsmo roles.
+
+o  Anoop C S <anoopcs at redhat.com>
+   * BUG 11907: packaging: Set default limit for core file size in service
+     files.
+
+o  Andreas Schneider <asn at samba.org>
+   * BUG 11922: s3-net: Convert the key_name to UTF8 during migration.
+   * BUG 11935: s3-smbspool: Log to stderr.
+
+o  Uri Simchoni <uri at samba.org>
+   * BUG 11900: heimdal: Encode/decode kvno as signed integer.
+   * BUG 11931: s3-quotas: Fix sysquotas_4B quota fetching for BSD.
+
+o  Raghavendra Talur <rtalur at redhat.com>
+   * BUG 11907: init: Set core file size to unlimited by default.
+
+o  Hemanth Thummala <hemanth.thummala at nutanix.com>
+   * BUG 11934: Fix memory leak in share mode locking.
+
+o  Volker Lendecke <vl at samba.org>
+   * BUG 11844: smbd: Fix an assert.
+
+o  Lorinczy Zsigmond <lzsiga at freemail.c3.hu>
+   * BUG 11947: lib: replace: snprintf - Fix length calculation for hex/octal
+     64-bit values.
+
+
+#######################################
+Reporting bugs & Development Discussion
+#######################################
+
+Please discuss this release on the samba-technical mailing list or by
+joining the #samba-technical IRC channel on irc.freenode.net.
+
+If you do report problems then please try to send high quality
+feedback. If you don't provide vital information to help us track down
+the problem then you will probably be ignored.  All bug reports should
+be filed under the "Samba 4.1 and newer" product in the project's Bugzilla
+database (https://bugzilla.samba.org/).
+
+
+======================================================================
+== Our Code, Our Bugs, Our Responsibility.
+== The Samba Team
+======================================================================
+
+
+Release notes for older releases follow:
+----------------------------------------
+
                    =============================
                    Release Notes for Samba 4.3.9
                             May 2, 2016
@@ -108,8 +209,7 @@ database (https://bugzilla.samba.org/).
 ======================================================================
 
 
-Release notes for older releases follow:
-----------------------------------------
+----------------------------------------------------------------------
 
 
                    =============================
diff --git a/docs-xml/manpages/vfs_fruit.8.xml b/docs-xml/manpages/vfs_fruit.8.xml
index 80c565c..9f38dff 100644
--- a/docs-xml/manpages/vfs_fruit.8.xml
+++ b/docs-xml/manpages/vfs_fruit.8.xml
@@ -226,6 +226,17 @@
 	    </listitem>
 	  </varlistentry>
 
+	  <varlistentry>
+	    <term>fruit:posix_rename = yes | no</term>
+	    <listitem>
+	      <para>Whether to enable POSIX directory rename behaviour
+	      for OS X clients. Without this, directories can't be
+	      renamed if any client has any file inside it
+	      (recursive!) open.</para>
+	      <para>The default is <emphasis>yes</emphasis>.</para>
+	    </listitem>
+	  </varlistentry>
+
 	</variablelist>
 </refsect1>
 
diff --git a/lib/replace/snprintf.c b/lib/replace/snprintf.c
index 86ba74c..63eb036 100644
--- a/lib/replace/snprintf.c
+++ b/lib/replace/snprintf.c
@@ -804,7 +804,7 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
 {
 	int signvalue = 0;
 	unsigned LLONG uvalue;
-	char convert[20];
+	char convert[22+1]; /* 64-bit value in octal: 22 digits + \0 */
 	int place = 0;
 	int spadlen = 0; /* amount to space pad */
 	int zpadlen = 0; /* amount to zero pad */
@@ -834,8 +834,8 @@ static void fmtint(char *buffer, size_t *currlen, size_t maxlen,
 			(caps? "0123456789ABCDEF":"0123456789abcdef")
 			[uvalue % (unsigned)base  ];
 		uvalue = (uvalue / (unsigned)base );
-	} while(uvalue && (place < 20));
-	if (place == 20) place--;
+	} while(uvalue && (place < sizeof(convert)));
+	if (place == sizeof(convert)) place--;
 	convert[place] = 0;
 
 	zpadlen = max - place;
diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 4622971..9979fad 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -24,7 +24,7 @@
 #include "includes.h"
 #include "system/filesys.h"
 #include "system/locale.h"
-#if HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
 #include <systemd/sd-daemon.h>
 #endif
 #include "lib/util/close_low_fd.h"
@@ -69,7 +69,7 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
 	if (do_fork) {
 		newpid = fork();
 		if (newpid) {
-#if HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
 			sd_notifyf(0, "READY=0\nSTATUS=Starting process...\nMAINPID=%lu", (unsigned long) newpid);
 #endif /* HAVE_LIBSYSTEMD_DAEMON */
 			_exit(0);
@@ -98,7 +98,7 @@ _PUBLIC_ void become_daemon(bool do_fork, bool no_process_group, bool log_stdout
 
 _PUBLIC_ void exit_daemon(const char *msg, int error)
 {
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
 	if (msg == NULL) {
 		msg = strerror(error);
 	}
@@ -117,7 +117,7 @@ _PUBLIC_ void daemon_ready(const char *name)
 	if (name == NULL) {
 		name = "Samba";
 	}
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
 	sd_notifyf(0, "READY=1\nSTATUS=%s: ready to serve connections...", name);
 #endif
 	DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve "
@@ -129,7 +129,7 @@ _PUBLIC_ void daemon_status(const char *name, const char *msg)
 	if (name == NULL) {
 		name = "Samba";
 	}
-#ifdef HAVE_LIBSYSTEMD_DAEMON
+#if defined(HAVE_LIBSYSTEMD_DAEMON) || defined(HAVE_LIBSYSTEMD)
 	sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
 #endif
 	DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));
diff --git a/libcli/auth/msrpc_parse.c b/libcli/auth/msrpc_parse.c
index d499d9e..74a7bcc 100644
--- a/libcli/auth/msrpc_parse.c
+++ b/libcli/auth/msrpc_parse.c
@@ -262,7 +262,11 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx,
 
 			ps = va_arg(ap, char **);
 			if (len1 == 0 && len2 == 0) {
-				*ps = (char *)discard_const("");
+				*ps = talloc_strdup(mem_ctx, "");
+				if (*ps == NULL) {
+					ret = false;
+					goto cleanup;
+				}
 			} else {
 				/* make sure its in the right format - be strict */
 				if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) {
@@ -289,7 +293,11 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx,
 						goto cleanup;
 					}
 				} else {
-					(*ps) = (char *)discard_const("");
+					*ps = talloc_strdup(mem_ctx, "");
+					if (*ps == NULL) {
+						ret = false;
+						goto cleanup;
+					}
 				}
 			}
 			break;
@@ -302,7 +310,11 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx,
 			ps = (char **)va_arg(ap, char **);
 			/* make sure its in the right format - be strict */
 			if (len1 == 0 && len2 == 0) {
-				*ps = (char *)discard_const("");
+				*ps = talloc_strdup(mem_ctx, "");
+				if (*ps == NULL) {
+					ret = false;
+					goto cleanup;
+				}
 			} else {
 				if ((len1 != len2) || (ptr + len1 < ptr) || (ptr + len1 < len1) || (ptr + len1 > blob->length)) {
 					ret = false;
@@ -325,7 +337,11 @@ bool msrpc_parse(TALLOC_CTX *mem_ctx,
 						goto cleanup;
 					}
 				} else {
-					(*ps) = (char *)discard_const("");
+					*ps = talloc_strdup(mem_ctx, "");
+					if (*ps == NULL) {
+						ret = false;
+						goto cleanup;
+					}
 				}
 			}
 			break;
diff --git a/packaging/RHEL-CTDB/setup/smb.init b/packaging/RHEL-CTDB/setup/smb.init
index 4dd5b23..39bf0a8 100644
--- a/packaging/RHEL-CTDB/setup/smb.init
+++ b/packaging/RHEL-CTDB/setup/smb.init
@@ -18,6 +18,8 @@ else
   exit 0
 fi
 
+DAEMON_COREFILE_LIMIT='unlimited'
+
 # Avoid using root's TMPDIR
 unset TMPDIR
 
diff --git a/packaging/RHEL-CTDB/setup/winbind.init b/packaging/RHEL-CTDB/setup/winbind.init
index a99038f..2a9dd82 100644
--- a/packaging/RHEL-CTDB/setup/winbind.init
+++ b/packaging/RHEL-CTDB/setup/winbind.init
@@ -16,6 +16,8 @@ else
   exit 0
 fi
 
+DAEMON_COREFILE_LIMIT='unlimited'
+
 # Avoid using root's TMPDIR
 unset TMPDIR
 
diff --git a/packaging/RHEL/setup/smb.init b/packaging/RHEL/setup/smb.init
index af85b2c..96fb74a 100644
--- a/packaging/RHEL/setup/smb.init
+++ b/packaging/RHEL/setup/smb.init
@@ -18,6 +18,8 @@ else
   exit 0
 fi
 
+DAEMON_COREFILE_LIMIT='unlimited'
+
 # Avoid using root's TMPDIR
 unset TMPDIR
 
diff --git a/packaging/RHEL/setup/winbind.init b/packaging/RHEL/setup/winbind.init
index a99038f..2a9dd82 100644
--- a/packaging/RHEL/setup/winbind.init
+++ b/packaging/RHEL/setup/winbind.init
@@ -16,6 +16,8 @@ else
   exit 0
 fi
 
+DAEMON_COREFILE_LIMIT='unlimited'
+
 # Avoid using root's TMPDIR
 unset TMPDIR
 
diff --git a/packaging/systemd/nmb.service b/packaging/systemd/nmb.service
index 3d71a7d..992c0cd 100644
--- a/packaging/systemd/nmb.service
+++ b/packaging/systemd/nmb.service
@@ -9,6 +9,7 @@ PIDFile=/run/nmbd.pid
 EnvironmentFile=-/etc/sysconfig/samba
 ExecStart=/usr/sbin/nmbd $NMBDOPTIONS
 ExecReload=/usr/bin/kill -HUP $MAINPID
+LimitCORE=infinity
 
 [Install]
 WantedBy=multi-user.target
diff --git a/packaging/systemd/smb.service b/packaging/systemd/smb.service
index 9810891..6053a5c 100644
--- a/packaging/systemd/smb.service
+++ b/packaging/systemd/smb.service
@@ -10,6 +10,7 @@ LimitNOFILE=16384
 EnvironmentFile=-/etc/sysconfig/samba
 ExecStart=/usr/sbin/smbd $SMBDOPTIONS
 ExecReload=/usr/bin/kill -HUP $MAINPID
+LimitCORE=infinity
 
 [Install]
 WantedBy=multi-user.target
diff --git a/packaging/systemd/winbind.service b/packaging/systemd/winbind.service
index f711a17..c511488 100644
--- a/packaging/systemd/winbind.service
+++ b/packaging/systemd/winbind.service
@@ -9,6 +9,7 @@ PIDFile=/run/winbindd.pid
 EnvironmentFile=-/etc/sysconfig/samba
 ExecStart=/usr/sbin/winbindd "$WINBINDOPTIONS"
 ExecReload=/usr/bin/kill -HUP $MAINPID
+LimitCORE=infinity
 
 [Install]
 WantedBy=multi-user.target
diff --git a/python/samba/netcmd/fsmo.py b/python/samba/netcmd/fsmo.py
index 3904bcb..3d14939 100644
--- a/python/samba/netcmd/fsmo.py
+++ b/python/samba/netcmd/fsmo.py
@@ -31,17 +31,26 @@ from samba.netcmd import (
     )
 from samba.samdb import SamDB
 
-def get_fsmo_roleowner(samdb, roledn):
+def get_fsmo_roleowner(samdb, roledn, role):
     """Gets the owner of an FSMO role
 
     :param roledn: The DN of the FSMO role
+    :param role: The FSMO role
     """
-    res = samdb.search(roledn,
-                       scope=ldb.SCOPE_BASE, attrs=["fSMORoleOwner"])
-    if len(res) == 0:
-        raise CommandError('"%s" does not have a FSMO roleowner' % roledn)
-    master_owner = res[0]["fSMORoleOwner"][0]
-    return master_owner
+    try:
+        res = samdb.search(roledn,
+                           scope=ldb.SCOPE_BASE, attrs=["fSMORoleOwner"])
+    except LdbError, (num, msg):
+        if num == ldb.ERR_NO_SUCH_OBJECT:
+            return "* The '%s' role is not present in this domain" % role
+        raise
+
+    if 'fSMORoleOwner' in res[0]:
+        master_owner = res[0]["fSMORoleOwner"][0]
+        return master_owner
+    else:
+        master_owner = "* The '%s' role does not have an FSMO roleowner" % role
+        return master_owner
 
 
 def transfer_dns_role(outf, sambaopts, credopts, role, samdb):
@@ -54,23 +63,23 @@ def transfer_dns_role(outf, sambaopts, credopts, role, samdb):
         forest_dn = samba.dn_from_dns_name(samdb.forest_dns_name())
         role_object = "CN=Infrastructure,DC=ForestDnsZones," + forest_dn
 
-    try:
-        res = samdb.search(role_object,
-                           attrs=["fSMORoleOwner"],
-                           scope=ldb.SCOPE_BASE,
-                           controls=["extended_dn:1:1"])
+    res = samdb.search(role_object,
+                       attrs=["fSMORoleOwner"],
+                       scope=ldb.SCOPE_BASE,
+                       controls=["extended_dn:1:1"])
 
-        if 'fSMORoleOwner' in res[0]:
-            try:
-                master_guid = str(misc.GUID(ldb.Dn(samdb,
-                                  res[0]['fSMORoleOwner'][0])
-                                  .get_extended_component('GUID')))
-                master_owner = str(ldb.Dn(samdb, res[0]['fSMORoleOwner'][0]))
-            except LdbError, (num, msg):
-                raise CommandError("GUID not found in partition naming master DN %s : %s \n" %
-                                   (res[0]['fSMORoleOwner'][0], msg))
-    except LdbError, (num, msg):
-        raise CommandError("DNS partion %s not found : %s" % (role, msg))
+    if 'fSMORoleOwner' in res[0]:
+        try:
+            master_guid = str(misc.GUID(ldb.Dn(samdb,
+                              res[0]['fSMORoleOwner'][0])
+                              .get_extended_component('GUID')))
+            master_owner = str(ldb.Dn(samdb, res[0]['fSMORoleOwner'][0]))
+        except LdbError, (num, msg):
+            raise CommandError("No GUID found in naming master DN %s : %s \n" %
+                               (res[0]['fSMORoleOwner'][0], msg))
+    else:
+        outf.write("* The '%s' role does not have an FSMO roleowner\n" % role)
+        return False
 
     if role == "domaindns":
         master_dns_name = '%s._msdcs.%s' % (master_guid,
@@ -150,12 +159,12 @@ def transfer_role(outf, role, samdb):
     m = ldb.Message()
     m.dn = ldb.Dn(samdb, "")
     if role == "rid":
-        master_owner = get_fsmo_roleowner(samdb, rid_dn)
+        master_owner = get_fsmo_roleowner(samdb, rid_dn, role)
         m["becomeRidMaster"]= ldb.MessageElement(
             "1", ldb.FLAG_MOD_REPLACE,
             "becomeRidMaster")
     elif role == "pdc":
-        master_owner = get_fsmo_roleowner(samdb, domain_dn)
+        master_owner = get_fsmo_roleowner(samdb, domain_dn, role)
 
         res = samdb.search(domain_dn,
                            scope=ldb.SCOPE_BASE, attrs=["objectSid"])
@@ -165,34 +174,38 @@ def transfer_role(outf, role, samdb):
             sid, ldb.FLAG_MOD_REPLACE,
             "becomePdc")
     elif role == "naming":
-        master_owner = get_fsmo_roleowner(samdb, naming_dn)
+        master_owner = get_fsmo_roleowner(samdb, naming_dn, role)
         m["becomeDomainMaster"]= ldb.MessageElement(
             "1", ldb.FLAG_MOD_REPLACE,
             "becomeDomainMaster")
     elif role == "infrastructure":
-        master_owner = get_fsmo_roleowner(samdb, infrastructure_dn)
+        master_owner = get_fsmo_roleowner(samdb, infrastructure_dn, role)
         m["becomeInfrastructureMaster"]= ldb.MessageElement(
             "1", ldb.FLAG_MOD_REPLACE,
             "becomeInfrastructureMaster")
     elif role == "schema":
-        master_owner = get_fsmo_roleowner(samdb, schema_dn)
+        master_owner = get_fsmo_roleowner(samdb, schema_dn, role)
         m["becomeSchemaMaster"]= ldb.MessageElement(
             "1", ldb.FLAG_MOD_REPLACE,
             "becomeSchemaMaster")
     else:
         raise CommandError("Invalid FSMO role.")
 
-    if master_owner != new_owner:
-        try:
-            samdb.modify(m)
-        except LdbError, (num, msg):
-            raise CommandError("Transfer of '%s' role failed: %s" %
-                               (role, msg))
+    if not '*' in master_owner:
+        if master_owner != new_owner:
+            try:
+                samdb.modify(m)
+            except LdbError, (num, msg):
+                raise CommandError("Transfer of '%s' role failed: %s" %


-- 
Samba Shared Repository



More information about the samba-cvs mailing list