Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 22 Oct 2001 18:51:47 +0300
From:      Ruslan Ermilov <ru@FreeBSD.org>
To:        Paul Jansen <vlaero@yahoo.com.au>, Boris Popov <bp@FreeBSD.org>
Cc:        questions@FreeBSD.org, ports@FreeBSD.org
Subject:   Re: smbfs bug?
Message-ID:  <20011022185147.D31361@sunbay.com>
In-Reply-To: <20011022152205.47154.qmail@web12907.mail.yahoo.com>; from vlaero@yahoo.com.au on Tue, Oct 23, 2001 at 01:22:05AM %2B1000
References:  <20011022152205.47154.qmail@web12907.mail.yahoo.com>

next in thread | previous in thread | raw e-mail | index | archive | help

--3uo+9/B/ebqu+fSQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline

On Tue, Oct 23, 2001 at 01:22:05AM +1000, Paul Jansen wrote:
> I'm wondering whether I've come across a bug in smbfs.
>  I've maanged to get this working at home and it's
> doing a great job.  I brought one of my FreeBSD boxes
> into work tongight and plugged it into the LAN with
> the intention of showing smbfs to one of my
> co-workers.  I tried attaching to a workstation on the
> network and got the following error:
> 
> "mount_smbfs: server name 'auadwesm1511625' too long"
> 
> This NT workstation works fine on our network so I
> know that it isn't a problem.  As I mentioned earlier
> I've used  smbfs successfully at home but that with
> with machines that had netbios names less than 15
> characters in length.
> I know that netbios names can be 16 characters in
> length but that the 16th character is a reserved
> 'special' character used to denote a particular
> function.  15 character netbios names for machines are
> perfectly legal - does smbfs have a bug?
> 
Seems like a bug.

kernel/netsmb/smb.h:#define SMB_MAXSRVNAMELEN   15      /* NetBIOS limit */
lib/smb/ctx.c:  if (strlen(name) >= SMB_MAXSRVNAMELEN) {
lib/smb/ctx.c-          smb_error("server name '%s' too long", 0, name);

The attached patch (untested) should fix this.
Make sure to apply smb_conn.h patch in /usr/src/sys/net/netsmb,
if you have this directory, and recompile smbfs KLD and/or
your kernel (if you have it compiled in statically).


Cheers,
-- 
Ruslan Ermilov		Oracle Developer/DBA,
ru@sunbay.com		Sunbay Software AG,
ru@FreeBSD.org		FreeBSD committer,
+380.652.512.251	Simferopol, Ukraine

http://www.FreeBSD.org	The Power To Serve
http://www.oracle.com	Enabling The Information Age

--3uo+9/B/ebqu+fSQ
Content-Type: text/plain; charset=us-ascii
Content-Disposition: attachment; filename=p

diff --exclude=CVS -ru smbfs-1.4.1/kernel/netsmb/smb_conn.h smbfs-1.4.1/kernel/netsmb/smb_conn.h
--- smbfs-1.4.1/kernel/netsmb/smb_conn.h	Tue Apr 10 08:37:22 2001
+++ smbfs-1.4.1/kernel/netsmb/smb_conn.h	Mon Oct 22 18:47:08 2001
@@ -148,7 +148,7 @@
 	int		flags;
 	enum smbiod_state iodstate;
 	struct smb_sopt	sopt;
-	char		srvname[SMB_MAXSRVNAMELEN];
+	char		srvname[SMB_MAXSRVNAMELEN + 1];
 	char		vcname[128];
 };
 
diff --exclude=CVS -ru smbfs-1.4.1/lib/smb/ctx.c smbfs-1.4.1/lib/smb/ctx.c
--- smbfs-1.4.1/lib/smb/ctx.c	Fri Apr  6 18:47:14 2001
+++ smbfs-1.4.1/lib/smb/ctx.c	Mon Oct 22 18:47:16 2001
@@ -266,7 +266,7 @@
 int
 smb_ctx_setserver(struct smb_ctx *ctx, const char *name)
 {
-	if (strlen(name) >= SMB_MAXSRVNAMELEN) {
+	if (strlen(name) > SMB_MAXSRVNAMELEN) {
 		smb_error("server name '%s' too long", 0, name);
 		return ENAMETOOLONG;
 	}

--3uo+9/B/ebqu+fSQ--

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20011022185147.D31361>