[SCM] Samba Shared Repository - branch master updated

Andrew Bartlett abartlet at samba.org
Sat Mar 2 15:35:02 MST 2013


The branch, master has been updated
       via  c692bb0 Handle EMSGSIZE on UNIX domain sockets.
       via  606f5d6 samba-tool ldapcmp: Add --skip-missing-dn to not error on DNs present in one DB but not the other
       via  161fa15 samba-tool domain classicupgrade: Fix typo in error path for multiple account flags
       via  669c302 samba-tool domain classicupgrade: Print a better error when the ldap backend PW was not found
       via  68f13f5 samba-tool dbcheck: fix comment on err_wrong_sd
      from  2cfbfa6 Remove incomplete check for IPv6 link-local addresses.

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


- Log -----------------------------------------------------------------
commit c692bb02b039ae8fef6ba968fd13b36ad7d62a72
Author: Landon Fuller <landonf at bikemonkey.org>
Date:   Sat Mar 2 14:08:47 2013 -0500

    Handle EMSGSIZE on UNIX domain sockets.
    
    On some systems (eg, FreeBSD) the default SO_SNDBUF for UNIX
    domain sockets is to small, and EMSGSIZE is returned. Other
    systems provide a larger default send buffer, but there is
    still no guarantee that the buffer will be sized appropriately.
    
    This patch modifies the sendto() path to attempt to resize
    the SO_SNDBUF dynamically upon an EMSGSIZE failure, and then
    retry the send.
    
    This fixes local DCE/RPC errors on FreeBSD, eg:
    
    https://lists.samba.org/archive/samba-technical/2013-January/089881.html
    
    Signed-Off-By: Landon Fuller <landonf at bikemonkey.org>
    
    Reviewed-by: Andrew Bartlett <abartlet at samba.org>
    
    Autobuild-User(master): Andrew Bartlett <abartlet at samba.org>
    Autobuild-Date(master): Sat Mar  2 23:34:03 CET 2013 on sn-devel-104

commit 606f5d6cc6b018259ba0306fe3b55e21b4b70fdb
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Thu Feb 14 14:59:28 2013 +1100

    samba-tool ldapcmp: Add --skip-missing-dn to not error on DNs present in one DB but not the other
    
    This is needed to compare some parts of the database, particularly in --two mode, which
    are just never going to have exactly the same DNs.
    
    Andrew Bartlett
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 161fa15697fab9effbe1db9640cece847dcf63cd
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Feb 12 09:20:03 2013 +1100

    samba-tool domain classicupgrade: Fix typo in error path for multiple account flags
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 669c302f2d78ab4bbd35982373ae079246c8979d
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Tue Jan 15 21:53:30 2013 +1100

    samba-tool domain classicupgrade: Print a better error when the ldap backend PW was not found
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

commit 68f13f5d7e80f2041e140a12fc2f7139561c83ce
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Mon Feb 11 14:50:49 2013 +1100

    samba-tool dbcheck: fix comment on err_wrong_sd
    
    Reviewed-by: Stefan Metzmacher <metze at samba.org>

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

Summary of changes:
 python/samba/dbchecker.py        |    3 +--
 python/samba/netcmd/ldapcmp.py   |   15 ++++++++++-----
 python/samba/upgrade.py          |    7 +++++--
 source4/lib/socket/socket_unix.c |   35 ++++++++++++++++++++++++++---------
 4 files changed, 42 insertions(+), 18 deletions(-)


Changeset truncated at 500 lines:

