summaryrefslogtreecommitdiff
path: root/source3/printing
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2001-03-23 03:12:58 +0000
committerJeremy Allison <jra@samba.org>2001-03-23 03:12:58 +0000
commita44721750944af9beb46f169a49a439b614a8622 (patch)
treed919f0287d64c24cec28ede7dd657117323512d0 /source3/printing
parentda8805b377e361a7cab399b3c786a25f7175e7cf (diff)
downloadsamba-a44721750944af9beb46f169a49a439b614a8622.tar.gz
samba-a44721750944af9beb46f169a49a439b614a8622.tar.bz2
samba-a44721750944af9beb46f169a49a439b614a8622.zip
Two OS/2 printer fixes from Jim McDonough @ IBM.
First one adds a new info level into the lanman printing and an ioctl to the trans2 code. Andrew - this uses ASCII only. It looks ok to me but please check ! Second one adds a parameter "os2 driver map" that allows OS/2 driver names to be mapped. Jeremy. (This used to be commit da79b519e0b6b4317d7fb5260d74e0e74a7e0b46)
Diffstat (limited to 'source3/printing')
-rw-r--r--source3/printing/nt_printing.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index f5c4a234ee..67ac3819ba 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -2135,6 +2135,86 @@ static int unpack_specifics(NT_PRINTER_PARAM **list, char *buf, int buflen)
return len;
}
+static void map_to_os2_driver(fstring drivername)
+{
+ static BOOL initialised=False;
+ static fstring last_from,last_to;
+ char *mapfile = lp_os2_driver_map();
+ char **lines = NULL;
+ int numlines = 0;
+ int i;
+
+ if (!strlen(drivername))
+ return;
+
+ if (!*mapfile)
+ return;
+
+ if (!initialised) {
+ *last_from = *last_to = 0;
+ initialised = True;
+ }
+
+ if (strequal(drivername,last_from)) {
+ DEBUG(3,("Mapped Windows driver %s to OS/2 driver %s\n",drivername,last_to));
+ fstrcpy(drivername,last_to);
+ return;
+ }
+
+ lines = file_lines_load(mapfile, &numlines, True);
+ if (numlines == 0) {
+ DEBUG(0,("No entries in OS/2 driver map %s\n",mapfile));
+ return;
+ }
+
+ DEBUG(4,("Scanning OS/2 driver map %s\n",mapfile));
+
+ for( i = 0; i < numlines; i++) {
+ char *nt_name = lines[i];
+ char *os2_name = strchr(nt_name,'=');
+
+ if (!os2_name)
+ continue;
+
+ *os2_name++ = 0;
+
+ while (isspace(*nt_name))
+ nt_name++;
+
+ if (!*nt_name || strchr("#;",*nt_name))
+ continue;
+
+ {
+ int l = strlen(nt_name);
+ while (l && isspace(nt_name[l-1])) {
+ nt_name[l-1] = 0;
+ l--;
+ }
+ }
+
+ while (isspace(*os2_name))
+ os2_name++;
+
+ {
+ int l = strlen(os2_name);
+ while (l && isspace(os2_name[l-1])) {
+ os2_name[l-1] = 0;
+ l--;
+ }
+ }
+
+ if (strequal(nt_name,drivername)) {
+ DEBUG(3,("Mapped windows driver %s to os2 driver%s\n",drivername,os2_name));
+ fstrcpy(last_from,drivername);
+ fstrcpy(last_to,os2_name);
+ fstrcpy(drivername,os2_name);
+ file_lines_free(lines);
+ return;
+ }
+ }
+
+ file_lines_free(lines);
+}
/****************************************************************************
get a default printer info 2 struct
@@ -2273,6 +2353,11 @@ static uint32 get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen
nt_printing_getsec(get_talloc_ctx(), sharename, &info.secdesc_buf);
+ /* Fix for OS/2 drivers. */
+
+ if (get_remote_arch() == RA_OS2)
+ map_to_os2_driver(info.drivername);
+
safe_free(dbuf.dptr);
*info_ptr=memdup(&info, sizeof(info));