Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys - fix endian cofusion around FID, which is used as is, s...



details:   https://anonhg.NetBSD.org/src/rev/4468edc4d0c4
branches:  trunk
changeset: 782875:4468edc4d0c4
user:      nakayama <nakayama%NetBSD.org@localhost>
date:      Sat Nov 24 19:48:24 2012 +0000

description:
- 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.

diffstat:

 sys/fs/smbfs/smbfs_smb.c |  9 ++++-----
 sys/netsmb/smb_smb.c     |  8 ++++----
 2 files changed, 8 insertions(+), 9 deletions(-)

diffs (80 lines):

diff -r 89bd6eaa0f9c -r 4468edc4d0c4 sys/fs/smbfs/smbfs_smb.c
--- a/sys/fs/smbfs/smbfs_smb.c  Sat Nov 24 18:16:15 2012 +0000
+++ b/sys/fs/smbfs/smbfs_smb.c  Sat Nov 24 19:48:24 2012 +0000
@@ -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 @@
                        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 @@
        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 @@
        flen = mbp->mb_count;
        SMBRQ_PUTLE16(nmlen, flen);
 
+       smb_rq_bend(rqp);
        error = smb_rq_simple(rqp);
        if (error)
                goto bad;
diff -r 89bd6eaa0f9c -r 4468edc4d0c4 sys/netsmb/smb_smb.c
--- a/sys/netsmb/smb_smb.c      Sat Nov 24 18:16:15 2012 +0000
+++ b/sys/netsmb/smb_smb.c      Sat Nov 24 19:48:24 2012 +0000
@@ -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 @@
                                        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 @@
                                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;



Home | Main Index | Thread Index | Old Index