[SCM] Samba Shared Repository - branch v4-0-test updated

Karolin Seeger kseeger at samba.org
Wed Oct 31 04:37:03 MDT 2012


The branch, v4-0-test has been updated
       via  f40bfca packaging: Add NetworkManager dispatcher script for winbind.
       via  1ce0680 BUG 9326: Fix net ads join message for the dns domain.
       via  b5a9e17 lib/replace: Return size of xattr if size argument is 0
       via  a210201 s3: vfs_streams_depot: add delete_lost option (bug #9300)
       via  0c454c5 s3: make recursive_rmdir function non-static
      from  7e100a2 WHATSNEW: Correct list of changed parameters.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v4-0-test


- Log -----------------------------------------------------------------
commit f40bfcaf4ce8e6a9001d843bbc48505b769d2777
Author: Andreas Schneider <asn at cryptomilk.org>
Date:   Fri Oct 26 12:46:21 2012 +0200

    packaging: Add NetworkManager dispatcher script for winbind.
    
    Signed-off-by: Andreas Schneider <asn at cryptomilk.org>
    Signed-off-by: Andreas Schneider <asn at samba.org>
    
    https://bugzilla.samba.org/show_bug.cgi?id=9336
    Add NetworkManager dispatcher script for winbind (systemd) (edit)
    
    Autobuild-User(v4-0-test): Karolin Seeger <kseeger at samba.org>
    Autobuild-Date(v4-0-test): Wed Oct 31 11:36:42 CET 2012 on sn-devel-104

commit 1ce06808962e62cc2f9c8f2c58eb488f3ff0df59
Author: Andreas Schneider <asn at samba.org>
Date:   Tue Oct 23 17:12:59 2012 +0200

    BUG 9326: Fix net ads join message for the dns domain.
    
    We don't get a realm back from the server which is useable as a realm on
    Unix. On Unix they are case sensitive and on Windows they aren't. This
    confuses uses and if we write realm they try to use it as it came back
    in lowercase.
    
    Signed-off-by: Andreas Schneider <asn at samba.org>

commit b5a9e1799d4e270a7061834d6a48d9effb29dedb
Author: Andrew Bartlett <abartlet at samba.org>
Date:   Sat Oct 27 19:15:58 2012 +1100

    lib/replace: Return size of xattr if size argument is 0
    
    This makes rep_{f,}getxattr a more complete replacement for the linux function.
    
    Andrew Bartlett
    
    https://bugzilla.samba.org/show_bug.cgi?id=9338
    libreplace does not replace getxattr correctly for 0 length semantics

commit a210201abc243faeb78316559487c25a6e78d8ab
Author: Björn Baumbach <bb at sernet.de>
Date:   Thu Sep 27 12:40:47 2012 +0200

    s3: vfs_streams_depot: add delete_lost option (bug #9300)
    
    With this option lost stream directories will be removed
    instead of renamed.
    
    Autobuild-User(master): Volker Lendecke <vl at samba.org>
    Autobuild-Date(master): Mon Oct  1 18:47:30 CEST 2012 on sn-devel-104
    (cherry picked from commit 8da8a2289ea51d4fcdf6b5352a46c14d36d8f072)

commit 0c454c5810ff26967da40d01979bb55982a8a50f
Author: Björn Baumbach <bb at sernet.de>
Date:   Mon Oct 1 09:55:28 2012 +0200

    s3: make recursive_rmdir function non-static
    
    Part of fix for bug #9300.
    
    (cherry picked from commit 7a76762c688f4fc7519dbd204b036963c460e093)

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

Summary of changes:
 lib/replace/xattr.c                         |   15 +++++-
 packaging/NetworkManager/30-winbind-systemd |   20 ++++++++
 packaging/NetworkManager/README             |    6 +++
 source3/modules/vfs_streams_depot.c         |   65 +++++++++++++++++---------
 source3/smbd/close.c                        |    8 ++--
 source3/smbd/proto.h                        |    3 +
 source3/utils/net_ads.c                     |    2 +-
 7 files changed, 88 insertions(+), 31 deletions(-)
 create mode 100755 packaging/NetworkManager/30-winbind-systemd
 create mode 100644 packaging/NetworkManager/README


Changeset truncated at 500 lines:

diff --git a/lib/replace/xattr.c b/lib/replace/xattr.c
index 8e1c989..a26ff67 100644
--- a/lib/replace/xattr.c
+++ b/lib/replace/xattr.c
@@ -71,7 +71,9 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
 	 * that the buffer is large enough to fit the returned value.
 	 */
 	if((retval=extattr_get_file(path, attrnamespace, attrname, NULL, 0)) >= 0) {
-		if(retval > size) {
+		if (size == 0) {
+			return retval;
+		} else if (retval > size) {
 			errno = ERANGE;
 			return -1;
 		}
@@ -88,6 +90,9 @@ ssize_t rep_getxattr (const char *path, const char *name, void *value, size_t si
 	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
 
 	retval = attr_get(path, attrname, (char *)value, &valuelength, flags);
+	if (size == 0 && retval == -1 && errno == E2BIG) {
+		return valuelength;
+	}
 
 	return retval ? retval : valuelength;
 #elif defined(HAVE_ATTROPEN)
@@ -126,7 +131,9 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
 	const char *attrname = ((s=strchr(name, '.')) == NULL) ? name : s + 1;
 
 	if((retval=extattr_get_fd(filedes, attrnamespace, attrname, NULL, 0)) >= 0) {
-		if(retval > size) {
+		if (size == 0) {
+			return retval;
+		} else if (retval > size) {
 			errno = ERANGE;
 			return -1;
 		}
@@ -143,7 +150,9 @@ ssize_t rep_fgetxattr (int filedes, const char *name, void *value, size_t size)
 	if (strncmp(name, "system", 6) == 0) flags |= ATTR_ROOT;
 
 	retval = attr_getf(filedes, attrname, (char *)value, &valuelength, flags);
-
+	if (size == 0 && retval == -1 && errno == E2BIG) {
+		return valuelength;
+	}
 	return retval ? retval : valuelength;
 #elif defined(HAVE_ATTROPEN)
 	ssize_t ret = -1;
diff --git a/packaging/NetworkManager/30-winbind-systemd b/packaging/NetworkManager/30-winbind-systemd
new file mode 100755
index 0000000..af0edf9
--- /dev/null
+++ b/packaging/NetworkManager/30-winbind-systemd
@@ -0,0 +1,20 @@
+#!/bin/sh
+
+winbind_is_active=$(/bin/systemctl is-active winbind.service)
+test "${winbind_is_active}" = "active" || exit 0
+
+winbind_offline_logon=$(testparm -s --parameter-name "winbind offline logon" 2>/dev/null)
+test "${winbind_offline_logon}" = "Yes" || exit 0
+
+case "$2" in
+	up|vpn-up)
+		nmb_is_active=$(/bin/systemctl is-active nmb.service)
+		if test "${nmb_is_active}" = "active"; then
+			/bin/systemctl try-restart nmb.service || :
+		fi
+		/usr/bin/smbcontrol winbind online || :
+	;;
+	down)
+		/usr/bin/smbcontrol winbind offline
+	;;
+esac
diff --git a/packaging/NetworkManager/README b/packaging/NetworkManager/README
new file mode 100644
index 0000000..0db8be6
--- /dev/null
+++ b/packaging/NetworkManager/README
@@ -0,0 +1,6 @@
+This directory includes files for the dispatcher of NetworkManager. The files
+need to be copied to /etc/NetworkManager/dispatcher.d/ and will be automatically
+called if a network interface goes up or down.
+
+30-winbind-systemd: This will set winbind into offline mode if you have winbind
+                    offline logon turned on.
diff --git a/source3/modules/vfs_streams_depot.c b/source3/modules/vfs_streams_depot.c
index c0d5945..620a580 100644
--- a/source3/modules/vfs_streams_depot.c
+++ b/source3/modules/vfs_streams_depot.c
@@ -198,6 +198,7 @@ static char *stream_dir(vfs_handle_struct *handle,
 	if (SMB_VFS_NEXT_STAT(handle, smb_fname_hash) == 0) {
 		struct smb_filename *smb_fname_new = NULL;
 		char *newname;
+		bool delete_lost;
 
 		if (!S_ISDIR(smb_fname_hash->st.st_ex_mode)) {
 			errno = EINVAL;
@@ -211,36 +212,54 @@ static char *stream_dir(vfs_handle_struct *handle,
 
 		/*
 		 * Someone has recreated a file under an existing inode
-		 * without deleting the streams directory. For now, just move
-		 * it away.
+		 * without deleting the streams directory.
+		 * Move it away or remove if streams_depot:delete_lost is set.
 		 */
 
 	again:
-		newname = talloc_asprintf(talloc_tos(), "lost-%lu", random());
-		if (newname == NULL) {
-			errno = ENOMEM;
-			goto fail;
-		}
+		delete_lost = lp_parm_bool(SNUM(handle->conn), "streams_depot",
+					   "delete_lost", false);
+
+		if (delete_lost) {
+			DEBUG(3, ("Someone has recreated a file under an "
+			      "existing inode. Removing: %s\n",
+			      smb_fname_hash->base_name));
+			recursive_rmdir(talloc_tos(), handle->conn,
+					smb_fname_hash);
+			SMB_VFS_NEXT_RMDIR(handle, smb_fname_hash->base_name);
+		} else {
+			newname = talloc_asprintf(talloc_tos(), "lost-%lu",
+						  random());
+			DEBUG(3, ("Someone has recreated a file under an "
+			      "existing inode. Renaming: %s to: %s\n",
+			      smb_fname_hash->base_name,
+			      newname));
+			if (newname == NULL) {
+				errno = ENOMEM;
+				goto fail;
+			}
 
-		status = create_synthetic_smb_fname(talloc_tos(), newname,
-						    NULL, NULL,
-						    &smb_fname_new);
-		TALLOC_FREE(newname);
-		if (!NT_STATUS_IS_OK(status)) {
-			errno = map_errno_from_nt_status(status);
-			goto fail;
-		}
+			status = create_synthetic_smb_fname(talloc_tos(),
+							    newname,
+							    NULL, NULL,
+							    &smb_fname_new);
+			TALLOC_FREE(newname);
+			if (!NT_STATUS_IS_OK(status)) {
+				errno = map_errno_from_nt_status(status);
+				goto fail;
+			}
 
-		if (SMB_VFS_NEXT_RENAME(handle, smb_fname_hash,
-					smb_fname_new) == -1) {
-			TALLOC_FREE(smb_fname_new);
-			if ((errno == EEXIST) || (errno == ENOTEMPTY)) {
-				goto again;
+			if (SMB_VFS_NEXT_RENAME(handle, smb_fname_hash,
+						smb_fname_new) == -1) {
+				TALLOC_FREE(smb_fname_new);
+				if ((errno == EEXIST) || (errno == ENOTEMPTY)) {
+					goto again;
+				}
+				goto fail;
 			}
-			goto fail;
-		}
 
-		TALLOC_FREE(smb_fname_new);
+			TALLOC_FREE(smb_fname_new);
+		}
 	}
 
 	if (!create_it) {
diff --git a/source3/smbd/close.c b/source3/smbd/close.c
index 8bf481d..9b988e0 100644
--- a/source3/smbd/close.c
+++ b/source3/smbd/close.c
@@ -853,13 +853,13 @@ static NTSTATUS close_normal_file(struct smb_request *req, files_struct *fsp,
 	return status;
 }
 /****************************************************************************
- Static function used by reply_rmdir to delete an entire directory
+ Function used by reply_rmdir to delete an entire directory
  tree recursively. Return True on ok, False on fail.
 ****************************************************************************/
 
-static bool recursive_rmdir(TALLOC_CTX *ctx,
-			connection_struct *conn,
-			struct smb_filename *smb_dname)
+bool recursive_rmdir(TALLOC_CTX *ctx,
+		     connection_struct *conn,
+		     struct smb_filename *smb_dname)
 {
 	const char *dname = NULL;
 	char *talloced = NULL;
diff --git a/source3/smbd/proto.h b/source3/smbd/proto.h
index 31c7a3e..4b0bdf1 100644
--- a/source3/smbd/proto.h
+++ b/source3/smbd/proto.h
@@ -139,6 +139,9 @@ void msg_close_file(struct messaging_context *msg_ctx,
 		    struct server_id server_id,
 		    DATA_BLOB *data);
 NTSTATUS delete_all_streams(connection_struct *conn, const char *fname);
+bool recursive_rmdir(TALLOC_CTX *ctx,
+		     connection_struct *conn,
+		     struct smb_filename *smb_dname);
 
 /* The following definitions come from smbd/conn.c  */
 
diff --git a/source3/utils/net_ads.c b/source3/utils/net_ads.c
index b1d55f1..c01ccf0 100644
--- a/source3/utils/net_ads.c
+++ b/source3/utils/net_ads.c
@@ -1533,7 +1533,7 @@ int net_ads_join(struct net_context *c, int argc, const char **argv)
 	d_printf(_("Using short domain name -- %s\n"), r->out.netbios_domain_name);
 
 	if (r->out.dns_domain_name) {
-		d_printf(_("Joined '%s' to realm '%s'\n"), r->in.machine_name,
+		d_printf(_("Joined '%s' to dns domain '%s'\n"), r->in.machine_name,
 			r->out.dns_domain_name);
 	} else {
 		d_printf(_("Joined '%s' to domain '%s'\n"), r->in.machine_name,


-- 
Samba Shared Repository


More information about the samba-cvs mailing list