From eee47fe2812a5b95997752afb65d1a9294b59dac Mon Sep 17 00:00:00 2001 From: peter Date: Mon, 1 Jan 1996 08:35:11 +0000 Subject: Make ftpd use setproctitle() from libutil I've left the old code in there under #ifdef OLD_SETPROCTITLE in case somebody wants to try to compile out ftpd on some other machine. --- libexec/ftpd/Makefile | 4 ++-- libexec/ftpd/extern.h | 2 ++ libexec/ftpd/ftpcmd.y | 1 + libexec/ftpd/ftpd.c | 19 +++++++++++-------- 4 files changed, 16 insertions(+), 10 deletions(-) (limited to 'libexec/ftpd') diff --git a/libexec/ftpd/Makefile b/libexec/ftpd/Makefile index a218380..4348d4f 100644 --- a/libexec/ftpd/Makefile +++ b/libexec/ftpd/Makefile @@ -7,8 +7,8 @@ SRCS= ftpd.c ftpcmd.c logwtmp.c popen.c skey-stuff.c CFLAGS+=-DSETPROCTITLE -DSKEY -DSTATS CFLAGS+=-DFTP_DATA_BOTTOM=40000 -DFTP_DATA_TOP=44999 -LDADD= -lskey -lmd -lcrypt -DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} +LDADD= -lskey -lmd -lcrypt -lutil +DPADD= ${LIBSKEY} ${LIBMD} ${LIBCRYPT} ${LIBUTIL} CLEANFILES+=ftpcmd.c y.tab.h diff --git a/libexec/ftpd/extern.h b/libexec/ftpd/extern.h index e3336b5..fe784c8 100644 --- a/libexec/ftpd/extern.h +++ b/libexec/ftpd/extern.h @@ -56,7 +56,9 @@ char *renamefrom __P((char *)); void reply __P((int, const char *, ...)); void retrieve __P((char *, char *)); void send_file_list __P((char *)); +#ifdef OLD_SETPROCTITLE void setproctitle __P((const char *, ...)); +#endif void statcmd __P((void)); void statfilecmd __P((char *)); void store __P((char *, char *, int)); diff --git a/libexec/ftpd/ftpcmd.y b/libexec/ftpd/ftpcmd.y index 151c3d7..4473b15 100644 --- a/libexec/ftpd/ftpcmd.y +++ b/libexec/ftpd/ftpcmd.y @@ -63,6 +63,7 @@ static char sccsid[] = "@(#)ftpcmd.y 8.3 (Berkeley) 4/6/94"; #include #include #include +#include #include "extern.h" diff --git a/libexec/ftpd/ftpd.c b/libexec/ftpd/ftpd.c index 0e256bf..d59d805 100644 --- a/libexec/ftpd/ftpd.c +++ b/libexec/ftpd/ftpd.c @@ -30,7 +30,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: ftpd.c,v 1.12 1995/08/28 21:30:49 mpp Exp $ + * $Id: ftpd.c,v 1.13 1995/11/29 19:52:30 guido Exp $ */ #ifndef lint @@ -80,6 +80,7 @@ static char sccsid[] = "@(#)ftpd.c 8.4 (Berkeley) 4/16/94"; #include #include #include +#include #ifdef SKEY #include @@ -152,8 +153,10 @@ int swaitmax = SWAITMAX; int swaitint = SWAITINT; #ifdef SETPROCTITLE +#ifdef OLD_SETPROCTITLE char **Argv = NULL; /* pointer to argument vector */ char *LastArgv = NULL; /* end of argv */ +#endif /* OLD_SETPROCTITLE */ char proctitle[LINE_MAX]; /* initial part of title */ #endif /* SETPROCTITLE */ @@ -247,7 +250,7 @@ main(argc, argv, envp) #endif data_source.sin_port = htons(ntohs(ctrl_addr.sin_port) - 1); debug = 0; -#ifdef SETPROCTITLE +#ifdef OLD_SETPROCTITLE /* * Save start and extent of argv for setproctitle. */ @@ -255,7 +258,7 @@ main(argc, argv, envp) while (*envp) envp++; LastArgv = envp[-1] + strlen(envp[-1]); -#endif /* SETPROCTITLE */ +#endif /* OLD_SETPROCTITLE */ #ifdef STATS @@ -672,7 +675,7 @@ pass(passwd) "%s: anonymous/%.*s", remotehost, sizeof(proctitle) - sizeof(remotehost) - sizeof(": anonymous/"), passwd); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* SETPROCTITLE */ if (logging) syslog(LOG_INFO, "ANONYMOUS FTP LOGIN FROM %s, %s", @@ -682,7 +685,7 @@ pass(passwd) #ifdef SETPROCTITLE snprintf(proctitle, sizeof(proctitle), "%s: %s", remotehost, pw->pw_name); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* SETPROCTITLE */ if (logging) syslog(LOG_INFO, "FTP LOGIN FROM %s as %s", @@ -1468,7 +1471,7 @@ dolog(sin) sizeof(remotehost)); #ifdef SETPROCTITLE snprintf(proctitle, sizeof(proctitle), "%s: connected", remotehost); - setproctitle(proctitle); + setproctitle("%s", proctitle); #endif /* SETPROCTITLE */ if (logging) @@ -1774,7 +1777,7 @@ out: } } -#ifdef SETPROCTITLE +#ifdef OLD_SETPROCTITLE /* * Clobber argv so ps will show what we're doing. (Stolen from sendmail.) * Warning, since this is usually started from inetd.conf, it often doesn't @@ -1817,7 +1820,7 @@ setproctitle(fmt, va_alist) while (p < LastArgv) *p++ = ' '; } -#endif /* SETPROCTITLE */ +#endif /* OLD_SETPROCTITLE */ #ifdef STATS logxfer(name, size, start) -- cgit v1.1