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

[DeleGate-En] AUTHOFIZER for NNTP-DeleGate (Re: authentication for ftp proxy?)
07 Jun 2000 07:17:58 GMT ysato@etl.go.jp (Yutaka Sato)


On 06/06/00(18:16) I wrote in <_A824@delegate-en.ML_>
 |Since AUTHORIZER for FTP-DeleGate has been necessary for DeleGate as
 |an origin FTP server, I made a tentative implementation of 1), and
 |4) as enclosed patch.  With the patch, I hope AUTHORIZER with
 |FTP-DeleGate works as you expected

The enclosed patch for "nnpc." will enable AUTHORIZER for NNTP-DeleGate,
together with the previous patch for "access.c"

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            _<   >_


*** ../6112/src/nntp.c	Wed May 31 15:57:50 2000
--- nntp.c	Wed Jun  7 16:14:30 2000
***************
*** 90,95 ****
--- 90,98 ----
  				 * must do Authentication to start a sesssion */
  	int	ne_withAuth;	/* the client or at least one of servers is
  				 * with AUTHINFO */
+ 	int	ne_needProxyAuth; /* with AUTHORIZER */
+ 	int	ne_proxyAuthOK;
+ 	char	ne_proxyUSER[64];
  
  	int	ne_group_nameid;/* group name to group id trans. tab. */
  	int	ne_permitted_nsid; /* group to nsid translation table */
***************
*** 145,150 ****
--- 148,156 ----
  
  #define needAuthClnt	NX.ne_needAuthClnt
  #define withAuth	NX.ne_withAuth
+ #define needProxyAuth	NX.ne_needProxyAuth
+ #define proxyAuthOK	NX.ne_proxyAuthOK
+ #define proxyUSER	NX.ne_proxyUSER
  
  #define group_nameid	NX.ne_group_nameid
  #define permitted_nsid	NX.ne_permitted_nsid
***************
*** 656,661 ****
--- 662,678 ----
  	}
  	return 0;
  }
+ static proxyAuth(Conn,userpass,host)
+ 	Connection *Conn;
+ 	char *userpass,*host;
+ {	FILE *xtc;
+ 	int rcode;
+ 
+ 	xtc = TMPFILE("NNTP-AUTHORIZER");
+ 	rcode = doAUTH(Conn,NULL,xtc,"nntp","-",0,userpass,host,NULL,NULL);
+ 	fclose(xtc);
+ 	return rcode;
+ }
  NNTP_authERROR(nsid)
  {	int error;
  
***************
*** 3848,3853 ****
--- 3865,3906 ----
  			}
  		}
  
+ 		if( needProxyAuth && proxyAuthOK == 0 )
+ 		if( !strcaseeq(com,"QUIT") ){
+ 			char com1[64],arg1[64],user[128],host[64];
+ 
+ 			if( strcaseeq(com,"AUTHINFO") ){
+ 			    dp = wordScan(arg,com1);
+ 			    wordScan(dp,arg1);
+ 			    if( strcaseeq(com1,"USER") ){
+ 				strcpy(proxyUSER,arg1);
+ 				fprintf(tc,"381 PASS required [DeleGate]\r\n");
+ 				continue;
+ 			    }
+ 			    if( strcaseeq(com1,"PASS") ){
+ 				if( proxyUSER[0] == 0 ){
+ 					fprintf(tc,"482 USER required.\r\n");
+ 					continue;
+ 				}
+ 				sprintf(user,"%s:%s",proxyUSER,arg1);
+ 				host[0] = 0;
+ 				if( proxyAuth(Conn,user,host) == EOF ){
+ 					sv1log("AUTHINFO ERR[%s].\n",proxyUSER);
+ 					fprintf(tc,"502 Auth. ERROR.\r\n");
+ 					break;
+ 				}else{
+ 					sv1log("AUTHINFO OK [%s].\n",proxyUSER);
+ 					fprintf(tc,"281 OK [DeleGate]\r\n");
+ 					proxyAuthOK = 1;
+ 				}
+ 				continue;
+ 			    }
+ 			}
+ 			sv1log("#### require AUTHINFO for '%s'\n",com);
+ 			fprintf(tc,"480 Authentication required[DeleGate]\r\n");
+ 			continue;
+ 		}
+ 
  		if( strcasecmp(com,"XECHO") == 0 ){
  			setSync(DO_ECHO);
  			continue;
***************
*** 5113,5118 ****
--- 5166,5173 ----
  	}
  	if( nservers_remote() != 1 )
  		putIdent(tc,"");
+ 
+ 	needProxyAuth = proxyAuth(Conn,"proxy-user:pass","host-xxxx") == EOF;
  
  	ClientIF_name(Conn,ClientSock,clientIF_FQDN);
  	getFQDN(clientIF_FQDN,clientIF_FQDN);

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