Bug 9021 - smbd must return NT_STATUS_INVALID_PARAMETER if FIND_FIRST2 on file\* requested
Summary: smbd must return NT_STATUS_INVALID_PARAMETER if FIND_FIRST2 on file\* requested
Alias: None
Product: Samba 3.6
Classification: Unclassified
Component: File services (show other bugs)
Version: 3.6.6
Hardware: All All
: P5 normal
Target Milestone: ---
Assignee: Björn Jacke
QA Contact: Samba QA Contact
Depends on:
Reported: 2012-07-02 16:30 UTC by SATOH Fumiyasu
Modified: 2020-10-02 22:24 UTC (History)
0 users

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description SATOH Fumiyasu 2012-07-02 16:30:10 UTC
The following Python program (using pysmbc, libsmbclient binding
for Python) fails by "RuntimeError: (2, 'No such file or directory')"
on Samba 3.6.6 and 3.5.16 file share because smbd return
NT_STATUS_OBJECT_PATH_NOT_FOUND if "smb://server/share/filename" is
a file, not a directory.

  import smbc
  ctx = smbc.Context()
  cb = lambda se, sh, w, u, p: ("domain", "username", "password")
  ctx.functionAuthData = cb
  uri = 'smb://server/share/filename'
  dir = ctx.opendir(uri)

log.smbd shows the following log:

  [2012/07/03 00:27:57.613445,  5] smbd/filename.c:609(unix_convert)
    Wildcard *
  [2012/07/03 00:27:57.613489,  3] smbd/vfs.c:905(check_reduced_name)
    check_reduced_name [filename/*] [/srv/share]
  [2012/07/03 00:27:57.613540,  3] smbd/vfs.c:914(check_reduced_name)
    check_reduced_name: Component not a directory in getting realpath for filename/*
  [2012/07/03 00:27:57.613582,  5] smbd/filename.c:1015(check_name)
    check_name: name filename/* failed with NT_STATUS_OBJECT_PATH_NOT_FOUND
  [2012/07/03 00:27:57.613628,  3] smbd/filename.c:1341(filename_convert)
    filename_convert: check_name failed for name filename/* with NT_STATUS_OBJECT_PATH_NOT_FOUND
  [2012/07/03 00:27:57.613673,  3] smbd/error.c:81(error_packet_set)
    error packet at smbd/trans2.c(2345) cmd=50 (SMBtrans2) NT_STATUS_OBJECT_PATH_NOT_FOUND

But on Windows share, this program fails by "RuntimeError: (20,
'Not a directory')" because Windows return NT_STATUS_INVALID_PARAMETER
and then libsmbclient check if the specified path is a directory or not.

smbd must return NT_STATUS_INVALID_PARAMETER in this case.
Comment 1 Björn Jacke 2020-10-02 22:24:24 UTC
sorry for the late response. This might partly have been a libsmbclient issue also. Testing your script with the current 4.12 libsmbclient version lets as well Windows as also smbd return NT_STATUS_NOT_A_DIRECTORY. I'll close this bug now, if you still see a possible bug in that area, please reopen this bug report.