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 | 0b72dd8325bc5c78de56039942acc175d28042a7 (patch) | |
tree | 7a3fb31a07cad1d29684aa54132f2ff37b240b24 /source3/libsmb | |
parent | efadbacb9abde371dfb3f19c9f9f69539ec1dc34 (diff) | |
download | samba-0b72dd8325bc5c78de56039942acc175d28042a7.tar.gz samba-0b72dd8325bc5c78de56039942acc175d28042a7.tar.bz2 samba-0b72dd8325bc5c78de56039942acc175d28042a7.zip |
Patch from Samuel Thibault to convert messages from dos to unix charset
when sending(and vice versa when receiving).
(This used to be commit 5310447ec6e0df1c000e3ee14572f5b7fee31f28)
Diffstat (limited to 'source3/libsmb')
-rw-r--r-- | source3/libsmb/climessage.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/source3/libsmb/climessage.c b/source3/libsmb/climessage.c index 1587e6f4cd..5f6ce36133 100644 --- a/source3/libsmb/climessage.c +++ b/source3/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); |