Bug 16340

Summary: Fails to handle sender information not being present in a dbus message gracefully
Product: PolicyKit Reporter: James Westby <jw+debian>
Component: daemonAssignee: David Zeuthen (not reading bugmail) <zeuthen>
Status: RESOLVED INVALID QA Contact: David Zeuthen (not reading bugmail) <zeuthen>
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description James Westby 2008-06-13 04:39:17 UTC
Hi,

I am working on debugging

  https://bugs.edge.launchpad.net/ubuntu/+source/policykit/+bug/219473

and I have come across a possible cause, at least for the warnings that
are shown in one of the messages.

I audited all of the kit_hash_insert usages, and only found one that could
try and add a new key, the one in polkit_tracker_get_caller_from_dbus_name.

It doesn't check that dbus_name is not NULL, presumably relying on 
dbus_error_is_set to be set if that is the case.

In polkitd/polkit-daemon.c in get_caller_from_context there is

  sender = dbus_g_method_get_sender (context);
  dbus_error_init (&dbus_error);
  pk_caller = polkit_tracker_get_caller_from_dbus_name (daemon->priv->pk_tracker,
                                                        sender,
                                                        &dbus_error);

which doesn't check for sender being NULL. Looking at the dbus code
shows that this can be NULL, as dbus messages don't always contain
sender information. dbus/dbus-message.c has the actual code, and in
dbus_message_new_method_return which is another caller has the
comment:

  /* sender is allowed to be null here in peer-to-peer case */

I believe that this can lead to the warning, and so could be handled
more gracefully. However, I'm not sure what PolicyKit's behaviour
should be in this case, but you probably have a better idea about
this than I.

I'm not sure if this is the cause of the bug that I linked to above,
but it is my best idea so far.

Thanks,

James
Comment 1 David Zeuthen (not reading bugmail) 2009-10-21 10:36:16 UTC
This bug report is for the old version of PolicyKit. Closing as all of the code has been rewritten. Please reopen if the bug report applies to the latest version of PolicyKit. Thanks.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.