summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--source3/Makefile.in4
-rw-r--r--source3/lib/util_unistr.c22
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c4
3 files changed, 26 insertions, 4 deletions
diff --git a/source3/Makefile.in b/source3/Makefile.in
index f3a254667d..8df5641058 100644
--- a/source3/Makefile.in
+++ b/source3/Makefile.in
@@ -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
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index c28ef44934..7379bd6811 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/lib/util_unistr.c
@@ -107,6 +107,28 @@ void ascii_to_unistr(char *dest, const char *src, size_t maxlen)
}
/*******************************************************************
+ * 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.
********************************************************************/
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 90a3a3e632..f974311c71 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -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;