diff options
author | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-05-12 04:11:07 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-05-12 04:11:07 +0800 |
commit | 1e54cba4d328f71b7d1e3d7dfc0b8b95344a4d01 (patch) | |
tree | bc4cdf8ce252b90f7543fd867e0704caef5f1b1d /camel | |
parent | 76715cfdda03f42433e3afaa6550f16c24b44815 (diff) | |
download | gsoc2013-evolution-1e54cba4d328f71b7d1e3d7dfc0b8b95344a4d01.tar.gz gsoc2013-evolution-1e54cba4d328f71b7d1e3d7dfc0b8b95344a4d01.tar.zst gsoc2013-evolution-1e54cba4d328f71b7d1e3d7dfc0b8b95344a4d01.zip |
providers/smtp/camel-smtp-transport.c: updated smtp_helo to more closely comply with RFC 821 standards
svn path=/trunk/; revision=2991
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, |