Article delegate-en/2189 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]

Newsgroups: mail-lists.delegate-en

[DeleGate-En] SV: [DeleGate-En] Support for ftp ACCT
31 Mar 2003 07:23:16 GMT Niels Ull Harremoes <pqueabdyi-g7ilkrvxmhjr.ml@ml.delegate.org>


Thanks  a lot! We'll give it a try.
Regards
	Niels HarremoŽs

-----Oprindelig meddelelse-----
Fra: feedback@delegate.org [mailto:feedback@delegate.org]
Sendt: 27. marts 2003 20:41
Til: feedback@delegate.org
Cc: pqueabdyi-g7ilkrvxmhjr.ml@ml.delegate.org
Emne: Re: [DeleGate-En] Support for ftp ACCT


On 03/25/03(17:54) you Niels Ull Harremoes <pqueabdyi-g7ilkrvxmhjr.ml@ml.delegate.org> wrote
in <_A2181@delegate-en.ML_>
 |I would like to connect to a mainframe ftp server, which requires me to
log
 |in with username, password *and* account (ACCT). 
 |I am trying to connect from an integration product, which does not know
 |anything about accounts. 
 |So if I would be able to set DeleGate up so that
 |
 |ftp localhost 8021
 |
 |would automatically proxy to remotemainframe using user "TRANSF", password
 |"fJge3", account "XFER"
 |
 |I only need to go to this one username/account, but I'd like for DeleGate
to
 |add the ACCT info. Is that possible?

It was not possible, but should be supported.
The enclosed patch will enable encoding account-name in user-name
like "user-name/account-name".  When a patched DeleGate receives
following command sequence from client:

  C: USER user-name/account-name
  C: PASS password

then the DeleGate will generate

  C: USER user-name
  S: 331
  C: PASS password
  S: 332
  C: ACCT account-name

Although I've not tested it with a real server, I hope it will work
in your case.

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


*** ../dist/delegate8.5.2/src/ftp.c	Mon Mar 17 09:25:44 2003
--- ftp.c	Fri Mar 28 04:19:02 2003
***************
*** 113,118 ****
--- 113,119 ----
  	char	fs_host[128];
  	int	fs_port;
  	char	fs_logindir[1024];
+ 	int	fs_logindir_isset;
  	int	fs_nocache;
  
  	int	fs_login1st;
***************
*** 147,152 ****
--- 148,154 ----
  	int	fs_auth;
  	char	fs_auser[128];
  	AuthInfo fs_proxyauth;
+ 	char	fs_acct[128];
  
  	char	fs_opts[32];
  	int	fs_REST;
***************
*** 172,177 ****
--- 174,180 ----
  	char	fc_swcom[32];
  	char	fc_user[128];
  	char	fc_pass[128];
+ 	char	fc_acct[128];
  	char	fc_path[128];
  	char	fc_type[64];
  	char	fc_opts[32];
***************
*** 552,557 ****
--- 555,561 ----
  	strcpy(PFC->fc_pass,cpass);
  	strcpy(PFC->fc_type,ctype);
  	wordScan(FS->fs_opts,PFC->fc_opts);
+ 	wordScan(FS->fs_acct,PFC->fc_acct);
  
  	wordScan(server,serv);
  	if( dp = strchr(serv,'/') )
