Re: [PATCH v2 1/5] A new object 'NMProxyConfig' with fields for proxy.



On Tue, 2016-07-12 at 17:57 +0530, Atul Anand wrote:
A new object NMProxyConfig has been implemented which contain fields
for proxy related stuff.
---


+                             port = (guint32) atoi (str);
+                             if (port >= 0)

Port is unsigned, is always >= 0. Perhaps you meant "if (port)" or
wanted to omit the condition altogether?

+                                     g_object_set (s_proxy, NM_SETTING_PROXY_HTTP_PORT, port, NULL);
+                             g_free (str);
+
+                     } else if (strstr (tmp, "https://";)) {
+                             tmp = tmp + 8;
+                             str = g_strndup (tmp, strchr (tmp, ':') - tmp);
+                             g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PROXY, str, NULL);
+                             g_free (str);
+
+
+                             tmp = strchr (tmp, ':') + 1;
+                             str = g_strndup (tmp, strchr (tmp, '/') - tmp);
+                             port = (guint32) atoi (str);
+                             if (port >= 0)

Ditto.

+                                     g_object_set (s_proxy, NM_SETTING_PROXY_SSL_PORT, port, NULL);
+                             g_free (str);
+
+                     } else if (strstr (tmp, "ftp://";)) {
+                             tmp = tmp + 6;
+                             str = g_strndup (tmp, strchr (tmp, ':') - tmp);
+                             g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PROXY, str, NULL);
+                             g_free (str);
+
+                             tmp = strchr (tmp, ':') + 1;
+                             str = g_strndup (tmp, strchr (tmp, '/') - tmp);
+                             port = (guint32) atoi (str);
+                             if (port >= 0)

Ditto.

+                                     g_object_set (s_proxy, NM_SETTING_PROXY_FTP_PORT, port, NULL);
+                             g_free (str);
+
+                     } else if (strstr (tmp, "socks4://") || strstr (tmp, "socks5://")) {
+                             if (strstr (tmp, "socks5://"))
+                                     g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_VERSION_5, TRUE, NULL);
+                             else
+                                     g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_VERSION_5, FALSE, NULL);
+
+                             tmp = tmp + 9;
+                             str = g_strndup (tmp, strchr (tmp, ':') - tmp);
+                             g_object_set (s_proxy, NM_SETTING_PROXY_SOCKS_PROXY, str, NULL);
+                             g_free (str);
+
+                             tmp = strchr (tmp, ':') + 1;
+                             str = g_strndup (tmp, strchr (tmp, '/') - tmp);
+                             port = (guint32) atoi (str);
+                             if (port >= 0)

Ditto.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]