[PATCH] Allow eavesdropping on method calls

Havoc Pennington hp at redhat.com
Mon Jun 5 09:17:21 PDT 2006


John (J5) Palmieri wrote:
> On Sun, 2006-06-04 at 00:46 -0400, Havoc Pennington wrote:
>> John (J5) Palmieri wrote:
>>> -  if (type == DBUS_MESSAGE_TYPE_METHOD_CALL)
>>> +  if (type == DBUS_MESSAGE_TYPE_METHOD_CALL &&
>>> +        addressed_recipient == proposed_recipient /* not eavesdropping */)
>>>      {
>> There's another if() right after this one with "(sender && 
>> addressed_recipient && ...)"
>>
>> It would make more sense to me to put the addressed_recipient == 
>> proposed_recipient test in that subsequent if() block, though it makes 
>> no real difference.
>>
>> I don't understand why this fixes eavesdropping, though it looks like a 
>> correct fix ... can you elaborate a little?
> 
> Yes, this is because if the second "if" fails it returns FALSE, thereby
> blocking the method from being sent.  If addressed_recipient !=
> proposed_recipient /* we are eavesdropping */ then we need to send out
> the message.  The first "if" bypasses the second "if" if we are
> eavesdropping.  
>  

OK makes sense, looks good. Can you squish the two "if" together for 
clarity?

Havoc


More information about the dbus mailing list