diff options
author | Jeremy Allison <jra@samba.org> | 2003-12-01 01:04:04 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2003-12-01 01:04:04 +0000 |
commit | 12d3246a6c0fe2d6241d7f7ec8573b263a559390 (patch) | |
tree | 97ed32a18e7037a4bcb072cd97760914e087ef41 /source3/libsmb/clitrans.c | |
parent | 2ad1159990f5f1be37af12d36b35def37d69ab25 (diff) | |
download | samba-12d3246a6c0fe2d6241d7f7ec8573b263a559390.tar.gz samba-12d3246a6c0fe2d6241d7f7ec8573b263a559390.tar.bz2 samba-12d3246a6c0fe2d6241d7f7ec8573b263a559390.zip |
Better fix for client signing bug. Ensure we don't malloc/free trans signing
state info each packet.
Jeremy.
(This used to be commit 818cf32d6330f7e7855ce662326003e75d4a1d46)
Diffstat (limited to 'source3/libsmb/clitrans.c')
-rw-r--r-- | source3/libsmb/clitrans.c | 56 |
1 files changed, 26 insertions, 30 deletions
diff --git a/source3/libsmb/clitrans.c b/source3/libsmb/clitrans.c index 3eb7fcc216..1602dcc683 100644 --- a/source3/libsmb/clitrans.c +++ b/source3/libsmb/clitrans.c @@ -50,6 +50,12 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, SCVAL(cli->outbuf,smb_com,trans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); + + /* + * Save the mid we're using. We need this for finding + * signing replies. + */ + mid = cli->mid; if (pipe_name) { @@ -87,16 +93,13 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, show_msg(cli->outbuf); - cli_signing_trans_start(cli); if (!cli_send_smb(cli)) { - cli_signing_trans_stop(cli); return False; } if (this_ldata < ldata || this_lparam < lparam) { /* receive interim response */ if (!cli_receive_smb(cli) || cli_is_error(cli)) { - cli_signing_trans_stop(cli); return(False); } @@ -130,23 +133,14 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, memcpy(outdata,data+tot_data,this_ldata); cli_setup_bcc(cli, outdata+this_ldata); - /* Ensure this packet has the same MID as - * the primary. Important in signing. JRA. */ - cli->mid = mid; - /* - * Turns out that we need to increment the - * sequence number for each packet until the - * last one in the signing sequence. That's - * the one that matters to check signing replies. JRA. + * Save the mid we're using. We need this for finding + * signing replies. */ - - cli_signing_trans_stop(cli); - cli_signing_trans_start(cli); + mid = cli->mid; show_msg(cli->outbuf); if (!cli_send_smb(cli)) { - cli_signing_trans_stop(cli); return False; } @@ -155,6 +149,10 @@ BOOL cli_send_trans(struct cli_state *cli, int trans, } } + /* Note we're in a trans state. Save the sequence + * numbers for replies. */ + + cli_signing_trans_start(cli, mid); return(True); } @@ -362,6 +360,12 @@ BOOL cli_send_nt_trans(struct cli_state *cli, SCVAL(cli->outbuf,smb_com,SMBnttrans); SSVAL(cli->outbuf,smb_tid, cli->cnum); cli_setup_packet(cli); + + /* + * Save the mid we're using. We need this for finding + * signing replies. + */ + mid = cli->mid; outparam = smb_buf(cli->outbuf)+3; @@ -391,16 +395,13 @@ BOOL cli_send_nt_trans(struct cli_state *cli, cli_setup_bcc(cli, outdata+this_ldata); show_msg(cli->outbuf); - cli_signing_trans_start(cli); if (!cli_send_smb(cli)) { - cli_signing_trans_stop(cli); return False; } if (this_ldata < ldata || this_lparam < lparam) { /* receive interim response */ if (!cli_receive_smb(cli) || cli_is_error(cli)) { - cli_signing_trans_stop(cli); return(False); } @@ -433,24 +434,15 @@ BOOL cli_send_nt_trans(struct cli_state *cli, memcpy(outdata,data+tot_data,this_ldata); cli_setup_bcc(cli, outdata+this_ldata); - /* Ensure this packet has the same MID as - * the primary. Important in signing. JRA. */ - cli->mid = mid; - /* - * Turns out that we need to increment the - * sequence number for each packet until the - * last one in the signing sequence. That's - * the one that matters to check signing replies. JRA. + * Save the mid we're using. We need this for finding + * signing replies. */ - - cli_signing_trans_stop(cli); - cli_signing_trans_start(cli); + mid = cli->mid; show_msg(cli->outbuf); if (!cli_send_smb(cli)) { - cli_signing_trans_stop(cli); return False; } @@ -459,6 +451,10 @@ BOOL cli_send_nt_trans(struct cli_state *cli, } } + /* Note we're in a trans state. Save the sequence + * numbers for replies. */ + + cli_signing_trans_start(cli, mid); return(True); } |