[Pkg-samba-maint] Bug#699461: /usr/sbin/smbd: Data corruption / file truncation not working with "large readwrite" set to "no"
Tobias Vogel
reportbug.toubsen at spamgourmet.com
Thu Jan 31 16:15:26 UTC 2013
Package: samba
Version: 2:3.5.6~dfsg-3squeeze8
Severity: important
File: /usr/sbin/smbd
On a debian default install of samba, when setting the parameter "large readwrite" to "no" (which is often recommended by users in some wikis / blogs / communities), file truncation will not happen when rewriting / saving the file. When the new content's size is smaller than the old one, trailing garbage is left at the end and thus leaving a corrupted file on the disk.
This bug may also affect upstream samba, as another user with a NAS experienced the same behaviour:
http://stackoverflow.com/questions/12211629/php-file-put-contents-not-truncating-file-in-cifs-mount
Test script to reproduce the behaviour:
echo "thisisabigfatpandaonwheelsgoingdownthestreet" > /mnt/test/newfile.txt
cat /mnt/test/newfile.txt
=> thisisabigfatpandaonwheelsgoingdownthestreet
echo -n "blah" > /mnt/test/newfile.txt
cat /mnt/test/newfile.txt
=> blahisabigfatpandaonwheelsgoingdownthestreet
Expected output of the second cat command:
=> blah
Changes to default smb.conf:
diff -pruN /usr/share/samba/smb.conf /etc/samba/smb.conf
--- /usr/share/samba/smb.conf 2012-04-30 08:53:47.000000000 +0200
+++ /etc/samba/smb.conf 2013-01-31 16:51:24.000000000 +0100
@@ -31,6 +31,7 @@
#======================= Global Settings =======================
[global]
+ large readwrite = no
## Browsing/Identification ###
@@ -323,3 +324,9 @@
; preexec = /bin/mount /cdrom
; postexec = /bin/umount /cdrom
+[test]
+ writable = yes
+ path = /export/test
+ valid users = testuser
+ create mask = 0644
+ guest ok = no
Mount on the test client:
//smbserver/test /mnt/test cifs rw,user=testuser,passwd=xxx 0 0
-- System Information:
Debian Release: 6.0.6
APT prefers stable-updates
APT policy: (500, 'stable-updates'), (500, 'stable')
Architecture: amd64 (x86_64)
Kernel: Linux 2.6.32-5-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages samba depends on:
ii adduser 3.112+nmu2 add and remove users and groups
ii debconf [debconf- 1.5.36.1 Debian configuration management sy
ii libacl1 2.2.49-4 Access control list shared library
ii libattr1 1:2.4.44-2 Extended attribute shared library
ii libc6 2.11.3-4 Embedded GNU C Library: Shared lib
ii libcap2 1:2.19-3 support for getting/setting POSIX.
ii libcomerr2 1.41.12-4stable1 common error description library
ii libcups2 1.4.4-7+squeeze2 Common UNIX Printing System(tm) -
ii libgssapi-krb5-2 1.8.3+dfsg-4squeeze6 MIT Kerberos runtime libraries - k
ii libk5crypto3 1.8.3+dfsg-4squeeze6 MIT Kerberos runtime libraries - C
ii libkrb5-3 1.8.3+dfsg-4squeeze6 MIT Kerberos runtime libraries
ii libldap-2.4-2 2.4.23-7.2 OpenLDAP libraries
ii libpam-modules 1.1.1-6.1+squeeze1 Pluggable Authentication Modules f
ii libpam-runtime 1.1.1-6.1+squeeze1 Runtime support for the PAM librar
ii libpam0g 1.1.1-6.1+squeeze1 Pluggable Authentication Modules l
ii libpopt0 1.16-1 lib for parsing cmdline parameters
ii libtalloc2 2.0.1-1 hierarchical pool based memory all
ii libwbclient0 2:3.5.6~dfsg-3squeeze8 Samba winbind client library
ii lsb-base 3.2-23.2squeeze1 Linux Standard Base 3.2 init scrip
ii procps 1:3.2.8-9squeeze1 /proc file system utilities
ii samba-common 2:3.5.6~dfsg-3squeeze8 common files used by both the Samb
ii update-inetd 4.38+nmu1+squeeze1 inetd configuration file updater
ii zlib1g 1:1.2.3.4.dfsg-3 compression library - runtime
Versions of packages samba recommends:
ii logrotate 3.7.8-6 Log rotation utility
Versions of packages samba suggests:
pn ctdb <none> (no description available)
pn ldb-tools <none> (no description available)
pn openbsd-inetd | inet-superser <none> (no description available)
pn smbldap-tools <none> (no description available)
-- debconf information:
samba/run_mode: daemons
samba/generate_smbpasswd: true
More information about the Pkg-samba-maint
mailing list