-D__FEATURE_HEADER_OPTIMIZATION__ \
-D__FEATURE_SEND_OPTMIZATION__ \
-D__FEATURE_XLIST_SUPPORT__ \
+ -D__FEATURE_SUPPORT_IMAP_ID__ \
-DCREATEPROTO=unixproto -DEMPTYPROTO=unixproto \
-DMAILSPOOL=\"/var/spool/mail\" \
-DANONYMOUSHOME=\"/var/spool/mail/anonymous\" \
gethstid.c getspnam.c \
gr_wait.c gr_wait4.c gr_waitp.c \
kerb_mit.c \
- auth_ext.c auth_gss.c auth_log.c auth_md5.c auth_pla.c \
+ auth_ext.c auth_gss.c auth_log.c auth_md5.c auth_pla.c auth_xoauth2.c\
pmatch.c scandir.c setpgrp.c strerror.c truncate.c write.c \
memmove.c memmove2.c memset.c \
tz_bsd.c tz_nul.c tz_sv4.c \
/* get initial (empty) challenge */
if (challenge = (*challenger) (stream,&clen)) {
fs_give ((void **) &challenge);
- if (clen) { /* abort if challenge non-empty */
- mm_log ("auth_plain_client : Server bug: non-empty initial PLAIN challenge 1",WARN);
- (*responder) (stream,NIL,0);
- ret = LONGT; /* will get a BAD response back */
- }
pwd[0] = NIL; /* prompt user if empty challenge */
mm_login (mb,user,pwd,*trial);
*trial = 0; /* cancel subsequent attempts */
ret = LONGT; /* will get a BAD response back */
}
+
+ else if ((*responder) (stream,user,strlen (user)) &&
+ (challenge = (*challenger) (stream,&clen))) {
+ fs_give ((void **) &challenge);
+ /* send password */
+ if ((*responder) (stream,pwd,strlen (pwd))) {
+ if (challenge = (*challenger) (stream,&clen))
+ fs_give ((void **) &challenge);
+ else {
+ ++*trial; /* can try again if necessary */
+ ret = LONGT; /* check the authentication */
+ }
+ }
+ }
+
else {
unsigned long rlen =
strlen (mb->authuser) + strlen (user) + strlen (pwd) + 2;
fs_give ((void **) &response);
}
}
- else // [ Written by Kyuho Jo for AOL 2010/02/16
+ else
{
mm_log ("Enter section for handling emtpy challenge",WARN);
- if (clen)
- { /* abort if challenge non-empty */
- mm_log ("auth_plain_client : Server bug: non-empty initial PLAIN challenge 2",WARN);
- (*responder) (stream,NIL,0);
- ret = LONGT; /* will get a BAD response back */
- }
pwd[0] = NIL; /* prompt user if empty challenge */
mm_login (mb,user,pwd,*trial);
fs_give ((void **) &challenge);
else
{
- mm_log ("Second emtpy challege ",WARN);
+ mm_log ("Second empty challege ",WARN);
++*trial; /* can try again if necessary */
ret = LONGT; /* check the authentication */
}
fs_give ((void **) &response);
}
- } // ] Written by Kyuho Jo for AOL 2010/02/16
+ }
memset (pwd,0,MAILTMPLEN); /* erase password */
if (!ret) *trial = 65535; /* don't retry if bad protocol */
--- /dev/null
+/* ========================================================================
+ * Copyright (c) 2012 Samsung Electronics Co., Ltd.
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ *
+ * ========================================================================
+ */
+
+/*
+ * Program: XOAUTH2 authenticator
+ *
+ * Author: Kyuho Jo (kyuho.jo@samsung.com)
+ *
+ * Date: 18 May 2013
+ */
+\f
+long auth_xoauth2_client (authchallenge_t challenger,authrespond_t responder,
+ char *service,NETMBX *mb,void *stream,
+ unsigned long *trial,char *user);
+char *auth_xoauth2_server (authresponse_t responder,int argc,char *argv[]);
+
+AUTHENTICATOR auth_xoauth2 = {
+ AU_AUTHUSER | AU_HIDE, /* allow authuser, hidden */
+ "XOAUTH2", /* authenticator name */
+ NIL, /* always valid */
+ auth_xoauth2_client, /* client method */
+ auth_xoauth2_server, /* server method */
+ NIL /* next authenticator */
+};
+\f
+/* Client authenticator
+ * Accepts: challenger function
+ * responder function
+ * SASL service name
+ * parsed network mailbox structure
+ * stream argument for functions
+ * pointer to current trial count
+ * returned user name
+ * Returns: T if success, NIL otherwise, number of trials incremented if retry
+ */
+
+#define MAX_RESPONSE_LENGTH 1024
+#define CHAR_SOH 0x01
+
+long auth_xoauth2_client (authchallenge_t challenger,authrespond_t responder,
+ char *service,NETMBX *mb,void *stream,
+ unsigned long *trial,char *user)
+{
+ char *u, token[MAILTMPLEN] = { 0, };
+ void *challenge;
+ unsigned long clen;
+ long ret = NIL;
+
+ if (challenge = (*challenger) (stream,&clen)) {
+ fs_give ((void **) &challenge);
+ if (clen) { /* abort if challenge non-empty */
+ mm_log ("auth_xoauth2_client : non-empty initial XOAUTH2 challenge",WARN);
+ (*responder) (stream,NIL,0);
+ ret = LONGT; /* will get a BAD response back */
+ }
+ token[0] = NIL; /* prompt user if empty challenge */
+ mm_login (mb, user, token, *trial);
+
+ if (!token[0]) { /* empty challenge or user requested abort */
+ (*responder) (stream, NIL, 0);
+ *trial = 0; /* cancel subsequent attempts */
+ ret = LONGT; /* will get a BAD response back */
+ }
+ else {
+ unsigned long formed_response_length = 0;
+ char formed_response[MAX_RESPONSE_LENGTH] = { 0, };
+
+ snprintf(formed_response, MAX_RESPONSE_LENGTH, "user=%s%cauth=Bearer %s%c%c", user, CHAR_SOH, token, CHAR_SOH, CHAR_SOH);
+
+ mm_log(formed_response, TCPDEBUG);
+
+ if ((*responder) (stream,formed_response,strlen(formed_response))) {
+ if (challenge = (*challenger) (stream,&clen)) {
+ /* print challenge with error code */
+ mm_log(challenge, ERROR);
+ /* and send CR */
+ (*responder) (stream, "", 0);
+ fs_give ((void **) &challenge);
+ ret = LONGT;
+ }
+ else {
+ ++*trial;
+ ret = LONGT;
+ }
+ }
+ }
+ memset(token,0,MAILTMPLEN);
+ }
+ return ret;
+}
+\f
+/* Server authenticator
+ * Accepts: responder function
+ * argument count
+ * argument vector
+ * Returns: authenticated user name or NIL
+ */
+char *auth_xoauth2_server (authresponse_t responder,int argc,char *argv[])
+{
+ char *ret = NIL;
+ return NIL;
+}
#include "auth_md5.c"
#include "auth_pla.c"
#include "auth_log.c"
+#include "auth_xoauth2.c"
#include "c-client.h"
#include "imap4r1.h"
\f
+
/* Parameters */
#define IMAPLOOKAHEAD 20 /* envelope lookahead */
MAILSTREAM *imap_open (MAILSTREAM *stream);
IMAPPARSEDREPLY *imap_rimap (MAILSTREAM *stream,char *service,NETMBX *mb,
char *usr,char *tmp);
+#ifdef __FEATURE_SUPPORT_IMAP_ID__
+long imap_id (MAILSTREAM *stream);
+#endif /* __FEATURE_SUPPORT_IMAP_ID__ */
long imap_anon (MAILSTREAM *stream,char *tmp);
long imap_auth (MAILSTREAM *stream,NETMBX *mb,char *tmp,char *usr);
long imap_login (MAILSTREAM *stream,NETMBX *mb,char *pwd,char *usr);
net_host (LOCAL->netstream),NETMAXHOST-1);
mb.host[NETMAXHOST-1] = '\0';
}
+
+
+#ifdef __FEATURE_SUPPORT_IMAP_ID__
+ /* Process for IMAP ID */
+ if (LOCAL->cap.id) {
+ mm_log ("This server requires IMAP ID", WARN);
+ imap_id(stream);
+ }
+#endif /* __FEATURE_SUPPORT_IMAP_ID__ */
+
/* need new capabilities after login */
LOCAL->gotcapability = NIL;
if (!(stream->anonymous ? imap_anon (stream,tmp) :
- (LOCAL->cap.auth ? imap_auth (stream,&mb,tmp,usr) :
+ ((LOCAL->cap.auth && (mb.auth_method > AUTH_METHOD_NONE))? imap_auth (stream,&mb,tmp,usr) :
imap_login (stream,&mb,tmp,usr)))) {
/* failed, is there a referral? */
if (ir && LOCAL->referral &&
}
return NIL;
}
+
+#ifdef __FEATURE_SUPPORT_IMAP_ID__
+long imap_id (MAILSTREAM *stream)
+{
+ IMAPPARSEDREPLY *reply;
+ int ret = NIL;
+ char *imap_id_tag_string = NULL;
+ IMAPARG *args[2];
+ IMAPARG id_tag;
+
+ if(stream == NULL)
+ return ret;
+
+ mm_imap_id (&imap_id_tag_string);
+
+ if(imap_id_tag_string != NULL) {
+ if(stream->debug)
+ mm_dlog(imap_id_tag_string);
+
+ id_tag.type = ASTRING;
+ id_tag.text = (void *) imap_id_tag_string;
+ args[0] = &id_tag; args[1] = NIL;
+ /* send "ID tag" */
+ if (imap_OK (stream,reply = imap_send (stream,"ID",args)))
+ ret = LONGT; /* success */
+ else {
+ mm_log ("ID failed",ERROR);
+ }
+ free(imap_id_tag_string);
+ }
+
+ return ret;
+}
+#endif /* __FEATURE_SUPPORT_IMAP_ID__ */
+
\f
/* IMAP log in as anonymous
* Accepts: stream to authenticate
ret = LONGT; /* success */
else {
mm_log (reply->text,WARN);
+ if (reply->text && strstr(reply->text, "AUTHENTICATIONFAILED")) {
+ mm_log ("Can not authenticate",ERROR);
+ break;
+ }
if (!LOCAL->referral && (trial == imap_maxlogintrials))
mm_log ("Too many login failures",ERROR);
}
else t = reply->text;
mm_list (stream,NIL,t,NIL);
}
+#ifdef __FEATURE_SUPPORT_IMAP_ID__
+ else if (!strcmp (reply->key,"ID")) {
+ imap_parse_id (stream,reply->text);
+ }
+#endif /* __FEATURE_SUPPORT_IMAP_ID__ */
else {
sprintf (LOCAL->tmp,"Unexpected untagged message: %.80s",
(char *) reply->key);
}
\f
else if (!compare_cstring (t,"CAPABILITY"))
- imap_parse_capabilities (stream,s);
+ imap_parse_capabilities (stream,s);
else if ((j = LEVELUIDPLUS (stream) && LOCAL->appendmailbox) &&
!compare_cstring (t,"COPYUID") &&
(cu = (copyuid_t) mail_parameters (NIL,GET_COPYUID,NIL)) &&
stream->unhealthy = T;
body->subtype = cpystr (rfc822_default_subtype (body->type));
}
- if (**txtptr == ' ') /* multipart parameters */
+ if (**txtptr == ' ' && *((*txtptr)+ 1) != ')') { /* multipart parameters */
body->parameter = imap_parse_body_parameter (stream,txtptr,reply);
- if (**txtptr == ' ') { /* disposition */
+ }
+ if (**txtptr == ' ' && *((*txtptr)+ 1) != ')') { /* disposition */
imap_parse_disposition (stream,body,txtptr,reply);
if (LOCAL->cap.extlevel < BODYEXTDSP) LOCAL->cap.extlevel = BODYEXTDSP;
}
- if (**txtptr == ' ') { /* language */
+ if (**txtptr == ' ' && *((*txtptr)+ 1) != ')') { /* language */
body->language = imap_parse_language (stream,txtptr,reply);
if (LOCAL->cap.extlevel < BODYEXTLANG)
LOCAL->cap.extlevel = BODYEXTLANG;
}
- if (**txtptr == ' ') { /* location */
+ if (**txtptr == ' ' && *((*txtptr)+ 1) != ')') { /* location */
body->location = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT);
if (LOCAL->cap.extlevel < BODYEXTLOC) LOCAL->cap.extlevel = BODYEXTLOC;
}
- while (**txtptr == ' ') imap_parse_extension (stream,txtptr,reply);
+ while (**txtptr == ' ' && *((*txtptr)+ 1) != ')') imap_parse_extension (stream,txtptr,reply);
+ while ((c = **txtptr) == ' ') ++*(txtptr);
if (**txtptr != ')') { /* validate ending */
sprintf (LOCAL->tmp,"Junk at end of multipart body: %.80s",
(char *) *txtptr);
break;
}
\f
- if (**txtptr == ' ') { /* extension data - md5 */
+ if (**txtptr == ' ' && *(*txtptr + 1) != ')') { /* extension data - md5 */
body->md5 = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT);
if (LOCAL->cap.extlevel < BODYEXTMD5) LOCAL->cap.extlevel = BODYEXTMD5;
}
- if (**txtptr == ' ') { /* disposition */
+ if (**txtptr == ' ' && *(*txtptr + 1) != ')') { /* disposition */
imap_parse_disposition (stream,body,txtptr,reply);
if (LOCAL->cap.extlevel < BODYEXTDSP) LOCAL->cap.extlevel = BODYEXTDSP;
}
- if (**txtptr == ' ') { /* language */
+ if (**txtptr == ' ' && *(*txtptr + 1) != ')') { /* language */
body->language = imap_parse_language (stream,txtptr,reply);
if (LOCAL->cap.extlevel < BODYEXTLANG)
LOCAL->cap.extlevel = BODYEXTLANG;
}
- if (**txtptr == ' ') { /* location */
+ if (**txtptr == ' ' && *(*txtptr + 1) != ')') { /* location */
body->location = imap_parse_string (stream,txtptr,reply,NIL,NIL,LONGT);
if (LOCAL->cap.extlevel < BODYEXTLOC) LOCAL->cap.extlevel = BODYEXTLOC;
}
(i = mail_lookup_auth_name ("LOGIN",NIL)) && (--i < MAXAUTHENTICATORS))
LOCAL->cap.auth &= ~(1 << i);
}
+
+/* IMAP parse id
+ * Accepts: MAIL stream
+ * reply
+ */
+
+void imap_parse_id (MAILSTREAM *stream,char *t)
+{
+ /* If ID information from host is needed, add parser here */
+}
\f
/* IMAP load cache
* Accepts: MAIL stream
auth_link (&auth_md5); /* link in the md5 authenticator */
auth_link (&auth_pla); /* link in the pla authenticator */
auth_link (&auth_log); /* link in the log authenticator */
+ auth_link (&auth_xoauth2); /* link in the xoauth2 authenticator */
mail_versioncheck (CCLIENTVERSION);
ssl_onceonlyinit ();
mail_parameters (NIL,SET_DISABLEPLAINTEXT,(void *) 2);
extern AUTHENTICATOR auth_md5;
extern AUTHENTICATOR auth_pla;
extern AUTHENTICATOR auth_log;
+extern AUTHENTICATOR auth_xoauth2;
}
#endif
-
int try_auth = 0;
-unsigned int mail_lookup_auth_name (char *mechanism,long flags)
-{
- int i;
- AUTHENTICATOR *auth;
-
- if(!try_auth) return 0;
-
- for (i = 1, auth = mailauthenticators; auth; i++, auth = auth->next)
- if (auth->client && !(flags & ~auth->flags) &&
- !compare_cstring (auth->name,mechanism))
- return i;
- return 0;
-}
-
-// 22-Mar-2010 added
int try_auth_smtp = 0;
-unsigned int mail_lookup_auth_name_smtp (char *mechanism,long flags)
+
+unsigned int mail_lookup_auth_name (char *mechanism,long flags)
{
int i;
AUTHENTICATOR *auth;
- if(!try_auth_smtp) return 0;
-
for (i = 1, auth = mailauthenticators; auth; i++, auth = auth->next)
if (auth->client && !(flags & ~auth->flags) &&
!compare_cstring (auth->name,mechanism))
else if (!compare_cstring (s,"loser")) mb->loser = T;
else if (!compare_cstring (s,"tls") && !mb->notlsflag)
mb->tlsflag = T;
- //APOP Authentication - shasikala.p@siso.com
else if (!compare_cstring (s,"apop"))
mb->apop = T;
+ else if (!compare_cstring (s,"force_tls_v1_0"))
+ mb->force_tls_v1_0 = T;
+ else if (!compare_cstring (s,"needauth"))
+ mb->auth_method = AUTH_METHOD_DEFAULT;
+ else if (!compare_cstring (s,"xoauth2"))
+ mb->auth_method = AUTH_METHOD_XOAUTH2;
else if (!compare_cstring (s,"tls-sslv23") && !mb->notlsflag)
mb->tlssslv23 = mb->tlsflag = T;
else if (!compare_cstring (s,"notls") && !mb->tlsflag)
d = mail_valid (NIL,name,(options & OP_SILENT) ?
(char *) NIL : "open mailbox");
}
- return d ? mail_open_work (d,stream,name,options) : stream;
+ if (d)
+ return mail_open_work (d,stream,name,options);
+
+ return stream;
}
\f
/* Mail open worker routine
{
int i;
char tmp[MAILTMPLEN];
+ char *local_mailbox_name = NIL;
NETMBX mb;
if (options & OP_PROTOTYPE) return (*d->open) (NIL);
/* name is copied here in case the caller does a re-open using
* stream->mailbox or stream->original_mailbox as the argument.
*/
- name = cpystr (name); /* make copy of name */
+ local_mailbox_name = cpystr (name); /* make copy of name */
if (stream) { /* recycling requested? */
if ((stream->dtb == d) && (d->flags & DR_RECYCLE) &&
((d->flags & DR_HALFOPEN) || !(options & OP_HALFOPEN)) &&
- mail_usable_network_stream (stream,name)) {
+ mail_usable_network_stream (stream,local_mailbox_name)) {
/* yes, checkpoint if needed */
if (d->flags & DR_XPOINT) mail_check (stream);
mail_free_cache (stream); /* clean up stream */
}
/* check if driver does not support halfopen */
else if ((options & OP_HALFOPEN) && !(d->flags & DR_HALFOPEN)) {
- fs_give ((void **) &name);
+ fs_give ((void **) &local_mailbox_name);
return NIL;
}
\f
sizeof (MAILSTREAM)),(long) 0,CH_INIT);
stream->dtb = d; /* set dispatch */
/* set mailbox name */
- stream->mailbox = cpystr (stream->original_mailbox = name);
+ stream->mailbox = cpystr (stream->original_mailbox = local_mailbox_name);
/* initialize stream flags */
stream->inbox = stream->lock = NIL;
stream->debug = (options & OP_DEBUG) ? T : NIL;
MAILSTREAM *mail_close_full (MAILSTREAM *stream,long options)
{
int i;
+ char tmp[MAILTMPLEN] = { 0, };
if (stream) { /* make sure argument given */
- /* do the driver's close action */
+ snprintf (tmp, MAILTMPLEN, "Checking 'unhealthy' flag of MAILSTEAM.. [%d]", stream->unhealthy);
+ MM_LOG (tmp,(long)WARN);
+ if(stream->unhealthy)
+ return NIL;
+ /* do the driver's close action */
if (stream->dtb) (*stream->dtb->close) (stream,options);
stream->dtb = NIL; /* resign driver */
if (stream->mailbox) fs_give ((void **) &stream->mailbox);
NETSTREAM *stream = NIL;
char tmp[MAILTMPLEN];
unsigned long flags = mb->novalidate ? NET_NOVALIDATECERT : 0;
+
+ flags |= (mb->force_tls_v1_0) ? NET_FORCE_LOWER_TLS_VERSION : 0;
+
if (strlen (mb->host) >= NETMAXHOST) {
sprintf (tmp,"Invalid host name: %.80s",mb->host);
MM_LOG (tmp,ERROR);
char *net_host (NETSTREAM *stream)
{
+ if(stream == NULL || stream->stream == NULL)
+ return "";
return (*stream->dtb->host) (stream->stream);
}
char *net_remotehost (NETSTREAM *stream)
{
+ if(stream == NULL || stream->stream == NULL)
+ return "";
return (*stream->dtb->remotehost) (stream->stream);
}
\f
unsigned long net_port (NETSTREAM *stream)
{
+ if(stream == NULL || stream->stream == NULL)
+ return 0;
return (*stream->dtb->port) (stream->stream);
}
char *net_localhost (NETSTREAM *stream)
{
+ if(stream == NULL || stream->stream == NULL)
+ return "";
return (*stream->dtb->localhost) (stream->stream);
}
#define OP_NOKOD (long) 0x800 /* suppress kiss-of-death */
#define OP_SNIFF (long) 0x1000 /* metadata only open */
/* reserved for application use */
+
+#define OP_FORCE_LOWER_TLS_VERSION 0x2000 /* force lower TLS version */
#define OP_RESERVED (unsigned long) 0xff000000
#define NET_TLSCLIENT ((unsigned long) 0x10000000)
/* try SSL mode */
#define NET_TRYSSL ((unsigned long) 0x8000000)
+ /* force lower TLS version */
+#define NET_FORCE_LOWER_TLS_VERSION ((unsigned long) 0x4000000)
\f
/* Close options */
#endif /* __FEATURE_XLIST_SUPPORT__ */
+#define AUTH_METHOD_NONE 0
+#define AUTH_METHOD_DEFAULT 1
+#define AUTH_METHOD_XOAUTH2 2
/* Sort functions */
unsigned int norsh : 1; /* don't use rsh/ssh */
unsigned int loser : 1; /* server is a loser */
unsigned int tlssslv23 : 1; /* force SSLv23 client method over TLS */
- unsigned int apop; /*APOP Authentication - shasikala.p@siso.com*/
+ unsigned int apop; /*APOP Authentication */
+ unsigned int force_tls_v1_0 : 1; /* force TLS v1.0 */
+ unsigned int auth_method; /* Authentication method */
} NETMBX;
\f
/* Item in an address list */
long mm_diskerror (MAILSTREAM *stream,long errcode,long serious);
void mm_fatal (char *string);
void *mm_cache (MAILSTREAM *stream,unsigned long msgno,long op);
+#ifdef __FEATURE_IMAP_ID_SUPPORT__
+void mm_imap_id (char **id_string);
+#endif /* __FEATURE_IMAP_ID_SUPPORT__ */
extern STRINGDRIVER mail_string;
void mail_versioncheck (char *version);
TLSv1_client_method () :
SSLv23_client_method ())))
return "SSL context failed";
- SSL_CTX_set_options (stream->context,0);
+ if (flags & NET_FORCE_LOWER_TLS_VERSION)
+ SSL_CTX_set_options(stream->context, SSL_OP_NO_SSLv2|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
+ else
+ SSL_CTX_set_options (stream->context,0);
+
/* disable certificate validation? */
if (flags & NET_NOVALIDATECERT)
SSL_CTX_set_verify (stream->context,SSL_VERIFY_NONE,NIL);
TLSv1_client_method () :
SSLv23_client_method ())))
return "SSL context failed";
- SSL_CTX_set_options (stream->context,0);
+
+ if (flags & NET_FORCE_LOWER_TLS_VERSION)
+ SSL_CTX_set_options(stream->context, SSL_OP_NO_SSLv2|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
+ else
+ SSL_CTX_set_options (stream->context,0);
+
/* disable certificate validation? */
if (flags & NET_NOVALIDATECERT)
SSL_CTX_set_verify (stream->context,SSL_VERIFY_NONE,NIL);
last = adr; /* new tail address */
if (string) { /* analyze what follows */
rfc822_skipws (&string);
+
+ /* Recovery from failure on parsing */
+ if ( string != NULL) {
+ while (*string != ',' && *string != '\0')
+ string++;
+ }
+
switch (c = *(unsigned char *) string) {
case ',': /* comma? */
++string; /* then another address follows */
if (!**ret) *ret = NIL; /* wipe pointer if at end of string */
return adr; /* return the address */
}
- sprintf (tmp,"Unterminated mailbox: %.80s@%.80s",adr->mailbox,
- *adr->host == '@' ? "<null>" : adr->host);
- MM_LOG (tmp,PARSE);
+ if (adr) {
+ sprintf (tmp,"Unterminated mailbox: %.80s@%.80s", (adr->mailbox == NULL) ? "<null>" : adr->mailbox,
+ (adr->host == NULL || *adr->host == '@') ? "<null>" : adr->host);
+ MM_LOG (tmp,PARSE);
+ }
adr->next = mail_newaddr ();
adr->next->mailbox = cpystr ("MISSING_MAILBOX_TERMINATOR");
adr->next->host = cpystr (errhst);
NETMAXHOST-1);
mb.host[NETMAXHOST-1] = '\0';
}
- if (!smtp_auth (stream,&mb,tmp)) stream = smtp_close (stream);
+ if(mb.auth_method > 0) {
+ if (!smtp_auth (stream,&mb,tmp)) stream = smtp_close (stream);
+ }
}
else { /* no available authenticators? */
sprintf (tmp,"%sSMTP authentication not available: %.80s", mb.secflag ? "Secure " : "",mb.host);
for (auths = ESMTP.auth, stream->saslcancel = NIL;
!ret && stream->netstream && auths &&
(at = mail_lookup_auth (find_rightmost_bit (&auths) + 1)); ) {
+
+ sprintf (tmp,"Trying using %s authentication. ", at->name);
+ mm_log (tmp,NIL);
if (lsterr) { /* previous authenticator failed? */
sprintf (tmp,"Retrying using %s authentication after %.80s", at->name,lsterr);
mm_log (tmp,NIL);
}
stream->sensitive = NIL;/* unhide */
}
-#if 1 // for smtp.web.de
- else if (!strcmp(at->name, "PLAIN")) {
- char* user = usr;
- char pwd[MAILTMPLEN];
-
- pwd[0] = NIL;
- mm_login(mb, user, pwd, trial);
-
- unsigned long rlen = strlen(mb->authuser) + strlen(user) + strlen(pwd) + 2;
- char* response = (char*) fs_get(rlen);
- char* t = response;
- char* u;
-
- if (mb->authuser[0])
- for (u =user; *u; *t++ = *u++);
-
- *t++ = '\0';
-
- for (u = (mb->authuser[0] ? mb->authuser : user); *u; *t++ = *u++);
-
- *t++ = '\0';
-
- for (u = pwd; *u; *t++ = *u++);
-
- unsigned long i, j;
-
- for (t = (char*) rfc822_binary(response, rlen, &i), u = t, j = 0; j < i; j++) {
- if (t[j] > ' ') *u++ = t[j];
- }
-
- *u = '\0';
-
- i = smtp_send(stream, "AUTH PLAIN", t);
-
- fs_give((void**)&t);
-
- memset(response, 0, rlen);
- fs_give((void**)&response);
-
- if (i == SMTPAUTHED) {
- ESMTP.auth = NIL;
- ret = LONGT;
- }
- else if (!trial) mm_log("SMTP Authentication cancelled", ERROR);
- }
-#endif
/* remember response if error and no cancel */
if (!ret && trial) lsterr = cpystr (stream->reply);
} while (!ret && stream->netstream && trial &&
ESMTP.atrn.ok = T;
}
else if (!compare_cstring (s,"AUTH"))
- //do if ((j = mail_lookup_auth_name (t,flags)) &&
- do if ((j = mail_lookup_auth_name_smtp (t,flags)) && // 22-Mar-2010 Fix for SMTP Authorization issue - avoid race condition. change from mail_lookup_auth_name to mail_lookup_auth_name_smtp
- (--j < MAXAUTHENTICATORS)) ESMTP.auth |= (1 << j);
+ do if ((j = mail_lookup_auth_name (t,flags)) &&
+ (--j < MAXAUTHENTICATORS)) ESMTP.auth |= (1 << j);
while ((t = strtok_r (NIL," ",&r)) && *t);
}
/* EHLO options which do not take arguments */
}
while ((i < 100) || (stream->reply[3] == '-'));
/* disable LOGIN if PLAIN also advertised */
- // 22-Mar-2010 change from mail_lookup_auth_name to mail_lookup_auth_name_smtp
/*
if ((j = mail_lookup_auth_name ("PLAIN",NIL)) && (--j < MAXAUTHENTICATORS) &&
(ESMTP.auth & (1 << j)) &&
(j = mail_lookup_auth_name ("LOGIN",NIL)) && (--j < MAXAUTHENTICATORS))
ESMTP.auth &= ~(1 << j);
- */
- if ((j = mail_lookup_auth_name_smtp ("PLAIN",NIL)) && (--j < MAXAUTHENTICATORS) &&
- (ESMTP.auth & (1 << j)) &&
- (j = mail_lookup_auth_name_smtp ("LOGIN",NIL)) && (--j < MAXAUTHENTICATORS))
- ESMTP.auth &= ~(1 << j);
+ */
return i; /* return the response code */
}
\f
TLSv1_client_method () :
SSLv23_client_method ())))
return "SSL context failed";
- SSL_CTX_set_options (stream->context,0);
+ if (flags & NET_FORCE_LOWER_TLS_VERSION)
+ SSL_CTX_set_options(stream->context, SSL_OP_NO_SSLv2|SSL_OP_NO_TLSv1_1|SSL_OP_NO_TLSv1_2);
+ else
+ SSL_CTX_set_options (stream->context,0);
/* disable certificate validation? */
if (flags & NET_NOVALIDATECERT)
SSL_CTX_set_verify (stream->context,SSL_VERIFY_NONE,NIL);
Name: uw-imap-toolkit
Summary: IMAP-2007e developed by University of Washington
-Version: 0.1.1
+Version: 0.1.2
Release: 0
Group: Messaging/Libraries
License: Apache-2.0
rm -rf %{buildroot}
%make_install
+mkdir -p %{buildroot}/usr/share/license
+cp imap-2007e/LICENSE.txt %{buildroot}/usr/share/license/%{name}
%post -n libuw-imap-toolkit -p /sbin/ldconfig
%manifest libuw-imap-toolkit.manifest
%defattr(-,root,root,-)
%{_libdir}/libuw-imap-toolkit.so.*
-
+/usr/share/license/%{name}
%files -n libuw-imap-toolkit-devel
%manifest libuw-imap-toolkit-devel.manifest