aboutsummaryrefslogtreecommitdiffstats
path: root/camel/camel-sasl-digest-md5.c
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-09-24 10:50:45 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-09-24 10:50:45 +0800
commit2223bc36fa7b6b16ff7ea83e39e64e9375e3ebc1 (patch)
tree47094ce1777a4c6fe98bfc81e70a07a6f9f5414a /camel/camel-sasl-digest-md5.c
parent6883c5737127983d776b7071c258ae74c9bfb4c1 (diff)
downloadgsoc2013-evolution-2223bc36fa7b6b16ff7ea83e39e64e9375e3ebc1.tar.gz
gsoc2013-evolution-2223bc36fa7b6b16ff7ea83e39e64e9375e3ebc1.tar.zst
gsoc2013-evolution-2223bc36fa7b6b16ff7ea83e39e64e9375e3ebc1.zip
** See bug #47821.
2004-09-13 Not Zed <NotZed@Ximian.com> ** See bug #47821. * camel-service.c: removed the old hostent based hostname interfaces. * camel-sasl-kerberos4.c (krb4_challenge): new hostname interfaces. * camel-sasl-gssapi.c (gssapi_challenge): new hostname interfaces. * camel-sasl-digest-md5.c (digest_md5_challenge): use new hostname interfaces. (generate_response): just take hostname directly, not hostent. * camel-mime-utils.c (camel_header_msgid_generate): use new hostname interfaces. * providers/smtp/camel-smtp-transport.c (connect_to_server): fixed to use new addrinfo apis. * providers/pop3/camel-pop3-store.c (connect_to_server): fixed to use new addrinfo apis. * camel-tcp-stream-ssl.c (stream_connect): try all addresses supplied. * camel-tcp-stream.c (camel_tcp_stream_get_remote_address) (camel_tcp_stream_get_local_address): return a sockaddr now, and also the address length. Fixed all implementations and callers. (camel_tcp_stream_connect): use addrinfo rather than hostent for host AND port info. Fixed all implementations and callers. svn path=/trunk/; revision=27352
Diffstat (limited to 'camel/camel-sasl-digest-md5.c')
-rw-r--r--camel/camel-sasl-digest-md5.c22
1 files changed, 15 insertions, 7 deletions
diff --git a/camel/camel-sasl-digest-md5.c b/camel/camel-sasl-digest-md5.c
index 36fd2f5808..b526ff47e7 100644
--- a/camel/camel-sasl-digest-md5.c
+++ b/camel/camel-sasl-digest-md5.c
@@ -624,7 +624,7 @@ compute_response (struct _DigestResponse *resp, const char *passwd, gboolean cli
}
static struct _DigestResponse *
-generate_response (struct _DigestChallenge *challenge, struct hostent *host,
+generate_response (struct _DigestChallenge *challenge, const char *host,
const char *protocol, const char *user, const char *passwd)
{
struct _DigestResponse *resp;
@@ -660,7 +660,7 @@ generate_response (struct _DigestChallenge *challenge, struct hostent *host,
/* create the URI */
uri = g_new0 (struct _DigestURI, 1);
uri->type = g_strdup (protocol);
- uri->host = g_strdup (host->h_name);
+ uri->host = g_strdup (host);
uri->name = NULL;
resp->uri = uri;
@@ -796,10 +796,10 @@ digest_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
struct _param *rspauth;
GByteArray *ret = NULL;
gboolean abort = FALSE;
- struct hostent *h;
const char *ptr;
guchar out[33];
char *tokens;
+ struct addrinfo *ai, hints;
/* Need to wait for the server */
if (!token)
@@ -830,12 +830,20 @@ digest_md5_challenge (CamelSasl *sasl, GByteArray *token, CamelException *ex)
"\"Quality of Protection\" token\n"));
return NULL;
}
-
- h = camel_service_gethost (sasl->service, ex);
- priv->response = generate_response (priv->challenge, h, sasl->service_name,
+
+ memset(&hints, 0, sizeof(hints));
+ hints.ai_flags = AI_CANONNAME;
+ ai = camel_getaddrinfo(sasl->service->url->host?sasl->service->url->host:"localhost", NULL, &hints, NULL);
+ if (ai && ai->ai_canonname)
+ ptr = ai->ai_canonname;
+ else
+ ptr = "localhost.localdomain";
+
+ priv->response = generate_response (priv->challenge, ptr, sasl->service_name,
sasl->service->url->user,
sasl->service->url->passwd);
- camel_free_host(h);
+ if (ai)
+ camel_freeaddrinfo(ai);
ret = digest_response (priv->response);
break;