summaryrefslogtreecommitdiff
path: root/libnm-glib
Commit message (Collapse)AuthorAgeFilesLines
* libnm-glib/libnm/vpn: fix handling of ConnectInteractive() failure (rh #1298732)Dan Williams2016-03-021-7/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the plugin supports interactive mode, but the VPN binary (like vpnc or openvpn) doesn't support it, then the plugin should return NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED from its connect_interactive() hook. This lets NetworkManager know to fall back to plain Connect(). Since this notification is done through an error return, the VPN service plugin code sees the failure and moves the plugin state back to STOPPED. NetworkManager sees that state change, and terminates the connection attempt while waiting for a reply to the Connect() method. (VPN service plugins that don't support interactive mode at all don't have this problem because that error is returned before the plugin's state is moved to STARTING.) To fix this, do two things: 1) if the connect_interactive() hook fails and returns the error NM_VPN_PLUGIN_ERROR_INTERACTIVE_NOT_SUPPORTED, postpone the STOPPED state change for a few seconds to allow NM time to fall back to plain Connect(). We still want to move the plugin state back to STOPPED eventually, because otherwise it could stay in STARTING forever. 2) change state to STARTING only if the connect/connect_interactive plugin hooks were successful. Otherwise the plugin would still be in STARTING state, and it's not valid to call Connect()/ConnectInteractive() during the STARTING state. https://mail.gnome.org/archives/networkmanager-list/2016-February/msg00091.html https://bugzilla.redhat.com/show_bug.cgi?id=1298732 (cherry picked from commit abc700c5c71f474730f703c648b0b8dab455d7ba)
* libnm-glib: fix another memory leak around update_permissions()Thomas Haller2016-01-261-13/+6
| | | | | | | | This time in init_async_got_permissions(). Thereby, just use gs_unref_hash and gs_free_error for cleanup. (cherry picked from commit 8029f59e4fcefe9786fb79d04ede5ea10e3c33c2)
* libnm-glib: fix crash due to uninitalized pointer in get_permissions_reply()Thomas Haller2016-01-261-1/+1
| | | | | | | | | If the D-Bus call failed with error, @permissions would stay uninitialized. Fixes: f2399a69760e8d14b91e523127eb187d6337530f Fixes: 808f0126035a09c946c559c9b1c464c4523a8a0e (cherry picked from commit e0601d501a09d2ea24c7d9d966056cb8042a49b3)
* libnm-glib: fix leak in get_permissions_reply()Dan Williams2016-01-261-0/+2
| | | | (cherry picked from commit f2399a69760e8d14b91e523127eb187d6337530f)
* libnm-glib,vpn-plugin: remove old connect timer when adding new oneLubomir Rintel2015-10-231-0/+1
| | | | | | | | If the plugin didn't succeed connecting once, don't let the old timer fire during a subsequent connection. https://bugzilla.redhat.com/show_bug.cgi?id=1271973 (cherry picked from commit 842889bc5b588d191aa2c2cbcb73452ac8971cf5)
* nm-vpn-service-plugin: increase the quit timerLubomir Rintel2015-10-011-1/+1
| | | | | | | | | | | | | | | | We now (since 3272ff6 libnm/libnm-glib: don't quit in the middle of asking for secrets) always hook on the quit timer when NM asks the plugin if it needs secrets. The timer is 20 seconds, which seems too short. Let's make it three minutes. Don't bother adding another timer or using a distinct timeout: it does no harm for the plugin to remain unused for three minutes on a bus. Another option would be to completely unhook it; however the plugin wouldn't learn if the user cancelled the NM's secrets request and would remain unused on the bus forever. (cherry picked from commit b1512221bc29f24b86d464dc5117439c366fd299)
* build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2015-09-302-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "nm-version-macros.h" For libnm library, "nm-dbus-interface.h" contains defines like the D-Bus paths of NetworkManager. It is desirable to have this header usable without having a dependency on "glib.h", for example for a QT application. For that, commit c0852964a890cf43cc2dcaeff41ac6edc5028f24 removed that dependancy. For libnm-glib library, the analog to "nm-dbus-interface.h" is "NetworkManager.h", and the same applies there. Commit 159e827a72f420048e12d318f8ba1edd3f641fc8 removed that include. However, that broke build on PackageKit [1] which expected to get the version macros by including "NetworkManager.h". So at least for libnm-glib, we need to preserve old behavior so that a user including "NetworkManager.h" gets the version macros, but not "glib.h". Extract the version macros to a new header file "nm-version-macros.h". This header doesn't include "glib.h" and can be included from "NetworkManager.h". This gives as previous behavior and a glib-free include. For libnm we still don't include "nm-version-macros.h" to "nm-dbus-interface.h". Very few users will actually need the version macros, but not using libnm. Users that use libnm, should just include (libnm's) "NetworkManager.h" to get all headers. As a special case, a user who doesn't want to use glib/libnm, but still needs both "nm-dbus-interface.h" and "nm-version-macros.h", can include them both separately. [1] https://github.com/hughsie/PackageKit/issues/85 Fixes: 4545a7fe9670ce4d7c259c11c2cc853bfae6729b (cherry picked from commit 7bf10a75db84655e65fe6216d248f7775c58ca23)
* tests: raise the mock service startup timeoutLubomir Rintel2015-08-171-1/+1
| | | | | | | Python is just too slow on some machines. Needed around twice the previous limit on BCM2835 with Pidora 20, let's add some safety margin too. (cherry picked from commit 81cc4d27b117d3d41947d1c974cc03ec521cb83b)
* libnm-glib: add NM_AVAILABLE_IN_1_0_6 for new API ↵Thomas Haller2015-08-091-0/+1
| | | | | | nm_access_point_get_last_seen() Fixes: cdb8a44a6e669d11e1d7f68cbdb2e576ef3e6eb4
* wifi: expose the last_seen property for a NMAccessPointMathieu Trudel-Lapierre2015-08-073-0/+47
| | | | https://mail.gnome.org/archives/networkmanager-list/2015-April/msg00053.html
* libnm/libnm-glib: don't quit in the middle of asking for secrets (bgo #752237)Dan Williams2015-07-161-3/+17
| | | | | | | | | | | | | If the VPN plugin terminated and the user started it again, then the quit timer will still be running and it sometimes happens that the VPN plugin will quit while the UI is asking the user for secrets. That's not very nice, so don't do that. Reproducer: while connect to the VPN, suspend your laptop. Then resume it, and immediately re-start the VPN connection. Watch the secrets dialog disappear within a very short time. https://bugzilla.gnome.org/show_bug.cgi?id=752237
* libnm/libnm-glib: clean up VPN plugin timeoutsDan Williams2015-07-161-56/+25
| | | | Use nm_clear_g_source().
* 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)
* builds: only enable TAP driver for glib >= 2.37.6Lubomir Rintel2015-06-191-2/+0
| | | | | | | No TAP support for previous versions and --tap argument is silently ignored, confusing the TAP driver. (cherry picked from commit c47c06470a0de70f5495d8919fd7f6b5369a5070)
* tests: use the TAP formatterLubomir Rintel2015-06-191-0/+2
| | | | | | The test results in standard format are easily integrated into CI systems. (cherry picked from commit 6463ce5dd9ffc1aae3ca9ddc4dac4e25fd815237)
* build: switch to parallel test harnessLubomir Rintel2015-06-191-1/+1
| | | | | | This will make it possible to use the TAP formatter. (cherry picked from commit 380ed633180a1e20cb70b2cfde482a1cda8278e0)
* tests: always spawn private d-busLubomir Rintel2015-06-191-5/+3
| | | | | | Parallel test runs would not be possible without this. (cherry picked from commit d0e25ac8be339e4ddcae93978281493d6dee551c)
* 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: do not access NULL GError variable (rh #1224819)Jiří Klimeš2015-05-261-4/+6
| | | | | | | | | dbus_g_proxy_call() should set GError if returning FALSE. But apparently there is a bug in dbus-glib and the error can be NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1224819 (cherry picked from commit f46eb1fc2086fe0bb952da52c276a1b6ded868dc)
* libnm,core: don't mix up enum typesLubomir Rintel2015-04-231-1/+1
| | | | | | Touches a weak spot on clang's soul. (cherry picked from commit fd41aa451bc83d17565bfd57f68558c9aff6358f)
* libnm-glib/tests: fix calling tests without valgrindThomas Haller2015-03-131-1/+1
| | | | | Fixes: e7356ef0a6fa94b20850d6f8ca73bfac17589510 (cherry picked from commit b0b15e47183eaf7526628efdf4dfdd25391cbfad)
* libnm/tests: enable valgrind for libnm testsThomas Haller2015-03-131-3/+5
| | | | (cherry picked from commit e7356ef0a6fa94b20850d6f8ca73bfac17589510)
* libnm/tests: fix memleaks in test code for valgrindThomas Haller2015-03-131-1/+5
| | | | (cherry picked from commit 76745817c3e77b7d6c22290a7564b73224147516)
* tests: enable valgrind tests for testsThomas Haller2015-03-131-0/+1
| | | | (cherry picked from commit c50f30e79c67593532392f0f251d662e4294f5b2)
* libnm-glib/nm-client: zero the CheckConnectivityData structureRui Matos2015-01-081-1/+1
| | | | | | | | | Otherwise, if the caller doesn't provide a cancellable we'll try to access a bogus ccd->cancellable in check_connectivity_data_free() and crash. https://bugzilla.gnome.org/show_bug.cgi?id=740841 (cherry picked from commit 8c32ea916ba0c86c4c50d6d4c7b6021adfbfdf02)
* 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
* libnm-util, libnm-glib: bump sonames for 1.0Dan Winship2014-12-181-1/+1
| | | | libnm-util.so.2.7.0, libnm-glib.so.4.9.0
* docs: misc small fixesDan Winship2014-12-184-6/+14
| | | | Cleans up all of the warnings that aren't overly annoying to clean up.
* tests: mute coverity for CHECKED_RETURN (CWE-252) in testsJiří Klimeš2014-12-161-1/+3
| | | | | | | | Error: CHECKED_RETURN (CWE-252): [#def12] NetworkManager-0.9.11.0/libnm-core/tests/test-general.c:348: check_return: Calling "nm_setting_verify" without checking return value (as is done elsewhere 37 out of 45 times). ... (cherry picked from commit 6603e7ffde2b6a90206ea2e321cdff33d5b1c680)
* libnm: add missing (transfer) annotation for nm_device_vlan_get_parent()Jiří Klimeš2014-11-251-1/+1
|
* libnm-glib: add :parent property for VLAN devicesJiří Klimeš2014-11-243-1/+43
|
* libnm*: fix library gettext usageDan Winship2014-11-132-2/+2
| | | | | | | | | | | | | | | | | Libraries need to include <gi18n-lib.h>, not <gi18n.h>, so that _() will get defined to "dgettext (GETTEXT_DOMAIN, string)" rather than "gettext (string)" (which will use the program's default domain, which works fine for programs in the NetworkManager tree, but not for external users). Likewise, we need to call bindtextdomain() so that gettext can find the translations if the library is installed in a different prefix from the program using it (and bind_textdomain_codeset(), so it will know the translations are in UTF-8 even if the locale isn't). (The fact that no one noticed this was broken before is because the libraries didn't really start returning useful translated strings much until 0.9.10, and none of the out-of-tree clients have been updated to actually show those strings to users yet.)
* all: consistently include config.hDan Winship2014-11-1338-16/+75
| | | | | | | | | | | 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.)
* tests: Don't run session-long dbus daemons for testsLubomir Rintel2014-10-241-3/+5
| | | | | | They require a tty or X11 displays, thus are not suitable for headless runs (such as in mock). Furthermore, they die with the tty or X11 session, which is somehow late -- a lot of them may accumulate. Let's kill them right away.
* 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, libnm-glib: clarify nm_client_activate_connection() semanticsDan Winship2014-10-051-0/+10
| | | | | | | | | nm_client_activate_connection() and nm_client_add_and_activate_connection() return when the activation has *started*, not when it *finishes*. Clarify this a bit more in the libnm docs, and copy that clarification to libnm-glib as well. https://bugzilla.gnome.org/show_bug.cgi?id=736233
* libnm: ensure auto-registration only when not yet registeredThomas Haller2014-08-271-1/+2
| | | | | | | | | | Calling nm_secret_agent_register() on an already registered instance leads to a warning. Ensure to call register during auto-registration only when needed. https://bugzilla.gnome.org/show_bug.cgi?id=727923 Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm, libnm-glib: fix cut-and-paste-osDan Winship2014-08-184-16/+16
| | | | | | Several nm-device-*.c files apparently originally used nm-device-ethernet.c as a template, but missed a reference to "eth" in class_init.
* libnm, libnm-glib: belatedly replace _nm_client_is_object_path()Dan Winship2014-08-071-46/+2
| | | | | | | _nm_client_is_object_path() had been copied from g_variant_is_object_path() with a note that it should be replaced when we depended on GLib > 2.24, but it got missed when we actually updated the dependency. Fix it now. (Also fix a nearby typo.)
* libnm-glib: add tests of NMClient:manager-running and ↵Dan Winship2014-08-012-0/+154
| | | | | | | NMRemoteSettings:service-running Test that the code to track whether NetworkManager is running works correctly.
* libnm-glib: fix a crash when using multiple NMClientsDan Winship2014-08-014-17/+19
| | | | | | | | | | | | | | NMObjectCache was assuming there would never be more than one object with the same path, but since NMClient is an NMObject, it was getting cached too, so if you created two clients and then unreffed one of them, it's possible the wrong one could get left in the cache, causing a crash the next time the other one called nm_object_cache_clear(). Fix this by only adding NMObjects to the cache in the codepaths where we also check to see if the object was already in the cache. (This also means we can remove the "except" argument to nm_object_cache_clear(), since the NMClient won't be cached any more.)
* libnm-glib: make test-networkmanager-service.py automatically exit with its ↵Dan Winship2014-08-014-158/+118
| | | | | | | | | | | | | | | | | | | parent test-nm-client.c and test-remote-settings-client.c were using their own assertion macros so they could kill the test service on assertion failure. Except that some new code didn't get the memo and used the g_assert* macros. Not to mention that sometimes the tests would crash outside of an assertion macro. We can make test-networkmanager-service.py notice that its parent has crashed by opening a pipe between them and taking advantage of the fact that the pipe will be automatically closed if the parent crashes. So then test-networkmanager-service.py just has to watch for that, and exit if the pipe closes. Then that lets us drop the test_assert* macros and just use g_assert* instead.
* libnm-glib: split out test service launching code from testsDan Winship2014-08-015-179/+224
|
* libnm-glib: use automake test infrastructure for test programsDan Winship2014-08-012-9/+13
| | | | | | | | Use "TESTS = tests-nm-client test-remote-settings-client" rather than overriding "check-local". Add a script "libnm-test-launch.sh" that will handle redirecting the test via dbus-launch if needed.
* libnm-glib: compile test-networkmanager-service.py path into test binariesDan Winship2014-08-013-23/+10
| | | | | | | | Rather than passing the path to the test service on the command line, compile it into the test programs. (Among other things, this makes it easier to run the test directly from the command line.)
* libnm-glib: fix warning about redefining typedef RemoteCallThomas Haller2014-08-011-2/+2
| | | | | | | | | | | | | | | clang warns: make[4]: Entering directory `./NetworkManager/libnm-glib' CC libnm_glib_la-nm-remote-connection.lo nm-remote-connection.c:77:3: error: redefinition of typedef 'RemoteCall' is a C11 feature [-Werror,-Wtypedef-redefinition] } RemoteCall; ^ nm-remote-connection.c:67:27: note: previous definition is here typedef struct RemoteCall RemoteCall; ^ Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib/test: add asserts to test-remote-settings-clientThomas Haller2014-08-011-1/+11
| | | | | | | | | - register a weak references and ensure that the connection is removed when expected. - disconnect the vis_new_connection_cb() handler Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib/test: fix crash in test-remote-settings-clientThomas Haller2014-08-011-0/+2
| | | | | | | | | test_make_invisible() forgot to disconnect handler invis_removed_cb(). Later, during test_remove_connection(), the connection will be eventually removed and the callback will corrupt the stack by writing to the '&done' user data. Signed-off-by: Thomas Haller <thaller@redhat.com>
* libnm-glib: disconnect the connectivity check cancellable signal after the ↵Giovanni Campagna2014-07-311-0/+5
| | | | | | | | | | | | call has ended (bgo #733915) We cannot rely on connectivity data freeing to disconnect the signal, because the simple async result might be kept alive by external code (for example the language runtime for JS), but we must not call dbus_g_proxy_cancel_call() if that cancellable is cancelled or reused afterwards. https://bugzilla.gnome.org/show_bug.cgi?id=733915
* tools: move libnm-glib's fake NM service implementations hereDan Winship2014-07-303-934/+5
| | | | | | | | | | Move libnm-glib's test-fake-nm.py and test-remote-settings-service.py to tools/, merge them together into a single program, and fix a few bugs (notably some missing signal emissions in the Settings service). Although they are currently only used by libnm-glib's tests, they are generic enough that they could be used by other code in the future (and in particular, they will be used by libnm's tests as well).