summaryrefslogtreecommitdiff
path: root/crypto/kerberosIV/appl
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/kerberosIV/appl')
-rw-r--r--crypto/kerberosIV/appl/afsutil/Makefile.in89
-rw-r--r--crypto/kerberosIV/appl/afsutil/aklog.c234
-rw-r--r--crypto/kerberosIV/appl/afsutil/kstring2key.c138
-rw-r--r--crypto/kerberosIV/appl/afsutil/pagsh.c136
-rw-r--r--crypto/kerberosIV/appl/bsd/osfc2.c79
-rw-r--r--crypto/kerberosIV/appl/ftp/ChangeLog376
-rw-r--r--crypto/kerberosIV/appl/ftp/Makefile.am5
-rw-r--r--crypto/kerberosIV/appl/ftp/common/Makefile.am12
-rw-r--r--crypto/kerberosIV/appl/ftp/ftp/Makefile.am44
-rw-r--r--crypto/kerberosIV/appl/ftp/ftp/gssapi.c379
-rw-r--r--crypto/kerberosIV/appl/ftp/ftp/security.c785
-rw-r--r--crypto/kerberosIV/appl/ftp/ftp/security.h131
-rw-r--r--crypto/kerberosIV/appl/ftp/ftpd/Makefile.am54
-rw-r--r--crypto/kerberosIV/appl/ftp/ftpd/ftpd_locl.h170
-rw-r--r--crypto/kerberosIV/appl/ftp/ftpd/gss_userok.c69
-rw-r--r--crypto/kerberosIV/appl/ftp/ftpd/ls.c572
-rw-r--r--crypto/kerberosIV/appl/kauth/ChangeLog30
-rw-r--r--crypto/kerberosIV/appl/kauth/Makefile.am42
-rw-r--r--crypto/kerberosIV/appl/push/ChangeLog135
-rw-r--r--crypto/kerberosIV/appl/push/Makefile.am27
-rw-r--r--crypto/kerberosIV/appl/push/Makefile.in95
-rw-r--r--crypto/kerberosIV/appl/push/pfrom.in6
-rw-r--r--crypto/kerberosIV/appl/push/push.8138
-rw-r--r--crypto/kerberosIV/appl/push/push.c795
-rw-r--r--crypto/kerberosIV/appl/push/push.cat877
-rw-r--r--crypto/kerberosIV/appl/push/push_locl.h98
-rw-r--r--crypto/kerberosIV/appl/sample/Makefile.in83
-rw-r--r--crypto/kerberosIV/appl/sample/sample.h76
-rw-r--r--crypto/kerberosIV/appl/sample/sample_client.c168
-rw-r--r--crypto/kerberosIV/appl/sample/sample_server.c153
-rw-r--r--crypto/kerberosIV/appl/sample/simple.h14
-rw-r--r--crypto/kerberosIV/appl/sample/simple_client.c202
-rw-r--r--crypto/kerberosIV/appl/sample/simple_server.c140
33 files changed, 0 insertions, 5552 deletions
diff --git a/crypto/kerberosIV/appl/afsutil/Makefile.in b/crypto/kerberosIV/appl/afsutil/Makefile.in
deleted file mode 100644
index 86adb88b51088..0000000000000
--- a/crypto/kerberosIV/appl/afsutil/Makefile.in
+++ /dev/null
@@ -1,89 +0,0 @@
-# $Id: Makefile.in,v 1.27 1999/03/10 19:01:10 joda Exp $
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-top_builddir = ../..
-
-CC = @CC@
-LINK = @LINK@
-AR = ar
-RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@ $(WFLAGS)
-WFLAGS = @WFLAGS@
-LD_FLAGS= @LD_FLAGS@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-LIBROKEN = -L../../lib/roken -lroken
-LIBS = @KRB_KAFS_LIB@ -L../../lib/krb -lkrb -L../../lib/des -ldes $(LIBROKEN) @LIBS@ $(LIBROKEN)
-MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-libexecdir = @libexecdir@
-bindir = @bindir@
-transform=@program_transform_name@
-EXECSUFFIX=@EXECSUFFIX@
-
-PROG_BIN = pagsh$(EXECSUFFIX) \
- afslog$(EXECSUFFIX) \
- kstring2key$(EXECSUFFIX)
-PROG_LIBEXEC =
-PROGS = $(PROG_BIN) $(PROG_LIBEXEC)
-
-SOURCES = pagsh.c aklog.c kstring2key.c
-
-OBJECTS = pagsh.o aklog.o kstring2key.o
-
-all: $(PROGS)
-
-Wall:
- make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
-
-.c.o:
- $(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
-
-install: all
- $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
- for x in $(PROG_BIN); do \
- $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
- done
-
-uninstall:
- for x in $(PROG_BIN); do \
- rm -f $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
- done
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-clean:
- rm -f *.a *.o $(PROGS)
-
-mostlyclean: clean
-
-distclean: clean
- rm -f Makefile *.tab.c *~
-
-realclean: distclean
- rm -f TAGS
-
-pagsh$(EXECSUFFIX): pagsh.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ pagsh.o $(LIBS)
-
-afslog$(EXECSUFFIX): aklog.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ aklog.o $(LIBS)
-
-kstring2key$(EXECSUFFIX): kstring2key.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ kstring2key.o $(LIBS)
-
-
-$(OBJECTS): ../../include/config.h
-
-.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/appl/afsutil/aklog.c b/crypto/kerberosIV/appl/afsutil/aklog.c
deleted file mode 100644
index 22dbfe7b2f858..0000000000000
--- a/crypto/kerberosIV/appl/afsutil/aklog.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/*
- * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <ctype.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_IOCCOM_H
-#include <sys/ioccom.h>
-#endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#include <err.h>
-#include <krb.h>
-#include <kafs.h>
-
-#include <roken.h>
-
-RCSID("$Id: aklog.c,v 1.24 1999/12/02 16:58:28 joda Exp $");
-
-static int debug = 0;
-
-static void
-DEBUG(const char *, ...)
-#ifdef __GNUC__
-__attribute__ ((format (printf, 1, 2)))
-#endif
-;
-
-static void
-DEBUG(const char *fmt, ...)
-{
- va_list ap;
- if (debug) {
- va_start(ap, fmt);
- vwarnx(fmt, ap);
- va_end(ap);
- }
-}
-
-static char *
-expand_cell_name(char *cell)
-{
- FILE *f;
- static char buf[128];
- char *p;
-
- f = fopen(_PATH_CELLSERVDB, "r");
- if(f == NULL)
- return cell;
- while(fgets(buf, sizeof(buf), f) != NULL) {
- if(buf[0] == '>') {
- for(p=buf; *p && !isspace(*p) && *p != '#'; p++)
- ;
- *p = '\0';
- if(strstr(buf, cell)){
- fclose(f);
- return buf + 1;
- }
- }
- buf[0] = 0;
- }
- fclose(f);
- return cell;
-}
-
-static int
-createuser (char *cell)
-{
- char cellbuf[64];
- char name[ANAME_SZ];
- char instance[INST_SZ];
- char realm[REALM_SZ];
- char cmd[1024];
-
- if (cell == NULL) {
- FILE *f;
- int len;
-
- f = fopen (_PATH_THISCELL, "r");
- if (f == NULL)
- err (1, "open(%s)", _PATH_THISCELL);
- if (fgets (cellbuf, sizeof(cellbuf), f) == NULL)
- err (1, "read cellname from %s", _PATH_THISCELL);
- fclose (f);
- len = strlen(cellbuf);
- if (cellbuf[len-1] == '\n')
- cellbuf[len-1] = '\0';
- cell = cellbuf;
- }
-
- if(krb_get_default_principal(name, instance, realm))
- errx (1, "Could not even figure out who you are");
-
- snprintf (cmd, sizeof(cmd),
- "pts createuser %s%s%s@%s -cell %s",
- name, *instance ? "." : "", instance, strlwr(realm),
- cell);
- DEBUG("Executing %s", cmd);
- return system(cmd);
-}
-
-int
-main(int argc, char **argv)
-{
- int i;
- int do_aklog = -1;
- int do_createuser = -1;
- char *cell = NULL;
- char *realm = NULL;
- char cellbuf[64];
-
- set_progname (argv[0]);
-
- if(!k_hasafs())
- exit(1);
-
- for(i = 1; i < argc; i++){
- if(!strncmp(argv[i], "-createuser", 11)){
- do_createuser = do_aklog = 1;
-
- }else if(!strncmp(argv[i], "-c", 2) && i + 1 < argc){
- cell = expand_cell_name(argv[++i]);
- do_aklog = 1;
-
- }else if(!strncmp(argv[i], "-k", 2) && i + 1 < argc){
- realm = argv[++i];
-
- }else if(!strncmp(argv[i], "-p", 2) && i + 1 < argc){
- if(k_afs_cell_of_file(argv[++i], cellbuf, sizeof(cellbuf)))
- errx (1, "No cell found for file \"%s\".", argv[i]);
- else
- cell = cellbuf;
- do_aklog = 1;
-
- }else if(!strncmp(argv[i], "-unlog", 6)){
- exit(k_unlog());
-
- }else if(!strncmp(argv[i], "-hosts", 6)){
- warnx ("Argument -hosts is not implemented.");
-
- }else if(!strncmp(argv[i], "-zsubs", 6)){
- warnx("Argument -zsubs is not implemented.");
-
- }else if(!strncmp(argv[i], "-noprdb", 6)){
- warnx("Argument -noprdb is not implemented.");
-
- }else if(!strncmp(argv[i], "-d", 6)){
- debug = 1;
-
- }else{
- if(!strcmp(argv[i], ".") ||
- !strcmp(argv[i], "..") ||
- strchr(argv[i], '/')){
- DEBUG("I guess that \"%s\" is a filename.", argv[i]);
- if(k_afs_cell_of_file(argv[i], cellbuf, sizeof(cellbuf)))
- errx (1, "No cell found for file \"%s\".", argv[i]);
- else {
- cell = cellbuf;
- DEBUG("The file \"%s\" lives in cell \"%s\".", argv[i], cell);
- }
- }else{
- cell = expand_cell_name(argv[i]);
- DEBUG("I guess that %s is cell %s.", argv[i], cell);
- }
- do_aklog = 1;
- }
- if(do_aklog == 1){
- do_aklog = 0;
- if(krb_afslog(cell, realm))
- errx (1, "Failed getting tokens for cell %s in realm %s.",
- cell?cell:"(local cell)", realm?realm:"(local realm)");
- }
- if(do_createuser == 1) {
- do_createuser = 0;
- if(createuser(cell))
- errx (1, "Failed creating user in cell %s", cell?cell:"(local cell)");
- }
- }
- if(do_aklog == -1 && do_createuser == -1 && krb_afslog(0, realm))
- errx (1, "Failed getting tokens for cell %s in realm %s.",
- cell?cell:"(local cell)", realm?realm:"(local realm)");
- return 0;
-}
diff --git a/crypto/kerberosIV/appl/afsutil/kstring2key.c b/crypto/kerberosIV/appl/afsutil/kstring2key.c
deleted file mode 100644
index 70246f90a66ad..0000000000000
--- a/crypto/kerberosIV/appl/afsutil/kstring2key.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-/* $FreeBSD$ */
-
-#include "config.h"
-
-RCSID("$Id: kstring2key.c,v 1.16 1999/12/02 16:58:28 joda Exp $");
-
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
-#include <err.h>
-
-#include <roken.h>
-
-#include <openssl/des.h>
-#include <krb.h>
-
-#define VERIFY 0
-
-static void
-usage(void)
-{
- fprintf(stderr,
- "Usage: %s [-c AFS cellname] [ -5 krb5salt ] [ password ]\n",
- __progname);
- fprintf(stderr,
- " krb5salt is realmname APPEND principal APPEND instance\n");
- exit(1);
-}
-
-static
-void
-krb5_string_to_key(char *str,
- char *salt,
- des_cblock *key)
-{
- char *foo;
-
- asprintf(&foo, "%s%s", str, salt);
- if (foo == NULL)
- errx (1, "malloc: out of memory");
- des_string_to_key(foo, key);
- free (foo);
-}
-
-
-int
-main(int argc, char **argv)
-{
- des_cblock key;
- char buf[1024];
- char *cellname = 0, *salt = 0;
-
- set_progname (argv[0]);
-
- if (argc >= 3 && argv[1][0] == '-' && argv[1][1] == 'c')
- {
- cellname = argv[2];
- argv += 2;
- argc -= 2;
- }
- else if (argc >= 3 && argv[1][0] == '-' && argv[1][1] == '5')
- {
- salt = argv[2];
- argv += 2;
- argc -= 2;
- }
- if (argc >= 2 && argv[1][0] == '-')
- usage();
-
- switch (argc) {
- case 1:
- if (des_read_pw_string(buf, sizeof(buf)-1, "password: ", VERIFY))
- errx (1, "Error reading password.");
- break;
- case 2:
- strlcpy(buf, argv[1], sizeof(buf));
- break;
- default:
- usage();
- break;
- }
-
- if (cellname != 0)
- afs_string_to_key(buf, cellname, &key);
- else if (salt != 0)
- krb5_string_to_key(buf, salt, &key);
- else
- des_string_to_key(buf, &key);
-
- {
- int j;
- unsigned char *tkey = (unsigned char *) &key;
- printf("ascii = ");
- for(j = 0; j < 8; j++)
- if(tkey[j] != '\\' && isalpha(tkey[j]) != 0)
- printf("%c", tkey[j]);
- else
- printf("\\%03o",(unsigned char)tkey[j]);
- printf("\n");
- printf("hex = ");
- for(j = 0; j < 8; j++)
- printf("%02x",(unsigned char)tkey[j]);
- printf("\n");
- }
- exit(0);
-}
diff --git a/crypto/kerberosIV/appl/afsutil/pagsh.c b/crypto/kerberosIV/appl/afsutil/pagsh.c
deleted file mode 100644
index c6704bed451de..0000000000000
--- a/crypto/kerberosIV/appl/afsutil/pagsh.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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: pagsh.c,v 1.22 1999/12/02 16:58:28 joda Exp $");
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <time.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-
-#include <err.h>
-#include <roken.h>
-
-#include <krb.h>
-#include <kafs.h>
-
-int
-main(int argc, char **argv)
-{
- int f;
- char tf[1024];
- char *p;
-
- char *path;
- char **args;
- int i;
-
- do {
- snprintf(tf, sizeof(tf), "%s%u_%u", TKT_ROOT, (unsigned int)getuid(),
- (unsigned int)(getpid()*time(0)));
- f = open(tf, O_CREAT|O_EXCL|O_RDWR);
- } while(f < 0);
- close(f);
- unlink(tf);
- setenv("KRBTKFILE", tf, 1);
-
- i = 0;
-
- args = (char **) malloc((argc + 10)*sizeof(char *));
- if (args == NULL)
- errx (1, "Out of memory allocating %lu bytes",
- (unsigned long)((argc + 10)*sizeof(char *)));
-
- argv++;
-
- if(*argv == NULL) {
- path = getenv("SHELL");
- if(path == NULL){
- struct passwd *pw = k_getpwuid(geteuid());
- path = strdup(pw->pw_shell);
- }
- } else {
- if(strcmp(*argv, "-c") == 0) argv++;
- path = strdup(*argv++);
- }
- if (path == NULL)
- errx (1, "Out of memory copying path");
-
- p=strrchr(path, '/');
- if(p)
- args[i] = strdup(p+1);
- else
- args[i] = strdup(path);
-
- if (args[i++] == NULL)
- errx (1, "Out of memory copying arguments");
-
- while(*argv)
- args[i++] = *argv++;
-
- args[i++] = NULL;
-
- if(k_hasafs())
- k_setpag();
-
- execvp(path, args);
- if (errno == ENOENT) {
- char **sh_args = malloc ((i + 2) * sizeof(char *));
- int j;
-
- if (sh_args == NULL)
- errx (1, "Out of memory copying sh arguments");
- for (j = 1; j < i; ++j)
- sh_args[j + 2] = args[j];
- sh_args[0] = "sh";
- sh_args[1] = "-c";
- sh_args[2] = path;
- execv ("/bin/sh", sh_args);
- }
- perror("execvp");
- exit(1);
-}
diff --git a/crypto/kerberosIV/appl/bsd/osfc2.c b/crypto/kerberosIV/appl/bsd/osfc2.c
deleted file mode 100644
index fbfd742e92243..0000000000000
--- a/crypto/kerberosIV/appl/bsd/osfc2.c
+++ /dev/null
@@ -1,79 +0,0 @@
-/*
- * Copyright (c) 1998 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-#include "bsd_locl.h"
-RCSID("$Id: osfc2.c,v 1.2 1999/12/02 16:58:28 joda Exp $");
-
-int
-do_osfc2_magic(uid_t uid)
-{
-#ifdef HAVE_OSFC2
- struct es_passwd *epw;
- char *argv[2];
-
- /* fake */
- argv[0] = (char*)__progname;
- argv[1] = NULL;
- set_auth_parameters(1, argv);
-
- epw = getespwuid(uid);
- if(epw == NULL) {
- syslog(LOG_AUTHPRIV|LOG_NOTICE,
- "getespwuid failed for %d", uid);
- printf("Sorry.\n");
- return 1;
- }
- /* We don't check for auto-retired, foo-retired,
- bar-retired, or any other kind of retired accounts
- here; neither do we check for time-locked accounts, or
- any other kind of serious C2 mumbo-jumbo. We do,
- however, call setluid, since failing to do so it not
- very good (take my word for it). */
-
- if(!epw->uflg->fg_uid) {
- syslog(LOG_AUTHPRIV|LOG_NOTICE,
- "attempted login by %s (has no uid)", epw->ufld->fd_name);
- printf("Sorry.\n");
- return 1;
- }
- setluid(epw->ufld->fd_uid);
- if(getluid() != epw->ufld->fd_uid) {
- syslog(LOG_AUTHPRIV|LOG_NOTICE,
- "failed to set LUID for %s (%d)",
- epw->ufld->fd_name, epw->ufld->fd_uid);
- printf("Sorry.\n");
- return 1;
- }
-#endif /* HAVE_OSFC2 */
- return 0;
-}
diff --git a/crypto/kerberosIV/appl/ftp/ChangeLog b/crypto/kerberosIV/appl/ftp/ChangeLog
deleted file mode 100644
index e2e1bb5f4dfa5..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ChangeLog
+++ /dev/null
@@ -1,376 +0,0 @@
-1999-11-30 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (getdatasock): make sure to keep the port-number of
- the outgoing connections. It has to be `ftp-data' or some people
- might get upset.
-
- * ftpd/ftpd.c (args): set correct variable when `-l' so that
- logging actually works
-
-1999-11-29 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (sec_login): check return value from realloc
- (sec_end): set app_data to NULL
-
-1999-11-25 Assar Westerlund <assar@sics.se>
-
- * ftp/krb4.c (krb4_auth): obtain the `local' address when doing
- NAT. also turn on passive mode. From <thn@stacken.kth.se>
-
-1999-11-20 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (make_fileinfo): cast to allow for non-const
- prototypes of readlink
-
-1999-11-12 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (args): use arg_counter for `l'
-
-1999-11-04 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (S_ISSOCK, S_ISLNK): fallback definitions for systems
- that don't have them (such as ultrix)
-
-1999-10-29 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (make_fileinfo): cast uid's and gid's to unsigned in
- printf, we don't know what types they might be.
- (lstat_file): conditionalize the kafs part on KRB4
-
- * ftpd/ftpd_locl.h: <sys/ioccom.h> is needed for kafs.h
-
-1999-10-28 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c (lstat_file): don't set st_mode, it should already be
- correct
-
- * ftpd/ls.c: don't use warnx to print errors
-
- * ftpd/ls.c (builtin_ls): fix typo, 'd' shouldn't imply 'f'
-
- * ftpd/ls.c (lstat_file): new function for avoiding stating AFS
- mount points. From Love <lha@s3.kth.se>
- (list_files): use `lstat_file'
-
- * ftpd/ftpd.c: some const-poisoning
-
- * ftpd/ftpd.c (args): add `-B' as an alias for `--builtin-ls' to
- allow for stupid inetds that only support two arguments. From
- Love <lha@s3.kth.se>
-
-1999-10-26 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y (help): it's unnecessary to interpret help strings
- as printf commands
-
- * ftpd/ftpd.c (show_issue): don't interpret contents of
- /etc/issue* as printf commands. From Brian A May
- <bmay@dgs.monash.edu.au>
-
-1999-10-21 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/kauth.c (kauth): complain if protection level isn't
- `private'
-
- * ftp/krb4.c (krb4_decode): syslog failure reason
-
- * ftp/kauth.c (kauth): set private level earlier
-
- * ftp/security.c: get_command_prot; (sec_prot): partially match
- `command' and `data'
-
-1999-10-18 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c: change `-l' flag to use arg_collect (this makes
- `-ll' work again)
-
- * ftpd/ftpd.c (list_file): pass filename to ls
-
-1999-10-04 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: FEAT
-
-1999-10-03 Assar Westerlund <assar@sics.se>
-
- * ftpd/ls.c: fall-back definitions for constans and casts for
- printfs
-
-1999-10-03 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (main): make this use getarg; add `list_file'
-
- * ftpd/ftpcmd.y (LIST): call list_file
-
- * ftpd/ls.c: add simple built-in ls
-
- * ftp/security.c: add `sec_vfprintf2' and `sec_fprintf2' that
- prints to the data stream
-
- * ftp/kauth.c (kauth): make sure we're using private protection
- level
-
- * ftp/security.c (set_command_prot): set command protection level
-
- * ftp/security.c: make it possible to set the command protection
- level with `prot'
-
-1999-09-30 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd_locl.h: add prototype for fclose to make sunos happy
-
-1999-08-19 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpd.c (do_login): show issue-file
- (send_data): change handling of zero-byte files
-
-1999-08-18 Assar Westerlund <assar@sics.se>
-
- * ftp/cmds.c (getit): be more suspicious when parsing the result
- of MDTM. Do the comparison of timestamps correctly.
-
-1999-08-13 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (send_data): avoid calling mmap with `len == 0'.
- Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
- get grumpy later.
-
- * ftp/ftp.c (copy_stream): avoid calling mmap with `len == 0'.
- Some mmap:s rather dislike that (Solaris) and some munmap (Linux)
- get grumpy later.
-
-1999-08-03 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (active_mode): hide failure of EPRT by setting verbose
-
- * ftp/gssapi.c (gss_auth): initialize application_data in bindings
-
-1999-08-02 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: save file names when doing commands that might
- get aborted (and longjmp:ed out of) to avoid overwriting them also
- remove extra closing brace
-
-1999-08-01 Johan Danielsson <joda@pdc.kth.se>
-
- * ftpd/ftpcmd.y: change `site find' to `site locate' (to match
- what it does, and other implementations) keep find as an alias
-
-1999-07-28 Assar Westerlund <assar@sics.se>
-
- * common/socket.c: moved to roken
-
- * common/socket.c: new file with generic socket functions
-
- * ftpd/ftpd.c: make it more AF-neutral and v6-capable
-
- * ftpd/ftpcmd.y: add EPRT and EPSV
-
- * ftpd/extern.h: update prototypes and variables
-
- * ftp/krb4.c: update to new types of addresses
-
- * ftp/gssapi.c: add support for both AF_INET and AF_INET6
- addresses
-
- * ftp/ftp.c: make it more AF-neutral and v6-capable
-
- * ftp/extern.h (hookup): change prototype
-
- * common/common.h: add prototypes for functions in socket.c
-
- * common/Makefile.am (libcommon_a_SOURCES): add socket.c
-
- * ftp/gssapi.c (gss_auth): check return value from
- `gss_import_name' and print error messages if it fails
-
-1999-06-15 Assar Westerlund <assar@sics.se>
-
- * ftp/krb4.c (krb4_auth): type correctness
-
-1999-06-02 Johan Danielsson <joda@pdc.kth.se>
-
- * ftp/ftp.c (sendrequest): lmode != rmode
-
-1999-05-21 Assar Westerlund <assar@sics.se>
-
- * ftp/extern.h (sendrequest): update prototype
-
- * ftp/cmds.c: update calls to sendrequest and recvrequest to send
- "b" when appropriate
-
- * ftp/ftp.c (sendrequest): add argument for mode to open file in.
-
-1999-05-08 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: rename getline -> ftpd_getline
-
- * ftp/main.c (makeargv): fill in unused slots with NULL
-
-Thu Apr 8 15:06:40 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd.c: remove definition of KRB_VERIFY_USER (moved to
- config.h)
-
-Wed Apr 7 16:15:21 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftp/gssapi.c (gss_auth): call gss_display_status to get a sane
- error message; return AUTH_{CONTINUE,ERROR}, where appropriate
-
- * ftp/krb4.c: return AUTH_{CONTINUE,ERROR}, where appropriate
-
- * ftp/security.c (sec_login): if mechanism returns AUTH_CONTINUE,
- just continue with the next mechanism, this fixes the case of
- having GSSAPI fail because of non-existant of expired tickets
-
- * ftp/security.h: add AUTH_{OK,CONTINUE,ERROR}
-
-Thu Apr 1 16:59:04 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: don't run check-local
-
- * ftp/Makefile.am: don't run check-local
-
-Mon Mar 22 22:15:18 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (pass): fall-back for KRB_VERIFY_SECURE
-
- * ftpd/ftpd.c (pass): 1 -> KRB_VERIFY_SECURE
-
-Thu Mar 18 12:07:09 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: clean ftpcmd.c
-
- * ftpd/ftpd_locl.h: remove krb5.h (breaks in ftpcmd.y)
-
- * ftpd/ftpd.c: move include of krb5.h here
-
- * ftpd/Makefile.am: include Makefile.am.common
-
- * Makefile.am: include Makefile.am.common
-
- * ftp/Makefile.am: include Makefile.am.common
-
- * common/Makefile.am: include Makefile.am.common
-
-Tue Mar 16 22:28:37 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd_locl.h: add krb5.h to get heimdal_version
-
- * ftpd/ftpd.c: krb_verify_user_multiple -> krb_verify_user
-
-Thu Mar 11 14:54:59 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftp/Makefile.in: WFLAGS
-
- * ftp/ruserpass.c: add some if-braces
-
-Wed Mar 10 20:02:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd_locl.h: remove ifdef HAVE_FNMATCH
-
-Mon Mar 8 21:29:24 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/ftpd.c: re-add version in greeting message
-
-Mon Mar 1 10:49:38 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/logwtmp.c: HAVE_UT_* -> HAVE_STRUCT_UTMP*_UT_*
-
-Mon Feb 22 19:20:51 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * common/Makefile.in: remove glob
-
-Sat Feb 13 17:19:35 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (match): remove #ifdef HAVE_FNMATCH. We have a
- fnmatch implementation in roken and therefore always have it.
-
- * ftp/ftp.c (copy_stream): initialize `werr'
-
-Wed Jan 13 23:52:57 1999 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpcmd.y: moved all check_login and check_login_no_guest to
- the end of the rules to ensure we don't generate several
- (independent) error messages. once again, having a yacc-grammar
- for FTP with embedded actions doesn't strike me as the most
- optimal way of doing it.
-
-Tue Dec 1 14:44:29 1998 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * ftpd/Makefile.am: link with extra libs for aix
-
-Sun Nov 22 10:28:20 1998 Assar Westerlund <assar@sics.se>
-
- * ftpd/ftpd.c (retrying): support on-the-fly decompression
-
- * ftpd/Makefile.in (WFLAGS): set
-
- * ftp/ruserpass.c (guess_domain): new function
- (ruserpass): use it
-
- * common/Makefile.in (WFLAGS): set
-
- * Makefile.in (WFLAGS): set
-
-Sat Nov 21 23:13:03 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c: some more type correctness.
-
- * ftp/gssapi.c (gss_adat): more braces to shut up warnings
-
-Wed Nov 18 21:47:55 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/main.c (main): new option `-p' for enable passive mode.
-
-Mon Nov 2 01:57:49 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c (getreply): remove extra `break'
-
- * ftp/gssapi.c (gss_auth): fixo typo(copyo?)
-
- * ftp/security.c (sec_login): fix loop and return value
-
-Tue Sep 1 16:56:42 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/cmds.c (quote1): fix % quoting bug
-
-Fri Aug 14 17:10:06 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/krb4.c: krb_put_int -> KRB_PUT_INT
-
-Tue Jun 30 18:07:15 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/security.c (auth): free `app_data'
- (sec_end): only destroy if it was initialized
-
-Tue Jun 9 21:01:59 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/krb4.c: pass client address to krb_rd_req
-
-Sat May 16 00:02:07 1998 Assar Westerlund <assar@sics.se>
-
- * ftpd/Makefile.am: link with DBLIB
-
-Tue May 12 14:15:32 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/gssapi.c: Save client name for userok().
-
- * ftpd/gss_userok.c: Userok for gssapi.
-
-Fri May 1 07:15:01 1998 Assar Westerlund <assar@sics.se>
-
- * ftp/ftp.c: unifdef -DHAVE_H_ERRNO
-
-Fri Mar 27 00:46:07 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * Make compile w/o krb4.
-
-Thu Mar 26 03:49:12 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * ftp/*, ftpd/*: Changes for new framework.
-
- * ftp/gssapi.c: GSS-API backend for the new security framework.
-
- * ftp/krb4.c: Updated for new framework.
-
- * ftp/security.{c,h}: New unified security framework.
diff --git a/crypto/kerberosIV/appl/ftp/Makefile.am b/crypto/kerberosIV/appl/ftp/Makefile.am
deleted file mode 100644
index f8831a308d037..0000000000000
--- a/crypto/kerberosIV/appl/ftp/Makefile.am
+++ /dev/null
@@ -1,5 +0,0 @@
-# $Id: Makefile.am,v 1.5 1999/03/20 13:58:14 joda Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-SUBDIRS = common ftp ftpd
diff --git a/crypto/kerberosIV/appl/ftp/common/Makefile.am b/crypto/kerberosIV/appl/ftp/common/Makefile.am
deleted file mode 100644
index 4fab07b9a1ae4..0000000000000
--- a/crypto/kerberosIV/appl/ftp/common/Makefile.am
+++ /dev/null
@@ -1,12 +0,0 @@
-# $Id: Makefile.am,v 1.9 1999/07/28 21:15:06 assar Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += $(INCLUDE_krb4)
-
-noinst_LIBRARIES = libcommon.a
-
-libcommon_a_SOURCES = \
- sockbuf.c \
- buffer.c \
- common.h
diff --git a/crypto/kerberosIV/appl/ftp/ftp/Makefile.am b/crypto/kerberosIV/appl/ftp/ftp/Makefile.am
deleted file mode 100644
index 081465a504169..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftp/Makefile.am
+++ /dev/null
@@ -1,44 +0,0 @@
-# $Id: Makefile.am,v 1.12 1999/04/09 18:22:08 assar Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += -I$(srcdir)/../common $(INCLUDE_readline) $(INCLUDE_krb4)
-
-bin_PROGRAMS = ftp
-
-CHECK_LOCAL =
-
-if KRB4
-krb4_sources = krb4.c kauth.c
-endif
-if KRB5
-krb5_sources = gssapi.c
-endif
-
-ftp_SOURCES = \
- cmds.c \
- cmdtab.c \
- extern.h \
- ftp.c \
- ftp_locl.h \
- ftp_var.h \
- main.c \
- pathnames.h \
- ruserpass.c \
- domacro.c \
- globals.c \
- security.c \
- security.h \
- $(krb4_sources) \
- $(krb5_sources)
-
-EXTRA_ftp_SOURCES = krb4.c kauth.c gssapi.c
-
-LDADD = \
- ../common/libcommon.a \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_krb4) \
- $(top_builddir)/lib/des/libdes.la \
- $(LIB_roken) \
- $(LIB_readline)
diff --git a/crypto/kerberosIV/appl/ftp/ftp/gssapi.c b/crypto/kerberosIV/appl/ftp/ftp/gssapi.c
deleted file mode 100644
index d06b5d62d29d8..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftp/gssapi.c
+++ /dev/null
@@ -1,379 +0,0 @@
-/*
- * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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 FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-#include <gssapi.h>
-
-RCSID("$Id: gssapi.c,v 1.13 1999/12/02 16:58:29 joda Exp $");
-
-struct gss_data {
- gss_ctx_id_t context_hdl;
- char *client_name;
-};
-
-static int
-gss_init(void *app_data)
-{
- struct gss_data *d = app_data;
- d->context_hdl = GSS_C_NO_CONTEXT;
- return 0;
-}
-
-static int
-gss_check_prot(void *app_data, int level)
-{
- if(level == prot_confidential)
- return -1;
- return 0;
-}
-
-static int
-gss_decode(void *app_data, void *buf, int len, int level)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- gss_qop_t qop_state;
- int conf_state;
- struct gss_data *d = app_data;
-
- input.length = len;
- input.value = buf;
- maj_stat = gss_unwrap (&min_stat,
- d->context_hdl,
- &input,
- &output,
- &conf_state,
- &qop_state);
- if(GSS_ERROR(maj_stat))
- return -1;
- memmove(buf, output.value, output.length);
- return output.length;
-}
-
-static int
-gss_overhead(void *app_data, int level, int len)
-{
- return 100; /* dunno? */
-}
-
-
-static int
-gss_encode(void *app_data, void *from, int length, int level, void **to)
-{
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc input, output;
- int conf_state;
- struct gss_data *d = app_data;
-
- input.length = length;
- input.value = from;
- maj_stat = gss_wrap (&min_stat,
- d->context_hdl,
- level == prot_private,
- GSS_C_QOP_DEFAULT,
- &input,
- &conf_state,
- &output);
- *to = output.value;
- return output.length;
-}
-
-static void
-sockaddr_to_gss_address (const struct sockaddr *sa,
- OM_uint32 *addr_type,
- gss_buffer_desc *gss_addr)
-{
- switch (sa->sa_family) {
-#ifdef HAVE_IPV6
- case AF_INET6 : {
- struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)sa;
-
- gss_addr->length = 16;
- gss_addr->value = &sin6->sin6_addr;
- *addr_type = GSS_C_AF_INET6;
- break;
- }
-#endif
- case AF_INET : {
- struct sockaddr_in *sin = (struct sockaddr_in *)sa;
-
- gss_addr->length = 4;
- gss_addr->value = &sin->sin_addr;
- *addr_type = GSS_C_AF_INET;
- break;
- }
- default :
- errx (1, "unknown address family %d", sa->sa_family);
-
- }
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-static int
-gss_adat(void *app_data, void *buf, size_t len)
-{
- char *p = NULL;
- gss_buffer_desc input_token, output_token;
- OM_uint32 maj_stat, min_stat;
- gss_name_t client_name;
- struct gss_data *d = app_data;
-
- gss_channel_bindings_t bindings = malloc(sizeof(*bindings));
- sockaddr_to_gss_address (his_addr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (ctrl_addr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
-
- input_token.value = buf;
- input_token.length = len;
-
- maj_stat = gss_accept_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_CREDENTIAL,
- &input_token,
- bindings,
- &client_name,
- NULL,
- &output_token,
- NULL,
- NULL,
- NULL);
-
- if(output_token.length) {
- if(base64_encode(output_token.value, output_token.length, &p) < 0) {
- reply(535, "Out of memory base64-encoding.");
- return -1;
- }
- }
- if(maj_stat == GSS_S_COMPLETE){
- char *name;
- gss_buffer_desc export_name;
- maj_stat = gss_export_name(&min_stat, client_name, &export_name);
- if(maj_stat != 0) {
- reply(500, "Error exporting name");
- goto out;
- }
- name = realloc(export_name.value, export_name.length + 1);
- if(name == NULL) {
- reply(500, "Out of memory");
- free(export_name.value);
- goto out;
- }
- name[export_name.length] = '\0';
- d->client_name = name;
- if(p)
- reply(235, "ADAT=%s", p);
- else
- reply(235, "ADAT Complete");
- sec_complete = 1;
-
- } else if(maj_stat == GSS_S_CONTINUE_NEEDED) {
- if(p)
- reply(335, "ADAT=%s", p);
- else
- reply(335, "OK, need more data");
- } else
- reply(535, "foo?");
-out:
- free(p);
- return 0;
-}
-
-int gss_userok(void*, char*);
-
-struct sec_server_mech gss_server_mech = {
- "GSSAPI",
- sizeof(struct gss_data),
- gss_init, /* init */
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
- /* */
- NULL,
- gss_adat,
- NULL, /* pbsz */
- NULL, /* ccc */
- gss_userok
-};
-
-#else /* FTP_SERVER */
-
-extern struct sockaddr *hisctladdr, *myctladdr;
-
-static int
-gss_auth(void *app_data, char *host)
-{
-
- OM_uint32 maj_stat, min_stat;
- gss_buffer_desc name;
- gss_name_t target_name;
- gss_buffer_desc input, output_token;
- int context_established = 0;
- char *p;
- int n;
- gss_channel_bindings_t bindings;
- struct gss_data *d = app_data;
-
- name.length = asprintf((char**)&name.value, "ftp@%s", host);
- maj_stat = gss_import_name(&min_stat,
- &name,
- GSS_C_NT_HOSTBASED_SERVICE,
- &target_name);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error importing name %s: %s\n",
- (char *)name.value,
- (char *)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_ERROR;
- }
- free(name.value);
-
-
- input.length = 0;
- input.value = NULL;
-
- bindings = malloc(sizeof(*bindings));
-
- sockaddr_to_gss_address (myctladdr,
- &bindings->initiator_addrtype,
- &bindings->initiator_address);
- sockaddr_to_gss_address (hisctladdr,
- &bindings->acceptor_addrtype,
- &bindings->acceptor_address);
-
- bindings->application_data.length = 0;
- bindings->application_data.value = NULL;
-
- while(!context_established) {
- maj_stat = gss_init_sec_context(&min_stat,
- GSS_C_NO_CREDENTIAL,
- &d->context_hdl,
- target_name,
- GSS_C_NO_OID,
- GSS_C_MUTUAL_FLAG | GSS_C_SEQUENCE_FLAG,
- 0,
- bindings,
- &input,
- NULL,
- &output_token,
- NULL,
- NULL);
- if (GSS_ERROR(maj_stat)) {
- OM_uint32 new_stat;
- OM_uint32 msg_ctx = 0;
- gss_buffer_desc status_string;
-
- gss_display_status(&new_stat,
- min_stat,
- GSS_C_MECH_CODE,
- GSS_C_NO_OID,
- &msg_ctx,
- &status_string);
- printf("Error initializing security context: %s\n",
- (char*)status_string.value);
- gss_release_buffer(&new_stat, &status_string);
- return AUTH_CONTINUE;
- }
-
- gss_release_buffer(&min_stat, &input);
- if (output_token.length != 0) {
- base64_encode(output_token.value, output_token.length, &p);
- gss_release_buffer(&min_stat, &output_token);
- n = command("ADAT %s", p);
- free(p);
- }
- if (GSS_ERROR(maj_stat)) {
- if (d->context_hdl != GSS_C_NO_CONTEXT)
- gss_delete_sec_context (&min_stat,
- &d->context_hdl,
- GSS_C_NO_BUFFER);
- break;
- }
- if (maj_stat & GSS_S_CONTINUE_NEEDED) {
- p = strstr(reply_string, "ADAT=");
- if(p == NULL){
- printf("Error: expected ADAT in reply.\n");
- return AUTH_ERROR;
- } else {
- p+=5;
- input.value = malloc(strlen(p));
- input.length = base64_decode(p, input.value);
- }
- } else {
- if(code != 235) {
- printf("Unrecognized response code: %d\n", code);
- return AUTH_ERROR;
- }
- context_established = 1;
- }
- }
- return AUTH_OK;
-}
-
-struct sec_client_mech gss_client_mech = {
- "GSSAPI",
- sizeof(struct gss_data),
- gss_init,
- gss_auth,
- NULL, /* end */
- gss_check_prot,
- gss_overhead,
- gss_encode,
- gss_decode,
-};
-
-#endif /* FTP_SERVER */
diff --git a/crypto/kerberosIV/appl/ftp/ftp/security.c b/crypto/kerberosIV/appl/ftp/ftp/security.c
deleted file mode 100644
index ca7eb0036a538..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftp/security.c
+++ /dev/null
@@ -1,785 +0,0 @@
-/*
- * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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 FTP_SERVER
-#include "ftpd_locl.h"
-#else
-#include "ftp_locl.h"
-#endif
-
-RCSID("$Id: security.c,v 1.15 1999/12/02 16:58:30 joda Exp $");
-
-static enum protection_level command_prot;
-static enum protection_level data_prot;
-static size_t buffer_size;
-
-struct buffer {
- void *data;
- size_t size;
- size_t index;
- int eof_flag;
-};
-
-static struct buffer in_buffer, out_buffer;
-int sec_complete;
-
-static struct {
- enum protection_level level;
- const char *name;
-} level_names[] = {
- { prot_clear, "clear" },
- { prot_safe, "safe" },
- { prot_confidential, "confidential" },
- { prot_private, "private" }
-};
-
-static const char *
-level_to_name(enum protection_level level)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(level_names[i].level == level)
- return level_names[i].name;
- return "unknown";
-}
-
-#ifndef FTP_SERVER /* not used in server */
-static enum protection_level
-name_to_level(const char *name)
-{
- int i;
- for(i = 0; i < sizeof(level_names) / sizeof(level_names[0]); i++)
- if(!strncasecmp(level_names[i].name, name, strlen(name)))
- return level_names[i].level;
- return (enum protection_level)-1;
-}
-#endif
-
-#ifdef FTP_SERVER
-
-static struct sec_server_mech *mechs[] = {
-#ifdef KRB5
- &gss_server_mech,
-#endif
-#ifdef KRB4
- &krb4_server_mech,
-#endif
- NULL
-};
-
-static struct sec_server_mech *mech;
-
-#else
-
-static struct sec_client_mech *mechs[] = {
-#ifdef KRB5
- &gss_client_mech,
-#endif
-#ifdef KRB4
- &krb4_client_mech,
-#endif
- NULL
-};
-
-static struct sec_client_mech *mech;
-
-#endif
-
-static void *app_data;
-
-int
-sec_getc(FILE *F)
-{
- if(sec_complete && data_prot) {
- char c;
- if(sec_read(fileno(F), &c, 1) <= 0)
- return EOF;
- return c;
- } else
- return getc(F);
-}
-
-static int
-block_read(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = read(fd, p, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-block_write(int fd, void *buf, size_t len)
-{
- unsigned char *p = buf;
- int b;
- while(len) {
- b = write(fd, p, len);
- if(b < 0)
- return -1;
- len -= b;
- p += b;
- }
- return p - (unsigned char*)buf;
-}
-
-static int
-sec_get_data(int fd, struct buffer *buf, int level)
-{
- int len;
- int b;
-
- b = block_read(fd, &len, sizeof(len));
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- len = ntohl(len);
- buf->data = realloc(buf->data, len);
- b = block_read(fd, buf->data, len);
- if (b == 0)
- return 0;
- else if (b < 0)
- return -1;
- buf->size = (*mech->decode)(app_data, buf->data, len, data_prot);
- buf->index = 0;
- return 0;
-}
-
-static size_t
-buffer_read(struct buffer *buf, void *data, size_t len)
-{
- len = min(len, buf->size - buf->index);
- memcpy(data, (char*)buf->data + buf->index, len);
- buf->index += len;
- return len;
-}
-
-static size_t
-buffer_write(struct buffer *buf, void *data, size_t len)
-{
- if(buf->index + len > buf->size) {
- void *tmp;
- if(buf->data == NULL)
- tmp = malloc(1024);
- else
- tmp = realloc(buf->data, buf->index + len);
- if(tmp == NULL)
- return -1;
- buf->data = tmp;
- buf->size = buf->index + len;
- }
- memcpy((char*)buf->data + buf->index, data, len);
- buf->index += len;
- return len;
-}
-
-int
-sec_read(int fd, void *data, int length)
-{
- size_t len;
- int rx = 0;
-
- if(sec_complete == 0 || data_prot == 0)
- return read(fd, data, length);
-
- if(in_buffer.eof_flag){
- in_buffer.eof_flag = 0;
- return 0;
- }
-
- len = buffer_read(&in_buffer, data, length);
- length -= len;
- rx += len;
- data = (char*)data + len;
-
- while(length){
- if(sec_get_data(fd, &in_buffer, data_prot) < 0)
- return -1;
- if(in_buffer.size == 0) {
- if(rx)
- in_buffer.eof_flag = 1;
- return rx;
- }
- len = buffer_read(&in_buffer, data, length);
- length -= len;
- rx += len;
- data = (char*)data + len;
- }
- return rx;
-}
-
-static int
-sec_send(int fd, char *from, int length)
-{
- int bytes;
- void *buf;
- bytes = (*mech->encode)(app_data, from, length, data_prot, &buf);
- bytes = htonl(bytes);
- block_write(fd, &bytes, sizeof(bytes));
- block_write(fd, buf, ntohl(bytes));
- free(buf);
- return length;
-}
-
-int
-sec_fflush(FILE *F)
-{
- if(data_prot != prot_clear) {
- if(out_buffer.index > 0){
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- sec_send(fileno(F), NULL, 0);
- }
- fflush(F);
- return 0;
-}
-
-int
-sec_write(int fd, char *data, int length)
-{
- int len = buffer_size;
- int tx = 0;
-
- if(data_prot == prot_clear)
- return write(fd, data, length);
-
- len -= (*mech->overhead)(app_data, data_prot, len);
- while(length){
- if(length < len)
- len = length;
- sec_send(fd, data, len);
- length -= len;
- data += len;
- tx += len;
- }
- return tx;
-}
-
-int
-sec_vfprintf2(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- int ret;
- if(data_prot == prot_clear)
- return vfprintf(f, fmt, ap);
- else {
- vasprintf(&buf, fmt, ap);
- ret = buffer_write(&out_buffer, buf, strlen(buf));
- free(buf);
- return ret;
- }
-}
-
-int
-sec_fprintf2(FILE *f, const char *fmt, ...)
-{
- int ret;
- va_list ap;
- va_start(ap, fmt);
- ret = sec_vfprintf2(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-int
-sec_putc(int c, FILE *F)
-{
- char ch = c;
- if(data_prot == prot_clear)
- return putc(c, F);
-
- buffer_write(&out_buffer, &ch, 1);
- if(c == '\n' || out_buffer.index >= 1024 /* XXX */) {
- sec_write(fileno(F), out_buffer.data, out_buffer.index);
- out_buffer.index = 0;
- }
- return c;
-}
-
-int
-sec_read_msg(char *s, int level)
-{
- int len;
- char *buf;
- int code;
-
- buf = malloc(strlen(s));
- len = base64_decode(s + 4, buf); /* XXX */
-
- len = (*mech->decode)(app_data, buf, len, level);
- if(len < 0)
- return -1;
-
- buf[len] = '\0';
-
- if(buf[3] == '-')
- code = 0;
- else
- sscanf(buf, "%d", &code);
- if(buf[len-1] == '\n')
- buf[len-1] = '\0';
- strcpy(s, buf);
- free(buf);
- return code;
-}
-
-int
-sec_vfprintf(FILE *f, const char *fmt, va_list ap)
-{
- char *buf;
- void *enc;
- int len;
- if(!sec_complete)
- return vfprintf(f, fmt, ap);
-
- vasprintf(&buf, fmt, ap);
- len = (*mech->encode)(app_data, buf, strlen(buf), command_prot, &enc);
- free(buf);
- if(len < 0) {
- printf("Failed to encode command.\n");
- return -1;
- }
- if(base64_encode(enc, len, &buf) < 0){
- printf("Out of memory base64-encoding.\n");
- return -1;
- }
-#ifdef FTP_SERVER
- if(command_prot == prot_safe)
- fprintf(f, "631 %s\r\n", buf);
- else if(command_prot == prot_private)
- fprintf(f, "632 %s\r\n", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "633 %s\r\n", buf);
-#else
- if(command_prot == prot_safe)
- fprintf(f, "MIC %s", buf);
- else if(command_prot == prot_private)
- fprintf(f, "ENC %s", buf);
- else if(command_prot == prot_confidential)
- fprintf(f, "CONF %s", buf);
-#endif
- free(buf);
- return 0;
-}
-
-int
-sec_fprintf(FILE *f, const char *fmt, ...)
-{
- va_list ap;
- int ret;
- va_start(ap, fmt);
- ret = sec_vfprintf(f, fmt, ap);
- va_end(ap);
- return ret;
-}
-
-/* end common stuff */
-
-#ifdef FTP_SERVER
-
-void
-auth(char *auth_name)
-{
- int i;
- for(i = 0; (mech = mechs[i]) != NULL; i++){
- if(!strcasecmp(auth_name, mech->name)){
- app_data = realloc(app_data, mech->size);
- if(mech->init && (*mech->init)(app_data) != 0) {
- reply(431, "Unable to accept %s at this time", mech->name);
- return;
- }
- if(mech->auth) {
- (*mech->auth)(app_data);
- return;
- }
- if(mech->adat)
- reply(334, "Send authorization data.");
- else
- reply(234, "Authorization complete.");
- return;
- }
- }
- free (app_data);
- reply(504, "%s is unknown to me", auth_name);
-}
-
-void
-adat(char *auth_data)
-{
- if(mech && !sec_complete) {
- void *buf = malloc(strlen(auth_data));
- size_t len;
- len = base64_decode(auth_data, buf);
- (*mech->adat)(app_data, buf, len);
- free(buf);
- } else
- reply(503, "You must %sissue an AUTH first.", mech ? "re-" : "");
-}
-
-void pbsz(int size)
-{
- size_t new = size;
- if(!sec_complete)
- reply(503, "Incomplete security data exchange.");
- if(mech->pbsz)
- new = (*mech->pbsz)(app_data, size);
- if(buffer_size != new){
- buffer_size = size;
- }
- if(new != size)
- reply(200, "PBSZ=%lu", (unsigned long)new);
- else
- reply(200, "OK");
-}
-
-void
-prot(char *pl)
-{
- int p = -1;
-
- if(buffer_size == 0){
- reply(503, "No protection buffer size negotiated.");
- return;
- }
-
- if(!strcasecmp(pl, "C"))
- p = prot_clear;
- else if(!strcasecmp(pl, "S"))
- p = prot_safe;
- else if(!strcasecmp(pl, "E"))
- p = prot_confidential;
- else if(!strcasecmp(pl, "P"))
- p = prot_private;
- else {
- reply(504, "Unrecognized protection level.");
- return;
- }
-
- if(sec_complete){
- if((*mech->check_prot)(app_data, p)){
- reply(536, "%s does not support %s protection.",
- mech->name, level_to_name(p));
- }else{
- data_prot = (enum protection_level)p;
- reply(200, "Data protection is %s.", level_to_name(p));
- }
- }else{
- reply(503, "Incomplete security data exchange.");
- }
-}
-
-void ccc(void)
-{
- if(sec_complete){
- if(mech->ccc && (*mech->ccc)(app_data) == 0)
- command_prot = data_prot = prot_clear;
- else
- reply(534, "You must be joking.");
- }else
- reply(503, "Incomplete security data exchange.");
-}
-
-void mec(char *msg, enum protection_level level)
-{
- void *buf;
- size_t len;
- if(!sec_complete) {
- reply(503, "Incomplete security data exchange.");
- return;
- }
- buf = malloc(strlen(msg) + 2); /* XXX go figure out where that 2
- comes from :-) */
- len = base64_decode(msg, buf);
- command_prot = level;
- if(len == (size_t)-1) {
- reply(501, "Failed to base64-decode command");
- return;
- }
- len = (*mech->decode)(app_data, buf, len, level);
- if(len == (size_t)-1) {
- reply(535, "Failed to decode command");
- return;
- }
- ((char*)buf)[len] = '\0';
- if(strstr((char*)buf, "\r\n") == NULL)
- strcat((char*)buf, "\r\n");
- new_ftp_command(buf);
-}
-
-/* ------------------------------------------------------------ */
-
-int
-sec_userok(char *user)
-{
- if(sec_complete)
- return (*mech->userok)(app_data, user);
- return 0;
-}
-
-char *ftp_command;
-
-void
-new_ftp_command(char *command)
-{
- ftp_command = command;
-}
-
-void
-delete_ftp_command(void)
-{
- free(ftp_command);
- ftp_command = NULL;
-}
-
-int
-secure_command(void)
-{
- return ftp_command != NULL;
-}
-
-enum protection_level
-get_command_prot(void)
-{
- return command_prot;
-}
-
-#else /* FTP_SERVER */
-
-void
-sec_status(void)
-{
- if(sec_complete){
- printf("Using %s for authentication.\n", mech->name);
- printf("Using %s command channel.\n", level_to_name(command_prot));
- printf("Using %s data channel.\n", level_to_name(data_prot));
- if(buffer_size > 0)
- printf("Protection buffer size: %lu.\n",
- (unsigned long)buffer_size);
- }else{
- printf("Not using any security mechanism.\n");
- }
-}
-
-static int
-sec_prot_internal(int level)
-{
- int ret;
- char *p;
- unsigned int s = 1048576;
-
- int old_verbose = verbose;
- verbose = 0;
-
- if(!sec_complete){
- printf("No security data exchange has taken place.\n");
- return -1;
- }
-
- if(level){
- ret = command("PBSZ %u", s);
- if(ret != COMPLETE){
- printf("Failed to set protection buffer size.\n");
- return -1;
- }
- buffer_size = s;
- p = strstr(reply_string, "PBSZ=");
- if(p)
- sscanf(p, "PBSZ=%u", &s);
- if(s < buffer_size)
- buffer_size = s;
- }
- verbose = old_verbose;
- ret = command("PROT %c", level["CSEP"]); /* XXX :-) */
- if(ret != COMPLETE){
- printf("Failed to set protection level.\n");
- return -1;
- }
-
- data_prot = (enum protection_level)level;
- return 0;
-}
-
-enum protection_level
-set_command_prot(enum protection_level level)
-{
- enum protection_level old = command_prot;
- command_prot = level;
- return old;
-}
-
-void
-sec_prot(int argc, char **argv)
-{
- int level = -1;
-
- if(argc < 2 || argc > 3)
- goto usage;
- if(!sec_complete) {
- printf("No security data exchange has taken place.\n");
- code = -1;
- return;
- }
- level = name_to_level(argv[argc - 1]);
-
- if(level == -1)
- goto usage;
-
- if((*mech->check_prot)(app_data, level)) {
- printf("%s does not implement %s protection.\n",
- mech->name, level_to_name(level));
- code = -1;
- return;
- }
-
- if(argc == 2 || strncasecmp(argv[1], "data", strlen(argv[1])) == 0) {
- if(sec_prot_internal(level) < 0){
- code = -1;
- return;
- }
- } else if(strncasecmp(argv[1], "command", strlen(argv[1])) == 0)
- set_command_prot(level);
- else
- goto usage;
- code = 0;
- return;
- usage:
- printf("usage: %s [command|data] [clear|safe|confidential|private]\n",
- argv[0]);
- code = -1;
-}
-
-static enum protection_level request_data_prot;
-
-void
-sec_set_protection_level(void)
-{
- if(sec_complete && data_prot != request_data_prot)
- sec_prot_internal(request_data_prot);
-}
-
-
-int
-sec_request_prot(char *level)
-{
- int l = name_to_level(level);
- if(l == -1)
- return -1;
- request_data_prot = (enum protection_level)l;
- return 0;
-}
-
-int
-sec_login(char *host)
-{
- int ret;
- struct sec_client_mech **m;
- int old_verbose = verbose;
-
- verbose = -1; /* shut up all messages this will produce (they
- are usually not very user friendly) */
-
- for(m = mechs; *m && (*m)->name; m++) {
- void *tmp;
-
- tmp = realloc(app_data, (*m)->size);
- if (tmp == NULL) {
- warnx ("realloc %u failed", (*m)->size);
- return -1;
- }
- app_data = tmp;
-
- if((*m)->init && (*(*m)->init)(app_data) != 0) {
- printf("Skipping %s...\n", (*m)->name);
- continue;
- }
- printf("Trying %s...\n", (*m)->name);
- ret = command("AUTH %s", (*m)->name);
- if(ret != CONTINUE){
- if(code == 504){
- printf("%s is not supported by the server.\n", (*m)->name);
- }else if(code == 534){
- printf("%s rejected as security mechanism.\n", (*m)->name);
- }else if(ret == ERROR) {
- printf("The server doesn't support the FTP "
- "security extensions.\n");
- verbose = old_verbose;
- return -1;
- }
- continue;
- }
-
- ret = (*(*m)->auth)(app_data, host);
-
- if(ret == AUTH_CONTINUE)
- continue;
- else if(ret != AUTH_OK){
- /* mechanism is supposed to output error string */
- verbose = old_verbose;
- return -1;
- }
- mech = *m;
- sec_complete = 1;
- command_prot = prot_safe;
- break;
- }
-
- verbose = old_verbose;
- return *m == NULL;
-}
-
-void
-sec_end(void)
-{
- if (mech != NULL) {
- if(mech->end)
- (*mech->end)(app_data);
- memset(app_data, 0, mech->size);
- free(app_data);
- app_data = NULL;
- }
- sec_complete = 0;
- data_prot = (enum protection_level)0;
-}
-
-#endif /* FTP_SERVER */
-
diff --git a/crypto/kerberosIV/appl/ftp/ftp/security.h b/crypto/kerberosIV/appl/ftp/ftp/security.h
deleted file mode 100644
index 6fe06946c570b..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftp/security.h
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-/* $Id: security.h,v 1.7 1999/12/02 16:58:30 joda Exp $ */
-
-#ifndef __security_h__
-#define __security_h__
-
-enum protection_level {
- prot_clear,
- prot_safe,
- prot_confidential,
- prot_private
-};
-
-struct sec_client_mech {
- char *name;
- size_t size;
- int (*init)(void *);
- int (*auth)(void *, char*);
- void (*end)(void *);
- int (*check_prot)(void *, int);
- int (*overhead)(void *, int, int);
- int (*encode)(void *, void*, int, int, void**);
- int (*decode)(void *, void*, int, int);
-};
-
-struct sec_server_mech {
- char *name;
- size_t size;
- int (*init)(void *);
- void (*end)(void *);
- int (*check_prot)(void *, int);
- int (*overhead)(void *, int, int);
- int (*encode)(void *, void*, int, int, void**);
- int (*decode)(void *, void*, int, int);
-
- int (*auth)(void *);
- int (*adat)(void *, void*, size_t);
- size_t (*pbsz)(void *, size_t);
- int (*ccc)(void*);
- int (*userok)(void*, char*);
-};
-
-#define AUTH_OK 0
-#define AUTH_CONTINUE 1
-#define AUTH_ERROR 2
-
-#ifdef FTP_SERVER
-extern struct sec_server_mech krb4_server_mech, gss_server_mech;
-#else
-extern struct sec_client_mech krb4_client_mech, gss_client_mech;
-#endif
-
-extern int sec_complete;
-
-#ifdef FTP_SERVER
-extern char *ftp_command;
-void new_ftp_command(char*);
-void delete_ftp_command(void);
-#endif
-
-/* ---- */
-
-
-int sec_fflush (FILE *);
-int sec_fprintf (FILE *, const char *, ...);
-int sec_getc (FILE *);
-int sec_putc (int, FILE *);
-int sec_read (int, void *, int);
-int sec_read_msg (char *, int);
-int sec_vfprintf (FILE *, const char *, va_list);
-int sec_fprintf2(FILE *f, const char *fmt, ...);
-int sec_vfprintf2(FILE *, const char *, va_list);
-int sec_write (int, char *, int);
-
-#ifdef FTP_SERVER
-void adat (char *);
-void auth (char *);
-void ccc (void);
-void mec (char *, enum protection_level);
-void pbsz (int);
-void prot (char *);
-void delete_ftp_command (void);
-void new_ftp_command (char *);
-int sec_userok (char *);
-int secure_command (void);
-enum protection_level get_command_prot(void);
-#else
-void sec_end (void);
-int sec_login (char *);
-void sec_prot (int, char **);
-int sec_request_prot (char *);
-void sec_set_protection_level (void);
-void sec_status (void);
-
-enum protection_level set_command_prot(enum protection_level);
-
-#endif
-
-#endif /* __security_h__ */
diff --git a/crypto/kerberosIV/appl/ftp/ftpd/Makefile.am b/crypto/kerberosIV/appl/ftp/ftpd/Makefile.am
deleted file mode 100644
index 282cb3a43c422..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftpd/Makefile.am
+++ /dev/null
@@ -1,54 +0,0 @@
-# $Id: Makefile.am,v 1.20 1999/10/03 16:38:53 joda Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += -I$(srcdir)/../common $(INCLUDE_krb4) -DFTP_SERVER
-
-libexec_PROGRAMS = ftpd
-
-CHECK_LOCAL =
-
-if KRB4
-krb4_sources = krb4.c kauth.c
-endif
-if KRB5
-krb5_sources = gssapi.c gss_userok.c
-endif
-
-ftpd_SOURCES = \
- extern.h \
- ftpcmd.y \
- ftpd.c \
- ftpd_locl.h \
- logwtmp.c \
- ls.c \
- pathnames.h \
- popen.c \
- security.c \
- $(krb4_sources) \
- $(krb5_sources)
-
-EXTRA_ftpd_SOURCES = krb4.c kauth.c gssapi.c gss_userok.c
-
-$(ftpd_OBJECTS): security.h
-
-security.c:
- @test -f security.c || $(LN_S) $(srcdir)/../ftp/security.c .
-security.h:
- @test -f security.h || $(LN_S) $(srcdir)/../ftp/security.h .
-krb4.c:
- @test -f krb4.c || $(LN_S) $(srcdir)/../ftp/krb4.c .
-gssapi.c:
- @test -f gssapi.c || $(LN_S) $(srcdir)/../ftp/gssapi.c .
-
-CLEANFILES = security.c security.h krb4.c gssapi.c ftpcmd.c
-
-LDADD = ../common/libcommon.a \
- $(LIB_kafs) \
- $(LIB_gssapi) \
- $(LIB_krb5) \
- $(LIB_krb4) \
- $(LIB_otp) \
- $(top_builddir)/lib/des/libdes.la \
- $(LIB_roken) \
- $(DBLIB)
diff --git a/crypto/kerberosIV/appl/ftp/ftpd/ftpd_locl.h b/crypto/kerberosIV/appl/ftp/ftpd/ftpd_locl.h
deleted file mode 100644
index 5cb49046b52ac..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftpd/ftpd_locl.h
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-/* $Id: ftpd_locl.h,v 1.9 1999/12/02 16:58:30 joda Exp $ */
-
-#ifndef __ftpd_locl_h__
-#define __ftpd_locl_h__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-/*
- * FTP server.
- */
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_PARAM_H
-#include <sys/param.h>
-#endif
-#ifdef HAVE_SYS_STAT_H
-#include <sys/stat.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
-#include <sys/ioctl.h>
-#endif
-#ifdef HAVE_SYS_IOCCOM_H
-#include <sys/ioccom.h>
-#endif
-#ifdef TIME_WITH_SYS_TIME
-#include <sys/time.h>
-#include <time.h>
-#elif defined(HAVE_SYS_TIME_H)
-#include <sys/time.h>
-#else
-#include <time.h>
-#endif
-#ifdef HAVE_SYS_RESOURCE_H
-#include <sys/resource.h>
-#endif
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.h>
-#endif
-
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETINET_IN_SYSTM_H
-#include <netinet/in_systm.h>
-#endif
-#ifdef HAVE_NETINET_IP_H
-#include <netinet/ip.h>
-#endif
-
-#ifdef HAVE_SYS_MMAN_H
-#include <sys/mman.h>
-#endif
-
-#include <arpa/ftp.h>
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_ARPA_TELNET_H
-#include <arpa/telnet.h>
-#endif
-
-#include <ctype.h>
-#ifdef HAVE_DIRENT_H
-#include <dirent.h>
-#endif
-#include <errno.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <glob.h>
-#include <limits.h>
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#include <setjmp.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#ifdef HAVE_SYSLOG_H
-#include <syslog.h>
-#endif
-#include <time.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.h>
-#endif
-#include <fnmatch.h>
-
-#ifdef HAVE_BSD_BSD_H
-#include <bsd/bsd.h>
-#endif
-
-#include <err.h>
-
-#include "pathnames.h"
-#include "extern.h"
-#include "common.h"
-
-#include "security.h"
-
-#include "roken.h"
-
-#ifdef KRB4
-#include <krb.h>
-#include <kafs.h>
-#endif
-
-#ifdef OTP
-#include <otp.h>
-#endif
-
-#ifdef SOCKS
-#include <socks.h>
-extern int LIBPREFIX(fclose) (FILE *);
-#endif
-
-/* SunOS doesn't have any declaration of fclose */
-
-int fclose(FILE *stream);
-
-int yyparse();
-
-#ifndef LOG_FTP
-#define LOG_FTP LOG_DAEMON
-#endif
-
-#endif /* __ftpd_locl_h__ */
diff --git a/crypto/kerberosIV/appl/ftp/ftpd/gss_userok.c b/crypto/kerberosIV/appl/ftp/ftpd/gss_userok.c
deleted file mode 100644
index 28e35960cc9da..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftpd/gss_userok.c
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright (c) 1998 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-#include "ftpd_locl.h"
-#include <gssapi.h>
-#include <krb5.h>
-
-RCSID("$Id: gss_userok.c,v 1.2 1999/12/02 16:58:31 joda Exp $");
-
-/* XXX a bit too much of krb5 dependency here...
- What is the correct way to do this?
- */
-
-extern krb5_context gssapi_krb5_context;
-
-/* XXX sync with gssapi.c */
-struct gss_data {
- gss_ctx_id_t context_hdl;
- char *client_name;
-};
-
-int gss_userok(void*, char*); /* to keep gcc happy */
-
-int
-gss_userok(void *app_data, char *username)
-{
- struct gss_data *data = app_data;
- if(gssapi_krb5_context) {
- krb5_principal client;
- krb5_error_code ret;
- ret = krb5_parse_name(gssapi_krb5_context, data->client_name, &client);
- if(ret)
- return 1;
- ret = krb5_kuserok(gssapi_krb5_context, client, username);
- krb5_free_principal(gssapi_krb5_context, client);
- return !ret;
- }
- return 1;
-}
diff --git a/crypto/kerberosIV/appl/ftp/ftpd/ls.c b/crypto/kerberosIV/appl/ftp/ftpd/ls.c
deleted file mode 100644
index 97eb77ed906d1..0000000000000
--- a/crypto/kerberosIV/appl/ftp/ftpd/ls.c
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- * Copyright (c) 1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of KTH 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 KTH AND ITS 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 KTH OR ITS 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. */
-
-#include "ftpd_locl.h"
-
-RCSID("$Id: ls.c,v 1.13 1999/11/20 20:49:41 assar Exp $");
-
-struct fileinfo {
- struct stat st;
- int inode;
- int bsize;
- char mode[11];
- int n_link;
- char *user;
- char *group;
- char *size;
- char *major;
- char *minor;
- char *date;
- char *filename;
- char *link;
-};
-
-#define LS_DIRS 1
-#define LS_IGNORE_DOT 2
-#define LS_SORT_MODE 12
-#define SORT_MODE(f) ((f) & LS_SORT_MODE)
-#define LS_SORT_NAME 4
-#define LS_SORT_MTIME 8
-#define LS_SORT_SIZE 12
-#define LS_SORT_REVERSE 16
-
-#define LS_SIZE 32
-#define LS_INODE 64
-
-#ifndef S_ISTXT
-#define S_ISTXT S_ISVTX
-#endif
-
-#ifndef S_ISSOCK
-#define S_ISSOCK(mode) (((mode) & _S_IFMT) == S_IFSOCK)
-#endif
-
-#ifndef S_ISLNK
-#define S_ISLNK(mode) (((mode) & _S_IFMT) == S_IFLNK)
-#endif
-
-static void
-make_fileinfo(const char *filename, struct fileinfo *file, int flags)
-{
- char buf[128];
- struct stat *st = &file->st;
-
- file->inode = st->st_ino;
-#ifdef S_BLKSIZE
- file->bsize = st->st_blocks * S_BLKSIZE / 1024;
-#else
- file->bsize = st->st_blocks * 512 / 1024;
-#endif
-
- if(S_ISDIR(st->st_mode))
- file->mode[0] = 'd';
- else if(S_ISCHR(st->st_mode))
- file->mode[0] = 'c';
- else if(S_ISBLK(st->st_mode))
- file->mode[0] = 'b';
- else if(S_ISREG(st->st_mode))
- file->mode[0] = '-';
- else if(S_ISFIFO(st->st_mode))
- file->mode[0] = 'p';
- else if(S_ISLNK(st->st_mode))
- file->mode[0] = 'l';
- else if(S_ISSOCK(st->st_mode))
- file->mode[0] = 's';
-#ifdef S_ISWHT
- else if(S_ISWHT(st->st_mode))
- file->mode[0] = 'w';
-#endif
- else
- file->mode[0] = '?';
- {
- char *x[] = { "---", "--x", "-w-", "-wx",
- "r--", "r-x", "rw-", "rwx" };
- strcpy(file->mode + 1, x[(st->st_mode & S_IRWXU) >> 6]);
- strcpy(file->mode + 4, x[(st->st_mode & S_IRWXG) >> 3]);
- strcpy(file->mode + 7, x[(st->st_mode & S_IRWXO) >> 0]);
- if((st->st_mode & S_ISUID)) {
- if((st->st_mode & S_IXUSR))
- file->mode[3] = 's';
- else
- file->mode[3] = 'S';
- }
- if((st->st_mode & S_ISGID)) {
- if((st->st_mode & S_IXGRP))
- file->mode[6] = 's';
- else
- file->mode[6] = 'S';
- }
- if((st->st_mode & S_ISTXT)) {
- if((st->st_mode & S_IXOTH))
- file->mode[9] = 't';
- else
- file->mode[9] = 'T';
- }
- }
- file->n_link = st->st_nlink;
- {
- struct passwd *pwd;
- pwd = getpwuid(st->st_uid);
- if(pwd == NULL)
- asprintf(&file->user, "%u", (unsigned)st->st_uid);
- else
- file->user = strdup(pwd->pw_name);
- }
- {
- struct group *grp;
- grp = getgrgid(st->st_gid);
- if(grp == NULL)
- asprintf(&file->group, "%u", (unsigned)st->st_gid);
- else
- file->group = strdup(grp->gr_name);
- }
-
- if(S_ISCHR(st->st_mode) || S_ISBLK(st->st_mode)) {
-#if defined(major) && defined(minor)
- asprintf(&file->major, "%u", (unsigned)major(st->st_rdev));
- asprintf(&file->minor, "%u", (unsigned)minor(st->st_rdev));
-#else
- /* Don't want to use the DDI/DKI crap. */
- asprintf(&file->major, "%u", (unsigned)st->st_rdev);
- asprintf(&file->minor, "%u", 0);
-#endif
- } else
- asprintf(&file->size, "%lu", (unsigned long)st->st_size);
-
- {
- time_t t = time(NULL);
- struct tm *tm = localtime(&st->st_mtime);
- if((t - st->st_mtime > 6*30*24*60*60) ||
- (st->st_mtime - t > 6*30*24*60*60))
- strftime(buf, sizeof(buf), "%b %e %Y", tm);
- else
- strftime(buf, sizeof(buf), "%b %e %H:%M", tm);
- file->date = strdup(buf);
- }
- {
- const char *p = strrchr(filename, '/');
- if(p)
- p++;
- else
- p = filename;
- file->filename = strdup(p);
- }
- if(S_ISLNK(st->st_mode)) {
- int n;
- n = readlink((char *)filename, buf, sizeof(buf));
- if(n >= 0) {
- buf[n] = '\0';
- file->link = strdup(buf);
- } else
- warn("%s: readlink", filename);
- }
-}
-
-static void
-print_file(FILE *out,
- int flags,
- struct fileinfo *f,
- int max_inode,
- int max_bsize,
- int max_n_link,
- int max_user,
- int max_group,
- int max_size,
- int max_major,
- int max_minor,
- int max_date)
-{
- if(f->filename == NULL)
- return;
-
- if(flags & LS_INODE) {
- sec_fprintf2(out, "%*d", max_inode, f->inode);
- sec_fprintf2(out, " ");
- }
- if(flags & LS_SIZE) {
- sec_fprintf2(out, "%*d", max_bsize, f->bsize);
- sec_fprintf2(out, " ");
- }
- sec_fprintf2(out, "%s", f->mode);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%*d", max_n_link, f->n_link);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%-*s", max_user, f->user);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%-*s", max_group, f->group);
- sec_fprintf2(out, " ");
- if(f->major != NULL && f->minor != NULL)
- sec_fprintf2(out, "%*s, %*s", max_major, f->major, max_minor, f->minor);
- else
- sec_fprintf2(out, "%*s", max_size, f->size);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%*s", max_date, f->date);
- sec_fprintf2(out, " ");
- sec_fprintf2(out, "%s", f->filename);
- if(f->link)
- sec_fprintf2(out, " -> %s", f->link);
- sec_fprintf2(out, "\r\n");
-}
-
-static int
-compare_filename(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return strcmp(a->filename, b->filename);
-}
-
-static int
-compare_mtime(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return a->st.st_mtime - b->st.st_mtime;
-}
-
-static int
-compare_size(struct fileinfo *a, struct fileinfo *b)
-{
- if(a->filename == NULL)
- return 1;
- if(b->filename == NULL)
- return -1;
- return a->st.st_size - b->st.st_size;
-}
-
-static void
-list_dir(FILE *out, const char *directory, int flags);
-
-static int
-log10(int num)
-{
- int i = 1;
- while(num > 10) {
- i++;
- num /= 10;
- }
- return i;
-}
-
-/*
- * Operate as lstat but fake up entries for AFS mount points so we don't
- * have to fetch them.
- */
-
-static int
-lstat_file (const char *file, struct stat *sb)
-{
-#ifdef KRB4
- if (k_hasafs()
- && strcmp(file, ".")
- && strcmp(file, ".."))
- {
- struct ViceIoctl a_params;
- char *last;
- char *path_bkp;
- static ino_t ino_counter = 0, ino_last = 0;
- int ret;
- const int maxsize = 2048;
-
- path_bkp = strdup (file);
- if (path_bkp == NULL)
- return -1;
-
- a_params.out = malloc (maxsize);
- if (a_params.out == NULL) {
- free (path_bkp);
- return -1;
- }
-
- /* If path contains more than the filename alone - split it */
-
- last = strrchr (path_bkp, '/');
- if (last != NULL) {
- *last = '\0';
- a_params.in = last + 1;
- } else
- a_params.in = (char *)file;
-
- a_params.in_size = strlen (a_params.in) + 1;
- a_params.out_size = maxsize;
-
- ret = k_pioctl (last ? path_bkp : "." ,
- VIOC_AFS_STAT_MT_PT, &a_params, 0);
- free (a_params.out);
- if (ret < 0) {
- free (path_bkp);
-
- if (errno != EINVAL)
- return ret;
- else
- /* if we get EINVAL this is probably not a mountpoint */
- return lstat (file, sb);
- }
-
- /*
- * wow this was a mountpoint, lets cook the struct stat
- * use . as a prototype
- */
-
- ret = lstat (path_bkp, sb);
- free (path_bkp);
- if (ret < 0)
- return ret;
-
- if (ino_last == sb->st_ino)
- ino_counter++;
- else {
- ino_last = sb->st_ino;
- ino_counter = 0;
- }
- sb->st_ino += ino_counter;
- sb->st_nlink = 3;
-
- return 0;
- }
-#endif /* KRB4 */
- return lstat (file, sb);
-}
-
-static void
-list_files(FILE *out, char **files, int n_files, int flags)
-{
- struct fileinfo *fi;
- int i;
-
- fi = calloc(n_files, sizeof(*fi));
- if (fi == NULL) {
- sec_fprintf2(out, "ouf of memory\r\n");
- return;
- }
- for(i = 0; i < n_files; i++) {
- if(lstat_file(files[i], &fi[i].st) < 0) {
- sec_fprintf2(out, "%s: %s\r\n", files[i], strerror(errno));
- fi[i].filename = NULL;
- } else {
- if((flags & LS_DIRS) == 0 && S_ISDIR(fi[i].st.st_mode)) {
- if(n_files > 1)
- sec_fprintf2(out, "%s:\r\n", files[i]);
- list_dir(out, files[i], flags);
- } else {
- make_fileinfo(files[i], &fi[i], flags);
- }
- }
- }
- switch(SORT_MODE(flags)) {
- case LS_SORT_NAME:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_filename);
- break;
- case LS_SORT_MTIME:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_mtime);
- break;
- case LS_SORT_SIZE:
- qsort(fi, n_files, sizeof(*fi),
- (int (*)(const void*, const void*))compare_size);
- break;
- }
- {
- int max_inode = 0;
- int max_bsize = 0;
- int max_n_link = 0;
- int max_user = 0;
- int max_group = 0;
- int max_size = 0;
- int max_major = 0;
- int max_minor = 0;
- int max_date = 0;
- for(i = 0; i < n_files; i++) {
- if(fi[i].filename == NULL)
- continue;
- if(fi[i].inode > max_inode)
- max_inode = fi[i].inode;
- if(fi[i].bsize > max_bsize)
- max_bsize = fi[i].bsize;
- if(fi[i].n_link > max_n_link)
- max_n_link = fi[i].n_link;
- if(strlen(fi[i].user) > max_user)
- max_user = strlen(fi[i].user);
- if(strlen(fi[i].group) > max_group)
- max_group = strlen(fi[i].group);
- if(fi[i].major != NULL && strlen(fi[i].major) > max_major)
- max_major = strlen(fi[i].major);
- if(fi[i].minor != NULL && strlen(fi[i].minor) > max_minor)
- max_minor = strlen(fi[i].minor);
- if(fi[i].size != NULL && strlen(fi[i].size) > max_size)
- max_size = strlen(fi[i].size);
- if(strlen(fi[i].date) > max_date)
- max_date = strlen(fi[i].date);
- }
- if(max_size < max_major + max_minor + 2)
- max_size = max_major + max_minor + 2;
- else if(max_size - max_minor - 2 > max_major)
- max_major = max_size - max_minor - 2;
- max_inode = log10(max_inode);
- max_bsize = log10(max_bsize);
- max_n_link = log10(max_n_link);
-
- if(flags & LS_SORT_REVERSE)
- for(i = n_files - 1; i >= 0; i--)
- print_file(out,
- flags,
- &fi[i],
- max_inode,
- max_bsize,
- max_n_link,
- max_user,
- max_group,
- max_size,
- max_major,
- max_minor,
- max_date);
- else
- for(i = 0; i < n_files; i++)
- print_file(out,
- flags,
- &fi[i],
- max_inode,
- max_bsize,
- max_n_link,
- max_user,
- max_group,
- max_size,
- max_major,
- max_minor,
- max_date);
- }
-}
-
-static void
-free_files (char **files, int n)
-{
- int i;
-
- for (i = 0; i < n; ++i)
- free (files[i]);
- free (files);
-}
-
-static void
-list_dir(FILE *out, const char *directory, int flags)
-{
- DIR *d = opendir(directory);
- struct dirent *ent;
- char **files = NULL;
- int n_files = 0;
-
- if(d == NULL) {
- sec_fprintf2(out, "%s: %s\r\n", directory, strerror(errno));
- return;
- }
- while((ent = readdir(d)) != NULL) {
- void *tmp;
-
- if(ent->d_name[0] == '.') {
- if (flags & LS_IGNORE_DOT)
- continue;
- if (ent->d_name[1] == 0) /* Ignore . */
- continue;
- if (ent->d_name[1] == '.' && ent->d_name[2] == 0) /* Ignore .. */
- continue;
- }
- tmp = realloc(files, (n_files + 1) * sizeof(*files));
- if (tmp == NULL) {
- sec_fprintf2(out, "%s: out of memory\r\n", directory);
- free_files (files, n_files);
- closedir (d);
- return;
- }
- files = tmp;
- asprintf(&files[n_files], "%s/%s", directory, ent->d_name);
- if (files[n_files] == NULL) {
- sec_fprintf2(out, "%s: out of memory\r\n", directory);
- free_files (files, n_files);
- closedir (d);
- return;
- }
- ++n_files;
- }
- closedir(d);
- list_files(out, files, n_files, flags | LS_DIRS);
-}
-
-void
-builtin_ls(FILE *out, const char *file)
-{
- int flags = LS_SORT_NAME;
-
- if(*file == '-') {
- const char *p;
- for(p = file + 1; *p; p++) {
- switch(*p) {
- case 'a':
- case 'A':
- flags &= ~LS_IGNORE_DOT;
- break;
- case 'C':
- break;
- case 'd':
- flags |= LS_DIRS;
- break;
- case 'f':
- flags = (flags & ~LS_SORT_MODE);
- break;
- case 'i':
- flags |= flags | LS_INODE;
- break;
- case 'l':
- break;
- case 't':
- flags = (flags & ~LS_SORT_MODE) | LS_SORT_MTIME;
- break;
- case 's':
- flags |= LS_SIZE;
- break;
- case 'S':
- flags = (flags & ~LS_SORT_MODE) | LS_SORT_SIZE;
- break;
- case 'r':
- flags |= LS_SORT_REVERSE;
- break;
- }
- }
- file = ".";
- }
- list_files(out, &file, 1, flags);
- sec_fflush(out);
-}
diff --git a/crypto/kerberosIV/appl/kauth/ChangeLog b/crypto/kerberosIV/appl/kauth/ChangeLog
deleted file mode 100644
index a770682f713b8..0000000000000
--- a/crypto/kerberosIV/appl/kauth/ChangeLog
+++ /dev/null
@@ -1,30 +0,0 @@
-1999-08-31 Johan Danielsson <joda@pdc.kth.se>
-
- * kauth.c: cleanup usage string; handle `kauth -h' gracefully
- (print usage); add `-a' flag to get the ticket address (useful for
- firewall configurations)
-
-Thu Apr 15 15:05:33 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * kauth.c: add `-v'
-
-Thu Mar 18 11:17:14 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * Makefile.am: include Makefile.am.common
-
-Sun Nov 22 10:30:47 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (WFLAGS): set
-
-Tue May 26 17:41:47 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * kauth.c: use krb_enable_debug
-
-Fri May 1 07:15:18 1998 Assar Westerlund <assar@sics.se>
-
- * rkinit.c: unifdef -DHAVE_H_ERRNO
-
-Thu Mar 19 16:07:18 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * kauth.c: Check for negative return value from krb_afslog().
-
diff --git a/crypto/kerberosIV/appl/kauth/Makefile.am b/crypto/kerberosIV/appl/kauth/Makefile.am
deleted file mode 100644
index a5bf0fdacac6c..0000000000000
--- a/crypto/kerberosIV/appl/kauth/Makefile.am
+++ /dev/null
@@ -1,42 +0,0 @@
-# $Id: Makefile.am,v 1.7 1999/04/09 18:22:45 assar Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += $(INCLUDE_krb4)
-
-bin_PROGRAMS = kauth
-bin_SCRIPTS = ksrvtgt
-libexec_PROGRAMS = kauthd
-
-EXTRA_DIST = zrefresh ksrvtgt.in
-
-kauth_SOURCES = \
- kauth.c \
- kauth.h \
- rkinit.c \
- marshall.c \
- encdata.c
-
-kauthd_SOURCES = \
- kauthd.c \
- kauth.h \
- marshall.c \
- encdata.c
-
-ksrvtgt: ksrvtgt.in
- sed -e "s!%bindir%!$(bindir)!" $(srcdir)/ksrvtgt.in > $@
- chmod +x $@
-
-install-exec-local:
- if test -f $(bindir)/zrefresh -o -r $(bindir)/zrefresh; then \
- true; \
- else \
- $(INSTALL_PROGRAM) $(srcdir)/zrefresh $(bindir)/`echo zrefresh | sed '$(transform)'`; \
- fi
-
-LDADD = \
- $(LIB_kafs) \
- $(LIB_krb5) \
- $(LIB_krb4) \
- $(top_builddir)/lib/des/libdes.la \
- $(LIB_roken)
diff --git a/crypto/kerberosIV/appl/push/ChangeLog b/crypto/kerberosIV/appl/push/ChangeLog
deleted file mode 100644
index a55954d66a5ae..0000000000000
--- a/crypto/kerberosIV/appl/push/ChangeLog
+++ /dev/null
@@ -1,135 +0,0 @@
-1999-11-13 Assar Westerlund <assar@sics.se>
-
- * push.c: make `-v' a arg_counter
-
-1999-11-02 Assar Westerlund <assar@sics.se>
-
- * push.c (main): redo the v4/v5 selection for consistency. -4 ->
- try only v4 -5 -> try only v5 none, -45 -> try v5, v4
-
-1999-08-19 Assar Westerlund <assar@sics.se>
-
- * push.c (doit): remember to step over the error message when we
- discover that XDELE is not supported
-
-1999-08-12 Johan Danielsson <joda@pdc.kth.se>
-
- * push.c: use XDELE
-
-1999-08-05 Assar Westerlund <assar@sics.se>
-
- * push.c (do_connect): v6-ify
-
-1999-06-15 Assar Westerlund <assar@sics.se>
-
- * push.c: get_default_username and the resulting const propagation
-
-1999-05-21 Assar Westerlund <assar@sics.se>
-
- * push.c (parse_pobox): try $USERNAME
-
-1999-05-11 Assar Westerlund <assar@sics.se>
-
- * push.c (do_v5): remove unused and non-working code
-
-1999-05-10 Assar Westerlund <assar@sics.se>
-
- * push.c (do_v5): call krb5_sendauth with ccache == NULL
-
-Wed Apr 7 23:40:00 1999 Assar Westerlund <assar@sics.se>
-
- * Makefile.in: fix names of hesiod variables
-
-Wed Mar 24 04:37:04 1999 Assar Westerlund <assar@sics.se>
-
- * Makefile.am (pfrom): fix typo
-
- * push.c (get_pobox): try to handle old and new hesiod APIs
-
-Mon Mar 22 22:19:40 1999 Assar Westerlund <assar@sics.se>
-
- * Makefile.am: hesoid -> hesiod
-
-Sun Mar 21 18:02:10 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * Makefile.am: bindir -> libexecdir
-
-Sat Mar 20 00:12:26 1999 Assar Westerlund <assar@sics.se>
-
- * Makefile.am: LDADD: add missing backslash
-
-Thu Mar 18 15:28:35 1999 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * Makefile.am: clean pfrom
-
- * Makefile.am: include Makefile.am.common
-
-Mon Mar 15 18:26:16 1999 Johan Danielsson <joda@blubb.pdc.kth.se>
-
- * push.c: strncasecmp headers
-
-Mon Feb 15 22:22:09 1999 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (pfrom): use libexecdir
-
- * Makefile.am: build and install pfrom
-
- * push.c (do_connect): init `s'
- (pop_state): spell-check enums
-
-Tue Nov 24 23:20:54 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in: build and install pfrom
-
- * pfrom.in: bindir -> libexecdir
-
-Sun Nov 22 15:33:52 1998 Johan Danielsson <joda@hella.pdc.kth.se>
-
- * push.c: eliminate some warnings
-
-Sun Nov 22 10:34:54 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (WFLAGS): set
-
-Thu Nov 19 01:17:33 1998 Assar Westerlund <assar@sics.se>
-
- * push_locl.h: add <hesiod.h>
-
- * Makefile.am, Makefile.in: link and include hesiod
-
- * push.c (get_pobox): new function. add hesiod support.
-
-1998-11-07 Assar Westerlund <assar@sics.se>
-
- * push.8: updated
-
- * push.c: --from implementation from <lha@stacken.kth.se>
-
-Fri Jul 10 01:14:45 1998 Assar Westerlund <assar@sics.se>
-
- * push.c (net_{read,write}): remove
-
-Wed Jun 24 14:41:41 1998 Johan Danielsson <joda@blubb.pdc.kth.se>
-
- * push.c: allow `po:user@host' mailbox syntax
-
-Tue Jun 2 17:35:06 1998 Johan Danielsson <joda@emma.pdc.kth.se>
-
- * push.c: quote '^From ' properly
-
-Mon May 25 05:22:47 1998 Assar Westerlund <assar@sics.se>
-
- * Makefile.in (clean): PROGS -> PROGRAMS
-
-Sun Apr 26 11:42:13 1998 Assar Westerlund <assar@sics.se>
-
- * push.c (main): better default for v4 and v5
-
- * push.c (main): init context correctly
-
- * push.c: should work with krb4
-
- * push_locl.h: krb4 compat
-
- * Makefile.in: new file
-
diff --git a/crypto/kerberosIV/appl/push/Makefile.am b/crypto/kerberosIV/appl/push/Makefile.am
deleted file mode 100644
index 07ecd0ad98022..0000000000000
--- a/crypto/kerberosIV/appl/push/Makefile.am
+++ /dev/null
@@ -1,27 +0,0 @@
-# $Id: Makefile.am,v 1.15 1999/04/09 18:29:48 assar Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += $(INCLUDE_krb4) $(INCLUDE_hesiod)
-
-bin_SCRIPTS = pfrom
-
-libexec_PROGRAMS = push
-
-push_SOURCES = push.c push_locl.h
-
-pfrom: pfrom.in
- sed -e "s!%libexecdir%!$(libexecdir)!" $(srcdir)/pfrom.in > $@
- chmod +x $@
-
-man_MANS = push.8
-
-CLEANFILES = pfrom
-
-EXTRA_DIST = pfrom.in $(man_MANS)
-
-LDADD = $(LIB_krb5) \
- $(LIB_krb4) \
- $(top_builddir)/lib/des/libdes.la \
- $(LIB_roken) \
- $(LIB_hesiod)
diff --git a/crypto/kerberosIV/appl/push/Makefile.in b/crypto/kerberosIV/appl/push/Makefile.in
deleted file mode 100644
index 87da6cfab3372..0000000000000
--- a/crypto/kerberosIV/appl/push/Makefile.in
+++ /dev/null
@@ -1,95 +0,0 @@
-# $Id: Makefile.in,v 1.10 1999/04/07 18:39:56 assar Exp $
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-
-CC = @CC@
-LINK = @LINK@
-RANLIB = @RANLIB@
-DEFS = @DEFS@ @INCLUDE_hesiod@
-CFLAGS = @CFLAGS@ $(WFLAGS)
-WFLAGS = @WFLAGS@
-LD_FLAGS = @LD_FLAGS@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-LIBS = @LIB_hesiod@ @LIBS@
-LIB_DBM = @LIB_DBM@
-MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-libexecdir = @libexecdir@
-bindir = @bindir@
-transform=@program_transform_name@
-EXECSUFFIX=@EXECSUFFIX@
-
-bin_PROGRAMS = pfrom
-
-libexec_PROGRAMS = push$(EXECSUFFIX)
-
-PROGRAMS = $(libexec_PROGRAMS) $(bin_PROGRAMS)
-
-push_SOURCES = push.c
-
-push_OBJECTS = push.o
-
-SOURCES = $(push_SOURCES)
-
-OBJECTS = $(push_OBJECTS)
-
-all: $(PROGRAMS)
-
-.c.o:
- $(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
-
-install: all
- $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
- for x in $(bin_PROGRAMS); do \
- $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
- done
- $(MKINSTALLDIRS) $(DESTDIR)$(libexecdir)
- for x in $(libexec_PROGRAMS); do \
- $(INSTALL_PROGRAM) $$x $(DESTDIR)$(libexecdir)/`echo $$x | sed '$(transform)'`; \
- done
-
-uninstall:
- for x in $(bin_PROGRAMS); do \
- rm -f $(DESTDIR)$(bindir)/`echo $$x | sed '$(transform)'`; \
- done
- for x in $(libexec_PROGRAMS); do \
- rm -f $(DESTDIR)$(libexecdir)/`echo $$x | sed '$(transform)'`; \
- done
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-clean:
- rm -f *.a *.o $(PROGRAMS)
-
-mostlyclean: clean
-
-distclean: clean
- rm -f Makefile *~
-
-realclean: distclean
- rm -f TAGS
-
-KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes
-LIBROKEN=-L../../lib/roken -lroken
-
-push$(EXECSUFFIX): $(push_OBJECTS)
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ $(push_OBJECTS) $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-pfrom: pfrom.in
- sed -e "s!%libexecdir%!$(libexecdir)!" $(srcdir)/pfrom.in > $@
- chmod +x $@
-
-$(OBJECTS): ../../include/config.h
-
-.PHONY: all install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/appl/push/pfrom.in b/crypto/kerberosIV/appl/push/pfrom.in
deleted file mode 100644
index 6adf4f0f7971c..0000000000000
--- a/crypto/kerberosIV/appl/push/pfrom.in
+++ /dev/null
@@ -1,6 +0,0 @@
-#!/bin/sh
-# $Id: pfrom.in,v 1.2 1998/11/24 13:25:47 assar Exp $
-libexecdir=%libexecdir%
-PATH=$libexecdir:$PATH
-export PATH
-push --from $*
diff --git a/crypto/kerberosIV/appl/push/push.8 b/crypto/kerberosIV/appl/push/push.8
deleted file mode 100644
index 5066b375cfb70..0000000000000
--- a/crypto/kerberosIV/appl/push/push.8
+++ /dev/null
@@ -1,138 +0,0 @@
-.\" $Id: push.8,v 1.3.16.1 1999/12/06 17:25:27 assar Exp $
-.\"
-.Dd May 31, 1998
-.Dt PUSH 8
-.Os HEIMDAL
-.Sh NAME
-.Nm push
-.Nd
-fetch mail via POP
-.Sh SYNOPSIS
-.Nm
-.Op Fl 4 | Fl -krb4
-.Op Fl 5 | Fl -krb5
-.Op Fl v | Fl -verbose
-.Op Fl f | Fl -fork
-.Op Fl l | -leave
-.Op Fl -from
-.Op Fl c | -count
-.Op Fl -header
-.Oo Fl p Ar port-spec \*(Ba Xo
-.Fl -port= Ns Ar port-spec Oc
-.Xc
-.Ar po-box
-.Pa filename
-.Sh DESCRIPTION
-.Nm
-retrieves mail from the post office box
-.Ar po-box ,
-and stores the mail in mbox format in
-.Pa filename .
-The
-.Ar po-box
-can have any of the following formats:
-.Bl -hang -compact -offset indent
-.It Ql hostname:username
-.It Ql po:hostname:username
-.It Ql username@hostname
-.It Ql po:username@hostname
-.It Ql hostname
-.It Ql po:username
-.El
-
-If no username is specified,
-.Nm
-assumes that it's the same as on the local machine;
-.Ar hostname
-defaults to the value of the
-.Ev MAILHOST
-environment variable.
-
-Supported options:
-.Bl -tag -width Ds
-.It Xo
-.Fl 4 Ns ,
-.Fl -krb4
-.Xc
-use Kerberos 4 (if compiled with support for Kerberos 4)
-.It Xo
-.Fl 5 Ns ,
-.Fl -krb5
-.Xc
-use Kerberos 5 (if compiled with support for Kerberos 5)
-.It Xo
-.Fl f Ns ,
-.Fl -fork
-.Xc
-fork before starting to delete messages
-.It Xo
-.Fl l Ns ,
-.Fl -leave
-.Xc
-don't delete fetched mail
-.It Xo
-.Fl -from
-.Xc
-behave like from.
-.It Xo
-.Fl c Ns ,
-.Fl -count
-.Xc
-first print how many messages and bytes there are.
-.It Xo
-.Fl -header
-.Xc
-which header from should print.
-.It Xo
-.Fl p Ar port-spec Ns ,
-.Fl -port= Ns Ar port-spec
-.Xc
-use this port instead of the default
-.Ql kpop
-or
-.Ql 1109 .
-.El
-
-The default is to first try Kerberos 5 authentication and then, if
-that fails, Kerberos 4.
-.Sh ENVIRONMENT
-
-.Bl -tag -width Ds
-.It Ev MAILHOST
-points to the post office, if no other hostname is specified.
-.El
-.\".Sh FILES
-.Sh EXAMPLES
-.Bd -literal -offset indent
-$ push cornfield:roosta ~/.gnus-crash-box
-.Ed
-
-tries to fetch mail for the user
-.Ar roosta
-from the post office at
-.Dq cornfield ,
-and stores the mail in
-.Pa ~/.gnus-crash-box
-(you are using Gnus, aren't you?)
-.Bd -literal -offset indent
-$ push --from -5 havregryn
-.Ed
-
-tries to fetch
-.Nm From:
-lines for current user at post office
-.Dq havregryn
-using Kerberos 5.
-.\".Sh DIAGNOSTICS
-.Sh SEE ALSO
-.Xr movemail 8 ,
-.Xr popper 8 ,
-.Xr from 1
-.\".Sh STANDARDS
-.Sh HISTORY
-.Nm
-was written while waiting for
-.Nm movemail
-to finish getting the mail.
-.\".Sh AUTHORS
-.\".Sh BUGS
diff --git a/crypto/kerberosIV/appl/push/push.c b/crypto/kerberosIV/appl/push/push.c
deleted file mode 100644
index bc7574fa634e9..0000000000000
--- a/crypto/kerberosIV/appl/push/push.c
+++ /dev/null
@@ -1,795 +0,0 @@
-/*
- * Copyright (c) 1997-1999 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-#include "push_locl.h"
-RCSID("$Id: push.c,v 1.34.2.1 1999/12/06 17:25:28 assar Exp $");
-
-#ifdef KRB4
-static int use_v4 = -1;
-#endif
-
-#ifdef KRB5
-static int use_v5 = -1;
-static krb5_context context;
-#endif
-
-static char *port_str;
-static int verbose_level;
-static int do_fork;
-static int do_leave;
-static int do_version;
-static int do_help;
-static int do_from;
-static int do_count;
-static char *header_str;
-
-struct getargs args[] = {
-#ifdef KRB4
- { "krb4", '4', arg_flag, &use_v4, "Use Kerberos V4",
- NULL },
-#endif
-#ifdef KRB5
- { "krb5", '5', arg_flag, &use_v5, "Use Kerberos V5",
- NULL },
-#endif
- { "verbose",'v', arg_counter, &verbose_level, "Verbose",
- NULL },
- { "fork", 'f', arg_flag, &do_fork, "Fork deleting proc",
- NULL },
- { "leave", 'l', arg_flag, &do_leave, "Leave mail on server",
- NULL },
- { "port", 'p', arg_string, &port_str, "Use this port",
- "number-or-service" },
- { "from", 0, arg_flag, &do_from, "Behave like from",
- NULL },
- { "header", 0, arg_string, &header_str, "Header string to print", NULL },
- { "count", 'c', arg_flag, &do_count, "Print number of messages", NULL},
- { "version", 0, arg_flag, &do_version, "Print version",
- NULL },
- { "help", 0, arg_flag, &do_help, NULL,
- NULL }
-
-};
-
-static void
-usage (int ret)
-{
- arg_printusage (args,
- sizeof(args) / sizeof(args[0]),
- NULL,
- "[[{po:username[@hostname] | hostname[:username]}] ...]"
- "filename");
- exit (ret);
-}
-
-static int
-do_connect (const char *hostname, int port, int nodelay)
-{
- struct hostent *hostent = NULL;
- char **h;
- int error;
- int af;
- int s;
-
-#ifdef HAVE_IPV6
- if (hostent == NULL)
- hostent = getipnodebyname (hostname, AF_INET6, 0, &error);
-#endif
- if (hostent == NULL)
- hostent = getipnodebyname (hostname, AF_INET, 0, &error);
-
- if (hostent == NULL)
- errx(1, "gethostbyname '%s' failed: %s", hostname, hstrerror(error));
-
- af = hostent->h_addrtype;
-
- for (h = hostent->h_addr_list; *h != NULL; ++h) {
- struct sockaddr_storage sa_ss;
- struct sockaddr *sa = (struct sockaddr *)&sa_ss;
-
- sa->sa_family = af;
- socket_set_address_and_port (sa, *h, port);
-
- s = socket (af, SOCK_STREAM, 0);
- if (s < 0)
- err (1, "socket");
- if (connect(s, sa, socket_sockaddr_size(sa)) < 0) {
- warn ("connect(%s)", hostname);
- close (s);
- continue;
- } else {
- break;
- }
- }
- freehostent (hostent);
- if (*h == NULL)
- return -1;
- if(setsockopt(s, IPPROTO_TCP, TCP_NODELAY,
- (void *)&nodelay, sizeof(nodelay)) < 0)
- err (1, "setsockopt TCP_NODELAY");
- return s;
-}
-
-typedef enum { INIT = 0, GREET, USER, PASS, STAT, RETR, TOP,
- DELE, XDELE, QUIT} pop_state;
-
-#define PUSH_BUFSIZ 65536
-
-#define STEP 16
-
-struct write_state {
- struct iovec *iovecs;
- size_t niovecs, maxiovecs, allociovecs;
- int fd;
-};
-
-static void
-write_state_init (struct write_state *w, int fd)
-{
-#ifdef UIO_MAXIOV
- w->maxiovecs = UIO_MAXIOV;
-#else
- w->maxiovecs = 16;
-#endif
- w->allociovecs = min(STEP, w->maxiovecs);
- w->niovecs = 0;
- w->iovecs = malloc(w->allociovecs * sizeof(*w->iovecs));
- if (w->iovecs == NULL)
- err (1, "malloc");
- w->fd = fd;
-}
-
-static void
-write_state_add (struct write_state *w, void *v, size_t len)
-{
- if(w->niovecs == w->allociovecs) {
- if(w->niovecs == w->maxiovecs) {
- if(writev (w->fd, w->iovecs, w->niovecs) < 0)
- err(1, "writev");
- w->niovecs = 0;
- } else {
- w->allociovecs = min(w->allociovecs + STEP, w->maxiovecs);
- w->iovecs = realloc (w->iovecs,
- w->allociovecs * sizeof(*w->iovecs));
- if (w->iovecs == NULL)
- errx (1, "realloc");
- }
- }
- w->iovecs[w->niovecs].iov_base = v;
- w->iovecs[w->niovecs].iov_len = len;
- ++w->niovecs;
-}
-
-static void
-write_state_flush (struct write_state *w)
-{
- if (w->niovecs) {
- if (writev (w->fd, w->iovecs, w->niovecs) < 0)
- err (1, "writev");
- w->niovecs = 0;
- }
-}
-
-static void
-write_state_destroy (struct write_state *w)
-{
- free (w->iovecs);
-}
-
-static int
-doit(int s,
- const char *host,
- const char *user,
- const char *outfilename,
- const char *header_str,
- int leavep,
- int verbose,
- int forkp)
-{
- int ret;
- char out_buf[PUSH_BUFSIZ];
- size_t out_len = 0;
- char in_buf[PUSH_BUFSIZ + 1]; /* sentinel */
- size_t in_len = 0;
- char *in_ptr = in_buf;
- pop_state state = INIT;
- unsigned count, bytes;
- unsigned asked_for = 0, retrieved = 0, asked_deleted = 0, deleted = 0;
- unsigned sent_xdele = 0;
- int out_fd;
- char from_line[128];
- size_t from_line_length;
- time_t now;
- struct write_state write_state;
-
- if (do_from) {
- out_fd = -1;
- if (verbose)
- fprintf (stderr, "%s@%s\n", user, host);
- } else {
- out_fd = open(outfilename, O_WRONLY | O_APPEND | O_CREAT, 0666);
- if (out_fd < 0)
- err (1, "open %s", outfilename);
- if (verbose)
- fprintf (stderr, "%s@%s -> %s\n", user, host, outfilename);
- }
-
- now = time(NULL);
- from_line_length = snprintf (from_line, sizeof(from_line),
- "From %s %s", "push", ctime(&now));
-
- out_len = snprintf (out_buf, sizeof(out_buf),
- "USER %s\r\nPASS hej\r\nSTAT\r\n",
- user);
- if (net_write (s, out_buf, out_len) != out_len)
- err (1, "write");
- if (verbose > 1)
- write (STDERR_FILENO, out_buf, out_len);
-
- if (!do_from)
- write_state_init (&write_state, out_fd);
-
- while(state != QUIT) {
- fd_set readset, writeset;
-
- FD_ZERO(&readset);
- FD_ZERO(&writeset);
- FD_SET(s,&readset);
- if (((state == STAT || state == RETR || state == TOP)
- && asked_for < count)
- || (state == XDELE && !sent_xdele)
- || (state == DELE && asked_deleted < count))
- FD_SET(s,&writeset);
- ret = select (s + 1, &readset, &writeset, NULL, NULL);
- if (ret < 0) {
- if (errno == EAGAIN)
- continue;
- else
- err (1, "select");
- }
-
- if (FD_ISSET(s, &readset)) {
- char *beg, *p;
- size_t rem;
- int blank_line = 0;
-
- ret = read (s, in_ptr, sizeof(in_buf) - in_len - 1);
- if (ret < 0)
- err (1, "read");
- else if (ret == 0)
- errx (1, "EOF during read");
-
- in_len += ret;
- in_ptr += ret;
- *in_ptr = '\0';
-
- beg = in_buf;
- rem = in_len;
- while(rem > 1
- && (p = strstr(beg, "\r\n")) != NULL) {
- if (state == TOP) {
- char *copy = beg;
-
- if (strncasecmp(copy,
- header_str,
- min(p - copy + 1, strlen(header_str))) == 0) {
- fprintf (stdout, "%.*s\n", (int)(p - copy), copy);
- }
- if (beg[0] == '.' && beg[1] == '\r' && beg[2] == '\n') {
- state = STAT;
- if (++retrieved == count) {
- state = QUIT;
- net_write (s, "QUIT\r\n", 6);
- if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
- }
- }
- rem -= p - beg + 2;
- beg = p + 2;
- } else if (state == RETR) {
- char *copy = beg;
- if (beg[0] == '.') {
- if (beg[1] == '\r' && beg[2] == '\n') {
- if(!blank_line)
- write_state_add(&write_state, "\n", 1);
- state = STAT;
- rem -= p - beg + 2;
- beg = p + 2;
- if (++retrieved == count) {
- write_state_flush (&write_state);
- if (fsync (out_fd) < 0)
- err (1, "fsync");
- close(out_fd);
- if (leavep) {
- state = QUIT;
- net_write (s, "QUIT\r\n", 6);
- if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
- } else {
- if (forkp) {
- pid_t pid;
-
- pid = fork();
- if (pid < 0)
- warn ("fork");
- else if(pid != 0) {
- if(verbose)
- fprintf (stderr,
- "(exiting)");
- return 0;
- }
- }
-
- state = XDELE;
- if (verbose)
- fprintf (stderr, "deleting... ");
- }
- }
- continue;
- } else
- ++copy;
- }
- *p = '\n';
- if(blank_line &&
- strncmp(copy, "From ", min(p - copy + 1, 5)) == 0)
- write_state_add(&write_state, ">", 1);
- write_state_add(&write_state, copy, p - copy + 1);
- blank_line = (*copy == '\n');
- rem -= p - beg + 2;
- beg = p + 2;
- } else if (rem >= 3 && strncmp (beg, "+OK", 3) == 0) {
- if (state == STAT) {
- if (!do_from)
- write_state_add(&write_state,
- from_line, from_line_length);
- blank_line = 0;
- if (do_from)
- state = TOP;
- else
- state = RETR;
- } else if (state == XDELE) {
- state = QUIT;
- net_write (s, "QUIT\r\n", 6);
- if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
- break;
- } else if (state == DELE) {
- if (++deleted == count) {
- state = QUIT;
- net_write (s, "QUIT\r\n", 6);
- if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
- break;
- }
- } else if (++state == STAT) {
- if(sscanf (beg + 4, "%u %u", &count, &bytes) != 2)
- errx(1, "Bad STAT-line: %.*s", (int)(p - beg), beg);
- if (verbose) {
- fprintf (stderr, "%u message(s) (%u bytes). "
- "fetching... ",
- count, bytes);
- if (do_from)
- fprintf (stderr, "\n");
- } else if (do_count) {
- fprintf (stderr, "%u message(s) (%u bytes).\n",
- count, bytes);
- }
- if (count == 0) {
- state = QUIT;
- net_write (s, "QUIT\r\n", 6);
- if (verbose > 1)
- net_write (STDERR_FILENO, "QUIT\r\n", 6);
- break;
- }
- }
-
- rem -= p - beg + 2;
- beg = p + 2;
- } else {
- if(state == XDELE) {
- state = DELE;
- rem -= p - beg + 2;
- beg = p + 2;
- } else
- errx (1, "Bad response: %.*s", (int)(p - beg), beg);
- }
- }
- if (!do_from)
- write_state_flush (&write_state);
-
- memmove (in_buf, beg, rem);
- in_len = rem;
- in_ptr = in_buf + rem;
- }
- if (FD_ISSET(s, &writeset)) {
- if ((state == STAT && !do_from) || state == RETR)
- out_len = snprintf (out_buf, sizeof(out_buf),
- "RETR %u\r\n", ++asked_for);
- else if ((state == STAT && do_from) || state == TOP)
- out_len = snprintf (out_buf, sizeof(out_buf),
- "TOP %u 0\r\n", ++asked_for);
- else if(state == XDELE) {
- out_len = snprintf(out_buf, sizeof(out_buf),
- "XDELE %u %u\r\n", 1, count);
- sent_xdele++;
- }
- else if(state == DELE)
- out_len = snprintf (out_buf, sizeof(out_buf),
- "DELE %u\r\n", ++asked_deleted);
- if (net_write (s, out_buf, out_len) != out_len)
- err (1, "write");
- if (verbose > 1)
- write (STDERR_FILENO, out_buf, out_len);
- }
- }
- if (verbose)
- fprintf (stderr, "Done\n");
- if (!do_from)
- write_state_destroy (&write_state);
- return 0;
-}
-
-#ifdef KRB5
-static int
-do_v5 (const char *host,
- int port,
- const char *user,
- const char *filename,
- const char *header_str,
- int leavep,
- int verbose,
- int forkp)
-{
- krb5_error_code ret;
- krb5_auth_context auth_context = NULL;
- krb5_principal server;
- int s;
-
- s = do_connect (host, port, 1);
- if (s < 0)
- return 1;
-
- ret = krb5_sname_to_principal (context,
- host,
- "pop",
- KRB5_NT_SRV_HST,
- &server);
- if (ret) {
- warnx ("krb5_sname_to_principal: %s",
- krb5_get_err_text (context, ret));
- return 1;
- }
-
- ret = krb5_sendauth (context,
- &auth_context,
- &s,
- "KPOPV1.0",
- NULL,
- server,
- 0,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL,
- NULL);
- krb5_free_principal (context, server);
- if (ret) {
- warnx ("krb5_sendauth: %s",
- krb5_get_err_text (context, ret));
- return 1;
- }
- return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
-}
-#endif
-
-#ifdef KRB4
-static int
-do_v4 (const char *host,
- int port,
- const char *user,
- const char *filename,
- const char *header_str,
- int leavep,
- int verbose,
- int forkp)
-{
- KTEXT_ST ticket;
- MSG_DAT msg_data;
- CREDENTIALS cred;
- des_key_schedule sched;
- int s;
- int ret;
-
- s = do_connect (host, port, 1);
- if (s < 0)
- return 1;
- ret = krb_sendauth(0,
- s,
- &ticket,
- "pop",
- (char *)host,
- krb_realmofhost(host),
- getpid(),
- &msg_data,
- &cred,
- sched,
- NULL,
- NULL,
- "KPOPV0.1");
- if(ret) {
- warnx("krb_sendauth: %s", krb_get_err_text(ret));
- return 1;
- }
- return doit (s, host, user, filename, header_str, leavep, verbose, forkp);
-}
-#endif /* KRB4 */
-
-#ifdef HESIOD
-
-#ifdef HESIOD_INTERFACES
-
-static char *
-hesiod_get_pobox (const char **user)
-{
- void *context;
- struct hesiod_postoffice *hpo;
- char *ret = NULL;
-
- if(hesiod_init (&context) != 0)
- err (1, "hesiod_init");
-
- hpo = hesiod_getmailhost (context, *user);
- if (hpo == NULL) {
- warn ("hesiod_getmailhost %s", *user);
- } else {
- if (strcasecmp(hpo->hesiod_po_type, "pop") != 0)
- errx (1, "Unsupported po type %s", hpo->hesiod_po_type);
-
- ret = strdup(hpo->hesiod_po_host);
- if(ret == NULL)
- errx (1, "strdup: out of memory");
- *user = strdup(hpo->hesiod_po_name);
- if (*user == NULL)
- errx (1, "strdup: out of memory");
- hesiod_free_postoffice (context, hpo);
- }
- hesiod_end (context);
- return ret;
-}
-
-#else /* !HESIOD_INTERFACES */
-
-static char *
-hesiod_get_pobox (const char **user)
-{
- char *ret = NULL;
- struct hes_postoffice *hpo;
-
- hpo = hes_getmailhost (*user);
- if (hpo == NULL) {
- warn ("hes_getmailhost %s", *user);
- } else {
- if (strcasecmp(hpo->po_type, "pop") != 0)
- errx (1, "Unsupported po type %s", hpo->po_type);
-
- ret = strdup(hpo->po_host);
- if(ret == NULL)
- errx (1, "strdup: out of memory");
- *user = strdup(hpo->po_name);
- if (*user == NULL)
- errx (1, "strdup: out of memory");
- }
- return ret;
-}
-
-#endif /* HESIOD_INTERFACES */
-
-#endif /* HESIOD */
-
-static char *
-get_pobox (const char **user)
-{
- char *ret = NULL;
-
-#ifdef HESIOD
- ret = hesiod_get_pobox (user);
-#endif
-
- if (ret == NULL)
- ret = getenv("MAILHOST");
- if (ret == NULL)
- errx (1, "MAILHOST not set");
- return ret;
-}
-
-static void
-parse_pobox (char *a0, const char **host, const char **user)
-{
- const char *h, *u;
- char *p;
- int po = 0;
-
- if (a0 == NULL) {
-
- *user = getenv ("USERNAME");
- if (*user == NULL) {
- struct passwd *pwd = getpwuid (getuid ());
-
- if (pwd == NULL)
- errx (1, "Who are you?");
- *user = strdup (pwd->pw_name);
- if (*user == NULL)
- errx (1, "strdup: out of memory");
- }
- *host = get_pobox (user);
- return;
- }
-
- /* if the specification starts with po:, remember this information */
- if(strncmp(a0, "po:", 3) == 0) {
- a0 += 3;
- po++;
- }
- /* if there is an `@', the hostname is after it, otherwise at the
- beginning of the string */
- p = strchr(a0, '@');
- if(p != NULL) {
- *p++ = '\0';
- h = p;
- } else {
- h = a0;
- }
- /* if there is a `:', the username comes before it, otherwise at
- the beginning of the string */
- p = strchr(a0, ':');
- if(p != NULL) {
- *p++ = '\0';
- u = p;
- } else {
- u = a0;
- }
- if(h == u) {
- /* some inconsistent compatibility with various mailers */
- if(po) {
- h = get_pobox (&u);
- } else {
- u = get_default_username ();
- if (u == NULL)
- errx (1, "Who are you?");
- }
- }
- *host = h;
- *user = u;
-}
-
-int
-main(int argc, char **argv)
-{
- int port = 0;
- int optind = 0;
- int ret = 1;
- const char *host, *user, *filename = NULL;
- char *pobox = NULL;
-
- set_progname (argv[0]);
-
-#ifdef KRB5
- krb5_init_context (&context);
-#endif
-
- if (getarg (args, sizeof(args) / sizeof(args[0]), argc, argv,
- &optind))
- usage (1);
-
- argc -= optind;
- argv += optind;
-
-#if defined(KRB4) && defined(KRB5)
- if(use_v4 == -1 && use_v5 == 1)
- use_v4 = 0;
- if(use_v5 == -1 && use_v4 == 1)
- use_v5 = 0;
-#endif
-
- if (do_help)
- usage (0);
-
- if (do_version) {
- print_version(NULL);
- return 0;
- }
-
- if (do_from && header_str == NULL)
- header_str = "From:";
- else if (header_str != NULL)
- do_from = 1;
-
- if (do_from) {
- if (argc == 0)
- pobox = NULL;
- else if (argc == 1)
- pobox = argv[0];
- else
- usage (1);
- } else {
- if (argc == 1) {
- filename = argv[0];
- pobox = NULL;
- } else if (argc == 2) {
- filename = argv[1];
- pobox = argv[0];
- } else
- usage (1);
- }
-
- if (port_str) {
- struct servent *s = roken_getservbyname (port_str, "tcp");
-
- if (s)
- port = s->s_port;
- else {
- char *ptr;
-
- port = strtol (port_str, &ptr, 10);
- if (port == 0 && ptr == port_str)
- errx (1, "Bad port `%s'", port_str);
- port = htons(port);
- }
- }
- if (port == 0)
-#ifdef KRB5
- port = krb5_getportbyname (context, "kpop", "tcp", 1109);
-#elif defined(KRB4)
- port = k_getportbyname ("kpop", "tcp", 1109);
-#else
-#error must define KRB4 or KRB5
-#endif
-
- parse_pobox (pobox, &host, &user);
-
-#ifdef KRB5
- if (ret && use_v5) {
- ret = do_v5 (host, port, user, filename, header_str,
- do_leave, verbose_level, do_fork);
- }
-#endif
-
-#ifdef KRB4
- if (ret && use_v4) {
- ret = do_v4 (host, port, user, filename, header_str,
- do_leave, verbose_level, do_fork);
- }
-#endif /* KRB4 */
- return ret;
-}
diff --git a/crypto/kerberosIV/appl/push/push.cat8 b/crypto/kerberosIV/appl/push/push.cat8
deleted file mode 100644
index bdd380491bafc..0000000000000
--- a/crypto/kerberosIV/appl/push/push.cat8
+++ /dev/null
@@ -1,77 +0,0 @@
-
-PUSH(8) UNIX System Manager's Manual PUSH(8)
-
-NNAAMMEE
- ppuusshh - fetch mail via POP
-
-SSYYNNOOPPSSIISS
- ppuusshh [--44 | ----kkrrbb44] [--55 | ----kkrrbb55] [--vv | ----vveerrbboossee] [--ff | ----ffoorrkk] [--ll |
- ----lleeaavvee] [----ffrroomm] [--cc | ----ccoouunntt] [----hheeaaddeerr] [--pp _p_o_r_t_-_s_p_e_c | ----ppoorrtt==_p_o_r_t_-
- _s_p_e_c] _p_o_-_b_o_x _f_i_l_e_n_a_m_e
-
-DDEESSCCRRIIPPTTIIOONN
- ppuusshh retrieves mail from the post office box _p_o_-_b_o_x, and stores the mail
- in mbox format in _f_i_l_e_n_a_m_e. The _p_o_-_b_o_x can have any of the following for-
- mats:
- `hostname:username'
- `po:hostname:username'
- `username@hostname'
- `po:username@hostname'
- `hostname'
- `po:username'
-
- If no username is specified, ppuusshh assumes that it's the same as on the
- local machine; _h_o_s_t_n_a_m_e defaults to the value of the MAILHOST environment
- variable.
-
- Supported options:
-
- --44, ----kkrrbb44
- use Kerberos 4 (if compiled with support for Kerberos 4)
-
- --55, ----kkrrbb55
- use Kerberos 5 (if compiled with support for Kerberos 5)
-
- --ff, ----ffoorrkk
- fork before starting to delete messages
-
- --ll, ----lleeaavvee
- don't delete fetched mail
-
- ----ffrroomm behave like from.
-
- --cc, ----ccoouunntt
- first print how many messages and bytes there are.
-
- ----hheeaaddeerr
- which header from should print.
-
- --pp _p_o_r_t_-_s_p_e_c, ----ppoorrtt==_p_o_r_t_-_s_p_e_c
- use this port instead of the default `kpop' or `1109'.
-
- The default is to first try Kerberos 5 authentication and then, if that
- fails, Kerberos 4.
-
-EENNVVIIRROONNMMEENNTT
- MAILHOST
- points to the post office, if no other hostname is specified.
-
-EEXXAAMMPPLLEESS
- $ push cornfield:roosta ~/.gnus-crash-box
-
- tries to fetch mail for the user _r_o_o_s_t_a from the post office at
- ``cornfield'', and stores the mail in _~_/_._g_n_u_s_-_c_r_a_s_h_-_b_o_x (you are using
- Gnus, aren't you?)
-
- $ push --from -5 havregryn
-
- tries to fetch FFrroomm:: lines for current user at post office ``havregryn''
- using Kerberos 5.
-
-SSEEEE AALLSSOO
- movemail(8), popper(8), from(1)
-
-HHIISSTTOORRYY
- ppuusshh was written while waiting for mmoovveemmaaiill to finish getting the mail.
-
- HEIMDAL May 31, 1998 2
diff --git a/crypto/kerberosIV/appl/push/push_locl.h b/crypto/kerberosIV/appl/push/push_locl.h
deleted file mode 100644
index 1e5ca784c845e..0000000000000
--- a/crypto/kerberosIV/appl/push/push_locl.h
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-/* $Id: push_locl.h,v 1.6 1999/12/02 16:58:33 joda Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_ERRNO_H
-#include <errno.h>
-#endif
-#include <ctype.h>
-#include <limits.h>
-#include <time.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SELECT_H
-#include <sys/select.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_UIO_H
-#include <sys/uio.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_NETINET_IN6_H
-#include <netinet/in6.h>
-#endif
-#ifdef HAVE_NETINET6_IN6_H
-#include <netinet6/in6.h>
-#endif
-#ifdef HAVE_NETINET_TCP_H
-#include <netinet/tcp.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef HESIOD
-#include <hesiod.h>
-#endif
-
-#include <roken.h>
-#include <err.h>
-#include <getarg.h>
-#ifdef KRB5
-#include <krb5.h>
-#endif
-
-#ifdef KRB4
-#include <krb.h>
-#endif
diff --git a/crypto/kerberosIV/appl/sample/Makefile.in b/crypto/kerberosIV/appl/sample/Makefile.in
deleted file mode 100644
index d88023a2d2870..0000000000000
--- a/crypto/kerberosIV/appl/sample/Makefile.in
+++ /dev/null
@@ -1,83 +0,0 @@
-# $Id: Makefile.in,v 1.18 1999/03/10 19:01:13 joda Exp $
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-top_builddir = ../..
-
-CC = @CC@
-LINK = @LINK@
-AR = ar
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@ $(WFLAGS)
-WFLAGS = @WFLAGS@
-LD_FLAGS = @LD_FLAGS@
-INSTALL = @INSTALL@
-LIBS = @LIBS@
-MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-libdir = @libdir@
-libexecdir = @libexecdir@
-bindir = @bindir@
-transform=@program_transform_name@
-EXECSUFFIX=@EXECSUFFIX@
-
-PROG_BIN = sample_client$(EXECSUFFIX) \
- simple_client$(EXECSUFFIX)
-PROG_LIBEXEC = sample_server$(EXECSUFFIX) \
- simple_server$(EXECSUFFIX)
-PROGS = $(PROG_BIN) $(PROG_LIBEXEC)
-
-OBJECTS = sample_client.o sample_server.o simple_client.o simple_server.o
-SOURCES = sample_client.c sample_server.c simple_client.c simple_server.c
-
-all: $(PROGS)
-
-Wall:
- make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
-
-.c.o:
- $(CC) -c $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $<
-
-install: all
-
-uninstall:
-
-TAGS: $(SOURCES)
- etags $(SOURCES)
-
-check:
-
-clean:
- rm -f *.a *.o $(PROGS)
-
-mostlyclean: clean
-
-distclean: clean
- rm -f Makefile *.tab.c *~
-
-realclean: distclean
- rm -f TAGS
-
-KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes
-LIBROKEN=-L../../lib/roken -lroken
-
-sample_client$(EXECSUFFIX): sample_client.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ sample_client.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-simple_client$(EXECSUFFIX): simple_client.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ simple_client.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-sample_server$(EXECSUFFIX): sample_server.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ sample_server.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-simple_server$(EXECSUFFIX): simple_server.o
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ simple_server.o $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-$(OBJECTS): ../../include/config.h
-
-.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/appl/sample/sample.h b/crypto/kerberosIV/appl/sample/sample.h
deleted file mode 100644
index d79d57441a7cc..0000000000000
--- a/crypto/kerberosIV/appl/sample/sample.h
+++ /dev/null
@@ -1,76 +0,0 @@
-/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * 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. Neither the name of the Institute 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 INSTITUTE 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 INSTITUTE 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.
- */
-
-/* $Id: sample.h,v 1.11 1999/12/02 16:58:33 joda Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_SYS_SOCKET_H
-#include <sys/socket.h>
-#endif
-#ifdef HAVE_NETINET_IN_H
-#include <netinet/in.h>
-#endif
-#ifdef HAVE_ARPA_INET_H
-#include <arpa/inet.h>
-#endif
-#ifdef HAVE_NETDB_H
-#include <netdb.h>
-#endif
-#include <errno.h>
-#ifdef SOCKS
-#include <socks.h>
-/* This doesn't belong here. */
-struct tm *localtime(const time_t *);
-struct hostent *gethostbyname(const char *);
-#endif
-
-#include <err.h>
-#include <krb.h>
-
-#include <roken.h>
-
-#define SAMPLE_PORT 6354
-
-#define SAMPLE_SERVICE "sample"
-#define SAMPLE_VERSION "VERSION9"
diff --git a/crypto/kerberosIV/appl/sample/sample_client.c b/crypto/kerberosIV/appl/sample/sample_client.c
deleted file mode 100644
index d0ec1c5667490..0000000000000
--- a/crypto/kerberosIV/appl/sample/sample_client.c
+++ /dev/null
@@ -1,168 +0,0 @@
-/*
- *
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please see the file <mit-copyright.h>.
- *
- * sample_client:
- * A sample Kerberos client, which connects to a server on a remote host,
- * at port "sample" (be sure to define it in /etc/services)
- * and authenticates itself to the server. The server then writes back
- * (in ASCII) the authenticated name.
- *
- * Usage:
- * sample_client <hostname> <checksum>
- *
- * <hostname> is the name of the foreign host to contact.
- *
- * <checksum> is an integer checksum to be used for the call to krb_mk_req()
- * and mutual authentication
- *
- */
-
-#include "sample.h"
-
-RCSID("$Id: sample_client.c,v 1.21 1999/11/13 06:27:01 assar Exp $");
-
-static void
-usage (void)
-{
- fprintf (stderr, "Usage: %s [-s service] [-p port] hostname checksum\n",
- __progname);
- exit (1);
-}
-
-int
-main(int argc, char **argv)
-{
- struct hostent *hp;
- struct sockaddr_in sin, lsin;
- char *remote_host;
- int status;
- int namelen;
- int sock = -1;
- KTEXT_ST ticket;
- char buf[512];
- long authopts;
- MSG_DAT msg_data;
- CREDENTIALS cred;
- des_key_schedule sched;
- u_int32_t cksum;
- int c;
- char service[SNAME_SZ];
- u_int16_t port;
- struct servent *serv;
- char **h_addr_list;
-
- set_progname (argv[0]);
- strlcpy (service, SAMPLE_SERVICE, sizeof(service));
- port = 0;
-
- while ((c = getopt(argc, argv, "s:p:")) != -1)
- switch(c) {
- case 's' :
- strlcpy (service, optarg, sizeof(service));
- break;
- case 'p' :
- serv = getservbyname (optarg, "tcp");
- if (serv)
- port = serv->s_port;
- else
- port = htons(atoi(optarg));
- break;
- case '?' :
- default :
- usage();
- }
-
- argc -= optind;
- argv += optind;
-
- if (argc != 2)
- usage ();
-
- /* convert cksum to internal rep */
- cksum = atoi(argv[1]);
-
- printf("Setting checksum to %ld\n", (long)cksum);
-
- /* clear out the structure first */
- memset(&sin, 0, sizeof(sin));
- sin.sin_family = AF_INET;
- if (port)
- sin.sin_port = port;
- else
- sin.sin_port = k_getportbyname (service, "tcp", htons(SAMPLE_PORT));
-
- /* look up the server host */
- hp = gethostbyname(argv[0]);
- if (hp == NULL)
- errx (1, "gethostbyname(%s): %s", argv[0],
- hstrerror(h_errno));
-
- /* copy the hostname into non-volatile storage */
- remote_host = strdup(hp->h_name);
- if (remote_host == NULL)
- errx (1, "strdup: out of memory");
-
- /* set up the address of the foreign socket for connect() */
- sin.sin_family = hp->h_addrtype;
-
- for (h_addr_list = hp->h_addr_list;
- *h_addr_list;
- ++h_addr_list) {
- memcpy(&sin.sin_addr, *h_addr_list, sizeof(sin.sin_addr));
- fprintf (stderr, "Trying %s...\n", inet_ntoa(sin.sin_addr));
-
- /* open a TCP socket */
- sock = socket(PF_INET, SOCK_STREAM, 0);
- if (sock < 0)
- err (1, "socket");
-
- /* connect to the server */
- if (connect(sock, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
- break;
- close (sock);
- }
-
- if (*h_addr_list == NULL)
- err (1, "connect");
-
- /* find out who I am, now that we are connected and therefore bound */
- namelen = sizeof(lsin);
- if (getsockname(sock, (struct sockaddr *) &lsin, &namelen) < 0) {
- close (sock);
- err (1, "getsockname");
- }
-
- /* call Kerberos library routine to obtain an authenticator,
- pass it over the socket to the server, and obtain mutual
- authentication. */
-
- authopts = KOPT_DO_MUTUAL;
- status = krb_sendauth(authopts, sock, &ticket,
- service, remote_host,
- NULL, cksum, &msg_data, &cred,
- sched, &lsin, &sin, SAMPLE_VERSION);
- if (status != KSUCCESS)
- errx (1, "cannot authenticate to server: %s",
- krb_get_err_text(status));
-
- /* After we send the authenticator to the server, it will write
- back the name we authenticated to. Read what it has to say. */
- status = read(sock, buf, sizeof(buf));
- if (status < 0)
- errx(1, "read");
-
- /* make sure it's null terminated before printing */
- if (status < sizeof(buf))
- buf[status] = '\0';
- else
- buf[sizeof(buf) - 1] = '\0';
-
- printf("The server says:\n%s\n", buf);
-
- close(sock);
- return 0;
-}
diff --git a/crypto/kerberosIV/appl/sample/sample_server.c b/crypto/kerberosIV/appl/sample/sample_server.c
deleted file mode 100644
index 5442562f3aa38..0000000000000
--- a/crypto/kerberosIV/appl/sample/sample_server.c
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *
- * Copyright 1987, 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information,
- * please see the file <mit-copyright.h>.
- *
- * sample_server:
- * A sample Kerberos server, which reads a ticket from a TCP socket,
- * decodes it, and writes back the results (in ASCII) to the client.
- *
- * Usage:
- * sample_server
- *
- * file descriptor 0 (zero) should be a socket connected to the requesting
- * client (this will be correct if this server is started by inetd).
- */
-
-#include "sample.h"
-
-RCSID("$Id: sample_server.c,v 1.14 1999/11/13 06:28:49 assar Exp $");
-
-static void
-usage (void)
-{
- fprintf (stderr, "Usage: %s [-i] [-s service] [-t srvtab]\n",
- __progname);
- exit (1);
-}
-
-int
-main(int argc, char **argv)
-{
- struct sockaddr_in peername, myname;
- int namelen = sizeof(peername);
- int status, count, len;
- long authopts;
- AUTH_DAT auth_data;
- KTEXT_ST clt_ticket;
- des_key_schedule sched;
- char instance[INST_SZ];
- char service[ANAME_SZ];
- char version[KRB_SENDAUTH_VLEN+1];
- char retbuf[512];
- char lname[ANAME_SZ];
- char srvtab[MaxPathLen];
- int c;
- int no_inetd = 0;
-
- /* open a log connection */
-
- set_progname (argv[0]);
-
- roken_openlog(__progname, LOG_ODELAY, LOG_DAEMON);
-
- strlcpy (service, SAMPLE_SERVICE, sizeof(service));
- *srvtab = '\0';
-
- while ((c = getopt (argc, argv, "s:t:i")) != -1)
- switch (c) {
- case 's' :
- strlcpy (service, optarg, sizeof(service));
- break;
- case 't' :
- strlcpy (srvtab, optarg, sizeof(srvtab));
- break;
- case 'i':
- no_inetd = 1;
- break;
- case '?' :
- default :
- usage ();
- }
-
- if (no_inetd)
- mini_inetd (htons(SAMPLE_PORT));
-
- /*
- * To verify authenticity, we need to know the address of the
- * client.
- */
- if (getpeername(STDIN_FILENO,
- (struct sockaddr *)&peername,
- &namelen) < 0) {
- syslog(LOG_ERR, "getpeername: %m");
- return 1;
- }
-
- /* for mutual authentication, we need to know our address */
- namelen = sizeof(myname);
- if (getsockname(STDIN_FILENO, (struct sockaddr *)&myname, &namelen) < 0) {
- syslog(LOG_ERR, "getsocknamename: %m");
- return 1;
- }
-
- /* read the authenticator and decode it. Using `k_getsockinst' we
- * always get the right instance on a multi-homed host.
- */
- k_getsockinst (STDIN_FILENO, instance, sizeof(instance));
-
- /* we want mutual authentication */
- authopts = KOPT_DO_MUTUAL;
- status = krb_recvauth(authopts, STDIN_FILENO, &clt_ticket,
- service, instance, &peername, &myname,
- &auth_data, srvtab,
- sched, version);
- if (status != KSUCCESS) {
- snprintf(retbuf, sizeof(retbuf),
- "Kerberos error: %s\n",
- krb_get_err_text(status));
- syslog(LOG_ERR, retbuf);
- } else {
- /* Check the version string (KRB_SENDAUTH_VLEN chars) */
- if (strncmp(version, SAMPLE_VERSION, KRB_SENDAUTH_VLEN)) {
- /* didn't match the expected version */
- /* could do something different, but we just log an error
- and continue */
- version[8] = '\0'; /* make sure null term */
- syslog(LOG_ERR, "Version mismatch: '%s' isn't '%s'",
- version, SAMPLE_VERSION);
- }
- /* now that we have decoded the authenticator, translate
- the kerberos principal.instance@realm into a local name */
- if (krb_kntoln(&auth_data, lname) != KSUCCESS)
- strlcpy(lname,
- "*No local name returned by krb_kntoln*",
- sizeof(lname));
- /* compose the reply */
- snprintf(retbuf, sizeof(retbuf),
- "You are %s.%s@%s (local name %s),\n at address %s, version %s, cksum %ld\n",
- auth_data.pname,
- auth_data.pinst,
- auth_data.prealm,
- lname,
- inet_ntoa(peername.sin_addr),
- version,
- (long)auth_data.checksum);
- }
-
- /* write back the response */
- if ((count = write(0, retbuf, (len = strlen(retbuf) + 1))) < 0) {
- syslog(LOG_ERR,"write: %m");
- return 1;
- } else if (count != len) {
- syslog(LOG_ERR, "write count incorrect: %d != %d\n",
- count, len);
- return 1;
- }
-
- /* close up and exit */
- close(0);
- return 0;
-}
diff --git a/crypto/kerberosIV/appl/sample/simple.h b/crypto/kerberosIV/appl/sample/simple.h
deleted file mode 100644
index 17315b33475c1..0000000000000
--- a/crypto/kerberosIV/appl/sample/simple.h
+++ /dev/null
@@ -1,14 +0,0 @@
-/*
- * $Id: simple.h,v 1.3 1996/09/27 15:54:23 assar Exp $
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Common definitions for the simple UDP-based Kerberos-mediated
- * server & client applications.
- */
-
-#define SERVICE "sample"
-#define HOST "bach"
diff --git a/crypto/kerberosIV/appl/sample/simple_client.c b/crypto/kerberosIV/appl/sample/simple_client.c
deleted file mode 100644
index 434150d2189bc..0000000000000
--- a/crypto/kerberosIV/appl/sample/simple_client.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/*
- *
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Simple UDP-based sample client program. For demonstration.
- * This program performs no useful function.
- */
-
-#include "sample.h"
-RCSID("$Id: simple_client.c,v 1.15 1999/11/13 06:29:01 assar Exp $");
-
-#define MSG "hi, Jennifer!" /* message text */
-
-static int
-talkto(char *hostname, char *service, int port)
-{
- int flags = 0; /* flags for sendto() */
- long len;
- u_long cksum = 0L; /* cksum not used */
- char c_realm[REALM_SZ]; /* local Kerberos realm */
- char *s_realm; /* server's Kerberos realm */
-
- KTEXT_ST k; /* Kerberos data */
- KTEXT ktxt = &k;
-
- int sock, i;
- struct hostent *host;
- struct sockaddr_in s_sock; /* server address */
- char myhostname[MaxHostNameLen]; /* local hostname */
-
- /* for krb_mk_safe/priv */
- struct sockaddr_in c_sock; /* client address */
- CREDENTIALS c; /* ticket & session key */
- CREDENTIALS *cred = &c;
-
- /* for krb_mk_priv */
- des_key_schedule sched; /* session key schedule */
-
- /* Look up server host */
- if ((host = gethostbyname(hostname)) == NULL) {
- fprintf(stderr, "%s: unknown host \n", hostname);
- return 1;
- }
-
- /* Set server's address */
- memset(&s_sock, 0, sizeof(s_sock));
- memcpy(&s_sock.sin_addr, host->h_addr, sizeof(s_sock.sin_addr));
- s_sock.sin_family = AF_INET;
- if (port)
- s_sock.sin_port = port;
- else
- s_sock.sin_port = k_getportbyname (service, "tcp", htons(SAMPLE_PORT));
-
- if (gethostname(myhostname, sizeof(myhostname)) < 0) {
- warn("gethostname");
- return 1;
- }
-
- if ((host = gethostbyname(myhostname)) == NULL) {
- fprintf(stderr, "%s: unknown host\n", myhostname);
- return 1;
- }
-
- /* Open a socket */
- if ((sock = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
- warn("socket SOCK_DGRAM");
- return 1;
- }
-
- memset(&c_sock, 0, sizeof(c_sock));
- memcpy(&c_sock.sin_addr, host->h_addr, sizeof(c_sock.sin_addr));
- c_sock.sin_family = AF_INET;
-
- /* Bind it to set the address; kernel will fill in port # */
- if (bind(sock, (struct sockaddr *)&c_sock, sizeof(c_sock)) < 0) {
- warn("bind");
- return 1;
- }
-
- /* Get local realm, not needed, just an example */
- if ((i = krb_get_lrealm(c_realm, 1)) != KSUCCESS) {
- fprintf(stderr, "can't find local Kerberos realm\n");
- return 1;
- }
- printf("Local Kerberos realm is %s\n", c_realm);
-
- /* Get Kerberos realm of host */
- s_realm = krb_realmofhost(hostname);
-
- /* PREPARE KRB_MK_REQ MESSAGE */
-
- /* Get credentials for server, create krb_mk_req message */
- if ((i = krb_mk_req(ktxt, service, hostname, s_realm, cksum))
- != KSUCCESS) {
- fprintf(stderr, "%s\n", krb_get_err_text(i));
- return 1;
- }
- printf("Got credentials for %s.\n", service);
-
- /* Send authentication info to server */
- i = sendto(sock, (char *)ktxt->dat, ktxt->length, flags,
- (struct sockaddr *)&s_sock, sizeof(s_sock));
- if (i < 0)
- warn("sending datagram message");
- printf("Sent authentication data: %d bytes\n", i);
-
- /* PREPARE KRB_MK_SAFE MESSAGE */
-
- /* Get my address */
- memset(&c_sock, 0, sizeof(c_sock));
- i = sizeof(c_sock);
- if (getsockname(sock, (struct sockaddr *)&c_sock, &i) < 0) {
- warn("getsockname");
- return 1;
- }
-
- /* Get session key */
- i = krb_get_cred(service, hostname, s_realm, cred);
- if (i != KSUCCESS)
- return 1;
-
- /* Make the safe message */
- len = krb_mk_safe(MSG, ktxt->dat, strlen(MSG)+1,
- &cred->session, &c_sock, &s_sock);
-
- /* Send it */
- i = sendto(sock, (char *)ktxt->dat, (int) len, flags,
- (struct sockaddr *)&s_sock, sizeof(s_sock));
- if (i < 0)
- warn("sending safe message");
- printf("Sent checksummed message: %d bytes\n", i);
-
- /* PREPARE KRB_MK_PRIV MESSAGE */
-
-#ifdef NOENCRYPTION
- memset(sched, 0, sizeof(sched));
-#else
- /* Get key schedule for session key */
- des_key_sched(&cred->session, sched);
-#endif
-
- /* Make the encrypted message */
- len = krb_mk_priv(MSG, ktxt->dat, strlen(MSG)+1,
- sched, &cred->session, &c_sock, &s_sock);
-
- /* Send it */
- i = sendto(sock, (char *)ktxt->dat, (int) len, flags,
- (struct sockaddr *)&s_sock, sizeof(s_sock));
- if (i < 0)
- warn("sending encrypted message");
- printf("Sent encrypted message: %d bytes\n", i);
- return 0;
-}
-
-static void
-usage (void)
-{
- fprintf (stderr, "Usage: %s [-s service] [-p port] hostname\n",
- __progname);
- exit (1);
-}
-
-int
-main(int argc, char **argv)
-{
- int ret = 0;
- int port = 0;
- char service[SNAME_SZ];
- struct servent *serv;
- int c;
-
- set_progname (argv[0]);
-
- strlcpy (service, SAMPLE_SERVICE, sizeof(service));
-
- while ((c = getopt(argc, argv, "s:p:")) != -1)
- switch(c) {
- case 's' :
- strlcpy (service, optarg, sizeof(service));
- break;
- case 'p' :
- serv = getservbyname (optarg, "tcp");
- if (serv)
- port = serv->s_port;
- else
- port = htons(atoi(optarg));
- break;
- case '?' :
- default :
- usage();
- }
-
- argc -= optind;
- argv += optind;
-
- while (argc-- > 0)
- ret &= talkto (*argv++, service, port);
- return ret;
-}
diff --git a/crypto/kerberosIV/appl/sample/simple_server.c b/crypto/kerberosIV/appl/sample/simple_server.c
deleted file mode 100644
index 05baa4ee1c4a0..0000000000000
--- a/crypto/kerberosIV/appl/sample/simple_server.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *
- * Copyright 1989 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Simple UDP-based server application. For demonstration.
- * This program performs no useful function.
- */
-
-#include "sample.h"
-
-RCSID("$Id: simple_server.c,v 1.11 1999/11/13 06:29:24 assar Exp $");
-
-static void
-usage (void)
-{
- fprintf (stderr, "Usage: %s [-p port] [-s service] [-t srvtab]\n",
- __progname);
- exit (1);
-}
-
-int
-main(int argc, char **argv)
-{
- char service[SNAME_SZ];
- char instance[INST_SZ];
- int port;
- char srvtab[MaxPathLen];
- struct sockaddr_in addr, otheraddr;
- int c;
- int sock;
- int i;
- int len;
- KTEXT_ST k;
- KTEXT ktxt = &k;
- AUTH_DAT ad;
- MSG_DAT msg_data;
- des_key_schedule sched;
-
- set_progname (argv[0]);
- strlcpy (service, SAMPLE_SERVICE, sizeof(service));
- strlcpy (instance, "*", sizeof(instance));
- *srvtab = '\0';
- port = 0;
-
- while ((c = getopt (argc, argv, "p:s:t:")) != -1)
- switch (c) {
- case 'p' : {
- struct servent *sp;
-
- sp = getservbyname (optarg, "udp");
- if (sp)
- port = sp->s_port;
- else
- port = htons(atoi(optarg));
- break;
- }
- case 's' :
- strlcpy (service, optarg, sizeof(service));
- break;
- case 't' :
- strlcpy (srvtab, optarg, sizeof(srvtab));
- break;
- case '?' :
- default :
- usage ();
- }
-
- if(port == 0)
- port = k_getportbyname (SAMPLE_SERVICE, "udp", htons(SAMPLE_PORT));
-
- memset (&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = port;
-
- sock = socket (AF_INET, SOCK_DGRAM, 0);
- if (sock < 0)
- err (1, "socket");
-
- if (bind (sock, (struct sockaddr *)&addr, sizeof(addr)) < 0)
- err (1, "bind");
-
- /* GET KRB_MK_REQ MESSAGE */
-
- i = read(sock, ktxt->dat, MAX_KTXT_LEN);
- if (i < 0)
- err (1, "read");
-
- printf("Received %d bytes\n", i);
- ktxt->length = i;
-
- /* Check authentication info */
- i = krb_rd_req(ktxt, service, instance, 0, &ad, "");
- if (i != KSUCCESS)
- errx (1, "krb_rd_req: %s", krb_get_err_text(i));
- printf("Got authentication info from %s%s%s@%s\n", ad.pname,
- *ad.pinst ? "." : "", ad.pinst, ad.prealm);
-
- /* GET KRB_MK_SAFE MESSAGE */
-
- /* use "recvfrom" so we know client's address */
- len = sizeof(otheraddr);
- i = recvfrom(sock, ktxt->dat, MAX_KTXT_LEN, 0,
- (struct sockaddr *)&otheraddr, &len);
- if (i < 0)
- err (1, "recvfrom");
- printf("Received %d bytes\n", i);
-
- /* Verify the checksummed message */
- i = krb_rd_safe(ktxt->dat, i, &ad.session, &otheraddr,
- &addr, &msg_data);
- if (i != KSUCCESS)
- errx (1, "krb_rd_safe: %s", krb_get_err_text(i));
- printf("Safe message is: %s\n", msg_data.app_data);
-
- /* NOW GET ENCRYPTED MESSAGE */
-
-#ifdef NOENCRYPTION
- memset(sched, 0, sizeof(sched));
-#else
- /* need key schedule for session key */
- des_key_sched(&ad.session, sched);
-#endif
-
- /* use "recvfrom" so we know client's address */
- len = sizeof(otheraddr);
- i = recvfrom(sock, ktxt->dat, MAX_KTXT_LEN, 0,
- (struct sockaddr *)&otheraddr, &len);
- if (i < 0)
- err (1, "recvfrom");
- printf("Received %d bytes\n", i);
- i = krb_rd_priv(ktxt->dat, i, sched, &ad.session, &otheraddr,
- &addr, &msg_data);
- if (i != KSUCCESS)
- errx (1, "krb_rd_priv: %s", krb_get_err_text(i));
- printf("Decrypted message is: %s\n", msg_data.app_data);
- return(0);
-}