NetworkManager/libnm-core
Thomas Haller 978724da96 libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion in agent_secrets_done_cb()
When secret providers return the connection hash in GetSecrets(),
this hash should only contain secrets. However, some providers also
return non-secret properties.

for_each_secret() iterated over all entries of the @secrets hash
and triggered the assertion in nm_setting_get_secret_flags() (see
below).

NM should not assert against user provided input. Change
nm_setting_get_secret_flags() to silently return FALSE, if the property
is not a secret.

Indeed, handling of secrets is very different for NMSettingVpn and
others. Hence nm_setting_get_secret_flags() has only an inconsistent
behavior and we have to fix all call sites to do the right thing
(depending on whether we have a VPN setting or not).

Now for_each_secret() checks whether the property is a secret
without hitting the assertion. Adjust all other calls of
nm_setting_get_secret_flags(), to anticipate non-secret flags and
assert/warn where appropriate.

Also, agent_secrets_done_cb() clears now all non-secrets properties
from the hash, using the new argument @remove_non_secrets when calling
for_each_secret().

  #0  0x0000003370c504e9 in g_logv () from /lib64/libglib-2.0.so.0
  #1  0x0000003370c5063f in g_log () from /lib64/libglib-2.0.so.0
  #2  0x00007fa4b0c1c156 in get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", verify_secret=1, out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1091
  #3  0x00007fa4b0c1c2b2 in nm_setting_get_secret_flags (setting=0x1e3ac60, secret_name=0x1ea9180 "security", out_flags=0x7fff7507857c, error=0x0) at nm-setting.c:1124
  #4  0x0000000000463d03 in for_each_secret (connection=0x1deb2f0, secrets=0x1e9f860, callback=0x464f1b <has_system_owned_secrets>, callback_data=0x7fff7507865c) at settings/nm-settings-connection.c:203
  #5  0x000000000046525f in agent_secrets_done_cb (manager=0x1dddf50, call_id=1, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", agent_has_modify=1, setting_name=0x1e91f90 "802-11-wireless-security",
      flags=NM_SETTINGS_GET_SECRETS_FLAG_ALLOW_INTERACTION, secrets=0x1e9f860, error=0x0, user_data=0x1deb2f0, other_data2=0x477d61 <get_secrets_cb>, other_data3=0x1ea92a0) at settings/nm-settings-connection.c:757
  #6  0x00000000004dc4fd in get_complete_cb (parent=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_username=0x1e51710 "thom", error=0x0, user_data=0x1dddf50) at settings/nm-agent-manager.c:1139
  #7  0x00000000004dab54 in req_complete_success (req=0x1ea6300, secrets=0x1e9f860, agent_dbus_owner=0x1ddb9e0 ":1.39", agent_uname=0x1e51710 "thom") at settings/nm-agent-manager.c:502
  #8  0x00000000004db86e in get_done_cb (agent=0x1e89530, call_id=0x1, secrets=0x1e9f860, error=0x0, user_data=0x1ea6300) at settings/nm-agent-manager.c:856
  #9  0x00000000004de9d0 in get_callback (proxy=0x1e47530, call=0x1, user_data=0x1ea10f0) at settings/nm-secret-agent.c:267
  #10 0x000000337380cad2 in complete_pending_call_and_unlock () from /lib64/libdbus-1.so.3
  #11 0x000000337380fdc1 in dbus_connection_dispatch () from /lib64/libdbus-1.so.3
  #12 0x000000342800ad65 in message_queue_dispatch () from /lib64/libdbus-glib-1.so.2
  #13 0x0000003370c492a6 in g_main_context_dispatch () from /lib64/libglib-2.0.so.0
  #14 0x0000003370c49628 in g_main_context_iterate.isra.24 () from /lib64/libglib-2.0.so.0
  #15 0x0000003370c49a3a in g_main_loop_run () from /lib64/libglib-2.0.so.0
  #16 0x000000000042e5c6 in main (argc=1, argv=0x7fff75078e88) at main.c:644

