ping

On Mon, 18 Nov 2019 14:56:46 +0900,
SASANO Takayoshi wrote:
> 
> Hello,
> 
> At least OpenBSD-6.5 and 6.6's ftpd does not work NLIST command with any
> -option like this.
> 
> ----
> ftp> nlist
> 150 Opening ASCII mode data connection for 'file list'.
> uaa
> _sysupgrade
> 226 Transfer complete.
> ftp> nlist -LF
> 550 -LF: No such file or directory.
> ftp>
> ----
> 
> Here is the remedy, ok?
> 
> Index: extern.h
> ===================================================================
> RCS file: /cvs/src/libexec/ftpd/extern.h,v
> retrieving revision 1.20
> diff -u -p -r1.20 extern.h
> --- extern.h  8 May 2019 23:56:48 -0000       1.20
> +++ extern.h  18 Nov 2019 05:48:53 -0000
> @@ -89,7 +89,7 @@ void        renamecmd(char *, char *);
>  char   *renamefrom(char *);
>  void reply(int, const char *, ...);
>  void reply_r(int, const char *, ...);
> -enum ret_cmd { RET_FILE, RET_LIST };
> +enum ret_cmd { RET_FILE, RET_LIST, RET_NLIST };
>  void retrieve(enum ret_cmd, char *);
>  void send_file_list(char *);
>  void setproctitle(const char *, ...);
> Index: ftpd.c
> ===================================================================
> RCS file: /cvs/src/libexec/ftpd/ftpd.c,v
> retrieving revision 1.228
> diff -u -p -r1.228 ftpd.c
> --- ftpd.c    3 Jul 2019 03:24:04 -0000       1.228
> +++ ftpd.c    18 Nov 2019 05:48:53 -0000
> @@ -1124,7 +1124,10 @@ retrieve(enum ret_cmd cmd, char *name)
>               fin = fopen(name, "r");
>               st.st_size = 0;
>       } else {
> -             fin = ftpd_ls("-lgA", name, &pid);
> +             if (cmd == RET_NLIST)
> +                     fin = ftpd_ls(name, ".", &pid);
> +             else
> +                     fin = ftpd_ls("-lgA", name, &pid);
>               st.st_size = -1;
>               st.st_blksize = BUFSIZ;
>       }
> @@ -1166,7 +1169,8 @@ retrieve(enum ret_cmd cmd, char *name)
>                       goto done;
>               }
>       }
> -     dout = dataconn(name, st.st_size, "w");
> +     dout = dataconn((cmd == RET_NLIST) ? "file list" : name,
> +                     st.st_size, "w");
>       if (dout == NULL)
>               goto done;
>       time(&start);
> @@ -2626,7 +2630,7 @@ send_file_list(char *whichf)
>                        */
>                       if (dirname[0] == '-' && *dirlist == NULL &&
>                           transflag == 0) {
> -                             retrieve(RET_FILE, dirname);
> +                             retrieve(RET_NLIST, dirname);
>                               goto out;
>                       }
>                       perror_reply(550, whichf);
> 
> -- 
> SASANO Takayoshi (JG1UAA) <u...@cvs.openbsd.org>
> 

Reply via email to