Bug 6564 - SetPrinter fails (panics) as non root
Summary: SetPrinter fails (panics) as non root
Status: RESOLVED FIXED
Alias: None
Product: Samba 3.4
Classification: Unclassified
Component: Printing (show other bugs)
Version: 3.4.0
Hardware: Other Linux
: P3 normal
Target Milestone: ---
Assignee: Karolin Seeger
QA Contact: Samba QA Contact
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-17 17:06 UTC by Guenther Deschner
Modified: 2009-07-26 05:20 UTC (History)
1 user (show)

See Also:


Attachments
Patch for 3.4.1. (1.18 KB, patch)
2009-07-17 19:33 UTC, Jeremy Allison
vl: review+
Details
git-am format patch for v3-4-test tree. (1.62 KB, patch)
2009-07-17 19:35 UTC, Jeremy Allison
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Guenther Deschner 2009-07-17 17:06:29 UTC
SetPrinter fails (panics) as non root

To reproduce:

setup a simple share:

[printername]
      printable = yes

call "rpcclient localhost -U user_with_printop_priv%pass -c "setprinter printername randomcomment"
Comment 1 Jeremy Allison 2009-07-17 19:33:26 UTC
Created attachment 4442 [details]
Patch for 3.4.1.

Missing become_root() calls around reload_services. Needs to be in 3.4.1.
Jeremy.
Comment 2 Jeremy Allison 2009-07-17 19:35:24 UTC
Created attachment 4443 [details]
git-am format patch for v3-4-test tree.
Comment 3 Jeremy Allison 2009-07-17 20:16:51 UTC
Please review then re-assign to Karolin, thanks !
Jeremy.
Comment 4 Volker Lendecke 2009-07-19 19:32:22 UTC
The one I'm not sure about is the one in smbconf_reloaded(). Does that also fix a panic with setprinter, or is that just "reload_services must always be done as root"? If so, why don't you put the [un]become_root pair into that routine?

Volker
Comment 5 Jeremy Allison 2009-07-20 10:26:38 UTC
That's more change than I wanted to put into 3.4.1. For master IMHO we should revisit the comment in the S3 events code that talks about all message callbacks being run as root rather than fixing them individually.
Jeremy.
Comment 6 Volker Lendecke 2009-07-20 16:58:37 UTC
Sorry, I don't understand. https://bugzilla.samba.org/attachment.cgi?id=4443, the patch you want me to ack for 3.4.1, does contain 3 hunks: 2 [un]become_root pairs, and one change_to_root_user() in smb_conf_updated. How does the latter fix a bug with setprinter()?

Thanks,

Volker
Comment 7 Jeremy Allison 2009-07-20 17:08:13 UTC
Calling smb_conf_updated (via a message) crashes when not called as root. That was the actual backtrace of the crash bug (it gets called async via the message sent to all smbd's as well as directly from the printer code). The two become_root()/unbecome_root() pairs were the obvious part of the fix.
Jeremy.
Comment 8 Volker Lendecke 2009-07-20 17:17:48 UTC
Ok, just put it in. I did not see the backtrace though, but if you say it's required, then it must be in.

Volker
Comment 9 Jeremy Allison 2009-07-20 17:19:34 UTC
Yes it's required. I created the backtrace myself (but didn't attach to the bugreport, sorry). It's already in master.
Jeremy.
Comment 10 Karolin Seeger 2009-07-21 01:04:39 UTC
Pushed, patch will be included in 3.4.1.
Closing out bug report.

Thanks!