- fix endian cofusion around FID, which is used as is, so no need

to do byte swapping.
- put right value to ByteCount of SMB_COM_NT_CREATE_ANDX request.

The fix makes smbfs actually works on big-endian port.
This commit is contained in:
nakayama 2012-11-24 19:48:24 +00:00
parent e1d0e8f360
commit 5f60ff96cb
2 changed files with 8 additions and 9 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_smb.c,v 1.42 2011/09/27 02:05:10 christos Exp $ */
/* $NetBSD: smbfs_smb.c,v 1.43 2012/11/24 19:48:24 nakayama 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.42 2011/09/27 02:05:10 christos Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_smb.c,v 1.43 2012/11/24 19:48:24 nakayama Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -689,7 +689,7 @@ smbfs_smb_create(struct smbnode *dnp, const char *name, int nmlen,
smb_rq_getreply(rqp, &mdp);
md_get_uint8(mdp, &wc);
if (wc == 1)
md_get_uint16le(mdp, &fid);
md_get_uint16(mdp, &fid);
else
error = EBADRPC;
}
@ -1422,8 +1422,6 @@ smbfs_smb_ntcreatex(struct smbnode *np, int accmode,
mb_put_uint8(mbp, 0); /* Security tracking mode flags */
smb_rq_wend(rqp);
smb_rq_bstart(rqp);
smb_rq_bend(rqp);
mbp->mb_count = 0;
error = smbfs_fullpath(mbp, SSTOVC(ssp), np, NULL, 0);
if (error)
@ -1435,6 +1433,7 @@ smbfs_smb_ntcreatex(struct smbnode *np, int accmode,
flen = mbp->mb_count;
SMBRQ_PUTLE16(nmlen, flen);
smb_rq_bend(rqp);
error = smb_rq_simple(rqp);
if (error)
goto bad;

View File

@ -1,4 +1,4 @@
/* $NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $ */
/* $NetBSD: smb_smb.c,v 1.33 2012/11/24 19:48:25 nakayama Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smb_smb.c,v 1.32 2009/10/18 23:20:31 tron Exp $");
__KERNEL_RCSID(0, "$NetBSD: smb_smb.c,v 1.33 2012/11/24 19:48:25 nakayama Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -175,7 +175,7 @@ smb_smb_negotiate(struct smb_vc *vcp, struct smb_cred *scred)
SMBERROR(("Unexpected length of security blob (%d)\n", sblen));
break;
}
error = md_get_uint16(mdp, &bc);
error = md_get_uint16le(mdp, &bc);
if (error)
break;
if (sp->sv_caps & SMB_CAP_EXT_SECURITY)
@ -210,7 +210,7 @@ smb_smb_negotiate(struct smb_vc *vcp, struct smb_cred *scred)
if (swlen > SMB_MAXCHALLENGELEN)
break;
md_get_uint16(mdp, NULL); /* mbz */
if (md_get_uint16(mdp, &bc) != 0)
if (md_get_uint16le(mdp, &bc) != 0)
break;
if (bc < swlen)
break;