Bug 6642 - Opening of Magic Quota file doesn't work anymore
Opening of Magic Quota file doesn't work anymore
Status: RESOLVED FIXED
Product: Samba 3.4
Classification: Unclassified
Component: File services
3.4.0
Other Linux
: P3 normal
: ---
Assigned To: Jeremy Allison
Samba QA Contact
:
: 6919 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-08-18 04:44 UTC by Stefan Metzmacher
Modified: 2011-10-12 14:14 UTC (History)
5 users (show)

See Also:


Attachments
Patch for v3-4 (7.03 KB, patch)
2009-09-02 06:25 UTC, Stefan Metzmacher
vl: review-
Details
Patch for v3-2 and v3-3 (817 bytes, patch)
2009-12-21 09:37 UTC, Stefan Metzmacher
no flags Details
Patch for v3-4 (822 bytes, patch)
2009-12-21 09:38 UTC, Stefan Metzmacher
no flags Details
log with DEBUG (3.80 KB, application/x-gzip)
2010-01-04 04:17 UTC, Laurent Bigonville
no flags Details
tcpdump dump (7.19 KB, application/x-gzip)
2010-01-04 06:41 UTC, Laurent Bigonville
no flags Details
New patch for v3-4 (1.74 KB, patch)
2010-01-05 04:29 UTC, Stefan Metzmacher
jra: review+
Details
New patch for v3-3 (and v3-2) (1.74 KB, patch)
2010-01-11 04:25 UTC, Stefan Metzmacher
metze: review? (jra)
Details
log with loglevel10 (25.82 KB, application/x-gzip)
2010-01-11 07:19 UTC, Laurent Bigonville
no flags Details
tcpdump dump with access denied (14.37 KB, application/cap)
2010-01-11 07:25 UTC, Laurent Bigonville
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Metzmacher 2009-08-18 04:44:25 UTC
When opening \\$Extend\\$Quota:$Q:$INDEX_ALLOCATION
NT_STATUS_INVALID_PARAMETER is returned because
the stream name verification is to strict after
edde763d3f981f9ccdf65feffd85a591fb1708c1.

We need to deferr the check for :$DATA to the backend modules.

metze
Comment 1 Stefan Metzmacher 2009-08-20 03:21:53 UTC
This branch fixes the problem for me:

http://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=ref/head/master3-quota

The only change that can cause trouble is the mapping change
from EINVAL to NT_STATUS_INVALID_PARAMETER. But I think that's
a better mapping as to NT_STATUS_INVALID_HANDLE. (Samba4 already
maps to INVALID_PARAMETER)

(Some of the patches are also needed in v3-2 and v3-3)

metze
Comment 2 Jeremy Allison 2009-08-20 12:52:00 UTC
I think this also needs to be in 3.4.1.

Jeremy.
Comment 3 Stefan Metzmacher 2009-08-24 10:40:02 UTC
Jeremy,

have you looked at the code changes already.

The fixed url is:
http://gitweb.samba.org/?p=metze/samba/wip.git;a=shortlog;h=refs/head/master3-quota

Comment 4 Karolin Seeger 2009-09-01 02:32:29 UTC
Shall I pick that one for 3.4.1 or not?

Metze, could you attach the patch, please?

Thanks!
Comment 5 Stefan Metzmacher 2009-09-02 06:25:18 UTC
Created attachment 4625 [details]
Patch for v3-4
Comment 6 Stefan Metzmacher 2009-09-02 06:26:24 UTC
We also need this in v3-3, but I'm not sure the patches apply there.
Comment 7 Volker Lendecke 2009-09-08 09:32:54 UTC
Comment on attachment 4625 [details]
Patch for v3-4

