summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-11-14 02:14:58 +0000
committerJeremy Allison <jra@samba.org>2000-11-14 02:14:58 +0000
commite0bcc7ff5434e9f858acc6a79d1842d86d37d73e (patch)
tree487d1ab297a54997af71e00f8b0ee0a11cd4687c
parentf77ceb61c07d2ff3cc28d24a873a2209d0c52e0a (diff)
downloadsamba-e0bcc7ff5434e9f858acc6a79d1842d86d37d73e.tar.gz
samba-e0bcc7ff5434e9f858acc6a79d1842d86d37d73e.tar.bz2
samba-e0bcc7ff5434e9f858acc6a79d1842d86d37d73e.zip
printing/nt_printing.c: After long soul searching and making both Andrew and my
life a misery, here is the only possible null driver fix we have found. This *SUCKS*. rpc_server/srv_spoolss_nt.c: Correct printername search. Correct portname reply Correct attributes reply. Removal of unused temp variable. Jeremy. (This used to be commit 06e71c9f8be20b84e33e143c3d0b7904225efb45)
-rw-r--r--source3/printing/nt_printing.c6
-rw-r--r--source3/rpc_server/srv_spoolss_nt.c23
2 files changed, 14 insertions, 15 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 15b78032cd..1519faa567 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1664,11 +1664,13 @@ static uint32 get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin
snum = lp_servicenumber(sharename);
slprintf(info.servername, sizeof(info.servername), "\\\\%s", global_myname);
- slprintf(info.printername, sizeof(info.printername), "\\\\%s\\%s",
- global_myname, sharename);
fstrcpy(info.sharename, sharename);
fstrcpy(info.portname, SAMBA_PRINTER_PORT_NAME);
fstrcpy(info.drivername, lp_printerdriver(snum));
+ if (*info.drivername == '\0')
+ fstrcpy(info.drivername, "NO DRIVER AVAILABLE");
+
+ slprintf(info.printername, sizeof(info.printername), "\\\\%s\\%s", global_myname, sharename);
pstrcpy(info.comment, "");
fstrcpy(info.printprocessor, "winprint");
fstrcpy(info.datatype, "RAW");
diff --git a/source3/rpc_server/srv_spoolss_nt.c b/source3/rpc_server/srv_spoolss_nt.c
index 42f9d29d9c..cd2b4c4e3d 100644
--- a/source3/rpc_server/srv_spoolss_nt.c
+++ b/source3/rpc_server/srv_spoolss_nt.c
@@ -405,6 +405,7 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
*/
for (snum=0;snum<n_services && found==False;snum++) {
+ char *printername;
if ( !(lp_snum_ok(snum) && lp_print_ok(snum) ) )
continue;
@@ -414,15 +415,18 @@ static BOOL set_printer_hnd_name(Printer_entry *Printer, char *handlename)
if (get_a_printer(&printer, 2, lp_servicename(snum))!=0)
continue;
+ printername=strchr(printer->info_2->printername+2, '\\');
+ printername++;
+
DEBUG(10,("set_printer_hnd_name: name [%s], aprinter [%s]\n",
printer->info_2->printername, aprinter ));
- if ( strlen(printer->info_2->printername) != strlen(aprinter) ) {
+ if ( strlen(printername) != strlen(aprinter) ) {
free_a_printer(&printer, 2);
continue;
}
- if ( strncasecmp(printer->info_2->printername, aprinter, strlen(aprinter))) {
+ if ( strncasecmp(printername, aprinter, strlen(aprinter))) {
free_a_printer(&printer, 2);
continue;
}
@@ -1097,8 +1101,7 @@ static void spoolss_notify_server_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, p
}
/*******************************************************************
- * fill a notify_info_data with the servicename
- * jfmxxxx: it's incorrect should be long_printername
+ * fill a notify_info_data with the printername (not including the servername).
********************************************************************/
static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue,
NT_PRINTER_INFO_LEVEL *printer)
@@ -1110,10 +1113,7 @@ static void spoolss_notify_printer_name(int snum, SPOOL_NOTIFY_INFO_DATA *data,
} else {
p++;
}
-/*
- data->notify_data.data.length=strlen(lp_servicename(snum));
- dos_PutUniCode(data->notify_data.data.string, lp_servicename(snum), sizeof(data->notify_data.data.string), True);
-*/
+
data->notify_data.data.length=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
p, sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
}
@@ -1135,7 +1135,7 @@ 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=(uint32)((dos_PutUniCode((char *)data->notify_data.data.string,
- lp_servicename(snum), sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
+ printer->info_2->portname, sizeof(data->notify_data.data.string), True) - sizeof(uint16))/sizeof(uint16));
}
/*******************************************************************
@@ -1239,9 +1239,7 @@ static void spoolss_notify_security_desc(int snum, SPOOL_NOTIFY_INFO_DATA *data,
********************************************************************/
static void spoolss_notify_attributes(int snum, SPOOL_NOTIFY_INFO_DATA *data, print_queue_struct *queue, NT_PRINTER_INFO_LEVEL *printer)
{
- data->notify_data.value[0] = PRINTER_ATTRIBUTE_SHARED \
- | PRINTER_ATTRIBUTE_LOCAL \
- | PRINTER_ATTRIBUTE_RAW_ONLY ;
+ data->notify_data.value[0] = printer->info_2->attributes;
}
/*******************************************************************
@@ -2614,7 +2612,6 @@ static uint32 getprinter_level_2(int snum, NEW_BUFFER *buffer, uint32 offered, u
static uint32 getprinter_level_3(int snum, NEW_BUFFER *buffer, uint32 offered, uint32 *needed)
{
PRINTER_INFO_3 *printer=NULL;
- fstring temp;
if (!construct_printer_info_3(&printer, snum))
return ERROR_NOT_ENOUGH_MEMORY;