aboutsummaryrefslogtreecommitdiffstats
path: root/camel
diff options
context:
space:
mode:
Diffstat (limited to 'camel')
-rw-r--r--camel/providers/smtp/camel-smtp-transport.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c
index e76815a795..ef20a06e8c 100644
--- a/camel/providers/smtp/camel-smtp-transport.c
+++ b/camel/providers/smtp/camel-smtp-transport.c
@@ -47,8 +47,6 @@
/* Specified in RFC 821 */
#define SMTP_PORT 25
-static CamelServiceClass *service_class = NULL;
-
/* camel smtp transport class prototypes */
static gboolean _can_send (CamelTransport *transport, CamelMedium *message);
static gboolean _send (CamelTransport *transport, CamelMedium *message, CamelException *ex);
@@ -68,8 +66,10 @@ static gboolean smtp_data (CamelSmtpTransport *transport, CamelMedium *message,
static gboolean smtp_rset (CamelSmtpTransport *transport, CamelException *ex);
static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex);
-
+/* private data members */
+static CamelServiceClass *service_class = NULL;
static gboolean smtp_is_esmtp = FALSE;
+static struct sockaddr_in localaddr;
static void
camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_class)
@@ -130,6 +130,7 @@ smtp_connect (CamelService *service, CamelException *ex)
struct hostent *h;
struct sockaddr_in sin;
gint fd;
+ guint32 addrlen;
gchar *pass = NULL, *respbuf = NULL;
CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service);
@@ -156,6 +157,10 @@ smtp_connect (CamelService *service, CamelException *ex)
return FALSE;
}
+ /* get the localaddr - needed later by smtp_helo */
+ addrlen = sizeof(localaddr);
+ getsockname(sock, (struct sockaddr*)&localaddr, &addrlen);
+
transport->ostream = camel_stream_fs_new_with_fd (fd);
transport->istream = camel_stream_buffer_new (transport->ostream,
CAMEL_STREAM_BUFFER_READ);
@@ -436,13 +441,9 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex)
{
/* say hello to the server */
gchar *cmdbuf, *respbuf = NULL;
- 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? */