From e5a951325a6cac8567af3a66de6d2df577508ae4 Mon Sep 17 00:00:00 2001 From: "Gerald (Jerry) Carter" Date: Wed, 10 Oct 2007 15:34:30 -0500 Subject: [GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch. (This used to be commit 5c6c8e1fe93f340005110a7833946191659d88ab) --- source3/lib/util.c | 48 ++++++++++++++---------------------------------- 1 file changed, 14 insertions(+), 34 deletions(-) (limited to 'source3/lib/util.c') diff --git a/source3/lib/util.c b/source3/lib/util.c index b98441ea53..adbebb04d4 100644 --- a/source3/lib/util.c +++ b/source3/lib/util.c @@ -514,51 +514,32 @@ void show_msg(char *buf) dump_data(10, (uint8 *)smb_buf(buf), bcc); } -/******************************************************************* - Set the length and marker of an encrypted smb packet. -********************************************************************/ - -void smb_set_enclen(char *buf,int len,uint16 enc_ctx_num) -{ - _smb_setlen(buf,len); - - SCVAL(buf,4,0xFF); - SCVAL(buf,5,'E'); - SSVAL(buf,6,enc_ctx_num); -} - /******************************************************************* Set the length and marker of an smb packet. ********************************************************************/ -void smb_setlen(const char *frombuf, char *buf, int len) +void smb_setlen(char *buf,int len) { _smb_setlen(buf,len); - 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'); - } + SCVAL(buf,4,0xFF); + SCVAL(buf,5,'S'); + SCVAL(buf,6,'M'); + SCVAL(buf,7,'B'); } /******************************************************************* Setup the word count and byte count for a smb message. ********************************************************************/ -int set_message(const char *frombuf, char *buf,int num_words,int num_bytes,BOOL zero) +int set_message(char *buf,int num_words,int num_bytes,BOOL zero) { if (zero && (num_words || num_bytes)) { memset(buf + smb_size,'\0',num_words*2 + num_bytes); } SCVAL(buf,smb_wct,num_words); SSVAL(buf,smb_vwv + num_words*SIZEOFWORD,num_bytes); - smb_setlen(frombuf, buf,smb_size + num_words*2 + num_bytes - 4); + smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); return (smb_size + num_words*2 + num_bytes); } @@ -566,11 +547,11 @@ int set_message(const char *frombuf, char *buf,int num_words,int num_bytes,BOOL Setup only the byte count for a smb message. ********************************************************************/ -int set_message_bcc(const char *frombuf, char *buf,int num_bytes) +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(frombuf, buf,smb_size + num_words*2 + num_bytes - 4); + smb_setlen(buf,smb_size + num_words*2 + num_bytes - 4); return (smb_size + num_words*2 + num_bytes); } @@ -579,11 +560,9 @@ int set_message_bcc(const char *frombuf, char *buf,int num_bytes) message as a marker. ********************************************************************/ -int set_message_end(const char *frombuf, void *outbuf,void *end_ptr) +int set_message_end(void *outbuf,void *end_ptr) { - return set_message_bcc(frombuf, - (char *)outbuf, - PTR_DIFF(end_ptr,smb_buf((char *)outbuf))); + return set_message_bcc((char *)outbuf,PTR_DIFF(end_ptr,smb_buf((char *)outbuf))); } /******************************************************************* @@ -603,7 +582,7 @@ ssize_t message_push_blob(uint8 **outbuf, DATA_BLOB blob) *outbuf = tmp; memcpy(tmp + smb_len(tmp) + 4, blob.data, blob.length); - set_message_bcc(NULL, (char *)tmp, smb_buflen(tmp) + blob.length); + set_message_bcc((char *)tmp, smb_buflen(tmp) + blob.length); return blob.length; } @@ -2296,8 +2275,9 @@ void print_asc(int level, const unsigned char *buf,int len) DEBUG(level,("%c", isprint(buf[i])?buf[i]:'.')); } -void dump_data(int level, const unsigned char *buf,int len) +void dump_data(int level, const unsigned char *buf1,int len) { + const unsigned char *buf = (const unsigned char *)buf1; int i=0; if (len<=0) return; -- cgit