Currently when "default devmode" is explicitly disabled, and a printer is added with a null device mode, spoolssd crashes in copy_devicemode(). Both construct_printer_info2() and construct_printer_info8() code paths currently unconditionally attempt to copy a printers device mode, without checking whether one is present. This is easily reproducible using the samba3.rpc.spoolss test suite with the following patch: diff --git a/selftest/target/Samba3.pm b/selftest/target/Samba3.pm index 5c86612..515db71 100755 --- a/selftest/target/Samba3.pm +++ b/selftest/target/Samba3.pm @@ -989,6 +989,7 @@ sub provision($$$$$$) [print1] copy = tmp printable = yes + default devmode = no [print2] copy = print1
Created attachment 8231 [details] proposed fix for master and v4-0-test
Created attachment 8232 [details] proposed fix for v3-6-test minor change for sys_usleep in the 3.6 branch.
Could we add new printer share and add a new test which runs on that share without the default devmode?
(In reply to comment #3) > Could we add new printer share and add a new test which runs on that share > without the default devmode? Sure, good idea. Patch to follow...
Comment on attachment 8231 [details] proposed fix for master and v4-0-test Looks fine pushing to autobuild for master.
(In reply to comment #4) > (In reply to comment #3) > > Could we add new printer share and add a new test which runs on that share > > without the default devmode? > > Sure, good idea. Patch to follow... (In reply to comment #4) > (In reply to comment #3) > > Could we add new printer share and add a new test which runs on that share > > without the default devmode? > > Sure, good idea. Patch to follow... We hit the segfault when doing a level 2 EnumPrinters where any printer is configured with "default devmode = no" is present, so simply adding the option to [print3] (not currently used explicitly) is sufficient. Andreas, please review and push if zufrieden, I've snuck in a couple of extra trivial changes: The following changes since commit b533fbc83617a5ba81d1c53309027be296901314: spoolss: fix segfault when "default devmode" is disabled (2012-11-29 11:22:32 +0100) are available in the git repository at: git://git.samba.org/ddiss/samba.git bnc791183_def_devmode_segv_qa David Disseldorp (3): selftest: configure printer with default devmode = no rpcclient: fix usage docs for rpcclient adddriver s3-printing: add missing carriage return to debug str docs-xml/manpages/rpcclient.1.xml | 2 +- selftest/target/Samba3.pm | 1 + source3/printing/printing.c | 2 +- source3/rpcclient/cmd_spoolss.c | 4 ++-- 4 files changed, 5 insertions(+), 4 deletions(-)
Created attachment 8240 [details] tagged fix for v3-6-test
Comment on attachment 8240 [details] tagged fix for v3-6-test Looks good.
Karolin, could you please cherry-pick 2e12deedcfdc5ce3637a125b083b0f00b208bf61 to the v4-0-test branch, and apply "tagged fix for v3-6-test" to the v3-6-test branch. Thanks!
Pushed to v3-6-test and autobuild-v4-0-test.
Pushed to v4-0-test. Closing out bug report. Thanks!