Inconsistency in calls to SMB_VFS_STAT ...

Jeremy Allison jra at samba.org
Tue Apr 14 11:17:38 MDT 2015


On Tue, Apr 14, 2015 at 10:14:59AM -0700, Richard Sharpe wrote:
> 
> OK, the offending code appears to be in source3/smbd/service.c around
> line 824, as shown below. Notice the comment about Win2000.
> 
>         smb_fname_cpath = synthetic_smb_fname(talloc_tos(), conn->connectpath,
>                                               NULL, NULL);
>         if (smb_fname_cpath == NULL) {
>                 status = NT_STATUS_NO_MEMORY;
>                 goto err_root_exit;
>         }
> 
>         /* win2000 does not check the permissions on the directory
>            during the tree connect, instead relying on permission
>            check during individual operations. To match this behaviour
>            I have disabled this chdir check (tridge) */
>         /* the alternative is just to check the directory exists */
> 
>         if ((ret = SMB_VFS_STAT(conn, smb_fname_cpath)) != 0 ||
>             !S_ISDIR(smb_fname_cpath->st.st_ex_mode)) {
>                 if (ret == 0 && !S_ISDIR(smb_fname_cpath->st.st_ex_mode)) {
>                         DEBUG(0,("'%s' is not a directory, when connecting to "
>                                  "[%s]\n", conn->connectpath,
>                                  lp_servicename(talloc_tos(), snum)));
>                 } else {
>                         DEBUG(0,("'%s' does not exist or permission denied "
>                                  "when connecting to [%s] Error was %s\n",
>                                  conn->connectpath,
>                                  lp_servicename(talloc_tos(), snum),
>                                  strerror(errno) ));
>                 }
>                 status = NT_STATUS_BAD_NETWORK_NAME;
>                 goto err_root_exit;
>         }
>         conn->base_share_dev = smb_fname_cpath->st.st_ex_dev;
> 
> Should I file a bug?

Yes please. This is clearly wrong, and we should depend on
torture tests around these things these days.

Thanks !

Jeremy.


More information about the samba-technical mailing list