Fw: Windows 2000 breaks the samba client

Jason Perlow perlow at hotmail.com
Sat Feb 26 00:19:05 GMT 2000


Okay.. stupid question... where do I get the source tree for 2.0.7 beta to
make a clean new build of Samba with smbmount?

Jason
----- Original Message -----
From: "Jeremy Allison" <jeremy at valinux.com>
To: "Jason Perlow" <perlow at hotmail.com>
Cc: <sjvn at zd.com>; <mfoley at zd.com>; <samba at samba.org>; "Dwight Johnson"
<dwj at linuxtoday.com>; <editors at linuxtoday.com>; <jeremy at valinux.com>;
"Antoine BUSCH" <antoineb at corel.com>
Sent: Friday, February 25, 2000 11:57 AM
Subject: Re: Fw: Windows 2000 breaks the samba client


> Ok I've fixed it. Turns out it was a weird little bug in Win2k...
> well, maybe :-).
>
> It seems that the RAP functions in Win2k can't cope
> with a max buffer reply size of 64K (0xFFFF) - it returns "No server
> memory" instead of the requested reply. So I fixed the problem
> by dropping the buffer size reply from 0xFFFF to 0xFFE0 in
> the Samba client code - an empirical number determined by trial
> and error (as are so many things in Microsoft's protocol :-).
>
> The old buffer value of 0xFFFF works correctly with all previous
> versions of Windows (and should be the correct value to use,
> as you really do want to have the maximum permitted share
> list size returned), but Win2K seems to be "different". Hmmmm :-).
>
> I have attached the patch for 2.0.6 (it should apply
> cleanly to 2.0.6, and with a few minor offsets to older
> and newer versions of Samba as well) and also have checked
> the changes into the HEAD and 2.0.7 trees.
>
> I also took the opportunity to improve the error reporting
> of share enumeration failures in the client code (as we
> were just silently ignoring them).
>
> So, no malevolent Microsoft plots :-), just a plain old
> bug (sorry to dissapoint "X-Files" fans :-) :-). Whether
> this is a bug in Samba or in Win2k I'll leave the reader
> to decide...... (fade out with Twilight Zone music :-).
>
> What *is* clear is that Microsoft didn't regression test
> with the Samba *client* code (although I know they did
> with the server code).
>
> Here's the patch - enjoy :-).
>
> Cheers,
>
> Jeremy Allison,
> Samba Team.
>
> PS. Thanks to Antoine BUSCH from Corel Corp. for providing
> a very helpful hint. I *love* Open Source :-).
>
> PPS. Also thanks to VA Linux Systems (my employer) for allowing
> me to drop everything, run out and buy Win2K server, put it on
> a spare machine, and mess with it for a while :-).
>
> PPPS. Dwight, if you want to publish this in LinuxToday now,
> to let people know the facts ("Just the Facts Ma'am" :-) be my guest.
>
> ---------------------cut here-----------------------------
> --- libsmb/clientgen.c.orig Fri Feb 25 10:33:23 2000
> +++ libsmb/clientgen.c Fri Feb 25 10:33:31 2000
> @@ -600,7 +600,7 @@
>
/***************************************************************************
*
>  call a NetShareEnum - try and browse available connections on a host
>
****************************************************************************
/
> -BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *,
uint32, const char *))
> +int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *,
uint32, const char *))
>  {
>    char *rparam = NULL;
>    char *rdata = NULL;
> @@ -618,12 +618,16 @@
>    pstrcpy(p,"B13BWz");
>    p = skip_string(p,1);
>    SSVAL(p,0,1);
> -  SSVAL(p,2,0xFFFF);
> +  /*
> +   * Win2k needs a *smaller* buffer than 0xFFFF here -
> +   * it returns "out of server memory" with 0xFFFF !!! JRA.
> +   */
> +  SSVAL(p,2,0xFFE0);
>    p += 4;
>
>    if (cli_api(cli,
>                param, PTR_DIFF(p,param), 1024,  /* Param, length, maxlen
*/
> -              NULL, 0, 0xFFFF,            /* data, length, maxlen */
> +              NULL, 0, 0xFFE0,            /* data, length, maxlen - Win2k
needs a small buffer here too ! */
>                &rparam, &rprcnt,                /* return params, length
*/
>                &rdata, &rdrcnt))                /* return data, length */
>      {
> --- client/client.c.orig Wed Nov 10 18:35:59 1999
> +++ client/client.c Fri Feb 25 10:33:37 2000
> @@ -1555,10 +1555,15 @@
>
****************************************************************************
/
>  static BOOL browse_host(BOOL sort)
>  {
> + int ret;
> +
>          printf("\n\tSharename      Type      Comment\n");
>          printf("\t---------      ----      -------\n");
>
> - return cli_RNetShareEnum(cli, browse_fn);
> + if((ret = cli_RNetShareEnum(cli, browse_fn)) == -1)
> + printf("Error returning browse list: %s\n", cli_errstr(cli));
> +
> + return (ret != -1);
>  }
>
>
/***************************************************************************
*
> --- include/proto.h.orig Fri Feb 25 10:36:38 2000
> +++ include/proto.h Fri Feb 25 10:37:02 2000
> @@ -435,7 +435,7 @@
>        char **rparam, int *rprcnt,
>        char **rdata, int *rdrcnt);
>  BOOL cli_NetWkstaUserLogon(struct cli_state *cli,char *user, char
*workstation);
> -BOOL cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *,
uint32, const char *));
> +int cli_RNetShareEnum(struct cli_state *cli, void (*fn)(const char *,
uint32, const char *));
>  BOOL cli_NetServerEnum(struct cli_state *cli, char *workgroup, uint32
stype,
>          void (*fn)(const char *, uint32, const char *));
>  BOOL cli_session_setup(struct cli_state *cli,
> ---------------------cut here-----------------------------
> --
> --------------------------------------------------------
> Buying an operating system without source is like buying
> a self-assembly Space Shuttle with no instructions.
> --------------------------------------------------------
>


More information about the samba mailing list