Bug 1122018

Summary: calling a method with different signature does not throw UnknownMethod error
Product: [Fedora] Fedora Reporter: Jakub Jelen <jjelen>
Component: dbus-pythonAssignee: leigh scott <leigh123linux>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 21CC: dan.mashal, jpopelka, lnie, rdieter, stefano, twoerner
Target Milestone: ---Flags: jjelen: needinfo? (dan.mashal)
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: dbus-python-1.2.0-12.fc23 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2015-11-19 09:53:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---
Bug Depends On:    
Bug Blocks: 1017034    
Attachments:
Description Flags
python-dbus example none

Description Jakub Jelen 2014-07-22 11:11:54 UTC
Description of problem:
When communicating with firewalld through D-Bus interface (strict types) firewalld accepts also wrong types. Behavior is unknown and this should fix in global scope in firewalld.

Version-Release number of selected component (if applicable):
Upstream version from git
https://git.fedorahosted.org/git/firewalld.git

How reproducible:
deterministic

Steps to Reproduce:
1. Call method through D-Bus interface with incorrect argument type (where it makes sense)
2. see return results & iptables dump

Actual results:
Call returns error but command with iptables is executed.

Expected results:
Call returns error (wrong arguments type) and command with IPtables is not executed.


Additional info:

Example:
# dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply --type=method_call /org/fedoraproject/FirewallD1 org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter" int32:32
First call returns:
> Error org.freedesktop.DBus.Python.dbus.exceptions.DBusException: Expected a string or unicode object
Second call returns:
> Error org.freedesktop.DBus.Python.dbus.exceptions.DBusException: ALREADY_ENABLED
# iptables-save -t filter | grep ":32"
contains just added chain even through this error.

Comment 1 Jiri Popelka 2014-07-25 16:42:21 UTC
With:
https://git.fedorahosted.org/cgit/firewalld.git/commit/?id=7b8d76273939d28b96b6a3e0bb99b2c6a8e6e1c3

the results are:
DBusException: 32 is <type 'int'>, expected <type 'str'>
and the chain is not added

Comment 2 Jakub Jelen 2014-07-28 17:07:50 UTC
Thanks for fix.
Tested on chains and works fine. I will test other methods later, but I see you made it working globally.

:: [ 12:55:32 ] :: :::::::: Direct example
:: [  BEGIN   ] :: Running 'dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply --type=method_call /org/fedoraproject/FirewallD1 org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter" int32:32'
Error org.freedesktop.DBus.Python.dbus.exceptions.DBusException: 32 is <type 'int'>, expected <type 'str'>
:: [   PASS   ] :: Command 'dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply --type=method_call /org/fedoraproject/FirewallD1 org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter" int32:32' (Expected 1, got 1)
:: [  BEGIN   ] :: Running 'dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply --type=method_call /org/fedoraproject/FirewallD1 org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter" int32:32'
Error org.freedesktop.DBus.Python.dbus.exceptions.DBusException: 32 is <type 'int'>, expected <type 'str'>
:: [   PASS   ] :: Command 'dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply --type=method_call /org/fedoraproject/FirewallD1 org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter" int32:32' (Expected 1, got 1)
:: [  BEGIN   ] :: Running 'iptables-save -t filter | grep ":32 - \[0:0\]"'
:: [   PASS   ] :: Command 'iptables-save -t filter | grep ":32 - \[0:0\]"' (Expected 1, got 1)

I guess this bugzilla is resolved in upstream.

Comment 3 Fedora Update System 2014-08-20 17:19:31 UTC
firewalld-0.3.11-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/firewalld-0.3.11-1.fc20

Comment 4 lnie 2014-08-21 03:03:02 UTC
firewalld-0.3.11-1.fc20 works

Comment 5 Fedora Update System 2014-08-21 09:43:07 UTC
Package firewalld-0.3.11-1.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing firewalld-0.3.11-1.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-9609/firewalld-0.3.11-1.fc20
then log in and leave karma (feedback).

Comment 6 Fedora Update System 2014-08-27 01:30:54 UTC
Package firewalld-0.3.11-2.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing firewalld-0.3.11-2.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-9609/firewalld-0.3.11-2.fc20
then log in and leave karma (feedback).

Comment 7 Fedora Update System 2014-08-28 15:33:26 UTC
Package firewalld-0.3.11-3.fc20:
* should fix your issue,
* was pushed to the Fedora 20 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing firewalld-0.3.11-3.fc20'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-9609/firewalld-0.3.11-3.fc20
then log in and leave karma (feedback).