diff --git a/python/samba/dbchecker.py b/python/samba/dbchecker.py
index 06fd827..297a065 100644
--- a/python/samba/dbchecker.py
+++ b/python/samba/dbchecker.py
@@ -692,8 +692,7 @@ newSuperior: %s""" % (str(from_dn), str(to_rdn), str(to_base)))
         return (sd, None)
 
     def err_wrong_sd(self, dn, sd, sd_broken):
-        '''re-write replPropertyMetaData elements for a single attribute for a
-        object. This is used to fix missing replPropertyMetaData elements'''
+        '''re-write the SD due to incorrect inherited ACEs'''
         sd_attr = "nTSecurityDescriptor"
         sd_val = ndr_pack(sd)
         sd_flags = security.SECINFO_DACL | security.SECINFO_SACL
diff --git a/python/samba/netcmd/ldapcmp.py b/python/samba/netcmd/ldapcmp.py
index 8398205..3c6c5f1 100644
--- a/python/samba/netcmd/ldapcmp.py
+++ b/python/samba/netcmd/ldapcmp.py
@@ -45,7 +45,7 @@ class LDAPBase(object):
     def __init__(self, host, creds, lp,
                  two=False, quiet=False, descriptor=False, sort_aces=False, verbose=False,
                  view="section", base="", scope="SUB",
-                 outf=sys.stdout, errf=sys.stderr):
+                 outf=sys.stdout, errf=sys.stderr, skip_missing_dn=True):
         ldb_options = []
         samdb_url = host
         if not "://" in host:
@@ -71,6 +71,7 @@ class LDAPBase(object):
         self.view = view
         self.verbose = verbose
         self.host = host
+        self.skip_missing_dn = skip_missing_dn
         self.base_dn = str(self.ldb.get_default_basedn())
         self.root_dn = str(self.ldb.get_root_basedn())
         self.config_dn = str(self.ldb.get_config_basedn())
@@ -686,6 +687,7 @@ class LDAPBundel(object):
         self.verbose = self.con.verbose
         self.search_base = self.con.search_base
         self.search_scope = self.con.search_scope
+        self.skip_missing_dn = self.con.skip_missing_dn
         self.summary = {}
         self.summary["unique_attrs"] = []
         self.summary["df_value_attrs"] = []
@@ -729,7 +731,8 @@ class LDAPBundel(object):
         res = True
         if self.size != other.size:
             self.log( "\n* DN lists have different size: %s != %s" % (self.size, other.size) )
-            res = False
+            if not self.skip_missing_dn:
+                res = False
         #
         # This is the case where we want to explicitly compare two objects with different DNs.
         # It does not matter if they are in the same DC, in two DC in one domain or in two
@@ -738,7 +741,7 @@ class LDAPBundel(object):
             title= "\n* DNs found only in %s:" % self.con.host
             for x in self.dn_list:
                 if not x.upper() in [q.upper() for q in other.dn_list]:
-                    if title:
+                    if title and not self.skip_missing_dn:
                         self.log( title )
                         title = None
                         res = False
@@ -749,7 +752,7 @@ class LDAPBundel(object):
             title= "\n* DNs found only in %s:" % other.con.host
             for x in other.dn_list:
                 if not x.upper() in [q.upper() for q in self.dn_list]:
-                    if title:
+                    if title and not self.skip_missing_dn:
                         self.log( title )
                         title = None
                         res = False
@@ -902,13 +905,15 @@ class cmd_ldapcmp(Command):
             help="Pass search scope that builds DN list. Options: SUB, ONE, BASE"),
         Option("--filter", dest="filter", default="",
             help="List of comma separated attributes to ignore in the comparision"),
+        Option("--skip-missing-dn", dest="skip_missing_dn", action="store_true", default=False,
+            help="Skip report and failure due to missing DNs in one server or another"),
         ]
 
     def run(self, URL1, URL2,
             context1=None, context2=None, context3=None,
             two=False, quiet=False, verbose=False, descriptor=False, sort_aces=False,
             view="section", base="", base2="", scope="SUB", filter="",
-            credopts=None, sambaopts=None, versionopts=None):
+            credopts=None, sambaopts=None, versionopts=None, skip_missing_dn=False):
 
         lp = sambaopts.get_loadparm()
 
diff --git a/python/samba/upgrade.py b/python/samba/upgrade.py
index d680a7c..8371224 100644
--- a/python/samba/upgrade.py
+++ b/python/samba/upgrade.py
@@ -598,7 +598,10 @@ def upgrade_from_samba3(samba3, logger, targetdir, session_info=None,
     if samba3.lp.get("passdb backend").split(":")[0].strip() == "ldapsam":
         base_dn =  samba3.lp.get("ldap suffix")
         ldapuser = samba3.lp.get("ldap admin dn")
-        ldappass = (secrets_db.get_ldap_bind_pw(ldapuser)).strip('\x00')
+        ldappass = secrets_db.get_ldap_bind_pw(ldapuser)
+        if ldappass is None:
+            raise ProvisioningError("ldapsam passdb backend detected but no LDAP Bind PW found in secrets.tdb for user %s.  Please point this tool at the secrets.tdb that was used by the previous installation.")
+        ldappass = ldappass.strip('\x00')
         ldap = True
     else:
         ldapuser = None
@@ -719,7 +722,7 @@ ACB_NORMAL (N, 0x%08X), ACB_WSTRUST (W 0x%08X), ACB_SVRTRUST (S 0x%08X) or ACB_D
 
 Please fix this account before attempting to upgrade again
 """
