diff options
author | Thomas Haller <thaller@redhat.com> | 2017-02-21 12:07:14 +0100 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2017-02-21 12:34:36 +0100 |
commit | c0c9b3dbcd90ed657ddf086477b1aecfe25f9fc7 (patch) | |
tree | 77700581edf0188889282e877547842a4e19025c | |
parent | d37c77234fe4e842ae7d7a513fc45daa50c70716 (diff) | |
download | NetworkManager-c0c9b3dbcd90ed657ddf086477b1aecfe25f9fc7.tar.gz |
ifcfg/trivial: rename svGetValueString() to svGetValueStr_cp()
We have
- svGetValue()
- returns the original string
- avoids copying the string unless necessary
- svGetValueStr_cp() (formerly svGetValueString())
- returns the original string, unless it is empty ""
- always clones the string
I think the behavior svGetValueStr*() of coercing "" to NULL is wrongly
used in most places. We should better handle "" like any other value,
not treat it as unset.
That would require another function svGetValue_cp(), which is like svGetValue()
but always copies the string. Rename svGetValueString() so that there is a place
for names like
- svGetValue_cp()
- svGetValueStr()
Also rename svSetValueString() to svSetValueStr().
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 314 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 442 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.c | 8 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/shvar.h | 4 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c | 18 |
5 files changed, 393 insertions, 393 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 36287a6aa2..17b8e8bb61 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 = svGetValueString (ifcfg, "NAME"); + name = svGetValueStr_cp (ifcfg, "NAME"); if (name) return name; @@ -141,11 +141,11 @@ make_connection_setting (const char *file, g_free (new_id); /* Try for a UUID key before falling back to hashing the file name */ - uuid = svGetValueString (ifcfg, "UUID"); + uuid = svGetValueStr_cp (ifcfg, "UUID"); if (!uuid) uuid = nm_utils_uuid_generate_from_string (svFileGetName (ifcfg), -1, NM_UTILS_UUID_TYPE_LEGACY, NULL); - stable_id = svGetValueString (ifcfg, "STABLE_ID"); + stable_id = svGetValueStr_cp (ifcfg, "STABLE_ID"); g_object_set (s_con, NM_SETTING_CONNECTION_TYPE, type, @@ -154,7 +154,7 @@ make_connection_setting (const char *file, NULL); g_free (uuid); - value = svGetValueString (ifcfg, "DEVICE"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); if (value) { GError *error = NULL; @@ -169,7 +169,7 @@ make_connection_setting (const char *file, g_free (value); } - value = svGetValueString (ifcfg, "LLDP"); + value = svGetValueStr_cp (ifcfg, "LLDP"); if (!g_strcmp0 (value, "rx")) lldp = NM_SETTING_CONNECTION_LLDP_ENABLE_RX; else @@ -193,7 +193,7 @@ make_connection_setting (const char *file, NM_SETTING_CONNECTION_LLDP, lldp, NULL); - value = svGetValueString (ifcfg, "USERS"); + value = svGetValueStr_cp (ifcfg, "USERS"); if (value) { char **items, **iter; @@ -209,11 +209,11 @@ make_connection_setting (const char *file, } - zone = svGetValueString (ifcfg, "ZONE"); + zone = svGetValueStr_cp (ifcfg, "ZONE"); g_object_set (s_con, NM_SETTING_CONNECTION_ZONE, zone, NULL); g_free (zone); - value = svGetValueString (ifcfg, "SECONDARY_UUIDS"); + value = svGetValueStr_cp (ifcfg, "SECONDARY_UUIDS"); if (value) { char **items, **iter; @@ -228,9 +228,9 @@ make_connection_setting (const char *file, g_strfreev (items); } - value = svGetValueString (ifcfg, "BRIDGE_UUID"); + value = svGetValueStr_cp (ifcfg, "BRIDGE_UUID"); if (!value) - value = svGetValueString (ifcfg, "BRIDGE"); + value = svGetValueStr_cp (ifcfg, "BRIDGE"); if (value) { const char *old_value; @@ -245,7 +245,7 @@ make_connection_setting (const char *file, g_free (value); } - value = svGetValueString (ifcfg, "GATEWAY_PING_TIMEOUT"); + value = svGetValueStr_cp (ifcfg, "GATEWAY_PING_TIMEOUT"); if (value) { gint64 tmp; @@ -338,19 +338,19 @@ is_any_ip4_address_defined (shvarFile *ifcfg, int *idx) char tag[256]; gs_free char *value = NULL; - value = svGetValueString (ifcfg, numbered_tag (tag, "IPADDR", i)); + value = svGetValueStr_cp (ifcfg, numbered_tag (tag, "IPADDR", i)); if (value) { *ret_idx = i; return TRUE; } - value = svGetValueString (ifcfg, numbered_tag (tag, "PREFIX", i)); + value = svGetValueStr_cp (ifcfg, numbered_tag (tag, "PREFIX", i)); if (value) { *ret_idx = i; return TRUE; } - value = svGetValueString (ifcfg, numbered_tag (tag, "NETMASK", i)); + value = svGetValueStr_cp (ifcfg, numbered_tag (tag, "NETMASK", i)); if (value) { *ret_idx = i; return TRUE; @@ -406,7 +406,7 @@ read_full_ip4_address (shvarFile *ifcfg, /* Prefix */ numbered_tag (prefix_tag, "PREFIX", which); - value = svGetValueString (ifcfg, prefix_tag); + value = svGetValueStr_cp (ifcfg, prefix_tag); if (value) { prefix = _nm_utils_ascii_str_to_int64 (value, 10, 0, 32, -1); if (prefix < 0) { @@ -500,7 +500,7 @@ read_one_ip4_route (shvarFile *ifcfg, /* Metric */ nm_clear_g_free (&value); - value = svGetValueString (ifcfg, numbered_tag (tag, "METRIC", which)); + value = svGetValueStr_cp (ifcfg, numbered_tag (tag, "METRIC", which)); if (value) { metric = _nm_utils_ascii_str_to_int64 (value, 10, 0, G_MAXUINT32, -1); if (metric < 0) { @@ -892,7 +892,7 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) char *value = NULL; NMSettingProxyMethod method; - value = svGetValueString (ifcfg, "PROXY_METHOD"); + value = svGetValueStr_cp (ifcfg, "PROXY_METHOD"); if (!value) return NULL; @@ -910,14 +910,14 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) NM_SETTING_PROXY_METHOD, (int) NM_SETTING_PROXY_METHOD_AUTO, NULL); - value = svGetValueString (ifcfg, "PAC_URL"); + value = svGetValueStr_cp (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 = svGetValueString (ifcfg, "PAC_SCRIPT"); + value = svGetValueStr_cp (ifcfg, "PAC_SCRIPT"); if (value) { value = g_strstrip (value); g_object_set (s_proxy, NM_SETTING_PROXY_PAC_SCRIPT, value, NULL); @@ -932,7 +932,7 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) break; } - value = svGetValueString (ifcfg, "BROWSER_ONLY"); + value = svGetValueStr_cp (ifcfg, "BROWSER_ONLY"); if (value) { if (!g_ascii_strcasecmp (value, "yes")) g_object_set (s_proxy, NM_SETTING_PROXY_BROWSER_ONLY, TRUE, NULL); @@ -988,8 +988,8 @@ make_ip4_setting (shvarFile *ifcfg, char *gatewaydev; /* Get the connection ifcfg device name and the global gateway device */ - value = svGetValueString (ifcfg, "DEVICE"); - gatewaydev = svGetValueString (network_ifcfg, "GATEWAYDEV"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); + gatewaydev = svGetValueStr_cp (network_ifcfg, "GATEWAYDEV"); dns_options = svGetValue (network_ifcfg, "RES_OPTIONS", &dns_options_free); /* If there was a global gateway device specified, then only connections @@ -1003,7 +1003,7 @@ make_ip4_setting (shvarFile *ifcfg, svCloseFile (network_ifcfg); } - value = svGetValueString (ifcfg, "BOOTPROTO"); + value = svGetValueStr_cp (ifcfg, "BOOTPROTO"); if (!value || !*value || !g_ascii_strcasecmp (value, "none")) { if (is_any_ip4_address_defined (ifcfg, NULL)) @@ -1066,13 +1066,13 @@ make_ip4_setting (shvarFile *ifcfg, return g_steal_pointer (&s_ip4); /* Handle DHCP settings */ - value = svGetValueString (ifcfg, "DHCP_HOSTNAME"); + value = svGetValueStr_cp (ifcfg, "DHCP_HOSTNAME"); if (value) { g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, value, NULL); g_free (value); } - value = svGetValueString (ifcfg, "DHCP_FQDN"); + value = svGetValueStr_cp (ifcfg, "DHCP_FQDN"); if (value) { g_object_set (s_ip4, NM_SETTING_IP_CONFIG_DHCP_HOSTNAME, NULL, @@ -1086,7 +1086,7 @@ make_ip4_setting (shvarFile *ifcfg, NM_SETTING_IP_CONFIG_DHCP_TIMEOUT, svGetValueInt64 (ifcfg, "IPV4_DHCP_TIMEOUT", 10, 0, G_MAXINT32, 0), NULL); - value = svGetValueString (ifcfg, "DHCP_CLIENT_ID"); + value = svGetValueStr_cp (ifcfg, "DHCP_CLIENT_ID"); if (value) { g_object_set (s_ip4, NM_SETTING_IP4_CONFIG_DHCP_CLIENT_ID, value, NULL); g_free (value); @@ -1150,7 +1150,7 @@ make_ip4_setting (shvarFile *ifcfg, char tag[256]; numbered_tag (tag, "DNS", i); - value = svGetValueString (ifcfg, tag); + value = svGetValueStr_cp (ifcfg, tag); if (value) { if (nm_utils_ipaddr_valid (AF_INET, value)) { if (!nm_setting_ip_config_add_dns (s_ip4, value)) @@ -1168,7 +1168,7 @@ make_ip4_setting (shvarFile *ifcfg, } /* DNS searches */ - value = svGetValueString (ifcfg, "DOMAIN"); + value = svGetValueStr_cp (ifcfg, "DOMAIN"); if (value) { char **searches = NULL; @@ -1231,7 +1231,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 = svGetValueString (ifcfg, "SEARCH"); + value = svGetValueStr_cp (ifcfg, "SEARCH"); if (value) { char **searches = NULL; @@ -1314,7 +1314,7 @@ read_aliases (NMSettingIPConfig *s_ip4, gboolean read_defroute, const char *file continue; } - device = svGetValueString (parsed, "DEVICE"); + device = svGetValueStr_cp (parsed, "DEVICE"); if (!device) { PARSE_WARNING ("alias file '%s' has no DEVICE", full_path); svCloseFile (parsed); @@ -1421,9 +1421,9 @@ make_ip6_setting (shvarFile *ifcfg, char *default_dev = NULL; /* Get the connection ifcfg device name and the global default route device */ - value = svGetValueString (ifcfg, "DEVICE"); - ipv6_defaultgw = svGetValueString (network_ifcfg, "IPV6_DEFAULTGW"); - ipv6_defaultdev = svGetValueString (network_ifcfg, "IPV6_DEFAULTDEV"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); + ipv6_defaultgw = svGetValueStr_cp (network_ifcfg, "IPV6_DEFAULTGW"); + ipv6_defaultdev = svGetValueStr_cp (network_ifcfg, "IPV6_DEFAULTDEV"); dns_options = svGetValue (network_ifcfg, "RES_OPTIONS", &dns_options_free); if (ipv6_defaultgw) { @@ -1448,7 +1448,7 @@ make_ip6_setting (shvarFile *ifcfg, /* Find out method property */ /* Is IPV6 enabled? Set method to "ignored", when not enabled */ - str_value = svGetValueString (ifcfg, "IPV6INIT"); + str_value = svGetValueStr_cp (ifcfg, "IPV6INIT"); ipv6init = svGetValueBoolean (ifcfg, "IPV6INIT", FALSE); if (!str_value) { network_ifcfg = svOpenFile (network_file, NULL); @@ -1463,7 +1463,7 @@ make_ip6_setting (shvarFile *ifcfg, method = NM_SETTING_IP6_CONFIG_METHOD_IGNORE; /* IPv6 is disabled */ else { ipv6forwarding = svGetValueBoolean (ifcfg, "IPV6FORWARDING", FALSE); - str_value = svGetValueString (ifcfg, "IPV6_AUTOCONF"); + str_value = svGetValueStr_cp (ifcfg, "IPV6_AUTOCONF"); dhcp6 = svGetValueBoolean (ifcfg, "DHCPV6C", FALSE); if (!g_strcmp0 (str_value, "shared")) @@ -1475,9 +1475,9 @@ make_ip6_setting (shvarFile *ifcfg, else { /* IPV6_AUTOCONF=no and no IPv6 address -> method 'link-local' */ g_free (str_value); - str_value = svGetValueString (ifcfg, "IPV6ADDR"); + str_value = svGetValueStr_cp (ifcfg, "IPV6ADDR"); if (!str_value) - str_value = svGetValueString (ifcfg, "IPV6ADDR_SECONDARIES"); + str_value = svGetValueStr_cp (ifcfg, "IPV6ADDR_SECONDARIES"); if (!str_value) method = NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL; @@ -1487,7 +1487,7 @@ make_ip6_setting (shvarFile *ifcfg, /* TODO - handle other methods */ /* Read IPv6 Privacy Extensions configuration */ - str_value = svGetValueString (ifcfg, "IPV6_PRIVACY"); + str_value = svGetValueStr_cp (ifcfg, "IPV6_PRIVACY"); if (str_value) { ip6_privacy = svParseBoolean (str_value, FALSE); if (!ip6_privacy) @@ -1517,13 +1517,13 @@ make_ip6_setting (shvarFile *ifcfg, if (strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_IGNORE) == 0) return NM_SETTING (s_ip6); - value = svGetValueString (ifcfg, "DHCPV6_HOSTNAME"); + value = svGetValueStr_cp (ifcfg, "DHCPV6_HOSTNAME"); /* Use DHCP_HOSTNAME as fallback if it is in FQDN format and ipv6.method is * auto or dhcp: this is required to support old ifcfg files */ if (!value && ( !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_AUTO) || !strcmp (method, NM_SETTING_IP6_CONFIG_METHOD_DHCP))) { - value = svGetValueString (ifcfg, "DHCP_HOSTNAME"); + value = svGetValueStr_cp (ifcfg, "DHCP_HOSTNAME"); if (value && !strchr (value, '.')) g_clear_pointer (&value, g_free); } @@ -1539,8 +1539,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 = svGetValueString (ifcfg, "IPV6ADDR"); - ipv6addr_secondaries = svGetValueString (ifcfg, "IPV6ADDR_SECONDARIES"); + ipv6addr = svGetValueStr_cp (ifcfg, "IPV6ADDR"); + ipv6addr_secondaries = svGetValueStr_cp (ifcfg, "IPV6ADDR_SECONDARIES"); value = g_strjoin (ipv6addr && ipv6addr_secondaries ? " " : NULL, ipv6addr ? ipv6addr : "", @@ -1567,12 +1567,12 @@ make_ip6_setting (shvarFile *ifcfg, /* Gateway */ if (nm_setting_ip_config_get_num_addresses (s_ip6)) { - value = svGetValueString (ifcfg, "IPV6_DEFAULTGW"); + value = svGetValueStr_cp (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 = svGetValueString (network_ifcfg, "IPV6_DEFAULTGW"); + value = svGetValueStr_cp (network_ifcfg, "IPV6_DEFAULTGW"); svCloseFile (network_ifcfg); } } @@ -1593,7 +1593,7 @@ make_ip6_setting (shvarFile *ifcfg, } /* IPv6 addressing mode configuration */ - str_value = svGetValueString (ifcfg, "IPV6_ADDR_GEN_MODE"); + str_value = svGetValueStr_cp (ifcfg, "IPV6_ADDR_GEN_MODE"); if (str_value) { if (nm_utils_enum_from_str (nm_setting_ip6_config_addr_gen_mode_get_type (), str_value, (int *) &addr_gen_mode, NULL)) @@ -1609,7 +1609,7 @@ make_ip6_setting (shvarFile *ifcfg, } /* IPv6 tokenized interface identifier */ - str_value = svGetValueString (ifcfg, "IPV6_TOKEN"); + str_value = svGetValueStr_cp (ifcfg, "IPV6_TOKEN"); if (str_value) { g_object_set (s_ip6, NM_SETTING_IP6_CONFIG_TOKEN, str_value, NULL); g_free (str_value); @@ -1622,7 +1622,7 @@ make_ip6_setting (shvarFile *ifcfg, char tag[256]; numbered_tag (tag, "DNS", i); - value = svGetValueString (ifcfg, tag); + value = svGetValueStr_cp (ifcfg, tag); if (!value) { /* all done */ break; @@ -1679,9 +1679,9 @@ check_if_bond_slave (shvarFile *ifcfg, { char *value; - value = svGetValueString (ifcfg, "MASTER_UUID"); + value = svGetValueStr_cp (ifcfg, "MASTER_UUID"); if (!value) - value = svGetValueString (ifcfg, "MASTER"); + value = svGetValueStr_cp (ifcfg, "MASTER"); if (value) { g_object_set (s_con, NM_SETTING_CONNECTION_MASTER, value, NULL); @@ -1702,9 +1702,9 @@ check_if_team_slave (shvarFile *ifcfg, { gs_free char *value = NULL; - value = svGetValueString (ifcfg, "TEAM_MASTER_UUID"); + value = svGetValueStr_cp (ifcfg, "TEAM_MASTER_UUID"); if (!value) - value = svGetValueString (ifcfg, "TEAM_MASTER"); + value = svGetValueStr_cp (ifcfg, "TEAM_MASTER"); if (!value) return FALSE; @@ -1780,7 +1780,7 @@ read_dcb_app (shvarFile *ifcfg, /* Priority */ tmp = g_strdup_printf ("DCB_APP_%s_PRIORITY", app); - val = svGetValueString (ifcfg, tmp); + val = svGetValueStr_cp (ifcfg, tmp); if (val) { priority = _nm_utils_ascii_str_to_int64 (val, 0, 0, 7, -1); if (priority < 0) { @@ -1820,7 +1820,7 @@ read_dcb_bool_array (shvarFile *ifcfg, gs_free char *val = NULL; guint i; - val = svGetValueString (ifcfg, prop); + val = svGetValueStr_cp (ifcfg, prop); if (!val) return TRUE; @@ -1864,7 +1864,7 @@ read_dcb_uint_array (shvarFile *ifcfg, gs_free char *val = NULL; guint i; - val = svGetValueString (ifcfg, prop); + val = svGetValueStr_cp (ifcfg, prop); if (!val) return TRUE; @@ -1913,7 +1913,7 @@ read_dcb_percent_array (shvarFile *ifcfg, char **iter; guint i, sum = 0; - val = svGetValueString (ifcfg, prop); + val = svGetValueStr_cp (ifcfg, prop); if (!val) return TRUE; @@ -1983,7 +1983,7 @@ make_dcb_setting (shvarFile *ifcfg, return FALSE; } if (nm_setting_dcb_get_app_fcoe_flags (s_dcb) & NM_SETTING_DCB_FLAG_ENABLE) { - val = svGetValueString (ifcfg, KEY_DCB_APP_FCOE_MODE); + val = svGetValueStr_cp (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) @@ -2120,7 +2120,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 = svGetValueString (ifcfg, shvar_key); + value = svGetValueStr_cp (ifcfg, shvar_key); if (!value) return TRUE; @@ -2226,7 +2226,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 = svGetValueString (ifcfg, flags_key); + val = svGetValueStr_cp (ifcfg, flags_key); if (val) { if (strstr (val, SECRET_FLAG_AGENT)) flags |= NM_SETTING_SECRET_FLAG_AGENT_OWNED; @@ -2255,7 +2255,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 = svGetValueString (ifcfg, "DEFAULTKEY"); + value = svGetValueStr_cp (ifcfg, "DEFAULTKEY"); if (value) { default_key_idx = _nm_utils_ascii_str_to_int64 (value, 0, 1, 4, 0); if (default_key_idx == 0) { @@ -2291,7 +2291,7 @@ make_wep_setting (shvarFile *ifcfg, } } - value = svGetValueString (ifcfg, "SECURITYMODE"); + value = svGetValueStr_cp (ifcfg, "SECURITYMODE"); if (value) { char *lcase; @@ -2348,7 +2348,7 @@ fill_wpa_ciphers (shvarFile *ifcfg, char **list = NULL, **iter; int i = 0; - p = value = svGetValueString (ifcfg, group ? "CIPHER_GROUP" : "CIPHER_PAIRWISE"); + p = value = svGetValueStr_cp (ifcfg, group ? "CIPHER_GROUP" : "CIPHER_PAIRWISE"); if (!value) return TRUE; @@ -2418,13 +2418,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 = svGetValueString (keys_ifcfg, "WPA_PSK"); + psk = svGetValueStr_cp (keys_ifcfg, "WPA_PSK"); svCloseFile (keys_ifcfg); } /* Fall back to the original ifcfg */ if (!psk) - psk = svGetValueString (ifcfg, "WPA_PSK"); + psk = svGetValueStr_cp (ifcfg, "WPA_PSK"); if (!psk) return NULL; @@ -2461,7 +2461,7 @@ eap_simple_reader (const char *eap_method, NMSettingSecretFlags flags; char *value; - value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueStr_cp (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'.", @@ -2476,10 +2476,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 = svGetValueString (ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_PASSWORD"); if (!value && keys) { /* Try the lookaside keys file */ - value = svGetValueString (keys, "IEEE_8021X_PASSWORD"); + value = svGetValueStr_cp (keys, "IEEE_8021X_PASSWORD"); } if (!value) { @@ -2563,13 +2563,13 @@ eap_tls_reader (const char *eap_method, NMSettingSecretFlags flags; NMSetting8021xCKScheme scheme; - value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_IDENTITY"); if (value) { g_object_set (s_8021x, NM_SETTING_802_1X_IDENTITY, value, NULL); g_free (value); } - ca_cert = svGetValueString (ifcfg, ca_cert_key); + ca_cert = svGetValueStr_cp (ifcfg, ca_cert_key); if (ca_cert) { gs_free char *real_cert_value = NULL; @@ -2587,7 +2587,7 @@ eap_tls_reader (const char *eap_method, g_object_set (s_8021x, ca_cert_pw_flags_prop, flags, NULL); if (flags == NM_SETTING_SECRET_FLAG_NONE) { - ca_cert_password = svGetValueString (ifcfg, ca_cert_pw_key); + ca_cert_password = svGetValueStr_cp (ifcfg, ca_cert_pw_key); g_object_set (s_8021x, ca_cert_pw_prop, ca_cert_password, NULL); } } @@ -2603,10 +2603,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 = svGetValueString (ifcfg, pk_pw_key); + privkey_password = svGetValueStr_cp (ifcfg, pk_pw_key); if (!privkey_password && keys) { /* Try the lookaside keys file */ - privkey_password = svGetValueString (keys, pk_pw_key); + privkey_password = svGetValueStr_cp (keys, pk_pw_key); } if (!privkey_password) { @@ -2619,7 +2619,7 @@ eap_tls_reader (const char *eap_method, } /* The private key itself */ - privkey = svGetValueString (ifcfg, pk_key); + privkey = svGetValueStr_cp (ifcfg, pk_key); if (!privkey) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing %s for EAP method '%s'.", @@ -2661,7 +2661,7 @@ eap_tls_reader (const char *eap_method, gs_free char *real_cert_value = NULL; gs_free char *client_cert = NULL; - client_cert = svGetValueString (ifcfg, cli_cert_key); + client_cert = svGetValueStr_cp (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'.", @@ -2684,7 +2684,7 @@ eap_tls_reader (const char *eap_method, g_object_set (s_8021x, cli_cert_pw_flags_prop, flags, NULL); if (flags == NM_SETTING_SECRET_FLAG_NONE) { - client_cert_password = svGetValueString (ifcfg, cli_cert_pw_key); + client_cert_password = svGetValueStr_cp (ifcfg, cli_cert_pw_key); g_object_set (s_8021x, cli_cert_pw_prop, client_cert_password, NULL); } } @@ -2711,7 +2711,7 @@ eap_peap_reader (const char *eap_method, gboolean success = FALSE; NMSetting8021xCKScheme scheme; - ca_cert = svGetValueString (ifcfg, "IEEE_8021X_CA_CERT"); + ca_cert = svGetValueStr_cp (ifcfg, "IEEE_8021X_CA_CERT"); if (ca_cert) { real_cert_value = get_cert_value (svFileGetName (ifcfg), ca_cert, &scheme); if (!nm_setting_802_1x_set_ca_cert (s_8021x, real_cert_value, scheme, NULL, error)) @@ -2721,7 +2721,7 @@ eap_peap_reader (const char *eap_method, eap_method); } - peapver = svGetValueString (ifcfg, "IEEE_8021X_PEAP_VERSION"); + peapver = svGetValueStr_cp (ifcfg, "IEEE_8021X_PEAP_VERSION"); if (peapver) { if (!strcmp (peapver, "0")) g_object_set (s_8021x, NM_SETTING_802_1X_PHASE1_PEAPVER, "0", NULL); @@ -2738,11 +2738,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 = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueStr_cp (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - inner_auth = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + inner_auth = svGetValueStr_cp (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."); @@ -2812,7 +2812,7 @@ eap_ttls_reader (const char *eap_method, char **list = NULL, **iter; NMSetting8021xCKScheme scheme; - ca_cert = svGetValueString (ifcfg, "IEEE_8021X_CA_CERT"); + ca_cert = svGetValueStr_cp (ifcfg, "IEEE_8021X_CA_CERT"); if (ca_cert) { real_cert_value = get_cert_value (svFileGetName (ifcfg), ca_cert, &scheme); if (!nm_setting_802_1x_set_ca_cert (s_8021x, real_cert_value, scheme, NULL, error)) @@ -2822,11 +2822,11 @@ eap_ttls_reader (const char *eap_method, eap_method); } - anon_ident = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueStr_cp (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - tmp = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + tmp = svGetValueStr_cp (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 = svGetValueString (ifcfg, "IEEE_8021X_PAC_FILE"); + pac_file = svGetValueStr_cp (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 = svGetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING"); + fast_provisioning = svGetValueStr_cp (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 = svGetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY"); + anon_ident = svGetValueStr_cp (ifcfg, "IEEE_8021X_ANON_IDENTITY"); if (anon_ident) g_object_set (s_8021x, NM_SETTING_802_1X_ANONYMOUS_IDENTITY, anon_ident, NULL); - inner_auth = svGetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS"); + inner_auth = svGetValueStr_cp (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 = svGetValueString (ifcfg, ifcfg_var_name); + value = svGetValueStr_cp (ifcfg, ifcfg_var_name); if (!value) return; @@ -3048,7 +3048,7 @@ fill_8021x (shvarFile *ifcfg, char **list = NULL, **iter; gint64 timeout; - value = svGetValueString (ifcfg, "IEEE_8021X_EAP_METHODS"); + value = svGetValueStr_cp (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'", @@ -3109,15 +3109,15 @@ fill_8021x (shvarFile *ifcfg, goto error; } - value = svGetValueString (ifcfg, "IEEE_8021X_SUBJECT_MATCH"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_SUBJECT_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_SUBJECT_MATCH, value, NULL); g_free (value); - value = svGetValueString (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_PHASE2_SUBJECT_MATCH, value, NULL); g_free (value); - value = svGetValueString (ifcfg, "IEEE_8021X_PHASE1_AUTH_FLAGS"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_PHASE1_AUTH_FLAGS"); if (value) { NMSetting8021xAuthFlags flags; char *token; @@ -3140,10 +3140,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 = svGetValueString (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH"); g_object_set (s_8021x, NM_SETTING_802_1X_DOMAIN_SUFFIX_MATCH, value, NULL); g_free (value); - value = svGetValueString (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH"); + value = svGetValueStr_cp (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); @@ -3175,7 +3175,7 @@ make_wpa_setting (shvarFile *ifcfg, wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); - value = svGetValueString (ifcfg, "KEY_MGMT"); + value = svGetValueStr_cp (ifcfg, "KEY_MGMT"); wpa_psk = !g_strcmp0 (value, "WPA-PSK"); wpa_eap = !g_strcmp0 (value, "WPA-EAP"); ieee8021x = !g_strcmp0 (value, "IEEE8021X"); @@ -3195,8 +3195,8 @@ make_wpa_setting (shvarFile *ifcfg, } else { char *allow_wpa, *allow_rsn; - allow_wpa = svGetValueString (ifcfg, "WPA_ALLOW_WPA"); - allow_rsn = svGetValueString (ifcfg, "WPA_ALLOW_WPA2"); + allow_wpa = svGetValueStr_cp (ifcfg, "WPA_ALLOW_WPA"); + allow_rsn = svGetValueStr_cp (ifcfg, "WPA_ALLOW_WPA2"); if (allow_wpa && svGetValueBoolean (ifcfg, "WPA_ALLOW_WPA", TRUE)) nm_setting_wireless_security_add_proto (wsec, "wpa"); @@ -3250,7 +3250,7 @@ make_wpa_setting (shvarFile *ifcfg, g_free (value); - value = svGetValueString (ifcfg, "SECURITYMODE"); + value = svGetValueStr_cp (ifcfg, "SECURITYMODE"); if (NM_IN_STRSET (value, NULL, "open")) g_object_set (wsec, NM_SETTING_WIRELESS_SECURITY_AUTH_ALG, value, NULL); @@ -3276,12 +3276,12 @@ make_leap_setting (shvarFile *ifcfg, wsec = NM_SETTING_WIRELESS_SECURITY (nm_setting_wireless_security_new ()); - value = svGetValueString (ifcfg, "KEY_MGMT"); + value = svGetValueStr_cp (ifcfg, "KEY_MGMT"); if (!value || strcmp (value, "IEEE8021X")) goto error; /* Not LEAP */ g_free (value); - value = svGetValueString (ifcfg, "SECURITYMODE"); + value = svGetValueStr_cp (ifcfg, "SECURITYMODE"); if (!value || strcasecmp (value, "leap")) goto error; /* Not LEAP */ @@ -3292,12 +3292,12 @@ make_leap_setting (shvarFile *ifcfg, /* Read LEAP password if it's system-owned */ if (flags == NM_SETTING_SECRET_FLAG_NONE) { - value = svGetValueString (ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueStr_cp (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 = svGetValueString (keys_ifcfg, "IEEE_8021X_PASSWORD"); + value = svGetValueStr_cp (keys_ifcfg, "IEEE_8021X_PASSWORD"); svCloseFile (keys_ifcfg); } } @@ -3306,7 +3306,7 @@ make_leap_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "IEEE_8021X_IDENTITY"); + value = svGetValueStr_cp (ifcfg, "IEEE_8021X_IDENTITY"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "Missing LEAP identity"); @@ -3399,25 +3399,25 @@ make_wireless_setting (shvarFile *ifcfg, s_wireless = NM_SETTING_WIRELESS (nm_setting_wireless_new ()); - value = svGetValueString (ifcfg, "HWADDR"); + value = svGetValueStr_cp (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wireless, NM_SETTING_WIRELESS_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValueString (ifcfg, "MACADDR"); + value = svGetValueStr_cp (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 = svGetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); + value = svGetValueStr_cp (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); g_object_set (s_wireless, NM_SETTING_WIRELESS_GENERATE_MAC_ADDRESS_MASK, value, NULL); g_free (value); - value = svGetValueString (ifcfg, "HWADDR_BLACKLIST"); + value = svGetValueStr_cp (ifcfg, "HWADDR_BLACKLIST"); if (value) { char **strv; @@ -3427,7 +3427,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "ESSID"); + value = svGetValueStr_cp (ifcfg, "ESSID"); if (value) { gs_unref_bytes GBytes *bytes = NULL; gsize ssid_len = 0; @@ -3456,7 +3456,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "MODE"); + value = svGetValueStr_cp (ifcfg, "MODE"); if (value) { char *lcase; const char *mode = NULL; @@ -3482,14 +3482,14 @@ make_wireless_setting (shvarFile *ifcfg, g_object_set (s_wireless, NM_SETTING_WIRELESS_MODE, mode, NULL); } - value = svGetValueString (ifcfg, "BSSID"); + value = svGetValueStr_cp (ifcfg, "BSSID"); if (value) { value = g_strstrip (value); g_object_set (s_wireless, NM_SETTING_WIRELESS_BSSID, value, NULL); g_free (value); } - value = svGetValueString (ifcfg, "CHANNEL"); + value = svGetValueStr_cp (ifcfg, "CHANNEL"); if (value) { errno = 0; chan = _nm_utils_ascii_str_to_int64 (value, 10, 1, 196, 0); @@ -3503,7 +3503,7 @@ make_wireless_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "BAND"); + value = svGetValueStr_cp (ifcfg, "BAND"); if (value) { if (!strcmp (value, "a")) { if (chan && chan <= 14) { @@ -3534,7 +3534,7 @@ make_wireless_setting (shvarFile *ifcfg, g_object_set (s_wireless, NM_SETTING_WIRELESS_BAND, "bg", NULL); } - value = svGetValueString (ifcfg, "MTU"); + value = svGetValueStr_cp (ifcfg, "MTU"); if (value) { int mtu; @@ -3863,7 +3863,7 @@ parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, const char *va } /* ETHTOOL_WAKE_ON_LAN = ignore overrides WoL settings in ETHTOOL_OPTS */ - wol_value = svGetValueString (ifcfg, "ETHTOOL_WAKE_ON_LAN"); + wol_value = svGetValueStr_cp (ifcfg, "ETHTOOL_WAKE_ON_LAN"); if (wol_value) { if (strcmp (wol_value, "ignore") == 0) wol_flags = NM_SETTING_WIRED_WAKE_ON_LAN_IGNORE; @@ -3898,7 +3898,7 @@ make_wired_setting (shvarFile *ifcfg, s_wired = NM_SETTING_WIRED (nm_setting_wired_new ()); - value = svGetValueString (ifcfg, "MTU"); + value = svGetValueStr_cp (ifcfg, "MTU"); if (value) { int mtu; @@ -3910,14 +3910,14 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "HWADDR"); + value = svGetValueStr_cp (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_wired, NM_SETTING_WIRED_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValueString (ifcfg, "SUBCHANNELS"); + value = svGetValueStr_cp (ifcfg, "SUBCHANNELS"); if (value) { const char *p = value; gboolean success = TRUE; @@ -3948,19 +3948,19 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "PORTNAME"); + value = svGetValueStr_cp (ifcfg, "PORTNAME"); if (value) { nm_setting_wired_add_s390_option (s_wired, "portname", value); g_free (value); } - value = svGetValueString (ifcfg, "CTCPROT"); + value = svGetValueStr_cp (ifcfg, "CTCPROT"); if (value) { nm_setting_wired_add_s390_option (s_wired, "ctcprot", value); g_free (value); } - nettype = svGetValueString (ifcfg, "NETTYPE"); + nettype = svGetValueStr_cp (ifcfg, "NETTYPE"); if (nettype) { if (!strcmp (nettype, "qeth") || !strcmp (nettype, "lcs") || !strcmp (nettype, "ctc")) g_object_set (s_wired, NM_SETTING_WIRED_S390_NETTYPE, nettype, NULL); @@ -3969,7 +3969,7 @@ make_wired_setting (shvarFile *ifcfg, g_free (nettype); } - value = svGetValueString (ifcfg, "OPTIONS"); + value = svGetValueStr_cp (ifcfg, "OPTIONS"); if (value) { char **options, **iter; @@ -3990,18 +3990,18 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "MACADDR"); + value = svGetValueStr_cp (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 = svGetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); + value = svGetValueStr_cp (ifcfg, "GENERATE_MAC_ADDRESS_MASK"); g_object_set (s_wired, NM_SETTING_WIRED_GENERATE_MAC_ADDRESS_MASK, value, NULL); g_free (value); - value = svGetValueString (ifcfg, "HWADDR_BLACKLIST"); + value = svGetValueStr_cp (ifcfg, "HWADDR_BLACKLIST"); if (value) { char **strv; @@ -4011,7 +4011,7 @@ make_wired_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "KEY_MGMT"); + value = svGetValueStr_cp (ifcfg, "KEY_MGMT"); if (value) { if (!strcmp (value, "IEEE8021X")) { *s_8021x = fill_8021x (ifcfg, file, value, FALSE, error); @@ -4086,19 +4086,19 @@ parse_infiniband_p_key (shvarFile *ifcfg, int id; gboolean ret = FALSE; - device = svGetValueString (ifcfg, "DEVICE"); + device = svGetValueStr_cp (ifcfg, "DEVICE"); if (!device) { PARSE_WARNING ("InfiniBand connection specified PKEY but not DEVICE"); goto done; } - physdev = svGetValueString (ifcfg, "PHYSDEV"); + physdev = svGetValueStr_cp (ifcfg, "PHYSDEV"); if (!physdev) { PARSE_WARNING ("InfiniBand connection specified PKEY but not PHYSDEV"); goto done; } - pkey_id = svGetValueString (ifcfg, "PKEY_ID"); + pkey_id = svGetValueStr_cp (ifcfg, "PKEY_ID"); if (!pkey_id) { PARSE_WARNING ("InfiniBand connection specified PKEY but not PKEY_ID"); goto done; @@ -4146,7 +4146,7 @@ make_infiniband_setting (shvarFile *ifcfg, s_infiniband = NM_SETTING_INFINIBAND (nm_setting_infiniband_new ()); - value = svGetValueString (ifcfg, "MTU"); + value = svGetValueStr_cp (ifcfg, "MTU"); if (value) { int mtu; @@ -4158,7 +4158,7 @@ make_infiniband_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "HWADDR"); + value = svGetValueStr_cp (ifcfg, "HWADDR"); if (value) { value = g_strstrip (value); g_object_set (s_infiniband, NM_SETTING_INFINIBAND_MAC_ADDRESS, value, NULL); @@ -4256,7 +4256,7 @@ make_bond_setting (shvarFile *ifcfg, NMSettingBond *s_bond; char *value; - value = svGetValueString (ifcfg, "DEVICE"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4266,7 +4266,7 @@ make_bond_setting (shvarFile *ifcfg, s_bond = NM_SETTING_BOND (nm_setting_bond_new ()); - value = svGetValueString (ifcfg, "BONDING_OPTS"); + value = svGetValueStr_cp (ifcfg, "BONDING_OPTS"); if (value) { char **items, **iter; @@ -4346,7 +4346,7 @@ read_team_config (shvarFile *ifcfg, const char *key, GError **error) gs_free char *value = NULL; size_t l; - value = svGetValueString (ifcfg, key); + value = svGetValueStr_cp (ifcfg, key); if (!value) return NULL; @@ -4374,7 +4374,7 @@ make_team_setting (shvarFile *ifcfg, char *value; GError *local_err = NULL; - value = svGetValueString (ifcfg, "DEVICE"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4528,7 +4528,7 @@ make_bridge_setting (shvarFile *ifcfg, gboolean stp = FALSE; gboolean stp_set = FALSE; - value = svGetValueString (ifcfg, "DEVICE"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); if (!value) { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, "mandatory DEVICE keyword missing"); @@ -4538,14 +4538,14 @@ make_bridge_setting (shvarFile *ifcfg, s_bridge = NM_SETTING_BRIDGE (nm_setting_bridge_new ()); - value = svGetValueString (ifcfg, "MACADDR"); + value = svGetValueStr_cp (ifcfg, "MACADDR"); if (value) { value = g_strstrip (value); g_object_set (s_bridge, NM_SETTING_BRIDGE_MAC_ADDRESS, value, NULL); g_free (value); } - value = svGetValueString (ifcfg, "STP"); + value = svGetValueStr_cp (ifcfg, "STP"); if (value) { if (!strcasecmp (value, "on") || !strcasecmp (value, "yes")) { g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, TRUE, NULL); @@ -4564,7 +4564,7 @@ make_bridge_setting (shvarFile *ifcfg, g_object_set (s_bridge, NM_SETTING_BRIDGE_STP, FALSE, NULL); } - value = svGetValueString (ifcfg, "DELAY"); + value = svGetValueStr_cp (ifcfg, "DELAY"); if (value) { if (stp) { if (get_uint (value, &u)) @@ -4576,7 +4576,7 @@ make_bridge_setting (shvarFile *ifcfg, g_free (value); } - value = svGetValueString (ifcfg, "BRIDGING_OPTS"); + value = svGetValueStr_cp (ifcfg, "BRIDGING_OPTS"); if (value) { handle_bridging_opts (NM_SETTING (s_bridge), stp, value, handle_bridge_option); g_free (value); @@ -4655,14 +4655,14 @@ make_bridge_port_setting (shvarFile *ifcfg) g_return_val_if_fail (ifcfg != NULL, FALSE); - value = svGetValueString (ifcfg, "BRIDGE_UUID"); + value = svGetValueStr_cp (ifcfg, "BRIDGE_UUID"); if (!value) - value = svGetValueString (ifcfg, "BRIDGE"); + value = svGetValueStr_cp (ifcfg, "BRIDGE"); if (value) { g_free (value); s_port = nm_setting_bridge_port_new (); - value = svGetValueString (ifcfg, "BRIDGING_OPTS"); + value = svGetValueStr_cp (ifcfg, "BRIDGING_OPTS"); if (value) handle_bridging_opts (s_port, FALSE, value, handle_bridge_port_option); g_free (value); @@ -4739,7 +4739,7 @@ parse_prio_map_list (NMSettingVlan *s_vlan, char *value; gchar **list = NULL, **iter; - value = svGetValueString (ifcfg, key); + value = svGetValueStr_cp (ifcfg, key); if (!value) return; @@ -4770,7 +4770,7 @@ make_vlan_setting (shvarFile *ifcfg, guint32 vlan_flags = 0; gint gvrp, reorder_hdr; - value = svGetValueString (ifcfg, "VLAN_ID"); + value = svGetValueStr_cp (ifcfg, "VLAN_ID"); if (value) { vlan_id = _nm_utils_ascii_str_to_int64 (value, 10, 0, 4095, -1); if (vlan_id == -1) { @@ -4783,7 +4783,7 @@ make_vlan_setting (shvarFile *ifcfg, } /* Need DEVICE if we don't have a separate VLAN_ID property */ - iface_name = svGetValueString (ifcfg, "DEVICE"); + iface_name = svGetValueStr_cp (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."); @@ -4793,7 +4793,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 = svGetValueString (ifcfg, "PHYSDEV"); + parent = svGetValueStr_cp (ifcfg, "PHYSDEV"); if (iface_name) { p = strchr (iface_name, '.'); @@ -4847,7 +4847,7 @@ make_vlan_setting (shvarFile *ifcfg, if (gvrp > 0) vlan_flags |= NM_VLAN_FLAG_GVRP; - value = svGetValueString (ifcfg, "VLAN_FLAGS"); + value = svGetValueStr_cp (ifcfg, "VLAN_FLAGS"); if (value) { gs_strfreev char **strv = NULL; char **ptr; @@ -4950,7 +4950,7 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg, nm_connection_add_setting (connection, nm_setting_generic_new ()); /* Get a spec */ - value = svGetValueString (ifcfg, "HWADDR"); + value = svGetValueStr_cp (ifcfg, "HWADDR"); if (value) { char *lower = g_ascii_strdown (value, -1); *out_spec = g_strdup_printf ("%s:mac:%s", type, lower); @@ -4959,14 +4959,14 @@ create_unhandled_connection (const char *filename, shvarFile *ifcfg, return connection; } - value = svGetValueString (ifcfg, "SUBCHANNELS"); + value = svGetValueStr_cp (ifcfg, "SUBCHANNELS"); if (value) { *out_spec = g_strdup_printf ("%s:s390-subchannels:%s", type, value); g_free (value); return connection; } - value = svGetValueString (ifcfg, "DEVICE"); + value = svGetValueStr_cp (ifcfg, "DEVICE"); if (value) { *out_spec = g_strdup_printf ("%s:interface-name:%s", type, value); g_free (value); @@ -4995,7 +4995,7 @@ uuid_from_file (const char *filename) return NULL; /* Try for a UUID key before falling back to hashing the file name */ - uuid = svGetValueString (ifcfg, "UUID"); + uuid = svGetValueStr_cp (ifcfg, "UUID"); if (!uuid) uuid = nm_utils_uuid_generate_from_string (svFileGetName (ifcfg), -1, NM_UTILS_UUID_TYPE_LEGACY, NULL); @@ -5014,7 +5014,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 = svGetValueString (ifcfg, "DOMAIN"); + char *value = svGetValueStr_cp (ifcfg, "DOMAIN"); if (value) { char **searches = g_strsplit (value, " ", 0); @@ -5077,7 +5077,7 @@ connection_from_file_full (const char *filename, } /* iBFT is handled by the iBFT settings plugin */ - bootproto = svGetValueString (parsed, "BOOTPROTO"); + bootproto = svGetValueStr_cp (parsed, "BOOTPROTO"); if (bootproto && !g_ascii_strcasecmp (bootproto, "ibft")) { if (out_ignore_error) *out_ignore_error = TRUE; @@ -5088,7 +5088,7 @@ connection_from_file_full (const char *filename, } g_free (bootproto); - devtype = svGetValueString (parsed, "DEVICETYPE"); + devtype = svGetValueStr_cp (parsed, "DEVICETYPE"); if (devtype) { if (!strcasecmp (devtype, TYPE_TEAM)) type = g_strdup (TYPE_TEAM); @@ -5102,19 +5102,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 = svGetValueString (parsed, "TEAM_CONFIG"); + t = svGetValueStr_cp (parsed, "TEAM_CONFIG"); if (t) type = g_strdup (TYPE_TEAM); } if (!type) - type = svGetValueString (parsed, "TYPE"); + type = svGetValueStr_cp (parsed, "TYPE"); if (!type) { gs_free char *tmp = NULL; char *device; - if ((tmp = svGetValueString (parsed, "IPV6TUNNELIPV4"))) { + if ((tmp = svGetValueStr_cp (parsed, "IPV6TUNNELIPV4"))) { if (out_ignore_error) *out_ignore_error = TRUE; g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_INVALID_CONNECTION, @@ -5122,7 +5122,7 @@ connection_from_file_full (const char *filename, return NULL; } - device = svGetValueString (parsed, "DEVICE"); + device = svGetValueStr_cp (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); @@ -5329,7 +5329,7 @@ devtimeout_from_file (const char *filename) if (!ifcfg) return 0; - devtimeout_str = svGetValueString (ifcfg, "DEVTIMEOUT"); + devtimeout_str = svGetValueStr_cp (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 f32bef2526..1d76752b6b 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -100,7 +100,7 @@ save_secret_flags (shvarFile *ifcfg, g_string_append (str, SECRET_FLAG_NOT_REQUIRED); } - svSetValueString (ifcfg, key, str->len ? str->str : NULL); + svSetValueStr (ifcfg, key, str->len ? str->str : NULL); g_string_free (str, TRUE); } @@ -128,7 +128,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) - svSetValueString (keyfile, key, value); + svSetValueStr (keyfile, key, value); else svUnsetValue (keyfile, key); @@ -144,7 +144,7 @@ set_secret (shvarFile *ifcfg, error: /* Try setting the secret in the actual ifcfg */ - svSetValueString (ifcfg, key, value); + svSetValueStr (ifcfg, key, value); } typedef struct { @@ -257,7 +257,7 @@ write_object (NMSetting8021x *s_8021x, * may have been sent. */ if (value) { - svSetValueString (ifcfg, objtype->ifcfg_rh_key, value); + svSetValueStr (ifcfg, objtype->ifcfg_rh_key, value); return TRUE; } @@ -285,7 +285,7 @@ write_object (NMSetting8021x *s_8021x, 0600, &write_error); if (success) { - svSetValueString (ifcfg, objtype->ifcfg_rh_key, new_file); + svSetValueStr (ifcfg, objtype->ifcfg_rh_key, new_file); g_free (new_file); return TRUE; } else { @@ -333,9 +333,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. */ - svSetValueString (ifcfg, - phase2 ? "IEEE_8021X_INNER_CLIENT_CERT" : "IEEE_8021X_CLIENT_CERT", - NULL); + svSetValueStr (ifcfg, + phase2 ? "IEEE_8021X_INNER_CLIENT_CERT" : "IEEE_8021X_CLIENT_CERT", + NULL); } else { /* Save the client certificate */ if (!write_object (s_8021x, ifcfg, @@ -378,7 +378,7 @@ write_8021x_setting (NMConnection *connection, /* If wired, write KEY_MGMT */ if (wired) - svSetValueString (ifcfg, "KEY_MGMT", "IEEE8021X"); + svSetValueStr (ifcfg, "KEY_MGMT", "IEEE8021X"); /* EAP method */ if (nm_setting_802_1x_get_num_eap_methods (s_8021x)) { @@ -386,14 +386,14 @@ write_8021x_setting (NMConnection *connection, if (value) tmp = g_ascii_strup (value, -1); } - svSetValueString (ifcfg, "IEEE_8021X_EAP_METHODS", tmp); + svSetValueStr (ifcfg, "IEEE_8021X_EAP_METHODS", tmp); g_free (tmp); - svSetValueString (ifcfg, "IEEE_8021X_IDENTITY", - nm_setting_802_1x_get_identity (s_8021x)); + svSetValueStr (ifcfg, "IEEE_8021X_IDENTITY", + nm_setting_802_1x_get_identity (s_8021x)); - svSetValueString (ifcfg, "IEEE_8021X_ANON_IDENTITY", - nm_setting_802_1x_get_anonymous_identity (s_8021x)); + svSetValueStr (ifcfg, "IEEE_8021X_ANON_IDENTITY", + nm_setting_802_1x_get_anonymous_identity (s_8021x)); set_secret (ifcfg, "IEEE_8021X_PASSWORD", @@ -405,30 +405,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"))) - svSetValueString (ifcfg, "IEEE_8021X_PEAP_VERSION", value); + svSetValueStr (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")) - svSetValueString (ifcfg, "IEEE_8021X_PEAP_FORCE_NEW_LABEL", "yes"); + svSetValueStr (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) - svSetValueString (ifcfg, "IEEE_8021X_PAC_FILE", value); + svSetValueStr (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) - svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth"); + svSetValueStr (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth"); else if (strcmp (value, "2") == 0) - svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-auth"); + svSetValueStr (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-auth"); else if (strcmp (value, "3") == 0) - svSetValueString (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth allow-auth"); + svSetValueStr (ifcfg, "IEEE_8021X_FAST_PROVISIONING", "allow-unauth allow-auth"); } /* Phase2 auth methods */ @@ -460,19 +460,19 @@ write_8021x_setting (NMConnection *connection, flags_str = _nm_utils_enum_to_str_full (nm_setting_802_1x_auth_flags_get_type (), auth_flags, " "); - svSetValueString (ifcfg, "IEEE_8021X_PHASE1_AUTH_FLAGS", flags_str); + svSetValueStr (ifcfg, "IEEE_8021X_PHASE1_AUTH_FLAGS", flags_str); } - svSetValueString (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS", - phase2_auth->len ? phase2_auth->str : NULL); + svSetValueStr (ifcfg, "IEEE_8021X_INNER_AUTH_METHODS", + phase2_auth->len ? phase2_auth->str : NULL); g_string_free (phase2_auth, TRUE); - svSetValueString (ifcfg, "IEEE_8021X_SUBJECT_MATCH", - nm_setting_802_1x_get_subject_match (s_8021x)); + svSetValueStr (ifcfg, "IEEE_8021X_SUBJECT_MATCH", + nm_setting_802_1x_get_subject_match (s_8021x)); - svSetValueString (ifcfg, "IEEE_8021X_PHASE2_SUBJECT_MATCH", - nm_setting_802_1x_get_phase2_subject_match (s_8021x)); + svSetValueStr (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); @@ -484,7 +484,7 @@ write_8021x_setting (NMConnection *connection, g_string_append (str, match); } if (str->len > 0) - svSetValueString (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str); + svSetValueStr (ifcfg, "IEEE_8021X_ALTSUBJECT_MATCHES", str->str); g_string_free (str, TRUE); svUnsetValue (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES"); @@ -497,13 +497,13 @@ write_8021x_setting (NMConnection *connection, g_string_append (str, match); } if (str->len > 0) - svSetValueString (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str); + svSetValueStr (ifcfg, "IEEE_8021X_PHASE2_ALTSUBJECT_MATCHES", str->str); g_string_free (str, TRUE); - 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)); + svSetValueStr (ifcfg, "IEEE_8021X_DOMAIN_SUFFIX_MATCH", + nm_setting_802_1x_get_domain_suffix_match (s_8021x)); + svSetValueStr (ifcfg, "IEEE_8021X_PHASE2_DOMAIN_SUFFIX_MATCH", + nm_setting_802_1x_get_phase2_domain_suffix_match (s_8021x)); timeout = nm_setting_802_1x_get_auth_timeout (s_8021x); if (timeout > 0) @@ -554,27 +554,27 @@ write_wireless_security_setting (NMConnection *connection, wep = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "wpa-none") || !strcmp (key_mgmt, "wpa-psk")) { - svSetValueString (ifcfg, "KEY_MGMT", "WPA-PSK"); + svSetValueStr (ifcfg, "KEY_MGMT", "WPA-PSK"); wpa = TRUE; *no_8021x = TRUE; } else if (!strcmp (key_mgmt, "ieee8021x")) { - svSetValueString (ifcfg, "KEY_MGMT", "IEEE8021X"); + svSetValueStr (ifcfg, "KEY_MGMT", "IEEE8021X"); dynamic_wep = TRUE; } else if (!strcmp (key_mgmt, "wpa-eap")) { - svSetValueString (ifcfg, "KEY_MGMT", "WPA-EAP"); + svSetValueStr (ifcfg, "KEY_MGMT", "WPA-EAP"); wpa = TRUE; } svUnsetValue (ifcfg, "SECURITYMODE"); if (auth_alg) { if (!strcmp (auth_alg, "shared")) - svSetValueString (ifcfg, "SECURITYMODE", "restricted"); + svSetValueStr (ifcfg, "SECURITYMODE", "restricted"); else if (!strcmp (auth_alg, "open")) - svSetValueString (ifcfg, "SECURITYMODE", "open"); + svSetValueStr (ifcfg, "SECURITYMODE", "open"); else if (!strcmp (auth_alg, "leap")) { - svSetValueString (ifcfg, "SECURITYMODE", "leap"); - svSetValueString (ifcfg, "IEEE_8021X_IDENTITY", - nm_setting_wireless_security_get_leap_username (s_wsec)); + svSetValueStr (ifcfg, "SECURITYMODE", "leap"); + svSetValueStr (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), @@ -604,7 +604,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); - svSetValueString (ifcfg, "DEFAULTKEY", tmp); + svSetValueStr (ifcfg, "DEFAULTKEY", tmp); g_free (tmp); for (i = 0; i < 4; i++) { @@ -660,9 +660,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")) - svSetValueString (ifcfg, "WPA_ALLOW_WPA", "yes"); + svSetValueStr (ifcfg, "WPA_ALLOW_WPA", "yes"); else if (proto && !strcmp (proto, "rsn")) - svSetValueString (ifcfg, "WPA_ALLOW_WPA2", "yes"); + svSetValueStr (ifcfg, "WPA_ALLOW_WPA2", "yes"); } /* WPA Pairwise ciphers */ @@ -684,7 +684,7 @@ write_wireless_security_setting (NMConnection *connection, } } if (strlen (str->str) && (dynamic_wep == FALSE)) - svSetValueString (ifcfg, "CIPHER_PAIRWISE", str->str); + svSetValueStr (ifcfg, "CIPHER_PAIRWISE", str->str); g_string_free (str, TRUE); /* WPA Group ciphers */ @@ -700,7 +700,7 @@ write_wireless_security_setting (NMConnection *connection, g_free (tmp); } if (strlen (str->str) && (dynamic_wep == FALSE)) - svSetValueString (ifcfg, "CIPHER_GROUP", str->str); + svSetValueStr (ifcfg, "CIPHER_GROUP", str->str); g_string_free (str, TRUE); if (wpa) @@ -740,13 +740,13 @@ write_wireless_setting (NMConnection *connection, } device_mac = nm_setting_wireless_get_mac_address (s_wireless); - svSetValueString (ifcfg, "HWADDR", device_mac); + svSetValueStr (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wireless_get_cloned_mac_address (s_wireless); - svSetValueString (ifcfg, "MACADDR", cloned_mac); + svSetValueStr (ifcfg, "MACADDR", cloned_mac); - svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wireless_get_generate_mac_address_mask (s_wireless)); + svSetValueStr (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); @@ -754,7 +754,7 @@ write_wireless_setting (NMConnection *connection, char *blacklist_str; blacklist_str = g_strjoinv (" ", (char **) macaddr_blacklist); - svSetValueString (ifcfg, "HWADDR_BLACKLIST", blacklist_str); + svSetValueStr (ifcfg, "HWADDR_BLACKLIST", blacklist_str); g_free (blacklist_str); } @@ -762,7 +762,7 @@ write_wireless_setting (NMConnection *connection, mtu = nm_setting_wireless_get_mtu (s_wireless); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValueString (ifcfg, "MTU", tmp); + svSetValueStr (ifcfg, "MTU", tmp); g_free (tmp); } @@ -810,7 +810,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]); - svSetValueString (ifcfg, "ESSID", str->str); + svSetValueStr (ifcfg, "ESSID", str->str); g_string_free (str, TRUE); } else { char buf[33]; @@ -818,17 +818,17 @@ write_wireless_setting (NMConnection *connection, nm_assert (ssid_len <= 32); memcpy (buf, ssid_data, ssid_len); buf[ssid_len] = '\0'; - svSetValueString (ifcfg, "ESSID", buf); + svSetValueStr (ifcfg, "ESSID", buf); } mode = nm_setting_wireless_get_mode (s_wireless); if (!mode || !strcmp (mode, "infrastructure")) { - svSetValueString (ifcfg, "MODE", "Managed"); + svSetValueStr (ifcfg, "MODE", "Managed"); } else if (!strcmp (mode, "adhoc")) { - svSetValueString (ifcfg, "MODE", "Ad-Hoc"); + svSetValueStr (ifcfg, "MODE", "Ad-Hoc"); adhoc = TRUE; } else if (!strcmp (mode, "ap")) { - svSetValueString (ifcfg, "MODE", "Ap"); + svSetValueStr (ifcfg, "MODE", "Ap"); } else { g_set_error (error, NM_SETTINGS_ERROR, NM_SETTINGS_ERROR_FAILED, "Invalid mode '%s' in '%s' setting", @@ -841,15 +841,15 @@ write_wireless_setting (NMConnection *connection, chan = nm_setting_wireless_get_channel (s_wireless); if (chan) { tmp = g_strdup_printf ("%u", chan); - svSetValueString (ifcfg, "CHANNEL", tmp); + svSetValueStr (ifcfg, "CHANNEL", tmp); g_free (tmp); } else { /* Band only set if channel is not, since channel implies band */ - svSetValueString (ifcfg, "BAND", nm_setting_wireless_get_band (s_wireless)); + svSetValueStr (ifcfg, "BAND", nm_setting_wireless_get_band (s_wireless)); } bssid = nm_setting_wireless_get_bssid (s_wireless); - svSetValueString (ifcfg, "BSSID", bssid); + svSetValueStr (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 @@ -895,17 +895,17 @@ write_wireless_setting (NMConnection *connection, g_free (keys_path); } - svSetValueString (ifcfg, "SSID_HIDDEN", nm_setting_wireless_get_hidden (s_wireless) ? "yes" : NULL); + svSetValueStr (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: - svSetValueString (ifcfg, "POWERSAVE", "ignore"); + svSetValueStr (ifcfg, "POWERSAVE", "ignore"); break; case NM_SETTING_WIRELESS_POWERSAVE_DISABLE: - svSetValueString (ifcfg, "POWERSAVE", "disable"); + svSetValueStr (ifcfg, "POWERSAVE", "disable"); break; case NM_SETTING_WIRELESS_POWERSAVE_ENABLE: - svSetValueString (ifcfg, "POWERSAVE", "enable"); + svSetValueStr (ifcfg, "POWERSAVE", "enable"); break; default: case NM_SETTING_WIRELESS_POWERSAVE_DEFAULT: @@ -915,18 +915,18 @@ write_wireless_setting (NMConnection *connection, switch (nm_setting_wireless_get_mac_address_randomization (s_wireless)) { case NM_SETTING_MAC_RANDOMIZATION_NEVER: - svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "never"); + svSetValueStr (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "never"); break; case NM_SETTING_MAC_RANDOMIZATION_ALWAYS: - svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "always"); + svSetValueStr (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "always"); break; case NM_SETTING_MAC_RANDOMIZATION_DEFAULT: default: - svSetValueString (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "default"); + svSetValueStr (ifcfg, "MAC_ADDRESS_RANDOMIZATION", "default"); break; } - svSetValueString (ifcfg, "TYPE", TYPE_WIRELESS); + svSetValueStr (ifcfg, "TYPE", TYPE_WIRELESS); return TRUE; } @@ -948,13 +948,13 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e } mac = nm_setting_infiniband_get_mac_address (s_infiniband); - svSetValueString (ifcfg, "HWADDR", mac); + svSetValueStr (ifcfg, "HWADDR", mac); svUnsetValue (ifcfg, "MTU"); mtu = nm_setting_infiniband_get_mtu (s_infiniband); if (mtu) { tmp = g_strdup_printf ("%u", mtu); - svSetValueString (ifcfg, "MTU", tmp); + svSetValueStr (ifcfg, "MTU", tmp); g_free (tmp); } @@ -963,17 +963,17 @@ write_infiniband_setting (NMConnection *connection, shvarFile *ifcfg, GError **e p_key = nm_setting_infiniband_get_p_key (s_infiniband); if (p_key != -1) { - svSetValueString (ifcfg, "PKEY", "yes"); + svSetValueStr (ifcfg, "PKEY", "yes"); tmp = g_strdup_printf ("%u", p_key); - svSetValueString (ifcfg, "PKEY_ID", tmp); + svSetValueStr (ifcfg, "PKEY_ID", tmp); g_free (tmp); parent = nm_setting_infiniband_get_parent (s_infiniband); if (parent) - svSetValueString (ifcfg, "PHYSDEV", parent); + svSetValueStr (ifcfg, "PHYSDEV", parent); } - svSetValueString (ifcfg, "TYPE", TYPE_INFINIBAND); + svSetValueStr (ifcfg, "TYPE", TYPE_INFINIBAND); return TRUE; } @@ -1001,13 +1001,13 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } device_mac = nm_setting_wired_get_mac_address (s_wired); - svSetValueString (ifcfg, "HWADDR", device_mac); + svSetValueStr (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); - svSetValueString (ifcfg, "MACADDR", cloned_mac); + svSetValueStr (ifcfg, "MACADDR", cloned_mac); - svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wired_get_generate_mac_address_mask (s_wired)); + svSetValueStr (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); @@ -1015,7 +1015,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) char *blacklist_str; blacklist_str = g_strjoinv (" ", (char **) macaddr_blacklist); - svSetValueString (ifcfg, "HWADDR_BLACKLIST", blacklist_str); + svSetValueStr (ifcfg, "HWADDR_BLACKLIST", blacklist_str); g_free (blacklist_str); } @@ -1023,7 +1023,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); - svSetValueString (ifcfg, "MTU", tmp); + svSetValueStr (ifcfg, "MTU", tmp); g_free (tmp); } @@ -1039,24 +1039,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]); } - svSetValueString (ifcfg, "SUBCHANNELS", tmp); + svSetValueStr (ifcfg, "SUBCHANNELS", tmp); g_free (tmp); } svUnsetValue (ifcfg, "NETTYPE"); nettype = nm_setting_wired_get_s390_nettype (s_wired); if (nettype) - svSetValueString (ifcfg, "NETTYPE", nettype); + svSetValueStr (ifcfg, "NETTYPE", nettype); svUnsetValue (ifcfg, "PORTNAME"); portname = nm_setting_wired_get_s390_option_by_key (s_wired, "portname"); if (portname) - svSetValueString (ifcfg, "PORTNAME", portname); + svSetValueStr (ifcfg, "PORTNAME", portname); svUnsetValue (ifcfg, "CTCPROT"); ctcprot = nm_setting_wired_get_s390_option_by_key (s_wired, "ctcprot"); if (ctcprot) - svSetValueString (ifcfg, "CTCPROT", ctcprot); + svSetValueStr (ifcfg, "CTCPROT", ctcprot); svUnsetValue (ifcfg, "OPTIONS"); num_opts = nm_setting_wired_get_num_s390_options (s_wired); @@ -1074,7 +1074,7 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_string_append_printf (str, "%s=%s", s390_key, s390_val); } if (str->len) - svSetValueString (ifcfg, "OPTIONS", str->str); + svSetValueStr (ifcfg, "OPTIONS", str->str); g_string_free (str, TRUE); } @@ -1138,12 +1138,12 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_string_append_printf (str, "s sopass %s", wol_password); } if (str) { - svSetValueString (ifcfg, "ETHTOOL_OPTS", str->str); + svSetValueStr (ifcfg, "ETHTOOL_OPTS", str->str); g_string_free (str, TRUE); } /* End ETHTOOL_OPT stuffing */ - svSetValueString (ifcfg, "TYPE", TYPE_ETHERNET); + svSetValueStr (ifcfg, "TYPE", TYPE_ETHERNET); return TRUE; } @@ -1185,18 +1185,18 @@ write_wired_for_virtual (NMConnection *connection, shvarFile *ifcfg) has_wired = TRUE; device_mac = nm_setting_wired_get_mac_address (s_wired); - svSetValueString (ifcfg, "HWADDR", device_mac); + svSetValueStr (ifcfg, "HWADDR", device_mac); cloned_mac = nm_setting_wired_get_cloned_mac_address (s_wired); - svSetValueString (ifcfg, "MACADDR", cloned_mac); + svSetValueStr (ifcfg, "MACADDR", cloned_mac); - svSetValueString (ifcfg, "GENERATE_MAC_ADDRESS_MASK", - nm_setting_wired_get_generate_mac_address_mask (s_wired)); + svSetValueStr (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); - svSetValueString (ifcfg, "MTU", tmp); + svSetValueStr (ifcfg, "MTU", tmp); g_free (tmp); } else svUnsetValue (ifcfg, "MTU"); @@ -1228,13 +1228,13 @@ write_vlan_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, return FALSE; } - 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)); + svSetValueStr (ifcfg, "VLAN", "yes"); + svSetValueStr (ifcfg, "TYPE", TYPE_VLAN); + svSetValueStr (ifcfg, "DEVICE", nm_setting_connection_get_interface_name (s_con)); + svSetValueStr (ifcfg, "PHYSDEV", nm_setting_vlan_get_parent (s_vlan)); tmp = g_strdup_printf ("%d", nm_setting_vlan_get_id (s_vlan)); - svSetValueString (ifcfg, "VLAN_ID", tmp); + svSetValueStr (ifcfg, "VLAN_ID", tmp); g_free (tmp); vlan_flags = nm_setting_vlan_get_flags (s_vlan); @@ -1248,16 +1248,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] ? "," : ""); - svSetValueString (ifcfg, "VLAN_FLAGS", s_buf); + svSetValueStr (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); - svSetValueString (ifcfg, "VLAN_INGRESS_PRIORITY_MAP", tmp); + svSetValueStr (ifcfg, "VLAN_INGRESS_PRIORITY_MAP", tmp); g_free (tmp); tmp = vlan_priority_maplist_to_stringlist (s_vlan, NM_VLAN_EGRESS_MAP); - svSetValueString (ifcfg, "VLAN_EGRESS_PRIORITY_MAP", tmp); + svSetValueStr (ifcfg, "VLAN_EGRESS_PRIORITY_MAP", tmp); g_free (tmp); svUnsetValue (ifcfg, "HWADDR"); @@ -1290,7 +1290,7 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wir return FALSE; } - svSetValueString (ifcfg, "DEVICE", iface); + svSetValueStr (ifcfg, "DEVICE", iface); svUnsetValue (ifcfg, "BONDING_OPTS"); num_opts = nm_setting_bond_get_num_options (s_bond); @@ -1310,13 +1310,13 @@ write_bonding_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wir } if (str->len) - svSetValueString (ifcfg, "BONDING_OPTS", str->str); + svSetValueStr (ifcfg, "BONDING_OPTS", str->str); g_string_free (str, TRUE); } - svSetValueString (ifcfg, "TYPE", TYPE_BOND); - svSetValueString (ifcfg, "BONDING_MASTER", "yes"); + svSetValueStr (ifcfg, "TYPE", TYPE_BOND); + svSetValueStr (ifcfg, "BONDING_MASTER", "yes"); *wired = write_wired_for_virtual (connection, ifcfg); @@ -1344,9 +1344,9 @@ write_team_setting (NMConnection *connection, shvarFile *ifcfg, gboolean *wired, return FALSE; } - svSetValueString (ifcfg, "DEVICE", iface); + svSetValueStr (ifcfg, "DEVICE", iface); config = nm_setting_team_get_config (s_team); - svSetValueString (ifcfg, "TEAM_CONFIG", config); + svSetValueStr (ifcfg, "TEAM_CONFIG", config); *wired = write_wired_for_virtual (connection, ifcfg); @@ -1412,24 +1412,24 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error return FALSE; } - svSetValueString (ifcfg, "DEVICE", iface); + svSetValueStr (ifcfg, "DEVICE", iface); svUnsetValue (ifcfg, "BRIDGING_OPTS"); svSetValueBoolean (ifcfg, "STP", FALSE); svUnsetValue (ifcfg, "DELAY"); mac = nm_setting_bridge_get_mac_address (s_bridge); - svSetValueString (ifcfg, "MACADDR", mac); + svSetValueStr (ifcfg, "MACADDR", mac); /* Bridge options */ opts = g_string_sized_new (32); if (nm_setting_bridge_get_stp (s_bridge)) { - svSetValueString (ifcfg, "STP", "yes"); + svSetValueStr (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); - svSetValueString (ifcfg, "DELAY", s); + svSetValueStr (ifcfg, "DELAY", s); g_free (s); } @@ -1465,10 +1465,10 @@ write_bridge_setting (NMConnection *connection, shvarFile *ifcfg, GError **error } if (opts->len) - svSetValueString (ifcfg, "BRIDGING_OPTS", opts->str); + svSetValueStr (ifcfg, "BRIDGING_OPTS", opts->str); g_string_free (opts, TRUE); - svSetValueString (ifcfg, "TYPE", TYPE_BRIDGE); + svSetValueStr (ifcfg, "TYPE", TYPE_BRIDGE); return TRUE; } @@ -1507,7 +1507,7 @@ write_bridge_port_setting (NMConnection *connection, shvarFile *ifcfg, GError ** } if (opts->len) - svSetValueString (ifcfg, "BRIDGING_OPTS", opts->str); + svSetValueStr (ifcfg, "BRIDGING_OPTS", opts->str); g_string_free (opts, TRUE); return TRUE; @@ -1524,7 +1524,7 @@ write_team_port_setting (NMConnection *connection, shvarFile *ifcfg, GError **er return TRUE; config = nm_setting_team_port_get_config (s_port); - svSetValueString (ifcfg, "TEAM_PORT_CONFIG", config); + svSetValueStr (ifcfg, "TEAM_PORT_CONFIG", config); return TRUE; } @@ -1535,13 +1535,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); - svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ENABLE) ? "yes" : NULL); + svSetValueStr (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ENABLE) ? "yes" : NULL); nm_sprintf_buf (prop, "DCB_%s_ADVERTISE", tag); - svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ADVERTISE) ? "yes" : NULL); + svSetValueStr (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_ADVERTISE) ? "yes" : NULL); nm_sprintf_buf (prop, "DCB_%s_WILLING", tag); - svSetValueString (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_WILLING) ? "yes" : NULL); + svSetValueStr (ifcfg, prop, (flags & NM_SETTING_DCB_FLAG_WILLING) ? "yes" : NULL); } static void @@ -1581,7 +1581,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'; - svSetValueString (ifcfg, key, str); + svSetValueStr (ifcfg, key, str); } typedef guint (*DcbGetUintFunc) (NMSettingDcb *, guint); @@ -1611,7 +1611,7 @@ write_dcb_uint_array (shvarFile *ifcfg, else g_assert_not_reached (); } - svSetValueString (ifcfg, key, str); + svSetValueStr (ifcfg, key, str); } static void @@ -1635,7 +1635,7 @@ write_dcb_percent_array (shvarFile *ifcfg, g_string_append_c (str, ','); g_string_append_printf (str, "%d", get_func (s_dcb, i)); } - svSetValueString (ifcfg, key, str->str); + svSetValueStr (ifcfg, key, str->str); g_string_free (str, TRUE); } @@ -1679,13 +1679,13 @@ write_dcb_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) return TRUE; } - svSetValueString (ifcfg, "DCB", "yes"); + svSetValueStr (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) - svSetValueString (ifcfg, KEY_DCB_APP_FCOE_MODE, nm_setting_dcb_get_app_fcoe_mode (s_dcb)); + svSetValueStr (ifcfg, KEY_DCB_APP_FCOE_MODE, nm_setting_dcb_get_app_fcoe_mode (s_dcb)); else svUnsetValue (ifcfg, KEY_DCB_APP_FCOE_MODE); @@ -1721,21 +1721,21 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) char *tmp; gint i_int; - 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)); + svSetValueStr (ifcfg, "NAME", nm_setting_connection_get_id (s_con)); + svSetValueStr (ifcfg, "UUID", nm_setting_connection_get_uuid (s_con)); + svSetValueStr (ifcfg, "STABLE_ID", nm_setting_connection_get_stable_id (s_con)); + svSetValueStr (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; - svSetValueString (ifcfg, "AUTOCONNECT_PRIORITY", tmp); + svSetValueStr (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; - svSetValueString (ifcfg, "AUTOCONNECT_RETRIES", tmp); + svSetValueStr (ifcfg, "AUTOCONNECT_RETRIES", tmp); g_free (tmp); /* Only save the value for master connections */ @@ -1745,9 +1745,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); - svSetValueString (ifcfg, "AUTOCONNECT_SLAVES", - autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES ? "yes" : - autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO ? "no" : NULL); + svSetValueStr (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"); @@ -1761,7 +1761,7 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) default: tmp = NULL; } - svSetValueString (ifcfg, "LLDP", tmp); + svSetValueStr (ifcfg, "LLDP", tmp); /* Permissions */ svUnsetValue (ifcfg, "USERS"); @@ -1781,19 +1781,19 @@ 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); } - svSetValueString (ifcfg, "USERS", str->str); + svSetValueStr (ifcfg, "USERS", str->str); g_string_free (str, TRUE); } - svSetValueString (ifcfg, "ZONE", nm_setting_connection_get_zone(s_con)); + svSetValueStr (ifcfg, "ZONE", nm_setting_connection_get_zone(s_con)); - svSetValueString (ifcfg, "MASTER_UUID", NULL); - svSetValueString (ifcfg, "MASTER", NULL); - svSetValueString (ifcfg, "SLAVE", NULL); - svSetValueString (ifcfg, "BRIDGE_UUID", NULL); - svSetValueString (ifcfg, "BRIDGE", NULL); - svSetValueString (ifcfg, "TEAM_MASTER_UUID", NULL); - svSetValueString (ifcfg, "TEAM_MASTER", NULL); + svSetValueStr (ifcfg, "MASTER_UUID", NULL); + svSetValueStr (ifcfg, "MASTER", NULL); + svSetValueStr (ifcfg, "SLAVE", NULL); + svSetValueStr (ifcfg, "BRIDGE_UUID", NULL); + svSetValueStr (ifcfg, "BRIDGE", NULL); + svSetValueStr (ifcfg, "TEAM_MASTER_UUID", NULL); + svSetValueStr (ifcfg, "TEAM_MASTER", NULL); master = nm_setting_connection_get_master (s_con); if (master) { @@ -1810,23 +1810,23 @@ write_connection_setting (NMSettingConnection *s_con, shvarFile *ifcfg) } if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BOND_SETTING_NAME)) { - svSetValueString (ifcfg, "MASTER_UUID", master); - svSetValueString (ifcfg, "MASTER", master_iface); - svSetValueString (ifcfg, "SLAVE", "yes"); + svSetValueStr (ifcfg, "MASTER_UUID", master); + svSetValueStr (ifcfg, "MASTER", master_iface); + svSetValueStr (ifcfg, "SLAVE", "yes"); } else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_BRIDGE_SETTING_NAME)) { - svSetValueString (ifcfg, "BRIDGE_UUID", master); - svSetValueString (ifcfg, "BRIDGE", master_iface); + svSetValueStr (ifcfg, "BRIDGE_UUID", master); + svSetValueStr (ifcfg, "BRIDGE", master_iface); } else if (nm_setting_connection_is_slave_type (s_con, NM_SETTING_TEAM_SETTING_NAME)) { - svSetValueString (ifcfg, "TEAM_MASTER_UUID", master); - svSetValueString (ifcfg, "TEAM_MASTER", master_iface); + svSetValueStr (ifcfg, "TEAM_MASTER_UUID", master); + svSetValueStr (ifcfg, "TEAM_MASTER", master_iface); svUnsetValue (ifcfg, "TYPE"); } } if (nm_streq0 (type, NM_SETTING_TEAM_SETTING_NAME)) - svSetValueString (ifcfg, "DEVICETYPE", TYPE_TEAM); + svSetValueStr (ifcfg, "DEVICETYPE", TYPE_TEAM); else if (master_iface && nm_setting_connection_is_slave_type (s_con, NM_SETTING_TEAM_SETTING_NAME)) - svSetValueString (ifcfg, "DEVICETYPE", TYPE_TEAM_PORT); + svSetValueStr (ifcfg, "DEVICETYPE", TYPE_TEAM_PORT); else svUnsetValue (ifcfg, "DEVICETYPE"); @@ -1848,23 +1848,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); } - svSetValueString (ifcfg, "SECONDARY_UUIDS", str->str); + svSetValueStr (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)); - svSetValueString (ifcfg, "GATEWAY_PING_TIMEOUT", tmp); + svSetValueStr (ifcfg, "GATEWAY_PING_TIMEOUT", tmp); g_free (tmp); } switch (nm_setting_connection_get_metered (s_con)) { case NM_METERED_YES: - svSetValueString (ifcfg, "CONNECTION_METERED", "yes"); + svSetValueStr (ifcfg, "CONNECTION_METERED", "yes"); break; case NM_METERED_NO: - svSetValueString (ifcfg, "CONNECTION_METERED", "no"); + svSetValueStr (ifcfg, "CONNECTION_METERED", "no"); break; default: svUnsetValue (ifcfg, "CONNECTION_METERED"); @@ -1944,19 +1944,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: - svSetValueString (ifcfg, "PROXY_METHOD", "auto"); + svSetValueStr (ifcfg, "PROXY_METHOD", "auto"); pac_url = nm_setting_proxy_get_pac_url (s_proxy); if (pac_url) - svSetValueString (ifcfg, "PAC_URL", pac_url); + svSetValueStr (ifcfg, "PAC_URL", pac_url); pac_script = nm_setting_proxy_get_pac_script (s_proxy); if (pac_script) - svSetValueString (ifcfg, "PAC_SCRIPT", pac_script); + svSetValueStr (ifcfg, "PAC_SCRIPT", pac_script); break; case NM_SETTING_PROXY_METHOD_NONE: - svSetValueString (ifcfg, "PROXY_METHOD", "none"); + svSetValueStr (ifcfg, "PROXY_METHOD", "none"); break; } @@ -2042,13 +2042,13 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_AUTO)) - svSetValueString (ifcfg, "BOOTPROTO", "dhcp"); + svSetValueStr (ifcfg, "BOOTPROTO", "dhcp"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_MANUAL)) - svSetValueString (ifcfg, "BOOTPROTO", "none"); + svSetValueStr (ifcfg, "BOOTPROTO", "none"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_LINK_LOCAL)) - svSetValueString (ifcfg, "BOOTPROTO", "autoip"); + svSetValueStr (ifcfg, "BOOTPROTO", "autoip"); else if (!strcmp (method, NM_SETTING_IP4_CONFIG_METHOD_SHARED)) - svSetValueString (ifcfg, "BOOTPROTO", "shared"); + svSetValueStr (ifcfg, "BOOTPROTO", "shared"); /* Clear out un-numbered IP address fields */ svUnsetValue (ifcfg, "IPADDR"); @@ -2095,10 +2095,10 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) gw_key = g_strdup_printf ("GATEWAY%d", n); } - svSetValueString (ifcfg, addr_key, nm_ip_address_get_address (addr)); + svSetValueStr (ifcfg, addr_key, nm_ip_address_get_address (addr)); tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); - svSetValueString (ifcfg, prefix_key, tmp); + svSetValueStr (ifcfg, prefix_key, tmp); g_free (tmp); svUnsetValue (ifcfg, netmask_key); @@ -2129,7 +2129,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) g_free (gw_key); } - svSetValueString (ifcfg, "GATEWAY", nm_setting_ip_config_get_gateway (s_ip4)); + svSetValueStr (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++) { @@ -2141,7 +2141,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); - svSetValueString (ifcfg, addr_key, dns); + svSetValueStr (ifcfg, addr_key, dns); } g_free (addr_key); } @@ -2154,7 +2154,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)); } - svSetValueString (ifcfg, "DOMAIN", searches->str); + svSetValueStr (ifcfg, "DOMAIN", searches->str); g_string_free (searches, TRUE); } else svUnsetValue (ifcfg, "DOMAIN"); @@ -2163,37 +2163,37 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValueBoolean (ifcfg, "DEFROUTE", !nm_setting_ip_config_get_never_default (s_ip4)); /* Missing PEERDNS means TRUE, so write it only when is FALSE */ - svSetValueString (ifcfg, "PEERDNS", - nm_setting_ip_config_get_ignore_auto_dns (s_ip4) ? "no" : NULL); + svSetValueStr (ifcfg, "PEERDNS", + nm_setting_ip_config_get_ignore_auto_dns (s_ip4) ? "no" : NULL); /* Missing PEERROUTES means TRUE, so write it only when is FALSE */ - svSetValueString (ifcfg, "PEERROUTES", - nm_setting_ip_config_get_ignore_auto_routes (s_ip4) ? "no" : NULL); + svSetValueStr (ifcfg, "PEERROUTES", + nm_setting_ip_config_get_ignore_auto_routes (s_ip4) ? "no" : NULL); value = nm_setting_ip_config_get_dhcp_hostname (s_ip4); - svSetValueString (ifcfg, "DHCP_HOSTNAME", value); + svSetValueStr (ifcfg, "DHCP_HOSTNAME", value); value = nm_setting_ip4_config_get_dhcp_fqdn (NM_SETTING_IP4_CONFIG (s_ip4)); - svSetValueString (ifcfg, "DHCP_FQDN", value); + svSetValueStr (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 */ - svSetValueString (ifcfg, "DHCP_SEND_HOSTNAME", - nm_setting_ip_config_get_dhcp_send_hostname (s_ip4) ? NULL : "no"); + svSetValueStr (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)); - svSetValueString (ifcfg, "DHCP_CLIENT_ID", value); + svSetValueStr (ifcfg, "DHCP_CLIENT_ID", value); timeout = nm_setting_ip_config_get_dhcp_timeout (s_ip4); tmp = timeout ? g_strdup_printf ("%d", timeout) : NULL; - svSetValueString (ifcfg, "IPV4_DHCP_TIMEOUT", tmp); + svSetValueStr (ifcfg, "IPV4_DHCP_TIMEOUT", tmp); g_free (tmp); svSetValueBoolean (ifcfg, "IPV4_FAILURE_FATAL", !nm_setting_ip_config_get_may_fail (s_ip4)); route_metric = nm_setting_ip_config_get_route_metric (s_ip4); tmp = route_metric != -1 ? g_strdup_printf ("%"G_GINT64_FORMAT, route_metric) : NULL; - svSetValueString (ifcfg, "IPV4_ROUTE_METRIC", tmp); + svSetValueStr (ifcfg, "IPV4_ROUTE_METRIC", tmp); g_free (tmp); /* Static routes - route-<name> file */ @@ -2236,14 +2236,14 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) } else { route = nm_setting_ip_config_get_route (s_ip4, i); - svSetValueString (routefile, addr_key, nm_ip_route_get_dest (route)); + svSetValueStr (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)); - svSetValueString (routefile, netmask_key, &buf[0]); + svSetValueStr (routefile, netmask_key, &buf[0]); - svSetValueString (routefile, gw_key, nm_ip_route_get_next_hop (route)); + svSetValueStr (routefile, gw_key, nm_ip_route_get_next_hop (route)); memset (buf, 0, sizeof (buf)); metric = nm_ip_route_get_metric (route); @@ -2251,7 +2251,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svUnsetValue (routefile, metric_key); else { tmp = g_strdup_printf ("%u", (guint32) metric); - svSetValueString (routefile, metric_key, tmp); + svSetValueStr (routefile, metric_key, tmp); g_free (tmp); } } @@ -2277,7 +2277,7 @@ write_ip4_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (timeout < 0) svUnsetValue (ifcfg, "ARPING_WAIT"); else if (timeout == 0) - svSetValueString (ifcfg, "ARPING_WAIT", "0"); + svSetValueStr (ifcfg, "ARPING_WAIT", "0"); else { /* Round the value up to next integer */ svSetValueInt64 (ifcfg, "ARPING_WAIT", (timeout - 1) / 1000 + 1); @@ -2364,13 +2364,13 @@ write_ip4_aliases (NMConnection *connection, char *base_ifcfg_path) ifcfg = svCreateFile (path); g_free (path); - svSetValueString (ifcfg, "DEVICE", label); + svSetValueStr (ifcfg, "DEVICE", label); addr = nm_setting_ip_config_get_address (s_ip4, i); - svSetValueString (ifcfg, "IPADDR", nm_ip_address_get_address (addr)); + svSetValueStr (ifcfg, "IPADDR", nm_ip_address_get_address (addr)); tmp = g_strdup_printf ("%u", nm_ip_address_get_prefix (addr)); - svSetValueString (ifcfg, "PREFIX", tmp); + svSetValueStr (ifcfg, "PREFIX", tmp); g_free (tmp); svWriteFile (ifcfg, 0644, NULL); @@ -2438,7 +2438,7 @@ write_ip6_setting_dhcp_hostname (NMSettingIPConfig *s_ip6, shvarFile *ifcfg) const char *hostname; hostname = nm_setting_ip_config_get_dhcp_hostname (s_ip6); - svSetValueString (ifcfg, "DHCPV6_HOSTNAME", hostname); + svSetValueStr (ifcfg, "DHCPV6_HOSTNAME", hostname); /* Missing DHCPV6_SEND_HOSTNAME means TRUE, and we prefer not write it * explicitly in that case, because it is NM-specific variable @@ -2446,7 +2446,7 @@ write_ip6_setting_dhcp_hostname (NMSettingIPConfig *s_ip6, shvarFile *ifcfg) if (nm_setting_ip_config_get_dhcp_send_hostname (s_ip6)) svUnsetValue (ifcfg, "DHCPV6_SEND_HOSTNAME"); else - svSetValueString (ifcfg, "DHCPV6_SEND_HOSTNAME", "no"); + svSetValueStr (ifcfg, "DHCPV6_SEND_HOSTNAME", "no"); } static gboolean @@ -2490,28 +2490,28 @@ 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)) { - svSetValueString (ifcfg, "IPV6INIT", "no"); + svSetValueStr (ifcfg, "IPV6INIT", "no"); svUnsetValue (ifcfg, "DHCPV6C"); return TRUE; } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_AUTO)) { - svSetValueString (ifcfg, "IPV6INIT", "yes"); - svSetValueString (ifcfg, "IPV6_AUTOCONF", "yes"); + svSetValueStr (ifcfg, "IPV6INIT", "yes"); + svSetValueStr (ifcfg, "IPV6_AUTOCONF", "yes"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_DHCP)) { - svSetValueString (ifcfg, "IPV6INIT", "yes"); - svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); - svSetValueString (ifcfg, "DHCPV6C", "yes"); + svSetValueStr (ifcfg, "IPV6INIT", "yes"); + svSetValueStr (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueStr (ifcfg, "DHCPV6C", "yes"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_MANUAL)) { - svSetValueString (ifcfg, "IPV6INIT", "yes"); - svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueStr (ifcfg, "IPV6INIT", "yes"); + svSetValueStr (ifcfg, "IPV6_AUTOCONF", "no"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL)) { - svSetValueString (ifcfg, "IPV6INIT", "yes"); - svSetValueString (ifcfg, "IPV6_AUTOCONF", "no"); + svSetValueStr (ifcfg, "IPV6INIT", "yes"); + svSetValueStr (ifcfg, "IPV6_AUTOCONF", "no"); svUnsetValue (ifcfg, "DHCPV6C"); } else if (!strcmp (value, NM_SETTING_IP6_CONFIG_METHOD_SHARED)) { - svSetValueString (ifcfg, "IPV6INIT", "yes"); - svSetValueString (ifcfg, "IPV6_AUTOCONF", "shared"); + svSetValueStr (ifcfg, "IPV6INIT", "yes"); + svSetValueStr (ifcfg, "IPV6_AUTOCONF", "shared"); svUnsetValue (ifcfg, "DHCPV6C"); } @@ -2535,9 +2535,9 @@ write_ip6_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) nm_ip_address_get_address (addr), nm_ip_address_get_prefix (addr)); } - 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)); + svSetValueStr (ifcfg, "IPV6ADDR", ip_str1->str); + svSetValueStr (ifcfg, "IPV6ADDR_SECONDARIES", ip_str2->str); + svSetValueStr (ifcfg, "IPV6_DEFAULTGW", nm_setting_ip_config_get_gateway (s_ip6)); g_string_free (ip_str1, TRUE); g_string_free (ip_str2, TRUE); @@ -2552,7 +2552,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); - svSetValueString (ifcfg, addr_key, dns); + svSetValueStr (ifcfg, addr_key, dns); } g_free (addr_key); } @@ -2561,14 +2561,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 = svGetValueString (ifcfg, "DOMAIN"); + ip4_domains = svGetValueStr_cp (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)); } - svSetValueString (ifcfg, "DOMAIN", searches->str); + svSetValueStr (ifcfg, "DOMAIN", searches->str); g_string_free (searches, TRUE); g_free (ip4_domains); } @@ -2577,22 +2577,22 @@ 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)) - svSetValueString (ifcfg, "IPV6_DEFROUTE", "no"); + svSetValueStr (ifcfg, "IPV6_DEFROUTE", "no"); else - svSetValueString (ifcfg, "IPV6_DEFROUTE", "yes"); + svSetValueStr (ifcfg, "IPV6_DEFROUTE", "yes"); - svSetValueString (ifcfg, "IPV6_PEERDNS", - nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : NULL); + svSetValueStr (ifcfg, "IPV6_PEERDNS", + nm_setting_ip_config_get_ignore_auto_dns (s_ip6) ? "no" : NULL); - svSetValueString (ifcfg, "IPV6_PEERROUTES", - nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : NULL); + svSetValueStr (ifcfg, "IPV6_PEERROUTES", + nm_setting_ip_config_get_ignore_auto_routes (s_ip6) ? "no" : NULL); - svSetValueString (ifcfg, "IPV6_FAILURE_FATAL", - nm_setting_ip_config_get_may_fail (s_ip6) ? "no" : "yes"); + svSetValueStr (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; - svSetValueString (ifcfg, "IPV6_ROUTE_METRIC", tmp); + svSetValueStr (ifcfg, "IPV6_ROUTE_METRIC", tmp); g_free (tmp); /* IPv6 Privacy Extensions */ @@ -2600,14 +2600,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: - svSetValueString (ifcfg, "IPV6_PRIVACY", "no"); + svSetValueStr (ifcfg, "IPV6_PRIVACY", "no"); break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_PUBLIC_ADDR: - svSetValueString (ifcfg, "IPV6_PRIVACY", "rfc3041"); - svSetValueString (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", "yes"); + svSetValueStr (ifcfg, "IPV6_PRIVACY", "rfc3041"); + svSetValueStr (ifcfg, "IPV6_PRIVACY_PREFER_PUBLIC_IP", "yes"); break; case NM_SETTING_IP6_CONFIG_PRIVACY_PREFER_TEMP_ADDR: - svSetValueString (ifcfg, "IPV6_PRIVACY", "rfc3041"); + svSetValueStr (ifcfg, "IPV6_PRIVACY", "rfc3041"); break; default: break; @@ -2618,7 +2618,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); - svSetValueString (ifcfg, "IPV6_ADDR_GEN_MODE", tmp); + svSetValueStr (ifcfg, "IPV6_ADDR_GEN_MODE", tmp); g_free (tmp); } else { svUnsetValue (ifcfg, "IPV6_ADDR_GEN_MODE"); @@ -2626,7 +2626,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)); - svSetValueString (ifcfg, "IPV6_TOKEN", value); + svSetValueStr (ifcfg, "IPV6_TOKEN", value); priority = nm_setting_ip_config_get_dns_priority (s_ip6); if (priority) diff --git a/src/settings/plugins/ifcfg-rh/shvar.c b/src/settings/plugins/ifcfg-rh/shvar.c index 65bcc0d9dd..d4c1ad49ef 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.c +++ b/src/settings/plugins/ifcfg-rh/shvar.c @@ -917,7 +917,7 @@ svGetValue (shvarFile *s, const char *key, char **to_free) * be freed by the caller. */ char * -svGetValueString (shvarFile *s, const char *key) +svGetValueStr_cp (shvarFile *s, const char *key) { char *to_free; const char *value; @@ -991,8 +991,8 @@ svGetValueInt64 (shvarFile *s, const char *key, guint base, gint64 min, gint64 m /*****************************************************************************/ -/* Same as svSetValueString() but it preserves empty @value -- contrary to - * svSetValueString() for which "" effectively means to remove the value. */ +/* Same as svSetValueStr() but it preserves empty @value -- contrary to + * svSetValueStr() for which "" effectively means to remove the value. */ void svSetValue (shvarFile *s, const char *key, const char *value) { @@ -1041,7 +1041,7 @@ svSetValue (shvarFile *s, const char *key, const char *value) * to the bottom of the file. */ void -svSetValueString (shvarFile *s, const char *key, const char *value) +svSetValueStr (shvarFile *s, const char *key, const char *value) { svSetValue (s, key, value && value[0] ? value : NULL); } diff --git a/src/settings/plugins/ifcfg-rh/shvar.h b/src/settings/plugins/ifcfg-rh/shvar.h index 3b35e30d1f..9f82e25970 100644 --- a/src/settings/plugins/ifcfg-rh/shvar.h +++ b/src/settings/plugins/ifcfg-rh/shvar.h @@ -49,7 +49,7 @@ shvarFile *svOpenFile (const char *name, GError **error); * be freed by the caller. */ const char *svGetValue (shvarFile *s, const char *key, char **to_free); -char *svGetValueString (shvarFile *s, const char *key); +char *svGetValueStr_cp (shvarFile *s, const char *key); gint svParseBoolean (const char *value, gint def); @@ -66,7 +66,7 @@ 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 svSetValueStr (shvarFile *s, const char *key, const char *value); void svSetValue (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 b05f05b5cc..fd4bdfdf7d 100644 --- a/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -81,7 +81,7 @@ shvarFile *const _f = (f); \ const char *const _key = (key); \ \ - _val_string = svGetValueString (_f, _key); \ + _val_string = svGetValueStr_cp (_f, _key); \ _val = svGetValue (_f, _key, &_to_free); \ g_assert_cmpstr (_val, ==, (expected_value)); \ g_assert ( (!_val_string && (!_val || !_val[0])) \ @@ -3275,7 +3275,7 @@ test_write_wired_wake_on_lan (void) &testfile); f = _svOpenFile (testfile); - val = svGetValueString (f, "ETHTOOL_OPTS"); + val = svGetValueStr_cp (f, "ETHTOOL_OPTS"); g_assert (val); g_assert (strstr (val, "wol")); g_assert (strstr (val, "sopass 00:00:00:11:22:33")); @@ -3310,7 +3310,7 @@ test_write_wired_auto_negotiate_off (void) &testfile); f = _svOpenFile (testfile); - val = svGetValueString (f, "ETHTOOL_OPTS"); + val = svGetValueStr_cp (f, "ETHTOOL_OPTS"); g_assert (val); g_assert (strstr (val, "autoneg off")); g_assert (strstr (val, "speed 10")); @@ -3344,7 +3344,7 @@ test_write_wired_auto_negotiate_on (void) &testfile); f = _svOpenFile (testfile); - val = svGetValueString (f, "ETHTOOL_OPTS"); + val = svGetValueStr_cp (f, "ETHTOOL_OPTS"); g_assert (val); g_assert (strstr (val, "autoneg on")); g_assert (!strstr (val, "speed")); @@ -4097,7 +4097,7 @@ test_write_wired_static_ip6_only_gw (gconstpointer user_data) nmtst_assert_connection_equals (connection, TRUE, reread, FALSE); ifcfg = _svOpenFile (testfile); - written_ifcfg_gateway = svGetValueString (ifcfg, "IPV6_DEFAULTGW"); + written_ifcfg_gateway = svGetValueStr_cp (ifcfg, "IPV6_DEFAULTGW"); svCloseFile (ifcfg); /* access the gateway from the loaded connection. */ @@ -4577,15 +4577,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"); - svSetValueString (ifcfg, "DEVICE", "alias0:2"); - svSetValueString (ifcfg, "IPADDR", "192.168.1.2"); + svSetValueStr (ifcfg, "DEVICE", "alias0:2"); + svSetValueStr (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"); - svSetValueString (ifcfg, "DEVICE", "alias0:5"); - svSetValueString (ifcfg, "IPADDR", "192.168.1.5"); + svSetValueStr (ifcfg, "DEVICE", "alias0:5"); + svSetValueStr (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)); |