Commit Graph

7740 Commits

Author SHA1 Message Date
Dan Williams
fa97543186 libnm-util: free temporary decoded base64 data when parsing OpenSSL key files
==7347== 1,201 bytes in 1 blocks are definitely lost in loss record 5,016 of 5,107
==7347==    at 0x4A06B0F: calloc (vg_replace_malloc.c:593)
==7347==    by 0x39B90548E6: g_malloc0 (gmem.c:189)
==7347==    by 0x39B9026F8D: g_base64_decode (gbase64.c:407)
==7347==    by 0x4C51CA1: parse_old_openssl_key_file (crypto.c:227)
==7347==    by 0x4C51EC3: crypto_decrypt_private_key_data (crypto.c:497)
==7347==    by 0x4C529BE: crypto_verify_private_key_data (crypto.c:706)
==7347==    by 0x4C52B7B: crypto_verify_private_key (crypto.c:735)
==7347==    by 0x4C5CCC5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1633)
==7347==    by 0xC8F64D4: eap_tls_reader (reader.c:2270)
==7347==    by 0xC8F4886: fill_8021x (reader.c:2704)
==7347==    by 0xC8F8311: wireless_connection_from_ifcfg (reader.c:2825)
==7347==    by 0xC8FAFD2: connection_from_file (reader.c:4303)
2013-03-08 09:27:51 -06:00
Dan Williams
c22e4da986 libnm-util: free PPPoE setting private data members
==23089== 342 bytes in 38 blocks are definitely lost in loss record 4,870 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B906A4BB: g_strdup (gstrfuncs.c:356)
==23089==    by 0x31FC02DA90: set_property (nm-setting-pppoe.c:220)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
==23089==    by 0x39B903F8DF: g_hash_table_foreach (ghash.c:1524)
==23089==    by 0x31FC01756C: nm_connection_duplicate (nm-connection.c:1203)
==23089==    by 0x4A7BE3: get_settings_auth_cb (nm-settings-connection.c:1062)
==23089==    by 0x4A5624: auth_start (nm-settings-connection.c:1008)
2013-03-08 09:27:51 -06:00
Dan Williams
ca00badb03 libnm-util: free temporary string when parsing OpenSSL key files
'str' was not freed anywhere.

==23089== 2,072 (24 direct, 2,048 indirect) bytes in 1 blocks are definitely lost in loss record 5,063 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B906C7FA: g_string_sized_new (gstring.c:121)
==23089==    by 0x39B906CE75: g_string_new_len (gstring.c:186)
==23089==    by 0x31FC0149CE: parse_old_openssl_key_file (crypto.c:150)
==23089==    by 0x31FC014E33: crypto_decrypt_private_key_data (crypto.c:494)
==23089==    by 0x31FC01592E: crypto_verify_private_key_data (crypto.c:703)
==23089==    by 0x31FC015AEB: crypto_verify_private_key (crypto.c:732)
==23089==    by 0x31FC0200E5: nm_setting_802_1x_set_private_key (nm-setting-8021x.c:1640)
==23089==    by 0xC694304: eap_tls_reader (reader.c:2280)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
2013-03-08 09:27:51 -06:00
Dan Williams
2878481c09 libnm-util: free temporary GByteArray when using NM_SETTING_802_1X_CK_SCHEME_PATH
If the certificate's format was valid, but we're asked to refer to it by
paths instead of using the raw data, 'data' would be leaked.

