Bug 12761 - Uploading 32-bit drivers to a Samba 4.6 print server fail
Uploading 32-bit drivers to a Samba 4.6 print server fail
Status: ASSIGNED
Product: Samba 4.1 and newer
Classification: Unclassified
Component: Printing
4.6.3
All All
: P5 major
: ---
Assigned To: Andreas Schneider
Samba QA Contact
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-04-28 06:10 UTC by Marc Muehlfeld
Modified: 2017-09-08 09:41 UTC (History)
6 users (show)

See Also:


Attachments
Level 10 debug log (Samba 4.6.3) (1.90 MB, application/x-bzip)
2017-04-28 06:11 UTC, Marc Muehlfeld
no flags Details
patch for master (2.24 KB, patch)
2017-05-04 15:50 UTC, Andreas Schneider
no flags Details
Proposed patch for master (7.26 KB, patch)
2017-05-05 09:15 UTC, Andreas Schneider
no flags Details
Proposed patch for master (8.08 KB, patch)
2017-05-05 09:34 UTC, Andreas Schneider
no flags Details
patch for v4-6-test (8.29 KB, patch)
2017-05-05 14:33 UTC, Andreas Schneider
gd: review+
Details
patch for 4.6 v2 (11.22 KB, patch)
2017-07-03 11:04 UTC, Andreas Schneider
gd: review+
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Marc Muehlfeld 2017-04-28 06:10:24 UTC
Problem description:
Uploading 32-bit drivers to a Samba 4.6 print server fail. 64-bit drivers work correctly. The same procedure works correctly on Samba 4.5.6.

The error is shown during the files are copied to the server:
> Unable to install //Driver_Name//, Type 3 - User Mode, x86 driver.
> Operation could not be completed (error 0x00000002).

Afterwards the following error is shown:
> Failed to add driver. Operation could not
> be completed (error 0x00000578).



Affected version:
Samba 4.6.3



Reproduceable:
Always.



Steps to reproduce:
See https://wiki.samba.org/index.php/Setting_up_Automatic_Printer_Driver_Downloads_for_Windows_Clients#Uploading_a_Printer_Driver_to_a_Samba_Print_Server



Additional information:
* Fails on Windows 7, 8.1, and 10.
* The problem was originally reported by André Freire on the Samba mailing list:
  https://lists.samba.org/archive/samba/2017-April/208010.htm
Comment 1 Marc Muehlfeld 2017-04-28 06:11:21 UTC
Created attachment 13177 [details]
Level 10 debug log (Samba 4.6.3)
Comment 2 Marc Muehlfeld 2017-04-28 17:30:18 UTC
I tried 4.6.0 on a newly deployed server and it also fails. It seems, that the printer enhancements in 4.6.0 introduced the problem and all later versions are effected.
Comment 3 Andreas Schneider 2017-05-04 15:50:43 UTC
Created attachment 13190 [details]
patch for master

Could you please test if it works with this patch?
Comment 4 Achim Gottinger 2017-05-04 19:08:51 UTC
With the patch applied to 4.6.3 it now fails with this error in the log (3). Tested with Windows 7 32Bit integrated Brother DCP-116C driver.

  api_rpcTNP: rpc command: SPOOLSS_ADDPRINTERDRIVEREX
[2017/05/04 21:06:07.111431,  3] ../source3/smbd/vfs.c:113(vfs_init_default)
  Initialising default vfs hooks
[2017/05/04 21:06:07.111502,  3] ../source3/smbd/vfs.c:139(vfs_init_custom)
  Initialising custom vfs hooks from [/[Default VFS]/]
[2017/05/04 21:06:07.111600,  3] ../source3/smbd/vfs.c:139(vfs_init_custom)
  Initialising custom vfs hooks from [acl_xattr]
[2017/05/04 21:06:07.111672,  3] ../source3/smbd/vfs.c:139(vfs_init_custom)
  Initialising custom vfs hooks from [dfs_samba4]
[2017/05/04 21:06:07.111739,  2] ../source3/modules/vfs_acl_xattr.c:235(connect_acl_xattr)
  connect_acl_xattr: setting 'inherit acls = true' 'dos filemode = true' and 'force unknown acl user = true' for service print$
[2017/05/04 21:06:07.117275,  3] ../source3/smbd/msdfs.c:433(create_conn_struct_cwd)
  create_conn_struct: Can't ChDir to new conn path /var/lib/samba/printing/{57CDAE8F-B46E-4113-91E5-74646A218C0E}. Error was Datei oder Verzeichnis nicht gefunden
[2017/05/04 21:06:07.117496,  0] ../source3/printing/nt_printing.c:726(get_correct_cversion)
  get_correct_cversion: create_conn_struct returned NT_STATUS_OBJECT_NAME_NOT_FOUND
[2017/05/04 21:06:07.117781,  0] ../source3/rpc_server/spoolss/srv_spoolss_nt.c:8604(_spoolss_AddPrinterDriverEx)
  _spoolss_AddPrinterDriverEx: clean_up_driver_struct failed - WERR_FILE_NOT_FOUND
