I have checked further and found out that scp-dbus-service.py only uses
authentication via asyncconn.py, never via asyncipp.py, asyncpk1.py, or
authconn.py directly. So for all authentication access an auto-selection
of IPP authentication (done by asyncipp.py and authconn.py) or PolicyKit
authentication is done:

use_pk = ((host.startswith ('/') or host == 'localhost') and
                  os.getuid () != 0)

PoliciKit is chosen if the program is started by a non-root user and the
CUPS host is local (either "localhost" or a socket). The PolicyKit
authentication does not open any GTK windows.

Also note that the "import authconn" in asyncconn.py is bogus, there
asyncconn.py does not use authconn.py directly.

The only use of the GTK module in asyncpk1.py are "gtk.gdk.threads_enter
()"/"gtk.gdk.threads_leave ()" pairs which should be made optional (only
if gtk is present), removed, or replaced by something more general.

So one could do the following:

1. Make the KDE printer setup tool PolicyKit-only. For this let it error
out (with an error dialog) when the user tries to start it as root and
also ignore any remote CUPS servers set as default via client.conf and
do not offer functionality to switch the CUPS server (If the default
CUPS server is remote, try to access "localhost" or the local daemon via
socket and if this does not work, error out with an error dialog). With
all this, asyncconn will always select PolicyKit authentication.

2. Remove "import gtk" and "import authconn" in asyncconn.py

3. In ayncconn.py import only the one to be actually used of asyncipp
and asyncpk1. If the import fails, let the creation of the Connection
instance fail.

4. In asyncpk1.py bracket the "import gtk", "gtk.gdk.threads_enter ()",
and "gtk.gdk.threads_leave ()" calls in "try: ... except: ...". In the
"except:" blocks either do nothing or put any substitution for the
"gtk.gdk.threads_enter ()"/"gtk.gdk.threads_leave ()" mechanism.

5. For the Ubuntu packaging move asyncconn.py and asyncpk1.py from the
system-config-printer-gnome binary package into system-config-printer-
common.

Scott, Tim, Jiri, WDYT about this solution?

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/902762

Title:
  scp-dbus-service.py crashed with ImportError in __main__: No module
  named asyncconn

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/system-config-printer/+bug/902762/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to