Subject: mount_smbfs aborts on 15 char server names [patch]
To: None <current-users@netbsd.org>
From: Matt Rickard <mjr6140@gmail.com>
List: current-users
Date: 05/01/2006 12:16:44
mount_smbfs will not mount shares from server names of 15 chars.=20
However, these server names are valid. This issue was mentioned on
the FreeBSD lists at
http://www.daemonnews.org/mailinglists/FreeBSD/freebsd-ports/msg72292.html
with a possible patch. I've tested this on -current and it seems to
fix the problem (patch below).
However, now mount_smbfs attempts to mount the share but fails with:
mount_smbfs: unable to open connection
mount_smbfs: mount error for /mnt: Socket is not connected
Does the fix below look correct? What is causing the 'unable to open
connection' error? The same share works fine through smbclient.
Index: ctx.c
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/dist/smbfs/lib/smb/ctx.c,v
retrieving revision 1.9
diff -u -r1.9 ctx.c
--- ctx.c 21 Mar 2004 12:30:51 -0000 1.9
+++ ctx.c 1 May 2006 05:44:36 -0000
@@ -301,7 +301,7 @@
}
}
- if (strlen(name) >=3D SMB_MAXSRVNAMELEN) {
+ if (strlen(name) > SMB_MAXSRVNAMELEN) {
smb_error("server name '%s' too long", 0, name);
return ENAMETOOLONG;
}
Index: smb_conn.h
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
RCS file: /cvsroot/src/sys/netsmb/smb_conn.h,v
retrieving revision 1.17
diff -u -r1.17 smb_conn.h
--- smb_conn.h 11 Dec 2005 12:25:16 -0000 1.17
+++ smb_conn.h 1 May 2006 05:46:14 -0000
@@ -151,7 +151,7 @@
int flags;
enum smbiod_state iodstate;
struct smb_sopt sopt;
- char srvname[SMB_MAXSRVNAMELEN];
+ char srvname[SMB_MAXSRVNAMELEN + 1];
char vcname[128];
};