Possible fix for TRANS2SCAN and NTTRANSSCAN bitrot in smbtorture ...
Jeremy Allison
jra at samba.org
Thu Nov 1 15:32:03 MDT 2012
On Mon, Oct 29, 2012 at 11:02:52AM -0700, Richard Sharpe wrote:
> 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,
>
>
>
So this fix applies to 3.6.x and 3.5.x, but not to 4.0.x or
above. Do you want to raise a bug and get this added there ?
Jeremy.
More information about the samba-technical
mailing list