Re: Problem to add a broadband connection on NetworkManagerUserSettings

2010-01-21 Thread Maxwell Chiareli Xandeco

Hi guys,

I tried with SystemSettings before use UserSettings and really works,
but when you create a connection with SystemSettings, it's marked as
Available for all users, and when you use this kind of connection, you
just can use once, the second time crashes the system, there is a lot of
issues opened on launchpad about it, because of that I need to use
UserSettings.

Happens for broadband and DSL connections, may be to wireless too, it's
not just about connections created with my own code, I tried with
nm-applet, if you check available for all uses, don't works.

If someone knows some workaround to get SystemSettings working, I can
use it.

Thanks guys for your help, and sorry again about the Legal message,
it's not my faul, but I'll start use other email.

Maxwell

On Tue, 2010-01-19 at 16:45 +0100, Jirka Klimes wrote:

 On Wednesday 13 January 2010 16:33:27 Maxwell Chiareli Xandeco wrote:
  I'm using Ubuntu 9.10, with your code I don't get errors but a
  connection is not added, nothing happens when I call AddConnection
  method.
 

 I've investigated it a bit and found out that AddConnection is not supported
 via D-Bus due to security reasons.
 (src/gconf-helpers/nma-gconf-settings.c:add_connection() function)

 If you use SystemSettings service instead of UserSettings, the connection
 adding will work (just keyfile plugin).

 Jirka



 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: Problem to add a broadband connection on NetworkManagerUserSettings

2010-01-13 Thread Maxwell Chiareli Xandeco

I'm using Ubuntu 9.10, with your code I don't get errors but a
connection is not added, nothing happens when I call AddConnection
method.

Follow my policy file:

!DOCTYPE busconfig PUBLIC
-//freedesktop//DTD D-BUS Bus Configuration 1.0//EN
http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd;
busconfig
!--
 WARNING: if running any D-Bus version prior to 1.2.6, you may be
 vulnerable to information leakage via the NM D-Bus interface.
 Previous D-Bus versions did not deny-by-default, and this
permissions
 config file assumes that D-Bus will deny rules by default unless
 explicitly over-ridden with an allow / tag.
--

policy user=root
allow
own=org.freedesktop.NetworkManagerUserSettings/

allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.NetworkManagerSettings/

allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.NetworkManagerSettings.Connection/

!-- Only root can get secrets --
allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.NetworkManagerSettings.Connection.Secrets/
/policy
policy at_console=true
allow
own=org.freedesktop.NetworkManagerUserSettings/

allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.NetworkManagerSettings/

allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.NetworkManagerSettings.Connection/
/policy
policy context=default
allow
send_destination=org.freedesktop.NetworkManagerUserSettings

send_interface=org.freedesktop.DBus.Introspectable/
/policy

limit name=max_replies_per_connection512/limit
/busconfig

On Wed, 2010-01-13 at 14:07 +0100, Jirka Klimes wrote:

 On Tuesday 12 January 2010 16:36:07 Maxwell Chiareli Xandeco wrote:
  Hi all,
 
  I trying to add a new broadband connection using dbus python API:
 
  settings = dbus.Dictionary({dbus.String(u'connection'):
  dbus.Dictionary({dbus.String(u'timestamp'): dbus.UInt64(1263301788L,
  variant_level=1), dbus.String(u'autoconnect'): dbus.Boolean(False,
  variant_level=1), dbus.String(u'type'): dbus.String(u'gsm',
  variant_level=1), dbus.String(u'uuid'):
  dbus.String(u'8a0e02d9-9b1a-463b-a089-7a68140bf4c3', variant_level=1),
  dbus.String(u'id'): dbus.String(u'Vivo Default', variant_level=1)},
  signature=dbus.Signature('sv')), dbus.String(u'ppp'):
  dbus.Dictionary({}, signature=dbus.Signature('sv')),
  dbus.String(u'gsm'): dbus.Dictionary({dbus.String(u'username'):
  dbus.String(u'vivo', variant_level=1), dbus.String(u'band'):
  dbus.Int32(0, variant_level=1), dbus.String(u'apn'):
  dbus.String(u'zap.vivo.com.br', variant_level=1),
  dbus.String(u'number'): dbus.String(u'*99#', variant_level=1)},
  signature=dbus.Signature('sv')), dbus.String(u'serial'):
  dbus.Dictionary({dbus.String(u'baud'): dbus.UInt32(115200L,
  variant_level=1)}, signature=dbus.Signature('sv'))},
  signature=dbus.Signature('sa{sv}'))
 
  sys_bus = dbus.SystemBus()
  proxy = sys_bus.get_object(org.freedesktop.NetworkManagerUserSettings,
  /org/freedesktop/NetworkManagerSettings)
  proxy.AddConnection(settings)
 
  When I run this code i get a access denied error:
 
  dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
  Rejected send message, 2 matched rules; type=method_call,
  sender=:1.210 (uid=0 pid=27292 comm=python) interface=(unset)
  member=AddConnection error name=(unset) requested_reply=0
  destination=:1.106 (uid=1000 pid=10148 comm=nm-applet))
 
  Does someone have any idea?
 
  Maxwell
 

 The error says that you don't have permissions.
 It's caused by not specifying interface which the method AddConnection should
 be called on.

 so do:
 sys_bus = dbus.SystemBus()
 proxy = sys_bus.get_object(org.freedesktop.NetworkManagerUserSettings,
 /org/freedesktop/NetworkManagerSettings)
 iface = dbus.Interface(proxy, org.freedesktop.NetworkManagerSettings)

 iface.AddConnection(settings)

 Btw, what distribution do you use and what policies do you have in
 /etc/dbus-1/system.d/nm-applet.conf ?

 Jirka



 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Problem to add a broadband connection on NetworkManagerUserSettings

