diff options
author | Jeremy Allison <jra@samba.org> | 2004-01-17 00:30:28 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2004-01-17 00:30:28 +0000 |
commit | c0beb062c1b75435f7991f75202b9d99bb9989ba (patch) | |
tree | 24e50ce30a2b38c79970fd1ab0925def2f68ff46 /source3 | |
parent | 65ed5b5f6e52780706e1fcc30a39741a43aa3342 (diff) | |
download | samba-c0beb062c1b75435f7991f75202b9d99bb9989ba.tar.gz samba-c0beb062c1b75435f7991f75202b9d99bb9989ba.tar.bz2 samba-c0beb062c1b75435f7991f75202b9d99bb9989ba.zip |
Fix for a signing bug when the mid wraps.
Found by Fran Fabrizio <fran@cis.uab.edu>.
Add to the *start* of the list not the end of the list.
This ensures that the *last* send sequence with this mid
is returned by preference.
This can happen if the mid wraps and one of the early
mid numbers didn't get a reply and is still lurking on
the list.
Jeremy.
(This used to be commit b84d249e67315c153e0aa3c5c9adfcf6ca008f97)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/smb_signing.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/source3/libsmb/smb_signing.c b/source3/libsmb/smb_signing.c index 8a056f659f..9010dbf5cb 100644 --- a/source3/libsmb/smb_signing.c +++ b/source3/libsmb/smb_signing.c @@ -46,15 +46,23 @@ static void store_sequence_for_reply(struct outstanding_packet_lookup **list, uint16 mid, uint32 reply_seq_num) { struct outstanding_packet_lookup *t; - struct outstanding_packet_lookup *tmp; - + t = smb_xmalloc(sizeof(*t)); ZERO_STRUCTP(t); - DLIST_ADD_END(*list, t, tmp); t->mid = mid; t->reply_seq_num = reply_seq_num; + /* + * Add to the *start* of the list not the end of the list. + * This ensures that the *last* send sequence with this mid + * is returned by preference. + * This can happen if the mid wraps and one of the early + * mid numbers didn't get a reply and is still lurking on + * the list. JRA. Found by Fran Fabrizio <fran@cis.uab.edu>. + */ + + DLIST_ADD(*list, t); DEBUG(10,("store_sequence_for_reply: stored seq = %u mid = %u\n", (unsigned int)reply_seq_num, (unsigned int)mid )); } |