summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
Diffstat (limited to 'source3')
-rw-r--r--source3/include/proto.h1
-rw-r--r--source3/printing/nt_printing.c55
-rw-r--r--source3/smbd/lanman.c51
3 files changed, 100 insertions, 7 deletions
diff --git a/source3/include/proto.h b/source3/include/proto.h
index e0ff128368..512d816535 100644
--- a/source3/include/proto.h
+++ b/source3/include/proto.h
@@ -1660,6 +1660,7 @@ BOOL add_a_form(nt_forms_struct **list, const FORM *form, int *count);
void update_a_form(nt_forms_struct **list, const FORM *form, int count);
int get_ntdrivers(fstring **list, char *architecture);
void get_short_archi(char *short_archi, char *long_archi);
+uint32 get_a_printer_driver_9x_compatible(pstring line, fstring model);
uint32 del_a_printer(char *portname);
BOOL add_a_specific_param(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param);
BOOL unlink_specific_param_if_exist(NT_PRINTER_INFO_LEVEL_2 *info_2, NT_PRINTER_PARAM *param);
diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c
index 00735ecbc1..d1cb7e8f34 100644
--- a/source3/printing/nt_printing.c
+++ b/source3/printing/nt_printing.c
@@ -455,6 +455,61 @@ static uint32 get_a_printer_driver_3(NT_PRINTER_DRIVER_INFO_LEVEL_3 **info_ptr,
}
/****************************************************************************
+****************************************************************************/
+uint32 get_a_printer_driver_9x_compatible(pstring line, fstring model)
+{
+ NT_PRINTER_DRIVER_INFO_LEVEL_3 *info3;
+ TDB_DATA kbuf, dbuf;
+ pstring key;
+ int i;
+ line[0] = '\0';
+
+ slprintf(key, sizeof(key), "%s%s/%s", DRIVERS_PREFIX, "WIN40", model);
+ DEBUG(10,("driver key: [%s]\n", key));
+
+ kbuf.dptr = key;
+ kbuf.dsize = strlen(key)+1;
+ if (!tdb_exists(tdb, kbuf)) return False;
+
+ ZERO_STRUCT(info3);
+ get_a_printer_driver_3(&info3, model, "Windows 4.0");
+
+ DEBUGADD(10,("info3->name [%s]\n", info3->name));
+ DEBUGADD(10,("info3->datafile [%s]\n", info3->datafile));
+ DEBUGADD(10,("info3->helpfile [%s]\n", info3->helpfile));
+ DEBUGADD(10,("info3->monitorname [%s]\n", info3->monitorname));
+ DEBUGADD(10,("info3->defaultdatatype [%s]\n", info3->defaultdatatype));
+ for (i=0; info3->dependentfiles && *info3->dependentfiles[i]; i++) {
+ DEBUGADD(10,("info3->dependentfiles [%s]\n", info3->dependentfiles[i]));
+ }
+ DEBUGADD(10,("info3->environment [%s]\n", info3->environment));
+ DEBUGADD(10,("info3->driverpath [%s]\n", info3->driverpath));
+ DEBUGADD(10,("info3->configfile [%s]\n", info3->configfile));
+
+ /*pstrcat(line, info3->name); pstrcat(line, ":");*/
+ pstrcat(line, info3->configfile);
+ pstrcat(line, ":");
+ pstrcat(line, info3->datafile);
+ pstrcat(line, ":");
+ pstrcat(line, info3->helpfile);
+ pstrcat(line, ":");
+ pstrcat(line, info3->monitorname);
+ pstrcat(line, ":");
+ pstrcat(line, "RAW"); /*info3->defaultdatatype);*/
+ pstrcat(line, ":");
+
+ for (i=0; info3->dependentfiles &&
+ *info3->dependentfiles[i]; i++) {
+ if (i) pstrcat(line, ","); /* don't end in a "," */
+ pstrcat(line, info3->dependentfiles[i]);
+ }
+
+ free(info3);
+
+ return True;
+}
+
+/****************************************************************************
debugging function, dump at level 6 the struct in the logs
****************************************************************************/
static uint32 dump_a_printer_driver(NT_PRINTER_DRIVER_INFO_LEVEL driver, uint32 level)
diff --git a/source3/smbd/lanman.c b/source3/smbd/lanman.c
index e5a42d4db4..a51ea92353 100644
--- a/source3/smbd/lanman.c
+++ b/source3/smbd/lanman.c
@@ -498,15 +498,17 @@ static void fill_printq_info_52(connection_struct *conn, int snum, int uLevel,
pstring tok,driver,datafile,langmon,helpfile,datatype;
char *p;
char **lines, *line;
+ pstring gen_line;
+ DEBUG(10,("snum: %d\nlp_printerdriver: [%s]\nlp_driverfile: [%s]\n",
+ snum, lp_printerdriver(snum), lp_driverfile(snum)));
lines = file_lines_load(lp_driverfile(snum),NULL);
if (!lines) {
DEBUG(3,("fill_printq_info: Can't open %s - %s\n",
lp_driverfile(snum),strerror(errno)));
- desc->errcode=NERR_notsupported;
- return;
}
-
+ else
+ {
/* lookup the long printer driver name in the file
description */
for (i=0;lines[i] && !ok;i++) {
@@ -516,6 +518,22 @@ static void fill_printq_info_52(connection_struct *conn, int snum, int uLevel,
(!strncmp(tok,lp_printerdriver(snum),strlen(lp_printerdriver(snum)))))
ok=1;
}
+ }
+
+ if( !ok ) {
+ /* no printers.def, or driver not found, check the NT driver tdb */
+ if ( ok = get_a_printer_driver_9x_compatible(gen_line, lp_printerdriver(snum)) ) {
+ p = gen_line;
+ DEBUG(10,("9x compatable driver line for [%s]: [%s]\n",
+ lp_printerdriver(snum), gen_line));
+ } else {
+ /* didn't find driver in tdb either... oh well */
+ DEBUG(10,("9x driver not found in tdb\n"));
+ desc->errcode=NERR_notsupported;
+ return;
+ }
+ }
+
line = strdup(p);
p = line;
file_lines_free(lines);
@@ -667,21 +685,40 @@ static int get_printerdrivernumber(int snum)
pstring tok;
char *p;
char **lines, *line;
+ pstring gen_line;
+ DEBUG(10,("snum: %d\nlp_printerdriver: [%s]\nlp_driverfile: [%s]\n",
+ snum, lp_printerdriver(snum), lp_driverfile(snum)));
lines = file_lines_load(lp_driverfile(snum), NULL);
if (!lines) {
DEBUG(3,("get_printerdrivernumber: Can't open %s - %s\n",
lp_driverfile(snum),strerror(errno)));
- return(0);
}
-
- /* lookup the long printer driver name in the file description */
- for (i=0;lines[i] && !ok; i++) {
+ else
+ {
+ /* lookup the long printer driver name in the file
+ description */
+ for (i=0;lines[i] && !ok;i++) {
p = lines[i];
if (next_token(&p,tok,":",sizeof(tok)) &&
+ (strlen(lp_printerdriver(snum)) == strlen(tok)) &&
(!strncmp(tok,lp_printerdriver(snum),strlen(lp_printerdriver(snum)))))
ok=1;
}
+ }
+
+ if( !ok ) {
+ /* no printers.def, or driver not found, check the NT driver tdb */
+ if ( ok = get_a_printer_driver_9x_compatible(gen_line, lp_printerdriver(snum)) ) {
+ p = gen_line;
+ DEBUG(10,("9x compatable driver line for [%s]: [%s]\n",
+ lp_printerdriver(snum), gen_line));
+ } else {
+ /* didn't find driver in tdb either... oh well */
+ DEBUG(10,("9x driver not found in tdb\n"));
+ return (0);
+ }
+ }
line = strdup(p);
p = line;
file_lines_free(lines);