summaryrefslogtreecommitdiff
path: root/source3/rpc_server
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-06-22 01:39:17 +0000
committerJeremy Allison <jra@samba.org>2000-06-22 01:39:17 +0000
commitf9e9f98a4a579f24d8ad1804b22bf36ede250e23 (patch)
tree23a89fdcc3b34315bbc8625ec3cffd4460ec8608 /source3/rpc_server
parenta7b5b10a0a32dd9a3f82c600898393fc53cfc4fc (diff)
downloadsamba-f9e9f98a4a579f24d8ad1804b22bf36ede250e23.tar.gz
samba-f9e9f98a4a579f24d8ad1804b22bf36ede250e23.tar.bz2
samba-f9e9f98a4a579f24d8ad1804b22bf36ede250e23.zip
lib/util_unistr.c: Removed ascii_to_unistr() as it does no codepage.
Removed unistr_to_ascii() as it was never used. printing/nt_printing.c: Removed "DUMMY.XX" files. rpc_server/srv_spoolss_nt.c: Use dos_PutUniCode() instead of ascii_to_unistr(). Attempted to fix the "return value" size code based on J.F's comments. This needs looking at. Jeremy. (This used to be commit de99011bf3b2a23bd1854a047382a107aaeb9c68)
Diffstat (limited to 'source3/rpc_server')
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c86
1 files changed, 32 insertions, 54 deletions
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 8cff8d68d9..dc4932fdfc 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -897,8 +897,8 @@ static void spoolss_notify_server_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, p
snprintf(temp_name, sizeof(temp_name)-1, "\\\\%s", global_myname);
- data->notify_data.data.length=strlen(temp_name);
- ascii_to_unistr((char *)data->notify_data.data.string, temp_name, sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length= (uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ temp_name, sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -910,12 +910,10 @@ static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data,
{
/*
data->notify_data.data.length=strlen(lp_servicename(snum));
- ascii_to_unistr(data->notify_data.data.string, lp_servicename(snum), sizeof(data->notify_data.data.string)-1);
+ dos_PutUniCode(data->notify_data.data.string, lp_servicename(snum), sizeof(data->notify_data.data.string), True);
*/
- data->notify_data.data.length=strlen(printer->info_2->printername);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->printername,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->printername, sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -923,10 +921,8 @@ static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data,
********************************************************************/
static void spoolss_notify_share_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(lp_servicename(snum));
- ascii_to_unistr((char *)data->notify_data.data.string,
- lp_servicename(snum),
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ lp_servicename(snum), sizeof(data->notify_data.data.string),True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -936,10 +932,8 @@ static void spoolss_notify_port_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, pri
{
/* even if it's strange, that's consistant in all the code */
- data->notify_data.data.length=strlen(lp_servicename(snum));
- ascii_to_unistr((char *)data->notify_data.data.string,
- lp_servicename(snum),
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ lp_servicename(snum), sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -949,10 +943,8 @@ static void spoolss_notify_port_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, pri
********************************************************************/
static void spoolss_notify_driver_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->drivername);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->drivername,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->drivername, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -960,10 +952,8 @@ static void spoolss_notify_driver_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, p
********************************************************************/
static void spoolss_notify_comment(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(lp_comment(snum));
- ascii_to_unistr((char *)data->notify_data.data.string,
- lp_comment(snum),
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ lp_comment(snum), sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -973,10 +963,8 @@ static void spoolss_notify_comment(int snum, SPOOL_NOTIFY_INFO_DATA *data, print
********************************************************************/
static void spoolss_notify_location(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->location);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->location,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->location, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -994,10 +982,8 @@ static void spoolss_notify_devmode(int snum, SPOOL_NOTIFY_INFO_DATA *data, print
********************************************************************/
static void spoolss_notify_sepfile(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->sepfile);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->sepfile,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->sepfile, sizeof(data->notify_data.data.string)-1,True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1006,10 +992,8 @@ static void spoolss_notify_sepfile(int snum, SPOOL_NOTIFY_INFO_DATA *data, print
********************************************************************/
static void spoolss_notify_print_processor(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->printprocessor);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->printprocessor,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->printprocessor, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1018,10 +1002,8 @@ static void spoolss_notify_print_processor(int snum, SPOOL_NOTIFY_INFO_DATA *dat
********************************************************************/
static void spoolss_notify_parameters(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->parameters);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->parameters,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->parameters, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1030,10 +1012,8 @@ static void spoolss_notify_parameters(int snum, SPOOL_NOTIFY_INFO_DATA *data, pr
********************************************************************/
static void spoolss_notify_datatype(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(printer->info_2->datatype);
- ascii_to_unistr((char *)data->notify_data.data.string,
- printer->info_2->datatype,
- sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ printer->info_2->datatype, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1133,8 +1113,8 @@ static void spoolss_notify_average_ppm(int snum, SPOOL_NOTIFY_INFO_DATA *data, p
********************************************************************/
static void spoolss_notify_username(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(queue->user);
- ascii_to_unistr((char *)data->notify_data.data.string, queue->user, sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ queue->user, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1150,8 +1130,8 @@ static void spoolss_notify_job_status(int snum, SPOOL_NOTIFY_INFO_DATA *data, pr
********************************************************************/
static void spoolss_notify_job_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.data.length=strlen(queue->file);
- ascii_to_unistr((char *)data->notify_data.data.string, queue->file, sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ queue->file, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1174,8 +1154,8 @@ static void spoolss_notify_job_status_string(int snum, SPOOL_NOTIFY_INFO_DATA *d
p = "PRINTING";
break;
}
- data->notify_data.data.length=strlen(p);
- ascii_to_unistr((char *)data->notify_data.data.string, p, sizeof(data->notify_data.data.string)-1);
+ data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
+ p, sizeof(data->notify_data.data.string)-1, True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -2598,8 +2578,7 @@ static void init_unistr_array(uint16 **uni_array, fstring *char_array, char *whe
DEBUG(0,("init_unistr_array: Realloc error\n" ));
return;
}
- ascii_to_unistr((char *)(*uni_array+j), line , 2*strlen(line));
- j+=strlen(line)+1;
+ j += (dos_PutUniCode((char *)(*uni_array+j), line , sizeof(uint16)*strlen(line), True) / sizeof(uint16) );
i++;
if (strlen(v) == 0) break;
}
@@ -4145,13 +4124,12 @@ uint32 _spoolss_enumprinterdata(const POLICY_HND *handle, uint32 idx,
* take a pause *before* coding not *during* coding
*/
- *out_max_value_len=in_value_len;
+ *out_max_value_len=(in_value_len/sizeof(uint16));
if((*out_value=(uint16 *)malloc(in_value_len*sizeof(uint8))) == NULL) {
safe_free(data);
return ERROR_NOT_ENOUGH_MEMORY;
}
- ascii_to_unistr((char *)*out_value, value, *out_max_value_len);
- *out_value_len=2*(1+strlen(value));
+ *out_value_len = (uint32)dos_PutUniCode((char *)*out_value, value, in_value_len, True);
*out_type=type;