From: Volker Lendecke on
On Sat, Nov 28, 2009 at 02:01:58PM +0100, Nagy Zoltan wrote:
> i'm trying to connect to my samba server from an openbsd system
> smbclient works perfectly from the client, but if i try to mount the
> share using shlight it refuses the connection and logs:
> negprot protocols not 0-terminated
>
> i was unable to find any occurances of this problem,
> i've read that the field should contain the host's name as
> a zero terminated string.

Please send a network trace of the attempt together with a
debug level 10 log of smbd. Information on how to create
useful network traces can be found under
http://wiki.samba.org/index.php/Capture_Packets

Thanks,

Volker
From: Nagy Zoltan on
Volker Lendecke wrote:
> Please send a network trace of the attempt together with a
> debug level 10 log of smbd. Information on how to create
> useful network traces can be found under
> http://wiki.samba.org/index.php/Capture_Packets
>
> Thanks,
>
> Volker

i've attached the requested info.

i've looked into the dump - and if i'm corret my samba server
requires at least lanman2.1 capable client.

--
Nagy Zoltan (kirk) <kirk(a)bteam.hu>
From: Volker Lendecke on
Hi!

On Sat, Nov 28, 2009 at 10:34:04PM +0100, Nagy Zoltan wrote:
> i've attached the requested info.
>
> i've looked into the dump - and if i'm corret my samba server
> requires at least lanman2.1 capable client.

Thanks. This is a bug in sharity, together with an incorrect
paranoia check in Samba 3.2 and 3.3.

sharity gets the calculation of the netbios packet length
wrong, both the negprot and the tcon packets have 4 bytes of
random garbage at the end. This needs fixing.

The incorrect paranoia check in smbd has been fixed
implicitly with Samba 3.4, the attached patch to 3.2 should
make you get over this step. If you need that in the next
Samba 3.2 version (and hope the best it's picked up by
Debian), please open a bug with Debian and Samba.

I've also attached a (completely untested) patch to Sharity
light. Maybe you want to give that also a test and try to
get that through the Sharity people and/or the OpenBSD
package process.

Volker
From: Volker Lendecke on
On Sun, Nov 29, 2009 at 01:26:43PM +0100, Volker Lendecke wrote:
> On Sun, Nov 29, 2009 at 01:22:08PM +0100, Volker Lendecke wrote:
> > I've also attached a (completely untested) patch to Sharity
> > light. Maybe you want to give that also a test and try to
> > get that through the Sharity people and/or the OpenBSD
> > package process.
>
> For reference, mailman has killed the attachments:

One should actually *test* patches :-)

Here's another one.

Volker


From 21fe07535ae9ed90aa036022e426cd7139b5faf4 Mon Sep 17 00:00:00 2001
From: Volker Lendecke <vl(a)samba.org>
Date: Sun, 29 Nov 2009 13:00:55 +0100
Subject: [PATCH] s3: In negprot, check for 0-termination via bcc, not smb packet length

---
source/smbd/negprot.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/source/smbd/negprot.c b/source/smbd/negprot.c
index 9f56949..c93f3c6 100644
--- a/source/smbd/negprot.c
+++ b/source/smbd/negprot.c
@@ -507,7 +507,7 @@ static const struct {

void reply_negprot(struct smb_request *req)
{
- size_t size = smb_len(req->inbuf) + 4;
+ size_t size = smb_buflen(req->inbuf);
int choice= -1;
int protocol;
char *p;
@@ -527,7 +527,9 @@ void reply_negprot(struct smb_request *req)
}
done_negprot = True;

- if (req->inbuf[size-1] != '\0') {
+ p = smb_buf(req->inbuf);
+
+ if (p[size-1] != '\0') {
DEBUG(0, ("negprot protocols not 0-terminated\n"));
reply_nterror(req, NT_STATUS_INVALID_PARAMETER);
END_PROFILE(SMBnegprot);
--
1.6.0.4