Comment 8 Jiri Popelka 2014-09-11 16:20:03 UTC
(In reply to Jakub Jelen from comment #0)
> # dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply
> --type=method_call /org/fedoraproject/FirewallD1
> org.fedoraproject.FirewallD1.direct.addChain string:"ipv4" string:"filter"
> int32:32

As Thomas noticed, not firewalld, but dbus-send in the first place should warn/error that this is not possible (according to introspection data).

Example: NM's GetDeviceByIpIface(in  s iface,out o device)

# dbus-send --system --dest=org.freedesktop.NetworkManager --print-reply /org/freedesktop/NetworkManager
org.freedesktop.NetworkManager.GetDeviceByIpIface string:"em1"
method return sender=:1.8 -> dest=:1.263 reply_serial=2
   object path "/org/freedesktop/NetworkManager/Devices/1"

if I specify int32:1 instead of string:"em1" I see:

Error org.freedesktop.DBus.Error.UnknownMethod: Method "GetDeviceByIpIface" with signature "i" on interface "org.freedesktop.NetworkManager" doesn't exist

But trying the same (i.e. using int32 instead of string) for the direct.addChain() mentioned in comment #0 obviously passes the call to firewalld without checking the introspection data first.

Comment 9 Jiri Popelka 2014-09-11 16:34:54 UTC
# dbus-send --system --dest=org.fedoraproject.FirewallD1 --print-reply /org/fedoraproject/FirewallD1 org.freedesktop.DBus.Introspectable.Introspect

correctly shows:
...
    <method name="addChain">
      <arg direction="in"  type="s" name="ipv" />
      <arg direction="in"  type="s" name="table" />
      <arg direction="in"  type="s" name="chain" />
    </method>
...

so I have no idea where can be the problem, dbus? python-slip? python-dbus?

Comment 10 Jiri Popelka 2014-09-17 16:08:10 UTC
Created attachment 938538 [details]
python-dbus example

I can see the same using pure python-dbus so python-slip seems to be ruled out.

I'm using the attached example (taken from [1]).
There's one hello() method which takes a string input argument.

# dbus-send --session --dest=org.frankhale.helloservice --print-reply /org/frankhale/helloservice org.freedesktop.DBus.Introspectable.Introspect
...
    <method name="hello">
      <arg direction="in"  type="s" name="a" />
      <arg direction="out" type="s" />
    </method>

But trying to call it with int32 argument shows that the signature is not checked beforehand:
# dbus-send --session --dest=org.frankhale.helloservice --print-reply /org/frankhale/helloservice org.frankhale.helloservice.hello int32:1
...
  File "myservice.py", line 17, in hello
    return "Hello,World: " + a
TypeError: cannot concatenate 'str' and 'dbus.Int32' objects


[1] http://excid3.com/blog/an-actually-decent-python-dbus-tutorial/

Comment 11 Jiri Popelka 2014-09-18 10:44:47 UTC
I don't know how to debug it further so let's pass this to dbus-python.

My question is:
Is it expected that calling a method (from previous comment) with different signature does not throw something like:

Error org.freedesktop.DBus.Error.UnknownMethod: Method "hello" with signature "i" on interface "org.frankhale.helloservice" doesn't exist

Comment 12 Jakub Jelen 2014-11-16 12:02:16 UTC
Hello guys.
This bugzilla is 2 months inactive and we don't have any answer from you, D-Bus people. What do you think about this issue? I'm really interested in results, because I need to continue in my testing and it is pretty hard when dbus does such things.

Comment 13 Fedora Admin XMLRPC Client 2015-06-17 22:01:52 UTC
This package has changed ownership in the Fedora Package Database.  Reassigning to the new owner of this component.

Comment 14 Fedora End Of Life 2015-11-04 11:25:00 UTC
This message is a reminder that Fedora 21 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 21. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '21'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 21 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 15 Fedora Update System 2015-11-16 09:42:05 UTC
dbus-python-1.2.0-12.fc23 has been submitted as an update to Fedora 23. https://bodhi.fedoraproject.org/updates/FEDORA-2015-b5c42d1d47

Comment 16 Fedora Update System 2015-11-16 18:23:19 UTC
dbus-python-1.2.0-12.fc23 has been pushed to the Fedora 23 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
$ su -c 'dnf --enablerepo=updates-testing update dbus-python'
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2015-b5c42d1d47

Comment 17 Fedora Update System 2015-11-19 09:53:43 UTC
dbus-python-1.2.0-12.fc23 has been pushed to the Fedora 23 stable repository. If problems still persist, please make note of it in this bug report.