From: Federico Mena Quintero Date: Tue, 1 Jun 2010 19:15:26 +0000 (-0500) Subject: Sanitize empty-string proxy hostnames at the API entry point X-Git-Tag: upstream/3.7.4~3037 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=d6d1a38a2deb7d33d80c10e115e9c31229104ba5;p=platform%2Fupstream%2Fevolution-data-server.git Sanitize empty-string proxy hostnames at the API entry point This way the rest of the code can assume that (proxy_host == NULL) means that no proxy is set; it doesn't need to check for empty strings. Signed-off-by: Federico Mena Quintero --- diff --git a/camel/camel-session.c b/camel/camel-session.c index d76ce31..40c3c21 100644 --- a/camel/camel-session.c +++ b/camel/camel-session.c @@ -1121,8 +1121,13 @@ camel_session_set_socks_proxy (CamelSession *session, const gchar *socks_host, i if (session->priv->socks_proxy_host) g_free (session->priv->socks_proxy_host); - session->priv->socks_proxy_host = g_strdup (socks_host); - session->priv->socks_proxy_port = socks_port; + if (socks_host && socks_host[0] != '\0') { + session->priv->socks_proxy_host = g_strdup (socks_host); + session->priv->socks_proxy_port = socks_port; + } else { + session->priv->socks_proxy_host = NULL; + session->priv->socks_proxy_port = 0; + } } /** diff --git a/camel/camel-tcp-stream.c b/camel/camel-tcp-stream.c index 9c37e99..c66cc8b 100644 --- a/camel/camel-tcp-stream.c +++ b/camel/camel-tcp-stream.c @@ -223,8 +223,14 @@ camel_tcp_stream_set_socks_proxy (CamelTcpStream *stream, const gchar *socks_hos priv = stream->priv; g_free (priv->socks_host); - priv->socks_host = g_strdup (socks_host); - priv->socks_port = socks_port; + + if (socks_host && socks_host[0] != '\0') { + priv->socks_host = g_strdup (socks_host); + priv->socks_port = socks_port; + } else { + priv->socks_host = NULL; + priv->socks_port = 0; + } } /**