[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

[SRM] Planned upload of samba in s-p-u to fix #561545



Bug #561545 is a clear regression in samba wrt 3.0.* series. It
affects file name mangling when one is setting "name mangling = hash"
in smb.conf. In short, only short filenames are mangled...not long
ones..:-)

That bug was fixed upstream
(https://bugzilla.samba.org/show_bug.cgi?id=6939) in samba 3.3.10 and
3.4.4 that will be released in early January. Samba 3.2 series is no
longer supported by upstream except security-wise, but the fix is fine
for it as well.

That bug revealed another bug that was hidden by it until now: file
and directory names that contain dots were truncated when mangled by
using the "hash" method ("Openoffice.org" then becomes "Openoffice",
etc.). Of course, it is required to fix that bug is the former bug is
fixed.

Given that these bugs are clear regressions from the version of samba
in etch and even though the "hash" method not being the default
mangling method (default is "hash2" and it has no regression) and
given that the fix is very obvious and well tested by upstream, I
propose fixing lenny with the attached patch.

-- 


Index: debian/patches/series
===================================================================
--- debian/patches/series	(révision 3082)
+++ debian/patches/series	(révision 3193)
@@ -37,3 +37,5 @@
 security-CVE-2009-2948-1.patch
 security-CVE-2009-2948-2.patch
 
+bug_561545_upstream_6969.patch
+bug_561545_upstream_7005.patch
Index: debian/patches/bug_561545_upstream_6969.patch
===================================================================
--- debian/patches/bug_561545_upstream_6969.patch	(révision 0)
+++ debian/patches/bug_561545_upstream_6969.patch	(révision 3193)
@@ -0,0 +1,26 @@
+Goal: Fix regression when setting "mangling method = hash". It was
+      just...not working anymore.
+
+Fixes: #561545
+
+Status wrt upstream: Fixed in 3.3.10 and 3.4.4
+
+Author: Jeremy Allison <jra@samba.org>
+
+diff --git a/source/smbd/mangle_hash.c b/source/smbd/mangle_hash.c
+index 69ecf77..5de69e2 100644
+--- a/source/smbd/mangle_hash.c
++++ b/source/smbd/mangle_hash.c
+@@ -613,7 +613,10 @@ static bool must_mangle(const char *name,
+ 	}
+ 	status = is_valid_name(name_ucs2, False, False);
+ 	SAFE_FREE(name_ucs2);
+-	return NT_STATUS_IS_OK(status);
++	/* We return true if we *must* mangle, so if it's
++	 * a valid name (status == OK) then we must return
++	 * false. Bug #6939. */
++	return !NT_STATUS_IS_OK(status);
+ }
+ 
+ /*****************************************************************************
+
Index: debian/patches/bug_561545_upstream_7005.patch
===================================================================
--- debian/patches/bug_561545_upstream_7005.patch	(révision 0)
+++ debian/patches/bug_561545_upstream_7005.patch	(révision 3193)
@@ -0,0 +1,38 @@
+Goal: Fix regression revealed when fixing upstream #6939.
+      Suffixes are stripped from filenames with a dot/period
+      character.
+
+Fixes: #561545
+
+Status wrt upstream: Fixed in 3.3.10 and 3.4.4
+
+Author: Jeremy Allison <jra@samba.org>
+
+diff --git a/source/smbd/mangle_hash.c b/source/smbd/mangle_hash.c
+index 5de69e2..7073c3c 100644
+--- a/source/smbd/mangle_hash.c
++++ b/source/smbd/mangle_hash.c
+@@ -432,6 +432,13 @@ static void cache_mangled_name( const char mangled_name[13],
+ 		if( !s1[i] && !s2[i] ) {
+ 			/* Truncate at the '.' */
+ 			*s1 = '\0';
++			/*
++			 * DANGER WILL ROBINSON - this
++			 * is changing a const string via
++			 * an aliased pointer ! Remember to
++			 * put it back once we've used it.
++			 * JRA
++			 */
+ 			*s2 = '\0';
+ 		}
+ 	}
+@@ -443,6 +450,8 @@ static void cache_mangled_name( const char mangled_name[13],
+ 	} else {
+ 		DEBUG(5,("cache_mangled_name: Stored entry %s -> %s\n", mangled_name_key, raw_name));
+ 	}
++	/* Restore the change we made to the const string. */
++	*s2 = '.';
+ }
+ 
+ /* ************************************************************************** **
+
Index: debian/changelog
===================================================================
--- debian/changelog	(révision 3082)
+++ debian/changelog	(révision 3193)
@@ -1,3 +1,13 @@
+samba (2:3.2.5-4lenny8) stable-proposed-updates; urgency=low
+
+  * Fix regression in name mangling. Only short
+    filenames were hashed, not long ones when using
+    "mangling method = hash". Closes: #561545
+  * Fix mangling of file or directory names that contain
+    dots. This bug was revealed when fixing #561545
+
+ -- Christian Perrier <bubulle@debian.org>  Wed, 23 Dec 2009 20:32:02 +0100
+
 samba (2:3.2.5-4lenny7) stable-security; urgency=high
 
   * Security update. Fixes the following issues:

Attachment: signature.asc
Description: Digital signature


Reply to: