summaryrefslogtreecommitdiff
path: root/libnm-glib/nm-remote-settings.c
Commit message (Collapse)AuthorAgeFilesLines
* libnm-glib: avoid coverity warningThomas Haller2015-06-251-1/+1
| | | | | | | | | | | | 5. NetworkManager-1.0.3/libnm-glib/nm-remote-settings.c:493: var_compare_op: Comparing "error" to null implies that "error" might be null. 8. NetworkManager-1.0.3/libnm-glib/nm-remote-settings.c:508: var_deref_op: Dereferencing null pointer "error". # 506| g_hash_table_remove (priv->pending, path); # 507| # 508|-> if (print_once && error->code == DBUS_GERROR_LIMITS_EXCEEDED) { # 509| g_printerr ("Warning: libnm-glib:%s(): a D-Bus limit exceeded: %s. The application might not work properly.\n" # 510| "Consider increasing max_replies_per_connection limit in /etc/dbus-1/system.d/org.freedesktop.NetworkManager.conf " (cherry picked from commit c157e3233d638dcd355ba1006031de6b98f3b679)
* libnm-glib: print a bold warning about reaching a D-Bus limitJiří Klimeš2015-05-291-0/+9
| | | | | This causes incorrect application behaviour, so libnm-glib should warn at least.
* libnm-glib: crash when NMRemoteSettings is quickly destroyed (bgo #742138)Dan Winship2015-01-051-1/+3
| | | | | | | | NMRemoteSettings queues a bunch of async NMRemoteConnection creations, but wasn't doing anything to ensure that it was still alive when they completed. Pointed out by Cosimo Cecchi. https://bugzilla.gnome.org/show_bug.cgi?id=742138
* all: consistently include config.hDan Winship2014-11-131-0/+2
| | | | | | | | | | | config.h should be included from every .c file, and it should be included before any other include. Fix that. (As a side effect of how I did this, this also changes us to consistently use "config.h" rather than <config.h>. To the extent that it matters [which is not much], quotes are more correct anyway, since we're talking about a file in our own build tree, not a system include.)
* remote-settings: Mark service as running when using private busFlorian Müllner2014-10-171-2/+3
| | | | | | | | When using a private bus connection, the service is never marked as running when settings are initialized asynchronously. Successfully opening a socket in NM's runtime directory should already imply a running service, so just mark it as such (as we already do in the synchronous path).
* libnm-glib: document some propertiesDan Winship2014-07-251-0/+23
| | | | | | | | Some libnm-glib object properties were only documented in the GParamSpec strings, not via gtk-doc comments, so they became undocumented when the paramspec strings went away. Fix that. (Also fix incorrect gtk-doc syntax with several NMClient properties.)
* libnm-util, libnm-glib: whitespace fixesDan Winship2014-07-151-24/+25
| | | | Fix indentation, kill trailing whitespace, split some long lines.
* libnm-util, libnm-glib: standardize copyright/license headersDan Winship2014-07-151-4/+2
| | | | | | | | | | | | | | | | | | - Remove list of authors from files that had them; these serve no purpose except to quickly get out of date (and were only used in libnm-util and not libnm-glib anyway). - Just say "Copyright", not "(C) Copyright" or "Copyright (C)" - Put copyright statement after the license, not before - Remove "NetworkManager - Network link manager" from the few files that contained it, and "libnm_glib -- Access network status & information from glib applications" from the many files that contained it. - Remove vim modeline from nm-device-olpc-mesh.[ch], add emacs modeline to files that were missing it.
* libnm-util, libnm-glib: tweak (element-type) annotations in docsDan Winship2014-07-151-1/+1
| | | | | | | g-i allows you to specify types in annotations using either their fully-qualified introspected names (eg, "NMClient.Device") or their plain C names ("NMDevice"). Switch from the former to the latter (so that they'll still be correct when migrated to libnm later).
* all: remove remaining GParamSpec name/blurb stringsDan Winship2014-06-191-16/+12
| | | | | | Remove all remaining GParamSpec name and blurb strings (and fix indentation while we're there), and add G_PARAM_STATIC_STRINGS to all paramspecs that were lacking it.
* libnm-glib: add documentation for NMRemoteSettings and connection additionDan Williams2014-04-101-1/+95
|
* docs: use %TRUE, %FALSE macros instead of plain TRUE, FALSE values for gtkdocJiří Klimeš2014-02-241-2/+2
|
* libnm-glib: add function nm_remote_settings_get_connection_by_id()Thomas Haller2014-01-271-0/+39
| | | | | | | Utility function, to search the list of connections for a connection with a matching id/name. Returns the first match. Signed-off-by: Thomas Haller <thaller@redhat.com>
* trivial: annotate/adjust some code to appease CoverityDan Winship2014-01-161-7/+8
|
* libnm-glib: fix return value in nm_remote_settings_load_connections()Jiří Klimeš2013-11-181-2/+2
| | | | when g_return_val_if_fail() fails.
* libnm-glib: add nm_remote_settings_load_connections()Dan Winship2013-11-151-0/+66
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=709830
* Fix typosYuri Chornoivan2013-10-191-1/+1
| | | | https://bugzilla.gnome.org/show_bug.cgi?id=710505
* core: add monitor-connection-files=false and ReloadConnectionsDan Winship2013-06-141-0/+41
| | | | | | | | | Add a "monitor-connection-files" config option, which can be set to "false" to disable automatic reloading of connections on file change. To go with this, add a new ReloadConnections method on o.fd.NM.Settings that can be used to manually reload connections, and add an nm-cli command to call it.
* libnm-glib: add support for new connection unsaved functionalityDan Williams2013-05-281-4/+62
|
* libnm-glib, core: use g_cclosure_marshal_genericDan Winship2013-05-081-7/+4
| | | | | Since we depend on new glib now, we can just use the generic marshaller rather than generating our own.
* Use %NULL macro in doc stringsMartin Pitt2013-04-191-3/+3
| | | | | | Mass-converted "NULL" to "%NULL" in docstrings with find -name '*.c'| xargs sed -i '/^ \*.*[^%]NULL/ s/NULL\b/%NULL/g'
* libnm-glib: never call NM D-Bus methods if NM isn't runningDan Williams2013-04-081-59/+42
| | | | | | | | | | | | | | | | | | Though the client shouldn't be calling anything when NM isn't running (because clients have nm_client_get_manager_running()), make sure that NMClient never calls a NetworkManager method when NM isn't on the bus. Next, ensure NMObject doesn't try to refresh properties when NM isn't running. Creating an NMClient may trigger a property refresh request, but if NM isn't running, defer that until NM starts, to ensure that we don't D-Bus autostart NM. Third, ensure NMRemoteSettings doesn't attempt to list connections unless NM is running. This prevents service activation of NetworkManager in lieu of dbus-glib learning about DBUS_HEADER_FLAG_NO_AUTO_START.
* libnm-glib: use private connection before trying the system busDan Williams2013-04-081-46/+65
| | | | | | | | | Use the D-Bus connection helper whenever we need a connection to NM, which by default tries to use a private connection instead of the shared bus connection whenever the user is root. Doing this by default will not change the behavior of libnm-glib, and allows tools like nmcli and libnm-glib-using clients to work in minimal environments (those without a bus daemon) by default.
* libnm-glib: use helpers to create dbus proxiesDan Williams2013-04-081-8/+8
| | | | | | | | | | When using a private connection, we need to use dbus_g_proxy_new_for_peer() because the bus isn't involved. Since many parts of libnm-glib create a proxy for their corresponding remote object, consolidate the proxy creation logic. A later patch will add logic to use a private connection versus a bus-based one.
* all: remove redundant return-if-fail checksDan Winship2013-03-071-6/+0
| | | | | NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate (x != NULL) check before it.
* NMRemoteSettings: fix async initializationGiovanni Campagna2012-10-161-4/+15
| | | | | | | | If async GetProperties completed before the GetConnections, init_left would be 0 and thus we never connected to connections-read, causing us to terminate initialization before connections were actually read. https://bugzilla.gnome.org/show_bug.cgi?id=686226
* libnm-glib: don't try to query for connections synchronously when NM isn't ↵Dan Williams2012-10-051-25/+57
| | | | | | | running (bgo #685345) And ensure we clear out properties when NM quits, and that we request them when NM starts up again.
* libnm-glib: fix GAsyncInitable implementationsDan Winship2012-07-171-0/+12
| | | | | | If a class implements init_async, it should implement init_finish too, rather than assuming the default implementation will do the right thing (which it briefly didn't in glib 2.33).
* libnm-glib: NULL out priv fields on dispose()Dan Winship2012-04-231-14/+18
| | | | | | | | In some situations, objects might get used after being disposed, so clear out their various priv fields so we don't try to access unreffed objects, freed strings, etc. https://bugzilla.gnome.org/show_bug.cgi?id=674473
* libnm-glib: ensure NMRemoteConnection signals are disconnected (bgo #674484) ↵Dan Williams2012-04-231-33/+69
| | | | | | | | | | | (lp:949743) If a client keeps the connection around after NMRemoteSettings is done with it (and has emitted 'removed' for that connection) then the RemoteSettings object was still registered to receive signals for that connection. To prevent clients from being able to screw up the RemoteSettings, disconnect any signals it may be listening for when the connection is removed. (it should be doing that anyway)
* libnm-glib: initialize GError, else invalid free() crash can occur (rh #809123)Jiří Klimeš2012-04-021-1/+1
|
* Revert "libnm-glib: initialize NMRemoteSettings in nm_remote_settings_new() ↵Jiří Klimeš2012-04-021-6/+1
| | | | | | | | | | | | (rh #806664)" This reverts commit dd0460697c4e281fe277b53916d5251332e1aafc. The commit dd0460697c4e281fe277b53916d5251332e1aafc make nm_remote_settings_new() create the NMRemoteSettings object synchronously. It fixed getting properties, but undid the previous ability to initialize the object asynchronously. It can be reverted now, because a4f450aa0bf087453a8d605db81a83368cbe3b0a commit ensure initialization in get_property() calls.
* libnm-glib: more ensure_inited() fixingDan Winship2012-03-281-0/+2
| | | | | | | | | We need to do _nm_object_ensure_inited() / _nm_remote_settings_ensure_inited() from the get_property() implementations; in most cases, get_property() just calls another accessor method (which will call _nm_object_ensure_inited()), but in a few places, it reads priv->whatever directly, so we need to make sure that it's valid.
* libnm-glib: initialize NMRemoteSettings in nm_remote_settings_new() (rh #806664)Jiří Klimeš2012-03-271-1/+6
| | | | | The object was not initialized after creation in nm_remote_settings_new(). This was a regression caused by 762df85234e7a042a2a5d31053e6cc273ae3e2ec.
* libnm-glib: ensure bindings-created objects work as expected (rh #802536)Dan Williams2012-03-211-28/+56
| | | | | | | | | | | | | | | | | | | | | | | | Bindings (like GObject Introspection) almost always create objects using g_object_new() by default and don't use our helper functions like nm_client_new(). Thus we need to make sure that if the object is created in that way, any property accesses or functions that return properties ensure that the object is fully initialized, which is what the _new() functions were supposed to do. In one case in NMClient that was missing (getting active connections) and wasn't happening at all in NMRemoteSettings, which are our two entry points into libnm-glib. This allows this python+GI sequence to return the expected active connection list: from gi.repository import NMClient nmclient = NMClient.Client(dbus_path='/org/freedesktop/NetworkManager') active = nmclient.get_active_connections() print(active) where previously it returned an empty list because the NMClient wasn't fully initialized by the time nm_client_get_active_connections() was called.
* Use glib-mkenums to generate enum typesDan Winship2012-02-151-22/+2
| | | | | | | | | | | | | | | | | | | Rather than generating enum classes by hand (and complaining in each file that "this should really be standard"), use glib-mkenums. Unfortunately, we need a very new version of glib-mkenums in order to deal with NM's naming conventions and to fix a few other bugs, so just import that into the source tree temporarily. Also, to simplify the use of glib-mkenums, import Makefile.glib from https://bugzilla.gnome.org/654395. To avoid having to run glib-mkenums for every subdirectory of src/, add a new "generated" directory, and put the generated enums files there. Finally, use Makefile.glib for marshallers too, and generate separate ones for libnm-glib and NetworkManager.
* libnm-glib: fix to not depend on newer glibDan Winship2012-02-061-0/+1
|
* libnm-glib: asyncify NMRemoteSettingsDan Winship2012-02-031-83/+244
| | | | Add nm_remote_settings_new_async/_finish, and misc other fixes
* libnm-glib: implement GInitable/GAsyncInitable in NMObjectDan Winship2012-02-031-11/+3
| | | | | | | | | | | | | | | | | | | | | | Implement GInitable and GAsyncInitable in NMObject, with implementations that synchronously or asynchonously load all properties, and change _nm_object_ensure_inited() to run g_initable_init(). Update the object/object-array property handling to initialize the objects after creating them (synchronously or asynchronously, according to the situation), so that they will have all of their properties preloaded before they are ever visible to the caller. Move the non-blocking/non-failable parts of various objects' constructor() methods to constructed(), and move the blocking/failable parts to init(), and implement init_async() methods with non-blocking versions of the blocking methods. Make nm_device_new() and nm_client_new() call _nm_object_ensure_inited(), to preserve the behaviour formerly enforced by their construct() methods, that properties are guaranteed to be initialized before any signals involving them are emitted.
* libnm-glib: don't use client-side generated dbus-glib bindingsDan Winship2012-02-021-7/+9
| | | | | | | Most of the code was using dbus_g_proxy_call() directly, but there were some leftover uses of the generated bindings. Make things more consistent by using dbus_g_proxy_call() everywhere, and stop building the -bindings.h files.
* libnm-glib: fix allow-none introspection annotations (rh #747302)Dan Williams2011-10-261-1/+1
|
* libnm-glib: fix introspection annotations for callbacks and user_data (rh ↵Dan Williams2011-10-261-4/+6
| | | | | | | #747302) user_data arguments should be annotated with (closure) and callbacks should be marked (allow none) where it's safe to pass NULL.
* libnm-glib: allow NMRemoteSettings constructor with NULL busDaniel Drake2011-08-161-4/+5
| | | | | | | | | | | | | | | | NMRemoteSettings's constructor requires a DBusGConnection, but there currently aren't any usable gobject-introspection bindings for that class. This means that NMRemoteSettings can't be used over gobject-introspection. Move the default fallback to the system bus into the constructor path, so that introspection bindings are usable. Python test case: from gi.repository import NMClient NMClient.RemoteSettings() Before, this produced a segfault. Now it returns a usable RemoteSettings object.
* settings: add a GetConnectionByUuid methodDan Williams2011-04-221-0/+29
| | | | | | | If the client knows the UUID, add a convenience function to get the connection path directly, instead of having to iterate the whole connection list and get each connection's details and then check the UUID.
* libnm-glib: documentation update for nm_remote_settings_list_connections()Dan Williams2011-03-101-2/+6
|
* libnm-glib: fix reply processing of AddConnection callsDan Williams2011-03-101-1/+1
| | | | It really is an object path, folks.
* libnm-glib: fix bogus freeDan Williams2011-03-101-13/+14
| | | | | | Apparently dbus-glib will pass non-NULL parameters to proxy callbacks in the error case, so we've got to make sure we don't touch any return parameters if there's been an error.
* libnm-glib: handle initially invisible connections correctlyDan Williams2011-02-121-2/+11
| | | | | | Don't delete them if we don't have permission for them, since we may get permission for them later via Update. But to listen for Update we need the connection around.
* libnm-glib: fix connection visibility handlingDan Williams2011-02-121-1/+47
| | | | | | | | | | | When the connection becomes invisible to a user (ie, the permissions of the connection no longer allow that user to view the connection) then we have to hid the connection from clients. But we can't just dispose of it, because visibility changes are signaled with Update signals on the connection itself, and thus we need to keep the connection around just in case it becomes visible to the user again. But if it's invisible, make sure we clear out the settings since they may have changed.
* libnm-glib: use define instead of string for Removed signalDan Williams2011-02-111-2/+2
| | | | Less error-prone and makes a mistype a compile error.