==23089== 8,232 (40 direct, 8,192 indirect) bytes in 1 blocks are definitely lost in loss record 5,109 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01ED26: nm_setting_802_1x_set_client_cert (nm-setting-8021x.c:819)
==23089==    by 0xC6944A4: eap_tls_reader (reader.c:2316)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
==23089==
==23089== 8,352 (160 direct, 8,192 indirect) bytes in 4 blocks are definitely lost in loss record 5,110 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024539: g_array_sized_new (garray.c:195)
==23089==    by 0x31FC0146EA: file_to_g_byte_array (crypto.c:319)
==23089==    by 0x31FC01543B: crypto_load_and_verify_certificate (crypto.c:606)
==23089==    by 0x31FC01E5E6: nm_setting_802_1x_set_ca_cert (nm-setting-8021x.c:538)
==23089==    by 0xC694DD8: eap_peap_reader (reader.c:2358)
==23089==    by 0xC692756: fill_8021x (reader.c:2714)
==23089==    by 0xC696151: wireless_connection_from_ifcfg (reader.c:2832)
==23089==    by 0xC698E3A: connection_from_file (reader.c:4316)
==23089==    by 0xC69135C: nm_ifcfg_connection_new (nm-ifcfg-connection.c:119)
2013-03-08 09:27:51 -06:00
Dan Williams
0f5b91ad2e libnm-util: fix leak of s390 subchannels
==23089== 7,293 (1,248 direct, 6,045 indirect) bytes in 39 blocks are definitely lost in loss record 5,100 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B9024E90: g_ptr_array_sized_new (garray.c:884)
==23089==    by 0x31FB81B3FC: ptrarray_copy (dbus-gvalue-utils.c:1047)
==23089==    by 0x31FB81845C: proxy_value_copy (dbus-gtype-specialized.c:446)
==23089==    by 0x39B980F51E: g_boxed_copy (gboxed.c:359)
==23089==    by 0x31FC03134C: set_property (nm-setting-wired.c:619)
==23089==    by 0x39B9819972: g_object_set_property (gobject.c:1352)
==23089==    by 0x31FC01A9A7: nm_setting_enumerate_values (nm-setting.c:589)
==23089==    by 0x31FC01AA81: nm_setting_duplicate (nm-setting.c:264)
==23089==    by 0x31FC01633B: duplicate_cb (nm-connection.c:1182)
2013-03-08 09:27:51 -06:00
Dan Williams
4cdb841881 wifi: optimize AvailableConnections updating on device disable
Call recheck_available_connections() once after removing all APs,
not every time we remove an AP.
2013-03-08 09:27:51 -06:00
Dan Williams
ec781ff9d5 core: fix leak of StateReason struct
==23089== 38,232 (4,248 direct, 33,984 indirect) bytes in 177 blocks are definitely lost in loss record 5,122 of 5,123
==23089==    at 0x4A0881C: malloc (vg_replace_malloc.c:270)
==23089==    by 0x39B905488E: g_malloc (gmem.c:159)
==23089==    by 0x39B9068CA1: g_slice_alloc (gslice.c:1003)
==23089==    by 0x39B98371B1: g_value_array_new (gvaluearray.c:140)
==23089==    by 0x31FB81B67D: valuearray_constructor (dbus-gvalue-utils.c:771)
==23089==    by 0x42DD8F: get_property (nm-device.c:4675)
==23089==    by 0x39B9819C64: g_object_get_property (gobject.c:1289)
==23089==    by 0x31FB80DA49: object_registration_message (dbus-gobject.c:1322)
==23089==    by 0x363961DA44: _dbus_object_tree_dispatch_and_unlock (dbus-object-tree.c:858)
==23089==    by 0x363960FA82: dbus_connection_dispatch (dbus-connection.c:4685)
==23089==    by 0x31FB80AC44: message_queue_dispatch (dbus-gmain.c:90)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
2013-03-08 09:27:51 -06:00
Dan Williams
b711256a5c core: fix use-after-free
'device' is freed by nm_ip6_manager_cancel_addrconf().  Plus if
addrconf fails, the DHCP options should be ignored anyway.

