Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can only access some folders on my linux server #7

Open
qiulang opened this issue Nov 21, 2011 · 6 comments
Open

I can only access some folders on my linux server #7

qiulang opened this issue Nov 21, 2011 · 6 comments

Comments

@qiulang
Copy link

qiulang commented Nov 21, 2011

Hi I hit this weird error on my linux server(using samba service of course) that I can access some directories under the same directory while others gave me the error message, "_tango_evaluate_response_header(): NT_STATUS Level is 0003 with value 000d." Can you take a look ? Thanks!

_tango_send(): Bytes to send (including nbt-header!): 95
_tango_send(): Sent 95 bytes.
_tango_send_and_receive(): Received 4 bytes.
_tango_send_and_receive(): Received 35 bytes.
_tango_TRANS2_FIND_FIRST2(): Received response
_tango_evaluate_response_header(): NT_STATUS Level is 0003 with value 000d.

@38leinaD
Copy link
Owner

Hi qiulang,
0003=Error
000d=Invalid Paramter
Sadly a rather generic error.

Can you boil the problem down to some specific file?
Maybe try to successively remove file from the folder to find out which file/folder might be the problem; special characters?

Thanks,
Daniel

@qiulang
Copy link
Author

qiulang commented Nov 22, 2011

Hi, some further information.
First I find that if that folder name contains "." or " ", it may not work. For example I originally had a folder called "expect5.45", I got the error, after I changed it to "expect545" I can list folder then. But the weird thing is that if I change the folder name to "expect5.45 -1" it works as well and there has to be a space in the folder name, if it is "expect5.45-1", I still got the error.

Second, the length of file name seems to cause the problem as well. If the name is more than 11 letters, I will got the error, e.g. "expect54500" is ok but "expect545000" is not. But again the weird thing is that I changed the folder name to "expect", I got the error; if it is "expect5", I can list folder again.

I open the VERY_VERBOSE macro, if you need I can attached the log.

@qiulang
Copy link
Author

qiulang commented Nov 22, 2011

Hi, I seem to find the pattern of the failed file name!

It seems that if the name's length is an odd number the access will succeed; but if the length is an even number the access will fail!

@qiulang
Copy link
Author

qiulang commented Nov 24, 2011

Hi I found a way to fix the problem although I don’t know the root cause of the problem!

So as I found current codes only work for the folder whose name’s length is odd number. Then I further found that it may be because for even number folder name, the data size we set in _tango_TRANS2_FIND_FIRST2 is incorrect!

Say I have a folder called “abc” and another folder called “abcd”, when I turn on the macro VERY_VERBOSE I find that they both print out log “Bytes to send (including nbt-header!): 89″, apparently for “abcd” folder the bytes to send should be 90. So I add this line to correct data size and codes work now!

if (data_offset % 2 == 0) _tango_smb_setDataSize(smb, data_offset+1);

But I examine your code carefully and can’t find out why we need to +1 for even number.

So any idea?

@38leinaD
Copy link
Owner

the "specification" is rather unclear on where paddings are required. As you see, i also do some paddings to word boundaries for the trans2_find_first SMB. So, in general it is not surprising that for folder names with length x and length x+1 bytes, actually a message with the same size is sent out.

The only way to really find out about what is "right" or "wrong" is comparing with what over cifs clients send. So, if your fix works, it might as well be that i am missing some padding somewhere.

I will have a check on this once i have access to a windows or samba server for testing again.

@rfcongithub
Copy link

Great work man!!! I followed the fix from qiulang and everything is working amazingly! Now if you could make it to talk to MTLM2 then it is perfect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants