summaryrefslogtreecommitdiffstats
path: root/source/lib/util.c
diff options
context:
space:
mode:
authorGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:34:30 -0500
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 15:34:30 -0500
commit5c6c8e1fe93f340005110a7833946191659d88ab (patch)
tree2572b9fe2367388eac54ac08ead007323618f0a6 /source/lib/util.c
parentba8c48244e140403b728d9a2ca297b40e8888964 (diff)
downloadsamba-5c6c8e1fe93f340005110a7833946191659d88ab.tar.gz
samba-5c6c8e1fe93f340005110a7833946191659d88ab.tar.xz
samba-5c6c8e1fe93f340005110a7833946191659d88ab.zip
[GLUE] Rsync SAMBA_3_2_0 SVN r25598 in order to create the v3-2-test branch.samba-misc-tags/initial-v3-2-test
Diffstat (limited to 'source/lib/util.c')
-rw-r--r--source/lib/util.c48
1 files changed, 14 insertions, 34 deletions
diff --git a/source/lib/util.c b/source/lib/util.c
index b98441ea53d..adbebb04d45 100644
--- a/source/lib/util.c
+++ b/source/lib/util.c
@@ -515,50 +515,31 @@ void show_msg(char *buf)
}
/*******************************************************************
- 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;