summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2007-04-19 20:50:49 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:19:30 -0500
commitdc90cd89a7fef3b0a744ef1873193cf2c9d75cad (patch)
tree33829db8298e704caba2679aa27d3ff99bf411a2 /source3/lib
parent20086f66cc32951da69aa357bc19c14d31a3913a (diff)
downloadsamba-dc90cd89a7fef3b0a744ef1873193cf2c9d75cad.tar.gz
samba-dc90cd89a7fef3b0a744ef1873193cf2c9d75cad.tar.bz2
samba-dc90cd89a7fef3b0a744ef1873193cf2c9d75cad.zip
r22389: Start preparing for multiple encryption contexts in the
server. Allow server to reflect back to calling client the encryption context that was sent. Jeremy. (This used to be commit b49e90335d1e589916b5ab4992e3c4a2d221ca7e)
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c20
1 files changed, 13 insertions, 7 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index b1db36c250..bb92466a05 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -533,14 +533,20 @@ void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num)
Set the length and marker of an smb packet.
********************************************************************/
-void smb_setlen(char *buf,int len)
+void smb_setlen(char *buf,int len,const char *frombuf)
{
_smb_setlen(buf,len);
- SCVAL(buf,4,0xFF);
- SCVAL(buf,5,'S');
- SCVAL(buf,6,'M');
- SCVAL(buf,7,'B');
+ if (frombuf) {
+ if (buf != frombuf) {
+ memcpy(buf+4, frombuf+4, 4);
+ }
+ } else {
+ SCVAL(buf,4,0xFF);
+ SCVAL(buf,5,'S');
+ SCVAL(buf,6,'M');
+ SCVAL(buf,7,'B');
+ }
}
/*******************************************************************
@@ -554,7 +560,7 @@ int set_message(char *buf,int num_words,int num_bytes,BOOL zero)
}
SCVAL(buf,smb_wct,num_words);
SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
- smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
+ smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4, NULL);
return (smb_size + num_words*2 + num_bytes);
}
@@ -566,7 +572,7 @@ int set_message_bcc(char *buf,int num_bytes)
{
int num_words = CVAL(buf,smb_wct);
SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes);
- smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4);
+ smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4, NULL);
return (smb_size + num_words*2 + num_bytes);
}