From 5ba229419b3a699ec55c1be0198838c3499ca93f Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 25 Aug 2006 18:07:21 +0000 Subject: [PATCH] windows-smb-alignment-20060825 on the wire smb data structures should be byte aligned --- src/WINNT/afsd/cm_callback.c | 2 +- src/WINNT/afsd/smb.h | 3 ++- src/WINNT/afsd/smb3.h | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/WINNT/afsd/cm_callback.c b/src/WINNT/afsd/cm_callback.c index 179330698..df53cfdde 100644 --- a/src/WINNT/afsd/cm_callback.c +++ b/src/WINNT/afsd/cm_callback.c @@ -121,7 +121,7 @@ void cm_CallbackNotifyChange(cm_scache_t *scp) Sleep(dwDelay); /* for directories, this sends a change notification on the dir itself */ - if (scp->fileType == CM_SCACHETYPE_DIRECTORY) { + if (scp->fileType == CM_SCACHETYPE_DIRECTORY) { #ifndef AFSIFS if (scp->flags & CM_SCACHEFLAG_ANYWATCH) smb_NotifyChange(0, diff --git a/src/WINNT/afsd/smb.h b/src/WINNT/afsd/smb.h index c4296b270..b14053965 100644 --- a/src/WINNT/afsd/smb.h +++ b/src/WINNT/afsd/smb.h @@ -16,6 +16,7 @@ #define AFS_LARGEFILES /* basic core protocol SMB structure */ +#pragma pack(push, 1) typedef struct smb { unsigned char id[4]; unsigned char com; @@ -33,7 +34,7 @@ typedef struct smb { unsigned char wct; unsigned char vdata[1]; } smb_t; - +#pragma pack(pop) /* reb values */ #define SMB_FLAGS_SUPPORT_LOCKREAD 0x01 diff --git a/src/WINNT/afsd/smb3.h b/src/WINNT/afsd/smb3.h index 836fe40c4..23bfa98fc 100644 --- a/src/WINNT/afsd/smb3.h +++ b/src/WINNT/afsd/smb3.h @@ -40,9 +40,12 @@ typedef struct smb_tran2Dispatch { long flags; } smb_tran2Dispatch_t; +/* Data Structures that are written to or read from the wire directly + * must be byte aligned (no padding). + */ +#pragma pack(push, 1) typedef struct smb_tran2QFSInfo { union { -#pragma pack(push, 2) struct { unsigned long FSID; /* file system ID */ unsigned long sectorsPerAllocUnit; @@ -50,7 +53,6 @@ typedef struct smb_tran2QFSInfo { unsigned long availAllocUnits; /* free blocks */ unsigned short bytesPerSector; /* bytes per sector */ } allocInfo; -#pragma pack(pop) struct { unsigned long vsn; /* volume serial number */ char vnCount; /* count of chars in label, incl null */ @@ -205,6 +207,7 @@ typedef struct { } QFfileNameInfo; } u; } smb_tran2QFileInfo_t; +#pragma pack(pop) /* more than enough opcodes for today, anyway */ #define SMB_TRAN2_NOPCODES 20 -- 2.39.5