9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: "ibrahim via 9fans" <9fans@9fans.net>
To: 9fans <9fans@9fans.net>
Subject: [9fans] ftpd bugfix and enhancement
Date: Thu, 17 Mar 2022 00:13:59 -0400	[thread overview]
Message-ID: <16474904390.dE6D6.98287@composer.9fans.topicbox.com> (raw)

[-- 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 --]

                 reply	other threads:[~2022-03-17  4:14 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=16474904390.dE6D6.98287@composer.9fans.topicbox.com \
    --to=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).