***************
*** 4012,4028 ****
--- 4016,4044 ----
  	FILE *ts,*fs;
  {	char *RESP;
  	int rcode;
+ 	char user[128];
  
  	Verbose("proxyLogin(%s,%s,%s,%s)\n",
  		pFC->fc_user,pFC->fc_pass,pFC->fc_path,pFC->fc_type);
  
  	RESP = resp;
  	rcode = 0;
+ 
+ 	user[0] = 0;
+ 	wordScan(pFC->fc_acct,FS->fs_acct);
+ 
  	if(pFC->fc_user[0]){
  		SSEEK(RESP);
  		if( xuser[0] == 0 )
  			xuser = pFC->fc_user;
  
+ 		if( strchr(xuser,'/') ){
+ 			scan_namebody(xuser,user,sizeof(user),"/",
+ 				FS->fs_acct,sizeof(FS->fs_acct),"");
+ 			sv1log("##ACCT got[%s]
USER[%s]\n",FS->fs_acct,xuser);
+ 			xuser = user;
+ 		}
+ 
  		_put_get(MODE(FS),ts,fs,RESP,rsize,
  			"USER %s\r\n",xuser);
  		rcode = atoi(RESP);
***************
*** 4039,4046 ****
--- 4055,4071 ----
  		if( FS->fs_anonymous &&
anonPASS(Conn,NULL,pFC->fc_user,pFC->fc_pass)!=0 )
  			sprintf(RESP,"530 Invalid/Forbidden
<%s>\r\n",pFC->fc_pass);
  		else
+ 		{
  		_put_get(MODE(FS),ts,fs,RESP,rsize,
  			"PASS %s\r\n",pFC->fc_pass);
+ 
+ 			if( atoi(RESP) == 332 && FS->fs_acct[0] != 0 ){
+ 				sv1log("##ACCT put[%s]\n",FS->fs_acct);
+ 				_put_get(MODE(FS),ts,fs,RESP,rsize,
+ 					"ACCT %s\r\n",FS->fs_acct);
+ 			}
+ 		}
+ 
  		if( atoi(RESP) == 530 )
 
FTP_delayReject(Conn,1,"PASS",RESP,0,pFC->fc_user,pFC->fc_pass);
  		if( *RESP == '5' || *RESP == '4' )
***************
*** 4623,4628 ****
--- 4648,4654 ----
  				goto EXIT;
  		}
  
+ 	GOTREQ:
  		dp = wordScan(req,com);
  		if( !method_permitted(Conn,"ftp",com,1) ){
  			fprintf(tc,"500 forbidden command: %s\r\n",com);
***************
*** 4640,4645 ****
--- 4666,4681 ----
  			if( unescape_user_at_host(arg) )
  				sprintf(req,"%s %s\r\n",com,arg);
  
+ 		if( (dp = strpbrk(arg,"/@")) && *dp == '/' ){
+ 			char *tp;
+
wordscanY(dp+1,FS->fs_acct,sizeof(FS->fs_acct),"^@");
+ 			sv1log("##ACCT got[%s] USER=%s\n",FS->fs_acct,arg);
+ 			if( tp = strpbrk(dp+1,"@") )
+ 				ovstrcpy(dp,tp);
+ 			else	*dp = 0;
+ 			sprintf(req,"%s %s\r\n",com,arg);
+ 		}
+ 
  		/* pipelining should be implicit rathar than explicit
  		 * with explicit PIPELINE command ...
  		 */
***************
*** 4681,4689 ****
--- 4717,4730 ----
  			continue;
  
  		if( strcaseeq(com,"CWD") || strcaseeq(com,"PWD") ||
login_done )
+ 		if( FS->fs_logindir_isset == 0 ){
  			if( FS->fs_logindir[0] == 0 )
  				if( reqQn == 0 )
+ 				{
  					setLoginPWD(FS,ts,fs);
+ 					FS->fs_logindir_isset = 1;
+ 				}
+ 		}
  
  		sav_islocal = FS->fs_islocal;/* can be changed in
rewrite_CWD */
  		strcpy(sav_cwd,FS->fs_CWD);
***************
*** 4932,4938 ****
--- 4973,4990 ----
  			fputs(resp,tc);
  			fflush(tc);
  		}else{
+ 			rcode = get_resp(fs,NULL,resp,sizeof(resp));
+ 			if( comeq(com,"PASS") )
+ 			if( atoi(resp) == 332 && FS->fs_acct[0] != 0 ){
+ 				sv1log("##ACCT put[%s]\n",FS->fs_acct);
+ 				sprintf(req,"ACCT %s\r\n",FS->fs_acct);
+ 				goto GOTREQ;
+ 			}
+ 			fputs(resp,tc);
+ 			fflush(tc);
+ 			/*
  			rcode = get_resp(fs,tc,resp,sizeof(resp));
+ 			*/
  			/* path name in (error) resp like that for CWD
  			 * command should be rewriten by reverse-MOUNT ...
  			 */

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