dovecot-2.1: lib-imap-client: If dns_client_socket_path isn't gi...
dovecot at dovecot.org
dovecot at dovecot.org
Thu Feb 2 16:51:03 EET 2012
details: http://hg.dovecot.org/dovecot-2.1/rev/9d031f0b613d
changeset: 14059:9d031f0b613d
user: Timo Sirainen <tss at iki.fi>
date: Thu Feb 02 16:49:46 2012 +0200
description:
lib-imap-client: If dns_client_socket_path isn't given, do a blocking lookup.
diffstat:
src/lib-imap-client/imapc-connection.c | 17 ++++++++++++++++-
1 files changed, 16 insertions(+), 1 deletions(-)
diffs (34 lines):
diff -r ceadfe9009aa -r 9d031f0b613d src/lib-imap-client/imapc-connection.c
--- a/src/lib-imap-client/imapc-connection.c Thu Feb 02 16:46:46 2012 +0200
+++ b/src/lib-imap-client/imapc-connection.c Thu Feb 02 16:49:46 2012 +0200
@@ -1340,7 +1340,9 @@
void *login_context)
{
struct dns_lookup_settings dns_set;
- struct ip_addr ip;
+ struct ip_addr ip, *ips;
+ unsigned int ips_count;
+ int ret;
if (conn->fd != -1) {
i_assert(login_callback == NULL);
@@ -1366,6 +1368,19 @@
conn->ips_count = 1;
conn->ips = i_new(struct ip_addr, conn->ips_count);
conn->ips[0] = ip;
+ } else if (*dns_set.dns_client_socket_path == '\0') {
+ ret = net_gethostbyname(conn->client->set.host,
+ &ips, &ips_count);
+ if (ret != 0) {
+ i_error("imapc(%s): net_gethostbyname(%s) failed: %s",
+ conn->name, conn->client->set.host,
+ net_gethosterror(ret));
+ imapc_connection_set_disconnected(conn);
+ return;
+ }
+ conn->ips_count = ips_count;
+ conn->ips = i_new(struct ip_addr, ips_count);
+ memcpy(conn->ips, ips, ips_count * sizeof(*ips));
}
if (conn->ips_count == 0) {
More information about the dovecot-cvs
mailing list