Bug 9021 - smbd must return NT_STATUS_INVALID_PARAMETER if FIND_FIRST2 on file\* requested
smbd must return NT_STATUS_INVALID_PARAMETER if FIND_FIRST2 on file\* requested
Status: NEW
Product: Samba 3.6
Classification: Unclassified
Component: File services
All All
: P5 normal
: ---
Assigned To: Volker Lendecke
Samba QA Contact
Depends on:
  Show dependency treegraph
Reported: 2012-07-02 16:30 UTC by SATOH Fumiyasu
Modified: 2012-07-02 16:30 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.