diff options
author | EDT 2000 Jeffrey Stedfast <fejj@stampede.org> | 2000-05-16 05:20:26 +0800 |
---|---|---|
committer | Jeffrey Stedfast <fejj@src.gnome.org> | 2000-05-16 05:20:26 +0800 |
commit | d3999f9c4c20ce02072ec774c5b54b126a96d427 (patch) | |
tree | 56f2f787e704a64237ed27c7268004590864be76 /camel/providers/smtp | |
parent | 6dfcfd767d0e0c515609cd36a80d8cc65370e264 (diff) | |
download | gsoc2013-evolution-d3999f9c4c20ce02072ec774c5b54b126a96d427.tar.gz gsoc2013-evolution-d3999f9c4c20ce02072ec774c5b54b126a96d427.tar.zst gsoc2013-evolution-d3999f9c4c20ce02072ec774c5b54b126a96d427.zip |
o Added some preliminary ESMTP AUTH support
Mon May 15 17:19:31 EDT 2000 Jeffrey Stedfast <fejj@stampede.org>
o Added some preliminary ESMTP AUTH support
svn path=/trunk/; revision=3049
Diffstat (limited to 'camel/providers/smtp')
-rw-r--r-- | camel/providers/smtp/camel-smtp-transport.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/camel/providers/smtp/camel-smtp-transport.c b/camel/providers/smtp/camel-smtp-transport.c index 5915045bc7..f7de36f571 100644 --- a/camel/providers/smtp/camel-smtp-transport.c +++ b/camel/providers/smtp/camel-smtp-transport.c @@ -70,6 +70,7 @@ static gboolean smtp_quit (CamelSmtpTransport *transport, CamelException *ex); static CamelServiceClass *service_class = NULL; static gboolean smtp_is_esmtp = FALSE; static struct sockaddr_in localaddr; +static GList *esmtp_supported_authtypes = NULL; static void camel_smtp_transport_class_init (CamelSmtpTransportClass *camel_smtp_transport_class) @@ -129,7 +130,7 @@ smtp_connect (CamelService *service, CamelException *ex) { struct hostent *h; struct sockaddr_in sin; - gint fd; + gint fd, num, i; guint32 addrlen; gchar *pass = NULL, *respbuf = NULL; CamelSmtpTransport *transport = CAMEL_SMTP_TRANSPORT (service); @@ -179,16 +180,23 @@ smtp_connect (CamelService *service, CamelException *ex) } if (strstr(respbuf, "ESMTP")) smtp_is_esmtp = TRUE; - if (smtp_is_esmtp && strstr(respbuf, "AUTH")) { - /* parse for supported AUTH types */ - esmtp_get_authtypes(respbuf); - } } while ( *(respbuf+3) == '-' ); /* if we got "220-" then loop again */ g_free(respbuf); - /* send HELO */ + /* send HELO (or EHLO, depending on the service type) */ smtp_helo(transport, ex); + /* check to see if AUTH is required, if so...then AUTH ourselves */ + if (smtp_is_esmtp && esmtp_supported_authtypes) { + /* not really supported yet, but we can at least show what auth types are supported */ + fprintf(stderr, "camel-smtp-transport: %s requires AUTH\n", service->url->host); + num = g_list_length(esmtp_supported_authtypes); + for (i = 0; i < num; i++) + fprintf(stderr, "Supported AUTH: %s\n", (gchar *) g_list_nth_data(esmtp_supported_authtypes, i)); + g_list_free(esmtp_supported_authtypes); + esmtp_supported_authtypes = NULL; + } + return TRUE; } @@ -218,6 +226,23 @@ static GList *esmtp_get_authtypes(gchar *buffer) { GList *ret = NULL; + gchar *start, *end; + + if (!(start = strstr(buffer, " AUTH "))) + return NULL; + + /* advance to the first token */ + for (start += 6; *start && *start != ' '; start++); + + for ( ; *start; ) { + /* advance to the end of the token */ + for (end = start; *end && *end != ' '; end++); + + ret = g_list_append(ret, g_strndup(start, end - start)); + + /* advance to the next token */ + for (start = end; *start && *start != ' '; start++); + } return ret; } @@ -472,6 +497,12 @@ smtp_helo (CamelSmtpTransport *transport, CamelException *ex) g_strerror (errno)); return FALSE; } + + if (smtp_is_esmtp && strstr(respbuf, "AUTH")) { + /* parse for supported AUTH types */ + g_strchomp(respbuf); + esmtp_supported_authtypes = esmtp_get_authtypes(respbuf); + } } while ( *(respbuf+3) == '-' ); /* if we got "250-" then loop again */ g_free(respbuf); |