summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/appl/kauth
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/kerberosIV/appl/kauth')
-rw-r--r--crypto/kerberosIV/appl/kauth/ChangeLog41
-rw-r--r--crypto/kerberosIV/appl/kauth/Makefile.am42
-rw-r--r--crypto/kerberosIV/appl/kauth/Makefile.in115
-rw-r--r--crypto/kerberosIV/appl/kauth/encdata.c96
-rw-r--r--crypto/kerberosIV/appl/kauth/kauth.c384
-rw-r--r--crypto/kerberosIV/appl/kauth/kauth.h116
-rw-r--r--crypto/kerberosIV/appl/kauth/kauthd.c202
-rw-r--r--crypto/kerberosIV/appl/kauth/ksrvtgt.in15
-rw-r--r--crypto/kerberosIV/appl/kauth/marshall.c126
-rw-r--r--crypto/kerberosIV/appl/kauth/rkinit.c226
-rw-r--r--crypto/kerberosIV/appl/kauth/zrefresh12
11 files changed, 0 insertions, 1375 deletions
diff --git a/crypto/kerberosIV/appl/kauth/ChangeLog b/crypto/kerberosIV/appl/kauth/ChangeLog
deleted file mode 100644
index 7ce281c..0000000
--- a/crypto/kerberosIV/appl/kauth/ChangeLog
+++ /dev/null
@@ -1,41 +0,0 @@
-2000-02-28 Assar Westerlund <assar@sics.se>
-
- * kauth.c (main): don't enable aflag with `-d'. this breaks with
- kaservers that don't let you get a ticket for a user and besides,
- adding debugging should not change the functionality
-
-1999-12-06 Assar Westerlund <assar@sics.se>
-
- * rkinit.c (doit_host): NAT work-around
- * kauthd.c (doit): type correctness
-
-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 a5bf0fdaca..0000000
--- 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/kauth/Makefile.in b/crypto/kerberosIV/appl/kauth/Makefile.in
deleted file mode 100644
index 1e8a4c1..0000000
--- a/crypto/kerberosIV/appl/kauth/Makefile.in
+++ /dev/null
@@ -1,115 +0,0 @@
-# $Id: Makefile.in,v 1.40.16.1 2000/06/23 02:52:31 assar Exp $
-
-SHELL = /bin/sh
-
-srcdir = @srcdir@
-VPATH = @srcdir@
-
-top_builddir = ../..
-
-CC = @CC@
-LINK = @LINK@
-AR = ar
-RANLIB = @RANLIB@
-DEFS = @DEFS@ -DBINDIR='"$(bindir)"'
-CFLAGS = @CFLAGS@ $(WFLAGS)
-WFLAGS = @WFLAGS@
-LD_FLAGS = @LD_FLAGS@
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-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 = kauth$(EXECSUFFIX)
-SCRIPT_BIN = ksrvtgt
-PROG_LIBEXEC = kauthd$(EXECSUFFIX)
-PROGS = $(PROG_BIN) $(SCRIPT_BIN) $(PROG_LIBEXEC)
-
-SOURCES_KAUTH = kauth.c rkinit.c
-SOURCES_KAUTHD = kauthd.c
-SOURCES_COMMON = encdata.c marshall.c
-
-OBJECTS_KAUTH = kauth.o rkinit.o
-OBJECTS_KAUTHD = kauthd.o
-OBJECTS_COMMON = marshall.o encdata.o
-
-OBJECTS = $(OBJECTS_KAUTH) $(OBJECTS_KAUTHD)
-SOURCES = $(SOURCES_KAUTH) $(SOURCES_KAUTHD) $(SOURCES_COMMON)
-
-KRB_KAFS_LIB = @KRB_KAFS_LIB@
-
-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) $(DESTDIR)$(libexecdir)
- for x in $(PROG_BIN); do \
- $(INSTALL_PROGRAM) $$x $(DESTDIR)$(bindir)/`echo $$x| sed '$(transform)'`; \
- done
- for x in $(SCRIPT_BIN); do \
- $(INSTALL_SCRIPT) $$x $(DESTDIR)$(bindir)/`echo $$x| sed '$(transform)'`; \
- done
- if test -f $(DESTDIR)$(bindir)/zrefresh -o -r $(DESTDIR)$(bindir)/zrefresh; then \
- true; \
- else \
- $(INSTALL_PROGRAM) $(srcdir)/zrefresh $(DESTDIR)$(bindir)/`echo zrefresh | sed '$(transform)'`; \
- fi
- for x in $(PROG_LIBEXEC); do \
- $(INSTALL_PROGRAM) $$x $(DESTDIR)$(libexecdir)/`echo $$x| sed '$(transform)'`; \
- done
-
-uninstall:
- for x in $(PROG_BIN) $(SCRIPT_BIN); do \
- rm -f $(DESTDIR)$(bindir)/`echo $$x| sed '$(transform)'`; \
- done
- for x in $(PROG_LIBEXEC); do \
- rm -f $(DESTDIR)$(libexecdir)/`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
-
-KLIB=-L../../lib/krb -lkrb -L../../lib/des -ldes
-LIBROKEN=-L../../lib/roken -lroken
-
-kauth$(EXECSUFFIX): $(OBJECTS_KAUTH) $(OBJECTS_COMMON)
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ $(OBJECTS_KAUTH) $(OBJECTS_COMMON) $(KRB_KAFS_LIB) $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-kauthd$(EXECSUFFIX): $(OBJECTS_KAUTHD) $(OBJECTS_COMMON)
- $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ $(OBJECTS_KAUTHD) $(OBJECTS_COMMON) $(KLIB) $(LIBROKEN) $(LIBS) $(LIBROKEN)
-
-ksrvtgt: ksrvtgt.in
- sed -e "s!%bindir%!$(bindir)!" $(srcdir)/ksrvtgt.in > $@
- chmod +x $@
-
-
-$(OBJECTS): ../../include/config.h
-
-.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/appl/kauth/encdata.c b/crypto/kerberosIV/appl/kauth/encdata.c
deleted file mode 100644
index 886f549..0000000
--- a/crypto/kerberosIV/appl/kauth/encdata.c
+++ /dev/null
@@ -1,96 +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.
- */
-
-#include "kauth.h"
-
-RCSID("$Id: encdata.c,v 1.10 1999/12/02 16:58:31 joda Exp $");
-
-int
-write_encrypted (int fd, void *buf, size_t len, des_key_schedule schedule,
- des_cblock *session, struct sockaddr_in *me,
- struct sockaddr_in *him)
-{
- void *outbuf;
- int32_t outlen, l;
- int i;
- unsigned char tmp[4];
-
- outbuf = malloc(len + 30);
- if (outbuf == NULL)
- return -1;
- outlen = krb_mk_priv (buf, outbuf, len, schedule, session, me, him);
- if (outlen < 0) {
- free(outbuf);
- return -1;
- }
- l = outlen;
- for(i = 3; i >= 0; i--, l = l >> 8)
- tmp[i] = l & 0xff;
- if (krb_net_write (fd, tmp, 4) != 4 ||
- krb_net_write (fd, outbuf, outlen) != outlen) {
- free(outbuf);
- return -1;
- }
-
- free(outbuf);
- return 0;
-}
-
-
-int
-read_encrypted (int fd, void *buf, size_t len, void **ret,
- des_key_schedule schedule, des_cblock *session,
- struct sockaddr_in *him, struct sockaddr_in *me)
-{
- int status;
- int32_t l;
- MSG_DAT msg;
- unsigned char tmp[4];
-
- l = krb_net_read (fd, tmp, 4);
- if (l != 4)
- return l;
- l = (tmp[0] << 24) | (tmp[1] << 16) | (tmp[2] << 8) | tmp[3];
- if (l > len)
- return -1;
- if (krb_net_read (fd, buf, l) != l)
- return -1;
- status = krb_rd_priv (buf, l, schedule, session, him, me, &msg);
- if (status != RD_AP_OK) {
- fprintf (stderr, "read_encrypted: %s\n",
- krb_get_err_text(status));
- return -1;
- }
- *ret = msg.app_data;
- return msg.app_length;
-}
diff --git a/crypto/kerberosIV/appl/kauth/kauth.c b/crypto/kerberosIV/appl/kauth/kauth.c
deleted file mode 100644
index 3f6f0bc..0000000
--- a/crypto/kerberosIV/appl/kauth/kauth.c
+++ /dev/null
@@ -1,384 +0,0 @@
-/*
- * Copyright (c) 1995 - 2000 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.
- */
-
-/*
- * Little program that reads an srvtab or password and
- * creates a suitable ticketfile and associated AFS tokens.
- *
- * If an optional command is given the command is executed in a
- * new PAG and when the command exits the tickets are destroyed.
- */
-
-#include "kauth.h"
-
-RCSID("$Id: kauth.c,v 1.97.2.1 2000/02/28 03:42:51 assar Exp $");
-
-krb_principal princ;
-static char srvtab[MaxPathLen];
-static int lifetime = DEFAULT_TKT_LIFE;
-static char remote_tktfile[MaxPathLen];
-static char remoteuser[100];
-static char *cell = 0;
-
-static void
-usage(void)
-{
- fprintf(stderr,
- "Usage:\n"
- " %s [name]\n"
- "or\n"
- " %s [-ad] [-n name] [-r remoteuser] [-t remote ticketfile]\n"
- " [-l lifetime (in minutes) ] [-f srvtab ] [-c AFS cell name ]\n"
- " [-h hosts... [--]] [command ... ]\n\n",
- __progname, __progname);
- fprintf(stderr,
- "A fully qualified name can be given: user[.instance][@realm]\n"
- "Realm is converted to uppercase!\n");
- exit(1);
-}
-
-#define EX_NOEXEC 126
-#define EX_NOTFOUND 127
-
-static int
-doexec(int argc, char **argv)
-{
- int ret = simple_execvp(argv[0], argv);
- if(ret == -2)
- warn ("fork");
- if(ret == -3)
- warn("waitpid");
- if(ret < 0)
- return EX_NOEXEC;
- if(ret == EX_NOEXEC || ret == EX_NOTFOUND)
- warnx("Can't exec program ``%s''", argv[0]);
-
- return ret;
-}
-
-static RETSIGTYPE
-renew(int sig)
-{
- int code;
-
- signal(SIGALRM, renew);
-
- code = krb_get_svc_in_tkt(princ.name, princ.instance, princ.realm,
- KRB_TICKET_GRANTING_TICKET,
- princ.realm, lifetime, srvtab);
- if (code)
- warnx ("%s", krb_get_err_text(code));
- else if (k_hasafs())
- {
- if ((code = krb_afslog(cell, NULL)) != 0 && code != KDC_PR_UNKNOWN) {
- warnx ("%s", krb_get_err_text(code));
- }
- }
-
- alarm(krb_life_to_time(0, lifetime)/2 - 60);
- SIGRETURN(0);
-}
-
-static int
-zrefresh(void)
-{
- switch (fork()) {
- case -1:
- err (1, "Warning: Failed to fork zrefresh");
- return -1;
- case 0:
- /* Child */
- execlp("zrefresh", "zrefresh", 0);
- execl(BINDIR "/zrefresh", "zrefresh", 0);
- exit(1);
- default:
- /* Parent */
- break;
- }
- return 0;
-}
-
-static int
-key_to_key(const char *user,
- char *instance,
- const char *realm,
- const void *arg,
- des_cblock *key)
-{
- memcpy(key, arg, sizeof(des_cblock));
- return 0;
-}
-
-static int
-get_ticket_address(krb_principal *princ, des_cblock *key)
-{
- int code;
- unsigned char flags;
- krb_principal service;
- u_int32_t addr;
- struct in_addr addr2;
- des_cblock session;
- int life;
- u_int32_t time_sec;
- des_key_schedule schedule;
- CREDENTIALS c;
-
- code = get_ad_tkt(princ->name, princ->instance, princ->realm, 0);
- if(code) {
- warnx("get_ad_tkt: %s\n", krb_get_err_text(code));
- return code;
- }
- code = krb_get_cred(princ->name, princ->instance, princ->realm, &c);
- if(code) {
- warnx("krb_get_cred: %s\n", krb_get_err_text(code));
- return code;
- }
-
- des_set_key(key, schedule);
- code = decomp_ticket(&c.ticket_st,
- &flags,
- princ->name,
- princ->instance,
- princ->realm,
- &addr,
- session,
- &life,
- &time_sec,
- service.name,
- service.instance,
- key,
- schedule);
- if(code) {
- warnx("decomp_ticket: %s\n", krb_get_err_text(code));
- return code;
- }
- memset(&session, 0, sizeof(session));
- memset(schedule, 0, sizeof(schedule));
- addr2.s_addr = addr;
- fprintf(stdout, "ticket address = %s\n", inet_ntoa(addr2));
-}
-
-
-int
-main(int argc, char **argv)
-{
- int code, more_args;
- int ret;
- int c;
- char *file;
- int pflag = 0;
- int aflag = 0;
- int version_flag = 0;
- char passwd[100];
- des_cblock key;
- char **host;
- int nhost;
- char tf[MaxPathLen];
-
- set_progname (argv[0]);
-
- if ((file = getenv("KRBTKFILE")) == 0)
- file = TKT_FILE;
-
- memset(&princ, 0, sizeof(princ));
- memset(srvtab, 0, sizeof(srvtab));
- *remoteuser = '\0';
- nhost = 0;
- host = NULL;
-
- /* Look for kerberos name */
- if (argc > 1 &&
- argv[1][0] != '-' &&
- krb_parse_name(argv[1], &princ) == 0)
- {
- argc--; argv++;
- strupr(princ.realm);
- }
-
- while ((c = getopt(argc, argv, "ar:t:f:hdl:n:c:v")) != -1)
- switch (c) {
- case 'a':
- aflag++;
- break;
- case 'd':
- krb_enable_debug();
- _kafs_debug = 1;
- break;
- case 'f':
- strlcpy(srvtab, optarg, sizeof(srvtab));
- break;
- case 't':
- strlcpy(remote_tktfile, optarg, sizeof(remote_tktfile));
- break;
- case 'r':
- strlcpy(remoteuser, optarg, sizeof(remoteuser));
- break;
- case 'l':
- lifetime = atoi(optarg);
- if (lifetime == -1)
- lifetime = 255;
- else if (lifetime < 5)
- lifetime = 1;
- else
- lifetime = krb_time_to_life(0, lifetime*60);
- if (lifetime > 255)
- lifetime = 255;
- break;
- case 'n':
- if ((code = krb_parse_name(optarg, &princ)) != 0) {
- warnx ("%s", krb_get_err_text(code));
- usage();
- }
- strupr(princ.realm);
- pflag = 1;
- break;
- case 'c':
- cell = optarg;
- break;
- case 'h':
- host = argv + optind;
- for(nhost = 0; optind < argc && *argv[optind] != '-'; ++optind)
- ++nhost;
- if(nhost == 0)
- usage();
- break;
- case 'v':
- version_flag++;
- print_version(NULL);
- break;
- case '?':
- default:
- usage();
- break;
- }
-
- if(version_flag) {
- print_version(NULL);
- exit(0);
- }
- if (princ.name[0] == '\0' && krb_get_default_principal (princ.name,
- princ.instance,
- princ.realm) < 0)
- errx (1, "Could not get default principal");
-
- /* With root tickets assume remote user is root */
- if (*remoteuser == '\0') {
- if (strcmp(princ.instance, "root") == 0)
- strlcpy(remoteuser, princ.instance, sizeof(remoteuser));
- else
- strlcpy(remoteuser, princ.name, sizeof(remoteuser));
- }
-
- more_args = argc - optind;
-
- if (princ.realm[0] == '\0')
- if (krb_get_lrealm(princ.realm, 1) != KSUCCESS)
- strlcpy(princ.realm, KRB_REALM, REALM_SZ);
-
- if (more_args) {
- int f;
-
- do{
- snprintf(tf, sizeof(tf), "%s%u_%u", TKT_ROOT, (unsigned)getuid(),
- (unsigned)(getpid()*time(0)));
- f = open(tf, O_CREAT|O_EXCL|O_RDWR);
- }while(f < 0);
- close(f);
- unlink(tf);
- setenv("KRBTKFILE", tf, 1);
- krb_set_tkt_string (tf);
- }
-
- if (srvtab[0])
- {
- signal(SIGALRM, renew);
-
- code = read_service_key (princ.name, princ.instance, princ.realm, 0,
- srvtab, (char *)&key);
- if (code == KSUCCESS)
- code = krb_get_in_tkt(princ.name, princ.instance, princ.realm,
- KRB_TICKET_GRANTING_TICKET,
- princ.realm, lifetime,
- key_to_key, NULL, key);
- alarm(krb_life_to_time(0, lifetime)/2 - 60);
- }
- else {
- char prompt[128];
-
- snprintf(prompt, sizeof(prompt), "%s's Password: ", krb_unparse_name(&princ));
- if (des_read_pw_string(passwd, sizeof(passwd)-1, prompt, 0)){
- memset(passwd, 0, sizeof(passwd));
- exit(1);
- }
- code = krb_get_pw_in_tkt2(princ.name, princ.instance, princ.realm,
- KRB_TICKET_GRANTING_TICKET, princ.realm,
- lifetime, passwd, &key);
-
- memset(passwd, 0, sizeof(passwd));
- }
- if (code) {
- memset (key, 0, sizeof(key));
- errx (1, "%s", krb_get_err_text(code));
- }
-
- if(aflag)
- get_ticket_address(&princ, &key);
-
- if (k_hasafs()) {
- if (more_args)
- k_setpag();
- if ((code = krb_afslog(cell, NULL)) != 0 && code != KDC_PR_UNKNOWN) {
- if(code > 0)
- warnx ("%s", krb_get_err_text(code));
- else
- warnx ("failed to store AFS token");
- }
- }
-
- for(ret = 0; nhost-- > 0; host++)
- ret += rkinit(&princ, lifetime, remoteuser, remote_tktfile, &key, *host);
-
- if (ret)
- return ret;
-
- if (more_args) {
- ret = doexec(more_args, &argv[optind]);
- dest_tkt();
- if (k_hasafs())
- k_unlog();
- }
- else
- zrefresh();
-
- return ret;
-}
diff --git a/crypto/kerberosIV/appl/kauth/kauth.h b/crypto/kerberosIV/appl/kauth/kauth.h
deleted file mode 100644
index 32243c7..0000000
--- a/crypto/kerberosIV/appl/kauth/kauth.h
+++ /dev/null
@@ -1,116 +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: kauth.h,v 1.21 1999/12/02 16:58:31 joda Exp $ */
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif /* HAVE_CONFIG_H */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <ctype.h>
-#include <string.h>
-#include <signal.h>
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#include <errno.h>
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_PWD_H
-#include <pwd.h>
-#endif
-#ifdef HAVE_GRP_H
-#include <grp.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 /* HAVE_SYS_RESOURCE_H */
-#ifdef HAVE_SYS_WAIT_H
-#include <sys/wait.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
-#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 <kafs.h>
-
-#include <roken.h>
-
-#define KAUTH_PORT 2120
-
-#define KAUTH_VERSION "RKINIT.0"
-
-int rkinit (krb_principal*, int, char*, char*, des_cblock*, char*);
-
-int write_encrypted (int, void*, size_t, des_key_schedule,
- des_cblock*, struct sockaddr_in*, struct sockaddr_in*);
-
-int read_encrypted (int, void*, size_t, void **, des_key_schedule,
- des_cblock*, struct sockaddr_in*, struct sockaddr_in*);
-
-int pack_args (char *, size_t, krb_principal*, int, const char*, const char*);
-
-int unpack_args (const char*, krb_principal*, int*, char*, char*);
diff --git a/crypto/kerberosIV/appl/kauth/kauthd.c b/crypto/kerberosIV/appl/kauth/kauthd.c
deleted file mode 100644
index d0b61ec..0000000
--- a/crypto/kerberosIV/appl/kauth/kauthd.c
+++ /dev/null
@@ -1,202 +0,0 @@
-/* $FreeBSD$ */
-
-/*
- * 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.
- */
-
-#include "kauth.h"
-
-RCSID("$Id: kauthd.c,v 1.25.2.1 2000/06/28 19:07:58 assar Exp $");
-
-krb_principal princ;
-static char locuser[SNAME_SZ];
-static int lifetime;
-static char tktfile[MaxPathLen];
-
-struct remote_args {
- int sock;
- des_key_schedule *schedule;
- des_cblock *session;
- struct sockaddr_in *me, *her;
-};
-
-static int
-decrypt_remote_tkt (const char *user,
- const char *inst,
- const char *realm,
- const void *varg,
- key_proc_t key_proc,
- KTEXT *cipp)
-{
- char buf[BUFSIZ];
- void *ptr;
- int len;
- KTEXT cip = *cipp;
- struct remote_args *args = (struct remote_args *)varg;
-
- write_encrypted (args->sock, cip->dat, cip->length,
- *args->schedule, args->session, args->me,
- args->her);
- len = read_encrypted (args->sock, buf, sizeof(buf), &ptr, *args->schedule,
- args->session, args->her, args->me);
- memcpy(cip->dat, ptr, cip->length);
-
- return 0;
-}
-
-static int
-doit(int sock)
-{
- int status;
- KTEXT_ST ticket;
- AUTH_DAT auth;
- char instance[INST_SZ];
- des_key_schedule schedule;
- struct sockaddr_in thisaddr, thataddr;
- int addrlen;
- int len;
- char buf[BUFSIZ];
- void *data;
- struct passwd *passwd;
- char version[KRB_SENDAUTH_VLEN + 1];
- char remotehost[MaxHostNameLen];
-
- addrlen = sizeof(thisaddr);
- if (getsockname (sock, (struct sockaddr *)&thisaddr, &addrlen) < 0 ||
- addrlen != sizeof(thisaddr)) {
- return 1;
- }
- addrlen = sizeof(thataddr);
- if (getpeername (sock, (struct sockaddr *)&thataddr, &addrlen) < 0 ||
- addrlen != sizeof(thataddr)) {
- return 1;
- }
-
- inaddr2str (thataddr.sin_addr, remotehost, sizeof(remotehost));
-
- k_getsockinst (sock, instance, sizeof(instance));
- status = krb_recvauth (KOPT_DO_MUTUAL, sock, &ticket, "rcmd", instance,
- &thataddr, &thisaddr, &auth, "", schedule,
- version);
- if (status != KSUCCESS ||
- strncmp(version, KAUTH_VERSION, KRB_SENDAUTH_VLEN) != 0) {
- return 1;
- }
- len = read_encrypted (sock, buf, sizeof(buf), &data, schedule,
- &auth.session, &thataddr, &thisaddr);
- if (len < 0) {
- write_encrypted (sock, "read_enc failed",
- sizeof("read_enc failed") - 1, schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
- if (unpack_args(data, &princ, &lifetime, locuser,
- tktfile)) {
- write_encrypted (sock, "unpack_args failed",
- sizeof("unpack_args failed") - 1, schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
-
- if( kuserok(&auth, locuser) != 0) {
- snprintf(buf, sizeof(buf), "%s cannot get tickets for %s",
- locuser, krb_unparse_name(&princ));
- syslog (LOG_ERR, "%s", buf);
- write_encrypted (sock, buf, strlen(buf), schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
- passwd = k_getpwnam (locuser);
- if (passwd == NULL) {
- snprintf (buf, sizeof(buf), "No user '%s'", locuser);
- syslog (LOG_ERR, "%s", buf);
- write_encrypted (sock, buf, strlen(buf), schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
- if (setgid (passwd->pw_gid) ||
- initgroups(passwd->pw_name, passwd->pw_gid) ||
- setuid(passwd->pw_uid)) {
- snprintf (buf, sizeof(buf), "Could not change user");
- syslog (LOG_ERR, "%s", buf);
- write_encrypted (sock, buf, strlen(buf), schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
- write_encrypted (sock, "ok", sizeof("ok") - 1, schedule,
- &auth.session, &thisaddr, &thataddr);
-
- if (*tktfile == 0)
- snprintf(tktfile, sizeof(tktfile), "%s%u", TKT_ROOT, (unsigned)getuid());
- krb_set_tkt_string (tktfile);
-
- {
- struct remote_args arg;
-
- arg.sock = sock;
- arg.schedule = &schedule;
- arg.session = &auth.session;
- arg.me = &thisaddr;
- arg.her = &thataddr;
-
- status = krb_get_in_tkt (princ.name, princ.instance, princ.realm,
- KRB_TICKET_GRANTING_TICKET,
- princ.realm,
- lifetime, NULL, decrypt_remote_tkt, &arg);
- }
- if (status == KSUCCESS) {
- syslog (LOG_INFO, "from %s(%s): %s -> %s",
- remotehost,
- inet_ntoa(thataddr.sin_addr),
- locuser,
- krb_unparse_name (&princ));
- write_encrypted (sock, "ok", sizeof("ok") - 1, schedule,
- &auth.session, &thisaddr, &thataddr);
- return 0;
- } else {
- snprintf (buf, sizeof(buf), "TGT failed: %s", krb_get_err_text(status));
- syslog (LOG_NOTICE, "%s", buf);
- write_encrypted (sock, buf, strlen(buf), schedule,
- &auth.session, &thisaddr, &thataddr);
- return 1;
- }
-}
-
-int
-main (int argc, char **argv)
-{
- openlog ("kauthd", LOG_ODELAY, LOG_AUTH);
-
- if(argc > 1 && strcmp(argv[1], "-i") == 0)
- mini_inetd (k_getportbyname("kauth", "tcp", htons(KAUTH_PORT)));
- return doit(STDIN_FILENO);
-}
diff --git a/crypto/kerberosIV/appl/kauth/ksrvtgt.in b/crypto/kerberosIV/appl/kauth/ksrvtgt.in
deleted file mode 100644
index 7a520fd..0000000
--- a/crypto/kerberosIV/appl/kauth/ksrvtgt.in
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-# $Id: ksrvtgt.in,v 1.3 1997/09/13 03:39:03 joda Exp $
-# $FreeBSD$
-
-usage="Usage: `basename $0` name instance [[realm] srvtab]"
-
-if [ $# -lt 2 -o $# -gt 4 ]; then
- echo "$usage"
- exit 1
-fi
-
-srvtab="${4-${3-/etc/kerberosIV/srvtab}}"
-realm="${4+@$3}"
-
-%bindir%/kauth -n "$1.$2$realm" -l 5 -f "$srvtab"
diff --git a/crypto/kerberosIV/appl/kauth/marshall.c b/crypto/kerberosIV/appl/kauth/marshall.c
deleted file mode 100644
index e37b8c9..0000000
--- a/crypto/kerberosIV/appl/kauth/marshall.c
+++ /dev/null
@@ -1,126 +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.
- */
-
-#include "kauth.h"
-
-RCSID("$Id: marshall.c,v 1.10 1999/12/02 16:58:31 joda Exp $");
-
-int
-pack_args (char *buf,
- size_t sz,
- krb_principal *pr,
- int lifetime,
- const char *locuser,
- const char *tktfile)
-{
- char *p = buf;
- int len;
-
- p = buf;
-
- len = strlen(pr->name);
- if (len >= sz)
- return -1;
- memcpy (p, pr->name, len + 1);
- p += len + 1;
- sz -= len + 1;
-
- len = strlen(pr->instance);
- if (len >= sz)
- return -1;
- memcpy (p, pr->instance, len + 1);
- p += len + 1;
- sz -= len + 1;
-
- len = strlen(pr->realm);
- if (len >= sz)
- return -1;
- memcpy(p, pr->realm, len + 1);
- p += len + 1;
- sz -= len + 1;
-
- if (sz < 1)
- return -1;
- *p++ = (unsigned char)lifetime;
-
- len = strlen(locuser);
- if (len >= sz)
- return -1;
- memcpy (p, locuser, len + 1);
- p += len + 1;
- sz -= len + 1;
-
- len = strlen(tktfile);
- if (len >= sz)
- return -1;
- memcpy (p, tktfile, len + 1);
- p += len + 1;
- sz -= len + 1;
-
- return p - buf;
-}
-
-int
-unpack_args (const char *buf, krb_principal *pr, int *lifetime,
- char *locuser, char *tktfile)
-{
- int len;
-
- len = strlen(buf);
- if (len >= SNAME_SZ)
- return -1;
- strlcpy (pr->name, buf, ANAME_SZ);
- buf += len + 1;
- len = strlen (buf);
- if (len >= INST_SZ)
- return -1;
- strlcpy (pr->instance, buf, INST_SZ);
- buf += len + 1;
- len = strlen (buf);
- if (len >= REALM_SZ)
- return -1;
- strlcpy (pr->realm, buf, REALM_SZ);
- buf += len + 1;
- *lifetime = (unsigned char)*buf++;
- len = strlen(buf);
- if (len >= SNAME_SZ)
- return -1;
- strlcpy (locuser, buf, SNAME_SZ);
- buf += len + 1;
- len = strlen(buf);
- if (len >= MaxPathLen)
- return -1;
- strlcpy (tktfile, buf, MaxPathLen);
- buf += len + 1;
- return 0;
-}
diff --git a/crypto/kerberosIV/appl/kauth/rkinit.c b/crypto/kerberosIV/appl/kauth/rkinit.c
deleted file mode 100644
index cac62c9..0000000
--- a/crypto/kerberosIV/appl/kauth/rkinit.c
+++ /dev/null
@@ -1,226 +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.
- */
-
-#include "kauth.h"
-
-RCSID("$Id: rkinit.c,v 1.22.2.1 1999/12/06 17:27:56 assar Exp $");
-
-static struct in_addr *
-getalladdrs (char *hostname, unsigned *count)
-{
- struct hostent *hostent;
- struct in_addr **h;
- struct in_addr *addr;
- unsigned naddr;
- unsigned maxaddr;
-
- hostent = gethostbyname (hostname);
- if (hostent == NULL) {
- warnx ("gethostbyname '%s' failed: %s\n",
- hostname,
- hstrerror(h_errno));
- return NULL;
- }
- maxaddr = 1;
- naddr = 0;
- addr = malloc(sizeof(*addr) * maxaddr);
- if (addr == NULL) {
- warnx ("out of memory");
- return NULL;
- }
- for (h = (struct in_addr **)(hostent->h_addr_list);
- *h != NULL;
- h++) {
- if (naddr >= maxaddr) {
- maxaddr *= 2;
- addr = realloc (addr, sizeof(*addr) * maxaddr);
- if (addr == NULL) {
- warnx ("out of memory");
- return NULL;
- }
- }
- addr[naddr++] = **h;
- }
- addr = realloc (addr, sizeof(*addr) * naddr);
- if (addr == NULL) {
- warnx ("out of memory");
- return NULL;
- }
- *count = naddr;
- return addr;
-}
-
-static int
-doit_host (krb_principal *princ, int lifetime, char *locuser,
- char *tktfile, des_cblock *key, int s, char *hostname)
-{
- char buf[BUFSIZ];
- int inlen;
- KTEXT_ST text;
- CREDENTIALS cred;
- MSG_DAT msg;
- int status;
- des_key_schedule schedule;
- struct sockaddr_in thisaddr, thataddr;
- int addrlen;
- void *ret;
-
- addrlen = sizeof(thisaddr);
- if (getsockname (s, (struct sockaddr *)&thisaddr, &addrlen) < 0 ||
- addrlen != sizeof(thisaddr)) {
- warn ("getsockname(%s)", hostname);
- return 1;
- }
- addrlen = sizeof(thataddr);
- if (getpeername (s, (struct sockaddr *)&thataddr, &addrlen) < 0 ||
- addrlen != sizeof(thataddr)) {
- warn ("getpeername(%s)", hostname);
- return 1;
- }
-
- if (krb_get_config_bool("nat_in_use")) {
- struct in_addr natAddr;
-
- if (krb_get_our_ip_for_realm(krb_realmofhost(hostname),
- &natAddr) == KSUCCESS
- || krb_get_our_ip_for_realm (NULL, &natAddr) == KSUCCESS)
- thisaddr.sin_addr = natAddr;
- }
-
- status = krb_sendauth (KOPT_DO_MUTUAL, s, &text, "rcmd",
- hostname, krb_realmofhost (hostname),
- getpid(), &msg, &cred, schedule,
- &thisaddr, &thataddr, KAUTH_VERSION);
- if (status != KSUCCESS) {
- warnx ("%s: %s\n", hostname, krb_get_err_text(status));
- return 1;
- }
- inlen = pack_args (buf, sizeof(buf),
- princ, lifetime, locuser, tktfile);
- if (inlen < 0) {
- warn ("cannot marshall arguments to %s", hostname);
- return 1;
- }
-
- if (write_encrypted(s, buf, inlen, schedule, &cred.session,
- &thisaddr, &thataddr) < 0) {
- warn ("write to %s", hostname);
- return 1;
- }
-
- inlen = read_encrypted (s, buf, sizeof(buf), &ret, schedule,
- &cred.session, &thataddr, &thisaddr);
- if (inlen < 0) {
- warn ("read from %s failed", hostname);
- return 1;
- }
-
- if (strncmp(ret, "ok", inlen) != 0) {
- warnx ("error from %s: %.*s\n",
- hostname, inlen, (char *)ret);
- return 1;
- }
-
- inlen = read_encrypted (s, buf, sizeof(buf), &ret, schedule,
- &cred.session, &thataddr, &thisaddr);
- if (inlen < 0) {
- warn ("read from %s", hostname);
- return 1;
- }
-
- {
- des_key_schedule key_s;
-
- des_key_sched(key, key_s);
- des_pcbc_encrypt(ret, ret, inlen, key_s, key, DES_DECRYPT);
- memset(key_s, 0, sizeof(key_s));
- }
- write_encrypted (s, ret, inlen, schedule, &cred.session,
- &thisaddr, &thataddr);
-
- inlen = read_encrypted (s, buf, sizeof(buf), &ret, schedule,
- &cred.session, &thataddr, &thisaddr);
- if (inlen < 0) {
- warn ("read from %s", hostname);
- return 1;
- }
-
- if (strncmp(ret, "ok", inlen) != 0) {
- warnx ("error from %s: %.*s\n",
- hostname, inlen, (char *)ret);
- return 1;
- }
- return 0;
-}
-
-int
-rkinit (krb_principal *princ, int lifetime, char *locuser,
- char *tktfile, des_cblock *key, char *hostname)
-{
- struct in_addr *addr;
- unsigned naddr;
- unsigned i;
- int port;
- int success;
-
- addr = getalladdrs (hostname, &naddr);
- if (addr == NULL)
- return 1;
- port = k_getportbyname ("kauth", "tcp", htons(KAUTH_PORT));
- success = 0;
- for (i = 0; !success && i < naddr; ++i) {
- struct sockaddr_in a;
- int s;
-
- memset(&a, 0, sizeof(a));
- a.sin_family = AF_INET;
- a.sin_port = port;
- a.sin_addr = addr[i];
-
- s = socket (AF_INET, SOCK_STREAM, 0);
- if (s < 0) {
- warn("socket");
- return 1;
- }
- if (connect(s, (struct sockaddr *)&a, sizeof(a)) < 0) {
- warn("connect(%s)", hostname);
- continue;
- }
-
- success = success || !doit_host (princ, lifetime,
- locuser, tktfile, key,
- s, hostname);
- close (s);
- }
- return !success;
-}
diff --git a/crypto/kerberosIV/appl/kauth/zrefresh b/crypto/kerberosIV/appl/kauth/zrefresh
deleted file mode 100644
index 8347a1b..0000000
--- a/crypto/kerberosIV/appl/kauth/zrefresh
+++ /dev/null
@@ -1,12 +0,0 @@
-#!/bin/sh
-#
-# @(#) $Id: zrefresh,v 1.3 1996/06/09 19:21:59 joda Exp $
-#
-# Substitute this script with a real zrefresh if running Zephyr. For
-# instance:
-#
-# if [ -f "$WGFILE" ] ; then
-# zctl load
-# fi
-
-exit 0
OpenPOWER on IntegriCloud