9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] ftpd bugfix and enhancement
@ 2022-03-17  4:13 ibrahim via 9fans
  0 siblings, 0 replies; only message in thread
From: ibrahim via 9fans @ 2022-03-17  4:13 UTC (permalink / raw)
  To: 9fans

[-- Attachment #1: Type: text/plain, Size: 2579 bytes --]

While using ftpd in 9vx and qemu I got response messages "Permission denied" in passive mode. This was caused in dialdata by dial(data,"20",0,0). While correcting this problem I also enhanced the options of ftpd to make it possible to use alternative ports instead of 20 for the data socket. ftpd got an optional parameter -P dataport which defaults to 20. The changes make it now possible to use ftpd from 9vx and qemu without port redirection.

with a call like :

aux/listen1 -vt tcp!*!13000 /bin/ip/ftpd -Aen namespace.ftp -P 13001

one can start a ftp server listening on port 13000 while using 13001 as its default data port. 

The diffs for ftpd.c and ipserv-manpage against 9legacy (latest version) are :

DIFF FOR ftpd.c :

137,138d136
< char *dataport="20" ;
< char dataadr[64] ;
177,178c175,176
<       syslog(0, "ftp", "usage: %s [-aAde] [-n nsfile] [-P dataport]", argv0);
<       fprint(2, "usage: %s [-aAde] [-n nsfile] [-P dataport]\n", argv0);
---
>       syslog(0, "ftp", "usage: %s [-aAde] [-n nsfile]", argv0);
>       fprint(2, "usage: %s [-aAde] [-n nsfile]\n", argv0);
194,195c192
<       int dataportid ;
<
---
214,216d210
<       case 'P' :
<               dataport = EARGF(usage()) ;
<               break ;
232,237d225
<       /* prepare data port */
<       dataportid=atol(dataport) ;
<       if (dataportid==0)
<               dataportid=20 ;
<       snprint(dataadr,64,"tcp!*!%d",dataportid) ;
<
1697c1685
<               fd = dial(data, dataadr, 0, 0);
---
>               fd = dial(data, "20", 0, 0);
1710d1697
<

Diff for man/8/ipserv
18,19d17
< .RB [ -P
< .IR dataport ]
170,172d167
< .TP
< .B P
< the port used for the data socket (default 20)
181,188d175
< .PP
< .SH EXAMPLE
< .PP
< Start ftpd with control port 13000 and data port 13001 while using prepared namespace /usr/glenda/ftp/namespace.ftp for anonymous access.
< .PP
< .EX
<       aux/listen1 -vt tcp!*!13000 /bin/ip/ftpd -Aen /usr/glenda/ftp/namespace.ftp -P 13001
< .EE


FURTHER COMMENT :
ftpd makes data exchange between UNIX hosts and plan9 guests while using qemu very simple.

ftpd can be started from 9vx in usermode when using ports other than 21(20).

Some ftp clients ask for utf8 opt and this is ignored by ftpd my next patch will adress this problem. Comments are welcome.

------------------------------------------
9fans: 9fans
Permalink: https://9fans.topicbox.com/groups/9fans/T5cbecf1a4fb8cf5e-Mcd4d16fb44d1c44c68272702
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription

[-- Attachment #2: Type: text/html, Size: 4317 bytes --]

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2022-03-17  4:14 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-03-17  4:13 [9fans] ftpd bugfix and enhancement ibrahim via 9fans

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).