[2017/05/04 21:06:09.115297,  3] ../source3/smbd/dir.c:656(dptr_create)
Comment 5 Achim Gottinger 2017-05-04 19:31:42 UTC
(In reply to Achim Gottinger from comment #4)
 Dir should be /var/lib/samba/printing/W32X86/{57CDAE8F-B46E-4113-91E5-74646A218C0E} instead of /var/lib/samba/printing/{57CDAE8F-B46E-4113-91E5-74646A218C0E}
Comment 6 Andreas Schneider 2017-05-05 07:38:19 UTC
Yep, it was just a quick shot before we left for dinner. We need to add the architecture directory too and add a test.
Comment 7 Andreas Schneider 2017-05-05 09:15:07 UTC
Created attachment 13191 [details]
Proposed patch for master

The attached patch fixes the problem and adds tests so we do not regress in future.
Comment 8 Andreas Schneider 2017-05-05 09:34:20 UTC
Created attachment 13192 [details]
Proposed patch for master
Comment 9 Marc Muehlfeld 2017-05-05 10:31:13 UTC
(In reply to Andreas Schneider from comment #8)
The latest patch works. I successfully tested it on 4.6.3. Thanks.
Comment 10 Achim Gottinger 2017-05-05 10:45:15 UTC
(In reply to Andreas Schneider from comment #8)
Tried it here with 4.6.3 as well and it works. Thanks for the patch!
Comment 11 Andreas Schneider 2017-05-05 14:33:41 UTC
Created attachment 13193 [details]
patch for v4-6-test

Cherry-picked patches from master for the next 4.6 release.
Comment 12 Andreas Schneider 2017-05-05 14:34:45 UTC
Marc, can you create a downstream bug, if you haven't done yet?
Comment 13 Guenther Deschner 2017-05-05 16:05:28 UTC
Comment on attachment 13193 [details]
patch for v4-6-test

LGTM, thanks!
Comment 14 Guenther Deschner 2017-05-05 16:06:27 UTC
Karolin, please add to 4.6.x.

Thanks!
Comment 15 Karolin Seeger 2017-05-09 08:13:11 UTC
Pushed to autobuild-v4-6-test.
Comment 16 Karolin Seeger 2017-05-15 10:38:49 UTC
This patchset seems to break the autobuild:

Testing DeletePrinterDriverEx(torture_driver_copy_from_directory)
WARNING!: ../source4/torture/rpc/spoolss.c:10192: r.out.result was WERR_PRINTER_DRIVER_IN_USE, expected WERR_OK: DeletePrinterDriverEx failed with unexpected result
WARNING!: ../source4/torture/rpc/spoolss.c:10236: Expression `test_DeletePrinterDriverEx_exp(tctx, b, server_name, driver, environment, delete_flags, version, ((WERROR) { 0x00000000 }))' failed: failed to delete driver
UNEXPECTED(failure): samba3.rpc.spoolss.driver.driver.test_driver_copy_from_directory_32(nt4_dc)
REASON: Exception: Exception: ../source4/torture/rpc/spoolss.c:11201: Expression `test_DeletePrinterDriverEx(tctx, b, server_name_slash, d->info8.driver_name, d->local.environment, delete_flags, d->info8.version)' failed: failed to delete driver
Comment 17 Andreas Schneider 2017-07-03 11:04:56 UTC
Created attachment 13341 [details]
patch for 4.6 v2

A patch to fix architecture handling in spoolss_DeletePrinterDriverEx call was missing.

ALL OK (12 tests in 1 testsuites)
Comment 18 Guenther Deschner 2017-07-06 12:27:39 UTC
Comment on attachment 13341 [details]
patch for 4.6 v2

LGTM
Comment 19 Guenther Deschner 2017-07-06 12:38:09 UTC
Karolin, please add to 4.6.x
Comment 20 Stefan Metzmacher 2017-07-13 04:54:52 UTC
Pushed to autobuild-v4-6-test
Comment 21 Stefan Metzmacher 2017-07-13 17:58:40 UTC
(In reply to Stefan Metzmacher from comment #20)

The autobuild is constantly failing with:

[571(3201)/2043 at 50m38s] samba3.rpc.spoolss.driver(nt4_dc)
Testing OpenPrinter(\\127.0.0.3)
Testing GetPrinterData(Architecture)
Testing ClosePrinter
Connecting printer driver share 'print$' on '127.0.0.3'
Uploading printer driver files to \\127.0.0.3\print$
Create remote driver directory: W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}
Uploading /usr/share/cups/drivers/i386/pscript5.dll to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\pscript5.dll
Uploading /usr/share/cups/drivers/i386/cups6.ppd to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\cups6.ppd
Uploading /usr/share/cups/drivers/i386/cupsui6.dll to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\cupsui6.dll
Uploading /usr/share/cups/drivers/i386/pscript.hlp to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\pscript.hlp
Uploading /usr/share/cups/drivers/i386/cups6.inf to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\cups6.inf
Uploading /usr/share/cups/drivers/i386/cups6.ini to W32X86\{79c2ac84-ce34-4fc1-abeb-a5a11ed5bc2f}\cups6.ini
Testing AddPrinterDriverEx(torture_driver_copy_from_directory) level: 3, environment: 'Windows NT x86'
Testing EnumPrinterDrivers(Windows NT x86) level 3, offered: 0
Testing DeletePrinterDriverEx(torture_driver_copy_from_directory)
Testing DeletePrinterDriverEx(torture_driver_copy_from_directory)
WARNING!: ../source4/torture/rpc/spoolss.c:10192: r.out.result was WERR_PRINTER_DRIVER_IN_USE, expected WERR_OK: DeletePrinterDriverEx failed with unexpected result
WARNING!: ../source4/torture/rpc/spoolss.c:10236: Expression `test_DeletePrinterDriverEx_exp(tctx, b, server_name, driver, environment, delete_flags, version, ((WERROR) { 0x00000000 }))' failed: failed to delete driver
UNEXPECTED(failure): samba3.rpc.spoolss.driver.driver.test_driver_copy_from_directory_32(nt4_dc)
REASON: Exception: Exception: ../source4/torture/rpc/spoolss.c:11201: Expression `test_DeletePrinterDriverEx(tctx, b, server_name_slash, d->info8.driver_name, d->local.environment, delete_flags, d->info8.version)' failed: failed to delete driver

FAILED (1 failures, 0 errors and 0 unexpected successes in 0 testsuites)

I'll try to drop the patches from this bug report for now.
Comment 22 Stefan Metzmacher 2017-07-14 06:36:45 UTC
(In reply to Stefan Metzmacher from comment #21)

The autobuild went through without these patches
Comment 23 Andreas Schneider 2017-07-14 08:45:45 UTC
I'm not able to reproduce this locally.

Günther, any idea?
Comment 24 Louis 2017-07-19 12:05:33 UTC
Hai, now, im not a dev, but if i look at both patches. 

i noticed these lines in V2. 

@@ -1374,7 +1374,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,

@@ -1399,7 +1399,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,

@@ -1416,26 +1416,31 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,

V1 does not have 3 lines with "bool printer_driver_in_use(TALLOC_CTX *mem_ctx,"


Im trying to apply the V2 to 4.6.6 for a debian build, and im getting. 

dpkg-source: error: expected [ +-] at start of line 29 of diff `samba-4.6.6+dfsg/debian/patches/S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch

line 28 is : @@ -1399,7 +1399,7 @@ bool printer_driver_in_use(TALLOC_CTX *mem_ctx,
line 29 is :         }


Maybe this helps you guys a bit to get you in the right direction.
Comment 25 Louis 2017-07-19 12:11:37 UTC
in addition. 

the V1 patch with the same setup also fails. 


expected [ +-] at start of line 21 of diff `samba-4.6.6+dfsg/debian/patches/S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch'

dpkg-source: error: expected [ +-] at start of line 21 of diff `samba-4.6.6+dfsg/debian/patches/S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch'
dpkg-source: info: applying S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch
dpkg-source: info: the patch has fuzz which is not allowed, or is malformed
dpkg-source: info: if patch 'S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch' is correctly applied by quilt, use 'quilt refresh' to update it
dpkg-buildpackage: error: dpkg-source --before-build samba-4.6.6+dfsg gave error exit status 2
debuild: fatal error at line 1116:

for you info, both of these patches did apply on 4.6.4 and 4.6.5 
if applied, install of 32 works fine, only removing does not work. 

Greetz, 

Louis
Comment 26 Louis 2017-07-20 10:11:38 UTC
Hai, 

Some extra info. 
Achim, contacted me that he made a new patch. 

his comment :
>> Hello Louis,
>>
>> Seen your post in regards to the windows 32 driver bug.
>> I do not have problems applying the patch but i cleaned it up at the 
>> time it was release.
>> Debian warned because the patch patches two files twice so i patched 
>> an clean source tree and created the diff against an unpatched tree.
>> Did the same after 4.6.6 was released. This time i only saw a few 
>> warnings about line offsets.
>> Here I can install and uninstall 32bit and 64bit drivers without 
>> errors.
>> Double checked and all driver files in W32X64/3 really disappear when 
>> i delete an driver.
>> I assume it is an error in the test routine causing the autobuild 
>> system to fail.

Now, i tried this also, so I used Achims patch. 
Which can be found here.
http://downloads.van-belle.nl/samba4/Patches/debian-S12761-s3-printing-Change-to-GUID-dir-if-we-deal-with-COPY.patch

I've added this one to my debuild 4.6.6 builds and this work fine.
I've tested this on my Jessie server with 4.6.6 debian packages i created.
And result, works for me. 

I can install and delete 32bit drivers again. 

We hope this helps a bit for you guys in finding the solution in the autobuild.
Comment 27 Jordi MORILLO 2017-09-08 09:41:12 UTC
I'm also concerned about this bug since I have to deploy many 32bits print drivers in few days.
Do you have any news about release date (4.6.x) ?
Best regards