aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNot Zed <NotZed@Ximian.com>2004-11-22 11:19:47 +0800
committerMichael Zucci <zucchi@src.gnome.org>2004-11-22 11:19:47 +0800
commitb64055ed673da750908950bb183000f4b5b2820c (patch)
tree19970d988081a098c3e830457b9deb658ea84bf7
parent3c80fbd004c256274bf6856c19cb119226415a89 (diff)
downloadgsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar.gz
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar.bz2
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar.lz
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar.xz
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.tar.zst
gsoc2013-evolution-b64055ed673da750908950bb183000f4b5b2820c.zip
** See bug #69109.
2004-11-10 Not Zed <NotZed@Ximian.com> ** See bug #69109. * camel-service.c (cs_getnameinfo): honour the NI_NAMEREQD flag. * providers/smtp/camel-smtp-transport.c (smtp_helo): change the nameinfo flags a bit so we know when we got a numeric name and need to wrap it in []. svn path=/trunk/; revision=27959
-rw-r--r--camel/ChangeLog11
-rw-r--r--camel/camel-service.c4
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c17
3 files changed, 23 insertions, 9 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 620481c2ce..b67943a9a9 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -1,3 +1,13 @@
+2004-11-10 Not Zed <NotZed@Ximian.com>
+
+ ** See bug #69109.
+
+ * camel-service.c (cs_getnameinfo): honour the NI_NAMEREQD flag.
+
+ * providers/smtp/camel-smtp-transport.c (smtp_helo): change the
+ nameinfo flags a bit so we know when we got a numeric name and
+ need to wrap it in [].
+
2004-11-21 Sivaiah Nallagatla <snallagatla@novell.com>
* providers/groupwise/camel-groupwise-provider.c : added
@@ -9,7 +19,6 @@
Add offline_sync property on e-sources if account is
marked for offline
-
2004-11-18 Not Zed <NotZed@Ximian.com>
* providers/nntp/camel-nntp-stream.c:
diff --git a/camel/camel-service.c b/camel/camel-service.c
index b916d5c05a..81bb9c85e6 100644
--- a/camel/camel-service.c
+++ b/camel/camel-service.c
@@ -969,13 +969,15 @@ cs_getnameinfo(void *data)
if (msg->host) {
g_free(msg->host);
+ msg->host = NULL;
if (msg->result == 0 && h.h_name && h.h_name[0]) {
msg->host = g_strdup(h.h_name);
- } else {
+ } else if ((msg->flags & NI_NAMEREQD) == 0) {
unsigned char *in = (unsigned char *)&sin->sin_addr;
/* sin_addr is always network order which is big-endian */
msg->host = g_strdup_printf("%u.%u.%u.%u", in[0], in[1], in[2], in[3]);
+ msg->result = 0;
}
}
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index ba89c440fe..0e1a175d6a 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -868,6 +868,7 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
/* say hello to the server */
char *name = NULL, *cmdbuf = NULL, *respbuf = NULL;
const char *token;
+ int numeric = FALSE;
/* these are flags that we set, so unset them in case we
are being called a second time (ie, after a STARTTLS) */
@@ -883,15 +884,17 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
camel_operation_start_transient (NULL, _("SMTP Greeting"));
- /* this can't really fail with the flags we're using, it should fallback to numerical */
- if (camel_getnameinfo(transport->localaddr, transport->localaddrlen, &name, NULL, 0, NULL) != 0)
- name = g_strdup("localhost.localdomain");
+ /* force name resolution first, fallback to numerical, we need to know when it falls back */
+ if (camel_getnameinfo(transport->localaddr, transport->localaddrlen, &name, NULL, NI_NAMEREQD, NULL) != 0) {
+ if (camel_getnameinfo(transport->localaddr, transport->localaddrlen, &name, NULL, NI_NUMERICHOST, NULL) != 0)
+ name = g_strdup("localhost.localdomain");
+ else
+ numeric = TRUE;
+ }
/* hiya server! how are you today? */
- if (transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP)
- cmdbuf = g_strdup_printf ("EHLO %s\r\n", name);
- else
- cmdbuf = g_strdup_printf ("HELO %s\r\n", name);
+ token = (transport->flags & CAMEL_SMTP_TRANSPORT_IS_ESMTP) ? "EHLO" : "HELO";
+ cmdbuf = g_strdup_printf(numeric ? "%s [%s]\r\n" : "%s %s\r\n", token, name);
g_free (name);
d(fprintf (stderr, "sending : %s", cmdbuf));