Bug 6642 - Opening of Magic Quota file doesn't work anymore
Summary: Opening of Magic Quota file doesn't work anymore
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.4.0
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Jeremy Allison
QA Contact: Samba QA Contact
: 6919 (view as bug list)
Depends on:
Reported: 2009-08-18 04:44 UTC by Stefan Metzmacher
Modified: 2011-10-12 14:14 UTC (History)
5 users (show)

See Also:

Patch for v3-4 (7.03 KB, patch)
2009-09-02 06:25 UTC, Stefan Metzmacher
vl: review-
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+
New patch for v3-3 (and v3-2) (1.74 KB, patch)
2010-01-11 04:25 UTC, Stefan Metzmacher
metze: review? (jra)
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
the stream name verification is to strict after

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

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


The only change that can cause trouble is the mapping change
a better mapping as to NT_STATUS_INVALID_HANDLE. (Samba4 already

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

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

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

have you looked at the code changes already.

The fixed url is:

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?

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.

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.

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

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. 
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

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)
[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.

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.
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.

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:

s3:smbd: add is_fake_file_path() that takes only the raw path as string
s3:streams: check for :$DATA only in the backend (fix bug #6642)
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