diff options
author | Thomas Haller <thaller@redhat.com> | 2016-10-31 13:10:55 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-11-09 12:07:34 +0100 |
commit | 917ab8334b5ece09027d692d0e693e6a3ffa423a (patch) | |
tree | 57c69ee4e3d7effd5bc2d08e4e588667c07d46b2 | |
parent | 2a3b238d493fcd9a5049727e18f7e0e9dac5b14e (diff) | |
download | NetworkManager-917ab8334b5ece09027d692d0e693e6a3ffa423a.tar.gz |
ifcfg-rh/trivial: rename svGetValue() and related
svGetValue() had the meaning of returning a string, except the
empty word "" was coerced to NULL.
svGetValueFull() had the meaing of returing the value as string,
including the empty word.
Rename those functions to better express what they do.
Same for svSetValue*().
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 312 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 412 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.c | 35 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.h | 4 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 62 |
5 files changed, 412 insertions, 413 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index 61b273c631..140e7be0a6 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -97,7 +97,7 @@ make_connection_name (shvarFile *ifcfg, char *full_name = NULL, *name; /* If the ifcfg file already has a NAME, always use that */ - name = svGetValue (ifcfg, "NAME"); + name = svGetValueString (ifcfg, "NAME"); if (name && strlen (name)) return name; @@ -142,13 +142,13 @@ make_connection_setting (const char *file, g_free (new_id); /* Try for a UUID key before falling back to hashing the file name */ - uuid = svGetValue (ifcfg, "UUID"); + uuid = svGetValueString (ifcfg, "UUID"); if (!uuid || !strlen (uuid)) { g_free (uuid); uuid = nm_utils_uuid_generate_from_string (svFileGetName (ifcfg), -1, NM_UTILS_UUID_TYPE_LEGACY, NULL); } - stable_id = svGetValue (ifcfg, "STABLE_ID"); + stable_id = svGetValueString (ifcfg, "STABLE_ID"); g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, type, @@ -157,7 +157,7 @@ make_connection_setting (const char *file, NULL); g_free (uuid); - value = svGetValue (ifcfg, "DEVICE"); + value = svGetValueString (ifcfg, "DEVICE"); if (value) { if (nm_utils_iface_valid_name (value)) { g_object_set (s_con, @@ -168,7 +168,7 @@ make_connection_setting (const char *file, g_free (value); } - value = svGetValue (ifcfg, "LLDP"); + value = svGetValueString (ifcfg, "LLDP"); if (!g_strcmp0 (value, "rx")) lldp = NM_SETTING_CONNECTION_LLDP_ENABLE_RX; else @@ -192,7 +192,7 @@ make_connection_setting (const char *file, NM_SETTING_CONNECTION_LLDP, lldp, NULL); - value = svGetValue (ifcfg, "USERS"); + value = svGetValueString (ifcfg, "USERS"); if (value) { char **items, **iter; @@ -208,7 +208,7 @@ make_connection_setting (const char *file, } - zone = svGetValue (ifcfg, "ZONE"); + zone = svGetValueString (ifcfg, "ZONE"); if (!zone || !strlen (zone)) { g_free (zone); zone = NULL; @@ -216,7 +216,7 @@ make_connection_setting (const char *file, g_object_set (s_con, NM_SETTING_CONNECTION_ZONE, zone, NULL); g_free (zone); - value = svGetValue (ifcfg, "SECONDARY_UUIDS"); + value = svGetValueString (ifcfg, "SECONDARY_UUIDS"); if (value) { char **items, **iter; @@ -231,7 +231,7 @@ make_connection_setting (const char *file, g_strfreev (items); } - value = svGetValue (ifcfg, "BRIDGE"); + value = svGetValueString (ifcfg, "BRIDGE"); if (value) { const char *old_value; @@ -246,7 +246,7 @@ make_connection_setting (const char *file, g_free (value); } - value = svGetValue (ifcfg, "GATEWAY_PING_TIMEOUT"); + value = svGetValueString (ifcfg, "GATEWAY_PING_TIMEOUT"); if (value) { gint64 tmp; @@ -286,7 +286,7 @@ read_ip4_address (shvarFile *ifcfg, *out_addr = NULL; - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); if (!value) return TRUE; @@ -321,7 +321,7 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx) char *value; tag = get_numbered_tag ("IPADDR", i); - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); g_free (tag); if (value) { g_free (value); @@ -330,7 +330,7 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx) } tag = get_numbered_tag ("PREFIX", i); - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); g_free(tag); if (value) { g_free (value); @@ -339,7 +339,7 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx) } tag = get_numbered_tag ("NETMASK", i); - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); g_free(tag); if (value) { g_free (value); @@ -396,7 +396,7 @@ read_full_ip4_address (shvarFile *ifcfg, } /* Prefix */ - value = svGetValue (ifcfg, prefix_tag); + value = svGetValueString (ifcfg, prefix_tag); if (value) { prefix = _nm_utils_ascii_str_to_int64 (value, 10, 0, 32, -1); if (prefix < 0) { @@ -474,7 +474,7 @@ read_one_ip4_route (shvarFile *ifcfg, if (!dest) { /* Check whether IP is missing or 0.0.0.0 */ char *val; - val = svGetValue (ifcfg, ip_tag); + val = svGetValueString (ifcfg, ip_tag); if (!val) { *out_route = NULL; success = TRUE; /* missing route = success */ @@ -509,7 +509,7 @@ read_one_ip4_route (shvarFile *ifcfg, } /* Metric */ - value = svGetValue (ifcfg, metric_tag); + value = svGetValueString (ifcfg, metric_tag); if (value) { metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1); if (metric < 0) { @@ -910,7 +910,7 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) char *value = NULL; NMSettingProxyMethod method; - value = svGetValue (ifcfg, "PROXY_METHOD"); + value = svGetValueString (ifcfg, "PROXY_METHOD"); if (!value) return NULL; @@ -928,14 +928,14 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) NM_SETTING_PROXY_METHOD, (int) NM_SETTING_PROXY_METHOD_AUTO, NULL); - value = svGetValue (ifcfg, "PAC_URL"); + value = svGetValueString (ifcfg, "PAC_URL"); if (value) { value = g_strstrip (value); g_object_set (s_proxy, NM_SETTING_PROXY_PAC_URL, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "PAC_SCRIPT"); + value = svGetValueString (ifcfg, "PAC_SCRIPT"); if (value) { value = g_strstrip (value); g_object_set (s_proxy, NM_SETTING_PROXY_PAC_SCRIPT, value, NULL); @@ -950,7 +950,7 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) break; } - value = svGetValue (ifcfg, "BROWSER_ONLY"); + value = svGetValueString (ifcfg, "BROWSER_ONLY"); if (value) { if (!g_ascii_strcasecmp (value, "yes")) g_object_set (s_proxy, NM_SETTING_PROXY_BROWSER_ONLY, TRUE, NULL); @@ -993,9 +993,9 @@ make_ip4_setting (shvarFile *ifcfg, char *gatewaydev; /* Get the connection ifcfg device name and the global gateway device */ - value = svGetValue (ifcfg, "DEVICE"); - gatewaydev = svGetValue (network_ifcfg, "GATEWAYDEV"); - dns_options = svGetValueFull (network_ifcfg, "RES_OPTIONS"); + value = svGetValueString (ifcfg, "DEVICE"); + gatewaydev = svGetValueString (network_ifcfg, "GATEWAYDEV"); + dns_options = svGetValue (network_ifcfg, "RES_OPTIONS"); /* If there was a global gateway device specified, then only connections * for that device can be the default connection. @@ -1008,7 +1008,7 @@ make_ip4_setting (shvarFile *ifcfg, svCloseFile (network_ifcfg); } - value = svGetValue (ifcfg, "BOOTPROTO"); + value = svGetValueString (ifcfg, "BOOTPROTO"); if (!value || !*value || !g_ascii_strcasecmp (value, "none")) { if (is_any_ip4_address_defined (ifcfg, NULL)) @@ -1070,12 +1070,12 @@ make_ip4_setting (shvarFile *ifcfg, /* Handle DHCP settings */ if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) { - value = svGetValue (ifcfg, "DHCP_HOSTNAME"); + value = svGetValueString (ifcfg, "DHCP_HOSTNAME"); if (value && *value) g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL); g_free (value); - value = svGetValue (ifcfg, "DHCP_FQDN"); + value = svGetValueString (ifcfg, "DHCP_FQDN"); if (value && *value) { g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NULL, @@ -1089,7 +1089,7 @@ make_ip4_setting (shvarFile *ifcfg, NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, svGetValueInt64 (ifcfg, "IPV4_DHCP_TIMEOUT", 10, 0, G_MAXINT32, 0), NULL); - value = svGetValue (ifcfg, "DHCP_CLIENT_ID"); + value = svGetValueString (ifcfg, "DHCP_CLIENT_ID"); if (value && strlen (value)) g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL); g_free (value); @@ -1152,7 +1152,7 @@ make_ip4_setting (shvarFile *ifcfg, char *tag; tag = g_strdup_printf ("DNS%u", i); - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); if (value) { if (nm_utils_ipaddr_valid (AF_INET, value)) { if (!nm_setting_ip_config_add_dns (s_ip4, value)) @@ -1173,7 +1173,7 @@ make_ip4_setting (shvarFile *ifcfg, } /* DNS searches */ - value = svGetValue (ifcfg, "DOMAIN"); + value = svGetValueString (ifcfg, "DOMAIN"); if (value) { char **searches = NULL; @@ -1192,7 +1192,7 @@ make_ip4_setting (shvarFile *ifcfg, } /* DNS options */ - value = svGetValueFull (ifcfg, "RES_OPTIONS"); + value = svGetValue (ifcfg, "RES_OPTIONS"); parse_dns_options (s_ip4, value); parse_dns_options (s_ip4, dns_options); g_free (value); @@ -1240,7 +1240,7 @@ make_ip4_setting (shvarFile *ifcfg, /* Legacy value NM used for a while but is incorrect (rh #459370) */ if (!nm_setting_ip_config_get_num_dns_searches (s_ip4)) { - value = svGetValue (ifcfg, "SEARCH"); + value = svGetValueString (ifcfg, "SEARCH"); if (value) { char **searches = NULL; @@ -1328,7 +1328,7 @@ read_aliases (NMSettingIPConfig *s_ip4, const char *filename) continue; } - device = svGetValue (parsed, "DEVICE"); + device = svGetValueString (parsed, "DEVICE"); if (!device) { PARSE_WARNING ("alias file '%s' has no DEVICE", full_path); svCloseFile (parsed); @@ -1415,10 +1415,10 @@ make_ip6_setting (shvarFile *ifcfg, char *default_dev = NULL; /* Get the connection ifcfg device name and the global default route device */ - value = svGetValue (ifcfg, "DEVICE"); - ipv6_defaultgw = svGetValue (network_ifcfg, "IPV6_DEFAULTGW"); - ipv6_defaultdev = svGetValue (network_ifcfg, "IPV6_DEFAULTDEV"); - dns_options = svGetValueFull (network_ifcfg, "RES_OPTIONS"); + value = svGetValueString (ifcfg, "DEVICE"); + ipv6_defaultgw = svGetValueString (network_ifcfg, "IPV6_DEFAULTGW"); + ipv6_defaultdev = svGetValueString (network_ifcfg, "IPV6_DEFAULTDEV"); + dns_options = svGetValue (network_ifcfg, "RES_OPTIONS"); if (ipv6_defaultgw) { default_dev = strchr (ipv6_defaultgw, '%'); @@ -1442,7 +1442,7 @@ make_ip6_setting (shvarFile *ifcfg, /* Find out method property */ /* Is IPV6 enabled? Set method to "ignored", when not enabled */ - str_value = svGetValue (ifcfg, "IPV6INIT"); + str_value = svGetValueString (ifcfg, "IPV6INIT"); ipv6init = svGetValueBoolean (ifcfg, "IPV6INIT", FALSE); if (!str_value) { network_ifcfg = svOpenFile (network_file, NULL); @@ -1466,9 +1466,9 @@ make_ip6_setting (shvarFile *ifcfg, method = NM_SETTING_IP6_CONFIG_METHOD_DHCP; else { /* IPV6_AUTOCONF=no and no IPv6 address -> method 'link-local' */ - str_value = svGetValue (ifcfg, "IPV6ADDR"); + str_value = svGetValueString (ifcfg, "IPV6ADDR"); if (!str_value) - str_value = svGetValue (ifcfg, "IPV6ADDR_SECONDARIES"); + str_value = svGetValueString (ifcfg, "IPV6ADDR_SECONDARIES"); if (!str_value) method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; @@ -1478,7 +1478,7 @@ make_ip6_setting (shvarFile *ifcfg, /* TODO - handle other methods */ /* Read IPv6 Privacy Extensions configuration */ - tmp = svGetValue (ifcfg, "IPV6_PRIVACY"); + tmp = svGetValueString (ifcfg, "IPV6_PRIVACY"); if (tmp) { ip6_privacy = svGetValueBoolean (ifcfg, "IPV6_PRIVACY", FALSE); if (!ip6_privacy) @@ -1511,7 +1511,7 @@ make_ip6_setting (shvarFile *ifcfg, if ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { /* METHOD_AUTO may trigger DHCPv6, so save the hostname to send to DHCP */ - value = svGetValue (ifcfg, "DHCP_HOSTNAME"); + value = svGetValueString (ifcfg, "DHCP_HOSTNAME"); if (value && value[0]) g_object_set (s_ip6, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL); g_free (value); @@ -1522,8 +1522,8 @@ make_ip6_setting (shvarFile *ifcfg, * added to the automatic ones. Note that this is not currently supported by * the legacy 'network' service (ifup-eth). */ - ipv6addr = svGetValue (ifcfg, "IPV6ADDR"); - ipv6addr_secondaries = svGetValue (ifcfg, "IPV6ADDR_SECONDARIES"); + ipv6addr = svGetValueString (ifcfg, "IPV6ADDR"); + ipv6addr_secondaries = svGetValueString (ifcfg, "IPV6ADDR_SECONDARIES"); value = g_strjoin (ipv6addr && ipv6addr_secondaries ? " " : NULL, ipv6addr ? ipv6addr : "", @@ -1550,12 +1550,12 @@ make_ip6_setting (shvarFile *ifcfg, /* Gateway */ if (nm_setting_ip_config_get_num_addresses (s_ip6)) { - value = svGetValue (ifcfg, "IPV6_DEFAULTGW"); + value = svGetValueString (ifcfg, "IPV6_DEFAULTGW"); if (!value) { /* If no gateway in the ifcfg, try global /etc/sysconfig/network instead */ network_ifcfg = svOpenFile (network_file, NULL); if (network_ifcfg) { - value = svGetValue (network_ifcfg, "IPV6_DEFAULTGW"); + value = svGetValueString (network_ifcfg, "IPV6_DEFAULTGW"); svCloseFile (network_ifcfg); } } @@ -1576,7 +1576,7 @@ make_ip6_setting (shvarFile *ifcfg, } /* IPv6 addressing mode configuration */ - tmp = svGetValue (ifcfg, "IPV6_ADDR_GEN_MODE"); + tmp = svGetValueString (ifcfg, "IPV6_ADDR_GEN_MODE"); if (tmp) { if (nm_utils_enum_from_str (nm_setting_ip6_config_addr_gen_mode_get_type (), tmp, (int *) &addr_gen_mode, NULL)) @@ -1592,7 +1592,7 @@ make_ip6_setting (shvarFile *ifcfg, } /* IPv6 tokenized interface identifier */ - tmp = svGetValue (ifcfg, "IPV6_TOKEN"); + tmp = svGetValueString (ifcfg, "IPV6_TOKEN"); if (tmp) { g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, tmp, NULL); g_free (tmp); @@ -1605,7 +1605,7 @@ make_ip6_setting (shvarFile *ifcfg, char *tag; tag = g_strdup_printf ("DNS%u", i); - value = svGetValue (ifcfg, tag); + value = svGetValueString (ifcfg, tag); if (!value) { g_free (tag); break; /* all done */ @@ -1639,7 +1639,7 @@ make_ip6_setting (shvarFile *ifcfg, } /* DNS options */ - value = svGetValueFull (ifcfg, "RES_OPTIONS"); + value = svGetValue (ifcfg, "RES_OPTIONS"); parse_dns_options (s_ip6, value); parse_dns_options (s_ip6, dns_options); g_free (value); @@ -1667,7 +1667,7 @@ check_if_bond_slave (shvarFile *ifcfg, { char *value; - value = svGetValue (ifcfg, "MASTER"); + value = svGetValueString (ifcfg, "MASTER"); if (value) { g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); g_object_set (s_con, @@ -1687,7 +1687,7 @@ check_if_team_slave (shvarFile *ifcfg, { gs_free char *value = NULL; - value = svGetValue (ifcfg, "TEAM_MASTER"); + value = svGetValueString (ifcfg, "TEAM_MASTER"); if (!value) return FALSE; g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); @@ -1762,7 +1762,7 @@ read_dcb_app (shvarFile *ifcfg, /* Priority */ tmp = g_strdup_printf ("DCB_APP_%s_PRIORITY", app); - val = svGetValue (ifcfg, tmp); + val = svGetValueString (ifcfg, tmp); if (val) { priority = _nm_utils_ascii_str_to_int64 (val, 0, 0, 7, -1); if (priority < 0) { @@ -1803,7 +1803,7 @@ read_dcb_bool_array (shvarFile *ifcfg, gboolean success = FALSE; guint i; - val = svGetValue (ifcfg, prop); + val = svGetValueString (ifcfg, prop); if (!val) return TRUE; @@ -1854,7 +1854,7 @@ read_dcb_uint_array (shvarFile *ifcfg, gboolean success = FALSE; guint i; - val = svGetValue (ifcfg, prop); + val = svGetValueString (ifcfg, prop); if (!val) return TRUE; @@ -1908,7 +1908,7 @@ read_dcb_percent_array (shvarFile *ifcfg, char **split = NULL, **iter; guint i, sum = 0; - val = svGetValue (ifcfg, prop); + val = svGetValueString (ifcfg, prop); if (!val) return TRUE; @@ -1986,7 +1986,7 @@ make_dcb_setting (shvarFile *ifcfg, return FALSE; } if (nm_setting_dcb_get_app_fcoe_flags (s_dcb) & NM_SETTING_DCB_FLAG_ENABLE) { - val = svGetValue (ifcfg, KEY_DCB_APP_FCOE_MODE); + val = svGetValueString (ifcfg, KEY_DCB_APP_FCOE_MODE); if (val) { if (strcmp (val, NM_SETTING_DCB_FCOE_MODE_FABRIC) == 0 || strcmp (val, NM_SETTING_DCB_FCOE_MODE_VN2VN) == 0) @@ -2123,7 +2123,7 @@ add_one_wep_key (shvarFile *ifcfg, g_return_val_if_fail (key_idx <= 3, FALSE); g_return_val_if_fail (s_wsec != NULL, FALSE); - value = svGetValue (ifcfg, shvar_key); + value = svGetValueString (ifcfg, shvar_key); if (!value || !strlen (value)) { g_free (value); return TRUE; @@ -2230,7 +2230,7 @@ read_secret_flags (shvarFile *ifcfg, const char *flags_key) g_return_val_if_fail (flags_key[0] != '\0', NM_SETTING_SECRET_FLAG_NONE); g_return_val_if_fail (g_str_has_suffix (flags_key, "_FLAGS"), NM_SETTING_SECRET_FLAG_NONE); - val = svGetValue (ifcfg, flags_key); + val = svGetValueString (ifcfg, flags_key); if (val) { if (strstr (val, SECRET_FLAG_AGENT)) flags |= NM_SETTING_SECRET_FLAG_AGENT_OWNED; @@ -2259,7 +2259,7 @@ make_wep_setting (shvarFile *ifcfg, s_wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); g_object_set (s_wsec, NM_SETTING_WIRELESS_SECURITY_KEY_MGMT, "none", NULL); - value = svGetValue (ifcfg, "DEFAULTKEY"); + value = svGetValueString (ifcfg, "DEFAULTKEY"); if (value) { default_key_idx = _nm_utils_ascii_str_to_int64 (value, 0, 1, 4, 0); if (default_key_idx == 0) { @@ -2295,7 +2295,7 @@ make_wep_setting (shvarFile *ifcfg, } } - value = svGetValue (ifcfg, "SECURITYMODE"); + value = svGetValueString (ifcfg, "SECURITYMODE"); if (value) { char *lcase; @@ -2358,7 +2358,7 @@ fill_wpa_ciphers (shvarFile *ifcfg, char **list = NULL, **iter; int i = 0; - p = value = svGetValue (ifcfg, group ? "CIPHER_GROUP" : "CIPHER_PAIRWISE"); + p = value = svGetValueString (ifcfg, group ? "CIPHER_GROUP" : "CIPHER_PAIRWISE"); if (!value) return TRUE; @@ -2428,13 +2428,13 @@ parse_wpa_psk (shvarFile *ifcfg, /* Try to get keys from the "shadow" key file */ keys_ifcfg = utils_get_keys_ifcfg (file, FALSE); if (keys_ifcfg) { - psk = svGetValue (keys_ifcfg, "WPA_PSK"); + psk = svGetValueString (keys_ifcfg, "WPA_PSK"); svCloseFile (keys_ifcfg); } /* Fall back to the original ifcfg */ if (!psk) - psk = svGetValue (ifcfg, "WPA_PSK"); + psk = svGetValueString (ifcfg, "WPA_PSK"); if (!psk) return NULL; @@ -2471,7 +2471,7 @@ eap_simple_reader (const char *eap_method, NMSettingSecretFlags flags; char *value; - value = svGetValue (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_IDENTITY for EAP method '%s'.", @@ -2486,10 +2486,10 @@ eap_simple_reader (const char *eap_method, /* Only read the password if it's system-owned */ if (flags == NM_SETTING_SECRET_FLAG_NONE) { - value = svGetValue (ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueString (ifcfg, "IEEE_8021X_PASSWORD"); if (!value && keys) { /* Try the lookaside keys file */ - value = svGetValue (keys, "IEEE_8021X_PASSWORD"); + value = svGetValueString (keys, "IEEE_8021X_PASSWORD"); } if (!value) { @@ -2552,7 +2552,7 @@ eap_tls_reader (const char *eap_method, const char *pk_pw_flags_prop = phase2 ? NM_SETTING_802_1X_PHASE2_PRIVATE_KEY_PASSWORD_FLAGS : NM_SETTING_802_1X_PRIVATE_KEY_PASSWORD_FLAGS; NMSettingSecretFlags flags; - value = svGetValue (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_IDENTITY for EAP method '%s'.", @@ -2562,7 +2562,7 @@ eap_tls_reader (const char *eap_method, g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); g_free (value); - ca_cert = svGetValue (ifcfg, ca_cert_key); + ca_cert = svGetValueString (ifcfg, ca_cert_key); if (ca_cert) { real_path = get_full_file_path (svFileGetName (ifcfg), ca_cert); if (phase2) { @@ -2594,10 +2594,10 @@ eap_tls_reader (const char *eap_method, /* Read the private key password if it's system-owned */ if (flags == NM_SETTING_SECRET_FLAG_NONE) { /* Private key password */ - privkey_password = svGetValue (ifcfg, pk_pw_key); + privkey_password = svGetValueString (ifcfg, pk_pw_key); if (!privkey_password && keys) { /* Try the lookaside keys file */ - privkey_password = svGetValue (keys, pk_pw_key); + privkey_password = svGetValueString (keys, pk_pw_key); } if (!privkey_password) { @@ -2610,7 +2610,7 @@ eap_tls_reader (const char *eap_method, } /* The private key itself */ - privkey = svGetValue (ifcfg, pk_key); + privkey = svGetValueString (ifcfg, pk_key); if (!privkey) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing %s for EAP method '%s'.", @@ -2647,7 +2647,7 @@ eap_tls_reader (const char *eap_method, */ if ( privkey_format == NM_SETTING_802_1X_CK_FORMAT_RAW_KEY || privkey_format == NM_SETTING_802_1X_CK_FORMAT_X509) { - client_cert = svGetValue (ifcfg, cli_cert_key); + client_cert = svGetValueString (ifcfg, cli_cert_key); if (!client_cert) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing %s for EAP method '%s'.", @@ -2704,7 +2704,7 @@ eap_peap_reader (const char *eap_method, char **list = NULL, **iter; gboolean success = FALSE; - ca_cert = svGetValue (ifcfg, "IEEE_8021X_CA_CERT"); + ca_cert = svGetValueString (ifcfg, "IEEE_8021X_CA_CERT"); if (ca_cert) { real_cert_path = get_full_file_path (svFileGetName (ifcfg), ca_cert); if (!nm_setting_802_1x_set_ca_cert (s_8021x, @@ -2718,7 +2718,7 @@ eap_peap_reader (const char *eap_method, eap_method); } - peapver = svGetValue (ifcfg, "IEEE_8021X_PEAP_VERSION"); + peapver = svGetValueString (ifcfg, "IEEE_8021X_PEAP_VERSION"); if (peapver) { if (!strcmp (peapver, "0")) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPVER, "0", NULL); @@ -2735,11 +2735,11 @@ eap_peap_reader (const char *eap_method, if (svGetValueBoolean (ifcfg, "IEEE_8021X_PEAP_FORCE_NEW_LABEL", FALSE)) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPLABEL, "1", NULL); - anon_ident = svGetValue (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident && strlen (anon_ident)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - inner_auth = svGetValue (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + inner_auth = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); if (!inner_auth) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_INNER_AUTH_METHODS."); @@ -2808,7 +2808,7 @@ eap_ttls_reader (const char *eap_method, char *tmp; char **list = NULL, **iter; - ca_cert = svGetValue (ifcfg, "IEEE_8021X_CA_CERT"); + ca_cert = svGetValueString (ifcfg, "IEEE_8021X_CA_CERT"); if (ca_cert) { real_cert_path = get_full_file_path (svFileGetName (ifcfg), ca_cert); if (!nm_setting_802_1x_set_ca_cert (s_8021x, @@ -2822,11 +2822,11 @@ eap_ttls_reader (const char *eap_method, eap_method); } - anon_ident = svGetValue (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident && strlen (anon_ident)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - tmp = svGetValue (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + tmp = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); if (!tmp) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_INNER_AUTH_METHODS."); @@ -2899,13 +2899,13 @@ eap_fast_reader (const char *eap_method, gboolean allow_unauth = FALSE, allow_auth = FALSE; gboolean success = FALSE; - pac_file = svGetValue (ifcfg, "IEEE_8021X_PAC_FILE"); + pac_file = svGetValueString (ifcfg, "IEEE_8021X_PAC_FILE"); if (pac_file) { real_pac_path = get_full_file_path (svFileGetName (ifcfg), pac_file); g_object_set (s_8021x, NM_SETTING_802_1X_PAC_FILE, real_pac_path, NULL); } - fast_provisioning = svGetValue (ifcfg, "IEEE_8021X_FAST_PROVISIONING"); + fast_provisioning = svGetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING"); if (fast_provisioning) { list = g_strsplit_set (fast_provisioning, " \t", 0); for (iter = list; iter && *iter; iter++) { @@ -2933,11 +2933,11 @@ eap_fast_reader (const char *eap_method, goto done; } - anon_ident = svGetValue (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident && strlen (anon_ident)) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - inner_auth = svGetValue (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + inner_auth = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); if (!inner_auth) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_INNER_AUTH_METHODS."); @@ -3024,7 +3024,7 @@ read_8021x_list_value (shvarFile *ifcfg, g_return_if_fail (ifcfg_var_name != NULL); g_return_if_fail (prop_name != NULL); - value = svGetValue (ifcfg, ifcfg_var_name); + value = svGetValueString (ifcfg, ifcfg_var_name); if (!value) return; @@ -3047,7 +3047,7 @@ fill_8021x (shvarFile *ifcfg, char *value; char **list = NULL, **iter; - value = svGetValue (ifcfg, "IEEE_8021X_EAP_METHODS"); + value = svGetValueString (ifcfg, "IEEE_8021X_EAP_METHODS"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing IEEE_8021X_EAP_METHODS for key management '%s'", @@ -3108,11 +3108,11 @@ fill_8021x (shvarFile *ifcfg, goto error; } - value = svGetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH"); + value = svGetValueString (ifcfg, "IEEE_8021X_SUBJECT_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_SUBJECT_MATCH, value, NULL); g_free (value); - value = svGetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH"); + value = svGetValueString (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, value, NULL); g_free (value); @@ -3121,10 +3121,10 @@ fill_8021x (shvarFile *ifcfg, read_8021x_list_value (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", s_8021x, NM_SETTING_802_1X_PHASE2_ALTSUBJECT_MATCHES); - value = svGetValue (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH"); + value = svGetValueString (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, value, NULL); g_free (value); - value = svGetValue (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH"); + value = svGetValueString (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_DOMAIN_SUFFIX_MATCH, value, NULL); g_free (value); @@ -3157,7 +3157,7 @@ make_wpa_setting (shvarFile *ifcfg, wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); - value = svGetValue (ifcfg, "KEY_MGMT"); + value = svGetValueString (ifcfg, "KEY_MGMT"); wpa_psk = !g_strcmp0 (value, "WPA-PSK"); wpa_eap = !g_strcmp0 (value, "WPA-EAP"); ieee8021x = !g_strcmp0 (value, "IEEE8021X"); @@ -3177,8 +3177,8 @@ make_wpa_setting (shvarFile *ifcfg, } else { char *allow_wpa, *allow_rsn; - allow_wpa = svGetValue (ifcfg, "WPA_ALLOW_WPA"); - allow_rsn = svGetValue (ifcfg, "WPA_ALLOW_WPA2"); + allow_wpa = svGetValueString (ifcfg, "WPA_ALLOW_WPA"); + allow_rsn = svGetValueString (ifcfg, "WPA_ALLOW_WPA2"); if (allow_wpa && svGetValueBoolean (ifcfg, "WPA_ALLOW_WPA", TRUE)) nm_setting_wireless_security_add_proto (wsec, "wpa"); @@ -3232,7 +3232,7 @@ make_wpa_setting (shvarFile *ifcfg, g_free (value); - value = svGetValue (ifcfg, "SECURITYMODE"); + value = svGetValueString (ifcfg, "SECURITYMODE"); if (NM_IN_STRSET (value, NULL, "open")) g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, value, NULL); @@ -3258,12 +3258,12 @@ make_leap_setting (shvarFile *ifcfg, wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); - value = svGetValue (ifcfg, "KEY_MGMT"); + value = svGetValueString (ifcfg, "KEY_MGMT"); if (!value || strcmp (value, "IEEE8021X")) goto error; /* Not LEAP */ g_free (value); - value = svGetValue (ifcfg, "SECURITYMODE"); + value = svGetValueString (ifcfg, "SECURITYMODE"); if (!value || strcasecmp (value, "leap")) goto error; /* Not LEAP */ @@ -3274,12 +3274,12 @@ make_leap_setting (shvarFile *ifcfg, /* Read LEAP password if it's system-owned */ if (flags == NM_SETTING_SECRET_FLAG_NONE) { - value = svGetValue (ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueString (ifcfg, "IEEE_8021X_PASSWORD"); if (!value) { /* Try to get keys from the "shadow" key file */ keys_ifcfg = utils_get_keys_ifcfg (file, FALSE); if (keys_ifcfg) { - value = svGetValue (keys_ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueString (keys_ifcfg, "IEEE_8021X_PASSWORD"); svCloseFile (keys_ifcfg); } } @@ -3288,7 +3288,7 @@ make_leap_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); if (!value || !strlen (value)) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing LEAP identity"); @@ -3380,25 +3380,25 @@ make_wireless_setting (shvarFile *ifcfg, s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); - value = svGetValue (ifcfg, "HWADDR"); + value = svGetValueString (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wireless, NM_SETTING_WIRELESS_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "MACADDR"); + value = svGetValueString (ifcfg, "MACADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wireless, NM_SETTING_WIRELESS_CLONED_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); + value = svGetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); g_object_set (s_wireless, NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK, value, NULL); g_free (value); - value = svGetValue (ifcfg, "HWADDR_BLACKLIST"); + value = svGetValueString (ifcfg, "HWADDR_BLACKLIST"); if (value) { char **strv; @@ -3408,7 +3408,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "ESSID"); + value = svGetValueString (ifcfg, "ESSID"); if (value) { gs_unref_bytes GBytes *bytes = NULL; gsize ssid_len = 0; @@ -3437,7 +3437,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "MODE"); + value = svGetValueString (ifcfg, "MODE"); if (value) { char *lcase; const char *mode = NULL; @@ -3463,14 +3463,14 @@ make_wireless_setting (shvarFile *ifcfg, g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, mode, NULL); } - value = svGetValue (ifcfg, "BSSID"); + value = svGetValueString (ifcfg, "BSSID"); if (value) { value = g_strstrip (value); g_object_set (s_wireless, NM_SETTING_WIRELESS_BSSID, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "CHANNEL"); + value = svGetValueString (ifcfg, "CHANNEL"); if (value) { errno = 0; chan = _nm_utils_ascii_str_to_int64 (value, 10, 1, 196, 0); @@ -3484,7 +3484,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "BAND"); + value = svGetValueString (ifcfg, "BAND"); if (value) { if (!strcmp (value, "a")) { if (chan && chan <= 14) { @@ -3515,7 +3515,7 @@ make_wireless_setting (shvarFile *ifcfg, g_object_set (s_wireless, NM_SETTING_WIRELESS_BAND, "bg", NULL); } - value = svGetValue (ifcfg, "MTU"); + value = svGetValueString (ifcfg, "MTU"); if (value) { int mtu; @@ -3535,7 +3535,7 @@ make_wireless_setting (shvarFile *ifcfg, svGetValueBoolean (ifcfg, "SSID_HIDDEN", FALSE), NULL); - value = svGetValueFull (ifcfg, "POWERSAVE"); + value = svGetValue (ifcfg, "POWERSAVE"); if (value) { if (!strcmp (value, "default")) powersave = NM_SETTING_WIRELESS_POWERSAVE_DEFAULT; @@ -3559,7 +3559,7 @@ make_wireless_setting (shvarFile *ifcfg, powersave, NULL); - value = svGetValueFull (ifcfg, "MAC_ADDRESS_RANDOMIZATION"); + value = svGetValue (ifcfg, "MAC_ADDRESS_RANDOMIZATION"); if (value) { if (strcmp (value, "default") == 0) mac_randomization = NM_SETTING_MAC_RANDOMIZATION_DEFAULT; @@ -3792,7 +3792,7 @@ make_wired_setting (shvarFile *ifcfg, s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); - value = svGetValue (ifcfg, "MTU"); + value = svGetValueString (ifcfg, "MTU"); if (value) { int mtu; @@ -3804,14 +3804,14 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "HWADDR"); + value = svGetValueString (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "SUBCHANNELS"); + value = svGetValueString (ifcfg, "SUBCHANNELS"); if (value) { const char *p = value; gboolean success = TRUE; @@ -3842,18 +3842,18 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "PORTNAME"); + value = svGetValueString (ifcfg, "PORTNAME"); if (value && strlen (value)) { nm_setting_wired_add_s390_option (s_wired, "portname", value); } g_free (value); - value = svGetValue (ifcfg, "CTCPROT"); + value = svGetValueString (ifcfg, "CTCPROT"); if (value && strlen (value)) nm_setting_wired_add_s390_option (s_wired, "ctcprot", value); g_free (value); - nettype = svGetValue (ifcfg, "NETTYPE"); + nettype = svGetValueString (ifcfg, "NETTYPE"); if (nettype && strlen (nettype)) { if (!strcmp (nettype, "qeth") || !strcmp (nettype, "lcs") || !strcmp (nettype, "ctc")) g_object_set (s_wired, NM_SETTING_WIRED_S390_NETTYPE, nettype, NULL); @@ -3862,7 +3862,7 @@ make_wired_setting (shvarFile *ifcfg, } g_free (nettype); - value = svGetValue (ifcfg, "OPTIONS"); + value = svGetValueString (ifcfg, "OPTIONS"); if (value && strlen (value)) { char **options, **iter; @@ -3883,18 +3883,18 @@ make_wired_setting (shvarFile *ifcfg, } g_free (value); - value = svGetValue (ifcfg, "MACADDR"); + value = svGetValueString (ifcfg, "MACADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wired, NM_SETTING_WIRED_CLONED_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); + value = svGetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); g_object_set (s_wired, NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK, value, NULL); g_free (value); - value = svGetValue (ifcfg, "HWADDR_BLACKLIST"); + value = svGetValueString (ifcfg, "HWADDR_BLACKLIST"); if (value) { char **strv; @@ -3904,7 +3904,7 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "KEY_MGMT"); + value = svGetValueString (ifcfg, "KEY_MGMT"); if (value) { if (!strcmp (value, "IEEE8021X")) { *s_8021x = fill_8021x (ifcfg, file, value, FALSE, error); @@ -3918,7 +3918,7 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueFull (ifcfg, "ETHTOOL_OPTS"); + value = svGetValue (ifcfg, "ETHTOOL_OPTS"); parse_ethtool_options (ifcfg, s_wired, value); g_free (value); @@ -3979,19 +3979,19 @@ parse_infiniband_p_key (shvarFile *ifcfg, int id; gboolean ret = FALSE; - device = svGetValue (ifcfg, "DEVICE"); + device = svGetValueString (ifcfg, "DEVICE"); if (!device) { PARSE_WARNING ("InfiniBand connection specified PKEY but not DEVICE"); goto done; } - physdev = svGetValue (ifcfg, "PHYSDEV"); + physdev = svGetValueString (ifcfg, "PHYSDEV"); if (!physdev) { PARSE_WARNING ("InfiniBand connection specified PKEY but not PHYSDEV"); goto done; } - pkey_id = svGetValue (ifcfg, "PKEY_ID"); + pkey_id = svGetValueString (ifcfg, "PKEY_ID"); if (!pkey_id) { PARSE_WARNING ("InfiniBand connection specified PKEY but not PKEY_ID"); goto done; @@ -4039,7 +4039,7 @@ make_infiniband_setting (shvarFile *ifcfg, s_infiniband = NM_SETTING_INFINIBAND (nm_setting_infiniband_new ()); - value = svGetValue (ifcfg, "MTU"); + value = svGetValueString (ifcfg, "MTU"); if (value) { int mtu; @@ -4051,7 +4051,7 @@ make_infiniband_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "HWADDR"); + value = svGetValueString (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_infiniband, NM_SETTING_INFINIBAND_MAC_ADDRESS, value, NULL); @@ -4151,7 +4151,7 @@ make_bond_setting (shvarFile *ifcfg, s_bond = NM_SETTING_BOND (nm_setting_bond_new ()); - value = svGetValue (ifcfg, "DEVICE"); + value = svGetValueString (ifcfg, "DEVICE"); if (!value || !strlen (value)) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4159,7 +4159,7 @@ make_bond_setting (shvarFile *ifcfg, } g_free (value); - value = svGetValue (ifcfg, "BONDING_OPTS"); + value = svGetValueString (ifcfg, "BONDING_OPTS"); if (value) { char **items, **iter; @@ -4243,7 +4243,7 @@ read_team_config (shvarFile *ifcfg, const char *key, GError **error) gs_free char *value = NULL; size_t l; - value = svGetValue (ifcfg, key); + value = svGetValueString (ifcfg, key); if (!value) return NULL; @@ -4273,7 +4273,7 @@ make_team_setting (shvarFile *ifcfg, s_team = NM_SETTING_TEAM (nm_setting_team_new ()); - value = svGetValue (ifcfg, "DEVICE"); + value = svGetValueString (ifcfg, "DEVICE"); if (!value || !strlen (value)) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4430,7 +4430,7 @@ make_bridge_setting (shvarFile *ifcfg, s_bridge = NM_SETTING_BRIDGE (nm_setting_bridge_new ()); - value = svGetValue (ifcfg, "DEVICE"); + value = svGetValueString (ifcfg, "DEVICE"); if (!value || !strlen (value)) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4438,14 +4438,14 @@ make_bridge_setting (shvarFile *ifcfg, } g_free (value); - value = svGetValue (ifcfg, "MACADDR"); + value = svGetValueString (ifcfg, "MACADDR"); if (value) { value = g_strstrip (value); g_object_set (s_bridge, NM_SETTING_BRIDGE_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValue (ifcfg, "STP"); + value = svGetValueString (ifcfg, "STP"); if (value) { if (!strcasecmp (value, "on") || !strcasecmp (value, "yes")) { g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, TRUE, NULL); @@ -4464,7 +4464,7 @@ make_bridge_setting (shvarFile *ifcfg, g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, FALSE, NULL); } - value = svGetValue (ifcfg, "DELAY"); + value = svGetValueString (ifcfg, "DELAY"); if (value) { if (stp) { if (get_uint (value, &u)) @@ -4476,7 +4476,7 @@ make_bridge_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValue (ifcfg, "BRIDGING_OPTS"); + value = svGetValueString (ifcfg, "BRIDGING_OPTS"); if (value) { handle_bridging_opts (NM_SETTING (s_bridge), stp, value, handle_bridge_option); g_free (value); @@ -4559,12 +4559,12 @@ make_bridge_port_setting (shvarFile *ifcfg) g_return_val_if_fail (ifcfg != NULL, FALSE); - value = svGetValue (ifcfg, "BRIDGE"); + value = svGetValueString (ifcfg, "BRIDGE"); if (value) { g_free (value); s_port = nm_setting_bridge_port_new (); - value = svGetValue (ifcfg, "BRIDGING_OPTS"); + value = svGetValueString (ifcfg, "BRIDGING_OPTS"); if (value) handle_bridging_opts (s_port, FALSE, value, handle_bridge_port_option); g_free (value); @@ -4641,7 +4641,7 @@ parse_prio_map_list (NMSettingVlan *s_vlan, char *value; gchar **list = NULL, **iter; - value = svGetValue (ifcfg, key); + value = svGetValueString (ifcfg, key); if (!value) return; @@ -4672,7 +4672,7 @@ make_vlan_setting (shvarFile *ifcfg, guint32 vlan_flags = 0; gint gvrp, reorder_hdr; - value = svGetValue (ifcfg, "VLAN_ID"); + value = svGetValueString (ifcfg, "VLAN_ID"); if (value) { vlan_id = _nm_utils_ascii_str_to_int64 (value, 10, 0, 4095, -1); if (vlan_id == -1) { @@ -4685,7 +4685,7 @@ make_vlan_setting (shvarFile *ifcfg, } /* Need DEVICE if we don't have a separate VLAN_ID property */ - iface_name = svGetValue (ifcfg, "DEVICE"); + iface_name = svGetValueString (ifcfg, "DEVICE"); if (!iface_name && vlan_id < 0) { g_set_error_literal (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing DEVICE property; cannot determine VLAN ID."); @@ -4695,7 +4695,7 @@ make_vlan_setting (shvarFile *ifcfg, s_vlan = NM_SETTING_VLAN (nm_setting_vlan_new ()); /* Parent interface from PHYSDEV takes precedence if it exists */ - parent = svGetValue (ifcfg, "PHYSDEV"); + parent = svGetValueString (ifcfg, "PHYSDEV"); if (iface_name) { p = strchr (iface_name, '.'); @@ -4751,7 +4751,7 @@ make_vlan_setting (shvarFile *ifcfg, if (gvrp > 0) vlan_flags |= NM_VLAN_FLAG_GVRP; - value = svGetValue (ifcfg, "VLAN_FLAGS"); + value = svGetValueString (ifcfg, "VLAN_FLAGS"); if (value) { gs_strfreev char **strv = NULL; char **ptr; @@ -4862,7 +4862,7 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg, nm_connection_add_setting (connection, nm_setting_generic_new ()); /* Get a spec */ - value = svGetValue (ifcfg, "HWADDR"); + value = svGetValueString (ifcfg, "HWADDR"); if (value) { char *lower = g_ascii_strdown (value, -1); *out_spec = g_strdup_printf ("%s:mac:%s", type, lower); @@ -4871,14 +4871,14 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg, return connection; } - value = svGetValue (ifcfg, "SUBCHANNELS"); + value = svGetValueString (ifcfg, "SUBCHANNELS"); if (value) { *out_spec = g_strdup_printf ("%s:s390-subchannels:%s", type, value); g_free (value); return connection; } - value = svGetValue (ifcfg, "DEVICE"); + value = svGetValueString (ifcfg, "DEVICE"); if (value) { *out_spec = g_strdup_printf ("%s:interface-name:%s", type, value); g_free (value); @@ -4907,7 +4907,7 @@ uuid_from_file (const char *filename) return NULL; /* Try for a UUID key before falling back to hashing the file name */ - uuid = svGetValue (ifcfg, "UUID"); + uuid = svGetValueString (ifcfg, "UUID"); if (!uuid || !strlen (uuid)) { g_free (uuid); uuid = nm_utils_uuid_generate_from_string (svFileGetName (ifcfg), -1, NM_UTILS_UUID_TYPE_LEGACY, NULL); @@ -4928,7 +4928,7 @@ check_dns_search_domains (shvarFile *ifcfg, NMSetting *s_ip4, NMSetting *s_ip6) */ if (!s_ip4 || nm_setting_ip_config_get_num_dns_searches (NM_SETTING_IP_CONFIG (s_ip4)) == 0) { /* DNS searches */ - char *value = svGetValue (ifcfg, "DOMAIN"); + char *value = svGetValueString (ifcfg, "DOMAIN"); if (value) { char **searches = g_strsplit (value, " ", 0); if (searches) { @@ -4988,7 +4988,7 @@ connection_from_file_full (const char *filename, } /* iBFT is handled by the iBFT settings plugin */ - bootproto = svGetValue (parsed, "BOOTPROTO"); + bootproto = svGetValueString (parsed, "BOOTPROTO"); if (bootproto && !g_ascii_strcasecmp (bootproto, "ibft")) { if (out_ignore_error) *out_ignore_error = TRUE; @@ -4999,7 +4999,7 @@ connection_from_file_full (const char *filename, } g_free (bootproto); - devtype = svGetValue (parsed, "DEVICETYPE"); + devtype = svGetValueString (parsed, "DEVICETYPE"); if (devtype) { if (!strcasecmp (devtype, TYPE_TEAM)) type = g_strdup (TYPE_TEAM); @@ -5013,19 +5013,19 @@ connection_from_file_full (const char *filename, /* Team and TeamPort types are also accepted by the mere * presense of TEAM_CONFIG/TEAM_MASTER. They don't require * DEVICETYPE. */ - t = svGetValue (parsed, "TEAM_CONFIG"); + t = svGetValueString (parsed, "TEAM_CONFIG"); if (t) type = g_strdup (TYPE_TEAM); } if (!type) - type = svGetValue (parsed, "TYPE"); + type = svGetValueString (parsed, "TYPE"); if (!type) { gs_free char *tmp = NULL; char *device; - if ((tmp = svGetValue (parsed, "IPV6TUNNELIPV4"))) { + if ((tmp = svGetValueString (parsed, "IPV6TUNNELIPV4"))) { if (out_ignore_error) *out_ignore_error = TRUE; g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, @@ -5033,7 +5033,7 @@ connection_from_file_full (const char *filename, goto done; } - device = svGetValue (parsed, "DEVICE"); + device = svGetValueString (parsed, "DEVICE"); if (!device) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "File '%s' had neither TYPE nor DEVICE keys.", filename); @@ -5247,7 +5247,7 @@ devtimeout_from_file (const char *filename) if (!ifcfg) return 0; - devtimeout_str = svGetValue (ifcfg, "DEVTIMEOUT"); + devtimeout_str = svGetValueString (ifcfg, "DEVTIMEOUT"); if (devtimeout_str) { devtimeout = _nm_utils_ascii_str_to_int64 (devtimeout_str, 10, 0, G_MAXUINT, 0); g_free (devtimeout_str); diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index e8cf3d231c..f098f1295e 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -98,7 +98,7 @@ save_secret_flags (shvarFile *ifcfg, g_string_append (str, SECRET_FLAG_NOT_REQUIRED); } - svSetValue (ifcfg, key, str->len ? str->str : NULL); + svSetValueString (ifcfg, key, str->len ? str->str : NULL); g_string_free (str, TRUE); } @@ -126,7 +126,7 @@ set_secret (shvarFile *ifcfg, /* Only write the secret if it's system owned and supposed to be saved */ if (flags == NM_SETTING_SECRET_FLAG_NONE) - svSetValue (keyfile, key, value); + svSetValueString (keyfile, key, value); else svUnsetValue (keyfile, key); @@ -142,7 +142,7 @@ set_secret (shvarFile *ifcfg, error: /* Try setting the secret in the actual ifcfg */ - svSetValue (ifcfg, key, value); + svSetValueString (ifcfg, key, value); } typedef struct ObjectType { @@ -277,7 +277,7 @@ write_object (NMSetting8021x *s_8021x, * may have been sent. */ if (path) { - svSetValue (ifcfg, objtype->ifcfg_key, path); + svSetValueString (ifcfg, objtype->ifcfg_key, path); return TRUE; } @@ -305,7 +305,7 @@ write_object (NMSetting8021x *s_8021x, 0600, &write_error); if (success) { - svSetValue (ifcfg, objtype->ifcfg_key, new_file); + svSetValueString (ifcfg, objtype->ifcfg_key, new_file); g_free (new_file); return TRUE; } else { @@ -379,9 +379,9 @@ write_8021x_certs (NMSetting8021x *s_8021x, /* Don't need a client certificate with PKCS#12 since the file is both * the client certificate and the private key in one file. */ - svSetValue (ifcfg, - phase2 ? "IEEE_8021X_INNER_CLIENT_CERT" : "IEEE_8021X_CLIENT_CERT", - NULL); + svSetValueString (ifcfg, + phase2 ? "IEEE_8021X_INNER_CLIENT_CERT" : "IEEE_8021X_CLIENT_CERT", + NULL); } else { /* Save the client certificate */ if (!write_object (s_8021x, ifcfg, phase2 ? &phase2_client_type : &client_type, error)) @@ -418,7 +418,7 @@ write_8021x_setting (NMConnection *connection, /* If wired, write KEY_MGMT */ if (wired) - svSetValue (ifcfg, "KEY_MGMT", "IEEE8021X"); + svSetValueString (ifcfg, "KEY_MGMT", "IEEE8021X"); /* EAP method */ if (nm_setting_802_1x_get_num_eap_methods (s_8021x)) { @@ -426,14 +426,14 @@ write_8021x_setting (NMConnection *connection, if (value) tmp = g_ascii_strup (value, -1); } - svSetValue (ifcfg, "IEEE_8021X_EAP_METHODS", tmp); + svSetValueString (ifcfg, "IEEE_8021X_EAP_METHODS", tmp); g_free (tmp); - svSetValue (ifcfg, "IEEE_8021X_IDENTITY", - nm_setting_802_1x_get_identity (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_IDENTITY", + nm_setting_802_1x_get_identity (s_8021x)); - svSetValue (ifcfg, "IEEE_8021X_ANON_IDENTITY", - nm_setting_802_1x_get_anonymous_identity (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY", + nm_setting_802_1x_get_anonymous_identity (s_8021x)); set_secret (ifcfg, "IEEE_8021X_PASSWORD", @@ -445,30 +445,30 @@ write_8021x_setting (NMConnection *connection, value = nm_setting_802_1x_get_phase1_peapver (s_8021x); svUnsetValue (ifcfg, "IEEE_8021X_PEAP_VERSION"); if (value && (!strcmp (value, "0") || !strcmp (value, "1"))) - svSetValue (ifcfg, "IEEE_8021X_PEAP_VERSION", value); + svSetValueString (ifcfg, "IEEE_8021X_PEAP_VERSION", value); /* Force new PEAP label */ value = nm_setting_802_1x_get_phase1_peaplabel (s_8021x); svUnsetValue (ifcfg, "IEEE_8021X_PEAP_FORCE_NEW_LABEL"); if (value && !strcmp (value, "1")) - svSetValue (ifcfg, "IEEE_8021X_PEAP_FORCE_NEW_LABEL", "yes"); + svSetValueString (ifcfg, "IEEE_8021X_PEAP_FORCE_NEW_LABEL", "yes"); /* PAC file */ value = nm_setting_802_1x_get_pac_file (s_8021x); svUnsetValue (ifcfg, "IEEE_8021X_PAC_FILE"); if (value) - svSetValue (ifcfg, "IEEE_8021X_PAC_FILE", value); + svSetValueString (ifcfg, "IEEE_8021X_PAC_FILE", value); /* FAST PAC provisioning */ value = nm_setting_802_1x_get_phase1_fast_provisioning (s_8021x); svUnsetValue (ifcfg, "IEEE_8021X_FAST_PROVISIONING"); if (value) { if (strcmp (value, "1") == 0) - svSetValue (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth"); + svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth"); else if (strcmp (value, "2") == 0) - svSetValue (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-auth"); + svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-auth"); else if (strcmp (value, "3") == 0) - svSetValue (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth allow-auth"); + svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth allow-auth"); } /* Phase2 auth methods */ @@ -492,16 +492,16 @@ write_8021x_setting (NMConnection *connection, g_free (tmp); } - svSetValue (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS", - phase2_auth->len ? phase2_auth->str : NULL); + svSetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS", + phase2_auth->len ? phase2_auth->str : NULL); g_string_free (phase2_auth, TRUE); - svSetValue (ifcfg, "IEEE_8021X_SUBJECT_MATCH", - nm_setting_802_1x_get_subject_match (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_SUBJECT_MATCH", + nm_setting_802_1x_get_subject_match (s_8021x)); - svSetValue (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH", - nm_setting_802_1x_get_phase2_subject_match (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH", + nm_setting_802_1x_get_phase2_subject_match (s_8021x)); svUnsetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES"); str = g_string_new (NULL); @@ -513,7 +513,7 @@ write_8021x_setting (NMConnection *connection, g_string_append (str, match); } if (str->len > 0) - svSetValue (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str); + svSetValueString (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str); g_string_free (str, TRUE); svUnsetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES"); @@ -526,13 +526,13 @@ write_8021x_setting (NMConnection *connection, g_string_append (str, match); } if (str->len > 0) - svSetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str); + svSetValueString (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str); g_string_free (str, TRUE); - svSetValue (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH", - nm_setting_802_1x_get_domain_suffix_match (s_8021x)); - svSetValue (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH", - nm_setting_802_1x_get_phase2_domain_suffix_match (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH", + nm_setting_802_1x_get_domain_suffix_match (s_8021x)); + svSetValueString (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH", + nm_setting_802_1x_get_phase2_domain_suffix_match (s_8021x)); success = write_8021x_certs (s_8021x, FALSE, ifcfg, error); if (success) { @@ -577,27 +577,27 @@ write_wireless_security_setting (NMConnection *connection, wep = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "wpa-none") || !strcmp (key_mgmt, "wpa-psk")) { - svSetValue (ifcfg, "KEY_MGMT", "WPA-PSK"); + svSetValueString (ifcfg, "KEY_MGMT", "WPA-PSK"); wpa = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "ieee8021x")) { - svSetValue (ifcfg, "KEY_MGMT", "IEEE8021X"); + svSetValueString (ifcfg, "KEY_MGMT", "IEEE8021X"); dynamic_wep = TRUE; } else if (!strcmp (key_mgmt, "wpa-eap")) { - svSetValue (ifcfg, "KEY_MGMT", "WPA-EAP"); + svSetValueString (ifcfg, "KEY_MGMT", "WPA-EAP"); wpa = TRUE; } svUnsetValue (ifcfg, "SECURITYMODE"); if (auth_alg) { if (!strcmp (auth_alg, "shared")) - svSetValue (ifcfg, "SECURITYMODE", "restricted"); + svSetValueString (ifcfg, "SECURITYMODE", "restricted"); else if (!strcmp (auth_alg, "open")) - svSetValue (ifcfg, "SECURITYMODE", "open"); + svSetValueString (ifcfg, "SECURITYMODE", "open"); else if (!strcmp (auth_alg, "leap")) { - svSetValue (ifcfg, "SECURITYMODE", "leap"); - svSetValue (ifcfg, "IEEE_8021X_IDENTITY", - nm_setting_wireless_security_get_leap_username (s_wsec)); + svSetValueString (ifcfg, "SECURITYMODE", "leap"); + svSetValueString (ifcfg, "IEEE_8021X_IDENTITY", + nm_setting_wireless_security_get_leap_username (s_wsec)); set_secret (ifcfg, "IEEE_8021X_PASSWORD", nm_setting_wireless_security_get_leap_password (s_wsec), @@ -627,7 +627,7 @@ write_wireless_security_setting (NMConnection *connection, if (wep) { /* Default WEP TX key index */ tmp = g_strdup_printf ("%d", nm_setting_wireless_security_get_wep_tx_keyidx (s_wsec) + 1); - svSetValue (ifcfg, "DEFAULTKEY", tmp); + svSetValueString (ifcfg, "DEFAULTKEY", tmp); g_free (tmp); for (i = 0; i < 4; i++) { @@ -683,9 +683,9 @@ write_wireless_security_setting (NMConnection *connection, for (i = 0; i < num; i++) { proto = nm_setting_wireless_security_get_proto (s_wsec, i); if (proto && !strcmp (proto, "wpa")) - svSetValue (ifcfg, "WPA_ALLOW_WPA", "yes"); + svSetValueString (ifcfg, "WPA_ALLOW_WPA", "yes"); else if (proto && !strcmp (proto, "rsn")) - svSetValue (ifcfg, "WPA_ALLOW_WPA2", "yes"); + svSetValueString (ifcfg, "WPA_ALLOW_WPA2", "yes"); } /* WPA Pairwise ciphers */ @@ -707,7 +707,7 @@ write_wireless_security_setting (NMConnection *connection, } } if (strlen (str->str) && (dynamic_wep == FALSE)) - svSetValue (ifcfg, "CIPHER_PAIRWISE", str->str); + svSetValueString (ifcfg, "CIPHER_PAIRWISE", str->str); g_string_free (str, TRUE); /* WPA Group ciphers */ @@ -723,7 +723,7 @@ write_wireless_security_setting (NMConnection *connection, g_free (tmp); } if (strlen (str->str) && (dynamic_wep == FALSE)) - svSetValue (ifcfg, "CIPHER_GROUP", str->str); + svSetValueString (ifcfg, "CIPHER_GROUP", str->str); g_string_free (str, TRUE); if (wpa) @@ -763,13 +763,13 @@ write_wireless_setting (NMConnection *connection, } device_mac = nm_setting_wireless_get_mac_address (s_wireless); - svSetValue (ifcfg, "HWADDR", device_mac); + svSetValueString (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless); - svSetValue (ifcfg, "MACADDR", cloned_mac); + svSetValueString (ifcfg, "MACADDR", cloned_mac); - svSetValue (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wireless_get_generate_mac_address_mask (s_wireless)); + svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", + nm_setting_wireless_get_generate_mac_address_mask (s_wireless)); svUnsetValue (ifcfg, "HWADDR_BLACKLIST"); macaddr_blacklist = nm_setting_wireless_get_mac_address_blacklist (s_wireless); @@ -777,7 +777,7 @@ write_wireless_setting (NMConnection *connection, char *blacklist_str; blacklist_str = g_strjoinv (" ", (char **) macaddr_blacklist); - svSetValue (ifcfg, "HWADDR_BLACKLIST", blacklist_str); + svSetValueString (ifcfg, "HWADDR_BLACKLIST", blacklist_str); g_free (blacklist_str); } @@ -785,7 +785,7 @@ write_wireless_setting (NMConnection *connection, mtu = nm_setting_wireless_get_mtu (s_wireless); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValue (ifcfg, "MTU", tmp); + svSetValueString (ifcfg, "MTU", tmp); g_free (tmp); } @@ -833,7 +833,7 @@ write_wireless_setting (NMConnection *connection, g_string_append (str, "0x"); for (i = 0; i < ssid_len; i++) g_string_append_printf (str, "%02X", ssid_data[i]); - svSetValue (ifcfg, "ESSID", str->str); + svSetValueString (ifcfg, "ESSID", str->str); g_string_free (str, TRUE); } else { char buf[33]; @@ -841,17 +841,17 @@ write_wireless_setting (NMConnection *connection, nm_assert (ssid_len <= 32); memcpy (buf, ssid_data, ssid_len); buf[ssid_len] = '\0'; - svSetValue (ifcfg, "ESSID", buf); + svSetValueString (ifcfg, "ESSID", buf); } mode = nm_setting_wireless_get_mode (s_wireless); if (!mode || !strcmp (mode, "infrastructure")) { - svSetValue (ifcfg, "MODE", "Managed"); + svSetValueString (ifcfg, "MODE", "Managed"); } else if (!strcmp (mode, "adhoc")) { - svSetValue (ifcfg, "MODE", "Ad-Hoc"); + svSetValueString (ifcfg, "MODE", "Ad-Hoc"); adhoc = TRUE; } else if (!strcmp (mode, "ap")) { - svSetValue (ifcfg, "MODE", "Ap"); + svSetValueString (ifcfg, "MODE", "Ap"); } else { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Invalid mode '%s' in '%s' setting", @@ -864,15 +864,15 @@ write_wireless_setting (NMConnection *connection, chan = nm_setting_wireless_get_channel (s_wireless); if (chan) { tmp = g_strdup_printf ("%u", chan); - svSetValue (ifcfg, "CHANNEL", tmp); + svSetValueString (ifcfg, "CHANNEL", tmp); g_free (tmp); } else { /* Band only set if channel is not, since channel implies band */ - svSetValue (ifcfg, "BAND", nm_setting_wireless_get_band (s_wireless)); + svSetValueString (ifcfg, "BAND", nm_setting_wireless_get_band (s_wireless)); } bssid = nm_setting_wireless_get_bssid (s_wireless); - svSetValue (ifcfg, "BSSID", bssid); + svSetValueString (ifcfg, "BSSID", bssid); /* Ensure DEFAULTKEY and SECURITYMODE are cleared unless there's security; * otherwise there's no way to detect WEP vs. open when WEP keys aren't @@ -918,17 +918,17 @@ write_wireless_setting (NMConnection *connection, g_free (keys_path); } - svSetValue (ifcfg, "SSID_HIDDEN", nm_setting_wireless_get_hidden (s_wireless) ? "yes" : NULL); + svSetValueString (ifcfg, "SSID_HIDDEN", nm_setting_wireless_get_hidden (s_wireless) ? "yes" : NULL); switch (nm_setting_wireless_get_powersave (s_wireless)) { case NM_SETTING_WIRELESS_POWERSAVE_IGNORE: - svSetValue (ifcfg, "POWERSAVE", "ignore"); + svSetValueString (ifcfg, "POWERSAVE", "ignore"); break; case NM_SETTING_WIRELESS_POWERSAVE_DISABLE: - svSetValue (ifcfg, "POWERSAVE", "disable"); + svSetValueString (ifcfg, "POWERSAVE", "disable"); break; case NM_SETTING_WIRELESS_POWERSAVE_ENABLE: - svSetValue (ifcfg, "POWERSAVE", "enable"); + svSetValueString (ifcfg, "POWERSAVE", "enable"); break; default: case NM_SETTING_WIRELESS_POWERSAVE_DEFAULT: @@ -939,18 +939,18 @@ write_wireless_setting (NMConnection *connection, svUnsetValue (ifcfg, "MAC_ADDRESS_RANDOMIZATION"); switch (nm_setting_wireless_get_mac_address_randomization (s_wireless)) { case NM_SETTING_MAC_RANDOMIZATION_DEFAULT: - svSetValue (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "default"); + svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "default"); break; case NM_SETTING_MAC_RANDOMIZATION_ALWAYS: - svSetValue (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "always"); + svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "always"); break; default: case NM_SETTING_MAC_RANDOMIZATION_NEVER: - svSetValue (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "never"); + svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "never"); break; } - svSetValue (ifcfg, "TYPE", TYPE_WIRELESS); + svSetValueString (ifcfg, "TYPE", TYPE_WIRELESS); return TRUE; } @@ -972,13 +972,13 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e } mac = nm_setting_infiniband_get_mac_address (s_infiniband); - svSetValue (ifcfg, "HWADDR", mac); + svSetValueString (ifcfg, "HWADDR", mac); svUnsetValue (ifcfg, "MTU"); mtu = nm_setting_infiniband_get_mtu (s_infiniband); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValue (ifcfg, "MTU", tmp); + svSetValueString (ifcfg, "MTU", tmp); g_free (tmp); } @@ -987,17 +987,17 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e p_key = nm_setting_infiniband_get_p_key (s_infiniband); if (p_key != -1) { - svSetValue (ifcfg, "PKEY", "yes"); + svSetValueString (ifcfg, "PKEY", "yes"); tmp = g_strdup_printf ("%u", p_key); - svSetValue (ifcfg, "PKEY_ID", tmp); + svSetValueString (ifcfg, "PKEY_ID", tmp); g_free (tmp); parent = nm_setting_infiniband_get_parent (s_infiniband); if (parent) - svSetValue (ifcfg, "PHYSDEV", parent); + svSetValueString (ifcfg, "PHYSDEV", parent); } - svSetValue (ifcfg, "TYPE", TYPE_INFINIBAND); + svSetValueString (ifcfg, "TYPE", TYPE_INFINIBAND); return TRUE; } @@ -1024,13 +1024,13 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } device_mac = nm_setting_wired_get_mac_address (s_wired); - svSetValue (ifcfg, "HWADDR", device_mac); + svSetValueString (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); - svSetValue (ifcfg, "MACADDR", cloned_mac); + svSetValueString (ifcfg, "MACADDR", cloned_mac); - svSetValue (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wired_get_generate_mac_address_mask (s_wired)); + svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", + nm_setting_wired_get_generate_mac_address_mask (s_wired)); svUnsetValue (ifcfg, "HWADDR_BLACKLIST"); macaddr_blacklist = nm_setting_wired_get_mac_address_blacklist (s_wired); @@ -1038,7 +1038,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) char *blacklist_str; blacklist_str = g_strjoinv (" ", (char **) macaddr_blacklist); - svSetValue (ifcfg, "HWADDR_BLACKLIST", blacklist_str); + svSetValueString (ifcfg, "HWADDR_BLACKLIST", blacklist_str); g_free (blacklist_str); } @@ -1046,7 +1046,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) mtu = nm_setting_wired_get_mtu (s_wired); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValue (ifcfg, "MTU", tmp); + svSetValueString (ifcfg, "MTU", tmp); g_free (tmp); } @@ -1062,24 +1062,24 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) tmp = g_strdup_printf ("%s,%s,%s", s390_subchannels[0], s390_subchannels[1], s390_subchannels[2]); } - svSetValue (ifcfg, "SUBCHANNELS", tmp); + svSetValueString (ifcfg, "SUBCHANNELS", tmp); g_free (tmp); } svUnsetValue (ifcfg, "NETTYPE"); nettype = nm_setting_wired_get_s390_nettype (s_wired); if (nettype) - svSetValue (ifcfg, "NETTYPE", nettype); + svSetValueString (ifcfg, "NETTYPE", nettype); svUnsetValue (ifcfg, "PORTNAME"); portname = nm_setting_wired_get_s390_option_by_key (s_wired, "portname"); if (portname) - svSetValue (ifcfg, "PORTNAME", portname); + svSetValueString (ifcfg, "PORTNAME", portname); svUnsetValue (ifcfg, "CTCPROT"); ctcprot = nm_setting_wired_get_s390_option_by_key (s_wired, "ctcprot"); if (ctcprot) - svSetValue (ifcfg, "CTCPROT", ctcprot); + svSetValueString (ifcfg, "CTCPROT", ctcprot); svUnsetValue (ifcfg, "OPTIONS"); num_opts = nm_setting_wired_get_num_s390_options (s_wired); @@ -1097,14 +1097,14 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_string_append_printf (str, "%s=%s", s390_key, s390_val); } if (str->len) - svSetValue (ifcfg, "OPTIONS", str->str); + svSetValueString (ifcfg, "OPTIONS", str->str); g_string_free (str, TRUE); } wol = nm_setting_wired_get_wake_on_lan (s_wired); wol_password = nm_setting_wired_get_wake_on_lan_password (s_wired); if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE) - svSetValueFull (ifcfg, "ETHTOOL_OPTS", ""); + svSetValue (ifcfg, "ETHTOOL_OPTS", ""); else if (wol == NM_SETTING_WIRED_WAKE_ON_LAN_DEFAULT) svUnsetValue (ifcfg, "ETHTOOL_OPTS"); else { @@ -1130,11 +1130,11 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (wol_password && NM_FLAGS_HAS (wol, NM_SETTING_WIRED_WAKE_ON_LAN_MAGIC)) g_string_append_printf (str, "s sopass %s", wol_password); - svSetValue (ifcfg, "ETHTOOL_OPTS", str->str); + svSetValueString (ifcfg, "ETHTOOL_OPTS", str->str); g_string_free (str, TRUE); } - svSetValue (ifcfg, "TYPE", TYPE_ETHERNET); + svSetValueString (ifcfg, "TYPE", TYPE_ETHERNET); return TRUE; } @@ -1176,18 +1176,18 @@ write_wired_for_virtual (NMConnection *connection, shvarFile *ifcfg) has_wired = TRUE; device_mac = nm_setting_wired_get_mac_address (s_wired); - svSetValue (ifcfg, "HWADDR", device_mac); + svSetValueString (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); - svSetValue (ifcfg, "MACADDR", cloned_mac); + svSetValueString (ifcfg, "MACADDR", cloned_mac); - svSetValue (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wired_get_generate_mac_address_mask (s_wired)); + svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", + nm_setting_wired_get_generate_mac_address_mask (s_wired)); mtu = nm_setting_wired_get_mtu (s_wired); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValue (ifcfg, "MTU", tmp); + svSetValueString (ifcfg, "MTU", tmp); g_free (tmp); } else svUnsetValue (ifcfg, "MTU"); @@ -1219,13 +1219,13 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, return FALSE; } - svSetValue (ifcfg, "VLAN", "yes"); - svSetValue (ifcfg, "TYPE", TYPE_VLAN); - svSetValue (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); - svSetValue (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan)); + svSetValueString (ifcfg, "VLAN", "yes"); + svSetValueString (ifcfg, "TYPE", TYPE_VLAN); + svSetValueString (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); + svSetValueString (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan)); tmp = g_strdup_printf ("%d", nm_setting_vlan_get_id (s_vlan)); - svSetValue (ifcfg, "VLAN_ID", tmp); + svSetValueString (ifcfg, "VLAN_ID", tmp); g_free (tmp); vlan_flags = nm_setting_vlan_get_flags (s_vlan); @@ -1239,16 +1239,16 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, if (!NM_FLAGS_HAS (vlan_flags, NM_VLAN_FLAG_REORDER_HEADERS)) nm_utils_strbuf_append (&s_buf_ptr, &s_buf_len, "%sNO_REORDER_HDR", s_buf[0] ? "," : ""); - svSetValue (ifcfg, "VLAN_FLAGS", s_buf); + svSetValueString (ifcfg, "VLAN_FLAGS", s_buf); svSetValueBoolean (ifcfg, "MVRP", NM_FLAGS_HAS (vlan_flags, NM_VLAN_FLAG_MVRP)); tmp = vlan_priority_maplist_to_stringlist (s_vlan, NM_VLAN_INGRESS_MAP); - svSetValue (ifcfg, "VLAN_INGRESS_PRIORITY_MAP", tmp); + svSetValueString (ifcfg, "VLAN_INGRESS_PRIORITY_MAP", tmp); g_free (tmp); tmp = vlan_priority_maplist_to_stringlist (s_vlan, NM_VLAN_EGRESS_MAP); - svSetValue (ifcfg, "VLAN_EGRESS_PRIORITY_MAP", tmp); + svSetValueString (ifcfg, "VLAN_EGRESS_PRIORITY_MAP", tmp); g_free (tmp); svUnsetValue (ifcfg, "HWADDR"); @@ -1281,7 +1281,7 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wir return FALSE; } - svSetValue (ifcfg, "DEVICE", iface); + svSetValueString (ifcfg, "DEVICE", iface); svUnsetValue (ifcfg, "BONDING_OPTS"); num_opts = nm_setting_bond_get_num_options (s_bond); @@ -1301,13 +1301,13 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wir } if (str->len) - svSetValue (ifcfg, "BONDING_OPTS", str->str); + svSetValueString (ifcfg, "BONDING_OPTS", str->str); g_string_free (str, TRUE); } - svSetValue (ifcfg, "TYPE", TYPE_BOND); - svSetValue (ifcfg, "BONDING_MASTER", "yes"); + svSetValueString (ifcfg, "TYPE", TYPE_BOND); + svSetValueString (ifcfg, "BONDING_MASTER", "yes"); *wired = write_wired_for_virtual (connection, ifcfg); @@ -1335,9 +1335,9 @@ write_team_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, return FALSE; } - svSetValue (ifcfg, "DEVICE", iface); + svSetValueString (ifcfg, "DEVICE", iface); config = nm_setting_team_get_config (s_team); - svSetValue (ifcfg, "TEAM_CONFIG", config); + svSetValueString (ifcfg, "TEAM_CONFIG", config); *wired = write_wired_for_virtual (connection, ifcfg); @@ -1403,24 +1403,24 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error return FALSE; } - svSetValue (ifcfg, "DEVICE", iface); + svSetValueString (ifcfg, "DEVICE", iface); svUnsetValue (ifcfg, "BRIDGING_OPTS"); svSetValueBoolean (ifcfg, "STP", FALSE); svUnsetValue (ifcfg, "DELAY"); mac = nm_setting_bridge_get_mac_address (s_bridge); - svSetValue (ifcfg, "MACADDR", mac); + svSetValueString (ifcfg, "MACADDR", mac); /* Bridge options */ opts = g_string_sized_new (32); if (nm_setting_bridge_get_stp (s_bridge)) { - svSetValue (ifcfg, "STP", "yes"); + svSetValueString (ifcfg, "STP", "yes"); i = nm_setting_bridge_get_forward_delay (s_bridge); if (i != get_setting_default_uint (NM_SETTING (s_bridge), NM_SETTING_BRIDGE_FORWARD_DELAY)) { s = g_strdup_printf ("%u", i); - svSetValue (ifcfg, "DELAY", s); + svSetValueString (ifcfg, "DELAY", s); g_free (s); } @@ -1456,10 +1456,10 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error } if (opts->len) - svSetValue (ifcfg, "BRIDGING_OPTS", opts->str); + svSetValueString (ifcfg, "BRIDGING_OPTS", opts->str); g_string_free (opts, TRUE); - svSetValue (ifcfg, "TYPE", TYPE_BRIDGE); + svSetValueString (ifcfg, "TYPE", TYPE_BRIDGE); return TRUE; } @@ -1498,7 +1498,7 @@ write_bridge_port_setting (NMConnection *connection, shvarFile *ifcfg, GError ** } if (opts->len) - svSetValue (ifcfg, "BRIDGING_OPTS", opts->str); + svSetValueString (ifcfg, "BRIDGING_OPTS", opts->str); g_string_free (opts, TRUE); return TRUE; @@ -1515,7 +1515,7 @@ write_team_port_setting (NMConnection *connection, shvarFile *ifcfg, GError **er return TRUE; config = nm_setting_team_port_get_config (s_port); - svSetValue (ifcfg, "TEAM_PORT_CONFIG", config); + svSetValueString (ifcfg, "TEAM_PORT_CONFIG", config); return TRUE; } @@ -1526,13 +1526,13 @@ write_dcb_flags (shvarFile *ifcfg, const char *tag, NMSettingDcbFlags flags) char prop[NM_STRLEN ("DCB_xxxxxxxxxxxxxxxxxxxxxxx_yyyyyyyyyyyyyyyyyyyy")]; nm_sprintf_buf (prop, "DCB_%s_ENABLE", tag); - svSetValue (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ENABLE) ? "yes" : NULL); + svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ENABLE) ? "yes" : NULL); nm_sprintf_buf (prop, "DCB_%s_ADVERTISE", tag); - svSetValue (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ADVERTISE) ? "yes" : NULL); + svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ADVERTISE) ? "yes" : NULL); nm_sprintf_buf (prop, "DCB_%s_WILLING", tag); - svSetValue (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_WILLING) ? "yes" : NULL); + svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_WILLING) ? "yes" : NULL); } static void @@ -1572,7 +1572,7 @@ write_dcb_bool_array (shvarFile *ifcfg, str[8] = 0; for (i = 0; i < 8; i++) str[i] = get_func (s_dcb, i) ? '1' : '0'; - svSetValue (ifcfg, key, str); + svSetValueString (ifcfg, key, str); } typedef guint (*DcbGetUintFunc) (NMSettingDcb *, guint); @@ -1602,7 +1602,7 @@ write_dcb_uint_array (shvarFile *ifcfg, else g_assert_not_reached (); } - svSetValue (ifcfg, key, str); + svSetValueString (ifcfg, key, str); } static void @@ -1626,7 +1626,7 @@ write_dcb_percent_array (shvarFile *ifcfg, g_string_append_c (str, ','); g_string_append_printf (str, "%d", get_func (s_dcb, i)); } - svSetValue (ifcfg, key, str->str); + svSetValueString (ifcfg, key, str->str); g_string_free (str, TRUE); } @@ -1670,13 +1670,13 @@ write_dcb_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } - svSetValue (ifcfg, "DCB", "yes"); + svSetValueString (ifcfg, "DCB", "yes"); write_dcb_app (ifcfg, "APP_FCOE", nm_setting_dcb_get_app_fcoe_flags (s_dcb), nm_setting_dcb_get_app_fcoe_priority (s_dcb)); if (nm_setting_dcb_get_app_fcoe_flags (s_dcb) & NM_SETTING_DCB_FLAG_ENABLE) - svSetValue (ifcfg, KEY_DCB_APP_FCOE_MODE, nm_setting_dcb_get_app_fcoe_mode (s_dcb)); + svSetValueString (ifcfg, KEY_DCB_APP_FCOE_MODE, nm_setting_dcb_get_app_fcoe_mode (s_dcb)); else svUnsetValue (ifcfg, KEY_DCB_APP_FCOE_MODE); @@ -1716,21 +1716,21 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) const char *v_bridge = NULL; const char *v_team_master = NULL; - svSetValue (ifcfg, "NAME", nm_setting_connection_get_id (s_con)); - svSetValue (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con)); - svSetValue (ifcfg, "STABLE_ID", nm_setting_connection_get_stable_id (s_con)); - svSetValue (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); + svSetValueString (ifcfg, "NAME", nm_setting_connection_get_id (s_con)); + svSetValueString (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con)); + svSetValueString (ifcfg, "STABLE_ID", nm_setting_connection_get_stable_id (s_con)); + svSetValueString (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); svSetValueBoolean (ifcfg, "ONBOOT", nm_setting_connection_get_autoconnect (s_con)); i_int = nm_setting_connection_get_autoconnect_priority (s_con); tmp = i_int != NM_SETTING_CONNECTION_AUTOCONNECT_PRIORITY_DEFAULT ? g_strdup_printf ("%d", i_int) : NULL; - svSetValue (ifcfg, "AUTOCONNECT_PRIORITY", tmp); + svSetValueString (ifcfg, "AUTOCONNECT_PRIORITY", tmp); g_free (tmp); i_int = nm_setting_connection_get_autoconnect_retries (s_con); tmp = i_int != -1 ? g_strdup_printf ("%d", i_int) : NULL; - svSetValue (ifcfg, "AUTOCONNECT_RETRIES", tmp); + svSetValueString (ifcfg, "AUTOCONNECT_RETRIES", tmp); g_free (tmp); /* Only save the value for master connections */ @@ -1740,9 +1740,9 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) || !g_strcmp0 (type, NM_SETTING_BRIDGE_SETTING_NAME)) { NMSettingConnectionAutoconnectSlaves autoconnect_slaves; autoconnect_slaves = nm_setting_connection_get_autoconnect_slaves (s_con); - svSetValue (ifcfg, "AUTOCONNECT_SLAVES", - autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES ? "yes" : - autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO ? "no" : NULL); + svSetValueString (ifcfg, "AUTOCONNECT_SLAVES", + autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES ? "yes" : + autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO ? "no" : NULL); } else svUnsetValue (ifcfg, "AUTOCONNECT_SLAVES"); @@ -1756,7 +1756,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) default: tmp = NULL; } - svSetValue (ifcfg, "LLDP", tmp); + svSetValueString (ifcfg, "LLDP", tmp); /* Permissions */ svUnsetValue (ifcfg, "USERS"); @@ -1776,11 +1776,11 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) if (nm_setting_connection_get_permission (s_con, i, NULL, &puser, NULL)) g_string_append (str, puser); } - svSetValue (ifcfg, "USERS", str->str); + svSetValueString (ifcfg, "USERS", str->str); g_string_free (str, TRUE); } - svSetValue (ifcfg, "ZONE", nm_setting_connection_get_zone(s_con)); + svSetValueString (ifcfg, "ZONE", nm_setting_connection_get_zone(s_con)); master = nm_setting_connection_get_master (s_con); if (master) { @@ -1795,15 +1795,15 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) } } - svSetValue (ifcfg, "MASTER", v_master); - svSetValue (ifcfg, "SLAVE", v_slave); - svSetValue (ifcfg, "BRIDGE", v_bridge); - svSetValue (ifcfg, "TEAM_MASTER", v_team_master); + svSetValueString (ifcfg, "MASTER", v_master); + svSetValueString (ifcfg, "SLAVE", v_slave); + svSetValueString (ifcfg, "BRIDGE", v_bridge); + svSetValueString (ifcfg, "TEAM_MASTER", v_team_master); if (nm_streq0 (type, NM_SETTING_TEAM_SETTING_NAME)) - svSetValue (ifcfg, "DEVICETYPE", TYPE_TEAM); + svSetValueString (ifcfg, "DEVICETYPE", TYPE_TEAM); else if (master && nm_setting_connection_is_slave_type (s_con, NM_SETTING_TEAM_SETTING_NAME)) - svSetValue (ifcfg, "DEVICETYPE", TYPE_TEAM_PORT); + svSetValueString (ifcfg, "DEVICETYPE", TYPE_TEAM_PORT); else svUnsetValue (ifcfg, "DEVICETYPE"); @@ -1825,23 +1825,23 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) if ((uuid = nm_setting_connection_get_secondary (s_con, i)) != NULL) g_string_append (str, uuid); } - svSetValue (ifcfg, "SECONDARY_UUIDS", str->str); + svSetValueString (ifcfg, "SECONDARY_UUIDS", str->str); g_string_free (str, TRUE); } svUnsetValue (ifcfg, "GATEWAY_PING_TIMEOUT"); if (nm_setting_connection_get_gateway_ping_timeout (s_con)) { tmp = g_strdup_printf ("%" G_GUINT32_FORMAT, nm_setting_connection_get_gateway_ping_timeout (s_con)); - svSetValue (ifcfg, "GATEWAY_PING_TIMEOUT", tmp); + svSetValueString (ifcfg, "GATEWAY_PING_TIMEOUT", tmp); g_free (tmp); } switch (nm_setting_connection_get_metered (s_con)) { case NM_METERED_YES: - svSetValue (ifcfg, "CONNECTION_METERED", "yes"); + svSetValueString (ifcfg, "CONNECTION_METERED", "yes"); break; case NM_METERED_NO: - svSetValue (ifcfg, "CONNECTION_METERED", "no"); + svSetValueString (ifcfg, "CONNECTION_METERED", "no"); break; default: svUnsetValue (ifcfg, "CONNECTION_METERED"); @@ -1921,19 +1921,19 @@ write_proxy_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) method = nm_setting_proxy_get_method (s_proxy); switch (method) { case NM_SETTING_PROXY_METHOD_AUTO: - svSetValue (ifcfg, "PROXY_METHOD", "auto"); + svSetValueString (ifcfg, "PROXY_METHOD", "auto"); pac_url = nm_setting_proxy_get_pac_url (s_proxy); if (pac_url) - svSetValue (ifcfg, "PAC_URL", pac_url); + svSetValueString (ifcfg, "PAC_URL", pac_url); pac_script = nm_setting_proxy_get_pac_script (s_proxy); if (pac_script) - svSetValue (ifcfg, "PAC_SCRIPT", pac_script); + svSetValueString (ifcfg, "PAC_SCRIPT", pac_script); break; case NM_SETTING_PROXY_METHOD_NONE: - svSetValue (ifcfg, "PROXY_METHOD", "none"); + svSetValueString (ifcfg, "PROXY_METHOD", "none"); break; } @@ -2019,13 +2019,13 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) - svSetValue (ifcfg, "BOOTPROTO", "dhcp"); + svSetValueString (ifcfg, "BOOTPROTO", "dhcp"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) - svSetValue (ifcfg, "BOOTPROTO", "none"); + svSetValueString (ifcfg, "BOOTPROTO", "none"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) - svSetValue (ifcfg, "BOOTPROTO", "autoip"); + svSetValueString (ifcfg, "BOOTPROTO", "autoip"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) - svSetValue (ifcfg, "BOOTPROTO", "shared"); + svSetValueString (ifcfg, "BOOTPROTO", "shared"); /* Clear out un-numbered IP address fields */ svUnsetValue (ifcfg, "IPADDR"); @@ -2072,10 +2072,10 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) gw_key = g_strdup_printf ("GATEWAY%d", n); } - svSetValue (ifcfg, addr_key, nm_ip_address_get_address (addr)); + svSetValueString (ifcfg, addr_key, nm_ip_address_get_address (addr)); tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); - svSetValue (ifcfg, prefix_key, tmp); + svSetValueString (ifcfg, prefix_key, tmp); g_free (tmp); svUnsetValue (ifcfg, netmask_key); @@ -2106,7 +2106,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_free (gw_key); } - svSetValue (ifcfg, "GATEWAY", nm_setting_ip_config_get_gateway (s_ip4)); + svSetValueString (ifcfg, "GATEWAY", nm_setting_ip_config_get_gateway (s_ip4)); num = nm_setting_ip_config_get_num_dns (s_ip4); for (i = 0; i < 254; i++) { @@ -2118,7 +2118,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svUnsetValue (ifcfg, addr_key); else { dns = nm_setting_ip_config_get_dns (s_ip4, i); - svSetValue (ifcfg, addr_key, dns); + svSetValueString (ifcfg, addr_key, dns); } g_free (addr_key); } @@ -2131,7 +2131,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_string_append_c (searches, ' '); g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip4, i)); } - svSetValue (ifcfg, "DOMAIN", searches->str); + svSetValueString (ifcfg, "DOMAIN", searches->str); g_string_free (searches, TRUE); } else svUnsetValue (ifcfg, "DOMAIN"); @@ -2148,25 +2148,25 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) value = nm_setting_ip_config_get_dhcp_hostname (s_ip4); if (value) - svSetValue (ifcfg, "DHCP_HOSTNAME", value); + svSetValueString (ifcfg, "DHCP_HOSTNAME", value); value = nm_setting_ip4_config_get_dhcp_fqdn (NM_SETTING_IP4_CONFIG (s_ip4)); if (value) - svSetValue (ifcfg, "DHCP_FQDN", value); + svSetValueString (ifcfg, "DHCP_FQDN", value); /* Missing DHCP_SEND_HOSTNAME means TRUE, and we prefer not write it explicitly * in that case, because it is NM-specific variable */ - svSetValue (ifcfg, "DHCP_SEND_HOSTNAME", - nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no"); + svSetValueString (ifcfg, "DHCP_SEND_HOSTNAME", + nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no"); value = nm_setting_ip4_config_get_dhcp_client_id (NM_SETTING_IP4_CONFIG (s_ip4)); if (value) - svSetValue (ifcfg, "DHCP_CLIENT_ID", value); + svSetValueString (ifcfg, "DHCP_CLIENT_ID", value); timeout = nm_setting_ip_config_get_dhcp_timeout (s_ip4); tmp = timeout ? g_strdup_printf ("%d", timeout) : NULL; - svSetValue (ifcfg, "IPV4_DHCP_TIMEOUT", tmp); + svSetValueString (ifcfg, "IPV4_DHCP_TIMEOUT", tmp); g_free (tmp); } @@ -2174,7 +2174,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) route_metric = nm_setting_ip_config_get_route_metric (s_ip4); tmp = route_metric != -1 ? g_strdup_printf ("%"G_GINT64_FORMAT, route_metric) : NULL; - svSetValue (ifcfg, "IPV4_ROUTE_METRIC", tmp); + svSetValueString (ifcfg, "IPV4_ROUTE_METRIC", tmp); g_free (tmp); /* Static routes - route-<name> file */ @@ -2217,14 +2217,14 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } else { route = nm_setting_ip_config_get_route (s_ip4, i); - svSetValue (routefile, addr_key, nm_ip_route_get_dest (route)); + svSetValueString (routefile, addr_key, nm_ip_route_get_dest (route)); memset (buf, 0, sizeof (buf)); netmask = nm_utils_ip4_prefix_to_netmask (nm_ip_route_get_prefix (route)); inet_ntop (AF_INET, (const void *) &netmask, &buf[0], sizeof (buf)); - svSetValue (routefile, netmask_key, &buf[0]); + svSetValueString (routefile, netmask_key, &buf[0]); - svSetValue (routefile, gw_key, nm_ip_route_get_next_hop (route)); + svSetValueString (routefile, gw_key, nm_ip_route_get_next_hop (route)); memset (buf, 0, sizeof (buf)); metric = nm_ip_route_get_metric (route); @@ -2232,7 +2232,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svUnsetValue (routefile, metric_key); else { tmp = g_strdup_printf ("%u", (guint32) metric); - svSetValue (routefile, metric_key, tmp); + svSetValueString (routefile, metric_key, tmp); g_free (tmp); } } @@ -2258,7 +2258,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (timeout < 0) svUnsetValue (ifcfg, "ARPING_WAIT"); else if (timeout == 0) - svSetValue (ifcfg, "ARPING_WAIT", "0"); + svSetValueString (ifcfg, "ARPING_WAIT", "0"); else { /* Round the value up to next integer */ svSetValueInt64 (ifcfg, "ARPING_WAIT", (timeout - 1) / 1000 + 1); @@ -2345,13 +2345,13 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) ifcfg = svCreateFile (path); g_free (path); - svSetValue (ifcfg, "DEVICE", label); + svSetValueString (ifcfg, "DEVICE", label); addr = nm_setting_ip_config_get_address (s_ip4, i); - svSetValue (ifcfg, "IPADDR", nm_ip_address_get_address (addr)); + svSetValueString (ifcfg, "IPADDR", nm_ip_address_get_address (addr)); tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); - svSetValue (ifcfg, "PREFIX", tmp); + svSetValueString (ifcfg, "PREFIX", tmp); g_free (tmp); svWriteFile (ifcfg, 0644, NULL); @@ -2452,31 +2452,31 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) value = nm_setting_ip_config_get_method (s_ip6); g_assert (value); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_IGNORE)) { - svSetValue (ifcfg, "IPV6INIT", "no"); + svSetValueString (ifcfg, "IPV6INIT", "no"); svUnsetValue (ifcfg, "DHCPV6C"); return TRUE; } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { - svSetValue (ifcfg, "IPV6INIT", "yes"); - svSetValue (ifcfg, "IPV6_AUTOCONF", "yes"); + svSetValueString (ifcfg, "IPV6INIT", "yes"); + svSetValueString (ifcfg, "IPV6_AUTOCONF", "yes"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { const char *hostname; - svSetValue (ifcfg, "IPV6INIT", "yes"); - svSetValue (ifcfg, "IPV6_AUTOCONF", "no"); - svSetValue (ifcfg, "DHCPV6C", "yes"); + svSetValueString (ifcfg, "IPV6INIT", "yes"); + svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueString (ifcfg, "DHCPV6C", "yes"); hostname = nm_setting_ip_config_get_dhcp_hostname (s_ip6); if (hostname) - svSetValue (ifcfg, "DHCP_HOSTNAME", hostname); + svSetValueString (ifcfg, "DHCP_HOSTNAME", hostname); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - svSetValue (ifcfg, "IPV6INIT", "yes"); - svSetValue (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueString (ifcfg, "IPV6INIT", "yes"); + svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) { - svSetValue (ifcfg, "IPV6INIT", "yes"); - svSetValue (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueString (ifcfg, "IPV6INIT", "yes"); + svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { - svSetValue (ifcfg, "IPV6INIT", "yes"); + svSetValueString (ifcfg, "IPV6INIT", "yes"); svUnsetValue (ifcfg, "DHCPV6C"); /* TODO */ } @@ -2499,9 +2499,9 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) nm_ip_address_get_address (addr), nm_ip_address_get_prefix (addr)); } - svSetValue (ifcfg, "IPV6ADDR", ip_str1->str); - svSetValue (ifcfg, "IPV6ADDR_SECONDARIES", ip_str2->str); - svSetValue (ifcfg, "IPV6_DEFAULTGW", nm_setting_ip_config_get_gateway (s_ip6)); + svSetValueString (ifcfg, "IPV6ADDR", ip_str1->str); + svSetValueString (ifcfg, "IPV6ADDR_SECONDARIES", ip_str2->str); + svSetValueString (ifcfg, "IPV6_DEFAULTGW", nm_setting_ip_config_get_gateway (s_ip6)); g_string_free (ip_str1, TRUE); g_string_free (ip_str2, TRUE); @@ -2516,7 +2516,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svUnsetValue (ifcfg, addr_key); else { dns = nm_setting_ip_config_get_dns (s_ip6, i); - svSetValue (ifcfg, addr_key, dns); + svSetValueString (ifcfg, addr_key, dns); } g_free (addr_key); } @@ -2525,14 +2525,14 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) num = nm_setting_ip_config_get_num_dns_searches (s_ip6); if (num > 0) { char *ip4_domains; - ip4_domains = svGetValue (ifcfg, "DOMAIN"); + ip4_domains = svGetValueString (ifcfg, "DOMAIN"); searches = g_string_new (ip4_domains); for (i = 0; i < num; i++) { if (searches->len > 0) g_string_append_c (searches, ' '); g_string_append (searches, nm_setting_ip_config_get_dns_search (s_ip6, i)); } - svSetValue (ifcfg, "DOMAIN", searches->str); + svSetValueString (ifcfg, "DOMAIN", searches->str); g_string_free (searches, TRUE); g_free (ip4_domains); } @@ -2540,26 +2540,26 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* handle IPV6_DEFROUTE */ /* IPV6_DEFROUTE has the opposite meaning from 'never-default' */ if (nm_setting_ip_config_get_never_default(s_ip6)) - svSetValue (ifcfg, "IPV6_DEFROUTE", "no"); + svSetValueString (ifcfg, "IPV6_DEFROUTE", "no"); else - svSetValue (ifcfg, "IPV6_DEFROUTE", "yes"); + svSetValueString (ifcfg, "IPV6_DEFROUTE", "yes"); svUnsetValue (ifcfg, "IPV6_PEERDNS"); svUnsetValue (ifcfg, "IPV6_PEERROUTES"); if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { - svSetValue (ifcfg, "IPV6_PEERDNS", - nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes"); + svSetValueString (ifcfg, "IPV6_PEERDNS", + nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : "yes"); - svSetValue (ifcfg, "IPV6_PEERROUTES", - nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes"); + svSetValueString (ifcfg, "IPV6_PEERROUTES", + nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : "yes"); } - svSetValue (ifcfg, "IPV6_FAILURE_FATAL", - nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes"); + svSetValueString (ifcfg, "IPV6_FAILURE_FATAL", + nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes"); route_metric = nm_setting_ip_config_get_route_metric (s_ip6); tmp = route_metric != -1 ? g_strdup_printf ("%"G_GINT64_FORMAT, route_metric) : NULL; - svSetValue (ifcfg, "IPV6_ROUTE_METRIC", tmp); + svSetValueString (ifcfg, "IPV6_ROUTE_METRIC", tmp); g_free (tmp); /* IPv6 Privacy Extensions */ @@ -2567,14 +2567,14 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svUnsetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP"); switch (nm_setting_ip6_config_get_ip6_privacy (NM_SETTING_IP6_CONFIG (s_ip6))){ case NM_SETTING_IP6_CONFIG_PRIVACY_DISABLED: - svSetValue (ifcfg, "IPV6_PRIVACY", "no"); + svSetValueString (ifcfg, "IPV6_PRIVACY", "no"); break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR: - svSetValue (ifcfg, "IPV6_PRIVACY", "rfc3041"); - svSetValue (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", "yes"); + svSetValueString (ifcfg, "IPV6_PRIVACY", "rfc3041"); + svSetValueString (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", "yes"); break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR: - svSetValue (ifcfg, "IPV6_PRIVACY", "rfc3041"); + svSetValueString (ifcfg, "IPV6_PRIVACY", "rfc3041"); break; default: break; @@ -2585,7 +2585,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (addr_gen_mode != NM_SETTING_IP6_CONFIG_ADDR_GEN_MODE_EUI64) { tmp = nm_utils_enum_to_str (nm_setting_ip6_config_addr_gen_mode_get_type (), addr_gen_mode); - svSetValue (ifcfg, "IPV6_ADDR_GEN_MODE", tmp); + svSetValueString (ifcfg, "IPV6_ADDR_GEN_MODE", tmp); g_free (tmp); } else { svUnsetValue (ifcfg, "IPV6_ADDR_GEN_MODE"); @@ -2593,7 +2593,7 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* IPv6 tokenized interface identifier */ value = nm_setting_ip6_config_get_token (NM_SETTING_IP6_CONFIG (s_ip6)); - svSetValue (ifcfg, "IPV6_TOKEN", value); + svSetValueString (ifcfg, "IPV6_TOKEN", value); priority = nm_setting_ip_config_get_dns_priority (s_ip6); if (priority) @@ -2670,7 +2670,7 @@ write_res_options (NMConnection *connection, shvarFile *ifcfg, GError **error) g_string_append_c (value, ' '); g_string_append (value, array->pdata[i]); } - svSetValueFull (ifcfg, "RES_OPTIONS", value->str); + svSetValue (ifcfg, "RES_OPTIONS", value->str); g_string_free (value, TRUE); } else svUnsetValue (ifcfg, "RES_OPTIONS"); diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index fbc5d1f9e8..29bb8e97a9 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -324,11 +324,11 @@ find_line (shvarFile *s, const char *key) return NULL; } -/* svGetValueFull() is identical to svGetValue() except that - * svGetValue() will never return an empty value (but %NULL instead). - * svGetValueFull() will return empty values if that is the value for the @key. */ +/* svGetValue() is identical to svGetValueString() except that + * svGetValueString() will never return an empty value (but %NULL instead). + * svGetValue() will return empty values if that is the value for the @key. */ char * -svGetValueFull (shvarFile *s, const char *key) +svGetValue (shvarFile *s, const char *key) { const char *line_val; char *value; @@ -350,11 +350,11 @@ svGetValueFull (shvarFile *s, const char *key) * be freed by the caller. */ char * -svGetValue (shvarFile *s, const char *key) +svGetValueString (shvarFile *s, const char *key) { char *value; - value = svGetValueFull (s, key); + value = svGetValue (s, key); if (value && !*value) { g_free (value); return NULL; @@ -376,7 +376,7 @@ svGetValueBoolean (shvarFile *s, const char *key, gint fallback) { gs_free char *tmp = NULL; - tmp = svGetValue (s, key); + tmp = svGetValueString (s, key); return svParseBoolean (tmp, fallback); } @@ -397,7 +397,7 @@ svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 m gint64 result; int errsv; - tmp = svGetValueFull (s, key); + tmp = svGetValue (s, key); if (!tmp) { errno = 0; return fallback; @@ -414,10 +414,10 @@ svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 m /*****************************************************************************/ -/* Same as svSetValue() but it preserves empty @value -- contrary to - * svSetValue() for which "" effectively means to remove the value. */ +/* Same as svSetValueString() but it preserves empty @value -- contrary to + * svSetValueString() for which "" effectively means to remove the value. */ void -svSetValueFull (shvarFile *s, const char *key, const char *value) +svSetValue (shvarFile *s, const char *key, const char *value) { gs_free char *newval_free = NULL; gs_free char *oldval = NULL; @@ -439,7 +439,7 @@ svSetValueFull (shvarFile *s, const char *key, const char *value) } value = svEscape (value, &newval_free); - oldval = svGetValueFull (s, key); + oldval = svGetValue (s, key); keyValue = g_strdup_printf ("%s=%s", key, value); if (!oldval) { @@ -467,9 +467,9 @@ svSetValueFull (shvarFile *s, const char *key, const char *value) * to the bottom of the file. */ void -svSetValue (shvarFile *s, const char *key, const char *value) +svSetValueString (shvarFile *s, const char *key, const char *value) { - svSetValueFull (s, key, value && value[0] ? value : NULL); + svSetValue (s, key, value && value[0] ? value : NULL); } void @@ -477,20 +477,19 @@ svSetValueInt64 (shvarFile *s, const char *key, gint64 value) { char buf[NM_DECIMAL_STR_MAX (value)]; - svSetValueFull (s, key, - nm_sprintf_buf (buf, "%"G_GINT64_FORMAT, value)); + svSetValue (s, key, nm_sprintf_buf (buf, "%"G_GINT64_FORMAT, value)); } void svSetValueBoolean (shvarFile *s, const char *key, gboolean value) { - svSetValueFull (s, key, value ? "yes" : "no"); + svSetValue (s, key, value ? "yes" : "no"); } void svUnsetValue (shvarFile *s, const char *key) { - svSetValueFull (s, key, NULL); + svSetValue (s, key, NULL); } /*****************************************************************************/ diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index 9daa004d1b..7525d17e17 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -45,8 +45,8 @@ shvarFile *svOpenFile (const char *name, GError **error); * pointing at the line containing the value. The char* returned MUST * be freed by the caller. */ +char *svGetValueString (shvarFile *s, const char *key); char *svGetValue (shvarFile *s, const char *key); -char *svGetValueFull (shvarFile *s, const char *key); gint svParseBoolean (const char *value, gint def); @@ -63,8 +63,8 @@ gint64 svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, g * the key=value pair after that line. Otherwise, prepend the pair * to the top of the file. */ +void svSetValueString (shvarFile *s, const char *key, const char *value); void svSetValue (shvarFile *s, const char *key, const char *value); -void svSetValueFull (shvarFile *s, const char *key, const char *value); void svSetValueBoolean (shvarFile *s, const char *key, gboolean value); void svSetValueInt64 (shvarFile *s, const char *key, gint64 value); diff --git a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 5000c2c7e0..1704340c8b 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -1789,7 +1789,7 @@ test_clear_master (void) g_assert_no_error (error); g_assert (f); - val = svGetValue (f, "BRIDGE"); + val = svGetValueString (f, "BRIDGE"); g_assert (!val); svCloseFile (f); } @@ -3014,7 +3014,7 @@ test_write_wifi_hidden (void) g_assert (f); /* re-read the file to check that what key was written. */ - val = svGetValue (f, "SSID_HIDDEN"); + val = svGetValueString (f, "SSID_HIDDEN"); g_assert (val); g_assert_cmpstr (val, ==, "yes"); g_free (val); @@ -3113,7 +3113,7 @@ test_write_wifi_mac_random (gconstpointer user_data) g_assert (f); /* re-read the file to check that what key was written. */ - val = svGetValue (f, "MAC_ADDRESS_RANDOMIZATION"); + val = svGetValueString (f, "MAC_ADDRESS_RANDOMIZATION"); g_assert_cmpstr (val, ==, write_expected); g_free (val); svCloseFile (f); @@ -3177,7 +3177,7 @@ test_write_wired_wake_on_lan (void) g_assert (f); /* re-read the file to check that the key was written. */ - val = svGetValue (f, "ETHTOOL_OPTS"); + val = svGetValueString (f, "ETHTOOL_OPTS"); g_assert (val); g_assert (strstr (val, "wol")); g_assert (strstr (val, "sopass 00:00:00:11:22:33")); @@ -3266,7 +3266,7 @@ test_write_wifi_band_a (void) g_assert (f); /* re-read the file to check that what key was written. */ - val = svGetValue (f, "BAND"); + val = svGetValueString (f, "BAND"); g_assert (val); g_assert_cmpstr (val, ==, "a"); g_free (val); @@ -3975,7 +3975,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) g_assert_no_error (error); g_assert (ifcfg); - written_ifcfg_gateway = svGetValue (ifcfg, "IPV6_DEFAULTGW"); + written_ifcfg_gateway = svGetValueString (ifcfg, "IPV6_DEFAULTGW"); svCloseFile (ifcfg); } @@ -4499,15 +4499,15 @@ test_write_wired_aliases (void) /* Create some pre-existing alias files, to make sure they get overwritten / deleted. */ ifcfg = svCreateFile (TEST_SCRATCH_ALIAS_BASE ":2"); - svSetValue (ifcfg, "DEVICE", "alias0:2"); - svSetValue (ifcfg, "IPADDR", "192.168.1.2"); + svSetValueString (ifcfg, "DEVICE", "alias0:2"); + svSetValueString (ifcfg, "IPADDR", "192.168.1.2"); svWriteFile (ifcfg, 0644, NULL); svCloseFile (ifcfg); g_assert (g_file_test (TEST_SCRATCH_ALIAS_BASE ":2", G_FILE_TEST_EXISTS)); ifcfg = svCreateFile (TEST_SCRATCH_ALIAS_BASE ":5"); - svSetValue (ifcfg, "DEVICE", "alias0:5"); - svSetValue (ifcfg, "IPADDR", "192.168.1.5"); + svSetValueString (ifcfg, "DEVICE", "alias0:5"); + svSetValueString (ifcfg, "IPADDR", "192.168.1.5"); svWriteFile (ifcfg, 0644, NULL); svCloseFile (ifcfg); g_assert (g_file_test (TEST_SCRATCH_ALIAS_BASE ":5", G_FILE_TEST_EXISTS)); @@ -4628,41 +4628,41 @@ test_write_gateway (void) g_assert (f); /* re-read the file to check that the keys was written as IPADDR, GATEWAY and IPADDR1, GATEWAY1 */ - val = svGetValue (f, "IPADDR"); + val = svGetValueString (f, "IPADDR"); g_assert (val); g_assert_cmpstr (val, ==, "1.1.1.3"); g_free (val); - val = svGetValue (f, "IPADDR1"); + val = svGetValueString (f, "IPADDR1"); g_assert (val); g_assert_cmpstr (val, ==, "2.2.2.5"); g_free (val); - val = svGetValue (f, "IPADDR0"); + val = svGetValueString (f, "IPADDR0"); g_assert (val == NULL); - val = svGetValue (f, "PREFIX"); + val = svGetValueString (f, "PREFIX"); g_assert (val); g_assert_cmpstr (val, ==, "24"); g_free (val); - val = svGetValue (f, "PREFIX1"); + val = svGetValueString (f, "PREFIX1"); g_assert (val); g_assert_cmpstr (val, ==, "24"); g_free (val); - val = svGetValue (f, "PREFIX0"); + val = svGetValueString (f, "PREFIX0"); g_assert (val == NULL); - val = svGetValue (f, "GATEWAY"); + val = svGetValueString (f, "GATEWAY"); g_assert (val); g_assert_cmpstr (val, ==, "1.1.1.254"); g_free (val); - val = svGetValue (f, "GATEWAY0"); + val = svGetValueString (f, "GATEWAY0"); g_assert (val == NULL); - val = svGetValue (f, "GATEWAY1"); + val = svGetValueString (f, "GATEWAY1"); g_assert (val == NULL); svCloseFile (f); @@ -4756,7 +4756,7 @@ test_write_wifi_open (void) g_assert_no_error (error); g_assert (ifcfg != NULL); - tmp = svGetValue (ifcfg, "ESSID"); + tmp = svGetValueString (ifcfg, "ESSID"); g_assert_cmpstr (tmp, ==, "Test SSID"); g_free (tmp); @@ -6506,11 +6506,11 @@ test_write_wifi_dynamic_wep_leap (void) ifcfg = svOpenFile (testfile, &error); g_assert_no_error (error); g_assert (ifcfg); - tmp = svGetValue (ifcfg, "SECURITYMODE"); + tmp = svGetValueString (ifcfg, "SECURITYMODE"); g_assert_cmpstr (tmp, ==, NULL); g_free (tmp); - tmp = svGetValue (ifcfg, "IEEE_8021X_EAP_METHODS"); + tmp = svGetValueString (ifcfg, "IEEE_8021X_EAP_METHODS"); g_assert_cmpstr (tmp, ==, "LEAP"); g_free (tmp); @@ -6672,13 +6672,13 @@ test_write_wired_ctc_dhcp (void) g_assert_no_error (error); g_assert (ifcfg); - tmp = svGetValue (ifcfg, "CTCPROT"); + tmp = svGetValueString (ifcfg, "CTCPROT"); g_assert (tmp); g_assert_cmpstr (tmp, ==, "0"); g_free (tmp); /* And that it's not in the generic OPTIONS string */ - tmp = svGetValue (ifcfg, "OPTIONS"); + tmp = svGetValueString (ifcfg, "OPTIONS"); g_assert (tmp == NULL); g_free (tmp); @@ -8421,7 +8421,7 @@ test_write_fcoe_mode (gconstpointer user_data) g_assert_no_error (error); g_assert (ifcfg); - written_mode = svGetValue (ifcfg, "DCB_APP_FCOE_MODE"); + written_mode = svGetValueString (ifcfg, "DCB_APP_FCOE_MODE"); svCloseFile (ifcfg); g_assert_cmpstr (written_mode, ==, expected_mode); g_free (written_mode); @@ -8558,11 +8558,11 @@ test_write_team_master (void) g_assert (f); /* re-read the file to check that what key was written. */ - val = svGetValue (f, "DEVICETYPE"); + val = svGetValueString (f, "DEVICETYPE"); g_assert (val); g_assert_cmpstr (val, ==, "Team"); g_free (val); - val = svGetValue (f, "TEAM_CONFIG"); + val = svGetValueString (f, "TEAM_CONFIG"); g_assert (val); g_assert_cmpstr (val, ==, expected_config); g_free (val); @@ -8652,16 +8652,16 @@ test_write_team_port (void) g_assert (f); /* re-read the file to check that what key was written. */ - val = svGetValue (f, "TYPE"); + val = svGetValueString (f, "TYPE"); g_assert (!val); - val = svGetValue (f, "DEVICETYPE"); + val = svGetValueString (f, "DEVICETYPE"); g_assert (val); g_assert_cmpstr (val, ==, "TeamPort"); g_free (val); - val = svGetValue (f, "TEAM_PORT_CONFIG"); + val = svGetValueString (f, "TEAM_PORT_CONFIG"); g_assert_cmpstr (val, ==, expected_config); g_free (val); - val = svGetValue (f, "TEAM_MASTER"); + val = svGetValueString (f, "TEAM_MASTER"); g_assert_cmpstr (val, ==, "team0"); g_free (val); svCloseFile (f); |