From 7df5ada37cd843e2315a1c078071854d0c566837 Mon Sep 17 00:00:00 2001 From: markm Date: Sun, 19 Sep 1999 21:56:09 +0000 Subject: Merge anf fix for build. --- crypto/kerberosIV/lib/kadm/kadm_err.et | 2 + crypto/kerberosIV/lib/kafs/kafs.h | 109 +++++++++- crypto/kerberosIV/lib/kdb/base64.c | 150 ------------- crypto/kerberosIV/lib/kdb/base64.h | 47 ----- crypto/kerberosIV/lib/kdb/kdc.h | 3 +- crypto/kerberosIV/lib/kdb/krb_db.h | 3 +- crypto/kerberosIV/lib/krb/et_list.c | 71 ------- crypto/kerberosIV/lib/krb/gettimeofday.c | 56 ----- crypto/kerberosIV/lib/krb/k_concat.c | 116 ---------- crypto/kerberosIV/lib/krb/k_flock.c | 95 --------- crypto/kerberosIV/lib/krb/k_gethostname.c | 58 ----- crypto/kerberosIV/lib/krb/krb.h | 321 +++++----------------------- crypto/kerberosIV/lib/krb/lsb_addr_comp.h | 26 --- crypto/kerberosIV/lib/krb/netread.c | 55 ----- crypto/kerberosIV/lib/krb/netwrite.c | 52 ----- crypto/kerberosIV/lib/krb/resolve.c | 288 ------------------------- crypto/kerberosIV/lib/krb/resolve.h | 110 ---------- crypto/kerberosIV/lib/krb/swab.c | 56 ----- crypto/kerberosIV/lib/krb/util.c | 64 ------ crypto/kerberosIV/lib/roken/roken.h | 338 ------------------------------ 20 files changed, 165 insertions(+), 1855 deletions(-) delete mode 100644 crypto/kerberosIV/lib/kdb/base64.c delete mode 100644 crypto/kerberosIV/lib/kdb/base64.h delete mode 100644 crypto/kerberosIV/lib/krb/et_list.c delete mode 100644 crypto/kerberosIV/lib/krb/gettimeofday.c delete mode 100644 crypto/kerberosIV/lib/krb/k_concat.c delete mode 100644 crypto/kerberosIV/lib/krb/k_flock.c delete mode 100644 crypto/kerberosIV/lib/krb/k_gethostname.c delete mode 100644 crypto/kerberosIV/lib/krb/lsb_addr_comp.h delete mode 100644 crypto/kerberosIV/lib/krb/netread.c delete mode 100644 crypto/kerberosIV/lib/krb/netwrite.c delete mode 100644 crypto/kerberosIV/lib/krb/resolve.c delete mode 100644 crypto/kerberosIV/lib/krb/resolve.h delete mode 100644 crypto/kerberosIV/lib/krb/swab.c delete mode 100644 crypto/kerberosIV/lib/krb/util.c delete mode 100644 crypto/kerberosIV/lib/roken/roken.h (limited to 'crypto/kerberosIV/lib') diff --git a/crypto/kerberosIV/lib/kadm/kadm_err.et b/crypto/kerberosIV/lib/kadm/kadm_err.et index 7a247c5..097e87c 100644 --- a/crypto/kerberosIV/lib/kadm/kadm_err.et +++ b/crypto/kerberosIV/lib/kadm/kadm_err.et @@ -7,6 +7,8 @@ # # Kerberos administration server error table # +# $FreeBSD$ +# et kadm # KADM_SUCCESS, as all success codes should be, is zero diff --git a/crypto/kerberosIV/lib/kafs/kafs.h b/crypto/kerberosIV/lib/kafs/kafs.h index 579856a..650d6ff 100644 --- a/crypto/kerberosIV/lib/kafs/kafs.h +++ b/crypto/kerberosIV/lib/kafs/kafs.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan + * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -36,13 +36,14 @@ * SUCH DAMAGE. */ -/* $Id$ */ +/* $Id: kafs.h,v 1.31 1999/07/07 12:30:40 assar Exp $ */ +/* $FreeBSD$ */ #ifndef __KAFS_H #define __KAFS_H -#include -#include +/* XXX must include krb5.h or krb.h */ + /* sys/ioctl.h must be included manually before kafs.h */ /* @@ -54,10 +55,39 @@ #define _VICEIOCTL(id) ((unsigned int ) _IOW('V', id, struct ViceIoctl)) #endif /* _VICEIOCTL */ +#define VIOCSETAL _VICEIOCTL(1) +#define VIOCGETAL _VICEIOCTL(2) #define VIOCSETTOK _VICEIOCTL(3) +#define VIOCGETVOLSTAT _VICEIOCTL(4) +#define VIOCSETVOLSTAT _VICEIOCTL(5) +#define VIOCFLUSH _VICEIOCTL(6) #define VIOCGETTOK _VICEIOCTL(8) #define VIOCUNLOG _VICEIOCTL(9) +#define VIOCCKSERV _VICEIOCTL(10) +#define VIOCCKBACK _VICEIOCTL(11) +#define VIOCCKCONN _VICEIOCTL(12) +#define VIOCWHEREIS _VICEIOCTL(14) +#define VIOCACCESS _VICEIOCTL(20) +#define VIOCUNPAG _VICEIOCTL(21) +#define VIOCGETFID _VICEIOCTL(22) +#define VIOCSETCACHESIZE _VICEIOCTL(24) +#define VIOCFLUSHCB _VICEIOCTL(25) +#define VIOCNEWCELL _VICEIOCTL(26) +#define VIOCGETCELL _VICEIOCTL(27) +#define VIOC_AFS_DELETE_MT_PT _VICEIOCTL(28) +#define VIOC_AFS_STAT_MT_PT _VICEIOCTL(29) #define VIOC_FILE_CELL_NAME _VICEIOCTL(30) +#define VIOC_GET_WS_CELL _VICEIOCTL(31) +#define VIOC_AFS_MARINER_HOST _VICEIOCTL(32) +#define VIOC_GET_PRIMARY_CELL _VICEIOCTL(33) +#define VIOC_VENUSLOG _VICEIOCTL(34) +#define VIOC_GETCELLSTATUS _VICEIOCTL(35) +#define VIOC_SETCELLSTATUS _VICEIOCTL(36) +#define VIOC_FLUSHVOLUME _VICEIOCTL(37) +#define VIOC_AFS_SYSNAME _VICEIOCTL(38) +#define VIOC_EXPORTAFS _VICEIOCTL(39) +#define VIOCGETCACHEPARAMS _VICEIOCTL(40) +#define VIOC_GCPAGS _VICEIOCTL(48) struct ViceIoctl { caddr_t in, out; @@ -73,17 +103,34 @@ struct ClearToken { int32_t EndTimestamp; }; +#ifdef __STDC__ #ifndef __P #define __P(x) x #endif +#else +#ifndef __P +#define __P(x) () +#endif +#endif /* Use k_hasafs() to probe if the machine supports AFS syscalls. The other functions will generate a SIGSYS if AFS is not supported */ int k_hasafs __P((void)); -int k_afsklog __P((const char *cell, const char *realm)); -int k_afsklog_uid __P((const char *cell, const char *realm, uid_t uid)); +int krb_afslog __P((const char *cell, const char *realm)); +int krb_afslog_uid __P((const char *cell, const char *realm, uid_t uid)); +int krb_afslog_home __P((const char *cell, const char *realm, + const char *homedir)); +int krb_afslog_uid_home __P((const char *cell, const char *realm, uid_t uid, + const char *homedir)); + +int krb_realm_of_cell __P((const char *cell, char **realm)); + +/* compat */ +#define k_afsklog krb_afslog +#define k_afsklog_uid krb_afslog_uid + int k_pioctl __P((char *a_path, int o_opcode, struct ViceIoctl *a_paramsP, @@ -92,9 +139,59 @@ int k_unlog __P((void)); int k_setpag __P((void)); int k_afs_cell_of_file __P((const char *path, char *cell, int len)); + + +/* XXX */ +#ifdef KFAILURE +#define KRB_H_INCLUDED +#endif + +#ifdef KRB5_RECVAUTH_IGNORE_VERSION +#define KRB5_H_INCLUDED +#endif + +#ifdef KRB_H_INCLUDED +int kafs_settoken __P((const char*, uid_t, CREDENTIALS*)); +#endif + +#ifdef KRB5_H_INCLUDED +krb5_error_code krb5_afslog_uid __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + uid_t uid)); +krb5_error_code krb5_afslog __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm)); +krb5_error_code krb5_afslog_uid_home __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + uid_t uid, + const char *homedir)); + +krb5_error_code krb5_afslog_home __P((krb5_context context, + krb5_ccache id, + const char *cell, + krb5_const_realm realm, + const char *homedir)); + +krb5_error_code krb5_realm_of_cell __P((const char *cell, char **realm)); + +#endif + + #define _PATH_VICE "/usr/vice/etc/" #define _PATH_THISCELL _PATH_VICE "ThisCell" #define _PATH_CELLSERVDB _PATH_VICE "CellServDB" #define _PATH_THESECELLS _PATH_VICE "TheseCells" +#define _PATH_ARLA_VICE "/usr/arla/etc/" +#define _PATH_ARLA_THISCELL _PATH_ARLA_VICE "ThisCell" +#define _PATH_ARLA_CELLSERVDB _PATH_ARLA_VICE "CellServDB" +#define _PATH_ARLA_THESECELLS _PATH_ARLA_VICE "TheseCells" + +extern int _kafs_debug; + #endif /* __KAFS_H */ diff --git a/crypto/kerberosIV/lib/kdb/base64.c b/crypto/kerberosIV/lib/kdb/base64.c deleted file mode 100644 index d7e89c4..0000000 --- a/crypto/kerberosIV/lib/kdb/base64.c +++ /dev/null @@ -1,150 +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 -RCSID("$Id: base64.c,v 1.7 1997/04/01 08:18:16 joda Exp $"); -#endif - -#include -#include -#include -#include "base64.h" - -static char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"; - -static int POS(char c) -{ - if(c == '=') return 64; - if(isupper(c)) - return c - 'A'; - if(islower(c)) - return c - 'a' + 26; - if(isdigit(c)) - return c - '0' + 52; - if(c == '+') - return 62; - if(c == '/') - return 63; - return -1; -} - -char *base64_encode(const void *buf, int size) -{ - char *str = (char*)malloc((size+3)*4/3+1); - char *p=str; - unsigned char *q = (unsigned char*)buf; - int i; - int c; - i=0; - while(i> 18]; - p[1]=base64[(c&0x0003f000) >> 12]; - p[2]=base64[(c&0x00000fc0) >> 6]; - p[3]=base64[(c&0x0000003f) >> 0]; - if(i>size) - p[3]='='; - if(i>size+1) - p[2]='='; - p+=4; - } - *p=0; - return str; -} - -/* convert string in s to binary data. s should be a multiple of 4 - * bytes long. data should be at least len(s) * 3 / 4 bytes long. - * returns - */ -int base64_decode(char *s, void *data) -{ - char *p; - unsigned char *q; - int n[4]; - - if(strlen(s) % 4) - return -1; - q=(unsigned char*)data; - for(p=s; *p; p+=4){ - n[0] = POS(p[0]); - n[1] = POS(p[1]); - n[2] = POS(p[2]); - n[3] = POS(p[3]); - if((n[0] | n[1] | n[2] | n[3]) < 0) - return -1; - - if(n[0] == 64 || n[1] == 64) - return -1; - if(n[2] == 64 && n[3] < 64) - return -1; - q[0] = (n[0] << 2) + (n[1] >> 4); - if(n[2] < 64){ - q[1] = ((n[1] & 15) << 4) + (n[2] >> 2); - } - if(n[3] < 64){ - q[2] = ((n[2] & 3) << 6) + n[3]; - } - q+=3; - } - q -= (n[2] == 64) + (n[3] == 64); - return q - (unsigned char*)data; -} - -#ifdef TEST -int main(int argc, char **argv) -{ - char str[128]; - char buf[128]; - char *p; - printf("base64_encode(\"%s\") = \"%s\"\n", argv[1], - p=base64_encode(argv[1], strlen(argv[1]))); - printf("base64_decode(\"%s\") = %d", p, base64_decode(p, buf)); - printf(" (\"%s\")\n", buf); - printf("base64_decode(\"%s\") = %d", argv[1], base64_decode(argv[1], buf)); - printf(" (\"%s\")\n", buf); -} -#endif diff --git a/crypto/kerberosIV/lib/kdb/base64.h b/crypto/kerberosIV/lib/kdb/base64.h deleted file mode 100644 index edfb344..0000000 --- a/crypto/kerberosIV/lib/kdb/base64.h +++ /dev/null @@ -1,47 +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: base64.h,v 1.5 1997/04/01 08:18:16 joda Exp $ */ - -#ifndef _BASE64_H_ -#define _BASE64_H_ - -char *base64_encode(const void *buf, int size); -int base64_decode(char *s, void *data); - -#endif diff --git a/crypto/kerberosIV/lib/kdb/kdc.h b/crypto/kerberosIV/lib/kdb/kdc.h index 08fa94f..968775d 100644 --- a/crypto/kerberosIV/lib/kdb/kdc.h +++ b/crypto/kerberosIV/lib/kdb/kdc.h @@ -1,5 +1,6 @@ /* - * $Id$ + * $Id: kdc.h,v 1.8 1997/04/01 03:59:05 assar Exp $ + * $FreeBSD$ * * Copyright 1987, 1988 by the Massachusetts Institute of Technology. * diff --git a/crypto/kerberosIV/lib/kdb/krb_db.h b/crypto/kerberosIV/lib/kdb/krb_db.h index 00d6bb0..d0fc260 100644 --- a/crypto/kerberosIV/lib/kdb/krb_db.h +++ b/crypto/kerberosIV/lib/kdb/krb_db.h @@ -1,5 +1,6 @@ /* - * $Id$ + * $Id: krb_db.h,v 1.15 1996/12/17 20:34:32 assar Exp $ + * $FreeBSD$ * * Copyright 1987, 1988 by the Massachusetts Institute of Technology. * 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 -#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 -#include -#include #include -__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 -/* 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 - * . - * - * 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 */ - -#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 -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 - * . - * - * 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 diff --git a/crypto/kerberosIV/lib/roken/roken.h b/crypto/kerberosIV/lib/roken/roken.h deleted file mode 100644 index 1204e3e..0000000 --- a/crypto/kerberosIV/lib/roken/roken.h +++ /dev/null @@ -1,338 +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: roken.h,v 1.63 1997/05/28 05:38:09 assar Exp $ */ - -#ifndef __ROKEN_H__ -#define __ROKEN_H__ - -#include -#include -#include -#include -#ifdef HAVE_SYS_TYPES_H -#include -#endif -#ifdef HAVE_UNISTD_H -#include -#endif -#ifdef HAVE_GRP_H -#include -#endif -#ifdef HAVE_SYS_STAT_H -#include -#endif -#ifdef HAVE_NETINET_IN_H -#include -#endif - -#ifdef HAVE_TERMIOS_H -#include -#endif - -#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4 -#include -#endif - -#include "protos.h" - -#if !defined(HAVE_SETSID) && defined(HAVE__SETSID) -#define setsid _setsid -#endif - -#ifndef HAVE_PUTENV -int putenv(const char *string); -#endif - -#ifndef HAVE_SETENV -int setenv(const char *var, const char *val, int rewrite); -#endif - -#ifndef HAVE_UNSETENV -void unsetenv(const char *name); -#endif - -#ifndef HAVE_GETUSERSHELL -char *getusershell(void); -#endif - -#if !defined(__GNUC__) && !defined(__attribute__) -#define __attribute__(x) -#endif - -#ifndef HAVE_SNPRINTF -int snprintf (char *str, size_t sz, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); -#endif - -#ifndef HAVE_VSNPRINTF -int vsnprintf (char *str, size_t sz, const char *format, va_list ap) - __attribute__((format (printf, 3, 0))); -#endif - -#ifndef HAVE_ASPRINTF -int asprintf (char **ret, const char *format, ...) - __attribute__ ((format (printf, 2, 3))); -#endif - -#ifndef HAVE_VASPRINTF -int vasprintf (char **ret, const char *format, va_list ap) - __attribute__((format (printf, 2, 0))); -#endif - -#ifndef HAVE_ASNPRINTF -int asnprintf (char **ret, size_t max_sz, const char *format, ...) - __attribute__ ((format (printf, 3, 4))); -#endif - -#ifndef HAVE_VASNPRINTF -int vasnprintf (char **ret, size_t max_sz, const char *format, va_list ap) - __attribute__((format (printf, 3, 0))); -#endif - -#ifndef HAVE_STRDUP -char * strdup(const char *old); -#endif - -#ifndef HAVE_STRLWR -char * strlwr(char *); -#endif - -#ifndef HAVE_STRNLEN -int strnlen(char*, int); -#endif - -#ifndef HAVE_STRTOK_R -char *strtok_r(char *s1, const char *s2, char **lasts); -#endif - -#ifndef HAVE_STRUPR -char * strupr(char *); -#endif - -#ifndef HAVE_GETDTABLESIZE -int getdtablesize(void); -#endif - -#if IRIX != 4 /* fix for compiler bug */ -#ifdef RETSIGTYPE -typedef RETSIGTYPE (*SigAction)(/* int??? */); -SigAction signal(int iSig, SigAction pAction); /* BSD compatible */ -#endif -#endif - -#ifndef SIG_ERR -#define SIG_ERR ((RETSIGTYPE (*)())-1) -#endif - -#if !defined(HAVE_STRERROR) && !defined(strerror) -char *strerror(int eno); -#endif - -#ifndef HAVE_HSTRERROR -char *hstrerror(int herr); -#endif - -#ifndef HAVE_H_ERRNO_DECLARATION -extern int h_errno; -#endif - -#ifndef HAVE_INET_ATON -/* Minimal implementation of inet_aton. Doesn't handle hex numbers. */ -int inet_aton(const char *cp, struct in_addr *adr); -#endif - -#if !defined(HAVE_GETCWD) -char* getcwd(char *path, size_t size); -#endif - -#ifndef HAVE_GETENT -int getent(char *cp, char *name); -#endif - -#ifdef HAVE_PWD_H -#include -struct passwd *k_getpwnam (char *user); -struct passwd *k_getpwuid (uid_t uid); -#endif - -#ifndef HAVE_SETEUID -int seteuid(int euid); -#endif - -#ifndef HAVE_SETEGID -int setegid(int egid); -#endif - -#ifndef HAVE_LSTAT -int lstat(const char *path, struct stat *buf); -#endif - -#ifndef HAVE_MKSTEMP -int mkstemp(char *); -#endif - -#ifndef HAVE_INITGROUPS -int initgroups(const char *name, gid_t basegid); -#endif - -#ifndef HAVE_FCHOWN -int fchown(int fd, uid_t owner, gid_t group); -#endif - -#ifndef HAVE_CHOWN -int chown(const char *path, uid_t owner, gid_t group); -#endif - -#ifndef HAVE_RCMD -int rcmd(char **ahost, unsigned short inport, const char *locuser, - const char *remuser, const char *cmd, int *fd2p); -#endif - -#ifdef TIME_WITH_SYS_TIME -#include -#include -#elif defined(HAVE_SYS_TIME_H) -#include -#else -#include -#endif - -time_t tm2time (struct tm tm, int local); - -int unix_verify_user(char *user, char *password); - -void inaddr2str(struct in_addr addr, char *s, size_t len); - -void mini_inetd (int port); - -#ifndef HAVE_STRUCT_WINSIZE -struct winsize { - unsigned short ws_row, ws_col; - unsigned short ws_xpixel, ws_ypixel; -}; -#endif - -int get_window_size(int fd, struct winsize *); - -#ifndef INADDR_NONE -#define INADDR_NONE 0xffffffff -#endif - -#ifndef SOMAXCONN -#define SOMAXCONN 5 -#endif - -#ifndef STDIN_FILENO -#define STDIN_FILENO 0 -#endif - -#ifndef STDOUT_FILENO -#define STDOUT_FILENO 1 -#endif - -#ifndef STDERR_FILENO -#define STDERR_FILENO 2 -#endif - -#ifndef max -#define max(a,b) (((a)>(b))?(a):(b)) -#endif - -#ifndef min -#define min(a,b) (((a)<(b))?(a):(b)) -#endif - -#ifndef TRUE -#define TRUE 1 -#endif - -#ifndef FALSE -#define FALSE 0 -#endif - -#ifdef HAVE_SYSLOG_H -#include -/* Misc definitions for old syslogs */ - -#ifndef LOG_DAEMON -#define openlog(id,option,facility) openlog((id),(option)) -#define LOG_DAEMON 0 -#endif -#ifndef LOG_ODELAY -#define LOG_ODELAY 0 -#endif -#ifndef LOG_NDELAY -#define LOG_NDELAY 0x08 -#endif -#ifndef LOG_CONS -#define LOG_CONS 0 -#endif -#ifndef LOG_AUTH -#define LOG_AUTH 0 -#endif -#ifndef LOG_AUTHPRIV -#define LOG_AUTHPRIV LOG_AUTH -#endif -#endif - -#ifndef HAVE_OPTARG_DECLARATION -extern char *optarg; -#endif -#ifndef HAVE_OPTIND_DECLARATION -extern int optind; -#endif -#ifndef HAVE_OPTERR_DECLARATION -extern int opterr; -#endif - -#ifndef HAVE___PROGNAME_DECLARATION -extern const char *__progname; -#endif - -void set_progname(char *argv0); - -#ifdef HAVE_PATHS_H -#include -#endif - -#ifndef _PATH_DEVNULL -#define _PATH_DEVNULL "/dev/null" -#endif - -#endif /* __ROKEN_H__ */ -- cgit v1.1