On Apr 28, 2008, at 1:00 AM, Shlomi Yaakobovich wrote:
> Hi,
>
> Recently we've encountered a customer who insisted on connecting his
> Mac
> clients using SMB to our samba. Immediately we began seeing some weird
> behavior. It turns out that samba answers a bit differently to
> TRANS2_QFSINFO+SMB_MAC_QUERY_FS_INFO request than Windows Server.
>
> Windows replies clearly that it does not support it (DOS Error +
> unknown
> level 0x007c). Samba does not reply with an error, but instead with an
> almost empty packet (SIVAL(pdata,84,0x100); /* Don't support mac...
> */)


See the SNIA SMB reference, section 4.1.6.8. 0x100 looks like the
NO_STREAMS_OR_MAC_SUPPORT value for the MacSupportFlags member of the
SMB_QUERY_MAC_FS_INFO structure.

> supposedly designed to let the Mac client know samba does not support
> Mac. However, this response makes the Mac client (tested with OS X
> 10.4.9) to behave differently - it assumes the SMB server is UNIX-
> style
> and not Windows, many of the following commands in a sequence are then
> in that spirit (e.g. QUERY_PATH_INFO Unix basic Info), and Mac
> resource
> forks are saved in a different direcory structure. In our system this
> caused things to break, and the client could not really work.
>
> We were forced to remove the relevant code in trans2.c dealing with
> SMB_MAC_QUERY_FS_INFO. Then things started to work:
>
> case SMB_MAC_QUERY_FS_INFO:
> /* drop through */
> default:
> return ERROR_DOS(ERRDOS,ERRunknownlevel);
>
> One oddity that happened when I did that was the fact that samba
> returned an NT error 124 instead of the Windows response of a DOS
> error
> 124. I am not sure which is the correct response since both replies
> did
> the work - the client understood that both samba and Windows do not
> support Mac.
>
> For some unclear reason not all Mac clients ask the SMB server for
> this
> request, so if someone wants to look into it be advised that it is not
> easily reproducible.


The Apple smbfs client doesn't use this operation. I think that it was
developed by the Thursby folks. Thisn might explain why you only
occasionally get reports - only people with the Thursby SMB client
installed see the problem.

> Here's the formal patch if anyone's interested:
>
> --- source/smbd/trans2.c 2008-03-08 17:56:27.000000000 +0200
> +++ patch/trans2.c 2008-04-28 11:00:19.000000000 +0300
> @@ -2725,15 +2725,6 @@
> }
>
> case SMB_MAC_QUERY_FS_INFO:
> - /*
> - * Thursby MAC extension... ONLY on NTFS
> filesystems
> - * once we do streams then we don't need this
> - */
> - if (strequal(lp_fstype(SNUM(conn)),"NTFS")) {
> - data_len = 88;
> - SIVAL(pdata,84,0x100); /* Don't
> support
> mac... */
> - break;
> - }
> /* drop through */
> default:
> return ERROR_NT(NT_STATUS_INVALID_LEVEL);
>
>
> Shlomi Yaakobovich, CIFS Architect - R&D Core Technologies
> www.exanet.com