diff -u samba-3.2.3/debian/changelog samba-3.2.3/debian/changelog --- samba-3.2.3/debian/changelog +++ samba-3.2.3/debian/changelog @@ -1,3 +1,10 @@ +samba (2:3.2.3-1ubuntu3.1) intrepid-proposed; urgency=low + + * debian/patches/last-char-truncation.patch: Fix compatibility issue with + NAS boxes still using Samba 2.2 or before (fixes LP: #282298) + + -- Thierry Carrez Mon, 17 Nov 2008 17:04:35 +0100 + samba (2:3.2.3-1ubuntu3) intrepid; urgency=low * Fix pam-smbpass.so crashing because it misses /var/lib/samba (LP: #260687) diff -u samba-3.2.3/debian/patches/series samba-3.2.3/debian/patches/series --- samba-3.2.3/debian/patches/series +++ samba-3.2.3/debian/patches/series @@ -20,0 +21 @@ +last-char-truncation.patch only in patch2: unchanged: --- samba-3.2.3.orig/debian/patches/last-char-truncation.patch +++ samba-3.2.3/debian/patches/last-char-truncation.patch @@ -0,0 +1,40 @@ +Goal: Fix compatibility with old Samba servers, experiencing issues like last +character being truncated from file names. + +Fixes: LP: #282298 + +Status wrt upstream: Patch from Jeremy Allison, extracted from Samba bugzilla +bug #5826. + +Author comment: There was some code in pull_ucs2_base_talloc() to cope with +this case which hadn't been added to pull_ascii_base_talloc(). The older Samba +returns non unicode names which is why you are seeing this codepath being +executed. + +Index: samba-3.2.3/source/lib/charcnv.c +=================================================================== +--- samba-3.2.3.orig/source/lib/charcnv.c 2008-11-17 16:55:35.000000000 +0100 ++++ samba-3.2.3/source/lib/charcnv.c 2008-11-17 16:55:47.000000000 +0100 +@@ -1209,7 +1209,21 @@ + if (dest_len && dest) { + /* Did we already process the terminating zero ? */ + if (dest[dest_len-1] != 0) { +- dest[dest_len-1] = 0; ++ size_t size = talloc_get_size(dest); ++ /* Have we got space to append the '\0' ? */ ++ if (size <= dest_len) { ++ /* No, realloc. */ ++ dest = TALLOC_REALLOC_ARRAY(ctx, dest, char, ++ dest_len+1); ++ if (!dest) { ++ /* talloc fail. */ ++ dest_len = (size_t)-1; ++ return 0; ++ } ++ } ++ /* Yay - space ! */ ++ dest[dest_len] = '\0'; ++ dest_len++; + } + } else if (dest) { + dest[0] = 0;