Possible fix for TRANS2SCAN and NTTRANSSCAN bitrot in smbtorture ...

Richard Sharpe realrichardsharpe at gmail.com
Mon Oct 29 12:02:52 MDT 2012


On Sat, Oct 27, 2012 at 11:06 AM, Richard Sharpe
<realrichardsharpe at gmail.com> wrote:
> Hi folks,
>
> Attached is a potential fix for the bitrot to those two tests.
>
> I am not happy with the changes to clifile.c since it does not handle
> all the cases, and the coding is ugly, so I would welcome suggestions.
>
> Perhaps if the response to the open attempt is
> NT_STATUS_FILE_IS_A_DIRECTORY I should fallback to opening it as a
> directory.
>
> These are against Samba 3.5.15 but they should apply to other versions.
>
> After some feedback, I will clean them up and propose a patch for the
> master branch.

Here is a much simpler fix that uses the fallback idea:

[Richard_Sharpe at dev-gw-01 source3]$ diff -up libsmb/clifile.c.orig
libsmb/clifile.c
--- libsmb/clifile.c.orig       2012-10-26 10:04:06.000000000 -0700
+++ libsmb/clifile.c    2012-10-29 10:57:21.000000000 -0700
@@ -2294,14 +2294,15 @@ static void cli_open_done(struct tevent_
                return;
        }

-       if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED)) {
+       if (!NT_STATUS_EQUAL(status, NT_STATUS_NOT_SUPPORTED) &&
+               !NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY)) {
                tevent_req_nterror(req, status);
                return;
        }

        /*
         * For the new shiny OS/X Lion SMB server, try a ntcreate
-        * fallback.
+        * fallback. Also, when we are told it is a directory.
         */

        if (!map_open_params_to_ntcreate(state->fname, state->dos_deny,
@@ -2312,6 +2313,9 @@ static void cli_open_done(struct tevent_
                return;
        }

+       if (NT_STATUS_EQUAL(status, NT_STATUS_FILE_IS_A_DIRECTORY))
+               create_options = FILE_DIRECTORY_FILE;
+
        subreq = cli_ntcreate_send(state, state->ev, state->cli,
                                state->fname, 0, access_mask,
                                0, share_mode, create_disposition,



-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)


More information about the samba-technical mailing list