This commit was generated by cvs2svn to compensate for changes in r161764,
which included commits to RCS files with non-trunk default branches.
This commit is contained in:
commit
0b2314893a
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=161765
@ -1,11 +1,11 @@
|
||||
# $NetBSD: Makefile,v 1.51 2003-07-23 08:01:27 itojun Exp $
|
||||
# $NetBSD: Makefile,v 1.56 2006/03/23 20:14:16 wiz Exp $
|
||||
# @(#)Makefile 8.2 (Berkeley) 4/4/94
|
||||
|
||||
.include <bsd.own.mk>
|
||||
|
||||
PROG= ftpd
|
||||
SRCS= cmds.c conf.c ftpd.c ftpcmd.y logutmp.c logwtmp.c popen.c
|
||||
CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX
|
||||
CPPFLAGS+=-I${.CURDIR} -DSUPPORT_UTMP -DSUPPORT_UTMPX -DLOGIN_CAP
|
||||
DPADD+= ${LIBCRYPT} ${LIBUTIL}
|
||||
LDADD+= -lcrypt -lutil
|
||||
MAN= ftpd.conf.5 ftpusers.5 ftpd.8
|
||||
@ -15,8 +15,9 @@ MLINKS= ftpusers.5 ftpchroot.5
|
||||
SRCS+= ls.c cmp.c print.c stat_flags.c util.c
|
||||
.PATH: ${NETBSDSRCDIR}/bin/ls
|
||||
|
||||
.if (${USE_INET6} != "no")
|
||||
CPPFLAGS+=-DINET6
|
||||
.include <bsd.own.mk>
|
||||
.endif
|
||||
|
||||
WARNS=2
|
||||
|
||||
@ -25,6 +26,11 @@ CPPFLAGS+=-DSKEY
|
||||
DPADD+= ${LIBSKEY}
|
||||
LDADD+= -lskey
|
||||
.endif
|
||||
.if (${USE_PAM} != "no")
|
||||
CPPFLAGS+=-DUSE_PAM
|
||||
DPADD+= ${LIBPAM} ${PAM_STATIC_DPADD}
|
||||
LDADD+= -lpam ${PAM_STATIC_LDADD}
|
||||
.endif
|
||||
|
||||
ftpd.o ftpcmd.o: version.h
|
||||
|
||||
@ -38,13 +44,8 @@ ftpd.o ftpcmd.o: version.h
|
||||
#DPADD+= ${LIBKRB5} ${LIBASN1}
|
||||
#LDADD+= -lkrb5 -lasn1
|
||||
#
|
||||
#SRCS+= klogin.c
|
||||
#CPPFLAGS+=-DKERBEROS -I${DESTDIR}/usr/include/kerberosIV
|
||||
#DPADD+= ${LIBKRB}
|
||||
#LDADD+= -lkrb
|
||||
#
|
||||
#DPADD+= ${LIBCRYPTO} ${LIBROKEN} ${LIBCOM_ERR}
|
||||
#LDADD+= -lcrypto -lroken -lcom_err
|
||||
#DPADD+= ${LIBCRYPTO} ${{LIBCRYPT} ${LIBROKEN} ${LIBCOM_ERR}
|
||||
#LDADD+= -lcrypto -lcrypt -lroken -lcom_err
|
||||
#
|
||||
#.endif
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: cmds.c,v 1.23 2004-08-09 12:56:47 lukem Exp $ */
|
||||
/* $NetBSD: cmds.c,v 1.24 2006/02/01 14:20:12 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
@ -97,7 +97,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: cmds.c,v 1.23 2004-08-09 12:56:47 lukem Exp $");
|
||||
__RCSID("$NetBSD: cmds.c,v 1.24 2006/02/01 14:20:12 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/param.h>
|
||||
@ -391,7 +391,7 @@ opts(const char *command)
|
||||
|
||||
/* default cases */
|
||||
if (ep != NULL && *ep != '\0')
|
||||
REASSIGN(c->options, xstrdup(ep));
|
||||
REASSIGN(c->options, ftpd_strdup(ep));
|
||||
if (c->options != NULL)
|
||||
reply(200, "Options for %s are '%s'.", c->name,
|
||||
c->options);
|
||||
@ -438,7 +438,7 @@ renamefrom(const char *name)
|
||||
return (NULL);
|
||||
}
|
||||
reply(350, "File exists, ready for destination name");
|
||||
return (xstrdup(name));
|
||||
return (ftpd_strdup(name));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $ */
|
||||
/* $NetBSD: conf.c,v 1.57 2006/02/01 14:20:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
#include <sys/cdefs.h>
|
||||
#ifndef lint
|
||||
__RCSID("$NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $");
|
||||
__RCSID("$NetBSD: conf.c,v 1.57 2006/02/01 14:20:12 christos Exp $");
|
||||
#endif /* not lint */
|
||||
|
||||
#include <sys/types.h>
|
||||
@ -77,7 +77,7 @@ static int filetypematch(char *, int);
|
||||
#define DEFAULT_MAXFILESIZE -1 /* unlimited file size */
|
||||
#define DEFAULT_MAXTIMEOUT 7200 /* 2 hours */
|
||||
#define DEFAULT_TIMEOUT 900 /* 15 minutes */
|
||||
#define DEFAULT_UMASK 027 /* 15 minutes */
|
||||
#define DEFAULT_UMASK 027 /* rw-r----- */
|
||||
|
||||
/*
|
||||
* Initialise curclass to an `empty' state
|
||||
@ -109,7 +109,7 @@ init_curclass(void)
|
||||
curclass.maxrateget = 0;
|
||||
curclass.maxrateput = 0;
|
||||
curclass.maxtimeout = DEFAULT_MAXTIMEOUT;
|
||||
REASSIGN(curclass.motd, xstrdup(_PATH_FTPLOGINMESG));
|
||||
REASSIGN(curclass.motd, ftpd_strdup(_NAME_FTPLOGINMESG));
|
||||
REASSIGN(curclass.notify, NULL);
|
||||
curclass.portmin = 0;
|
||||
curclass.portmax = 0;
|
||||
@ -126,6 +126,7 @@ init_curclass(void)
|
||||
|
||||
CURCLASS_FLAGS_SET(checkportcmd);
|
||||
CURCLASS_FLAGS_CLR(denyquick);
|
||||
CURCLASS_FLAGS_CLR(hidesymlinks);
|
||||
CURCLASS_FLAGS_SET(modify);
|
||||
CURCLASS_FLAGS_SET(passive);
|
||||
CURCLASS_FLAGS_CLR(private);
|
||||
@ -152,14 +153,14 @@ parse_conf(const char *findclass)
|
||||
struct ftpconv *conv, *cnext;
|
||||
|
||||
init_curclass();
|
||||
REASSIGN(curclass.classname, xstrdup(findclass));
|
||||
REASSIGN(curclass.classname, ftpd_strdup(findclass));
|
||||
/* set more guest defaults */
|
||||
if (strcasecmp(findclass, "guest") == 0) {
|
||||
CURCLASS_FLAGS_CLR(modify);
|
||||
curclass.umask = 0707;
|
||||
}
|
||||
|
||||
infile = conffilename(_PATH_FTPDCONF);
|
||||
infile = conffilename(_NAME_FTPDCONF);
|
||||
if ((f = fopen(infile, "r")) == NULL)
|
||||
return;
|
||||
|
||||
@ -205,7 +206,7 @@ parse_conf(const char *findclass)
|
||||
if (none || EMPTYSTR(arg)) \
|
||||
arg = NULL; \
|
||||
else \
|
||||
arg = xstrdup(arg); \
|
||||
arg = ftpd_strdup(arg); \
|
||||
REASSIGN(curclass.Field, arg); \
|
||||
} while (0)
|
||||
|
||||
@ -310,16 +311,16 @@ parse_conf(const char *findclass)
|
||||
convcmd = p;
|
||||
if (convcmd)
|
||||
convcmd += strspn(convcmd, " \t");
|
||||
suffix = xstrdup(arg);
|
||||
suffix = ftpd_strdup(arg);
|
||||
if (none || EMPTYSTR(types) ||
|
||||
EMPTYSTR(disable) || EMPTYSTR(convcmd)) {
|
||||
types = NULL;
|
||||
disable = NULL;
|
||||
convcmd = NULL;
|
||||
} else {
|
||||
types = xstrdup(types);
|
||||
disable = xstrdup(disable);
|
||||
convcmd = xstrdup(convcmd);
|
||||
types = ftpd_strdup(types);
|
||||
disable = ftpd_strdup(disable);
|
||||
convcmd = ftpd_strdup(convcmd);
|
||||
}
|
||||
for (conv = curclass.conversions; conv != NULL;
|
||||
conv = conv->next) {
|
||||
@ -354,6 +355,9 @@ parse_conf(const char *findclass)
|
||||
} else if (strcasecmp(word, "display") == 0) {
|
||||
CONF_STRING(display);
|
||||
|
||||
} else if (strcasecmp(word, "hidesymlinks") == 0) {
|
||||
CONF_FLAG(hidesymlinks);
|
||||
|
||||
} else if (strcasecmp(word, "homedir") == 0) {
|
||||
CONF_STRING(homedir);
|
||||
|
||||
@ -362,7 +366,7 @@ parse_conf(const char *findclass)
|
||||
REASSIGN(curclass.limitfile, NULL);
|
||||
CONF_LL(limit, arg, -1, LLTMAX);
|
||||
REASSIGN(curclass.limitfile,
|
||||
EMPTYSTR(p) ? NULL : xstrdup(p));
|
||||
EMPTYSTR(p) ? NULL : ftpd_strdup(p));
|
||||
|
||||
} else if (strcasecmp(word, "maxfilesize") == 0) {
|
||||
curclass.maxfilesize = DEFAULT_MAXFILESIZE;
|
||||
@ -385,6 +389,10 @@ parse_conf(const char *findclass)
|
||||
curclass.writesize = 0;
|
||||
CONF_LL(writesize, arg, 0, LLTMAX);
|
||||
|
||||
} else if (strcasecmp(word, "recvbufsize") == 0) {
|
||||
curclass.recvbufsize = 0;
|
||||
CONF_LL(recvbufsize, arg, 0, LLTMAX);
|
||||
|
||||
} else if (strcasecmp(word, "sendbufsize") == 0) {
|
||||
curclass.sendbufsize = 0;
|
||||
CONF_LL(sendbufsize, arg, 0, LLTMAX);
|
||||
@ -464,7 +472,7 @@ parse_conf(const char *findclass)
|
||||
} else if (strcasecmp(word, "template") == 0) {
|
||||
if (none)
|
||||
continue;
|
||||
REASSIGN(template, EMPTYSTR(arg) ? NULL : xstrdup(arg));
|
||||
REASSIGN(template, EMPTYSTR(arg) ? NULL : ftpd_strdup(arg));
|
||||
|
||||
} else if (strcasecmp(word, "umask") == 0) {
|
||||
u_long fumask;
|
||||
@ -547,7 +555,7 @@ show_chdir_messages(int code)
|
||||
if (sl_find(slist, curwd) != NULL)
|
||||
return;
|
||||
|
||||
cp = xstrdup(curwd);
|
||||
cp = ftpd_strdup(curwd);
|
||||
if (sl_add(slist, cp) == -1)
|
||||
syslog(LOG_WARNING, "can't add `%s' to stringlist", cp);
|
||||
|
||||
@ -846,13 +854,13 @@ do_conversion(const char *fname)
|
||||
/* Split up command into an argv */
|
||||
if ((sl = sl_init()) == NULL)
|
||||
goto cleanup_do_conv;
|
||||
cmd = xstrdup(cp->command);
|
||||
cmd = ftpd_strdup(cp->command);
|
||||
p = cmd;
|
||||
while (p) {
|
||||
NEXTWORD(p, lp);
|
||||
if (strcmp(lp, "%s") == 0)
|
||||
lp = base;
|
||||
if (sl_add(sl, xstrdup(lp)) == -1)
|
||||
if (sl_add(sl, ftpd_strdup(lp)) == -1)
|
||||
goto cleanup_do_conv;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: extern.h,v 1.50 2004-08-09 12:56:47 lukem Exp $ */
|
||||
/* $NetBSD: extern.h,v 1.55 2006/02/01 14:20:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
@ -32,7 +32,7 @@
|
||||
*/
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -174,22 +174,27 @@ void statfilecmd(const char *);
|
||||
void statxfer(void);
|
||||
void store(const char *, const char *, int);
|
||||
void user(const char *);
|
||||
char *xstrdup(const char *);
|
||||
char *ftpd_strdup(const char *);
|
||||
void yyerror(char *);
|
||||
|
||||
#ifdef SUPPORT_UTMP
|
||||
struct utmp;
|
||||
|
||||
void ftpd_initwtmp(void);
|
||||
void ftpd_logwtmp(const char *, const char *, const char *);
|
||||
void ftpd_login(const struct utmp *ut);
|
||||
int ftpd_logout(const char *line);
|
||||
void ftpd_login(const struct utmp *);
|
||||
int ftpd_logout(const char *);
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_UTMPX
|
||||
struct utmpx;
|
||||
struct sockinet;
|
||||
|
||||
void ftpd_initwtmpx(void);
|
||||
void ftpd_logwtmpx(const char *, const char *, const char *,
|
||||
struct sockinet *, int, int);
|
||||
void ftpd_loginx(const struct utmpx *);
|
||||
void ftpd_logwtmpx(const char *, const char *, const char *, int, int);
|
||||
int ftpd_logoutx(const char *, int, int);
|
||||
#endif
|
||||
|
||||
#include <netinet/in.h>
|
||||
@ -251,12 +256,15 @@ typedef enum {
|
||||
typedef enum {
|
||||
FLAG_checkportcmd = 1<<0, /* Check port commands */
|
||||
FLAG_denyquick = 1<<1, /* Check ftpusers(5) before PASS */
|
||||
FLAG_modify = 1<<2, /* Allow CHMOD, DELE, MKD, RMD, RNFR,
|
||||
FLAG_hidesymlinks = 1<<2, /* For symbolic links, list the file
|
||||
or directory the link references
|
||||
rather than the link itself */
|
||||
FLAG_modify = 1<<3, /* Allow CHMOD, DELE, MKD, RMD, RNFR,
|
||||
UMASK */
|
||||
FLAG_passive = 1<<3, /* Allow PASV mode */
|
||||
FLAG_private = 1<<4, /* Don't publish class info in STAT */
|
||||
FLAG_sanenames = 1<<5, /* Restrict names of uploaded files */
|
||||
FLAG_upload = 1<<6, /* As per modify, but also allow
|
||||
FLAG_passive = 1<<4, /* Allow PASV mode */
|
||||
FLAG_private = 1<<5, /* Don't publish class info in STAT */
|
||||
FLAG_sanenames = 1<<6, /* Restrict names of uploaded files */
|
||||
FLAG_upload = 1<<7, /* As per modify, but also allow
|
||||
APPE, STOR, STOU */
|
||||
} classflag_t;
|
||||
|
||||
@ -290,6 +298,7 @@ struct ftpclass {
|
||||
LLT mmapsize; /* mmap window size */
|
||||
LLT readsize; /* data read size */
|
||||
LLT writesize; /* data write size */
|
||||
LLT recvbufsize; /* SO_RCVBUF size */
|
||||
LLT sendbufsize; /* SO_SNDBUF size */
|
||||
LLT sendlowat; /* SO_SNDLOWAT size */
|
||||
};
|
||||
@ -309,7 +318,7 @@ GLOBAL struct sockinet his_addr;
|
||||
GLOBAL struct sockinet pasv_addr;
|
||||
GLOBAL int connections;
|
||||
GLOBAL struct ftpclass curclass;
|
||||
GLOBAL int debug;
|
||||
GLOBAL int ftpd_debug;
|
||||
GLOBAL char *emailaddr;
|
||||
GLOBAL int form;
|
||||
GLOBAL int gidcount; /* number of entries in gidlist[] */
|
||||
|
@ -1,7 +1,7 @@
|
||||
/* $NetBSD: ftpcmd.y,v 1.80 2004-08-09 12:56:47 lukem Exp $ */
|
||||
/* $NetBSD: ftpcmd.y,v 1.84 2006/02/01 14:20:12 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
|
||||
* Copyright (c) 1997-2005 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* This code is derived from software contributed to The NetBSD Foundation
|
||||
@ -79,7 +79,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: ftpcmd.y,v 1.80 2004-08-09 12:56:47 lukem Exp $");
|
||||
__RCSID("$NetBSD: ftpcmd.y,v 1.84 2006/02/01 14:20:12 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -118,6 +118,14 @@ char cbuf[FTP_BUFLEN];
|
||||
char *cmdp;
|
||||
char *fromname;
|
||||
|
||||
extern int epsvall;
|
||||
struct tab sitetab[];
|
||||
|
||||
static int check_write(const char *, int);
|
||||
static void help(struct tab *, const char *);
|
||||
static void port_check(const char *, int);
|
||||
int yylex(void);
|
||||
|
||||
%}
|
||||
|
||||
%union {
|
||||
@ -503,6 +511,8 @@ cmd
|
||||
{
|
||||
char *argv[] = { INTERNAL_LS, "-lgA", NULL };
|
||||
|
||||
if (CURCLASS_FLAGS_ISSET(hidesymlinks))
|
||||
argv[1] = "-LlgA";
|
||||
if ($2)
|
||||
retrieve(argv, "");
|
||||
}
|
||||
@ -511,6 +521,8 @@ cmd
|
||||
{
|
||||
char *argv[] = { INTERNAL_LS, "-lgA", NULL, NULL };
|
||||
|
||||
if (CURCLASS_FLAGS_ISSET(hidesymlinks))
|
||||
argv[1] = "-LlgA";
|
||||
if ($2 && $4 != NULL) {
|
||||
argv[2] = $4;
|
||||
retrieve(argv, $4);
|
||||
@ -1293,13 +1305,6 @@ struct tab sitetab[] = {
|
||||
{ NULL, 0, 0, 0, NULL }
|
||||
};
|
||||
|
||||
static int check_write(const char *, int);
|
||||
static void help(struct tab *, const char *);
|
||||
static void port_check(const char *, int);
|
||||
int yylex(void);
|
||||
|
||||
extern int epsvall;
|
||||
|
||||
/*
|
||||
* Check if a filename is allowed to be modified (isupload == 0) or
|
||||
* uploaded (isupload == 1), and if necessary, check the filename is `sane'.
|
||||
@ -1333,7 +1338,7 @@ check_write(const char *file, int isupload)
|
||||
if (file[0] == '.')
|
||||
goto insane_name;
|
||||
for (p = file; *p; p++) {
|
||||
if (isalnum(*p) || *p == '-' || *p == '+' ||
|
||||
if (isalnum((unsigned char)*p) || *p == '-' || *p == '+' ||
|
||||
*p == ',' || *p == '.' || *p == '_')
|
||||
continue;
|
||||
insane_name:
|
||||
@ -1371,7 +1376,7 @@ getline(char *s, int n, FILE *iop)
|
||||
*cs++ = tmpline[c];
|
||||
if (tmpline[c] == '\n') {
|
||||
*cs++ = '\0';
|
||||
if (debug)
|
||||
if (ftpd_debug)
|
||||
syslog(LOG_DEBUG, "command: %s", s);
|
||||
tmpline[0] = '\0';
|
||||
return(s);
|
||||
@ -1419,7 +1424,7 @@ getline(char *s, int n, FILE *iop)
|
||||
if (c == EOF && cs == s)
|
||||
return (NULL);
|
||||
*cs++ = '\0';
|
||||
if (debug) {
|
||||
if (ftpd_debug) {
|
||||
if ((curclass.type != CLASS_GUEST &&
|
||||
strncasecmp(s, "PASS ", 5) == 0) ||
|
||||
strncasecmp(s, "ACCT ", 5) == 0) {
|
||||
@ -1571,7 +1576,7 @@ yylex(void)
|
||||
*/
|
||||
if (n > 1 && cmdp[cpos] == '\n') {
|
||||
cmdp[cpos] = '\0';
|
||||
yylval.s = xstrdup(cp);
|
||||
yylval.s = ftpd_strdup(cp);
|
||||
cmdp[cpos] = '\n';
|
||||
state = ARGS;
|
||||
return (STRING);
|
||||
@ -1583,9 +1588,9 @@ yylex(void)
|
||||
cpos++;
|
||||
return (SP);
|
||||
}
|
||||
if (isdigit(cmdp[cpos])) {
|
||||
if (isdigit((unsigned char)cmdp[cpos])) {
|
||||
cp = &cmdp[cpos];
|
||||
while (isdigit(cmdp[++cpos]))
|
||||
while (isdigit((unsigned char)cmdp[++cpos]))
|
||||
;
|
||||
c = cmdp[cpos];
|
||||
cmdp[cpos] = '\0';
|
||||
@ -1598,9 +1603,9 @@ yylex(void)
|
||||
goto dostr1;
|
||||
|
||||
case ARGS:
|
||||
if (isdigit(cmdp[cpos])) {
|
||||
if (isdigit((unsigned char)cmdp[cpos])) {
|
||||
cp = &cmdp[cpos];
|
||||
while (isdigit(cmdp[++cpos]))
|
||||
while (isdigit((unsigned char)cmdp[++cpos]))
|
||||
;
|
||||
c = cmdp[cpos];
|
||||
cmdp[cpos] = '\0';
|
||||
@ -1610,7 +1615,7 @@ yylex(void)
|
||||
return (NUMBER);
|
||||
}
|
||||
if (strncasecmp(&cmdp[cpos], "ALL", 3) == 0
|
||||
&& !isalnum(cmdp[cpos + 3])) {
|
||||
&& !isalnum((unsigned char)cmdp[cpos + 3])) {
|
||||
cpos += 3;
|
||||
return (ALL);
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
.\" $NetBSD: ftpd.8,v 1.74 2003-08-07 09:46:39 agc Exp $
|
||||
.\" $NetBSD: ftpd.8,v 1.76 2005/08/07 11:13:34 wiz Exp $
|
||||
.\"
|
||||
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
|
||||
.\" All rights reserved.
|
||||
@ -63,7 +63,7 @@
|
||||
.\"
|
||||
.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
|
||||
.\"
|
||||
.Dd February 26, 2003
|
||||
.Dd August 4, 2005
|
||||
.Dt FTPD 8
|
||||
.Os
|
||||
.Sh NAME
|
||||
@ -72,10 +72,10 @@
|
||||
Internet File Transfer Protocol server
|
||||
.Sh SYNOPSIS
|
||||
.Nm
|
||||
.Op Fl dHlqQrsuUwWX
|
||||
.Op Fl 46DdHlQqrsUuWwX
|
||||
.Op Fl a Ar anondir
|
||||
.Op Fl c Ar confdir
|
||||
.Op Fl C Ar user
|
||||
.Op Fl c Ar confdir
|
||||
.Op Fl e Ar emailaddr
|
||||
.Op Fl h Ar hostname
|
||||
.Op Fl L Ar xferlogfile
|
||||
@ -93,6 +93,14 @@ service specification; see
|
||||
.Pp
|
||||
Available options:
|
||||
.Bl -tag -width Ds
|
||||
.It Fl 4
|
||||
When
|
||||
.Fl D
|
||||
is specified, bind to IPv4 addresses only.
|
||||
.It Fl 6
|
||||
When
|
||||
.Fl D
|
||||
is specified, bind to IPv6 addresses only.
|
||||
.It Fl a Ar anondir
|
||||
Define
|
||||
.Ar anondir
|
||||
@ -104,6 +112,16 @@ This can also be specified with the
|
||||
.Xr ftpd.conf 5
|
||||
.Sy chroot
|
||||
directive.
|
||||
.It Fl C Ar user
|
||||
Check whether
|
||||
.Ar user
|
||||
would be granted access under
|
||||
the restrictions given in
|
||||
.Xr ftpusers 5
|
||||
and exit without attempting a connection.
|
||||
.Nm
|
||||
exits with an exit code of 0 if access would be granted, or 1 otherwise.
|
||||
This can be useful for testing configurations.
|
||||
.It Fl c Ar confdir
|
||||
Change the root directory of the configuration files from
|
||||
.Dq Pa /etc
|
||||
@ -118,16 +136,16 @@ and the file specified by the
|
||||
.Xr ftpd.conf 5
|
||||
.Sy limit
|
||||
directive.
|
||||
.It Fl C Ar user
|
||||
Check whether
|
||||
.Ar user
|
||||
would be granted access under
|
||||
the restrictions given in
|
||||
.Xr ftpusers 5
|
||||
and exit without attempting a connection.
|
||||
.It Fl D
|
||||
Run as daemon.
|
||||
.Nm
|
||||
exits with an exit code of 0 if access would be granted, or 1 otherwise.
|
||||
This can be useful for testing configurations.
|
||||
will listen on the default FTP port for incoming connections
|
||||
and fork a child for each connection.
|
||||
This is lower overhead than starting
|
||||
.Nm
|
||||
from
|
||||
.Xr inetd 8
|
||||
and thus might be useful on busy servers to reduce load.
|
||||
.It Fl d
|
||||
Debugging information is written to the syslog using a facility of
|
||||
.Dv LOG_FTP .
|
||||
@ -138,6 +156,12 @@ for the
|
||||
.Dq "\&%E"
|
||||
escape sequence (see
|
||||
.Sx Display file escape sequences )
|
||||
.It Fl H
|
||||
Equivalent to
|
||||
.Do
|
||||
-h
|
||||
`hostname`
|
||||
.Dc .
|
||||
.It Fl h Ar hostname
|
||||
Explicitly set the hostname to advertise as to
|
||||
.Ar hostname .
|
||||
@ -155,12 +179,13 @@ servers, each listening on separate addresses as separate names.
|
||||
Refer to
|
||||
.Xr inetd.conf 5
|
||||
for more information on starting services to listen on specific IP addresses.
|
||||
.It Fl H
|
||||
Equivalent to
|
||||
.Do
|
||||
-h
|
||||
`hostname`
|
||||
.Dc .
|
||||
.It Fl L Ar xferlogfile
|
||||
Log
|
||||
.Tn wu-ftpd
|
||||
style
|
||||
.Sq xferlog
|
||||
entries to
|
||||
.Ar xferlogfile .
|
||||
.It Fl l
|
||||
Each successful and failed
|
||||
.Tn FTP
|
||||
@ -169,13 +194,6 @@ session is logged using syslog with a facility of
|
||||
If this option is specified more than once, the retrieve (get), store (put),
|
||||
append, delete, make directory, remove directory and rename operations and
|
||||
their file name arguments are also logged.
|
||||
.It Fl L Ar xferlogfile
|
||||
Log
|
||||
.Tn wu-ftpd
|
||||
style
|
||||
.Sq xferlog
|
||||
entries to
|
||||
.Ar xferlogfile .
|
||||
.It Fl P Ar dataport
|
||||
Use
|
||||
.Ar dataport
|
||||
@ -183,16 +201,16 @@ as the data port, overriding the default of using the port one less
|
||||
that the port
|
||||
.Nm
|
||||
is listening on.
|
||||
.It Fl q
|
||||
Enable the use of pid files for keeping track of the number of logged-in
|
||||
users per class.
|
||||
This is the default.
|
||||
.It Fl Q
|
||||
Disable the use of pid files for keeping track of the number of logged-in
|
||||
users per class.
|
||||
This may reduce the load on heavily loaded
|
||||
.Tn FTP
|
||||
servers.
|
||||
.It Fl q
|
||||
Enable the use of pid files for keeping track of the number of logged-in
|
||||
users per class.
|
||||
This is the default.
|
||||
.It Fl r
|
||||
Permanently drop root privileges once the user is logged in.
|
||||
The use of this option may result in the server using a port other
|
||||
@ -206,6 +224,12 @@ See
|
||||
below for more details.
|
||||
.It Fl s
|
||||
Require a secure authentication mechanism like Kerberos or S/Key to be used.
|
||||
.It Fl U
|
||||
Don't log each concurrent
|
||||
.Tn FTP
|
||||
session to
|
||||
.Pa /var/run/utmp .
|
||||
This is the default.
|
||||
.It Fl u
|
||||
Log each concurrent
|
||||
.Tn FTP
|
||||
@ -213,12 +237,6 @@ session to
|
||||
.Pa /var/run/utmp ,
|
||||
making them visible to commands such as
|
||||
.Xr who 1 .
|
||||
.It Fl U
|
||||
Don't log each concurrent
|
||||
.Tn FTP
|
||||
session to
|
||||
.Pa /var/run/utmp .
|
||||
This is the default.
|
||||
.It Fl V Ar version
|
||||
Use
|
||||
.Ar version
|
||||
@ -232,6 +250,11 @@ If
|
||||
is empty or
|
||||
.Sq -
|
||||
then don't display any version information.
|
||||
.It Fl W
|
||||
Don't log each
|
||||
.Tn FTP
|
||||
session to
|
||||
.Pa /var/log/wtmp .
|
||||
.It Fl w
|
||||
Log each
|
||||
.Tn FTP
|
||||
@ -240,11 +263,6 @@ session to
|
||||
making them visible to commands such as
|
||||
.Xr last 1 .
|
||||
This is the default.
|
||||
.It Fl W
|
||||
Don't log each
|
||||
.Tn FTP
|
||||
session to
|
||||
.Pa /var/log/wtmp .
|
||||
.It Fl X
|
||||
Log
|
||||
.Tn wu-ftpd
|
||||
|
@ -154,4 +154,10 @@ ftpd_loginx(const struct utmpx *ut)
|
||||
{
|
||||
(void)pututxline(ut);
|
||||
}
|
||||
|
||||
int
|
||||
ftpd_logoutx(const char *line, int status, int mode)
|
||||
{
|
||||
return logoutx(line, status, mode);
|
||||
}
|
||||
#endif
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $ */
|
||||
/* $NetBSD: logwtmp.c,v 1.24 2005/06/23 04:20:41 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1988, 1993
|
||||
@ -36,7 +36,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $");
|
||||
__RCSID("$NetBSD: logwtmp.c,v 1.24 2005/06/23 04:20:41 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -51,8 +51,11 @@ __RCSID("$NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $");
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <syslog.h>
|
||||
#include <unistd.h>
|
||||
#ifdef SUPPORT_UTMP
|
||||
#include <utmp.h>
|
||||
#endif
|
||||
#ifdef SUPPORT_UTMPX
|
||||
#include <utmpx.h>
|
||||
#endif
|
||||
@ -64,10 +67,16 @@ __RCSID("$NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $");
|
||||
|
||||
#include "extern.h"
|
||||
|
||||
#ifdef SUPPORT_UTMP
|
||||
static int fd = -1;
|
||||
#ifdef SUPPORT_UTMPX
|
||||
static int fdx = -1;
|
||||
#endif
|
||||
|
||||
void
|
||||
ftpd_initwtmp(void)
|
||||
{
|
||||
const char *wf = _PATH_WTMP;
|
||||
if ((fd = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
|
||||
syslog(LOG_ERR, "Cannot open `%s' (%m)", wf);
|
||||
}
|
||||
|
||||
/*
|
||||
* Modified version of logwtmp that holds wtmp file open
|
||||
@ -92,20 +101,36 @@ ftpd_logwtmp(const char *line, const char *name, const char *host)
|
||||
(void)ftruncate(fd, buf.st_size);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SUPPORT_UTMPX
|
||||
static int fdx = -1;
|
||||
|
||||
void
|
||||
ftpd_logwtmpx(const char *line, const char *name, const char *host, int status, int utx_type)
|
||||
ftpd_initwtmpx(void)
|
||||
{
|
||||
const char *wf = _PATH_WTMPX;
|
||||
if ((fd = open(wf, O_WRONLY|O_APPEND, 0)) == -1)
|
||||
syslog(LOG_ERR, "Cannot open `%s' (%m)", wf);
|
||||
}
|
||||
|
||||
void
|
||||
ftpd_logwtmpx(const char *line, const char *name, const char *host,
|
||||
struct sockinet *haddr, int status, int utx_type)
|
||||
{
|
||||
struct utmpx ut;
|
||||
struct stat buf;
|
||||
|
||||
if (fdx < 0 && (fdx = open(_PATH_WTMPX, O_WRONLY|O_APPEND, 0)) < 0)
|
||||
if (fdx < 0)
|
||||
return;
|
||||
if (fstat(fdx, &buf) == 0) {
|
||||
(void)strncpy(ut.ut_line, line, sizeof(ut.ut_line));
|
||||
(void)strncpy(ut.ut_name, name, sizeof(ut.ut_name));
|
||||
(void)strncpy(ut.ut_host, host, sizeof(ut.ut_host));
|
||||
if (haddr)
|
||||
(void)memcpy(&ut.ut_ss, &haddr->si_su, haddr->su_len);
|
||||
else
|
||||
(void)memset(&ut.ut_ss, 0, sizeof(ut.ut_ss));
|
||||
ut.ut_type = utx_type;
|
||||
if (WIFEXITED(status))
|
||||
ut.ut_exit.e_exit = (uint16_t)WEXITSTATUS(status);
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: pathnames.h,v 1.11 2003-08-07 09:46:40 agc Exp $ */
|
||||
/* $NetBSD: pathnames.h,v 1.12 2004/12/11 18:37:26 christos Exp $ */
|
||||
|
||||
/*
|
||||
* Copyright (c) 1989, 1993
|
||||
@ -37,11 +37,11 @@
|
||||
#define _DEFAULT_CONFDIR "/etc"
|
||||
#endif
|
||||
|
||||
#define _PATH_FTPCHROOT "ftpchroot"
|
||||
#define _PATH_FTPDCONF "ftpd.conf"
|
||||
#define _PATH_FTPLOGINMESG "motd"
|
||||
#define _PATH_FTPUSERS "ftpusers"
|
||||
#define _PATH_FTPWELCOME "ftpwelcome"
|
||||
#define _NAME_FTPCHROOT "ftpchroot"
|
||||
#define _NAME_FTPDCONF "ftpd.conf"
|
||||
#define _NAME_FTPLOGINMESG "motd"
|
||||
#define _NAME_FTPUSERS "ftpusers"
|
||||
#define _NAME_FTPWELCOME "ftpwelcome"
|
||||
|
||||
#define _PATH_CLASSPIDS "/var/run/ftpd.pids-"
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $ */
|
||||
/* $NetBSD: popen.c,v 1.31 2006/02/01 14:20:14 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
@ -74,7 +74,7 @@
|
||||
#if 0
|
||||
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $");
|
||||
__RCSID("$NetBSD: popen.c,v 1.31 2006/02/01 14:20:14 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint */
|
||||
|
||||
@ -138,7 +138,7 @@ ftpd_popen(char *argv[], const char *ptype, int stderrfd)
|
||||
goto pfree;
|
||||
|
||||
/* glob each piece */
|
||||
if (sl_add(sl, xstrdup(argv[0])) == -1)
|
||||
if (sl_add(sl, ftpd_strdup(argv[0])) == -1)
|
||||
goto pfree;
|
||||
for (argc = 1; argv[argc]; argc++) {
|
||||
glob_t gl;
|
||||
@ -146,13 +146,13 @@ ftpd_popen(char *argv[], const char *ptype, int stderrfd)
|
||||
|
||||
memset(&gl, 0, sizeof(gl));
|
||||
if (glob(argv[argc], flags, NULL, &gl)) {
|
||||
if (sl_add(sl, xstrdup(argv[argc])) == -1) {
|
||||
if (sl_add(sl, ftpd_strdup(argv[argc])) == -1) {
|
||||
globfree(&gl);
|
||||
goto pfree;
|
||||
}
|
||||
} else {
|
||||
for (pop = gl.gl_pathv; *pop; pop++) {
|
||||
if (sl_add(sl, xstrdup(*pop)) == -1) {
|
||||
if (sl_add(sl, ftpd_strdup(*pop)) == -1) {
|
||||
globfree(&gl);
|
||||
goto pfree;
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: version.h,v 1.57 2004-08-09 12:56:48 lukem Exp $ */
|
||||
/* $NetBSD: version.h,v 1.64 2005/11/24 23:47:23 lukem Exp $ */
|
||||
/*-
|
||||
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
|
||||
* All rights reserved.
|
||||
@ -36,5 +36,5 @@
|
||||
*/
|
||||
|
||||
#ifndef FTPD_VERSION
|
||||
#define FTPD_VERSION "NetBSD-ftpd 20040809"
|
||||
#define FTPD_VERSION "NetBSD-ftpd 20051124"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user