summaryrefslogtreecommitdiff
path: root/source3/smbd/trans2.c
diff options
context:
space:
mode:
authorMatthew Chapman <matty@samba.org>1999-02-12 00:16:09 +0000
committerMatthew Chapman <matty@samba.org>1999-02-12 00:16:09 +0000
commitfd96929ec1fa27e0affd4c4e9ba307c4ee30b978 (patch)
tree6bfb5226bc58be39aaf7cfb954dcb472ea256a11 /source3/smbd/trans2.c
parentf38bfc7d9aa07c4e21448aa846956bd89a259a65 (diff)
downloadsamba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.tar.gz
samba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.tar.bz2
samba-fd96929ec1fa27e0affd4c4e9ba307c4ee30b978.zip
UNICODE cleanup (see lib/util_unistr.c).
No more ugly static library buffers and all functions take a destination string length (especially unistrcpy was rather dangerous; we were only saved by the fact that datagrams are limited in size). (This used to be commit a1d39af1ce1d451b811dbd7c2ba391214851b87e)
Diffstat (limited to 'source3/smbd/trans2.c')
-rw-r--r--source3/smbd/trans2.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/source3/smbd/trans2.c b/source3/smbd/trans2.c
index 7bfb046cc2..1bfcaa5f12 100644
--- a/source3/smbd/trans2.c
+++ b/source3/smbd/trans2.c
@@ -1121,7 +1121,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
#endif /* Old code. */
SIVAL(pdata,4,128); /* Max filename component length */
SIVAL(pdata,8,2*strlen(fstype));
- PutUniCode(pdata+12,fstype);
+ ascii_to_unibuf(pdata+12, fstype, 1024-12);
SSVAL(outbuf,smb_flg2,SVAL(outbuf,smb_flg2)|FLAGS2_UNICODE_STRINGS);
break;
case SMB_QUERY_FS_LABEL_INFO:
@@ -1148,7 +1148,7 @@ static int call_trans2qfsinfo(connection_struct *conn,
} else {
data_len = 18 + 2*strlen(vname);
SIVAL(pdata,12,strlen(vname)*2);
- PutUniCode(pdata+18,vname);
+ ascii_to_unibuf(pdata+18, vname, 1024-18);
}
DEBUG(5,("call_trans2qfsinfo : SMB_QUERY_FS_VOLUME_INFO namelen = %d, vol = %s\n",
@@ -1395,6 +1395,8 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
case SMB_QUERY_FILE_ALT_NAME_INFO:
{
pstring short_name;
+ char *data_end;
+
pstrcpy(short_name,p);
/* Mangle if not already 8.3 */
if(!is_8_3(short_name, True))
@@ -1403,10 +1405,9 @@ static int call_trans2qfilepathinfo(connection_struct *conn,
*short_name = '\0';
}
strupper(short_name);
- l = strlen(short_name);
- PutUniCode(pdata + 4, short_name);
- data_size = 4 + (2*l);
- SIVAL(pdata,0,2*l);
+ data_end = ascii_to_unibuf(pdata + 4, short_name, 1024-4);
+ data_size = data_end - pdata;
+ SIVAL(pdata,0,2*(data_size-4));
}
break;