summaryrefslogtreecommitdiff
path: root/source3/smbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2000-07-19 20:11:11 +0000
committerJeremy Allison <jra@samba.org>2000-07-19 20:11:11 +0000
commit5c162bbe5b6ce32f894c3ee77da9dcdd9c840ad4 (patch)
treea6e9c9ede92831ad5e3e6bf995632fe6c049ce83 /source3/smbd
parent3c9e410c340d53897a3f97243d8286812704f6c0 (diff)
downloadsamba-5c162bbe5b6ce32f894c3ee77da9dcdd9c840ad4.tar.gz
samba-5c162bbe5b6ce32f894c3ee77da9dcdd9c840ad4.tar.bz2
samba-5c162bbe5b6ce32f894c3ee77da9dcdd9c840ad4.zip
Code from John Reilly <jreilly@hp.com> to add tdb lookups into the Win95
printer driver download if looking for the default driver files fail. Jeremy. (This used to be commit 1192d867c4e863471f9bc12afceb68a23ba2142e)
Diffstat (limited to 'source3/smbd')
-rw-r--r--source3/smbd/lanman.c51
1 files changed, 44 insertions, 7 deletions
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);