diff options
author | Jelmer Vernooij <jelmer@samba.org> | 2003-03-20 16:44:14 +0000 |
---|---|---|
committer | Jelmer Vernooij <jelmer@samba.org> | 2003-03-20 16:44:14 +0000 |
commit | 5310447ec6e0df1c000e3ee14572f5b7fee31f28 (patch) | |
tree | 9489d964e527a5458c8bd3b5e6148b6c5042b44e /source/libsmb/climessage.c | |
parent | 2e3710f67293b01084026549246d494103b2d536 (diff) | |
download | samba-5310447ec6e0df1c000e3ee14572f5b7fee31f28.tar.gz samba-5310447ec6e0df1c000e3ee14572f5b7fee31f28.tar.xz samba-5310447ec6e0df1c000e3ee14572f5b7fee31f28.zip |
Patch from Samuel Thibault to convert messages from dos to unix charset
when sending(and vice versa when receiving).
Diffstat (limited to 'source/libsmb/climessage.c')
-rw-r--r-- | source/libsmb/climessage.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source/libsmb/climessage.c b/source/libsmb/climessage.c index 1587e6f4cd7..5f6ce361339 100644 --- a/source/libsmb/climessage.c +++ b/source/libsmb/climessage.c @@ -65,6 +65,8 @@ send a message ****************************************************************************/ BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp) { + char *msgdos; + int lendos; char *p; memset(cli->outbuf,'\0',smb_size); @@ -77,9 +79,18 @@ BOOL cli_message_text(struct cli_state *cli, char *msg, int len, int grp) p = smb_buf(cli->outbuf); *p++ = 1; - SSVAL(p,0,len); p += 2; - memcpy(p,msg,len); - p += len; + + if ((lendos = convert_string_allocate(CH_UNIX, CH_DOS, msg,len, (void **) &msgdos)) < 0 || !msgdos) { + DEBUG(3,("Conversion failed, sending message in UNIX charset\n")); + SSVAL(p, 0, len); p += 2; + memcpy(p, msg, len); + p += len; + } else { + SSVAL(p, 0, lendos); p += 2; + memcpy(p, msgdos, lendos); + p += lendos; + SAFE_FREE(msgdos); + } cli_setup_bcc(cli, p); cli_send_smb(cli); |