Article delegate-en/3567 of [1-5169] on the server localhost:119
  upper oldest olders older1 this newer1 newers latest
search
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
[Reference:<_A3564@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] supported CAPA / STLS for POP3 (Re: Delegate behaviour analogue among well-known POP3 servers)
03 Nov 2006 01:50:29 GMT feedback@delegate.org (Yutaka Sato)


Hi,

On 11/02/06(16:30) you Soldatov Andrey <p5qgqbdyi-j73qrjk4emlr.ml@ml.delegate.org> wrote
in <_A3564@delegate-en.ML_>
 |Hello, do you know big well-known POP3 server with SSL support
 |on non-dedicated port which returns on CAPA command (at the beginning

I don't know so mutch about POP3 implementations because I'm not a
practical user of POP3.

 |of connection) the same as DeleGate:
 |   C:\DeleGate> dg9_2_3 -f STLS=-fcl -P310 SERVER=pop://someserver:311
 |         ADMIN=a@someserver.. DGROOT=c:/DeleGate PERMIT="*:*:*"
 |   S: +OK XXX POP3 Server ready <4534.1162437568@someserver..>
 |   C: CAPA
 |   S: -ERR Say STLS first

I think the response from DeleGate can be so if you specified STLS="fcl"
but it could not be with STLS="-fcl" which means STLS is optional
so DeleGate simply relays the response for CAPA from the POP server.

 |I has read RFC 2449 and RFC 2595 and I think it's correct but I need
 |practical confirmation of permissibility of CAPA command unsupport
 |when STLS is supported. Or may be you know another requirements
 |clarify such behavoiur?

The implementation of STLS for POP in DeleGate is still in experimental
and I'll extend it on demand.  A modification like the enclosed patch
will support CAPA for STLS in following cases.

            SERVER=pop://server ... removes STLS in CAPA resp. from the server
   STLS=fcl SERVER=pop://server
  STLS=-fcl SERVER=pop://server
            SERVER=pop
   STLS=fcl SERVER=pop
  STLS=-fcl SERVER=pop

The executable files with this extension is uploaded at
<URL:ftp://ftp.delegate.org/pub/DeleGate/tmp/bin-latest9/>

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


diff -cr delegate9.2.5-fix3/src/pop.c delegate9.3.0-pre1/src/pop.c
*** delegate9.2.5-fix3/src/pop.c	Thu Aug 31 09:27:38 2006
--- delegate9.3.0-pre1/src/pop.c	Fri Nov  3 10:31:31 2006
***************
*** 102,107 ****
--- 102,108 ----
  	{ "UIDL", WITH_BODY|NULL_BODY_IFARG },
  	{ "TOP",  WITH_BODY|IN_RFC822 },
  	{ "AUTH", WITH_BODY|NULL_BODY_IFARG },
+ 	{ "CAPA", WITH_BODY },
  
  	/* private extension ? */
  	{ "LAST"},
***************
*** 496,501 ****
--- 497,505 ----
  	return 0;
  }
  
+ #define acceptSTLS(Conn) \
+ 	((ClientFlags&PF_STLS_DO) && (ClientFlags&(PF_STLS_ON|PF_SSL_ON))==0)
+ 
  static void ProxyPOP(Connection *Conn)
  {	CStr(myhost,LNSIZE);
  	CStr(banner,LNSIZE);
***************
*** 528,533 ****
--- 532,549 ----
  			lineScan(vp,resp);
  			fprintf(tc,"%s\r\n",resp);
  		}else
+ 		if( strcaseeq(com,"CAPA") ){
+ 			fputs("+OK Capability list follows\r\n",tc);
+ 			if( !needSTLS(Conn) ){
+ 				fputs("USER\r\n",tc);
+ 				if( withAPOP(Conn) )
+ 					fputs("APOP\r\n",tc);
+ 			}
+ 			if( acceptSTLS(Conn) ){
+ 				fputs("STLS\r\n",tc);
+ 			}
+ 			fputs(".\r\n",tc);
+ 		}else
  		if( strcaseeq(com,"USER") || strcaseeq(com,"APOP") ){
  			sv1log("POP C-S: %s",req);
  			req[0] = 0;
***************
*** 684,689 ****
--- 700,728 ----
  	return 0;
  }
  
+ static void filterCAPA(Connection *Conn,PCStr(resp),FILE *fs,FILE *tc){
+ 	CStr(line,LNSIZE);
+ 	CStr(cap1,LNSIZE);
+ 	while( 1 ){
+ 		if( fgets(line,sizeof(line),fs) == 0 )
+ 			break;
+ 		Verbose("S-C: CAPA %s",line);
+ 		wordScan(line,cap1);
+ 		if( strcaseeq(cap1,"STLS") ){
+ 			sv1log("S-D: CAPA STLS --- removed\n");
+ 			continue;
+ 		}
+ 		if( line[0] == '.' && (line[1] == '\r' || line[1] == '\n') ){
+ 			if( acceptSTLS(Conn) ){
+ 				sv1log("D-C: CAPA STLS --- appended\n");
+ 				fputs("STLS\r\n",tc);
+ 			}
+ 			fputs(line,tc);
+ 			break;
+ 		}
+ 		fputs(line,tc);
+ 	}
+ }
  int POP_STARTTLS_withCL(Connection *Conn,FILE *fc,FILE *tc,PCStr(com),PCStr(arg));
  int POP_STARTTLS_withSV(Connection *Conn,FILE *ts,FILE *fs,PCStr(user));
  
***************
*** 852,857 ****
--- 891,902 ----
  			continue;
  		}
  		if( needSTLS(Conn) ){
+ 			if( strcaseeq(com,"CAPA") ){
+ 				fputs("+OK Capability list follows\r\n",tc);
+ 				fputs("STLS\r\n",tc);
+ 				fputs(".\r\n",tc);
+ 				continue;
+ 			}
  			if( strcasecmp(com,"STLS") != 0 )
  			if( strcasecmp(com,"QUIT") != 0 )
  			{
***************
*** 927,932 ****
--- 972,980 ----
  		else	Verbose("POP S-C[%d:%d]: %s",ri,body,resp);
  
  		if( body && *resp == '+' ){
+ 			if( strcaseeq(com,"CAPA") ){
+ 				filterCAPA(Conn,resp,fs,tc);
+ 			}else
  			switch( body & RESPFLAGS ){
  				case WITH_BODY | IN_RFC822:
  					PGPdecodeMIME(fs,tc,NULL,0xFF,1,0);


  admin search upper oldest olders older1 this newer1 newers latest
[Top/Up] [oldest] - [Older+chunk] - [Newer+chunk] - [newest + Check]
@_@V