diff options
author | Dan Harnett <danh@cvs.openbsd.org> | 2002-07-02 18:09:55 +0000 |
---|---|---|
committer | Dan Harnett <danh@cvs.openbsd.org> | 2002-07-02 18:09:55 +0000 |
commit | 08164aa7b48cddaba444394214fd10fa49bf5cd9 (patch) | |
tree | 12d8c5dedf29274c3571c63db0c916ddb4d56545 /libexec | |
parent | 3aca8249d13a32de42bfae96a88149bea16f20e0 (diff) |
* use lostconn() as the SIGALRM handler in receive_data() as originally
done by downsj@ in revision 1.54.
* some -Wall cleanup
- only declare check_host() if TCPWRAPPERS is defined.
- use socklen_t where appropriate instead of int (pointer signedness
warnings).
- {u_}char * pointer signedness warnings.
ok millert@
Diffstat (limited to 'libexec')
-rw-r--r-- | libexec/ftpd/ftpcmd.y | 7 | ||||
-rw-r--r-- | libexec/ftpd/ftpd.c | 36 | ||||
-rw-r--r-- | libexec/ftpd/logwtmp.c | 7 | ||||
-rw-r--r-- | libexec/ftpd/popen.c | 7 |
4 files changed, 37 insertions, 20 deletions
diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 690096505c7..32e4c5f08a7 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpcmd.y,v 1.40 2002/06/17 19:33:37 danh Exp $ */ +/* $OpenBSD: ftpcmd.y,v 1.41 2002/07/02 18:09:53 danh Exp $ */ /* $NetBSD: ftpcmd.y,v 1.7 1996/04/08 19:03:11 jtc Exp $ */ /* @@ -45,9 +45,10 @@ #ifndef lint #if 0 -static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94"; +static const char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94"; #else -static char rcsid[] = "$OpenBSD: ftpcmd.y,v 1.40 2002/06/17 19:33:37 danh Exp $"; +static const char rcsid[] = + "$OpenBSD: ftpcmd.y,v 1.41 2002/07/02 18:09:53 danh Exp $"; #endif #endif /* not lint */ diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index abbd44184ac..747c77bf9e8 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ftpd.c,v 1.129 2002/06/17 19:33:37 danh Exp $ */ +/* $OpenBSD: ftpd.c,v 1.130 2002/07/02 18:09:54 danh Exp $ */ /* $NetBSD: ftpd.c,v 1.15 1995/06/03 22:46:47 mycroft Exp $ */ /* @@ -64,16 +64,17 @@ */ #ifndef lint -static char copyright[] = +static const char copyright[] = "@(#) Copyright (c) 1985, 1988, 1990, 1992, 1993, 1994\n\ The Regents of the University of California. All rights reserved.\n"; #endif /* not lint */ #ifndef lint #if 0 -static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; +static const char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #else -static char rcsid[] = "$OpenBSD: ftpd.c,v 1.129 2002/06/17 19:33:37 danh Exp $"; +static const char rcsid[] = + "$OpenBSD: ftpd.c,v 1.130 2002/07/02 18:09:54 danh Exp $"; #endif #endif /* not lint */ @@ -240,7 +241,7 @@ static char *copy_dir(char *, struct passwd *); static char *curdir(void); static void end_login(void); static FILE *getdatasock(char *); -static int guniquefd(char *, char **); +static int guniquefd(char *, char **); static void lostconn(int); static void sigquit(int); static int receive_data(FILE *, FILE *); @@ -249,7 +250,9 @@ static int send_data(FILE *, FILE *, off_t, off_t, int); static struct passwd * sgetpwnam(char *); static void reapchild(int); +#if defined(TCPWRAPPERS) static int check_host(struct sockaddr *); +#endif /* TCPWRAPPERS */ static void usage(void); void logxfer(char *, off_t, time_t); @@ -283,7 +286,8 @@ main(argc, argv, envp) char *argv[]; char **envp; { - int addrlen, ch, on = 1, tos; + socklen_t addrlen; + int ch, on = 1, tos; char *cp, line[LINE_MAX]; FILE *fp; struct hostent *hp; @@ -1350,7 +1354,7 @@ dataconn(name, size, mode) FILE *file; int retry = 0; in_port_t *p; - char *fa, *ha; + u_char *fa, *ha; int alen; file_size = size; @@ -1362,7 +1366,8 @@ dataconn(name, size, mode) sizebuf[0] = '\0'; if (pdata >= 0) { union sockunion from; - int s, fromlen = sizeof(from); + int s; + socklen_t fromlen = sizeof(from); (void) alarm ((unsigned) timeout); s = accept(pdata, (struct sockaddr *)&from, &fromlen); @@ -1623,6 +1628,7 @@ receive_data(instr, outstr) int c; int cnt; char buf[BUFSIZ]; + struct sigaction sa, sa_saved; volatile int bare_lfs = 0; transflag++; @@ -1630,6 +1636,11 @@ receive_data(instr, outstr) case TYPE_I: case TYPE_L: + memset(&sa, 0, sizeof(sa)); + sigfillset(&sa.sa_mask); + sa.sa_flags = SA_RESTART; + sa.sa_handler = lostconn; + (void) sigaction(SIGALRM, &sa, &sa_saved); do { (void) alarm ((unsigned) timeout); cnt = read(fileno(instr), buf, sizeof(buf)); @@ -1643,6 +1654,7 @@ receive_data(instr, outstr) byte_count += cnt; } } while (cnt > 0); + (void) sigaction(SIGALRM, &sa_saved, NULL); if (cnt < 0) goto data_err; transflag = 0; @@ -2182,7 +2194,8 @@ myoob() void passive() { - int len, on; + socklen_t len; + int on; u_char *p, *a; if (pw == NULL) { @@ -2301,7 +2314,8 @@ af2epsvproto(int af) void long_passive(char *cmd, int pf) { - int len, on; + socklen_t len; + int on; u_char *p, *a; if (!logged_in) { @@ -2384,7 +2398,7 @@ long_passive(char *cmd, int pf) 4, 4, a[0], a[1], a[2], a[3], 2, p[0], p[1]); return; case AF_INET6: - a = (char *) &pasv_addr.su_sin6.sin6_addr; + a = (u_char *) &pasv_addr.su_sin6.sin6_addr; reply(228, "Entering Long Passive Mode (%u,%u,%u,%u,%u,%u," "%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u,%u)", diff --git a/libexec/ftpd/logwtmp.c b/libexec/ftpd/logwtmp.c index 168f394e151..0f62d1e5a78 100644 --- a/libexec/ftpd/logwtmp.c +++ b/libexec/ftpd/logwtmp.c @@ -1,4 +1,4 @@ -/* $OpenBSD: logwtmp.c,v 1.4 2001/01/28 19:34:27 niklas Exp $ */ +/* $OpenBSD: logwtmp.c,v 1.5 2002/07/02 18:09:54 danh Exp $ */ /* $NetBSD: logwtmp.c,v 1.4 1995/04/11 02:44:58 cgd Exp $ */ /* @@ -37,9 +37,10 @@ #ifndef lint #if 0 -static char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93"; +static const char sccsid[] = "@(#)logwtmp.c 8.1 (Berkeley) 6/4/93"; #else -static char rcsid[] = "$OpenBSD: logwtmp.c,v 1.4 2001/01/28 19:34:27 niklas Exp $"; +static const char rcsid[] = + "$OpenBSD: logwtmp.c,v 1.5 2002/07/02 18:09:54 danh Exp $"; #endif #endif /* not lint */ diff --git a/libexec/ftpd/popen.c b/libexec/ftpd/popen.c index 5ba908fcb07..6cba0c2fb20 100644 --- a/libexec/ftpd/popen.c +++ b/libexec/ftpd/popen.c @@ -1,4 +1,4 @@ -/* $OpenBSD: popen.c,v 1.16 2002/05/29 20:35:27 mpech Exp $ */ +/* $OpenBSD: popen.c,v 1.17 2002/07/02 18:09:54 danh Exp $ */ /* $NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $ */ /* @@ -40,9 +40,10 @@ #ifndef lint #if 0 -static char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; +static const char sccsid[] = "@(#)popen.c 8.3 (Berkeley) 4/6/94"; #else -static char rcsid[] = "$NetBSD: popen.c,v 1.5 1995/04/11 02:45:00 cgd Exp $"; +static const char rcsid[] = + "$OpenBSD: popen.c,v 1.17 2002/07/02 18:09:54 danh Exp $"; #endif #endif /* not lint */ |