summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2001-03-14 11:55:08 +0000
committerAndrew Tridgell <tridge@samba.org>2001-03-14 11:55:08 +0000
commit376a44c81d360026eb0c2886e9a05dd2bfefd2cc (patch)
tree69444f31874e60147c7af4ca2395d93345d512d2 /source3/smbd
parentdf03c7480d32b60f45d5407dbabd82237570b54c (diff)
downloadsamba-376a44c81d360026eb0c2886e9a05dd2bfefd2cc.tar.gz
samba-376a44c81d360026eb0c2886e9a05dd2bfefd2cc.tar.bz2
samba-376a44c81d360026eb0c2886e9a05dd2bfefd2cc.zip
converted the smb messaging code to unicode
(This used to be commit 54bde1b3aec829ba55b8a6c946424fdaf38803a9)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/message.c32
1 files changed, 15 insertions, 17 deletions
diff --git a/source3/smbd/message.c b/source3/smbd/message.c
index 3afe7218e0..21750f9cd4 100644
--- a/source3/smbd/message.c
+++ b/source3/smbd/message.c
@@ -31,9 +31,9 @@ extern int DEBUGLEVEL;
static char msgbuf[1600];
-static int msgpos=0;
-static fstring msgfrom="";
-static fstring msgto="";
+static int msgpos;
+static fstring msgfrom;
+static fstring msgto;
/****************************************************************************
deliver the message
@@ -107,8 +107,10 @@ int reply_sends(connection_struct *conn,
char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
int len;
- char *orig,*dest,*msg;
+ char *msg;
int outsize = 0;
+ char *p;
+
START_PROFILE(SMBsends);
msgpos = 0;
@@ -120,12 +122,11 @@ int reply_sends(connection_struct *conn,
outsize = set_message(outbuf,0,0,True);
- orig = smb_buf(inbuf)+1;
- dest = skip_string(orig,1)+1;
- msg = skip_string(dest,1)+1;
+ p = smb_buf(inbuf)+1;
+ p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE|STR_CONVERT) + 1;
+ p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE|STR_CONVERT) + 1;
- fstrcpy(msgfrom,orig);
- fstrcpy(msgto,dest);
+ msg = p;
len = SVAL(msg,0);
len = MIN(len,sizeof(msgbuf)-msgpos);
@@ -135,8 +136,6 @@ int reply_sends(connection_struct *conn,
memcpy(&msgbuf[msgpos],msg+2,len);
msgpos += len;
- DEBUG( 3, ( "SMBsends (from %s to %s)\n", orig, dest ) );
-
msg_deliver();
END_PROFILE(SMBsends);
@@ -150,8 +149,9 @@ int reply_sends(connection_struct *conn,
int reply_sendstrt(connection_struct *conn,
char *inbuf,char *outbuf, int dum_size, int dum_buffsize)
{
- char *orig,*dest;
int outsize = 0;
+ char *p;
+
START_PROFILE(SMBsendstrt);
if (! (*lp_msg_command())) {
@@ -164,11 +164,9 @@ int reply_sendstrt(connection_struct *conn,
memset(msgbuf,'\0',sizeof(msgbuf));
msgpos = 0;
- orig = smb_buf(inbuf)+1;
- dest = skip_string(orig,1)+1;
-
- fstrcpy(msgfrom,orig);
- fstrcpy(msgto,dest);
+ p = smb_buf(inbuf)+1;
+ p += srvstr_pull(inbuf, msgfrom, p, sizeof(msgfrom), -1, STR_TERMINATE|STR_CONVERT) + 1;
+ p += srvstr_pull(inbuf, msgto, p, sizeof(msgto), -1, STR_TERMINATE|STR_CONVERT) + 1;
DEBUG( 3, ( "SMBsendstrt (from %s to %s)\n", msgfrom, msgto ) );