From 528ff0d6f724f74800a5098ef2ec6106d67164a6 Mon Sep 17 00:00:00 2001 From: Gerald Carter Date: Tue, 22 Jan 2002 18:14:31 +0000 Subject: merge from 2.2. of * PRINTER_ATTRIBUTE's * "default devmode" parameter (This used to be commit 90a7a1840b4823d4ebe047130a95dd15a824500b) --- source3/param/loadparm.c | 4 ++++ source3/printing/nt_printing.c | 39 +++++++++++++++++++-------------------- 2 files changed, 23 insertions(+), 20 deletions(-) diff --git a/source3/param/loadparm.c b/source3/param/loadparm.c index af8a5df897..227e44e95b 100644 --- a/source3/param/loadparm.c +++ b/source3/param/loadparm.c @@ -387,6 +387,7 @@ typedef struct BOOL bInheritPerms; BOOL bMSDfsRoot; BOOL bUseClientDriver; + BOOL bDefaultDevmode; BOOL bNTAclSupport; char dummy[3]; /* for alignment */ @@ -501,6 +502,7 @@ static service sDefault = { False, /* bInheritPerms */ False, /* bMSDfsRoot */ False, /* bUseClientDriver */ + False, /* bDefaultDevmode */ True, /* bNTAclSupport */ "" /* dummy */ @@ -874,6 +876,7 @@ static struct parm_struct parm_table[] = { {"printer name", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, FLAG_PRINT}, {"printer", P_STRING, P_LOCAL, &sDefault.szPrintername, NULL, NULL, 0}, {"use client driver", P_BOOL, P_LOCAL, &sDefault.bUseClientDriver, NULL, NULL, FLAG_PRINT}, + {"default devmode", P_BOOL, P_LOCAL, &sDefault.bDefaultDevmode, NULL, NULL, FLAG_PRINT}, {"printer driver", P_STRING, P_LOCAL, &sDefault.szPrinterDriver, NULL, NULL, FLAG_PRINT}, {"printer driver file", P_STRING, P_LOCAL, &sDefault.szDriverFile, NULL, NULL, FLAG_PRINT}, {"printer driver location", P_STRING, P_LOCAL, &sDefault.szPrinterDriverLocation, NULL, NULL, FLAG_PRINT | FLAG_GLOBAL}, @@ -1711,6 +1714,7 @@ FN_LOCAL_BOOL(lp_fake_dir_create_times, bFakeDirCreateTimes) FN_LOCAL_BOOL(lp_blocking_locks, bBlockingLocks) FN_LOCAL_BOOL(lp_inherit_perms, bInheritPerms) FN_LOCAL_BOOL(lp_use_client_driver, bUseClientDriver) +FN_LOCAL_BOOL(lp_default_devmode, bDefaultDevmode) FN_LOCAL_BOOL(lp_nt_acl_support, bNTAclSupport) FN_LOCAL_INTEGER(lp_create_mask, iCreate_mask) FN_LOCAL_INTEGER(lp_force_create_mode, iCreate_force_mode) diff --git a/source3/printing/nt_printing.c b/source3/printing/nt_printing.c index 0f02266c0f..0ba0f45452 100644 --- a/source3/printing/nt_printing.c +++ b/source3/printing/nt_printing.c @@ -2425,10 +2425,7 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin fstrcpy(info.printprocessor, "winprint"); fstrcpy(info.datatype, "RAW"); - info.attributes = PRINTER_ATTRIBUTE_SHARED \ - | PRINTER_ATTRIBUTE_LOCAL \ - | PRINTER_ATTRIBUTE_RAW_ONLY \ - | PRINTER_ATTRIBUTE_QUEUED ; /* attributes */ + info.attributes = (PRINTER_ATTRIBUTE_SHARED | PRINTER_ATTRIBUTE_NETWORK); info.starttime = 0; /* Minutes since 12:00am GMT */ info.untiltime = 0; /* Minutes since 12:00am GMT */ @@ -2440,20 +2437,19 @@ static WERROR get_a_printer_2_default(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstrin * I changed this as I think it is better to have a generic * DEVMODE than to crash Win2k explorer.exe --jerry * See the HP Deskjet 990c Win2k drivers for an example. + * + * However the default devmode appears to cause problems + * with the HP CLJ 8500 PCL driver. Hence the addition of + * the "default devmode" parameter --jerry 22/01/2002 */ -#if 0 /* JRA - NO NOT CHANGE ! */ - info.devmode = NULL; -#else - /* - * We should not return a default devicemode, as this causes - * Win2K to not send the correct one on PCL drivers. It needs to - * see a null devicemode so it can then overwrite the devicemode - * on OpenPrinterEx. Yes this *is* insane :-). JRA. - */ - if ((info.devmode = construct_nt_devicemode(info.printername)) == NULL) - goto fail; -#endif + if (lp_default_devmode(snum)) { + info.devmode = NULL; + } + else { + if ((info.devmode = construct_nt_devicemode(info.printername)) == NULL) + goto fail; + } /* This will get the current RPC talloc context, but we should be passing this as a parameter... fixme... JRA ! */ @@ -2522,7 +2518,7 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen info.parameters); /* Samba has to have shared raw drivers. */ - info.attributes |= (PRINTER_ATTRIBUTE_SHARED|PRINTER_ATTRIBUTE_RAW_ONLY); + info.attributes |= (PRINTER_ATTRIBUTE_SHARED | PRINTER_ATTRIBUTE_NETWORK); /* Restore the stripped strings. */ slprintf(info.servername, sizeof(info.servername)-1, "\\\\%s", get_called_name()); @@ -2531,19 +2527,22 @@ static WERROR get_a_printer_2(NT_PRINTER_INFO_LEVEL_2 **info_ptr, fstring sharen fstrcpy(info.printername, printername); len += unpack_devicemode(&info.devmode,dbuf.dptr+len, dbuf.dsize-len); -#if 1 + /* * Some client drivers freak out if there is a NULL devmode * (probably the driver is not checking before accessing * the devmode pointer) --jerry + * + * See comments in get_a_printer_2_default() */ - if (!info.devmode) + + if (lp_default_devmode(lp_servicenumber(sharename)) && !info.devmode) { DEBUG(8,("get_a_printer_2: Constructing a default device mode for [%s]\n", printername)); info.devmode = construct_nt_devicemode(printername); } -#endif + len += unpack_specifics(&info.specific,dbuf.dptr+len, dbuf.dsize-len); /* This will get the current RPC talloc context, but we should be -- cgit