Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/netbsd-7]: src Pull up following revision(s) (requested by nakayama in t...
details: https://anonhg.NetBSD.org/src/rev/05de8b6c42d7
branches: netbsd-7
changeset: 798640:05de8b6c42d7
user: martin <martin%NetBSD.org@localhost>
date: Mon Dec 01 09:31:39 2014 +0000
description:
Pull up following revision(s) (requested by nakayama in ticket #275):
sys/rump/dev/lib/libnetsmb/netsmb_iconv.c: revision 1.1
external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8: revision 1.3
sys/netsmb/smb_subr.c: revision 1.37
external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8: revision 1.4
sys/fs/smbfs/smbfs_subr.c: revision 1.17
sys/rump/dev/lib/libnetsmb/Makefile: revision 1.5
sys/fs/smbfs/smbfs_smb.c: revision 1.46
sys/fs/smbfs/smbfs_node.c: revision 1.52
sys/netsmb/mchain.h: revision 1.10
external/bsd/smbfs/dist/lib/smb/ctx.c: revision 1.3
sys/netsmb/subr_mchain.c: revision 1.23
sys/rump/dev/lib/libnetsmb/netsmb_user.c: revision 1.1
sys/rump/dev/lib/libnetsmb/netsmb_user.c: revision 1.2
sys/rump/dev/lib/libnetsmb/netsmb_user.c: revision 1.3
sys/rump/dev/lib/libnetsmb/netsmb_user.h: revision 1.1
sys/netsmb/iconv.c: revision 1.14
external/bsd/smbfs/dist/smbutil/smbutil.1: revision 1.3
sys/fs/smbfs/smbfs_subr.h: revision 1.22
Make rump_smbfs(8) uses host iconv(3) to convert filenames
character set on NetBSD hosts.
Adjust smbfs/netsmb for filenames byte length changes that come as
a result of iconv conversion. Most codes are taken from FreeBSD.
Disable unused codes that causes SIGBUS or SIGSEGV if character
sets option (-E) is specified to mount_smbfs/rump_smbfs.
Adjust man page accordingly.
diffstat:
external/bsd/smbfs/dist/lib/smb/ctx.c | 6 +-
external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8 | 17 +++-
external/bsd/smbfs/dist/smbutil/smbutil.1 | 4 +-
sys/fs/smbfs/smbfs_node.c | 8 +-
sys/fs/smbfs/smbfs_smb.c | 10 +-
sys/fs/smbfs/smbfs_subr.c | 38 +++++++-
sys/fs/smbfs/smbfs_subr.h | 4 +-
sys/netsmb/iconv.c | 34 +++++--
sys/netsmb/mchain.h | 3 +-
sys/netsmb/smb_subr.c | 19 +++-
sys/netsmb/subr_mchain.c | 24 +++-
sys/rump/dev/lib/libnetsmb/Makefile | 5 +-
sys/rump/dev/lib/libnetsmb/netsmb_iconv.c | 79 ++++++++++++++++++
sys/rump/dev/lib/libnetsmb/netsmb_user.c | 98 +++++++++++++++++++++++
sys/rump/dev/lib/libnetsmb/netsmb_user.h | 31 +++++++
15 files changed, 332 insertions(+), 48 deletions(-)
diffs (truncated from 691 to 300 lines):
diff -r bce09962d7e9 -r 05de8b6c42d7 external/bsd/smbfs/dist/lib/smb/ctx.c
--- a/external/bsd/smbfs/dist/lib/smb/ctx.c Mon Dec 01 09:02:26 2014 +0000
+++ b/external/bsd/smbfs/dist/lib/smb/ctx.c Mon Dec 01 09:31:39 2014 +0000
@@ -33,7 +33,7 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: ctx.c,v 1.2 2013/12/25 22:03:15 christos Exp $");
+__RCSID("$NetBSD: ctx.c,v 1.2.6.1 2014/12/01 09:31:40 martin Exp $");
#include <sys/param.h>
#include <sys/sysctl.h>
@@ -501,8 +501,10 @@
struct sockaddr *sap;
struct sockaddr_nb *salocal, *saserver;
char *cp;
+#ifdef notyet
u_char cstbl[256];
u_int i;
+#endif
int error = 0;
ctx->ct_flags &= ~SMBCF_RESOLVED;
@@ -531,6 +533,7 @@
error = smb_addiconvtbl("toupper", ssn->ioc_localcs, nls_upper);
if (error)
return error;
+#ifdef notyet
if (ssn->ioc_servercs[0] != 0) {
for(i = 0; i < sizeof(cstbl); i++)
cstbl[i] = i;
@@ -545,6 +548,7 @@
if (error)
return error;
}
+#endif
if (ctx->ct_srvaddr) {
error = nb_resolvehost_in(ctx->ct_srvaddr, &sap);
} else {
diff -r bce09962d7e9 -r 05de8b6c42d7 external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8
--- a/external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8 Mon Dec 01 09:02:26 2014 +0000
+++ b/external/bsd/smbfs/dist/mount_smbfs/mount_smbfs.8 Mon Dec 01 09:31:39 2014 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: mount_smbfs.8,v 1.2 2013/12/25 22:03:15 christos Exp $
+.\" $NetBSD: mount_smbfs.8,v 1.2.6.1 2014/12/01 09:31:40 martin Exp $
.\" Id: mount_smbfs.8,v 1.8 2000/06/09 13:52:56 bp Exp
.\"
.\" Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -25,7 +25,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd November 9, 2003
+.Dd November 17, 2014
.Dt MOUNT_SMBFS 8
.Os
.Sh NAME
@@ -189,6 +189,7 @@
.Pp
.Dl "//guest@samba/public /smb/public smbfs rw,noauto 0 0"
.Sh SEE ALSO
+.Xr smbutil 1 ,
.Xr mount 8
.Sh HISTORY
Support for SMBFS first appeared in
@@ -207,3 +208,15 @@
and
.An Jaromir Dolecek
.Aq jdolecek%NetBSD.org@localhost .
+.Sh BUGS
+The
+.Fl E
+option works only if you mount with
+.Xr rump_smbfs 8
+instead of
+.Nm .
+.Pp
+The
+.Fl c
+option is not implemented yet.
+It is silently ignored for now.
diff -r bce09962d7e9 -r 05de8b6c42d7 external/bsd/smbfs/dist/smbutil/smbutil.1
--- a/external/bsd/smbfs/dist/smbutil/smbutil.1 Mon Dec 01 09:02:26 2014 +0000
+++ b/external/bsd/smbfs/dist/smbutil/smbutil.1 Mon Dec 01 09:31:39 2014 +0000
@@ -124,9 +124,11 @@
.It Pa ~/.nsmbrc
Keeps description for each connection.
See
-.Pa ./examples/dot.nsmbrc
+.Pa /usr/share/examples/smbfs/dot.nsmbrc
for details.
.El
+.Sh SEE ALSO
+.Xr mount_smbfs 8
.Sh AUTHORS
.An Boris Popov Aq Mt bp%butya.kz@localhost ,
.Aq bp%FreeBSD.org@localhost
diff -r bce09962d7e9 -r 05de8b6c42d7 sys/fs/smbfs/smbfs_node.c
--- a/sys/fs/smbfs/smbfs_node.c Mon Dec 01 09:02:26 2014 +0000
+++ b/sys/fs/smbfs/smbfs_node.c Mon Dec 01 09:31:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_node.c,v 1.51 2014/01/28 13:23:49 martin Exp $ */
+/* $NetBSD: smbfs_node.c,v 1.51.4.1 2014/12/01 09:31:40 martin Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.51 2014/01/28 13:23:49 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.51.4.1 2014/12/01 09:31:40 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -197,10 +197,10 @@
|| memcmp(name, np2->n_name, nmlen) != 0)
continue;
mutex_exit(&smp->sm_hashlock);
- pool_put(&smbfs_node_pool, np);
- ungetnewvnode(vp);
if ((np->n_flag & NREFPARENT) != 0)
vrele(dvp);
+ ungetnewvnode(vp);
+ pool_put(&smbfs_node_pool, np);
goto retry;
}
diff -r bce09962d7e9 -r 05de8b6c42d7 sys/fs/smbfs/smbfs_smb.c
--- a/sys/fs/smbfs/smbfs_smb.c Mon Dec 01 09:02:26 2014 +0000
+++ b/sys/fs/smbfs/smbfs_smb.c Mon Dec 01 09:31:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_smb.c,v 1.44.12.1 2014/10/20 09:55:54 martin Exp $ */
+/* $NetBSD: smbfs_smb.c,v 1.44.12.2 2014/12/01 09:31:40 martin Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_smb.c,v 1.44.12.1 2014/10/20 09:55:54 martin Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_smb.c,v 1.44.12.2 2014/12/01 09:31:40 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -1129,7 +1129,7 @@
smbfs_findopenLM2(struct smbfs_fctx *ctx, struct smbnode *dnp,
const char *wildcard, int wclen, int attr, struct smb_cred *scred)
{
- ctx->f_name = malloc(SMB_MAXNAMLEN, M_SMBFSDATA, M_WAITOK);
+ ctx->f_name = malloc(SMB_MAXNAMLEN * 2, M_SMBFSDATA, M_WAITOK);
if (ctx->f_name == NULL)
return ENOMEM;
ctx->f_infolevel = SMB_DIALECT(SSTOVC(ctx->f_ssp)) < SMB_DIALECT_NTLM0_12 ?
@@ -1212,7 +1212,7 @@
return EINVAL;
#endif
}
- nmlen = min(size, SMB_MAXNAMLEN);
+ nmlen = min(size, SMB_MAXNAMLEN * 2);
cp = ctx->f_name;
error = md_get_mem(mbp, cp, nmlen, MB_MSYSTEM);
if (error)
@@ -1316,7 +1316,7 @@
continue;
break;
}
- smbfs_fname_tolocal(SSTOVC(ctx->f_ssp), ctx->f_name, ctx->f_nmlen,
+ smbfs_fname_tolocal(SSTOVC(ctx->f_ssp), ctx->f_name, &ctx->f_nmlen,
ctx->f_dnp->n_mount->sm_caseopt);
ctx->f_attr.fa_ino = smbfs_getino(ctx->f_dnp, ctx->f_name, ctx->f_nmlen);
return 0;
diff -r bce09962d7e9 -r 05de8b6c42d7 sys/fs/smbfs/smbfs_subr.c
--- a/sys/fs/smbfs/smbfs_subr.c Mon Dec 01 09:02:26 2014 +0000
+++ b/sys/fs/smbfs/smbfs_subr.c Mon Dec 01 09:31:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_subr.c,v 1.16 2012/11/30 23:24:21 nakayama Exp $ */
+/* $NetBSD: smbfs_subr.c,v 1.16.12.1 2014/12/01 09:31:40 martin Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.16 2012/11/30 23:24:21 nakayama Exp $");
+__KERNEL_RCSID(0, "$NetBSD: smbfs_subr.c,v 1.16.12.1 2014/12/01 09:31:40 martin Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -318,14 +318,36 @@
}
int
-smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int nmlen,
+smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int *nmlen,
int caseopt)
{
-/* if (caseopt & SMB_CS_UPPER)
+ int error = 0;
+ size_t ilen, olen;
+ const char *ibuf;
+ char *obuf, *outbuf;
+
+#ifdef notyet
+ if (caseopt & SMB_CS_UPPER)
iconv_convmem(vcp->vc_toupper, name, name, nmlen);
else if (caseopt & SMB_CS_LOWER)
- iconv_convmem(vcp->vc_tolower, name, name, nmlen);*/
- if (vcp->vc_tolocal)
- iconv_convmem(vcp->vc_tolocal, name, name, nmlen);
- return 0;
+ iconv_convmem(vcp->vc_tolower, name, name, nmlen);
+#endif
+ if (vcp->vc_tolocal) {
+ const size_t buflen = SMB_MAXNAMLEN * 2;
+
+ outbuf = malloc(buflen, M_SMBTEMP, M_WAITOK);
+ if (outbuf == NULL)
+ return ENOMEM;
+ ilen = *nmlen;
+ olen = buflen;
+ ibuf = name;
+ obuf = outbuf;
+ error = iconv_conv(vcp->vc_tolocal, &ibuf, &ilen, &obuf, &olen);
+ if (!error) {
+ *nmlen = buflen - olen;
+ memcpy(name, outbuf, *nmlen);
+ }
+ free(outbuf, M_SMBTEMP);
+ }
+ return error;
}
diff -r bce09962d7e9 -r 05de8b6c42d7 sys/fs/smbfs/smbfs_subr.h
--- a/sys/fs/smbfs/smbfs_subr.h Mon Dec 01 09:02:26 2014 +0000
+++ b/sys/fs/smbfs/smbfs_subr.h Mon Dec 01 09:31:39 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: smbfs_subr.h,v 1.21 2012/11/30 23:24:21 nakayama Exp $ */
+/* $NetBSD: smbfs_subr.h,v 1.21.12.1 2014/12/01 09:31:40 martin Exp $ */
/*
* Copyright (c) 2000-2001, Boris Popov
@@ -176,7 +176,7 @@
int smbfs_smb_lookup(struct smbnode *dnp, const char *name, int nmlen,
struct smbfattr *fap, struct smb_cred *scred);
-int smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int nmlen, int caseopt);
+int smbfs_fname_tolocal(struct smb_vc *vcp, char *name, int *nmlen, int caseopt);
void smb_time_local2server(struct timespec *tsp, int tzoff, u_long *seconds);
void smb_time_server2local(u_long seconds, int tzoff, struct timespec *tsp);
diff -r bce09962d7e9 -r 05de8b6c42d7 sys/netsmb/iconv.c
--- a/sys/netsmb/iconv.c Mon Dec 01 09:02:26 2014 +0000
+++ b/sys/netsmb/iconv.c Mon Dec 01 09:31:39 2014 +0000
@@ -1,41 +1,48 @@
-/* $NetBSD: iconv.c,v 1.13 2014/02/20 11:08:57 joerg Exp $ */
+/* $NetBSD: iconv.c,v 1.13.4.1 2014/12/01 09:31:40 martin Exp $ */
/* Public domain */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: iconv.c,v 1.13 2014/02/20 11:08:57 joerg Exp $");
+__KERNEL_RCSID(0, "$NetBSD: iconv.c,v 1.13.4.1 2014/12/01 09:31:40 martin Exp $");
#include <sys/param.h>
#include <sys/kernel.h>
#include <sys/systm.h>
#include <sys/errno.h>
-#include <sys/malloc.h>
#include <netsmb/iconv.h>
+/* stubs for iconv functions */
+int iconv_open_stub(const char *, const char *, void **);
+int iconv_close_stub(void *);
+int iconv_conv_stub(void *, const char **, size_t *, char **, size_t *);
+__weak_alias(iconv_open, iconv_open_stub);
+__weak_alias(iconv_close, iconv_close_stub);
+__weak_alias(iconv_conv, iconv_conv_stub);
+
int
-iconv_open(const char *to, const char *from,
+iconv_open_stub(const char *to, const char *from,
void **handle)
{
return 0;
}
int
-iconv_close(void *handle)
+iconv_close_stub(void *handle)
{
return 0;
}
int
-iconv_conv(void *handle, const char **inbuf,
+iconv_conv_stub(void *handle, const char **inbuf,
size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
Home |
Main Index |
Thread Index |
Old Index