2010-01-12 Thread Maxwell Chiareli Xandeco
Hi all,

I trying to add a new broadband connection using dbus python API:

settings = dbus.Dictionary({dbus.String(u'connection'):
dbus.Dictionary({dbus.String(u'timestamp'): dbus.UInt64(1263301788L,
variant_level=1), dbus.String(u'autoconnect'): dbus.Boolean(False,
variant_level=1), dbus.String(u'type'): dbus.String(u'gsm',
variant_level=1), dbus.String(u'uuid'):
dbus.String(u'8a0e02d9-9b1a-463b-a089-7a68140bf4c3', variant_level=1),
dbus.String(u'id'): dbus.String(u'Vivo Default', variant_level=1)},
signature=dbus.Signature('sv')), dbus.String(u'ppp'):
dbus.Dictionary({}, signature=dbus.Signature('sv')),
dbus.String(u'gsm'): dbus.Dictionary({dbus.String(u'username'):
dbus.String(u'vivo', variant_level=1), dbus.String(u'band'):
dbus.Int32(0, variant_level=1), dbus.String(u'apn'):
dbus.String(u'zap.vivo.com.br', variant_level=1),
dbus.String(u'number'): dbus.String(u'*99#', variant_level=1)},
signature=dbus.Signature('sv')), dbus.String(u'serial'):
dbus.Dictionary({dbus.String(u'baud'): dbus.UInt32(115200L,
variant_level=1)}, signature=dbus.Signature('sv'))},
signature=dbus.Signature('sa{sv}'))

sys_bus = dbus.SystemBus()
proxy = sys_bus.get_object(org.freedesktop.NetworkManagerUserSettings,
/org/freedesktop/NetworkManagerSettings)
proxy.AddConnection(settings)

When I run this code i get a access denied error:

dbus.exceptions.DBusException: org.freedesktop.DBus.Error.AccessDenied:
Rejected send message, 2 matched rules; type=method_call,
sender=:1.210 (uid=0 pid=27292 comm=python) interface=(unset)
member=AddConnection error name=(unset) requested_reply=0
destination=:1.106 (uid=1000 pid=10148 comm=nm-applet))

Does someone have any idea?

Maxwell

 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Writing a script to multiple versions of DBus API

2009-12-08 Thread Maxwell Chiareli Xandeco
Hi all,

I'm writing a simple python script to manage a broadband connection.

I'm using the Disconnect() method from Device interface to close
connection, that works fine with the 0.8 version, and on the 0.7 version
I need to use the DeactivateConnection ( o: active_connection ) method
from NetworkManager interface.

My question is, what is the best approach to verify API version and call
the correct method.

Cheers
Maxwell

 
Legal Disclaimer:
The information contained in this message may be privileged and confidential. 
It is intended to be read only by the individual or entity to whom it is 
addressed or by their designee. If the reader of this message is not the 
intended recipient, you are on notice that any distribution of this message, in 
any form, is strictly prohibited. If you have received this message in error, 
please immediately notify the sender and delete or destroy any copy of this 
message

___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list