Mac extenstion with TRANS2_QFSINFO

Shlomi Yaakobovich Shlomi at
Mon Apr 28 08:00:34 GMT 2008


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... */)
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:

			/* drop through */
			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.

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
-                        * 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 */
                        return ERROR_NT(NT_STATUS_INVALID_LEVEL);

Shlomi Yaakobovich, CIFS Architect - R&D Core Technologies

More information about the samba-technical mailing list