Finally get most of wu-ftpd working.

Changes:

- Use internal functions rather than libc versions in a couple of places
  This allows writing to dirs without read perms and the
  ftpconversions file to work.
- Fix up skey support to use correct parameters
- using compress in the ftpconversions file doesn't seem to work,
  so alter example ftpconversions file to use gzip -d rather than compress -dc
- Install manpages compressed

Still broken :

- using /bin/compress to compress/uncompress files on the fly
This commit is contained in:
Gary Palmer 1995-01-25 22:41:57 +00:00
parent 1678c18cc7
commit 64b881e789
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=826
12 changed files with 1074 additions and 394 deletions

View File

@ -1,196 +1,19 @@
*** src/ftpd.c.orig Wed Apr 13 22:17:18 1994
--- src/ftpd.c Fri Jan 13 20:22:05 1995
*** src/realpath.c.orig Wed Jan 18 22:39:04 1995
--- src/realpath.c Wed Jan 18 22:38:48 1995
***************
*** 139,146 ****
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline(),
! *realpath(char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
--- 139,148 ----
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline();
! #ifndef HAVE_REALPATH
! extern char *realpath(char *pathname, char *result);
! #endif
extern char cbuf[];
extern off_t restart_point;
***************
*** 237,242 ****
--- 239,250 ----
#endif /* SETPROCTITLE */
+ #ifdef SKEY
+ int pwok = 0;
+ char *skey_challenge();
+ char *skey_crypt();
+ #endif
+
#ifdef KERBEROS
void init_krb();
void end_krb();
***************
*** 878,884 ****
--- 886,897 ----
} else
acl_setfunctions();
+ #ifdef SKEY
+ pwok = skeyaccess(name, NULL, remotehost);
+ reply(331, "%s", skey_challenge(name, pw, pwok));
+ #else
reply(331, "Password required for %s.", name);
+ #endif
askpasswd = 1;
/* Delay before reading passwd after first failed attempt to slow down
* passwd-guessing programs. */
***************
*** 1007,1014 ****
--- 1020,1032 ----
#ifdef KERBEROS
xpasswd = crypt16(passwd, salt);
#else
+ #ifdef SKEY
+ xpasswd = skey_crypt(passwd, salt, pw, pwok);
+ pwok = 0;
+ #else
xpasswd = crypt(passwd, salt);
*** 42,48 ****
#endif
+ #endif
#ifdef ULTRIX_AUTH
if ((numfails = ultrix_check_pass(passwd, xpasswd)) < 0) {
***************
*** 1095,1101 ****
(void) initgroups(pw->pw_name, pw->pw_gid);
char *
! realpath(char *pathname, char *result)
{
struct stat sbuf;
char curpath[MAXPATHLEN],
--- 42,48 ----
#endif
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%d", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
--- 1113,1119 ----
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%ld", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
***************
*** 1422,1428 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1440,1446 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1610,1616 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1628,1634 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1699,1705 ****
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%ld bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
--- 1717,1723 ----
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%qd bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
*** src/realpath.c.orig Fri Apr 1 20:03:45 1994
--- src/realpath.c Fri Jan 13 01:09:30 1995
***************
*** 29,36 ****
--- 29,39 ----
* POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
+ #ifndef HAVE_REALPATH
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
***************
*** 159,161 ****
--- 162,165 ----
strcpy(result, workpath);
return (result);
}
+ #endif
*** src/extensions.c.orig Fri Jan 13 20:26:26 1995
--- src/extensions.c Fri Jan 13 20:29:39 1995
***************
*** 103,109 ****
if (st->st_mtime > newer_time) {
if (show_fullinfo != 0) {
if (flag == FTW_F || flag == FTW_D) {
! fprintf(dout, "%s %d %d %s", flag == FTW_F ? "F" : "D",
st->st_size, st->st_mtime, path);
}
} else if (flag == FTW_F)
--- 103,109 ----
if (st->st_mtime > newer_time) {
if (show_fullinfo != 0) {
if (flag == FTW_F || flag == FTW_D) {
! fprintf(dout, "%s %qd %ld %s", flag == FTW_F ? "F" : "D",
st->st_size, st->st_mtime, path);
}
} else if (flag == FTW_F)
***************
*** 524,530 ****
if (fp == NULL)
return (0);
fgets(buf, sizeof(buf), fp);
! if (sscanf(buf, "%d %d %d %d %d %d %d", &tmbuf.tm_year, &tmbuf.tm_mon,
&tmbuf.tm_mday, &tmbuf.tm_hour, &tmbuf.tm_min, &deny, &disc) != 7) {
return (0);
}
--- 524,530 ----
if (fp == NULL)
return (0);
fgets(buf, sizeof(buf), fp);
! if (sscanf(buf, "%d %d %d %d %d %ld %ld", &tmbuf.tm_year, &tmbuf.tm_mon,
&tmbuf.tm_mday, &tmbuf.tm_hour, &tmbuf.tm_min, &deny, &disc) != 7) {
return (0);
}
char *
! realpath(const char *pathname, char *result)
{
struct stat sbuf;
char curpath[MAXPATHLEN],

View File

@ -1,5 +1,5 @@
*** Makefile.orig Fri Apr 1 21:03:58 1994
--- Makefile Tue Oct 18 18:45:08 1994
*** Makefile.orig Fri Apr 1 20:03:58 1994
--- Makefile Wed Jan 25 21:12:08 1995
***************
*** 1,25 ****
! BINDIR= /usr/local/bin
@ -27,7 +27,7 @@
! install -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! install -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! install -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
--- 1,26 ----
--- 1,35 ----
! BINDIR= ${PREFIX}/bin
! ETCDIR= ${PREFIX}/etc
! MANDIR= ${PREFIX}/man
@ -54,3 +54,12 @@
! install -c -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! install -c -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! install -c -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
! @echo Compressing manpages
! gzip -9 ${MANDIR}/man8/ftpd.8
! gzip -9 ${MANDIR}/man1/ftpcount.1
! gzip -9 ${MANDIR}/man1/ftpwho.1
! gzip -9 ${MANDIR}/man8/ftpshut.8
! gzip -9 ${MANDIR}/man5/ftpaccess.5
! gzip -9 ${MANDIR}/man5/ftphosts.5
! gzip -9 ${MANDIR}/man5/ftpconversions.5
! gzip -9 ${MANDIR}/man5/xferlog.5

View File

@ -22,7 +22,7 @@
! #define _PATH_FTPUSERS "!!PREFIX!!/etc/ftpusers"
! #define _PATH_FTPACCESS "!!PREFIX!!/etc/ftpaccess"
#define _PATH_EXECPATH "/bin/ftp-exec"
! #define _PATH_PIDNAMES "/var/run/ftp.pids-%s"
! #define _PATH_PIDNAMES "!!PREFIX!!/daemon/ftpd/ftp.pids-%s"
! #define _PATH_CVT "!!PREFIX!!/etc/ftpconversions"
! #define _PATH_XFERLOG "/var/log/xferlog"
! #define _PATH_PRIVATE "!!PREFIX!!/etc/ftpgroups"

View File

@ -0,0 +1,489 @@
*** src/ftpd.c.orig Wed Apr 13 22:17:18 1994
--- src/ftpd.c Wed Jan 25 21:51:50 1995
***************
*** 139,146 ****
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline(),
! *realpath(char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
--- 139,146 ----
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline();
! extern char *realpath(const char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
***************
*** 237,242 ****
--- 237,247 ----
#endif /* SETPROCTITLE */
+ #ifdef SKEY
+ #include <skey.h>
+ int pwok = 0;
+ #endif
+
#ifdef KERBEROS
void init_krb();
void end_krb();
***************
*** 252,257 ****
--- 257,269 ----
char ls_short[50];
struct aclmember *entry = NULL;
+ void end_login(void);
+ void send_data(FILE *, FILE *, off_t);
+ void dolog(struct sockaddr_in *);
+ void dologout(int);
+ void perror_reply(int, char *);
+
+ void
main(int argc, char **argv, char **envp)
{
int addrlen,
***************
*** 686,691 ****
--- 698,705 ----
* does not have a standard shell as returned by getusershell(). Disallow
* anyone mentioned in the file _PATH_FTPUSERS to allow people such as root
* and uucp to be avoided. */
+
+ void
user(char *name)
{
register char *cp;
***************
*** 878,884 ****
--- 892,903 ----
} else
acl_setfunctions();
+ #ifdef SKEY
+ pwok = skeyaccess(name, NULL, remotehost, remoteaddr);
+ reply(331, "%s", skey_challenge(name, pw, pwok));
+ #else
reply(331, "Password required for %s.", name);
+ #endif
askpasswd = 1;
/* Delay before reading passwd after first failed attempt to slow down
* passwd-guessing programs. */
***************
*** 887,892 ****
--- 906,912 ----
}
/* Check if a user is in the file _PATH_FTPUSERS */
+ int
checkuser(char *name)
{
register FILE *fd;
***************
*** 911,916 ****
--- 931,937 ----
/* Terminate login as previous user, if any, resetting state; used when USER
* command is given or login fails. */
+ void
end_login(void)
{
***************
*** 965,970 ****
--- 986,992 ----
return 0;
}
+ void
pass(char *passwd)
{
char *xpasswd,
***************
*** 1007,1014 ****
--- 1029,1041 ----
#ifdef KERBEROS
xpasswd = crypt16(passwd, salt);
#else
+ #ifdef SKEY
+ xpasswd = skey_crypt(passwd, salt, pw, pwok);
+ pwok = 0;
+ #else
xpasswd = crypt(passwd, salt);
#endif
+ #endif
#ifdef ULTRIX_AUTH
if ((numfails = ultrix_check_pass(passwd, xpasswd)) < 0) {
***************
*** 1095,1101 ****
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%d", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
--- 1122,1132 ----
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! #if (defined(BSD) && (BSD >= 199103))
! (void) sprintf(ttyline, "ftp%ld", getpid());
! #else
! (void) sprintf(ttyline, "ftpd%d", getpid());
! #endif
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
***************
*** 1190,1197 ****
reply(230, "Guest login ok, access restrictions apply.");
#ifdef SETPROCTITLE
sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
! sizeof(proctitle) - sizeof(remotehost) -
! sizeof(": anonymous/"), passwd);
setproctitle("%s", proctitle);
#endif /* SETPROCTITLE */
if (logging)
--- 1221,1228 ----
reply(230, "Guest login ok, access restrictions apply.");
#ifdef SETPROCTITLE
sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
! (int) (sizeof(proctitle) - sizeof(remotehost) -
! sizeof(": anonymous/")), passwd);
setproctitle("%s", proctitle);
#endif /* SETPROCTITLE */
if (logging)
***************
*** 1235,1240 ****
--- 1266,1272 ----
return (buf);
}
+ void
retrieve(char *cmd, char *name)
{
FILE *fin,
***************
*** 1422,1428 ****
--- 1454,1464 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
+ #if (defined(BSD) && (BSD >= 199103))
+ sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
+ #else
sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
+ #endif
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1445,1450 ****
--- 1481,1487 ----
(*closefunc) (fin);
}
+ void
store(char *name, char *mode, int unique)
{
FILE *fout, *din;
***************
*** 1610,1616 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1647,1657 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! #if (defined(BSD) && (BSD >= 199103))
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
! #else
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
! #endif
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1699,1705 ****
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%ld bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
--- 1740,1750 ----
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! #if (defined(BSD) && (BSD >= 199103))
! (void) sprintf(sizebuf, " (%qd bytes)", size);
! #else
! (void) sprintf(sizebuf, " (%d bytes)", size);
! #endif
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
***************
*** 1707,1715 ****
int s,
fromlen = sizeof(from);
! s = accept(pdata, (struct sockaddr *) &from, &fromlen);
! if (s < 0) {
! reply(425, "Can't open data connection.");
(void) close(pdata);
pdata = -1;
return (NULL);
--- 1752,1774 ----
int s,
fromlen = sizeof(from);
! #ifdef FD_ZERO
! struct timeval timeout;
! fd_set set;
!
! FD_ZERO(&set);
! FD_SET(pdata, &set);
!
! timeout.tv_usec = 0;
! timeout.tv_sec = 120;
!
! if (select(pdata+1, &set, (fd_set *) 0, (fd_set *) 0, &timeout) == 0 ||
! (s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0) {
! #else
! s = accept(pdata, (struct sockaddr *) &from, &fromlen);
! if (s < 0) {
! #endif
! reply(425, "Can't open data connection.");
(void) close(pdata);
pdata = -1;
return (NULL);
***************
*** 1764,1769 ****
--- 1823,1829 ----
* encapsulation of the data subject to Mode, Structure, and Type.
*
* NB: Form isn't handled. */
+ void
send_data(FILE *instr, FILE *outstr, off_t blksize)
{
register int c,
***************
*** 1839,1844 ****
--- 1899,1905 ----
* the data subject to Mode, Structure, and Type.
*
* N.B.: Form isn't handled. */
+ int
receive_data(FILE *instr, FILE *outstr)
{
register int c;
***************
*** 1915,1920 ****
--- 1976,1982 ----
return (-1);
}
+ void
statfilecmd(char *filename)
{
char line[BUFSIZ];
***************
*** 1948,1953 ****
--- 2010,2016 ----
reply(211, "End of Status");
}
+ void
statcmd(void)
{
struct sockaddr_in *sin;
***************
*** 2001,2006 ****
--- 2064,2070 ----
reply(211, "End of status");
}
+ void
fatal(char *s)
{
reply(451, "Error in server: %s\n", s);
***************
*** 2095,2100 ****
--- 2159,2165 ----
#else
/* VARARGS2 */
+ void
reply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
{
if (autospout != NULL) {
***************
*** 2129,2134 ****
--- 2194,2200 ----
}
/* VARARGS2 */
+ void
lreply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
{
if (!dolreplies)
***************
*** 2144,2160 ****
--- 2210,2229 ----
}
#endif
+ void
ack(char *s)
{
reply(250, "%s command successful.", s);
}
+ void
nack(char *s)
{
reply(502, "%s command not implemented.", s);
}
/* ARGSUSED */
+ void
yyerror(char *s)
{
char *cp;
***************
*** 2164,2169 ****
--- 2233,2239 ----
reply(500, "'%s': command not understood.", cbuf);
}
+ void
delete(char *name)
{
struct stat st;
***************
*** 2208,2213 ****
--- 2278,2284 ----
ack("DELE");
}
+ void
cwd(char *path)
{
struct aclmember *entry = NULL;
***************
*** 2248,2253 ****
--- 2319,2325 ----
}
}
+ void
makedir(char *name)
{
uid_t uid;
***************
*** 2274,2282 ****
reply(257, "MKD command successful.");
}
removedir(char *name)
{
! int c, d; /* dummy variables */
int valid = 0;
/*
--- 2346,2355 ----
reply(257, "MKD command successful.");
}
+ void
removedir(char *name)
{
! unsigned long c, d; /* dummy variables */
int valid = 0;
/*
***************
*** 2298,2303 ****
--- 2371,2377 ----
ack("RMD");
}
+ void
pwd(void)
{
char path[MAXPATHLEN + 1];
***************
*** 2342,2347 ****
--- 2416,2422 ----
return (name);
}
+ void
renamecmd(char *from, char *to)
{
***************
*** 2357,2362 ****
--- 2432,2438 ----
ack("RNTO");
}
+ void
dolog(struct sockaddr_in *sin)
{
struct hostent *hp;
***************
*** 2412,2417 ****
--- 2488,2494 ----
}
/* Record logout in wtmp file and exit with supplied status. */
+ void
dologout(int status)
{
if (logged_in) {
***************
*** 2459,2464 ****
--- 2536,2542 ----
* PASV command in RFC959. However, it has been blessed as a legitimate
* response by Jon Postel in a telephone conversation with Rick Adams on 25
* Jan 89. */
+ void
passive(void)
{
int len;
***************
*** 2530,2535 ****
--- 2608,2614 ----
}
/* Format and send reply containing system error number. */
+ void
perror_reply(int code, char *string)
{
reply(code, "%s: %s.", string, strerror(errno));
***************
*** 2538,2543 ****
--- 2617,2623 ----
static char *onefile[] =
{"", 0};
+ void
send_file_list(char *whichfiles)
{
struct stat st;

View File

@ -0,0 +1,19 @@
*** doc/examples/ftpconversions.orig Wed Jan 25 22:11:02 1995
--- doc/examples/ftpconversions Wed Jan 25 22:11:49 1995
***************
*** 1,7 ****
! :.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
: : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
:.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
: : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
: : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
: : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
! : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP
--- 1,7 ----
! :.Z: : :/bin/gzip -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
: : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
:.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
: : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
: : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
: : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
! : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id$
# configure,v 1.1.1.1 1994/10/23 01:36:59 torstenb Exp
#
mv ${WRKSRC}/src/pathnames.h ${WRKSRC}/src/pathnames.h.bak

View File

@ -1,196 +1,19 @@
*** src/ftpd.c.orig Wed Apr 13 22:17:18 1994
--- src/ftpd.c Fri Jan 13 20:22:05 1995
*** src/realpath.c.orig Wed Jan 18 22:39:04 1995
--- src/realpath.c Wed Jan 18 22:38:48 1995
***************
*** 139,146 ****
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline(),
! *realpath(char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
--- 139,148 ----
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline();
! #ifndef HAVE_REALPATH
! extern char *realpath(char *pathname, char *result);
! #endif
extern char cbuf[];
extern off_t restart_point;
***************
*** 237,242 ****
--- 239,250 ----
#endif /* SETPROCTITLE */
+ #ifdef SKEY
+ int pwok = 0;
+ char *skey_challenge();
+ char *skey_crypt();
+ #endif
+
#ifdef KERBEROS
void init_krb();
void end_krb();
***************
*** 878,884 ****
--- 886,897 ----
} else
acl_setfunctions();
+ #ifdef SKEY
+ pwok = skeyaccess(name, NULL, remotehost);
+ reply(331, "%s", skey_challenge(name, pw, pwok));
+ #else
reply(331, "Password required for %s.", name);
+ #endif
askpasswd = 1;
/* Delay before reading passwd after first failed attempt to slow down
* passwd-guessing programs. */
***************
*** 1007,1014 ****
--- 1020,1032 ----
#ifdef KERBEROS
xpasswd = crypt16(passwd, salt);
#else
+ #ifdef SKEY
+ xpasswd = skey_crypt(passwd, salt, pw, pwok);
+ pwok = 0;
+ #else
xpasswd = crypt(passwd, salt);
*** 42,48 ****
#endif
+ #endif
#ifdef ULTRIX_AUTH
if ((numfails = ultrix_check_pass(passwd, xpasswd)) < 0) {
***************
*** 1095,1101 ****
(void) initgroups(pw->pw_name, pw->pw_gid);
char *
! realpath(char *pathname, char *result)
{
struct stat sbuf;
char curpath[MAXPATHLEN],
--- 42,48 ----
#endif
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%d", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
--- 1113,1119 ----
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%ld", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
***************
*** 1422,1428 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1440,1446 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1610,1616 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1628,1634 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1699,1705 ****
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%ld bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
--- 1717,1723 ----
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%qd bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
*** src/realpath.c.orig Fri Apr 1 20:03:45 1994
--- src/realpath.c Fri Jan 13 01:09:30 1995
***************
*** 29,36 ****
--- 29,39 ----
* POSSIBILITY OF SUCH DAMAGE.
*/
+
#include "config.h"
+ #ifndef HAVE_REALPATH
+
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
***************
*** 159,161 ****
--- 162,165 ----
strcpy(result, workpath);
return (result);
}
+ #endif
*** src/extensions.c.orig Fri Jan 13 20:26:26 1995
--- src/extensions.c Fri Jan 13 20:29:39 1995
***************
*** 103,109 ****
if (st->st_mtime > newer_time) {
if (show_fullinfo != 0) {
if (flag == FTW_F || flag == FTW_D) {
! fprintf(dout, "%s %d %d %s", flag == FTW_F ? "F" : "D",
st->st_size, st->st_mtime, path);
}
} else if (flag == FTW_F)
--- 103,109 ----
if (st->st_mtime > newer_time) {
if (show_fullinfo != 0) {
if (flag == FTW_F || flag == FTW_D) {
! fprintf(dout, "%s %qd %ld %s", flag == FTW_F ? "F" : "D",
st->st_size, st->st_mtime, path);
}
} else if (flag == FTW_F)
***************
*** 524,530 ****
if (fp == NULL)
return (0);
fgets(buf, sizeof(buf), fp);
! if (sscanf(buf, "%d %d %d %d %d %d %d", &tmbuf.tm_year, &tmbuf.tm_mon,
&tmbuf.tm_mday, &tmbuf.tm_hour, &tmbuf.tm_min, &deny, &disc) != 7) {
return (0);
}
--- 524,530 ----
if (fp == NULL)
return (0);
fgets(buf, sizeof(buf), fp);
! if (sscanf(buf, "%d %d %d %d %d %ld %ld", &tmbuf.tm_year, &tmbuf.tm_mon,
&tmbuf.tm_mday, &tmbuf.tm_hour, &tmbuf.tm_min, &deny, &disc) != 7) {
return (0);
}
char *
! realpath(const char *pathname, char *result)
{
struct stat sbuf;
char curpath[MAXPATHLEN],

View File

@ -1,5 +1,5 @@
*** Makefile.orig Fri Apr 1 21:03:58 1994
--- Makefile Tue Oct 18 18:45:08 1994
*** Makefile.orig Fri Apr 1 20:03:58 1994
--- Makefile Wed Jan 25 21:12:08 1995
***************
*** 1,25 ****
! BINDIR= /usr/local/bin
@ -27,7 +27,7 @@
! install -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! install -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! install -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
--- 1,26 ----
--- 1,35 ----
! BINDIR= ${PREFIX}/bin
! ETCDIR= ${PREFIX}/etc
! MANDIR= ${PREFIX}/man
@ -54,3 +54,12 @@
! install -c -o bin -g bin -m 755 doc/ftphosts.5 ${MANDIR}/man5/ftphosts.5
! install -c -o bin -g bin -m 755 doc/ftpconversions.5 ${MANDIR}/man5/ftpconversions.5
! install -c -o bin -g bin -m 755 doc/xferlog.5 ${MANDIR}/man5/xferlog.5
! @echo Compressing manpages
! gzip -9 ${MANDIR}/man8/ftpd.8
! gzip -9 ${MANDIR}/man1/ftpcount.1
! gzip -9 ${MANDIR}/man1/ftpwho.1
! gzip -9 ${MANDIR}/man8/ftpshut.8
! gzip -9 ${MANDIR}/man5/ftpaccess.5
! gzip -9 ${MANDIR}/man5/ftphosts.5
! gzip -9 ${MANDIR}/man5/ftpconversions.5
! gzip -9 ${MANDIR}/man5/xferlog.5

View File

@ -22,7 +22,7 @@
! #define _PATH_FTPUSERS "!!PREFIX!!/etc/ftpusers"
! #define _PATH_FTPACCESS "!!PREFIX!!/etc/ftpaccess"
#define _PATH_EXECPATH "/bin/ftp-exec"
! #define _PATH_PIDNAMES "/var/run/ftp.pids-%s"
! #define _PATH_PIDNAMES "!!PREFIX!!/daemon/ftpd/ftp.pids-%s"
! #define _PATH_CVT "!!PREFIX!!/etc/ftpconversions"
! #define _PATH_XFERLOG "/var/log/xferlog"
! #define _PATH_PRIVATE "!!PREFIX!!/etc/ftpgroups"

489
ftp/wu-ftpd/files/patch-ad Normal file
View File

@ -0,0 +1,489 @@
*** src/ftpd.c.orig Wed Apr 13 22:17:18 1994
--- src/ftpd.c Wed Jan 25 21:51:50 1995
***************
*** 139,146 ****
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline(),
! *realpath(char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
--- 139,146 ----
*freopen(const char *, const char *, FILE *);
extern int ftpd_pclose(FILE *iop),
fclose(FILE *);
! extern char *getline();
! extern char *realpath(const char *pathname, char *result);
extern char cbuf[];
extern off_t restart_point;
***************
*** 237,242 ****
--- 237,247 ----
#endif /* SETPROCTITLE */
+ #ifdef SKEY
+ #include <skey.h>
+ int pwok = 0;
+ #endif
+
#ifdef KERBEROS
void init_krb();
void end_krb();
***************
*** 252,257 ****
--- 257,269 ----
char ls_short[50];
struct aclmember *entry = NULL;
+ void end_login(void);
+ void send_data(FILE *, FILE *, off_t);
+ void dolog(struct sockaddr_in *);
+ void dologout(int);
+ void perror_reply(int, char *);
+
+ void
main(int argc, char **argv, char **envp)
{
int addrlen,
***************
*** 686,691 ****
--- 698,705 ----
* does not have a standard shell as returned by getusershell(). Disallow
* anyone mentioned in the file _PATH_FTPUSERS to allow people such as root
* and uucp to be avoided. */
+
+ void
user(char *name)
{
register char *cp;
***************
*** 878,884 ****
--- 892,903 ----
} else
acl_setfunctions();
+ #ifdef SKEY
+ pwok = skeyaccess(name, NULL, remotehost, remoteaddr);
+ reply(331, "%s", skey_challenge(name, pw, pwok));
+ #else
reply(331, "Password required for %s.", name);
+ #endif
askpasswd = 1;
/* Delay before reading passwd after first failed attempt to slow down
* passwd-guessing programs. */
***************
*** 887,892 ****
--- 906,912 ----
}
/* Check if a user is in the file _PATH_FTPUSERS */
+ int
checkuser(char *name)
{
register FILE *fd;
***************
*** 911,916 ****
--- 931,937 ----
/* Terminate login as previous user, if any, resetting state; used when USER
* command is given or login fails. */
+ void
end_login(void)
{
***************
*** 965,970 ****
--- 986,992 ----
return 0;
}
+ void
pass(char *passwd)
{
char *xpasswd,
***************
*** 1007,1014 ****
--- 1029,1041 ----
#ifdef KERBEROS
xpasswd = crypt16(passwd, salt);
#else
+ #ifdef SKEY
+ xpasswd = skey_crypt(passwd, salt, pw, pwok);
+ pwok = 0;
+ #else
xpasswd = crypt(passwd, salt);
#endif
+ #endif
#ifdef ULTRIX_AUTH
if ((numfails = ultrix_check_pass(passwd, xpasswd)) < 0) {
***************
*** 1095,1101 ****
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! (void) sprintf(ttyline, "ftp%d", getpid());
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
--- 1122,1132 ----
(void) initgroups(pw->pw_name, pw->pw_gid);
/* open wtmp before chroot */
! #if (defined(BSD) && (BSD >= 199103))
! (void) sprintf(ttyline, "ftp%ld", getpid());
! #else
! (void) sprintf(ttyline, "ftpd%d", getpid());
! #endif
logwtmp(ttyline, pw->pw_name, remotehost);
logged_in = 1;
***************
*** 1190,1197 ****
reply(230, "Guest login ok, access restrictions apply.");
#ifdef SETPROCTITLE
sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
! sizeof(proctitle) - sizeof(remotehost) -
! sizeof(": anonymous/"), passwd);
setproctitle("%s", proctitle);
#endif /* SETPROCTITLE */
if (logging)
--- 1221,1228 ----
reply(230, "Guest login ok, access restrictions apply.");
#ifdef SETPROCTITLE
sprintf(proctitle, "%s: anonymous/%.*s", remotehost,
! (int) (sizeof(proctitle) - sizeof(remotehost) -
! sizeof(": anonymous/")), passwd);
setproctitle("%s", proctitle);
#endif /* SETPROCTITLE */
if (logging)
***************
*** 1235,1240 ****
--- 1266,1272 ----
return (buf);
}
+ void
retrieve(char *cmd, char *name)
{
FILE *fin,
***************
*** 1422,1428 ****
--- 1454,1464 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
+ #if (defined(BSD) && (BSD >= 199103))
+ sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
+ #else
sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
+ #endif
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1445,1450 ****
--- 1481,1487 ----
(*closefunc) (fin);
}
+ void
store(char *name, char *mode, int unique)
{
FILE *fout, *din;
***************
*** 1610,1616 ****
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
ctime(&curtime),
xfertime,
remotehost,
--- 1647,1657 ----
for (loop = 0; namebuf[loop]; loop++)
if (isspace(namebuf[loop]) || iscntrl(namebuf[loop]))
namebuf[loop] = '_';
! #if (defined(BSD) && (BSD >= 199103))
! sprintf(msg, "%.24s %d %s %qd %s %c %s %c %c %s ftp %d %s\n",
! #else
! sprintf(msg, "%.24s %d %s %d %s %c %s %c %c %s ftp %d %s\n",
! #endif
ctime(&curtime),
xfertime,
remotehost,
***************
*** 1699,1705 ****
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! (void) sprintf(sizebuf, " (%ld bytes)", size);
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
--- 1740,1750 ----
file_size = size;
byte_count = 0;
if (size != (off_t) - 1)
! #if (defined(BSD) && (BSD >= 199103))
! (void) sprintf(sizebuf, " (%qd bytes)", size);
! #else
! (void) sprintf(sizebuf, " (%d bytes)", size);
! #endif
else
(void) strcpy(sizebuf, "");
if (pdata >= 0) {
***************
*** 1707,1715 ****
int s,
fromlen = sizeof(from);
! s = accept(pdata, (struct sockaddr *) &from, &fromlen);
! if (s < 0) {
! reply(425, "Can't open data connection.");
(void) close(pdata);
pdata = -1;
return (NULL);
--- 1752,1774 ----
int s,
fromlen = sizeof(from);
! #ifdef FD_ZERO
! struct timeval timeout;
! fd_set set;
!
! FD_ZERO(&set);
! FD_SET(pdata, &set);
!
! timeout.tv_usec = 0;
! timeout.tv_sec = 120;
!
! if (select(pdata+1, &set, (fd_set *) 0, (fd_set *) 0, &timeout) == 0 ||
! (s = accept(pdata, (struct sockaddr *) &from, &fromlen)) < 0) {
! #else
! s = accept(pdata, (struct sockaddr *) &from, &fromlen);
! if (s < 0) {
! #endif
! reply(425, "Can't open data connection.");
(void) close(pdata);
pdata = -1;
return (NULL);
***************
*** 1764,1769 ****
--- 1823,1829 ----
* encapsulation of the data subject to Mode, Structure, and Type.
*
* NB: Form isn't handled. */
+ void
send_data(FILE *instr, FILE *outstr, off_t blksize)
{
register int c,
***************
*** 1839,1844 ****
--- 1899,1905 ----
* the data subject to Mode, Structure, and Type.
*
* N.B.: Form isn't handled. */
+ int
receive_data(FILE *instr, FILE *outstr)
{
register int c;
***************
*** 1915,1920 ****
--- 1976,1982 ----
return (-1);
}
+ void
statfilecmd(char *filename)
{
char line[BUFSIZ];
***************
*** 1948,1953 ****
--- 2010,2016 ----
reply(211, "End of Status");
}
+ void
statcmd(void)
{
struct sockaddr_in *sin;
***************
*** 2001,2006 ****
--- 2064,2070 ----
reply(211, "End of status");
}
+ void
fatal(char *s)
{
reply(451, "Error in server: %s\n", s);
***************
*** 2095,2100 ****
--- 2159,2165 ----
#else
/* VARARGS2 */
+ void
reply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
{
if (autospout != NULL) {
***************
*** 2129,2134 ****
--- 2194,2200 ----
}
/* VARARGS2 */
+ void
lreply(int n, char *fmt, int p0, int p1, int p2, int p3, int p4, int p5)
{
if (!dolreplies)
***************
*** 2144,2160 ****
--- 2210,2229 ----
}
#endif
+ void
ack(char *s)
{
reply(250, "%s command successful.", s);
}
+ void
nack(char *s)
{
reply(502, "%s command not implemented.", s);
}
/* ARGSUSED */
+ void
yyerror(char *s)
{
char *cp;
***************
*** 2164,2169 ****
--- 2233,2239 ----
reply(500, "'%s': command not understood.", cbuf);
}
+ void
delete(char *name)
{
struct stat st;
***************
*** 2208,2213 ****
--- 2278,2284 ----
ack("DELE");
}
+ void
cwd(char *path)
{
struct aclmember *entry = NULL;
***************
*** 2248,2253 ****
--- 2319,2325 ----
}
}
+ void
makedir(char *name)
{
uid_t uid;
***************
*** 2274,2282 ****
reply(257, "MKD command successful.");
}
removedir(char *name)
{
! int c, d; /* dummy variables */
int valid = 0;
/*
--- 2346,2355 ----
reply(257, "MKD command successful.");
}
+ void
removedir(char *name)
{
! unsigned long c, d; /* dummy variables */
int valid = 0;
/*
***************
*** 2298,2303 ****
--- 2371,2377 ----
ack("RMD");
}
+ void
pwd(void)
{
char path[MAXPATHLEN + 1];
***************
*** 2342,2347 ****
--- 2416,2422 ----
return (name);
}
+ void
renamecmd(char *from, char *to)
{
***************
*** 2357,2362 ****
--- 2432,2438 ----
ack("RNTO");
}
+ void
dolog(struct sockaddr_in *sin)
{
struct hostent *hp;
***************
*** 2412,2417 ****
--- 2488,2494 ----
}
/* Record logout in wtmp file and exit with supplied status. */
+ void
dologout(int status)
{
if (logged_in) {
***************
*** 2459,2464 ****
--- 2536,2542 ----
* PASV command in RFC959. However, it has been blessed as a legitimate
* response by Jon Postel in a telephone conversation with Rick Adams on 25
* Jan 89. */
+ void
passive(void)
{
int len;
***************
*** 2530,2535 ****
--- 2608,2614 ----
}
/* Format and send reply containing system error number. */
+ void
perror_reply(int code, char *string)
{
reply(code, "%s: %s.", string, strerror(errno));
***************
*** 2538,2543 ****
--- 2617,2623 ----
static char *onefile[] =
{"", 0};
+ void
send_file_list(char *whichfiles)
{
struct stat st;

View File

@ -0,0 +1,19 @@
*** doc/examples/ftpconversions.orig Wed Jan 25 22:11:02 1995
--- doc/examples/ftpconversions Wed Jan 25 22:11:49 1995
***************
*** 1,7 ****
! :.Z: : :/bin/compress -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
: : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
:.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
: : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
: : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
: : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
! : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP
--- 1,7 ----
! :.Z: : :/bin/gzip -d -c %s:T_REG|T_ASCII:O_UNCOMPRESS:UNCOMPRESS
: : :.Z:/bin/compress -c %s:T_REG:O_COMPRESS:COMPRESS
:.gz: : :/bin/gzip -cd %s:T_REG|T_ASCII:O_UNCOMPRESS:GUNZIP
: : :.gz:/bin/gzip -9 -c %s:T_REG:O_COMPRESS:GZIP
: : :.tar:/bin/tar -c -f - %s:T_REG|T_DIR:O_TAR:TAR
: : :.tar.Z:/bin/tar -c -Z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+COMPRESS
! : : :.tar.gz:/bin/tar -c -z -f - %s:T_REG|T_DIR:O_COMPRESS|O_TAR:TAR+GZIP

View File

@ -1,6 +1,6 @@
#!/bin/sh
#
# $Id$
# configure,v 1.1.1.1 1994/10/23 01:36:59 torstenb Exp
#
mv ${WRKSRC}/src/pathnames.h ${WRKSRC}/src/pathnames.h.bak