From 51c9bd7f7bdaa8153f5b1c3c86399f880e063e6e Mon Sep 17 00:00:00 2001 From: Unknown User d91-jda Date: Tue, 23 Apr 1996 07:40:14 +0000 Subject: [PATCH] Import of kerberized ftp. git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@419 ec53bebd-3082-4978-b11e-865c3cabbd6b --- appl/ftp/common/Makefile.in | 2 +- appl/ftp/common/common.h | 10 +- appl/ftp/common/err.c | 16 ---- appl/ftp/common/err.h | 21 ---- appl/ftp/common/errx.c | 16 ---- appl/ftp/common/getusershell.c | 149 ----------------------------- appl/ftp/common/hstrerror.c | 26 ----- appl/ftp/common/inet_aton.c | 24 ----- appl/ftp/common/krb_get_err_text.c | 13 --- appl/ftp/common/memmove.c | 33 ------- appl/ftp/common/snprintf.c | 18 ---- appl/ftp/common/strerror.c | 21 ---- appl/ftp/common/verr.c | 22 ----- appl/ftp/common/verrx.c | 17 ---- appl/ftp/common/vsyslog.c | 17 ---- appl/ftp/common/vsyslog.h | 6 -- appl/ftp/common/vwarn.c | 21 ---- appl/ftp/common/vwarnx.c | 16 ---- appl/ftp/common/warn.c | 16 ---- appl/ftp/common/warnx.c | 16 ---- appl/ftp/configure.in | 16 +--- appl/ftp/ftp/Makefile.in | 4 +- appl/ftp/ftp/ftp_locl.h | 1 + appl/ftp/ftpd/Makefile.in | 9 +- 24 files changed, 16 insertions(+), 494 deletions(-) delete mode 100644 appl/ftp/common/err.c delete mode 100644 appl/ftp/common/err.h delete mode 100644 appl/ftp/common/errx.c delete mode 100644 appl/ftp/common/getusershell.c delete mode 100644 appl/ftp/common/hstrerror.c delete mode 100644 appl/ftp/common/inet_aton.c delete mode 100644 appl/ftp/common/krb_get_err_text.c delete mode 100644 appl/ftp/common/memmove.c delete mode 100644 appl/ftp/common/snprintf.c delete mode 100644 appl/ftp/common/strerror.c delete mode 100644 appl/ftp/common/verr.c delete mode 100644 appl/ftp/common/verrx.c delete mode 100644 appl/ftp/common/vsyslog.c delete mode 100644 appl/ftp/common/vsyslog.h delete mode 100644 appl/ftp/common/vwarn.c delete mode 100644 appl/ftp/common/vwarnx.c delete mode 100644 appl/ftp/common/warn.c delete mode 100644 appl/ftp/common/warnx.c diff --git a/appl/ftp/common/Makefile.in b/appl/ftp/common/Makefile.in index 508a62ca6..5a9fd24b5 100644 --- a/appl/ftp/common/Makefile.in +++ b/appl/ftp/common/Makefile.in @@ -19,7 +19,7 @@ libdir = $(exec_prefix)/lib ATHENA = /usr/athena -libcommon_OBJS = base64.o glob.o @LIBOBJS@ +libcommon_OBJS = base64.o glob.o all: libcommon.a diff --git a/appl/ftp/common/common.h b/appl/ftp/common/common.h index 280e61b02..0efa0d3bd 100644 --- a/appl/ftp/common/common.h +++ b/appl/ftp/common/common.h @@ -1,15 +1,9 @@ -#ifndef __COMMON_H__ -#define __COMMON_H__ - #ifdef HAVE_CONFIG_H #include #endif -#include - -#include "vsyslog.h" - -#include "err.h" +#ifndef __COMMON_H__ +#define __COMMON_H__ #include "base64.h" diff --git a/appl/ftp/common/err.c b/appl/ftp/common/err.c deleted file mode 100644 index 0f567f5bc..000000000 --- a/appl/ftp/common/err.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -err(int eval, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - verr(eval, fmt, ap); - va_end(ap); -} diff --git a/appl/ftp/common/err.h b/appl/ftp/common/err.h deleted file mode 100644 index 40c08de8e..000000000 --- a/appl/ftp/common/err.h +++ /dev/null @@ -1,21 +0,0 @@ -#ifndef __ERR_H__ -#define __ERR_H__ - -#include -#include -#include -#include -#include - -extern char *__progname; - -void verr(int eval, const char *fmt, va_list ap); -void err(int eval, const char *fmt, ...); -void verrx(int eval, const char *fmt, va_list ap); -void errx(int eval, const char *fmt, ...); -void vwarn(const char *fmt, va_list ap); -void warn(const char *fmt, ...); -void vwarnx(const char *fmt, va_list ap); -void warnx(const char *fmt, ...); - -#endif /* __ERR_H__ */ diff --git a/appl/ftp/common/errx.c b/appl/ftp/common/errx.c deleted file mode 100644 index 6b3b5a8a1..000000000 --- a/appl/ftp/common/errx.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -errx(int eval, const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - verrx(eval, fmt, ap); - va_end(ap); -} diff --git a/appl/ftp/common/getusershell.c b/appl/ftp/common/getusershell.c deleted file mode 100644 index ff696a03d..000000000 --- a/appl/ftp/common/getusershell.c +++ /dev/null @@ -1,149 +0,0 @@ -/* $NetBSD: getusershell.c,v 1.5 1995/02/27 04:13:27 cgd Exp $ */ - -/* - * Copyright (c) 1985, 1993 - * The Regents of the University of California. 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. - * 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 - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -RCSID("$Id$"); - -#ifndef HAVE_GETUSERSHELL - -#include -#include -#include -#include -#include - -#ifndef __P -#define __P(X) X -#endif - -#ifndef _PATH_SHELLS -#define _PATH_SHELLS "/etc/shells" -#endif - -/* - * Local shells should NOT be added here. They should be added in - * /etc/shells. - */ - -static char *okshells[] = { _PATH_BSHELL, _PATH_CSHELL, NULL }; -static char **curshell, **shells, *strings; -static char **initshells __P((void)); - -/* - * Get a list of shells from _PATH_SHELLS, if it exists. - */ -char * -getusershell() -{ - char *ret; - - if (curshell == NULL) - curshell = initshells(); - ret = *curshell; - if (ret != NULL) - curshell++; - return (ret); -} - -void -endusershell() -{ - - if (shells != NULL) - free(shells); - shells = NULL; - if (strings != NULL) - free(strings); - strings = NULL; - curshell = NULL; -} - -void -setusershell() -{ - - curshell = initshells(); -} - -static char ** -initshells() -{ - register char **sp, *cp; - register FILE *fp; - struct stat statb; - - if (shells != NULL) - free(shells); - shells = NULL; - if (strings != NULL) - free(strings); - strings = NULL; - if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) - return (okshells); - if (fstat(fileno(fp), &statb) == -1) { - (void)fclose(fp); - return (okshells); - } - if ((strings = malloc((u_int)statb.st_size)) == NULL) { - (void)fclose(fp); - return (okshells); - } - shells = calloc((unsigned)statb.st_size / 3, sizeof (char *)); - if (shells == NULL) { - (void)fclose(fp); - free(strings); - strings = NULL; - return (okshells); - } - sp = shells; - cp = strings; - while (fgets(cp, MAXPATHLEN + 1, fp) != NULL) { - while (*cp != '#' && *cp != '/' && *cp != '\0') - cp++; - if (*cp == '#' || *cp == '\0') - continue; - *sp++ = cp; - while (!isspace(*cp) && *cp != '#' && *cp != '\0') - cp++; - *cp++ = '\0'; - } - *sp = NULL; - (void)fclose(fp); - return (shells); -} -#endif /* HAVE_GETUSERSHELL */ diff --git a/appl/ftp/common/hstrerror.c b/appl/ftp/common/hstrerror.c deleted file mode 100644 index 42e5975c1..000000000 --- a/appl/ftp/common/hstrerror.c +++ /dev/null @@ -1,26 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef HAVE_HSTRERROR - -#include -#include - -static char *msg[] = { - "No error", - "Authoritative Answer Host not found", - "Non-Authoritive Host not found, or SERVERFAIL", - "Non recoverable errors, FORMERR, REFUSED, NOTIMP", - "Valid name, no data record of requested type" -}; - -char *hstrerror(int herr) -{ - if(herr >= 0 && herr <= 4) - return msg[herr]; - return "Error number out of range (hstrerror)"; -} - -#endif - diff --git a/appl/ftp/common/inet_aton.c b/appl/ftp/common/inet_aton.c deleted file mode 100644 index bea95c12d..000000000 --- a/appl/ftp/common/inet_aton.c +++ /dev/null @@ -1,24 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include - -RCSID("$Id$"); - -int inet_aton(char *cp, struct in_addr *adr) -{ - int a, b, c, d; - - if(sscanf(cp, "%d.%d.%d.%d", &a, &b, &c, &d) != 4) - return 0; - if(a < 0 || a > 255 || - b < 0 || b > 255 || - c < 0 || c > 255 || - d < 0 || d > 255) - return 0; - adr->s_addr = htonl((a << 24) | (b << 16) | (c << 8) | d); - return 1; -} diff --git a/appl/ftp/common/krb_get_err_text.c b/appl/ftp/common/krb_get_err_text.c deleted file mode 100644 index 64d94b7c5..000000000 --- a/appl/ftp/common/krb_get_err_text.c +++ /dev/null @@ -1,13 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -RCSID("$Id$"); - -const char * -krb_get_err_text(int n) -{ - return krb_err_txt[n]; -} diff --git a/appl/ftp/common/memmove.c b/appl/ftp/common/memmove.c deleted file mode 100644 index 8604af68a..000000000 --- a/appl/ftp/common/memmove.c +++ /dev/null @@ -1,33 +0,0 @@ -/* - * memmove for systems that doesn't have it - * - * $Id$ - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include - -RCSID("$Id$"); - -void* memmove(void *s1, const void *s2, size_t n) -{ - char *s=(char*)s2, *d=(char*)s1; - - if(d > s){ - s+=n-1; - d+=n-1; - while(n){ - *d--=*s--; - n--; - } - }else if(d < s) - while(n){ - *d++=*s++; - n--; - } - return s1; -} diff --git a/appl/ftp/common/snprintf.c b/appl/ftp/common/snprintf.c deleted file mode 100644 index 9d35de6b4..000000000 --- a/appl/ftp/common/snprintf.c +++ /dev/null @@ -1,18 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -RCSID("$Id$"); - -int snprintf(char *s, int n, char *fmt, ...) -{ - int ret; - va_list ap; - va_start(ap, fmt); - ret = vsprintf(s, fmt, ap); - va_end(ap); - return ret; -} diff --git a/appl/ftp/common/strerror.c b/appl/ftp/common/strerror.c deleted file mode 100644 index 517ac580c..000000000 --- a/appl/ftp/common/strerror.c +++ /dev/null @@ -1,21 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -RCSID("$Id$"); - -static char emsg[1024]; - -char* -strerror(int eno) -{ - if(eno < 0 || eno >= sys_nerr) - sprintf(emsg, "Error %d occurred.", eno); - else - strcpy(emsg, sys_errlist[eno]); - - return emsg; -} diff --git a/appl/ftp/common/verr.c b/appl/ftp/common/verr.c deleted file mode 100644 index 04fa0a37a..000000000 --- a/appl/ftp/common/verr.c +++ /dev/null @@ -1,22 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -verr(int eval, const char *fmt, va_list ap) -{ - int sverrno; - - sverrno = errno; - fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - vfprintf(stderr, fmt, ap); - fprintf(stderr, ": "); - } - fprintf(stderr, "%s\n", strerror(sverrno)); - exit(eval); -} diff --git a/appl/ftp/common/verrx.c b/appl/ftp/common/verrx.c deleted file mode 100644 index 001d25336..000000000 --- a/appl/ftp/common/verrx.c +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -verrx(int eval, const char *fmt, va_list ap) -{ - fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); - exit(eval); -} diff --git a/appl/ftp/common/vsyslog.c b/appl/ftp/common/vsyslog.c deleted file mode 100644 index 395d07b08..000000000 --- a/appl/ftp/common/vsyslog.c +++ /dev/null @@ -1,17 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#ifndef HAVE_VSYSLOG - -#include -#include - -void vsyslog(int pri, const char *fmt, va_list ap) -{ - char buf[10240]; - vsprintf(buf, fmt, ap); - syslog(pri, buf); -} - -#endif diff --git a/appl/ftp/common/vsyslog.h b/appl/ftp/common/vsyslog.h deleted file mode 100644 index fb0a10502..000000000 --- a/appl/ftp/common/vsyslog.h +++ /dev/null @@ -1,6 +0,0 @@ -#ifndef __VSYSLOG_H__ -#define __VSYSLOG_H__ - -void vsyslog(int pri, const char *fmt, va_list ap); - -#endif /* __VSYSLOG_H__ */ diff --git a/appl/ftp/common/vwarn.c b/appl/ftp/common/vwarn.c deleted file mode 100644 index f2effc3ee..000000000 --- a/appl/ftp/common/vwarn.c +++ /dev/null @@ -1,21 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -vwarn(const char *fmt, va_list ap) -{ - int sverrno; - - sverrno = errno; - fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) { - vfprintf(stderr, fmt, ap); - fprintf(stderr, ": "); - } - fprintf(stderr, "%s\n", strerror(sverrno)); -} diff --git a/appl/ftp/common/vwarnx.c b/appl/ftp/common/vwarnx.c deleted file mode 100644 index 9e58676de..000000000 --- a/appl/ftp/common/vwarnx.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -vwarnx(const char *fmt, va_list ap) -{ - fprintf(stderr, "%s: ", __progname); - if (fmt != NULL) - vfprintf(stderr, fmt, ap); - fprintf(stderr, "\n"); -} diff --git a/appl/ftp/common/warn.c b/appl/ftp/common/warn.c deleted file mode 100644 index dec5abf48..000000000 --- a/appl/ftp/common/warn.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -warn(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vwarn(fmt, ap); - va_end(ap); -} diff --git a/appl/ftp/common/warnx.c b/appl/ftp/common/warnx.c deleted file mode 100644 index ef8bfec2d..000000000 --- a/appl/ftp/common/warnx.c +++ /dev/null @@ -1,16 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "err.h" - -RCSID("$Id$"); - -void -warnx(const char *fmt, ...) -{ - va_list ap; - va_start(ap, fmt); - vwarnx(fmt, ap); - va_end(ap); -} diff --git a/appl/ftp/configure.in b/appl/ftp/configure.in index 1b7747db8..4d97137f1 100644 --- a/appl/ftp/configure.in +++ b/appl/ftp/configure.in @@ -22,13 +22,8 @@ AC_SUBST(LDFLAGS)dnl AC_CHECK_HEADERS(sys/select.h paths.h bsd/bsd.h) -AC_CHECK_LIB(socket, socket) -AC_CHECK_LIB(nsl, gethostbyname) -LDFLAGS="$LDFLAGS -L/usr/athena/lib" -AC_CHECK_LIB(des, des_encrypt) -AC_CHECK_LIB(krb, krb_mk_req) -AC_CHECK_LIB(kafs, k_afsklog) - +AC_FIND_FUNC(socket, socket) +AC_FIND_FUNC(gethostbyname, nsl) AC_MSG_CHECKING([for ut_host in utmp]) AC_CACHE_VAL(ac_cv_struct_ut_host, [ @@ -47,7 +42,7 @@ if test "$ac_cv_struct_ut_host" = "yes"; then fi -AC_CHECK_FUNCS(getcwd getdtablesize setproctitle) +AC_CHECK_FUNCS(getcwd setproctitle) if test "$ac_cv_func_getcwd" = yes; then AC_MSG_CHECKING(for broken getcwd) @@ -81,9 +76,6 @@ fi fi -AC_REPLACE_FUNCS(errx hstrerror inet_aton getusershell krb_get_err_text memmove snprintf strerror vsyslog verrx vwarn vwarnx warn warnx) - - AC_MSG_CHECKING([for __progname]) AC_CACHE_VAL(ac_cv_var___progname, [ AC_TRY_LINK([extern char *__progname;], [return strlen(__progname);], ac_cv_var___progname=yes, ac_cv_var___progname=no) @@ -93,4 +85,4 @@ if test "$ac_cv_var___progname" = "yes"; then AC_DEFINE(HAVE___PROGNAME, 1) fi -AC_OUTPUT(Makefile common/Makefile ftp/Makefile ftpd/Makefile) \ No newline at end of file +AC_OUTPUT(Makefile common/Makefile ftp/Makefile ftpd/Makefile) diff --git a/appl/ftp/ftp/Makefile.in b/appl/ftp/ftp/Makefile.in index 6c4c8996d..203058766 100644 --- a/appl/ftp/ftp/Makefile.in +++ b/appl/ftp/ftp/Makefile.in @@ -10,7 +10,6 @@ CC = @CC@ RANLIB = @RANLIB@ DEFS = @DEFS@ CFLAGS = @CFLAGS@ -LIBS = @LIBS@ INSTALL = @INSTALL@ @@ -19,6 +18,9 @@ exec_prefix = $(prefix) libdir = $(exec_prefix)/lib ATHENA = /usr/athena +LIBTOP = ../../../lib + +LIBS = $(LIBTOP)/krb/libkrb.a $(LIBTOP)/des/libdes.a $(LIBTOP)/broken/libbroken.a ftp_OBJS = cmds.o cmdtab.o ftp.o krb4.o main.o ruserpass.o domacro.o globals.o kauth.o diff --git a/appl/ftp/ftp/ftp_locl.h b/appl/ftp/ftp/ftp_locl.h index ea7de2f68..7dd61d8bd 100644 --- a/appl/ftp/ftp/ftp_locl.h +++ b/appl/ftp/ftp/ftp_locl.h @@ -26,6 +26,7 @@ extern int h_errno; #include #include #include +#include #include #include #include diff --git a/appl/ftp/ftpd/Makefile.in b/appl/ftp/ftpd/Makefile.in index f58b1c51a..17ac47ef8 100644 --- a/appl/ftp/ftpd/Makefile.in +++ b/appl/ftp/ftpd/Makefile.in @@ -19,8 +19,9 @@ libdir = $(exec_prefix)/lib ATHENA = /usr/athena -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ +LIBTOP = ../../../lib + +LIBS = ../common/libcommon.a $(LIBTOP)/kafs/libkafs.a $(LIBTOP)/krb/libkrb.a $(LIBTOP)/des/libdes.a $(LIBTOP)/broken/libbroken.a ftpd_OBJS = ftpd.o ftpcmd.o logwtmp.o popen.o auth.o krb4.o kauth.o klogin.o @@ -32,8 +33,8 @@ all: ftpd install: -ftpd: $(ftpd_OBJS) ../common/libcommon.a - $(CC) -o ftpd $(ftpd_OBJS) ../common/libcommon.a $(LDFLAGS) $(LIBS) +ftpd: $(ftpd_OBJS) $(LIBS) + $(CC) -o ftpd $(ftpd_OBJS) $(LIBS) ftpcmd.c: ftpcmd.y $(YACC) $(YFLAGS) $<