Bug 1851 - printerdata_ex data/keys incorrect against W2K3
Summary: printerdata_ex data/keys incorrect against W2K3
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.0
Classification: Unclassified
Component: Printing (show other bugs)
Version: 3.0.20
Hardware: All All
: P3 normal
Target Milestone: none
Assignee: Guenther Deschner
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-09-29 10:08 UTC by Daniel Jarboe
Modified: 2009-09-03 15:12 UTC (History)
1 user (show)

See Also:


Attachments
sample python script to illustrate problem (711 bytes, text/plain)
2004-09-29 10:09 UTC, Daniel Jarboe
no flags Details
output from above script (4.02 KB, text/plain)
2004-09-29 10:10 UTC, Daniel Jarboe
no flags Details
same output with debug set to 10 (gzipped) (133.16 KB, text/plain)
2004-09-29 10:16 UTC, Daniel Jarboe
no flags Details
hotfix (1.24 KB, patch)
2004-10-05 07:38 UTC, Guenther Deschner
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Jarboe 2004-09-29 10:08:22 UTC
There's a problem using printerdata_ex keys (wrong offsets during parsing 
maybe?).  I was trying to use this to suck driver settings off of a W2K3 
server and onto Samba on Linux.

In a nutshell, key names are cut short or include additional characters, and 
attempts to read them often result in WERR_BADFILE exceptions.

Here's some example key values from a RH9 intel box against a W2K3 server:

