summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>2003-07-07 03:18:11 +0000
committerderaadt <deraadt@openbsd.org>2003-07-07 03:18:11 +0000
commitb12aa87c63950dc682b0b09afacb26323ecb305f (patch)
treeb51642d2967a8840c4d5de8c90b9dbb3dfbf7707
parentfunction for cpuid instruction. pulled from longrun into generic code. (diff)
downloadwireguard-openbsd-b12aa87c63950dc682b0b09afacb26323ecb305f.tar.xz
wireguard-openbsd-b12aa87c63950dc682b0b09afacb26323ecb305f.zip
make this match protos; millert ok
-rw-r--r--libexec/ftpd/extern.h6
-rw-r--r--libexec/ftpd/ftpd.c10
-rw-r--r--libexec/ftpd/logutmp.c37
3 files changed, 32 insertions, 21 deletions
diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h
index bf994bce487..4ea60241d8d 100644
--- a/libexec/ftpd/extern.h
+++ b/libexec/ftpd/extern.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: extern.h,v 1.11 2003/06/02 19:38:24 millert Exp $ */
+/* $OpenBSD: extern.h,v 1.12 2003/07/07 03:18:11 deraadt Exp $ */
/* $NetBSD: extern.h,v 1.2 1995/04/11 02:44:49 cgd Exp $ */
/*
@@ -100,6 +100,10 @@ void user(char *);
void yyerror(char *);
void toolong(int);
+struct utmp;
+void ftpd_login(struct utmp *ut);
+int ftpd_logout(char *);
+
int yyparse(void);
union sockunion {
diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c
index 15907e95583..8056cd27565 100644
--- a/libexec/ftpd/ftpd.c
+++ b/libexec/ftpd/ftpd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: ftpd.c,v 1.143 2003/06/11 14:24:46 deraadt Exp $ */
+/* $OpenBSD: ftpd.c,v 1.144 2003/07/07 03:18:11 deraadt Exp $ */
/* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */
/*
@@ -70,7 +70,7 @@ static const char copyright[] =
static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94";
#else
static const char rcsid[] =
- "$OpenBSD: ftpd.c,v 1.143 2003/06/11 14:24:46 deraadt Exp $";
+ "$OpenBSD: ftpd.c,v 1.144 2003/07/07 03:18:11 deraadt Exp $";
#endif
#endif /* not lint */
@@ -845,7 +845,7 @@ end_login(void)
if (logged_in) {
ftpdlogwtmp(ttyline, "", "");
if (doutmp)
- logout(utmp.ut_line);
+ ftpd_logout(utmp.ut_line);
}
reply(530, "Please reconnect to work as another user");
exit(0);
@@ -945,7 +945,7 @@ pass(char *passwd)
(void)strncpy(utmp.ut_name, pw->pw_name, sizeof(utmp.ut_name));
(void)strncpy(utmp.ut_host, remotehost, sizeof(utmp.ut_host));
(void)strncpy(utmp.ut_line, ttyline, sizeof(utmp.ut_line));
- login(&utmp);
+ ftpd_login(&utmp);
}
/* open stats file before chroot */
@@ -2091,7 +2091,7 @@ dologout(int status)
sigprocmask(SIG_BLOCK, &allsigs, NULL);
ftpdlogwtmp(ttyline, "", "");
if (doutmp)
- logout(utmp.ut_line);
+ ftpd_logout(utmp.ut_line);
}
/* beware of flushing buffers after a SIGPIPE */
_exit(status);
diff --git a/libexec/ftpd/logutmp.c b/libexec/ftpd/logutmp.c
index 77ec2c2dcb6..39f09cf3e6a 100644
--- a/libexec/ftpd/logutmp.c
+++ b/libexec/ftpd/logutmp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: logutmp.c,v 1.6 2003/06/11 14:24:46 deraadt Exp $ */
+/* $OpenBSD: logutmp.c,v 1.7 2003/07/07 03:18:11 deraadt Exp $ */
/*
* Portions Copyright (c) 1988, 1993
* The Regents of the University of California. All rights reserved.
@@ -30,6 +30,11 @@
*/
#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+#include <netinet/in_systm.h>
+#include <netinet/ip.h>
+#include <netinet/tcp.h>
#include <fcntl.h>
#include <unistd.h>
@@ -38,8 +43,7 @@
#include <stdio.h>
#include <string.h>
#include <ttyent.h>
-
-typedef struct utmp UTMP;
+#include "extern.h"
static int fd = -1;
static int topslot = -1;
@@ -50,9 +54,9 @@ static int topslot = -1;
*/
void
-login(UTMP *ut)
+ftpd_login(struct utmp *ut)
{
- UTMP ubuf;
+ struct utmp ubuf;
/*
* First, loop through /etc/ttys, if needed, to initialize the
@@ -70,28 +74,31 @@ login(UTMP *ut)
/*
* Now find a slot that's not in use...
*/
- (void)lseek(fd, (off_t)(topslot * sizeof(UTMP)), SEEK_SET);
+ (void)lseek(fd, (off_t)(topslot * sizeof(struct utmp)), SEEK_SET);
while (1) {
- if (read(fd, &ubuf, sizeof(UTMP)) == sizeof(UTMP)) {
+ if (read(fd, &ubuf, sizeof(struct utmp)) ==
+ sizeof(struct utmp)) {
if (!ubuf.ut_name[0]) {
- (void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
+ (void)lseek(fd, -(off_t)sizeof(struct utmp),
+ SEEK_CUR);
break;
}
topslot++;
} else {
- (void)lseek(fd, (off_t)(topslot * sizeof(UTMP)), SEEK_SET);
+ (void)lseek(fd, (off_t)(topslot *
+ sizeof(struct utmp)), SEEK_SET);
break;
}
}
- (void)write(fd, ut, sizeof(UTMP));
+ (void)write(fd, ut, sizeof(struct utmp));
}
int
-logout(char *line)
+ftpd_logout(char *line)
{
- UTMP ut;
+ struct utmp ut;
int rval;
rval = 0;
@@ -100,15 +107,15 @@ logout(char *line)
(void)lseek(fd, 0, SEEK_SET);
- while (read(fd, &ut, sizeof(UTMP)) == sizeof(UTMP)) {
+ while (read(fd, &ut, sizeof(struct utmp)) == sizeof(struct utmp)) {
if (!ut.ut_name[0] ||
strncmp(ut.ut_line, line, UT_LINESIZE))
continue;
bzero(ut.ut_name, UT_NAMESIZE);
bzero(ut.ut_host, UT_HOSTSIZE);
(void)time(&ut.ut_time);
- (void)lseek(fd, -(off_t)sizeof(UTMP), SEEK_CUR);
- (void)write(fd, &ut, sizeof(UTMP));
+ (void)lseek(fd, -(off_t)sizeof(struct utmp), SEEK_CUR);
+ (void)write(fd, &ut, sizeof(struct utmp));
rval = 1;
}
return(rval);