diff options
Diffstat (limited to 'camel')
-rw-r--r-- | camel/ChangeLog | 5 | ||||
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 24 |
2 files changed, 15 insertions, 14 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 5385940204..0d22e830e5 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,8 @@ +2000-05-11 Jeffrey Stedfast <fejj@stampede.org> + + * providers/smtp/camel-smtp-transport.c: (smtp_helo): + Updated to more closely comply with RFC 821 standards + 2000-05-11 NotZed <NotZed@HelixCode.com> * camel-mime-part.c (write_to_stream): Unref the filter after diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 57d14d7fe3..e76815a795 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -436,24 +436,20 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) { /* say hello to the server */ gchar *cmdbuf, *respbuf = NULL; - gchar localhost[MAXHOSTNAMELEN + MAXHOSTNAMELEN + 2]; - gchar domainname[MAXHOSTNAMELEN]; - - /* get the localhost name */ - memset(localhost, 0, sizeof(localhost)); - gethostname (localhost, MAXHOSTNAMELEN); - memset(domainname, 0, sizeof(domainname)); - getdomainname(domainname, MAXHOSTNAMELEN); - if (*domainname && strcmp(domainname, "(none)")) { - strcat(localhost, "."); - strcat(localhost, domainname); - } + struct sockaddr_in localaddr; + guint32 addrlen; + struct hostent *host; + + /* get the local host name */ + addrlen = sizeof(localaddr); + getsockname(sock, (struct sockaddr*)&localaddr, &addrlen); + host = gethostbyaddr((gchar *)&localaddr.sin_addr, sizeof(localaddr.sin_addr), AF_INET); /* hiya server! how are you today? */ if (smtp_is_esmtp) - cmdbuf = g_strdup_printf ("EHLO %s\r\n", localhost); + cmdbuf = g_strdup_printf ("EHLO %s\r\n", host->h_name); else - cmdbuf = g_strdup_printf ("HELO %s\r\n", localhost); + cmdbuf = g_strdup_printf ("HELO %s\r\n", host->h_name); if ( camel_stream_write (transport->ostream, cmdbuf, strlen(cmdbuf), ex) == -1) { g_free(cmdbuf); camel_exception_setv (ex, CAMEL_EXCEPTION_SYSTEM, |