diff options
author | Jeremy Allison <jra@samba.org> | 2004-06-11 23:54:52 +0000 |
---|---|---|
committer | Gerald (Jerry) Carter <jerry@samba.org> | 2007-10-10 10:51:56 -0500 |
commit | 58686e844f30e0c1712ec87d7f1b3e743d09be96 (patch) | |
tree | 0a12d81b1d2df90220b001e4f49b38f795d02042 /source3 | |
parent | fddef6fc201ed127eaac737e725d1c2dd8c6926e (diff) | |
download | samba-58686e844f30e0c1712ec87d7f1b3e743d09be96.tar.gz samba-58686e844f30e0c1712ec87d7f1b3e743d09be96.tar.bz2 samba-58686e844f30e0c1712ec87d7f1b3e743d09be96.zip |
r1117: Doh ! Remember to turn off signing when sending a "break to level II" oplock
message, or we mess up the signing sequence number.... Also improve sign error
reporting. Also when deferring an open that had been deferred due to an oplock
break, don't re-add the mid to the pending sign queue or we increment the sequence
number twice and mess up signing again...
I can now bounce between 2 WinXP/Win2003 boxes opening Excel spreadsheets with
signing turned on and get correct "file in use" messages.
Jeremy.
(This used to be commit 1745ce4e2cf7fcb4c27c077973258d157cd241b1)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/libsmb/smb_signing.c | 34 | ||||
-rw-r--r-- | source3/smbd/oplock.c | 10 |
2 files changed, 33 insertions, 11 deletions
diff --git a/source3/libsmb/smb_signing.c b/source3/libsmb/smb_signing.c index 63838e6933..868c991c16 100644 --- a/source3/libsmb/smb_signing.c +++ b/source3/libsmb/smb_signing.c @@ -42,11 +42,18 @@ struct smb_basic_signing_context { struct outstanding_packet_lookup *outstanding_packet_list; }; -static void store_sequence_for_reply(struct outstanding_packet_lookup **list, +static BOOL store_sequence_for_reply(struct outstanding_packet_lookup **list, uint16 mid, uint32 reply_seq_num) { struct outstanding_packet_lookup *t; + /* Ensure we only add a mid once. */ + for (t = *list; t; t = t->next) { + if (t->mid == mid) { + return False; + } + } + t = smb_xmalloc(sizeof(*t)); ZERO_STRUCTP(t); @@ -65,6 +72,7 @@ static void store_sequence_for_reply(struct outstanding_packet_lookup **list, DLIST_ADD(*list, t); DEBUG(10,("store_sequence_for_reply: stored seq = %u mid = %u\n", (unsigned int)reply_seq_num, (unsigned int)mid )); + return True; } static BOOL get_sequence_for_reply(struct outstanding_packet_lookup **list, @@ -748,14 +756,16 @@ static BOOL srv_check_incoming_message(char *inbuf, struct smb_sign_info *si, BO if (!good) { - DEBUG(0, ("srv_check_incoming_message: BAD SIG: seq %u wanted SMB signature of\n", - (unsigned int)saved_seq)); - dump_data(5, (const char *)calc_md5_mac, 8); - - DEBUG(0, ("srv_check_incoming_message: BAD SIG: seq %u got SMB signature of\n", + if (saved_seq) { + DEBUG(0, ("srv_check_incoming_message: BAD SIG: seq %u wanted SMB signature of\n", (unsigned int)saved_seq)); - dump_data(5, (const char *)server_sent_mac, 8); + dump_data(5, (const char *)calc_md5_mac, 8); + DEBUG(0, ("srv_check_incoming_message: BAD SIG: seq %u got SMB signature of\n", + (unsigned int)reply_seq_number)); + dump_data(5, (const char *)server_sent_mac, 8); + } + #if 1 /* JRATEST */ { int i; @@ -848,9 +858,13 @@ void srv_defer_sign_response(uint16 mid) if (!data) return; - store_sequence_for_reply(&data->outstanding_packet_list, - mid, data->send_seq_num); - data->send_seq_num++; + /* + * Ensure we only store this mid reply once... + */ + + if (store_sequence_for_reply(&data->outstanding_packet_list, mid, data->send_seq_num)) { + data->send_seq_num++; + } } /*********************************************************** diff --git a/source3/smbd/oplock.c b/source3/smbd/oplock.c index c34fa60954..1ffc798b1f 100644 --- a/source3/smbd/oplock.c +++ b/source3/smbd/oplock.c @@ -616,6 +616,8 @@ BOOL oplock_break_level2(files_struct *fsp, BOOL local_request, int token) */ if (global_client_caps & CAP_LEVEL_II_OPLOCKS) { + BOOL sign_state; + /* * If we are sending an oplock break due to an SMB sent * by our own client we ensure that we wait at leat @@ -627,10 +629,16 @@ BOOL oplock_break_level2(files_struct *fsp, BOOL local_request, int token) wait_before_sending_break(local_request); /* Prepare the SMBlockingX message. */ - prepare_break_message( outbuf, fsp, False); + + /* Save the server smb signing state. */ + sign_state = srv_oplock_set_signing(False); + if (!send_smb(smbd_server_fd(), outbuf)) exit_server("oplock_break_level2: send_smb failed."); + + /* Restore the sign state to what it was. */ + srv_oplock_set_signing(sign_state); } /* |