summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorDavid O'Neill <dmo@samba.org>2001-01-26 18:13:17 +0000
committerDavid O'Neill <dmo@samba.org>2001-01-26 18:13:17 +0000
commit221926402aa6c9cd4e7c66f8b349a2dc3d8c5c5a (patch)
tree218a0aa029c41003b61ad04f8d5fe7ff1447a46c /source3/printing
parentc7a7dea3331c5d77f57fb0622303933ca7afb0f9 (diff)
downloadsamba-221926402aa6c9cd4e7c66f8b349a2dc3d8c5c5a.tar.gz
samba-221926402aa6c9cd4e7c66f8b349a2dc3d8c5c5a.tar.bz2
samba-221926402aa6c9cd4e7c66f8b349a2dc3d8c5c5a.zip
Changes from APPLIANCE_HEAD:
source/printing/nt_printing.c - fix for Win2k sending NULL devicemode in setprinter calls which was making NT4 grumpy. The solution is to never set a NULL devicemode if we previously had a valid one in the printer's TDB entry. (This used to be commit b9036a07781724d58b34da3b6e876dd28d5f70a6)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 9eb7dc12ed..eb4b243f2e 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -1711,6 +1711,9 @@ uint32 del_a_printer(char *sharename)
return 0;
}
+/* FIXME!!! Reorder so this forward declaration is not necessary --jerry */
+static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **, fstring);
+static void free_nt_printer_info_level_2(NT_PRINTER_INFO_LEVEL_2 **);
/****************************************************************************
****************************************************************************/
static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
@@ -1719,6 +1722,8 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
char *buf;
int buflen, len, ret;
TDB_DATA kbuf, dbuf;
+ NT_PRINTER_INFO_LEVEL_2 *old_printer = NULL;
+ NT_DEVICEMODE *devmode = NULL;
/*
* in addprinter: no servername and the printer is the name
@@ -1774,7 +1779,21 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
info->datatype,
info->parameters);
- len += pack_devicemode(info->devmode, buf+len, buflen-len);
+ /* do not write a NULL devicemode if there was previously
+ a valid one. Windows 2000 likes to send setprinter calls
+ with NULL devicemodes (e.g. HP 4050 PCL6 driver) --jerry
+
+ We need to get the previously saved information for
+ this printer if the devicemode is NULL */
+ devmode = info->devmode;
+ if (!devmode && info->sharename)
+ {
+ get_a_printer_2(&old_printer, info->sharename);
+ if (old_printer)
+ devmode = old_printer->devmode;
+ }
+ len += pack_devicemode(devmode, buf+len, buflen-len);
+
len += pack_specifics(info->specific, buf+len, buflen-len);
if (buflen != len) {
@@ -1802,6 +1821,9 @@ static uint32 update_a_printer_2(NT_PRINTER_INFO_LEVEL_2 *info)
DEBUG(8,("packed printer [%s] with driver [%s] portname=[%s] len=%d\n",
info->sharename, info->drivername, info->portname, len));
+ if (old_printer)
+ free_nt_printer_info_level_2(&old_printer);
+
return ret;
}