diff options
author | Jeremy Allison <jra@samba.org> | 2000-10-03 19:15:05 +0000 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2000-10-03 19:15:05 +0000 |
commit | 6692d0905e3e8605884ced5d38efb26929648d29 (patch) | |
tree | fda0c578904875f3d32e491a2c15bcecb8bbfd09 /source3 | |
parent | c5ca95aeb1202c64bf37c8031c83d5c59c990ce3 (diff) | |
download | samba-6692d0905e3e8605884ced5d38efb26929648d29.tar.gz samba-6692d0905e3e8605884ced5d38efb26929648d29.tar.bz2 samba-6692d0905e3e8605884ced5d38efb26929648d29.zip |
Fixes for the fact that UNICODE sizes are no always 2*no of chars when
in multibyte codepages. Fix from Hiroshi MIURA, Samba User Group Japan staff.
Jeremy.
(This used to be commit f2f373df67a3c6b0bd431c19e3494d45ef0a263c)
Diffstat (limited to 'source3')
-rw-r--r-- | source3/smbd/trans2.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c index 9d1aa5dcfe..2366fceae7 100644 --- a/source3/smbd/trans2.c +++ b/source3/smbd/trans2.c @@ -1193,9 +1193,11 @@ static int call_trans2qfsinfo(connection_struct *conn, SIVAL(pdata,12,strlen(vname)); pstrcpy(pdata+18,vname); } else { - data_len = 18 + 2*strlen(vname); - SIVAL(pdata,12,strlen(vname)*2); - dos_PutUniCode(pdata+18,unix_to_dos(vname,False),sizeof(pstring), False); + int vnamelen; + + vnamelen = dos_PutUniCode(pdata+18, vname, sizeof(pstring), False); + data_len = 18 + vnamelen; + SIVAL(pdata,12,vnamelen); SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS); } @@ -1466,10 +1468,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn, *short_name = '\0'; } strupper(short_name); - l = strlen(short_name); - dos_PutUniCode(pdata + 4, unix_to_dos(short_name,False),sizeof(pstring), False); - data_size = 4 + (2*l); - SIVAL(pdata,0,2*l); + l = dos_PutUniCode(pdata + 4, short_name, sizeof(pstring), False); + data_size = 4 + l; + SIVAL(pdata,0,l); } break; @@ -1483,7 +1484,7 @@ static int call_trans2qfilepathinfo(connection_struct *conn, if(strequal(".", fname) && (global_client_caps & CAP_UNICODE)) { l = l*2; SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS); - dos_PutUniCode(pdata + 4, unix_to_dos("\\",False),sizeof(pstring), False); + dos_PutUniCode(pdata + 4, "\\",sizeof(pstring), False); } else { pstrcpy(pdata+4,fname); } |