summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/lib/krb
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1999-09-19 21:56:09 +0000
committermarkm <markm@FreeBSD.org>1999-09-19 21:56:09 +0000
commit7df5ada37cd843e2315a1c078071854d0c566837 (patch)
tree5c5f0867443a03ea20eeb5278faf23c48632b2bb /crypto/kerberosIV/lib/krb
parent6b45152ee9c956cc4d4653caa6ee355eb079f588 (diff)
downloadFreeBSD-src-7df5ada37cd843e2315a1c078071854d0c566837.zip
FreeBSD-src-7df5ada37cd843e2315a1c078071854d0c566837.tar.gz
Merge anf fix for build.
Diffstat (limited to 'crypto/kerberosIV/lib/krb')
-rw-r--r--crypto/kerberosIV/lib/krb/et_list.c71
-rw-r--r--crypto/kerberosIV/lib/krb/gettimeofday.c56
-rw-r--r--crypto/kerberosIV/lib/krb/k_concat.c116
-rw-r--r--crypto/kerberosIV/lib/krb/k_flock.c95
-rw-r--r--crypto/kerberosIV/lib/krb/k_gethostname.c58
-rw-r--r--crypto/kerberosIV/lib/krb/krb.h321
-rw-r--r--crypto/kerberosIV/lib/krb/lsb_addr_comp.h26
-rw-r--r--crypto/kerberosIV/lib/krb/netread.c55
-rw-r--r--crypto/kerberosIV/lib/krb/netwrite.c52
-rw-r--r--crypto/kerberosIV/lib/krb/resolve.c288
-rw-r--r--crypto/kerberosIV/lib/krb/resolve.h110
-rw-r--r--crypto/kerberosIV/lib/krb/swab.c56
-rw-r--r--crypto/kerberosIV/lib/krb/util.c64
13 files changed, 56 insertions, 1312 deletions
diff --git a/crypto/kerberosIV/lib/krb/et_list.c b/crypto/kerberosIV/lib/krb/et_list.c
deleted file mode 100644
index 3e72b14..0000000
--- a/crypto/kerberosIV/lib/krb/et_list.c
+++ /dev/null
@@ -1,71 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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.
- */
-
-/*
- * This is a hack to resolve the reference to _et_list when making a
- * shared library under Psoriasis and possibly other systems. Presumably
- * they define __ELF__, some people say Linux does so.
- */
-
-#include "config.h"
-
-RCSID("$Id: et_list.c,v 1.1.1.1 1997/09/04 06:04:22 markm Exp $");
-
-struct et_list {
- struct et_list *next;
- const struct error_table *table;
-};
-
-#if defined(__GNUC__)
-
-struct et_list * _et_list __attribute__ ((weak)) = 0;
-
-#else /* !__GNUC__ */
-
-#ifdef HAVE_PRAGMA_WEAK
-
-#pragma weak _et_list = __et_list
-struct et_list * __et_list = 0;
-
-#else /* !HAVE_PRAGMA_WEAK */
-
-struct et_list * _et_list = 0;
-
-#endif /* !HAVE_PRAGMA_WEAK */
-
-#endif /* !__GNUC__ */
diff --git a/crypto/kerberosIV/lib/krb/gettimeofday.c b/crypto/kerberosIV/lib/krb/gettimeofday.c
deleted file mode 100644
index 734ca59..0000000
--- a/crypto/kerberosIV/lib/krb/gettimeofday.c
+++ /dev/null
@@ -1,56 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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 "krb_locl.h"
-RCSID("$Id: gettimeofday.c,v 1.5 1997/04/01 08:18:29 joda Exp $");
-
-#ifndef HAVE_GETTIMEOFDAY
-/*
- * Simple gettimeofday that only returns seconds.
- */
-int
-gettimeofday (struct timeval *tp, void *ignore)
-{
- time_t t;
-
- t = time(NULL);
- tp->tv_sec = t;
- tp->tv_usec = 0;
- return 0;
-}
-#endif
diff --git a/crypto/kerberosIV/lib/krb/k_concat.c b/crypto/kerberosIV/lib/krb/k_concat.c
deleted file mode 100644
index e7daa5f..0000000
--- a/crypto/kerberosIV/lib/krb/k_concat.c
+++ /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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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 "krb_locl.h"
-
-RCSID("$Id: k_concat.c,v 1.5 1997/05/02 08:56:39 joda Exp $");
-
-int
-k_concat (char *s, size_t len, ...)
-{
- int ret;
- va_list args;
-
- va_start(args, len);
- ret = k_vconcat (s, len, args);
- va_end(args);
- return ret;
-}
-
-int
-k_vconcat (char *s, size_t len, va_list args)
-{
- const char *a;
-
- while ((a = va_arg(args, const char*))) {
- size_t n = strlen (a);
-
- if (n >= len)
- return -1;
- strncpy (s, a, n);
- s += n;
- len -= n;
- }
- *s = '\0';
- return 0;
-}
-
-size_t
-k_vmconcat (char **s, size_t max_len, va_list args)
-{
- const char *a;
- char *p, *q;
- size_t len = 0;
- *s = NULL;
- p = malloc(1);
- if(p == NULL)
- return 0;
- *p = 0;
- len = 1;
- while ((a = va_arg(args, const char*))) {
- size_t n = strlen (a);
-
- if(max_len && len + n > max_len){
- free(p);
- return 0;
- }
- q = realloc(p, len + n);
- if(q == NULL){
- free(p);
- return 0;
- }
- p = q;
- len += n;
- strcat(p, a);
- }
- *s = p;
- return len;
-}
-
-size_t
-k_mconcat (char **s, size_t max_len, ...)
-{
- int ret;
- va_list args;
-
- va_start(args, max_len);
- ret = k_vmconcat (s, max_len, args);
- va_end(args);
- return ret;
-}
-
diff --git a/crypto/kerberosIV/lib/krb/k_flock.c b/crypto/kerberosIV/lib/krb/k_flock.c
deleted file mode 100644
index 844c34c..0000000
--- a/crypto/kerberosIV/lib/krb/k_flock.c
+++ /dev/null
@@ -1,95 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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 "krb_locl.h"
-
-RCSID("$Id: k_flock.c,v 1.8 1997/04/01 08:18:30 joda Exp $");
-
-#define K_OP_MASK (K_LOCK_SH | K_LOCK_EX | K_LOCK_UN)
-
-int
-k_flock(int fd, int operation)
-{
-#ifdef HAVE_FLOCK
- int op = 0;
- if (operation & K_LOCK_SH)
- op |= LOCK_SH;
- if (operation & K_LOCK_EX)
- op |= LOCK_EX;
- if (operation & K_LOCK_UN)
- op |= LOCK_UN;
- if (operation & K_LOCK_NB)
- op |= LOCK_NB;
-
- return flock(fd, op);
-#elif defined(HAVE_FCNTL) && defined(F_SETLK)
- struct flock arg;
- int code, cmd;
-
- arg.l_whence = SEEK_SET;
- arg.l_start = 0;
- arg.l_len = 0; /* means to EOF */
-
- if (operation & K_LOCK_NB)
- cmd = F_SETLK;
- else
- cmd = F_SETLKW; /* Blocking */
-
- switch (operation & K_OP_MASK) {
- case K_LOCK_UN:
- arg.l_type = F_UNLCK;
- code = fcntl(fd, F_SETLK, &arg);
- break;
- case K_LOCK_SH:
- arg.l_type = F_RDLCK;
- code = fcntl(fd, cmd, &arg);
- break;
- case K_LOCK_EX:
- arg.l_type = F_WRLCK;
- code = fcntl(fd, cmd, &arg);
- break;
- default:
- errno = EINVAL;
- code = -1;
- break;
- }
- return code;
-#else
- return -1;
-#endif /* !HAVE_FLOCK */
-}
diff --git a/crypto/kerberosIV/lib/krb/k_gethostname.c b/crypto/kerberosIV/lib/krb/k_gethostname.c
deleted file mode 100644
index 0f4d57f..0000000
--- a/crypto/kerberosIV/lib/krb/k_gethostname.c
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- Copyright (C) 1989 by the Massachusetts Institute of Technology
-
- Export of this software from the United States of America is assumed
- to require a specific license from the United States Government.
- It is the responsibility of any person or organization contemplating
- export to obtain such a license before exporting.
-
-WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
-distribute this software and its documentation for any purpose and
-without fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright notice and
-this permission notice appear in supporting documentation, and that
-the name of M.I.T. not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission. M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is" without express
-or implied warranty.
-
- */
-
-#include "krb_locl.h"
-RCSID("$Id: k_gethostname.c,v 1.10 1997/03/23 03:53:12 joda Exp $");
-
-#ifdef HAVE_SYS_UTSNAME_H
-#include <sys/utsname.h>
-#endif
-
-/*
- * Return the local host's name in "name", up to "namelen" characters.
- * "name" will be null-terminated if "namelen" is big enough.
- * The return code is 0 on success, -1 on failure. (The calling
- * interface is identical to gethostname(2).)
- */
-
-int
-k_gethostname(char *name, int namelen)
-{
-#if defined(HAVE_GETHOSTNAME)
- return gethostname(name, namelen);
-#elif defined(HAVE_UNAME)
- {
- struct utsname utsname;
- int ret;
-
- ret = uname (&utsname);
- if (ret < 0)
- return ret;
- strncpy (name, utsname.nodename, namelen);
- name[namelen-1] = '\0';
- return 0;
- }
-#else
- strncpy (name, "some.random.host", namelen);
- name[namelen-1] = '\0';
- return 0;
-#endif
-}
diff --git a/crypto/kerberosIV/lib/krb/krb.h b/crypto/kerberosIV/lib/krb/krb.h
index 90ca0ab..10f8c9b 100644
--- a/crypto/kerberosIV/lib/krb/krb.h
+++ b/crypto/kerberosIV/lib/krb/krb.h
@@ -1,5 +1,6 @@
/*
- * $Id$
+ * $Id: krb.h,v 1.97 1999/06/29 21:18:06 bg Exp $
+ * $FreeBSD$
*
* Copyright 1987, 1988 by the Massachusetts Institute of Technology.
*
@@ -9,20 +10,39 @@
* Include file for the Kerberos library.
*/
-/* Only one time, please */
-#ifndef KRB_DEFS
-#define KRB_DEFS
+#if !defined (__STDC__) && !defined(_MSC_VER)
+#define const
+#define signed
+#endif
#include <sys/types.h>
-#include <sys/cdefs.h>
-#include <stdarg.h>
#include <time.h>
-__BEGIN_DECLS
+#ifndef __KRB_H__
+#define __KRB_H__
+
+/* XXX */
+#ifndef __BEGIN_DECLS
+#if defined(__cplusplus)
+#define __BEGIN_DECLS extern "C" {
+#define __END_DECLS };
+#else
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+#endif
+#if defined (__STDC__) || defined (_MSC_VER)
#ifndef __P
#define __P(x) x
#endif
+#else
+#ifndef __P
+#define __P(x) ()
+#endif
+#endif
+
+__BEGIN_DECLS
/* Need some defs from des.h */
#if !defined(NOPROTO) && !defined(__STDC__)
@@ -30,7 +50,7 @@ __BEGIN_DECLS
#endif
#include <des.h>
-/* Don't use these guys, they are only for compatibility with CNS. */
+/* CNS compatibility ahead! */
#ifndef KRB_INT32
#define KRB_INT32 int32_t
#endif
@@ -43,15 +63,16 @@ extern int krb_ignore_ip_address; /* To turn off IP address comparison */
extern int krb_no_long_lifetimes; /* To disable AFS compatible lifetimes */
extern int krbONE;
#define HOST_BYTE_ORDER (* (char *) &krbONE)
+/* Debug variables */
+extern int krb_debug;
+extern int krb_ap_req_debug;
+extern int krb_dns_debug;
+
/* Text describing error codes */
#define MAX_KRB_ERRORS 256
extern const char *krb_err_txt[MAX_KRB_ERRORS];
-/* Use this function rather than indexing in krb_err_txt */
-const char *krb_get_err_text __P((int code));
-
-
/* General definitions */
#define KSUCCESS 0
#define KFAILURE 255
@@ -71,7 +92,6 @@ const char *krb_get_err_text __P((int code));
*/
/* /etc/kerberosIV is only for backwards compatibility, don't use it! */
-/* FreeBSD wants to maintain backwards compatibility */
#ifndef KRB_CONF
#define KRB_CONF "/etc/kerberosIV/krb.conf"
#endif
@@ -133,7 +153,7 @@ typedef struct ktext KTEXT_ST;
/* Definitions for send_to_kdc */
-#define CLIENT_KRB_TIMEOUT 4 /* time between retries */
+#define CLIENT_KRB_TIMEOUT 4 /* default time between retries */
#define CLIENT_KRB_RETRY 5 /* retry this many times */
#define CLIENT_KRB_BUFLEN 512 /* max unfragmented packet */
@@ -199,17 +219,14 @@ typedef struct msg_dat MSG_DAT;
struct krb_host {
char *realm;
char *host;
- int proto;
+ enum krb_host_proto { PROTO_UDP, PROTO_TCP, PROTO_HTTP } proto;
int port;
int admin;
};
-struct krb_host *krb_get_host __P((int, char*, int));
-
-
/* Location of ticket file for save_cred and get_cred */
#define TKT_FILE tkt_string()
-#define TKT_ROOT "/tmp/tkt_"
+#define TKT_ROOT "/tmp/tkt"
/* Error codes returned from the KDC */
#define KDC_OK 0 /* Request OK */
@@ -298,76 +315,6 @@ struct krb_host *krb_get_host __P((int, char*, int));
/* Error code returned by krb_mk_safe */
#define SAFE_PRIV_ERROR -1 /* syscall error */
-/*
- * macros for byte swapping; also scratch space
- * u_quad 0-->7, 1-->6, 2-->5, 3-->4, 4-->3, 5-->2, 6-->1, 7-->0
- * u_int32_t 0-->3, 1-->2, 2-->1, 3-->0
- * u_int16_t 0-->1, 1-->0
- */
-
-#define swap_u_16(x) {\
- u_int32_t _krb_swap_tmp[4];\
- swab(((char *) x) +0, ((char *) _krb_swap_tmp) +14 ,2); \
- swab(((char *) x) +2, ((char *) _krb_swap_tmp) +12 ,2); \
- swab(((char *) x) +4, ((char *) _krb_swap_tmp) +10 ,2); \
- swab(((char *) x) +6, ((char *) _krb_swap_tmp) +8 ,2); \
- swab(((char *) x) +8, ((char *) _krb_swap_tmp) +6 ,2); \
- swab(((char *) x) +10,((char *) _krb_swap_tmp) +4 ,2); \
- swab(((char *) x) +12,((char *) _krb_swap_tmp) +2 ,2); \
- swab(((char *) x) +14,((char *) _krb_swap_tmp) +0 ,2); \
- memcpy(x, _krb_swap_tmp, 16);\
- }
-
-#define swap_u_12(x) {\
- u_int32_t _krb_swap_tmp[4];\
- swab(( char *) x, ((char *) _krb_swap_tmp) +10 ,2); \
- swab(((char *) x) +2, ((char *) _krb_swap_tmp) +8 ,2); \
- swab(((char *) x) +4, ((char *) _krb_swap_tmp) +6 ,2); \
- swab(((char *) x) +6, ((char *) _krb_swap_tmp) +4 ,2); \
- swab(((char *) x) +8, ((char *) _krb_swap_tmp) +2 ,2); \
- swab(((char *) x) +10,((char *) _krb_swap_tmp) +0 ,2); \
- memcpy(x, _krb_swap_tmp, 12);\
- }
-
-#define swap_C_Block(x) {\
- u_int32_t _krb_swap_tmp[4];\
- swab(( char *) x, ((char *) _krb_swap_tmp) +6 ,2); \
- swab(((char *) x) +2,((char *) _krb_swap_tmp) +4 ,2); \
- swab(((char *) x) +4,((char *) _krb_swap_tmp) +2 ,2); \
- swab(((char *) x) +6,((char *) _krb_swap_tmp) ,2); \
- memcpy(x, _krb_swap_tmp, 8);\
- }
-#define swap_u_quad(x) {\
- u_int32_t _krb_swap_tmp[4];\
- swab(( char *) &x, ((char *) _krb_swap_tmp) +6 ,2); \
- swab(((char *) &x) +2,((char *) _krb_swap_tmp) +4 ,2); \
- swab(((char *) &x) +4,((char *) _krb_swap_tmp) +2 ,2); \
- swab(((char *) &x) +6,((char *) _krb_swap_tmp) ,2); \
- memcpy(x, _krb_swap_tmp, 8);\
- }
-
-#define swap_u_long(x) {\
- u_int32_t _krb_swap_tmp[4];\
- swab((char *) &x, ((char *) _krb_swap_tmp) +2 ,2); \
- swab(((char *) &x) +2,((char *) _krb_swap_tmp),2); \
- x = _krb_swap_tmp[0]; \
- }
-
-#define swap_u_short(x) {\
- u_int16_t _krb_swap_sh_tmp; \
- swab((char *) &x, ( &_krb_swap_sh_tmp) ,2); \
- x = (u_int16_t) _krb_swap_sh_tmp; \
- }
-/* Kerberos ticket flag field bit definitions */
-#define K_FLAG_ORDER 0 /* bit 0 --> lsb */
-#define K_FLAG_1 /* reserved */
-#define K_FLAG_2 /* reserved */
-#define K_FLAG_3 /* reserved */
-#define K_FLAG_4 /* reserved */
-#define K_FLAG_5 /* reserved */
-#define K_FLAG_6 /* reserved */
-#define K_FLAG_7 /* reserved, bit 7 --> msb */
-
/* Defines for krb_sendauth and krb_recvauth */
#define KOPT_DONT_MK_REQ 0x00000001 /* don't call krb_mk_req */
@@ -378,189 +325,33 @@ struct krb_host *krb_get_host __P((int, char*, int));
* a hostname
*/
+#define KOPT_IGNORE_PROTOCOL 0x0008
+
#define KRB_SENDAUTH_VLEN 8 /* length for version strings */
-/* File locking */
-#define K_LOCK_SH 1 /* Shared lock */
-#define K_LOCK_EX 2 /* Exclusive lock */
-#define K_LOCK_NB 4 /* Don't block when locking */
-#define K_LOCK_UN 8 /* Unlock */
-int k_flock __P((int fd, int operation));
-struct tm *k_localtime __P((u_int32_t *));
-int k_getsockinst __P((int fd, char *inst, size_t));
-int k_getportbyname __P((const char *service, const char *proto, int default_port));
+/* flags for krb_verify_user() */
+#define KRB_VERIFY_NOT_SECURE 0
+#define KRB_VERIFY_SECURE 1
+#define KRB_VERIFY_SECURE_FAIL 2
extern char *krb4_version;
-struct in_addr;
-
-int k_get_all_addrs __P((struct in_addr **l));
-
-/* Host address comparison */
-int krb_equiv __P((u_int32_t, u_int32_t));
-
-/* Password conversion */
-void mit_string_to_key __P((char *str, char *cell, des_cblock *key));
-void afs_string_to_key __P((char *str, char *cell, des_cblock *key));
-
-/* Lifetime conversion */
-u_int32_t krb_life_to_time __P((u_int32_t start, int life));
-int krb_time_to_life __P((u_int32_t start, u_int32_t end));
-char *krb_life_to_atime __P((int life));
-int krb_atime_to_life __P((char *atime));
-
-/* Ticket manipulation */
-int tf_get_cred __P((CREDENTIALS *));
-int tf_get_pinst __P((char *));
-int tf_get_pname __P((char *));
-int tf_put_pinst __P((char *));
-int tf_put_pname __P((char *));
-int tf_init __P((char *, int));
-int tf_create __P((char *));
-int tf_save_cred __P((char *, char *, char *, unsigned char *, int , int , KTEXT ticket, u_int32_t));
-void tf_close __P((void));
-int tf_setup __P((CREDENTIALS *cred, char *pname, char *pinst));
-
-/* Private communication */
-
-struct sockaddr_in;
-
-int32_t krb_mk_priv __P((void *, void *, u_int32_t, struct des_ks_struct *, des_cblock *, struct sockaddr_in *, struct sockaddr_in *));
-int32_t krb_rd_priv __P((void *, u_int32_t, struct des_ks_struct *, des_cblock *, struct sockaddr_in *, struct sockaddr_in *, MSG_DAT *));
-
-/* Misc */
-KTEXT create_auth_reply __P((char *, char *, char *, int32_t, int, u_int32_t, int, KTEXT));
-
-char *krb_get_phost __P((const char *));
-char *krb_realmofhost __P((const char *));
-char *tkt_string __P((void));
-
-int create_ciph __P((KTEXT, unsigned char *, char *, char *, char *, u_int32_t, int, KTEXT, u_int32_t, des_cblock *));
-int decomp_ticket __P((KTEXT, unsigned char *, char *, char *, char *, u_int32_t *, unsigned char *, int *, u_int32_t *, char *, char *, des_cblock *, struct des_ks_struct *));
-int dest_tkt __P((void));
-int get_ad_tkt __P((char *, char *, char *, int));
-int get_pw_tkt __P((char *, char *, char *, char *));
-int get_request __P((KTEXT, int, char **, char **));
-int in_tkt __P((char *, char *));
-int k_gethostname __P((char *, int ));
-int k_isinst __P((char *));
-int k_isname __P((char *));
-int k_isrealm __P((char *));
-int kname_parse __P((char *, char *, char *, char *));
-int krb_parse_name __P((const char*, krb_principal*));
-char *krb_unparse_name __P((krb_principal*));
-char *krb_unparse_name_r __P((krb_principal*, char*));
-char *krb_unparse_name_long __P((char*, char*, char*));
-char *krb_unparse_name_long_r __P((char *name, char *instance, char *realm, char *fullname));
-int krb_create_ticket __P((KTEXT, unsigned char, char *, char *, char *, int32_t, void *, int16_t, int32_t, char *, char *, des_cblock *));
-int krb_get_admhst __P((char *, char *, int));
-int krb_get_cred __P((char *, char *, char *, CREDENTIALS *));
-
-typedef int (*key_proc_t) __P((char*, char*, char*, void*, des_cblock*));
-
-typedef int (*decrypt_proc_t) __P((char*, char*, char*, void*,
- key_proc_t, KTEXT*));
-
-int krb_get_in_tkt __P((char*, char*, char*, char*, char*, int, key_proc_t,
- decrypt_proc_t, void*));
-
-int srvtab_to_key __P((char *, char *, char *, void *, des_cblock *));
-int passwd_to_key __P((char *, char *, char *, void *, des_cblock *));
-int passwd_to_afskey __P((char *, char *, char *, void *, des_cblock *));
-
-int krb_get_krbhst __P((char *, char *, int));
-int krb_get_lrealm __P((char *, int));
-char *krb_get_default_realm __P((void));
-int krb_get_pw_in_tkt __P((char *, char *, char *, char *, char *, int, char *));
-int krb_get_svc_in_tkt __P((char *, char *, char *, char *, char *, int, char *));
-int krb_get_tf_fullname __P((char *, char *, char *, char *));
-int krb_get_tf_realm __P((char *, char *));
-int krb_kntoln __P((AUTH_DAT *, char *));
-int krb_mk_req __P((KTEXT , char *, char *, char *, int32_t));
-int krb_net_read __P((int , void *, size_t));
-int krb_net_write __P((int , const void *, size_t));
-int krb_rd_err __P((u_char *, u_int32_t, int32_t *, MSG_DAT *));
-int krb_rd_req __P((KTEXT , char *, char *, int32_t, AUTH_DAT *, char *));
-int krb_recvauth __P((int32_t, int, KTEXT, char *, char *, struct sockaddr_in *, struct sockaddr_in *, AUTH_DAT *, char *, struct des_ks_struct *, char *));
-int krb_sendauth __P((int32_t, int, KTEXT, char *,char *, char *, u_int32_t, MSG_DAT *, CREDENTIALS *, struct des_ks_struct *, struct sockaddr_in *, struct sockaddr_in *, char *));
-int krb_mk_auth __P((int32_t, KTEXT, char *, char *, char *, u_int32_t, char *, KTEXT));
-int krb_check_auth __P((KTEXT, u_int32_t, MSG_DAT *, des_cblock *, struct des_ks_struct *, struct sockaddr_in *, struct sockaddr_in *));
-int krb_set_key __P((void *, int));
-int krb_set_lifetime __P((int));
-int krb_kuserok __P((char *name, char *inst, char *realm, char *luser));
-int kuserok __P((AUTH_DAT *, char *));
-int read_service_key __P((char *, char *, char *, int , char *, char *));
-int save_credentials __P((char *, char *, char *, unsigned char *, int , int , KTEXT , int32_t));
-int send_to_kdc __P((KTEXT , KTEXT , char *));
-
-int32_t krb_mk_err __P((u_char *, int32_t, char *));
-int32_t krb_mk_safe __P((void *, void *, u_int32_t, des_cblock *, struct sockaddr_in *, struct sockaddr_in *));
-int32_t krb_rd_safe __P((void *, u_int32_t, des_cblock *, struct sockaddr_in *, struct sockaddr_in *, MSG_DAT *));
-
-void ad_print __P((AUTH_DAT *));
-void cr_err_reply __P((KTEXT, char *, char *, char *, u_int32_t, u_int32_t, char *));
-void extract_ticket __P((KTEXT, int, char *, int *, int *, char *, KTEXT));
-void krb_set_tkt_string __P((char *));
-
-int krb_get_default_principal __P((char *, char *, char *));
-int krb_realm_parse __P((char *, int));
-int krb_verify_user __P((char*, char*, char*, char*, int, char *));
-
-/* logging.c */
-
-typedef int (*krb_log_func_t)(FILE *, const char *, va_list);
-
-typedef krb_log_func_t krb_warnfn_t;
-
-struct krb_log_facility;
-
-int krb_vlogger __P((struct krb_log_facility*, const char *, va_list))
-#ifdef __GNUC__
-__attribute__ ((format (printf, 2, 0)))
-#endif
-;
-int krb_logger __P((struct krb_log_facility*, const char *, ...))
-#ifdef __GNUC__
-__attribute__ ((format (printf, 2, 3)))
-#endif
-;
-int krb_openlog __P((struct krb_log_facility*, char*, FILE*, krb_log_func_t));
-
-void krb_set_warnfn __P((krb_warnfn_t));
-krb_warnfn_t krb_get_warnfn __P((void));
-void krb_warning __P((const char*, ...))
-#ifdef __GNUC__
-__attribute__ ((format (printf, 1, 2)))
-#endif
-;
+typedef int (*key_proc_t) __P((const char *name,
+ char *instance, /* INOUT parameter */
+ const char *realm,
+ const void *password,
+ des_cblock *key));
-void kset_logfile __P((char*));
-void krb_log __P((const char*, ...))
-#ifdef __GNUC__
-__attribute__ ((format (printf, 1, 2)))
-#endif
-;
-char *klog __P((int, const char*, ...))
-#ifdef __GNUC__
-__attribute__ ((format (printf, 2, 3)))
-#endif
-;
-
-int getst __P((int, char *, int));
-const char *month_sname __P((int));
-const char *krb_stime __P((time_t *));
-int krb_check_tm __P((struct tm));
-
-int krb_get_int __P((void *from, u_int32_t *to, int size, int lsb));
-int krb_put_int __P((u_int32_t from, void *to, int size));
-int krb_get_address __P((void *from, u_int32_t *to));
-int krb_put_address __P((u_int32_t addr, void *to));
-int krb_put_string __P((char *from, void *to));
-int krb_get_string __P((void *from, char *to));
-int krb_get_nir __P((void *from, char *name, char *instance, char *realm));
-int krb_put_nir __P((char *name, char *instance, char *realm, void *to));
+typedef int (*decrypt_proc_t) __P((const char *name,
+ const char *instance,
+ const char *realm,
+ const void *arg,
+ key_proc_t,
+ KTEXT *));
+
+#include "krb-protos.h"
__END_DECLS
-#endif /* KRB_DEFS */
+#endif /* __KRB_H__ */
diff --git a/crypto/kerberosIV/lib/krb/lsb_addr_comp.h b/crypto/kerberosIV/lib/krb/lsb_addr_comp.h
deleted file mode 100644
index 21adf06..0000000
--- a/crypto/kerberosIV/lib/krb/lsb_addr_comp.h
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * $Id: lsb_addr_comp.h,v 1.6 1996/10/05 00:18:02 joda Exp $
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Comparison macros to emulate LSBFIRST comparison results of network
- * byte-order quantities
- */
-
-#ifndef LSB_ADDR_COMP_DEFS
-#define LSB_ADDR_COMP_DEFS
-
-/* Compare x and y in VAX byte order, result is -1, 0 or 1. */
-
-#define krb_lsb_antinet_ulong_less(x, y) (((x) == (y)) ? 0 : krb_lsb_antinet_ulong_cmp(x, y))
-
-#define krb_lsb_antinet_ushort_less(x, y) (((x) == (y)) ? 0 : krb_lsb_antinet_ushort_cmp(x, y))
-
-int krb_lsb_antinet_ulong_cmp(u_int32_t x, u_int32_t y);
-int krb_lsb_antinet_ushort_cmp(u_int16_t x, u_int16_t y);
-u_int32_t lsb_time(time_t t, struct sockaddr_in *src, struct sockaddr_in *dst);
-
-#endif /* LSB_ADDR_COMP_DEFS */
diff --git a/crypto/kerberosIV/lib/krb/netread.c b/crypto/kerberosIV/lib/krb/netread.c
deleted file mode 100644
index cbc1bd1..0000000
--- a/crypto/kerberosIV/lib/krb/netread.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- Copyright (C) 1989 by the Massachusetts Institute of Technology
-
- Export of this software from the United States of America is assumed
- to require a specific license from the United States Government.
- It is the responsibility of any person or organization contemplating
- export to obtain such a license before exporting.
-
-WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
-distribute this software and its documentation for any purpose and
-without fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright notice and
-this permission notice appear in supporting documentation, and that
-the name of M.I.T. not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission. M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is" without express
-or implied warranty.
-
- */
-
-#include "krb_locl.h"
-
-RCSID("$Id: netread.c,v 1.6 1997/03/23 03:53:15 joda Exp $");
-
-/*
- * krb_net_read() reads from the file descriptor "fd" to the buffer
- * "buf", until either 1) "len" bytes have been read or 2) cannot
- * read anymore from "fd". It returns the number of bytes read
- * or a read() error. (The calling interface is identical to
- * read(2).)
- *
- * XXX must not use non-blocking I/O
- */
-
-int
-krb_net_read (int fd, void *v, size_t len)
-{
- int cc, len2 = 0;
- char *buf = v;
-
- do {
- cc = read(fd, buf, len);
- if (cc < 0)
- return(cc); /* errno is already set */
- else if (cc == 0) {
- return(len2);
- } else {
- buf += cc;
- len2 += cc;
- len -= cc;
- }
- } while (len > 0);
- return(len2);
-}
diff --git a/crypto/kerberosIV/lib/krb/netwrite.c b/crypto/kerberosIV/lib/krb/netwrite.c
deleted file mode 100644
index 0703d91..0000000
--- a/crypto/kerberosIV/lib/krb/netwrite.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- Copyright (C) 1989 by the Massachusetts Institute of Technology
-
- Export of this software from the United States of America is assumed
- to require a specific license from the United States Government.
- It is the responsibility of any person or organization contemplating
- export to obtain such a license before exporting.
-
-WITHIN THAT CONSTRAINT, permission to use, copy, modify, and
-distribute this software and its documentation for any purpose and
-without fee is hereby granted, provided that the above copyright
-notice appear in all copies and that both that copyright notice and
-this permission notice appear in supporting documentation, and that
-the name of M.I.T. not be used in advertising or publicity pertaining
-to distribution of the software without specific, written prior
-permission. M.I.T. makes no representations about the suitability of
-this software for any purpose. It is provided "as is" without express
-or implied warranty.
-
- */
-
-#include "krb_locl.h"
-
-RCSID("$Id: netwrite.c,v 1.7 1997/03/23 03:53:15 joda Exp $");
-
-/*
- * krb_net_write() writes "len" bytes from "buf" to the file
- * descriptor "fd". It returns the number of bytes written or
- * a write() error. (The calling interface is identical to
- * write(2).)
- *
- * XXX must not use non-blocking I/O
- */
-
-int
-krb_net_write(int fd, const void *v, size_t len)
-{
- int cc;
- int wrlen = len;
- const char *buf = (const char*)v;
-
- do {
- cc = write(fd, buf, wrlen);
- if (cc < 0)
- return(cc);
- else {
- buf += cc;
- wrlen -= cc;
- }
- } while (wrlen > 0);
- return(len);
-}
diff --git a/crypto/kerberosIV/lib/krb/resolve.c b/crypto/kerberosIV/lib/krb/resolve.c
deleted file mode 100644
index 7777c0e..0000000
--- a/crypto/kerberosIV/lib/krb/resolve.c
+++ /dev/null
@@ -1,288 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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 "krb_locl.h"
-#include "resolve.h"
-
-RCSID("$Id: resolve.c,v 1.11 1997/06/01 04:19:20 assar Exp $");
-
-#if defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND)
-
-#define DECL(X) {#X, T_##X}
-
-static struct stot{
- char *name;
- int type;
-}stot[] = {
- DECL(A),
- DECL(NS),
- DECL(CNAME),
- DECL(PTR),
- DECL(MX),
- DECL(TXT),
- DECL(AFSDB),
- DECL(SRV),
- {NULL, 0}
-};
-
-static int
-string_to_type(const char *name)
-{
- struct stot *p = stot;
- for(p = stot; p->name; p++)
- if(strcasecmp(name, p->name) == 0)
- return p->type;
- return -1;
-}
-
-#if 0
-static char *
-type_to_string(int type)
-{
- struct stot *p = stot;
- for(p = stot; p->name; p++)
- if(type == p->type)
- return p->name;
- return NULL;
-}
-#endif
-
-void
-dns_free_data(struct dns_reply *r)
-{
- struct resource_record *rr;
- if(r->q.domain)
- free(r->q.domain);
- for(rr = r->head; rr;){
- struct resource_record *tmp = rr;
- if(rr->domain)
- free(rr->domain);
- if(rr->u.data)
- free(rr->u.data);
- rr = rr->next;
- free(tmp);
- }
- free (r);
-}
-
-static struct dns_reply*
-parse_reply(unsigned char *data, int len)
-{
- unsigned char *p;
- char host[128];
- int status;
-
- struct dns_reply *r;
- struct resource_record **rr;
-
- r = (struct dns_reply*)malloc(sizeof(struct dns_reply));
- memset(r, 0, sizeof(struct dns_reply));
-
- p = data;
- memcpy(&r->h, p, sizeof(HEADER));
- p += sizeof(HEADER);
- status = dn_expand(data, data + len, p, host, sizeof(host));
- if(status < 0){
- dns_free_data(r);
- return NULL;
- }
- r->q.domain = strdup(host);
- p += status;
- r->q.type = (p[0] << 8 | p[1]);
- p += 2;
- r->q.class = (p[0] << 8 | p[1]);
- p += 2;
- rr = &r->head;
- while(p < data + len){
- int type, class, ttl, size;
- status = dn_expand(data, data + len, p, host, sizeof(host));
- if(status < 0){
- dns_free_data(r);
- return NULL;
- }
- p += status;
- type = (p[0] << 8) | p[1];
- p += 2;
- class = (p[0] << 8) | p[1];
- p += 2;
- ttl = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
- p += 4;
- size = (p[0] << 8) | p[1];
- p += 2;
- *rr = (struct resource_record*)calloc(1,
- sizeof(struct resource_record));
- (*rr)->domain = strdup(host);
- (*rr)->type = type;
- (*rr)->class = class;
- (*rr)->ttl = ttl;
- (*rr)->size = size;
- switch(type){
- case T_NS:
- case T_CNAME:
- case T_PTR:
- status = dn_expand(data, data + len, p, host, sizeof(host));
- if(status < 0){
- dns_free_data(r);
- return NULL;
- }
- (*rr)->u.txt = strdup(host);
- break;
- case T_MX:
- case T_AFSDB:{
- status = dn_expand(data, data + len, p + 2, host, sizeof(host));
- if(status < 0){
- dns_free_data(r);
- return NULL;
- }
- (*rr)->u.mx = (struct mx_record*)malloc(sizeof(struct mx_record) +
- strlen(host));
- (*rr)->u.mx->preference = (p[0] << 8) | p[1];
- strcpy((*rr)->u.mx->domain, host);
- break;
- }
- case T_SRV:{
- status = dn_expand(data, data + len, p + 6, host, sizeof(host));
- if(status < 0){
- dns_free_data(r);
- return NULL;
- }
- (*rr)->u.srv =
- (struct srv_record*)malloc(sizeof(struct srv_record) +
- strlen(host));
- (*rr)->u.srv->priority = (p[0] << 8) | p[1];
- (*rr)->u.srv->weight = (p[2] << 8) | p[3];
- (*rr)->u.srv->port = (p[4] << 8) | p[5];
- strcpy((*rr)->u.srv->target, host);
- break;
- }
- case T_TXT:{
- (*rr)->u.txt = (char*)malloc(size + 1);
- strncpy((*rr)->u.txt, (char*)p + 1, *p);
- (*rr)->u.txt[*p] = 0;
- break;
- }
-
- default:
- (*rr)->u.data = (unsigned char*)malloc(size);
- memcpy((*rr)->u.data, p, size);
- }
- p += size;
- rr = &(*rr)->next;
- }
- *rr = NULL;
- return r;
-}
-
-
-
-struct dns_reply *
-dns_lookup(const char *domain, const char *type_name)
-{
- unsigned char reply[1024];
- int len;
- int type;
- struct dns_reply *r = NULL;
-
- type = string_to_type(type_name);
- len = res_search(domain, C_IN, type, reply, sizeof(reply));
- if(len >= 0)
- r = parse_reply(reply, len);
- return r;
-}
-
-#else /* defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND) */
-
-struct dns_reply *
-dns_lookup(const char *domain, const char *type_name)
-{
- return NULL;
-}
-
-void
-dns_free_data(struct dns_reply *r)
-{
-}
-
-#endif
-
-#ifdef TEST
-
-int
-main(int argc, char **argv)
-{
- struct dns_reply *r;
- struct resource_record *rr;
- r = dns_lookup(argv[1], argv[2]);
- if(r == NULL){
- printf("No reply.\n");
- return 1;
- }
- for(rr = r->head; rr;rr=rr->next){
- printf("%s %s %d ", rr->domain, type_to_string(rr->type), rr->ttl);
- switch(rr->type){
- case T_NS:
- printf("%s\n", (char*)rr->data);
- break;
- case T_A:
- printf("%d.%d.%d.%d\n",
- ((unsigned char*)rr->data)[0],
- ((unsigned char*)rr->data)[1],
- ((unsigned char*)rr->data)[2],
- ((unsigned char*)rr->data)[3]);
- break;
- case T_MX:
- case T_AFSDB:{
- struct mx_record *mx = (struct mx_record*)rr->data;
- printf("%d %s\n", mx->preference, mx->domain);
- break;
- }
- case T_SRV:{
- struct srv_record *srv = (struct srv_record*)rr->data;
- printf("%d %d %d %s\n", srv->priority, srv->weight,
- srv->port, srv->target);
- break;
- }
- default:
- printf("\n");
- break;
- }
- }
-
- return 0;
-}
-#endif
diff --git a/crypto/kerberosIV/lib/krb/resolve.h b/crypto/kerberosIV/lib/krb/resolve.h
deleted file mode 100644
index dac9993..0000000
--- a/crypto/kerberosIV/lib/krb/resolve.h
+++ /dev/null
@@ -1,110 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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: resolve.h,v 1.5 1997/05/14 17:41:25 joda Exp $ */
-
-/* THIS IS NOT (yet) A PUBLIC INTERFACE */
-
-
-#ifndef __RESOLVE_H__
-#define __RESOLVE_H__
-
-/* We use these, but they are not always present in <arpa/nameser.h> */
-
-#ifndef T_TXT
-#define T_TXT 16
-#endif
-#ifndef T_AFSDB
-#define T_AFSDB 18
-#endif
-#ifndef T_SRV
-#define T_SRV 33
-#endif
-
-struct dns_query{
- char *domain;
- unsigned type;
- unsigned class;
-};
-
-struct mx_record{
- unsigned preference;
- char domain[1];
-};
-
-struct srv_record{
- unsigned priority;
- unsigned weight;
- unsigned port;
- char target[1];
-};
-
-struct resource_record{
- char *domain;
- unsigned type;
- unsigned class;
- unsigned ttl;
- unsigned size;
- union {
- void *data;
- struct mx_record *mx;
- struct mx_record *afsdb; /* mx and afsdb are identical */
- struct srv_record *srv;
- struct in_addr *a;
- char *txt;
- }u;
- struct resource_record *next;
-};
-
-
-#ifndef HAVE_ARPA_NAMESER_H /* XXX */
-typedef int HEADER; /* will never be used */
-#endif
-
-struct dns_reply{
- HEADER h;
- struct dns_query q;
- struct resource_record *head;
-};
-
-
-struct dns_reply* dns_lookup(const char *, const char *);
-
-void dns_free_data(struct dns_reply *r);
-
-#endif /* __RESOLVE_H__ */
diff --git a/crypto/kerberosIV/lib/krb/swab.c b/crypto/kerberosIV/lib/krb/swab.c
deleted file mode 100644
index d68ce3d..0000000
--- a/crypto/kerberosIV/lib/krb/swab.c
+++ /dev/null
@@ -1,56 +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. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the Kungliga Tekniska
- * Högskolan and its contributors.
- *
- * 4. 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>
-RCSID("$Id: swab.c,v 1.4 1997/04/01 08:18:45 joda Exp $");
-#endif
-
-#ifndef HAVE_SWAB
-void
-swab (char *from, char *to, int nbytes)
-{
- while(nbytes >= 2) {
- *(to + 1) = *from;
- *to = *(from + 1);
- to += 2;
- from += 2;
- nbytes -= 2;
- }
-}
-#endif
diff --git a/crypto/kerberosIV/lib/krb/util.c b/crypto/kerberosIV/lib/krb/util.c
deleted file mode 100644
index 7b77bb8..0000000
--- a/crypto/kerberosIV/lib/krb/util.c
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- *
- * Copyright 1988 by the Massachusetts Institute of Technology.
- *
- * For copying and distribution information, please see the file
- * <mit-copyright.h>.
- *
- * Miscellaneous debug printing utilities
- */
-
-#include "krb_locl.h"
-
-RCSID("$Id: util.c,v 1.6 1996/10/05 00:18:34 joda Exp $");
-
-/*
- * Print some of the contents of the given authenticator structure
- * (AUTH_DAT defined in "krb.h"). Fields printed are:
- *
- * pname, pinst, prealm, netaddr, flags, cksum, timestamp, session
- */
-
-void
-ad_print(AUTH_DAT *x)
-{
- /*
- * Print the contents of an auth_dat struct.
- */
- struct in_addr address;
- address.s_addr = x->address;
- printf("\n%s %s %s %s flags %u cksum 0x%X\n\ttkt_tm 0x%X sess_key",
- x->pname, x->pinst, x->prealm,
- inet_ntoa(address), x->k_flags,
- x->checksum, x->time_sec);
- printf("[8] =");
-#ifdef NOENCRYPTION
- placebo_cblock_print(x->session);
-#else
- des_cblock_print_file(&x->session,stdout);
-#endif
- /* skip reply for now */
-}
-
-/*
- * Print in hex the 8 bytes of the given session key.
- *
- * Printed format is: " 0x { x, x, x, x, x, x, x, x }"
- */
-
-#ifdef NOENCRYPTION
-placebo_cblock_print(x)
- des_cblock x;
-{
- unsigned char *y = (unsigned char *) x;
- int i = 0;
-
- printf(" 0x { ");
-
- while (i++ <8) {
- printf("%x",*y++);
- if (i<8) printf(", ");
- }
- printf(" }");
-}
-#endif
OpenPOWER on IntegriCloud