This commit was generated by cvs2svn to compensate for changes in r133936,

which included commits to RCS files with non-trunk default branches.
This commit is contained in:
obrien 2004-08-18 06:29:48 +00:00
commit cf10dfca59
12 changed files with 185 additions and 151 deletions

View File

@ -1,6 +1,6 @@
/* $NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp $ */
/* $NetBSD: strsuftoll.c,v 1.5 2004/01/17 23:02:51 dbj Exp $ */
/*-
* Copyright (c) 2001-2002 The NetBSD Foundation, Inc.
* Copyright (c) 2001-2002,2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -50,11 +50,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -71,20 +67,20 @@
* SUCH DAMAGE.
*/
#if HAVE_NBTOOL_CONFIG_H
#include "nbtool_config.h"
#endif
#include <sys/cdefs.h>
#if defined(LIBC_SCCS) && !defined(lint)
__RCSID("$NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp $");
__RCSID("$NetBSD: strsuftoll.c,v 1.5 2004/01/17 23:02:51 dbj Exp $");
#endif /* LIBC_SCCS and not lint */
#ifdef _LIBC
#include "namespace.h"
#endif
#if HAVE_CONFIG_H
#include "config.h"
#endif
#if !HAVE_STRSUFTOLL
#include <sys/types.h>
@ -100,16 +96,11 @@ __RCSID("$NetBSD: strsuftoll.c,v 1.1 2002/11/29 12:58:17 lukem Exp $");
#include <string.h>
#ifdef _LIBC
# define _STRSUFTOLL _strsuftoll
# define _STRSUFTOLLX _strsuftollx
# ifdef __weak_alias
__weak_alias(strsuftoll, _strsuftoll)
__weak_alias(strsuftollx, _strsuftollx)
# endif
#else /* !LIBC */
# define _STRSUFTOLL strsuftoll
# define _STRSUFTOLLX strsuftollx
#endif /* !LIBC */
#endif /* LIBC */
/*
* Convert an expression of the following forms to a (u)int64_t.
@ -117,8 +108,10 @@ __weak_alias(strsuftollx, _strsuftollx)
* 2) A positive decimal number followed by a b (mult by 512).
* 3) A positive decimal number followed by a k (mult by 1024).
* 4) A positive decimal number followed by a m (mult by 1048576).
* 5) A positive decimal number followed by a w (mult by sizeof int)
* 6) Two or more positive decimal numbers (with/without k,b or w).
* 5) A positive decimal number followed by a g (mult by 1073741824).
* 6) A positive decimal number followed by a t (mult by 1099511627776).
* 7) A positive decimal number followed by a w (mult by sizeof int)
* 8) Two or more positive decimal numbers (with/without k,b or w).
* separated by x (also * for backwards compatibility), specifying
* the product of the indicated values.
* Returns the result upon successful conversion, or exits with an
@ -127,7 +120,7 @@ __weak_alias(strsuftollx, _strsuftollx)
*/
/* LONGLONG */
long long
_STRSUFTOLL(const char *desc, const char *val,
strsuftoll(const char *desc, const char *val,
long long min, long long max)
{
long long result;
@ -145,7 +138,7 @@ _STRSUFTOLL(const char *desc, const char *val,
*/
/* LONGLONG */
long long
_STRSUFTOLLX(const char *desc, const char *val,
strsuftollx(const char *desc, const char *val,
long long min, long long max, char *ebuf, size_t ebuflen)
{
long long num, t;
@ -161,7 +154,7 @@ _STRSUFTOLLX(const char *desc, const char *val,
while (isspace((unsigned char)*val)) /* Skip leading space */
val++;
num = strtoll(val, &expr, 0);
num = strtoll(val, &expr, 10);
if (errno == ERANGE)
goto erange; /* Overflow */
@ -244,7 +237,7 @@ _STRSUFTOLLX(const char *desc, const char *val,
/* LONGLONG */
snprintf(ebuf, ebuflen,
"%s %lld is greater than %lld.",
desc, (long long)num, (long long)min);
desc, (long long)num, (long long)max);
return (0);
}
*ebuf = '\0';

View File

@ -1,4 +1,4 @@
# $NetBSD: Makefile,v 1.49 2002/08/22 00:09:38 christos Exp $
# $NetBSD: Makefile,v 1.51 2003-07-23 08:01:27 itojun Exp $
# @(#)Makefile 8.2 (Berkeley) 4/4/94
.include <bsd.own.mk>
@ -28,19 +28,24 @@ LDADD+= -lskey
ftpd.o ftpcmd.o: version.h
# XXX Kerberos support is broken right now.
#.if (${USE_KERBEROS} != "no")
#
#.PATH: ${NETBSDSRCDIR}/usr.bin/login
#.ifdef KERBEROS5
#
#SRCS+= k5login.c
#CPPFLAGS+=-DKERBEROS5
#DPADD+= ${LIBKRB5} ${LIBK5CRYPTO} ${LIBCOM_ERR}
#LDADD+= -lkrb5 -lk5crypto -lcom_err
#.else
#SRCS+= klogin.c
#CPPFLAGS+=-DKERBEROS
#DPADD+= ${LIBKRB} ${LIBDES} ${LIBCOM_ERR}
#LDADD+= -lkrb -kdes -lcom_err
#CPPFLAGS+=-DKERBEROS5 -I${DESTDIR}/usr/include/krb5
#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
#
#.endif
.include <bsd.prog.mk>

View File

@ -1,7 +1,7 @@
/* $NetBSD: cmds.c,v 1.20 2003/01/08 18:07:31 manu Exp $ */
/* $NetBSD: cmds.c,v 1.23 2004-08-09 12:56:47 lukem Exp $ */
/*
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -48,11 +48,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -101,7 +97,7 @@
#include <sys/cdefs.h>
#ifndef lint
__RCSID("$NetBSD: cmds.c,v 1.20 2003/01/08 18:07:31 manu Exp $");
__RCSID("$NetBSD: cmds.c,v 1.23 2004-08-09 12:56:47 lukem Exp $");
#endif /* not lint */
#include <sys/param.h>
@ -111,7 +107,6 @@ __RCSID("$NetBSD: cmds.c,v 1.20 2003/01/08 18:07:31 manu Exp $");
#include <dirent.h>
#include <errno.h>
#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -812,7 +807,7 @@ static void
mlsname(FILE *fp, factelem *fe)
{
char realfile[MAXPATHLEN];
int i, userf;
int i, userf = 0;
for (i = 0; i < FACTTABSIZE; i++) {
if (facttab[i].enabled)

View File

@ -1,7 +1,7 @@
/* $NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $ */
/* $NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $ */
/*-
* Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2004 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.50 2002/11/16 03:10:34 itojun Exp $");
__RCSID("$NetBSD: conf.c,v 1.52 2004-08-09 12:56:47 lukem Exp $");
#endif /* not lint */
#include <sys/types.h>
@ -51,7 +51,6 @@ __RCSID("$NetBSD: conf.c,v 1.50 2002/11/16 03:10:34 itojun Exp $");
#include <fcntl.h>
#include <glob.h>
#include <netdb.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,4 +1,4 @@
/* $NetBSD: extern.h,v 1.44 2002/05/30 00:24:47 enami Exp $ */
/* $NetBSD: extern.h,v 1.50 2004-08-09 12:56:47 lukem Exp $ */
/*-
* Copyright (c) 1992, 1993
@ -12,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -36,7 +32,7 @@
*/
/*-
* Copyright (c) 1997-2001 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -147,9 +143,6 @@ char *getline(char *, int, FILE *);
void init_curclass(void);
void logxfer(const char *, off_t, const char *, const char *,
const struct timeval *, const char *);
#if 0
void logwtmp(const char *, const char *, const char *);
#endif
struct tab *lookup(struct tab *, const char *);
void makedir(const char *);
void mlsd(const char *);
@ -184,6 +177,21 @@ void user(const char *);
char *xstrdup(const char *);
void yyerror(char *);
#ifdef SUPPORT_UTMP
struct utmp;
void ftpd_logwtmp(const char *, const char *, const char *);
void ftpd_login(const struct utmp *ut);
int ftpd_logout(const char *line);
#endif
#ifdef SUPPORT_UTMPX
struct utmpx;
void ftpd_loginx(const struct utmpx *);
void ftpd_logwtmpx(const char *, const char *, const char *, int, int);
#endif
#include <netinet/in.h>
#if defined(__NetBSD__)
@ -302,11 +310,10 @@ GLOBAL struct sockinet pasv_addr;
GLOBAL int connections;
GLOBAL struct ftpclass curclass;
GLOBAL int debug;
GLOBAL jmp_buf errcatch;
GLOBAL char *emailaddr;
GLOBAL int form;
GLOBAL int gidcount; /* number of entries in gidlist[] */
GLOBAL gid_t gidlist[NGROUPS_MAX];
GLOBAL gid_t *gidlist;
GLOBAL int hasyyerrored;
GLOBAL char hostname[MAXHOSTNAMELEN+1];
GLOBAL char homedir[MAXPATHLEN];
@ -324,7 +331,6 @@ GLOBAL int quietmessages;
GLOBAL char remotehost[MAXHOSTNAMELEN+1];
GLOBAL off_t restart_point;
GLOBAL char tmpline[FTP_BUFLEN];
GLOBAL sig_atomic_t transflag;
GLOBAL int type;
GLOBAL int usedefault; /* for data transfers */
GLOBAL const char *version;

View File

@ -1,7 +1,7 @@
/* $NetBSD: ftpcmd.y,v 1.73 2003/01/22 04:33:35 lukem Exp $ */
/* $NetBSD: ftpcmd.y,v 1.80 2004-08-09 12:56:47 lukem Exp $ */
/*-
* Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
* Copyright (c) 1997-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -48,11 +48,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -83,7 +79,7 @@
#if 0
static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: ftpcmd.y,v 1.73 2003/01/22 04:33:35 lukem Exp $");
__RCSID("$NetBSD: ftpcmd.y,v 1.80 2004-08-09 12:56:47 lukem Exp $");
#endif
#endif /* not lint */
@ -98,8 +94,6 @@ __RCSID("$NetBSD: ftpcmd.y,v 1.73 2003/01/22 04:33:35 lukem Exp $");
#include <ctype.h>
#include <errno.h>
#include <pwd.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@ -128,7 +122,7 @@ char *fromname;
%union {
struct {
off_t o;
LLT ll;
int i;
} u;
char *s;
@ -138,7 +132,7 @@ char *fromname;
A B C E F I
L N P R S T
SP CRLF COMMA
SP CRLF COMMA ALL
USER PASS ACCT CWD CDUP SMNT
QUIT REIN PORT PASV TYPE STRU
@ -164,7 +158,6 @@ char *fromname;
LEXERR
%token <s> STRING
%token <s> ALL
%token <u> NUMBER
%type <u.i> check_login octal_number byte_size
@ -179,7 +172,7 @@ char *fromname;
cmd_sel
: cmd
{
fromname = NULL;
REASSIGN(fromname, NULL);
restart_point = (off_t) 0;
}
@ -459,8 +452,7 @@ cmd
if (check_write($3, 0)) {
if (fromname) {
renamecmd(fromname, $3);
free(fromname);
fromname = NULL;
REASSIGN(fromname, NULL);
} else {
reply(503, "Bad sequence of commands.");
}
@ -548,7 +540,7 @@ cmd
| SITE SP CHMOD SP octal_number SP pathname CRLF
{
if (check_write($7, 0)) {
if ($5 > 0777)
if (($5 == -1) || ($5 > 0777))
reply(501,
"CHMOD: Mode value must be between 0 and 0777");
else if (chmod($7, $5) < 0)
@ -883,8 +875,8 @@ rcmd
: REST check_login SP NUMBER CRLF
{
if ($2) {
fromname = NULL;
restart_point = $4.o;
REASSIGN(fromname, NULL);
restart_point = (off_t)$4.ll;
reply(350,
"Restarting at " LLF ". Send STORE or RETRIEVE to initiate transfer.",
(LLT)restart_point);
@ -894,8 +886,10 @@ rcmd
| RNFR SP pathname CRLF
{
restart_point = (off_t) 0;
if (check_write($3, 0))
if (check_write($3, 0)) {
REASSIGN(fromname, NULL);
fromname = renamefrom($3);
}
if ($3 != NULL)
free($3);
}
@ -987,7 +981,7 @@ host_long_port6
memset(&data_dest, 0, sizeof(data_dest));
#endif /* INET6 */
/* reject invalid LPRT command */
if ($1.i != 6.i || $3.i != 16.i || $37.i != 2)
if ($1.i != 6 || $3.i != 16 || $37.i != 2)
memset(&data_dest, 0, sizeof(data_dest));
}
;
@ -1302,8 +1296,7 @@ struct tab sitetab[] = {
static int check_write(const char *, int);
static void help(struct tab *, const char *);
static void port_check(const char *, int);
static void toolong(int);
static int yylex(void);
int yylex(void);
extern int epsvall;
@ -1449,19 +1442,6 @@ getline(char *s, int n, FILE *iop)
return (s);
}
static void
toolong(int signo)
{
reply(421,
"Timeout (" LLF " seconds): closing control connection.",
(LLT)curclass.timeout);
if (logging)
syslog(LOG_INFO, "User %s timed out after " LLF " seconds",
(pw ? pw->pw_name : "unknown"), (LLT)curclass.timeout);
dologout(1);
}
void
ftp_handle_line(char *cp)
{
@ -1475,7 +1455,6 @@ ftp_loop(void)
{
while (1) {
(void) signal(SIGALRM, toolong);
(void) alarm(curclass.timeout);
if (getline(cbuf, sizeof(cbuf)-1, stdin) == NULL) {
reply(221, "You could at least say goodbye.");
@ -1487,7 +1466,7 @@ ftp_loop(void)
/*NOTREACHED*/
}
static int
int
yylex(void)
{
static int cpos, state;
@ -1626,15 +1605,14 @@ yylex(void)
c = cmdp[cpos];
cmdp[cpos] = '\0';
yylval.u.i = atoi(cp);
yylval.u.o = strtoull(cp, (char **)NULL, 10);
yylval.u.ll = STRTOLL(cp, (char **)NULL, 10);
cmdp[cpos] = c;
return (NUMBER);
}
if (strncasecmp(&cmdp[cpos], "ALL", 3) == 0
&& !isalnum(cmdp[cpos + 3])) {
yylval.s = xstrdup("ALL");
&& !isalnum(cmdp[cpos + 3])) {
cpos += 3;
return ALL;
return (ALL);
}
switch (cmdp[cpos++]) {
@ -1720,9 +1698,7 @@ yylex(void)
}
yyerror(NULL);
state = CMD;
is_oob = 0;
longjmp(errcatch, 0);
/* NOTREACHED */
return (0);
}
/* ARGSUSED */

View File

@ -1,6 +1,6 @@
.\" $NetBSD: ftpd.8,v 1.69 2002/02/08 01:30:07 ross Exp $
.\" $NetBSD: ftpd.8,v 1.74 2003-08-07 09:46:39 agc Exp $
.\"
.\" Copyright (c) 1997-2002 The NetBSD Foundation, Inc.
.\" Copyright (c) 1997-2003 The NetBSD Foundation, Inc.
.\" All rights reserved.
.\"
.\" This code is derived from software contributed to The NetBSD Foundation
@ -45,11 +45,7 @@
.\" 2. Redistributions in binary form must reproduce the above copyright
.\" notice, this list of conditions and the following disclaimer in the
.\" documentation and/or other materials provided with the distribution.
.\" 3. All advertising materials mentioning features or use of this software
.\" must display the following acknowledgement:
.\" This product includes software developed by the University of
.\" California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\" 3. Neither the name of the University nor the names of its contributors
.\" may be used to endorse or promote products derived from this software
.\" without specific prior written permission.
.\"
@ -67,7 +63,7 @@
.\"
.\" @(#)ftpd.8 8.2 (Berkeley) 4/19/94
.\"
.Dd October 25, 2002
.Dd February 26, 2003
.Dt FTPD 8
.Os
.Sh NAME
@ -82,6 +78,7 @@ Internet File Transfer Protocol server
.Op Fl C Ar user
.Op Fl e Ar emailaddr
.Op Fl h Ar hostname
.Op Fl L Ar xferlogfile
.Op Fl P Ar dataport
.Op Fl V Ar version
.Sh DESCRIPTION
@ -172,6 +169,13 @@ 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
@ -392,7 +396,7 @@ interprets file names according to the
.Dq globbing
conventions used by
.Xr csh 1 .
This allows users to utilize the metacharacters
This allows users to use the metacharacters
.Dq Li \&*?[]{}~ .
.Ss User authentication
.Nm

View File

@ -1,7 +1,6 @@
/*
* Portions Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
* Portions Copyright (c) 1996, Jason Downs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
@ -11,11 +10,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -32,7 +27,33 @@
* SUCH DAMAGE.
*/
/*
* Portions Copyright (c) 1996, Jason Downs. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS
* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*/
#include <sys/types.h>
#include <sys/param.h>
#include <fcntl.h>
#include <stdio.h>
@ -41,8 +62,13 @@
#include <ttyent.h>
#include <unistd.h>
#include <utmp.h>
#ifdef SUPPORT_UTMPX
#include <utmpx.h>
#endif
#include <util.h>
#include "extern.h"
typedef struct utmp UTMP;
static int fd = -1;
@ -54,7 +80,7 @@ static int topslot = -1;
*/
void
login(const UTMP *ut)
ftpd_login(const struct utmp *ut)
{
UTMP ubuf;
@ -94,7 +120,7 @@ login(const UTMP *ut)
}
int
logout(const char *line)
ftpd_logout(const char *line)
{
UTMP ut;
int rval;
@ -118,3 +144,14 @@ logout(const char *line)
}
return(rval);
}
#ifdef SUPPORT_UTMPX
/*
* special version of loginx which updates utmpx only.
*/
void
ftpd_loginx(const struct utmpx *ut)
{
(void)pututxline(ut);
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: logwtmp.c,v 1.17 2002/09/12 08:55:31 itojun Exp $ */
/* $NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $ */
/*
* Copyright (c) 1988, 1993
@ -12,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -40,7 +36,7 @@
#if 0
static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93";
#else
__RCSID("$NetBSD: logwtmp.c,v 1.17 2002/09/12 08:55:31 itojun Exp $");
__RCSID("$NetBSD: logwtmp.c,v 1.22 2004-08-09 12:56:48 lukem Exp $");
#endif
#endif /* not lint */
@ -48,15 +44,18 @@ __RCSID("$NetBSD: logwtmp.c,v 1.17 2002/09/12 08:55:31 itojun Exp $");
#include <sys/param.h>
#include <sys/time.h>
#include <sys/stat.h>
#include <sys/wait.h>
#include <fcntl.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <string.h>
#include <time.h>
#include <unistd.h>
#include <utmp.h>
#ifdef SUPPORT_UTMPX
#include <utmpx.h>
#endif
#include <util.h>
#ifdef KERBEROS5
@ -66,6 +65,9 @@ __RCSID("$NetBSD: logwtmp.c,v 1.17 2002/09/12 08:55:31 itojun Exp $");
#include "extern.h"
static int fd = -1;
#ifdef SUPPORT_UTMPX
static int fdx = -1;
#endif
/*
* Modified version of logwtmp that holds wtmp file open
@ -73,7 +75,7 @@ static int fd = -1;
* after login, but before logout).
*/
void
logwtmp(const char *line, const char *name, const char *host)
ftpd_logwtmp(const char *line, const char *name, const char *host)
{
struct utmp ut;
struct stat buf;
@ -90,3 +92,29 @@ logwtmp(const char *line, const char *name, const char *host)
(void)ftruncate(fd, buf.st_size);
}
}
#ifdef SUPPORT_UTMPX
void
ftpd_logwtmpx(const char *line, const char *name, const char *host, int status, int utx_type)
{
struct utmpx ut;
struct stat buf;
if (fdx < 0 && (fdx = open(_PATH_WTMPX, O_WRONLY|O_APPEND, 0)) < 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));
ut.ut_type = utx_type;
if (WIFEXITED(status))
ut.ut_exit.e_exit = (uint16_t)WEXITSTATUS(status);
if (WIFSIGNALED(status))
ut.ut_exit.e_termination = (uint16_t)WTERMSIG(status);
(void)gettimeofday(&ut.ut_tv, NULL);
if(write(fdx, (char *)&ut, sizeof(struct utmpx)) !=
sizeof(struct utmpx))
(void)ftruncate(fdx, buf.st_size);
}
}
#endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: pathnames.h,v 1.9 2000/01/08 11:09:56 lukem Exp $ */
/* $NetBSD: pathnames.h,v 1.11 2003-08-07 09:46:40 agc Exp $ */
/*
* Copyright (c) 1989, 1993
@ -12,11 +12,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*

View File

@ -1,7 +1,7 @@
/* $NetBSD: popen.c,v 1.28 2003/01/16 09:41:38 kleink Exp $ */
/* $NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $ */
/*-
* Copyright (c) 1999-2001 The NetBSD Foundation, Inc.
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -51,11 +51,7 @@
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* 3. All advertising materials mentioning features or use of this software
* must display the following acknowledgement:
* This product includes software developed by the University of
* California, Berkeley and its contributors.
* 4. Neither the name of the University nor the names of its contributors
* 3. Neither the name of the University nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
@ -78,7 +74,7 @@
#if 0
static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94";
#else
__RCSID("$NetBSD: popen.c,v 1.28 2003/01/16 09:41:38 kleink Exp $");
__RCSID("$NetBSD: popen.c,v 1.30 2004-08-09 12:56:48 lukem Exp $");
#endif
#endif /* not lint */
@ -88,7 +84,6 @@ __RCSID("$NetBSD: popen.c,v 1.28 2003/01/16 09:41:38 kleink Exp $");
#include <errno.h>
#include <glob.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
#include <stdlib.h>

View File

@ -1,6 +1,6 @@
/* $NetBSD: version.h,v 1.50 2003/01/22 04:46:08 lukem Exp $ */
/* $NetBSD: version.h,v 1.57 2004-08-09 12:56:48 lukem Exp $ */
/*-
* Copyright (c) 1999-2002 The NetBSD Foundation, Inc.
* Copyright (c) 1999-2004 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -36,5 +36,5 @@
*/
#ifndef FTPD_VERSION
#define FTPD_VERSION "NetBSD-ftpd 20030122"
#define FTPD_VERSION "NetBSD-ftpd 20040809"
#endif