[patch] messages conversion in HEAD

Ihar Viarheichyk i.viarheichyk at sam-solutions.net
Tue Jan 15 11:00:49 GMT 2002


Hello.

Here is a patch which adds encoding/decoding winpopup messages from/to
unix charset in HEAD. It fixes both client and server parts.

-- 
Igor Vergeichik
ICQ 47298730

-------------- next part --------------
diff -urNk.orig samba.HEAD/source/libsmb/climessage.c.orig samba.HEAD/source/libsmb/climessage.c
--- samba.HEAD/source/libsmb/climessage.c.orig	Tue Jan 15 19:29:11 2002
+++ samba.HEAD/source/libsmb/climessage.c	Tue Jan 15 19:32:32 2002
@@ -79,8 +79,7 @@
 	p = smb_buf(cli->outbuf);
 	*p++ = 1;
 	SSVAL(p,0,len); p += 2;
-	memcpy(p,msg,len);
-	p += len;
+	p += clistr_push(cli, p, msg, len, 0);
 
 	cli_setup_bcc(cli, p);
 	cli_send_smb(cli);
diff -urNk.orig samba.HEAD/source/smbd/message.c.orig samba.HEAD/source/smbd/message.c
--- samba.HEAD/source/smbd/message.c.orig	Tue Jan 15 17:48:01 2002
+++ samba.HEAD/source/smbd/message.c	Tue Jan 15 17:55:38 2002
@@ -124,13 +124,9 @@
 
   msg = p;
 
-  len = SVAL(msg,0);
-  len = MIN(len,sizeof(msgbuf)-msgpos);
-
   memset(msgbuf,'\0',sizeof(msgbuf));
 
-  memcpy(&msgbuf[msgpos],msg+2,len);
-  msgpos += len;
+  msgpos+=srvstr_pull(inbuf, &msgbuf[msgpos], msg+2, sizeof(msgbuf)-msgpos, SVAL(msg,0), 0);
 
   msg_deliver();
 
@@ -191,11 +187,7 @@
 
   msg = smb_buf(inbuf) + 1;
 
-  len = SVAL(msg,0);
-  len = MIN(len,sizeof(msgbuf)-msgpos);
-
-  memcpy(&msgbuf[msgpos],msg+2,len);
-  msgpos += len;
+  msgpos += srvstr_pull(inbuf, &msgbuf[msgpos], msg+2, sizeof(msgbuf)-msgpos, SVAL(msg,0), 0);
 
   DEBUG( 3, ( "SMBsendtxt\n" ) );
 


More information about the samba-technical mailing list