aboutsummaryrefslogtreecommitdiffstats
path: root/camel/providers
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 /camel/providers
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
Diffstat (limited to 'camel/providers')
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c17
1 files changed, 10 insertions, 7 deletions
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));