diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-23 08:13:39 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1998-07-23 08:13:39 +0000 |
commit | 2bba642ea588faa134ac8f7c78b3313bf6fe8072 (patch) | |
tree | 0696225d9bc8cb2373cbf368998b99f631918296 /libexec | |
parent | e941a53ee3112718030c21fdc633ea4417cc0119 (diff) |
add replydirname() from netbsd; fixes 257 directory replies; problem noted by kstailey
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/ftpd.c | 23 |
1 files changed, 20 insertions, 3 deletions
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index c13fb1b799d..816fba20299 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.48 1998/07/13 02:11:15 millert Exp $ */ +/* $OpenBSD: ftpd.c,v 1.49 1998/07/23 08:13:38 deraadt Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -218,6 +218,7 @@ static int guniquefd __P((char *, char **)); static void lostconn __P((int)); static void sigquit __P((int)); static int receive_data __P((FILE *, FILE *)); +static void replydirname __P((const char *, const char *)); static void send_data __P((FILE *, FILE *, off_t, off_t, int)); static struct passwd * sgetpwnam __P((char *)); @@ -1676,6 +1677,22 @@ cwd(path) } void +replydirname(name, message) + const char *name, *message; +{ + char npath[MAXPATHLEN]; + int i; + + for (i = 0; *name != '\0' && i < sizeof(npath) - 1; i++, name++) { + npath[i] = *name; + if (*name == '"') + npath[++i] = '"'; + } + npath[i] = '\0'; + reply(257, "\"%s\" %s", npath, message); +} + +void makedir(name) char *name; { @@ -1684,7 +1701,7 @@ makedir(name) if (mkdir(name, 0777) < 0) perror_reply(550, name); else - reply(257, "MKD command successful."); + replydirname(name, "directory created."); } void @@ -1707,7 +1724,7 @@ pwd() if (getwd(path) == (char *)NULL) reply(550, "%s.", path); else - reply(257, "\"%s\" is current directory.", path); + replydirname(path, "is current directory."); } char * |