From 9515de83a864250c417cf490b7be714c8e1e127e Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Thu, 17 Jul 2003 00:58:14 +0000 Subject: [PATCH] Correctly toggle the signing state to what it was previosly when sending an oplock break. Jeremy. --- source/libsmb/smb_signing.c | 17 +++++------------ source/smbd/oplock.c | 11 ++++++++--- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/source/libsmb/smb_signing.c b/source/libsmb/smb_signing.c index 8e3a4ff8d82..23611f3e3bf 100644 --- a/source/libsmb/smb_signing.c +++ b/source/libsmb/smb_signing.c @@ -491,21 +491,14 @@ static struct smb_sign_info srv_sign_info = { }; /*********************************************************** - Turn on signing after sending an oplock break. + Turn signing off or on for oplock break code. ************************************************************/ -void srv_enable_signing(void) +BOOL srv_oplock_set_signing(BOOL onoff) { - srv_sign_info.doing_signing = True; -} - -/*********************************************************** - Turn off signing before sending an oplock break. -************************************************************/ - -void srv_disable_signing(void) -{ - srv_sign_info.doing_signing = False; + BOOL ret = srv_sign_info.doing_signing; + srv_sign_info.doing_signing = onoff; + return ret; } /*********************************************************** diff --git a/source/smbd/oplock.c b/source/smbd/oplock.c index bd52b0066d6..ab7c6e8344a 100644 --- a/source/smbd/oplock.c +++ b/source/smbd/oplock.c @@ -660,6 +660,7 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, time_t start_time; BOOL shutdown_server = False; BOOL oplock_timeout = False; + BOOL sign_state; connection_struct *saved_user_conn; connection_struct *saved_fsp_conn; int saved_vuid; @@ -742,12 +743,16 @@ static BOOL oplock_break(SMB_DEV_T dev, SMB_INO_T inode, unsigned long file_id, /* Remember if we just sent a break to level II on this file. */ fsp->sent_oplock_break = using_levelII? LEVEL_II_BREAK_SENT:EXCLUSIVE_BREAK_SENT; - srv_disable_signing(); + /* Save the server smb signing state. */ + sign_state = srv_oplock_set_signing(False); + if (!send_smb(smbd_server_fd(), outbuf)) { - srv_enable_signing(); + srv_oplock_set_signing(sign_state); exit_server("oplock_break: send_smb failed."); } - srv_enable_signing(); + + /* Restore the sign state to what it was. */ + srv_oplock_set_signing(sign_state); /* We need this in case a readraw crosses on the wire. */ global_oplock_break = True;