==23089== Thread 1:
==23089== Invalid read of size 4
==23089==    at 0x4861E0: finish_addrconf (nm-ip6-manager.c:444)
==23089==    by 0x39B904F7EA: g_timeout_dispatch (gmain.c:3882)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
==23089==    by 0x39B904EF87: g_main_context_iterate.isra.23 (gmain.c:3146)
==23089==    by 0x39B904F381: g_main_loop_run (gmain.c:3340)
==23089==    by 0x426188: main (main.c:614)
==23089==  Address 0xcdb791c is 60 bytes inside a block of size 152 free'd
==23089==    at 0x4A07786: free (vg_replace_malloc.c:446)
==23089==    by 0x39B905499E: g_free (gmem.c:252)
==23089==    by 0x39B90692FE: g_slice_free1 (gslice.c:1111)
==23089==    by 0x39B903EC49: g_hash_table_remove_internal (ghash.c:1274)
==23089==    by 0x4861DC: finish_addrconf (nm-ip6-manager.c:443)
==23089==    by 0x39B904F7EA: g_timeout_dispatch (gmain.c:3882)
==23089==    by 0x39B904EC54: g_main_context_dispatch (gmain.c:2539)
==23089==    by 0x39B904EF87: g_main_context_iterate.isra.23 (gmain.c:3146)
==23089==    by 0x39B904F381: g_main_loop_run (gmain.c:3340)
==23089==    by 0x426188: main (main.c:614)
2013-03-08 09:27:51 -06:00
Pavel Šimerda
e98d6430a8 misc: add toplevel .dir-locals file that tells Emacs to show trailing whitespace
To help developers avoid adding any.
2013-03-08 15:15:28 +01:00
Pavel Šimerda
9ba40ca886 cleanup: remove obsolete nmnetlink.test.c 2013-03-08 15:12:13 +01:00
Enrico Nicoletto
cff78d8f49 po: updated Brazilian Portuguese (pt_BR) translation (bgo #694959) 2013-03-08 10:54:54 +01:00
Dan Williams
7badb7ae43 trivial: remove unused define 2013-03-07 16:29:03 -06:00
Colin Walters
dc6f5f5dd7 keyfile: handle NetworkManager.conf not existing
Since in gnome-ostree we're trying to move towards an empty /etc.
We'll create it on demand if necessary.
2013-03-07 15:49:28 -06:00
Colin Walters
21ba714f78 keyfile: Use "goto out" style error handling
Just code cleanup: This is much less error-prone than manual nesting,
and will mesh very well with future changes to use the libgsystem
cleanup macros.
2013-03-07 15:46:15 -06:00
Dan Winship
6f44b7f3c6 all: remove redundant return-if-fail checks
NM_IS_FOO(x) returns FALSE if x is NULL, so we don't need a separate
(x != NULL) check before it.
2013-03-07 07:32:27 -05:00
Dan Winship
0006c6aa1d trivial: update .gitignore 2013-03-07 07:12:53 -05:00
Pavel Šimerda
bf32605287 cleanup: remove unnecessary headers from nm-netlink-monitor.h
Accomodate nm-netlink-monitor.c to the change by moving around utility
functions and making them static (removing if not used). Unsubscription
of rtnl groups is not necessary and the whole process will be eventually
moved to nm-platform.
2013-03-06 11:59:07 +01:00
Pavel Šimerda
8f758b0af9 cleanup: remove nm-netlink-compat 2013-03-05 23:02:50 +01:00
Pavel Šimerda
47a3e24d32 netlink: replace libnl 1.x functions
Confusingly, nm-platform-compat's rtnl_link_set_oif adds a new nexthop
with ifindex set, while rtnl_link_set_gateway sets gateway for an
existing nexthop. Keeping the behavior to avoid potential problems.
2013-03-05 23:02:42 +01:00
Pavel Šimerda
92481c6a6a ip6: replace libnl 1.x functions 2013-03-05 20:22:47 +01:00
Pavel Šimerda
487afb779c ip6: use delayed execution to avoid duplicate events
device_sync_from_netlink() and nm_netlink_request_ip6_info() are now
delayed, so that they are called only once for a series of events. This
makes the IPv6 processing and especially debug messages more sane.
2013-03-05 02:34:21 +01:00
Pavel Šimerda
896af74097 ip6: replace timed polling with event-based call
Request IPv6 flags from kernel on RTM_NEWROUTE/RTM_DELROUTE instead
of requesting periodically.
2013-03-05 02:32:42 +01:00
Pavel Šimerda
a93fb28d1a ip6: don't subscribe for RTM_PREFIX messages 2013-03-05 02:29:50 +01:00
Pavel Šimerda
195a09d7c0 ip6: fix rtnl_route_alloc_cache() call
NL_AUTO_PROVIDE is not a valid flag for this call and it's coincidental
with ROUTE_CACHE_CONTENT, which is certainly not what we want.

NETLINK_ROUTE is a netlink family, not an address family. It is
coincidental with AF_UNSPEC which is what we actually want.
2013-03-05 02:29:43 +01:00
Pavel Šimerda
fc41ae3ac6 ip6: use assert for fatal errors during initialization 2013-03-05 01:49:18 +01:00
Pavel Šimerda
54746d5ed4 ip6: clean up and improve debugging
Stop logging the whole list of addresses as we already have new and lost
addresses logged. Stop putting 'state' and 'ra_flags' in almost every
message since changes of those are already logged. Log target state
change.
2013-03-05 01:49:13 +01:00
Pavel Šimerda
9dddb51af2 ip6: rename got-ra to got-router-advertisement 2013-03-05 01:02:37 +01:00
Pavel Šimerda
649c21bbc9 trivial: add missing standard includes
This will help later cleanups of nm-system.
2013-03-04 22:11:54 +01:00
Pavel Šimerda
bb8c75bd53 remove obsolete nm-tool
Use nmcli instead.
2013-03-04 22:11:45 +01:00
Dan Williams
632c52ceea libnm-glib: fix type annotation of NMDHCP[46]Config:options
The GOI syntax changed a while back and these didn't follow.
2013-02-27 18:09:52 +01:00
Dan Williams
395228b5cf Revert "libnm-glib: fix type annotation of NMDHCP[46]Config:options"
This reverts commit 0e0b5da7e3.

Syntax actually uses () instead of <> for various docbook-related
reasons.
2013-02-27 18:09:52 +01:00
Dan Williams
a096ef8f87 core: fix more GValueArray deprecation fallout 2013-02-27 18:09:52 +01:00
Dan Williams
97990135f1 dhcp: ensure any dhclient script from dhclient.conf is ignored
The config file can specify a dhclient script, which gets used instead
of what NM passes on the command-line.  Make sure that script gets
ignored in the final dhclient config, because the script NM passes
is the script that needs to be used to pass data back to NM.  People
may have old dhclient.conf files lying around that get picked up and
we don't want any script specified there to interfere.
2013-02-27 17:17:11 +01:00
Dan Williams
80886c2866 libnm-glib: work around possible compiler bug with GValueArray deprecation workarounds
GValueArray is deprecated.  Unfortunately, it's part of our API right now,
so we have to keep it around for a while.  But since it's deprecated, and
we want to know about *other* deprecations, we have to suppress deprecations
about GValueArray.  Unfortunately using macros to do that (eg in
nm-gvaluearray-compat.h) exposes some compiler bugs due to the combination
of parentheses/braces and #pragma from G_GNUC_BEGIN_IGNORE_DEPRECATIONS,
resulting in warnings like:

nm-utils.c:920:9: error: expected expression before ‘#pragma’

Work around this by not trying to stuff what's now a macro (eg
g_value_array_get_nth) into what's already a macro (G_VALUE_TYPE).
There's probably a better way to do this...
2013-02-27 17:16:27 +01:00
Dan Williams
db7ba1c161 trivial: rename 'link' to avoid shadowing a global variable/function
nm-system.c: In function "nm_system_bond_enslave":
nm-system.c:1689:21: error: declaration of "link" shadows a global declaration [-Werror=shadow]
2013-02-27 15:41:07 +01:00
Dan Winship
0e0b5da7e3 libnm-glib: fix type annotation of NMDHCP[46]Config:options 2013-02-26 13:26:38 +01:00
Dan Winship
de2e32b375 build: Update GLIB_VERSION_MIN_REQUIRED to 2.32
now that it no longer causes any warnings
2013-02-26 13:07:33 +01:00
Dan Winship
be89197214 core: remove remaining pre-2.32 GLib compat / deprecated usage 2013-02-26 13:07:33 +01:00
Dan Winship
a2cdf63204 core: use GResolver for reverse resolution
Remove the HostnameThread stuff from nm-policy-hostname and just use
GResolver instead. Move the one remaining nm-policy-hostname function
into nm-policy.
2013-02-26 13:07:33 +01:00
Dan Winship
f936400c38 tests: clean up gtester usage
Use g_test_add_func() and g_test_add_data_func() to simplify the test
cases, getting rid of the GLIB_CHECK_VERSION calls in the process.
2013-02-26 13:07:33 +01:00
Dan Winship
ed9e2d8377 build: avoid GValueArray deprecation warnings
Avoid warnings about GValueArray being deprecated by adding macros
that wrap G_GNUC_BEGIN_IGNORE_DEPRECATIONS /
G_GNUC_END_IGNORE_DEPRECATIONS around the GValueArray calls.
2013-02-26 13:07:33 +01:00
Dan Winship
3bd867bb62 build: remove glib-mkenums
This was imported to get a bugfix in glib 2.31.5; since we require
2.32 now, we can use the system glib-mkenums.
2013-02-26 13:07:32 +01:00
Dan Winship
279a347abf examples: remove GLIB_CHECK_VERSION checks from GDBus examples 2013-02-26 13:07:32 +01:00
Dan Winship
38035856d9 build: require GLib 2.32 2013-02-26 13:07:32 +01:00
Jiří Klimeš
5e17df86f4 cli: fix a crash in 'nmcli d l' when no connections available for a device
The regression caused by 1dca1e3c3d
2013-02-26 11:44:22 +01:00
Dan Williams
47d8db57b5 trivial: plug some memory leaks
(review+ danw)
2013-02-25 16:07:03 +01:00
Dan Williams
5f626b1c56 trivial: fix makefile typo 2013-02-22 08:57:56 -06:00
Dan Williams
a2269b0974 libnm-glib: bump soname for added functions 2013-02-22 08:34:25 -06:00
Dan Williams
3e689be15e libnm-util: bump soname for added functions 2013-02-22 08:34:19 -06:00
Dan Williams
4f9e13fcb0 libnm-glib: add Since tags to new functions and properties 2013-02-22 08:34:13 -06:00