1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-12 09:18:10 +03:00

unistr_to_dos not unistr_to_ascii

This commit is contained in:
Luke Leighton 0001-01-01 00:00:00 +00:00
parent 06cd46b0ec
commit f46c4fe876
3 changed files with 26 additions and 4 deletions

View File

@ -104,7 +104,7 @@ LIB_OBJ = lib/charcnv.o lib/charset.o lib/debug.o lib/fault.o \
lib/signal.o lib/slprintf.o lib/system.o lib/doscalls.o lib/time.o \
lib/ufc.o lib/genrand.o lib/username.o lib/access.o lib/smbrun.o \
lib/bitmap.o lib/crc32.o lib/snprintf.o \
lib/util_array.o lib/util_unixsd.o lib/util_str.o lib/util_sid.o \
lib/util_array.o lib/util_str.o lib/util_sid.o \
lib/util_unistr.o lib/util_file.o \
lib/util.o lib/util_sock.o lib/util_sec.o smbd/ssl.o \
lib/talloc.o lib/hash.o lib/substitute.o lib/fsusage.o \
@ -165,7 +165,7 @@ SMBD_OBJ1 = smbd/server.o smbd/files.o smbd/chgpasswd.o smbd/connection.o \
smbd/reply.o smbd/trans2.o smbd/uid.o \
smbd/dosmode.o smbd/filename.o smbd/open.o smbd/close.o smbd/blocking.o \
smbd/vfs.o smbd/vfs-wrap.o smbd/statcache.o \
lib/msrpc-client.o lib/msrpc_use.o \
lib/util_unixsd.o lib/msrpc-client.o lib/msrpc_use.o \
rpc_parse/parse_creds.o \
smbd/process.o smbd/oplock.o smbd/service.o smbd/error.o \
printing/printfsp.o

View File

@ -106,6 +106,28 @@ void ascii_to_unistr(char *dest, const char *src, size_t maxlen)
SSVAL(dest, 0, 0);
}
/*******************************************************************
* HORRIBLE HACK!
********************************************************************/
void unistr_to_ascii(char *dest, const uint16 *src, int len)
{
char *destend = dest + len;
register uint16 c;
while (dest < destend)
{
c = *(src++);
if (c == 0)
{
break;
}
*(dest++) = (char)c;
}
*dest = 0;
}
/*******************************************************************
Pull a DOS codepage string out of a UNICODE array. len is in bytes.
********************************************************************/

View File

@ -587,8 +587,8 @@ static BOOL convert_printer_driver_info(const SPOOL_PRINTER_DRIVER_INFO_LEVEL *u
static BOOL convert_devicemode(DEVICEMODE devmode, NT_DEVICEMODE *nt_devmode)
{
unistr_to_ascii(nt_devmode->devicename, (char *)devmode.devicename.buffer, 31);
unistr_to_ascii(nt_devmode->formname, (char *)devmode.formname.buffer, 31);
unistr_to_dos(nt_devmode->devicename, (char *)devmode.devicename.buffer, 31);
unistr_to_dos(nt_devmode->formname, (char *)devmode.formname.buffer, 31);
nt_devmode->specversion=devmode.specversion;
nt_devmode->driverversion=devmode.driverversion;