diff options
author | Atul Anand <atulhjp@gmail.com> | 2016-09-05 21:34:27 +0530 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2016-10-04 11:44:44 +0200 |
commit | 812b8774f69682bbdb3ed4bd6557d6303aa8d03b (patch) | |
tree | ca9b16093eed921276a43ba7112b89e97e647cf0 | |
parent | 0a9d1e001bd1cc0639a97c7fa4fe5fe7b71937f7 (diff) | |
download | NetworkManager-812b8774f69682bbdb3ed4bd6557d6303aa8d03b.tar.gz |
proxy: remove unnecessary APIs
Unnecessary APIs have been removed from nm-setting-proxy, client like
nm-connection-editor are expected to create a PAC script snippet the load
the location of file in NM.
-rw-r--r-- | callouts/nm-dispatcher-utils.c | 8 | ||||
-rw-r--r-- | callouts/tests/dispatcher-external | 2 | ||||
-rw-r--r-- | callouts/tests/dispatcher-up | 2 | ||||
-rw-r--r-- | callouts/tests/dispatcher-vpn-down | 2 | ||||
-rw-r--r-- | callouts/tests/dispatcher-vpn-up | 2 | ||||
-rw-r--r-- | callouts/tests/test-dispatcher-envp.c | 14 | ||||
-rw-r--r-- | clients/cli/connections.c | 11 | ||||
-rw-r--r-- | clients/cli/settings.c | 196 | ||||
-rw-r--r-- | libnm-core/nm-setting-proxy.c | 581 | ||||
-rw-r--r-- | libnm-core/nm-setting-proxy.h | 37 | ||||
-rw-r--r-- | libnm/libnm.ver | 13 | ||||
-rw-r--r-- | src/nm-dispatcher.c | 8 | ||||
-rw-r--r-- | src/nm-pacrunner-manager.c | 32 | ||||
-rw-r--r-- | src/nm-proxy-config.c | 73 | ||||
-rw-r--r-- | src/nm-proxy-config.h | 5 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/reader.c | 114 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/writer.c | 90 |
17 files changed, 18 insertions, 1172 deletions
diff --git a/callouts/nm-dispatcher-utils.c b/callouts/nm-dispatcher-utils.c index 3fdf800f34..64a4b9ef6c 100644 --- a/callouts/nm-dispatcher-utils.c +++ b/callouts/nm-dispatcher-utils.c @@ -111,14 +111,6 @@ construct_proxy_items (GSList *items, GVariant *proxy_config, const char *prefix if (prefix == NULL) prefix = ""; - /* Proxies */ - val = g_variant_lookup_value (proxy_config, "proxies", G_VARIANT_TYPE_STRING_ARRAY); - if (val) { - items = _list_append_val_strv (items, g_variant_dup_strv (val, NULL), - "%sPROXIES=", prefix); - g_variant_unref (val); - } - /* PAC Url */ val = g_variant_lookup_value (proxy_config, "pac-url", G_VARIANT_TYPE_STRING); if (val) { diff --git a/callouts/tests/dispatcher-external b/callouts/tests/dispatcher-external index 2ff0c630a9..8c92241462 100644 --- a/callouts/tests/dispatcher-external +++ b/callouts/tests/dispatcher-external @@ -13,7 +13,6 @@ interface=virbr0 path=/org/freedesktop/NetworkManager/Devices/0 [proxy] -proxies=http://test.proxy.com https://sec.proxy.com pac-url=http://networkmanager.com/proxy.pac pac-script=path/to/script @@ -31,7 +30,6 @@ CONNECTION_ID=virbr0 CONNECTION_EXTERNAL=1 DEVICE_IFACE=virbr0 DEVICE_IP_IFACE=virbr0 -PROXIES=http://test.proxy.com https://sec.proxy.com PROXY_PAC_URL=http://networkmanager.com/proxy.pac PROXY_PAC_SCRIPT=path/to/script IP4_NUM_ADDRESSES=1 diff --git a/callouts/tests/dispatcher-up b/callouts/tests/dispatcher-up index d3f9c2998c..01d932a221 100644 --- a/callouts/tests/dispatcher-up +++ b/callouts/tests/dispatcher-up @@ -26,7 +26,6 @@ subnet_mask=255.255.255.0 expiry=1304300446 [proxy] -proxies=http://test.proxy.com https://sec.proxy.com pac-url=http://networkmanager.com/proxy.pac pac-script=path/to/script @@ -43,7 +42,6 @@ CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-up DEVICE_IFACE=wlan0 DEVICE_IP_IFACE=wlan0 -PROXIES=http://test.proxy.com https://sec.proxy.com PROXY_PAC_URL=http://networkmanager.com/proxy.pac PROXY_PAC_SCRIPT=path/to/script IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1 diff --git a/callouts/tests/dispatcher-vpn-down b/callouts/tests/dispatcher-vpn-down index 5f5823b809..8215eb7a36 100644 --- a/callouts/tests/dispatcher-vpn-down +++ b/callouts/tests/dispatcher-vpn-down @@ -26,7 +26,6 @@ subnet_mask=255.255.255.0 expiry=1304349405 [proxy] -proxies=http://test.proxy.com https://sec.proxy.com pac-url=http://networkmanager.com/proxy.pac pac-script=path/to/script @@ -43,7 +42,6 @@ CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-down DEVICE_IFACE=wlan0 DEVICE_IP_IFACE=tun0 -PROXIES=http://test.proxy.com https://sec.proxy.com PROXY_PAC_URL=http://networkmanager.com/proxy.pac PROXY_PAC_SCRIPT=path/to/script IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1 diff --git a/callouts/tests/dispatcher-vpn-up b/callouts/tests/dispatcher-vpn-up index fc2518c537..6a89023e6a 100644 --- a/callouts/tests/dispatcher-vpn-up +++ b/callouts/tests/dispatcher-vpn-up @@ -26,7 +26,6 @@ subnet_mask=255.255.255.0 expiry=1304349405 [proxy] -proxies=http://test.proxy.com https://sec.proxy.com pac-url=http://networkmanager.com/proxy.pac pac-script=path/to/script @@ -43,7 +42,6 @@ CONNECTION_ID=Random Connection CONNECTION_FILENAME=/callouts/tests/dispatcher-vpn-up DEVICE_IFACE=wlan0 DEVICE_IP_IFACE=tun0 -PROXIES=http://test.proxy.com https://sec.proxy.com PROXY_PAC_URL=http://networkmanager.com/proxy.pac PROXY_PAC_SCRIPT=path/to/script IP4_ADDRESS_0=192.168.1.119/24 192.168.1.1 diff --git a/callouts/tests/test-dispatcher-envp.c b/callouts/tests/test-dispatcher-envp.c index 8d84657abf..383beaab75 100644 --- a/callouts/tests/test-dispatcher-envp.c +++ b/callouts/tests/test-dispatcher-envp.c @@ -198,23 +198,9 @@ parse_proxy (GKeyFile *kf, GVariant **out_props, const char *section, GError **e { GVariantBuilder props; char *tmp; - char **split, **iter; g_variant_builder_init (&props, G_VARIANT_TYPE ("a{sv}")); - tmp = g_key_file_get_string (kf, section, "proxies", error); - if (tmp == NULL) - return FALSE; - split = g_strsplit_set (tmp, " ", -1); - g_free (tmp); - - if (split && g_strv_length (split) > 0) { - for (iter = split; iter && *iter; iter++) - g_strstrip (*iter); - g_variant_builder_add (&props, "{sv}", "proxies", g_variant_new_strv ((gpointer) split, -1)); - } - g_strfreev (split); - tmp = g_key_file_get_string (kf, section, "pac-url", error); if (tmp == NULL) return FALSE; diff --git a/clients/cli/connections.c b/clients/cli/connections.c index d93aea9f4a..61350da395 100644 --- a/clients/cli/connections.c +++ b/clients/cli/connections.c @@ -4305,17 +4305,6 @@ static OptionInfo option_info[] = { set_ip6_address, NULL }, { NM_SETTING_IP6_CONFIG_SETTING_NAME, NM_SETTING_IP_CONFIG_GATEWAY, "gw6", OPTION_NONE, N_("IPv6 gateway [none]"), NULL, NULL, NULL }, { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_METHOD, "method", OPTION_NONE, N_("Proxy method"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_PROXY, "http-proxy", OPTION_NONE, N_("HTTP Proxy"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_PORT, "http-port", OPTION_NONE, N_("HTTP Port"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_DEFAULT, "http-default", OPTION_NONE, N_("HTTP Default"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SSL_PROXY, "ssl-proxy", OPTION_NONE, N_("SSL Proxy"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SSL_PORT, "ssl-port", OPTION_NONE, N_("SSL Port"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_FTP_PROXY, "ftp-proxy", OPTION_NONE, N_("FTP Proxy"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_FTP_PORT, "ftp-port", OPTION_NONE, N_("FTP Port"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_PROXY, "socks-proxy", OPTION_NONE, N_("SOCKS Proxy"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_PORT, "socks-port", OPTION_NONE, N_("SOCKS Port"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_VERSION_5, "socks-version-5", OPTION_NONE, N_("SOCKS V5"), NULL, NULL, NULL }, - { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_NO_PROXY_FOR, "no-proxy-for", OPTION_NONE, N_("NO Proxy For"), NULL, NULL, NULL }, { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_BROWSER_ONLY, "browser-only", OPTION_NONE, N_("Browser Only"), NULL, NULL, NULL }, { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_URL, "pac-url", OPTION_NONE, N_("PAC Url"), NULL, NULL, NULL }, { NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_SCRIPT, "pac-script", OPTION_NONE, N_("PAC Script"), NULL, NULL, NULL }, diff --git a/clients/cli/settings.c b/clients/cli/settings.c index 385c9c4fc8..1926c86551 100644 --- a/clients/cli/settings.c +++ b/clients/cli/settings.c @@ -799,35 +799,13 @@ NmcOutputField nmc_fields_setting_vxlan[] = { NmcOutputField nmc_fields_setting_proxy[] = { SETTING_FIELD ("name"), /* 0 */ SETTING_FIELD (NM_SETTING_PROXY_METHOD), /* 1 */ - SETTING_FIELD (NM_SETTING_PROXY_HTTP_PROXY), /* 2 */ - SETTING_FIELD (NM_SETTING_PROXY_HTTP_PORT), /* 3 */ - SETTING_FIELD (NM_SETTING_PROXY_HTTP_DEFAULT), /* 4 */ - SETTING_FIELD (NM_SETTING_PROXY_SSL_PROXY), /* 5 */ - SETTING_FIELD (NM_SETTING_PROXY_SSL_PORT), /* 6 */ - SETTING_FIELD (NM_SETTING_PROXY_FTP_PROXY), /* 7 */ - SETTING_FIELD (NM_SETTING_PROXY_FTP_PORT), /* 8 */ - SETTING_FIELD (NM_SETTING_PROXY_SOCKS_PROXY), /* 9 */ - SETTING_FIELD (NM_SETTING_PROXY_SOCKS_PORT), /* 10 */ - SETTING_FIELD (NM_SETTING_PROXY_SOCKS_VERSION_5), /* 11 */ - SETTING_FIELD (NM_SETTING_PROXY_NO_PROXY_FOR), /* 12 */ - SETTING_FIELD (NM_SETTING_PROXY_BROWSER_ONLY), /* 13 */ - SETTING_FIELD (NM_SETTING_PROXY_PAC_URL), /* 14 */ - SETTING_FIELD (NM_SETTING_PROXY_PAC_SCRIPT), /* 15 */ + SETTING_FIELD (NM_SETTING_PROXY_BROWSER_ONLY), /* 2 */ + SETTING_FIELD (NM_SETTING_PROXY_PAC_URL), /* 3 */ + SETTING_FIELD (NM_SETTING_PROXY_PAC_SCRIPT), /* 4 */ {NULL, NULL, 0, NULL, FALSE, FALSE, 0} }; #define NMC_FIELDS_SETTING_PROXY_ALL "name"","\ NM_SETTING_PROXY_METHOD","\ - NM_SETTING_PROXY_HTTP_PROXY","\ - NM_SETTING_PROXY_HTTP_PORT","\ - NM_SETTING_PROXY_HTTP_DEFAULT","\ - NM_SETTING_PROXY_SSL_PROXY","\ - NM_SETTING_PROXY_SSL_PORT","\ - NM_SETTING_PROXY_FTP_PROXY","\ - NM_SETTING_PROXY_FTP_PORT","\ - NM_SETTING_PROXY_SOCKS_PROXY","\ - NM_SETTING_PROXY_SOCKS_PORT","\ - NM_SETTING_PROXY_SOCKS_VERSION_5","\ - NM_SETTING_PROXY_NO_PROXY_FOR","\ NM_SETTING_PROXY_BROWSER_ONLY","\ NM_SETTING_PROXY_PAC_URL","\ NM_SETTING_PROXY_PAC_SCRIPT @@ -2137,17 +2115,6 @@ DEFINE_GETTER (nmc_property_vxlan_get_l2_miss, NM_SETTING_VXLAN_L2_MISS) DEFINE_GETTER (nmc_property_vxlan_get_l3_miss, NM_SETTING_VXLAN_L3_MISS) /* --- NM_SETTING_PROXY_SETTING_NAME property get functions --- */ -DEFINE_GETTER (nmc_property_proxy_get_http_proxy, NM_SETTING_PROXY_HTTP_PROXY) -DEFINE_GETTER (nmc_property_proxy_get_http_port, NM_SETTING_PROXY_HTTP_PORT) -DEFINE_GETTER (nmc_property_proxy_get_http_default, NM_SETTING_PROXY_HTTP_DEFAULT) -DEFINE_GETTER (nmc_property_proxy_get_ssl_proxy, NM_SETTING_PROXY_SSL_PROXY) -DEFINE_GETTER (nmc_property_proxy_get_ssl_port, NM_SETTING_PROXY_SSL_PORT) -DEFINE_GETTER (nmc_property_proxy_get_ftp_proxy, NM_SETTING_PROXY_FTP_PROXY) -DEFINE_GETTER (nmc_property_proxy_get_ftp_port, NM_SETTING_PROXY_FTP_PORT) -DEFINE_GETTER (nmc_property_proxy_get_socks_proxy, NM_SETTING_PROXY_SOCKS_PROXY) -DEFINE_GETTER (nmc_property_proxy_get_socks_port, NM_SETTING_PROXY_SOCKS_PORT) -DEFINE_GETTER (nmc_property_proxy_get_socks_version_5, NM_SETTING_PROXY_SOCKS_VERSION_5) -DEFINE_GETTER (nmc_property_proxy_get_no_proxy_for, NM_SETTING_PROXY_NO_PROXY_FOR) DEFINE_GETTER (nmc_property_proxy_get_browser_only, NM_SETTING_PROXY_BROWSER_ONLY) DEFINE_GETTER (nmc_property_proxy_get_pac_url, NM_SETTING_PROXY_PAC_URL) DEFINE_GETTER (nmc_property_proxy_get_pac_script, NM_SETTING_PROXY_PAC_SCRIPT) @@ -2190,32 +2157,6 @@ nmc_property_proxy_set_method (NMSetting *setting, const char *prop, return TRUE; } -/* No Proxy For */ -static gboolean -nmc_property_proxy_set_no_proxy_for (NMSetting *setting, const char *prop, const char *val, GError **error) -{ - char **strv = NULL, **no_proxy_for = NULL, **iter; - GPtrArray *tmp_array = NULL; - - g_return_val_if_fail (error == NULL || *error == NULL, FALSE); - - tmp_array = g_ptr_array_new (); - strv = nmc_strsplit_set (val, " \t,", 0); - for (iter = strv; iter && *iter; iter++) { - char *stripped = g_strstrip (*iter); - - if (strlen (stripped)) - g_ptr_array_add (tmp_array, g_strdup (stripped)); - } - g_strfreev (strv); - - g_ptr_array_add (tmp_array, NULL); - no_proxy_for = (char **) g_ptr_array_free (tmp_array, (tmp_array->len == 1)); - - g_object_set (setting, prop, no_proxy_for, NULL); - return TRUE; -} - /*----------------------------------------------------------------------------*/ static void @@ -2433,43 +2374,8 @@ proxy_method_changed_cb (GObject *object, GParamSpec *pspec, gpointer user_data) method = nm_setting_proxy_get_method (NM_SETTING_PROXY (object)); - switch (method) { - case NM_SETTING_PROXY_METHOD_AUTO: - g_object_set (object, - NM_SETTING_PROXY_HTTP_PROXY, NULL, - NM_SETTING_PROXY_HTTP_PORT, 0, - NM_SETTING_PROXY_HTTP_DEFAULT, FALSE, - NM_SETTING_PROXY_SSL_PROXY, NULL, - NM_SETTING_PROXY_SSL_PORT, 0, - NM_SETTING_PROXY_FTP_PROXY, NULL, - NM_SETTING_PROXY_FTP_PORT, 0, - NM_SETTING_PROXY_SOCKS_PROXY, NULL, - NM_SETTING_PROXY_SOCKS_PORT, 0, - NM_SETTING_PROXY_SOCKS_VERSION_5, FALSE, - NM_SETTING_PROXY_NO_PROXY_FOR, NULL, - NULL); - - break; - case NM_SETTING_PROXY_METHOD_MANUAL: - g_object_set (object, - NM_SETTING_PROXY_PAC_URL, NULL, - NM_SETTING_PROXY_PAC_SCRIPT, NULL, - NULL); - - break; - case NM_SETTING_PROXY_METHOD_NONE: + if (method == NM_SETTING_PROXY_METHOD_NONE) { g_object_set (object, - NM_SETTING_PROXY_HTTP_PROXY, NULL, - NM_SETTING_PROXY_HTTP_PORT, 0, - NM_SETTING_PROXY_HTTP_DEFAULT, FALSE, - NM_SETTING_PROXY_SSL_PROXY, NULL, - NM_SETTING_PROXY_SSL_PORT, 0, - NM_SETTING_PROXY_FTP_PROXY, NULL, - NM_SETTING_PROXY_FTP_PORT, 0, - NM_SETTING_PROXY_SOCKS_PROXY, NULL, - NM_SETTING_PROXY_SOCKS_PORT, 0, - NM_SETTING_PROXY_SOCKS_VERSION_5, FALSE, - NM_SETTING_PROXY_NO_PROXY_FOR, NULL, NM_SETTING_PROXY_PAC_URL, NULL, NM_SETTING_PROXY_PAC_SCRIPT, NULL, NULL); @@ -7975,83 +7881,6 @@ nmc_properties_init (void) NULL, NULL, NULL); - nmc_add_prop_funcs (GLUE (PROXY, HTTP_PROXY), - nmc_property_proxy_get_http_proxy, - nmc_property_set_string, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, HTTP_PORT), - nmc_property_proxy_get_http_port, - nmc_property_set_uint, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, HTTP_DEFAULT), - nmc_property_proxy_get_http_default, - nmc_property_set_bool, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, SSL_PROXY), - nmc_property_proxy_get_ssl_proxy, - nmc_property_set_string, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, SSL_PORT), - nmc_property_proxy_get_ssl_port, - nmc_property_set_uint, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, FTP_PROXY), - nmc_property_proxy_get_ftp_proxy, - nmc_property_set_string, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, FTP_PORT), - nmc_property_proxy_get_ftp_port, - nmc_property_set_uint, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, SOCKS_PROXY), - nmc_property_proxy_get_socks_proxy, - nmc_property_set_string, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, SOCKS_PORT), - nmc_property_proxy_get_socks_port, - nmc_property_set_uint, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, SOCKS_VERSION_5), - nmc_property_proxy_get_socks_version_5, - nmc_property_set_bool, - NULL, - NULL, - NULL, - NULL); - nmc_add_prop_funcs (GLUE (PROXY, NO_PROXY_FOR), - nmc_property_proxy_get_no_proxy_for, - nmc_property_proxy_set_no_proxy_for, - NULL, - NULL, - NULL, - NULL); nmc_add_prop_funcs (GLUE (PROXY, BROWSER_ONLY), nmc_property_proxy_get_browser_only, nmc_property_set_bool, @@ -9388,20 +9217,9 @@ setting_proxy_details (NMSetting *setting, NmCli *nmc, const char *one_prop, gb arr = nmc_dup_fields_array (tmpl, tmpl_len, NMC_OF_FLAG_SECTION_PREFIX); set_val_str (arr, 0, g_strdup (nm_setting_get_name (setting))); set_val_str (arr, 1, nmc_property_proxy_get_method (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 2, nmc_property_proxy_get_http_proxy (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 3, nmc_property_proxy_get_http_port (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 4, nmc_property_proxy_get_http_default (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 5, nmc_property_proxy_get_ssl_proxy (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 6, nmc_property_proxy_get_ssl_port (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 7, nmc_property_proxy_get_ftp_proxy (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 8, nmc_property_proxy_get_ftp_port (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 9, nmc_property_proxy_get_socks_proxy (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 10, nmc_property_proxy_get_socks_port (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 11, nmc_property_proxy_get_socks_version_5 (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 12, nmc_property_proxy_get_no_proxy_for (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 13, nmc_property_proxy_get_browser_only (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 14, nmc_property_proxy_get_pac_url (setting, NMC_PROPERTY_GET_PRETTY)); - set_val_str (arr, 15, nmc_property_proxy_get_pac_script (setting, NMC_PROPERTY_GET_PRETTY)); + set_val_str (arr, 2, nmc_property_proxy_get_browser_only (setting, NMC_PROPERTY_GET_PRETTY)); + set_val_str (arr, 3, nmc_property_proxy_get_pac_url (setting, NMC_PROPERTY_GET_PRETTY)); + set_val_str (arr, 4, nmc_property_proxy_get_pac_script (setting, NMC_PROPERTY_GET_PRETTY)); g_ptr_array_add (nmc->output_data, arr); print_data (nmc); /* Print all data */ diff --git a/libnm-core/nm-setting-proxy.c b/libnm-core/nm-setting-proxy.c index d2ec32ef80..33cb7363cf 100644 --- a/libnm-core/nm-setting-proxy.c +++ b/libnm-core/nm-setting-proxy.c @@ -32,12 +32,11 @@ * The #NMSettingProxy object is a #NMSetting subclass that describes properties * related to Proxy settings like Pac Url, Pac Script etc. * - * NetworkManager support 3 values for the #NMSettingProxy:method property for + * NetworkManager support 2 values for the #NMSettingProxy:method property for * proxy. If "auto" is specified then WPAD takes places and the appropriate details * are pushed into PacRunner or user can override this URL with a new PAC url or a - * PAC Script. If "manual" is selected then users can specify different proxy servers - * for different protocols. If "none" is selected then no proxy configuration is given - * to PacRunner to fulfill client queries. + * PAC Script. If "none" is selected then no proxy configuration is given to PacRunner + * to fulfill client queries. **/ G_DEFINE_TYPE_WITH_CODE (NMSettingProxy, nm_setting_proxy, NM_TYPE_SETTING, @@ -48,17 +47,6 @@ NM_SETTING_REGISTER_TYPE (NM_TYPE_SETTING_PROXY) typedef struct { NMSettingProxyMethod method; - char *http_proxy; - guint32 http_port; - gboolean http_default; - char *ssl_proxy; - guint32 ssl_port; - char *ftp_proxy; - guint32 ftp_port; - char *socks_proxy; - guint32 socks_port; - gboolean socks_version_5; - char **no_proxy_for; gboolean browser_only; char *pac_url; char *pac_script; @@ -67,17 +55,6 @@ typedef struct { enum { PROP_0, PROP_METHOD, - PROP_HTTP_PROXY, - PROP_HTTP_PORT, - PROP_HTTP_DEFAULT, - PROP_SSL_PROXY, - PROP_SSL_PORT, - PROP_FTP_PROXY, - PROP_FTP_PORT, - PROP_SOCKS_PROXY, - PROP_SOCKS_PORT, - PROP_SOCKS_VERSION_5, - PROP_NO_PROXY_FOR, PROP_BROWSER_ONLY, PROP_PAC_URL, PROP_PAC_SCRIPT, @@ -121,189 +98,6 @@ nm_setting_proxy_get_method (NMSettingProxy *setting) } /** - * nm_setting_proxy_get_http_proxy: - * @setting: the #NMSettingProxy - * - * Returns: the HTTP proxy - * - * Since: 1.6 - **/ -const char * -nm_setting_proxy_get_http_proxy (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), NULL); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->http_proxy; -} - -/** - * nm_setting_proxy_get_http_port: - * @setting: the #NMSettingProxy - * - * Returns: the HTTP port number - * - * Since: 1.6 - **/ -guint32 -nm_setting_proxy_get_http_port (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), 0); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->http_port; -} - -/** - * nm_setting_proxy_get_http_default: - * @setting: the #NMSettingProxy - * - * Returns: TRUE if HTTP Proxy is default for all - * protocols. FALSE if not. - * - * Since: 1.6 - **/ -gboolean -nm_setting_proxy_get_http_default (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), FALSE); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->http_default; -} - -/** - * nm_setting_proxy_get_ssl_proxy: - * @setting: the #NMSettingProxy - * - * Returns: the SSL proxy - * - * Since: 1.6 - **/ -const char * -nm_setting_proxy_get_ssl_proxy (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), NULL); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->ssl_proxy; -} - -/** - * nm_setting_proxy_get_ssl_port: - * @setting: the #NMSettingProxy - * - * Returns: the SSL port number - * - * Since: 1.6 - **/ -guint32 -nm_setting_proxy_get_ssl_port (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), 0); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->ssl_port; -} - -/** - * nm_setting_proxy_get_ftp_proxy: - * @setting: the #NMSettingProxy - * - * Returns: the FTP proxy - * - * Since: 1.6 - **/ -const char * -nm_setting_proxy_get_ftp_proxy (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), NULL); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->ftp_proxy; -} - -/** - * nm_setting_proxy_get_ftp_port: - * @setting: the #NMSettingProxy - * - * Returns: the FTP port number - * - * Since: 1.6 - **/ -guint32 -nm_setting_proxy_get_ftp_port (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), 0); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->ftp_port; -} - -/** - * nm_setting_proxy_get_socks_proxy: - * @setting: the #NMSettingProxy - * - * Returns: the SOCKS proxy - * - * Since: 1.6 - **/ -const char * -nm_setting_proxy_get_socks_proxy (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), NULL); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->socks_proxy; -} - -/** - * nm_setting_proxy_get_socks_port: - * @setting: the #NMSettingProxy - * - * Returns: the SOCKS port number - * - * Since: 1.6 - **/ -guint32 -nm_setting_proxy_get_socks_port (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), 0); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->socks_port; -} - -/** - * nm_setting_proxy_get_socks_version_5: - * @setting: the #NMSettingProxy - * - * Returns: TRUE if SOCKS version is 5. - * FALSE if SOCKS version is 4. - * - * Since: 1.6 -**/ -gboolean -nm_setting_proxy_get_socks_version_5 (NMSettingProxy *setting) -{ - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), FALSE); - - return NM_SETTING_PROXY_GET_PRIVATE (setting)->socks_version_5; -} - -/** - * nm_setting_proxy_get_no_proxy_for: - * @setting: the #NMSettingProxy - * - * Returns: (transfer none): the hosts to be excluded from proxy - * - * Since: 1.6 - **/ -const char *const* -nm_setting_proxy_get_no_proxy_for (NMSettingProxy *setting) -{ - NMSettingProxyPrivate *priv; - - g_return_val_if_fail (NM_IS_SETTING_PROXY (setting), NULL); - - priv = NM_SETTING_PROXY_GET_PRIVATE (setting); - - return ((const char *const*) priv->no_proxy_for) - ?: ((const char *const*) &priv->no_proxy_for); -} - -/** * nm_setting_proxy_get_browser_only: * @setting: the #NMSettingProxy * @@ -359,131 +153,12 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) NMSettingProxyMethod method; method = priv->method; - if (method == NM_SETTING_PROXY_METHOD_AUTO || method == NM_SETTING_PROXY_METHOD_NONE) { - if (priv->http_proxy) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_PROXY); - return FALSE; - } - - if (priv->http_port) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_PORT); - return FALSE; - } - - if (priv->http_default) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_HTTP_DEFAULT); - return FALSE; - } - - if (priv->ssl_proxy) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SSL_PROXY); - return FALSE; - } - - if (priv->ssl_port) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SSL_PORT); - return FALSE; - } - - if (priv->ftp_proxy) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_FTP_PROXY); - return FALSE; - } - - if (priv->ftp_port) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_FTP_PORT); - return FALSE; - } - - if (priv->socks_proxy) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_PROXY); - return FALSE; - } - - if (priv->socks_port) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_PORT); - return FALSE; - } - - if (priv->socks_version_5) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_SOCKS_VERSION_5); - return FALSE; - } - - if (priv->no_proxy_for) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method auto/none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_NO_PROXY_FOR); - return FALSE; - } - - if (method == NM_SETTING_PROXY_METHOD_NONE) { - if (priv->pac_url) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_URL); - return FALSE; - } - - if (priv->pac_script) { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method none")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_SCRIPT); - return FALSE; - } - } - } else if (method == NM_SETTING_PROXY_METHOD_MANUAL) { + if (method == NM_SETTING_PROXY_METHOD_NONE) { if (priv->pac_url) { g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method manual")); + _("this property is not allowed for method none")); g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_URL); return FALSE; } @@ -492,17 +167,10 @@ verify (NMSetting *setting, NMConnection *connection, GError **error) g_set_error (error, NM_CONNECTION_ERROR, NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("this property is not allowed for method manual")); + _("this property is not allowed for method none")); g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_PAC_SCRIPT); return FALSE; } - } else { - g_set_error (error, - NM_CONNECTION_ERROR, - NM_CONNECTION_ERROR_INVALID_PROPERTY, - _("unknown method")); - g_prefix_error (error, "%s.%s: ", NM_SETTING_PROXY_SETTING_NAME, NM_SETTING_PROXY_METHOD); - return FALSE; } return TRUE; @@ -522,15 +190,9 @@ finalize (GObject *object) NMSettingProxy *self = NM_SETTING_PROXY (object); NMSettingProxyPrivate *priv = NM_SETTING_PROXY_GET_PRIVATE (self); - g_free (priv->http_proxy); - g_free (priv->ssl_proxy); - g_free (priv->ftp_proxy); - g_free (priv->socks_proxy); g_free (priv->pac_url); g_free (priv->pac_script); - g_strfreev (priv->no_proxy_for); - G_OBJECT_CLASS (nm_setting_proxy_parent_class)->finalize (object); } @@ -544,39 +206,6 @@ get_property (GObject *object, guint prop_id, case PROP_METHOD: g_value_set_int (value, nm_setting_proxy_get_method (setting)); break; - case PROP_HTTP_PROXY: - g_value_set_string (value, nm_setting_proxy_get_http_proxy (setting)); - break; - case PROP_HTTP_PORT: - g_value_set_uint (value, nm_setting_proxy_get_http_port (setting)); - break; - case PROP_HTTP_DEFAULT: - g_value_set_boolean (value, nm_setting_proxy_get_http_default (setting)); - break; - case PROP_SSL_PROXY: - g_value_set_string (value, nm_setting_proxy_get_ssl_proxy (setting)); - break; - case PROP_SSL_PORT: - g_value_set_uint (value, nm_setting_proxy_get_ssl_port (setting)); - break; - case PROP_FTP_PROXY: - g_value_set_string (value, nm_setting_proxy_get_ftp_proxy (setting)); - break; - case PROP_FTP_PORT: - g_value_set_uint (value, nm_setting_proxy_get_ftp_port (setting)); - break; - case PROP_SOCKS_PROXY: - g_value_set_string (value, nm_setting_proxy_get_socks_proxy (setting)); - break; - case PROP_SOCKS_PORT: - g_value_set_uint (value, nm_setting_proxy_get_socks_port (setting)); - break; - case PROP_SOCKS_VERSION_5: - g_value_set_boolean (value, nm_setting_proxy_get_socks_version_5 (setting)); - break; - case PROP_NO_PROXY_FOR: - g_value_set_boxed (value, nm_setting_proxy_get_no_proxy_for (setting)); - break; case PROP_BROWSER_ONLY: g_value_set_boolean (value, nm_setting_proxy_get_browser_only (setting)); break; @@ -602,50 +231,6 @@ set_property (GObject *object, guint prop_id, case PROP_METHOD: priv->method = g_value_get_int (value); break; - case PROP_HTTP_PROXY: - g_free (priv->http_proxy); - priv->http_proxy = g_value_dup_string (value); - break; - case PROP_HTTP_PORT: - priv->http_port = g_value_get_uint (value); - break; - case PROP_HTTP_DEFAULT: - priv->http_default = g_value_get_boolean (value); - break; - case PROP_SSL_PROXY: - g_free (priv->ssl_proxy); - priv->ssl_proxy = g_value_dup_string (value); - break; - case PROP_SSL_PORT: - priv->ssl_port = g_value_get_uint (value); - break; - case PROP_FTP_PROXY: - g_free (priv->ftp_proxy); - priv->ftp_proxy = g_value_dup_string (value); - break; - case PROP_FTP_PORT: - priv->ftp_port = g_value_get_uint (value); - break; - case PROP_SOCKS_PROXY: - g_free (priv->socks_proxy); - priv->socks_proxy = g_value_dup_string (value); - break; - case PROP_SOCKS_PORT: - priv->socks_port = g_value_get_uint (value); - break; - case PROP_SOCKS_VERSION_5: - priv->socks_version_5 = g_value_get_boolean (value); - break; - case PROP_NO_PROXY_FOR: - g_strfreev (priv->no_proxy_for); - priv->no_proxy_for = g_value_get_boxed (value); - if (priv->no_proxy_for) { - if (priv->no_proxy_for[0]) - priv->no_proxy_for = g_strdupv (priv->no_proxy_for); - else - priv->no_proxy_for = NULL; - } - break; case PROP_BROWSER_ONLY: priv->browser_only = g_value_get_boolean (value); break; @@ -693,160 +278,6 @@ nm_setting_proxy_class_init (NMSettingProxyClass *setting_class) G_PARAM_STATIC_STRINGS)); /** - * NMSettingProxy:http-proxy: - * - * HTTP proxy - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_HTTP_PROXY, - g_param_spec_string (NM_SETTING_PROXY_HTTP_PROXY, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:http-port: - * - * Port number for HTTP proxy - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_HTTP_PORT, - g_param_spec_uint (NM_SETTING_PROXY_HTTP_PORT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:http-default: - * - * Make HTTP proxy default for all protocols. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_HTTP_DEFAULT, - g_param_spec_boolean (NM_SETTING_PROXY_HTTP_DEFAULT, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:ssl-proxy: - * - * SSL proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_SSL_PROXY, - g_param_spec_string (NM_SETTING_PROXY_SSL_PROXY, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:ssl-port: - * - * Port number for SSL proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_SSL_PORT, - g_param_spec_uint (NM_SETTING_PROXY_SSL_PORT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:ftp-proxy: - * - * FTP proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_FTP_PROXY, - g_param_spec_string (NM_SETTING_PROXY_FTP_PROXY, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:ftp-port: - * - * Port number for FTP proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_FTP_PORT, - g_param_spec_uint (NM_SETTING_PROXY_FTP_PORT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:socks-proxy: - * - * SOCKS proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_SOCKS_PROXY, - g_param_spec_string (NM_SETTING_PROXY_SOCKS_PROXY, "", "", - NULL, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:socks-port: - * - * Port number for SOCKS proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_SOCKS_PORT, - g_param_spec_uint (NM_SETTING_PROXY_SOCKS_PORT, "", "", - 0, G_MAXUINT32, 0, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:socks-version-5: - * - * set %TRUE if SOCKS version is 5. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_SOCKS_VERSION_5, - g_param_spec_boolean (NM_SETTING_PROXY_SOCKS_VERSION_5, "", "", - FALSE, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** - * NMSettingProxy:nm-proxy-for: - * - * Array of host to be excluded from proxy. - * - * Since: 1.6 - **/ - g_object_class_install_property - (object_class, PROP_NO_PROXY_FOR, - g_param_spec_boxed (NM_SETTING_PROXY_NO_PROXY_FOR, "", "", - G_TYPE_STRV, - G_PARAM_READWRITE | - G_PARAM_STATIC_STRINGS)); - - /** * NMSettingProxy:browser-only: * * TRUE if Proxy is for Browser Stuff. diff --git a/libnm-core/nm-setting-proxy.h b/libnm-core/nm-setting-proxy.h index 81c4906ac9..c51359fb22 100644 --- a/libnm-core/nm-setting-proxy.h +++ b/libnm-core/nm-setting-proxy.h @@ -32,8 +32,7 @@ G_BEGIN_DECLS /** * NMSettingProxyMethod: - * @NM_SETTING_PROXY_METHOD_AUTO: DHCP obtained Proxy - * @NM_SETTING_PROXY_METHOD_MANUAL: Manual mode + * @NM_SETTING_PROXY_METHOD_AUTO: DHCP obtained Proxy/ Manual override * @NM_SETTING_PROXY_METHOD_NONE: No Proxy for the Connection * * The Proxy method. @@ -42,7 +41,6 @@ G_BEGIN_DECLS */ typedef enum { NM_SETTING_PROXY_METHOD_AUTO = 0, - NM_SETTING_PROXY_METHOD_MANUAL, NM_SETTING_PROXY_METHOD_NONE } NMSettingProxyMethod; @@ -56,17 +54,6 @@ typedef enum { #define NM_SETTING_PROXY_SETTING_NAME "proxy" #define NM_SETTING_PROXY_METHOD "method" -#define NM_SETTING_PROXY_HTTP_PROXY "http-proxy" -#define NM_SETTING_PROXY_HTTP_PORT "http-port" -#define NM_SETTING_PROXY_HTTP_DEFAULT "http-default" -#define NM_SETTING_PROXY_SSL_PROXY "ssl-proxy" -#define NM_SETTING_PROXY_SSL_PORT "ssl-port" -#define NM_SETTING_PROXY_FTP_PROXY "ftp-proxy" -#define NM_SETTING_PROXY_FTP_PORT "ftp-port" -#define NM_SETTING_PROXY_SOCKS_PROXY "socks-proxy" -#define NM_SETTING_PROXY_SOCKS_PORT "socks-port" -#define NM_SETTING_PROXY_SOCKS_VERSION_5 "socks-version-5" -#define NM_SETTING_PROXY_NO_PROXY_FOR "no-proxy-for" #define NM_SETTING_PROXY_BROWSER_ONLY "browser-only" #define NM_SETTING_PROXY_PAC_URL "pac-url" #define NM_SETTING_PROXY_PAC_SCRIPT "pac-script" @@ -90,28 +77,6 @@ NMSetting *nm_setting_proxy_new (void); NM_AVAILABLE_IN_1_6 NMSettingProxyMethod nm_setting_proxy_get_method (NMSettingProxy *setting); NM_AVAILABLE_IN_1_6 -const char *nm_setting_proxy_get_http_proxy (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -guint32 nm_setting_proxy_get_http_port (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -gboolean nm_setting_proxy_get_http_default (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -const char *nm_setting_proxy_get_ssl_proxy (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -guint32 nm_setting_proxy_get_ssl_port (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -const char *nm_setting_proxy_get_ftp_proxy (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -guint32 nm_setting_proxy_get_ftp_port (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -const char *nm_setting_proxy_get_socks_proxy (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -guint32 nm_setting_proxy_get_socks_port (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -gboolean nm_setting_proxy_get_socks_version_5 (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 -const char *const*nm_setting_proxy_get_no_proxy_for (NMSettingProxy *setting); -NM_AVAILABLE_IN_1_6 gboolean nm_setting_proxy_get_browser_only (NMSettingProxy *setting); NM_AVAILABLE_IN_1_6 const char *nm_setting_proxy_get_pac_url (NMSettingProxy *setting); diff --git a/libnm/libnm.ver b/libnm/libnm.ver index 8c0e34f0d1..46e91d9e93 100644 --- a/libnm/libnm.ver +++ b/libnm/libnm.ver @@ -1092,19 +1092,8 @@ global: nm_setting_proxy_new; nm_setting_proxy_get_method; nm_setting_proxy_method_get_type; - nm_setting_proxy_get_http_proxy; - nm_setting_proxy_get_http_port; - nm_setting_proxy_get_http_default; - nm_setting_proxy_get_ssl_proxy; - nm_setting_proxy_get_ssl_port; - nm_setting_proxy_get_ftp_proxy; - nm_setting_proxy_get_ftp_port; - nm_setting_proxy_get_socks_proxy; - nm_setting_proxy_get_socks_port; - nm_setting_proxy_get_socks_version_5; - nm_setting_proxy_get_pac_script; - nm_setting_proxy_get_no_proxy_for; nm_setting_proxy_get_browser_only; nm_setting_proxy_get_pac_url; + nm_setting_proxy_get_pac_script; nm_utils_is_json_object; } libnm_1_4_0; diff --git a/src/nm-dispatcher.c b/src/nm-dispatcher.c index a7b8e15818..64ebfc66d4 100644 --- a/src/nm-dispatcher.c +++ b/src/nm-dispatcher.c @@ -94,19 +94,11 @@ _get_monitor_by_action (DispatcherAction action) static void dump_proxy_to_props (NMProxyConfig *proxy, GVariantBuilder *builder) { - const char *const*proxies; const char *pac_url = NULL, *pac_script = NULL; if (nm_proxy_config_get_method (proxy) == NM_PROXY_CONFIG_METHOD_NONE) return; - proxies = nm_proxy_config_get_proxies (proxy); - if (proxies && proxies[0]) { - g_variant_builder_add (builder, "{sv}", - "proxies", - g_variant_new_strv (proxies, -1)); - } - pac_url = nm_proxy_config_get_pac_url (proxy); if (pac_url) { g_variant_builder_add (builder, "{sv}", diff --git a/src/nm-pacrunner-manager.c b/src/nm-pacrunner-manager.c index d401e03afa..3631257f3a 100644 --- a/src/nm-pacrunner-manager.c +++ b/src/nm-pacrunner-manager.c @@ -102,13 +102,11 @@ static void add_proxy_config (NMPacRunnerManager *self, GVariantBuilder *proxy_data, const NMProxyConfig *proxy_config) { const char *pac_url, *pac_script; - const char *const*proxies; - const char *const*excludes; NMProxyConfigMethod method; method = nm_proxy_config_get_method (proxy_config); - switch (method) { - case NM_PROXY_CONFIG_METHOD_AUTO: + + if (method == NM_PROXY_CONFIG_METHOD_AUTO) { pac_url = nm_proxy_config_get_pac_url (proxy_config); if (pac_url) { g_variant_builder_add (proxy_data, "{sv}", @@ -126,26 +124,6 @@ add_proxy_config (NMPacRunnerManager *self, GVariantBuilder *proxy_data, const N g_variant_new_take_string (contents)); } } - - break; - case NM_PROXY_CONFIG_METHOD_MANUAL: - proxies = nm_proxy_config_get_proxies (proxy_config); - if (proxies && proxies[0]) { - g_variant_builder_add (proxy_data, "{sv}", - "Servers", - g_variant_new_strv (proxies, -1)); - } - - excludes = nm_proxy_config_get_excludes (proxy_config); - if (excludes && excludes[0]) { - g_variant_builder_add (proxy_data, "{sv}", - "Excludes", - g_variant_new_strv (excludes, -1)); - } - - break; - case NM_PROXY_CONFIG_METHOD_NONE: - break; } g_variant_builder_add (proxy_data, "{sv}", @@ -376,12 +354,6 @@ nm_pac_runner_manager_send (NMPacRunnerManager *self, g_variant_new_string ("auto")); break; - case NM_PROXY_CONFIG_METHOD_MANUAL: - g_variant_builder_add (&proxy_data, "{sv}", - "Method", - g_variant_new_string ("manual")); - - break; case NM_PROXY_CONFIG_METHOD_NONE: g_variant_builder_add (&proxy_data, "{sv}", "Method", diff --git a/src/nm-proxy-config.c b/src/nm-proxy-config.c index fca3301825..906951cab9 100644 --- a/src/nm-proxy-config.c +++ b/src/nm-proxy-config.c @@ -28,8 +28,6 @@ typedef struct { NMProxyConfigMethod method; - char **proxies; - char **excludes; gboolean browser_only; char *pac_url; char *pac_script; @@ -61,12 +59,6 @@ G_DEFINE_TYPE (NMProxyConfig, nm_proxy_config, G_TYPE_OBJECT) /*****************************************************************************/ -static char ** -_strdupv_nonempty (const char *const* strv) -{ - return (!strv || !strv[0]) ? NULL : g_strdupv ((char **) strv); -} - NMProxyConfig * nm_proxy_config_new (void) { @@ -93,10 +85,8 @@ void nm_proxy_config_merge_setting (NMProxyConfig *config, NMSettingProxy *setting) { const char *tmp = NULL; - guint32 port = 0; NMProxyConfigPrivate *priv; NMSettingProxyMethod method; - GPtrArray *proxies; if (!setting) return; @@ -105,8 +95,6 @@ nm_proxy_config_merge_setting (NMProxyConfig *config, NMSettingProxy *setting) priv = NM_PROXY_CONFIG_GET_PRIVATE (config); - g_clear_pointer (&priv->proxies, g_strfreev); - g_clear_pointer (&priv->excludes, g_strfreev); g_clear_pointer (&priv->pac_script, g_free); method = nm_setting_proxy_get_method (setting); @@ -127,47 +115,6 @@ nm_proxy_config_merge_setting (NMProxyConfig *config, NMSettingProxy *setting) priv->pac_script = g_strdup (tmp); break; - case NM_SETTING_PROXY_METHOD_MANUAL: - priv->method = NM_PROXY_CONFIG_METHOD_MANUAL; - - priv->excludes = _strdupv_nonempty (nm_setting_proxy_get_no_proxy_for (setting)); - - - tmp = nm_setting_proxy_get_http_proxy (setting); - port = nm_setting_proxy_get_http_port (setting); - - /* If HTTP Proxy has been selected for all Protocols - * set up a generic proxy in PacRunner i.e without a - * protocol prefix. - */ - proxies = g_ptr_array_new (); - if (nm_setting_proxy_get_http_default (setting)) { - if (tmp && port) - g_ptr_array_add (proxies, g_strdup_printf ("%s:%u/", tmp, port)); - } else { - if (tmp && port) - g_ptr_array_add (proxies, g_strdup_printf ("http://%s:%u/", tmp, port)); - - tmp = nm_setting_proxy_get_ssl_proxy (setting); - port = nm_setting_proxy_get_ssl_port (setting); - if (tmp && port) - g_ptr_array_add (proxies, g_strdup_printf ("https://%s:%u/", tmp, port)); - - tmp = nm_setting_proxy_get_ftp_proxy (setting); - port = nm_setting_proxy_get_ftp_port (setting); - if (tmp && port) - g_ptr_array_add (proxies, g_strdup_printf ("ftp://%s:%u/", tmp, port)); - - tmp = nm_setting_proxy_get_socks_proxy (setting); - port = nm_setting_proxy_get_socks_port (setting); - if (tmp && port) { - g_ptr_array_add (proxies, g_strdup_printf (nm_setting_proxy_get_socks_version_5 (setting) ? - "socks5://%s:%u/" : "socks4://%s:%u/", tmp, port)); - } - } - - priv->proxies = (char **) g_ptr_array_free (proxies, proxies->len == 0); - break; case NM_SETTING_PROXY_METHOD_NONE: priv->method = NM_PROXY_CONFIG_METHOD_NONE; break; @@ -176,24 +123,6 @@ nm_proxy_config_merge_setting (NMProxyConfig *config, NMSettingProxy *setting) priv->browser_only = nm_setting_proxy_get_browser_only (setting); } -const char *const* -nm_proxy_config_get_proxies (const NMProxyConfig *config) -{ - const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE (config); - - /* don't return NULL */ - return priv->proxies ? ((const char *const*) priv->proxies) : ((const char *const*) &priv->proxies); -} - -const char *const* -nm_proxy_config_get_excludes (const NMProxyConfig *config) -{ - const NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE (config); - - /* don't return NULL */ - return priv->excludes ? ((const char *const*) priv->excludes) : ((const char *const*) &priv->excludes); -} - gboolean nm_proxy_config_get_browser_only (const NMProxyConfig *config) { @@ -250,8 +179,6 @@ finalize (GObject *object) NMProxyConfig *self = NM_PROXY_CONFIG (object); NMProxyConfigPrivate *priv = NM_PROXY_CONFIG_GET_PRIVATE (self); - g_strfreev (priv->proxies); - g_strfreev (priv->excludes); g_free (priv->pac_url); g_free (priv->pac_script); diff --git a/src/nm-proxy-config.h b/src/nm-proxy-config.h index 1a25d4dddc..2712e43fba 100644 --- a/src/nm-proxy-config.h +++ b/src/nm-proxy-config.h @@ -25,7 +25,6 @@ typedef enum { NM_PROXY_CONFIG_METHOD_AUTO = 0, - NM_PROXY_CONFIG_METHOD_MANUAL, NM_PROXY_CONFIG_METHOD_NONE } NMProxyConfigMethod; @@ -47,10 +46,6 @@ NMProxyConfigMethod nm_proxy_config_get_method (const NMProxyConfig *config); void nm_proxy_config_merge_setting (NMProxyConfig *config, NMSettingProxy *setting); -const char *const*nm_proxy_config_get_proxies (const NMProxyConfig *config); - -const char *const*nm_proxy_config_get_excludes (const NMProxyConfig *config); - gboolean nm_proxy_config_get_browser_only (const NMProxyConfig *config); void nm_proxy_config_set_pac_url (NMProxyConfig *config, const char *url); diff --git a/src/settings/plugins/ifcfg-rh/reader.c b/src/settings/plugins/ifcfg-rh/reader.c index 2b58059e20..bf15d32d29 100644 --- a/src/settings/plugins/ifcfg-rh/reader.c +++ b/src/settings/plugins/ifcfg-rh/reader.c @@ -913,8 +913,6 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) if (!g_ascii_strcasecmp (value, "auto")) method = NM_SETTING_PROXY_METHOD_AUTO; - else if (!g_ascii_strcasecmp (value, "manual")) - method = NM_SETTING_PROXY_METHOD_MANUAL; else method = NM_SETTING_PROXY_METHOD_NONE; g_free (value); @@ -942,118 +940,6 @@ make_proxy_setting (shvarFile *ifcfg, GError **error) } break; - case NM_SETTING_PROXY_METHOD_MANUAL: - g_object_set (s_proxy, - NM_SETTING_PROXY_METHOD, NM_SETTING_PROXY_METHOD_MANUAL, - NULL); - - value = svGetValue (ifcfg, "NO_PROXY_FOR", FALSE); - if (value) { - char **excludes = NULL; - - excludes = g_strsplit (value, " ", 0); - if (excludes) - g_object_set (s_proxy, - NM_SETTING_PROXY_NO_PROXY_FOR, excludes, - NULL); - g_free (value); - } - - value = svGetValue (ifcfg, "HTTP_PROXY", FALSE); - if (value) { - value = g_strstrip (value); - g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_PROXY, value, NULL); - g_free (value); - } - - value = svGetValue (ifcfg, "HTTP_PORT", FALSE); - if (value) { - int port; - - port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1); - if (port > 0) - g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_PORT, (guint) port, NULL); - else - PARSE_WARNING ("invalid PORT '%s'", value); - g_free (value); - } - - value = svGetValue (ifcfg, "HTTP_DEFAULT", FALSE); - if (value) { - if (!g_ascii_strcasecmp (value, "yes")) { - g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_DEFAULT, TRUE, NULL); - g_free (value); - break; - } - } - - value = svGetValue (ifcfg, "SSL_PROXY", FALSE); - if (value) { - value = g_strstrip (value); - g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PROXY, value, NULL); - g_free (value); - } - - value = svGetValue (ifcfg, "SSL_PORT", FALSE); - if (value) { - int port; - - port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1); - if (port > 0) - g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PORT, (guint) port, NULL); - else - PARSE_WARNING ("invalid PORT '%s'", value); - g_free (value); - } - - value = svGetValue (ifcfg, "FTP_PROXY", FALSE); - if (value) { - value = g_strstrip (value); - g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PROXY, value, NULL); - g_free (value); - } - - value = svGetValue (ifcfg, "FTP_PORT", FALSE); - if (value) { - int port; - - port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1); - if (port > 0) - g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PORT, (guint) port, NULL); - else - PARSE_WARNING ("invalid PORT '%s'", value); - g_free (value); - } - - value = svGetValue (ifcfg, "SOCKS_PROXY", FALSE); - if (value) { - value = g_strstrip (value); - g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_PROXY, value, NULL); - g_free (value); - } - - value = svGetValue (ifcfg, "SOCKS_PORT", FALSE); - if (value) { - int port; - - port = _nm_utils_ascii_str_to_int64 (value, 0, 0, 65535, -1); - if (port > 0) - g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_PORT, (guint) port, NULL); - else - PARSE_WARNING ("invalid PORT '%s'", value); - g_free (value); - } - - value = svGetValue (ifcfg, "SOCKS_VERSION_5", FALSE); - if (value) { - if (!g_ascii_strcasecmp (value, "yes")) { - g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_VERSION_5, TRUE, NULL); - g_free (value); - break; - } - } - - break; case NM_SETTING_PROXY_METHOD_NONE: g_object_set (s_proxy, NM_SETTING_PROXY_METHOD, NM_SETTING_PROXY_METHOD_NONE, diff --git a/src/settings/plugins/ifcfg-rh/writer.c b/src/settings/plugins/ifcfg-rh/writer.c index f2c3074575..383337c77f 100644 --- a/src/settings/plugins/ifcfg-rh/writer.c +++ b/src/settings/plugins/ifcfg-rh/writer.c @@ -2003,28 +2003,13 @@ write_proxy_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) { NMSettingProxy *s_proxy; NMSettingProxyMethod method; - char *tmp; const char *pac_url, *pac_script; - const char *http_proxy, *ssl_proxy, *ftp_proxy, *socks_proxy; - guint32 http_port, ssl_port, ftp_port, socks_port; - gboolean http_default, socks_version_5, browser_only; - const char *const*excludes; + gboolean browser_only; s_proxy = nm_connection_get_setting_proxy (connection); if (!s_proxy) return TRUE; - svSetValue (ifcfg, "HTTP_PROXY", NULL, FALSE); - svSetValue (ifcfg, "HTTP_PORT", NULL, FALSE); - svSetValue (ifcfg, "HTTP_DEFAULT", NULL, FALSE); - svSetValue (ifcfg, "SSL_PROXY", NULL, FALSE); - svSetValue (ifcfg, "SSL_PORT", NULL, FALSE); - svSetValue (ifcfg, "FTP_PROXY", NULL, FALSE); - svSetValue (ifcfg, "FTP_PORT", NULL, FALSE); - svSetValue (ifcfg, "SOCKS_PROXY", NULL, FALSE); - svSetValue (ifcfg, "SOCKS_PORT", NULL, FALSE); - svSetValue (ifcfg, "SOCKS_VERSION_5", NULL, FALSE); - svSetValue (ifcfg, "NO_PROXY_FOR", NULL, FALSE); svSetValue (ifcfg, "BROWSER_ONLY", NULL, FALSE); svSetValue (ifcfg, "PAC_URL", NULL, FALSE); svSetValue (ifcfg, "PAC_SCRIPT", NULL, FALSE); @@ -2043,79 +2028,6 @@ write_proxy_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) svSetValue (ifcfg, "PAC_SCRIPT", pac_script, FALSE); break; - case NM_SETTING_PROXY_METHOD_MANUAL: - svSetValue (ifcfg, "PROXY_METHOD", "manual", FALSE); - - excludes = nm_setting_proxy_get_no_proxy_for (s_proxy); - if (excludes && excludes[0]) { - gs_free char *str = NULL; - - str = g_strjoinv (" ", (char **) excludes); - svSetValue (ifcfg, "NO_PROXY_FOR", str, FALSE); - } - - http_proxy = nm_setting_proxy_get_http_proxy (s_proxy); - if (http_proxy) - svSetValue (ifcfg, "HTTP_PROXY", http_proxy, FALSE); - - svSetValue (ifcfg, "HTTP_PORT", NULL, FALSE); - http_port = nm_setting_proxy_get_http_port (s_proxy); - if (http_port) { - tmp = g_strdup_printf ("%u", http_port); - svSetValue (ifcfg, "HTTP_PORT", tmp, FALSE); - g_free (tmp); - } - - http_default = nm_setting_proxy_get_http_default (s_proxy); - if (http_default) { - svSetValue (ifcfg, "HTTP_DEFAULT", "yes", FALSE); - break; - } else - svSetValue (ifcfg, "HTTP_DEFAULT", "no", FALSE); - - ssl_proxy = nm_setting_proxy_get_ssl_proxy (s_proxy); - if (ssl_proxy) - svSetValue (ifcfg, "SSL_PROXY", ssl_proxy, FALSE); - - svSetValue (ifcfg, "SSL_PORT", NULL, FALSE); - ssl_port = nm_setting_proxy_get_ssl_port (s_proxy); - if (ssl_port) { - tmp = g_strdup_printf ("%u", ssl_port); - svSetValue (ifcfg, "SSL_PORT", tmp, FALSE); - g_free (tmp); - } - - ftp_proxy = nm_setting_proxy_get_ftp_proxy (s_proxy); - if (ftp_proxy) - svSetValue (ifcfg, "FTP_PROXY", ftp_proxy, FALSE); - - svSetValue (ifcfg, "FTP_PORT", NULL, FALSE); - ftp_port = nm_setting_proxy_get_ftp_port (s_proxy); - if (ftp_port) { - tmp = g_strdup_printf ("%u", ftp_port); - svSetValue (ifcfg, "FTP_PORT", tmp, FALSE); - g_free (tmp); - } - - socks_proxy = nm_setting_proxy_get_socks_proxy (s_proxy); - if (socks_proxy) - svSetValue (ifcfg, "SOCKS_PROXY", socks_proxy, FALSE); - - svSetValue (ifcfg, "SOCKS_PORT", NULL, FALSE); - socks_port = nm_setting_proxy_get_socks_port (s_proxy); - if (socks_port) { - tmp = g_strdup_printf ("%u", socks_port); - svSetValue (ifcfg, "SOCKS_PORT", tmp, FALSE); - g_free (tmp); - } - - socks_version_5 = nm_setting_proxy_get_socks_version_5 (s_proxy); - if (socks_version_5) - svSetValue (ifcfg, "SOCKS_VERSION_5", "yes", FALSE); - else - svSetValue (ifcfg, "SOCKS_VERSION_5", "no", FALSE); - - break; case NM_SETTING_PROXY_METHOD_NONE: svSetValue (ifcfg, "PROXY_METHOD", "none", FALSE); /* Write nothing more */ |