Signed-off-by: Thomas Haller <thaller@redhat.com>
2014-10-12 21:17:17 +02:00
..
tests libnm: add NMSettingConnection:autoconnect-priority setting 2014-10-12 20:13:17 +02:00
crypto.c libnm-core: replace GByteArray with pointer + length in some APIs 2014-09-04 09:20:11 -04:00
crypto.h libnm-core: replace GByteArray with pointer + length in some APIs 2014-09-04 09:20:11 -04:00
crypto_gnutls.c libnm-core: replace GByteArray with pointer + length in some APIs 2014-09-04 09:20:11 -04:00
crypto_nss.c libnm-core: replace GByteArray with pointer + length in some APIs 2014-09-04 09:20:11 -04:00
Makefile.am libnm: port to GDBus 2014-09-18 11:51:09 -04:00
Makefile.libnm-core libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-connection.c libnm-core: fix crash in update-secrets when trying to clear all settings without providing a connection variant 2014-09-22 16:16:41 +02:00
nm-connection.h libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-core-internal.h libnm: port to GDBus 2014-09-18 11:51:09 -04:00
nm-dbus-interface.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-property-compare.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-property-compare.h libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-8021x.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-8021x.h libnm-core: change DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES 2014-09-04 09:20:11 -04:00
nm-setting-adsl.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-adsl.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-bluetooth.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-bluetooth.h libnm-core: change all mac-address properties to G_TYPE_STRING 2014-09-04 09:20:10 -04:00
nm-setting-bond.c libnm: add bonding option "lacp_rate" to NMSettingBond 2014-10-02 16:36:03 +02:00
nm-setting-bond.h libnm: add bonding option "lacp_rate" to NMSettingBond 2014-10-02 16:36:03 +02:00
nm-setting-bridge-port.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-bridge-port.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-bridge.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-bridge.h libnm-core: change all mac-address properties to G_TYPE_STRING 2014-09-04 09:20:10 -04:00
nm-setting-cdma.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-cdma.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-connection.c libnm: add NMSettingConnection:autoconnect-priority setting 2014-10-12 20:13:17 +02:00
nm-setting-connection.h libnm: add NMSettingConnection:autoconnect-priority setting 2014-10-12 20:13:17 +02:00
nm-setting-dcb.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-dcb.h libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-generic.c libnm-core: simplify _nm_register_setting(), register error types too 2014-09-04 09:18:44 -04:00
nm-setting-generic.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-gsm.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-gsm.h libnm-core: drop previously-deprecated NMSetting properties 2014-09-04 09:17:37 -04:00
nm-setting-infiniband.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-infiniband.h libnm-core: change all mac-address properties to G_TYPE_STRING 2014-09-04 09:20:10 -04:00
nm-setting-ip4-config.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-ip4-config.h libnm-core: improve NMSettingIP4Config / NMSettingIP6Config property types 2014-09-04 09:20:11 -04:00
nm-setting-ip6-config.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-ip6-config.h libnm-core: improve NMSettingIP4Config / NMSettingIP6Config property types 2014-09-04 09:20:11 -04:00
nm-setting-olpc-mesh.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-olpc-mesh.h libnm-core: change DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES 2014-09-04 09:20:11 -04:00
nm-setting-ppp.c libnm-core: simplify _nm_register_setting(), register error types too 2014-09-04 09:18:44 -04:00
nm-setting-ppp.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-pppoe.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-pppoe.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-private.h libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-serial.c libnm-core: make NMSettingSerial:parity an enum 2014-10-03 09:36:28 -04:00
nm-setting-serial.h libnm-core: make NMSettingSerial:parity an enum 2014-10-03 09:36:28 -04:00
nm-setting-team-port.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-team-port.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-team.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-team.h libnm-core: drop :interface-name properties on virtual NMSetting types 2014-09-04 09:18:44 -04:00
nm-setting-vlan.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-vlan.h libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-vpn.c libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion in agent_secrets_done_cb() 2014-10-12 21:17:17 +02:00
nm-setting-vpn.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-wimax.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-wimax.h libnm-core: change all mac-address properties to G_TYPE_STRING 2014-09-04 09:20:10 -04:00
nm-setting-wired.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-wired.h libnm-core: change list-of-string and array-of-string properties to G_TYPE_STRV 2014-09-04 09:20:10 -04:00
nm-setting-wireless-security.c libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-setting-wireless-security.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00
nm-setting-wireless.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-setting-wireless.h libnm-core: change DBUS_TYPE_G_UCHAR_ARRAY properties to G_TYPE_BYTES 2014-09-04 09:20:11 -04:00
nm-setting.c libnm-util: don't assert in nm_setting_get_secret_flags() and avoid assertion in agent_secrets_done_cb() 2014-10-12 21:17:17 +02:00
nm-setting.h libnm: make use of GParamSpecFlags and GParamSpecEnum 2014-10-03 09:36:28 -04:00
nm-simple-connection.c libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-simple-connection.h libnm-core: change connection hash tables to variants in API 2014-09-18 11:51:09 -04:00
nm-utils-private.h libnm: port to GDBus 2014-09-18 11:51:09 -04:00
nm-utils.c libnm: make @copy_func argument in _nm_utils_copy_strdict() optional 2014-10-12 20:13:17 +02:00
nm-utils.h libnm-core: add nm_utils_wifi_strength_bars(), use it in nmcli and nmtui 2014-09-27 11:49:15 -04:00
nm-version.h.in libnm: add libnm/libnm-core (part 1) 2014-08-01 14:34:04 -04:00
nm-vpn-dbus-interface.h all: fix up multiple-include-guard defines 2014-08-16 10:17:14 -04:00