-                                    % (user.acct_flags, username,
+                                    % (username, user.acct_ctrl,
                                        samr.ACB_NORMAL, samr.ACB_WSTRUST, samr.ACB_SVRTRUST, samr.ACB_DOMTRUST))
 
         userdata[username] = user
diff --git a/source4/lib/socket/socket_unix.c b/source4/lib/socket/socket_unix.c
index 4755e79..049e570 100644
--- a/source4/lib/socket/socket_unix.c
+++ b/source4/lib/socket/socket_unix.c
@@ -263,26 +263,43 @@ static NTSTATUS unixdom_sendto(struct socket_context *sock,
 			       const DATA_BLOB *blob, size_t *sendlen, 
 			       const struct socket_address *dest)
 {
+	struct sockaddr_un srv_addr;
+	const struct sockaddr *sa;
+	socklen_t sa_len;
 	ssize_t len;
+
 	*sendlen = 0;
-		
+
 	if (dest->sockaddr) {
-		len = sendto(sock->fd, blob->data, blob->length, 0, 
-			     dest->sockaddr, dest->sockaddrlen);
+		sa = dest->sockaddr;
+		sa_len = dest->sockaddrlen;
 	} else {
-		struct sockaddr_un srv_addr;
-		
 		if (strlen(dest->addr)+1 > sizeof(srv_addr.sun_path)) {
 			return NT_STATUS_OBJECT_PATH_INVALID;
 		}
-		
+
 		ZERO_STRUCT(srv_addr);
 		srv_addr.sun_family = AF_UNIX;
-		snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s", dest->addr);
+		snprintf(srv_addr.sun_path, sizeof(srv_addr.sun_path), "%s",
+			 dest->addr);
+		sa = (struct sockaddr *) &srv_addr;
+		sa_len = sizeof(srv_addr);
+	}
+
+	len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len);
 
-		len = sendto(sock->fd, blob->data, blob->length, 0, 
-			     (struct sockaddr *)&srv_addr, sizeof(srv_addr));
+	/* retry once */
+	if (len == -1 && errno == EMSGSIZE) {
+		/* round up in 1K increments */
+		int bufsize = ((blob->length + 1023) & (~1023));
+		if (setsockopt(sock->fd, SOL_SOCKET, SO_SNDBUF, &bufsize,
+			       sizeof(bufsize)) == -1)
+		{
+			return map_nt_error_from_unix_common(errno);
+		}
+		len = sendto(sock->fd, blob->data, blob->length, 0, sa, sa_len);
 	}
+
 	if (len == -1) {
 		return map_nt_error_from_unix_common(errno);
 	}	


-- 
Samba Shared Repository


More information about the samba-cvs mailing list