The Samba-Bugzilla – Bug 4404
Vista and Offline Files broken, with Office 2007 (and more?)
Last modified: 2010-10-17 16:23:27 UTC
[logged with OS as XP since Vista is not listed - could it be added?]
I have a share exported from a Samba server (version 3.0.24 with the latest patches applied, running on FreeBSD) to a Windows Vista machine. The problem is only exhibted when I enable Offline Files (by selecting Always Available Offline) on a directory within the share. It works fine on a "normal" directory.
The problem is easy to reproduce. After enabling Offline Files open Word 2007 and make a new document. Hit save, and place it in the offlined directory named test.docx. On the Vista client I see two files:
The latter is the "usual" temporary file. It vanishes when I close Word. On the Unix filestore I see:
I've scanned the samba logs with debugging turned on and I can see it doing something with "E28BEAE6.tmp" and "test.docx" - maybe it's trying to write to a temporary file first and move it in to place (which maybe fails?). But I need some advice on what log level to use to get the best info here.
This scenario also occurs if you edit an existing file and save it. On the Vista machine it appears fine, on the Unix filesystem you see the original unedited file and a new .tmp file.
It's worth noting that the Sync Manager does notice this abnormality and attempts to let you fix it up, but it doesn't seem to work correctly in the useful direction (vista->samba).
Of course I'm happy to do what I can to help investigate this. Let me know if I can provide any logs or other relevant information.
Have you applied the patches in http://www.samba.org/samba/patches/?
Yes, I've applied all of them.
Just done some further testing. I can replicate the problem using the same version of Samba but on a Solaris server. I can confirm it all works as it should against a Windows server.
So the next step is clear: We need comparative sniffs against windows and Samba. See http://wiki.samba.org/index.php/Capture_Packets for hints how to create sniffs.
Unfortunately I can't get Wireshark (or, more likely, WinPcap) to work - it can't detect the network interface in my laptop.
So the best I can do at this point is provide tcpdumps from the server side. I've done two captures.
dump.ok - without offline files enabled where it works fine
dump.bad - with offline files where it's broken
In both cases I saved a file to \\vulture\files\home\offlinetest called test.docx. In the failure case I was left with 4608E83B.tmp rather than test.docx.
In the many times I've tried this I have occasionally noticed the .tmp file on the Vista end for a split second before it vanishes. So this likely supports my idea that it's writing to a temporary file first.
(files will be attached shortly)
Created attachment 2305 [details]
tcpdump without offline files enabled, behaviour is correct.
Created attachment 2306 [details]
tcpdump with offline files enabled, behaviour is broken.
Jeremy, Here's another Vista bug we should review. Maybe not for 3.0.25
but probably soon.
It turns out that we weren't doing the protocol correctly for tconX, NTCreateX and NTTransCreate - who knew we'd still be finding things like this in 2007 ? :-).
When the extended response bit is set in the tconX request that changes the response from 3 words to 7 - the extra words are the share access control mask, when the NTCreateX/NTTransCreate extended response bit is set the reply adds 32 extra bytes containing the access mask of the file (used for caching locally I believe) and for pipes contains two access masks (don't know why).
This bug might be fixed for 3.0.25rc1 now, but I don't have an Office 2007 environment set up yet so can't officially test.
Should be fixed in 3.0.25rc1. Please reopen if not.
Sorry for the delay, I've only just managed to get 3.0.25 rc1 installed. I'm afraid this bug isn't fixed but it has changed.
When saving a file from Office 2007 I now get an "Access denied" error message. From the Vista end I can see the file name I tried to save as with a size of 0kb. On the Samba end I can see:
-rwxr--r-- 1 tdb users 9846 Apr 22 01:19 AB8B4671.tmp
-rwxr--r-- 1 tdb users 0 Apr 22 01:20 test.docx
So it looks like you're tweaking the right bit of code, but something is still not right.
I'll look at doing a packet capture tomorrow.
A packet trace would definately help, as would a packet trace from Vista to a Windows 2003 server where this works. Please use the same filename in each case for the Word file.
Ok, dumps are done and will be attached shortly. They were taken using tshark on the server side (I can't get wireshark to run on my vista machine). In both cases I saved a new file called tdbtest.docx from Word 2007 in to a folder called offlinetest (which had previously been "made available offline") in a share called junk. I used the samba Vista client in both cases.
Maybe worth noting that since I upgraded to 3.0.25rc1 I can't make any new folders available offline from the vista client. I get the same access denied message.
I should have added this bit of info to that last message. This is what the filesystem looks like on the samba server - the temporary file name might be useful when looking through the dumps?
-rwxr--r-- 1 tdb users 9868 Apr 22 19:01 F6383BB4.tmp
-rwxr--r-- 1 tdb users 0 Apr 22 19:02 tdbtest.docx
Created attachment 2397 [details]
Samba 3.0.25rc1 exhibting problem
Dump taken using tshark on the samba server.
Created attachment 2398 [details]
Dump from Windows 2003 server showing correct behaviour.
Dump taken using tshark on the windows 2003 server.
I have found the fix for this. Set :
map acl inherit = yes
in the [global] section of your smb.conf. You don't want to know how long it took for me to find this :-).
Sorry to do this, but it's still behaving the same with this option set. Attached is the output of testparm to confirm that.
I hate being a pain :-(
Created attachment 2415 [details]
Are you running on Linux and have the acl,user_xattr options
enabled for the mount? ANd do you have the libacl and libattr devel
packages installed before compiling smbd?
I'm running on FreeBSD 6.2. I also replicated the initial issue at work on Solaris 9. I've not tried with Linux and don't have access to a Linux system.
Apparently without EA's you cannot do inherited ACLs and therefore cannot do offline support. Jeremy might be willing to make a change to drop the DACL_ACL_PROTECTED FLAG in some cases but this is no longer considered a show stopper for 3.0.25.
Just to clarify, has Vista changed behaviour with offline files? Because this all works fine with XP.
Created attachment 2734 [details]
There's an off-by-one bug in returning the access mask associated with an offline file. Please test this patch against 3.0.25a.
I've tested this new patch and I can now confirm the strange Permission Denied messages I had been getting in 3.0.25 have gone away.
However, the original problem unfortunately still persists.
Would be happy to help with getting this one resolved (from the testing side) as its quite an annoying bug (I can confirm it also happens on Windows 7 x64 with Office 2007). Its possible that Office 2010 doesn't have the issue but cannot confirm that for definite just yet.
Similar MS bug report / workaround: http://support.microsoft.com/kb/2002109
I can confirm the issue on Win 7 x64 with Office 2010.