As it stands right now, this patch does not apply cleanly against current v3-4-test (I'm using d5098d737). I had assumed this was for 3.4.

Volker
Comment 8 Stefan Metzmacher 2009-09-08 09:50:05 UTC
I think we should fix this for 3.4.2, the code has changed to much
between v3-4-test and master.

metze
Comment 9 Laurent Bigonville 2009-11-16 10:59:24 UTC
Hi,

What the status of this bug?

I still get "\\$Extend\\$Quota:$Q:$INDEX_ALLOCATION NT_STATUS_INVALID_PARAMETER" when using smbcquotas on 3.4.3
Comment 10 Stefan Metzmacher 2009-11-17 07:43:42 UTC
I haven't looked into how to fix this for v3-3 and v3-4 yet.
It's only fixed in master and v3-5.
Comment 11 Stefan Metzmacher 2009-11-24 02:18:15 UTC
*** Bug 6919 has been marked as a duplicate of this bug. ***
Comment 12 Stefan Metzmacher 2009-12-21 09:37:19 UTC
Created attachment 5104 [details]
Patch for v3-2 and v3-3

Can someone please test this patch?
Comment 13 Stefan Metzmacher 2009-12-21 09:38:11 UTC
Created attachment 5105 [details]
Patch for v3-4

And this one please
Comment 14 Stefan Metzmacher 2009-12-21 13:32:48 UTC
A little reminder to a IRC chat:

17:49 < bigon> metze: doesn't seem to work :/
18:01 < bigon> metze: [2009/12/21 18:00:19,  3] smbd/error.c:60(error_packet_set) error packet at 
               smbd/nttrans.c(467) cmd=162 (SMBntcreateX) NT_STATUS_INVALID_PARAMETER
18:12 -!- kamenim [n=kamenim@mail.sofia.postpath.com] has quit ["Miranda IM! Smaller, Faster, Easier. 
          http://miranda-im.org"]
18:18 < metze> bigon: can you add a DEBUG(0,("check_path_syntax_internal: path[%s] stream[%s]\n", path, s));
18:18 < metze> before the return NT_STATUS_INVALID_PARAMETER;
18:20 < metze> we may need FAKE_FILE_NAME_QUOTA_UNIX instead of FAKE_FILE_NAME_QUOTA_WIN32
Comment 15 Laurent Bigonville 2010-01-04 04:17:02 UTC
Created attachment 5115 [details]
log with DEBUG

I also tried with _UNIX instead of _WIN32 but same error :/
Comment 16 Laurent Bigonville 2010-01-04 04:24:54 UTC
I don't know if it's important or not, but in the log file the path says [...]:$QQ:[...] and the error from smbcquotas it says [...]:$Q:[...]
Comment 17 Stefan Metzmacher 2010-01-04 05:41:11 UTC
Then we need a network capture

http://wiki.samba.org/index.php/Capture_Packets
Comment 18 Laurent Bigonville 2010-01-04 06:41:44 UTC
Created attachment 5117 [details]
tcpdump dump
Comment 19 Stefan Metzmacher 2010-01-05 01:43:17 UTC
The file name looks good in the capture.

The $QQ is very strange...
Comment 20 Laurent Bigonville 2010-01-05 03:16:51 UTC
There is a loop into check_path_syntax_internal that rewrite the path maybe the loop exits too early or something
Comment 21 Stefan Metzmacher 2010-01-05 04:29:38 UTC
Created attachment 5120 [details]
New patch for v3-4

Can you please test this patch?
Comment 22 Laurent Bigonville 2010-01-11 04:03:28 UTC
I've tested and it seems that the patch is working (tested with smbcquota)
Comment 23 Stefan Metzmacher 2010-01-11 04:25:38 UTC
Created attachment 5154 [details]
New patch for v3-3 (and v3-2)
Comment 24 Laurent Bigonville 2010-01-11 07:19:02 UTC
Created attachment 5155 [details]
log with loglevel10

As I've said, I can get the quotas with smbcquotas, but it seems that it doesn't work with windows xp, in the logs I get:
[2010/01/11 14:12:33,  5] smbd/uid.c:353(change_to_user)
  change_to_user uid=(0,1287) gid=(0,513)
[2010/01/11 14:12:33,  4] smbd/vfs.c:753(vfs_ChDir)
  vfs_ChDir to /home/l-bigonville
[2010/01/11 14:12:33, 10] smbd/nttrans.c:483(reply_ntcreate_and_X)
  reply_ntcreate_and_X: flags = 0x16, access_mask = 0x2019f file_attributes = 0x0, share_access = 0x3, create_disposition = 0x1 create_options = 0x0 root_dir_fid = 0x0, fname = $Extend/$Quota:$Q:$INDEX_ALLOCATION
[2010/01/11 14:12:33, 10] smbd/open.c:3366(create_file_default)
  create_file: access_mask = 0x2019f file_attributes = 0x0, share_access = 0x3, create_disposition = 0x1 create_options = 0x0 oplock_request = 0x3 root_dir_fid = 0x0, ea_list = 0x(nil), sd = 0x(nil), create_file_flags = 0x1, fname = $Extend/$Quota:$Q:$INDEX_ALLOCATION
[2010/01/11 14:12:33,  5] smbd/fake_file.c:87(is_fake_file)
  is_fake_file: [$Extend/$Quota:$Q:$INDEX_ALLOCATION] is a fake file
[2010/01/11 14:12:33,  3] smbd/fake_file.c:116(open_fake_file)
  open_fake_file_shared: access_denied to service[l-bigonville] file[$Extend/$Quota:$Q:$INDEX_ALLOCATION] user[l-bigonville]
[2010/01/11 14:12:33, 10] smbd/open.c:3508(create_file_default)
  create_file: NT_STATUS_ACCESS_DENIED
[2010/01/11 14:12:33,  3] smbd/error.c:60(error_packet_set)
  error packet at smbd/nttrans.c(541) cmd=162 (SMBntcreateX) NT_STATUS_ACCESS_DENIED
Comment 25 Laurent Bigonville 2010-01-11 07:25:53 UTC
Created attachment 5156 [details]
tcpdump dump with access denied
Comment 26 Laurent Bigonville 2010-01-11 09:52:31 UTC
< metze> bigon: only root can manage quotas
< bigon> metze: mmm are you sure? because with the same user (memeber of domain admin group) on a 3.0.28a I can see (and I guess manage) the quota but not on a 3.0.24 (this is on my production machines)

To be clear the dump comes from a 3.4.3 version not a 3.0.x
Comment 27 Jeremy Allison 2010-01-11 18:54:16 UTC
Comment on attachment 5120 [details]
New patch for v3-4

This patch is good for 3.4.5. The access denied is a separate issue - this patch should be applied to fix the pathname problem.

Jeremy.
Comment 28 Jeremy Allison 2010-01-11 18:55:18 UTC
Re-assigning to Karolin to get the fix in attachment 5120 [details] included in the next 3.4.x.
Jeremy.
Comment 29 Stefan Metzmacher 2010-01-12 05:45:20 UTC
It would be nice to have that also in the next v3-3 release...
Comment 30 Karolin Seeger 2010-01-12 05:54:32 UTC
Pushed to v3-3-test and v3-4-test.
Re-assigning to Metze as I am not sure whether there is still an open task or not.

Thanks!
Comment 31 Laurent Bigonville 2010-01-29 10:52:23 UTC
Thanks for fixing it, I guess I will open a new bug for the fact that only the user root can see quota tab from windows machines
Comment 32 Laurent Bigonville 2010-04-14 02:47:50 UTC
Looks like this is NOT fixed in 3.5 :(
Comment 33 Laurent Bigonville 2010-04-14 03:28:51 UTC
BTW is 09fe57923ab5570aad106b6b82faabe3fcd130fd really needed?
Comment 34 Stefan Metzmacher 2010-04-14 03:55:55 UTC
Yes, otherwise you'll always get NT_STATUS_INVALID_PARAMETER
Comment 35 Stefan Metzmacher 2010-04-14 03:57:20 UTC
Jeremy, can you find the cause of the failing access check?
Comment 36 Laurent Bigonville 2010-04-14 05:58:05 UTC
Well the patch that has been applied to 3.4 hasn't been applied to 3.5.

For the permission denied with user != root in 3.4 I've opened a different bug (bug #7080)
Comment 37 Stefan Metzmacher 2010-04-14 06:30:17 UTC
v3-5 and master have different patches:

v3-5-stable has:

5234d10c8e8c9d0d2576133c209ba474e1867d28
s3:smbd: add is_fake_file_path() that takes only the raw path as string
09fe57923ab5570aad106b6b82faabe3fcd130fd
s3:streams: check for :$DATA only in the backend (fix bug #6642)
e91d5dbed05f364d155ff8b91ddf5af718fb1462
s3:error_map: make NTSTATUS -> errno -> NTSTATUS mapping consistent for NT_STATUS_INVALID_PARAMETER

Comment 38 Stefan Metzmacher 2011-10-12 14:14:10 UTC
This is fixed in 3.5.x, 3.6.x and master