summaryrefslogtreecommitdiff
path: root/libnm-util
Commit message (Collapse)AuthorAgeFilesLines
* build: extract version macros from "nm-version.h" to new header file ↵Thomas Haller2015-09-304-53/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | "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
* Revert "libnm-util: don't include "nm-version.h" in "NetworkManager.h""Thomas Haller2015-09-261-0/+2
| | | | | | | | This breaks build of PackageKit. Revert the patch. This reverts commit 159e827a72f420048e12d318f8ba1edd3f641fc8. https://bugzilla.gnome.org/show_bug.cgi?id=755660
* libnm-core/libnm-util: fix an erroneous error messageJiří Klimeš2015-09-251-1/+0
| | | | ipv6.dns: 'this property is not allowed for '%s=%s'' not allowed for method=ignore
* libnm: include "glib.h" in "nm-version.h"Thomas Haller2015-09-251-0/+2
| | | | | | | | | | | | This is a forward port of commit 6f616d4c4b04d5478f60d0311317bc84c5459ea4 which added this patch on nm-1-0 branch. However, the reason stated there is wrong because we don't need this to fix Qt examples. Building Qt examples was fixed in that "nm-dbus-interface.h" no longer drags in "nm-version.h". On the other hand, we still want "nm-version.h" to be self-contained, and include "glib.h" as it needs it.
* libnm-util: don't include "nm-version.h" in "NetworkManager.h"Thomas Haller2015-09-251-2/+0
| | | | We want "NetworkManager.h" to have no dependancy on libnm and glib.
* libnm-core/libnm-util: fix an assertion in adsl settingJiří Klimeš2015-09-211-2/+5
| | | | (process:7799): GLib-CRITICAL **: g_ascii_strdown: assertion 'str != NULL' failed
* libnm-util: fix flags for GObject introspection (rh #1255436)Jiří Klimeš2015-08-241-7/+7
| | | | | | | | | | | | | | | | | Without marking the enumeration as flags, the types will be "enumeration" instead of "bitfield". And python raises ValueError exception. Example: from gi.repository import NMClient, NetworkManager client = NMClient.Client.new() for dev in client.get_devices(): if dev.get_device_type() == NetworkManager.DeviceType.WIFI: for ap in dev.get_access_points(): ap.get_rsn_flags() raises "ValueError: invalid enum value: 648" https://bugzilla.redhat.com/show_bug.cgi?id=1255436
* core: final gdbus portingDan Winship2015-08-107-2/+157
| | | | | | | | | | Port remaining bits to gdbus and remove stray dbus-glib references Drop the dbus-glib version check from configure, since nothing depends on new dbus-glib any more. Move nm-dbus-glib-types.h and nm-gvaluearray-compat.h from include/ to libnm-util/ since they are now only used by libnm-util and libnm-glib.
* all: drop includes to <glib/gi18n.h> for "nm-default.h"Dan Winship2015-08-0531-34/+0
| | | | | | | The localization headers are now included via "nm-default.h". Also fixes several places, where we wrongly included <glib/gi18n-lib.h> instead of <glib/gi18n.h>. For example under "clients/" directory.
* nm-default: include i18n headers via "nm-default.h"Thomas Haller2015-08-051-0/+1
|
* all: make use of new header file "nm-default.h"Thomas Haller2015-08-0520-22/+20
|
* libnm: include header in public header file with angle bracketsThomas Haller2015-08-051-1/+1
|
* libnm-glib: add libnm compat defines to nm-vpn-plugin-ui-interface.hDan Winship2015-07-251-0/+4
| | | | | | | | Add a bunch of compat defines to nm-vpn-plugin-ui-interface.h, to make it easier to compile the same code against libnm-glib's NMVpnPluginUiInterface and libnm's NMVpnEditorPlugin. https://bugzilla.gnome.org/show_bug.cgi?id=752500
* all: rename nm-glib-compat.h to nm-glib.h, use everywhereDan Winship2015-07-2420-24/+20
| | | | | | | | | | | | | | | | Rather than randomly including one or more of <glib.h>, <glib-object.h>, and <gio/gio.h> everywhere (and forgetting to include "nm-glib-compat.h" most of the time), rename nm-glib-compat.h to nm-glib.h, include <gio/gio.h> from there, and then change all .c files in NM to include "nm-glib.h" rather than including the glib headers directly. (Public headers files still have to include the real glib headers, since nm-glib.h isn't installed...) Also, remove glib includes from header files that are already including a base object header file (which must itself already include the glib headers).
* libnm: handle illegal characters in nm_utils_ssid_to_utf8() (rh #1243078)David Shea2015-07-161-0/+15
| | | | | | | | | | | | g_convert_with_fallback() will fail if the SSID contains characters that are not legal in the source encoding, which, if $LANG is not set, will be ASCII. If this happens, replace all non-ASCII and non-printable characters with '?'. It is possible that nm_utils_ssid_to_utf8() will now return an empty string (e.g., the source string is actually big-endian UTF-16 and g_strcanon() stops on the first byte), but it will not return NULL. https://bugzilla.redhat.com/show_bug.cgi?id=1243078
* all: remove #if GLIB_CHECK_VERSION conditionals around g_type_init()Thomas Haller2015-07-124-10/+4
| | | | g_type_init() is now provided by nm-glib-compat.h as nm_g_type_init().
* libnm-core,libnm-util: avoid calling a constructorLubomir Rintel2015-06-021-1/+7
| | | | | | It yields completely unpredictable results on Ubuntu 12.04 (the global variable successfully comparing to NULL despite demonstrably not NULL). Possibly a toolchain bug.
* build: rename file "include/nm-utils-internal.h" to "nm-macros-internal.h"Thomas Haller2015-06-012-2/+2
| | | | | | | | | | | We already have "nm-utils*.h" and "NetworkManagerUtils.h" headers. Rename "include/nm-utils-internal.h" to "nm-macros-internal.h". I think that name is better, because this file is header-only, internal, and repository-wide. Also, it will never contain non-header-only declarations because there is no backing object file under "include/". It will only contain macros and inline functions.
* builds: only enable TAP driver for glib >= 2.37.6Lubomir Rintel2015-05-281-2/+0
| | | | | No TAP support for previous versions and --tap argument is silently ignored, confusing the TAP driver.
* tests: use the TAP formatterLubomir Rintel2015-05-261-0/+2
| | | | The test results in standard format are easily integrated into CI systems.
* tests: move all asserts into testsLubomir Rintel2015-05-263-121/+121
| | | | Otherwise the TAP formatter would produce a plan-less output.
* vlan: don't fail if parent isn't found at construct time for existing devicesDan Williams2015-05-061-0/+4
| | | | | | | | | | | | | For existing devices, depending on the order that netlink sends interfaces to us, the parent may be found after the VLAN interface and not be available when the VLAN interface is constructed. Instead of failing construction, when a NMDeviceVlan has no parent keep it unavailable for activation. Then have the Manager notify existing devices when a new device is found, and let NMDeviceVlan find the parent later and become available via that mechanism. This doesn't apply to VLANs created by NM itself, because the kernel requires a parent ifindex when creating a VLAN device. Thus this fix only applies to VLANs created outside NetworkManager, or existing when NM starts up.
* build: don't drop libnm-util/nm-version.h on cleanLubomir Rintel2015-05-051-2/+1
| | | | | Same behavior as for libnm-core/nm-version.h. It's created by configure, not built with make. Removing it breaks 'make clean; make'
* wimax: drop WiMAX support (bgo #747846)Dan Winship2015-04-172-0/+21
| | | | | | | | | | | | | | | | | | | | Even Fedora is no longer shipping the WiMAX SDK, so it's likely we'll eventually accidentally break some of the code in src/devices/wimax/ (if we haven't already). Discussion on the list showed a consensus for dropping support for WiMAX. So, remove the SDK checks from configure.ac, remove the WiMAX device plugin and associated manager support, and deprecate all the APIs. For compatibility reasons, it is still possible to create and save WiMAX connections, to toggle the software WiMAX rfkill state, and to change the "WIMAX" log level, although none of these have any effect, since no NMDeviceWimax will ever be created. nmcli was only compiling in support for most WiMAX operations when NM as a whole was built with WiMAX support, so that code has been removed now as well. (It is still possible to use nmcli to create and edit WiMAX connections, but those connections will never be activatable.)
* wifi: indicate 2ghz and 5ghz wifi device capabilitiesBeniamino Galvani2015-04-081-1/+7
| | | | | | | | | | | | Add new capabilities CAP_FREQ_2GHZ and CAP_FREQ_5GHZ to indicate the frequency bands supported by a Wifi device. Add also CAP_FREQ_VALID, which is set when the values of the other 2 capabilities are available. Original patch by Dan Williams <dcbw@redhat.com> https://bugzilla.gnome.org/show_bug.cgi?id=723295
* device,libnm,cli: add "new-activation" reason for device state changeLubomir Rintel2015-04-081-0/+2
| | | | It will be used when the device is disconnected for new connection activation.
* crypto: only use gnutls crypto API, remove libgcrypt dependency (bgo #730294)Jiří Klimeš2015-04-012-83/+65
| | | | | | | We don't need libgcrypt, because gnutls provides an API for encryption and hashing. (Anyway gnutls itself now uses nettle instead of libgcrypt). https://bugzilla.gnome.org/show_bug.cgi?id=730294
* libnm-util: allow 0.0.0.0/1 route in verify() (rh #1203904)Jiří Klimeš2015-03-242-10/+44
| | | | | | | | | | | | | | OpenVPN uses a trick to override default route by adding these two routes: 0.0.0.0/1 and 128.0.0.0/1. We should allow this and only refuse real default route (i.e. prefix == 0). Also verify IPv6 addresses and routes. See: man openvpn (search for def1) https://community.openvpn.net/openvpn/wiki/IgnoreRedirectGateway https://bugzilla.redhat.com/show_bug.cgi?id=1203904
* libnm: don't check for valid passwords in NMSetting:verify()Thomas Haller2015-03-204-81/+4
| | | | | | | | | | | | | | | | | | | | | | | | We must never fail verification of a connection based on a password because the password is re-requested during activation. Otherwise, if the user enters an invalid password for a (previously) valid connection, the connection becomes invalid. NetworkManager does not expect or handle that requesting password can make a connection invalid. Invalid passwords should be treated as wrong passwords. Only a UI (such as nm-connection-editor or nmcli) should validate passwords against a certain scheme. Note that there is need_secrets() which on the contrary must check for valid passwords. Error scenario: Connect to a WEP Wi-Fi, via `nmcli device wifi connect SSID`. The generated connection has wep-key-type=0 (UNKNOWN) and wep-key-flags=0. When trying to connect, NM will ask for secrets and set the wep-key0 field. After that, verification can fail (e.g. if the password is longer then 64 chars).
* libnm: fix error prefix in NMSettingGsm:verify()Thomas Haller2015-03-171-1/+1
|
* libnm: only call strlen() once in NMSetting8021x:path_to_scheme_value()Thomas Haller2015-03-121-5/+7
| | | | Also assert that path is not empty.
* libnm: ensure valid blob for nm_setting_802_1x_set_*_cert()Thomas Haller2015-03-121-4/+32
| | | | | | | A valid blob cannot start with "file://", otherwise it would break the implementation of the certificate properties in NMSetting8021x. Simply reject every blob in nm_setting_802_1x_set_ca_cert() et al. that is not valid according to get_cert_scheme().
* libnm: combine get_cert_scheme() and verify_cert() and ensure valid paths ↵Thomas Haller2015-03-121-21/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | for NMSetting8021x get_cert_scheme() would return PATH scheme for binary data that later will be rejected by verify_cert(). Even worse, get_cert_scheme() would not check whether the path is NUL terminated, hence the following can crash for an invalid connection: if (nm_setting_802_1x_get_ca_cert_scheme (s_8021x) == NM_SETTING_802_1X_CK_SCHEME_PATH) g_print ("path: %s", nm_setting_802_1x_get_ca_cert_path (s_8021x)) Combine the two functions so that already get_cert_scheme() does the same validation as verify_cert(). Also change behavior and be more strict about invalid paths: - Now, the value is considered a PATH candidate if it starts with "file://", (sans NUL character). A change is that before, the "file://" (without NUL) would have been treated as BLOB, now it is an invalid PATH (UNKNOWN). - If the binary starts with "file://" it is considered as PATH but it is only valid, if all the fllowing is true: (a) the last character must be NUL. (b) there is no other intermediate NUL character. Before, an intermediate NUL character would have been accepted and the remainder would be ignored. (c) there is at least one non-NUL character after "file://". (d) the string must be fully valid utf8. The conditions (b) and (c) are new and some invalid(?) paths might no longer validate. Checking (d) moved from verify_cert() to get_cert_scheme(). As set_cert_prop_helper() already called verify_cert(), this causes no additional change beyond (b).
* translations: avoid preprocessor strings inside translation macroThomas Haller2015-02-241-8/+10
| | | | | | | | https://bugzilla.gnome.org/show_bug.cgi?id=740381 https://bugzilla.gnome.org/show_bug.cgi?id=744998 Backport commit 943db815eeca43e5d1086b80feee77840655a781 from libnm-core to libnm-util.
* test: initialize auto-destructed pointersLubomir Rintel2015-02-093-15/+15
| | | | | | | Otherwise the compiler complains that they could be left uninitialized in case the function returns too early. Fixes: 76745817c3e77b7d6c22290a7564b73224147516
* tests: enable valgrind tests for testsThomas Haller2015-02-091-0/+1
|
* libnm/tests: fix memleaks in tests for valgrindThomas Haller2015-02-095-17/+46
|
* libnm-util: only unref and don't destroy hash in nm_connection_to_hash()Thomas Haller2015-02-092-4/+6
| | | | | The returned hash from nm_connection_to_hash() used to destroy the nested hashes, instead of only unrefing them.
* libnm: fix memleak in nm_setting_wired_get_s390_option() and refactorThomas Haller2015-02-091-18/+15
| | | | | @keys was leaked. Also refactor the function to iterate the hash only once.
* libnm: fix memleak for config in NMSettingTeamPortThomas Haller2015-02-091-0/+12
|
* libnm: fix memleak for app_fcoe_mode in NMSettingDcbThomas Haller2015-02-091-1/+13
|
* libnm/libnm-util: add Wi-Fi 'powersave' propertyDan Williams2015-01-213-0/+45
|
* libnm-core, libnm-util: belatedly update version macrosDan Winship2015-01-211-8/+23
| | | | | Add version macros for NM 1.2, and change NM_VERSION_CUR_STABLE to 1.0, and NEXT_STABLE to 1.2.
* libnm: fix documentation for nm_utils_file_search_in_paths()Thomas Haller2015-01-081-1/+1
|
* 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-41/+49
| | | | Cleans up all of the warnings that aren't overly annoying to clean up.
* build: embed git-commit-id as string inside libnm binaryThomas Haller2014-12-181-0/+6
| | | | | | | | | | | | | | | | | | In the 'configure.ac' script we already detect the git commit id for the current source version. When creating a tarball, it is also included inside the generated 'configure' script. Add the commit id as a static string to nm-utils.c. That way, having a build of libnm.so or NetworkManager, you can quickly find the corresponding git commit: strings src/NetworkManager | grep NM_GIT_SHA Note that this only works after a new `autogen.sh` run. Only rebuilding is not enough. Hence, you must rebuild all to ensure that the correct commit id is embedded. https://bugzilla.gnome.org/show_bug.cgi?id=741651
* libnm-core: mute coverity for RESOURCE_LEAK (CWE-772) in g_return_val_if_fail()Jiří Klimeš2014-12-151-1/+2
| | | | | | | | | | | | | | | | | | | | Error: RESOURCE_LEAK (CWE-772): [#def10] NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:225: alloc_fn: Storage is returned from allocation function "priority_map_new_from_str". NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:154:4: alloc_fn: Storage is returned from allocation function "g_malloc0". NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:154:4: var_assign: Assigning: "p" = "g_malloc0(8UL)". NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:164:2: return_alloc: Returning allocated memory "p". NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:225: var_assign: Assigning: "item" = storage returned from "priority_map_new_from_str(map, str)". NetworkManager-0.9.11.0/libnm-core/nm-setting-vlan.c:226: leaked_storage: Variable "item" going out of scope leaks the storage it points to. Error: RESOURCE_LEAK (CWE-772): [#def11] NetworkManager-0.9.11.0/libnm-core/nm-utils.c:2056: alloc_fn: Storage is returned from allocation function "crypto_make_des_aes_key". NetworkManager-0.9.11.0/libnm-core/crypto.c:405:2: alloc_fn: Storage is returned from allocation function "g_malloc0". NetworkManager-0.9.11.0/libnm-core/crypto.c:405:2: var_assign: Assigning: "key" = "g_malloc0(digest_len + 1U)". NetworkManager-0.9.11.0/libnm-core/crypto.c:407:2: noescape: Resource "key" is not freed or pointed-to in function "crypto_md5_hash". NetworkManager-0.9.11.0/libnm-core/crypto.c:769:24: noescape: "crypto_md5_hash(char const *, gssize, char const *, gssize, char *, gsize)" does not free or save its pointer parameter "buffer". NetworkManager-0.9.11.0/libnm-core/crypto.c:415:2: return_alloc: Returning allocated memory "key". NetworkManager-0.9.11.0/libnm-core/nm-utils.c:2056: var_assign: Assigning: "key" = storage returned from "crypto_make_des_aes_key("DES-EDE3-CBC", &salt[0], salt_len, in_password, &key_len, NULL)". NetworkManager-0.9.11.0/libnm-core/nm-utils.c:2057: leaked_storage: Variable "key" going out of scope leaks the storage it points to.
* libnm: fix wrong g_return_if_fail() in nm_utils_file_search_in_paths()Thomas Haller2014-12-051-1/+1
| | | | | Fixes: 6399170ff36986b7e973f77598390b37612106cb https://bugzilla.gnome.org/show_bug.cgi?id=740783
* libnm: fix gtkdoc annotations for nm_utils_file_search_in_paths()Thomas Haller2014-12-051-2/+2
| | | | Fixes: 6399170ff36986b7e973f77598390b37612106cb