Article delegate-en/898 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:<_A897@delegate-en.ML_>]
Newsgroups: mail-lists.delegate-en

[DeleGate-En] a patch to enable IMAP MOUNT (Re: Question about delegate software, using SSLway, etc.)
10 Oct 2000 22:22:39 GMT ysato@etl.go.jp (Yutaka Sato)


On 10/11/00(07:10) I wrote in <_A897@delegate-en.ML_>
 |  MOUNT="//hostX/userA pop://hostY/userB"
...
 |This MOUNT will be applicable to IMAP too in the next release of DeleGate.

The enclosed is a patch to enable such MOUNT for SERVER=imap with a
parameter like follows: 

  MOUNT="//hostX/userA imap://hostY/userB"

The next version of DeleGate will be released with this modification.

Cheers,
Yutaka
--
Yutaka Sato <ysato@etl.go.jp> http://www.etl.go.jp/~ysato/   @ @ 
Computer Science Division, Electrotechnical Laboratory      ( - )
1-1-4 Umezono, Tsukuba, Ibaraki, 305-8568 Japan            _<   >_

*** ../../delegate6.1.18/src/imap.c	Wed Jun 28 11:20:24 2000
--- imap.c	Wed Oct 11 07:14:24 2000
***************
*** 23,35 ****
--- 23,56 ----
  #include "ystring.h"
  #define LNSIZE 1024
  extern char *fgetsTIMEOUT();
+ extern char *CTX_mount_url_to();
  
  static imap_change_server(Conn,login)
  	Connection *Conn;
  	char *login;
  {	char *dp,host[LNSIZE];
+ 	char *opts,user[LNSIZE],tmp[LNSIZE];
  	int port;
  
+ 	if( *login == '"' )
+ 		wordscanY(login+1,user,sizeof(user),"^\"");
+ 	else	wordScan(login,user);
+ 	if( dp = strrpbrk(user,"@%") ){
+ 		*dp = 0;
+ 		strcpy(tmp,user);
+ 		wordScan(dp+1,host);
+ 		sprintf(user,"//%s/%s",host,tmp);
+ 	}
+ 	opts = CTX_mount_url_to(Conn,NULL,"GET",user);
+ 	if( strncasecmp(user,"imap://",7) == 0 )
+ 		strcpy(user,user+5);
+ 
+ 	if( sscanf(user,"//%[^/]/%s",tmp,user) == 2 ){
+ 		port = scan_hostportX("imap",tmp,host,sizeof(host));
+ 		sprintf(login,"\"%s\"",user);
+ 		goto SWSERV;
+ 	}
+ 
  	dp = strrpbrk(login,"@%");
  	if( dp == 0 )
  		return;
***************
*** 39,44 ****
--- 60,66 ----
  		*dp++ = '"';
  	*dp = 0;
  
+ SWSERV:
  	sv1log("IMAP LOGIN  %s @ %s:%d\n",login,host,port);
  	set_realserver(Conn,"imap",host,port);
  	connect_to_serv(Conn,FromC,ToC,0);
***************
*** 143,148 ****
--- 165,193 ----
  		if( strcaseeq(qcmd,"LOGOUT") && strcaseeq(rstat,"OK")
  		 || feof(fs) )
  			break;
+ 
+ 		if( strcaseeq(qcmd,"LOGIN") )
+ 		if( !strcaseeq(rstat,"OK") ){
+ 			fprintf(ts,"X LOGOUT\r\n");
+ 			fclose(ts);
+ 			fclose(fs);
+ 			ts = fs = NULL;
+ 			ToS = FromS = -1;
+ 			sv1log(">>>> IMAP connection to the server closed.\n");
+ 			/* must clear FSV,FTOSV,FFROMSV if exists */
+ 		}
+ 		if( strcaseeq(qcmd,"LOGIN") ){
+ 			char clnt[LNSIZE],user[LNSIZE],serv[LNSIZE];
+ 			strfConn(Conn,"%u@%h",clnt);
+ 			if( *qarg == '"' )
+ 				wordscanY(qarg+1,user,sizeof(user),"^\"");
+ 			else	wordScan(qarg,user);
+ 			sprintf(serv,"%s@%s",user,DST_HOST);
+ 			sv1log("%s IMAP-LOGIN FROM=%s TO=%s\n",
+ 				0<=ToS?"OK":"NO",clnt,serv);
+ 			fputLog(Conn,"Login","%s IMAP-LOGIN; from=%s; to=%s\n",
+ 				0<=ToS?"OK":"NO",clnt,serv);
+ 		}
  	}
  EXIT:
  	return;

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