PrinterDriverData keys from samba python on intel:
['', 'InitDriverVersion', '\xe4\x89\x8d\xe0\xa8\x80\xe7\x95\x84\xe6\xb1\xb0\xe7
\xa1\xa5\xe6\xb9\x95\xe7\x91\xa9\xe4\xa4\x80\xe7\x8d\xae\xe6\x85\xb4\xe6\xb1
\xac\xe6\x91\xa5\xe0\xa8\x80\xe7\x89\x94\xe7\xa5\xa1\xe5\x94\xb3\xe6\xa5
\xaet\xe6\xb9\x89\xe7\x91\xb3\xe6\xb1\xa1\xe6\x95\xacd\xe4\x94\x8a\xe7\x99
\xae\xe6\x95\x86\xe6\x91\xa5\xe7\x89\xa5\xe4\xb8\x80\xe7\x91\xaf\xe6\xb9\x89
\xe7\x91\xb3\xe6\xb1\xa1\xe6\x95\xacd\xe4\x98\x8a\xe6\xb9\xa9\xe7\x8d\xa9\xe6
\x95\xa8r\xe6\xbd\x8e\xe4\xa5\xb4\xe7\x8d\xae\xe6\x85\xb4\xe6\xb1\xac\xe6\x91
\xa5\xe0\xa8\x80', 'pdPrinterPassThrough', '0', 'velope 
feed', 'Model', 'interDataSize', 'rms?', 'FreeMem']

DsSpooler keys intel:
['', 'description', 'printStartTime', 'int-serva\\TC6-W-
TECH', 'ame', 'atorFile', 'intSpooling', 'C6-W-
TECH', 'r', 'location', 'portName', 'driverName', '-W-
TECH', 'tServerName', 'printKeepPrintedJobs', 'y', 'intEndTime']

DsDriver keys intel: 
['', 'rintMaxResolutionSupported', 'rintDuplexSupported', 'printNumberUp', 'nve
lope 
Feeder', 'intMemory', 'RTRAIT', 'agesPerMinute', 'NDSCAPE', 'printColor', 'prin
tRate', '\x18', 'printRateUnit', 'pported', 'rintPagesPerMinute', 'printMediaSu
pported', 'printCollate', 'riverVersion', 'printMediaReady']

On SLES8 s390 more of them are correct, but still some are wrong.

PrinterDriverData keys on samba python s390: 
['PrinterDataSize', 'FeatureKeyword', 'LpdPrinterDontDetect', 'Forms?', '\xea\x
84
\x93TrayFormTable', 'InitDriverVersion', 'LpdPrinterPassThrough', 'FeatureKeywo
rdSize', 'PrinterData', 'Model', 'FreeMem', 'FontCart']

pdex['DsDriver'] keys s390: 
['printBinNames', 'driverVersion', 'printNumberUp', 'printMaxYExtent', 'printPa
gesPerMinute', '\x01printColor', 'printMemory', 'printMaxXExtent', 'printOrient
ationsSupported', 'printStaplingSupported', 'printMaxResolutionSupported', 'pri
ntMinXExtent', 'printRate', 'printDuplexSupported', 'printRateUnit', 'printMinY
Extent', 'printMediaSupported', 'printCollate', 'printLanguage', 'printMediaRea
dy']

The RH9 intel example its with samba-latest.tgz (3.0.7)...
./configure --with-python
make proto_exists python_ext

Attached please find the python script and two outputs to demonstrate the 
problem when run on RH9 intel.

Any ideas?

Thanks,
~ Daniel
Comment 1 Daniel Jarboe 2004-09-29 10:09:19 UTC
Created attachment 686 [details]
sample python script to illustrate problem

python and debuglevel 10 output to follow...
Comment 2 Daniel Jarboe 2004-09-29 10:10:01 UTC
Created attachment 687 [details]
output from above script

Sample output to better understand the problem
Comment 3 Daniel Jarboe 2004-09-29 10:16:15 UTC
Created attachment 688 [details]
same output with debug set to 10 (gzipped)

with samba debug, script run on RH9 on intel
Comment 4 Daniel Jarboe 2004-10-05 07:18:12 UTC
On further investigation it appears the problem is below the python wrappers.

Possibly with the cli_spoolss_ code, specifically against W2K3?

Here's rpcclient output run from a debian intel box against a W2k3 server, doing
an enumdataex for two sample printers.

rpcclient $> enumkey TC6-W-TECH
DsDriver
DsSpooler
PnPData
PrinterDriverData
rpcclient $> enumdataex TC6-W-TECH DsDriver
printMediaSupported: REG_MULTI_SZ:
  Letter
  Legal
  Statement
  Executive
  A3
  A4
  A5
  B4 (JIS)
  B5 (JIS)
  Folio
  Envelope #10
  Envelope DL
  Envelope C5
  Envelope B5
  Envelope Monarch
  Ledger 11 x 17 in
  B5-ISO
  JPOSTD
printMediaReady: REG_MULTI_SZ:
  Letter
  Legal
printNumberUp: REG_DWORD: 0x00060000
: REG_DWORD: 0x00720070
intMemory: REG_MULTI_SZ:
  á
  intBinNames
  Automatically Select
  Tray 1
  Tray 2
  Tray 3
  Auxiliary Tray
  Manual Paper Feed
  Manual Envelope feed
  E
nvelope Feeder: REG_MULTI_SZ:
pported: REG_DWORD: 0x004f0050
RTRAIT: REG_MULTI_SZ:
  LA
NDSCAPE: REG_DWORD: 0x00700000
rintMaxResolutionSupported: REG_SZ: É
: REG_DWORD: 0x00000000
printRate: REG_DWORD: 0x00000018
printRateUnit: REG_BINARY: unknown length value not displayed
agesPerMinute: REG_BINARY: unknown length value not displayed
rintPagesPerMinute: REG_BINARY: unknown length value not displayed
▒: REG_BINARY: unknown length value not displayed
riverVersion: REG_DWORD: 0x00000401
printCollate: REG_DWORD: 0x00010000
printColor: REG_DWORD: 0x00700000
rintDuplexSupported: REG_DWORD: 0x00700001
rpcclient $> enumkey TC5-E-2
DsDriver
DsSpooler
PnPData
PrinterDriverData
rpcclient $> enumdataex DsDriver
Usage: enumdataex printername <keyname>
rpcclient $> enumdataex Tc5-E-2 DsDriver
printBinNames: REG_MULTI_SZ:
   Auto Select
   Manual Feed
   Tray 1
   Tray 2
   Tray 3
   Tray 4
  Plain
  Preprinted
  Letterhead
  Transparency
  Prepunched
  Labels
  Bond
  Recycled
  Color
  Cardstock
  Rough
printCollate: REG_BINARY: unknown length value not displayed
printColor: REG_BINARY: unknown length value not displayed
printDuplexSupported: REG_BINARY: unknown length value not displayed
printStaplingSupported: REG_BINARY: unknown length value not displayed
printMaxXExtent: REG_DWORD: 0x0c2f0000
: REG_DWORD: 0x00720070
intMaxYExtent: REG_DWORD: 0x0000125b
printMinXExtent: REG_DWORD: 0x000003d7
printMinYExtent: REG_MULTI_SZ:
  ݱ
  rintMediaSupported
  Letter
  Legal
  Executive
  A3
  A4
  A5
  B4 (JIS)
  B5 (JIS)
  11x17
  Envelope #10
  Envelope DL
  Envelope C5
  Envelope B5
  Envelope Monarch
  5.5x8.5
  8x13
  8.25x13
  8.5x13
  11 x 17
  7.25 x 10.5
  5.5 x 8.5
  8.25 x 13
  8.5 x 13
  8 x 13
  8K
  16K
  11x17 (Oversize 11.7x17.7)
  Double Postcard (JIS)
  Executive (JIS)
  Ledger 11 x 17 in
  B5-ISO
  JPOSTD
  Ledger (11 x 17 inch)
  Statement (5.5 x 8.5 inch)
  Folio (210 x 330 mm)
  Oficio II (8.5 x 13 inch)
  B5 (ISO)
  Maximum 11
.7 x17.7: REG_MULTI_SZ:
  Cäᢨä
ustom Size: REG_DWORD: 0x00700000
rintMediaReady: REG_DWORD: 0x00700000
rintNumberUp: REG_MULTI_SZ:

  printMemory
  @
  prinçà ©Ä
tOrientationsSupported: REG_DWORD: 0x004f0050
RTRAIT: REG_MULTI_SZ:
  LANDS
CAPE: REG_DWORD: 0x00700000
rintMaxResolutionSupported: REG_SZ:
e: REG_DWORD: 0x00430050
L: REG_DWORD: 0x00700000
rpcclient $>


Against a W2K print server it looks fine...
rpcclient $> enumdataex 30-MAIL-N DsDriver
printBinNames: REG_MULTI_SZ:
   Auto Select
   Manual Feed
   Tray 1
   Tray 2
   Tray 3
   Tray 4
  Plain
  Preprinted
  Letterhead
  Transparency
  Prepunched
  Labels
  Bond
  Recycled
  Color
  Cardstock
  Rough
printCollate: REG_BINARY: unknown length value not displayed
printColor: REG_BINARY: unknown length value not displayed
printDuplexSupported: REG_BINARY: unknown length value not displayed
printStaplingSupported: REG_BINARY: unknown length value not displayed
printMaxXExtent: REG_DWORD: 0x00000c2f
printMaxYExtent: REG_DWORD: 0x0000125b
printMinXExtent: REG_DWORD: 0x000003d7
printMinYExtent: REG_DWORD: 0x00000771
printMediaSupported: REG_MULTI_SZ:
  Letter
  Legal
  Executive
  A3
  A4
  A5
  B4 (JIS)
  B5 (JIS)
  11x17
  Envelope #10
  Envelope DL
  Envelope C5
  Envelope B5
  Envelope Monarch
  Index card 5 x 8 in
  Index card 8 x 10 in
  Maximum 11.7 x17.7
  B5 ISO
  Executive (JIS)
  16K
  8K
  Double Post Card
  Fanfold 8 1/2 x 12 in
  Ledger (11 x 17 inch)
  Statement (5.5 x 8.5 inch)
  Folio (210 x 330 mm)
  Oficio II (8.5 x 13 inch)
  11 x 17
  7.25 x 10.5
  5.5 x 8.5
  8.25 x 13
  8.5 x 13
  8 x 13
  Ledger 11 x 17 in
  B5-ISO
  JPOSTD
  Double Postcard (JIS)
  B5 (ISO)
  Custom Size
printMediaReady: REG_MULTI_SZ:
printNumberUp: REG_DWORD: 0x00000005
printMemory: REG_DWORD: 0x00000040
printOrientationsSupported: REG_MULTI_SZ:
  PORTRAIT
  LANDSCAPE
printMaxResolutionSupported: REG_DWORD: 0x00000258
printLanguage: REG_MULTI_SZ:
  PCL
printRate: REG_DWORD: 0x00000032
printRateUnit: REG_SZ: PagesPerMinute
printPagesPerMinute: REG_DWORD: 0x00000032
driverVersion: REG_DWORD: 0x00000401
rpcclient $>

So when querying a W2K server the data seems okay, but looks like samba has
trouble parsing the data from a W2K3 server?  Any ideas?

~ Daniel
Comment 5 Guenther Deschner 2004-10-05 07:37:03 UTC
I'm so glad I'm not the only one seeing crippled values from win2k3-spoolss-rpc.

Attached is a very ugly hotfix (certainly not the right way to resolve that
issue). Anyway, most of the issues seem to be addressed with that patch applied.
Comment 6 Guenther Deschner 2004-10-05 07:38:00 UTC
Created attachment 700 [details]
hotfix
Comment 7 Daniel Jarboe 2004-10-06 10:27:32 UTC
Yes, your patch helps (but some offsets are still wrong).

debian intel:

PrinterDriverData keys: ['PrinterDataSize', 'FeatureKeyword',
'LpdPrinterDontDetect', 'Forms?', '\xea\x84\x93TrayFormTable',
'InitDriverVersion', 'LpdPrinterPassThrough', 'FreeMem', 'PrinterData', 'Model',
'FeatureKeywordSize', 'FontCart']

DsDriver keys: ['printBinNames', 'driverVersion', 'printNumberUp',
'printMaxYExtent', 'printPagesPerMinute', '\x01printColor', 'printMemory',
'printMaxXExtent', 'printOrientationsSupported', 'printStaplingSupported',
'printMaxResolutionSupported', 'printMinXExtent', 'printRate',
'printDuplexSupported', 'printRateUnit', 'printMinYExtent',
'printMediaSupported', 'printCollate', 'printLanguage', 'printMediaReady']

So are you implying this is not a samba problem but a W2K3 problem?
Comment 8 Guenther Deschner 2004-11-12 16:30:54 UTC
This is a samba problem.
Comment 9 Gerald (Jerry) Carter (dead mail address) 2006-03-16 07:34:47 UTC
marking as later.  will retest once Samba 3 moves to IDL.
Comment 10 Guenther Deschner 2009-03-18 09:16:08 UTC
(In reply to comment #9)
> marking as later.  will retest once Samba 3 moves to IDL.
> 

ok, we moved to IDL in spoolss now. can people re-test this ? I cannot reproduce it anymore.
Comment 11 Guenther Deschner 2009-03-18 09:17:00 UTC
Tim, I'm re-assigning to me if you don't mind.
Comment 12 Guenther Deschner 2009-09-03 15:12:13 UTC
After having observed this for a while we can say it is fixed with the conversion to IDL generated spoolss marshaling in 3.4.0