PATCH: charset recode
Alexandr Kukushkin
shura at 7ka.mipt.ru
Tue Feb 19 00:22:07 GMT 2002
This patch fixed problem, when we connect to servers that's not
supporting unicode throught smbclient.
-------------- next part --------------
diff -urN samba-2.2.3a/source/libsmb/clifile.c samba-2.2.3a-patched/source/libsmb/clifile.c
--- samba-2.2.3a/source/libsmb/clifile.c Thu Feb 7 21:12:40 2002
+++ samba-2.2.3a-patched/source/libsmb/clifile.c Thu Feb 7 21:16:43 2002
@@ -42,11 +42,11 @@
SSVAL(param,0,hard_link ? SMB_SET_FILE_UNIX_HLINK : SMB_SET_FILE_UNIX_LINK);
p = ¶m[6];
- p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname_src, -1, STR_CONVERT|STR_TERMINATE);
param_len = PTR_DIFF(p, param);
p = data;
- p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname_dst, -1, STR_CONVERT|STR_TERMINATE);
data_len = PTR_DIFF(p, data);
if (!cli_send_trans(cli, SMBtrans2,
@@ -137,7 +137,7 @@
SSVAL(param,0,SMB_SET_FILE_UNIX_BASIC);
p = ¶m[6];
- p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, -1, STR_CONVERT|STR_TERMINATE);
param_len = PTR_DIFF(p, param);
SIVAL(data,40,uid);
@@ -208,9 +208,9 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, fname_src, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname_src, -1, STR_CONVERT|STR_TERMINATE);
*p++ = 4;
- p += clistr_push(cli, p, fname_dst, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname_dst, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -245,7 +245,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
cli_send_smb(cli);
@@ -279,7 +279,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, dname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, dname, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -314,7 +314,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, dname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, dname, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -408,7 +408,7 @@
p = smb_buf(cli->outbuf);
/* this alignment and termination is critical for netapp filers. Don't change */
p += clistr_align_out(cli, p, 0);
- len = clistr_push(cli, p, fname, -1, 0);
+ len = clistr_push(cli, p, fname, -1, STR_CONVERT);
p += len;
SSVAL(cli->outbuf,smb_ntcreate_NameLength, len);
/* sigh. this copes with broken netapp filer behaviour */
@@ -501,7 +501,7 @@
}
p = smb_buf(cli->outbuf);
- p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -814,7 +814,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -865,7 +865,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, fname, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, -1, STR_CONVERT|STR_TERMINATE);
*p++ = 4;
cli_setup_bcc(cli, p);
@@ -902,7 +902,7 @@
cli_setup_packet(cli);
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, path2, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, path2, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
@@ -963,7 +963,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, path, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, path, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
diff -urN samba-2.2.3a/source/libsmb/clilist.c samba-2.2.3a-patched/source/libsmb/clilist.c
--- samba-2.2.3a/source/libsmb/clilist.c Thu Feb 7 21:12:40 2002
+++ samba-2.2.3a-patched/source/libsmb/clilist.c Thu Feb 7 21:17:41 2002
@@ -177,7 +177,7 @@
SIVAL(param,8,0);
p = param+12;
p += clistr_push(cli, param+12, mask, -1,
- STR_TERMINATE);
+ STR_CONVERT|STR_TERMINATE);
} else {
setup = TRANSACT2_FINDNEXT;
SSVAL(param,0,ff_dir_handle);
@@ -187,7 +187,7 @@
SSVAL(param,10,8+4+2); /* continue + resume required + close on end */
p = param+12;
p += clistr_push(cli, param+12, mask, -1,
- STR_TERMINATE);
+ STR_CONVERT|STR_TERMINATE);
}
param_len = PTR_DIFF(p, param);
@@ -369,7 +369,7 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, first?mask:"", -1, STR_TERMINATE);
+ p += clistr_push(cli, p, first?mask:"", -1, STR_CONVERT|STR_TERMINATE);
*p++ = 5;
if (first) {
SSVAL(p,0,0);
diff -urN samba-2.2.3a/source/libsmb/climessage.c samba-2.2.3a-patched/source/libsmb/climessage.c
--- samba-2.2.3a/source/libsmb/climessage.c Thu Feb 7 21:12:40 2002
+++ samba-2.2.3a-patched/source/libsmb/climessage.c Thu Feb 7 21:18:25 2002
@@ -41,9 +41,9 @@
p = smb_buf(cli->outbuf);
*p++ = 4;
- p += clistr_push(cli, p, username, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, username, -1, STR_CONVERT|STR_TERMINATE);
*p++ = 4;
- p += clistr_push(cli, p, host, -1, STR_TERMINATE);
+ p += clistr_push(cli, p, host, -1, STR_CONVERT|STR_TERMINATE);
cli_setup_bcc(cli, p);
diff -urN samba-2.2.3a/source/libsmb/clirap.c samba-2.2.3a-patched/source/libsmb/clirap.c
--- samba-2.2.3a/source/libsmb/clirap.c Thu Feb 7 21:12:40 2002
+++ samba-2.2.3a-patched/source/libsmb/clirap.c Thu Feb 7 21:19:16 2002
@@ -386,7 +386,7 @@
memset(p, 0, 6);
SSVAL(p, 0, SMB_INFO_STANDARD);
p += 6;
- p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE );
+ p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_CONVERT|STR_TERMINATE );
param_len = PTR_DIFF(p, param);
@@ -462,7 +462,7 @@
memset(p, 0, 6);
SSVAL(p, 0, SMB_QUERY_FILE_ALL_INFO);
p += 6;
- p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE );
+ p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_CONVERT|STR_TERMINATE );
param_len = PTR_DIFF(p, param);
@@ -649,7 +649,7 @@
memset(p, 0, 6);
SSVAL(p, 0, SMB_QUERY_FILE_ALT_NAME_INFO);
p += 6;
- p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_TERMINATE);
+ p += clistr_push(cli, p, fname, sizeof(pstring)-6, STR_CONVERT|STR_TERMINATE);
param_len = PTR_DIFF(p, param);
diff -urN samba-2.2.3a/source/libsmb/clistr.c samba-2.2.3a-patched/source/libsmb/clistr.c
--- samba-2.2.3a/source/libsmb/clistr.c Thu Feb 7 21:12:40 2002
+++ samba-2.2.3a-patched/source/libsmb/clistr.c Thu Feb 7 21:20:26 2002
@@ -72,10 +72,7 @@
}
/* the server likes unicode. give it the works */
- if (flags & STR_CONVERT)
- dos_PutUniCode(dest, unix_to_dos(src,False), dest_len, flags & STR_TERMINATE);
- else
- unix_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE);
+ unix_PutUniCode(dest, src, dest_len, flags & STR_TERMINATE);
if (flags & STR_UPPER)
strupper_w(dest);
More information about the samba-technical
mailing list