Re: Problem to add a broadband connection on NetworkManagerUserSettings
On Thu, 2010-01-21 at 10:15 -0200, Maxwell Chiareli Xandeco wrote: > > 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 That's a bug then; I fixed one specific bug with nm-connection-editor caused by an older version of the polkit-gnome packages. We'd need more logs, pointers to logs, stacktraces, or Launchpad links to figure that out. It's probably a bug, and we need to figure out more details before we can fix it. > lot of issues opened on launchpad about it, because of that I need to > use UserSettings. That's somewhat unfortunate, because for a variety of security reasons programs themselves are not allowed to change network information via the D-Bus interface. You can however use GConf (see gconftool-2 --import) to do this if you really need to. Dan > 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 ___ 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
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
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). Right; mainly because it's user settings, allowing any program to add connections isn't necessarily secure. However, any program can write GConf so it's mostly a misnomer. In the future we do want to allow this, subject to various security considerations or at least notifications. For now, only system settings allows connection addition because it actually validates caller's via PolicyKit. Dan ___ 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
On Tue, 2010-01-19 at 16:54 +0100, Jirka Klimes wrote: > On Tuesday 19 January 2010 16:45:23 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) > > > > Actually, there is an error causing critical error (g_error_new (0, ...)) > > g_error_new (0, ... > (nm-applet:27425): GLib-CRITICAL **: g_error_new: assertion `domain != 0' > failed > (nm-applet:27425): GLib-CRITICAL **: g_error_free: assertion `error != NULL' > failed > > The attached patch fixes that. D-Bus then returns an error message on > AddConnection. > Please find also attached test program in python. Committed, thanks! Dan ___ 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
On Tuesday 19 January 2010 16:45:23 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) > Actually, there is an error causing critical error (g_error_new (0, ...)) g_error_new (0, ... (nm-applet:27425): GLib-CRITICAL **: g_error_new: assertion `domain != 0' failed (nm-applet:27425): GLib-CRITICAL **: g_error_free: assertion `error != NULL' failed The attached patch fixes that. D-Bus then returns an error message on AddConnection. Please find also attached test program in python. Jirka diff --git a/src/gconf-helpers/nma-gconf-settings.c b/src/gconf-helpers/nma-gconf-settings.c index 986d947..57300c1 100644 --- a/src/gconf-helpers/nma-gconf-settings.c +++ b/src/gconf-helpers/nma-gconf-settings.c @@ -191,7 +191,10 @@ add_connection (NMSettingsService *settings, if (context) { GError *error; - error = g_error_new (0, 0, "%s: adding connections via D-Bus is not (yet) supported", __func__); + /* Beware: error domain is actually checked in D-Bus via _dbus_validate_interface() function. + * That's why use an interface name. + */ + error = g_error_new (g_quark_from_string("org.freedesktop.NetworkManagerSettings.AddFailed"), 0, "%s: adding connections via D-Bus is not (yet) supported", __func__); callback (NM_SETTINGS_INTERFACE (settings), error, user_data); g_error_free (error); return; #!/usr/bin/python import dbus import glib import posix import os 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')), dbus.String(u'ipv4'): dbus.Dictionary({dbus.String(u'method'): dbus.String(u'auto', variant_level=1)}, signature=dbus.Signature('sv'))}, signature=dbus.Signature('sa{sv}')) uuid = "cabfaf9e-4043-4afb-8506-0e6f4a225636" s_con = { 'id': 'NovaGSM', 'uuid':uuid, 'type':'gsm', 'autoconnect': False, 'name':'connection' } s_gsm = { 'username': 'vivo', 'band': 0, 'apn': 'zap.vivo.com.br', 'number': '*99#', 'name': 'gsm' } s_ip4 = { 'method': 'auto', 'name': 'ipv4' } s_ppp = { 'name': 'ppp' } s_serial = { 'baud': 115200, 'name': 'serial' } con = { 'connection': s_con, 'gsm': s_gsm, 'ppp': s_ppp, 'serial': s_serial, 'ipv4': s_ip4 } sys_bus = dbus.SystemBus() ses_bus = dbus.SessionBus() proxy = sys_bus.get_object("org.freedesktop.NetworkManagerUserSettings", "/org/freedesktop/NetworkManagerSettings") iface = dbus.Interface(proxy, "org.freedesktop.NetworkManagerSettings") try: iface.AddConnection(con) except Exception, e: print e ___ 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
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 ___ 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
On Fri, 15 Jan 2010 13:03:14 -0200 Maxwell Chiareli Xandeco wrote: > Sorry . it's automatically added by server, it's not my fault. =( Normally those plagued by these disclaimers are encouraged to find a posting address that doesn't add them, and elect not to receive mail on that address. -- Brian Morrison ___ 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
Sorry . it's automatically added by server, it's not my fault. =( On Wed, 2010-01-13 at 12:58 -0500, Bill C Riemers wrote: > On 13/01/10 10:33 AM, Maxwell Chiareli Xandeco wrote: > > > > > 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 > > Interesting disclaimer for a message sent to a mailing list. Last I > checked the sole purpose of a mailing list is to distribute messages. > > ___ 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
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: http://www.freedesktop.org/standards/dbus/1.0/busconfig.dtd";> 512 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
Re: Problem to add a broadband connection on NetworkManagerUserSettings
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 ___ NetworkManager-list mailing list NetworkManager-list@gnome.org http://mail.gnome.org/mailman/listinfo/networkmanager-list
Problem to add a broadband connection on NetworkManagerUserSettings
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