Import of kerberized ftp.
git-svn-id: svn://svn.h5l.se/heimdal/trunk/heimdal@419 ec53bebd-3082-4978-b11e-865c3cabbd6b
This commit is contained 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
|
||||
|
||||
|
@@ -1,15 +1,9 @@
|
||||
#ifndef __COMMON_H__
|
||||
#define __COMMON_H__
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdarg.h>
|
||||
|
||||
#include "vsyslog.h"
|
||||
|
||||
#include "err.h"
|
||||
#ifndef __COMMON_H__
|
||||
#define __COMMON_H__
|
||||
|
||||
#include "base64.h"
|
||||
|
||||
|
@@ -1,16 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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);
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
#ifndef __ERR_H__
|
||||
#define __ERR_H__
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
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__ */
|
@@ -1,16 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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);
|
||||
}
|
@@ -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 <config.h>
|
||||
#endif
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
#ifndef HAVE_GETUSERSHELL
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <paths.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/param.h>
|
||||
|
||||
#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 */
|
@@ -1,26 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_HSTRERROR
|
||||
|
||||
#include <stdio.h>
|
||||
#include <netdb.h>
|
||||
|
||||
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
|
||||
|
@@ -1,24 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <netinet/in.h>
|
||||
#include <netdb.h>
|
||||
|
||||
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;
|
||||
}
|
@@ -1,13 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <krb.h>
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
const char *
|
||||
krb_get_err_text(int n)
|
||||
{
|
||||
return krb_err_txt[n];
|
||||
}
|
@@ -1,33 +0,0 @@
|
||||
/*
|
||||
* memmove for systems that doesn't have it
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
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;
|
||||
}
|
@@ -1,18 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
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;
|
||||
}
|
@@ -1,21 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
|
||||
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;
|
||||
}
|
@@ -1,22 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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);
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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);
|
||||
}
|
@@ -1,17 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#ifndef HAVE_VSYSLOG
|
||||
|
||||
#include <syslog.h>
|
||||
#include <stdarg.h>
|
||||
|
||||
void vsyslog(int pri, const char *fmt, va_list ap)
|
||||
{
|
||||
char buf[10240];
|
||||
vsprintf(buf, fmt, ap);
|
||||
syslog(pri, buf);
|
||||
}
|
||||
|
||||
#endif
|
@@ -1,6 +0,0 @@
|
||||
#ifndef __VSYSLOG_H__
|
||||
#define __VSYSLOG_H__
|
||||
|
||||
void vsyslog(int pri, const char *fmt, va_list ap);
|
||||
|
||||
#endif /* __VSYSLOG_H__ */
|
@@ -1,21 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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));
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#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");
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "err.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
void
|
||||
warn(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vwarn(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include <config.h>
|
||||
#endif
|
||||
|
||||
#include "err.h"
|
||||
|
||||
RCSID("$Id$");
|
||||
|
||||
void
|
||||
warnx(const char *fmt, ...)
|
||||
{
|
||||
va_list ap;
|
||||
va_start(ap, fmt);
|
||||
vwarnx(fmt, ap);
|
||||
va_end(ap);
|
||||
}
|
@@ -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)
|
||||
|
@@ -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
|
||||
|
||||
|
@@ -26,6 +26,7 @@ extern int h_errno;
|
||||
#include <signal.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdarg.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
|
@@ -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) $<
|
||||
|
Reference in New Issue
Block a user