Article delegate-en/4776 of [1-5107] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:]  
Re: SMTP AUTH LOGIN
Tue, 30 Mar 2010     Yutaka Sato

Hi,

In message  on 03/30/10(02:44:15)
you =?iso-8859-1?Q?Jes=FAs_DIEGO_FERN=C1NDEZ?= wrote:
 |We were planning to use Delegate to send emails from internal machines (no-ssl,
 no-authentication) to BPOS. However we are facing a problem:
 |
 |-          BPOS smtp service only supports AUTH LOGIN function after STARTTLS (
no support for AUTH PLAIN even if the RFC says that it must).
 |
 |-          Delegate only supports AUTH PLAIN when acting as a client (the source
 code of SMTP_sendMYAUTH is clear about it).
 |
 |Questions:
 |-          Can we expect to get support for AUTH LOGIN in future releases?
 |-          If not, any suggested workaround?

When I implemented it about 7 years ago, AUTH PLAIN was the only method 
available in any server implementation of SMTP-AUTH (even without EHLO).
So I coded so.  Now I'll extend it as the enclosed patch to do AUTH LOGIN
if it is listed in the response to EHLO.
I uploaded 9.9.7-pre37 with the patch applied (and 9.9.7 to be released
in this month).

Cheers,
Yutaka
--
  9 9   Yutaka Sato http://delegate.org/y.sato/
 ( ~ )  National Institute of Advanced Industrial Science and Technology
_<   >_ 1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan
Do the more with the less -- B. Fuller

*** dist/src/delegate9.9.7-pre36/src/smtp.c	Wed Mar 24 09:24:37 2010
--- ./src/smtp.c	Tue Mar 30 12:37:19 2010
***************
*** 1467,1472 ****
--- 1467,1520 ----
  	return 0;
  }
  
+ int strtoB64(PCStr(str),int slen,PVStr(b64),int bsiz,int withnl);
+ static int SMTP_authLOGIN(Connection *Conn,FILE *log,FILE *ts,FILE *fs,PCStr(auth),PVStr(resp)){
+ 	IStr(user,128);
+ 	IStr(pass,128);
+ 	IStr(userb,256);
+ 	IStr(passb,256);
+ 	int code;
+ 
+ 	fieldScan(auth,user,pass);
+ 	strtoB64(user,strlen(user),AVStr(userb),sizeof(userb),0);
+ 	strtoB64(pass,strlen(pass),AVStr(passb),sizeof(passb),0);
+ 
+ 	SMTP_putserv(log,fs,ts,BVStr(resp),"AUTH LOGIN\r\n");
+ 	if( (code = atoi(resp)) != 334 ){
+ 		return code;
+ 	}
+ 
+ 	SMTP_putserv(log,fs,ts,BVStr(resp),"%s\r\n",userb);
+ 	if( (code = atoi(resp)) != 334 ){
+ 		return code;
+ 	}
+ 
+ 	SMTP_putserv(log,fs,ts,BVStr(resp),"%s\r\n",passb);
+ 	if( (code = atoi(resp)) != 235 ){
+ 		return code;
+ 	}
+ 	return code;
+ }
+ static int doAUTH_LOGIN_SV(PCStr(myhost),FILE *log,FILE *ts,FILE *fs,PVStr(resp)){
+ 	const char *cache = EHLO_cache;
+ 	int doauth = SMTP_doauth;
+ 	IStr(caps,4*1024);
+ 	const char *dp;
+ 
+ 	EHLO_cache = 0;
+ 	SMTP_doauth = 0;
+ 	HELO_withSV("EHLO",myhost,log,ts,fs,AVStr(caps));
+ 	EHLO_cache = cache;
+ 	SMTP_doauth = doauth;
+ 
+ 	lineScan(caps,resp);
+ 	if( strstr(caps,"250-AUTH") ){
+ 		if( strstr(caps,"LOGIN") ){
+ 			return 1;
+ 		}
+ 	}
+ 	return 0;
+ }
  static int SMTP_sendMYAUTH(Connection *Conn,FILE *log,FILE *ts,FILE *fs)
  {	CStr(authb,256);
  	const char *ap;
***************
*** 1483,1488 ****
--- 1531,1544 ----
  		if( gethostNAME(fileno(ts),AVStr(myhost)) <= 0 )
  			gethostname(myhost,sizeof(myhost));
  		getFQDN(myhost,AVStr(myhost));
+ 
+ 		if( doAUTH_LOGIN_SV(myhost,log,ts,fs,AVStr(resp)) ){
+ 			SMTP_authLOGIN(Conn,log,ts,fs,authb,AVStr(resp));
+ 			if( atoi(resp) == 235 ){
+ 				return 0;
+ 			}
+ 		}
+ 
  		SMTP_putserv(log,fs,ts,AVStr(resp),"EHLO %s\r\n",myhost);
  		if( atoi(resp) != 250 ){
  			return -1;
  search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V