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 :

< char *dataport="20" ;
< char dataadr[64] ;
<       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);
<       int dataportid ;
<       case 'P' :
<               dataport = EARGF(usage()) ;
<               break ;
<       /* prepare data port */
<       dataportid=atol(dataport) ;
<       if (dataportid==0)
<               dataportid=20 ;
<       snprint(dataadr,64,"tcp!*!%d",dataportid) ;
<               fd = dial(data, dataadr, 0, 0);
>               fd = dial(data, "20", 0, 0);

Diff for man/8/ipserv
< .RB [ -P
< .IR dataport ]
< .TP
< .B P
< the port used for the data socket (default 20)
< .PP
< .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

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:

* 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 \
    --subject='Re: [9fans] ftpd bugfix and enhancement' \


* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

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).