summaryrefslogtreecommitdiffstats
path: root/crypto/kerberosIV/lib
diff options
context:
space:
mode:
authormarkm <markm@FreeBSD.org>1999-09-19 14:19:32 +0000
committermarkm <markm@FreeBSD.org>1999-09-19 14:19:32 +0000
commitc171f3b18205ec5324a32cba54aff58ae5594701 (patch)
tree66b3054dafd0977d967bd8aba7ce4e8bcc8d605f /crypto/kerberosIV/lib
parent4f947d680afa74c70cf3f206d4f05dcc3555aa90 (diff)
parentfe83e8abf357ee11114856a5278bb38431a9517c (diff)
downloadFreeBSD-src-c171f3b18205ec5324a32cba54aff58ae5594701.zip
FreeBSD-src-c171f3b18205ec5324a32cba54aff58ae5594701.tar.gz
This commit was generated by cvs2svn to compensate for changes in r51415,
which included commits to RCS files with non-trunk default branches.
Diffstat (limited to 'crypto/kerberosIV/lib')
-rw-r--r--crypto/kerberosIV/lib/Makefile.in6
-rw-r--r--crypto/kerberosIV/lib/acl/Makefile.in32
-rw-r--r--crypto/kerberosIV/lib/acl/acl.h4
-rw-r--r--crypto/kerberosIV/lib/acl/acl_files.c100
-rw-r--r--crypto/kerberosIV/lib/auth/ChangeLog34
-rw-r--r--crypto/kerberosIV/lib/auth/Makefile.am6
-rw-r--r--crypto/kerberosIV/lib/auth/Makefile.in55
-rw-r--r--crypto/kerberosIV/lib/auth/afskauthlib/Makefile.am38
-rw-r--r--crypto/kerberosIV/lib/auth/afskauthlib/Makefile.in86
-rw-r--r--crypto/kerberosIV/lib/auth/afskauthlib/README25
-rw-r--r--crypto/kerberosIV/lib/auth/afskauthlib/verify.c213
-rw-r--r--crypto/kerberosIV/lib/auth/pam/Makefile.am3
-rw-r--r--crypto/kerberosIV/lib/auth/pam/Makefile.in83
-rw-r--r--crypto/kerberosIV/lib/auth/pam/README25
-rw-r--r--crypto/kerberosIV/lib/auth/pam/pam.c244
-rw-r--r--crypto/kerberosIV/lib/auth/pam/pam.conf.add13
-rw-r--r--crypto/kerberosIV/lib/auth/sia/Makefile.am48
-rw-r--r--crypto/kerberosIV/lib/auth/sia/Makefile.in89
-rw-r--r--crypto/kerberosIV/lib/auth/sia/README87
-rw-r--r--crypto/kerberosIV/lib/auth/sia/krb4+c2_matrix.conf63
-rw-r--r--crypto/kerberosIV/lib/auth/sia/krb4_matrix.conf64
-rw-r--r--crypto/kerberosIV/lib/auth/sia/krb5+c2_matrix.conf27
-rw-r--r--crypto/kerberosIV/lib/auth/sia/krb5_matrix.conf27
-rw-r--r--crypto/kerberosIV/lib/auth/sia/posix_getpw.c78
-rw-r--r--crypto/kerberosIV/lib/auth/sia/security.patch11
-rw-r--r--crypto/kerberosIV/lib/auth/sia/sia.c673
-rw-r--r--crypto/kerberosIV/lib/auth/sia/sia_locl.h94
-rw-r--r--crypto/kerberosIV/lib/kadm/Makefile.in81
-rw-r--r--crypto/kerberosIV/lib/kadm/check_password.c60
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm.h41
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm_cli_wrap.c284
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm_err.et12
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm_locl.h8
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm_stream.c298
-rw-r--r--crypto/kerberosIV/lib/kadm/kadm_supp.c177
-rw-r--r--crypto/kerberosIV/lib/kafs/ChangeLog117
-rw-r--r--crypto/kerberosIV/lib/kafs/Makefile.am69
-rw-r--r--crypto/kerberosIV/lib/kafs/Makefile.in71
-rw-r--r--crypto/kerberosIV/lib/kafs/README.dlfcn246
-rw-r--r--crypto/kerberosIV/lib/kafs/afskrb.c374
-rw-r--r--crypto/kerberosIV/lib/kafs/afskrb5.c177
-rw-r--r--crypto/kerberosIV/lib/kafs/afssys.c265
-rw-r--r--crypto/kerberosIV/lib/kafs/afssysdefs.h13
-rw-r--r--crypto/kerberosIV/lib/kafs/common.c370
-rw-r--r--crypto/kerberosIV/lib/kafs/dlfcn.c119
-rw-r--r--crypto/kerberosIV/lib/kafs/kafs_locl.h49
-rw-r--r--crypto/kerberosIV/lib/kdb/Makefile.in49
-rw-r--r--crypto/kerberosIV/lib/kdb/krb_cache.c32
-rw-r--r--crypto/kerberosIV/lib/kdb/krb_dbm.c121
-rw-r--r--crypto/kerberosIV/lib/kdb/krb_kdb_utils.c28
-rw-r--r--crypto/kerberosIV/lib/kdb/krb_lib.c47
-rw-r--r--crypto/kerberosIV/lib/krb/Makefile.in474
-rw-r--r--crypto/kerberosIV/lib/krb/cr_err_reply.c50
-rw-r--r--crypto/kerberosIV/lib/krb/create_auth_reply.c63
-rw-r--r--crypto/kerberosIV/lib/krb/create_ciph.c44
-rw-r--r--crypto/kerberosIV/lib/krb/create_death_packet.c30
-rw-r--r--crypto/kerberosIV/lib/krb/create_ticket.c45
-rw-r--r--crypto/kerberosIV/lib/krb/debug_decl.c17
-rw-r--r--crypto/kerberosIV/lib/krb/decomp_ticket.c19
-rw-r--r--crypto/kerberosIV/lib/krb/dllmain.c50
-rw-r--r--crypto/kerberosIV/lib/krb/extra.c207
-rw-r--r--crypto/kerberosIV/lib/krb/get_ad_tkt.c38
-rw-r--r--crypto/kerberosIV/lib/krb/get_cred.c4
-rw-r--r--crypto/kerberosIV/lib/krb/get_default_principal.c20
-rw-r--r--crypto/kerberosIV/lib/krb/get_host.c246
-rw-r--r--crypto/kerberosIV/lib/krb/get_in_tkt.c109
-rw-r--r--crypto/kerberosIV/lib/krb/get_krbrlm.c182
-rw-r--r--crypto/kerberosIV/lib/krb/get_svc_in_tkt.c7
-rw-r--r--crypto/kerberosIV/lib/krb/get_tf_fullname.c8
-rw-r--r--crypto/kerberosIV/lib/krb/getaddrs.c93
-rw-r--r--crypto/kerberosIV/lib/krb/getfile.c96
-rw-r--r--crypto/kerberosIV/lib/krb/getrealm.c169
-rw-r--r--crypto/kerberosIV/lib/krb/k_getsockinst.c5
-rw-r--r--crypto/kerberosIV/lib/krb/kdc_reply.c13
-rw-r--r--crypto/kerberosIV/lib/krb/kntoln.c145
-rw-r--r--crypto/kerberosIV/lib/krb/krb-archaeology.h131
-rw-r--r--crypto/kerberosIV/lib/krb/krb-protos.h773
-rw-r--r--crypto/kerberosIV/lib/krb/krb.def16
-rw-r--r--crypto/kerberosIV/lib/krb/krb.dsp398
-rw-r--r--crypto/kerberosIV/lib/krb/krb.mak3301
-rw-r--r--crypto/kerberosIV/lib/krb/krb.rc105
-rw-r--r--crypto/kerberosIV/lib/krb/krb_equiv.c13
-rw-r--r--crypto/kerberosIV/lib/krb/krb_err.et310
-rw-r--r--crypto/kerberosIV/lib/krb/krb_err_txt.c6
-rw-r--r--crypto/kerberosIV/lib/krb/krb_get_in_tkt.c153
-rw-r--r--crypto/kerberosIV/lib/krb/krb_locl.h59
-rw-r--r--crypto/kerberosIV/lib/krb/krb_log.h79
-rw-r--r--crypto/kerberosIV/lib/krb/krb_net_read.c47
-rw-r--r--crypto/kerberosIV/lib/krb/krb_net_write.c47
-rw-r--r--crypto/kerberosIV/lib/krb/kuserok.c48
-rw-r--r--crypto/kerberosIV/lib/krb/logging.c6
-rw-r--r--crypto/kerberosIV/lib/krb/lsb_addr_comp.c42
-rw-r--r--crypto/kerberosIV/lib/krb/mk_auth.c50
-rw-r--r--crypto/kerberosIV/lib/krb/mk_err.c11
-rw-r--r--crypto/kerberosIV/lib/krb/mk_priv.c20
-rw-r--r--crypto/kerberosIV/lib/krb/mk_req.c102
-rw-r--r--crypto/kerberosIV/lib/krb/mk_safe.c18
-rw-r--r--crypto/kerberosIV/lib/krb/name2name.c29
-rw-r--r--crypto/kerberosIV/lib/krb/parse_name.c8
-rw-r--r--crypto/kerberosIV/lib/krb/prot.h59
-rw-r--r--crypto/kerberosIV/lib/krb/rd_priv.c6
-rw-r--r--crypto/kerberosIV/lib/krb/rd_req.c12
-rw-r--r--crypto/kerberosIV/lib/krb/rd_safe.c4
-rw-r--r--crypto/kerberosIV/lib/krb/read_service_key.c15
-rw-r--r--crypto/kerberosIV/lib/krb/realm_parse.c22
-rw-r--r--crypto/kerberosIV/lib/krb/recvauth.c16
-rw-r--r--crypto/kerberosIV/lib/krb/resource.h15
-rw-r--r--crypto/kerberosIV/lib/krb/roken_rename.h103
-rw-r--r--crypto/kerberosIV/lib/krb/rw.c66
-rw-r--r--crypto/kerberosIV/lib/krb/send_to_kdc.c473
-rw-r--r--crypto/kerberosIV/lib/krb/sendauth.c8
-rw-r--r--crypto/kerberosIV/lib/krb/sizetest.c17
-rw-r--r--crypto/kerberosIV/lib/krb/solaris_compat.c94
-rw-r--r--crypto/kerberosIV/lib/krb/str2key.c31
-rw-r--r--crypto/kerberosIV/lib/krb/tf_util.c77
-rw-r--r--crypto/kerberosIV/lib/krb/ticket_memory.c86
-rw-r--r--crypto/kerberosIV/lib/krb/ticket_memory.h3
-rw-r--r--crypto/kerberosIV/lib/krb/time.c76
-rw-r--r--crypto/kerberosIV/lib/krb/tkt_string.c28
-rw-r--r--crypto/kerberosIV/lib/krb/unparse_name.c18
-rw-r--r--crypto/kerberosIV/lib/krb/verify_user.c118
-rw-r--r--crypto/kerberosIV/lib/roken/ChangeLog373
-rw-r--r--crypto/kerberosIV/lib/roken/Makefile.am157
-rw-r--r--crypto/kerberosIV/lib/roken/Makefile.in182
-rw-r--r--crypto/kerberosIV/lib/roken/base64.c151
-rw-r--r--crypto/kerberosIV/lib/roken/base64.h47
-rw-r--r--crypto/kerberosIV/lib/roken/concat.c117
-rw-r--r--crypto/kerberosIV/lib/roken/daemon.c47
-rw-r--r--crypto/kerberosIV/lib/roken/emalloc.c61
-rw-r--r--crypto/kerberosIV/lib/roken/eread.c62
-rw-r--r--crypto/kerberosIV/lib/roken/erealloc.c61
-rw-r--r--crypto/kerberosIV/lib/roken/err.h6
-rw-r--r--crypto/kerberosIV/lib/roken/estrdup.c61
-rw-r--r--crypto/kerberosIV/lib/roken/ewrite.c62
-rw-r--r--crypto/kerberosIV/lib/roken/flock.c92
-rw-r--r--crypto/kerberosIV/lib/roken/fnmatch.c173
-rw-r--r--crypto/kerberosIV/lib/roken/fnmatch.h49
-rw-r--r--crypto/kerberosIV/lib/roken/get_default_username.c85
-rw-r--r--crypto/kerberosIV/lib/roken/get_window_size.c57
-rw-r--r--crypto/kerberosIV/lib/roken/getarg.c488
-rw-r--r--crypto/kerberosIV/lib/roken/getarg.h74
-rw-r--r--crypto/kerberosIV/lib/roken/getcwd.c9
-rw-r--r--crypto/kerberosIV/lib/roken/getdtablesize.c6
-rw-r--r--crypto/kerberosIV/lib/roken/getegid.c53
-rw-r--r--crypto/kerberosIV/lib/roken/geteuid.c53
-rw-r--r--crypto/kerberosIV/lib/roken/getgid.c53
-rw-r--r--crypto/kerberosIV/lib/roken/gethostname.c77
-rw-r--r--crypto/kerberosIV/lib/roken/gettimeofday.c60
-rw-r--r--crypto/kerberosIV/lib/roken/getuid.c53
-rw-r--r--crypto/kerberosIV/lib/roken/glob.c835
-rw-r--r--crypto/kerberosIV/lib/roken/glob.h84
-rw-r--r--crypto/kerberosIV/lib/roken/hstrerror.c19
-rw-r--r--crypto/kerberosIV/lib/roken/inaddr2str.c29
-rw-r--r--crypto/kerberosIV/lib/roken/inet_aton.c9
-rw-r--r--crypto/kerberosIV/lib/roken/innetgr.c49
-rw-r--r--crypto/kerberosIV/lib/roken/iruserok.c294
-rw-r--r--crypto/kerberosIV/lib/roken/issuid.c58
-rw-r--r--crypto/kerberosIV/lib/roken/k_getpwnam.c6
-rw-r--r--crypto/kerberosIV/lib/roken/k_getpwuid.c6
-rw-r--r--crypto/kerberosIV/lib/roken/make-print-version.c73
-rw-r--r--crypto/kerberosIV/lib/roken/memmove.c4
-rw-r--r--crypto/kerberosIV/lib/roken/mini_inetd.c30
-rw-r--r--crypto/kerberosIV/lib/roken/net_read.c79
-rw-r--r--crypto/kerberosIV/lib/roken/net_write.c77
-rw-r--r--crypto/kerberosIV/lib/roken/parse_time.c83
-rw-r--r--crypto/kerberosIV/lib/roken/parse_time.h56
-rw-r--r--crypto/kerberosIV/lib/roken/parse_units.c327
-rw-r--r--crypto/kerberosIV/lib/roken/parse_units.h78
-rw-r--r--crypto/kerberosIV/lib/roken/print_version.c83
-rw-r--r--crypto/kerberosIV/lib/roken/readv.c72
-rw-r--r--crypto/kerberosIV/lib/roken/recvmsg.c74
-rw-r--r--crypto/kerberosIV/lib/roken/resolve.c358
-rw-r--r--crypto/kerberosIV/lib/roken/resolve.h108
-rw-r--r--crypto/kerberosIV/lib/roken/resource.h15
-rw-r--r--crypto/kerberosIV/lib/roken/roken-common.h147
-rw-r--r--crypto/kerberosIV/lib/roken/roken.awk35
-rw-r--r--crypto/kerberosIV/lib/roken/roken.def15
-rw-r--r--crypto/kerberosIV/lib/roken/roken.dsp156
-rw-r--r--crypto/kerberosIV/lib/roken/roken.h.in435
-rw-r--r--crypto/kerberosIV/lib/roken/roken.mak362
-rw-r--r--crypto/kerberosIV/lib/roken/roken.rc105
-rw-r--r--crypto/kerberosIV/lib/roken/roken_gethostby.c285
-rw-r--r--crypto/kerberosIV/lib/roken/sendmsg.c70
-rw-r--r--crypto/kerberosIV/lib/roken/setegid.c6
-rw-r--r--crypto/kerberosIV/lib/roken/seteuid.c6
-rw-r--r--crypto/kerberosIV/lib/roken/simple_exec.c124
-rw-r--r--crypto/kerberosIV/lib/roken/snprintf.c254
-rw-r--r--crypto/kerberosIV/lib/roken/strcasecmp.c147
-rw-r--r--crypto/kerberosIV/lib/roken/strcat_truncate.c55
-rw-r--r--crypto/kerberosIV/lib/roken/strcpy_truncate.c65
-rw-r--r--crypto/kerberosIV/lib/roken/strerror.c6
-rw-r--r--crypto/kerberosIV/lib/roken/strftime.c2
-rw-r--r--crypto/kerberosIV/lib/roken/strncasecmp.c65
-rw-r--r--crypto/kerberosIV/lib/roken/strndup.c61
-rw-r--r--crypto/kerberosIV/lib/roken/strnlen.c11
-rw-r--r--crypto/kerberosIV/lib/roken/strsep.c66
-rw-r--r--crypto/kerberosIV/lib/roken/swab.c59
-rw-r--r--crypto/kerberosIV/lib/roken/verr.c5
-rw-r--r--crypto/kerberosIV/lib/roken/verrx.c5
-rw-r--r--crypto/kerberosIV/lib/roken/vsyslog.c62
-rw-r--r--crypto/kerberosIV/lib/roken/vwarn.c4
-rw-r--r--crypto/kerberosIV/lib/roken/vwarnx.c4
-rw-r--r--crypto/kerberosIV/lib/roken/warnerr.c6
-rw-r--r--crypto/kerberosIV/lib/roken/writev.c69
-rw-r--r--crypto/kerberosIV/lib/roken/xdbm.h7
-rw-r--r--crypto/kerberosIV/lib/sl/ChangeLog112
-rw-r--r--crypto/kerberosIV/lib/sl/Makefile.am44
-rw-r--r--crypto/kerberosIV/lib/sl/Makefile.in91
-rw-r--r--crypto/kerberosIV/lib/sl/lex.l119
-rw-r--r--crypto/kerberosIV/lib/sl/make_cmds.c245
-rw-r--r--crypto/kerberosIV/lib/sl/make_cmds.h74
-rw-r--r--crypto/kerberosIV/lib/sl/parse.y199
-rw-r--r--crypto/kerberosIV/lib/sl/roken_rename.h66
-rw-r--r--crypto/kerberosIV/lib/sl/sl.c148
-rw-r--r--crypto/kerberosIV/lib/sl/sl.h10
-rw-r--r--crypto/kerberosIV/lib/sl/sl_locl.h9
-rw-r--r--crypto/kerberosIV/lib/sl/ss.c138
-rw-r--r--crypto/kerberosIV/lib/sl/ss.h60
218 files changed, 19016 insertions, 5262 deletions
diff --git a/crypto/kerberosIV/lib/Makefile.in b/crypto/kerberosIV/lib/Makefile.in
index b2e662c..44a8918 100644
--- a/crypto/kerberosIV/lib/Makefile.in
+++ b/crypto/kerberosIV/lib/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.21 1997/05/20 18:58:40 bg Exp $
+# $Id: Makefile.in,v 1.27 1998/04/05 10:27:59 assar Exp $
#
srcdir = @srcdir@
@@ -9,7 +9,7 @@ SHELL = /bin/sh
@SET_MAKE@
-SUBDIRS = des krb kdb kadm acl kafs roken otp auth sl editline
+SUBDIRS = roken com_err des krb kdb kadm acl kafs auth editline sl @LIB_SUBDIRS@
all:
for i in $(SUBDIRS); \
@@ -44,3 +44,5 @@ distclean:
realclean:
for i in $(SUBDIRS); \
do (cd $$i && $(MAKE) $(MFLAGS) realclean); done
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/acl/Makefile.in b/crypto/kerberosIV/lib/acl/Makefile.in
index 59894e4..2a78190 100644
--- a/crypto/kerberosIV/lib/acl/Makefile.in
+++ b/crypto/kerberosIV/lib/acl/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.21 1997/05/06 03:46:37 assar Exp $
+# $Id: Makefile.in,v 1.29 1999/03/10 19:01:14 joda Exp $
#
SHELL = /bin/sh
@@ -8,10 +8,13 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
AR = ar
+LN_S = @LN_S@
RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+DEFS = @DEFS@ -DROKEN_RENAME
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -41,14 +44,14 @@ Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I../../include -I$(srcdir) -I. $(CFLAGS) $(PICFLAGS) $(CPPFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
uninstall:
- rm -f $(libdir)/$(LIB)
+ rm -f $(DESTDIR)$(libdir)/$(LIB)
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -61,17 +64,11 @@ clean:
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c *~
+ rm -f Makefile *.tab.c *~ roken_rename.h
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
$(LIBNAME).a: $(OBJECTS)
rm -f $@
$(AR) cr $@ $(OBJECTS)
@@ -81,4 +78,9 @@ $(LIBNAME).$(SHLIBEXT): $(OBJECTS)
rm -f $@
$(LDSHARED) -o $@ $(OBJECTS)
-$(OBJECTS): ../../include/config.h
+$(OBJECTS): ../../include/config.h roken_rename.h
+
+roken_rename.h:
+ $(LN_S) $(srcdir)/../krb/roken_rename.h .
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/acl/acl.h b/crypto/kerberosIV/lib/acl/acl.h
index 305b66c..0a6fa56 100644
--- a/crypto/kerberosIV/lib/acl/acl.h
+++ b/crypto/kerberosIV/lib/acl/acl.h
@@ -36,13 +36,11 @@
* SUCH DAMAGE.
*/
-/* $Id: acl.h,v 1.5 1997/04/01 08:17:52 joda Exp $ */
+/* $Id: acl.h,v 1.6 1997/12/05 03:31:47 joda Exp $ */
#ifndef __ACL_H
#define __ACL_H
-#include <sys/cdefs.h>
-
void acl_canonicalize_principal __P((char *principal, char *canon));
int acl_initialize __P((char *acl_file, int perm));
int acl_exact_match __P((char *acl, char *principal));
diff --git a/crypto/kerberosIV/lib/acl/acl_files.c b/crypto/kerberosIV/lib/acl/acl_files.c
index fc00b80..12098b7 100644
--- a/crypto/kerberosIV/lib/acl/acl_files.c
+++ b/crypto/kerberosIV/lib/acl/acl_files.c
@@ -22,7 +22,7 @@ or implied warranty.
#include "config.h"
#include "protos.h"
-RCSID("$Id: acl_files.c,v 1.10 1997/05/02 14:28:56 assar Exp $");
+RCSID("$Id: acl_files.c,v 1.13 1999/03/13 21:21:32 assar Exp $");
#include <stdio.h>
#include <stdlib.h>
@@ -71,67 +71,28 @@ RCSID("$Id: acl_files.c,v 1.10 1997/05/02 14:28:56 assar Exp $");
#define COR(a,b) ((a!=NULL)?(a):(b))
-/* Canonicalize a principal name */
-/* If instance is missing, it becomes "" */
-/* If realm is missing, it becomes the local realm */
-/* Canonicalized form is put in canon, which must be big enough to hold
- MAX_PRINCIPAL_SIZE characters */
+/*
+ * Canonicalize a principal name.
+ * If instance is missing, it becomes ""
+ * If realm is missing, it becomes the local realm
+ * Canonicalized form is put in canon, which must be big enough to
+ * hold MAX_PRINCIPAL_SIZE characters
+ *
+ */
+
void
acl_canonicalize_principal(char *principal, char *canon)
{
- char *dot, *atsign, *end;
- int len;
-
- dot = strchr(principal, INST_SEP);
- atsign = strchr(principal, REALM_SEP);
-
- /* Maybe we're done already */
- if(dot != NULL && atsign != NULL) {
- if(dot < atsign) {
- /* It's for real */
- /* Copy into canon */
- strncpy(canon, principal, MAX_PRINCIPAL_SIZE);
- canon[MAX_PRINCIPAL_SIZE-1] = '\0';
- return;
- } else {
- /* Nope, it's part of the realm */
- dot = NULL;
- }
- }
-
- /* No such luck */
- end = principal + strlen(principal);
-
- /* Get the principal name */
- len = min(ANAME_SZ, COR(dot, COR(atsign, end)) - principal);
- strncpy(canon, principal, len);
- canon += len;
-
- /* Add INST_SEP */
- *canon++ = INST_SEP;
-
- /* Get the instance, if it exists */
- if(dot != NULL) {
- ++dot;
- len = min(INST_SZ, COR(atsign, end) - dot);
- strncpy(canon, dot, len);
- canon += len;
- }
-
- /* Add REALM_SEP */
- *canon++ = REALM_SEP;
-
- /* Get the realm, if it exists */
- /* Otherwise, default to local realm */
- if(atsign != NULL) {
- ++atsign;
- len = min(REALM_SZ, end - atsign);
- strncpy(canon, atsign, len);
- canon += len;
- *canon++ = '\0';
- } else if(krb_get_lrealm(canon, 1) != KSUCCESS) {
- strcpy(canon, KRB_REALM);
+ krb_principal princ;
+ int ret;
+ ret = krb_parse_name(principal, &princ);
+ if(ret) { /* ? */
+ *canon = '\0';
+ return;
}
+ if(princ.realm[0] == '\0')
+ krb_get_lrealm(princ.realm, 1);
+ krb_unparse_name_r(&princ, canon);
}
/* Get a lock to modify acl_file */
@@ -256,12 +217,13 @@ acl_initialize(char *acl_file, int perm)
/* Eliminate all whitespace character in buf */
/* Modifies its argument */
static void
- nuke_whitespace(char *buf)
+nuke_whitespace(char *buf)
{
- char *pin, *pout;
+ unsigned char *pin, *pout;
- for(pin = pout = buf; *pin != '\0'; pin++)
- if(!isspace(*pin)) *pout++ = *pin;
+ for(pin = pout = (unsigned char *)buf; *pin != '\0'; pin++)
+ if(!isspace(*pin))
+ *pout++ = *pin;
*pout = '\0'; /* Terminate the string */
}
@@ -281,9 +243,15 @@ make_hash(int size)
if(size < 1) size = 1;
h = (struct hashtbl *) malloc(sizeof(struct hashtbl));
+ if (h == NULL)
+ return NULL;
h->size = size;
h->entries = 0;
h->tbl = (char **) calloc(size, sizeof(char *));
+ if (h->tbl == NULL) {
+ free (h);
+ return NULL;
+ }
return(h);
}
@@ -339,8 +307,10 @@ add_hash(struct hashtbl *h, char *el)
hv = hashval(el) % h->size;
while(h->tbl[hv] != NULL && strcmp(h->tbl[hv], el)) hv = (hv+1) % h->size;
s = strdup(el);
- h->tbl[hv] = s;
- h->entries++;
+ if (s != NULL) {
+ h->tbl[hv] = s;
+ h->entries++;
+ }
}
/* Returns nonzero if el is in h */
@@ -403,7 +373,7 @@ acl_load(char *name)
}
/* Set up the acl */
- strcpy(acl_cache[i].filename, name);
+ strcpy_truncate(acl_cache[i].filename, name, LINESIZE);
if((acl_cache[i].fd = open(name, O_RDONLY, 0)) < 0) return(-1);
/* Force reload */
acl_cache[i].acl = (struct hashtbl *) 0;
diff --git a/crypto/kerberosIV/lib/auth/ChangeLog b/crypto/kerberosIV/lib/auth/ChangeLog
new file mode 100644
index 0000000..ce2eccc
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/ChangeLog
@@ -0,0 +1,34 @@
+Thu Apr 8 14:35:34 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * sia/sia.c: remove definition of KRB_VERIFY_USER (moved to
+ config.h)
+
+ * sia/Makefile.am: make it build w/o krb4
+
+ * afskauthlib/verify.c: add krb5 support
+
+ * afskauthlib/Makefile.am: build afskauthlib.so
+
+Wed Apr 7 14:06:22 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * sia/sia.c: make it compile w/o krb4
+
+ * sia/Makefile.am: make it compile w/o krb4
+
+Thu Apr 1 18:09:23 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * sia/sia_locl.h: POSIX_GETPWNAM_R is defined in config.h
+
+Sun Mar 21 14:08:30 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * sia/Makefile.in: add posix_getpw.c
+
+ * sia/Makefile.am: makefile for sia
+
+ * sia/posix_getpw.c: move from sia.c
+
+ * sia/sia_locl.h: merge with krb5 version
+
+ * sia/sia.c: merge with krb5 version
+
+ * sia/sia5.c: remove unused variables
diff --git a/crypto/kerberosIV/lib/auth/Makefile.am b/crypto/kerberosIV/lib/auth/Makefile.am
new file mode 100644
index 0000000..0310dc3
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/Makefile.am
@@ -0,0 +1,6 @@
+# $Id: Makefile.am,v 1.2 1999/03/21 17:11:08 joda Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+SUBDIRS = @LIB_AUTH_SUBDIRS@
+DIST_SUBDIRS = afskauthlib pam sia
diff --git a/crypto/kerberosIV/lib/auth/Makefile.in b/crypto/kerberosIV/lib/auth/Makefile.in
new file mode 100644
index 0000000..53fde5f
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/Makefile.in
@@ -0,0 +1,55 @@
+#
+# $Id: Makefile.in,v 1.12 1998/03/15 05:58:10 assar Exp $
+#
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+SHELL = /bin/sh
+
+@SET_MAKE@
+
+SUBDIRS = @LIB_AUTH_SUBDIRS@
+
+all:
+ SUBDIRS='$(SUBDIRS)'; \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) all); done
+
+Wall:
+ make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
+
+install:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) install); done
+
+uninstall:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) uninstall); done
+
+check:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) check); done
+
+clean:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) clean); done
+
+mostlyclean: clean
+
+distclean:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) distclean); done
+ rm -f Makefile *~
+
+realclean:
+ SUBDIRS=$(SUBDIRS); \
+ for i in $$SUBDIRS; \
+ do (cd $$i && $(MAKE) $(MFLAGS) realclean); done
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.am b/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.am
new file mode 100644
index 0000000..7dd6d52
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.am
@@ -0,0 +1,38 @@
+# $Id: Makefile.am,v 1.3 1999/04/08 12:35:33 joda Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+INCLUDES += $(INCLUDE_krb4)
+
+DEFS = @DEFS@
+
+foodir = $(libdir)
+foo_DATA = afskauthlib.so
+
+SUFFIXES += .c .o
+
+SRCS = verify.c
+OBJS = verify.o
+
+CLEANFILES = $(foo_DATA) $(OBJS) so_locations
+
+afskauthlib.so: $(OBJS)
+ $(LD) -shared -o $@ $(LDFLAGS) $(OBJS) $(L)
+
+.c.o:
+ $(COMPILE) -c $<
+
+if KRB4
+KAFS = $(top_builddir)/lib/kafs/.libs/libkafs.a
+endif
+
+L = \
+ $(KAFS) \
+ $(top_builddir)/lib/krb5/.libs/libkrb5.a \
+ $(top_builddir)/lib/asn1/.libs/libasn1.a \
+ $(LIB_krb4) \
+ $(top_builddir)/lib/des/.libs/libdes.a \
+ $(top_builddir)/lib/roken/.libs/libroken.a \
+ -lc
+
+$(OBJS): $(top_builddir)/include/config.h
diff --git a/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.in b/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.in
new file mode 100644
index 0000000..dc09a13
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/afskauthlib/Makefile.in
@@ -0,0 +1,86 @@
+#
+# $Id: Makefile.in,v 1.24 1999/03/10 19:01:14 joda Exp $
+#
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+LINK = @LINK@
+AR = ar
+LN_S = @LN_S@
+RANLIB = @RANLIB@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+
+@lib_deps_yes@LIB_DEPS = -L../../kafs -lkafs \
+@lib_deps_yes@ -L../../krb -lkrb \
+@lib_deps_yes@ -L../../des -ldes \
+@lib_deps_yes@ -L../../roken -lroken \
+@lib_deps_yes@ -lc
+@lib_deps_no@LIB_DEPS =
+
+PICFLAGS = @REAL_PICFLAGS@
+LDSHARED = @LDSHARED@
+SHLIBEXT = @REAL_SHLIBEXT@
+LD_FLAGS = @REAL_LD_FLAGS@
+
+LIB = afskauthlib.$(SHLIBEXT)
+
+SOURCES = verify.c
+
+OBJECTS = verify.o
+
+all: $(LIB)
+
+Wall:
+ make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
+
+.c.o:
+ $(CC) -c $(DEFS) -I../../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
+
+install: all
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ -if test "$(LIB)" != ""; then \
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+uninstall:
+ -if test "$(LIB)" != ""; then \
+ rm -f $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+TAGS: $(SOURCES)
+ etags $(SOURCES)
+
+check:
+
+clean:
+ rm -f $(LIB) *.o
+
+mostlyclean: clean
+
+distclean: clean
+ rm -f Makefile *.tab.c *~
+
+realclean: distclean
+ rm -f TAGS
+
+$(OBJECTS): ../../../include/config.h
+
+$(LIB): $(OBJECTS)
+ rm -f $@
+ $(LDSHARED) $(CFLAGS) -o $@ $(OBJECTS) $(LD_FLAGS) $(LIB_DEPS)
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/auth/afskauthlib/README b/crypto/kerberosIV/lib/auth/afskauthlib/README
new file mode 100644
index 0000000..6052a26
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/afskauthlib/README
@@ -0,0 +1,25 @@
+
+IRIX
+----
+
+The IRIX support is a module that is compatible with Transarc's
+`afskauthlib.so'. It should work with all programs that use this
+library, this should include `login' and `xdm'.
+
+The interface is not very documented but it seems that you have to copy
+`libkafs.so', `libkrb.so', and `libdes.so' to `/usr/lib', or build your
+`afskauthlib.so' statically.
+
+The `afskauthlib.so' itself is able to reside in `/usr/vice/etc',
+`/usr/afsws/lib', or the current directory (wherever that is).
+
+IRIX 6.4 and newer seems to have all programs (including `xdm' and
+`login') in the N32 object format, whereas in older versions they were
+O32. For it to work, the `afskauthlib.so' library has to be in the same
+object format as the program that tries to load it. This might require
+that you have to configure and build for O32 in addition to the default
+N32.
+
+Appart from this it should "just work", there are no configuration
+files.
+
diff --git a/crypto/kerberosIV/lib/auth/afskauthlib/verify.c b/crypto/kerberosIV/lib/auth/afskauthlib/verify.c
new file mode 100644
index 0000000..f7db523
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/afskauthlib/verify.c
@@ -0,0 +1,213 @@
+/*
+ * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: verify.c,v 1.13 1999/04/08 12:36:16 joda Exp $");
+#endif
+#include <unistd.h>
+#include <sys/types.h>
+#include <pwd.h>
+#ifdef KRB5
+#include <krb5.h>
+#endif
+#ifdef KRB4
+#include <krb.h>
+#include <kafs.h>
+#endif
+#include <roken.h>
+
+#if 0
+static char krb5ccname[128];
+#endif
+static char krbtkfile[128];
+
+#ifdef KRB4
+static void
+set_krbtkfile(uid_t uid)
+{
+ snprintf (krbtkfile, sizeof(krbtkfile), "%s%d", TKT_ROOT, (unsigned)uid);
+ krb_set_tkt_string (krbtkfile);
+}
+#endif
+
+
+#ifdef KRB5
+static int
+verify_krb5(struct passwd *pwd,
+ char *password,
+ int32_t *exp,
+ int quiet)
+{
+ krb5_context context;
+ krb5_error_code ret;
+ char ticket[128];
+ krb5_ccache ccache;
+ krb5_principal principal;
+ krb5_realm realm;
+
+ krb5_init_context(&context);
+
+ krb5_get_default_realm(context, &realm);
+ krb5_make_principal(context, &principal, realm, pwd->pw_name, NULL);
+
+ if(!krb5_kuserok(context, principal, pwd->pw_name)) {
+ syslog(LOG_AUTH|LOG_DEBUG, "krb5_kuserok failed");
+ goto out;
+ }
+ /* XXX this has to be the default cache name, since the KRB5CCNAME
+ environment variable isn't exported by login/xdm
+ */
+ snprintf(ticket, sizeof(ticket), "FILE:/tmp/krb5cc_%d", pwd->pw_uid);
+ ret = krb5_cc_resolve(context, ticket, &ccache);
+ if(ret) {
+ syslog(LOG_AUTH|LOG_DEBUG, "krb5_cc_resolve: %s",
+ krb5_get_err_text(context, ret));
+ goto out;
+ }
+
+ ret = krb5_verify_user(context,
+ principal,
+ ccache,
+ password,
+ TRUE,
+ NULL);
+ if(ret) {
+ syslog(LOG_AUTH|LOG_DEBUG, "krb5_verify_user: %s",
+ krb5_get_err_text(context, ret));
+ goto out;
+ }
+ if(chown(krb5_cc_get_name(context, ccache), pwd->pw_uid, pwd->pw_gid)) {
+ syslog(LOG_AUTH|LOG_DEBUG, "chown: %s",
+ krb5_get_err_text(context, errno));
+ goto out;
+ }
+
+#ifdef KRB4
+ {
+ CREDENTIALS c;
+ krb5_creds mcred, cred;
+
+ krb5_make_principal(context, &mcred.server, realm,
+ "krbtgt",
+ realm,
+ NULL);
+ ret = krb5_cc_retrieve_cred(context, ccache, 0, &mcred, &cred);
+ if(ret == 0) {
+ ret = krb524_convert_creds_kdc(context, &cred, &c);
+ if(ret)
+ krb5_warn(context, ret, "converting creds");
+ else {
+ set_krbtkfile(pwd->pw_uid);
+ tf_setup(&c, c.pname, c.pinst);
+ }
+ memset(&c, 0, sizeof(c));
+ krb5_free_creds_contents(context, &cred);
+ } else
+ syslog(LOG_AUTH|LOG_DEBUG, "krb5_cc_retrieve_cred: %s",
+ krb5_get_err_text(context, ret));
+
+ krb5_free_principal(context, mcred.server);
+ }
+ if (k_hasafs()) {
+ k_setpag();
+ krb5_afslog_uid_home(context, ccache, NULL, NULL,
+ pwd->pw_uid, pwd->pw_dir);
+ }
+#endif
+
+out:
+ if(ret && !quiet)
+ printf ("%s\n", krb5_get_err_text (context, ret));
+ return ret;
+}
+#endif
+
+#ifdef KRB4
+static int
+verify_krb4(struct passwd *pwd,
+ char *password,
+ int32_t *exp,
+ int quiet)
+{
+ int ret = 1;
+ char lrealm[REALM_SZ];
+
+ if (krb_get_lrealm (lrealm, 1) != KFAILURE) {
+ set_krbtkfile(pwd->pw_uid);
+ ret = krb_verify_user (pwd->pw_name, "", lrealm, password,
+ KRB_VERIFY_SECURE, NULL);
+ if (ret == KSUCCESS) {
+ if (k_hasafs()) {
+ k_setpag ();
+ krb_afslog_uid_home (0, 0, pwd->pw_uid, pwd->pw_dir);
+ }
+ } else if (!quiet)
+ printf ("%s\n", krb_get_err_text (ret));
+ }
+ return ret;
+}
+#endif
+
+int
+afs_verify(char *name,
+ char *password,
+ int32_t *exp,
+ int quiet)
+{
+ int ret = 1;
+ struct passwd *pwd = k_getpwnam (name);
+ if(pwd == NULL)
+ return 1;
+#ifdef KRB5
+ ret = verify_krb5(pwd, password, exp, quiet);
+#endif
+#ifdef KRB4
+ if(ret)
+ ret = verify_krb4(pwd, password, exp, quiet);
+#endif
+ if (ret)
+ ret = unix_verify_user (name, password);
+ return ret;
+}
+
+char *
+afs_gettktstring (void)
+{
+ return krbtkfile;
+}
diff --git a/crypto/kerberosIV/lib/auth/pam/Makefile.am b/crypto/kerberosIV/lib/auth/pam/Makefile.am
new file mode 100644
index 0000000..abde2d9
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/pam/Makefile.am
@@ -0,0 +1,3 @@
+# $Id: Makefile.am,v 1.2 1999/04/01 14:57:04 joda Exp $
+
+include $(top_srcdir)/Makefile.am.common
diff --git a/crypto/kerberosIV/lib/auth/pam/Makefile.in b/crypto/kerberosIV/lib/auth/pam/Makefile.in
new file mode 100644
index 0000000..f338fbf
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/pam/Makefile.in
@@ -0,0 +1,83 @@
+#
+# $Id: Makefile.in,v 1.20 1999/03/10 19:01:14 joda Exp $
+#
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+LINK = @LINK@
+AR = ar
+RANLIB = @RANLIB@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+
+PICFLAGS = @REAL_PICFLAGS@
+LDSHARED = @LDSHARED@
+SHLIBEXT = @REAL_SHLIBEXT@
+LD_FLAGS = @REAL_LD_FLAGS@
+
+@lib_deps_yes@LIB_DEPS = -L../../kafs -L../../krb -L../../des -L../../roken \
+@lib_deps_yes@ -lkafs -lkrb -ldes -lroken -lc
+@lib_deps_no@LIB_DEPS =
+
+LIB = pam_krb4.$(SHLIBEXT)
+
+SOURCES = pam.c
+
+OBJECTS = pam.o
+
+all: $(LIB)
+
+Wall:
+ make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
+
+.c.o:
+ $(CC) -c $(DEFS) -I../../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
+
+install: all
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ -if test "$(LIB)" != ""; then \
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+uninstall:
+ -if test "$(LIB)" != ""; then \
+ rm -f $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+TAGS: $(SOURCES)
+ etags $(SOURCES)
+
+check:
+
+clean:
+ rm -f $(LIB) *.o
+
+mostlyclean: clean
+
+distclean: clean
+ rm -f Makefile *.tab.c *~
+
+realclean: distclean
+ rm -f TAGS
+
+$(OBJECTS): ../../../include/config.h
+
+$(LIB): $(OBJECTS)
+ rm -f $@
+ $(LDSHARED) -o $@ $(OBJECTS) $(LD_FLAGS) $(LIB_DEPS)
+# $(LINK) -shared -Wl,-x -o $(LIB) $(OBJECTS) ../../kafs/libkafs.a ../../krb/libkrb.a ../../des/libdes.a
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/auth/pam/README b/crypto/kerberosIV/lib/auth/pam/README
new file mode 100644
index 0000000..9505699
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/pam/README
@@ -0,0 +1,25 @@
+
+PAM
+---
+
+The PAM module was written more out of curiosity that anything else. It
+has not been updated for quite a while, since none of us are using
+Linux, and Solaris does not support PAM yet. We've had positive reports
+from at least one person using the module, though.
+
+To use this module you should:
+
+ * Make sure `pam_krb4.so' is available in `/usr/athena/lib'. You
+ might actually want it on local disk, so `/lib/security' might be a
+ better place if `/usr/athena' is not local.
+
+ * Look at `pam.conf.add' for examples of what to add to
+ `/etc/pam.conf'.
+
+There is currently no support for changing kerberos passwords. Use
+kpasswd instead.
+
+See also Derrick J Brashear's `<shadow@dementia.org>' Kerberos PAM
+module at `ftp://ftp.dementia.org/pub/pam'. It has a lot more features,
+and it is also more in line with other PAM modules.
+
diff --git a/crypto/kerberosIV/lib/auth/pam/pam.c b/crypto/kerberosIV/lib/auth/pam/pam.c
new file mode 100644
index 0000000..37a125e
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/pam/pam.c
@@ -0,0 +1,244 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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 code is extremely ugly, and would probably be better off
+ beeing completely rewritten */
+
+
+#ifdef HAVE_CONFIG_H
+#include<config.h>
+RCSID("$Id: pam.c,v 1.18 1999/03/17 22:37:10 assar Exp $");
+#endif
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <pwd.h>
+#include <unistd.h>
+#include <sys/types.h>
+
+#define PAM_SM_AUTH
+#define PAM_SM_SESSION
+#include <security/pam_appl.h>
+#include <security/pam_modules.h>
+
+#include <netinet/in.h>
+#include <krb.h>
+#include <kafs.h>
+
+static int
+cleanup(pam_handle_t *pamh, void *data, int error_code)
+{
+ if(error_code != PAM_SUCCESS)
+ dest_tkt();
+ free(data);
+ return PAM_SUCCESS;
+}
+
+static int
+doit(pam_handle_t *pamh, char *name, char *inst, char *pwd, char *tkt)
+{
+ char realm[REALM_SZ];
+ int ret;
+
+ pam_set_data(pamh, "KRBTKFILE", strdup(tkt), cleanup);
+ krb_set_tkt_string(tkt);
+
+ krb_get_lrealm(realm, 1);
+ ret = krb_verify_user(name, inst, realm, pwd, KRB_VERIFY_SECURE, NULL);
+ memset(pwd, 0, strlen(pwd));
+ switch(ret){
+ case KSUCCESS:
+ return PAM_SUCCESS;
+ case KDC_PR_UNKNOWN:
+ return PAM_USER_UNKNOWN;
+ case SKDC_CANT:
+ case SKDC_RETRY:
+ case RD_AP_TIME:
+ return PAM_AUTHINFO_UNAVAIL;
+ default:
+ return PAM_AUTH_ERR;
+ }
+}
+
+static int
+auth_login(pam_handle_t *pamh, int flags, char *user, struct pam_conv *conv)
+{
+ int ret;
+ struct pam_message msg, *pmsg;
+ struct pam_response *resp;
+ char prompt[128];
+
+ pmsg = &msg;
+ msg.msg_style = PAM_PROMPT_ECHO_OFF;
+ snprintf(prompt, sizeof(prompt), "%s's Password: ", user);
+ msg.msg = prompt;
+
+ ret = conv->conv(1, (const struct pam_message**)&pmsg,
+ &resp, conv->appdata_ptr);
+ if(ret != PAM_SUCCESS)
+ return ret;
+
+ {
+ char tkt[1024];
+ struct passwd *pw = getpwnam(user);
+
+ if(pw){
+ snprintf(tkt, sizeof(tkt),
+ "%s%u", TKT_ROOT, (unsigned)pw->pw_uid);
+ ret = doit(pamh, user, "", resp->resp, tkt);
+ if(ret == PAM_SUCCESS)
+ chown(tkt, pw->pw_uid, pw->pw_gid);
+ }else
+ ret = PAM_USER_UNKNOWN;
+ memset(resp->resp, 0, strlen(resp->resp));
+ free(resp->resp);
+ free(resp);
+ }
+ return ret;
+}
+
+static int
+auth_su(pam_handle_t *pamh, int flags, char *user, struct pam_conv *conv)
+{
+ int ret;
+ struct passwd *pw;
+ struct pam_message msg, *pmsg;
+ struct pam_response *resp;
+ char prompt[128];
+ krb_principal pr;
+
+ pr.realm[0] = 0;
+ ret = pam_get_user(pamh, &user, "login: ");
+ if(ret != PAM_SUCCESS)
+ return ret;
+
+ pw = getpwuid(getuid());
+ if(strcmp(user, "root") == 0){
+ strcpy_truncate(pr.name, pw->pw_name, sizeof(pr.name));
+ strcpy_truncate(pr.instance, "root", sizeof(pr.instance));
+ }else{
+ strcpy_truncate(pr.name, user, sizeof(pr.name));
+ pr.instance[0] = 0;
+ }
+ pmsg = &msg;
+ msg.msg_style = PAM_PROMPT_ECHO_OFF;
+ snprintf(prompt, sizeof(prompt), "%s's Password: ", krb_unparse_name(&pr));
+ msg.msg = prompt;
+
+ ret = conv->conv(1, (const struct pam_message**)&pmsg,
+ &resp, conv->appdata_ptr);
+ if(ret != PAM_SUCCESS)
+ return ret;
+
+ {
+ char tkt[1024];
+
+ snprintf(tkt, sizeof(tkt),"%s_%s_to_%s",
+ TKT_ROOT, pw->pw_name, user);
+ ret = doit(pamh, pr.name, pr.instance, resp->resp, tkt);
+ if(ret == PAM_SUCCESS)
+ chown(tkt, pw->pw_uid, pw->pw_gid);
+ memset(resp->resp, 0, strlen(resp->resp));
+ free(resp->resp);
+ free(resp);
+ }
+ return ret;
+}
+
+int
+pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv)
+{
+ char *user;
+ int ret;
+ struct pam_conv *conv;
+ ret = pam_get_user(pamh, &user, "login: ");
+ if(ret != PAM_SUCCESS)
+ return ret;
+
+ ret = pam_get_item(pamh, PAM_CONV, (void*)&conv);
+ if(ret != PAM_SUCCESS)
+ return ret;
+
+
+ if(getuid() != geteuid())
+ return auth_su(pamh, flags, user, conv);
+ else
+ return auth_login(pamh, flags, user, conv);
+}
+
+int
+pam_sm_setcred(pam_handle_t *pamh, int flags, int argc, const char **argv)
+{
+ return PAM_SUCCESS;
+}
+
+
+int
+pam_sm_open_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
+{
+ char *tkt;
+ void *user;
+ const char *homedir = NULL;
+
+ if(pam_get_item (pamh, PAM_USER, &user) == PAM_SUCCESS) {
+ struct passwd *pwd;
+
+ pwd = getpwnam ((char *)user);
+ if (pwd != NULL)
+ homedir = pwd->pw_dir;
+ }
+
+ pam_get_data(pamh, "KRBTKFILE", (const void**)&tkt);
+ setenv("KRBTKFILE", tkt, 1);
+ if(k_hasafs()){
+ k_setpag();
+ krb_afslog_home(0, 0, homedir);
+ }
+ return PAM_SUCCESS;
+}
+
+
+int
+pam_sm_close_session(pam_handle_t *pamh, int flags, int argc, const char **argv)
+{
+ dest_tkt();
+ if(k_hasafs())
+ k_unlog();
+ return PAM_SUCCESS;
+}
diff --git a/crypto/kerberosIV/lib/auth/pam/pam.conf.add b/crypto/kerberosIV/lib/auth/pam/pam.conf.add
new file mode 100644
index 0000000..1bfb30e
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/pam/pam.conf.add
@@ -0,0 +1,13 @@
+# To get this to work, you will have to add entries to /etc/pam.conf
+#
+# To make login kerberos-aware, you might change pam.conf to look
+# like:
+
+# login authorization
+login auth sufficient /lib/security/pam_krb4.so
+login auth required /lib/security/pam_securetty.so
+login auth required /lib/security/pam_unix_auth.so
+login account required /lib/security/pam_unix_acct.so
+login password required /lib/security/pam_unix_passwd.so
+login session required /lib/security/pam_krb4.so
+login session required /lib/security/pam_unix_session.so
diff --git a/crypto/kerberosIV/lib/auth/sia/Makefile.am b/crypto/kerberosIV/lib/auth/sia/Makefile.am
new file mode 100644
index 0000000..5a58cb7
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/Makefile.am
@@ -0,0 +1,48 @@
+# $Id: Makefile.am,v 1.4 1999/04/08 12:36:40 joda Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+INCLUDES += $(INCLUDE_krb4)
+
+WFLAGS += $(WFLAGS_NOIMPLICITINT)
+
+DEFS = @DEFS@
+
+## this is horribly ugly, but automake/libtool doesn't allow us to
+## unconditionally build shared libraries, and it does not allow us to
+## link with non-installed libraries
+
+if KRB4
+KAFS=$(top_builddir)/lib/kafs/.libs/libkafs.a
+endif
+
+L = \
+ $(KAFS) \
+ $(top_builddir)/lib/krb5/.libs/libkrb5.a \
+ $(top_builddir)/lib/asn1/.libs/libasn1.a \
+ $(LIB_krb4) \
+ $(top_builddir)/lib/des/.libs/libdes.a \
+ $(top_builddir)/lib/com_err/.libs/libcom_err.a \
+ $(top_builddir)/lib/roken/.libs/libroken.a \
+ $(LIB_getpwnam_r) \
+ -lc
+
+EXTRA_DIST = sia.c krb5_matrix.conf krb5+c2_matrix.conf security.patch
+
+foodir = $(libdir)
+foo_DATA = libsia_krb5.so
+
+LDFLAGS = -rpath $(libdir) -hidden -exported_symbol siad_\*
+
+OBJS = sia.o posix_getpw.o
+
+libsia_krb5.so: $(OBJS)
+ ld -shared -o $@ $(LDFLAGS) $(OBJS) $(L)
+ ostrip -x -z $@
+
+CLEANFILES = libsia_krb5.so $(OBJS) so_locations
+
+SUFFIXES += .c .o
+
+.c.o:
+ $(COMPILE) -c $<
diff --git a/crypto/kerberosIV/lib/auth/sia/Makefile.in b/crypto/kerberosIV/lib/auth/sia/Makefile.in
new file mode 100644
index 0000000..7abc8f0
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/Makefile.in
@@ -0,0 +1,89 @@
+#
+# $Id: Makefile.in,v 1.29 1999/03/21 17:11:58 joda Exp $
+#
+
+SHELL = /bin/sh
+
+srcdir = @srcdir@
+VPATH = @srcdir@
+
+CC = @CC@
+LINK = @LINK@
+AR = ar
+RANLIB = @RANLIB@
+DEFS = @DEFS@
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
+
+INSTALL = @INSTALL@
+INSTALL_DATA = @INSTALL_DATA@
+MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+
+prefix = @prefix@
+exec_prefix = @exec_prefix@
+libdir = @libdir@
+
+PICFLAGS = @REAL_PICFLAGS@
+SHARED = @SHARED@
+LDSHARED = @LDSHARED@
+SHLIBEXT = @REAL_SHLIBEXT@
+LD_FLAGS = @REAL_LD_FLAGS@
+
+@lib_deps_yes@LIB_DEPS = -L../../kafs -lkafs \
+@lib_deps_yes@ -L../../kadm -lkadm \
+@lib_deps_yes@ -L../../krb -lkrb \
+@lib_deps_yes@ -L../../des -ldes \
+@lib_deps_yes@ -L../../com_err -lcom_err \
+@lib_deps_yes@ -L../../roken -lroken \
+@lib_deps_yes@ @LIB_getpwnam_r@ \
+@lib_deps_yes@ -lc
+@lib_deps_no@LIB_DEPS =
+
+LIB = libsia_krb4.$(SHLIBEXT)
+
+SOURCES = sia.c posix_getpw.c
+
+OBJECTS = sia.o posix_getpw.o
+
+all: $(LIB)
+
+Wall:
+ make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
+
+.c.o:
+ $(CC) -c $(DEFS) -I../../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
+
+install: all
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ -if test "$(LIB)" != ""; then \
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+uninstall:
+ -if test "$(LIB)" != ""; then \
+ rm -f $(DESTDIR)$(libdir)/$(LIB) ; \
+ fi
+
+TAGS: $(SOURCES)
+ etags $(SOURCES)
+
+check:
+
+clean:
+ rm -f $(LIB) *.o
+
+mostlyclean: clean
+
+distclean: clean
+ rm -f Makefile *.tab.c *~
+
+realclean: distclean
+ rm -f TAGS
+
+$(OBJECTS): ../../../include/config.h
+
+$(LIB): $(OBJECTS)
+ rm -f $@
+ $(LDSHARED) -shared -o $@ -rpath $(libdir) -hidden -exported_symbol siad_\* $(OBJECTS) $(LIB_DEPS)
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/auth/sia/README b/crypto/kerberosIV/lib/auth/sia/README
new file mode 100644
index 0000000..aa7383e
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/README
@@ -0,0 +1,87 @@
+
+Digital SIA
+-----------
+
+To install the SIA module you will have to do the following:
+
+ * Make sure `libsia_krb4.so' is available in `/usr/athena/lib'. If
+ `/usr/athena' is not on local disk, you might want to put it in
+ `/usr/shlib' or someplace else. If you do, you'll have to edit
+ `krb4_matrix.conf' to reflect the new location (you will also have
+ to do this if you installed in some other directory than
+ `/usr/athena'). If you built with shared libraries, you will have
+ to copy the shared `libkrb.so', `libdes.so', `libkadm.so', and
+ `libkafs.so' to a place where the loader can find them (such as
+ `/usr/shlib').
+
+ * Copy (your possibly edited) `krb4_matrix.conf' to `/etc/sia'.
+
+ * Apply `security.patch' to `/sbin/init.d/security'.
+
+ * Turn on KRB4 security by issuing `rcmgr set SECURITY KRB4' and
+ `rcmgr set KRB4_MATRIX_CONF krb4_matrix.conf'.
+
+ * Digital thinks you should reboot your machine, but that really
+ shouldn't be necessary. It's usually sufficient just to run
+ `/sbin/init.d/security start' (and restart any applications that
+ use SIA, like `xdm'.)
+
+Users with local passwords (like `root') should be able to login safely.
+
+When using Digital's xdm the `KRBTKFILE' environment variable isn't
+passed along as it should (since xdm zaps the environment). Instead you
+have to set `KRBTKFILE' to the correct value in
+`/usr/lib/X11/xdm/Xsession'. Add a line similar to
+ KRBTKFILE=/tmp/tkt`id -u`_`ps -o ppid= -p $$`; export KRBTKFILE
+If you use CDE, `dtlogin' allows you to specify which additional
+environment variables it should export. To add `KRBTKFILE' to this
+list, edit `/usr/dt/config/Xconfig', and look for the definition of
+`exportList'. You want to add something like:
+ Dtlogin.exportList: KRBTKFILE
+
+Notes to users with Enhanced security
+.....................................
+
+Digital's `ENHANCED' (C2) security, and Kerberos solves two different
+problems. C2 deals with local security, adds better control of who can
+do what, auditing, and similar things. Kerberos deals with network
+security.
+
+To make C2 security work with Kerberos you will have to do the
+following.
+
+ * Replace all occurencies of `krb4_matrix.conf' with
+ `krb4+c2_matrix.conf' in the directions above.
+
+ * You must enable "vouching" in the `default' database. This will
+ make the OSFC2 module trust other SIA modules, so you can login
+ without giving your C2 password. To do this use `edauth' to edit
+ the default entry `/usr/tcb/bin/edauth -dd default', and add a
+ `d_accept_alternate_vouching' capability, if not already present.
+
+ * For each user that does *not* have a local C2 password, you should
+ set the password expiration field to zero. You can do this for each
+ user, or in the `default' table. To do this use `edauth' to set
+ (or change) the `u_exp' capability to `u_exp#0'.
+
+ * You also need to be aware that the shipped `login', `rcp', and
+ `rshd', doesn't do any particular C2 magic (such as checking to
+ various forms of disabled accounts), so if you rely on those
+ features, you shouldn't use those programs. If you configure with
+ `--enable-osfc2', these programs will, however, set the login UID.
+ Still: use at your own risk.
+
+At present `su' does not accept the vouching flag, so it will not work
+as expected.
+
+Also, kerberised ftp will not work with C2 passwords. You can solve this
+by using both Digital's ftpd and our on different ports.
+
+*Remember*, if you do these changes you will get a system that most
+certainly does *not* fulfill the requirements of a C2 system. If C2 is
+what you want, for instance if someone else is forcing you to use it,
+you're out of luck. If you use enhanced security because you want a
+system that is more secure than it would otherwise be, you probably got
+an even more secure system. Passwords will not be sent in the clear,
+for instance.
+
diff --git a/crypto/kerberosIV/lib/auth/sia/krb4+c2_matrix.conf b/crypto/kerberosIV/lib/auth/sia/krb4+c2_matrix.conf
new file mode 100644
index 0000000..b664d3d
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/krb4+c2_matrix.conf
@@ -0,0 +1,63 @@
+# Copyright (c) 1998 Kungliga Tekniska Högskolan
+# (Royal Institute of Technology, Stockholm, Sweden).
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by 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: krb4+c2_matrix.conf,v 1.3 1998/06/30 15:14:31 assar Exp $
+
+# sia matrix configuration file (Kerberos 4 + C2)
+
+siad_init=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_chk_invoker=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_init=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_authent=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_estab=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_launch=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_suauthent=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_reauthent=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_finger=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_password=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_shell=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_getpwent=(BSD,libc.so)
+siad_getpwuid=(BSD,libc.so)
+siad_getpwnam=(BSD,libc.so)
+siad_setpwent=(BSD,libc.so)
+siad_endpwent=(BSD,libc.so)
+siad_getgrent=(BSD,libc.so)
+siad_getgrgid=(BSD,libc.so)
+siad_getgrnam=(BSD,libc.so)
+siad_setgrent=(BSD,libc.so)
+siad_endgrent=(BSD,libc.so)
+siad_ses_release=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chk_user=(KRB4,/usr/athena/lib/libsia_krb4.so)(OSFC2,/usr/shlib/libsecurity.so)
diff --git a/crypto/kerberosIV/lib/auth/sia/krb4_matrix.conf b/crypto/kerberosIV/lib/auth/sia/krb4_matrix.conf
new file mode 100644
index 0000000..9f78850
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/krb4_matrix.conf
@@ -0,0 +1,64 @@
+# Copyright (c) 1998 Kungliga Tekniska Högskolan
+# (Royal Institute of Technology, Stockholm, Sweden).
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions
+# are met:
+#
+# 1. Redistributions of source code must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# 2. Redistributions in binary form must reproduce the above copyright
+# notice, this list of conditions and the following disclaimer in the
+# documentation and/or other materials provided with the distribution.
+#
+# 3. All advertising materials mentioning features or use of this software
+# must display the following acknowledgement:
+# This product includes software developed by 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: krb4_matrix.conf,v 1.5 1998/01/29 02:54:11 joda Exp $
+
+# sia matrix configuration file (Kerberos 4 + BSD)
+
+siad_init=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_chk_invoker=(BSD,libc.so)
+siad_ses_init=(KRB4,/usr/athena/lib/libsia_krb4.so)
+siad_ses_authent=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_ses_estab=(BSD,libc.so)
+siad_ses_launch=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_ses_suauthent=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_ses_reauthent=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_chg_finger=(BSD,libc.so)
+siad_chg_password=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_chg_shell=(BSD,libc.so)
+siad_getpwent=(BSD,libc.so)
+siad_getpwuid=(BSD,libc.so)
+siad_getpwnam=(BSD,libc.so)
+siad_setpwent=(BSD,libc.so)
+siad_endpwent=(BSD,libc.so)
+siad_getgrent=(BSD,libc.so)
+siad_getgrgid=(BSD,libc.so)
+siad_getgrnam=(BSD,libc.so)
+siad_setgrent=(BSD,libc.so)
+siad_endgrent=(BSD,libc.so)
+siad_ses_release=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+siad_chk_user=(KRB4,/usr/athena/lib/libsia_krb4.so)(BSD,libc.so)
+
diff --git a/crypto/kerberosIV/lib/auth/sia/krb5+c2_matrix.conf b/crypto/kerberosIV/lib/auth/sia/krb5+c2_matrix.conf
new file mode 100644
index 0000000..c2952e2
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/krb5+c2_matrix.conf
@@ -0,0 +1,27 @@
+# $Id: krb5+c2_matrix.conf,v 1.2 1998/11/26 20:58:18 assar Exp $
+
+# sia matrix configuration file (Kerberos 5 + C2)
+
+siad_init=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_chk_invoker=(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_init=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_authent=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_estab=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_launch=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_suauthent=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_ses_reauthent=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_finger=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_password=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chg_shell=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_getpwent=(BSD,libc.so)
+siad_getpwuid=(BSD,libc.so)
+siad_getpwnam=(BSD,libc.so)
+siad_setpwent=(BSD,libc.so)
+siad_endpwent=(BSD,libc.so)
+siad_getgrent=(BSD,libc.so)
+siad_getgrgid=(BSD,libc.so)
+siad_getgrnam=(BSD,libc.so)
+siad_setgrent=(BSD,libc.so)
+siad_endgrent=(BSD,libc.so)
+siad_ses_release=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
+siad_chk_user=(KRB5,/usr/athena/lib/libsia_krb5.so)(OSFC2,/usr/shlib/libsecurity.so)
diff --git a/crypto/kerberosIV/lib/auth/sia/krb5_matrix.conf b/crypto/kerberosIV/lib/auth/sia/krb5_matrix.conf
new file mode 100644
index 0000000..e49366a
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/krb5_matrix.conf
@@ -0,0 +1,27 @@
+# $Id: krb5_matrix.conf,v 1.1 1997/05/15 18:34:18 joda Exp $
+
+# sia matrix configuration file (Kerberos 5 + BSD)
+
+siad_init=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_chk_invoker=(BSD,libc.so)
+siad_ses_init=(KRB5,/usr/athena/lib/libsia_krb5.so)
+siad_ses_authent=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_ses_estab=(BSD,libc.so)
+siad_ses_launch=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_ses_suauthent=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_ses_reauthent=(BSD,libc.so)
+siad_chg_finger=(BSD,libc.so)
+siad_chg_password=(BSD,libc.so)
+siad_chg_shell=(BSD,libc.so)
+siad_getpwent=(BSD,libc.so)
+siad_getpwuid=(BSD,libc.so)
+siad_getpwnam=(BSD,libc.so)
+siad_setpwent=(BSD,libc.so)
+siad_endpwent=(BSD,libc.so)
+siad_getgrent=(BSD,libc.so)
+siad_getgrgid=(BSD,libc.so)
+siad_getgrnam=(BSD,libc.so)
+siad_setgrent=(BSD,libc.so)
+siad_endgrent=(BSD,libc.so)
+siad_ses_release=(KRB5,/usr/athena/lib/libsia_krb5.so)(BSD,libc.so)
+siad_chk_user=(BSD,libc.so)
diff --git a/crypto/kerberosIV/lib/auth/sia/posix_getpw.c b/crypto/kerberosIV/lib/auth/sia/posix_getpw.c
new file mode 100644
index 0000000..c5961dc
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/posix_getpw.c
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of KTH nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+#include "sia_locl.h"
+
+RCSID("$Id: posix_getpw.c,v 1.1 1999/03/21 17:07:02 joda Exp $");
+
+#ifndef POSIX_GETPWNAM_R
+/*
+ * These functions translate from the old Digital UNIX 3.x interface
+ * to POSIX.1c.
+ */
+
+int
+posix_getpwnam_r(const char *name, struct passwd *pwd,
+ char *buffer, int len, struct passwd **result)
+{
+ int ret = getpwnam_r(name, pwd, buffer, len);
+ if(ret == 0)
+ *result = pwd;
+ else{
+ *result = NULL;
+ ret = _Geterrno();
+ if(ret == 0){
+ ret = ERANGE;
+ _Seterrno(ret);
+ }
+ }
+ return ret;
+}
+
+int
+posix_getpwuid_r(uid_t uid, struct passwd *pwd,
+ char *buffer, int len, struct passwd **result)
+{
+ int ret = getpwuid_r(uid, pwd, buffer, len);
+ if(ret == 0)
+ *result = pwd;
+ else{
+ *result = NULL;
+ ret = _Geterrno();
+ if(ret == 0){
+ ret = ERANGE;
+ _Seterrno(ret);
+ }
+ }
+ return ret;
+}
+#endif /* POSIX_GETPWNAM_R */
diff --git a/crypto/kerberosIV/lib/auth/sia/security.patch b/crypto/kerberosIV/lib/auth/sia/security.patch
new file mode 100644
index 0000000..c407876
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/security.patch
@@ -0,0 +1,11 @@
+--- /sbin/init.d/security~ Tue Aug 20 22:44:09 1996
++++ /sbin/init.d/security Fri Nov 1 14:52:56 1996
+@@ -49,7 +49,7 @@
+ SECURITY=BASE
+ fi
+ ;;
+- BASE)
++ BASE|KRB4)
+ ;;
+ *)
+ echo "security configuration set to default (BASE)."
diff --git a/crypto/kerberosIV/lib/auth/sia/sia.c b/crypto/kerberosIV/lib/auth/sia/sia.c
new file mode 100644
index 0000000..8d35b41
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/sia.c
@@ -0,0 +1,673 @@
+/*
+ * Copyright (c) 1995-1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of the Institute nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#include "sia_locl.h"
+
+RCSID("$Id: sia.c,v 1.30 1999/04/08 13:07:38 joda Exp $");
+
+int
+siad_init(void)
+{
+ return SIADSUCCESS;
+}
+
+int
+siad_chk_invoker(void)
+{
+ SIA_DEBUG(("DEBUG", "siad_chk_invoker"));
+ return SIADFAIL;
+}
+
+int
+siad_ses_init(SIAENTITY *entity, int pkgind)
+{
+ struct state *s = malloc(sizeof(*s));
+ SIA_DEBUG(("DEBUG", "siad_ses_init"));
+ if(s == NULL)
+ return SIADFAIL;
+ memset(s, 0, sizeof(*s));
+#ifdef SIA_KRB5
+ krb5_init_context(&s->context);
+#endif
+ entity->mech[pkgind] = (int*)s;
+ return SIADSUCCESS;
+}
+
+static int
+setup_name(SIAENTITY *e, prompt_t *p)
+{
+ SIA_DEBUG(("DEBUG", "setup_name"));
+ e->name = malloc(SIANAMEMIN + 1);
+ if(e->name == NULL){
+ SIA_DEBUG(("DEBUG", "failed to malloc %u bytes", SIANAMEMIN+1));
+ return SIADFAIL;
+ }
+ p->prompt = (unsigned char*)"login: ";
+ p->result = (unsigned char*)e->name;
+ p->min_result_length = 1;
+ p->max_result_length = SIANAMEMIN;
+ p->control_flags = 0;
+ return SIADSUCCESS;
+}
+
+static int
+setup_password(SIAENTITY *e, prompt_t *p)
+{
+ SIA_DEBUG(("DEBUG", "setup_password"));
+ e->password = malloc(SIAMXPASSWORD + 1);
+ if(e->password == NULL){
+ SIA_DEBUG(("DEBUG", "failed to malloc %u bytes", SIAMXPASSWORD+1));
+ return SIADFAIL;
+ }
+ p->prompt = (unsigned char*)"Password: ";
+ p->result = (unsigned char*)e->password;
+ p->min_result_length = 0;
+ p->max_result_length = SIAMXPASSWORD;
+ p->control_flags = SIARESINVIS;
+ return SIADSUCCESS;
+}
+
+
+static int
+doauth(SIAENTITY *entity, int pkgind, char *name)
+{
+ struct passwd pw, *pwd;
+ char pwbuf[1024];
+ struct state *s = (struct state*)entity->mech[pkgind];
+#ifdef SIA_KRB5
+ char *realm;
+ krb5_principal principal;
+ krb5_ccache ccache;
+ krb5_error_code ret;
+#endif
+#ifdef SIA_KRB4
+ char realm[REALM_SZ];
+ char *toname, *toinst;
+ int ret;
+ struct passwd fpw, *fpwd;
+ char fpwbuf[1024];
+ int secure;
+#endif
+
+ if(getpwnam_r(name, &pw, pwbuf, sizeof(pwbuf), &pwd) != 0){
+ SIA_DEBUG(("DEBUG", "failed to getpwnam(%s)", name));
+ return SIADFAIL;
+ }
+
+#ifdef SIA_KRB5
+ ret = krb5_get_default_realm(s->context, &realm);
+ krb5_build_principal(s->context, &principal,
+ strlen(realm),
+ realm,
+ entity->name,
+ NULL);
+
+
+ if(!krb5_kuserok(s->context, principal, entity->name))
+ return SIADFAIL;
+ sprintf(s->ticket, "FILE:/tmp/krb5_cc%d_%d", pwd->pw_uid, getpid());
+ ret = krb5_cc_resolve(s->context, s->ticket, &ccache);
+ if(ret)
+ return SIADFAIL;
+ ret = krb5_cc_initialize(s->context, ccache, principal);
+ if(ret)
+ return SIADFAIL;
+#endif
+
+#ifdef SIA_KRB4
+ snprintf(s->ticket, sizeof(s->ticket),
+ TKT_ROOT "%u_%u", (unsigned)pwd->pw_uid, (unsigned)getpid());
+ krb_get_lrealm(realm, 1);
+ toname = name;
+ toinst = "";
+ if(entity->authtype == SIA_A_SUAUTH){
+ uid_t ouid;
+#ifdef HAVE_SIAENTITY_OUID
+ ouid = entity->ouid;
+#else
+ ouid = getuid();
+#endif
+ if(getpwuid_r(ouid, &fpw, fpwbuf, sizeof(fpwbuf), &fpwd) != 0){
+ SIA_DEBUG(("DEBUG", "failed to getpwuid(%u)", ouid));
+ return SIADFAIL;
+ }
+ snprintf(s->ticket, sizeof(s->ticket), TKT_ROOT "_%s_to_%s_%d",
+ fpwd->pw_name, pwd->pw_name, getpid());
+ if(strcmp(pwd->pw_name, "root") == 0){
+ toname = fpwd->pw_name;
+ toinst = pwd->pw_name;
+ }
+ }
+ if(entity->authtype == SIA_A_REAUTH)
+ snprintf(s->ticket, sizeof(s->ticket), "%s", tkt_string());
+
+ krb_set_tkt_string(s->ticket);
+
+ setuid(0); /* XXX fix for fix in tf_util.c */
+ if(krb_kuserok(toname, toinst, realm, name)){
+ SIA_DEBUG(("DEBUG", "%s.%s@%s is not allowed to login as %s",
+ toname, toinst, realm, name));
+ return SIADFAIL;
+ }
+#endif
+#ifdef SIA_KRB5
+ ret = krb5_verify_user(s->context, principal, ccache,
+ entity->password, 1, NULL);
+ if(ret){
+ /* if this is most likely a local user (such as
+ root), just silently return failure when the
+ principal doesn't exist */
+ if(ret != KRB5KDC_ERR_C_PRINCIPAL_UNKNOWN &&
+ ret != KRB5KDC_ERR_S_PRINCIPAL_UNKNOWN)
+ SIALOG("WARNING", "krb5_verify_user(%s): %s",
+ entity->name, error_message(ret));
+ return SIADFAIL;
+ }
+#endif
+#ifdef SIA_KRB4
+ if (getuid () == 0)
+ secure = KRB_VERIFY_SECURE;
+ else
+ secure = KRB_VERIFY_NOT_SECURE;
+
+ ret = krb_verify_user(toname, toinst, realm,
+ entity->password, secure, NULL);
+ if(ret){
+ SIA_DEBUG(("DEBUG", "krb_verify_user: %s", krb_get_err_text(ret)));
+ if(ret != KDC_PR_UNKNOWN)
+ /* since this is most likely a local user (such as
+ root), just silently return failure when the
+ principal doesn't exist */
+ SIALOG("WARNING", "krb_verify_user(%s.%s): %s",
+ toname, toinst, krb_get_err_text(ret));
+ return SIADFAIL;
+ }
+#endif
+ if(sia_make_entity_pwd(pwd, entity) == SIAFAIL)
+ return SIADFAIL;
+ s->valid = 1;
+ return SIADSUCCESS;
+}
+
+
+static int
+common_auth(sia_collect_func_t *collect,
+ SIAENTITY *entity,
+ int siastat,
+ int pkgind)
+{
+ prompt_t prompts[2], *pr;
+ char *name;
+
+ SIA_DEBUG(("DEBUG", "common_auth"));
+ if((siastat == SIADSUCCESS) && (geteuid() == 0))
+ return SIADSUCCESS;
+ if(entity == NULL) {
+ SIA_DEBUG(("DEBUG", "entity == NULL"));
+ return SIADFAIL | SIADSTOP;
+ }
+ name = entity->name;
+ if(entity->acctname)
+ name = entity->acctname;
+
+ if((collect != NULL) && entity->colinput) {
+ int num;
+ pr = prompts;
+ if(name == NULL){
+ if(setup_name(entity, pr) != SIADSUCCESS)
+ return SIADFAIL;
+ pr++;
+ }
+ if(entity->password == NULL){
+ if(setup_password(entity, pr) != SIADSUCCESS)
+ return SIADFAIL;
+ pr++;
+ }
+ num = pr - prompts;
+ if(num == 1){
+ if((*collect)(240, SIAONELINER, (unsigned char*)"", num,
+ prompts) != SIACOLSUCCESS){
+ SIA_DEBUG(("DEBUG", "collect failed"));
+ return SIADFAIL | SIADSTOP;
+ }
+ } else if(num > 0){
+ if((*collect)(0, SIAFORM, (unsigned char*)"", num,
+ prompts) != SIACOLSUCCESS){
+ SIA_DEBUG(("DEBUG", "collect failed"));
+ return SIADFAIL | SIADSTOP;
+ }
+ }
+ }
+ if(name == NULL)
+ name = entity->name;
+ if(name == NULL || name[0] == '\0'){
+ SIA_DEBUG(("DEBUG", "name is null"));
+ return SIADFAIL;
+ }
+
+ if(entity->password == NULL || strlen(entity->password) > SIAMXPASSWORD){
+ SIA_DEBUG(("DEBUG", "entity->password is null"));
+ return SIADFAIL;
+ }
+
+ return doauth(entity, pkgind, name);
+}
+
+
+int
+siad_ses_authent(sia_collect_func_t *collect,
+ SIAENTITY *entity,
+ int siastat,
+ int pkgind)
+{
+ SIA_DEBUG(("DEBUG", "siad_ses_authent"));
+ return common_auth(collect, entity, siastat, pkgind);
+}
+
+int
+siad_ses_estab(sia_collect_func_t *collect,
+ SIAENTITY *entity, int pkgind)
+{
+ SIA_DEBUG(("DEBUG", "siad_ses_estab"));
+ return SIADFAIL;
+}
+
+int
+siad_ses_launch(sia_collect_func_t *collect,
+ SIAENTITY *entity,
+ int pkgind)
+{
+ static char env[MaxPathLen];
+ struct state *s = (struct state*)entity->mech[pkgind];
+ SIA_DEBUG(("DEBUG", "siad_ses_launch"));
+ if(s->valid){
+#ifdef SIA_KRB5
+ chown(s->ticket + sizeof("FILE:") - 1,
+ entity->pwd->pw_uid,
+ entity->pwd->pw_gid);
+ snprintf(env, sizeof(env), "KRB5CCNAME=%s", s->ticket);
+#endif
+#ifdef SIA_KRB4
+ chown(s->ticket, entity->pwd->pw_uid, entity->pwd->pw_gid);
+ snprintf(env, sizeof(env), "KRBTKFILE=%s", s->ticket);
+#endif
+ putenv(env);
+ }
+#ifdef KRB4
+ if (k_hasafs()) {
+ char cell[64];
+ k_setpag();
+ if(k_afs_cell_of_file(entity->pwd->pw_dir, cell, sizeof(cell)) == 0)
+ krb_afslog(cell, 0);
+ krb_afslog_home(0, 0, entity->pwd->pw_dir);
+ }
+#endif
+ return SIADSUCCESS;
+}
+
+int
+siad_ses_release(SIAENTITY *entity, int pkgind)
+{
+ SIA_DEBUG(("DEBUG", "siad_ses_release"));
+ if(entity->mech[pkgind]){
+#ifdef SIA_KRB5
+ struct state *s = (struct state*)entity->mech[pkgind];
+ krb5_free_context(s->context);
+#endif
+ free(entity->mech[pkgind]);
+ }
+ return SIADSUCCESS;
+}
+
+int
+siad_ses_suauthent(sia_collect_func_t *collect,
+ SIAENTITY *entity,
+ int siastat,
+ int pkgind)
+{
+ SIA_DEBUG(("DEBUG", "siad_ses_suauth"));
+ if(geteuid() != 0)
+ return SIADFAIL;
+ if(entity->name == NULL)
+ return SIADFAIL;
+ if(entity->name[0] == '\0') {
+ free(entity->name);
+ entity->name = strdup("root");
+ if (entity->name == NULL)
+ return SIADFAIL;
+ }
+ return common_auth(collect, entity, siastat, pkgind);
+}
+
+int
+siad_ses_reauthent (sia_collect_func_t *collect,
+ SIAENTITY *entity,
+ int siastat,
+ int pkgind)
+{
+ int ret;
+ SIA_DEBUG(("DEBUG", "siad_ses_reauthent"));
+ if(entity == NULL || entity->name == NULL)
+ return SIADFAIL;
+ ret = common_auth(collect, entity, siastat, pkgind);
+ if((ret & SIADSUCCESS)){
+ /* launch isn't (always?) called when doing reauth, so we must
+ duplicate some code here... */
+ struct state *s = (struct state*)entity->mech[pkgind];
+ chown(s->ticket, entity->pwd->pw_uid, entity->pwd->pw_gid);
+#ifdef KRB4
+ if(k_hasafs()) {
+ char cell[64];
+ if(k_afs_cell_of_file(entity->pwd->pw_dir,
+ cell, sizeof(cell)) == 0)
+ krb_afslog(cell, 0);
+ krb_afslog_home(0, 0, entity->pwd->pw_dir);
+ }
+#endif
+ }
+ return ret;
+}
+
+int
+siad_chg_finger (sia_collect_func_t *collect,
+ const char *username,
+ int argc,
+ char *argv[])
+{
+ SIA_DEBUG(("DEBUG", "siad_chg_finger"));
+ return SIADFAIL;
+}
+
+#ifdef SIA_KRB5
+int
+siad_chg_password (sia_collect_func_t *collect,
+ const char *username,
+ int argc,
+ char *argv[])
+{
+ return SIADFAIL;
+}
+#endif
+
+#ifdef SIA_KRB4
+static void
+sia_message(sia_collect_func_t *collect, int rendition,
+ const char *title, const char *message)
+{
+ prompt_t prompt;
+ prompt.prompt = (unsigned char*)message;
+ (*collect)(0, rendition, (unsigned char*)title, 1, &prompt);
+}
+
+static int
+init_change(sia_collect_func_t *collect, krb_principal *princ)
+{
+ prompt_t prompt;
+ char old_pw[MAX_KPW_LEN+1];
+ char *msg;
+ char tktstring[128];
+ int ret;
+
+ SIA_DEBUG(("DEBUG", "init_change"));
+ prompt.prompt = (unsigned char*)"Old password: ";
+ prompt.result = (unsigned char*)old_pw;
+ prompt.min_result_length = 0;
+ prompt.max_result_length = sizeof(old_pw) - 1;
+ prompt.control_flags = SIARESINVIS;
+ asprintf(&msg, "Changing password for %s", krb_unparse_name(princ));
+ if(msg == NULL){
+ SIA_DEBUG(("DEBUG", "out of memory"));
+ return SIADFAIL;
+ }
+ ret = (*collect)(60, SIAONELINER, (unsigned char*)msg, 1, &prompt);
+ free(msg);
+ SIA_DEBUG(("DEBUG", "ret = %d", ret));
+ if(ret != SIACOLSUCCESS)
+ return SIADFAIL;
+ snprintf(tktstring, sizeof(tktstring),
+ TKT_ROOT "_cpw_%u", (unsigned)getpid());
+ krb_set_tkt_string(tktstring);
+
+ ret = krb_get_pw_in_tkt(princ->name, princ->instance, princ->realm,
+ PWSERV_NAME, KADM_SINST, 1, old_pw);
+ if (ret != KSUCCESS) {
+ SIA_DEBUG(("DEBUG", "krb_get_pw_in_tkt: %s", krb_get_err_text(ret)));
+ if (ret == INTK_BADPW)
+ sia_message(collect, SIAWARNING, "", "Incorrect old password.");
+ else
+ sia_message(collect, SIAWARNING, "", "Kerberos error.");
+ memset(old_pw, 0, sizeof(old_pw));
+ return SIADFAIL;
+ }
+ if(chown(tktstring, getuid(), -1) < 0){
+ dest_tkt();
+ return SIADFAIL;
+ }
+ memset(old_pw, 0, sizeof(old_pw));
+ return SIADSUCCESS;
+}
+
+int
+siad_chg_password (sia_collect_func_t *collect,
+ const char *username,
+ int argc,
+ char *argv[])
+{
+ prompt_t prompts[2];
+ krb_principal princ;
+ int ret;
+ char new_pw1[MAX_KPW_LEN+1];
+ char new_pw2[MAX_KPW_LEN+1];
+ static struct et_list *et_list;
+
+ set_progname(argv[0]);
+
+ SIA_DEBUG(("DEBUG", "siad_chg_password"));
+ if(collect == NULL)
+ return SIADFAIL;
+
+ if(username == NULL)
+ username = getlogin();
+
+ ret = krb_parse_name(username, &princ);
+ if(ret)
+ return SIADFAIL;
+ if(princ.realm[0] == '\0')
+ krb_get_lrealm(princ.realm, 1);
+
+ if(et_list == NULL) {
+ initialize_kadm_error_table_r(&et_list);
+ initialize_krb_error_table_r(&et_list);
+ }
+
+ ret = init_change(collect, &princ);
+ if(ret != SIADSUCCESS)
+ return ret;
+
+again:
+ prompts[0].prompt = (unsigned char*)"New password: ";
+ prompts[0].result = (unsigned char*)new_pw1;
+ prompts[0].min_result_length = MIN_KPW_LEN;
+ prompts[0].max_result_length = sizeof(new_pw1) - 1;
+ prompts[0].control_flags = SIARESINVIS;
+ prompts[1].prompt = (unsigned char*)"Verify new password: ";
+ prompts[1].result = (unsigned char*)new_pw2;
+ prompts[1].min_result_length = MIN_KPW_LEN;
+ prompts[1].max_result_length = sizeof(new_pw2) - 1;
+ prompts[1].control_flags = SIARESINVIS;
+ if((*collect)(120, SIAFORM, (unsigned char*)"", 2, prompts) !=
+ SIACOLSUCCESS) {
+ dest_tkt();
+ return SIADFAIL;
+ }
+ if(strcmp(new_pw1, new_pw2) != 0){
+ sia_message(collect, SIAWARNING, "", "Password mismatch.");
+ goto again;
+ }
+ ret = kadm_check_pw(new_pw1);
+ if(ret) {
+ sia_message(collect, SIAWARNING, "", com_right(et_list, ret));
+ goto again;
+ }
+
+ memset(new_pw2, 0, sizeof(new_pw2));
+ ret = kadm_init_link (PWSERV_NAME, KRB_MASTER, princ.realm);
+ if (ret != KADM_SUCCESS)
+ sia_message(collect, SIAWARNING, "Error initing kadmin connection",
+ com_right(et_list, ret));
+ else {
+ des_cblock newkey;
+ char *pw_msg; /* message from server */
+
+ des_string_to_key(new_pw1, &newkey);
+ ret = kadm_change_pw_plain((unsigned char*)&newkey, new_pw1, &pw_msg);
+ memset(newkey, 0, sizeof(newkey));
+
+ if (ret == KADM_INSECURE_PW)
+ sia_message(collect, SIAWARNING, "Insecure password", pw_msg);
+ else if (ret != KADM_SUCCESS)
+ sia_message(collect, SIAWARNING, "Error changing password",
+ com_right(et_list, ret));
+ }
+ memset(new_pw1, 0, sizeof(new_pw1));
+
+ if (ret != KADM_SUCCESS)
+ sia_message(collect, SIAWARNING, "", "Password NOT changed.");
+ else
+ sia_message(collect, SIAINFO, "", "Password changed.");
+
+ dest_tkt();
+ if(ret)
+ return SIADFAIL;
+ return SIADSUCCESS;
+}
+#endif
+
+int
+siad_chg_shell (sia_collect_func_t *collect,
+ const char *username,
+ int argc,
+ char *argv[])
+{
+ return SIADFAIL;
+}
+
+int
+siad_getpwent(struct passwd *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_getpwuid (uid_t uid,
+ struct passwd *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_getpwnam (const char *name,
+ struct passwd *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_setpwent (struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_endpwent (struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_getgrent(struct group *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_getgrgid (gid_t gid,
+ struct group *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_getgrnam (const char *name,
+ struct group *result,
+ char *buf,
+ int bufsize,
+ struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_setgrent (struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_endgrent (struct sia_context *context)
+{
+ return SIADFAIL;
+}
+
+int
+siad_chk_user (const char *logname, int checkflag)
+{
+ if(checkflag != CHGPASSWD)
+ return SIADFAIL;
+ return SIADSUCCESS;
+}
diff --git a/crypto/kerberosIV/lib/auth/sia/sia_locl.h b/crypto/kerberosIV/lib/auth/sia/sia_locl.h
new file mode 100644
index 0000000..0f3f74d
--- /dev/null
+++ b/crypto/kerberosIV/lib/auth/sia/sia_locl.h
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of KTH nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+/* $Id: sia_locl.h,v 1.2 1999/04/01 16:09:22 joda Exp $ */
+
+#ifndef __sia_locl_h__
+#define __sia_locl_h__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include <ctype.h>
+#include <stdio.h>
+#include <string.h>
+#include <siad.h>
+#include <pwd.h>
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <netinet/in.h>
+
+#ifdef KRB5
+#define SIA_KRB5
+#elif defined(KRB4)
+#define SIA_KRB4
+#endif
+
+#ifdef SIA_KRB5
+#include <krb5.h>
+#include <com_err.h>
+#endif
+#ifdef SIA_KRB4
+#include <krb.h>
+#include <krb_err.h>
+#include <kadm.h>
+#include <kadm_err.h>
+#endif
+#ifdef KRB4
+#include <kafs.h>
+#endif
+
+#include <roken.h>
+
+#ifndef POSIX_GETPWNAM_R
+
+#define getpwnam_r posix_getpwnam_r
+#define getpwuid_r posix_getpwuid_r
+
+#endif /* POSIX_GETPWNAM_R */
+
+#ifndef DEBUG
+#define SIA_DEBUG(X)
+#else
+#define SIA_DEBUG(X) SIALOG X
+#endif
+
+struct state{
+#ifdef SIA_KRB5
+ krb5_context context;
+ krb5_auth_context auth_context;
+#endif
+ char ticket[MaxPathLen];
+ int valid;
+};
+
+#endif /* __sia_locl_h__ */
diff --git a/crypto/kerberosIV/lib/kadm/Makefile.in b/crypto/kerberosIV/lib/kadm/Makefile.in
index 1dafd4f..ba97c5d 100644
--- a/crypto/kerberosIV/lib/kadm/Makefile.in
+++ b/crypto/kerberosIV/lib/kadm/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.30 1997/05/06 03:47:28 assar Exp $
+# $Id: Makefile.in,v 1.47 1998/10/13 16:50:44 joda Exp $
#
SHELL = /bin/sh
@@ -8,24 +8,42 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
LN_S = @LN_S@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+DEFS = @DEFS@ -DROKEN_RENAME
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
-COMPILE_ET = ../../util/et/compile_et$(EXECSUFFIX) -language ansi-c
+COMPILE_ET = ../com_err/compile_et
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
+top_builddir = ../..
+
+includedir = @includedir@
+
+incdir = $(includedir)
+inc_DATA = kadm_err.h
+idir = $(top_builddir)/include
+
PICFLAGS = @PICFLAGS@
+@lib_deps_yes@LIB_DEPS = -L../krb -lkrb \
+@lib_deps_yes@ -L../des -ldes \
+@lib_deps_yes@ -lc
+@lib_deps_no@LIB_DEPS =
+
+build_symlink_command = @build_symlink_command@
+install_symlink_command = @install_symlink_command@
+
LIBNAME = $(LIBPREFIX)kadm
LIBEXT = @LIBEXT@
LIBPREFIX = @LIBPREFIX@
@@ -34,24 +52,32 @@ SHLIBEXT = @SHLIBEXT@
LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)
-SOURCES = kadm_cli_wrap.c kadm_err.c kadm_stream.c kadm_supp.c
+SOURCES = kadm_cli_wrap.c kadm_err.c kadm_stream.c kadm_supp.c check_password.c
-OBJECTS = kadm_cli_wrap.o kadm_err.o kadm_stream.o kadm_supp.o
+OBJECTS = kadm_cli_wrap.o kadm_err.o kadm_stream.o kadm_supp.o check_password.o
-all: $(LIB)
+all: $(LIB) all-local
Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I. -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
+ @install_symlink_command@
+ $(MKINSTALLDIRS) $(DESTDIR)$(includedir)
+ @for i in $(inc_DATA); do \
+ echo " $(INSTALL_DATA) $$i $(DESTDIR)$(incdir)/$$i";\
+ $(INSTALL_DATA) $$i $(DESTDIR)$(incdir)/$$i; done
uninstall:
- rm -f $(libdir)/$(LIB)
+ rm -f $(DESTDIR)$(libdir)/$(LIB)
+ @for i in $(inc_DATA); do \
+ echo " rm -f $(DESTDIR)$(incdir)/$$i";\
+ rm -f $(DESTDIR)$(incdir)/$$i; done
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -59,22 +85,16 @@ TAGS: $(SOURCES)
check:
clean:
- rm -f $(LIB) *.o *.a kadm_err.c kadm_err.h
+ rm -f $(LIB) *.o *.a *.so *.so.* so_locations kadm_err.c kadm_err.h
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c *~
+ rm -f Makefile *.tab.c *~ roken_rename.h
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
$(LIBNAME).a: $(OBJECTS)
rm -f $@
$(AR) cr $@ $(OBJECTS)
@@ -82,11 +102,24 @@ $(LIBNAME).a: $(OBJECTS)
$(LIBNAME).$(SHLIBEXT): $(OBJECTS)
rm -f $@
- $(LDSHARED) -o $@ $(OBJECTS)
+ $(LDSHARED) -o $@ $(OBJECTS) $(LIB_DEPS)
+ @build_symlink_command@
-kadm_err.c kadm_err.h: kadm_err.et
- test -r kadm_err.et || (rm -f kadm_err.et && $(LN_S) $(srcdir)/kadm_err.et .)
- $(COMPILE_ET) kadm_err.et
+kadm_err.c kadm_err.h: $(srcdir)/kadm_err.et
+ $(COMPILE_ET) $(srcdir)/kadm_err.et
-$(OBJECTS): ../../include/config.h
+$(OBJECTS): ../../include/config.h roken_rename.h
$(OBJECTS): kadm_err.h kadm_locl.h
+
+roken_rename.h:
+ $(LN_S) $(srcdir)/../krb/roken_rename.h .
+
+all-local: $(inc_DATA)
+ @for i in $(inc_DATA); do \
+ if cmp -s $$i $(idir)/$$i 2> /dev/null ; then :; else\
+ echo " $(INSTALL_DATA) $$i $(idir)/$$i"; \
+ $(INSTALL_DATA) $$i $(idir)/$$i; \
+ fi ; \
+ done
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean all-local
diff --git a/crypto/kerberosIV/lib/kadm/check_password.c b/crypto/kerberosIV/lib/kadm/check_password.c
new file mode 100644
index 0000000..be95c91
--- /dev/null
+++ b/crypto/kerberosIV/lib/kadm/check_password.c
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "kadm_locl.h"
+RCSID("$Id: check_password.c,v 1.2 1999/03/13 21:23:48 assar Exp $");
+
+/* This is a client side password check. Should perhaps be merged with
+ kadmind version that lives in pw_check.c */
+
+int
+kadm_check_pw (const char *password)
+{
+ const char *t;
+ if (strlen(password) == 0)
+ return KADM_PASS_Q_NULL;
+ if (strlen(password) < MIN_KPW_LEN)
+ return KADM_PASS_Q_TOOSHORT;
+
+ /* Don't allow all lower case passwords regardless of length */
+ for (t = password; *t && islower((unsigned char)*t); t++)
+ ;
+ if (*t == '\0')
+ return KADM_PASS_Q_CLASS;
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/kadm/kadm.h b/crypto/kerberosIV/lib/kadm/kadm.h
index d18f592..fd3d75b 100644
--- a/crypto/kerberosIV/lib/kadm/kadm.h
+++ b/crypto/kerberosIV/lib/kadm/kadm.h
@@ -1,5 +1,5 @@
/*
- * $Id: kadm.h,v 1.12 1996/11/17 20:04:39 assar Exp $
+ * $Id: kadm.h,v 1.17 1998/10/23 14:25:55 joda Exp $
*
* Copyright 1988 by the Massachusetts Institute of Technology.
*
@@ -66,20 +66,26 @@ typedef struct { /* status of the server, i.e the parameters */
/* Kadm_vals structure for passing db fields into the server routines */
#define FLDSZ 4
+/* XXX enable new extended kadm fields */
+#define EXTENDED_KADM 1
+
typedef struct {
- u_int8_t fields[FLDSZ]; /* The active fields in this struct */
- char name[ANAME_SZ];
- char instance[INST_SZ];
- u_int32_t key_low;
- u_int32_t key_high;
- u_int32_t exp_date;
- u_int16_t attributes;
- u_int8_t max_life;
+ u_int8_t fields[FLDSZ]; /* The active fields in this struct */
+ char name[ANAME_SZ];
+ char instance[INST_SZ];
+ u_int32_t key_low;
+ u_int32_t key_high;
+ u_int32_t exp_date;
+ u_int16_t attributes;
+ u_int8_t max_life;
+#ifdef EXTENDED_KADM
+ u_int32_t mod_date;
+ char mod_name[ANAME_SZ];
+ char mod_instance[INST_SZ];
+ u_int8_t key_version;
+#endif
} Kadm_vals; /* The basic values structure in Kadm */
-/* Kadm_vals structure for passing db fields into the server routines */
-#define FLDSZ 4
-
/* Need to define fields types here */
#define KADM_NAME 31
#define KADM_INST 30
@@ -88,6 +94,13 @@ typedef struct {
#define KADM_MAXLIFE 27
#define KADM_DESKEY 26
+#ifdef EXTENDED_KADM
+#define KADM_MODDATE 25
+#define KADM_MODNAME 24
+#define KADM_MODINST 23
+#define KADM_KVNO 22
+#endif
+
/* To set a field entry f in a fields structure d */
#define SET_FIELD(f,d) (d[3-(f/8)]|=(1<<(f%8)))
@@ -131,13 +144,13 @@ int vals_to_stream __P((Kadm_vals *, u_char **));
int kadm_init_link __P((char *, char *, char *));
int kadm_change_pw __P((unsigned char *));
int kadm_change_pw_plain __P((unsigned char *, char *, char**));
+int kadm_change_pw2 __P((unsigned char *, char *, char**));
int kadm_mod __P((Kadm_vals *, Kadm_vals *));
int kadm_get __P((Kadm_vals *, u_char *));
int kadm_add __P((Kadm_vals *));
int kadm_del __P((Kadm_vals *));
void kadm_vals_to_prin __P((u_char *, Principal *, Kadm_vals *));
void kadm_prin_to_vals __P((u_char *, Kadm_vals *, Principal *));
-
-
+int kadm_check_pw __P((const char*));
#endif /* KADM_DEFS */
diff --git a/crypto/kerberosIV/lib/kadm/kadm_cli_wrap.c b/crypto/kerberosIV/lib/kadm/kadm_cli_wrap.c
index 1e5c4f3..8f98d44 100644
--- a/crypto/kerberosIV/lib/kadm/kadm_cli_wrap.c
+++ b/crypto/kerberosIV/lib/kadm/kadm_cli_wrap.c
@@ -29,16 +29,12 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: kadm_cli_wrap.c,v 1.21 1997/05/02 10:28:11 joda Exp $");
-
-#ifndef NULL
-#define NULL 0
-#endif
+RCSID("$Id: kadm_cli_wrap.c,v 1.26 1999/07/05 13:28:58 bg Exp $");
static Kadm_Client client_parm;
/* Macros for use in returning data... used in kadm_cli_send */
-#define RET_N_FREE(r) {clear_secrets(); free((char *)act_st); free((char *)priv_pak); return r;}
+#define RET_N_FREE(r) {clear_secrets(); free(act_st); free(priv_pak); return r;}
/* Keys for use in the transactions */
static des_cblock sess_key; /* to be filled in by kadm_cli_keyd */
@@ -49,7 +45,6 @@ clear_secrets(void)
{
memset(sess_key, 0, sizeof(sess_key));
memset(sess_sched, 0, sizeof(sess_sched));
- return;
}
static RETSIGTYPE (*opipe)();
@@ -59,7 +54,6 @@ kadm_cli_disconn(void)
{
close(client_parm.admin_fd);
signal(SIGPIPE, opipe);
- return;
}
/*
@@ -79,9 +73,9 @@ kadm_init_link(char *n, char *i, char *r)
init_kadm_err_tbl();
init_krb_err_tbl();
- strcpy(client_parm.sname, n);
- strcpy(client_parm.sinst, i);
- strcpy(client_parm.krbrlm, r);
+ strcpy_truncate(client_parm.sname, n, ANAME_SZ);
+ strcpy_truncate(client_parm.sinst, i, INST_SZ);
+ strcpy_truncate(client_parm.krbrlm, r, REALM_SZ);
client_parm.admin_fd = -1;
/* set up the admin_addr - fetch name of admin host */
@@ -102,17 +96,17 @@ kadm_init_link(char *n, char *i, char *r)
static int
kadm_cli_conn(void)
{ /* this connects and sets my_addr */
- int on = 1;
+ client_parm.admin_fd =
+ socket(client_parm.admin_addr.sin_family, SOCK_STREAM, 0);
- if ((client_parm.admin_fd =
- socket(client_parm.admin_addr.sin_family, SOCK_STREAM,0)) < 0)
- return KADM_NO_SOCK; /* couldnt create the socket */
+ if (client_parm.admin_fd < 0)
+ return KADM_NO_SOCK; /* couldn't create the socket */
if (connect(client_parm.admin_fd,
(struct sockaddr *) & client_parm.admin_addr,
sizeof(client_parm.admin_addr))) {
close(client_parm.admin_fd);
client_parm.admin_fd = -1;
- return KADM_NO_CONN; /* couldnt get the connect */
+ return KADM_NO_CONN; /* couldn't get the connect */
}
opipe = signal(SIGPIPE, SIG_IGN);
client_parm.my_addr_len = sizeof(client_parm.my_addr);
@@ -122,16 +116,20 @@ kadm_cli_conn(void)
close(client_parm.admin_fd);
client_parm.admin_fd = -1;
signal(SIGPIPE, opipe);
- return KADM_NO_HERE; /* couldnt find out who we are */
+ return KADM_NO_HERE; /* couldn't find out who we are */
}
#if defined(SO_KEEPALIVE) && defined(HAVE_SETSOCKOPT)
- if (setsockopt(client_parm.admin_fd, SOL_SOCKET, SO_KEEPALIVE,
- (void *)&on,
- sizeof(on)) < 0) {
- close(client_parm.admin_fd);
- client_parm.admin_fd = -1;
- signal(SIGPIPE, opipe);
- return KADM_NO_CONN; /* XXX */
+ {
+ int on = 1;
+
+ if (setsockopt(client_parm.admin_fd, SOL_SOCKET, SO_KEEPALIVE,
+ (void *)&on,
+ sizeof(on)) < 0) {
+ close(client_parm.admin_fd);
+ client_parm.admin_fd = -1;
+ signal(SIGPIPE, opipe);
+ return KADM_NO_CONN; /* XXX */
+ }
}
#endif
return KADM_SUCCESS;
@@ -139,16 +137,15 @@ kadm_cli_conn(void)
/* takes in the sess_key and key_schedule and sets them appropriately */
static int
-kadm_cli_keyd(des_cblock (*s_k), struct des_ks_struct *s_s)
- /* session key */
- /* session key schedule */
+kadm_cli_keyd(des_cblock (*s_k), /* session key */
+ struct des_ks_struct *s_s) /* session key schedule */
{
CREDENTIALS cred; /* to get key data */
int stat;
/* want .sname and .sinst here.... */
if ((stat = krb_get_cred(client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, &cred)))
+ client_parm.krbrlm, &cred)))
return stat + krb_err_base;
memcpy(s_k, cred.session, sizeof(des_cblock));
memset(cred.session, 0, sizeof(des_cblock));
@@ -156,7 +153,7 @@ kadm_cli_keyd(des_cblock (*s_k), struct des_ks_struct *s_s)
memset(s_s, 0, sizeof(des_key_schedule));
#else
if ((stat = des_key_sched(s_k,s_s)))
- return(stat+krb_err_base);
+ return stat+krb_err_base;
#endif
return KADM_SUCCESS;
} /* This code "works" */
@@ -178,7 +175,7 @@ kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
if (krb_net_write(client_parm.admin_fd, tmp, 2) != 2)
return (errno); /* XXX */
- if (krb_net_write(client_parm.admin_fd, (char *) dat, dat_len) < 0)
+ if (krb_net_write(client_parm.admin_fd, dat, dat_len) < 0)
return (errno); /* XXX */
@@ -190,12 +187,12 @@ kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
}
dlen = (tmp[0] << 8) | tmp[1];
- *ret_dat = (u_char *)malloc((unsigned)dlen);
- if (!*ret_dat)
+ *ret_dat = malloc(dlen);
+ if (*ret_dat == NULL)
return(KADM_NOMEM);
if ((retval = krb_net_read(client_parm.admin_fd, *ret_dat,
- dlen) != dlen)) {
+ dlen) != dlen)) {
if (retval < 0)
return(errno); /* XXX */
else
@@ -224,69 +221,94 @@ kadm_cli_out(u_char *dat, int dat_len, u_char **ret_dat, int *ret_siz)
* then it sends the data and waits for a reply.
*/
static int
-kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
- /* the actual data */
- /* length of said data */
- /* to give return info */
- /* length of returned info */
+kadm_cli_send(u_char *st_dat, /* the actual data */
+ int st_siz, /* length of said data */
+ u_char **ret_dat, /* to give return info */
+ int *ret_siz) /* length of returned info */
{
- int act_len, retdat; /* current offset into packet, return
- * data */
- KTEXT_ST authent; /* the authenticator we will build */
- u_char *act_st; /* the pointer to the complete packet */
- u_char *priv_pak; /* private version of the packet */
- int priv_len; /* length of private packet */
- u_int32_t cksum; /* checksum of the packet */
+ int act_len, retdat; /* current offset into packet, return
+ * data */
+ KTEXT_ST authent; /* the authenticator we will build */
+ u_char *act_st; /* the pointer to the complete packet */
+ u_char *priv_pak; /* private version of the packet */
+ int priv_len; /* length of private packet */
+ u_int32_t cksum; /* checksum of the packet */
MSG_DAT mdat;
u_char *return_dat;
+ int tmp;
+ void *tmp_ptr;
- act_st = (u_char *) malloc(KADM_VERSIZE); /* verstr stored first */
- strncpy((char *)act_st, KADM_VERSTR, KADM_VERSIZE);
+ act_st = malloc(KADM_VERSIZE); /* verstr stored first */
+ if (act_st == NULL) {
+ clear_secrets ();
+ return KADM_NOMEM;
+ }
+ memcpy(act_st, KADM_VERSTR, KADM_VERSIZE);
act_len = KADM_VERSIZE;
if ((retdat = kadm_cli_keyd(&sess_key, sess_sched)) != KADM_SUCCESS) {
free(act_st);
+ clear_secrets();
return retdat; /* couldnt get key working */
}
- priv_pak = (u_char *) malloc((unsigned)(st_siz + 200));
+ priv_pak = malloc(st_siz + 200);
/* 200 bytes for extra info case */
- if ((priv_len = krb_mk_priv(st_dat, priv_pak, (u_int32_t)st_siz,
- sess_sched, &sess_key, &client_parm.my_addr,
- &client_parm.admin_addr)) < 0)
+ if (priv_pak == NULL) {
+ free(act_st);
+ clear_secrets ();
+ return KADM_NOMEM;
+ }
+ priv_len = krb_mk_priv(st_dat, priv_pak, st_siz,
+ sess_sched, &sess_key, &client_parm.my_addr,
+ &client_parm.admin_addr);
+
+ if (priv_len < 0)
RET_N_FREE(KADM_NO_ENCRYPT); /* whoops... we got a lose
* here */
/* here is the length of priv data. receiver calcs
size of authenticator by subtracting vno size, priv size, and
sizeof(u_int32_t) (for the size indication) from total size */
- act_len += vts_long((u_int32_t) priv_len, &act_st, act_len);
+ tmp = vts_long(priv_len, &act_st, act_len);
+ if (tmp < 0)
+ RET_N_FREE(KADM_NOMEM);
+ act_len += tmp;
#ifdef NOENCRYPTION
cksum = 0;
#else
- cksum = des_quad_cksum((des_cblock *)priv_pak, (des_cblock *)0, (long)priv_len, 0,
- &sess_key);
+ cksum = des_quad_cksum((des_cblock *)priv_pak,
+ (des_cblock *)0, priv_len, 0,
+ &sess_key);
#endif
- if ((retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
- client_parm.krbrlm, cksum))) {
+
+ retdat = krb_mk_req(&authent, client_parm.sname, client_parm.sinst,
+ client_parm.krbrlm, cksum);
+
+ if (retdat) {
/* authenticator? */
RET_N_FREE(retdat + krb_err_base);
}
- act_st = (u_char *) realloc(act_st,
- act_len + authent.length + priv_len);
- if (!act_st) {
+ tmp_ptr = realloc(act_st,
+ act_len + authent.length + priv_len);
+ if (tmp_ptr == NULL) {
clear_secrets();
- free(priv_pak);
- return(KADM_NOMEM);
+ free (priv_pak);
+ free (act_st);
+ return KADM_NOMEM;
}
- memcpy((char *)act_st + act_len, authent.dat, authent.length);
- memcpy((char *)act_st + act_len + authent.length, priv_pak, priv_len);
+ act_st = tmp_ptr;
+ memcpy(act_st + act_len, authent.dat, authent.length);
+ memcpy(act_st + act_len + authent.length, priv_pak, priv_len);
free(priv_pak);
- if ((retdat = kadm_cli_out(act_st,
- act_len + authent.length + priv_len,
- ret_dat, ret_siz)) != KADM_SUCCESS)
- RET_N_FREE(retdat);
+ retdat = kadm_cli_out(act_st,
+ act_len + authent.length + priv_len,
+ ret_dat, ret_siz);
free(act_st);
+ if (retdat != KADM_SUCCESS) {
+ clear_secrets();
+ return retdat;
+ }
#define RET_N_FREE2(r) {free(*ret_dat); clear_secrets(); return(r);}
/* first see if it's a YOULOUSE */
@@ -301,9 +323,10 @@ kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
RET_N_FREE2(retdat);
}
/* need to decode the ret_dat */
- if ((retdat = krb_rd_priv(*ret_dat, (u_int32_t)*ret_siz, sess_sched,
- &sess_key, &client_parm.admin_addr,
- &client_parm.my_addr, &mdat)))
+ retdat = krb_rd_priv(*ret_dat, (u_int32_t)*ret_siz, sess_sched,
+ &sess_key, &client_parm.admin_addr,
+ &client_parm.my_addr, &mdat);
+ if (retdat)
RET_N_FREE2(retdat+krb_err_base);
if (mdat.app_length < KADM_VERSIZE + 4)
/* too short! */
@@ -316,10 +339,13 @@ kadm_cli_send(u_char *st_dat, int st_siz, u_char **ret_dat, int *ret_siz)
retdat = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
}
{
- int s=mdat.app_length - KADM_VERSIZE - 4;
- if(s<=0) s=1;
- if (!(return_dat = (u_char *)malloc(s)))
- RET_N_FREE2(KADM_NOMEM);
+ int s = mdat.app_length - KADM_VERSIZE - 4;
+
+ if(s <= 0)
+ s=1;
+ return_dat = malloc(s);
+ if (return_dat == NULL)
+ RET_N_FREE2(KADM_NOMEM);
}
memcpy(return_dat,
(char *) mdat.app_data + KADM_VERSIZE + 4,
@@ -348,24 +374,33 @@ int kadm_change_pw_plain(unsigned char *newkey, char *password, char **pw_msg)
int status;
static char msg[128];
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
/* possible problem with vts_long on a non-multiple of four boundary */
stsize = 0; /* start of our output packet */
- send_st = (u_char *) malloc(1);/* to make it reallocable */
+ send_st = malloc(9);
+ if (send_st == NULL)
+ return KADM_NOMEM;
send_st[stsize++] = (u_char) CHANGE_PW;
-
- /* change key to stream */
-
- send_st = realloc(send_st, stsize + 8);
memcpy(send_st + stsize + 4, newkey, 4); /* yes, this is backwards */
memcpy(send_st + stsize, newkey + 4, 4);
stsize += 8;
-
- if(password && *password)
- stsize += vts_string(password, &send_st, stsize);
+ /* change key to stream */
+
+ if(password && *password) {
+ int tmp = vts_string(password, &send_st, stsize);
+
+ if (tmp < 0) {
+ free(send_st);
+ return KADM_NOMEM;
+ }
+ stsize += tmp;
+ }
+
+ if ((retc = kadm_cli_conn()) != KADM_SUCCESS) {
+ free(send_st);
+ return(retc);
+ }
retc = kadm_cli_send(send_st, stsize, &ret_st, &ret_sz);
free(send_st);
@@ -384,6 +419,16 @@ int kadm_change_pw_plain(unsigned char *newkey, char *password, char **pw_msg)
}
/*
+ * This function is here for compatibility with CNS
+ */
+
+int kadm_change_pw2(unsigned char *newkey, char *password, char **pw_msg)
+{
+ return kadm_change_pw_plain (newkey, password, pw_msg);
+}
+
+
+/*
* kadm_change_pw
* recieves : key
*
@@ -416,14 +461,21 @@ kadm_add(Kadm_vals *vals)
u_char *ret_st;
int ret_sz;
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
st_len = vals_to_stream(vals, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len));
+ st2 = malloc(1 + st_len);
+ if (st2 == NULL) {
+ free(st);
+ return KADM_NOMEM;
+ }
*st2 = (u_char) ADD_ENT; /* here's the opcode */
memcpy((char *) st2 + 1, st, st_len); /* append st on */
- retc = kadm_cli_send(st2, st_len + 1, &ret_st, &ret_sz);
free(st);
+
+ if ((retc = kadm_cli_conn()) != KADM_SUCCESS) {
+ free(st2);
+ return(retc);
+ }
+ retc = kadm_cli_send(st2, st_len + 1, &ret_st, &ret_sz);
free(st2);
if (retc == KADM_SUCCESS) {
/* ret_st has vals */
@@ -451,23 +503,37 @@ kadm_mod(Kadm_vals *vals1, Kadm_vals *vals2)
int st_len, nlen; /* st2 the final stream with opcode */
u_char *ret_st;
int ret_sz;
+ void *tmp_ptr;
/* nlen is the length of second vals */
int retc; /* return code from call */
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
-
st_len = vals_to_stream(vals1, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len));
+ st2 = malloc(1 + st_len);
+ if (st2 == NULL) {
+ free(st);
+ return KADM_NOMEM;
+ }
*st2 = (u_char) MOD_ENT; /* here's the opcode */
memcpy((char *)st2 + 1, st, st_len++); /* append st on */
free(st);
nlen = vals_to_stream(vals2, &st);
- st2 = (u_char *) realloc((char *) st2, (unsigned)(st_len + nlen));
+ tmp_ptr = realloc(st2, st_len + nlen);
+ if (tmp_ptr == NULL) {
+ free(st);
+ free(st2);
+ return KADM_NOMEM;
+ }
+ st2 = tmp_ptr;
memcpy((char *) st2 + st_len, st, nlen); /* append st on */
- retc = kadm_cli_send(st2, st_len + nlen, &ret_st, &ret_sz);
free(st);
+
+ if ((retc = kadm_cli_conn()) != KADM_SUCCESS) {
+ free(st2);
+ return(retc);
+ }
+
+ retc = kadm_cli_send(st2, st_len + nlen, &ret_st, &ret_sz);
free(st2);
if (retc == KADM_SUCCESS) {
/* ret_st has vals */
@@ -489,14 +555,21 @@ kadm_del(Kadm_vals *vals)
u_char *ret_st;
int ret_sz;
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
st_len = vals_to_stream(vals, &st);
- st2 = (unsigned char *) malloc(st_len + 1);
+ st2 = malloc(st_len + 1);
+ if (st2 == NULL) {
+ free(st);
+ return KADM_NOMEM;
+ }
*st2 = DEL_ENT; /* here's the opcode */
memcpy(st2 + 1, st, st_len); /* append st on */
+ free (st);
+
+ if ((retc = kadm_cli_conn()) != KADM_SUCCESS) {
+ free(st2);
+ return(retc);
+ }
retc = kadm_cli_send(st2, st_len + 1, &ret_st, &ret_sz);
- free(st);
free(st2);
kadm_cli_disconn();
return(retc);
@@ -523,16 +596,23 @@ kadm_get(Kadm_vals *vals, u_char *fl)
u_char *ret_st;
int ret_sz;
- if ((retc = kadm_cli_conn()) != KADM_SUCCESS)
- return(retc);
st_len = vals_to_stream(vals, &st);
- st2 = (u_char *) malloc((unsigned)(1 + st_len + FLDSZ));
+ st2 = malloc(1 + st_len + FLDSZ);
+ if (st2 == NULL) {
+ free(st);
+ return KADM_NOMEM;
+ }
*st2 = (u_char) GET_ENT; /* here's the opcode */
memcpy((char *)st2 + 1, st, st_len); /* append st on */
+ free(st);
for (loop = FLDSZ - 1; loop >= 0; loop--)
*(st2 + st_len + FLDSZ - loop) = fl[loop]; /* append the flags */
+
+ if ((retc = kadm_cli_conn()) != KADM_SUCCESS) {
+ free(st2);
+ return(retc);
+ }
retc = kadm_cli_send(st2, st_len + 1 + FLDSZ, &ret_st, &ret_sz);
- free(st);
free(st2);
if (retc == KADM_SUCCESS) {
/* ret_st has vals */
diff --git a/crypto/kerberosIV/lib/kadm/kadm_err.et b/crypto/kerberosIV/lib/kadm/kadm_err.et
index 0a7c7b6..7a247c5 100644
--- a/crypto/kerberosIV/lib/kadm/kadm_err.et
+++ b/crypto/kerberosIV/lib/kadm/kadm_err.et
@@ -1,5 +1,4 @@
-# $Id: kadm_err.et,v 1.4 1996/06/12 08:01:34 bg Exp $
-# $Author: bg $
+# $Id: kadm_err.et,v 1.5 1998/01/16 23:11:27 joda Exp $
#
# Copyright 1988 by the Massachusetts Institute of Technology.
#
@@ -12,7 +11,7 @@
# KADM_SUCCESS, as all success codes should be, is zero
-ec KADM_RCSID, "$Id: kadm_err.et,v 1.4 1996/06/12 08:01:34 bg Exp $"
+ec KADM_RCSID, "$Id: kadm_err.et,v 1.5 1998/01/16 23:11:27 joda Exp $"
# /* Building and unbuilding the packet errors */
ec KADM_NO_REALM, "Cannot fetch local realm"
ec KADM_NO_CRED, "Unable to fetch credentials"
@@ -56,4 +55,11 @@ ec KADM_PW_MISMATCH, "Cleartext password and DES key did not match"
ec KADM_NOT_SERV_PRINC, "Invalid principal for change srvtab request"
ec KADM_IMMUTABLE, "Attempt do delete immutable principal"
+# password quality basically stolen from OV libkadm5
+index 64
+prefix KADM_PASS_Q
+ec NULL, "Null passwords are not allowed"
+ec TOOSHORT, "Password is too short"
+ec CLASS, "Too few character classes in password"
+ec DICT, "Password is in the password dictionary"
end
diff --git a/crypto/kerberosIV/lib/kadm/kadm_locl.h b/crypto/kerberosIV/lib/kadm/kadm_locl.h
index e6e374b..da73df9 100644
--- a/crypto/kerberosIV/lib/kadm/kadm_locl.h
+++ b/crypto/kerberosIV/lib/kadm/kadm_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-/* $Id: kadm_locl.h,v 1.9 1997/05/20 18:40:44 bg Exp $ */
+/* $Id: kadm_locl.h,v 1.11 1998/10/05 13:56:42 joda Exp $ */
#include "config.h"
#include "protos.h"
@@ -44,6 +44,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <ctype.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -66,6 +67,9 @@
#ifdef SOCKS
#include <socks.h>
+/* This doesn't belong here. */
+struct tm *localtime(const time_t *);
+struct hostent *gethostbyname(const char *);
#endif
#include <roken.h>
diff --git a/crypto/kerberosIV/lib/kadm/kadm_stream.c b/crypto/kerberosIV/lib/kadm/kadm_stream.c
index 33fe177..d890164 100644
--- a/crypto/kerberosIV/lib/kadm/kadm_stream.c
+++ b/crypto/kerberosIV/lib/kadm/kadm_stream.c
@@ -37,23 +37,23 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: kadm_stream.c,v 1.11 1997/05/02 10:28:05 joda Exp $");
+RCSID("$Id: kadm_stream.c,v 1.13 1998/10/22 15:38:01 joda Exp $");
static int
-build_field_header(u_char *cont, u_char **st)
- /* container for fields data */
- /* stream */
+build_field_header(u_char *cont, /* container for fields data */
+ u_char **st) /* stream */
{
- *st = (u_char *) malloc (4);
+ *st = malloc (4);
+ if (*st == NULL)
+ return -1;
memcpy(*st, cont, 4);
return 4; /* return pointer to current stream location */
}
static int
-check_field_header(u_char *st, u_char *cont, int maxlen)
- /* stream */
- /* container for fields data */
-
+check_field_header(u_char *st, /* stream */
+ u_char *cont, /* container for fields data */
+ int maxlen)
{
if (4 > maxlen)
return(-1);
@@ -62,28 +62,31 @@ check_field_header(u_char *st, u_char *cont, int maxlen)
}
int
-vts_string(char *dat, u_char **st, int loc)
- /* a string to put on the stream */
- /* base pointer to the stream */
- /* offset into the stream for current data */
+vts_string(char *dat, /* a string to put on the stream */
+ u_char **st, /* base pointer to the stream */
+ int loc) /* offset into the stream for current data */
{
- *st = (u_char *) realloc (*st, (unsigned) (loc + strlen(dat) + 1));
- memcpy(*st + loc, dat, strlen(dat)+1);
+ void *tmp;
+
+ tmp = realloc(*st, loc + strlen(dat) + 1);
+ if(tmp == NULL)
+ return -1;
+ memcpy((char *)tmp + loc, dat, strlen(dat)+1);
+ *st = tmp;
return strlen(dat)+1;
}
static int
-vts_short(u_int16_t dat, u_char **st, int loc)
- /* the attributes field */
- /* a base pointer to the stream */
- /* offset into the stream for current data */
+vts_short(u_int16_t dat, /* the attributes field */
+ u_char **st, /* a base pointer to the stream */
+ int loc) /* offset into the stream for current data */
{
unsigned char *p;
+
p = realloc(*st, loc + 2);
- if(p == NULL){
- abort();
- }
+ if(p == NULL)
+ return -1;
p[loc] = (dat >> 8) & 0xff;
p[loc+1] = dat & 0xff;
*st = p;
@@ -91,30 +94,31 @@ vts_short(u_int16_t dat, u_char **st, int loc)
}
static int
-vts_char(u_char dat, u_char **st, int loc)
- /* the attributes field */
- /* a base pointer to the stream */
- /* offset into the stream for current data */
+vts_char(u_char dat, /* the attributes field */
+ u_char **st, /* a base pointer to the stream */
+ int loc) /* offset into the stream for current data */
{
- unsigned char *p = realloc(*st, loc + 1);
- if(p == NULL){
- abort();
- }
+ unsigned char *p;
+
+ p = realloc(*st, loc + 1);
+
+ if(p == NULL)
+ return -1;
p[loc] = dat;
*st = p;
return 1;
}
int
-vts_long(u_int32_t dat, u_char **st, int loc)
- /* the attributes field */
- /* a base pointer to the stream */
- /* offset into the stream for current data */
+vts_long(u_int32_t dat, /* the attributes field */
+ u_char **st, /* a base pointer to the stream */
+ int loc) /* offset into the stream for current data */
{
- unsigned char *p = realloc(*st, loc + 4);
- if(p == NULL){
- abort();
- }
+ unsigned char *p;
+
+ p = realloc(*st, loc + 4);
+ if(p == NULL)
+ return -1;
p[loc] = (dat >> 24) & 0xff;
p[loc+1] = (dat >> 16) & 0xff;
p[loc+2] = (dat >> 8) & 0xff;
@@ -131,25 +135,28 @@ stv_string(u_char *st, /* base pointer to the stream */
int maxlen) /* max length of input stream */
{
int maxcount; /* max count of chars to copy */
+ int len;
maxcount = min(maxlen - loc, stlen);
if(maxcount <= 0)
return -1;
- strncpy(dat, (char *)st + loc, maxcount);
+ len = strnlen ((char *)st + loc, maxlen - loc);
- if (dat[maxcount-1]) /* not null-term --> not enuf room */
- return(-1);
- return strlen(dat)+1;
+ if (len >= stlen)
+ return -1;
+
+ memcpy(dat, st + loc, len);
+ dat[len] = '\0';
+ return len + 1;
}
static int
-stv_short(u_char *st, u_int16_t *dat, int loc, int maxlen)
- /* a base pointer to the stream */
- /* the attributes field */
- /* offset into the stream for current data */
-
+stv_short(u_char *st, /* a base pointer to the stream */
+ u_int16_t *dat, /* the attributes field */
+ int loc, /* offset into the stream for current data */
+ int maxlen)
{
if (maxlen - loc < 2)
return -1;
@@ -159,11 +166,10 @@ stv_short(u_char *st, u_int16_t *dat, int loc, int maxlen)
}
int
-stv_long(u_char *st, u_int32_t *dat, int loc, int maxlen)
- /* a base pointer to the stream */
- /* the attributes field */
- /* offset into the stream for current data */
- /* maximum length of st */
+stv_long(u_char *st, /* a base pointer to the stream */
+ u_int32_t *dat, /* the attributes field */
+ int loc, /* offset into the stream for current data */
+ int maxlen) /* maximum length of st */
{
if (maxlen - loc < 4)
return -1;
@@ -173,11 +179,10 @@ stv_long(u_char *st, u_int32_t *dat, int loc, int maxlen)
}
static int
-stv_char(u_char *st, u_char *dat, int loc, int maxlen)
- /* a base pointer to the stream */
- /* the attributes field */
- /* offset into the stream for current data */
-
+stv_char(u_char *st, /* a base pointer to the stream */
+ u_char *dat, /* the attributes field */
+ int loc, /* offset into the stream for current data */
+ int maxlen)
{
if (maxlen - loc < 1)
return -1;
@@ -199,32 +204,56 @@ vals_to_stream(Kadm_vals *dt_in, u_char **dt_out)
int vsloop, stsize; /* loop counter, stream size */
stsize = build_field_header(dt_in->fields, dt_out);
+ if (stsize < 0)
+ return stsize;
for (vsloop=31; vsloop>=0; vsloop--)
if (IS_FIELD(vsloop,dt_in->fields)) {
+ int tmp = 0;
+
switch (vsloop) {
case KADM_NAME:
- stsize+=vts_string(dt_in->name, dt_out, stsize);
+ tmp = vts_string(dt_in->name, dt_out, stsize);
break;
case KADM_INST:
- stsize+=vts_string(dt_in->instance, dt_out, stsize);
+ tmp = vts_string(dt_in->instance, dt_out, stsize);
break;
case KADM_EXPDATE:
- stsize+=vts_long(dt_in->exp_date, dt_out, stsize);
+ tmp = vts_long(dt_in->exp_date, dt_out, stsize);
break;
case KADM_ATTR:
- stsize+=vts_short(dt_in->attributes, dt_out, stsize);
+ tmp = vts_short(dt_in->attributes, dt_out, stsize);
break;
case KADM_MAXLIFE:
- stsize+=vts_char(dt_in->max_life, dt_out, stsize);
+ tmp = vts_char(dt_in->max_life, dt_out, stsize);
break;
case KADM_DESKEY:
- stsize+=vts_long(dt_in->key_high, dt_out, stsize);
- stsize+=vts_long(dt_in->key_low, dt_out, stsize);
+ tmp = vts_long(dt_in->key_high, dt_out, stsize);
+ if(tmp > 0)
+ tmp += vts_long(dt_in->key_low, dt_out, stsize + tmp);
break;
+#ifdef EXTENDED_KADM
+ case KADM_MODDATE:
+ tmp = vts_long(dt_in->mod_date, dt_out, stsize);
+ break;
+ case KADM_MODNAME:
+ tmp = vts_string(dt_in->mod_name, dt_out, stsize);
+ break;
+ case KADM_MODINST:
+ tmp = vts_string(dt_in->mod_instance, dt_out, stsize);
+ break;
+ case KADM_KVNO:
+ tmp = vts_char(dt_in->key_version, dt_out, stsize);
+ break;
+#endif
default:
break;
}
-}
+ if (tmp < 0) {
+ free(*dt_out);
+ return tmp;
+ }
+ stsize += tmp;
+ }
return(stsize);
}
@@ -236,64 +265,89 @@ stream_to_vals
this decodes a byte stream represntation of a vals struct into kadm_vals
*/
int
-stream_to_vals(u_char *dt_in, Kadm_vals *dt_out, int maxlen)
-
-
- /* max length to use */
+stream_to_vals(u_char *dt_in,
+ Kadm_vals *dt_out,
+ int maxlen) /* max length to use */
{
- int vsloop, stsize; /* loop counter, stream size */
- int status;
+ int vsloop, stsize; /* loop counter, stream size */
+ int status;
- memset(dt_out, 0, sizeof(*dt_out));
+ memset(dt_out, 0, sizeof(*dt_out));
- stsize = check_field_header(dt_in, dt_out->fields, maxlen);
- if (stsize < 0)
- return(-1);
- for (vsloop=31; vsloop>=0; vsloop--)
- if (IS_FIELD(vsloop,dt_out->fields))
- switch (vsloop) {
- case KADM_NAME:
- if ((status = stv_string(dt_in, dt_out->name, stsize,
- sizeof(dt_out->name), maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_INST:
- if ((status = stv_string(dt_in, dt_out->instance, stsize,
- sizeof(dt_out->instance), maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_EXPDATE:
- if ((status = stv_long(dt_in, &dt_out->exp_date, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_ATTR:
- if ((status = stv_short(dt_in, &dt_out->attributes, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_MAXLIFE:
- if ((status = stv_char(dt_in, &dt_out->max_life, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- case KADM_DESKEY:
- if ((status = stv_long(dt_in, &dt_out->key_high, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- if ((status = stv_long(dt_in, &dt_out->key_low, stsize,
- maxlen)) < 0)
- return(-1);
- stsize += status;
- break;
- default:
- break;
- }
- return stsize;
+ stsize = check_field_header(dt_in, dt_out->fields, maxlen);
+ if (stsize < 0)
+ return(-1);
+ for (vsloop=31; vsloop>=0; vsloop--)
+ if (IS_FIELD(vsloop,dt_out->fields))
+ switch (vsloop) {
+ case KADM_NAME:
+ if ((status = stv_string(dt_in, dt_out->name, stsize,
+ sizeof(dt_out->name), maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_INST:
+ if ((status = stv_string(dt_in, dt_out->instance, stsize,
+ sizeof(dt_out->instance), maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_EXPDATE:
+ if ((status = stv_long(dt_in, &dt_out->exp_date, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_ATTR:
+ if ((status = stv_short(dt_in, &dt_out->attributes, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_MAXLIFE:
+ if ((status = stv_char(dt_in, &dt_out->max_life, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_DESKEY:
+ if ((status = stv_long(dt_in, &dt_out->key_high, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ if ((status = stv_long(dt_in, &dt_out->key_low, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+#ifdef EXTENDED_KADM
+ case KADM_MODDATE:
+ if ((status = stv_long(dt_in, &dt_out->mod_date, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_MODNAME:
+ if ((status = stv_string(dt_in, dt_out->mod_name, stsize,
+ sizeof(dt_out->mod_name), maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_MODINST:
+ if ((status = stv_string(dt_in, dt_out->mod_instance, stsize,
+ sizeof(dt_out->mod_instance), maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+ case KADM_KVNO:
+ if ((status = stv_char(dt_in, &dt_out->key_version, stsize,
+ maxlen)) < 0)
+ return(-1);
+ stsize += status;
+ break;
+#endif
+ default:
+ break;
+ }
+ return stsize;
}
diff --git a/crypto/kerberosIV/lib/kadm/kadm_supp.c b/crypto/kerberosIV/lib/kadm/kadm_supp.c
index 9845267..0c403eb 100644
--- a/crypto/kerberosIV/lib/kadm/kadm_supp.c
+++ b/crypto/kerberosIV/lib/kadm/kadm_supp.c
@@ -35,7 +35,13 @@ or implied warranty.
#include "kadm_locl.h"
-RCSID("$Id: kadm_supp.c,v 1.8 1997/05/02 10:27:58 joda Exp $");
+RCSID("$Id: kadm_supp.c,v 1.13 1999/03/16 09:41:20 assar Exp $");
+
+static void
+time2str(char *buf, size_t len, time_t t)
+{
+ strftime(buf, len, "%Y-%m-%d %H:%M:%S", localtime(&t));
+}
/*
prin_vals:
@@ -44,14 +50,57 @@ prin_vals:
void
prin_vals(Kadm_vals *vals)
{
- printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
- printf(" Max Life: %d (%s) Exp Date: %s\n",
- vals->max_life,
- krb_life_to_atime(vals->max_life),
- asctime(k_localtime(&vals->exp_date)));
- printf(" Attribs: %.2x key: %#lx %#lx\n",
- vals->attributes,
- (long)vals->key_low, (long)vals->key_high);
+ char date[32];
+ if(IS_FIELD(KADM_NAME, vals->fields) && IS_FIELD(KADM_INST, vals->fields))
+ printf("%20s: %s\n", "Principal",
+ krb_unparse_name_long(vals->name, vals->instance, NULL));
+ else {
+ printf("Dump of funny entry:\n");
+ if(IS_FIELD(KADM_NAME, vals->fields))
+ printf("%20s: %s\n", "Name", vals->name);
+ if(IS_FIELD(KADM_INST, vals->fields))
+ printf("%20s: %s\n", "Instance", vals->instance);
+ }
+ if(IS_FIELD(KADM_MAXLIFE, vals->fields))
+ printf("%20s: %d (%s)\n", "Max ticket life",
+ vals->max_life,
+ krb_life_to_atime(vals->max_life));
+ if(IS_FIELD(KADM_EXPDATE, vals->fields)) {
+ time2str(date, sizeof(date), vals->exp_date);
+ printf("%20s: %s\n", "Expiration date", date);
+ }
+ if(IS_FIELD(KADM_ATTR, vals->fields))
+ printf("%20s: %d\n", "Attributes",
+ vals->attributes);
+ if(IS_FIELD(KADM_DESKEY, vals->fields))
+ printf("%20s: %#lx %#lx\n", "Key",
+ (unsigned long)vals->key_low,
+ (unsigned long)vals->key_high);
+
+#ifdef EXTENDED_KADM
+ if (IS_FIELD(KADM_MODDATE,vals->fields)) {
+ time2str(date, sizeof(date), vals->mod_date);
+ printf("%20s: %s\n", "Modification date", date);
+ }
+ if (IS_FIELD(KADM_MODNAME,vals->fields) &&
+ IS_FIELD(KADM_MODINST,vals->fields))
+ printf("%20s: %s\n", "Modifier",
+ krb_unparse_name_long(vals->mod_name, vals->mod_instance, NULL));
+ if (IS_FIELD(KADM_KVNO,vals->fields))
+ printf("%20s: %d\n", "Key version", vals->key_version);
+#endif
+
+#if 0
+ printf("Info in Database for %s.%s:\n", vals->name, vals->instance);
+ printf(" Max Life: %d (%s) Exp Date: %s\n",
+ vals->max_life,
+ krb_life_to_atime(vals->max_life),
+ asctime(k_localtime(&vals->exp_date)));
+ printf(" Attribs: %.2x key: %#lx %#lx\n",
+ vals->attributes,
+ (unsigned long)vals->key_low,
+ (unsigned long)vals->key_high);
+#endif
}
/* kadm_prin_to_vals takes a fields arguments, a Kadm_vals and a Principal,
@@ -61,51 +110,79 @@ prin_vals(Kadm_vals *vals)
void
kadm_prin_to_vals(u_char *fields, Kadm_vals *new, Principal *old)
{
- memset(new, 0, sizeof(*new));
- if (IS_FIELD(KADM_NAME,fields)) {
- strncpy(new->name, old->name, ANAME_SZ);
- SET_FIELD(KADM_NAME, new->fields);
- }
- if (IS_FIELD(KADM_INST,fields)) {
- strncpy(new->instance, old->instance, INST_SZ);
- SET_FIELD(KADM_INST, new->fields);
- }
- if (IS_FIELD(KADM_EXPDATE,fields)) {
- new->exp_date = old->exp_date;
- SET_FIELD(KADM_EXPDATE, new->fields);
- }
- if (IS_FIELD(KADM_ATTR,fields)) {
- new->attributes = old->attributes;
- SET_FIELD(KADM_ATTR, new->fields);
- }
- if (IS_FIELD(KADM_MAXLIFE,fields)) {
- new->max_life = old->max_life;
- SET_FIELD(KADM_MAXLIFE, new->fields);
- }
- if (IS_FIELD(KADM_DESKEY,fields)) {
- new->key_low = old->key_low;
- new->key_high = old->key_high;
- SET_FIELD(KADM_DESKEY, new->fields);
- }
+ memset(new, 0, sizeof(*new));
+ if (IS_FIELD(KADM_NAME,fields)) {
+ strcpy_truncate(new->name, old->name, ANAME_SZ);
+ SET_FIELD(KADM_NAME, new->fields);
+ }
+ if (IS_FIELD(KADM_INST,fields)) {
+ strcpy_truncate(new->instance, old->instance, INST_SZ);
+ SET_FIELD(KADM_INST, new->fields);
+ }
+ if (IS_FIELD(KADM_EXPDATE,fields)) {
+ new->exp_date = old->exp_date;
+ SET_FIELD(KADM_EXPDATE, new->fields);
+ }
+ if (IS_FIELD(KADM_ATTR,fields)) {
+ new->attributes = old->attributes;
+ SET_FIELD(KADM_ATTR, new->fields);
+ }
+ if (IS_FIELD(KADM_MAXLIFE,fields)) {
+ new->max_life = old->max_life;
+ SET_FIELD(KADM_MAXLIFE, new->fields);
+ }
+ if (IS_FIELD(KADM_DESKEY,fields)) {
+ new->key_low = old->key_low;
+ new->key_high = old->key_high;
+ SET_FIELD(KADM_DESKEY, new->fields);
+ }
+#ifdef EXTENDED_KADM
+ if (IS_FIELD(KADM_MODDATE,fields)) {
+ new->mod_date = old->mod_date;
+ SET_FIELD(KADM_MODDATE, new->fields);
+ }
+ if (IS_FIELD(KADM_MODNAME,fields)) {
+ strcpy_truncate(new->mod_name, old->mod_name, ANAME_SZ);
+ SET_FIELD(KADM_MODNAME, new->fields);
+ }
+ if (IS_FIELD(KADM_MODINST,fields)) {
+ strcpy_truncate(new->mod_instance, old->mod_instance, ANAME_SZ);
+ SET_FIELD(KADM_MODINST, new->fields);
+ }
+ if (IS_FIELD(KADM_KVNO,fields)) {
+ new->key_version = old->key_version;
+ SET_FIELD(KADM_KVNO, new->fields);
+ }
+#endif
}
void
kadm_vals_to_prin(u_char *fields, Principal *new, Kadm_vals *old)
{
- memset(new, 0, sizeof(*new));
- if (IS_FIELD(KADM_NAME,fields))
- strncpy(new->name, old->name, ANAME_SZ);
- if (IS_FIELD(KADM_INST,fields))
- strncpy(new->instance, old->instance, INST_SZ);
- if (IS_FIELD(KADM_EXPDATE,fields))
- new->exp_date = old->exp_date;
- if (IS_FIELD(KADM_ATTR,fields))
- new->attributes = old->attributes;
- if (IS_FIELD(KADM_MAXLIFE,fields))
- new->max_life = old->max_life;
- if (IS_FIELD(KADM_DESKEY,fields)) {
- new->key_low = old->key_low;
- new->key_high = old->key_high;
- }
+ memset(new, 0, sizeof(*new));
+ if (IS_FIELD(KADM_NAME,fields))
+ strcpy_truncate(new->name, old->name, ANAME_SZ);
+ if (IS_FIELD(KADM_INST,fields))
+ strcpy_truncate(new->instance, old->instance, INST_SZ);
+ if (IS_FIELD(KADM_EXPDATE,fields))
+ new->exp_date = old->exp_date;
+ if (IS_FIELD(KADM_ATTR,fields))
+ new->attributes = old->attributes;
+ if (IS_FIELD(KADM_MAXLIFE,fields))
+ new->max_life = old->max_life;
+ if (IS_FIELD(KADM_DESKEY,fields)) {
+ new->key_low = old->key_low;
+ new->key_high = old->key_high;
+ }
+#ifdef EXTENDED_KADM
+ if (IS_FIELD(KADM_MODDATE,fields))
+ new->mod_date = old->mod_date;
+ if (IS_FIELD(KADM_MODNAME,fields))
+ strcpy_truncate(new->mod_name, old->mod_name, ANAME_SZ);
+ if (IS_FIELD(KADM_MODINST,fields))
+ strcpy_truncate(new->mod_instance, old->mod_instance, ANAME_SZ);
+ if (IS_FIELD(KADM_KVNO,fields))
+ new->key_version = old->key_version;
+#endif
}
diff --git a/crypto/kerberosIV/lib/kafs/ChangeLog b/crypto/kerberosIV/lib/kafs/ChangeLog
new file mode 100644
index 0000000..e32b7ed
--- /dev/null
+++ b/crypto/kerberosIV/lib/kafs/ChangeLog
@@ -0,0 +1,117 @@
+1999-07-22 Assar Westerlund <assar@sics.se>
+
+ * afssysdefs.h: define AFS_SYSCALL to 73 for Solaris 2.7
+
+1999-07-07 Assar Westerlund <assar@sics.se>
+
+ * afskrb5.c (krb5_realm_of_cell): new function
+
+ * afskrb.c (krb_realm_of_cell): new function
+ (afslog_uid_int): call krb_get_lrealm correctly
+
+1999-06-15 Assar Westerlund <assar@sics.se>
+
+ * common.c (realm_of_cell): rename to _kafs_realm_of_cell and
+ un-staticize
+
+Fri Mar 19 14:52:29 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: add version-info
+
+Thu Mar 18 11:24:02 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: include Makefile.am.common
+
+Sat Feb 27 19:46:21 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: remove EXTRA_DATA (as of autoconf 2.13/automake
+ 1.4)
+
+Thu Feb 11 22:57:37 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: set AIX_SRC also if !AIX
+
+Tue Dec 1 14:45:15 1998 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: fix AIX linkage
+
+Sun Nov 22 10:40:44 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (WFLAGS): set
+
+Sat Nov 21 16:55:19 1998 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * afskrb5.c: add homedir support
+
+Sun Sep 6 20:16:27 1998 Assar Westerlund <assar@sics.se>
+
+ * add new functionality for specifying the homedir to krb_afslog
+ et al
+
+Thu Jul 16 01:27:19 1998 Assar Westerlund <assar@sics.se>
+
+ * afssys.c: reorganize order of definitions.
+ (try_one, try_two): conditionalize
+
+Thu Jul 9 18:31:52 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * common.c (realm_of_cell): make the dns fallback work
+
+Wed Jul 8 01:39:44 1998 Assar Westerlund <assar@sics.se>
+
+ * afssys.c (map_syscall_name_to_number): new function for finding
+ the number of a syscall given the name on solaris
+ (k_hasafs): try using map_syscall_name_to_number
+
+Tue Jun 30 17:19:00 1998 Assar Westerlund <assar@sics.se>
+
+ * afssys.c: rewrite and add support for environment variable
+ AFS_SYSCALL
+
+ * Makefile.in (distclean): don't remove roken_rename.h
+
+Fri May 29 19:03:20 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (roken_rename.h): remove dependency
+
+Mon May 25 05:25:54 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (clean): try to remove shared library debris
+
+Sun Apr 19 09:58:40 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in: add symlink magic for linux
+
+Sat Apr 4 15:08:48 1998 Assar Westerlund <assar@sics.se>
+
+ * kafs.h: add arla paths
+
+ * common.c (_kafs_afslog_all_local_cells): Try _PATH_ARLA_*
+ (_realm_of_cell): Try _PATH_ARLA_CELLSERVDB
+
+Thu Feb 19 14:50:22 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * common.c: Don't store expired tokens (this broke when using
+ pag-less rsh-sessions, and `non-standard' ticket files).
+
+Thu Feb 12 11:20:15 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * Makefile.in: Install/uninstall one library at a time.
+
+Thu Feb 12 05:38:58 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (install): one library at a time.
+
+Mon Feb 9 23:40:32 1998 Assar Westerlund <assar@sics.se>
+
+ * common.c (find_cells): ignore empty lines
+
+Tue Jan 6 04:25:58 1998 Assar Westerlund <assar@sics.se>
+
+ * afssysdefs.h (AFS_SYSCALL): add FreeBSD
+
+Fri Jan 2 17:08:24 1998 Assar Westerlund <assar@sics.se>
+
+ * kafs.h: new VICEIOCTL's. From <rb@stacken.kth.se>
+
+ * afssysdefs.h: Add OpenBSD
diff --git a/crypto/kerberosIV/lib/kafs/Makefile.am b/crypto/kerberosIV/lib/kafs/Makefile.am
new file mode 100644
index 0000000..f6afbc7
--- /dev/null
+++ b/crypto/kerberosIV/lib/kafs/Makefile.am
@@ -0,0 +1,69 @@
+# $Id: Makefile.am,v 1.13 1999/03/21 14:08:14 joda Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+INCLUDES += $(INCLUDE_krb4) $(AFS_EXTRA_DEFS)
+
+if KRB4
+AFSLIBS = libkafs.la
+else
+AFSLIBS =
+endif
+
+if AIX
+AFSL_EXP = $(srcdir)/afsl.exp
+
+if AIX4
+AFS_EXTRA_LD = -bnoentry
+else
+AFS_EXTRA_LD = -e _nostart
+endif
+
+if AIX_DYNAMIC_AFS
+if HAVE_DLOPEN
+AIX_SRC =
+else
+AIX_SRC = dlfcn.c
+endif
+AFS_EXTRA_LIBS = afslib.so
+AFS_EXTRA_DEFS =
+else
+AIX_SRC = afslib.c
+AFS_EXTRA_LIBS =
+AFS_EXTRA_DEFS = -DSTATIC_AFS
+endif
+
+else
+AFSL_EXP =
+AIX_SRC =
+endif # AIX
+
+
+lib_LTLIBRARIES = $(AFSLIBS)
+libkafs_la_LDFLAGS = -version-info 0:0:0
+foodir = $(libdir)
+foo_DATA = $(AFS_EXTRA_LIBS)
+# EXTRA_DATA = afslib.so
+
+CLEANFILES= $(AFS_EXTRA_LIBS)
+
+include_HEADERS = kafs.h
+
+if KRB5
+afskrb5_c = afskrb5.c
+endif
+
+libkafs_la_SOURCES = afssys.c afskrb.c $(afskrb5_c) common.c $(AIX_SRC) kafs_locl.h afssysdefs.h
+#afslib_so_SOURCES = afslib.c
+
+EXTRA_libkafs_la_SOURCES = afskrb5.c dlfcn.c afslib.c dlfcn.h
+
+EXTRA_DIST = README.dlfcn afsl.exp afslib.exp
+
+
+# AIX: this almost works with gcc, but somehow it fails to use the
+# correct ld, use ld instead
+afslib.so: afslib.o
+ ld -o $@ -bM:SRE -bI:$(srcdir)/afsl.exp -bE:$(srcdir)/afslib.exp $(AFS_EXTRA_LD) afslib.o -lc
+
+$(OBJECTS): ../../include/config.h
diff --git a/crypto/kerberosIV/lib/kafs/Makefile.in b/crypto/kerberosIV/lib/kafs/Makefile.in
index e9c9121..3a44f79 100644
--- a/crypto/kerberosIV/lib/kafs/Makefile.in
+++ b/crypto/kerberosIV/lib/kafs/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.30 1997/05/06 03:47:35 assar Exp $
+# $Id: Makefile.in,v 1.49 1999/03/10 19:01:15 joda Exp $
#
SHELL = /bin/sh
@@ -8,10 +8,13 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
-DEFS = @DEFS@ -DLIBDIR='"$(libdir)"'
-CFLAGS = @CFLAGS@
+LN_S = @LN_S@
+DEFS = @DEFS@ -DROKEN_RENAME -DLIBDIR='"$(libdir)"' @AFS_EXTRA_DEFS@
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -23,17 +26,26 @@ libdir = @libdir@
PICFLAGS = @PICFLAGS@
+LIB_DEPS = @lib_deps_yes@ -lc
+build_symlink_command = @build_symlink_command@
+install_symlink_command = @install_symlink_command@
+
LIBNAME = $(LIBPREFIX)kafs
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
LIBPREFIX = @LIBPREFIX@
LDSHARED = @LDSHARED@
+AFS_EXTRA_OBJS = @AFS_EXTRA_OBJS@
AFS_EXTRA_LIBS = @AFS_EXTRA_LIBS@
LIB = $(LIBNAME).$(LIBEXT) $(AFS_EXTRA_LIBS)
-SOURCES = afssys.c afskrb.c afslib.c
+SOURCES = afssys.c afskrb.c common.c afslib.c
+
+EXTRA_SOURCE = issuid.c strcpy_truncate.c strcat_truncate.c
+
+EXTRA_OBJECT = issuid.o strcpy_truncate.o strcat_truncate.o
-OBJECTS = afssys.o afskrb.o
+OBJECTS = afssys.o afskrb.o common.o $(EXTRA_OBJECT) $(AFS_EXTRA_OBJS)
all: $(LIB)
@@ -41,14 +53,19 @@ Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I../../include -I$(srcdir) -I. $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ @for i in $(LIB); do \
+ echo "$(INSTALL) -m 0555 $$i $(DESTDIR)$(libdir)/$$i" ;\
+ $(INSTALL) -m 0555 $$i $(DESTDIR)$(libdir)/$$i ; done
+ @install_symlink_command@
uninstall:
- rm -f $(libdir)/$(LIB)
+ @for i in $(LIB); do \
+ echo "rm -f $(DESTDIR)$(libdir)/$$i" ;\
+ rm -f $(DESTDIR)$(libdir)/$$i ; done
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -56,35 +73,45 @@ TAGS: $(SOURCES)
check:
clean:
- rm -f $(LIB) *.o *.a
+ rm -f $(LIB) *.o *.a *.so *.so.* so_locations $(EXTRA_SOURCE)
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c *~
+ rm -f Makefile *.tab.c *~ roken_rename.h
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
-$(LIBNAME).a: $(OBJECTS) @AFS_EXTRA_OBJS@
+$(LIBNAME).a: $(OBJECTS)
rm -f $@
- $(AR) cr $@ $(OBJECTS) @AFS_EXTRA_OBJS@
+ $(AR) cr $@ $(OBJECTS)
-$(RANLIB) $@
$(LIBNAME).$(SHLIBEXT): $(OBJECTS)
rm -f $@
- $(LDSHARED) -o $@ $(OBJECTS)
+ $(LDSHARED) -o $@ $(OBJECTS) $(LIB_DEPS)
+ @build_symlink_command@
# AIX: this almost works with gcc, but somehow it fails to use the
# correct ld, use ld instead
afslib.so: afslib.o
- ld -o $@ -bM:SRE -bI:$(srcdir)/afsl.exp -bE:$(srcdir)/afslib.exp -bnoentry afslib.o
+ ld -o $@ -bM:SRE -bI:$(srcdir)/afsl.exp -bE:$(srcdir)/afslib.exp @AFS_EXTRA_LD@ afslib.o -lc
+
+$(OBJECTS): ../../include/config.h roken_rename.h
+
+roken_rename.h:
+ $(LN_S) $(srcdir)/../krb/roken_rename.h .
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
+
+issuid.c:
+ $(LN_S) $(srcdir)/../roken/issuid.c .
+
+strcat_truncate.c:
+ $(LN_S) $(srcdir)/../roken/strcat_truncate.c .
+
+strcpy_truncate.c:
+ $(LN_S) $(srcdir)/../roken/strcpy_truncate.c .
-$(OBJECTS): ../../include/config.h
diff --git a/crypto/kerberosIV/lib/kafs/README.dlfcn b/crypto/kerberosIV/lib/kafs/README.dlfcn
new file mode 100644
index 0000000..cee1b75
--- /dev/null
+++ b/crypto/kerberosIV/lib/kafs/README.dlfcn
@@ -0,0 +1,246 @@
+Copyright (c) 1992,1993,1995,1996, Jens-Uwe Mager, Helios Software GmbH
+Not derived from licensed software.
+
+Permission is granted to freely use, copy, modify, and redistribute
+this software, provided that the author is not construed to be liable
+for any results of using the software, alterations are clearly marked
+as such, and this notice is not modified.
+
+libdl.a
+-------
+
+This is an emulation library to emulate the SunOS/System V.4 functions
+to access the runtime linker. The functions are emulated by using the
+AIX load() function and by reading the .loader section of the loaded
+module to find the exports. The to be loaded module should be linked as
+follows (if using AIX 3):
+
+ cc -o module.so -bM:SRE -bE:module.exp -e _nostart $(OBJS)
+
+For AIX 4:
+
+ cc -o module.so -bM:SRE -bE:module.exp -bnoentry $(OBJS)
+
+If you want to reference symbols from the main part of the program in a
+loaded module, you will have to link against the export file of the
+main part:
+
+ cc -o main -bE:main.exp $(MAIN_OBJS)
+ cc -o module.so -bM:SRE -bI:main.exp -bE:module.exp -bnoentry $(OBJS)
+
+Note that you explicitely have to specify what functions are supposed
+to be accessible from your loaded modules, this is different from
+SunOS/System V.4 where any global is automatically exported. If you
+want to export all globals, the following script might be of help:
+
+#!/bin/sh
+/usr/ucb/nm -g $* | awk '$2 == "B" || $2 == "D" { print $3 }'
+
+The module export file contains the symbols to be exported. Because
+this library uses the loader section, the final module.so file can be
+stripped. C++ users should build their shared objects using the script
+makeC++SharedLib (part of the IBM C++ compiler), this will make sure
+that constructors and destructors for static and global objects will be
+called upon loading and unloading the module. GNU C++ users should use
+the -shared option to g++ to link the shared object:
+
+ g++ -o module.so -shared $(OBJS)
+
+If the shared object does have permissions for anybody, the shared
+object will be loaded into the shared library segment and it will stay
+there even if the main application terminates. If you rebuild your
+shared object after a bugfix and you want to make sure that you really
+get the newest version you will have to use the "slibclean" command
+before starting the application again to garbage collect the shared
+library segment. If the performance utilities (bosperf) are installed
+you can use the following command to see what shared objects are
+loaded:
+
+/usr/lpp/bosperf/genkld | sort | uniq
+
+For easier debugging you can avoid loading the shared object into the
+shared library segment alltogether by removing permissions for others
+from the module.so file:
+
+chmod o-rwx module.so
+
+This will ensure you get a fresh copy of the shared object for every
+dlopen() call which is loaded into the application's data segment.
+
+Usage
+-----
+
+void *dlopen(const char *path, int mode);
+
+This routine loads the module pointed to by path and reads its export
+table. If the path does not contain a '/' character, dlopen will search
+for the module using the LIBPATH environment variable. It returns an
+opaque handle to the module or NULL on error. The mode parameter can be
+either RTLD_LAZY (for lazy function binding) or RTLD_NOW for immediate
+function binding. The AIX implementation currently does treat RTLD_NOW
+the same as RTLD_LAZY. The flag RTLD_GLOBAL might be or'ed into the
+mode parameter to allow loaded modules to bind to global variables or
+functions in other loaded modules loaded by dlopen(). If RTLD_GLOBAL is
+not specified, only globals from the main part of the executable or
+shared libraries are used to look for undefined symbols in loaded
+modules.
+
+
+void *dlsym(void *handle, const char *symbol);
+
+This routine searches for the symbol in the module referred to by
+handle and returns its address. If the symbol could not be found, the
+function returns NULL. The return value must be casted to a proper
+function pointer before it can be used. SunOS/System V.4 allows handle
+to be a NULL pointer to refer to the module the call is made from, this
+is not implemented.
+
+int dlclose(void *handle);
+
+This routine unloads the module referred to by the handle and disposes
+of any local storage. this function returns -1 on failure. Any function
+pointers obtained through dlsym() should be considered invalid after
+closing a module.
+
+As AIX caches shared objects in the shared library segment, function
+pointers obtained through dlsym() might still work even though the
+module has been unloaded. This can introduce subtle bugs that will
+segment fault later if AIX garbage collects or immediatly on
+SunOS/System V.4 as the text segment is unmapped.
+
+char *dlerror(void);
+
+This routine can be used to retrieve a text message describing the most
+recent error that occured on on of the above routines. This function
+returns NULL if there is no error information.
+
+Initialization and termination handlers
+---------------------------------------
+
+The emulation provides for an initialization and a termination
+handler. The dlfcn.h file contains a structure declaration named
+dl_info with following members:
+
+ void (*init)(void);
+ void (*fini)(void);
+
+The init function is called upon first referencing the library. The
+fini function is called at dlclose() time or when the process exits.
+The module should declare a variable named dl_info that contains this
+structure which must be exported. These functions correspond to the
+documented _init() and _fini() functions of SunOS 4.x, but these are
+appearently not implemented in SunOS. When using SunOS 5.0, these
+correspond to #pragma init and #pragma fini respectively. At the same
+time any static or global C++ object's constructors or destructors will
+be called.
+
+BUGS
+----
+
+Please note that there is currently a problem with implicitely loaded
+shared C++ libaries: if you refer to a shared C++ library from a loaded
+module that is not yet used by the main program, the dlopen() emulator
+does not notice this and does not call the static constructors for the
+implicitely loaded library. This can be easily demonstrated by
+referencing the C++ standard streams from a loaded module if the main
+program is a plain C program.
+
+Jens-Uwe Mager
+
+HELIOS Software GmbH
+Lavesstr. 80
+30159 Hannover
+Germany
+
+Phone: +49 511 36482-0
+FAX: +49 511 36482-69
+AppleLink: helios.de/jum
+Internet: jum@helios.de
+
+Revison History
+---------------
+
+SCCS/s.dlfcn.h:
+
+D 1.4 95/04/25 09:36:52 jum 4 3 00018/00004/00028
+MRs:
+COMMENTS:
+added RTLD_GLOBAL, include and C++ guards
+
+D 1.3 92/12/27 20:58:32 jum 3 2 00001/00001/00031
+MRs:
+COMMENTS:
+we always have prototypes on RS/6000
+
+D 1.2 92/08/16 17:45:11 jum 2 1 00009/00000/00023
+MRs:
+COMMENTS:
+added dl_info structure to implement initialize and terminate functions
+
+D 1.1 92/08/02 18:08:45 jum 1 0 00023/00000/00000
+MRs:
+COMMENTS:
+Erstellungsdatum und -uhrzeit 92/08/02 18:08:45 von jum
+
+SCCS/s.dlfcn.c:
+
+D 1.11 96/04/10 20:12:51 jum 13 12 00037/00000/00533
+MRs:
+COMMENTS:
+Integrated the changes from John W. Eaton <jwe@bevo.che.wisc.edu> to initialize
+g++ generated shared objects.
+
+D 1.10 96/02/15 17:42:44 jum 12 10 00012/00007/00521
+MRs:
+COMMENTS:
+the C++ constructor and destructor chains are now called properly for either
+xlC 2 or xlC 3 (CSet++).
+
+D 1.9 95/09/22 11:09:38 markus 10 9 00001/00008/00527
+MRs:
+COMMENTS:
+Fix version number
+
+D 1.8 95/09/22 10:14:34 markus 9 8 00008/00001/00527
+MRs:
+COMMENTS:
+Added version number for dl lib
+
+D 1.7 95/08/14 19:08:38 jum 8 6 00026/00004/00502
+MRs:
+COMMENTS:
+Integrated the fixes from Kirk Benell (kirk@rsinc.com) to allow loading of
+shared objects generated under AIX 4. Fixed bug that symbols with exactly
+8 characters would use garbage characters from the following symbol value.
+
+D 1.6 95/04/25 09:38:03 jum 6 5 00046/00006/00460
+MRs:
+COMMENTS:
+added handling of C++ static constructors and destructors, added RTLD_GLOBAL to bind against other loaded modules
+
+D 1.5 93/02/14 20:14:17 jum 5 4 00002/00000/00464
+MRs:
+COMMENTS:
+added path to dlopen error message to make clear where there error occured.
+
+D 1.4 93/01/03 19:13:56 jum 4 3 00061/00005/00403
+MRs:
+COMMENTS:
+to allow calling symbols in the main module call load with L_NOAUTODEFER and
+do a loadbind later with the main module.
+
+D 1.3 92/12/27 20:59:55 jum 3 2 00066/00008/00342
+MRs:
+COMMENTS:
+added search by L_GETINFO if module got loaded by LIBPATH
+
+D 1.2 92/08/16 17:45:43 jum 2 1 00074/00006/00276
+MRs:
+COMMENTS:
+implemented initialize and terminate functions, added reference counting to avoid multiple loads of the same library
+
+D 1.1 92/08/02 18:08:45 jum 1 0 00282/00000/00000
+MRs:
+COMMENTS:
+Erstellungsdatum und -uhrzeit 92/08/02 18:08:45 von jum
+
diff --git a/crypto/kerberosIV/lib/kafs/afskrb.c b/crypto/kerberosIV/lib/kafs/afskrb.c
index d979ac5..4da459c 100644
--- a/crypto/kerberosIV/lib/kafs/afskrb.c
+++ b/crypto/kerberosIV/lib/kafs/afskrb.c
@@ -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.
*
@@ -38,336 +38,104 @@
#include "kafs_locl.h"
-RCSID("$Id: afskrb.c,v 1.6 1997/05/26 17:38:24 bg Exp $");
+RCSID("$Id: afskrb.c,v 1.11 1999/07/07 12:29:33 assar Exp $");
-#define AUTH_SUPERUSER "afs"
-
-/*
- * Here only ASCII characters are relevant.
- */
-
-#define IsAsciiLower(c) ('a' <= (c) && (c) <= 'z')
-
-#define ToAsciiUpper(c) ((c) - 'a' + 'A')
-
-static void
-foldup(char *a, const char *b)
-{
- for (; *b; a++, b++)
- if (IsAsciiLower(*b))
- *a = ToAsciiUpper(*b);
- else
- *a = *b;
- *a = '\0';
-}
+struct krb_kafs_data {
+ const char *realm;
+};
static int
-get_cred(const char *princ, const char *inst, const char *krealm,
- CREDENTIALS *c, KTEXT_ST *tkt)
+get_cred(kafs_data *data, const char *name, const char *inst,
+ const char *realm, CREDENTIALS *c)
{
- int k_errno = krb_get_cred((char*)princ, (char*)inst, (char*)krealm, c);
-
- if (k_errno != KSUCCESS)
- {
- k_errno = krb_mk_req(tkt, (char*)princ, (char*)inst, (char*)krealm, 0);
- if (k_errno == KSUCCESS)
- k_errno = krb_get_cred((char*)princ, (char*)inst, (char*)krealm, c);
+ KTEXT_ST tkt;
+ int ret = krb_get_cred((char*)name, (char*)inst, (char*)realm, c);
+
+ if (ret) {
+ ret = krb_mk_req(&tkt, (char*)name, (char*)inst, (char*)realm, 0);
+ if (ret == KSUCCESS)
+ ret = krb_get_cred((char*)name, (char*)inst, (char*)realm, c);
}
- return k_errno;
-}
-
-
-/* Convert a string to a 32 bit ip number in network byte order.
- Return 0 on error
- */
-
-static u_int32_t
-ip_aton(char *ip)
-{
- u_int32_t addr;
- unsigned int a, b, c, d;
-
- if(sscanf(ip, "%u.%u.%u.%u", &a, &b, &c, &d) != 4)
- return 0;
- if((a | b | c | d) > 255)
- return 0;
- addr = (a << 24) | (b << 16) | (c << 8) | d;
- addr = htonl(addr);
- return addr;
+ return ret;
}
-/* Try to get a db-server for an AFS cell from a AFSDB record */
-
static int
-dns_find_cell(const char *cell, char *dbserver)
+afslog_uid_int(kafs_data *data, const char *cell, uid_t uid,
+ const char *homedir)
{
- struct dns_reply *r;
- int ok = -1;
- r = dns_lookup(cell, "afsdb");
- if(r){
- struct resource_record *rr = r->head;
- while(rr){
- if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
- strncpy(dbserver, rr->u.afsdb->domain, MaxHostNameLen);
- dbserver[MaxHostNameLen - 1] = 0;
- ok = 0;
- break;
- }
- rr = rr->next;
- }
- dns_free_data(r);
- }
- return ok;
-}
-
+ int ret;
+ CREDENTIALS c;
+ struct krb_kafs_data *d = data->data;
+ char realm[REALM_SZ], *lrealm;
+
+ if (cell == 0 || cell[0] == 0)
+ return _kafs_afslog_all_local_cells (data, uid, homedir);
-/* Find the realm associated with cell. Do this by opening
- /usr/vice/etc/CellServDB and getting the realm-of-host for the
- first VL-server for the cell.
+ ret = krb_get_lrealm(realm, 1);
+ if(ret == KSUCCESS && (d->realm == NULL || strcmp(d->realm, realm)))
+ lrealm = realm;
+ else
+ lrealm = NULL;
- This does not work when the VL-server is living in one cell, but
- the cell it is serving is living in another cell.
- */
+ ret = _kafs_get_cred(data, cell, d->realm, lrealm, &c);
+
+ if(ret == 0)
+ ret = kafs_settoken(cell, uid, &c);
+ return ret;
+}
-static char*
-realm_of_cell(const char *cell)
+static char *
+get_realm(kafs_data *data, const char *host)
{
- FILE *F;
- char buf[1024];
- u_int32_t addr;
- struct hostent *hp;
- char *realm = NULL;
-
- if((F = fopen(_PATH_CELLSERVDB, "r"))){
- while(fgets(buf, sizeof(buf), F)){
- if(buf[0] != '>')
- continue;
- if(strncmp(buf + 1, cell, strlen(cell)) == 0){
- if(fgets(buf, sizeof(buf), F) == NULL)
- break;
- addr = ip_aton(buf);
- if(addr == 0)
- break;
- hp = gethostbyaddr((char*)&addr, 4, AF_INET);
- if(hp == NULL)
- break;
- strncpy (buf, hp->h_name, sizeof(buf));
- buf[sizeof(buf) - 1] = '\0';
- realm = krb_realmofhost(buf);
- break;
- }
- }
- fclose(F);
- }
- if(realm == NULL){
- if(dns_find_cell(cell, buf) == 0)
- realm = krb_realmofhost(buf);
- }
- return realm;
+ char *r = krb_realmofhost(host);
+ if(r != NULL)
+ return strdup(r);
+ else
+ return NULL;
}
-/*
- * Get tokens for all cells[]
- */
-static int
-k_afslog_cells(char *cells[], int max, const char *krealm, uid_t uid)
+int
+krb_afslog_uid_home(const char *cell, const char *realm, uid_t uid,
+ const char *homedir)
{
- int err = KSUCCESS;
- int i;
- for(i = 0; i < max; i++)
- err = k_afsklog_uid(cells[i], krealm, uid);
- return err;
+ kafs_data kd;
+ struct krb_kafs_data d;
+
+ kd.afslog_uid = afslog_uid_int;
+ kd.get_cred = get_cred;
+ kd.get_realm = get_realm;
+ kd.data = &d;
+ d.realm = realm;
+ return afslog_uid_int(&kd, cell, uid, homedir);
}
-/*
- * Try to find the cells we should try to klog to in "file".
- */
-static void
-k_find_cells(char *file, char *cells[], int size, int *index)
+int
+krb_afslog_uid(const char *cell, const char *realm, uid_t uid)
{
- FILE *f;
- char cell[64];
- int i;
- f = fopen(file, "r");
- if (f == NULL)
- return;
- while (*index < size && fgets(cell, sizeof(cell), f)) {
- char *nl = strchr(cell, '\n');
- if (nl) *nl = 0;
- for(i = 0; i < *index; i++)
- if(strcmp(cells[i], cell) == 0)
- break;
- if(i == *index)
- cells[(*index)++] = strdup(cell);
- }
- fclose(f);
+ return krb_afslog_uid_home (cell, realm, uid, NULL);
}
-static int
-k_afsklog_all_local_cells(const char *krealm, uid_t uid)
+int
+krb_afslog(const char *cell, const char *realm)
{
- int err;
- char *cells[32]; /* XXX */
- int num_cells = sizeof(cells) / sizeof(cells[0]);
- int index = 0;
-
- char *p;
-
- if ((p = getenv("HOME"))) {
- char home[MaxPathLen];
-
- if (k_concat(home, sizeof(home), p, "/.TheseCells", NULL) == 0)
- k_find_cells(home, cells, num_cells, &index);
- }
- k_find_cells(_PATH_THESECELLS, cells, num_cells, &index);
- k_find_cells(_PATH_THISCELL, cells, num_cells, &index);
-
- err = k_afslog_cells(cells, index, krealm, uid);
- while(index > 0)
- free(cells[--index]);
- return err;
+ return krb_afslog_uid (cell, realm, getuid());
}
int
-k_afsklog_uid(const char *cell, const char *krealm, uid_t uid)
+krb_afslog_home(const char *cell, const char *realm, const char *homedir)
{
- int k_errno;
- CREDENTIALS c;
- KTEXT_ST ticket;
- char realm[REALM_SZ];
- char *vl_realm; /* realm of vl-server */
- char *lrealm; /* local realm */
- char CELL[64];
-
- if (cell == 0 || cell[0] == 0)
- return k_afsklog_all_local_cells (krealm, uid);
- foldup(CELL, cell);
-
- k_errno = krb_get_lrealm(realm , 0);
- if(k_errno == KSUCCESS && (krealm == NULL || strcmp(krealm, realm)))
- lrealm = realm;
- else
- lrealm = NULL;
-
- /* We're about to find the the realm that holds the key for afs in
- * the specified cell. The problem is that null-instance
- * afs-principals are common and that hitting the wrong realm might
- * yield the wrong afs key. The following assumptions were made.
- *
- * Any realm passed to us is preferred.
- *
- * If there is a realm with the same name as the cell, it is most
- * likely the correct realm to talk to.
- *
- * In most (maybe even all) cases the database servers of the cell
- * will live in the realm we are looking for.
- *
- * Try the local realm, but if the previous cases fail, this is
- * really a long shot.
- *
- */
-
- /* comments on the ordering of these tests */
-
- /* If the user passes a realm, she probably knows something we don't
- * know and we should try afs@krealm (otherwise we're talking with a
- * blondino and she might as well have it.)
- */
-
- k_errno = -1;
- if(krealm){
- k_errno = get_cred(AUTH_SUPERUSER, cell, krealm, &c, &ticket);
- if(k_errno)
- k_errno = get_cred(AUTH_SUPERUSER, "", krealm, &c, &ticket);
- }
-
- if(k_errno)
- k_errno = get_cred(AUTH_SUPERUSER, cell, CELL, &c, &ticket);
- if(k_errno)
- k_errno = get_cred(AUTH_SUPERUSER, "", CELL, &c, &ticket);
-
- /* this might work in some conditions */
- if(k_errno && (vl_realm = realm_of_cell(cell))){
- k_errno = get_cred(AUTH_SUPERUSER, cell, vl_realm, &c, &ticket);
- if(k_errno)
- k_errno = get_cred(AUTH_SUPERUSER, "", vl_realm, &c, &ticket);
- }
-
- if(k_errno && lrealm){
- k_errno = get_cred(AUTH_SUPERUSER, cell, lrealm, &c, &ticket);
-#if 0
- /* this is most likely never right anyway, but won't fail */
- if(k_errno)
- k_errno = get_cred(AUTH_SUPERUSER, "", lrealm, &c, &ticket);
-#endif
- }
-
- if (k_errno == KSUCCESS)
- {
- struct ViceIoctl parms;
- struct ClearToken ct;
- int32_t sizeof_x;
- char buf[2048], *t;
-
- /*
- * Build a struct ClearToken
- */
- ct.AuthHandle = c.kvno;
- memcpy (ct.HandShakeKey, c.session, sizeof(c.session));
- ct.ViceId = uid; /* is this always valid? */
- ct.BeginTimestamp = 1 + c.issue_date;
- ct.EndTimestamp = krb_life_to_time(c.issue_date, c.lifetime);
-
-#define ODD(x) ((x) & 1)
- /* If we don't know the numerical ID lifetime should be even? */
- if (uid == 0 && ODD(ct.EndTimestamp - ct.BeginTimestamp))
- ct.BeginTimestamp--;
-
- t = buf;
- /*
- * length of secret token followed by secret token
- */
- sizeof_x = c.ticket_st.length;
- memcpy(t, &sizeof_x, sizeof(sizeof_x));
- t += sizeof(sizeof_x);
- memcpy(t, c.ticket_st.dat, sizeof_x);
- t += sizeof_x;
- /*
- * length of clear token followed by clear token
- */
- sizeof_x = sizeof(ct);
- memcpy(t, &sizeof_x, sizeof(sizeof_x));
- t += sizeof(sizeof_x);
- memcpy(t, &ct, sizeof_x);
- t += sizeof_x;
-
- /*
- * do *not* mark as primary cell
- */
- sizeof_x = 0;
- memcpy(t, &sizeof_x, sizeof(sizeof_x));
- t += sizeof(sizeof_x);
- /*
- * follow with cell name
- */
- sizeof_x = strlen(cell) + 1;
- memcpy(t, cell, sizeof_x);
- t += sizeof_x;
-
- /*
- * Build argument block
- */
- parms.in = buf;
- parms.in_size = t - buf;
- parms.out = 0;
- parms.out_size = 0;
- k_pioctl(0, VIOCSETTOK, &parms, 0);
- }
- return k_errno;
+ return krb_afslog_uid_home (cell, realm, getuid(), homedir);
}
+/*
+ *
+ */
+
int
-k_afsklog(const char *cell, const char *krealm)
+krb_realm_of_cell(const char *cell, char **realm)
{
- return k_afsklog_uid (cell, krealm, getuid());
+ kafs_data kd;
+
+ kd.get_realm = get_realm;
+ return _kafs_realm_of_cell(&kd, cell, realm);
}
diff --git a/crypto/kerberosIV/lib/kafs/afskrb5.c b/crypto/kerberosIV/lib/kafs/afskrb5.c
new file mode 100644
index 0000000..a25dd7e
--- /dev/null
+++ b/crypto/kerberosIV/lib/kafs/afskrb5.c
@@ -0,0 +1,177 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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 "kafs_locl.h"
+
+RCSID("$Id: afskrb5.c,v 1.7 1999/07/07 12:30:06 assar Exp $");
+
+struct krb5_kafs_data {
+ krb5_context context;
+ krb5_ccache id;
+ krb5_const_realm realm;
+};
+
+static int
+get_cred(kafs_data *data, const char *name, const char *inst,
+ const char *realm, CREDENTIALS *c)
+{
+ krb5_error_code ret;
+ krb5_creds in_creds, *out_creds;
+ struct krb5_kafs_data *d = data->data;
+
+ memset(&in_creds, 0, sizeof(in_creds));
+ ret = krb5_425_conv_principal(d->context, name, inst, realm,
+ &in_creds.server);
+ if(ret)
+ return ret;
+ ret = krb5_cc_get_principal(d->context, d->id, &in_creds.client);
+ if(ret){
+ krb5_free_principal(d->context, in_creds.server);
+ return ret;
+ }
+ ret = krb5_get_credentials(d->context, 0, d->id, &in_creds, &out_creds);
+ krb5_free_principal(d->context, in_creds.server);
+ krb5_free_principal(d->context, in_creds.client);
+ if(ret)
+ return ret;
+ ret = krb524_convert_creds_kdc(d->context, out_creds, c);
+ krb5_free_creds(d->context, out_creds);
+ return ret;
+}
+
+static krb5_error_code
+afslog_uid_int(kafs_data *data, const char *cell, uid_t uid,
+ const char *homedir)
+{
+ krb5_error_code ret;
+ CREDENTIALS c;
+ krb5_realm lrealm; /* local realm */
+ struct krb5_kafs_data *d = data->data;
+
+ if (cell == 0 || cell[0] == 0)
+ return _kafs_afslog_all_local_cells (data, uid, homedir);
+
+ ret = krb5_get_default_realm(d->context, &lrealm);
+ if(ret || (d->realm && strcmp(d->realm, lrealm) == 0)){
+ free(lrealm);
+ lrealm = NULL;
+ }
+
+ ret = _kafs_get_cred(data, cell, d->realm, lrealm, &c);
+ if(lrealm)
+ free(lrealm);
+
+ if(ret == 0)
+ ret = kafs_settoken(cell, uid, &c);
+ return ret;
+}
+
+static char *
+get_realm(kafs_data *data, const char *host)
+{
+ struct krb5_kafs_data *d = data->data;
+ krb5_realm *realms;
+ char *r;
+ if(krb5_get_host_realm(d->context, host, &realms))
+ return NULL;
+ r = strdup(realms[0]);
+ krb5_free_host_realm(d->context, realms);
+ return r;
+}
+
+krb5_error_code
+krb5_afslog_uid_home(krb5_context context,
+ krb5_ccache id,
+ const char *cell,
+ krb5_const_realm realm,
+ uid_t uid,
+ const char *homedir)
+{
+ kafs_data kd;
+ struct krb5_kafs_data d;
+ kd.afslog_uid = afslog_uid_int;
+ kd.get_cred = get_cred;
+ kd.get_realm = get_realm;
+ kd.data = &d;
+ d.context = context;
+ d.id = id;
+ d.realm = realm;
+ return afslog_uid_int(&kd, cell, uid, homedir);
+}
+
+krb5_error_code
+krb5_afslog_uid(krb5_context context,
+ krb5_ccache id,
+ const char *cell,
+ krb5_const_realm realm,
+ uid_t uid)
+{
+ return krb5_afslog_uid_home (context, id, cell, realm, uid, NULL);
+}
+
+krb5_error_code
+krb5_afslog(krb5_context context,
+ krb5_ccache id,
+ const char *cell,
+ krb5_const_realm realm)
+{
+ return krb5_afslog_uid (context, id, cell, realm, getuid());
+}
+
+krb5_error_code
+krb5_afslog_home(krb5_context context,
+ krb5_ccache id,
+ const char *cell,
+ krb5_const_realm realm,
+ const char *homedir)
+{
+ return krb5_afslog_uid_home (context, id, cell, realm, getuid(), homedir);
+}
+
+/*
+ *
+ */
+
+krb5_error_code
+krb5_realm_of_cell(const char *cell, char **realm)
+{
+ kafs_data kd;
+
+ kd.get_realm = get_realm;
+ return _kafs_realm_of_cell(&kd, cell, realm);
+}
diff --git a/crypto/kerberosIV/lib/kafs/afssys.c b/crypto/kerberosIV/lib/kafs/afssys.c
index 741225c..2c6e3af 100644
--- a/crypto/kerberosIV/lib/kafs/afssys.c
+++ b/crypto/kerberosIV/lib/kafs/afssys.c
@@ -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.
*
@@ -38,28 +38,34 @@
#include "kafs_locl.h"
-RCSID("$Id: afssys.c,v 1.53 1997/05/04 02:30:41 assar Exp $");
+RCSID("$Id: afssys.c,v 1.63 1999/05/08 02:24:32 assar Exp $");
+
+int _kafs_debug; /* this should be done in a better way */
+
+#define NO_ENTRY_POINT 0
+#define SINGLE_ENTRY_POINT 1
+#define MULTIPLE_ENTRY_POINT 2
+#define SINGLE_ENTRY_POINT2 3
+#define SINGLE_ENTRY_POINT3 4
+#define AIX_ENTRY_POINTS 5
+#define UNKNOWN_ENTRY_POINT 6
+static int afs_entry_point = UNKNOWN_ENTRY_POINT;
+static int afs_syscalls[2];
/* Magic to get AIX syscalls to work */
#ifdef _AIX
-static int (*Pioctl)(char*, int, void*, int);
+static int (*Pioctl)(char*, int, struct ViceIoctl*, int);
static int (*Setpag)(void);
#include "dlfcn.h"
-static int
-isSuid()
-{
- int uid = getuid();
- int gid = getgid();
- int euid = getegid();
- int egid = getegid();
- return (uid != euid) || (gid != egid);
-}
+/*
+ *
+ */
static int
-aix_setup(void)
+try_aix(void)
{
#ifdef STATIC_AFS_SYSCALLS
Pioctl = aix_pioctl;
@@ -70,30 +76,63 @@ aix_setup(void)
/*
* If we are root or running setuid don't trust AFSLIBPATH!
*/
- if (getuid() != 0 && !isSuid() && (p = getenv("AFSLIBPATH")) != NULL)
- strcpy(path, p);
+ if (getuid() != 0 && !issuid() && (p = getenv("AFSLIBPATH")) != NULL)
+ strcpy_truncate(path, p, sizeof(path));
else
snprintf(path, sizeof(path), "%s/afslib.so", LIBDIR);
- ptr = dlopen(path, 0);
- if(ptr){
- Setpag = (int (*)(void))dlsym(ptr, "aix_setpag");
- Pioctl = (int (*)(char*, int, void*, int))dlsym(ptr, "aix_pioctl");
+ ptr = dlopen(path, RTLD_NOW);
+ if(ptr == NULL) {
+ if(_kafs_debug) {
+ if(errno == ENOEXEC && (p = dlerror()) != NULL)
+ fprintf(stderr, "dlopen(%s): %s\n", path, p);
+ else if (errno != ENOENT)
+ fprintf(stderr, "dlopen(%s): %s\n", path, strerror(errno));
+ }
+ return 1;
}
+ Setpag = (int (*)(void))dlsym(ptr, "aix_setpag");
+ Pioctl = (int (*)(char*, int,
+ struct ViceIoctl*, int))dlsym(ptr, "aix_pioctl");
#endif
+ afs_entry_point = AIX_ENTRY_POINTS;
+ return 0;
}
#endif /* _AIX */
-#define NO_ENTRY_POINT 0
-#define SINGLE_ENTRY_POINT 1
-#define MULTIPLE_ENTRY_POINT 2
-#define SINGLE_ENTRY_POINT2 3
-#define SINGLE_ENTRY_POINT3 4
-#define AIX_ENTRY_POINTS 5
-#define UNKNOWN_ENTRY_POINT 6
-static int afs_entry_point = UNKNOWN_ENTRY_POINT;
-static int afs_syscalls[2];
+/*
+ * This probably only works under Solaris and could get confused if
+ * there's a /etc/name_to_sysnum file.
+ */
+
+#define _PATH_ETC_NAME_TO_SYSNUM "/etc/name_to_sysnum"
+static int
+map_syscall_name_to_number (const char *str, int *res)
+{
+ FILE *f;
+ char buf[256];
+ size_t str_len = strlen (str);
+
+ f = fopen (_PATH_ETC_NAME_TO_SYSNUM, "r");
+ if (f == NULL)
+ return -1;
+ while (fgets (buf, sizeof(buf), f) != NULL) {
+ if (strncmp (str, buf, str_len) == 0) {
+ char *begptr = buf + str_len;
+ char *endptr;
+ long val = strtol (begptr, &endptr, 0);
+
+ if (val != 0 && endptr != begptr) {
+ fclose (f);
+ *res = val;
+ return 0;
+ }
+ }
+ }
+ fclose (f);
+ return -1;
+}
int
k_pioctl(char *a_path,
@@ -191,12 +230,65 @@ SIGSYS_handler(int sig)
#endif
+/*
+ * Try to see if `syscall' is a pioctl. Return 0 iff succesful.
+ */
+
+#if defined(AFS_SYSCALL) || defined(AFS_SYSCALL2) || defined(AFS_SYSCALL3)
+static int
+try_one (int syscall_num)
+{
+ struct ViceIoctl parms;
+ memset(&parms, 0, sizeof(parms));
+
+ if (setjmp(catch_SIGSYS) == 0) {
+ syscall(syscall_num, AFSCALL_PIOCTL,
+ 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ if (errno == EINVAL) {
+ afs_entry_point = SINGLE_ENTRY_POINT;
+ afs_syscalls[0] = syscall_num;
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif
+
+/*
+ * Try to see if `syscall_pioctl' is a pioctl syscall. Return 0 iff
+ * succesful.
+ *
+ */
+
+#ifdef AFS_PIOCTL
+static int
+try_two (int syscall_pioctl, int syscall_setpag)
+{
+ struct ViceIoctl parms;
+ memset(&parms, 0, sizeof(parms));
+
+ if (setjmp(catch_SIGSYS) == 0) {
+ syscall(syscall_pioctl,
+ 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
+ if (errno == EINVAL) {
+ afs_entry_point = MULTIPLE_ENTRY_POINT;
+ afs_syscalls[0] = syscall_pioctl;
+ afs_syscalls[1] = syscall_setpag;
+ return 0;
+ }
+ }
+ return 1;
+}
+#endif
+
int
k_hasafs(void)
{
- int saved_errno;
+#if !defined(NO_AFS) && defined(SIGSYS)
RETSIGTYPE (*saved_func)();
- struct ViceIoctl parms;
+#endif
+ int saved_errno;
+ char *env = getenv ("AFS_SYSCALL");
/*
* Already checked presence of AFS syscalls?
@@ -210,7 +302,6 @@ k_hasafs(void)
* If the syscall is absent we recive a SIGSYS.
*/
afs_entry_point = NO_ENTRY_POINT;
- memset(&parms, 0, sizeof(parms));
saved_errno = errno;
#ifndef NO_AFS
@@ -218,69 +309,85 @@ k_hasafs(void)
saved_func = signal(SIGSYS, SIGSYS_handler);
#endif
-#ifdef AFS_SYSCALL
- if (setjmp(catch_SIGSYS) == 0)
- {
- syscall(AFS_SYSCALL, AFSCALL_PIOCTL,
- 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (errno == EINVAL)
- {
- afs_entry_point = SINGLE_ENTRY_POINT;
- afs_syscalls[0] = AFS_SYSCALL;
+#if defined(AFS_SYSCALL) || defined(AFS_SYSCALL2) || defined(AFS_SYSCALL3)
+ {
+ int tmp;
+
+ if (env != NULL) {
+ if (sscanf (env, "%d", &tmp) == 1) {
+ if (try_one (tmp) == 0)
goto done;
+ } else {
+ char *end = NULL;
+ char *p;
+ char *s = strdup (env);
+
+ if (s != NULL) {
+ for (p = strtok_r (s, ",", &end);
+ p != NULL;
+ p = strtok_r (NULL, ",", &end)) {
+ if (map_syscall_name_to_number (p, &tmp) == 0)
+ if (try_one (tmp) == 0) {
+ free (s);
+ goto done;
+ }
+ }
+ free (s);
}
+ }
}
+ }
+#endif /* AFS_SYSCALL || AFS_SYSCALL2 || AFS_SYSCALL3 */
+
+#ifdef AFS_SYSCALL
+ if (try_one (AFS_SYSCALL) == 0)
+ goto done;
#endif /* AFS_SYSCALL */
#ifdef AFS_PIOCTL
- if (setjmp(catch_SIGSYS) == 0)
- {
- syscall(AFS_PIOCTL,
- 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (errno == EINVAL)
- {
- afs_entry_point = MULTIPLE_ENTRY_POINT;
- afs_syscalls[0] = AFS_PIOCTL;
- afs_syscalls[1] = AFS_SETPAG;
- goto done;
- }
- }
+ {
+ int tmp[2];
+
+ if (env != NULL && sscanf (env, "%d%d", &tmp[0], &tmp[1]) == 2)
+ if (try_two (tmp[0], tmp[1]) == 2)
+ goto done;
+ }
+#endif /* AFS_PIOCTL */
+
+#ifdef AFS_PIOCTL
+ if (try_two (AFS_PIOCTL, AFS_SETPAG) == 0)
+ goto done;
#endif /* AFS_PIOCTL */
#ifdef AFS_SYSCALL2
- if (setjmp(catch_SIGSYS) == 0)
- {
- syscall(AFS_SYSCALL2, AFSCALL_PIOCTL,
- 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (errno == EINVAL)
- {
- afs_entry_point = SINGLE_ENTRY_POINT2;
- afs_syscalls[0] = AFS_SYSCALL2;
- goto done;
- }
- }
-#endif /* AFS_SYSCALL */
+ if (try_one (AFS_SYSCALL2) == 0)
+ goto done;
+#endif /* AFS_SYSCALL2 */
#ifdef AFS_SYSCALL3
- if (setjmp(catch_SIGSYS) == 0)
- {
- syscall(AFS_SYSCALL3, AFSCALL_PIOCTL,
- 0, VIOCSETTOK, &parms, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
- if (errno == EINVAL)
- {
- afs_entry_point = SINGLE_ENTRY_POINT3;
- afs_syscalls[0] = AFS_SYSCALL3;
+ if (try_one (AFS_SYSCALL3) == 0)
+ goto done;
+#endif /* AFS_SYSCALL3 */
+
+#ifdef _AIX
+#if 0
+ if (env != NULL) {
+ char *pos = NULL;
+ char *pioctl_name;
+ char *setpag_name;
+
+ pioctl_name = strtok_r (env, ", \t", &pos);
+ if (pioctl_name != NULL) {
+ setpag_name = strtok_r (NULL, ", \t", &pos);
+ if (setpag_name != NULL)
+ if (try_aix (pioctl_name, setpag_name) == 0)
goto done;
- }
}
-#endif /* AFS_SYSCALL */
+ }
+#endif
-#ifdef _AIX
- aix_setup();
- if(Pioctl != NULL && Setpag != NULL){
- afs_entry_point = AIX_ENTRY_POINTS;
+ if(try_aix() == 0)
goto done;
- }
#endif
done:
diff --git a/crypto/kerberosIV/lib/kafs/afssysdefs.h b/crypto/kerberosIV/lib/kafs/afssysdefs.h
index 028f9b3..7193eea 100644
--- a/crypto/kerberosIV/lib/kafs/afssysdefs.h
+++ b/crypto/kerberosIV/lib/kafs/afssysdefs.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-/* $Id: afssysdefs.h,v 1.15 1997/04/01 08:18:12 joda Exp $ */
+/* $Id: afssysdefs.h,v 1.19.4.1 1999/07/22 03:21:43 assar Exp $ */
/*
* This section is for machines using single entry point AFS syscalls!
@@ -47,17 +47,22 @@
* entry point syscalls.
*/
-#if SunOS == 4
+#if SunOS == 40
#define AFS_SYSCALL 31
#endif
-#if SunOS == 5
+#if SunOS >= 50 && SunOS < 57
#define AFS_SYSCALL 105
#endif
+#if SunOS == 57
+#define AFS_SYSCALL 73
+#endif
+
#if defined(__hpux)
#define AFS_SYSCALL 50
#define AFS_SYSCALL2 49
+#define AFS_SYSCALL3 48
#endif
#if defined(_AIX)
@@ -78,7 +83,7 @@
#define AFS_SYSCALL 31
#endif
-#if defined(__NetBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#define AFS_SYSCALL 210
#endif
diff --git a/crypto/kerberosIV/lib/kafs/common.c b/crypto/kerberosIV/lib/kafs/common.c
new file mode 100644
index 0000000..54d7b1b
--- /dev/null
+++ b/crypto/kerberosIV/lib/kafs/common.c
@@ -0,0 +1,370 @@
+/*
+ * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "kafs_locl.h"
+
+RCSID("$Id: common.c,v 1.15 1999/06/09 22:41:41 assar Exp $");
+
+#define AUTH_SUPERUSER "afs"
+
+/*
+ * Here only ASCII characters are relevant.
+ */
+
+#define IsAsciiLower(c) ('a' <= (c) && (c) <= 'z')
+
+#define ToAsciiUpper(c) ((c) - 'a' + 'A')
+
+static void
+foldup(char *a, const char *b)
+{
+ for (; *b; a++, b++)
+ if (IsAsciiLower(*b))
+ *a = ToAsciiUpper(*b);
+ else
+ *a = *b;
+ *a = '\0';
+}
+
+int
+kafs_settoken(const char *cell, uid_t uid, CREDENTIALS *c)
+{
+ struct ViceIoctl parms;
+ struct ClearToken ct;
+ int32_t sizeof_x;
+ char buf[2048], *t;
+ int ret;
+
+ /*
+ * Build a struct ClearToken
+ */
+ ct.AuthHandle = c->kvno;
+ memcpy (ct.HandShakeKey, c->session, sizeof(c->session));
+ ct.ViceId = uid;
+ ct.BeginTimestamp = c->issue_date;
+ ct.EndTimestamp = krb_life_to_time(c->issue_date, c->lifetime);
+ if(ct.EndTimestamp < time(NULL))
+ return 0; /* don't store tokens that has expired (and possibly
+ overwriting valid tokens)*/
+
+#define ODD(x) ((x) & 1)
+ /* According to Transarc conventions ViceId is valid iff
+ * (EndTimestamp - BeginTimestamp) is odd. By decrementing EndTime
+ * the transformations:
+ *
+ * (issue_date, life) -> (StartTime, EndTime) -> (issue_date, life)
+ * preserves the original values.
+ */
+ if (uid != 0) /* valid ViceId */
+ {
+ if (!ODD(ct.EndTimestamp - ct.BeginTimestamp))
+ ct.EndTimestamp--;
+ }
+ else /* not valid ViceId */
+ {
+ if (ODD(ct.EndTimestamp - ct.BeginTimestamp))
+ ct.EndTimestamp--;
+ }
+
+ t = buf;
+ /*
+ * length of secret token followed by secret token
+ */
+ sizeof_x = c->ticket_st.length;
+ memcpy(t, &sizeof_x, sizeof(sizeof_x));
+ t += sizeof(sizeof_x);
+ memcpy(t, c->ticket_st.dat, sizeof_x);
+ t += sizeof_x;
+ /*
+ * length of clear token followed by clear token
+ */
+ sizeof_x = sizeof(ct);
+ memcpy(t, &sizeof_x, sizeof(sizeof_x));
+ t += sizeof(sizeof_x);
+ memcpy(t, &ct, sizeof_x);
+ t += sizeof_x;
+
+ /*
+ * do *not* mark as primary cell
+ */
+ sizeof_x = 0;
+ memcpy(t, &sizeof_x, sizeof(sizeof_x));
+ t += sizeof(sizeof_x);
+ /*
+ * follow with cell name
+ */
+ sizeof_x = strlen(cell) + 1;
+ memcpy(t, cell, sizeof_x);
+ t += sizeof_x;
+
+ /*
+ * Build argument block
+ */
+ parms.in = buf;
+ parms.in_size = t - buf;
+ parms.out = 0;
+ parms.out_size = 0;
+ ret = k_pioctl(0, VIOCSETTOK, &parms, 0);
+ return ret;
+}
+
+/* Try to get a db-server for an AFS cell from a AFSDB record */
+
+static int
+dns_find_cell(const char *cell, char *dbserver, size_t len)
+{
+ struct dns_reply *r;
+ int ok = -1;
+ r = dns_lookup(cell, "afsdb");
+ if(r){
+ struct resource_record *rr = r->head;
+ while(rr){
+ if(rr->type == T_AFSDB && rr->u.afsdb->preference == 1){
+ strcpy_truncate(dbserver,
+ rr->u.afsdb->domain,
+ len);
+ ok = 0;
+ break;
+ }
+ rr = rr->next;
+ }
+ dns_free_data(r);
+ }
+ return ok;
+}
+
+
+/*
+ * Try to find the cells we should try to klog to in "file".
+ */
+static void
+find_cells(char *file, char ***cells, int *index)
+{
+ FILE *f;
+ char cell[64];
+ int i;
+ int ind = *index;
+
+ f = fopen(file, "r");
+ if (f == NULL)
+ return;
+ while (fgets(cell, sizeof(cell), f)) {
+ char *nl = strchr(cell, '\n');
+ if (nl)
+ *nl = '\0';
+ if (cell[0] == '\0')
+ continue;
+ for(i = 0; i < ind; i++)
+ if(strcmp((*cells)[i], cell) == 0)
+ break;
+ if(i == ind){
+ char **tmp;
+
+ tmp = realloc(*cells, (ind + 1) * sizeof(**cells));
+ if (tmp == NULL)
+ break;
+ *cells = tmp;
+ (*cells)[ind] = strdup(cell);
+ if ((*cells)[ind] == NULL)
+ break;
+ ++ind;
+ }
+ }
+ fclose(f);
+ *index = ind;
+}
+
+/*
+ * Get tokens for all cells[]
+ */
+static int
+afslog_cells(kafs_data *data, char **cells, int max, uid_t uid,
+ const char *homedir)
+{
+ int ret = 0;
+ int i;
+ for(i = 0; i < max; i++)
+ ret = (*data->afslog_uid)(data, cells[i], uid, homedir);
+ return ret;
+}
+
+int
+_kafs_afslog_all_local_cells(kafs_data *data, uid_t uid, const char *homedir)
+{
+ int ret;
+ char **cells = NULL;
+ int index = 0;
+
+ if (homedir == NULL)
+ homedir = getenv("HOME");
+ if (homedir != NULL) {
+ char home[MaxPathLen];
+ snprintf(home, sizeof(home), "%s/.TheseCells", homedir);
+ find_cells(home, &cells, &index);
+ }
+ find_cells(_PATH_THESECELLS, &cells, &index);
+ find_cells(_PATH_THISCELL, &cells, &index);
+ find_cells(_PATH_ARLA_THESECELLS, &cells, &index);
+ find_cells(_PATH_ARLA_THISCELL, &cells, &index);
+
+ ret = afslog_cells(data, cells, index, uid, homedir);
+ while(index > 0)
+ free(cells[--index]);
+ free(cells);
+ return ret;
+}
+
+
+/* Find the realm associated with cell. Do this by opening
+ /usr/vice/etc/CellServDB and getting the realm-of-host for the
+ first VL-server for the cell.
+
+ This does not work when the VL-server is living in one realm, but
+ the cell it is serving is living in another realm.
+
+ Return 0 on success, -1 otherwise.
+ */
+
+int
+_kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm)
+{
+ FILE *F;
+ char buf[1024];
+ char *p;
+ int ret = -1;
+
+ if ((F = fopen(_PATH_CELLSERVDB, "r"))
+ || (F = fopen(_PATH_ARLA_CELLSERVDB, "r"))) {
+ while (fgets(buf, sizeof(buf), F)) {
+ if (buf[0] != '>')
+ continue; /* Not a cell name line, try next line */
+ if (strncmp(buf + 1, cell, strlen(cell)) == 0) {
+ /*
+ * We found the cell name we're looking for.
+ * Read next line on the form ip-address '#' hostname
+ */
+ if (fgets(buf, sizeof(buf), F) == NULL)
+ break; /* Read failed, give up */
+ p = strchr(buf, '#');
+ if (p == NULL)
+ break; /* No '#', give up */
+ p++;
+ if (buf[strlen(buf) - 1] == '\n')
+ buf[strlen(buf) - 1] = '\0';
+ *realm = (*data->get_realm)(data, p);
+ if (*realm && **realm != '\0')
+ ret = 0;
+ break; /* Won't try any more */
+ }
+ }
+ fclose(F);
+ }
+ if (*realm == NULL && dns_find_cell(cell, buf, sizeof(buf)) == 0) {
+ *realm = strdup(krb_realmofhost(buf));
+ if(*realm != NULL)
+ ret = 0;
+ }
+ return ret;
+}
+
+int
+_kafs_get_cred(kafs_data *data,
+ const char *cell,
+ const char *krealm,
+ const char *lrealm,
+ CREDENTIALS *c)
+{
+ int ret = -1;
+ char *vl_realm;
+ char CELL[64];
+
+ /* We're about to find the the realm that holds the key for afs in
+ * the specified cell. The problem is that null-instance
+ * afs-principals are common and that hitting the wrong realm might
+ * yield the wrong afs key. The following assumptions were made.
+ *
+ * Any realm passed to us is preferred.
+ *
+ * If there is a realm with the same name as the cell, it is most
+ * likely the correct realm to talk to.
+ *
+ * In most (maybe even all) cases the database servers of the cell
+ * will live in the realm we are looking for.
+ *
+ * Try the local realm, but if the previous cases fail, this is
+ * really a long shot.
+ *
+ */
+
+ /* comments on the ordering of these tests */
+
+ /* If the user passes a realm, she probably knows something we don't
+ * know and we should try afs@krealm (otherwise we're talking with a
+ * blondino and she might as well have it.)
+ */
+
+ if (krealm) {
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, krealm, c);
+ if (ret == 0) return 0;
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", krealm, c);
+ }
+ if (ret == 0) return 0;
+
+ foldup(CELL, cell);
+
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, CELL, c);
+ if (ret == 0) return 0;
+
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", CELL, c);
+ if (ret == 0) return 0;
+
+ /* this might work in some cases */
+ if (_kafs_realm_of_cell(data, cell, &vl_realm) == 0) {
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, vl_realm, c);
+ if (ret)
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, "", vl_realm, c);
+ free(vl_realm);
+ if (ret == 0) return 0;
+ }
+
+ if (lrealm)
+ ret = (*data->get_cred)(data, AUTH_SUPERUSER, cell, lrealm, c);
+ return ret;
+}
+
+
diff --git a/crypto/kerberosIV/lib/kafs/dlfcn.c b/crypto/kerberosIV/lib/kafs/dlfcn.c
index 3f4de92..98e081c 100644
--- a/crypto/kerberosIV/lib/kafs/dlfcn.c
+++ b/crypto/kerberosIV/lib/kafs/dlfcn.c
@@ -115,14 +115,12 @@ void *dlopen(const char *path, int mode)
}
if ((mp = (ModulePtr)calloc(1, sizeof(*mp))) == NULL) {
errvalid++;
- strcpy(errbuf, "calloc: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, "calloc: %s", strerror(errno));
return NULL;
}
if ((mp->name = strdup(path)) == NULL) {
errvalid++;
- strcpy(errbuf, "strdup: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, "strdup: %s", strerror(errno));
free(mp);
return NULL;
}
@@ -134,9 +132,8 @@ void *dlopen(const char *path, int mode)
free(mp->name);
free(mp);
errvalid++;
- strcpy(errbuf, "dlopen: ");
- strcat(errbuf, path);
- strcat(errbuf, ": ");
+ snprintf (errbuf, sizeof(errbuf),
+ "dlopen: %s: ", path);
/*
* If AIX says the file is not executable, the error
* can be further described by querying the loader about
@@ -145,14 +142,18 @@ void *dlopen(const char *path, int mode)
if (errno == ENOEXEC) {
char *tmp[BUFSIZ/sizeof(char *)];
if (loadquery(L_GETMESSAGES, tmp, sizeof(tmp)) == -1)
- strcpy(errbuf, strerror(errno));
+ strcpy_truncate(errbuf,
+ strerror(errno),
+ sizeof(errbuf));
else {
char **p;
for (p = tmp; *p; p++)
caterr(*p);
}
} else
- strcat(errbuf, strerror(errno));
+ strcat_truncate(errbuf,
+ strerror(errno),
+ sizeof(errbuf));
return NULL;
}
mp->refCnt = 1;
@@ -161,8 +162,8 @@ void *dlopen(const char *path, int mode)
if (loadbind(0, mainModule, mp->entry) == -1) {
dlclose(mp);
errvalid++;
- strcpy(errbuf, "loadbind: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "loadbind: %s", strerror(errno));
return NULL;
}
/*
@@ -175,8 +176,9 @@ void *dlopen(const char *path, int mode)
if (loadbind(0, mp1->entry, mp->entry) == -1) {
dlclose(mp);
errvalid++;
- strcpy(errbuf, "loadbind: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "loadbind: %s",
+ strerror(errno));
return NULL;
}
}
@@ -229,29 +231,29 @@ static void caterr(char *s)
p++;
switch(atoi(s)) {
case L_ERROR_TOOMANY:
- strcat(errbuf, "to many errors");
+ strcat_truncate(errbuf, "to many errors", sizeof(errbuf));
break;
case L_ERROR_NOLIB:
- strcat(errbuf, "can't load library");
- strcat(errbuf, p);
+ strcat_truncate(errbuf, "can't load library", sizeof(errbuf));
+ strcat_truncate(errbuf, p, sizeof(errbuf));
break;
case L_ERROR_UNDEF:
- strcat(errbuf, "can't find symbol");
- strcat(errbuf, p);
+ strcat_truncate(errbuf, "can't find symbol", sizeof(errbuf));
+ strcat_truncate(errbuf, p, sizeof(errbuf));
break;
case L_ERROR_RLDBAD:
- strcat(errbuf, "bad RLD");
- strcat(errbuf, p);
+ strcat_truncate(errbuf, "bad RLD", sizeof(errbuf));
+ strcat_truncate(errbuf, p, sizeof(errbuf));
break;
case L_ERROR_FORMAT:
- strcat(errbuf, "bad exec format in");
- strcat(errbuf, p);
+ strcat_truncate(errbuf, "bad exec format in", sizeof(errbuf));
+ strcat_truncate(errbuf, p, sizeof(errbuf));
break;
case L_ERROR_ERRNO:
- strcat(errbuf, strerror(atoi(++p)));
+ strcat_truncate(errbuf, strerror(atoi(++p)), sizeof(errbuf));
break;
default:
- strcat(errbuf, s);
+ strcat_truncate(errbuf, s, sizeof(errbuf));
break;
}
}
@@ -270,8 +272,8 @@ void *dlsym(void *handle, const char *symbol)
if (strcmp(ep->name, symbol) == 0)
return ep->addr;
errvalid++;
- strcpy(errbuf, "dlsym: undefined symbol ");
- strcat(errbuf, symbol);
+ snprintf (errbuf, sizeof(errbuf),
+ "dlsym: undefined symbol %s", symbol);
return NULL;
}
@@ -311,7 +313,8 @@ int dlclose(void *handle)
result = unload(mp->entry);
if (result == -1) {
errvalid++;
- strcpy(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "%s", strerror(errno));
}
if (mp->exports) {
ExportPtr ep;
@@ -360,8 +363,9 @@ static int readExports(ModulePtr mp)
int size = 4*1024;
if (errno != ENOENT) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: %s",
+ strerror(errno));
return -1;
}
/*
@@ -371,8 +375,9 @@ static int readExports(ModulePtr mp)
*/
if ((buf = malloc(size)) == NULL) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: %s",
+ strerror(errno));
return -1;
}
while ((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) {
@@ -380,15 +385,17 @@ static int readExports(ModulePtr mp)
size += 4*1024;
if ((buf = malloc(size)) == NULL) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: %s",
+ strerror(errno));
return -1;
}
}
if (i == -1) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: %s",
+ strerror(errno));
free(buf);
return -1;
}
@@ -411,14 +418,14 @@ static int readExports(ModulePtr mp)
free(buf);
if (!ldp) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "readExports: %s", strerror(errno));
return -1;
}
}
if (TYPE(ldp) != U802TOCMAGIC) {
errvalid++;
- strcpy(errbuf, "readExports: bad magic");
+ snprintf(errbuf, sizeof(errbuf), "readExports: bad magic");
while(ldclose(ldp) == FAILURE)
;
return -1;
@@ -430,14 +437,16 @@ static int readExports(ModulePtr mp)
*/
if (ldnshread(ldp, _DATA, &shdata) != SUCCESS) {
errvalid++;
- strcpy(errbuf, "readExports: cannot read data section header");
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: cannot read data section header");
while(ldclose(ldp) == FAILURE)
;
return -1;
}
if (ldnshread(ldp, _LOADER, &sh) != SUCCESS) {
errvalid++;
- strcpy(errbuf, "readExports: cannot read loader section header");
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: cannot read loader section header");
while(ldclose(ldp) == FAILURE)
;
return -1;
@@ -448,15 +457,16 @@ static int readExports(ModulePtr mp)
*/
if ((ldbuf = (char *)malloc(sh.s_size)) == NULL) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "readExports: %s", strerror(errno));
while(ldclose(ldp) == FAILURE)
;
return -1;
}
if (FSEEK(ldp, sh.s_scnptr, BEGINNING) != OKFSEEK) {
errvalid++;
- strcpy(errbuf, "readExports: cannot seek to loader section");
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: cannot seek to loader section");
free(ldbuf);
while(ldclose(ldp) == FAILURE)
;
@@ -464,7 +474,8 @@ static int readExports(ModulePtr mp)
}
if (FREAD(ldbuf, sh.s_size, 1, ldp) != 1) {
errvalid++;
- strcpy(errbuf, "readExports: cannot read loader section");
+ snprintf(errbuf, sizeof(errbuf),
+ "readExports: cannot read loader section");
free(ldbuf);
while(ldclose(ldp) == FAILURE)
;
@@ -482,8 +493,8 @@ static int readExports(ModulePtr mp)
}
if ((mp->exports = (ExportPtr)calloc(mp->nExports, sizeof(*mp->exports))) == NULL) {
errvalid++;
- strcpy(errbuf, "readExports: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "readExports: %s", strerror(errno));
free(ldbuf);
while(ldclose(ldp) == FAILURE)
;
@@ -508,8 +519,8 @@ static int readExports(ModulePtr mp)
* must copy the first SYMNMLEN chars and make
* sure we have a zero byte at the end.
*/
- strncpy(tmpsym, ls->l_name, SYMNMLEN);
- tmpsym[SYMNMLEN] = '\0';
+ strcpy_truncate (tmpsym, ls->l_name,
+ SYMNMLEN + 1);
symname = tmpsym;
}
ep->name = strdup(symname);
@@ -537,8 +548,8 @@ static void * findMain(void)
if ((buf = malloc(size)) == NULL) {
errvalid++;
- strcpy(errbuf, "findMain: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "findMail: %s", strerror(errno));
return NULL;
}
while ((i = loadquery(L_GETINFO, buf, size)) == -1 && errno == ENOMEM) {
@@ -546,15 +557,15 @@ static void * findMain(void)
size += 4*1024;
if ((buf = malloc(size)) == NULL) {
errvalid++;
- strcpy(errbuf, "findMain: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "findMail: %s", strerror(errno));
return NULL;
}
}
if (i == -1) {
errvalid++;
- strcpy(errbuf, "findMain: ");
- strcat(errbuf, strerror(errno));
+ snprintf (errbuf, sizeof(errbuf),
+ "findMail: %s", strerror(errno));
free(buf);
return NULL;
}
diff --git a/crypto/kerberosIV/lib/kafs/kafs_locl.h b/crypto/kerberosIV/lib/kafs/kafs_locl.h
index 6ada6ab..6174f74 100644
--- a/crypto/kerberosIV/lib/kafs/kafs_locl.h
+++ b/crypto/kerberosIV/lib/kafs/kafs_locl.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: kafs_locl.h,v 1.3 1997/05/04 23:04:44 assar Exp $ */
+/* $Id: kafs_locl.h,v 1.12.2.1 1999/07/22 03:22:05 assar Exp $ */
#ifndef __KAFS_LOCL_H__
#define __KAFS_LOCL_H__
+#ifdef HAVE_CONFIG_H
#include <config.h>
-#include <protos.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
@@ -57,7 +58,7 @@
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
-#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
+#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
#include <sys/ioctl.h>
#endif
#ifdef HAVE_SYS_FILIO_H
@@ -73,6 +74,13 @@
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
@@ -85,12 +93,45 @@
#endif
#include <roken.h>
+#ifdef KRB5
+#include <krb5.h>
+#endif
+#ifdef KRB4
#include <krb.h>
+#endif
#include <kafs.h>
#include <resolve.h>
#include "afssysdefs.h"
+struct kafs_data;
+typedef int (*afslog_uid_func_t)(struct kafs_data*, const char*, uid_t,
+ const char *);
+
+typedef int (*get_cred_func_t)(struct kafs_data*, const char*, const char*,
+ const char*, CREDENTIALS*);
+
+typedef char* (*get_realm_func_t)(struct kafs_data*, const char*);
+
+typedef struct kafs_data {
+ afslog_uid_func_t afslog_uid;
+ get_cred_func_t get_cred;
+ get_realm_func_t get_realm;
+ void *data;
+} kafs_data;
+
+int _kafs_afslog_all_local_cells(kafs_data*, uid_t, const char*);
+
+int _kafs_get_cred(kafs_data*, const char*, const char*, const char *,
+ CREDENTIALS*);
+
+int
+_kafs_realm_of_cell(kafs_data *data, const char *cell, char **realm);
+
+#ifdef _AIX
+int aix_pioctl(char*, int, struct ViceIoctl*, int);
+int aix_setpag(void);
+#endif
#endif /* __KAFS_LOCL_H__ */
diff --git a/crypto/kerberosIV/lib/kdb/Makefile.in b/crypto/kerberosIV/lib/kdb/Makefile.in
index f6fb962..ac90e05 100644
--- a/crypto/kerberosIV/lib/kdb/Makefile.in
+++ b/crypto/kerberosIV/lib/kdb/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.25 1997/05/06 03:47:39 assar Exp $
+# $Id: Makefile.in,v 1.40 1999/03/10 19:01:15 joda Exp $
#
SHELL = /bin/sh
@@ -8,10 +8,13 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+LN_S = @LN_S@
+DEFS = @DEFS@ -DROKEN_RENAME
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -23,6 +26,11 @@ libdir = @libdir@
PICFLAGS = @PICFLAGS@
+LIB_DBM = @LIB_DBM@
+LIB_DEPS = @lib_deps_yes@ $(LIB_DBM) -lc
+build_symlink_command = @build_symlink_command@
+install_symlink_command = @install_symlink_command@
+
LIBNAME = $(LIBPREFIX)kdb
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
@@ -30,9 +38,11 @@ LIBPREFIX = @LIBPREFIX@
LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)
-SOURCES = krb_cache.c krb_kdb_utils.c copykey.c krb_lib.c krb_dbm.c print_princ.c base64.c
+SOURCES = krb_cache.c krb_kdb_utils.c copykey.c krb_lib.c \
+ krb_dbm.c print_princ.c
-OBJECTS = krb_cache.o krb_kdb_utils.o copykey.o krb_lib.o krb_dbm.o print_princ.o base64.o
+OBJECTS = krb_cache.o krb_kdb_utils.o copykey.o krb_lib.o \
+ krb_dbm.o print_princ.o
all: $(LIB)
@@ -40,14 +50,15 @@ Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I../../include -I$(srcdir) -I. $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
+ @install_symlink_command@
uninstall:
- rm -f $(libdir)/$(LIB)
+ rm -f $(DESTDIR)$(libdir)/$(LIB)
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -55,22 +66,16 @@ TAGS: $(SOURCES)
check:
clean:
- rm -f $(LIB) *.o *.a
+ rm -f $(LIB) *.o *.a *.so *.so.* so_locations
mostlyclean: clean
distclean: clean
- rm -f Makefile *.tab.c *~
+ rm -f Makefile *.tab.c *~ roken_rename.h
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
$(LIBNAME).a: $(OBJECTS)
rm -f $@
$(AR) cr $@ $(OBJECTS)
@@ -78,6 +83,12 @@ $(LIBNAME).a: $(OBJECTS)
$(LIBNAME).$(SHLIBEXT): $(OBJECTS)
rm -f $@
- $(LDSHARED) -o $@ $(OBJECTS)
+ $(LDSHARED) -o $@ $(OBJECTS) $(LIB_DEPS)
+ @build_symlink_command@
+
+$(OBJECTS): ../../include/config.h roken_rename.h
+
+roken_rename.h:
+ $(LN_S) $(srcdir)/../krb/roken_rename.h .
-$(OBJECTS): ../../include/config.h
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/kdb/krb_cache.c b/crypto/kerberosIV/lib/kdb/krb_cache.c
index ed4a5b1..bd8da50 100644
--- a/crypto/kerberosIV/lib/kdb/krb_cache.c
+++ b/crypto/kerberosIV/lib/kdb/krb_cache.c
@@ -25,7 +25,7 @@ or implied warranty.
#include "kdb_locl.h"
-RCSID("$Id: krb_cache.c,v 1.6 1997/05/02 10:27:53 joda Exp $");
+RCSID("$Id: krb_cache.c,v 1.7 1998/06/09 19:25:14 joda Exp $");
#ifdef DEBUG
extern int debug;
@@ -49,12 +49,10 @@ kerb_cache_init(void)
*/
int
-kerb_cache_get_principal(char *serv, char *inst, Principal *principal, unsigned int max)
- /* could have wild card */
- /* could have wild card */
-
- /* max number of name structs to return */
-
+kerb_cache_get_principal(char *serv, /* could have wild card */
+ char *inst, /* could have wild card */
+ Principal *principal,
+ unsigned int max) /* max number of name structs to return */
{
int found = 0;
@@ -86,11 +84,10 @@ kerb_cache_get_principal(char *serv, char *inst, Principal *principal, unsigned
*/
int
-kerb_cache_put_principal(Principal *principal, unsigned int max)
-
+kerb_cache_put_principal(Principal *principal,
+ unsigned int max)
/* max number of principal structs to
* insert */
-
{
u_long i;
int count = 0;
@@ -123,12 +120,10 @@ kerb_cache_put_principal(Principal *principal, unsigned int max)
*/
int
-kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
- /* could have wild card */
- /* could have wild card */
-
- /* max number of name structs to return */
-
+kerb_cache_get_dba(char *serv, /* could have wild card */
+ char *inst, /* could have wild card */
+ Dba *dba,
+ unsigned int max) /* max number of name structs to return */
{
int found = 0;
@@ -159,10 +154,9 @@ kerb_cache_get_dba(char *serv, char *inst, Dba *dba, unsigned int max)
*/
int
-kerb_cache_put_dba(Dba *dba, unsigned int max)
-
+kerb_cache_put_dba(Dba *dba,
+ unsigned int max)
/* max number of dba structs to insert */
-
{
u_long i;
int count = 0;
diff --git a/crypto/kerberosIV/lib/kdb/krb_dbm.c b/crypto/kerberosIV/lib/kdb/krb_dbm.c
index 963656a..ca6a2c8 100644
--- a/crypto/kerberosIV/lib/kdb/krb_dbm.c
+++ b/crypto/kerberosIV/lib/kdb/krb_dbm.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "kdb_locl.h"
-RCSID("$Id: krb_dbm.c,v 1.27 1997/05/02 14:29:09 assar Exp $");
+RCSID("$Id: krb_dbm.c,v 1.36 1998/11/07 14:25:55 assar Exp $");
#include <xdbm.h>
@@ -98,8 +98,6 @@ static int non_blocking = 0;
* Utility routine: generate name of database file.
*/
-static char *gen_dbsuffix (char *db_name, char *sfx);
-
static char *
gen_dbsuffix(char *db_name, char *sfx)
{
@@ -109,25 +107,21 @@ gen_dbsuffix(char *db_name, char *sfx)
sfx = ".ok";
asprintf (&dbsuffix, "%s%s", db_name, sfx);
+ if (dbsuffix == NULL) {
+ fprintf (stderr, "gen_dbsuffix: out of memory\n");
+ exit(1);
+ }
return dbsuffix;
}
static void
-decode_princ_key (datum *key, char *name, char *instance);
-
-static void
decode_princ_key(datum *key, char *name, char *instance)
{
- strncpy(name, key->dptr, ANAME_SZ);
- strncpy(instance, (char *)key->dptr + ANAME_SZ, INST_SZ);
- name[ANAME_SZ - 1] = '\0';
- instance[INST_SZ - 1] = '\0';
+ strcpy_truncate (name, key->dptr, ANAME_SZ);
+ strcpy_truncate (instance, (char *)key->dptr + ANAME_SZ, INST_SZ);
}
static void
-encode_princ_contents (datum *contents, Principal *principal);
-
-static void
encode_princ_contents(datum *contents, Principal *principal)
{
contents->dsize = sizeof(*principal);
@@ -157,10 +151,7 @@ static int mylock = 0;
static int inited = 0;
static int
-kerb_dbl_init (void);
-
-static int
-kerb_dbl_init()
+kerb_dbl_init(void)
{
if (!inited) {
char *filename = gen_dbsuffix (current_db_name, ".ok");
@@ -177,10 +168,7 @@ kerb_dbl_init()
}
static void
-kerb_dbl_fini (void);
-
-static void
-kerb_dbl_fini()
+kerb_dbl_fini(void)
{
close(dblfd);
dblfd = -1;
@@ -189,9 +177,6 @@ kerb_dbl_fini()
}
static int
-kerb_dbl_lock (int mode);
-
-static int
kerb_dbl_lock(int mode)
{
int flock_mode;
@@ -206,47 +191,42 @@ kerb_dbl_lock(int mode)
}
switch (mode) {
case KERB_DBL_EXCLUSIVE:
- flock_mode = K_LOCK_EX;
+ flock_mode = LOCK_EX;
break;
case KERB_DBL_SHARED:
- flock_mode = K_LOCK_SH;
+ flock_mode = LOCK_SH;
break;
default:
fprintf(stderr, "invalid lock mode %d\n", mode);
abort();
}
if (non_blocking)
- flock_mode |= K_LOCK_NB;
+ flock_mode |= LOCK_NB;
- if (k_flock(dblfd, flock_mode) < 0)
+ if (flock(dblfd, flock_mode) < 0)
return errno;
mylock++;
return 0;
}
-static void kerb_dbl_unlock (void);
-
static void
-kerb_dbl_unlock()
+kerb_dbl_unlock(void)
{
if (!mylock) { /* lock already unlocked */
fprintf(stderr, "Kerberos database lock not locked when unlocking.\n");
fflush(stderr);
exit(1);
}
- if (k_flock(dblfd, K_LOCK_UN) < 0) {
+ if (flock(dblfd, LOCK_UN) < 0) {
fprintf(stderr, "Kerberos database lock error. (unlocking)\n");
fflush(stderr);
- perror("k_flock");
+ perror("flock");
exit(1);
}
mylock = 0;
}
int
-kerb_db_set_lockmode (int mode);
-
-int
kerb_db_set_lockmode(int mode)
{
int old = non_blocking;
@@ -259,10 +239,7 @@ kerb_db_set_lockmode(int mode)
*/
int
-kerb_db_init (void);
-
-int
-kerb_db_init()
+kerb_db_init(void)
{
init = 1;
return (0);
@@ -274,10 +251,7 @@ kerb_db_init()
*/
void
-kerb_db_fini (void);
-
-void
-kerb_db_fini()
+kerb_db_fini(void)
{
}
@@ -289,9 +263,6 @@ kerb_db_fini()
*/
int
-kerb_db_set_name (char *name);
-
-int
kerb_db_set_name(char *name)
{
DBM *db;
@@ -312,10 +283,7 @@ kerb_db_set_name(char *name)
*/
time_t
-kerb_get_db_age (void);
-
-time_t
-kerb_get_db_age()
+kerb_get_db_age(void)
{
struct stat st;
char *okname;
@@ -341,9 +309,6 @@ kerb_get_db_age()
*/
static time_t
-kerb_start_update (char *db_name);
-
-static time_t
kerb_start_update(char *db_name)
{
char *okname = gen_dbsuffix(db_name, ".ok");
@@ -358,9 +323,6 @@ kerb_start_update(char *db_name)
}
static int
-kerb_end_update (char *db_name, time_t age);
-
-static int
kerb_end_update(char *db_name, time_t age)
{
int fd;
@@ -395,16 +357,11 @@ kerb_end_update(char *db_name, time_t age)
}
static time_t
-kerb_start_read (void);
-
-static time_t
-kerb_start_read()
+kerb_start_read(void)
{
return kerb_get_db_age();
}
-static int kerb_end_read (time_t age);
-
static int
kerb_end_read(time_t age)
{
@@ -520,7 +477,7 @@ kerb_db_delete_principal (char *name, char *inst)
kerb_db_init();
for(try = 0; try < KERB_DB_MAX_RETRY; try++){
- if((code = kerb_dbl_lock(KERB_DBL_SHARED)) != 0)
+ if((code = kerb_dbl_lock(KERB_DBL_EXCLUSIVE)) != 0)
return -1;
db = dbm_open(current_db_name, O_RDWR, 0600);
@@ -570,6 +527,8 @@ kerb_db_get_principal (char *name, char *inst, Principal *principal,
return -1;
db = dbm_open(current_db_name, O_RDONLY, 0600);
+ if (db == NULL)
+ return -1;
*more = 0;
@@ -684,7 +643,9 @@ kerb_db_update(long *db, Principal *principal, unsigned int max)
for (i = 0; i < max; i++) {
encode_princ_contents(&contents, principal);
encode_princ_key(&key, principal->name, principal->instance);
- dbm_store((DBM *)db, key, contents, DBM_REPLACE);
+ if(dbm_store((DBM *)db, key, contents, DBM_REPLACE) < 0)
+ return found; /* XXX some better mechanism to report
+ failure should exist */
#ifdef DEBUG
if (kerb_debug & 1) {
fprintf(stderr, "\n put %s %s\n",
@@ -703,9 +664,6 @@ kerb_db_update(long *db, Principal *principal, unsigned int max)
*/
int
-kerb_db_put_principal (Principal *principal, unsigned int max);
-
-int
kerb_db_put_principal(Principal *principal,
unsigned max)
@@ -724,9 +682,6 @@ kerb_db_put_principal(Principal *principal,
}
void
-kerb_db_get_stat (DB_stat *s);
-
-void
kerb_db_get_stat(DB_stat *s)
{
gettimeofday(&timestamp, NULL);
@@ -745,17 +700,11 @@ kerb_db_get_stat(DB_stat *s)
}
void
-kerb_db_put_stat (DB_stat *s);
-
-void
kerb_db_put_stat(DB_stat *s)
{
}
void
-delta_stat (DB_stat *a, DB_stat *b, DB_stat *c);
-
-void
delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
{
/* c = a - b then b = a for the next time */
@@ -772,7 +721,6 @@ delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
c->n_put_stat = a->n_put_stat - b->n_put_stat;
memcpy(b, a, sizeof(DB_stat));
- return;
}
/*
@@ -781,16 +729,11 @@ delta_stat(DB_stat *a, DB_stat *b, DB_stat *c)
*/
int
-kerb_db_get_dba (char *dba_name, char *dba_inst, Dba *dba, unsigned int max, int *more);
-
-int
-kerb_db_get_dba(char *dba_name, char *dba_inst, Dba *dba,
- unsigned max,
- int *more)
- /* could have wild card */
- /* could have wild card */
- /* max number of name structs to return */
- /* where there more than 'max' tuples? */
+kerb_db_get_dba(char *dba_name, /* could have wild card */
+ char *dba_inst, /* could have wild card */
+ Dba *dba,
+ unsigned max, /* max number of name structs to return */
+ int *more) /* where there more than 'max' tuples? */
{
*more = 0;
return (0);
@@ -809,6 +752,8 @@ kerb_db_iterate (k_iter_proc_t func, void *arg)
return code;
db = dbm_open(current_db_name, O_RDONLY, 0600);
+ if (db == NULL)
+ return errno;
for (key = dbm_firstkey (db); key.dptr != NULL; key = dbm_next(db, key)) {
contents = dbm_fetch (db, key);
diff --git a/crypto/kerberosIV/lib/kdb/krb_kdb_utils.c b/crypto/kerberosIV/lib/kdb/krb_kdb_utils.c
index f321e9f..af941dc 100644
--- a/crypto/kerberosIV/lib/kdb/krb_kdb_utils.c
+++ b/crypto/kerberosIV/lib/kdb/krb_kdb_utils.c
@@ -31,7 +31,7 @@ or implied warranty.
#include <kdc.h>
-RCSID("$Id: krb_kdb_utils.c,v 1.23 1997/05/02 14:29:10 assar Exp $");
+RCSID("$Id: krb_kdb_utils.c,v 1.25 1999/03/13 21:24:21 assar Exp $");
/* always try /.k for backwards compatibility */
static char *master_key_files[] = { MKEYFILE, "/.k", NULL };
@@ -60,7 +60,7 @@ k_strerror(int eno)
int
kdb_new_get_master_key(des_cblock *key, des_key_schedule schedule)
{
- int kfile;
+ int kfile = -1;
int i;
char buf[1024];
@@ -128,8 +128,10 @@ kdb_new_get_master_key(des_cblock *key, des_key_schedule schedule)
exit(1);
}
-int kdb_new_get_new_master_key(des_cblock *key, des_key_schedule schedule,
- int verify)
+int
+kdb_new_get_new_master_key(des_cblock *key,
+ des_key_schedule schedule,
+ int verify)
{
#ifndef RANDOM_MKEY
des_read_password(key, "\nEnter Kerberos master password: ", verify);
@@ -147,8 +149,10 @@ int kdb_new_get_new_master_key(des_cblock *key, des_key_schedule schedule,
return 0;
}
-int kdb_get_master_key(int prompt, des_cblock *master_key,
- des_key_schedule master_key_sched)
+int
+kdb_get_master_key(int prompt,
+ des_cblock *master_key,
+ des_key_schedule master_key_sched)
{
int ask = (prompt == KDB_GET_TWICE);
#ifndef RANDOM_MKEY
@@ -163,9 +167,11 @@ int kdb_get_master_key(int prompt, des_cblock *master_key,
return 0;
}
-int kdb_kstash(des_cblock *master_key, char *file)
+int
+kdb_kstash(des_cblock *master_key, char *file)
{
int kfile;
+
kfile = open(file, O_TRUNC | O_RDWR | O_CREAT, 0600);
if (kfile < 0) {
return -1;
@@ -191,7 +197,7 @@ kdb_encrypt_key (des_cblock (*in), des_cblock (*out),
memcpy(out, in, sizeof(des_cblock));
#else
des_pcbc_encrypt(in,out,(long)sizeof(des_cblock),master_key_sched,master_key,
- e_d_flag);
+ e_d_flag);
#endif
}
@@ -214,7 +220,7 @@ kdb_verify_master_key (des_cblock *master_key,
n = kerb_get_principal(KERB_M_NAME, KERB_M_INST, principal_data,
1 /* only one please */, &more);
if ((n != 1) || more) {
- if (out != (FILE *) NULL)
+ if (out != NULL)
fprintf(out,
"verify_master_key: %s, %d found.\n",
"Kerberos error on master key version lookup",
@@ -225,7 +231,7 @@ kdb_verify_master_key (des_cblock *master_key,
master_key_version = (long) principal_data[0].key_version;
/* set up the master key */
- if (out != (FILE *) NULL) /* should we punt this? */
+ if (out != NULL) /* should we punt this? */
fprintf(out, "Current Kerberos master key version is %d.\n",
principal_data[0].kdc_key_ver);
@@ -245,7 +251,7 @@ kdb_verify_master_key (des_cblock *master_key,
memset(key_from_db, 0, sizeof(key_from_db));
memset(principal_data, 0, sizeof (principal_data));
- if (n && (out != (FILE *) NULL)) {
+ if (n && (out != NULL)) {
fprintf(out, "\n\07\07verify_master_key: Invalid master key; ");
fprintf(out, "does not match database.\n");
}
diff --git a/crypto/kerberosIV/lib/kdb/krb_lib.c b/crypto/kerberosIV/lib/kdb/krb_lib.c
index 19bf316..59949f9 100644
--- a/crypto/kerberosIV/lib/kdb/krb_lib.c
+++ b/crypto/kerberosIV/lib/kdb/krb_lib.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "kdb_locl.h"
-RCSID("$Id: krb_lib.c,v 1.11 1997/05/07 01:36:08 assar Exp $");
+RCSID("$Id: krb_lib.c,v 1.13 1998/11/22 09:41:43 assar Exp $");
#ifdef DEBUG
extern int debug;
@@ -93,14 +93,11 @@ kerb_delete_principal(char *name, char *inst)
*/
int
-kerb_get_principal(char *name, char *inst, Principal *principal,
- unsigned int max, int *more)
- /* could have wild card */
- /* could have wild card */
-
- /* max number of name structs to return */
- /* more tuples than room for */
-
+kerb_get_principal(char *name, /* could have wild card */
+ char *inst, /* could have wild card */
+ Principal *principal,
+ unsigned int max, /* max number of name structs to return */
+ int *more) /* more tuples than room for */
{
int found = 0;
#ifdef CACHE
@@ -144,7 +141,7 @@ kerb_get_principal(char *name, char *inst, Principal *principal,
found = kerb_db_get_principal(name, inst, principal, max, more);
/* try to insert principal(s) into cache if it was found */
#ifdef CACHE
- if (found) {
+ if (found > 0) {
kerb_cache_put_principal(principal, found);
}
#endif
@@ -153,22 +150,20 @@ kerb_get_principal(char *name, char *inst, Principal *principal,
/* principals */
int
-kerb_put_principal(Principal *principal, unsigned int n)
-
+kerb_put_principal(Principal *principal,
+ unsigned int n)
/* number of principal structs to write */
{
- struct tm *tp;
-
/* set mod date */
principal->mod_date = time((time_t *)0);
/* and mod date string */
- tp = k_localtime(&principal->mod_date);
- snprintf(principal->mod_date_txt,
- sizeof(principal->mod_date_txt),
- "%4d-%2d-%2d",
- tp->tm_year + 1900,
- tp->tm_mon + 1, tp->tm_mday); /* January is 0, not 1 */
+ strftime(principal->mod_date_txt,
+ sizeof(principal->mod_date_txt),
+ "%Y-%m-%d", k_localtime(&principal->mod_date));
+ strftime(principal->exp_date_txt,
+ sizeof(principal->exp_date_txt),
+ "%Y-%m-%d", k_localtime(&principal->exp_date));
#ifdef DEBUG
if (kerb_debug & 1) {
int i;
@@ -201,13 +196,11 @@ kerb_put_principal(Principal *principal, unsigned int n)
}
int
-kerb_get_dba(char *name, char *inst, Dba *dba, unsigned int max, int *more)
- /* could have wild card */
- /* could have wild card */
-
- /* max number of name structs to return */
- /* more tuples than room for */
-
+kerb_get_dba(char *name, /* could have wild card */
+ char *inst, /* could have wild card */
+ Dba *dba,
+ unsigned int max, /* max number of name structs to return */
+ int *more) /* more tuples than room for */
{
int found = 0;
#ifdef CACHE
diff --git a/crypto/kerberosIV/lib/krb/Makefile.in b/crypto/kerberosIV/lib/krb/Makefile.in
index 8b34d65..9697de6 100644
--- a/crypto/kerberosIV/lib/krb/Makefile.in
+++ b/crypto/kerberosIV/lib/krb/Makefile.in
@@ -1,37 +1,50 @@
#
-# $Id: Makefile.in,v 1.74 1997/05/19 03:03:05 assar Exp $
+# $Id: Makefile.in,v 1.110 1999/03/10 19:01:16 joda Exp $
#
-
-# Under SunOS-5.x it is necessary to link with -ldes to be binary compatible.
-LIBDES=`test -r /usr/lib/libkrb.so.1 && echo "-lresolv -L../des -ldes"; true`
-
SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
LN_S = @LN_S@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+DEFS = @DEFS@ -DROKEN_RENAME
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
LD_FLAGS = @LD_FLAGS@
EXECSUFFIX=@EXECSUFFIX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
+top_builddir = ../..
-COMPILE_ET = ../../util/et/compile_et$(EXECSUFFIX) -language ansi-c
+COMPILE_ET = ../com_err/compile_et
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
+includedir = @includedir@
+
+incdir = $(includedir)
+inc_DATA = krb_err.h
+idir = $(top_builddir)/include
+
PICFLAGS = @PICFLAGS@
+
+# Under SunOS-5.x it is necessary to link with -ldes to be binary compatible.
+
+LIBDES=`test -r /usr/lib/libkrb.so.1 && echo "@LD_FLAGS@ -L../des -ldes"; true`
+
+LIB_DEPS = @lib_deps_yes@ `echo @LIB_res_search@ @LIB_dn_expand@ | sort | uniq` $(LIBDES) -lc
+build_symlink_command = @build_symlink_command@
+install_symlink_command = @install_symlink_command@
-PROGS = sizetest$(EXEC_SUFFIX)
+PROGS = sizetest$(EXECSUFFIX)
LIBNAME = $(LIBPREFIX)krb
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
@@ -39,176 +52,216 @@ LIBPREFIX = @LIBPREFIX@
LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)
-SOURCES = cr_err_reply.c \
- create_auth_reply.c \
- create_ciph.c \
- create_death_packet.c \
- create_ticket.c \
- dest_tkt.c \
- get_in_tkt.c \
- get_svc_in_tkt.c \
- getrealm.c \
- k_localtime.c \
- krb_err_txt.c \
- krb_get_in_tkt.c \
- kuserok.c \
- parse_name.c \
- kntoln.c \
- mk_auth.c \
- krb_check_auth.c \
- mk_err.c \
- mk_safe.c \
- rd_err.c \
- rd_safe.c \
- recvauth.c \
- mk_priv.c \
- rd_req.c \
- decomp_ticket.c \
- lifetime.c \
- month_sname.c \
- stime.c \
- read_service_key.c \
- getst.c \
- sendauth.c \
- netread.c \
- netwrite.c \
- rd_priv.c \
- krb_equiv.c \
- str2key.c \
- get_ad_tkt.c \
- mk_req.c \
- get_cred.c \
- get_tf_realm.c \
- get_tf_fullname.c \
- one.c \
- save_credentials.c \
- send_to_kdc.c \
- get_host.c \
- get_krbrlm.c \
- k_gethostname.c \
- tf_util.c \
- debug_decl.c \
- k_flock.c \
- tkt_string.c \
- getaddrs.c \
- k_getsockinst.c \
- k_getport.c \
- lsb_addr_comp.c \
- name2name.c \
- get_default_principal.c \
- realm_parse.c \
- verify_user.c \
- rw.c \
- kdc_reply.c \
- encrypt_ktext.c \
- swab.c \
- gettimeofday.c \
- check_time.c \
- krb_err.c \
- et_list.c \
- resolve.c \
- unparse_name.c \
- logging.c \
- k_concat.c
-
-# these files reside in ../roken
-# snprintf.c \
-# strdup.c \
-# strtok_r.c \
-# strcasecmp.c
-
-OBJECTS = cr_err_reply.o \
- create_auth_reply.o \
- create_ciph.o \
- create_death_packet.o \
- create_ticket.o \
- dest_tkt.o \
- get_in_tkt.o \
- get_svc_in_tkt.o \
- getrealm.o \
- k_localtime.o \
- krb_err_txt.o \
- krb_get_in_tkt.o \
- kuserok.o \
- parse_name.o \
- kntoln.o \
- mk_auth.o \
- krb_check_auth.o \
- mk_err.o \
- mk_safe.o \
- rd_err.o \
- rd_safe.o \
- recvauth.o \
- mk_priv.o \
- rd_req.o \
- decomp_ticket.o \
- lifetime.o \
- month_sname.o \
- stime.o \
- read_service_key.o \
- getst.o \
- sendauth.o \
- netread.o \
- netwrite.o \
- rd_priv.o \
- krb_equiv.o \
- str2key.o \
- get_ad_tkt.o \
- mk_req.o \
- get_cred.o \
- get_tf_realm.o \
- get_tf_fullname.o \
- one.o \
- save_credentials.o \
- send_to_kdc.o \
- get_host.o \
- get_krbrlm.o \
- k_gethostname.o \
- tf_util.o \
- debug_decl.o \
- k_flock.o \
- tkt_string.o \
- getaddrs.o \
- k_getsockinst.o \
- k_getport.o \
- lsb_addr_comp.o \
- name2name.o \
- get_default_principal.o \
- realm_parse.o \
- verify_user.o \
- rw.o \
- kdc_reply.o \
- encrypt_ktext.o \
- swab.o \
- gettimeofday.o \
- check_time.o \
- krb_err.o \
- resolve.o \
- unparse_name.o \
- logging.o \
- k_concat.o \
- snprintf.o \
- strdup.o \
- strtok_r.o \
- strcasecmp.o
-
-# This is only needed by some shared library implementations
-LDOBJ = et_list.o
-
-all: $(LIB) $(PROGS)
+SOURCES = \
+ check_time.c \
+ cr_err_reply.c \
+ create_auth_reply.c \
+ create_ciph.c \
+ create_death_packet.c \
+ create_ticket.c \
+ debug_decl.c \
+ decomp_ticket.c \
+ dest_tkt.c \
+ encrypt_ktext.c \
+ extra.c \
+ get_ad_tkt.c \
+ getfile.c \
+ get_cred.c \
+ get_default_principal.c \
+ get_host.c \
+ get_in_tkt.c \
+ get_krbrlm.c \
+ get_svc_in_tkt.c \
+ get_tf_fullname.c \
+ get_tf_realm.c \
+ getaddrs.c \
+ getrealm.c \
+ getst.c \
+ k_getport.c \
+ k_getsockinst.c \
+ k_localtime.c \
+ kdc_reply.c \
+ kntoln.c \
+ krb_check_auth.c \
+ krb_equiv.c \
+ krb_err.c \
+ krb_err_txt.c \
+ krb_get_in_tkt.c \
+ kuserok.c \
+ lifetime.c \
+ logging.c \
+ lsb_addr_comp.c \
+ mk_auth.c \
+ mk_err.c \
+ mk_priv.c \
+ mk_req.c \
+ mk_safe.c \
+ month_sname.c \
+ name2name.c \
+ krb_net_read.c \
+ krb_net_write.c \
+ one.c \
+ parse_name.c \
+ rd_err.c \
+ rd_priv.c \
+ rd_req.c \
+ rd_safe.c \
+ read_service_key.c \
+ realm_parse.c \
+ recvauth.c \
+ rw.c \
+ save_credentials.c \
+ send_to_kdc.c \
+ sendauth.c \
+ solaris_compat.c \
+ stime.c \
+ str2key.c \
+ tf_util.c \
+ time.c \
+ tkt_string.c \
+ unparse_name.c \
+ verify_user.c
+
+# these files reside in ../roken or ../com_err/
+EXTRA_SOURCE = \
+ base64.c \
+ concat.c \
+ flock.c \
+ gethostname.c \
+ gettimeofday.c \
+ getuid.c \
+ resolve.c \
+ snprintf.c \
+ strcasecmp.c \
+ strcat_truncate.c \
+ strcpy_truncate.c \
+ strdup.c \
+ strncasecmp.c \
+ strnlen.c \
+ strtok_r.c \
+ swab.c
+
+SHLIB_EXTRA_SOURCE = \
+ com_err.c \
+ error.c
+
+OBJECTS = \
+ check_time.o \
+ cr_err_reply.o \
+ create_auth_reply.o \
+ create_ciph.o \
+ create_death_packet.o \
+ create_ticket.o \
+ debug_decl.o \
+ decomp_ticket.o \
+ dest_tkt.o \
+ encrypt_ktext.o \
+ extra.o \
+ get_ad_tkt.o \
+ getfile.o \
+ get_cred.o \
+ get_default_principal.o \
+ get_host.o \
+ get_in_tkt.o \
+ get_krbrlm.o \
+ get_svc_in_tkt.o \
+ get_tf_fullname.o \
+ get_tf_realm.o \
+ getaddrs.o \
+ getrealm.o \
+ getst.o \
+ k_getport.o \
+ k_getsockinst.o \
+ k_localtime.o \
+ kdc_reply.o \
+ kntoln.o \
+ krb_check_auth.o \
+ krb_equiv.o \
+ krb_err.o \
+ krb_err_txt.o \
+ krb_get_in_tkt.o \
+ kuserok.o \
+ lifetime.o \
+ logging.o \
+ lsb_addr_comp.o \
+ mk_auth.o \
+ mk_err.o \
+ mk_priv.o \
+ mk_req.o \
+ mk_safe.o \
+ month_sname.o \
+ name2name.o \
+ krb_net_read.o \
+ krb_net_write.o \
+ one.o \
+ parse_name.o \
+ rd_err.o \
+ rd_priv.o \
+ rd_req.o \
+ rd_safe.o \
+ read_service_key.o \
+ realm_parse.o \
+ recvauth.o \
+ rw.o \
+ save_credentials.o \
+ send_to_kdc.o \
+ sendauth.o \
+ solaris_compat.o \
+ stime.o \
+ str2key.o \
+ tf_util.o \
+ time.o \
+ tkt_string.o \
+ unparse_name.o \
+ verify_user.o \
+ $(LIBADD)
+
+LIBADD = \
+ base64.o \
+ concat.o \
+ flock.o \
+ gethostname.o \
+ gettimeofday.o \
+ getuid.o \
+ net_read.o \
+ net_write.o \
+ resolve.o \
+ snprintf.o \
+ strcasecmp.o \
+ strcat_truncate.o \
+ strcpy_truncate.o \
+ strdup.o \
+ strncasecmp.o \
+ strnlen.o \
+ strtok_r.o \
+ swab.o
+
+SHLIB_LIBADD = \
+ com_err.o \
+ error.o
+
+all: $(LIB) $(PROGS) all-local
Wall:
- make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
+ make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I. -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(INSTALL_DATA) -m 0555 $(LIB) $(DESTDIR)$(libdir)/$(LIB)
+ @install_symlink_command@
+ $(MKINSTALLDIRS) $(DESTDIR)$(includedir)
+ @for i in $(inc_DATA); do \
+ echo " $(INSTALL_DATA) $$i $(DESTDIR)$(incdir)/$$i";\
+ $(INSTALL_DATA) $$i $(DESTDIR)$(incdir)/$$i; done
uninstall:
- rm -f $(libdir)/$(LIB)
+ rm -f $(DESTDIR)$(libdir)/$(LIB)
+ @for i in $(inc_DATA); do \
+ echo " rm -f $(DESTDIR)$(incdir)/$$i";\
+ rm -f $(DESTDIR)$(incdir)/$$i; done
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -217,13 +270,14 @@ sizetest.o: sizetest.c
$(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $<
sizetest$(EXECSUFFIX): sizetest.o
- $(CC) $(LD_FLAGS) $(LDFLAGS) -o $@ sizetest.o
+ $(LINK) $(LD_FLAGS) $(LDFLAGS) -o $@ sizetest.o
check: sizetest$(EXECSUFFIX)
./sizetest$(EXECSUFFIX)
clean:
- rm -f $(LIB) *.o *.a krb_err.c krb_err.h $(PROGS)
+ rm -f $(LIB) *.o *.a *.so *.so.* so_locations \
+ krb_err.c krb_err.h $(PROGS) $(EXTRA_SOURCE) $(SHLIB_EXTRA_SOURCE)
mostlyclean: clean
@@ -233,37 +287,77 @@ distclean: clean
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
$(LIBNAME).a: $(OBJECTS)
rm -f $@
$(AR) cr $@ $(OBJECTS)
-$(RANLIB) $@
-$(LIBNAME).$(SHLIBEXT): $(OBJECTS) $(LDOBJ)
+$(LIBNAME).$(SHLIBEXT): $(OBJECTS) $(SHLIB_LIBADD)
rm -f $@
- $(LDSHARED) -o $@ $(OBJECTS) $(LDOBJ) $(LIBDES)
+ $(LDSHARED) -o $@ $(OBJECTS) $(SHLIB_LIBADD) $(LIB_DEPS)
+ @build_symlink_command@
krb_err.c krb_err.h: krb_err.et
- test -r krb_err.et || (rm -f krb_err.et && $(LN_S) $(srcdir)/krb_err.et .)
- $(COMPILE_ET) krb_err.et
-
+ $(COMPILE_ET) $(srcdir)/krb_err.et
+
+# this doesn't work with parallel makes
+#$(EXTRA_SOURCE):
+# for i in $(EXTRA_SOURCE); do \
+# test -f $$i || $(LN_S) $(srcdir)/../roken/$$i .; \
+# done
+
+base64.c:
+ $(LN_S) $(srcdir)/../roken/base64.c .
+concat.c:
+ $(LN_S) $(srcdir)/../roken/concat.c .
+flock.c:
+ $(LN_S) $(srcdir)/../roken/flock.c .
+gethostname.c:
+ $(LN_S) $(srcdir)/../roken/gethostname.c .
+gettimeofday.c:
+ $(LN_S) $(srcdir)/../roken/gettimeofday.c .
+getuid.c:
+ $(LN_S) $(srcdir)/../roken/getuid.c .
snprintf.c:
$(LN_S) $(srcdir)/../roken/snprintf.c .
-
+strcasecmp.c:
+ $(LN_S) $(srcdir)/../roken/strcasecmp.c .
+strcat_truncate.c:
+ $(LN_S) $(srcdir)/../roken/strcat_truncate.c .
+strcpy_truncate.c:
+ $(LN_S) $(srcdir)/../roken/strcpy_truncate.c .
+strncasecmp.c:
+ $(LN_S) $(srcdir)/../roken/strncasecmp.c .
+strnlen.c:
+ $(LN_S) $(srcdir)/../roken/strnlen.c .
strdup.c:
$(LN_S) $(srcdir)/../roken/strdup.c .
-
strtok_r.c:
$(LN_S) $(srcdir)/../roken/strtok_r.c .
+swab.c:
+ $(LN_S) $(srcdir)/../roken/swab.c .
+resolve.c:
+ $(LN_S) $(srcdir)/../roken/resolve.c .
+net_read.c:
+ $(LN_S) $(srcdir)/../roken/net_read.c .
+net_write.c:
+ $(LN_S) $(srcdir)/../roken/net_write.c .
+com_err.c:
+ $(LN_S) $(srcdir)/../com_err/com_err.c .
+error.c:
+ $(LN_S) $(srcdir)/../com_err/error.c .
-strcasecmp.c:
- $(LN_S) $(srcdir)/../roken/strcasecmp.c .
$(OBJECTS): ../../include/config.h
-$(OBJECTS): krb_locl.h krb.h krb_err.h
-one.o: ../../include/version.h
+$(OBJECTS): krb_locl.h krb.h
+rw.o: ../../include/version.h
+
+all-local: $(inc_DATA)
+ @for i in $(inc_DATA); do \
+ if cmp -s $$i $(idir)/$$i 2> /dev/null ; then :; else\
+ echo " $(INSTALL_DATA) $$i $(idir)/$$i"; \
+ $(INSTALL_DATA) $$i $(idir)/$$i; \
+ fi ; \
+ done
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean all-local
diff --git a/crypto/kerberosIV/lib/krb/cr_err_reply.c b/crypto/kerberosIV/lib/krb/cr_err_reply.c
index 2c1956a..3e82659 100644
--- a/crypto/kerberosIV/lib/krb/cr_err_reply.c
+++ b/crypto/kerberosIV/lib/krb/cr_err_reply.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: cr_err_reply.c,v 1.9 1997/04/01 08:18:19 joda Exp $");
+RCSID("$Id: cr_err_reply.c,v 1.10 1998/06/09 19:25:16 joda Exp $");
/*
* This routine is used by the Kerberos authentication server to
@@ -74,26 +74,54 @@ RCSID("$Id: cr_err_reply.c,v 1.9 1997/04/01 08:18:19 joda Exp $");
* string e_string error text
*/
-void
+int
cr_err_reply(KTEXT pkt, char *pname, char *pinst, char *prealm,
u_int32_t time_ws, u_int32_t e, char *e_string)
{
unsigned char *p = pkt->dat;
-
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_ERR_REPLY, p, 1);
+ int tmp;
+ size_t rem = sizeof(pkt->dat);
+
+ tmp = krb_put_int(KRB_PROT_VERSION, p, rem, 1);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(AUTH_MSG_ERR_REPLY, p, rem, 1);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
if (pname == NULL) pname = "";
if (pinst == NULL) pinst = "";
if (prealm == NULL) prealm = "";
- p += krb_put_nir(pname, pinst, prealm, p);
-
- p += krb_put_int(time_ws, p, 4);
+ tmp = krb_put_nir(pname, pinst, prealm, p, rem);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(time_ws, p, rem, 4);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(e, p, 4);
+ tmp = krb_put_int(e, p, rem, 4);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_string(e_string, p);
+ tmp = krb_put_string(e_string, p, rem);
+ if (tmp < 0)
+ return -1;
+ p += tmp;
+ rem -= tmp;
pkt->length = p - pkt->dat;
+ return 0;
}
diff --git a/crypto/kerberosIV/lib/krb/create_auth_reply.c b/crypto/kerberosIV/lib/krb/create_auth_reply.c
index 4976c46..f10d34c 100644
--- a/crypto/kerberosIV/lib/krb/create_auth_reply.c
+++ b/crypto/kerberosIV/lib/krb/create_auth_reply.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: create_auth_reply.c,v 1.11 1997/04/01 08:18:20 joda Exp $");
+RCSID("$Id: create_auth_reply.c,v 1.14 1998/06/13 00:06:59 assar Exp $");
/*
* This routine is called by the Kerberos authentication server
@@ -98,32 +98,65 @@ create_auth_reply(char *pname, /* Principal's name */
KTEXT pkt = &pkt_st;
unsigned char *p = pkt->dat;
+ int tmp;
+ size_t rem = sizeof(pkt->dat);
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_KDC_REPLY, p, 1);
-
- if(n != 0){
- /* barf on old code */
- krb_warning("create_auth_reply: don't give me no krb3 crap!"
- " (n == %d)\n", n);
+ if(n != 0)
+ return NULL;
+
+ tmp = krb_put_int(KRB_PROT_VERSION, p, rem, 1);
+ if (tmp < 0)
return NULL;
- }
+ p += tmp;
+ rem -= tmp;
+ tmp = krb_put_int(AUTH_MSG_KDC_REPLY, p, rem, 1);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_nir(pname, pinst, prealm, p);
+ tmp = krb_put_nir(pname, pinst, prealm, p, rem);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(time_ws, p, 4);
+ tmp = krb_put_int(time_ws, p, rem, 4);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(n, p, 1);
+ tmp = krb_put_int(n, p, rem, 1);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(x_date, p, 4);
+ tmp = krb_put_int(x_date, p, rem, 4);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(kvno, p, 1);
+ tmp = krb_put_int(kvno, p, rem, 1);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(cipher->length, p, 2);
+ tmp = krb_put_int(cipher->length, p, rem, 2);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
+ if (rem < cipher->length)
+ return NULL;
memcpy(p, cipher->dat, cipher->length);
p += cipher->length;
+ rem -= cipher->length;
pkt->length = p - pkt->dat;
diff --git a/crypto/kerberosIV/lib/krb/create_ciph.c b/crypto/kerberosIV/lib/krb/create_ciph.c
index 27d27ff..c22f01e 100644
--- a/crypto/kerberosIV/lib/krb/create_ciph.c
+++ b/crypto/kerberosIV/lib/krb/create_ciph.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: create_ciph.c,v 1.9 1997/04/01 08:18:20 joda Exp $");
+RCSID("$Id: create_ciph.c,v 1.12 1998/07/24 06:32:53 assar Exp $");
/*
* This routine is used by the authentication server to create
@@ -91,23 +91,53 @@ create_ciph(KTEXT c, /* Text block to hold ciphertext */
{
unsigned char *p = c->dat;
+ size_t rem = sizeof(c->dat);
+ int tmp;
memset(c, 0, sizeof(KTEXT_ST));
+ if (rem < 8)
+ return KFAILURE;
memcpy(p, session, 8);
p += 8;
+ rem -= 8;
- p += krb_put_nir(service, instance, realm, p);
+ tmp = krb_put_nir(service, instance, realm, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
- p += krb_put_int(life, p, 1);
- p += krb_put_int(kvno, p, 1);
+ tmp = krb_put_int(life, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(kvno, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(tkt->length, p, 1);
+ tmp = krb_put_int(tkt->length, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+ if (rem < tkt->length)
+ return KFAILURE;
memcpy(p, tkt->dat, tkt->length);
p += tkt->length;
+ rem -= tkt->length;
- p += krb_put_int(kdc_time, p, 4);
+ tmp = krb_put_int(kdc_time, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
/* multiple of eight bytes */
c->length = (p - c->dat + 7) & ~7;
diff --git a/crypto/kerberosIV/lib/krb/create_death_packet.c b/crypto/kerberosIV/lib/krb/create_death_packet.c
index f74ba30..ddc4c9a 100644
--- a/crypto/kerberosIV/lib/krb/create_death_packet.c
+++ b/crypto/kerberosIV/lib/krb/create_death_packet.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: create_death_packet.c,v 1.8 1997/04/01 08:18:21 joda Exp $");
+RCSID("$Id: create_death_packet.c,v 1.9 1998/06/09 19:25:17 joda Exp $");
/*
* This routine creates a packet to type AUTH_MSG_DIE which is sent to
@@ -74,11 +74,29 @@ krb_create_death_packet(char *a_name)
KTEXT pkt = &pkt_st;
unsigned char *p = pkt->dat;
-
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_DIE, p, 1);
-
- p += krb_put_string(a_name, p);
+ int tmp;
+ int rem = sizeof(pkt->dat);
+
+ pkt->length = 0;
+
+ tmp = krb_put_int(KRB_PROT_VERSION, p, rem, 1);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(AUTH_MSG_DIE, p, rem, 1);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_string(a_name, p, rem);
+ if (tmp < 0)
+ return NULL;
+ p += tmp;
+ rem -= tmp;
+
pkt->length = p - pkt->dat;
return pkt;
}
diff --git a/crypto/kerberosIV/lib/krb/create_ticket.c b/crypto/kerberosIV/lib/krb/create_ticket.c
index b469232..822cfbb 100644
--- a/crypto/kerberosIV/lib/krb/create_ticket.c
+++ b/crypto/kerberosIV/lib/krb/create_ticket.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: create_ticket.c,v 1.12 1997/04/01 08:18:21 joda Exp $");
+RCSID("$Id: create_ticket.c,v 1.13 1998/06/09 19:25:17 joda Exp $");
/*
* Create ticket takes as arguments information that should be in a
@@ -103,21 +103,52 @@ krb_create_ticket(KTEXT tkt, /* Gets filled in by the ticket */
des_cblock *key) /* Service's secret key */
{
unsigned char *p = tkt->dat;
+ int tmp;
+ size_t rem = sizeof(tkt->dat);
memset(tkt, 0, sizeof(KTEXT_ST));
- p += krb_put_int(flags, p, 1);
- p += krb_put_nir(pname, pinstance, prealm, p);
+ tmp = krb_put_int(flags, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_nir(pname, pinstance, prealm, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_address(paddress, p);
+ tmp = krb_put_address(paddress, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+ if (rem < 8)
+ return KFAILURE;
memcpy(p, session, 8);
p += 8;
+ rem -= 8;
+
+ tmp = krb_put_int(life, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(life, p, 1);
- p += krb_put_int(time_sec, p, 4);
+ tmp = krb_put_int(time_sec, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_nir(sname, sinstance, NULL, p);
+ tmp = krb_put_nir(sname, sinstance, NULL, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
/* multiple of eight bytes */
tkt->length = (p - tkt->dat + 7) & ~7;
diff --git a/crypto/kerberosIV/lib/krb/debug_decl.c b/crypto/kerberosIV/lib/krb/debug_decl.c
index 5358bcb..5cbab77 100644
--- a/crypto/kerberosIV/lib/krb/debug_decl.c
+++ b/crypto/kerberosIV/lib/krb/debug_decl.c
@@ -21,9 +21,24 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: debug_decl.c,v 1.6 1997/03/23 03:53:07 joda Exp $");
+RCSID("$Id: debug_decl.c,v 1.10 1999/06/16 15:10:38 joda Exp $");
/* Declare global debugging variables. */
int krb_ap_req_debug = 0;
int krb_debug = 0;
+int krb_dns_debug = 0;
+
+int
+krb_enable_debug(void)
+{
+ krb_ap_req_debug = krb_debug = krb_dns_debug = 1;
+ return 0;
+}
+
+int
+krb_disable_debug(void)
+{
+ krb_ap_req_debug = krb_debug = krb_dns_debug = 0;
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/krb/decomp_ticket.c b/crypto/kerberosIV/lib/krb/decomp_ticket.c
index 8e556a3..b62e978 100644
--- a/crypto/kerberosIV/lib/krb/decomp_ticket.c
+++ b/crypto/kerberosIV/lib/krb/decomp_ticket.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: decomp_ticket.c,v 1.16 1997/04/01 08:18:22 joda Exp $");
+RCSID("$Id: decomp_ticket.c,v 1.19 1998/11/22 09:42:36 assar Exp $");
/*
* This routine takes a ticket and pointers to the variables that
@@ -82,19 +82,22 @@ decomp_ticket(KTEXT tkt, /* The ticket to be decoded */
*flags = *p++;
- little_endian = (*flags >> K_FLAG_ORDER) & 1;
+ little_endian = *flags & 1;
if(strlen((char*)p) > ANAME_SZ)
return KFAILURE;
- p += krb_get_string(p, pname);
+ p += krb_get_string(p, pname, ANAME_SZ);
if(strlen((char*)p) > INST_SZ)
return KFAILURE;
- p += krb_get_string(p, pinstance);
+ p += krb_get_string(p, pinstance, INST_SZ);
if(strlen((char*)p) > REALM_SZ)
return KFAILURE;
- p += krb_get_string(p, prealm);
+ p += krb_get_string(p, prealm, REALM_SZ);
+
+ if (*prealm == '\0')
+ krb_get_lrealm (prealm, 1);
if(tkt->length - (p - tkt->dat) < 8 + 1 + 4)
return KFAILURE;
@@ -109,11 +112,11 @@ decomp_ticket(KTEXT tkt, /* The ticket to be decoded */
if(strlen((char*)p) > SNAME_SZ)
return KFAILURE;
- p += krb_get_string(p, sname);
+ p += krb_get_string(p, sname, SNAME_SZ);
if(strlen((char*)p) > INST_SZ)
return KFAILURE;
- p += krb_get_string(p, sinstance);
+ p += krb_get_string(p, sinstance, INST_SZ);
return KSUCCESS;
}
diff --git a/crypto/kerberosIV/lib/krb/dllmain.c b/crypto/kerberosIV/lib/krb/dllmain.c
index e98b7dc..9d653cd 100644
--- a/crypto/kerberosIV/lib/krb/dllmain.c
+++ b/crypto/kerberosIV/lib/krb/dllmain.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -45,7 +45,7 @@
#include "ticket_memory.h"
#include <Windows.h>
-RCSID("$Id: dllmain.c,v 1.6 1997/05/02 14:29:13 assar Exp $");
+RCSID("$Id: dllmain.c,v 1.8 1998/07/13 14:29:33 assar Exp $");
void
msg(char *text, int error)
@@ -55,12 +55,28 @@ msg(char *text, int error)
asprintf (&buf, "%s\nAn error of type: %d", text, error);
MessageBox(GetActiveWindow(),
- buf ? buf : "can't tell you",
+ buf ? buf : "Out of memory!",
"kerberos message",
MB_OK|MB_APPLMODAL);
free (buf);
}
+void
+PostUpdateMessage(void)
+{
+ HWND hWnd;
+ static UINT km_message;
+
+ if(km_message == 0)
+ km_message = RegisterWindowMessage("krb4-update-cache");
+
+ hWnd = FindWindow("KrbManagerWndClass", NULL);
+ if (hWnd == NULL)
+ hWnd = HWND_BROADCAST;
+ PostMessage(hWnd, km_message, 0, 0);
+}
+
+
BOOL WINAPI
DllMain (HANDLE hInst,
ULONG reason,
@@ -90,35 +106,35 @@ DllMain (HANDLE hInst,
}
if(GetLastError() != ERROR_ALREADY_EXISTS)
{
- STARTUPINFO s =
- {
+ STARTUPINFO s = {
sizeof(s),
- 0,
- 0,
- 0,
+ NULL,
+ NULL,
+ NULL,
0,0,
0,0,
0,0,
0,
- 0,
- 0,
- 0,0,
- 0,0,0};
+ STARTF_USESHOWWINDOW,
+ SW_SHOWMINNOACTIVE,
+ 0, NULL,
+ NULL, NULL, NULL
+ };
- s.dwFlags = STARTF_USESHOWWINDOW;
- s.wShowWindow = SW_HIDE;
if(!CreateProcess(0,"krbmanager",
0,0,FALSE,0,0,
- 0,&s, &p))
- {
- msg("Unable to create kerberos manager process.\n"
+ 0,&s, &p)) {
+#if 0
+ msg("Unable to create Kerberos manager process.\n"
"Make sure krbmanager.exe is in your PATH.",
GetLastError());
return FALSE;
+#endif
}
}
break;
case DLL_PROCESS_DETACH:
+ /* should this really be done here? */
freeTktMem(0);
WSACleanup();
break;
diff --git a/crypto/kerberosIV/lib/krb/extra.c b/crypto/kerberosIV/lib/krb/extra.c
new file mode 100644
index 0000000..eb13c43
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/extra.c
@@ -0,0 +1,207 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: extra.c,v 1.6 1998/07/24 07:18:47 assar Exp $");
+
+struct value {
+ char *variable;
+ char *value;
+ struct value *next;
+};
+
+static struct value *_extra_values;
+
+static int _krb_extra_read = 0;
+
+static int
+define_variable(const char *variable, const char *value)
+{
+ struct value *e;
+ e = malloc(sizeof(*e));
+ if(e == NULL)
+ return ENOMEM;
+ e->variable = strdup(variable);
+ if(e->variable == NULL) {
+ free(e);
+ return ENOMEM;
+ }
+ e->value = strdup(value);
+ if(e->value == NULL) {
+ free(e->variable);
+ free(e);
+ return ENOMEM;
+ }
+ e->next = _extra_values;
+ _extra_values = e;
+ return 0;
+}
+
+#ifndef WIN32
+
+struct obsolete {
+ const char *from;
+ const char *to;
+} obsolete [] = {
+ { "KDC_TIMESYNC", "kdc_timesync" },
+ { "KRB_REVERSE_DIRECTION", "reverse_lsb_test"},
+ { "krb4_proxy", "krb4_proxy"},
+ { NULL, NULL }
+};
+
+static void
+check_obsolete(void)
+{
+ struct obsolete *r;
+ for(r = obsolete; r->from; r++) {
+ if(getenv(r->from)) {
+ krb_warning("The environment variable `%s' is obsolete;\n"
+ "set `%s' in your `krb.extra' file instead\n",
+ r->from, r->to);
+ define_variable(r->to, getenv(r->from));
+ }
+ }
+}
+
+static int
+read_extra_file(void)
+{
+ int i = 0;
+ char file[128];
+ char line[1024];
+ if(_krb_extra_read)
+ return 0;
+ _krb_extra_read = 1;
+ check_obsolete();
+ while(krb_get_krbextra(i++, file, sizeof(file)) == 0) {
+ FILE *f = fopen(file, "r");
+ if(f == NULL)
+ continue;
+ while(fgets(line, sizeof(line), f)) {
+ char *var, *tmp, *val;
+
+ /* skip initial whitespace */
+ var = line + strspn(line, " \t");
+ /* skip non-whitespace */
+ tmp = var + strcspn(var, " \t=");
+ /* skip whitespace */
+ val = tmp + strspn(tmp, " \t=");
+ *tmp = '\0';
+ tmp = val + strcspn(val, " \t\n");
+ *tmp = '\0';
+ if(*var == '\0' || *var == '#' || *val == '\0')
+ continue;
+ if(krb_debug)
+ krb_warning("%s: setting `%s' to `%s'\n", file, var, val);
+ define_variable(var, val);
+ }
+ fclose(f);
+ return 0;
+ }
+ return ENOENT;
+}
+
+#else /* WIN32 */
+
+static int
+read_extra_file(void)
+{
+ char name[1024], data[1024];
+ DWORD name_sz, data_sz;
+ DWORD type;
+ int num = 0;
+ HKEY reg_key;
+
+ if(_krb_extra_read)
+ return 0;
+ _krb_extra_read = 1;
+
+ if(RegCreateKey(HKEY_CURRENT_USER, "krb4", &reg_key) != 0)
+ return -1;
+
+
+ while(1) {
+ name_sz = sizeof(name);
+ data_sz = sizeof(data);
+ if(RegEnumValue(reg_key,
+ num++,
+ name,
+ &name_sz,
+ NULL,
+ &type,
+ data,
+ &data_sz) != 0)
+ break;
+ if(type == REG_SZ)
+ define_variable(name, data);
+ }
+ RegCloseKey(reg_key);
+ return 0;
+}
+
+#endif
+
+static const char*
+find_variable(const char *variable)
+{
+ struct value *e;
+ for(e = _extra_values; e; e = e->next) {
+ if(strcasecmp(variable, e->variable) == 0)
+ return e->value;
+ }
+ return NULL;
+}
+
+const char *
+krb_get_config_string(const char *variable)
+{
+ read_extra_file();
+ return find_variable(variable);
+}
+
+int
+krb_get_config_bool(const char *variable)
+{
+ const char *value = krb_get_config_string(variable);
+ if(value == NULL)
+ return 0;
+ return strcasecmp(value, "yes") == 0 ||
+ strcasecmp(value, "true") == 0 ||
+ atoi(value);
+}
diff --git a/crypto/kerberosIV/lib/krb/get_ad_tkt.c b/crypto/kerberosIV/lib/krb/get_ad_tkt.c
index 9590760..a10018e 100644
--- a/crypto/kerberosIV/lib/krb/get_ad_tkt.c
+++ b/crypto/kerberosIV/lib/krb/get_ad_tkt.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: get_ad_tkt.c,v 1.16 1997/05/30 17:43:34 bg Exp $");
+RCSID("$Id: get_ad_tkt.c,v 1.20 1998/11/22 09:42:55 assar Exp $");
/*
* get_ad_tkt obtains a new service ticket from Kerberos, using
@@ -86,6 +86,8 @@ get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
u_int32_t time_ws = 0;
int kerror;
unsigned char *p;
+ size_t rem;
+ int tmp;
/*
* First check if we have a "real" TGT for the corresponding
@@ -93,9 +95,9 @@ get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
*/
kerror = krb_get_cred(KRB_TICKET_GRANTING_TICKET, realm, realm, &cr);
- if (kerror == KSUCCESS)
- strncpy(lrealm, realm, REALM_SZ);
- else
+ if (kerror == KSUCCESS) {
+ strcpy_truncate(lrealm, realm, REALM_SZ);
+ } else
kerror = krb_get_tf_realm(TKT_FILE, lrealm);
if (kerror != KSUCCESS)
@@ -119,11 +121,12 @@ get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
else{
if ((kerror =
get_ad_tkt(KRB_TICKET_GRANTING_TICKET,
- realm, lrealm, lifetime)) != KSUCCESS)
+ realm, lrealm, lifetime)) != KSUCCESS) {
if (kerror == KDC_PR_UNKNOWN)
return(AD_INTR_RLM_NOTGT);
else
return(kerror);
+ }
if ((kerror = krb_get_cred(KRB_TICKET_GRANTING_TICKET,
realm, lrealm, &cr)) != KSUCCESS)
return(kerror);
@@ -144,10 +147,25 @@ get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
return(AD_NOTGT);
p = pkt->dat + pkt->length;
-
- p += krb_put_int(time_ws, p, 4);
- p += krb_put_int(lifetime, p, 1);
- p += krb_put_nir(service, sinstance, NULL, p);
+ rem = sizeof(pkt->dat) - pkt->length;
+
+ tmp = krb_put_int(time_ws, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(lifetime, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_nir(service, sinstance, NULL, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
pkt->length = p - pkt->dat;
rpkt->length = 0;
@@ -176,7 +194,7 @@ get_ad_tkt(char *service, char *sinstance, char *realm, int lifetime)
strcmp(cred.realm, realm)) /* not what we asked for */
return INTK_ERR; /* we need a better code here XXX */
- gettimeofday(&tv, NULL);
+ krb_kdctimeofday(&tv);
if (abs((int)(tv.tv_sec - cred.issue_date)) > CLOCK_SKEW) {
return RD_AP_TIME; /* XXX should probably be better code */
}
diff --git a/crypto/kerberosIV/lib/krb/get_cred.c b/crypto/kerberosIV/lib/krb/get_cred.c
index 1a0016c..085184b 100644
--- a/crypto/kerberosIV/lib/krb/get_cred.c
+++ b/crypto/kerberosIV/lib/krb/get_cred.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: get_cred.c,v 1.6 1997/05/30 17:38:29 bg Exp $");
+RCSID("$Id: get_cred.c,v 1.7 1997/12/15 17:12:55 assar Exp $");
/*
* krb_get_cred takes a service name, instance, and realm, and a
@@ -41,7 +41,7 @@ krb_get_cred(char *service, /* Service name */
int tf_status; /* return value of tf function calls */
CREDENTIALS cr;
- if (c == 0)
+ if (c == NULL)
c = &cr;
/* Open ticket file and lock it for shared reading */
diff --git a/crypto/kerberosIV/lib/krb/get_default_principal.c b/crypto/kerberosIV/lib/krb/get_default_principal.c
index 3a111ea..f9e18a1 100644
--- a/crypto/kerberosIV/lib/krb/get_default_principal.c
+++ b/crypto/kerberosIV/lib/krb/get_default_principal.c
@@ -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.
*
@@ -38,14 +38,13 @@
#include "krb_locl.h"
-RCSID("$Id: get_default_principal.c,v 1.10 1997/04/01 08:18:28 joda Exp $");
+RCSID("$Id: get_default_principal.c,v 1.12 1999/03/13 21:24:51 assar Exp $");
int
krb_get_default_principal(char *name, char *instance, char *realm)
{
char *file;
int ret;
-
char *p;
if ((file = getenv("KRBTKFILE")) == NULL)
@@ -58,7 +57,6 @@ krb_get_default_principal(char *name, char *instance, char *realm)
p = getenv("KRB4PRINCIPAL");
if(p && kname_parse(name, instance, realm, p) == KSUCCESS)
return 1;
-
#ifdef HAVE_PWD_H
{
@@ -68,11 +66,11 @@ krb_get_default_principal(char *name, char *instance, char *realm)
return -1;
}
- strcpy(name, pw->pw_name);
- strcpy(instance, "");
+ strcpy_truncate (name, pw->pw_name, ANAME_SZ);
+ strcpy_truncate (instance, "", INST_SZ);
krb_get_lrealm(realm, 1);
- if(strcmp(name, "root") == 0){
+ if(strcmp(name, "root") == 0) {
p = NULL;
#if defined(HAVE_GETLOGIN) && !defined(POSIX_GETLOGIN)
p = getlogin();
@@ -82,13 +80,13 @@ krb_get_default_principal(char *name, char *instance, char *realm)
if(p == NULL)
p = getenv("LOGNAME");
if(p){
- strncpy (name, p, ANAME_SZ);
- name[ANAME_SZ - 1] = '\0';
- strcpy(instance, "root");
+ strcpy_truncate (name, p, ANAME_SZ);
+ strcpy_truncate (instance, "root", INST_SZ);
}
}
return 1;
}
-#endif
+#else
return -1;
+#endif
}
diff --git a/crypto/kerberosIV/lib/krb/get_host.c b/crypto/kerberosIV/lib/krb/get_host.c
index de80ac4..aa5fb51 100644
--- a/crypto/kerberosIV/lib/krb/get_host.c
+++ b/crypto/kerberosIV/lib/krb/get_host.c
@@ -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.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: get_host.c,v 1.30 1997/05/02 14:29:13 assar Exp $");
+RCSID("$Id: get_host.c,v 1.45 1999/06/29 21:18:02 bg Exp $");
static struct host_list {
struct krb_host *this;
@@ -63,29 +63,42 @@ free_hosts(struct host_list *h)
}
static int
-parse_address(char *address, int *proto, char **host, int *port)
+parse_address(char *address, enum krb_host_proto *proto,
+ char **host, int *port)
{
char *p, *q;
- p = strchr(address, '/');
- *proto = IPPROTO_UDP;
- if(p){
- char prot[32];
- struct protoent *pp;
- strncpy(prot, address, p - address);
- prot[p - address] = 0;
- if((pp = getprotobyname(prot)))
- *proto = pp->p_proto;
- else
- krb_warning("Bad protocol name `%s', Using default `udp'.\n",
- prot);
- p++;
- }else
- p = address;
+ int default_port = krb_port;
+ *proto = PROTO_UDP;
+ if(strncmp(address, "http://", 7) == 0){
+ p = address + 7;
+ *proto = PROTO_HTTP;
+ default_port = 80;
+ }else{
+ p = strchr(address, '/');
+ if(p){
+ char prot[32];
+ strcpy_truncate (prot, address,
+ min(p - address + 1, sizeof(prot)));
+ if(strcasecmp(prot, "udp") == 0)
+ *proto = PROTO_UDP;
+ else if(strcasecmp(prot, "tcp") == 0)
+ *proto = PROTO_TCP;
+ else if(strcasecmp(prot, "http") == 0) {
+ *proto = PROTO_HTTP;
+ default_port = 80;
+ } else
+ krb_warning("Unknown protocol `%s', Using default `udp'.\n",
+ prot);
+ p++;
+ }else
+ p = address;
+ }
q = strchr(p, ':');
- if(q){
- *host = (char*)malloc(q - p + 1);
- strncpy(*host, p, q - p);
- (*host)[q - p] = 0;
+ if(q) {
+ *host = malloc(q - p + 1);
+ if (*host == NULL)
+ return -1;
+ strcpy_truncate (*host, p, q - p + 1);
q++;
{
struct servent *sp = getservbyname(q, NULL);
@@ -98,25 +111,49 @@ parse_address(char *address, int *proto, char **host, int *port)
*port = krb_port;
}
}
- }else{
- *host = strdup(p);
- *port = krb_port;
+ } else {
+ *port = default_port;
+ q = strchr(p, '/');
+ if (q) {
+ *host = malloc(q - p + 1);
+ if (*host == NULL)
+ return -1;
+ strcpy_truncate (*host, p, q - p + 1);
+ } else {
+ *host = strdup(p);
+ if(*host == NULL)
+ return -1;
+ }
}
return 0;
}
static int
-add_host(char *realm, char *address, int admin, int validate)
+add_host(const char *realm, char *address, int admin, int validate)
{
struct krb_host *host;
struct host_list *p, **last = &hosts;
+
host = (struct krb_host*)malloc(sizeof(struct krb_host));
- parse_address(address, &host->proto, &host->host, &host->port);
- if(validate && gethostbyname(host->host) == NULL){
- free(host->host);
+ if (host == NULL)
+ return 1;
+ if(parse_address(address, &host->proto, &host->host, &host->port) < 0) {
free(host);
return 1;
}
+ if (validate) {
+ if (krb_dns_debug)
+ krb_warning("Getting host entry for %s...", host->host);
+ if (gethostbyname(host->host) == NULL) {
+ if (krb_dns_debug)
+ krb_warning("Didn't get it.\n");
+ free(host->host);
+ free(host);
+ return 1;
+ }
+ else if (krb_dns_debug)
+ krb_warning("Got it.\n");
+ }
host->admin = admin;
for(p = hosts; p; p = p->next){
if(strcmp(realm, p->this->realm) == 0 &&
@@ -130,57 +167,106 @@ add_host(char *realm, char *address, int admin, int validate)
last = &p->next;
}
host->realm = strdup(realm);
+ if (host->realm == NULL) {
+ free(host->host);
+ free(host);
+ return 1;
+ }
p = (struct host_list*)malloc(sizeof(struct host_list));
+ if (p == NULL) {
+ free(host->realm);
+ free(host->host);
+ free(host);
+ return 1;
+ }
p->this = host;
p->next = NULL;
*last = p;
return 0;
}
-
-
static int
read_file(const char *filename, const char *r)
{
char line[1024];
- char realm[1024];
- char address[1024];
- char scratch[1024];
- int n;
int nhosts = 0;
-
FILE *f = fopen(filename, "r");
+
if(f == NULL)
return -1;
- while(fgets(line, sizeof(line), f)){
- n = sscanf(line, "%s %s admin %s", realm, address, scratch);
- if(n == 2 || n == 3){
- if(strcmp(realm, r))
- continue;
- if(add_host(realm, address, n == 3, 0) == 0)
- nhosts++;
- }
+ while(fgets(line, sizeof(line), f) != NULL) {
+ char *realm, *address, *admin;
+ char *save;
+
+ realm = strtok_r (line, " \t\n\r", &save);
+ if (realm == NULL)
+ continue;
+ if (strcmp(realm, r))
+ continue;
+ address = strtok_r (NULL, " \t\n\r", &save);
+ if (address == NULL)
+ continue;
+ admin = strtok_r (NULL, " \t\n\r", &save);
+ if (add_host(realm,
+ address,
+ admin != NULL && strcasecmp(admin, "admin") == 0,
+ 0) == 0)
+ ++nhosts;
}
fclose(f);
return nhosts;
}
+#if 0
+static int
+read_cellservdb (const char *filename, const char *realm)
+{
+ char line[1024];
+ FILE *f = fopen (filename, "r");
+ int nhosts = 0;
+
+ if (f == NULL)
+ return -1;
+ while (fgets (line, sizeof(line), f) != NULL) {
+ if (line[0] == '>'
+ && strncasecmp (line + 1, realm, strlen(realm)) == 0) {
+ while (fgets (line, sizeof(line), f) != NULL && *line != '>') {
+ char *hash;
+
+ if (line [strlen(line) - 1] == '\n')
+ line [strlen(line) - 1] = '\0';
+
+ hash = strchr (line, '#');
+
+ if (hash != NULL
+ && add_host (realm, hash + 1, 0, 0) == 0)
+ ++nhosts;
+ }
+ break;
+ }
+ }
+ fclose (f);
+ return nhosts;
+}
+#endif
+
static int
init_hosts(char *realm)
{
- static const char *files[] = KRB_CNF_FILES;
- int i;
- char *dir = getenv("KRBCONFDIR");
+ int i, j, ret = 0;
+ char file[MaxPathLen];
+
+ /*
+ * proto should really be NULL, but there are libraries out there
+ * that don't like that so we use "udp" instead.
+ */
- krb_port = ntohs(k_getportbyname (KRB_SERVICE, NULL, htons(KRB_PORT)));
- if(dir){
- char file[MaxPathLen];
- if(k_concat(file, sizeof(file), dir, "/krb.conf", NULL) == 0)
- read_file(file, realm);
+ krb_port = ntohs(k_getportbyname (KRB_SERVICE, "udp", htons(KRB_PORT)));
+ for(i = 0; krb_get_krbconf(i, file, sizeof(file)) == 0; i++) {
+ j = read_file(file, realm);
+ if (j > 0) ret += j;
}
- for(i = 0; files[i]; i++)
- read_file(files[i], realm);
- return 0;
+ return ret;
}
static void
@@ -190,7 +276,7 @@ srv_find_realm(char *realm, char *proto, char *service)
struct dns_reply *r;
struct resource_record *rr;
- k_mconcat(&domain, 1024, service, ".", proto, ".", realm, ".", NULL);
+ roken_mconcat(&domain, 1024, service, ".", proto, ".", realm, ".", NULL);
if(domain == NULL)
return;
@@ -225,11 +311,11 @@ krb_get_host(int nth, char *realm, int admin)
{
struct host_list *p;
static char orealm[REALM_SZ];
+
if(orealm[0] == 0 || strcmp(realm, orealm)){
/* quick optimization */
if(realm && realm[0]){
- strncpy(orealm, realm, sizeof(orealm) - 1);
- orealm[sizeof(orealm) - 1] = 0;
+ strcpy_truncate (orealm, realm, sizeof(orealm));
}else{
int ret = krb_get_lrealm(orealm, 1);
if(ret != KSUCCESS)
@@ -241,32 +327,46 @@ krb_get_host(int nth, char *realm, int admin)
hosts = NULL;
}
- init_hosts(orealm);
-
- srv_find_realm(orealm, "udp", KRB_SERVICE);
- srv_find_realm(orealm, "tcp", KRB_SERVICE);
+ if (init_hosts(orealm) < nth) {
+ srv_find_realm(orealm, "udp", KRB_SERVICE);
+ srv_find_realm(orealm, "tcp", KRB_SERVICE);
+ srv_find_realm(orealm, "http", KRB_SERVICE);
- {
- /* XXX this assumes no one has more than 99999 kerberos
- servers */
- char host[REALM_SZ + sizeof("kerberos-XXXXX..")];
+ {
+ char *host;
int i = 0;
- sprintf(host, "kerberos.%s.", orealm);
+
+ asprintf(&host, "kerberos.%s.", orealm);
+ if (host == NULL) {
+ free_hosts(hosts);
+ hosts = NULL;
+ return NULL;
+ }
add_host(orealm, host, 1, 1);
- do{
+ do {
i++;
- sprintf(host, "kerberos-%d.%s.", i, orealm);
- }while(i < 100000 && add_host(orealm, host, 0, 1) == 0);
+ free(host);
+ asprintf(&host, "kerberos-%d.%s.", i, orealm);
+ } while(host != NULL
+ && i < 100000
+ && add_host(orealm, host, 0, 1) == 0);
+ free(host);
+ }
}
+#if 0
+ read_cellservdb ("/usr/vice/etc/CellServDB", orealm);
+ read_cellservdb ("/usr/arla/etc/CellServDB", orealm);
+#endif
}
for(p = hosts; p; p = p->next){
if(strcmp(orealm, p->this->realm) == 0 &&
- (!admin || p->this->admin))
+ (!admin || p->this->admin)) {
if(nth == 1)
return p->this;
else
nth--;
+ }
}
return NULL;
}
@@ -277,7 +377,7 @@ krb_get_krbhst(char *host, char *realm, int nth)
struct krb_host *p = krb_get_host(nth, realm, 0);
if(p == NULL)
return KFAILURE;
- strcpy(host, p->host);
+ strcpy_truncate (host, p->host, MaxHostNameLen);
return KSUCCESS;
}
@@ -287,6 +387,6 @@ krb_get_admhst(char *host, char *realm, int nth)
struct krb_host *p = krb_get_host(nth, realm, 1);
if(p == NULL)
return KFAILURE;
- strcpy(host, p->host);
+ strcpy_truncate (host, p->host, MaxHostNameLen);
return KSUCCESS;
}
diff --git a/crypto/kerberosIV/lib/krb/get_in_tkt.c b/crypto/kerberosIV/lib/krb/get_in_tkt.c
index 435632a..4336687 100644
--- a/crypto/kerberosIV/lib/krb/get_in_tkt.c
+++ b/crypto/kerberosIV/lib/krb/get_in_tkt.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: get_in_tkt.c,v 1.15 1997/03/23 03:53:08 joda Exp $");
+RCSID("$Id: get_in_tkt.c,v 1.23 1999/07/01 09:36:22 assar Exp $");
/*
* This file contains three routines: passwd_to_key() and
@@ -35,7 +35,10 @@ RCSID("$Id: get_in_tkt.c,v 1.15 1997/03/23 03:53:08 joda Exp $");
*/
int
-passwd_to_key(char *user, char *instance, char *realm, void *passwd,
+passwd_to_key(const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
des_cblock *key)
{
#ifndef NOENCRYPTION
@@ -44,13 +47,34 @@ passwd_to_key(char *user, char *instance, char *realm, void *passwd,
return 0;
}
+int
+passwd_to_5key(const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
+ des_cblock *key)
+{
+ char *p;
+ size_t len;
+ len = roken_mconcat (&p, 512, passwd, realm, user, instance, NULL);
+ if(len == 0)
+ return -1;
+ des_string_to_key(p, key);
+ memset(p, 0, len);
+ free(p);
+ return 0;
+}
+
int
-passwd_to_afskey(char *user, char *instance, char *realm, void *passwd,
- des_cblock *key)
+passwd_to_afskey(const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
+ des_cblock *key)
{
#ifndef NOENCRYPTION
- afs_string_to_key((char *)passwd, realm, key);
+ afs_string_to_key(passwd, realm, key);
#endif
return (0);
}
@@ -72,9 +96,21 @@ passwd_to_afskey(char *user, char *instance, char *realm, void *passwd,
* The result of the call to krb_get_in_tkt() is returned.
*/
+typedef int (*const_key_proc_t) __P((const char *name,
+ const char *instance, /* IN parameter */
+ const char *realm,
+ const void *password,
+ des_cblock *key));
+
int
-krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
- char *sinstance, int life, char *password)
+krb_get_pw_in_tkt2(const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ const char *password,
+ des_cblock *key)
{
char pword[100]; /* storage for the password */
int code;
@@ -88,12 +124,61 @@ krb_get_pw_in_tkt(char *user, char *instance, char *realm, char *service,
password = pword;
}
- code = krb_get_in_tkt(user,instance,realm,service,sinstance,life,
- passwd_to_key, NULL, password);
- if (code == INTK_BADPW)
- code = krb_get_in_tkt(user,instance,realm,service,sinstance,life,
- passwd_to_afskey, NULL, password);
+ {
+ KTEXT_ST as_rep;
+ CREDENTIALS cred;
+ int ret = 0;
+ const_key_proc_t key_procs[] = { passwd_to_key,
+ passwd_to_afskey,
+ passwd_to_5key,
+ NULL };
+ const_key_proc_t *kp;
+
+ code = krb_mk_as_req(user, instance, realm,
+ service, sinstance, life, &as_rep);
+ if(code)
+ return code;
+ for(kp = key_procs; *kp; kp++){
+ KTEXT_ST tmp;
+ memcpy(&tmp, &as_rep, sizeof(as_rep));
+ code = krb_decode_as_rep(user,
+ (char *)instance, /* const_key_proc_t */
+ realm,
+ service,
+ sinstance,
+ (key_proc_t)*kp, /* const_key_proc_t */
+ NULL,
+ password,
+ &tmp,
+ &cred);
+ if(code == 0){
+ if(key)
+ (**kp)(user, instance, realm, password, key);
+ break;
+ }
+ if(code != INTK_BADPW)
+ ret = code; /* this is probably a better code than
+ what code gets after this loop */
+ }
+ if(code)
+ return ret ? ret : code;
+
+ code = tf_setup(&cred, user, instance);
+ }
if (password == pword)
memset(pword, 0, sizeof(pword));
return(code);
}
+
+int
+krb_get_pw_in_tkt(const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ const char *password)
+{
+ return krb_get_pw_in_tkt2(user, instance, realm,
+ service, sinstance, life, password, NULL);
+}
diff --git a/crypto/kerberosIV/lib/krb/get_krbrlm.c b/crypto/kerberosIV/lib/krb/get_krbrlm.c
index 8c5b0c9..9c675f6 100644
--- a/crypto/kerberosIV/lib/krb/get_krbrlm.c
+++ b/crypto/kerberosIV/lib/krb/get_krbrlm.c
@@ -1,27 +1,44 @@
-/*
- 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.
-
- */
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: get_krbrlm.c,v 1.16 1997/05/02 01:26:22 assar Exp $");
+RCSID("$Id: get_krbrlm.c,v 1.22.2.1 1999/09/02 08:51:04 joda Exp $");
/*
* krb_get_lrealm takes a pointer to a string, and a number, n. It fills
@@ -31,9 +48,6 @@ RCSID("$Id: get_krbrlm.c,v 1.16 1997/05/02 01:26:22 assar Exp $");
* config file does not exist, and if n=1, a successful return will occur
* with r = KRB_REALM (also defined in "krb.h").
*
- * NOTE: for archaic & compatibility reasons, this routine will only return
- * valid results when n = 1.
- *
* For the format of the KRB_CONF file, see comments describing the routine
* krb_get_krbhst().
*/
@@ -41,76 +55,88 @@ RCSID("$Id: get_krbrlm.c,v 1.16 1997/05/02 01:26:22 assar Exp $");
static int
krb_get_lrealm_f(char *r, int n, const char *fname)
{
+ char buf[1024];
+ char *p;
+ int nchar;
FILE *f;
int ret = KFAILURE;
+
+ if (n < 0)
+ return KFAILURE;
+ if(n == 0)
+ n = 1;
+
f = fopen(fname, "r");
- if(f){
- char buf[REALM_SZ];
- if(fgets(buf, sizeof(buf), f)){
- char *p = buf + strspn(buf, " \t");
- p[strcspn(p, " \t\r\n")] = 0;
- p[REALM_SZ - 1] = 0;
- strcpy(r, p);
- ret = KSUCCESS;
- }
- fclose(f);
- }
+ if (f == 0)
+ return KFAILURE;
+
+ for (; n > 0; n--)
+ if (fgets(buf, sizeof(buf), f) == 0)
+ goto done;
+
+ /* We now have the n:th line, remove initial white space. */
+ p = buf + strspn(buf, " \t");
+
+ /* Collect realmname. */
+ nchar = strcspn(p, " \t\n");
+ if (nchar == 0 || nchar > REALM_SZ)
+ goto done; /* No realmname */
+ strncpy(r, p, nchar);
+ r[nchar] = 0;
+
+ /* Does more junk follow? */
+ p += nchar;
+ nchar = strspn(p, " \t\n");
+ if (p[nchar] == 0)
+ ret = KSUCCESS; /* This was a realm name only line. */
+
+ done:
+ fclose(f);
return ret;
}
+static const char *no_default_realm = "NO.DEFAULT.REALM";
+
int
krb_get_lrealm(char *r, int n)
{
- static const char *const files[] = KRB_CNF_FILES;
- int i;
-
- const char *dir = getenv("KRBCONFDIR");
-
- if (n > 1)
- return(KFAILURE); /* Temporary restriction */
-
- /* First try user specified file */
- if (dir != 0) {
- char fname[MaxPathLen];
- if(k_concat(fname, sizeof(fname), dir, "/krb.conf", NULL) == 0)
- if (krb_get_lrealm_f(r, n, fname) == KSUCCESS)
+ int i;
+ char file[MaxPathLen];
+
+ for (i = 0; krb_get_krbconf(i, file, sizeof(file)) == 0; i++)
+ if (krb_get_lrealm_f(r, n, file) == KSUCCESS)
return KSUCCESS;
- }
- for (i = 0; files[i] != 0; i++)
- if (krb_get_lrealm_f(r, n, files[i]) == KSUCCESS)
- return KSUCCESS;
+ /* When nothing else works try default realm */
+ if (n == 1) {
+ char *t = krb_get_default_realm();
+
+ if (strcmp(t, no_default_realm) == 0)
+ return KFAILURE; /* Can't figure out default realm */
- /* If nothing else works try LOCALDOMAIN, if it exists */
- if (n == 1)
- {
- char *t, hostname[MaxHostNameLen];
- k_gethostname(hostname, sizeof(hostname));
- t = krb_realmofhost(hostname);
- if (t) {
- strcpy (r, t);
- return KSUCCESS;
- }
- t = strchr(hostname, '.');
- if (t == 0)
- return KFAILURE; /* No domain part, you loose */
-
- t++; /* Skip leading dot and upcase the rest */
- for (; *t; t++, r++)
- *r = toupper(*t);
- *r = 0;
- return(KSUCCESS);
+ strcpy(r, t);
+ return KSUCCESS;
}
- else
- return(KFAILURE);
+ else
+ return(KFAILURE);
}
-/* For SunOS5 compat. */
+/* Returns local realm if that can be figured out else NO.DEFAULT.REALM */
char *
krb_get_default_realm(void)
{
- static char local_realm[REALM_SZ]; /* local kerberos realm */
- if (krb_get_lrealm(local_realm, 1) != KSUCCESS)
- strcpy(local_realm, "NO.DEFAULT.REALM");
- return local_realm;
+ static char local_realm[REALM_SZ]; /* Local kerberos realm */
+
+ if (local_realm[0] == 0) {
+ char *t, hostname[MaxHostNameLen];
+
+ strcpy_truncate(local_realm, no_default_realm,
+ sizeof(local_realm)); /* Provide default */
+
+ gethostname(hostname, sizeof(hostname));
+ t = krb_realmofhost(hostname);
+ if (t && strcmp(t, no_default_realm) != 0)
+ strcpy_truncate(local_realm, t, sizeof(local_realm));
+ }
+ return local_realm;
}
diff --git a/crypto/kerberosIV/lib/krb/get_svc_in_tkt.c b/crypto/kerberosIV/lib/krb/get_svc_in_tkt.c
index c290524..daf7ae1 100644
--- a/crypto/kerberosIV/lib/krb/get_svc_in_tkt.c
+++ b/crypto/kerberosIV/lib/krb/get_svc_in_tkt.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: get_svc_in_tkt.c,v 1.8 1997/03/23 03:53:09 joda Exp $");
+RCSID("$Id: get_svc_in_tkt.c,v 1.9 1999/06/29 21:18:04 bg Exp $");
/*
* This file contains two routines: srvtab_to_key(), which gets
@@ -47,7 +47,10 @@ RCSID("$Id: get_svc_in_tkt.c,v 1.8 1997/03/23 03:53:09 joda Exp $");
*/
int
-srvtab_to_key(char *user, char *instance, char *realm, void *srvtab,
+srvtab_to_key(const char *user,
+ char *instance,
+ const char *realm,
+ const void *srvtab,
des_cblock *key)
{
if (!srvtab)
diff --git a/crypto/kerberosIV/lib/krb/get_tf_fullname.c b/crypto/kerberosIV/lib/krb/get_tf_fullname.c
index 33733d0..7a103b6 100644
--- a/crypto/kerberosIV/lib/krb/get_tf_fullname.c
+++ b/crypto/kerberosIV/lib/krb/get_tf_fullname.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: get_tf_fullname.c,v 1.6 1997/03/23 03:53:10 joda Exp $");
+RCSID("$Id: get_tf_fullname.c,v 1.7 1998/06/09 19:25:19 joda Exp $");
/*
* This file contains a routine to extract the fullname of a user
@@ -51,12 +51,12 @@ krb_get_tf_fullname(char *ticket_file, char *name, char *instance, char *realm)
return (tf_status);
if (name)
- strcpy(name, c.pname);
+ strcpy_truncate (name, c.pname, ANAME_SZ);
if (instance)
- strcpy(instance, c.pinst);
+ strcpy_truncate (instance, c.pinst, INST_SZ);
if ((tf_status = tf_get_cred(&c)) == KSUCCESS) {
if (realm)
- strcpy(realm, c.realm);
+ strcpy_truncate (realm, c.realm, REALM_SZ);
}
else {
if (tf_status == EOF)
diff --git a/crypto/kerberosIV/lib/krb/getaddrs.c b/crypto/kerberosIV/lib/krb/getaddrs.c
index d25ec1b..069b8b7 100644
--- a/crypto/kerberosIV/lib/krb/getaddrs.c
+++ b/crypto/kerberosIV/lib/krb/getaddrs.c
@@ -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.
*
@@ -38,12 +38,19 @@
#include "krb_locl.h"
-RCSID("$Id: getaddrs.c,v 1.19 1997/04/01 08:18:29 joda Exp $");
+RCSID("$Id: getaddrs.c,v 1.26.2.1 1999/07/22 03:15:33 assar Exp $");
-#if defined(HAVE_SYS_IOCTL_H) && SunOS != 4
+#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
#include <sys/ioctl.h>
#endif
#ifdef HAVE_NET_IF_H
+#ifdef __osf__
+struct rtentry;
+struct mbuf;
+#endif
+#ifdef _AIX
+#undef __P /* XXX hack for AIX 4.3 */
+#endif
#include <net/if.h>
#endif
@@ -62,7 +69,7 @@ k_get_all_addrs (struct in_addr **l)
char name[MaxHostNameLen];
struct hostent *he;
- if (k_gethostname(name, sizeof(name)) < 0)
+ if (gethostname(name, sizeof(name)) < 0)
return -1;
he = gethostbyname (name);
if (he == NULL)
@@ -74,57 +81,75 @@ k_get_all_addrs (struct in_addr **l)
return 1;
#else
int fd;
- char buf[BUFSIZ];
+ char *inbuf = NULL;
+ size_t in_len = 8192;
struct ifreq ifreq;
struct ifconf ifconf;
int num, j;
char *p;
+ size_t sz;
+ *l = NULL;
fd = socket(AF_INET, SOCK_DGRAM, 0);
if (fd < 0)
return -1;
- ifconf.ifc_len = sizeof(buf);
- ifconf.ifc_buf = buf;
- if(ioctl(fd, SIOCGIFCONF, &ifconf) < 0)
- return -1;
+ for(;;) {
+ void *tmp;
+
+ tmp = realloc (inbuf, in_len);
+ if (tmp == NULL)
+ goto fail;
+ inbuf = tmp;
+
+ ifconf.ifc_len = in_len;
+ ifconf.ifc_buf = inbuf;
+
+ if(ioctl(fd, SIOCGIFCONF, &ifconf) < 0)
+ goto fail;
+ if(ifconf.ifc_len + sizeof(ifreq) < in_len)
+ break;
+ in_len *= 2;
+ }
num = ifconf.ifc_len / sizeof(struct ifreq);
*l = malloc(num * sizeof(struct in_addr));
- if(*l == NULL) {
- close (fd);
- return -1;
- }
+ if(*l == NULL)
+ goto fail;
j = 0;
ifreq.ifr_name[0] = '\0';
- for (p = ifconf.ifc_buf; p < ifconf.ifc_buf + ifconf.ifc_len;) {
+ for (p = ifconf.ifc_buf; p < ifconf.ifc_buf + ifconf.ifc_len; p += sz) {
struct ifreq *ifr = (struct ifreq *)p;
-#ifdef SOCKADDR_HAS_SA_LEN
- size_t sz = sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len;
-#else
- size_t sz = sizeof(*ifr);
+ sz = sizeof(*ifr);
+#ifdef HAVE_STRUCT_SOCKADDR_SA_LEN
+ sz = max(sz, sizeof(ifr->ifr_name) + ifr->ifr_addr.sa_len);
#endif
+
if(strncmp(ifreq.ifr_name, ifr->ifr_name, sizeof(ifr->ifr_name))) {
- if(ioctl(fd, SIOCGIFFLAGS, ifr) < 0) {
- close (fd);
- free (*l);
- return -1;
- }
- if (ifr->ifr_flags & IFF_UP) {
- if(ioctl(fd, SIOCGIFADDR, ifr) < 0) {
- close (fd);
- free (*l);
- return -1;
- }
- (*l)[j++] = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
+ if(ioctl(fd, SIOCGIFFLAGS, ifr) < 0)
+ continue;
+ if (ifr->ifr_flags & IFF_UP) {
+ if(ioctl(fd, SIOCGIFADDR, ifr) < 0)
+ continue;
+ (*l)[j++] = ((struct sockaddr_in *)&ifr->ifr_addr)->sin_addr;
}
- ifreq = *ifr;
+ ifreq = *ifr;
}
- p = p + sz;
}
- if (j != num)
- *l = realloc (*l, j * sizeof(struct in_addr));
+ if (j != num) {
+ void *tmp;
+ tmp = realloc (*l, j * sizeof(struct in_addr));
+ if(tmp == NULL)
+ goto fail;
+ *l = tmp;
+ }
close (fd);
+ free(inbuf);
return j;
+fail:
+ close(fd);
+ free(inbuf);
+ free(*l);
+ return -1;
#endif /* SIOCGIFCONF */
}
diff --git a/crypto/kerberosIV/lib/krb/getfile.c b/crypto/kerberosIV/lib/krb/getfile.c
new file mode 100644
index 0000000..15c5ed8
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/getfile.c
@@ -0,0 +1,96 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: getfile.c,v 1.4 1998/06/09 19:25:19 joda Exp $");
+
+static int
+is_suid(void)
+{
+ int ret = 0;
+#ifdef HAVE_GETUID
+ ret |= getuid() != geteuid();
+#endif
+#ifdef HAVE_GETGID
+ ret |= getgid() != getegid();
+#endif
+ return ret;
+}
+
+static int
+get_file(const char **files, int num, const char *file, char *buf, size_t len)
+{
+ const char *p, **q;
+ int i = 0;
+ if(!is_suid() && (p = getenv("KRBCONFDIR"))){
+ if(num == i){
+ snprintf(buf, len, "%s/%s", p, file);
+ return 0;
+ }
+ i++;
+ }
+ for(q = files; *q; q++, i++){
+ if(num == i){
+ snprintf(buf, len, "%s", *q);
+ return 0;
+ }
+ }
+ return -1;
+}
+
+int
+krb_get_krbconf(int num, char *buf, size_t len)
+{
+ const char *files[] = KRB_CNF_FILES;
+ return get_file(files, num, "krb.conf", buf, len);
+}
+
+int
+krb_get_krbrealms(int num, char *buf, size_t len)
+{
+ const char *files[] = KRB_RLM_FILES;
+ return get_file(files, num, "krb.realms", buf, len);
+}
+
+int
+krb_get_krbextra(int num, char *buf, size_t len)
+{
+ const char *files[] = { "/etc/krb.extra", NULL };
+ return get_file(files, num, "krb.extra", buf, len);
+}
diff --git a/crypto/kerberosIV/lib/krb/getrealm.c b/crypto/kerberosIV/lib/krb/getrealm.c
index 05dfdab..16734c7 100644
--- a/crypto/kerberosIV/lib/krb/getrealm.c
+++ b/crypto/kerberosIV/lib/krb/getrealm.c
@@ -21,9 +21,11 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: getrealm.c,v 1.25 1997/05/02 14:29:14 assar Exp $");
+RCSID("$Id: getrealm.c,v 1.35 1998/08/31 10:40:06 assar Exp $");
-#define MATCH_SUBDOMAINS 0
+#ifndef MATCH_SUBDOMAINS
+#define MATCH_SUBDOMAINS 0
+#endif
/*
* krb_realmofhost.
@@ -66,13 +68,16 @@ dns_find_realm(char *hostname, char *realm)
while(1){
snprintf(domain, sizeof(domain), "krb4-realm.%s.", p);
+ p = strchr(p, '.');
+ if(p == NULL)
+ break;
+ p++;
r = dns_lookup(domain, "TXT");
if(r){
struct resource_record *rr = r->head;
while(rr){
if(rr->type == T_TXT){
- strncpy(realm, rr->u.txt, REALM_SZ);
- realm[REALM_SZ - 1] = 0;
+ strcpy_truncate(realm, rr->u.txt, REALM_SZ);
dns_free_data(r);
return level;
}
@@ -81,10 +86,6 @@ dns_find_realm(char *hostname, char *realm)
dns_free_data(r);
}
level++;
- p = strchr(p, '.');
- if(p == NULL)
- break;
- p++;
}
return -1;
}
@@ -93,92 +94,92 @@ dns_find_realm(char *hostname, char *realm)
static FILE *
open_krb_realms(void)
{
- static const char *const files[] = KRB_RLM_FILES;
- FILE *res;
- int i;
-
- const char *dir = getenv("KRBCONFDIR");
-
- /* First try user specified file */
- if (dir != 0) {
- char fname[MaxPathLen];
+ int i;
+ char file[MaxPathLen];
+ FILE *res;
- if(k_concat(fname, sizeof(fname), dir, "/krb.realms", NULL) == 0)
- if ((res = fopen(fname, "r")) != NULL)
+ for(i = 0; krb_get_krbrealms(i, file, sizeof(file)) == 0; i++)
+ if ((res = fopen(file, "r")) != NULL)
return res;
- }
-
- for (i = 0; files[i] != 0; i++)
- if ((res = fopen(files[i], "r")) != NULL)
- return res;
-
return NULL;
}
+static int
+file_find_realm(const char *phost, const char *domain,
+ char *ret_realm, size_t ret_realm_sz)
+{
+ FILE *trans_file;
+ char buf[1024];
+ int ret = -1;
+
+ if ((trans_file = open_krb_realms()) == NULL)
+ return -1;
+
+ while (fgets(buf, sizeof(buf), trans_file) != NULL) {
+ char *save = NULL;
+ char *tok;
+ char *tmp_host;
+ char *tmp_realm;
+
+ tok = strtok_r(buf, " \t\r\n", &save);
+ if(tok == NULL)
+ continue;
+ tmp_host = tok;
+ tok = strtok_r(NULL, " \t\r\n", &save);
+ if(tok == NULL)
+ continue;
+ tmp_realm = tok;
+ if (strcasecmp(tmp_host, phost) == 0) {
+ /* exact match of hostname, so return the realm */
+ strcpy_truncate(ret_realm, tmp_realm, ret_realm_sz);
+ ret = 0;
+ break;
+ }
+ if ((tmp_host[0] == '.') && domain) {
+ const char *cp = domain;
+ do {
+ if(strcasecmp(tmp_host, cp) == 0){
+ /* domain match, save for later */
+ strcpy_truncate(ret_realm, tmp_realm, ret_realm_sz);
+ ret = 0;
+ break;
+ }
+ cp = strchr(cp + 1, '.');
+ } while(MATCH_SUBDOMAINS && cp);
+ }
+ if (ret == 0)
+ break;
+ }
+ fclose(trans_file);
+ return ret;
+}
+
char *
krb_realmofhost(const char *host)
{
- static char ret_realm[REALM_SZ];
- char *domain;
- FILE *trans_file;
- char trans_host[MaxHostNameLen];
- char trans_realm[REALM_SZ];
- char buf[1024];
-
- char phost[MaxHostNameLen];
+ static char ret_realm[REALM_SZ];
+ char *domain;
+ char phost[MaxHostNameLen];
- krb_name_to_name(host, phost, sizeof(phost));
+ krb_name_to_name(host, phost, sizeof(phost));
- domain = strchr(phost, '.');
+ domain = strchr(phost, '.');
- /* prepare default */
- if(dns_find_realm(phost, ret_realm) < 0){
- if (domain) {
- char *cp;
+ if(file_find_realm(phost, domain, ret_realm, sizeof ret_realm) == 0)
+ return ret_realm;
+
+ if(dns_find_realm(phost, ret_realm) >= 0)
+ return ret_realm;
+
+ if (domain) {
+ char *cp;
- strncpy(ret_realm, &domain[1], REALM_SZ);
- ret_realm[REALM_SZ - 1] = 0;
- /* Upper-case realm */
- for (cp = ret_realm; *cp; cp++)
- *cp = toupper(*cp);
- } else {
- krb_get_lrealm(ret_realm, 1);
- }
- }
-
- if ((trans_file = open_krb_realms()) == NULL)
- return(ret_realm); /* krb_errno = KRB_NO_TRANS */
-
- while (fgets(buf, sizeof(buf), trans_file)) {
- char *save = NULL;
- char *tok = strtok_r(buf, " \t\r\n", &save);
- if(tok == NULL)
- continue;
- strncpy(trans_host, tok, MaxHostNameLen);
- trans_host[MaxHostNameLen - 1] = 0;
- tok = strtok_r(NULL, " \t\r\n", &save);
- if(tok == NULL)
- continue;
- strcpy(trans_realm, tok);
- trans_realm[REALM_SZ - 1] = 0;
- if (!strcasecmp(trans_host, phost)) {
- /* exact match of hostname, so return the realm */
- strcpy(ret_realm, trans_realm);
- fclose(trans_file);
- return(ret_realm);
- }
- if ((trans_host[0] == '.') && domain) {
- char *cp = domain;
- do {
- if(strcasecmp(trans_host, domain) == 0){
- /* domain match, save for later */
- strcpy(ret_realm, trans_realm);
- break;
- }
- cp = strchr(cp + 1, '.');
- } while(MATCH_SUBDOMAINS && cp);
- }
- }
- fclose(trans_file);
- return ret_realm;
+ strcpy_truncate(ret_realm, &domain[1], REALM_SZ);
+ /* Upper-case realm */
+ for (cp = ret_realm; *cp; cp++)
+ *cp = toupper(*cp);
+ } else {
+ strncpy(ret_realm, krb_get_default_realm(), REALM_SZ); /* Wild guess */
+ }
+ return ret_realm;
}
diff --git a/crypto/kerberosIV/lib/krb/k_getsockinst.c b/crypto/kerberosIV/lib/krb/k_getsockinst.c
index 04676b1..6c3edb0 100644
--- a/crypto/kerberosIV/lib/krb/k_getsockinst.c
+++ b/crypto/kerberosIV/lib/krb/k_getsockinst.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: k_getsockinst.c,v 1.10 1997/05/02 14:29:17 assar Exp $");
+RCSID("$Id: k_getsockinst.c,v 1.11 1998/06/09 19:25:20 joda Exp $");
/*
* Return in inst the name of the local interface bound to socket
@@ -61,8 +61,7 @@ k_getsockinst(int fd, char *inst, size_t inst_size)
if (hnam == 0)
goto fail;
- strncpy (inst, hnam->h_name, inst_size);
- inst[inst_size - 1] = '\0';
+ strcpy_truncate (inst, hnam->h_name, inst_size);
k_ricercar(inst); /* Canonicalize name */
return 0; /* Success */
diff --git a/crypto/kerberosIV/lib/krb/kdc_reply.c b/crypto/kerberosIV/lib/krb/kdc_reply.c
index aa012e0..51675b0 100644
--- a/crypto/kerberosIV/lib/krb/kdc_reply.c
+++ b/crypto/kerberosIV/lib/krb/kdc_reply.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: kdc_reply.c,v 1.9 1997/04/15 21:52:14 assar Exp $");
+RCSID("$Id: kdc_reply.c,v 1.11 1998/06/09 19:25:20 joda Exp $");
static int little_endian; /* XXX ugly */
@@ -52,15 +52,15 @@ kdc_reply_cred(KTEXT cip, CREDENTIALS *cred)
if(p + strlen((char*)p) > cip->dat + cip->length)
return INTK_BADPW;
- p += krb_get_string(p, cred->service);
+ p += krb_get_string(p, cred->service, sizeof(cred->service));
if(p + strlen((char*)p) > cip->dat + cip->length)
return INTK_BADPW;
- p += krb_get_string(p, cred->instance);
+ p += krb_get_string(p, cred->instance, sizeof(cred->instance));
if(p + strlen((char*)p) > cip->dat + cip->length)
return INTK_BADPW;
- p += krb_get_string(p, cred->realm);
+ p += krb_get_string(p, cred->realm, sizeof(cred->realm));
if(p + 3 > cip->dat + cip->length)
return INTK_BADPW;
@@ -107,11 +107,14 @@ kdc_reply_cipher(KTEXT reply, KTEXT cip)
if(type == AUTH_MSG_ERR_REPLY){
u_int32_t code;
+ /* skip these fields */
p += strlen((char*)p) + 1; /* name */
p += strlen((char*)p) + 1; /* instance */
p += strlen((char*)p) + 1; /* realm */
p += 4; /* time */
p += krb_get_int(p, &code, 4, little_endian);
+ if(code == 0)
+ code = KFAILURE; /* things will go bad otherwise */
return code;
}
if(type != AUTH_MSG_KDC_REPLY)
diff --git a/crypto/kerberosIV/lib/krb/kntoln.c b/crypto/kerberosIV/lib/krb/kntoln.c
index 88b8b25..86e5205 100644
--- a/crypto/kerberosIV/lib/krb/kntoln.c
+++ b/crypto/kerberosIV/lib/krb/kntoln.c
@@ -47,7 +47,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: kntoln.c,v 1.7 1997/03/23 03:53:12 joda Exp $");
+RCSID("$Id: kntoln.c,v 1.10 1998/06/09 19:25:21 joda Exp $");
int
krb_kntoln(AUTH_DAT *ad, char *lname)
@@ -91,57 +91,55 @@ extern int errno;
static char lrealm[REALM_SZ] = "";
-an_to_ln(ad,lname)
-AUTH_DAT *ad;
-char *lname;
+int
+an_to_ln(AUTH_DAT *ad, char *lname)
{
- static DBM *aname = NULL;
- char keyname[ANAME_SZ+INST_SZ+REALM_SZ+2];
-
- if(!(*lrealm) && (krb_get_lrealm(lrealm,1) == KFAILURE))
- return(KFAILURE);
-
- if((strcmp(ad->pinst,"") && strcmp(ad->pinst,"root")) ||
-strcmp(ad->prealm,lrealm)) {
- datum val;
- datum key;
- /*
- * Non-local name (or) non-null and non-root instance.
- * Look up in dbm file.
- */
- if (!aname) {
- if ((aname = dbm_open("/etc/aname", O_RDONLY, 0))
- == NULL) return (KFAILURE);
- }
- /* Construct dbm lookup key. */
- an_to_a(ad, keyname);
- key.dptr = keyname;
- key.dsize = strlen(keyname)+1;
- flock(dbm_dirfno(aname), LOCK_SH);
- val = dbm_fetch(aname, key);
- flock(dbm_dirfno(aname), LOCK_UN);
- if (!val.dptr) {
- dbm_close(aname);
- return(KFAILURE);
- }
- /* Got it! */
- strcpy(lname,val.dptr);
- return(KSUCCESS);
- } else strcpy(lname,ad->pname);
- return(KSUCCESS);
+ static DBM *aname = NULL;
+ char keyname[ANAME_SZ+INST_SZ+REALM_SZ+2];
+
+ if(!(*lrealm) && (krb_get_lrealm(lrealm,1) == KFAILURE))
+ return(KFAILURE);
+
+ if((strcmp(ad->pinst,"") && strcmp(ad->pinst,"root")) ||
+ strcmp(ad->prealm,lrealm)) {
+ datum val;
+ datum key;
+ /*
+ * Non-local name (or) non-null and non-root instance.
+ * Look up in dbm file.
+ */
+ if (!aname) {
+ if ((aname = dbm_open("/etc/aname", O_RDONLY, 0))
+ == NULL) return (KFAILURE);
+ }
+ /* Construct dbm lookup key. */
+ an_to_a(ad, keyname);
+ key.dptr = keyname;
+ key.dsize = strlen(keyname)+1;
+ flock(dbm_dirfno(aname), LOCK_SH);
+ val = dbm_fetch(aname, key);
+ flock(dbm_dirfno(aname), LOCK_UN);
+ if (!val.dptr) {
+ dbm_close(aname);
+ return(KFAILURE);
+ }
+ /* Got it! */
+ strcpy(lname,val.dptr);
+ return(KSUCCESS);
+ } else strcpy(lname,ad->pname);
+ return(KSUCCESS);
}
-an_to_a(ad, str)
- AUTH_DAT *ad;
- char *str;
+void
+an_to_a(AUTH_DAT *ad, char *str)
{
- strcpy(str, ad->pname);
- if(*ad->pinst) {
- strcat(str, ".");
- strcat(str, ad->pinst);
- }
- strcat(str, "@");
- strcat(str, ad->prealm);
+ strcpy(str, ad->pname);
+ if(*ad->pinst) {
+ strcat(str, ".");
+ strcat(str, ad->pinst);
+ }
+ strcat(str, "@");
+ strcat(str, ad->prealm);
}
/*
@@ -149,32 +147,31 @@ an_to_a(ad, str)
* into a struct AUTH_DAT.
*/
-a_to_an(str, ad)
- AUTH_DAT *ad;
- char *str;
+int
+a_to_an(char *str, AUTH_DAT *ad)
{
- char *buf = (char *)malloc(strlen(str)+1);
- char *rlm, *inst, *princ;
-
- if(!(*lrealm) && (krb_get_lrealm(lrealm,1) == KFAILURE)) {
- free(buf);
- return(KFAILURE);
- }
- /* destructive string hacking is more fun.. */
- strcpy(buf, str);
-
- if (rlm = index(buf, '@')) {
- *rlm++ = '\0';
- }
- if (inst = index(buf, '.')) {
- *inst++ = '\0';
- }
- strcpy(ad->pname, buf);
- if(inst) strcpy(ad->pinst, inst);
- else *ad->pinst = '\0';
- if (rlm) strcpy(ad->prealm, rlm);
- else strcpy(ad->prealm, lrealm);
- free(buf);
- return(KSUCCESS);
+ char *buf = (char *)malloc(strlen(str)+1);
+ char *rlm, *inst, *princ;
+
+ if(!(*lrealm) && (krb_get_lrealm(lrealm,1) == KFAILURE)) {
+ free(buf);
+ return(KFAILURE);
+ }
+ /* destructive string hacking is more fun.. */
+ strcpy(buf, str);
+
+ if (rlm = index(buf, '@')) {
+ *rlm++ = '\0';
+ }
+ if (inst = index(buf, '.')) {
+ *inst++ = '\0';
+ }
+ strcpy(ad->pname, buf);
+ if(inst) strcpy(ad->pinst, inst);
+ else *ad->pinst = '\0';
+ if (rlm) strcpy(ad->prealm, rlm);
+ else strcpy(ad->prealm, lrealm);
+ free(buf);
+ return(KSUCCESS);
}
#endif
diff --git a/crypto/kerberosIV/lib/krb/krb-archaeology.h b/crypto/kerberosIV/lib/krb/krb-archaeology.h
new file mode 100644
index 0000000..0757996
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb-archaeology.h
@@ -0,0 +1,131 @@
+/*
+ * $Id: krb-archaeology.h,v 1.2 1997/12/05 02:04:44 joda Exp $
+ *
+ * Most of the cruft in this file is probably:
+ *
+ * Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
+ * of Technology.
+ *
+ * For copying and distribution information, please see the file
+ * <mit-copyright.h>.
+ */
+
+#ifndef __KRB_ARCHAEOLOGY_H__
+#define __KRB_ARCHAEOLOGY_H__
+
+/* 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);
+
+/* Macro's to obtain various fields from a packet */
+
+#define pkt_version(packet) (unsigned int) *(packet->dat)
+#define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
+#define pkt_a_name(packet) (packet->dat+2)
+#define pkt_a_inst(packet) \
+ (packet->dat+3+strlen((char *)pkt_a_name(packet)))
+#define pkt_a_realm(packet) \
+ (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
+
+/* Macro to obtain realm from application request */
+#define apreq_realm(auth) (auth->dat + 3)
+
+#define pkt_time_ws(packet) (char *) \
+ (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
+ strlen((char *)pkt_a_inst(packet)) + \
+ strlen((char *)pkt_a_realm(packet)))
+
+#define pkt_no_req(packet) (unsigned short) \
+ *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
+ strlen((char *)pkt_a_inst(packet)) + \
+ strlen((char *)pkt_a_realm(packet)))
+#define pkt_x_date(packet) (char *) \
+ (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
+ strlen((char *)pkt_a_inst(packet)) + \
+ strlen((char *)pkt_a_realm(packet)))
+#define pkt_err_code(packet) ( (char *) \
+ (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
+ strlen((char *)pkt_a_inst(packet)) + \
+ strlen((char *)pkt_a_realm(packet))))
+#define pkt_err_text(packet) \
+ (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
+ strlen((char *)pkt_a_inst(packet)) + \
+ strlen((char *)pkt_a_realm(packet)))
+
+/*
+ * 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 */
+
+#endif /* __KRB_ARCHAEOLOGY_H__ */
diff --git a/crypto/kerberosIV/lib/krb/krb-protos.h b/crypto/kerberosIV/lib/krb/krb-protos.h
new file mode 100644
index 0000000..965e4dc
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb-protos.h
@@ -0,0 +1,773 @@
+/*
+ * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: krb-protos.h,v 1.18 1999/06/29 21:18:05 bg Exp $ */
+
+#ifndef __krb_protos_h__
+#define __krb_protos_h__
+
+#if defined (__STDC__) || defined (_MSC_VER)
+#include <stdarg.h>
+#ifndef __P
+#define __P(x) x
+#endif
+#else
+#ifndef __P
+#define __P(x) ()
+#endif
+#endif
+
+#ifdef __STDC__
+struct in_addr;
+struct sockaddr_in;
+struct timeval;
+#endif
+
+#ifndef KRB_LIB_FUNCTION
+#if defined(__BORLANDC__)
+#define KRB_LIB_FUNCTION /* not-ready-definition-yet */
+#elif defined(_MSC_VER)
+#define KRB_LIB_FUNCTION /* not-ready-definition-yet2 */
+#else
+#define KRB_LIB_FUNCTION
+#endif
+#endif
+
+void KRB_LIB_FUNCTION
+afs_string_to_key __P((
+ const char *str,
+ const char *cell,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+create_ciph __P((
+ KTEXT c,
+ unsigned char *session,
+ char *service,
+ char *instance,
+ char *realm,
+ u_int32_t life,
+ int kvno,
+ KTEXT tkt,
+ u_int32_t kdc_time,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+cr_err_reply __P((
+ KTEXT pkt,
+ char *pname,
+ char *pinst,
+ char *prealm,
+ u_int32_t time_ws,
+ u_int32_t e,
+ char *e_string));
+
+int KRB_LIB_FUNCTION
+decomp_ticket __P((
+ KTEXT tkt,
+ unsigned char *flags,
+ char *pname,
+ char *pinstance,
+ char *prealm,
+ u_int32_t *paddress,
+ unsigned char *session,
+ int *life,
+ u_int32_t *time_sec,
+ char *sname,
+ char *sinstance,
+ des_cblock *key,
+ des_key_schedule schedule));
+
+int KRB_LIB_FUNCTION
+dest_tkt __P((void));
+
+int KRB_LIB_FUNCTION
+get_ad_tkt __P((
+ char *service,
+ char *sinstance,
+ char *realm,
+ int lifetime));
+
+int KRB_LIB_FUNCTION
+getst __P((
+ int fd,
+ char *s,
+ int n));
+
+int KRB_LIB_FUNCTION
+in_tkt __P((
+ char *pname,
+ char *pinst));
+
+int KRB_LIB_FUNCTION
+k_get_all_addrs __P((struct in_addr **l));
+
+int KRB_LIB_FUNCTION
+k_gethostname __P((
+ char *name,
+ int namelen));
+
+int KRB_LIB_FUNCTION
+k_getportbyname __P((
+ const char *service,
+ const char *proto,
+ int default_port));
+
+int KRB_LIB_FUNCTION
+k_getsockinst __P((
+ int fd,
+ char *inst,
+ size_t inst_size));
+
+int KRB_LIB_FUNCTION
+k_isinst __P((char *s));
+
+int KRB_LIB_FUNCTION
+k_isname __P((char *s));
+
+int KRB_LIB_FUNCTION
+k_isrealm __P((char *s));
+
+struct tm * KRB_LIB_FUNCTION
+k_localtime __P((u_int32_t *tp));
+
+int KRB_LIB_FUNCTION
+kname_parse __P((
+ char *np,
+ char *ip,
+ char *rp,
+ char *fullname));
+
+int KRB_LIB_FUNCTION
+krb_atime_to_life __P((char *atime));
+
+int KRB_LIB_FUNCTION
+krb_check_auth __P((
+ KTEXT packet,
+ u_int32_t checksum,
+ MSG_DAT *msg_data,
+ des_cblock *session,
+ struct des_ks_struct *schedule,
+ struct sockaddr_in *laddr,
+ struct sockaddr_in *faddr));
+
+int KRB_LIB_FUNCTION
+krb_check_tm __P((struct tm tm));
+
+KTEXT KRB_LIB_FUNCTION
+krb_create_death_packet __P((char *a_name));
+
+int KRB_LIB_FUNCTION
+krb_create_ticket __P((
+ KTEXT tkt,
+ unsigned char flags,
+ char *pname,
+ char *pinstance,
+ char *prealm,
+ int32_t paddress,
+ void *session,
+ int16_t life,
+ int32_t time_sec,
+ char *sname,
+ char *sinstance,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+krb_decode_as_rep __P((
+ const char *user,
+ char *instance, /* INOUT parameter */
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ key_proc_t key_proc,
+ decrypt_proc_t decrypt_proc,
+ const void *arg,
+ KTEXT as_rep,
+ CREDENTIALS *cred));
+
+int KRB_LIB_FUNCTION
+krb_disable_debug __P((void));
+
+int KRB_LIB_FUNCTION
+krb_enable_debug __P((void));
+
+int KRB_LIB_FUNCTION
+krb_equiv __P((
+ u_int32_t a,
+ u_int32_t b));
+
+int KRB_LIB_FUNCTION
+krb_get_address __P((
+ void *from,
+ u_int32_t *to));
+
+int KRB_LIB_FUNCTION
+krb_get_admhst __P((
+ char *host,
+ char *realm,
+ int nth));
+
+int KRB_LIB_FUNCTION
+krb_get_config_bool __P((const char *variable));
+
+const char * KRB_LIB_FUNCTION
+krb_get_config_string __P((const char *variable));
+
+int KRB_LIB_FUNCTION
+krb_get_cred __P((
+ char *service,
+ char *instance,
+ char *realm,
+ CREDENTIALS *c));
+
+int KRB_LIB_FUNCTION
+krb_get_default_principal __P((
+ char *name,
+ char *instance,
+ char *realm));
+
+char * KRB_LIB_FUNCTION
+krb_get_default_realm __P((void));
+
+const char * KRB_LIB_FUNCTION
+krb_get_err_text __P((int code));
+
+struct krb_host* KRB_LIB_FUNCTION
+krb_get_host __P((
+ int nth,
+ char *realm,
+ int admin));
+
+int KRB_LIB_FUNCTION
+krb_get_in_tkt __P((
+ char *user,
+ char *instance,
+ char *realm,
+ char *service,
+ char *sinstance,
+ int life,
+ key_proc_t key_proc,
+ decrypt_proc_t decrypt_proc,
+ void *arg));
+
+int KRB_LIB_FUNCTION
+krb_get_int __P((
+ void *f,
+ u_int32_t *to,
+ int size,
+ int lsb));
+
+int KRB_LIB_FUNCTION
+krb_get_kdc_time_diff __P((void));
+
+int KRB_LIB_FUNCTION
+krb_get_krbconf __P((
+ int num,
+ char *buf,
+ size_t len));
+
+int KRB_LIB_FUNCTION
+krb_get_krbextra __P((
+ int num,
+ char *buf,
+ size_t len));
+
+int KRB_LIB_FUNCTION
+krb_get_krbhst __P((
+ char *host,
+ char *realm,
+ int nth));
+
+int KRB_LIB_FUNCTION
+krb_get_krbrealms __P((
+ int num,
+ char *buf,
+ size_t len));
+
+int KRB_LIB_FUNCTION
+krb_get_lrealm __P((
+ char *r,
+ int n));
+
+int KRB_LIB_FUNCTION
+krb_get_nir __P((
+ void *from,
+ char *name,
+ char *instance,
+ char *realm));
+
+char * KRB_LIB_FUNCTION
+krb_get_phost __P((const char *alias));
+
+int KRB_LIB_FUNCTION
+krb_get_pw_in_tkt __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ const char *password));
+
+int KRB_LIB_FUNCTION
+krb_get_pw_in_tkt2 __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ const char *password,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+krb_get_string __P((
+ void *from,
+ char *to,
+ size_t to_size));
+
+int KRB_LIB_FUNCTION
+krb_get_svc_in_tkt __P((
+ char *user,
+ char *instance,
+ char *realm,
+ char *service,
+ char *sinstance,
+ int life,
+ char *srvtab));
+
+int KRB_LIB_FUNCTION
+krb_get_tf_fullname __P((
+ char *ticket_file,
+ char *name,
+ char *instance,
+ char *realm));
+
+int KRB_LIB_FUNCTION
+krb_get_tf_realm __P((
+ char *ticket_file,
+ char *realm));
+
+void KRB_LIB_FUNCTION
+krb_kdctimeofday __P((struct timeval *tv));
+
+int KRB_LIB_FUNCTION
+krb_kntoln __P((
+ AUTH_DAT *ad,
+ char *lname));
+
+int KRB_LIB_FUNCTION
+krb_kuserok __P((
+ char *name,
+ char *instance,
+ char *realm,
+ char *luser));
+
+char * KRB_LIB_FUNCTION
+krb_life_to_atime __P((int life));
+
+u_int32_t KRB_LIB_FUNCTION
+krb_life_to_time __P((
+ u_int32_t start,
+ int life_));
+
+int KRB_LIB_FUNCTION
+krb_lsb_antinet_ulong_cmp __P((
+ u_int32_t x,
+ u_int32_t y));
+
+int KRB_LIB_FUNCTION
+krb_lsb_antinet_ushort_cmp __P((
+ u_int16_t x,
+ u_int16_t y));
+
+int KRB_LIB_FUNCTION
+krb_mk_as_req __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ KTEXT cip));
+
+int KRB_LIB_FUNCTION
+krb_mk_auth __P((
+ int32_t options,
+ KTEXT ticket,
+ char *service,
+ char *instance,
+ char *realm,
+ u_int32_t checksum,
+ char *version,
+ KTEXT buf));
+
+int32_t KRB_LIB_FUNCTION
+krb_mk_err __P((
+ u_char *p,
+ int32_t e,
+ char *e_string));
+
+int32_t KRB_LIB_FUNCTION
+krb_mk_priv __P((
+ void *in,
+ void *out,
+ u_int32_t length,
+ struct des_ks_struct *schedule,
+ des_cblock *key,
+ struct sockaddr_in *sender,
+ struct sockaddr_in *receiver));
+
+int KRB_LIB_FUNCTION
+krb_mk_req __P((
+ KTEXT authent,
+ char *service,
+ char *instance,
+ char *realm,
+ int32_t checksum));
+
+int32_t KRB_LIB_FUNCTION
+krb_mk_safe __P((
+ void *in,
+ void *out,
+ u_int32_t length,
+ des_cblock *key,
+ struct sockaddr_in *sender,
+ struct sockaddr_in *receiver));
+
+int KRB_LIB_FUNCTION
+krb_net_read __P((
+ int fd,
+ void *v,
+ size_t len));
+
+int KRB_LIB_FUNCTION
+krb_net_write __P((
+ int fd,
+ const void *v,
+ size_t len));
+
+int KRB_LIB_FUNCTION
+krb_parse_name __P((
+ const char *fullname,
+ krb_principal *principal));
+
+int KRB_LIB_FUNCTION
+krb_put_address __P((
+ u_int32_t addr,
+ void *to,
+ size_t rem));
+
+int KRB_LIB_FUNCTION
+krb_put_int __P((
+ u_int32_t from,
+ void *to,
+ size_t rem,
+ int size));
+
+int KRB_LIB_FUNCTION
+krb_put_nir __P((
+ const char *name,
+ const char *instance,
+ const char *realm,
+ void *to,
+ size_t rem));
+
+int KRB_LIB_FUNCTION
+krb_put_string __P((
+ const char *from,
+ void *to,
+ size_t rem));
+
+int KRB_LIB_FUNCTION
+krb_rd_err __P((
+ u_char *in,
+ u_int32_t in_length,
+ int32_t *code,
+ MSG_DAT *m_data));
+
+int32_t KRB_LIB_FUNCTION
+krb_rd_priv __P((
+ void *in,
+ u_int32_t in_length,
+ struct des_ks_struct *schedule,
+ des_cblock *key,
+ struct sockaddr_in *sender,
+ struct sockaddr_in *receiver,
+ MSG_DAT *m_data));
+
+int KRB_LIB_FUNCTION
+krb_rd_req __P((
+ KTEXT authent,
+ char *service,
+ char *instance,
+ int32_t from_addr,
+ AUTH_DAT *ad,
+ char *fn));
+
+int32_t KRB_LIB_FUNCTION
+krb_rd_safe __P((
+ void *in,
+ u_int32_t in_length,
+ des_cblock *key,
+ struct sockaddr_in *sender,
+ struct sockaddr_in *receiver,
+ MSG_DAT *m_data));
+
+int KRB_LIB_FUNCTION
+krb_realm_parse __P((
+ char *realm,
+ int length));
+
+char * KRB_LIB_FUNCTION
+krb_realmofhost __P((const char *host));
+
+int KRB_LIB_FUNCTION
+krb_recvauth __P((
+ int32_t options,
+ int fd,
+ KTEXT ticket,
+ char *service,
+ char *instance,
+ struct sockaddr_in *faddr,
+ struct sockaddr_in *laddr,
+ AUTH_DAT *kdata,
+ char *filename,
+ struct des_ks_struct *schedule,
+ char *version));
+
+int KRB_LIB_FUNCTION
+krb_sendauth __P((
+ int32_t options,
+ int fd,
+ KTEXT ticket,
+ char *service,
+ char *instance,
+ char *realm,
+ u_int32_t checksum,
+ MSG_DAT *msg_data,
+ CREDENTIALS *cred,
+ struct des_ks_struct *schedule,
+ struct sockaddr_in *laddr,
+ struct sockaddr_in *faddr,
+ char *version));
+
+void KRB_LIB_FUNCTION
+krb_set_kdc_time_diff __P((int diff));
+
+int KRB_LIB_FUNCTION
+krb_set_key __P((
+ void *key,
+ int cvt));
+
+int KRB_LIB_FUNCTION
+krb_set_lifetime __P((int newval));
+
+void KRB_LIB_FUNCTION
+krb_set_tkt_string __P((const char *val));
+
+const char * KRB_LIB_FUNCTION
+krb_stime __P((time_t *t));
+
+int KRB_LIB_FUNCTION
+krb_time_to_life __P((
+ u_int32_t start,
+ u_int32_t end));
+
+char * KRB_LIB_FUNCTION
+krb_unparse_name __P((krb_principal *pr));
+
+char * KRB_LIB_FUNCTION
+krb_unparse_name_long __P((
+ char *name,
+ char *instance,
+ char *realm));
+
+char * KRB_LIB_FUNCTION
+krb_unparse_name_long_r __P((
+ char *name,
+ char *instance,
+ char *realm,
+ char *fullname));
+
+char * KRB_LIB_FUNCTION
+krb_unparse_name_r __P((
+ krb_principal *pr,
+ char *fullname));
+
+int KRB_LIB_FUNCTION
+krb_use_admin_server __P((int flag));
+
+int KRB_LIB_FUNCTION
+krb_verify_user __P((
+ char *name,
+ char *instance,
+ char *realm,
+ char *password,
+ int secure,
+ char *linstance));
+
+int KRB_LIB_FUNCTION
+krb_verify_user_srvtab __P((
+ char *name,
+ char *instance,
+ char *realm,
+ char *password,
+ int secure,
+ char *linstance,
+ char *srvtab));
+
+int KRB_LIB_FUNCTION
+kuserok __P((
+ AUTH_DAT *auth,
+ char *luser));
+
+u_int32_t KRB_LIB_FUNCTION
+lsb_time __P((
+ time_t t,
+ struct sockaddr_in *src,
+ struct sockaddr_in *dst));
+
+const char * KRB_LIB_FUNCTION
+month_sname __P((int n));
+
+int KRB_LIB_FUNCTION
+passwd_to_5key __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+passwd_to_afskey __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+passwd_to_key __P((
+ const char *user,
+ const char *instance,
+ const char *realm,
+ const void *passwd,
+ des_cblock *key));
+
+int KRB_LIB_FUNCTION
+read_service_key __P((
+ const char *service,
+ char *instance,
+ const char *realm,
+ int kvno,
+ const char *file,
+ void *key));
+
+int KRB_LIB_FUNCTION
+save_credentials __P((
+ char *service,
+ char *instance,
+ char *realm,
+ unsigned char *session,
+ int lifetime,
+ int kvno,
+ KTEXT ticket,
+ int32_t issue_date));
+
+int KRB_LIB_FUNCTION
+send_to_kdc __P((
+ KTEXT pkt,
+ KTEXT rpkt,
+ const char *realm));
+
+int KRB_LIB_FUNCTION
+srvtab_to_key __P((
+ const char *user,
+ char *instance, /* INOUT parameter */
+ const char *realm,
+ const void *srvtab,
+ des_cblock *key));
+
+void KRB_LIB_FUNCTION
+tf_close __P((void));
+
+int KRB_LIB_FUNCTION
+tf_create __P((char *tf_name));
+
+int KRB_LIB_FUNCTION
+tf_get_cred __P((CREDENTIALS *c));
+
+int KRB_LIB_FUNCTION
+tf_get_pinst __P((char *inst));
+
+int KRB_LIB_FUNCTION
+tf_get_pname __P((char *p));
+
+int KRB_LIB_FUNCTION
+tf_init __P((
+ char *tf_name,
+ int rw));
+
+int KRB_LIB_FUNCTION
+tf_put_pinst __P((const char *inst));
+
+int KRB_LIB_FUNCTION
+tf_put_pname __P((const char *p));
+
+int KRB_LIB_FUNCTION
+tf_save_cred __P((
+ char *service,
+ char *instance,
+ char *realm,
+ unsigned char *session,
+ int lifetime,
+ int kvno,
+ KTEXT ticket,
+ u_int32_t issue_date));
+
+int KRB_LIB_FUNCTION
+tf_setup __P((
+ CREDENTIALS *cred,
+ const char *pname,
+ const char *pinst));
+
+char * KRB_LIB_FUNCTION
+tkt_string __P((void));
+
+#endif /* __krb_protos_h__ */
diff --git a/crypto/kerberosIV/lib/krb/krb.def b/crypto/kerberosIV/lib/krb/krb.def
index da2e906..1158e60 100644
--- a/crypto/kerberosIV/lib/krb/krb.def
+++ b/crypto/kerberosIV/lib/krb/krb.def
@@ -1,8 +1,4 @@
-LIBRARY "krb" BASE=0x07000000
-
-DESCRIPTION "Dynamic link library for kerberos version 4"
-VERSION 1.0
-
+LIBRARY krb BASE=0x07000000
EXPORTS
krb_get_err_text
@@ -13,11 +9,16 @@ EXPORTS
currCredIndex
nextFreeIndex
- k_flock
k_localtime
k_getsockinst
k_getportbyname
k_get_all_addrs
+
+ krb_set_kdc_time_diff
+ krb_get_kdc_time_diff
+
+ krb_get_config_bool
+ krb_get_config_string
krb_equiv
@@ -55,6 +56,9 @@ EXPORTS
k_isname
k_isrealm
kname_parse
+ krb_parse_name
+ krb_unparse_name
+ krb_unparse_name_long
krb_create_ticket
krb_get_admhst
krb_get_cred
diff --git a/crypto/kerberosIV/lib/krb/krb.dsp b/crypto/kerberosIV/lib/krb/krb.dsp
new file mode 100644
index 0000000..efec3b2
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb.dsp
@@ -0,0 +1,398 @@
+# Microsoft Developer Studio Project File - Name="krb" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=krb - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "krb.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "krb.mak" CFG="krb - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "krb - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "krb - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "krb - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\include" /I "..\..\include\win32" /I "..\des" /I "..\roken" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 ..\roken\Release\roken.lib ..\des\Release\des.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "krb - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\..\include" /I "..\..\include\win32" /I "..\des" /I "..\roken" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+# ADD LINK32 ..\roken\Debug\roken.lib ..\des\Debug\des.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386
+
+!ENDIF
+
+# Begin Target
+
+# Name "krb - Win32 Release"
+# Name "krb - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\cr_err_reply.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\create_auth_reply.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\create_ciph.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\create_ticket.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\debug_decl.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\decomp_ticket.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\dllmain.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\encrypt_ktext.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\extra.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_ad_tkt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_cred.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_default_principal.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_host.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_in_tkt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_krbrlm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_svc_in_tkt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_tf_fullname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\get_tf_realm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getaddrs.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getfile.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getrealm.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getst.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\k_gethostname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\k_getport.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\k_getsockinst.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\k_localtime.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\kdc_reply.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\kntoln.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb.def
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_check_auth.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_equiv.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_err_txt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_get_in_tkt.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lifetime.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\logging.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\lsb_addr_comp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mk_auth.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mk_err.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mk_priv.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mk_req.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\mk_safe.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\month_sname.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\name2name.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\netread.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\netwrite.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\one.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\parse_name.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rd_err.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rd_priv.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rd_req.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rd_safe.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\read_service_key.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\realm_parse.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\recvauth.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\rw.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\save_credentials.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\send_to_kdc.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\sendauth.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\stime.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\str2key.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\ticket_memory.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\time.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\tkt_string.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\unparse_name.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\util.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\verify_user.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\klog.h
+# End Source File
+# Begin Source File
+
+SOURCE=".\krb-protos.h"
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_locl.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\krb_log.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\prot.h
+# End Source File
+# Begin Source File
+
+SOURCE=.\ticket_memory.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\krb.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/crypto/kerberosIV/lib/krb/krb.mak b/crypto/kerberosIV/lib/krb/krb.mak
index 1236261..e9d5690 100644
--- a/crypto/kerberosIV/lib/krb/krb.mak
+++ b/crypto/kerberosIV/lib/krb/krb.mak
@@ -1,19 +1,15 @@
-# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
+# Microsoft Developer Studio Generated NMAKE File, Based on krb.dsp
!IF "$(CFG)" == ""
-CFG=krb - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to krb - Win32 Debug.
+CFG=krb - Win32 Release
+!MESSAGE No configuration specified. Defaulting to krb - Win32 Release.
!ENDIF
!IF "$(CFG)" != "krb - Win32 Release" && "$(CFG)" != "krb - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "krb.mak" CFG="krb - Win32 Debug"
+!MESSAGE NMAKE /f "krb.mak" CFG="krb - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
@@ -28,3038 +24,1879 @@ NULL=
!ELSE
NULL=nul
!ENDIF
-################################################################################
-# Begin Project
-# PROP Target_Last_Scanned "krb - Win32 Debug"
-RSC=rc.exe
-MTL=mktyplib.exe
-CPP=cl.exe
!IF "$(CFG)" == "krb - Win32 Release"
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
-ALL : ".\Release\krb.dll"
+ALL : "$(OUTDIR)\krb.dll"
+
+!ELSE
+
+ALL : "des - Win32 Release" "$(OUTDIR)\krb.dll"
+
+!ENDIF
+!IF "$(RECURSE)" == "1"
+CLEAN :"des - Win32 ReleaseCLEAN"
+!ELSE
CLEAN :
- -@erase ".\Release\cr_err_reply.obj"
- -@erase ".\Release\create_auth_reply.obj"
- -@erase ".\Release\create_ciph.obj"
- -@erase ".\Release\create_ticket.obj"
- -@erase ".\Release\debug_decl.obj"
- -@erase ".\Release\decomp_ticket.obj"
- -@erase ".\Release\dllmain.obj"
- -@erase ".\Release\encrypt_ktext.obj"
- -@erase ".\Release\et_list.obj"
- -@erase ".\Release\get_ad_tkt.obj"
- -@erase ".\Release\get_cred.obj"
- -@erase ".\Release\get_default_principal.obj"
- -@erase ".\Release\get_host.obj"
- -@erase ".\Release\get_in_tkt.obj"
- -@erase ".\Release\get_krbrlm.obj"
- -@erase ".\Release\get_phost.obj"
- -@erase ".\Release\get_svc_in_tkt.obj"
- -@erase ".\Release\get_tf_fullname.obj"
- -@erase ".\Release\get_tf_realm.obj"
- -@erase ".\Release\getaddrs.obj"
- -@erase ".\Release\getrealm.obj"
- -@erase ".\Release\getst.obj"
- -@erase ".\Release\k_flock.obj"
- -@erase ".\Release\k_gethostname.obj"
- -@erase ".\Release\k_getport.obj"
- -@erase ".\Release\k_getsockinst.obj"
- -@erase ".\Release\k_localtime.obj"
- -@erase ".\Release\kdc_reply.obj"
- -@erase ".\Release\kntoln.obj"
- -@erase ".\Release\krb.dll"
- -@erase ".\Release\krb.exp"
- -@erase ".\Release\krb.lib"
- -@erase ".\Release\krb_check_auth.obj"
- -@erase ".\Release\krb_equiv.obj"
- -@erase ".\Release\krb_err_txt.obj"
- -@erase ".\Release\krb_get_in_tkt.obj"
- -@erase ".\Release\lifetime.obj"
- -@erase ".\Release\logging.obj"
- -@erase ".\Release\lsb_addr_comp.obj"
- -@erase ".\Release\mk_auth.obj"
- -@erase ".\Release\mk_err.obj"
- -@erase ".\Release\mk_priv.obj"
- -@erase ".\Release\mk_req.obj"
- -@erase ".\Release\mk_safe.obj"
- -@erase ".\Release\month_sname.obj"
- -@erase ".\Release\name2name.obj"
- -@erase ".\Release\netread.obj"
- -@erase ".\Release\netwrite.obj"
- -@erase ".\Release\one.obj"
- -@erase ".\Release\parse_name.obj"
- -@erase ".\Release\rd_err.obj"
- -@erase ".\Release\rd_priv.obj"
- -@erase ".\Release\rd_req.obj"
- -@erase ".\Release\rd_safe.obj"
- -@erase ".\Release\read_service_key.obj"
- -@erase ".\Release\realm_parse.obj"
- -@erase ".\Release\recvauth.obj"
- -@erase ".\Release\resolve.obj"
- -@erase ".\Release\rw.obj"
- -@erase ".\Release\save_credentials.obj"
- -@erase ".\Release\send_to_kdc.obj"
- -@erase ".\Release\sendauth.obj"
- -@erase ".\Release\stime.obj"
- -@erase ".\Release\str2key.obj"
- -@erase ".\Release\swab.obj"
- -@erase ".\Release\ticket_memory.obj"
- -@erase ".\Release\tkt_string.obj"
- -@erase ".\Release\unparse_name.obj"
- -@erase ".\Release\util.obj"
- -@erase ".\Release\verify_user.obj"
+!ENDIF
+ -@erase "$(INTDIR)\cr_err_reply.obj"
+ -@erase "$(INTDIR)\create_auth_reply.obj"
+ -@erase "$(INTDIR)\create_ciph.obj"
+ -@erase "$(INTDIR)\create_ticket.obj"
+ -@erase "$(INTDIR)\debug_decl.obj"
+ -@erase "$(INTDIR)\decomp_ticket.obj"
+ -@erase "$(INTDIR)\dllmain.obj"
+ -@erase "$(INTDIR)\encrypt_ktext.obj"
+ -@erase "$(INTDIR)\get_ad_tkt.obj"
+ -@erase "$(INTDIR)\get_cred.obj"
+ -@erase "$(INTDIR)\get_default_principal.obj"
+ -@erase "$(INTDIR)\get_host.obj"
+ -@erase "$(INTDIR)\get_in_tkt.obj"
+ -@erase "$(INTDIR)\get_krbrlm.obj"
+ -@erase "$(INTDIR)\get_svc_in_tkt.obj"
+ -@erase "$(INTDIR)\get_tf_fullname.obj"
+ -@erase "$(INTDIR)\get_tf_realm.obj"
+ -@erase "$(INTDIR)\getaddrs.obj"
+ -@erase "$(INTDIR)\getfile.obj"
+ -@erase "$(INTDIR)\getrealm.obj"
+ -@erase "$(INTDIR)\getst.obj"
+ -@erase "$(INTDIR)\k_flock.obj"
+ -@erase "$(INTDIR)\k_gethostname.obj"
+ -@erase "$(INTDIR)\k_getport.obj"
+ -@erase "$(INTDIR)\k_getsockinst.obj"
+ -@erase "$(INTDIR)\k_localtime.obj"
+ -@erase "$(INTDIR)\kdc_reply.obj"
+ -@erase "$(INTDIR)\kntoln.obj"
+ -@erase "$(INTDIR)\krb.res"
+ -@erase "$(INTDIR)\krb_check_auth.obj"
+ -@erase "$(INTDIR)\krb_equiv.obj"
+ -@erase "$(INTDIR)\krb_err_txt.obj"
+ -@erase "$(INTDIR)\krb_get_in_tkt.obj"
+ -@erase "$(INTDIR)\lifetime.obj"
+ -@erase "$(INTDIR)\logging.obj"
+ -@erase "$(INTDIR)\lsb_addr_comp.obj"
+ -@erase "$(INTDIR)\mk_auth.obj"
+ -@erase "$(INTDIR)\mk_err.obj"
+ -@erase "$(INTDIR)\mk_priv.obj"
+ -@erase "$(INTDIR)\mk_req.obj"
+ -@erase "$(INTDIR)\mk_safe.obj"
+ -@erase "$(INTDIR)\month_sname.obj"
+ -@erase "$(INTDIR)\name2name.obj"
+ -@erase "$(INTDIR)\netread.obj"
+ -@erase "$(INTDIR)\netwrite.obj"
+ -@erase "$(INTDIR)\one.obj"
+ -@erase "$(INTDIR)\parse_name.obj"
+ -@erase "$(INTDIR)\rd_err.obj"
+ -@erase "$(INTDIR)\rd_priv.obj"
+ -@erase "$(INTDIR)\rd_req.obj"
+ -@erase "$(INTDIR)\rd_safe.obj"
+ -@erase "$(INTDIR)\read_service_key.obj"
+ -@erase "$(INTDIR)\realm_parse.obj"
+ -@erase "$(INTDIR)\recvauth.obj"
+ -@erase "$(INTDIR)\rw.obj"
+ -@erase "$(INTDIR)\save_credentials.obj"
+ -@erase "$(INTDIR)\send_to_kdc.obj"
+ -@erase "$(INTDIR)\sendauth.obj"
+ -@erase "$(INTDIR)\stime.obj"
+ -@erase "$(INTDIR)\str2key.obj"
+ -@erase "$(INTDIR)\ticket_memory.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\tkt_string.obj"
+ -@erase "$(INTDIR)\unparse_name.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\verify_user.obj"
+ -@erase "$(OUTDIR)\krb.dll"
+ -@erase "$(OUTDIR)\krb.exp"
+ -@erase "$(OUTDIR)\krb.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "." /I "..\..\include" /I "..\..\include\win32" /I "..\des" /I "..\roken" /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /c
+CPP=cl.exe
CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "." /I "..\..\include" /I\
"..\..\include\win32" /I "..\des" /I "..\roken" /D "NDEBUG" /D "WIN32" /D\
- "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)/krb.pch" /YX /Fo"$(INTDIR)/" /c
+ "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\krb.pch" /YX /Fo"$(INTDIR)\\"\
+ /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Release/
-CPP_SBRS=.\.
-# ADD BASE MTL /nologo /D "NDEBUG" /win32
-# ADD MTL /nologo /D "NDEBUG" /win32
-MTL_PROJ=/nologo /D "NDEBUG" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\krb.res" /d "NDEBUG"
BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/krb.bsc"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\krb.bsc"
BSC32_SBRS= \
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 ..\roken\Release\roken.lib ..\des\Release\des.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
LINK32_FLAGS=..\roken\Release\roken.lib ..\des\Release\des.lib wsock32.lib\
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib\
- shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo\
- /subsystem:windows /dll /incremental:no /pdb:"$(OUTDIR)/krb.pdb" /machine:I386\
- /def:".\krb.def" /out:"$(OUTDIR)/krb.dll" /implib:"$(OUTDIR)/krb.lib"
+ shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll\
+ /incremental:no /pdb:"$(OUTDIR)\krb.pdb" /machine:I386 /def:".\krb.def"\
+ /out:"$(OUTDIR)\krb.dll" /implib:"$(OUTDIR)\krb.lib"
DEF_FILE= \
".\krb.def"
LINK32_OBJS= \
- ".\Release\cr_err_reply.obj" \
- ".\Release\create_auth_reply.obj" \
- ".\Release\create_ciph.obj" \
- ".\Release\create_ticket.obj" \
- ".\Release\debug_decl.obj" \
- ".\Release\decomp_ticket.obj" \
- ".\Release\dllmain.obj" \
- ".\Release\encrypt_ktext.obj" \
- ".\Release\et_list.obj" \
- ".\Release\get_ad_tkt.obj" \
- ".\Release\get_cred.obj" \
- ".\Release\get_default_principal.obj" \
- ".\Release\get_host.obj" \
- ".\Release\get_in_tkt.obj" \
- ".\Release\get_krbrlm.obj" \
- ".\Release\get_phost.obj" \
- ".\Release\get_svc_in_tkt.obj" \
- ".\Release\get_tf_fullname.obj" \
- ".\Release\get_tf_realm.obj" \
- ".\Release\getaddrs.obj" \
- ".\Release\getrealm.obj" \
- ".\Release\getst.obj" \
- ".\Release\k_flock.obj" \
- ".\Release\k_gethostname.obj" \
- ".\Release\k_getport.obj" \
- ".\Release\k_getsockinst.obj" \
- ".\Release\k_localtime.obj" \
- ".\Release\kdc_reply.obj" \
- ".\Release\kntoln.obj" \
- ".\Release\krb_check_auth.obj" \
- ".\Release\krb_equiv.obj" \
- ".\Release\krb_err_txt.obj" \
- ".\Release\krb_get_in_tkt.obj" \
- ".\Release\lifetime.obj" \
- ".\Release\logging.obj" \
- ".\Release\lsb_addr_comp.obj" \
- ".\Release\mk_auth.obj" \
- ".\Release\mk_err.obj" \
- ".\Release\mk_priv.obj" \
- ".\Release\mk_req.obj" \
- ".\Release\mk_safe.obj" \
- ".\Release\month_sname.obj" \
- ".\Release\name2name.obj" \
- ".\Release\netread.obj" \
- ".\Release\netwrite.obj" \
- ".\Release\one.obj" \
- ".\Release\parse_name.obj" \
- ".\Release\rd_err.obj" \
- ".\Release\rd_priv.obj" \
- ".\Release\rd_req.obj" \
- ".\Release\rd_safe.obj" \
- ".\Release\read_service_key.obj" \
- ".\Release\realm_parse.obj" \
- ".\Release\recvauth.obj" \
- ".\Release\resolve.obj" \
- ".\Release\rw.obj" \
- ".\Release\save_credentials.obj" \
- ".\Release\send_to_kdc.obj" \
- ".\Release\sendauth.obj" \
- ".\Release\stime.obj" \
- ".\Release\str2key.obj" \
- ".\Release\swab.obj" \
- ".\Release\ticket_memory.obj" \
- ".\Release\tkt_string.obj" \
- ".\Release\unparse_name.obj" \
- ".\Release\util.obj" \
- ".\Release\verify_user.obj"
-
-".\Release\krb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ "$(INTDIR)\cr_err_reply.obj" \
+ "$(INTDIR)\create_auth_reply.obj" \
+ "$(INTDIR)\create_ciph.obj" \
+ "$(INTDIR)\create_ticket.obj" \
+ "$(INTDIR)\debug_decl.obj" \
+ "$(INTDIR)\decomp_ticket.obj" \
+ "$(INTDIR)\dllmain.obj" \
+ "$(INTDIR)\encrypt_ktext.obj" \
+ "$(INTDIR)\get_ad_tkt.obj" \
+ "$(INTDIR)\get_cred.obj" \
+ "$(INTDIR)\get_default_principal.obj" \
+ "$(INTDIR)\get_host.obj" \
+ "$(INTDIR)\get_in_tkt.obj" \
+ "$(INTDIR)\get_krbrlm.obj" \
+ "$(INTDIR)\get_svc_in_tkt.obj" \
+ "$(INTDIR)\get_tf_fullname.obj" \
+ "$(INTDIR)\get_tf_realm.obj" \
+ "$(INTDIR)\getaddrs.obj" \
+ "$(INTDIR)\getfile.obj" \
+ "$(INTDIR)\getrealm.obj" \
+ "$(INTDIR)\getst.obj" \
+ "$(INTDIR)\k_flock.obj" \
+ "$(INTDIR)\k_gethostname.obj" \
+ "$(INTDIR)\k_getport.obj" \
+ "$(INTDIR)\k_getsockinst.obj" \
+ "$(INTDIR)\k_localtime.obj" \
+ "$(INTDIR)\kdc_reply.obj" \
+ "$(INTDIR)\kntoln.obj" \
+ "$(INTDIR)\krb.res" \
+ "$(INTDIR)\krb_check_auth.obj" \
+ "$(INTDIR)\krb_equiv.obj" \
+ "$(INTDIR)\krb_err_txt.obj" \
+ "$(INTDIR)\krb_get_in_tkt.obj" \
+ "$(INTDIR)\lifetime.obj" \
+ "$(INTDIR)\logging.obj" \
+ "$(INTDIR)\lsb_addr_comp.obj" \
+ "$(INTDIR)\mk_auth.obj" \
+ "$(INTDIR)\mk_err.obj" \
+ "$(INTDIR)\mk_priv.obj" \
+ "$(INTDIR)\mk_req.obj" \
+ "$(INTDIR)\mk_safe.obj" \
+ "$(INTDIR)\month_sname.obj" \
+ "$(INTDIR)\name2name.obj" \
+ "$(INTDIR)\netread.obj" \
+ "$(INTDIR)\netwrite.obj" \
+ "$(INTDIR)\one.obj" \
+ "$(INTDIR)\parse_name.obj" \
+ "$(INTDIR)\rd_err.obj" \
+ "$(INTDIR)\rd_priv.obj" \
+ "$(INTDIR)\rd_req.obj" \
+ "$(INTDIR)\rd_safe.obj" \
+ "$(INTDIR)\read_service_key.obj" \
+ "$(INTDIR)\realm_parse.obj" \
+ "$(INTDIR)\recvauth.obj" \
+ "$(INTDIR)\rw.obj" \
+ "$(INTDIR)\save_credentials.obj" \
+ "$(INTDIR)\send_to_kdc.obj" \
+ "$(INTDIR)\sendauth.obj" \
+ "$(INTDIR)\stime.obj" \
+ "$(INTDIR)\str2key.obj" \
+ "$(INTDIR)\ticket_memory.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\tkt_string.obj" \
+ "$(INTDIR)\unparse_name.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\verify_user.obj" \
+ "..\des\Release\des.lib"
+
+"$(OUTDIR)\krb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\krb.dll"
+
+!ELSE
+
+ALL : "des - Win32 Debug" "$(OUTDIR)\krb.dll"
-ALL : ".\Debug\krb.dll"
+!ENDIF
+!IF "$(RECURSE)" == "1"
+CLEAN :"des - Win32 DebugCLEAN"
+!ELSE
CLEAN :
- -@erase ".\Debug\cr_err_reply.obj"
- -@erase ".\Debug\create_auth_reply.obj"
- -@erase ".\Debug\create_ciph.obj"
- -@erase ".\Debug\create_ticket.obj"
- -@erase ".\Debug\debug_decl.obj"
- -@erase ".\Debug\decomp_ticket.obj"
- -@erase ".\Debug\dllmain.obj"
- -@erase ".\Debug\encrypt_ktext.obj"
- -@erase ".\Debug\et_list.obj"
- -@erase ".\Debug\get_ad_tkt.obj"
- -@erase ".\Debug\get_cred.obj"
- -@erase ".\Debug\get_default_principal.obj"
- -@erase ".\Debug\get_host.obj"
- -@erase ".\Debug\get_in_tkt.obj"
- -@erase ".\Debug\get_krbrlm.obj"
- -@erase ".\Debug\get_phost.obj"
- -@erase ".\Debug\get_svc_in_tkt.obj"
- -@erase ".\Debug\get_tf_fullname.obj"
- -@erase ".\Debug\get_tf_realm.obj"
- -@erase ".\Debug\getaddrs.obj"
- -@erase ".\Debug\getrealm.obj"
- -@erase ".\Debug\getst.obj"
- -@erase ".\Debug\k_flock.obj"
- -@erase ".\Debug\k_gethostname.obj"
- -@erase ".\Debug\k_getport.obj"
- -@erase ".\Debug\k_getsockinst.obj"
- -@erase ".\Debug\k_localtime.obj"
- -@erase ".\Debug\kdc_reply.obj"
- -@erase ".\Debug\kntoln.obj"
- -@erase ".\Debug\krb.dll"
- -@erase ".\Debug\krb.exp"
- -@erase ".\Debug\krb.ilk"
- -@erase ".\Debug\krb.lib"
- -@erase ".\Debug\krb.pdb"
- -@erase ".\Debug\krb_check_auth.obj"
- -@erase ".\Debug\krb_equiv.obj"
- -@erase ".\Debug\krb_err_txt.obj"
- -@erase ".\Debug\krb_get_in_tkt.obj"
- -@erase ".\Debug\lifetime.obj"
- -@erase ".\Debug\logging.obj"
- -@erase ".\Debug\lsb_addr_comp.obj"
- -@erase ".\Debug\mk_auth.obj"
- -@erase ".\Debug\mk_err.obj"
- -@erase ".\Debug\mk_priv.obj"
- -@erase ".\Debug\mk_req.obj"
- -@erase ".\Debug\mk_safe.obj"
- -@erase ".\Debug\month_sname.obj"
- -@erase ".\Debug\name2name.obj"
- -@erase ".\Debug\netread.obj"
- -@erase ".\Debug\netwrite.obj"
- -@erase ".\Debug\one.obj"
- -@erase ".\Debug\parse_name.obj"
- -@erase ".\Debug\rd_err.obj"
- -@erase ".\Debug\rd_priv.obj"
- -@erase ".\Debug\rd_req.obj"
- -@erase ".\Debug\rd_safe.obj"
- -@erase ".\Debug\read_service_key.obj"
- -@erase ".\Debug\realm_parse.obj"
- -@erase ".\Debug\recvauth.obj"
- -@erase ".\Debug\resolve.obj"
- -@erase ".\Debug\rw.obj"
- -@erase ".\Debug\save_credentials.obj"
- -@erase ".\Debug\send_to_kdc.obj"
- -@erase ".\Debug\sendauth.obj"
- -@erase ".\Debug\stime.obj"
- -@erase ".\Debug\str2key.obj"
- -@erase ".\Debug\swab.obj"
- -@erase ".\Debug\ticket_memory.obj"
- -@erase ".\Debug\tkt_string.obj"
- -@erase ".\Debug\unparse_name.obj"
- -@erase ".\Debug\util.obj"
- -@erase ".\Debug\vc40.idb"
- -@erase ".\Debug\vc40.pdb"
- -@erase ".\Debug\verify_user.obj"
+!ENDIF
+ -@erase "$(INTDIR)\cr_err_reply.obj"
+ -@erase "$(INTDIR)\create_auth_reply.obj"
+ -@erase "$(INTDIR)\create_ciph.obj"
+ -@erase "$(INTDIR)\create_ticket.obj"
+ -@erase "$(INTDIR)\debug_decl.obj"
+ -@erase "$(INTDIR)\decomp_ticket.obj"
+ -@erase "$(INTDIR)\dllmain.obj"
+ -@erase "$(INTDIR)\encrypt_ktext.obj"
+ -@erase "$(INTDIR)\get_ad_tkt.obj"
+ -@erase "$(INTDIR)\get_cred.obj"
+ -@erase "$(INTDIR)\get_default_principal.obj"
+ -@erase "$(INTDIR)\get_host.obj"
+ -@erase "$(INTDIR)\get_in_tkt.obj"
+ -@erase "$(INTDIR)\get_krbrlm.obj"
+ -@erase "$(INTDIR)\get_svc_in_tkt.obj"
+ -@erase "$(INTDIR)\get_tf_fullname.obj"
+ -@erase "$(INTDIR)\get_tf_realm.obj"
+ -@erase "$(INTDIR)\getaddrs.obj"
+ -@erase "$(INTDIR)\getfile.obj"
+ -@erase "$(INTDIR)\getrealm.obj"
+ -@erase "$(INTDIR)\getst.obj"
+ -@erase "$(INTDIR)\k_flock.obj"
+ -@erase "$(INTDIR)\k_gethostname.obj"
+ -@erase "$(INTDIR)\k_getport.obj"
+ -@erase "$(INTDIR)\k_getsockinst.obj"
+ -@erase "$(INTDIR)\k_localtime.obj"
+ -@erase "$(INTDIR)\kdc_reply.obj"
+ -@erase "$(INTDIR)\kntoln.obj"
+ -@erase "$(INTDIR)\krb.res"
+ -@erase "$(INTDIR)\krb_check_auth.obj"
+ -@erase "$(INTDIR)\krb_equiv.obj"
+ -@erase "$(INTDIR)\krb_err_txt.obj"
+ -@erase "$(INTDIR)\krb_get_in_tkt.obj"
+ -@erase "$(INTDIR)\lifetime.obj"
+ -@erase "$(INTDIR)\logging.obj"
+ -@erase "$(INTDIR)\lsb_addr_comp.obj"
+ -@erase "$(INTDIR)\mk_auth.obj"
+ -@erase "$(INTDIR)\mk_err.obj"
+ -@erase "$(INTDIR)\mk_priv.obj"
+ -@erase "$(INTDIR)\mk_req.obj"
+ -@erase "$(INTDIR)\mk_safe.obj"
+ -@erase "$(INTDIR)\month_sname.obj"
+ -@erase "$(INTDIR)\name2name.obj"
+ -@erase "$(INTDIR)\netread.obj"
+ -@erase "$(INTDIR)\netwrite.obj"
+ -@erase "$(INTDIR)\one.obj"
+ -@erase "$(INTDIR)\parse_name.obj"
+ -@erase "$(INTDIR)\rd_err.obj"
+ -@erase "$(INTDIR)\rd_priv.obj"
+ -@erase "$(INTDIR)\rd_req.obj"
+ -@erase "$(INTDIR)\rd_safe.obj"
+ -@erase "$(INTDIR)\read_service_key.obj"
+ -@erase "$(INTDIR)\realm_parse.obj"
+ -@erase "$(INTDIR)\recvauth.obj"
+ -@erase "$(INTDIR)\rw.obj"
+ -@erase "$(INTDIR)\save_credentials.obj"
+ -@erase "$(INTDIR)\send_to_kdc.obj"
+ -@erase "$(INTDIR)\sendauth.obj"
+ -@erase "$(INTDIR)\stime.obj"
+ -@erase "$(INTDIR)\str2key.obj"
+ -@erase "$(INTDIR)\ticket_memory.obj"
+ -@erase "$(INTDIR)\time.obj"
+ -@erase "$(INTDIR)\tkt_string.obj"
+ -@erase "$(INTDIR)\unparse_name.obj"
+ -@erase "$(INTDIR)\util.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\vc50.pdb"
+ -@erase "$(INTDIR)\verify_user.obj"
+ -@erase "$(OUTDIR)\krb.dll"
+ -@erase "$(OUTDIR)\krb.exp"
+ -@erase "$(OUTDIR)\krb.ilk"
+ -@erase "$(OUTDIR)\krb.lib"
+ -@erase "$(OUTDIR)\krb.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\..\include" /I "..\..\include\win32" /I "..\des" /I "..\roken" /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /c
-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "." /I "..\..\include" /I\
+CPP=cl.exe
+CPP_PROJ=/nologo /MDd /W3 /Gm /GX /Zi /Od /I "." /I "..\..\include" /I\
"..\..\include\win32" /I "..\des" /I "..\roken" /D "_DEBUG" /D "WIN32" /D\
- "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)/krb.pch" /YX /Fo"$(INTDIR)/"\
- /Fd"$(INTDIR)/" /c
+ "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\krb.pch" /YX /Fo"$(INTDIR)\\"\
+ /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
-CPP_SBRS=.\.
-# ADD BASE MTL /nologo /D "_DEBUG" /win32
-# ADD MTL /nologo /D "_DEBUG" /win32
-MTL_PROJ=/nologo /D "_DEBUG" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
+CPP_SBRS=.
+
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
+
+MTL=midl.exe
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC=rc.exe
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\krb.res" /d "_DEBUG"
BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/krb.bsc"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\krb.bsc"
BSC32_SBRS= \
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
-# ADD LINK32 ..\roken\Debug\roken.lib ..\des\Debug\des.lib wsock32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
LINK32_FLAGS=..\roken\Debug\roken.lib ..\des\Debug\des.lib wsock32.lib\
kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib\
- shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo\
- /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)/krb.pdb" /debug\
- /machine:I386 /def:".\krb.def" /out:"$(OUTDIR)/krb.dll"\
- /implib:"$(OUTDIR)/krb.lib"
+ shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll\
+ /incremental:yes /pdb:"$(OUTDIR)\krb.pdb" /debug /machine:I386 /def:".\krb.def"\
+ /out:"$(OUTDIR)\krb.dll" /implib:"$(OUTDIR)\krb.lib"
DEF_FILE= \
".\krb.def"
LINK32_OBJS= \
- ".\Debug\cr_err_reply.obj" \
- ".\Debug\create_auth_reply.obj" \
- ".\Debug\create_ciph.obj" \
- ".\Debug\create_ticket.obj" \
- ".\Debug\debug_decl.obj" \
- ".\Debug\decomp_ticket.obj" \
- ".\Debug\dllmain.obj" \
- ".\Debug\encrypt_ktext.obj" \
- ".\Debug\et_list.obj" \
- ".\Debug\get_ad_tkt.obj" \
- ".\Debug\get_cred.obj" \
- ".\Debug\get_default_principal.obj" \
- ".\Debug\get_host.obj" \
- ".\Debug\get_in_tkt.obj" \
- ".\Debug\get_krbrlm.obj" \
- ".\Debug\get_phost.obj" \
- ".\Debug\get_svc_in_tkt.obj" \
- ".\Debug\get_tf_fullname.obj" \
- ".\Debug\get_tf_realm.obj" \
- ".\Debug\getaddrs.obj" \
- ".\Debug\getrealm.obj" \
- ".\Debug\getst.obj" \
- ".\Debug\k_flock.obj" \
- ".\Debug\k_gethostname.obj" \
- ".\Debug\k_getport.obj" \
- ".\Debug\k_getsockinst.obj" \
- ".\Debug\k_localtime.obj" \
- ".\Debug\kdc_reply.obj" \
- ".\Debug\kntoln.obj" \
- ".\Debug\krb_check_auth.obj" \
- ".\Debug\krb_equiv.obj" \
- ".\Debug\krb_err_txt.obj" \
- ".\Debug\krb_get_in_tkt.obj" \
- ".\Debug\lifetime.obj" \
- ".\Debug\logging.obj" \
- ".\Debug\lsb_addr_comp.obj" \
- ".\Debug\mk_auth.obj" \
- ".\Debug\mk_err.obj" \
- ".\Debug\mk_priv.obj" \
- ".\Debug\mk_req.obj" \
- ".\Debug\mk_safe.obj" \
- ".\Debug\month_sname.obj" \
- ".\Debug\name2name.obj" \
- ".\Debug\netread.obj" \
- ".\Debug\netwrite.obj" \
- ".\Debug\one.obj" \
- ".\Debug\parse_name.obj" \
- ".\Debug\rd_err.obj" \
- ".\Debug\rd_priv.obj" \
- ".\Debug\rd_req.obj" \
- ".\Debug\rd_safe.obj" \
- ".\Debug\read_service_key.obj" \
- ".\Debug\realm_parse.obj" \
- ".\Debug\recvauth.obj" \
- ".\Debug\resolve.obj" \
- ".\Debug\rw.obj" \
- ".\Debug\save_credentials.obj" \
- ".\Debug\send_to_kdc.obj" \
- ".\Debug\sendauth.obj" \
- ".\Debug\stime.obj" \
- ".\Debug\str2key.obj" \
- ".\Debug\swab.obj" \
- ".\Debug\ticket_memory.obj" \
- ".\Debug\tkt_string.obj" \
- ".\Debug\unparse_name.obj" \
- ".\Debug\util.obj" \
- ".\Debug\verify_user.obj"
-
-".\Debug\krb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ "$(INTDIR)\cr_err_reply.obj" \
+ "$(INTDIR)\create_auth_reply.obj" \
+ "$(INTDIR)\create_ciph.obj" \
+ "$(INTDIR)\create_ticket.obj" \
+ "$(INTDIR)\debug_decl.obj" \
+ "$(INTDIR)\decomp_ticket.obj" \
+ "$(INTDIR)\dllmain.obj" \
+ "$(INTDIR)\encrypt_ktext.obj" \
+ "$(INTDIR)\get_ad_tkt.obj" \
+ "$(INTDIR)\get_cred.obj" \
+ "$(INTDIR)\get_default_principal.obj" \
+ "$(INTDIR)\get_host.obj" \
+ "$(INTDIR)\get_in_tkt.obj" \
+ "$(INTDIR)\get_krbrlm.obj" \
+ "$(INTDIR)\get_svc_in_tkt.obj" \
+ "$(INTDIR)\get_tf_fullname.obj" \
+ "$(INTDIR)\get_tf_realm.obj" \
+ "$(INTDIR)\getaddrs.obj" \
+ "$(INTDIR)\getfile.obj" \
+ "$(INTDIR)\getrealm.obj" \
+ "$(INTDIR)\getst.obj" \
+ "$(INTDIR)\k_flock.obj" \
+ "$(INTDIR)\k_gethostname.obj" \
+ "$(INTDIR)\k_getport.obj" \
+ "$(INTDIR)\k_getsockinst.obj" \
+ "$(INTDIR)\k_localtime.obj" \
+ "$(INTDIR)\kdc_reply.obj" \
+ "$(INTDIR)\kntoln.obj" \
+ "$(INTDIR)\krb.res" \
+ "$(INTDIR)\krb_check_auth.obj" \
+ "$(INTDIR)\krb_equiv.obj" \
+ "$(INTDIR)\krb_err_txt.obj" \
+ "$(INTDIR)\krb_get_in_tkt.obj" \
+ "$(INTDIR)\lifetime.obj" \
+ "$(INTDIR)\logging.obj" \
+ "$(INTDIR)\lsb_addr_comp.obj" \
+ "$(INTDIR)\mk_auth.obj" \
+ "$(INTDIR)\mk_err.obj" \
+ "$(INTDIR)\mk_priv.obj" \
+ "$(INTDIR)\mk_req.obj" \
+ "$(INTDIR)\mk_safe.obj" \
+ "$(INTDIR)\month_sname.obj" \
+ "$(INTDIR)\name2name.obj" \
+ "$(INTDIR)\netread.obj" \
+ "$(INTDIR)\netwrite.obj" \
+ "$(INTDIR)\one.obj" \
+ "$(INTDIR)\parse_name.obj" \
+ "$(INTDIR)\rd_err.obj" \
+ "$(INTDIR)\rd_priv.obj" \
+ "$(INTDIR)\rd_req.obj" \
+ "$(INTDIR)\rd_safe.obj" \
+ "$(INTDIR)\read_service_key.obj" \
+ "$(INTDIR)\realm_parse.obj" \
+ "$(INTDIR)\recvauth.obj" \
+ "$(INTDIR)\rw.obj" \
+ "$(INTDIR)\save_credentials.obj" \
+ "$(INTDIR)\send_to_kdc.obj" \
+ "$(INTDIR)\sendauth.obj" \
+ "$(INTDIR)\stime.obj" \
+ "$(INTDIR)\str2key.obj" \
+ "$(INTDIR)\ticket_memory.obj" \
+ "$(INTDIR)\time.obj" \
+ "$(INTDIR)\tkt_string.obj" \
+ "$(INTDIR)\unparse_name.obj" \
+ "$(INTDIR)\util.obj" \
+ "$(INTDIR)\verify_user.obj" \
+ "..\des\Debug\des.lib"
+
+"$(OUTDIR)\krb.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
-.c{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.c{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-.cxx{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
-
-################################################################################
-# Begin Target
-
-# Name "krb - Win32 Release"
-# Name "krb - Win32 Debug"
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-!ENDIF
-
-################################################################################
-# Begin Source File
-
-SOURCE=.\krb.def
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\get_tf_fullname.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_T=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_tf_fullname.obj" : $(SOURCE) $(DEP_CPP_GET_T) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GET_T=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
- "..\des\des.h"\
- "..\roken\roken.h"\
- ".\krb.h"\
- ".\krb_locl.h"\
- ".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\get_tf_fullname.obj" : $(SOURCE) $(DEP_CPP_GET_T) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+!IF "$(CFG)" == "krb - Win32 Release" || "$(CFG)" == "krb - Win32 Debug"
SOURCE=.\cr_err_reply.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_CR_ER=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\cr_err_reply.obj" : $(SOURCE) $(DEP_CPP_CR_ER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_CR_ER=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\cr_err_reply.obj" : $(SOURCE) $(DEP_CPP_CR_ER) "$(INTDIR)"
+"$(INTDIR)\cr_err_reply.obj" : $(SOURCE) $(DEP_CPP_CR_ER) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\create_auth_reply.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_CREAT=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\create_auth_reply.obj" : $(SOURCE) $(DEP_CPP_CREAT) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_CREAT=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\create_auth_reply.obj" : $(SOURCE) $(DEP_CPP_CREAT) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\create_auth_reply.obj" : $(SOURCE) $(DEP_CPP_CREAT) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\create_ciph.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_CREATE=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\create_ciph.obj" : $(SOURCE) $(DEP_CPP_CREATE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_CREATE=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\create_ciph.obj" : $(SOURCE) $(DEP_CPP_CREATE) "$(INTDIR)"
+"$(INTDIR)\create_ciph.obj" : $(SOURCE) $(DEP_CPP_CREATE) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\create_ticket.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_CREATE_=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
+ ".\prot.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\create_ticket.obj" : $(SOURCE) $(DEP_CPP_CREATE_) "$(INTDIR)"
-
+"$(INTDIR)\create_ticket.obj" : $(SOURCE) $(DEP_CPP_CREATE_) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_CREATE_=\
+SOURCE=.\debug_decl.c
+DEP_CPP_DEBUG=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\create_ticket.obj" : $(SOURCE) $(DEP_CPP_CREATE_) "$(INTDIR)"
+"$(INTDIR)\debug_decl.obj" : $(SOURCE) $(DEP_CPP_DEBUG) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\decomp_ticket.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_DECOM=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\decomp_ticket.obj" : $(SOURCE) $(DEP_CPP_DECOM) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_DECOM=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\decomp_ticket.obj" : $(SOURCE) $(DEP_CPP_DECOM) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\decomp_ticket.obj" : $(SOURCE) $(DEP_CPP_DECOM) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\dllmain.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_DLLMA=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\ticket_memory.h"\
-
-
-".\Release\dllmain.obj" : $(SOURCE) $(DEP_CPP_DLLMA) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_DLLMA=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
".\ticket_memory.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\dllmain.obj" : $(SOURCE) $(DEP_CPP_DLLMA) "$(INTDIR)"
+"$(INTDIR)\dllmain.obj" : $(SOURCE) $(DEP_CPP_DLLMA) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\encrypt_ktext.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_ENCRY=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\encrypt_ktext.obj" : $(SOURCE) $(DEP_CPP_ENCRY) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_ENCRY=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\encrypt_ktext.obj" : $(SOURCE) $(DEP_CPP_ENCRY) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\et_list.c
-DEP_CPP_ET_LI=\
- "..\..\include\win32\config.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!IF "$(CFG)" == "krb - Win32 Release"
-
-
-".\Release\et_list.obj" : $(SOURCE) $(DEP_CPP_ET_LI) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-
-".\Debug\et_list.obj" : $(SOURCE) $(DEP_CPP_ET_LI) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\encrypt_ktext.obj" : $(SOURCE) $(DEP_CPP_ENCRY) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\get_ad_tkt.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_GET_A=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_ad_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_A) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GET_A=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_ad_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_A) "$(INTDIR)"
+"$(INTDIR)\get_ad_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_A) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\get_cred.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_C=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_cred.obj" : $(SOURCE) $(DEP_CPP_GET_C) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_GET_C=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_cred.obj" : $(SOURCE) $(DEP_CPP_GET_C) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\get_cred.obj" : $(SOURCE) $(DEP_CPP_GET_C) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\get_default_principal.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_GET_D=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_default_principal.obj" : $(SOURCE) $(DEP_CPP_GET_D) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GET_D=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_default_principal.obj" : $(SOURCE) $(DEP_CPP_GET_D) "$(INTDIR)"
-
+"$(INTDIR)\get_default_principal.obj" : $(SOURCE) $(DEP_CPP_GET_D) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\get_host.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_H=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_host.obj" : $(SOURCE) $(DEP_CPP_GET_H) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_GET_H=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_host.obj" : $(SOURCE) $(DEP_CPP_GET_H) "$(INTDIR)"
-
+"$(INTDIR)\get_host.obj" : $(SOURCE) $(DEP_CPP_GET_H) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\get_in_tkt.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_GET_I=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_I) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GET_I=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_I) "$(INTDIR)"
+"$(INTDIR)\get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_I) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\get_krbrlm.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_K=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_krbrlm.obj" : $(SOURCE) $(DEP_CPP_GET_K) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_GET_K=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\get_krbrlm.obj" : $(SOURCE) $(DEP_CPP_GET_K) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\get_krbrlm.obj" : $(SOURCE) $(DEP_CPP_GET_K) "$(INTDIR)"
-SOURCE=.\get_phos
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\get_svc_in_tkt.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_S=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\get_svc_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_S) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_GET_S=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\get_svc_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_S) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\get_phost.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_P=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\get_phost.obj" : $(SOURCE) $(DEP_CPP_GET_P) "$(INTDIR)"
-
+"$(INTDIR)\get_svc_in_tkt.obj" : $(SOURCE) $(DEP_CPP_GET_S) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_GET_P=\
+SOURCE=.\get_tf_fullname.c
+DEP_CPP_GET_T=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\get_phost.obj" : $(SOURCE) $(DEP_CPP_GET_P) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\krb_equiv.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_KRB_E=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\krb_equiv.obj" : $(SOURCE) $(DEP_CPP_KRB_E) "$(INTDIR)"
-
+"$(INTDIR)\get_tf_fullname.obj" : $(SOURCE) $(DEP_CPP_GET_T) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_KRB_E=\
+SOURCE=.\get_tf_realm.c
+DEP_CPP_GET_TF=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\krb_equiv.obj" : $(SOURCE) $(DEP_CPP_KRB_E) "$(INTDIR)"
+"$(INTDIR)\get_tf_realm.obj" : $(SOURCE) $(DEP_CPP_GET_TF) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\getaddrs.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_GETAD=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
+ ".\prot.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\getaddrs.obj" : $(SOURCE) $(DEP_CPP_GETAD) "$(INTDIR)"
-
+"$(INTDIR)\getaddrs.obj" : $(SOURCE) $(DEP_CPP_GETAD) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_GETAD=\
+SOURCE=.\getfile.c
+DEP_CPP_GETFI=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\getaddrs.obj" : $(SOURCE) $(DEP_CPP_GETAD) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\getfile.obj" : $(SOURCE) $(DEP_CPP_GETFI) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\getrealm.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GETRE=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\getrealm.obj" : $(SOURCE) $(DEP_CPP_GETRE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_GETRE=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\getrealm.obj" : $(SOURCE) $(DEP_CPP_GETRE) "$(INTDIR)"
-
+"$(INTDIR)\getrealm.obj" : $(SOURCE) $(DEP_CPP_GETRE) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\getst.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_GETST=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\getst.obj" : $(SOURCE) $(DEP_CPP_GETST) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GETST=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\getst.obj" : $(SOURCE) $(DEP_CPP_GETST) "$(INTDIR)"
-
+"$(INTDIR)\getst.obj" : $(SOURCE) $(DEP_CPP_GETST) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\k_flock.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_K_FLO=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\k_flock.obj" : $(SOURCE) $(DEP_CPP_K_FLO) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_K_FLO=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\k_flock.obj" : $(SOURCE) $(DEP_CPP_K_FLO) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\k_flock.obj" : $(SOURCE) $(DEP_CPP_K_FLO) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\k_gethostname.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_K_GET=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\k_gethostname.obj" : $(SOURCE) $(DEP_CPP_K_GET) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_K_GET=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\k_gethostname.obj" : $(SOURCE) $(DEP_CPP_K_GET) "$(INTDIR)"
-
+"$(INTDIR)\k_gethostname.obj" : $(SOURCE) $(DEP_CPP_K_GET) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\k_getport.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_K_GETP=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\k_getport.obj" : $(SOURCE) $(DEP_CPP_K_GETP) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_K_GETP=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\k_getport.obj" : $(SOURCE) $(DEP_CPP_K_GETP) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\k_getport.obj" : $(SOURCE) $(DEP_CPP_K_GETP) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\k_getsockinst.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_K_GETS=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\k_getsockinst.obj" : $(SOURCE) $(DEP_CPP_K_GETS) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_K_GETS=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\k_getsockinst.obj" : $(SOURCE) $(DEP_CPP_K_GETS) "$(INTDIR)"
+"$(INTDIR)\k_getsockinst.obj" : $(SOURCE) $(DEP_CPP_K_GETS) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\k_localtime.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_K_LOC=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\k_localtime.obj" : $(SOURCE) $(DEP_CPP_K_LOC) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_K_LOC=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\k_localtime.obj" : $(SOURCE) $(DEP_CPP_K_LOC) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\k_localtime.obj" : $(SOURCE) $(DEP_CPP_K_LOC) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\kdc_reply.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_KDC_R=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\kdc_reply.obj" : $(SOURCE) $(DEP_CPP_KDC_R) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_KDC_R=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\kdc_reply.obj" : $(SOURCE) $(DEP_CPP_KDC_R) "$(INTDIR)"
+"$(INTDIR)\kdc_reply.obj" : $(SOURCE) $(DEP_CPP_KDC_R) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\kntoln.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_KNTOL=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
- "..\des\des.h"\
- ".\krb.h"\
- ".\krb_locl.h"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Release\kntoln.obj" : $(SOURCE) $(DEP_CPP_KNTOL) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_KNTOL=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\kntoln.obj" : $(SOURCE) $(DEP_CPP_KNTOL) "$(INTDIR)"
-
+"$(INTDIR)\kntoln.obj" : $(SOURCE) $(DEP_CPP_KNTOL) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\krb_check_auth.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_KRB_C=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\krb_check_auth.obj" : $(SOURCE) $(DEP_CPP_KRB_C) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_KRB_C=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\krb_check_auth.obj" : $(SOURCE) $(DEP_CPP_KRB_C) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\get_tf_realm.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_GET_TF=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
+"$(INTDIR)\krb_check_auth.obj" : $(SOURCE) $(DEP_CPP_KRB_C) "$(INTDIR)"
-".\Release\get_tf_realm.obj" : $(SOURCE) $(DEP_CPP_GET_TF) "$(INTDIR)"
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_GET_TF=\
+SOURCE=.\krb_equiv.c
+DEP_CPP_KRB_E=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\get_tf_realm.obj" : $(SOURCE) $(DEP_CPP_GET_TF) "$(INTDIR)"
-
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-SOURCE=.\rd_safe.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
+"$(INTDIR)\krb_equiv.obj" : $(SOURCE) $(DEP_CPP_KRB_E) "$(INTDIR)"
-DEP_CPP_RD_SA=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
-
-".\Release\rd_safe.obj" : $(SOURCE) $(DEP_CPP_RD_SA) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_RD_SA=\
+SOURCE=.\krb_err_txt.c
+DEP_CPP_KRB_ER=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\rd_safe.obj" : $(SOURCE) $(DEP_CPP_RD_SA) "$(INTDIR)"
+"$(INTDIR)\krb_err_txt.obj" : $(SOURCE) $(DEP_CPP_KRB_ER) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\krb_get_in_tkt.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_KRB_G=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\krb_get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_KRB_G) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_KRB_G=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\krb_get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_KRB_G) "$(INTDIR)"
-
+"$(INTDIR)\krb_get_in_tkt.obj" : $(SOURCE) $(DEP_CPP_KRB_G) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\lifetime.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_LIFET=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
+ ".\prot.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\lifetime.obj" : $(SOURCE) $(DEP_CPP_LIFET) "$(INTDIR)"
+"$(INTDIR)\lifetime.obj" : $(SOURCE) $(DEP_CPP_LIFET) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_LIFET=\
+SOURCE=.\logging.c
+DEP_CPP_LOGGI=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\klog.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\lifetime.obj" : $(SOURCE) $(DEP_CPP_LIFET) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\logging.obj" : $(SOURCE) $(DEP_CPP_LOGGI) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\lsb_addr_comp.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_LSB_A=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
-
-
-".\Release\lsb_addr_comp.obj" : $(SOURCE) $(DEP_CPP_LSB_A) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_LSB_A=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-archaeology.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\lsb_addr_comp.obj" : $(SOURCE) $(DEP_CPP_LSB_A) "$(INTDIR)"
-
+"$(INTDIR)\lsb_addr_comp.obj" : $(SOURCE) $(DEP_CPP_LSB_A) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\mk_auth.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_MK_AU=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\mk_auth.obj" : $(SOURCE) $(DEP_CPP_MK_AU) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_MK_AU=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\mk_auth.obj" : $(SOURCE) $(DEP_CPP_MK_AU) "$(INTDIR)"
-
+"$(INTDIR)\mk_auth.obj" : $(SOURCE) $(DEP_CPP_MK_AU) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\mk_err.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_MK_ER=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\mk_err.obj" : $(SOURCE) $(DEP_CPP_MK_ER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_MK_ER=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\mk_err.obj" : $(SOURCE) $(DEP_CPP_MK_ER) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\mk_err.obj" : $(SOURCE) $(DEP_CPP_MK_ER) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\mk_priv.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_MK_PR=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
-
-
-".\Release\mk_priv.obj" : $(SOURCE) $(DEP_CPP_MK_PR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_MK_PR=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-archaeology.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\mk_priv.obj" : $(SOURCE) $(DEP_CPP_MK_PR) "$(INTDIR)"
+"$(INTDIR)\mk_priv.obj" : $(SOURCE) $(DEP_CPP_MK_PR) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\mk_req.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_MK_RE=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\mk_req.obj" : $(SOURCE) $(DEP_CPP_MK_RE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_MK_RE=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\mk_req.obj" : $(SOURCE) $(DEP_CPP_MK_RE) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\mk_req.obj" : $(SOURCE) $(DEP_CPP_MK_RE) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\mk_safe.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_MK_SA=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
-
-
-".\Release\mk_safe.obj" : $(SOURCE) $(DEP_CPP_MK_SA) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_MK_SA=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-archaeology.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\mk_safe.obj" : $(SOURCE) $(DEP_CPP_MK_SA) "$(INTDIR)"
-
+"$(INTDIR)\mk_safe.obj" : $(SOURCE) $(DEP_CPP_MK_SA) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\month_sname.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_MONTH=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\month_sname.obj" : $(SOURCE) $(DEP_CPP_MONTH) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_MONTH=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\month_sname.obj" : $(SOURCE) $(DEP_CPP_MONTH) "$(INTDIR)"
-
+"$(INTDIR)\month_sname.obj" : $(SOURCE) $(DEP_CPP_MONTH) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\name2name.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_NAME2=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\name2name.obj" : $(SOURCE) $(DEP_CPP_NAME2) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_NAME2=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\name2name.obj" : $(SOURCE) $(DEP_CPP_NAME2) "$(INTDIR)"
-
+"$(INTDIR)\name2name.obj" : $(SOURCE) $(DEP_CPP_NAME2) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\netread.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_NETRE=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\netread.obj" : $(SOURCE) $(DEP_CPP_NETRE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_NETRE=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\netread.obj" : $(SOURCE) $(DEP_CPP_NETRE) "$(INTDIR)"
-
+"$(INTDIR)\netread.obj" : $(SOURCE) $(DEP_CPP_NETRE) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\netwrite.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_NETWR=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\netwrite.obj" : $(SOURCE) $(DEP_CPP_NETWR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_NETWR=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\netwrite.obj" : $(SOURCE) $(DEP_CPP_NETWR) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\netwrite.obj" : $(SOURCE) $(DEP_CPP_NETWR) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\one.c
-!IF "$(CFG)" == "krb - Win32 Release"
-
-
-".\Release\one.obj" : $(SOURCE) "$(INTDIR)"
-
+"$(INTDIR)\one.obj" : $(SOURCE) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-
-".\Debug\one.obj" : $(SOURCE) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\parse_name.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_PARSE=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\parse_name.obj" : $(SOURCE) $(DEP_CPP_PARSE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_PARSE=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\parse_name.obj" : $(SOURCE) $(DEP_CPP_PARSE) "$(INTDIR)"
-
+"$(INTDIR)\parse_name.obj" : $(SOURCE) $(DEP_CPP_PARSE) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\rd_err.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RD_ER=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\rd_err.obj" : $(SOURCE) $(DEP_CPP_RD_ER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_RD_ER=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\rd_err.obj" : $(SOURCE) $(DEP_CPP_RD_ER) "$(INTDIR)"
+"$(INTDIR)\rd_err.obj" : $(SOURCE) $(DEP_CPP_RD_ER) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\rd_priv.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RD_PR=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
-
-
-".\Release\rd_priv.obj" : $(SOURCE) $(DEP_CPP_RD_PR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_RD_PR=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-archaeology.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
- ".\lsb_addr_comp.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\rd_priv.obj" : $(SOURCE) $(DEP_CPP_RD_PR) "$(INTDIR)"
+"$(INTDIR)\rd_priv.obj" : $(SOURCE) $(DEP_CPP_RD_PR) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\rd_req.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RD_RE=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\rd_req.obj" : $(SOURCE) $(DEP_CPP_RD_RE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_RD_RE=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\rd_req.obj" : $(SOURCE) $(DEP_CPP_RD_RE) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\rd_req.obj" : $(SOURCE) $(DEP_CPP_RD_RE) "$(INTDIR)"
-SOURCE=.\krb_err_txt.c
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_KRB_ER=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\krb_err_txt.obj" : $(SOURCE) $(DEP_CPP_KRB_ER) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_KRB_ER=\
+SOURCE=.\rd_safe.c
+DEP_CPP_RD_SA=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-archaeology.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\krb_err_txt.obj" : $(SOURCE) $(DEP_CPP_KRB_ER) "$(INTDIR)"
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\rd_safe.obj" : $(SOURCE) $(DEP_CPP_RD_SA) "$(INTDIR)"
-SOURCE=.\send_to_kdc.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-DEP_CPP_SEND_=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\send_to_kdc.obj" : $(SOURCE) $(DEP_CPP_SEND_) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_SEND_=\
+SOURCE=.\read_service_key.c
+DEP_CPP_READ_=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\send_to_kdc.obj" : $(SOURCE) $(DEP_CPP_SEND_) "$(INTDIR)"
+"$(INTDIR)\read_service_key.obj" : $(SOURCE) $(DEP_CPP_READ_) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
SOURCE=.\realm_parse.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_REALM=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\realm_parse.obj" : $(SOURCE) $(DEP_CPP_REALM) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_REALM=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\realm_parse.obj" : $(SOURCE) $(DEP_CPP_REALM) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\realm_parse.obj" : $(SOURCE) $(DEP_CPP_REALM) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\recvauth.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RECVA=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\recvauth.obj" : $(SOURCE) $(DEP_CPP_RECVA) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_RECVA=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\recvauth.obj" : $(SOURCE) $(DEP_CPP_RECVA) "$(INTDIR)"
-
+"$(INTDIR)\recvauth.obj" : $(SOURCE) $(DEP_CPP_RECVA) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\resolve.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RESOL=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
- ".\resolve.h"\
-
-
-".\Release\resolve.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_RESOL=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\resolve.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\resolve.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\rw.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_RW_C68=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- "..\des\version.h"\
- ".\krb_locl.h"\
-
-
-".\Release\rw.obj" : $(SOURCE) $(DEP_CPP_RW_C68) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_RW_C68=\
+DEP_CPP_RW_C6a=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\..\include\win32\version.h"\
"..\des\des.h"\
- "..\des\version.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\rw.obj" : $(SOURCE) $(DEP_CPP_RW_C68) "$(INTDIR)"
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!ENDIF
+"$(INTDIR)\rw.obj" : $(SOURCE) $(DEP_CPP_RW_C6a) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\save_credentials.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_SAVE_=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\save_credentials.obj" : $(SOURCE) $(DEP_CPP_SAVE_) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_SAVE_=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\save_credentials.obj" : $(SOURCE) $(DEP_CPP_SAVE_) "$(INTDIR)"
+"$(INTDIR)\save_credentials.obj" : $(SOURCE) $(DEP_CPP_SAVE_) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\read_service_key.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_READ_=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\read_service_key.obj" : $(SOURCE) $(DEP_CPP_READ_) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_READ_=\
+SOURCE=.\send_to_kdc.c
+DEP_CPP_SEND_=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\base64.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\read_service_key.obj" : $(SOURCE) $(DEP_CPP_READ_) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\verify_user.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_VERIF=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\verify_user.obj" : $(SOURCE) $(DEP_CPP_VERIF) "$(INTDIR)"
-
+"$(INTDIR)\send_to_kdc.obj" : $(SOURCE) $(DEP_CPP_SEND_) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_VERIF=\
+SOURCE=.\sendauth.c
+DEP_CPP_SENDA=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\verify_user.obj" : $(SOURCE) $(DEP_CPP_VERIF) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\sendauth.obj" : $(SOURCE) $(DEP_CPP_SENDA) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\stime.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_STIME=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
+ ".\prot.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\stime.obj" : $(SOURCE) $(DEP_CPP_STIME) "$(INTDIR)"
-
+"$(INTDIR)\stime.obj" : $(SOURCE) $(DEP_CPP_STIME) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_STIME=\
+SOURCE=.\str2key.c
+DEP_CPP_STR2K=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\stime.obj" : $(SOURCE) $(DEP_CPP_STIME) "$(INTDIR)"
+"$(INTDIR)\str2key.obj" : $(SOURCE) $(DEP_CPP_STR2K) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\swab.c
-DEP_CPP_SWAB_=\
- "..\..\include\win32\config.h"\
-
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-
-".\Release\swab.obj" : $(SOURCE) $(DEP_CPP_SWAB_) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-
-".\Debug\swab.obj" : $(SOURCE) $(DEP_CPP_SWAB_) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\ticket_memory.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_TICKE=\
- ".\krb_locl.h"\
- ".\ticket_memory.h"\
-
-
-".\Release\ticket_memory.obj" : $(SOURCE) $(DEP_CPP_TICKE) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_TICKE=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
+ ".\prot.h"\
".\ticket_memory.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\ticket_memory.obj" : $(SOURCE) $(DEP_CPP_TICKE) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\ticket_memory.obj" : $(SOURCE) $(DEP_CPP_TICKE) "$(INTDIR)"
-SOURCE=.\tkt_string.c
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_TKT_S=\
+SOURCE=.\time.c
+DEP_CPP_TIME_=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
+ "..\des\des.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
+ ".\krb.h"\
".\krb_locl.h"\
-
+ ".\krb_log.h"\
+ ".\prot.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\tkt_string.obj" : $(SOURCE) $(DEP_CPP_TKT_S) "$(INTDIR)"
+"$(INTDIR)\time.obj" : $(SOURCE) $(DEP_CPP_TIME_) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
+SOURCE=.\tkt_string.c
DEP_CPP_TKT_S=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\tkt_string.obj" : $(SOURCE) $(DEP_CPP_TKT_S) "$(INTDIR)"
-
-
-!ENDIF
+"$(INTDIR)\tkt_string.obj" : $(SOURCE) $(DEP_CPP_TKT_S) "$(INTDIR)"
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\unparse_name.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
DEP_CPP_UNPAR=\
"..\..\include\protos.h"\
"..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\unparse_name.obj" : $(SOURCE) $(DEP_CPP_UNPAR) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_UNPAR=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\unparse_name.obj" : $(SOURCE) $(DEP_CPP_UNPAR) "$(INTDIR)"
-
+"$(INTDIR)\unparse_name.obj" : $(SOURCE) $(DEP_CPP_UNPAR) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\util.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_UTIL_=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
DEP_CPP_UTIL_=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Debug\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\util.obj" : $(SOURCE) $(DEP_CPP_UTIL_) "$(INTDIR)"
-SOURCE=.\sendauth.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-DEP_CPP_SENDA=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\sendauth.obj" : $(SOURCE) $(DEP_CPP_SENDA) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_SENDA=\
+SOURCE=.\verify_user.c
+DEP_CPP_VERIF=\
"..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
+ "..\..\include\win32\ktypes.h"\
+ "..\..\include\win32\roken.h"\
"..\des\des.h"\
- "..\roken\roken.h"\
+ "..\roken\err.h"\
+ "..\roken\roken-common.h"\
+ ".\krb-protos.h"\
".\krb.h"\
".\krb_locl.h"\
+ ".\krb_log.h"\
".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\sendauth.obj" : $(SOURCE) $(DEP_CPP_SENDA) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\logging.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
-
-DEP_CPP_LOGGI=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\klog.h"\
- ".\krb_locl.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-".\Release\logging.obj" : $(SOURCE) $(DEP_CPP_LOGGI) "$(INTDIR)"
+"$(INTDIR)\verify_user.obj" : $(SOURCE) $(DEP_CPP_VERIF) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
+SOURCE=.\krb.rc
-DEP_CPP_LOGGI=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
- "..\des\des.h"\
- "..\roken\roken.h"\
- ".\klog.h"\
- ".\krb.h"\
- ".\krb_locl.h"\
- ".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
+"$(INTDIR)\krb.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
-".\Debug\logging.obj" : $(SOURCE) $(DEP_CPP_LOGGI) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\str2key.c
-
!IF "$(CFG)" == "krb - Win32 Release"
-DEP_CPP_STR2K=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
-
-
-".\Release\str2key.obj" : $(SOURCE) $(DEP_CPP_STR2K) "$(INTDIR)"
+"des - Win32 Release" :
+ cd "\tmp\wirus-krb\krb4-pre-0.9.9\lib\des"
+ $(MAKE) /$(MAKEFLAGS) /F ".\des.mak" CFG="des - Win32 Release"
+ cd "..\krb"
+"des - Win32 ReleaseCLEAN" :
+ cd "\tmp\wirus-krb\krb4-pre-0.9.9\lib\des"
+ $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\des.mak" CFG="des - Win32 Release"\
+ RECURSE=1
+ cd "..\krb"
!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-DEP_CPP_STR2K=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
- "..\des\des.h"\
- "..\roken\roken.h"\
- ".\krb.h"\
- ".\krb_locl.h"\
- ".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\str2key.obj" : $(SOURCE) $(DEP_CPP_STR2K) "$(INTDIR)"
-
-
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
-
-SOURCE=.\debug_decl.c
-
-!IF "$(CFG)" == "krb - Win32 Release"
+"des - Win32 Debug" :
+ cd "\tmp\wirus-krb\krb4-pre-0.9.9\lib\des"
+ $(MAKE) /$(MAKEFLAGS) /F ".\des.mak" CFG="des - Win32 Debug"
+ cd "..\krb"
-DEP_CPP_DEBUG=\
- "..\..\include\protos.h"\
- "..\..\include\win32\config.h"\
- ".\krb_locl.h"\
+"des - Win32 DebugCLEAN" :
+ cd "\tmp\wirus-krb\krb4-pre-0.9.9\lib\des"
+ $(MAKE) /$(MAKEFLAGS) CLEAN /F ".\des.mak" CFG="des - Win32 Debug" RECURSE=1\
+ cd "..\krb"
-".\Release\debug_decl.obj" : $(SOURCE) $(DEP_CPP_DEBUG) "$(INTDIR)"
-
-
-!ELSEIF "$(CFG)" == "krb - Win32 Debug"
-
-DEP_CPP_DEBUG=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
- "..\..\include\win32\config.h"\
- "..\des\des.h"\
- "..\roken\roken.h"\
- ".\krb.h"\
- ".\krb_locl.h"\
- ".\prot.h"\
- ".\resolve.h"\
- {$(INCLUDE)}"\sys\STAT.H"\
- {$(INCLUDE)}"\sys\TYPES.H"\
-
-
-".\Debug\debug_decl.obj" : $(SOURCE) $(DEP_CPP_DEBUG) "$(INTDIR)"
+!ENDIF
!ENDIF
-# End Source File
-# End Target
-# End Project
-################################################################################
diff --git a/crypto/kerberosIV/lib/krb/krb.rc b/crypto/kerberosIV/lib/krb/krb.rc
new file mode 100644
index 0000000..413e706
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb.rc
@@ -0,0 +1,105 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Swedish resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
+#ifdef _WIN32
+LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Royal Institute of Technology (KTH)\0"
+ VALUE "FileDescription", "krb\0"
+ VALUE "FileVersion", "4, 0, 9, 9\0"
+ VALUE "InternalName", "krb\0"
+ VALUE "LegalCopyright", "Copyright © 1996 - 1998 Royal Institute of Technology (KTH)\0"
+ VALUE "OriginalFilename", "krb.dll\0"
+ VALUE "ProductName", "KTH Kerberos\0"
+ VALUE "ProductVersion", "4,0,9,9\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+#endif // Swedish resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/crypto/kerberosIV/lib/krb/krb_equiv.c b/crypto/kerberosIV/lib/krb/krb_equiv.c
index 06f42f5..fab79e5 100644
--- a/crypto/kerberosIV/lib/krb/krb_equiv.c
+++ b/crypto/kerberosIV/lib/krb/krb_equiv.c
@@ -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.
*
@@ -56,7 +56,7 @@
*/
#include "krb_locl.h"
-RCSID("$Id: krb_equiv.c,v 1.13 1997/04/01 08:18:33 joda Exp $");
+RCSID("$Id: krb_equiv.c,v 1.14 1999/03/13 21:25:30 assar Exp $");
int krb_ignore_ip_address = 0;
@@ -100,9 +100,9 @@ krb_equiv(u_int32_t a, u_int32_t b)
++t;
} else if (*t == '\\' ) /* continuation */
break;
- else if (isspace(*t)) /* skip space */
+ else if (isspace((unsigned char)*t)) /* skip space */
t++;
- else if (isdigit(*t)) /* an address? */
+ else if (isdigit((unsigned char)*t)) /* an address? */
{
u_int32_t tmp;
u_int32_t tmpa, tmpb, tmpc, tmpd;
@@ -110,7 +110,8 @@ krb_equiv(u_int32_t a, u_int32_t b)
sscanf(t, "%d.%d.%d.%d", &tmpa, &tmpb, &tmpc, &tmpd);
tmp = (tmpa << 24) | (tmpb << 16) | (tmpc << 8) | tmpd;
- while (*t == '.' || isdigit(*t)) /* done with this address */
+ /* done with this address */
+ while (*t == '.' || isdigit((unsigned char)*t))
t++;
if (tmp != -1) { /* an address (and not broadcast) */
@@ -120,7 +121,7 @@ krb_equiv(u_int32_t a, u_int32_t b)
++t;
mask <<= 32 - atoi(t);
- while(isdigit(*t))
+ while(isdigit((unsigned char)*t))
++t;
}
diff --git a/crypto/kerberosIV/lib/krb/krb_err.et b/crypto/kerberosIV/lib/krb/krb_err.et
index 4e32aed..9dce192 100644
--- a/crypto/kerberosIV/lib/krb/krb_err.et
+++ b/crypto/kerberosIV/lib/krb/krb_err.et
@@ -3,255 +3,63 @@
# For copying and distribution information, see the file
# "mit-copyright.h".
#
-# $Id: krb_err.et,v 1.4 1996/10/27 13:30:28 bg Exp $
+# This might look like a com_err file, but is not
#
- error_table krb
-
- ec KRBET_KSUCCESS,
- "Kerberos successful"
-
- ec KRBET_KDC_NAME_EXP,
- "Kerberos principal expired"
-
- ec KRBET_KDC_SERVICE_EXP,
- "Kerberos service expired"
-
- ec KRBET_KDC_AUTH_EXP,
- "Kerberos auth expired"
-
- ec KRBET_KDC_PKT_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_P_MKEY_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_S_MKEY_VER,
- "Incorrect kerberos master key version"
-
- ec KRBET_KDC_BYTE_ORDER,
- "Kerberos error: byte order unknown"
-
- ec KRBET_KDC_PR_UNKNOWN,
- "Kerberos principal unknown"
-
- ec KRBET_KDC_PR_N_UNIQUE,
- "Kerberos principal not unique"
-
- ec KRBET_KDC_NULL_KEY,
- "Kerberos principal has null key"
-
- ec KRBET_KRB_RES11,
- "Reserved 11"
-
- ec KRBET_KRB_RES12,
- "Reserved 12"
-
- ec KRBET_KRB_RES13,
- "Reserved 13"
-
- ec KRBET_KRB_RES14,
- "Reserved 14"
-
- ec KRBET_KRB_RES15,
- "Reserved 15"
-
- ec KRBET_KRB_RES16,
- "Reserved 16"
-
- ec KRBET_KRB_RES17,
- "Reserved 17"
-
- ec KRBET_KRB_RES18,
- "Reserved 18"
-
- ec KRBET_KRB_RES19,
- "Reserved 19"
-
- ec KRBET_KDC_GEN_ERR,
- "Generic error from Kerberos KDC"
-
- ec KRBET_GC_TKFIL,
- "Can't read Kerberos ticket file"
-
- ec KRBET_GC_NOTKT,
- "Can't find Kerberos ticket or TGT"
-
- ec KRBET_KRB_RES23,
- "Reserved 23"
-
- ec KRBET_KRB_RES24,
- "Reserved 24"
-
- ec KRBET_KRB_RES25,
- "Reserved 25"
-
- ec KRBET_MK_AP_TGTEXP,
- "Kerberos TGT Expired"
-
- ec KRBET_KRB_RES27,
- "Reserved 27"
-
- ec KRBET_KRB_RES28,
- "Reserved 28"
-
- ec KRBET_KRB_RES29,
- "Reserved 29"
-
- ec KRBET_KRB_RES30,
- "Reserved 30"
-
- ec KRBET_RD_AP_UNDEC,
- "Kerberos error: Can't decode authenticator"
-
- ec KRBET_RD_AP_EXP,
- "Kerberos ticket expired"
-
- ec KRBET_RD_AP_NYV,
- "Kerberos ticket not yet valid"
-
- ec KRBET_RD_AP_REPEAT,
- "Kerberos error: Repeated request"
-
- ec KRBET_RD_AP_NOT_US,
- "The kerberos ticket isn't for us"
-
- ec KRBET_RD_AP_INCON,
- "Kerberos request inconsistent"
-
- ec KRBET_RD_AP_TIME,
- "Kerberos error: delta_t too big"
-
- ec KRBET_RD_AP_BADD,
- "Kerberos error: incorrect net address"
-
- ec KRBET_RD_AP_VERSION,
- "Kerberos protocol version mismatch"
-
- ec KRBET_RD_AP_MSG_TYPE,
- "Kerberos error: invalid msg type"
-
- ec KRBET_RD_AP_MODIFIED,
- "Kerberos error: message stream modified"
-
- ec KRBET_RD_AP_ORDER,
- "Kerberos error: message out of order"
-
- ec KRBET_RD_AP_UNAUTHOR,
- "Kerberos error: unauthorized request"
-
- ec KRBET_KRB_RES44,
- "Reserved 44"
-
- ec KRBET_KRB_RES45,
- "Reserved 45"
-
- ec KRBET_KRB_RES46,
- "Reserved 46"
-
- ec KRBET_KRB_RES47,
- "Reserved 47"
-
- ec KRBET_KRB_RES48,
- "Reserved 48"
-
- ec KRBET_KRB_RES49,
- "Reserved 49"
-
- ec KRBET_KRB_RES50,
- "Reserved 50"
-
- ec KRBET_GT_PW_NULL,
- "Kerberos error: current PW is null"
-
- ec KRBET_GT_PW_BADPW,
- "Kerberos error: Incorrect current password"
-
- ec KRBET_GT_PW_PROT,
- "Kerberos protocol error"
-
- ec KRBET_GT_PW_KDCERR,
- "Error returned by Kerberos KDC"
-
- ec KRBET_GT_PW_NULLTKT,
- "Null Kerberos ticket returned by KDC"
-
- ec KRBET_SKDC_RETRY,
- "Kerberos error: Retry count exceeded"
-
- ec KRBET_SKDC_CANT,
- "Kerberos error: Can't send request"
-
- ec KRBET_KRB_RES58,
- "Reserved 58"
-
- ec KRBET_KRB_RES59,
- "Reserved 59"
-
- ec KRBET_KRB_RES60,
- "Reserved 60"
-
- ec KRBET_INTK_W_NOTALL,
- "Kerberos error: not all tickets returned"
-
- ec KRBET_INTK_BADPW,
- "Kerberos error: incorrect password"
-
- ec KRBET_INTK_PROT,
- "Kerberos error: Protocol Error"
-
- ec KRBET_KRB_RES64,
- "Reserved 64"
-
- ec KRBET_KRB_RES65,
- "Reserved 65"
-
- ec KRBET_KRB_RES66,
- "Reserved 66"
-
- ec KRBET_KRB_RES67,
- "Reserved 67"
-
- ec KRBET_KRB_RES68,
- "Reserved 68"
-
- ec KRBET_KRB_RES69,
- "Reserved 69"
-
- ec KRBET_INTK_ERR,
- "Other error"
-
- ec KRBET_AD_NOTGT,
- "Don't have Kerberos ticket-granting ticket"
-
- ec KRBET_KRB_RES72,
- "Can't get Kerberos inter-realm ticket-granting ticket"
-
- ec KRBET_KRB_RES73,
- "Reserved 73"
-
- ec KRBET_KRB_RES74,
- "Reserved 74"
-
- ec KRBET_KRB_RES75,
- "Reserved 75"
-
- ec KRBET_NO_TKT_FIL,
- "No ticket file found"
-
- ec KRBET_TKT_FIL_ACC,
- "Couldn't access ticket file"
-
- ec KRBET_TKT_FIL_LCK,
- "Couldn't lock ticket file"
-
- ec KRBET_TKT_FIL_FMT,
- "Bad ticket file format"
-
- ec KRBET_TKT_FIL_INI,
- "tf_init not called first"
-
- ec KRBET_KNAME_FMT,
- "Bad Kerberos name format"
-
- end
-
+id "$Id: krb_err.et,v 1.7 1998/03/29 14:19:52 bg Exp $"
+
+error_table krb
+
+prefix KRBET
+ec KSUCCESS, "Kerberos successful"
+ec KDC_NAME_EXP, "Kerberos principal expired"
+ec KDC_SERVICE_EXP, "Kerberos service expired"
+ec KDC_AUTH_EXP, "Kerberos auth expired"
+ec KDC_PKT_VER, "Incorrect kerberos master key version"
+ec KDC_P_MKEY_VER, "Incorrect kerberos master key version"
+ec KDC_S_MKEY_VER, "Incorrect kerberos master key version"
+ec KDC_BYTE_ORDER, "Kerberos error: byte order unknown"
+ec KDC_PR_UNKNOWN, "Kerberos principal unknown"
+ec KDC_PR_N_UNIQUE, "Kerberos principal not unique"
+ec KDC_NULL_KEY, "Kerberos principal has null key"
+index 20
+ec KDC_GEN_ERR, "Generic error from Kerberos KDC"
+ec GC_TKFIL, "Can't read Kerberos ticket file"
+ec GC_NOTKT, "Can't find Kerberos ticket or TGT"
+index 26
+ec MK_AP_TGTEXP, "Kerberos TGT Expired"
+index 31
+ec RD_AP_UNDEC, "Kerberos error: Can't decode authenticator"
+ec RD_AP_EXP, "Kerberos ticket expired"
+ec RD_AP_NYV, "Kerberos ticket not yet valid"
+ec RD_AP_REPEAT, "Kerberos error: Repeated request"
+ec RD_AP_NOT_US, "The kerberos ticket isn't for us"
+ec RD_AP_INCON, "Kerberos request inconsistent"
+ec RD_AP_TIME, "Kerberos error: delta_t too big"
+ec RD_AP_BADD, "Kerberos error: incorrect net address"
+ec RD_AP_VERSION, "Kerberos protocol version mismatch"
+ec RD_AP_MSG_TYPE, "Kerberos error: invalid msg type"
+ec RD_AP_MODIFIED, "Kerberos error: message stream modified"
+ec RD_AP_ORDER, "Kerberos error: message out of order"
+ec RD_AP_UNAUTHOR, "Kerberos error: unauthorized request"
+index 51
+ec GT_PW_NULL, "Kerberos error: current PW is null"
+ec GT_PW_BADPW, "Kerberos error: Incorrect current password"
+ec GT_PW_PROT, "Kerberos protocol error"
+ec GT_PW_KDCERR, "Error returned by Kerberos KDC"
+ec GT_PW_NULLTKT, "Null Kerberos ticket returned by KDC"
+ec SKDC_RETRY, "Kerberos error: Retry count exceeded"
+ec SKDC_CANT, "Kerberos error: Can't send request"
+index 61
+ec INTK_W_NOTALL, "Kerberos error: not all tickets returned"
+ec INTK_BADPW, "Kerberos error: incorrect password"
+ec INTK_PROT, "Kerberos error: Protocol Error"
+index 70
+ec INTK_ERR, "Other error"
+ec AD_NOTGT, "Don't have Kerberos ticket-granting ticket"
+index 76
+ec NO_TKT_FIL, "No ticket file found"
+ec TKT_FIL_ACC, "Couldn't access ticket file"
+ec TKT_FIL_LCK, "Couldn't lock ticket file"
+ec TKT_FIL_FMT, "Bad ticket file format"
+ec TKT_FIL_INI, "tf_init not called first"
+ec KNAME_FMT, "Bad Kerberos name format"
diff --git a/crypto/kerberosIV/lib/krb/krb_err_txt.c b/crypto/kerberosIV/lib/krb/krb_err_txt.c
index 161aa0f..cb6cd13 100644
--- a/crypto/kerberosIV/lib/krb/krb_err_txt.c
+++ b/crypto/kerberosIV/lib/krb/krb_err_txt.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: krb_err_txt.c,v 1.12 1997/04/02 05:37:10 joda Exp $");
+RCSID("$Id: krb_err_txt.c,v 1.13 1998/01/31 08:11:52 joda Exp $");
/*
* This file contains an array of error text strings.
@@ -70,7 +70,7 @@ const char *krb_err_txt[256] = {
"Time is out of bounds (krb_rd_req)", /* 037 */
"Incorrect network address (krb_rd_req)", /* 038 */
"Protocol version mismatch (krb_rd_req)", /* 039 */
- "Illegal message type (krb_rd_req)", /* 040 */
+ "Invalid message type (krb_rd_req)", /* 040 */
"Message integrity error (krb_rd_req)", /* 041 */
"Message duplicate or out of order (krb_rd_req)", /* 042 */
"Unauthorized request (krb_rd_req)", /* 043 */
@@ -288,7 +288,7 @@ const char *krb_err_txt[256] = {
"Generic kerberos error (kfailure)", /* 255 */
};
-static const char err_failure[] = "Illegal error code passed (krb_get_err_text)";
+static const char err_failure[] = "Unknown error code passed (krb_get_err_text)";
const char *
krb_get_err_text(int code)
diff --git a/crypto/kerberosIV/lib/krb/krb_get_in_tkt.c b/crypto/kerberosIV/lib/krb/krb_get_in_tkt.c
index d3e6cc1..83848c8 100644
--- a/crypto/kerberosIV/lib/krb/krb_get_in_tkt.c
+++ b/crypto/kerberosIV/lib/krb/krb_get_in_tkt.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: krb_get_in_tkt.c,v 1.20 1997/04/01 08:18:34 joda Exp $");
+RCSID("$Id: krb_get_in_tkt.c,v 1.29 1999/06/29 21:18:07 bg Exp $");
/*
* decrypt_tkt(): Given user, instance, realm, passwd, key_proc
@@ -47,8 +47,12 @@ RCSID("$Id: krb_get_in_tkt.c,v 1.20 1997/04/01 08:18:34 joda Exp $");
*/
static int
-decrypt_tkt(char *user, char *instance, char *realm,
- void *arg, key_proc_t key_proc, KTEXT *cip)
+decrypt_tkt(const char *user,
+ char *instance,
+ const char *realm,
+ const void *arg,
+ key_proc_t key_proc,
+ KTEXT *cip)
{
des_cblock key; /* Key for decrypting cipher */
int ret;
@@ -105,32 +109,64 @@ decrypt_tkt(char *user, char *instance, char *realm,
*/
int
-krb_get_in_tkt(char *user, char *instance, char *realm,
- char *service, char *sinstance, int life,
- key_proc_t key_proc, decrypt_proc_t decrypt_proc, void *arg)
+krb_mk_as_req(const char *user,
+ const char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ int life,
+ KTEXT cip)
{
KTEXT_ST pkt_st;
KTEXT pkt = &pkt_st; /* Packet to KDC */
KTEXT_ST rpkt_st;
- KTEXT rpkt = &rpkt_st; /* Returned packet */
-
+ KTEXT rpkt = &rpkt_st; /* Reply from KDC */
+
int kerror;
struct timeval tv;
/* BUILD REQUEST PACKET */
unsigned char *p = pkt->dat;
+ int tmp;
+ size_t rem = sizeof(pkt->dat);
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_KDC_REQUEST, p, 1);
-
- p += krb_put_nir(user, instance, realm, p);
+ tmp = krb_put_int(KRB_PROT_VERSION, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(AUTH_MSG_KDC_REQUEST, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_nir(user, instance, realm, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
gettimeofday(&tv, NULL);
- p += krb_put_int(tv.tv_sec, p, 4);
- p += krb_put_int(life, p, 1);
-
- p += krb_put_nir(service, sinstance, NULL, p);
+ tmp = krb_put_int(tv.tv_sec, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(life, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_nir(service, sinstance, NULL, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
pkt->length = p - pkt->dat;
@@ -138,38 +174,67 @@ krb_get_in_tkt(char *user, char *instance, char *realm,
/* SEND THE REQUEST AND RECEIVE THE RETURN PACKET */
- if ((kerror = send_to_kdc(pkt, rpkt, realm))) return(kerror);
-
- p = rpkt->dat;
+ kerror = send_to_kdc(pkt, rpkt, realm);
+ if(kerror) return kerror;
+ kerror = kdc_reply_cipher(rpkt, cip);
+ return kerror;
+}
+
+int
+krb_decode_as_rep(const char *user,
+ char *instance,
+ const char *realm,
+ const char *service,
+ const char *sinstance,
+ key_proc_t key_proc,
+ decrypt_proc_t decrypt_proc,
+ const void *arg,
+ KTEXT as_rep,
+ CREDENTIALS *cred)
+{
+ int kerror;
+ time_t now;
- {
- CREDENTIALS cred;
- KTEXT_ST cip;
- KTEXT foo = &cip; /* braindamage */
+ if (decrypt_proc == NULL)
+ decrypt_tkt(user, instance, realm, arg, key_proc, &as_rep);
+ else
+ (*decrypt_proc)(user, instance, realm, arg, key_proc, &as_rep);
+
+ kerror = kdc_reply_cred(as_rep, cred);
+ if(kerror != KSUCCESS)
+ return kerror;
- kerror = kdc_reply_cipher(rpkt, &cip);
- if(kerror != KSUCCESS)
- return kerror;
+ if (strcmp(cred->service, service) ||
+ strcmp(cred->instance, sinstance) ||
+ strcmp(cred->realm, realm)) /* not what we asked for */
+ return INTK_ERR; /* we need a better code here XXX */
- if (decrypt_proc == NULL)
- decrypt_proc = decrypt_tkt;
- (*decrypt_proc)(user, instance, realm, arg, key_proc, &foo);
+ now = time(NULL);
+ if(krb_get_config_bool("kdc_timesync"))
+ krb_set_kdc_time_diff(cred->issue_date - now);
+ else if (abs((int)(now - cred->issue_date)) > CLOCK_SKEW)
+ return RD_AP_TIME; /* XXX should probably be better code */
- kerror = kdc_reply_cred(&cip, &cred);
- if(kerror != KSUCCESS)
- return kerror;
-
- if (strcmp(cred.service, service) ||
- strcmp(cred.instance, sinstance) ||
- strcmp(cred.realm, realm)) /* not what we asked for */
- return INTK_ERR; /* we need a better code here XXX */
+ return 0;
+}
- if (abs((int)(tv.tv_sec - cred.issue_date)) > CLOCK_SKEW) {
- return RD_AP_TIME; /* XXX should probably be better code */
- }
+int
+krb_get_in_tkt(char *user, char *instance, char *realm,
+ char *service, char *sinstance, int life,
+ key_proc_t key_proc, decrypt_proc_t decrypt_proc, void *arg)
+{
+ KTEXT_ST as_rep;
+ CREDENTIALS cred;
+ int ret;
- /* initialize ticket cache */
+ ret = krb_mk_as_req(user, instance, realm,
+ service, sinstance, life, &as_rep);
+ if(ret)
+ return ret;
+ ret = krb_decode_as_rep(user, instance, realm, service, sinstance,
+ key_proc, decrypt_proc, arg, &as_rep, &cred);
+ if(ret)
+ return ret;
- return tf_setup(&cred, user, instance);
- }
+ return tf_setup(&cred, user, instance);
}
diff --git a/crypto/kerberosIV/lib/krb/krb_locl.h b/crypto/kerberosIV/lib/krb/krb_locl.h
index 4475883..f5792a8 100644
--- a/crypto/kerberosIV/lib/krb/krb_locl.h
+++ b/crypto/kerberosIV/lib/krb/krb_locl.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-/* $Id: krb_locl.h,v 1.42 1997/05/20 18:40:45 bg Exp $ */
+/* $Id: krb_locl.h,v 1.49 1998/06/13 00:06:59 assar Exp $ */
#ifndef __krb_locl_h
#define __krb_locl_h
@@ -119,6 +119,11 @@
#ifdef SOCKS
#include <socks.h>
+
+/* This doesn't belong here. */
+struct tm *localtime(const time_t *);
+struct hostent *gethostbyname(const char *);
+
#endif
#include <roken.h>
@@ -127,37 +132,49 @@
#include <prot.h>
#include "resolve.h"
+#include "krb_log.h"
/* --- */
-/* Globals! */
-extern int krb_debug;
-extern int krb_ap_req_debug;
-
/* Utils */
-int krb_name_to_name(const char *, char *, size_t);
+int
+krb_name_to_name __P((
+ const char *host,
+ char *phost,
+ size_t phost_size));
-void encrypt_ktext(KTEXT cip, des_cblock *key, int encrypt);
-int kdc_reply_cred(KTEXT cip, CREDENTIALS *cred);
-int kdc_reply_cipher(KTEXT reply, KTEXT cip);
+void
+encrypt_ktext __P((
+ KTEXT cip,
+ des_cblock *key,
+ int encrypt));
-#ifndef HAVE_GETTIMEOFDAY
-int gettimeofday (struct timeval *, void *);
-#endif
+int
+kdc_reply_cipher __P((
+ KTEXT reply,
+ KTEXT cip));
-void k_ricercar(char*);
+int
+kdc_reply_cred __P((
+ KTEXT cip,
+ CREDENTIALS *cred));
-/* safe multiple strcat */
-int k_concat(char*, size_t, ...);
-int k_vconcat(char*, size_t, va_list);
+void
+k_ricercar __P((char *name));
-/* mallocing versions of the above */
-size_t k_vmconcat (char**, size_t, va_list);
-size_t k_mconcat (char**, size_t, ...);
/* used in rd_safe.c and mk_safe.c */
-void fixup_quad_cksum(void *start, size_t len, des_cblock *key,
- void *new_checksum, void *old_checksum, int little);
+void
+fixup_quad_cksum __P((
+ void *start,
+ size_t len,
+ des_cblock *key,
+ void *new_checksum,
+ void *old_checksum,
+ int little));
+
+void
+krb_kdctimeofday __P((struct timeval *tv));
#endif /* __krb_locl_h */
diff --git a/crypto/kerberosIV/lib/krb/krb_log.h b/crypto/kerberosIV/lib/krb/krb_log.h
new file mode 100644
index 0000000..a760102
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb_log.h
@@ -0,0 +1,79 @@
+/*
+ * 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: krb_log.h,v 1.2 1997/09/26 17:40:33 joda Exp $ */
+
+#include <krb.h>
+
+#ifndef __KRB_LOG_H__
+#define __KRB_LOG_H__
+
+#if !defined(__GNUC__) && !defined(__attribute__)
+#define __attribute__(X)
+#endif
+
+__BEGIN_DECLS
+
+/* logging.c */
+
+typedef int (*krb_log_func_t) __P((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))
+ __attribute__ ((format (printf, 2, 0)));
+int krb_logger __P((struct krb_log_facility*, const char *, ...))
+ __attribute__ ((format (printf, 2, 3)));
+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*, ...))
+ __attribute__ ((format (printf, 1, 2)));
+
+void kset_logfile __P((char*));
+void krb_log __P((const char*, ...))
+ __attribute__ ((format (printf, 1, 2)));
+char *klog __P((int, const char*, ...))
+ __attribute__ ((format (printf, 2, 3)));
+
+__END_DECLS
+
+#endif /* __KRB_LOG_H__ */
diff --git a/crypto/kerberosIV/lib/krb/krb_net_read.c b/crypto/kerberosIV/lib/krb/krb_net_read.c
new file mode 100644
index 0000000..7459e2f
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb_net_read.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: krb_net_read.c,v 1.2 1999/03/17 16:18:37 joda Exp $");
+
+int
+krb_net_read (int fd, void *buf, size_t nbytes)
+{
+ return net_read (fd, buf, nbytes);
+}
diff --git a/crypto/kerberosIV/lib/krb/krb_net_write.c b/crypto/kerberosIV/lib/krb/krb_net_write.c
new file mode 100644
index 0000000..e086ee1
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/krb_net_write.c
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: krb_net_write.c,v 1.2 1999/03/17 16:18:37 joda Exp $");
+
+int
+krb_net_write (int fd, const void *buf, size_t nbytes)
+{
+ return net_write (fd, buf, nbytes);
+}
diff --git a/crypto/kerberosIV/lib/krb/kuserok.c b/crypto/kerberosIV/lib/krb/kuserok.c
index e3d5e6b..4a2be44 100644
--- a/crypto/kerberosIV/lib/krb/kuserok.c
+++ b/crypto/kerberosIV/lib/krb/kuserok.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,12 +38,29 @@
#include "krb_locl.h"
-RCSID("$Id: kuserok.c,v 1.21 1997/04/01 08:18:35 joda Exp $");
+RCSID("$Id: kuserok.c,v 1.24 1999/06/23 10:12:37 assar Exp $");
#define OK 0
#define NOTOK 1
#define MAX_USERNAME 10
+/*
+ * Return OK if `r' is one of the local realms, else NOTOK
+ */
+
+static int
+is_local_realm (const char *r)
+{
+ char lrealm[REALM_SZ];
+ int n;
+
+ for (n = 1; krb_get_lrealm(lrealm, n) == KSUCCESS; ++n) {
+ if (strcmp (r, lrealm) == 0)
+ return OK;
+ }
+ return NOTOK;
+}
+
/*
* Given a Kerberos principal and a local username, determine whether
* user is authorized to login according to the authorization file
@@ -83,7 +100,6 @@ int
krb_kuserok(char *name, char *instance, char *realm, char *luser)
{
struct passwd *pwd;
- char lrealm[REALM_SZ];
FILE *f;
char line[1024];
char file[MaxPathLen];
@@ -92,15 +108,13 @@ krb_kuserok(char *name, char *instance, char *realm, char *luser)
pwd = getpwnam(luser);
if(pwd == NULL)
return NOTOK;
- if(krb_get_lrealm(lrealm, 1))
- return NOTOK;
- if(pwd->pw_uid != 0 &&
- strcmp(name, luser) == 0 &&
- strcmp(instance, "") == 0 &&
- strcmp(realm, lrealm) == 0)
+ if (pwd->pw_uid != 0
+ && strcmp (name, luser) == 0
+ && strcmp (instance, "") == 0
+ && is_local_realm (realm) == OK)
return OK;
- strcpy(file, pwd->pw_dir);
- strcat(file, "/.klogin");
+
+ snprintf(file, sizeof(file), "%s/.klogin", pwd->pw_dir);
f = fopen(file, "r");
if(f == NULL)
@@ -135,10 +149,15 @@ krb_kuserok(char *name, char *instance, char *realm, char *luser)
continue;
if(strcmp(instance, finst))
continue;
- if(frealm[0] == 0)
- strcpy(frealm, lrealm);
- if(strcmp(realm, frealm))
+#if 0 /* don't support principals without realm any longer */
+ if(frealm[0] == 0) {
+ if (is_local_realm (realm) != OK)
+ continue;
+ } else
+#endif
+ if (strcmp (realm, frealm))
continue;
+
fclose(f);
return OK;
}
@@ -153,4 +172,3 @@ kuserok(AUTH_DAT *auth, char *luser)
{
return krb_kuserok(auth->pname, auth->pinst, auth->prealm, luser);
}
-
diff --git a/crypto/kerberosIV/lib/krb/logging.c b/crypto/kerberosIV/lib/krb/logging.c
index 15e5bde..76965fd 100644
--- a/crypto/kerberosIV/lib/krb/logging.c
+++ b/crypto/kerberosIV/lib/krb/logging.c
@@ -39,7 +39,7 @@
#include "krb_locl.h"
#include <klog.h>
-RCSID("$Id: logging.c,v 1.14 1997/05/11 09:01:40 assar Exp $");
+RCSID("$Id: logging.c,v 1.16 1998/07/24 06:13:35 assar Exp $");
struct krb_log_facility {
char filename[MaxPathLen];
@@ -87,7 +87,7 @@ krb_openlog(struct krb_log_facility *f,
FILE *file,
krb_log_func_t func)
{
- strcpy(f->filename, filename);
+ strcpy_truncate(f->filename, filename, MaxPathLen);
f->file = file;
f->func = func;
return KSUCCESS;
@@ -109,7 +109,7 @@ log_tty(FILE *f, const char *format, va_list args)
static struct krb_log_facility std_log = { "/dev/tty", NULL, log_tty };
static void
-init_std_log ()
+init_std_log (void)
{
static int done = 0;
diff --git a/crypto/kerberosIV/lib/krb/lsb_addr_comp.c b/crypto/kerberosIV/lib/krb/lsb_addr_comp.c
index bc3c484..024e8ca 100644
--- a/crypto/kerberosIV/lib/krb/lsb_addr_comp.c
+++ b/crypto/kerberosIV/lib/krb/lsb_addr_comp.c
@@ -38,9 +38,9 @@
#include "krb_locl.h"
-RCSID("$Id: lsb_addr_comp.c,v 1.9 1997/04/01 08:18:37 joda Exp $");
+RCSID("$Id: lsb_addr_comp.c,v 1.15 1998/10/22 15:58:26 joda Exp $");
-#include "lsb_addr_comp.h"
+#include "krb-archaeology.h"
int
krb_lsb_antinet_ulong_cmp(u_int32_t x, u_int32_t y)
@@ -83,23 +83,57 @@ 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)
{
+ int dir = 1;
+ const char *fw;
+
/*
* direction bit is the sign bit of the timestamp. Ok until
* 2038??
*/
+ if(krb_debug) {
+ krb_warning("lsb_time: src = %s:%u\n",
+ inet_ntoa(src->sin_addr), ntohs(src->sin_port));
+ krb_warning("lsb_time: dst = %s:%u\n",
+ inet_ntoa(dst->sin_addr), ntohs(dst->sin_port));
+ }
+
/* For compatibility with broken old code, compares are done in VAX
byte order (LSBFIRST) */
if (krb_lsb_antinet_ulong_less(src->sin_addr.s_addr, /* src < recv */
dst->sin_addr.s_addr) < 0)
- t = -t;
+ dir = -1;
else if (krb_lsb_antinet_ulong_less(src->sin_addr.s_addr,
dst->sin_addr.s_addr)==0)
if (krb_lsb_antinet_ushort_less(src->sin_port, dst->sin_port) < 0)
- t = -t;
+ dir = -1;
/*
* all that for one tiny bit! Heaven help those that talk to
* themselves.
*/
+ if(krb_get_config_bool("reverse_lsb_test")) {
+ if(krb_debug)
+ krb_warning("lsb_time: reversing direction: %d -> %d\n", dir, -dir);
+ dir = -dir;
+ }else if((fw = krb_get_config_string("firewall_address"))) {
+ struct in_addr fw_addr;
+ fw_addr.s_addr = inet_addr(fw);
+ if(fw_addr.s_addr != INADDR_NONE) {
+ int s_lt_d, d_lt_f;
+ krb_warning("lsb_time: fw = %s\n", inet_ntoa(fw_addr));
+ /* negate if src < dst < fw || fw < dst < src */
+ s_lt_d = (krb_lsb_antinet_ulong_less(src->sin_addr.s_addr,
+ dst->sin_addr.s_addr) == -1);
+ d_lt_f = (krb_lsb_antinet_ulong_less(fw_addr.s_addr,
+ dst->sin_addr.s_addr) == 1);
+ if((s_lt_d ^ d_lt_f) == 0) {
+ if(krb_debug)
+ krb_warning("lsb_time: reversing direction: %d -> %d\n",
+ dir, -dir);
+ dir = -dir;
+ }
+ }
+ }
+ t = t * dir;
t = t & 0xffffffff;
return t;
}
diff --git a/crypto/kerberosIV/lib/krb/mk_auth.c b/crypto/kerberosIV/lib/krb/mk_auth.c
index 7cfb36b..91ea866 100644
--- a/crypto/kerberosIV/lib/krb/mk_auth.c
+++ b/crypto/kerberosIV/lib/krb/mk_auth.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: mk_auth.c,v 1.4 1997/04/01 08:18:35 joda Exp $");
+RCSID("$Id: mk_auth.c,v 1.6 1998/06/09 19:25:22 joda Exp $");
/*
* Generate an authenticator for service.instance@realm.
@@ -62,12 +62,14 @@ krb_mk_auth(int32_t options,
char realinst[INST_SZ];
char realrealm[REALM_SZ];
int ret;
- unsigned char *p;
+ char *tmp;
if (options & KOPT_DONT_CANON)
- strncpy(realinst, instance, sizeof(realinst));
+ tmp = instance;
else
- strncpy(realinst, krb_get_phost (instance), sizeof(realinst));
+ tmp = krb_get_phost (instance);
+
+ strcpy_truncate(realinst, tmp, sizeof(realinst));
if (realm == NULL) {
ret = krb_get_lrealm (realrealm, 1);
@@ -82,15 +84,35 @@ krb_mk_auth(int32_t options,
return ret;
}
- p = buf->dat;
+ {
+ int tmp;
+ size_t rem = sizeof(buf->dat);
+ unsigned char *p = buf->dat;
+
+ p = buf->dat;
+
+ if (rem < 2 * KRB_SENDAUTH_VLEN)
+ return KFAILURE;
+ memcpy (p, KRB_SENDAUTH_VERS, KRB_SENDAUTH_VLEN);
+ p += KRB_SENDAUTH_VLEN;
+ rem -= KRB_SENDAUTH_VLEN;
- memcpy (p, KRB_SENDAUTH_VERS, KRB_SENDAUTH_VLEN);
- p += KRB_SENDAUTH_VLEN;
- memcpy (p, version, KRB_SENDAUTH_VLEN);
- p += KRB_SENDAUTH_VLEN;
- p += krb_put_int(ticket->length, p, 4);
- memcpy(p, ticket->dat, ticket->length);
- p += ticket->length;
- buf->length = p - buf->dat;
+ memcpy (p, version, KRB_SENDAUTH_VLEN);
+ p += KRB_SENDAUTH_VLEN;
+ rem -= KRB_SENDAUTH_VLEN;
+
+ tmp = krb_put_int(ticket->length, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ if (rem < ticket->length)
+ return KFAILURE;
+ memcpy(p, ticket->dat, ticket->length);
+ p += ticket->length;
+ rem -= ticket->length;
+ buf->length = p - buf->dat;
+ }
return KSUCCESS;
}
diff --git a/crypto/kerberosIV/lib/krb/mk_err.c b/crypto/kerberosIV/lib/krb/mk_err.c
index 710587a..11fc059 100644
--- a/crypto/kerberosIV/lib/krb/mk_err.c
+++ b/crypto/kerberosIV/lib/krb/mk_err.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: mk_err.c,v 1.6 1997/03/23 03:53:14 joda Exp $");
+RCSID("$Id: mk_err.c,v 1.7 1998/06/09 19:25:22 joda Exp $");
/*
* This routine creates a general purpose error reply message. It
@@ -47,10 +47,11 @@ int32_t
krb_mk_err(u_char *p, int32_t e, char *e_string)
{
unsigned char *start = p;
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_APPL_ERR, p, 1);
- p += krb_put_int(e, p, 4);
- p += krb_put_string(e_string, p);
+ p += krb_put_int(KRB_PROT_VERSION, p, 1, 1);
+ p += krb_put_int(AUTH_MSG_APPL_ERR, p, 1, 1);
+
+ p += krb_put_int(e, p, 4, 4);
+ p += krb_put_string(e_string, p, strlen(e_string) + 1);
return p - start;
}
diff --git a/crypto/kerberosIV/lib/krb/mk_priv.c b/crypto/kerberosIV/lib/krb/mk_priv.c
index b6a9cc4..20f4ee2 100644
--- a/crypto/kerberosIV/lib/krb/mk_priv.c
+++ b/crypto/kerberosIV/lib/krb/mk_priv.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,10 +38,10 @@
#include "krb_locl.h"
-RCSID("$Id: mk_priv.c,v 1.18 1997/04/01 08:18:37 joda Exp $");
+RCSID("$Id: mk_priv.c,v 1.21 1998/06/09 19:25:23 joda Exp $");
/* application include files */
-#include "lsb_addr_comp.h"
+#include "krb-archaeology.h"
/*
* krb_mk_priv() constructs an AUTH_MSG_PRIVATE message. It takes
@@ -93,28 +93,28 @@ krb_mk_priv(void *in, void *out, u_int32_t length,
u_int32_t src_addr;
u_int32_t len;
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_PRIVATE, p, 1);
+ p += krb_put_int(KRB_PROT_VERSION, p, 1, 1);
+ p += krb_put_int(AUTH_MSG_PRIVATE, p, 1, 1);
len = 4 + length + 1 + 4 + 4;
len = (len + 7) & ~7;
- p += krb_put_int(len, p, 4);
+ p += krb_put_int(len, p, 4, 4);
cipher = p;
- p += krb_put_int(length, p, 4);
+ p += krb_put_int(length, p, 4, 4);
memcpy(p, in, length);
p += length;
- gettimeofday(&tv, NULL);
+ krb_kdctimeofday(&tv);
*p++ =tv.tv_usec / 5000;
src_addr = sender->sin_addr.s_addr;
- p += krb_put_address(src_addr, p);
+ p += krb_put_address(src_addr, p, 4);
- p += krb_put_int(lsb_time(tv.tv_sec, sender, receiver), p, 4);
+ p += krb_put_int(lsb_time(tv.tv_sec, sender, receiver), p, 4, 4);
memset(p, 0, 7);
diff --git a/crypto/kerberosIV/lib/krb/mk_req.c b/crypto/kerberosIV/lib/krb/mk_req.c
index 313ea04..b3761ca 100644
--- a/crypto/kerberosIV/lib/krb/mk_req.c
+++ b/crypto/kerberosIV/lib/krb/mk_req.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,32 +38,50 @@
#include "krb_locl.h"
-RCSID("$Id: mk_req.c,v 1.17 1997/05/30 17:42:38 bg Exp $");
+RCSID("$Id: mk_req.c,v 1.20 1998/06/09 19:25:23 joda Exp $");
static int lifetime = 255; /* But no longer than TGT says. */
-static void
+static int
build_request(KTEXT req, char *name, char *inst, char *realm,
u_int32_t checksum)
{
struct timeval tv;
unsigned char *p = req->dat;
-
- p += krb_put_nir(name, inst, realm, p);
-
- p += krb_put_int(checksum, p, 4);
+ int tmp;
+ size_t rem = sizeof(req->dat);
+
+ tmp = krb_put_nir(name, inst, realm, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+ tmp = krb_put_int(checksum, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
/* Fill in the times on the request id */
- gettimeofday(&tv, NULL);
+ krb_kdctimeofday(&tv);
+
+ if (rem < 1)
+ return KFAILURE;
*p++ = tv.tv_usec / 5000; /* 5ms */
+ --rem;
- p += krb_put_int(tv.tv_sec, p, 4);
+ tmp = krb_put_int(tv.tv_sec, p, rem, 4);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
/* Fill to a multiple of 8 bytes for DES */
req->length = ((p - req->dat + 7)/8) * 8;
+ return 0;
}
@@ -125,11 +143,21 @@ krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
char myrealm[REALM_SZ];
unsigned char *p = authent->dat;
+ int rem = sizeof(authent->dat);
+ int tmp;
+
+ tmp = krb_put_int(KRB_PROT_VERSION, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(AUTH_MSG_APPL_REQUEST, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
-
- p += krb_put_int(AUTH_MSG_APPL_REQUEST, p, 1);
-
/* Get the ticket and move it into the authenticator */
if (krb_ap_req_debug)
krb_warning("Realm: %s\n", realm);
@@ -155,9 +183,9 @@ krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
*/
retval = krb_get_cred(KRB_TICKET_GRANTING_TICKET, realm, realm, 0);
- if (retval == KSUCCESS)
- strncpy(myrealm, realm, REALM_SZ);
- else
+ if (retval == KSUCCESS) {
+ strcpy_truncate(myrealm, realm, REALM_SZ);
+ } else
retval = krb_get_tf_realm(TKT_FILE, myrealm);
if (retval != KSUCCESS)
@@ -167,25 +195,45 @@ krb_mk_req(KTEXT authent, char *service, char *instance, char *realm,
krb_warning("serv=%s.%s@%s princ=%s.%s@%s\n", service, instance, realm,
cr.pname, cr.pinst, myrealm);
- p += krb_put_int(cr.kvno, p, 1);
-
- p += krb_put_string(realm, p);
-
- p += krb_put_int(ticket->length, p, 1);
-
- build_request(req_id, cr.pname, cr.pinst, myrealm, checksum);
+ tmp = krb_put_int(cr.kvno, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_string(realm, p, rem);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_int(ticket->length, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ retval = build_request(req_id, cr.pname, cr.pinst, myrealm, checksum);
+ if (retval != KSUCCESS)
+ return retval;
encrypt_ktext(req_id, &cr.session, DES_ENCRYPT);
- p += krb_put_int(req_id->length, p, 1);
+ tmp = krb_put_int(req_id->length, p, rem, 1);
+ if (tmp < 0)
+ return KFAILURE;
+ p += tmp;
+ rem -= tmp;
+
+ if (rem < ticket->length + req_id->length)
+ return KFAILURE;
memcpy(p, ticket->dat, ticket->length);
-
p += ticket->length;
-
+ rem -= ticket->length;
memcpy(p, req_id->dat, req_id->length);
-
p += req_id->length;
+ rem -= req_id->length;
authent->length = p - authent->dat;
diff --git a/crypto/kerberosIV/lib/krb/mk_safe.c b/crypto/kerberosIV/lib/krb/mk_safe.c
index df5ca21..e5ea847 100644
--- a/crypto/kerberosIV/lib/krb/mk_safe.c
+++ b/crypto/kerberosIV/lib/krb/mk_safe.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,10 +38,10 @@
#include "krb_locl.h"
-RCSID("$Id: mk_safe.c,v 1.21 1997/04/19 23:18:03 joda Exp $");
+RCSID("$Id: mk_safe.c,v 1.24 1998/06/09 19:25:23 joda Exp $");
/* application include files */
-#include "lsb_addr_comp.h"
+#include "krb-archaeology.h"
/* from rd_safe.c */
@@ -89,24 +89,24 @@ krb_mk_safe(void *in, void *out, u_int32_t length, des_cblock *key,
unsigned char *start;
u_int32_t src_addr;
- p += krb_put_int(KRB_PROT_VERSION, p, 1);
- p += krb_put_int(AUTH_MSG_SAFE, p, 1);
+ p += krb_put_int(KRB_PROT_VERSION, p, 1, 1);
+ p += krb_put_int(AUTH_MSG_SAFE, p, 1, 1);
start = p;
- p += krb_put_int(length, p, 4);
+ p += krb_put_int(length, p, 4, 4);
memcpy(p, in, length);
p += length;
- gettimeofday(&tv, NULL);
+ krb_kdctimeofday(&tv);
*p++ = tv.tv_usec/5000; /* 5ms */
src_addr = sender->sin_addr.s_addr;
- p += krb_put_address(src_addr, p);
+ p += krb_put_address(src_addr, p, 4);
- p += krb_put_int(lsb_time(tv.tv_sec, sender, receiver), p, 4);
+ p += krb_put_int(lsb_time(tv.tv_sec, sender, receiver), p, 4, 4);
{
/* We are faking big endian mode, so we need to fix the
diff --git a/crypto/kerberosIV/lib/krb/name2name.c b/crypto/kerberosIV/lib/krb/name2name.c
index fa95b89..2e2e9e6 100644
--- a/crypto/kerberosIV/lib/krb/name2name.c
+++ b/crypto/kerberosIV/lib/krb/name2name.c
@@ -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.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: name2name.c,v 1.15 1997/04/30 04:30:36 assar Exp $");
+RCSID("$Id: name2name.c,v 1.20 1999/03/13 21:26:02 assar Exp $");
/* convert host to a more fully qualified domain name, returns 0 if
* phost is the same as host, 1 otherwise. phost should be
@@ -53,15 +53,25 @@ krb_name_to_name(const char *host, char *phost, size_t phost_size)
const char *tmp;
adr.s_addr = inet_addr(host);
- hp = gethostbyname(host);
- if (hp == NULL && adr.s_addr != INADDR_NONE)
+ if (adr.s_addr != INADDR_NONE)
hp = gethostbyaddr((char *)&adr, sizeof(adr), AF_INET);
+ else
+ hp = gethostbyname(host);
if (hp == NULL)
tmp = host;
- else
+ else {
tmp = hp->h_name;
- strncpy (phost, tmp, phost_size);
- phost[phost_size - 1] = '\0';
+ /*
+ * Broken SunOS 5.4 sometimes keeps the official name as the
+ * 1:st alias.
+ */
+ if (strchr(tmp, '.') == NULL
+ && hp->h_aliases != NULL
+ && hp->h_aliases[0] != NULL
+ && strchr (hp->h_aliases[0], '.') != NULL)
+ tmp = hp->h_aliases[0];
+ }
+ strcpy_truncate (phost, tmp, phost_size);
if (strcmp(phost, host) == 0)
return 0;
@@ -74,7 +84,8 @@ krb_name_to_name(const char *host, char *phost, size_t phost_size)
void
k_ricercar(char *name)
{
- char *p = name;
+ unsigned char *p = (unsigned char *)name;
+
while(*p && *p != '.'){
if(isupper(*p))
*p = tolower(*p);
@@ -94,7 +105,7 @@ k_ricercar(char *name)
char *
krb_get_phost(const char *alias)
{
- static char phost[MaxHostNameLen+1];
+ static char phost[MaxHostNameLen];
krb_name_to_name(alias, phost, sizeof(phost));
k_ricercar(phost);
diff --git a/crypto/kerberosIV/lib/krb/parse_name.c b/crypto/kerberosIV/lib/krb/parse_name.c
index 1184330..da06aec 100644
--- a/crypto/kerberosIV/lib/krb/parse_name.c
+++ b/crypto/kerberosIV/lib/krb/parse_name.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: parse_name.c,v 1.4 1997/04/01 08:18:39 joda Exp $");
+RCSID("$Id: parse_name.c,v 1.5 1998/06/09 19:25:24 joda Exp $");
int
krb_parse_name(const char *fullname, krb_principal *principal)
@@ -86,10 +86,10 @@ kname_parse(char *np, char *ip, char *rp, char *fullname)
krb_principal p;
int ret;
if((ret = krb_parse_name(fullname, &p)) == 0){
- strcpy(np, p.name);
- strcpy(ip, p.instance);
+ strcpy_truncate (np, p.name, ANAME_SZ);
+ strcpy_truncate (ip, p.instance, INST_SZ);
if(p.realm[0])
- strcpy(rp, p.realm);
+ strcpy_truncate (rp, p.realm, REALM_SZ);
}
return ret;
}
diff --git a/crypto/kerberosIV/lib/krb/prot.h b/crypto/kerberosIV/lib/krb/prot.h
index e4825e1..b9a4ea3 100644
--- a/crypto/kerberosIV/lib/krb/prot.h
+++ b/crypto/kerberosIV/lib/krb/prot.h
@@ -1,5 +1,5 @@
/*
- * $Id: prot.h,v 1.7 1997/03/23 03:52:27 joda Exp $
+ * $Id: prot.h,v 1.8 1997/12/05 00:18:02 joda Exp $
*
* Copyright 1985, 1986, 1987, 1988 by the Massachusetts Institute
* of Technology.
@@ -20,41 +20,6 @@
#define MAX_PKT_LEN 1000
#define MAX_TXT_LEN 1000
-/* Macro's to obtain various fields from a packet */
-
-#define pkt_version(packet) (unsigned int) *(packet->dat)
-#define pkt_msg_type(packet) (unsigned int) *(packet->dat+1)
-#define pkt_a_name(packet) (packet->dat+2)
-#define pkt_a_inst(packet) \
- (packet->dat+3+strlen((char *)pkt_a_name(packet)))
-#define pkt_a_realm(packet) \
- (pkt_a_inst(packet)+1+strlen((char *)pkt_a_inst(packet)))
-
-/* Macro to obtain realm from application request */
-#define apreq_realm(auth) (auth->dat + 3)
-
-#define pkt_time_ws(packet) (char *) \
- (packet->dat+5+strlen((char *)pkt_a_name(packet)) + \
- strlen((char *)pkt_a_inst(packet)) + \
- strlen((char *)pkt_a_realm(packet)))
-
-#define pkt_no_req(packet) (unsigned short) \
- *(packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
- strlen((char *)pkt_a_inst(packet)) + \
- strlen((char *)pkt_a_realm(packet)))
-#define pkt_x_date(packet) (char *) \
- (packet->dat+10+strlen((char *)pkt_a_name(packet)) + \
- strlen((char *)pkt_a_inst(packet)) + \
- strlen((char *)pkt_a_realm(packet)))
-#define pkt_err_code(packet) ( (char *) \
- (packet->dat+9+strlen((char *)pkt_a_name(packet)) + \
- strlen((char *)pkt_a_inst(packet)) + \
- strlen((char *)pkt_a_realm(packet))))
-#define pkt_err_text(packet) \
- (packet->dat+13+strlen((char *)pkt_a_name(packet)) + \
- strlen((char *)pkt_a_inst(packet)) + \
- strlen((char *)pkt_a_realm(packet)))
-
/* Routines to create and read packets may be found in prot.c */
KTEXT create_auth_reply(char *pname, char *pinst, char *prealm,
@@ -66,17 +31,17 @@ KTEXT krb_create_death_packet(char *a_name);
/* Message types , always leave lsb for byte order */
-#define AUTH_MSG_KDC_REQUEST 1<<1
-#define AUTH_MSG_KDC_REPLY 2<<1
-#define AUTH_MSG_APPL_REQUEST 3<<1
-#define AUTH_MSG_APPL_REQUEST_MUTUAL 4<<1
-#define AUTH_MSG_ERR_REPLY 5<<1
-#define AUTH_MSG_PRIVATE 6<<1
-#define AUTH_MSG_SAFE 7<<1
-#define AUTH_MSG_APPL_ERR 8<<1
-#define AUTH_MSG_KDC_FORWARD 9<<1
-#define AUTH_MSG_KDC_RENEW 10<<1
-#define AUTH_MSG_DIE 63<<1
+#define AUTH_MSG_KDC_REQUEST (1<<1)
+#define AUTH_MSG_KDC_REPLY (2<<1)
+#define AUTH_MSG_APPL_REQUEST (3<<1)
+#define AUTH_MSG_APPL_REQUEST_MUTUAL (4<<1)
+#define AUTH_MSG_ERR_REPLY (5<<1)
+#define AUTH_MSG_PRIVATE (6<<1)
+#define AUTH_MSG_SAFE (7<<1)
+#define AUTH_MSG_APPL_ERR (8<<1)
+#define AUTH_MSG_KDC_FORWARD (9<<1)
+#define AUTH_MSG_KDC_RENEW (10<<1)
+#define AUTH_MSG_DIE (63<<1)
/* values for kerb error codes */
diff --git a/crypto/kerberosIV/lib/krb/rd_priv.c b/crypto/kerberosIV/lib/krb/rd_priv.c
index 58ecd9f..0721b2c 100644
--- a/crypto/kerberosIV/lib/krb/rd_priv.c
+++ b/crypto/kerberosIV/lib/krb/rd_priv.c
@@ -38,10 +38,10 @@
#include "krb_locl.h"
-RCSID("$Id: rd_priv.c,v 1.24 1997/05/14 17:53:29 joda Exp $");
+RCSID("$Id: rd_priv.c,v 1.26 1998/05/26 19:57:42 joda Exp $");
/* application include files */
-#include "lsb_addr_comp.h"
+#include "krb-archaeology.h"
/*
* krb_rd_priv() decrypts and checks the integrity of an
@@ -116,7 +116,7 @@ krb_rd_priv(void *in, u_int32_t in_length,
if (delta_t > CLOCK_SKEW)
return RD_AP_TIME;
if (krb_debug)
- krb_warning("\ndelta_t = %d", (int) delta_t);
+ krb_warning("delta_t = %d\n", (int) delta_t);
/*
* caller must check timestamps for proper order and
diff --git a/crypto/kerberosIV/lib/krb/rd_req.c b/crypto/kerberosIV/lib/krb/rd_req.c
index 1a3e848..e145dae 100644
--- a/crypto/kerberosIV/lib/krb/rd_req.c
+++ b/crypto/kerberosIV/lib/krb/rd_req.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: rd_req.c,v 1.24 1997/05/11 11:05:28 assar Exp $");
+RCSID("$Id: rd_req.c,v 1.25 1998/06/09 19:25:25 joda Exp $");
static struct timeval t_local = { 0, 0 };
@@ -198,7 +198,7 @@ krb_rd_req(KTEXT authent, /* The received message */
s_kvno = *p++;
- p += krb_get_string(p, realm);
+ p += krb_get_string(p, realm, sizeof(realm));
/*
* If "fn" is NULL, key info should already be set; don't
@@ -217,9 +217,9 @@ krb_rd_req(KTEXT authent, /* The received message */
return(RD_AP_UNDEC);
if ((status = krb_set_key((char*)skey, 0)))
return(status);
- strcpy(st_rlm, realm);
- strcpy(st_nam, service);
- strcpy(st_inst, instance);
+ strcpy_truncate (st_rlm, realm, REALM_SZ);
+ strcpy_truncate (st_nam, service, SNAME_SZ);
+ strcpy_truncate (st_inst, instance, INST_SZ);
}
tkt->length = *p++;
diff --git a/crypto/kerberosIV/lib/krb/rd_safe.c b/crypto/kerberosIV/lib/krb/rd_safe.c
index 8471df0..495a681 100644
--- a/crypto/kerberosIV/lib/krb/rd_safe.c
+++ b/crypto/kerberosIV/lib/krb/rd_safe.c
@@ -38,10 +38,10 @@
#include "krb_locl.h"
-RCSID("$Id: rd_safe.c,v 1.24 1997/04/19 23:18:20 joda Exp $");
+RCSID("$Id: rd_safe.c,v 1.25 1997/12/05 00:17:09 joda Exp $");
/* application include files */
-#include "lsb_addr_comp.h"
+#include "krb-archaeology.h"
/* Generate two checksums in the given byteorder of the data, one
* new-form and one old-form. It has to be done this way to be
diff --git a/crypto/kerberosIV/lib/krb/read_service_key.c b/crypto/kerberosIV/lib/krb/read_service_key.c
index 6de5db2..d517551 100644
--- a/crypto/kerberosIV/lib/krb/read_service_key.c
+++ b/crypto/kerberosIV/lib/krb/read_service_key.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: read_service_key.c,v 1.8 1997/03/23 03:53:16 joda Exp $");
+RCSID("$Id: read_service_key.c,v 1.11 1999/03/10 18:34:34 joda Exp $");
/*
* The private keys for servers on a given host are stored in a
@@ -57,12 +57,12 @@ RCSID("$Id: read_service_key.c,v 1.8 1997/03/23 03:53:16 joda Exp $");
int
-read_service_key(char *service, /* Service Name */
+read_service_key(const char *service, /* Service Name */
char *instance, /* Instance name or "*" */
- char *realm, /* Realm */
+ const char *realm, /* Realm */
int kvno, /* Key version number */
- char *file, /* Filename */
- char *key) /* Pointer to key to be filled in */
+ const char *file, /* Filename */
+ void *key) /* Pointer to key to be filled in */
{
char serv[SNAME_SZ];
char inst[INST_SZ];
@@ -96,8 +96,9 @@ read_service_key(char *service, /* Service Name */
/* How about instance */
if (!wcard && strcmp(inst,instance))
continue;
- if (wcard)
- strncpy(instance,inst,INST_SZ);
+ if (wcard) {
+ strcpy_truncate (instance, inst, INST_SZ);
+ }
/* Is this the right realm */
if (strcmp(rlm,realm))
continue;
diff --git a/crypto/kerberosIV/lib/krb/realm_parse.c b/crypto/kerberosIV/lib/krb/realm_parse.c
index 2ce852a..8d90f1b 100644
--- a/crypto/kerberosIV/lib/krb/realm_parse.c
+++ b/crypto/kerberosIV/lib/krb/realm_parse.c
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: realm_parse.c,v 1.10 1997/06/01 03:14:50 assar Exp $");
+RCSID("$Id: realm_parse.c,v 1.15 1998/06/09 19:25:25 joda Exp $");
static int
realm_parse(char *realm, int length, const char *file)
@@ -55,7 +55,7 @@ realm_parse(char *realm, int length, const char *file)
p = strtok_r(tr, " \t\n\r", &unused);
if(p && strcasecmp(p, realm) == 0){
fclose(F);
- strncpy(realm, p, length);
+ strcpy_truncate (realm, p, length);
return 0;
}
}
@@ -63,26 +63,14 @@ realm_parse(char *realm, int length, const char *file)
return -1;
}
-static const char *const files[] = KRB_CNF_FILES;
-
int
krb_realm_parse(char *realm, int length)
{
int i;
-
- const char *dir = getenv("KRBCONFDIR");
-
- /* First try user specified file */
- if (dir != 0) {
- char fname[MaxPathLen];
-
- if(k_concat(fname, sizeof(fname), dir, "/krb.conf", NULL) == 0)
- if (realm_parse(realm, length, fname) == 0)
- return 0;
- }
+ char file[MaxPathLen];
- for (i = 0; files[i] != NULL; i++)
- if (realm_parse(realm, length, files[i]) == 0)
+ for(i = 0; krb_get_krbconf(i, file, sizeof(file)) == 0; i++)
+ if (realm_parse(realm, length, file) == 0)
return 0;
return -1;
}
diff --git a/crypto/kerberosIV/lib/krb/recvauth.c b/crypto/kerberosIV/lib/krb/recvauth.c
index 6c96897..f164b2b 100644
--- a/crypto/kerberosIV/lib/krb/recvauth.c
+++ b/crypto/kerberosIV/lib/krb/recvauth.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: recvauth.c,v 1.17 1997/03/23 03:53:16 joda Exp $");
+RCSID("$Id: recvauth.c,v 1.19 1998/06/09 19:25:25 joda Exp $");
/*
* krb_recvauth() reads (and optionally responds to) a message sent
@@ -117,10 +117,12 @@ krb_recvauth(int32_t options, /* bit-pattern of options */
int32_t priv_len;
u_char tmp_buf[MAX_KTXT_LEN+max(KRB_SENDAUTH_VLEN+1,21)];
- /* read the protocol version number */
- if (krb_net_read(fd, krb_vers, KRB_SENDAUTH_VLEN) != KRB_SENDAUTH_VLEN)
- return(errno);
- krb_vers[KRB_SENDAUTH_VLEN] = '\0';
+ if (!(options & KOPT_IGNORE_PROTOCOL)) {
+ /* read the protocol version number */
+ if (krb_net_read(fd, krb_vers, KRB_SENDAUTH_VLEN) != KRB_SENDAUTH_VLEN)
+ return(errno);
+ krb_vers[KRB_SENDAUTH_VLEN] = '\0';
+ }
/* read the application version string */
if (krb_net_read(fd, version, KRB_SENDAUTH_VLEN) != KRB_SENDAUTH_VLEN)
@@ -168,7 +170,7 @@ krb_recvauth(int32_t options, /* bit-pattern of options */
for return to the client */
{
unsigned char cs[4];
- krb_put_int(kdata->checksum + 1, cs, 4);
+ krb_put_int(kdata->checksum + 1, cs, sizeof(cs), 4);
#ifndef NOENCRYPTION
des_key_sched(&kdata->session,schedule);
#endif
@@ -181,7 +183,7 @@ krb_recvauth(int32_t options, /* bit-pattern of options */
faddr);
}
/* mk_priv will never fail */
- priv_len += krb_put_int(priv_len, tmp_buf, 4);
+ priv_len += krb_put_int(priv_len, tmp_buf, 4, 4);
if((cc = krb_net_write(fd, tmp_buf, priv_len)) != priv_len)
return -1;
diff --git a/crypto/kerberosIV/lib/krb/resource.h b/crypto/kerberosIV/lib/krb/resource.h
new file mode 100644
index 0000000..d50551f
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by krb.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/crypto/kerberosIV/lib/krb/roken_rename.h b/crypto/kerberosIV/lib/krb/roken_rename.h
new file mode 100644
index 0000000..831da32
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/roken_rename.h
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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_rename.h,v 1.7 1998/10/13 16:50:23 joda Exp $ */
+
+#ifndef __roken_rename_h__
+#define __roken_rename_h__
+
+/*
+ * Libroken routines that are added libkrb
+ */
+
+#define base64_decode _krb_base64_decode
+#define base64_encode _krb_base64_encode
+
+#define net_write roken_net_write
+#define net_read roken_net_read
+
+#ifndef HAVE_FLOCK
+#define flock _krb_flock
+#endif
+#ifndef HAVE_GETHOSTNAME
+#define gethostname _krb_gethostname
+#endif
+#ifndef HAVE_GETTIMEOFDAY
+#define gettimeofday _krb_gettimeofday
+#endif
+#ifndef HAVE_GETUID
+#define getuid _krb_getuid
+#endif
+#ifndef HAVE_SNPRINTF
+#define snprintf _krb_snprintf
+#endif
+#ifndef HAVE_ASPRINTF
+#define asprintf _krb_asprintf
+#endif
+#ifndef HAVE_ASNPRINTF
+#define asnprintf _krb_asnprintf
+#endif
+#ifndef HAVE_VASPRINTF
+#define vasprintf _krb_vasprintf
+#endif
+#ifndef HAVE_VASNPRINTF
+#define vasnprintf _krb_vasnprintf
+#endif
+#ifndef HAVE_VSNPRINTF
+#define vsnprintf _krb_vsnprintf
+#endif
+#ifndef HAVE_STRCASECMP
+#define strcasecmp _krb_strcasecmp
+#endif
+#ifndef HAVE_STRNCASECMP
+#define strncasecmp _krb_strncasecmp
+#endif
+#ifndef HAVE_STRDUP
+#define strdup _krb_strdup
+#endif
+#ifndef HAVE_STRNLEN
+#define strnlen _krb_strnlen
+#endif
+#ifndef HAVE_SWAB
+#define swab _krb_swab
+#endif
+#ifndef HAVE_STRTOK_R
+#define strtok_r _krb_strtok_r
+#endif
+
+#endif /* __roken_rename_h__ */
diff --git a/crypto/kerberosIV/lib/krb/rw.c b/crypto/kerberosIV/lib/krb/rw.c
index 4b136aa..559e3fa 100644
--- a/crypto/kerberosIV/lib/krb/rw.c
+++ b/crypto/kerberosIV/lib/krb/rw.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -43,7 +43,7 @@
#include "krb_locl.h"
-RCSID("$Id: rw.c,v 1.8 1997/04/01 08:18:44 joda Exp $");
+RCSID("$Id: rw.c,v 1.10 1999/06/29 21:18:08 bg Exp $");
int
krb_get_int(void *f, u_int32_t *to, int size, int lsb)
@@ -63,10 +63,14 @@ krb_get_int(void *f, u_int32_t *to, int size, int lsb)
}
int
-krb_put_int(u_int32_t from, void *to, int size)
+krb_put_int(u_int32_t from, void *to, size_t rem, int size)
{
int i;
unsigned char *p = (unsigned char *)to;
+
+ if (rem < size)
+ return -1;
+
for(i = size - 1; i >= 0; i--){
p[i] = from & 0xff;
from >>= 8;
@@ -86,22 +90,27 @@ krb_get_address(void *from, u_int32_t *to)
}
int
-krb_put_address(u_int32_t addr, void *to)
+krb_put_address(u_int32_t addr, void *to, size_t rem)
{
- return krb_put_int(ntohl(addr), to, 4);
+ return krb_put_int(ntohl(addr), to, rem, 4);
}
int
-krb_put_string(char *from, void *to)
+krb_put_string(const char *from, void *to, size_t rem)
{
- strcpy((char *)to, from);
- return strlen(from) + 1;
+ size_t len = strlen(from) + 1;
+
+ if (rem < len)
+ return -1;
+ memcpy(to, from, len);
+ return len;
}
int
-krb_get_string(void *from, char *to)
+krb_get_string(void *from, char *to, size_t to_size)
{
- return krb_put_string(from, to);
+ strcpy_truncate (to, (char *)from, to_size);
+ return strlen((char *)from) + 1;
}
int
@@ -109,20 +118,41 @@ krb_get_nir(void *from, char *name, char *instance, char *realm)
{
char *p = (char *)from;
- p += krb_get_string(p, name);
- p += krb_get_string(p, instance);
+ p += krb_get_string(p, name, ANAME_SZ);
+ p += krb_get_string(p, instance, INST_SZ);
if(realm)
- p += krb_get_string(p, realm);
+ p += krb_get_string(p, realm, REALM_SZ);
return p - (char *)from;
}
int
-krb_put_nir(char *name, char *instance, char *realm, void *to)
+krb_put_nir(const char *name,
+ const char *instance,
+ const char *realm,
+ void *to,
+ size_t rem)
{
char *p = (char *)to;
- p += krb_put_string(name, p);
- p += krb_put_string(instance, p);
- if(realm)
- p += krb_put_string(realm, p);
+ int tmp;
+
+ tmp = krb_put_string(name, p, rem);
+ if (tmp < 0)
+ return tmp;
+ p += tmp;
+ rem -= tmp;
+
+ tmp = krb_put_string(instance, p, rem);
+ if (tmp < 0)
+ return tmp;
+ p += tmp;
+ rem -= tmp;
+
+ if (realm) {
+ tmp = krb_put_string(realm, p, rem);
+ if (tmp < 0)
+ return tmp;
+ p += tmp;
+ rem -= tmp;
+ }
return p - (char *)to;
}
diff --git a/crypto/kerberosIV/lib/krb/send_to_kdc.c b/crypto/kerberosIV/lib/krb/send_to_kdc.c
index 828b34d..04409be 100644
--- a/crypto/kerberosIV/lib/krb/send_to_kdc.c
+++ b/crypto/kerberosIV/lib/krb/send_to_kdc.c
@@ -20,23 +20,17 @@ or implied warranty.
*/
#include "krb_locl.h"
+#include <base64.h>
-RCSID("$Id: send_to_kdc.c,v 1.39 1997/05/15 21:02:31 joda Exp $");
+RCSID("$Id: send_to_kdc.c,v 1.69 1999/06/29 21:18:09 bg Exp $");
struct host {
- struct sockaddr_in addr;
- int proto;
+ struct sockaddr_in addr;
+ enum krb_host_proto proto;
};
-static const char *prog = "send_to_kdc";
-static send_recv(KTEXT pkt, KTEXT rpkt, int f,
- struct sockaddr_in *_to, struct host *addrs,
- int h_hosts);
-
-/*
- * This file contains two routines, send_to_kdc() and send_recv().
- * send_recv() is a static routine used by send_to_kdc().
- */
+static int send_recv(KTEXT pkt, KTEXT rpkt, int f,
+ struct sockaddr_in *adr);
/*
* send_to_kdc() sends a message to the Kerberos authentication
@@ -65,8 +59,21 @@ static send_recv(KTEXT pkt, KTEXT rpkt, int f,
* after several retries
*/
+/* always use the admin server */
+static int krb_use_admin_server_flag = 0;
+
+static int client_timeout = -1;
+
int
-send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
+krb_use_admin_server(int flag)
+{
+ int old = krb_use_admin_server_flag;
+ krb_use_admin_server_flag = flag;
+ return old;
+}
+
+int
+send_to_kdc(KTEXT pkt, KTEXT rpkt, const char *realm)
{
int i;
int no_host; /* was a kerberos host found? */
@@ -78,53 +85,87 @@ send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
struct krb_host *k_host;
struct host *hosts = malloc(sizeof(*hosts));
+ if (client_timeout == -1) {
+ const char *to;
+
+ client_timeout = CLIENT_KRB_TIMEOUT;
+ to = krb_get_config_string ("kdc_timeout");
+ if (to != NULL) {
+ int tmp;
+ char *end;
+
+ tmp = strtol (to, &end, 0);
+ if (end != to)
+ client_timeout = tmp;
+ }
+ }
+
if (hosts == NULL)
- return SKDC_CANT;
+ return SKDC_CANT;
/*
* If "realm" is non-null, use that, otherwise get the
* local realm.
*/
if (realm)
- strcpy(lrealm, realm);
+ strcpy_truncate(lrealm, realm, REALM_SZ);
else
if (krb_get_lrealm(lrealm,1)) {
if (krb_debug)
- krb_warning("%s: can't get local realm\n", prog);
+ krb_warning("send_to_kdc: can't get local realm\n");
return(SKDC_CANT);
}
if (krb_debug)
- krb_warning("lrealm is %s\n", lrealm);
+ krb_warning("lrealm is %s\n", lrealm);
no_host = 1;
/* get an initial allocation */
n_hosts = 0;
- for (i = 1; (k_host = krb_get_host(i, lrealm, 0)); ++i) {
+ for (i = 1;
+ (k_host = krb_get_host(i, lrealm, krb_use_admin_server_flag));
+ ++i) {
char *p;
+ char **addr_list;
+ int j;
+ int n_addrs;
+ struct host *tmp;
if (krb_debug)
- krb_warning("Getting host entry for %s...", k_host->host);
+ krb_warning("Getting host entry for %s...", k_host->host);
host = gethostbyname(k_host->host);
if (krb_debug) {
- krb_warning("%s.\n",
- host ? "Got it" : "Didn't get it");
+ krb_warning("%s.\n",
+ host ? "Got it" : "Didn't get it");
}
- if (!host)
+ if (host == NULL)
continue;
no_host = 0; /* found at least one */
- while ((p = *(host->h_addr_list)++)) {
- hosts = realloc(hosts, sizeof(*hosts) * (n_hosts + 1));
- if (hosts == NULL)
- return SKDC_CANT;
- memset (&hosts[n_hosts].addr, 0, sizeof(hosts[n_hosts].addr));
- hosts[n_hosts].addr.sin_family = host->h_addrtype;
- hosts[n_hosts].addr.sin_port = htons(k_host->port);
- hosts[n_hosts].proto = k_host->proto;
- memcpy(&hosts[n_hosts].addr.sin_addr, p,
- sizeof(hosts[n_hosts].addr.sin_addr));
- ++n_hosts;
- if (send_recv(pkt, rpkt, hosts[n_hosts-1].proto,
- &hosts[n_hosts-1].addr, hosts, n_hosts)) {
+
+ n_addrs = 0;
+ for (addr_list = host->h_addr_list; *addr_list != NULL; ++addr_list)
+ ++n_addrs;
+
+ tmp = realloc (hosts, (n_hosts + n_addrs) * sizeof(*hosts));
+ if (tmp == NULL) {
+ free (hosts);
+ return SKDC_CANT;
+ }
+ hosts = tmp;
+
+ for (addr_list = host->h_addr_list, j = 0;
+ (p = *addr_list) != NULL;
+ ++addr_list, ++j) {
+ memset (&hosts[n_hosts + j].addr, 0, sizeof(struct sockaddr_in));
+ hosts[n_hosts + j].addr.sin_family = host->h_addrtype;
+ hosts[n_hosts + j].addr.sin_port = htons(k_host->port);
+ hosts[n_hosts + j].proto = k_host->proto;
+ memcpy(&hosts[n_hosts + j].addr.sin_addr, p,
+ sizeof(struct in_addr));
+ }
+
+ for (j = 0; j < n_addrs; ++j) {
+ if (send_recv(pkt, rpkt, hosts[n_hosts + j].proto,
+ &hosts[n_hosts + j].addr)) {
retval = KSUCCESS;
goto rtn;
}
@@ -132,11 +173,11 @@ send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
krb_warning("Timeout, error, or wrong descriptor\n");
}
}
+ n_hosts += j;
}
if (no_host) {
if (krb_debug)
- krb_warning("%s: can't find any Kerberos host.\n",
- prog);
+ krb_warning("send_to_kdc: can't find any Kerberos host.\n");
retval = SKDC_CANT;
goto rtn;
}
@@ -145,9 +186,7 @@ send_to_kdc(KTEXT pkt, KTEXT rpkt, char *realm)
for (i = 0; i < n_hosts; ++i) {
if (send_recv(pkt, rpkt,
hosts[i].proto,
- &hosts[i].addr,
- hosts,
- n_hosts)) {
+ &hosts[i].addr)) {
retval = KSUCCESS;
goto rtn;
}
@@ -159,93 +198,297 @@ rtn:
return(retval);
}
-/*
- * try to send out and receive message.
- * return 1 on success, 0 on failure
- */
+static int
+udp_socket(void)
+{
+ return socket(AF_INET, SOCK_DGRAM, 0);
+}
static int
-send_recv_it(KTEXT pkt, KTEXT rpkt, int stream, int f,
- struct sockaddr_in *_to, struct host *addrs, int n_hosts)
+udp_connect(int s, struct sockaddr_in *adr)
{
- fd_set readfds;
- int numsent;
-
- /* CLIENT_KRB_TIMEOUT indicates the time to wait before
- * retrying a server. It's defined in "krb.h".
- */
- struct timeval timeout;
- timeout.tv_sec = CLIENT_KRB_TIMEOUT;
- timeout.tv_usec = 0;
-
- if (krb_debug) {
- if (_to->sin_family == AF_INET)
- krb_warning("Sending message to %s...",
- inet_ntoa(_to->sin_addr));
- else
- krb_warning("Sending message...");
- }
- if(stream){
- unsigned char tmp[4];
- krb_put_int(pkt->length, tmp, 4);
- if((numsent = send(f, tmp, 4, 0)) != 4){
- if (krb_debug)
- krb_warning("sent only %d/%d\n", numsent, 4);
- return 0;
- }
+ if(krb_debug) {
+ krb_warning("connecting to %s udp, port %d\n",
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
}
- if ((numsent = send(f, pkt->dat, pkt->length, 0)) != pkt->length) {
- if (krb_debug)
- krb_warning("sent only %d/%d\n",numsent, pkt->length);
- return 0;
+ return connect(s, (struct sockaddr*)adr, sizeof(*adr));
+}
+
+static int
+udp_send(int s, struct sockaddr_in* adr, KTEXT pkt)
+{
+ if(krb_debug) {
+ krb_warning("sending %d bytes to %s, udp port %d\n",
+ pkt->length,
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
}
- if (krb_debug)
- krb_warning("Sent\nWaiting for reply...");
- FD_ZERO(&readfds);
- FD_SET(f, &readfds);
- /* select - either recv is ready, or timeout */
- /* see if timeout or error or wrong descriptor */
- if (select(f + 1, &readfds, 0, 0, &timeout) < 1
- || !FD_ISSET(f, &readfds)) {
- if (krb_debug)
- krb_warning("select failed: errno = %d", errno);
- return 0;
- }
- if(stream){
- if(krb_net_read(f, rpkt->dat, sizeof(rpkt->dat)) <= 0)
- return 0;
- }else{
- if (recv (f, rpkt->dat, sizeof(rpkt->dat), 0) < 0) {
- if (krb_debug)
- krb_warning("recvfrom: errno = %d\n", errno);
- return 0;
+ return send(s, pkt->dat, pkt->length, 0);
+}
+
+static int
+tcp_socket(void)
+{
+ return socket(AF_INET, SOCK_STREAM, 0);
+}
+
+static int
+tcp_connect(int s, struct sockaddr_in *adr)
+{
+ if(krb_debug) {
+ krb_warning("connecting to %s, tcp port %d\n",
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
+ }
+ return connect(s, (struct sockaddr*)adr, sizeof(*adr));
+}
+
+static int
+tcp_send(int s, struct sockaddr_in* adr, KTEXT pkt)
+{
+ unsigned char len[4];
+ if(krb_debug) {
+ krb_warning("sending %d bytes to %s, tcp port %d\n",
+ pkt->length,
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
+ }
+ krb_put_int(pkt->length, len, sizeof(len), 4);
+ if(send(s, len, sizeof(len), 0) != sizeof(len))
+ return -1;
+ return send(s, pkt->dat, pkt->length, 0);
+}
+
+static int
+udptcp_recv(void *buf, size_t len, KTEXT rpkt)
+{
+ int pktlen = min(len, MAX_KTXT_LEN);
+
+ if(krb_debug)
+ krb_warning("recieved %lu bytes on udp/tcp socket\n",
+ (unsigned long)len);
+ memcpy(rpkt->dat, buf, pktlen);
+ rpkt->length = pktlen;
+ return 0;
+}
+
+static int
+url_parse(const char *url, char *host, size_t len, short *port)
+{
+ const char *p;
+ size_t n;
+
+ if(strncmp(url, "http://", 7))
+ return -1;
+ url += 7;
+ p = strchr(url, ':');
+ if(p) {
+ char *end;
+
+ *port = htons(strtol(p + 1, &end, 0));
+ if (end == p + 1)
+ return -1;
+ n = p - url;
+ } else {
+ *port = k_getportbyname ("http", "tcp", htons(80));
+ p = strchr(url, '/');
+ if (p)
+ n = p - url;
+ else
+ n = strlen(url);
+ }
+ if (n >= len)
+ return -1;
+ memcpy(host, url, n);
+ host[n] = '\0';
+ return 0;
+}
+
+#define PROXY_VAR "krb4_proxy"
+
+static int
+http_connect(int s, struct sockaddr_in *adr)
+{
+ const char *proxy = krb_get_config_string(PROXY_VAR);
+ char host[MaxHostNameLen];
+ short port;
+ struct hostent *hp;
+ struct sockaddr_in sin;
+ if(proxy == NULL) {
+ if(krb_debug)
+ krb_warning("Not using proxy.\n");
+ return tcp_connect(s, adr);
+ }
+ if(url_parse(proxy, host, sizeof(host), &port) < 0)
+ return -1;
+ hp = gethostbyname(host);
+ if(hp == NULL)
+ return -1;
+ memset(&sin, 0, sizeof(sin));
+ sin.sin_family = AF_INET;
+ memcpy(&sin.sin_addr, hp->h_addr, sizeof(sin.sin_addr));
+ sin.sin_port = port;
+ if(krb_debug) {
+ krb_warning("connecting to proxy on %s (%s) port %d\n",
+ host, inet_ntoa(sin.sin_addr), ntohs(port));
+ }
+ return connect(s, (struct sockaddr*)&sin, sizeof(sin));
+}
+
+static int
+http_send(int s, struct sockaddr_in* adr, KTEXT pkt)
+{
+ char *str;
+ char *msg;
+
+ if(base64_encode(pkt->dat, pkt->length, &str) < 0)
+ return -1;
+ if(krb_get_config_string(PROXY_VAR)) {
+ if(krb_debug) {
+ krb_warning("sending %d bytes to %s, tcp port %d (via proxy)\n",
+ pkt->length,
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
+ }
+ asprintf(&msg, "GET http://%s:%d/%s HTTP/1.0\r\n\r\n",
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port),
+ str);
+ } else {
+ if(krb_debug) {
+ krb_warning("sending %d bytes to %s, http port %d\n",
+ pkt->length,
+ inet_ntoa(adr->sin_addr),
+ ntohs(adr->sin_port));
}
+ asprintf(&msg, "GET %s HTTP/1.0\r\n\r\n", str);
+ }
+ free(str);
+
+ if (msg == NULL)
+ return -1;
+
+ if(send(s, msg, strlen(msg), 0) != strlen(msg)){
+ free(msg);
+ return -1;
}
- return 1;
+ free(msg);
+ return 0;
}
static int
-send_recv(KTEXT pkt, KTEXT rpkt, int proto, struct sockaddr_in *_to,
- struct host *addrs, int n_hosts)
+http_recv(void *buf, size_t len, KTEXT rpkt)
{
- int f;
- int ret = 0;
- if(proto == IPPROTO_UDP)
- f = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
- else if(proto == IPPROTO_TCP)
- f = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP);
- else{
- krb_warning("Unknown protocol `%d'.\n", proto);
- return 0;
+ char *p;
+ char *tmp = malloc(len + 1);
+
+ if (tmp == NULL)
+ return -1;
+ memcpy(tmp, buf, len);
+ tmp[len] = 0;
+ p = strstr(tmp, "\r\n\r\n");
+ if(p == NULL){
+ free(tmp);
+ return -1;
}
+ p += 4;
+ if(krb_debug)
+ krb_warning("recieved %lu bytes on http socket\n",
+ (unsigned long)((tmp + len) - p));
+ if((tmp + len) - p > MAX_KTXT_LEN) {
+ free(tmp);
+ return -1;
+ }
+ if (strncasecmp (tmp, "HTTP/1.0 2", 10) != 0
+ && strncasecmp (tmp, "HTTP/1.1 2", 10) != 0) {
+ free (tmp);
+ return -1;
+ }
+ memcpy(rpkt->dat, p, (tmp + len) - p);
+ rpkt->length = (tmp + len) - p;
+ free(tmp);
+ return 0;
+}
+
+static struct proto_descr {
+ int proto;
+ int stream_flag;
+ int (*socket)(void);
+ int (*connect)(int, struct sockaddr_in*);
+ int (*send)(int, struct sockaddr_in*, KTEXT);
+ int (*recv)(void*, size_t, KTEXT);
+} protos[] = {
+ { PROTO_UDP, 0, udp_socket, udp_connect, udp_send, udptcp_recv },
+ { PROTO_TCP, 1, tcp_socket, tcp_connect, tcp_send, udptcp_recv },
+ { PROTO_HTTP, 1, tcp_socket, http_connect, http_send, http_recv }
+};
+
+static int
+send_recv(KTEXT pkt, KTEXT rpkt, int proto, struct sockaddr_in *adr)
+{
+ int i;
+ int s;
+ unsigned char buf[MAX_KTXT_LEN];
+ int offset = 0;
- if(connect(f, (struct sockaddr*)_to, sizeof(*_to)) < 0)
- krb_warning("Connecting socket: errno = %d\n", errno);
- else
- ret = send_recv_it(pkt, rpkt, proto == IPPROTO_TCP, f,
- _to, addrs, n_hosts);
-
- close(f);
- return ret;
+ for(i = 0; i < sizeof(protos) / sizeof(protos[0]); i++){
+ if(protos[i].proto == proto)
+ break;
+ }
+ if(i == sizeof(protos) / sizeof(protos[0]))
+ return FALSE;
+ if((s = (*protos[i].socket)()) < 0)
+ return FALSE;
+ if((*protos[i].connect)(s, adr) < 0){
+ close(s);
+ return FALSE;
+ }
+ if((*protos[i].send)(s, adr, pkt) < 0){
+ close(s);
+ return FALSE;
+ }
+ do{
+ fd_set readfds;
+ struct timeval timeout;
+ int len;
+ timeout.tv_sec = client_timeout;
+ timeout.tv_usec = 0;
+ FD_ZERO(&readfds);
+ FD_SET(s, &readfds);
+
+ /* select - either recv is ready, or timeout */
+ /* see if timeout or error or wrong descriptor */
+ if(select(s + 1, &readfds, 0, 0, &timeout) < 1
+ || !FD_ISSET(s, &readfds)) {
+ if (krb_debug)
+ krb_warning("select failed: errno = %d\n", errno);
+ close(s);
+ return FALSE;
+ }
+ len = recv(s, buf + offset, sizeof(buf) - offset, 0);
+ if (len < 0) {
+ close(s);
+ return FALSE;
+ }
+ if(len == 0)
+ break;
+ offset += len;
+ } while(protos[i].stream_flag);
+ close(s);
+ if((*protos[i].recv)(buf, offset, rpkt) < 0)
+ return FALSE;
+ return TRUE;
}
+/* The configuration line "hosts: dns files" in /etc/nsswitch.conf is
+ * rumored to avoid triggering this bug. */
+#if defined(linux) && defined(HAVE__DNS_GETHOSTBYNAME) && 0
+/* Linux libc 5.3 is broken probably somewhere in nsw_hosts.o,
+ * for now keep this kludge. */
+static
+struct hostent *gethostbyname(const char *name)
+{
+ return (void *)_dns_gethostbyname(name);
+}
+#endif
diff --git a/crypto/kerberosIV/lib/krb/sendauth.c b/crypto/kerberosIV/lib/krb/sendauth.c
index 4240bcf..3debc49 100644
--- a/crypto/kerberosIV/lib/krb/sendauth.c
+++ b/crypto/kerberosIV/lib/krb/sendauth.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: sendauth.c,v 1.15 1997/04/18 14:11:36 joda Exp $");
+RCSID("$Id: sendauth.c,v 1.17 1998/06/09 19:25:26 joda Exp $");
/*
* krb_sendauth() transmits a ticket over a file descriptor for a
@@ -130,6 +130,7 @@ krb_sendauth(int32_t options, /* bit-pattern of options */
char tmp[4];
u_int32_t len;
char inst[INST_SZ];
+ char *i;
ret = krb_net_read (fd, tmp, 4);
if (ret < 0)
@@ -144,9 +145,10 @@ krb_sendauth(int32_t options, /* bit-pattern of options */
return -1;
if (options & KOPT_DONT_CANON)
- strncpy (inst, instance, sizeof(inst));
+ i = instance;
else
- strncpy (inst, krb_get_phost(instance), sizeof(inst));
+ i = krb_get_phost(instance);
+ strcpy_truncate (inst, i, sizeof(inst));
ret = krb_get_cred (service, inst, realm, cred);
if (ret != KSUCCESS)
diff --git a/crypto/kerberosIV/lib/krb/sizetest.c b/crypto/kerberosIV/lib/krb/sizetest.c
index d64bbeb..e683416 100644
--- a/crypto/kerberosIV/lib/krb/sizetest.c
+++ b/crypto/kerberosIV/lib/krb/sizetest.c
@@ -1,24 +1,23 @@
#include "krb_locl.h"
-RCSID("$Id: sizetest.c,v 1.5 1996/11/15 18:39:19 bg Exp $");
+RCSID("$Id: sizetest.c,v 1.6 1998/01/01 22:29:04 assar Exp $");
-static
-void
-err(const char *msg)
+static void
+fatal(const char *msg)
{
fputs(msg, stderr);
exit(1);
}
int
-main()
+main(void)
{
if (sizeof(u_int8_t) < 1)
- err("sizeof(u_int8_t) is smaller than 1 byte\n");
+ fatal("sizeof(u_int8_t) is smaller than 1 byte\n");
if (sizeof(u_int16_t) < 2)
- err("sizeof(u_int16_t) is smaller than 2 bytes\n");
+ fatal("sizeof(u_int16_t) is smaller than 2 bytes\n");
if (sizeof(u_int32_t) < 4)
- err("sizeof(u_int32_t) is smaller than 4 bytes\n");
+ fatal("sizeof(u_int32_t) is smaller than 4 bytes\n");
if (sizeof(u_int8_t) > 1)
fputs("warning: sizeof(u_int8_t) is larger than 1 byte, "
@@ -31,7 +30,7 @@ main()
u <<= 1;
if (i < 8)
- err("u_int8_t is smaller than 8 bits\n");
+ fatal("u_int8_t is smaller than 8 bits\n");
else if (i > 8)
fputs("warning: u_int8_t is larger than 8 bits, "
"some stuff may not work properly!\n", stderr);
diff --git a/crypto/kerberosIV/lib/krb/solaris_compat.c b/crypto/kerberosIV/lib/krb/solaris_compat.c
new file mode 100644
index 0000000..ff59dcb
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/solaris_compat.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: solaris_compat.c,v 1.2.6.1 1999/07/22 03:15:53 assar Exp $");
+
+#if (SunOS + 0) >= 50
+/*
+ * Compatibility with solaris' libkrb.
+ */
+
+int32_t
+_C0095C2A(void *in, void *out, u_int32_t length,
+ struct des_ks_struct *schedule, des_cblock *key,
+ struct sockaddr_in *sender, struct sockaddr_in *receiver)
+{
+ return krb_mk_priv (in, out, length, schedule, key, sender, receiver);
+}
+
+int32_t
+_C0095C2B(void *in, u_int32_t in_length,
+ struct des_ks_struct *schedule, des_cblock *key,
+ struct sockaddr_in *sender, struct sockaddr_in *receiver,
+ MSG_DAT *m_data)
+{
+ return krb_rd_priv (in, in_length, schedule, key,
+ sender, receiver, m_data);
+}
+
+void
+_C0095B2B(des_cblock *input,des_cblock *output,
+ des_key_schedule ks,int enc)
+{
+ des_ecb_encrypt(input, output, ks, enc);
+}
+
+void
+_C0095B2A(des_cblock (*input),
+ des_cblock (*output),
+ long length,
+ des_key_schedule schedule,
+ des_cblock (*ivec),
+ int encrypt)
+{
+ des_cbc_encrypt(input, output, length, schedule, ivec, encrypt);
+}
+
+void
+_C0095B2C(des_cblock (*input),
+ des_cblock (*output),
+ long length,
+ des_key_schedule schedule,
+ des_cblock (*ivec),
+ int encrypt)
+{
+ des_pcbc_encrypt(input, output, length, schedule, ivec, encrypt);
+}
+#endif /* (SunOS-0) >= 50 */
diff --git a/crypto/kerberosIV/lib/krb/str2key.c b/crypto/kerberosIV/lib/krb/str2key.c
index 2b00fc1..71a2cea 100644
--- a/crypto/kerberosIV/lib/krb/str2key.c
+++ b/crypto/kerberosIV/lib/krb/str2key.c
@@ -6,9 +6,9 @@
#include "krb_locl.h"
-RCSID("$Id: str2key.c,v 1.10 1997/03/23 03:53:19 joda Exp $");
+RCSID("$Id: str2key.c,v 1.12.2.1 1999/08/19 13:35:01 assar Exp $");
-static void
+static inline void
mklower(char *s)
{
for (; *s; s++)
@@ -19,8 +19,8 @@ mklower(char *s)
/*
* Short passwords, i.e 8 characters or less.
*/
-static void
-afs_cmu_StringToKey (char *str, char *cell, des_cblock *key)
+static inline void
+afs_cmu_StringToKey(const char *str, const char *cell, des_cblock *key)
{
char password[8+1]; /* crypt is limited to 8 chars anyway */
int i;
@@ -29,7 +29,7 @@ afs_cmu_StringToKey (char *str, char *cell, des_cblock *key)
memset (key, 0, sizeof(key));
memset(password, 0, sizeof(password));
- strncpy (password, cell, 8);
+ strcpy_truncate (password, cell, sizeof(password));
passlen = strlen (str);
if (passlen > 8) passlen = 8;
@@ -41,7 +41,7 @@ afs_cmu_StringToKey (char *str, char *cell, des_cblock *key)
/* crypt only considers the first 8 characters of password but for some
reason returns eleven characters of result (plus the two salt chars). */
- strncpy((char *)key, (char *)crypt(password, "#~") + 2, sizeof(des_cblock));
+ strncpy((char *)key, crypt(password, "p1") + 2, sizeof(des_cblock));
/* parity is inserted into the LSB so leftshift each byte up one bit. This
allows ascii characters with a zero MSB to retain as much significance
@@ -60,8 +60,8 @@ afs_cmu_StringToKey (char *str, char *cell, des_cblock *key)
/*
* Long passwords, i.e 9 characters or more.
*/
-static void
-afs_transarc_StringToKey (char *str, char *cell, des_cblock *key)
+static inline void
+afs_transarc_StringToKey(const char *str, const char *cell, des_cblock *key)
{
des_key_schedule schedule;
des_cblock temp_key;
@@ -69,10 +69,11 @@ afs_transarc_StringToKey (char *str, char *cell, des_cblock *key)
char password[512];
int passlen;
- strncpy (password, str, sizeof(password));
+ strcpy_truncate (password, str, sizeof(password));
if ((passlen = strlen (password)) < sizeof(password)-1)
- strncat (password, cell, sizeof(password)-passlen);
- if ((passlen = strlen(password)) > sizeof(password)) passlen = sizeof(password);
+ strcat_truncate (password, cell, sizeof(password));
+ if ((passlen = strlen(password)) > sizeof(password))
+ passlen = sizeof(password);
memcpy(&ivec, "kerberos", 8);
memcpy(&temp_key, "kerberos", 8);
@@ -89,11 +90,11 @@ afs_transarc_StringToKey (char *str, char *cell, des_cblock *key)
}
void
-afs_string_to_key(char *str, char *cell, des_cblock *key)
+afs_string_to_key(const char *str, const char *cell, des_cblock *key)
{
- char realm[REALM_SZ+1];
- strncpy(realm, cell, REALM_SZ);
- realm[REALM_SZ] = 0;
+ char realm[REALM_SZ];
+
+ strcpy_truncate(realm, cell, REALM_SZ);
mklower(realm);
if (strlen(str) > 8)
diff --git a/crypto/kerberosIV/lib/krb/tf_util.c b/crypto/kerberosIV/lib/krb/tf_util.c
index a196448..27a6125 100644
--- a/crypto/kerberosIV/lib/krb/tf_util.c
+++ b/crypto/kerberosIV/lib/krb/tf_util.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: tf_util.c,v 1.24 1997/04/20 06:24:32 assar Exp $");
+RCSID("$Id: tf_util.c,v 1.35 1999/06/29 21:18:11 bg Exp $");
#define TOO_BIG -1
@@ -121,6 +121,11 @@ static int tf_read(void *s, int n);
* TKT_FIL_LCK - couldn't lock the file, even after a retry
*/
+#ifdef _NO_LOCKING
+#undef flock
+#define flock(F, M) 0
+#endif
+
int
tf_init(char *tf_name, int rw)
{
@@ -148,18 +153,21 @@ tf_init(char *tf_name, int rw)
default:
return TKT_FIL_ACC;
}
- /* The old code tried to guess when the calling program was
- * running set-uid, this is now removed - the kerberos library
- * does not (or shouldn't) know anything about user-ids.
-
- * All library functions now assume that the right userids are set
- * upon entry, therefore there is no need to test permissions like
- * before. If the file is openable, just open it.
- */
-
- if(!S_ISREG(stat_buf.st_mode))
+ if (!S_ISREG(stat_buf.st_mode))
return TKT_FIL_ACC;
+ /* The code tries to guess when the calling program is running
+ * set-uid and prevent unauthorized access.
+ *
+ * All library functions now assume that the right set of userids
+ * are set upon entry, therefore it's not strictly necessary to
+ * perform these test for programs adhering to these assumptions.
+ */
+ {
+ uid_t me = getuid();
+ if (stat_buf.st_uid != me && me != 0)
+ return TKT_FIL_ACC;
+ }
/*
* If "wflag" is set, open the ticket file in append-writeonly mode
@@ -177,7 +185,7 @@ tf_init(char *tf_name, int rw)
return TKT_FIL_ACC;
}
for (i_retry = 0; i_retry < TF_LCK_RETRY_COUNT; i_retry++) {
- if (k_flock(fd, K_LOCK_EX | K_LOCK_NB) < 0) {
+ if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
if (krb_debug)
krb_warning("tf_init: retry %d of write lock of `%s'.\n",
i_retry, tf_name);
@@ -201,7 +209,7 @@ tf_init(char *tf_name, int rw)
}
for (i_retry = 0; i_retry < TF_LCK_RETRY_COUNT; i_retry++) {
- if (k_flock(fd, K_LOCK_SH | K_LOCK_NB) < 0) {
+ if (flock(fd, LOCK_SH | LOCK_NB) < 0) {
if (krb_debug)
krb_warning("tf_init: retry %d of read lock of `%s'.\n",
i_retry, tf_name);
@@ -252,9 +260,9 @@ tf_create(char *tf_name)
fd = open(tf_name, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600);
if (fd < 0)
return TKT_FIL_ACC;
- if (k_flock(fd, K_LOCK_EX | K_LOCK_NB) < 0) {
+ if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
sleep(TF_LCK_RETRY);
- if (k_flock(fd, K_LOCK_EX | K_LOCK_NB) < 0) {
+ if (flock(fd, LOCK_EX | LOCK_NB) < 0) {
close(fd);
fd = -1;
return TKT_FIL_LCK;
@@ -295,7 +303,7 @@ tf_get_pname(char *p)
*/
int
-tf_put_pname(char *p)
+tf_put_pname(const char *p)
{
unsigned count;
@@ -343,7 +351,7 @@ tf_get_pinst(char *inst)
*/
int
-tf_put_pinst(char *inst)
+tf_put_pinst(const char *inst)
{
unsigned count;
@@ -369,6 +377,9 @@ tf_put_pinst(char *inst)
* EOF - end of file encountered
*/
+#define MAGIC_TICKET_NAME "magic"
+#define MAGIC_TICKET_INST "time-diff"
+
int
tf_get_cred(CREDENTIALS *c)
{
@@ -380,6 +391,7 @@ tf_get_cred(CREDENTIALS *c)
krb_warning ("tf_get_cred called before tf_init.\n");
return TKT_FIL_INI;
}
+again:
if ((k_errno = tf_gets(c->service, SNAME_SZ)) < 2)
switch (k_errno) {
case TOO_BIG:
@@ -431,6 +443,16 @@ tf_get_cred(CREDENTIALS *c)
krb_warning ("tf_get_cred: failed tf_read.\n");
return TKT_FIL_FMT;
}
+ if(strcmp(c->service, MAGIC_TICKET_NAME) == 0 &&
+ strcmp(c->instance, MAGIC_TICKET_INST) == 0) {
+ /* we found the magic `time diff' ticket; update the kdc time
+ differential, and then get the next ticket */
+ u_int32_t d;
+
+ krb_get_int(c->ticket_st.dat, &d, 4, 0);
+ krb_set_kdc_time_diff(d);
+ goto again;
+ }
return KSUCCESS;
}
@@ -446,7 +468,7 @@ void
tf_close(void)
{
if (!(fd < 0)) {
- k_flock(fd, K_LOCK_UN);
+ flock(fd, LOCK_UN);
close(fd);
fd = -1; /* see declaration of fd above */
}
@@ -603,9 +625,9 @@ tf_save_cred(char *service, /* Service name */
bad:
return (KFAILURE);
}
-
+
int
-tf_setup(CREDENTIALS *cred, char *pname, char *pinst)
+tf_setup(CREDENTIALS *cred, const char *pname, const char *pinst)
{
int ret;
ret = tf_create(tkt_string());
@@ -617,7 +639,20 @@ tf_setup(CREDENTIALS *cred, char *pname, char *pinst)
tf_close();
return INTK_ERR;
}
-
+
+ if(krb_get_kdc_time_diff() != 0) {
+ /* Add an extra magic ticket containing the time differential
+ to the kdc. The first ticket defines which realm we belong
+ to, but since this ticket gets the same realm as the tgt,
+ this shouldn't be a problem */
+ des_cblock s = { 0, 0, 0, 0, 0, 0, 0, 0 };
+ KTEXT_ST t;
+ int d = krb_get_kdc_time_diff();
+ krb_put_int(d, t.dat, sizeof(t.dat), 4);
+ t.length = 4;
+ tf_save_cred(MAGIC_TICKET_NAME, MAGIC_TICKET_INST, cred->realm, s,
+ cred->lifetime, 0, &t, cred->issue_date);
+ }
ret = tf_save_cred(cred->service, cred->instance, cred->realm,
cred->session, cred->lifetime, cred->kvno,
&cred->ticket_st, cred->issue_date);
diff --git a/crypto/kerberosIV/lib/krb/ticket_memory.c b/crypto/kerberosIV/lib/krb/ticket_memory.c
index 04e20b6..d1fab2e 100644
--- a/crypto/kerberosIV/lib/krb/ticket_memory.c
+++ b/crypto/kerberosIV/lib/krb/ticket_memory.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -45,7 +45,7 @@
#include "krb_locl.h"
#include "ticket_memory.h"
-RCSID("$Id: ticket_memory.c,v 1.9 1997/04/20 18:07:36 assar Exp $");
+RCSID("$Id: ticket_memory.c,v 1.13 1998/08/23 18:07:41 assar Exp $");
void msg(char *text, int error);
@@ -55,40 +55,36 @@ tktmem *SharedMemory;
static int CredIndex = -1;
+void PostUpdateMessage(void);
+
int
newTktMem(const char *tf_name)
{
- if(!SharedMemory)
- {
- unsigned int MemorySize = sizeof(tktmem);
- unsigned int MemorySizeHi = sizeof(tktmem)>>16;
- unsigned int MemorySizeLo = MemorySize&0xFFFF;
- SharedMemoryHandle = CreateFileMapping((HANDLE)(int)-1, 0,
+ if(!SharedMemory){
+ SharedMemoryHandle = CreateFileMapping((HANDLE)-1, 0,
PAGE_READWRITE,
- MemorySizeHi, MemorySizeLo,
+ sizeof(tktmem) >> 16,
+ sizeof(tktmem) & 0xffff,
"krb_memory");
-
- if(!SharedMemoryHandle)
- {
+
+ if(!SharedMemoryHandle){
msg("Could not create shared memory.", GetLastError());
return KFAILURE;
}
SharedMemory = MapViewOfFile(SharedMemoryHandle,
FILE_MAP_WRITE, 0, 0, 0);
- if(!SharedMemory)
- {
+ if(!SharedMemory){
msg("Unable to alloc shared memory.", GetLastError());
return KFAILURE;
}
- if(GetLastError() != ERROR_ALREADY_EXISTS)
- {
+ if(GetLastError() != ERROR_ALREADY_EXISTS) {
+ memset(SharedMemory, 0, sizeof(*SharedMemory));
if(tf_name)
- strcpy(SharedMemory->tmname, tf_name);
- SharedMemory->last_cred_no = 0;
+ strcpy_truncate(SharedMemory->tmname,
+ tf_name, sizeof(SharedMemory->tmname));
}
}
-
CredIndex = 0;
return KSUCCESS;
}
@@ -96,8 +92,7 @@ newTktMem(const char *tf_name)
int
freeTktMem(const char *tf_name)
{
- if(SharedMemory)
- {
+ if(SharedMemory) {
UnmapViewOfFile(SharedMemory);
CloseHandle(SharedMemoryHandle);
}
@@ -184,9 +179,8 @@ in_tkt(char *pname, char *pinst)
int
dest_tkt(void)
{
- /* Here goes code to destroy tickets in shared memory. */
- /* Not implemented yet. */
- return KFAILURE;
+ memset(getTktMem(0), 0, sizeof(tktmem));
+ return 0;
}
/* Short description of routines:
@@ -265,9 +259,9 @@ tf_get_pname(char *p)
if(!(TktStore = getTktMem(0)))
return KFAILURE;
- if(!TktStore->pname)
+ if(!TktStore->pname[0])
return KFAILURE;
- strcpy(p, TktStore->pname);
+ strcpy_truncate(p, TktStore->pname, ANAME_SZ);
return KSUCCESS;
}
@@ -283,9 +277,7 @@ tf_put_pname(char *p)
if(!(TktStore = getTktMem(0)))
return KFAILURE;
- if(!TktStore->pname)
- return KFAILURE;
- strcpy(TktStore->pname, p);
+ strcpy_truncate(TktStore->pname, p, sizeof(TktStore->pname));
return KSUCCESS;
}
@@ -306,9 +298,7 @@ tf_get_pinst(char *inst)
if(!(TktStore = getTktMem(0)))
return KFAILURE;
- if(!TktStore->pinst)
- return KFAILURE;
- strcpy(inst, TktStore->pinst);
+ strcpy_truncate(inst, TktStore->pinst, INST_SZ);
return KSUCCESS;
}
@@ -324,9 +314,7 @@ tf_put_pinst(char *inst)
if(!(TktStore = getTktMem(0)))
return KFAILURE;
- if(!TktStore->pinst)
- return KFAILURE;
- strcpy(TktStore->pinst, inst);
+ strcpy_truncate(TktStore->pinst, inst, sizeof(TktStore->pinst));
return KSUCCESS;
}
@@ -350,10 +338,11 @@ tf_get_cred(CREDENTIALS *c)
if(!(TktStore = getTktMem(0)))
return KFAILURE;
+ krb_set_kdc_time_diff(TktStore->kdc_diff);
if((index = nextCredIndex()) == -1)
return EOF;
if(!(cred = TktStore->cred_vec+index))
- return KFAILURE;
+ return KFAILURE;
if(!c)
return KFAILURE;
memcpy(c, cred, sizeof(*c));
@@ -402,20 +391,31 @@ tf_save_cred(char *service, /* Service name */
if(last == -1)
return KFAILURE;
cred = mem->cred_vec+last;
- strcpy(cred->service, service);
- strcpy(cred->instance, instance);
- strcpy(cred->realm, realm);
- strcpy(cred->session, session);
+ strcpy_truncate(cred->service, service, sizeof(cred->service));
+ strcpy_truncate(cred->instance, instance, sizeof(cred->instance));
+ strcpy_truncate(cred->realm, realm, sizeof(cred->realm));
+ memcpy(cred->session, session, sizeof(cred->session));
cred->lifetime = lifetime;
cred->kvno = kvno;
memcpy(&(cred->ticket_st), ticket, sizeof(*ticket));
cred->issue_date = issue_date;
- strcpy(cred->pname, mem->pname);
- strcpy(cred->pinst, mem->pinst);
+ strcpy_truncate(cred->pname, mem->pname, sizeof(cred->pname));
+ strcpy_truncate(cred->pinst, mem->pinst, sizeof(cred->pinst));
+ PostUpdateMessage();
return KSUCCESS;
}
+static void
+set_time_diff(time_t diff)
+{
+ tktmem *TktStore = getTktMem(0);
+ if(TktStore == NULL)
+ return;
+ TktStore->kdc_diff = diff;
+}
+
+
int
tf_setup(CREDENTIALS *cred, char *pname, char *pinst)
{
@@ -430,6 +430,8 @@ tf_setup(CREDENTIALS *cred, char *pname, char *pinst)
return INTK_ERR;
}
+ set_time_diff(krb_get_kdc_time_diff());
+
ret = tf_save_cred(cred->service, cred->instance, cred->realm,
cred->session, cred->lifetime, cred->kvno,
&cred->ticket_st, cred->issue_date);
diff --git a/crypto/kerberosIV/lib/krb/ticket_memory.h b/crypto/kerberosIV/lib/krb/ticket_memory.h
index e85e1a4..307fb9a 100644
--- a/crypto/kerberosIV/lib/krb/ticket_memory.h
+++ b/crypto/kerberosIV/lib/krb/ticket_memory.h
@@ -40,7 +40,7 @@
* Author: d93-jka@nada.kth.se - June 1996
*/
-/* $Id: ticket_memory.h,v 1.6 1997/04/20 06:25:12 assar Exp $ */
+/* $Id: ticket_memory.h,v 1.7 1998/06/03 02:31:05 joda Exp $ */
#ifndef TICKET_MEMORY_H
#define TICKET_MEMORY_H
@@ -56,6 +56,7 @@ typedef struct _tktmem
char pinst[INST_SZ]; /* Principal's instance */
int last_cred_no;
CREDENTIALS cred_vec[CRED_VEC_SZ];
+ time_t kdc_diff;
} tktmem;
int newTktMem(const char *tf_name);
diff --git a/crypto/kerberosIV/lib/krb/time.c b/crypto/kerberosIV/lib/krb/time.c
new file mode 100644
index 0000000..23831cf
--- /dev/null
+++ b/crypto/kerberosIV/lib/krb/time.c
@@ -0,0 +1,76 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: time.c,v 1.3 1998/09/30 22:36:19 assar Exp $");
+
+/* number of seconds the kdc clock is ahead of us */
+static int time_diff;
+
+void
+krb_set_kdc_time_diff(int diff)
+{
+ time_diff = diff;
+ if(krb_debug)
+ krb_warning("Setting time diff to %d\n", diff);
+}
+
+int
+krb_get_kdc_time_diff(void)
+{
+ return time_diff;
+}
+
+/* return the time at the kdc (local time corrected with a time
+ differential) */
+void
+krb_kdctimeofday(struct timeval *tv)
+{
+ time_t t;
+
+ gettimeofday(tv, NULL);
+ t = tv->tv_sec;
+
+ if(krb_debug)
+ krb_warning("Machine time: %s", ctime(&t));
+ t += krb_get_kdc_time_diff();
+ if(krb_debug)
+ krb_warning("Correcting to %s", ctime(&t));
+ tv->tv_sec = t;
+}
diff --git a/crypto/kerberosIV/lib/krb/tkt_string.c b/crypto/kerberosIV/lib/krb/tkt_string.c
index 2914abb..2c81288 100644
--- a/crypto/kerberosIV/lib/krb/tkt_string.c
+++ b/crypto/kerberosIV/lib/krb/tkt_string.c
@@ -21,7 +21,7 @@ or implied warranty.
#include "krb_locl.h"
-RCSID("$Id: tkt_string.c,v 1.10 1997/05/02 14:54:26 assar Exp $");
+RCSID("$Id: tkt_string.c,v 1.14 1998/06/09 19:25:28 joda Exp $");
/*
* This routine is used to generate the name of the file that holds
@@ -39,25 +39,19 @@ RCSID("$Id: tkt_string.c,v 1.10 1997/05/02 14:54:26 assar Exp $");
static char krb_ticket_string[MaxPathLen] = "";
-#ifndef HAVE_GETUID
-int getuid(void)
-{
- return 27;
-}
-#endif
-
-char *tkt_string(void)
+char *
+tkt_string(void)
{
char *env;
if (!*krb_ticket_string) {
if ((env = getenv("KRBTKFILE"))) {
- strncpy(krb_ticket_string, env,
- sizeof(krb_ticket_string)-1);
- krb_ticket_string[sizeof(krb_ticket_string)-1] = '\0';
+ strcpy_truncate (krb_ticket_string,
+ env,
+ sizeof(krb_ticket_string));
} else {
snprintf(krb_ticket_string, sizeof(krb_ticket_string),
- "%s%u",TKT_ROOT,(unsigned)getuid());
+ "%s%u",TKT_ROOT, (unsigned)getuid());
}
}
return krb_ticket_string;
@@ -75,11 +69,7 @@ char *tkt_string(void)
*/
void
-krb_set_tkt_string(char *val)
+krb_set_tkt_string(const char *val)
{
-
- strncpy(krb_ticket_string, val, sizeof(krb_ticket_string)-1);
- krb_ticket_string[sizeof(krb_ticket_string)-1] = '\0';
-
- return;
+ strcpy_truncate (krb_ticket_string, val, sizeof(krb_ticket_string));
}
diff --git a/crypto/kerberosIV/lib/krb/unparse_name.c b/crypto/kerberosIV/lib/krb/unparse_name.c
index ddb938f..9d39f1d 100644
--- a/crypto/kerberosIV/lib/krb/unparse_name.c
+++ b/crypto/kerberosIV/lib/krb/unparse_name.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#include "krb_locl.h"
-RCSID("$Id: unparse_name.c,v 1.7 1997/04/01 08:18:46 joda Exp $");
+RCSID("$Id: unparse_name.c,v 1.8 1998/06/09 19:25:28 joda Exp $");
static void
quote_string(char *quote, char *from, char *to)
@@ -74,12 +74,13 @@ krb_unparse_name_long_r(char *name, char *instance, char *realm,
char *fullname)
{
krb_principal pr;
+
memset(&pr, 0, sizeof(pr));
- strcpy(pr.name, name);
+ strcpy_truncate(pr.name, name, sizeof(pr.name));
if(instance)
- strcpy(pr.instance, instance);
+ strcpy_truncate(pr.instance, instance, sizeof(pr.instance));
if(realm)
- strcpy(pr.realm, realm);
+ strcpy_truncate(pr.realm, realm, sizeof(pr.realm));
return krb_unparse_name_r(&pr, fullname);
}
@@ -95,11 +96,12 @@ char *
krb_unparse_name_long(char *name, char *instance, char *realm)
{
krb_principal pr;
+
memset(&pr, 0, sizeof(pr));
- strcpy(pr.name, name);
+ strcpy_truncate(pr.name, name, sizeof(pr.name));
if(instance)
- strcpy(pr.instance, instance);
+ strcpy_truncate(pr.instance, instance, sizeof(pr.instance));
if(realm)
- strcpy(pr.realm, realm);
+ strcpy_truncate(pr.realm, realm, sizeof(pr.realm));
return krb_unparse_name(&pr);
}
diff --git a/crypto/kerberosIV/lib/krb/verify_user.c b/crypto/kerberosIV/lib/krb/verify_user.c
index ce22b59..de692dd 100644
--- a/crypto/kerberosIV/lib/krb/verify_user.c
+++ b/crypto/kerberosIV/lib/krb/verify_user.c
@@ -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.
*
@@ -38,22 +38,38 @@
#include "krb_locl.h"
-RCSID("$Id: verify_user.c,v 1.8 1997/04/01 08:18:46 joda Exp $");
+RCSID("$Id: verify_user.c,v 1.14 1999/03/16 17:31:39 assar Exp $");
-/* Verify user with password. If secure, also verify against local
- * service key, this can (usually) only be done by root.
+/*
+ * Verify user (name.instance@realm) with `password'.
+ *
+ * If secure, also verify against local
+ * service key (`linstance'.hostname) (or rcmd if linstance == NULL),
+ * this can (usually) only be done by root.
+ *
+ * If secure == KRB_VERIFY_SECURE, fail if there's no key.
+ * If secure == KRB_VERIFY_SECURE_FAIL, don't fail if there's no such
+ * key in the srvtab.
*
* As a side effect, fresh tickets are obtained.
*
+ * srvtab is where the key is found.
+ *
* Returns zero if ok, a positive kerberos error or -1 for system
* errors.
*/
-int
-krb_verify_user(char *name, char *instance, char *realm, char *password,
- int secure, char *linstance)
+static int
+krb_verify_user_srvtab_exact(char *name,
+ char *instance,
+ char *realm,
+ char *password,
+ int secure,
+ char *linstance,
+ char *srvtab)
{
int ret;
+
ret = krb_get_pw_in_tkt(name, instance, realm,
KRB_TICKET_GRANTING_TICKET,
realm,
@@ -61,7 +77,7 @@ krb_verify_user(char *name, char *instance, char *realm, char *password,
if(ret != KSUCCESS)
return ret;
- if(secure){
+ if(secure == KRB_VERIFY_SECURE || secure == KRB_VERIFY_SECURE_FAIL){
struct hostent *hp;
int32_t addr;
@@ -72,7 +88,7 @@ krb_verify_user(char *name, char *instance, char *realm, char *password,
char hostname[MaxHostNameLen];
char *phost;
- if (k_gethostname(hostname, sizeof(hostname)) == -1) {
+ if (gethostname(hostname, sizeof(hostname)) == -1) {
dest_tkt();
return -1;
}
@@ -94,13 +110,21 @@ krb_verify_user(char *name, char *instance, char *realm, char *password,
if (linstance == NULL)
linstance = "rcmd";
+ if(secure == KRB_VERIFY_SECURE_FAIL) {
+ des_cblock key;
+ ret = read_service_key(linstance, phost, lrealm, 0, srvtab, &key);
+ memset(key, 0, sizeof(key));
+ if(ret == KFAILURE)
+ return 0;
+ }
+
ret = krb_mk_req(&ticket, linstance, phost, lrealm, 33);
if(ret != KSUCCESS){
dest_tkt();
return ret;
}
- ret = krb_rd_req(&ticket, linstance, phost, addr, &auth, "");
+ ret = krb_rd_req(&ticket, linstance, phost, addr, &auth, srvtab);
if(ret != KSUCCESS){
dest_tkt();
return ret;
@@ -109,3 +133,77 @@ krb_verify_user(char *name, char *instance, char *realm, char *password,
return 0;
}
+/*
+ *
+ */
+
+int
+krb_verify_user_srvtab(char *name,
+ char *instance,
+ char *realm,
+ char *password,
+ int secure,
+ char *linstance,
+ char *srvtab)
+{
+ int n;
+ char rlm[256];
+#define ERICSSON_COMPAT 1
+#ifdef ERICSSON_COMPAT
+ FILE *f;
+
+ f = fopen ("/etc/krb.localrealms", "r");
+ if (f != NULL) {
+ while (fgets(rlm, sizeof(rlm), f) != NULL) {
+ if (rlm[strlen(rlm) - 1] == '\n')
+ rlm[strlen(rlm) - 1] = '\0';
+
+ if (krb_verify_user_srvtab_exact(name, instance, rlm, password,
+ secure, linstance, srvtab)
+ == KSUCCESS) {
+ fclose(f);
+ return KSUCCESS;
+ }
+ }
+ fclose (f);
+ return krb_verify_user_srvtab_exact(name, instance, realm, password,
+ secure, linstance, srvtab);
+ }
+#endif
+ /* First try to verify against the supplied realm. */
+ if (krb_verify_user_srvtab_exact(name, instance, realm, password,
+ secure, linstance, srvtab)
+ == KSUCCESS)
+ return KSUCCESS;
+
+ /* Verify all local realms, except the supplied realm. */
+ for (n = 1; krb_get_lrealm(rlm, n) == KSUCCESS; n++)
+ if (strcmp(rlm, realm) != 0)
+ if (krb_verify_user_srvtab_exact(name, instance, rlm, password,
+ secure, linstance, srvtab)
+ == KSUCCESS)
+ return KSUCCESS;
+
+ return KFAILURE;
+}
+
+/*
+ * Compat function without srvtab.
+ */
+
+int
+krb_verify_user(char *name,
+ char *instance,
+ char *realm,
+ char *password,
+ int secure,
+ char *linstance)
+{
+ return krb_verify_user_srvtab (name,
+ instance,
+ realm,
+ password,
+ secure,
+ linstance,
+ KEYFILE);
+}
diff --git a/crypto/kerberosIV/lib/roken/ChangeLog b/crypto/kerberosIV/lib/roken/ChangeLog
new file mode 100644
index 0000000..6c51e17
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/ChangeLog
@@ -0,0 +1,373 @@
+1999-07-08 Johan Danielsson <joda@pdc.kth.se>
+
+ * roken.awk: use puts, as suggested by Jeffrey Hutzelman
+ <jhutz+@cmu.edu>
+
+1999-07-06 Assar Westerlund <assar@sics.se>
+
+ * readv.c (readv): typo
+
+1999-07-03 Assar Westerlund <assar@sics.se>
+
+ * writev.c (writev): error check malloc properly
+
+ * sendmsg.c (sendmsg): error check malloc properly
+
+ * resolve.c (parse_reply): error check malloc properly
+
+ * recvmsg.c (recvmsg): error check malloc properly
+
+ * readv.c (readv): error check malloc properly
+
+1999-06-23 Assar Westerlund <assar@sics.se>
+
+ * parse_units.c (acc_units): move the special case of 0 -> 1 to
+ parse_something to avoid having it happen at the end of the string
+
+1999-06-15 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in: add get_default_username
+
+ * get_default_username.c: new file
+
+ * roken.h.in (get_default_username): add prototype
+
+ * Makefile.am: add get_default_username
+
+1999-05-08 Assar Westerlund <assar@sics.se>
+
+ * xdbm.h: also try <db.h> with DB_DBM_HSEARCH == 1
+
+ * strnlen.c (strnlen): update prototype
+
+ * Makefile.am: strndup.c: add
+
+ * Makefile.in: strndup.c: add
+
+ * roken.h.in (strndup): add
+ (strnlen): update prototype
+
+ * strndup.c: new file
+
+Fri Apr 16 17:59:30 1999 Assar Westerlund <assar@sics.se>
+
+ * roken.h.in: include strsep prototype if needed
+
+Thu Apr 15 14:04:03 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: make make-print-version.o depend on version.h
+
+Wed Apr 7 14:11:00 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: make it compile w/o krb4
+
+Sat Mar 27 17:33:03 1999 Johan Danielsson <joda@blubb.pdc.kth.se>
+
+ * snprintf.c (vasnprintf): correct check if realloc returns NULL
+
+Sat Mar 27 12:37:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: link print_version with -ldes to avoid unresolved
+ references if -lkrb is shared
+
+Sat Mar 20 03:42:30 1999 Assar Westerlund <assar@sics.se>
+
+ * roken-common.h (eread, ewrite): add
+
+ * simple_exec.c: add <roken.h>
+
+Fri Mar 19 21:29:58 1999 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in: add eread, ewrite
+
+ * eread.c, ewrite.c: new files
+
+ * Makefile.am (libroken_la_SOURCES): add eread and ewrite
+
+Fri Mar 19 14:52:57 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: add version-info
+
+Thu Mar 18 12:53:32 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: remove include_dir hack
+
+ * Makefile.am: parse_units.h
+
+ * Makefile.am: include Makefile.am.common
+
+Sat Mar 13 23:31:35 1999 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (SOURCES): add glob.c
+
+Thu Mar 11 15:02:21 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * iruserok.c: move innetgr() to separate file
+
+ * innetgr.c: move innetgr() to separate file
+
+ * hstrerror.c (hstrerror): add const to return type
+
+ * erealloc.c: fix types in format string
+
+ * emalloc.c: fix types in format string
+
+Wed Mar 10 16:36:55 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * resolve.c: ugly fix for crays
+
+Mon Mar 8 11:52:20 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * roken.h.in: protos for {un,}setenv
+
+1999-02-16 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (SOURCES): add fnmatch
+
+ * roken-common.h (abs): add
+
+Sat Feb 13 17:12:53 1999 Assar Westerlund <assar@sics.se>
+
+ * emalloc.c, erealloc.c, estrup.c: new files
+
+ * roken.h.in (mkstemp, gethostname): also includes prototypes if
+ they are needed.
+
+1998-12-23 Assar Westerlund <assar@sics.se>
+
+ * roken.h.in: mkstemp: add prototype
+
+1998-12-20 Assar Westerlund <assar@sics.se>
+
+ * snprintf.c, iruserok.c, parse-units.c: unsigned char-correctness
+
+ * roken.h.in (inet_aton): also chedk NEED_INET_ATON_PROTO
+
+ * roken-common.h: __attribute__: check for autoconf'd
+ HAVE___ATTRIBUTE__ instead of GNUC
+
+Sun Dec 6 19:53:21 1998 Assar Westerlund <assar@sics.se>
+
+ * parse_units.c (parse_something): func is called with val == 0 if
+ no unit was given
+ (acc_flags, acc_units): update to new standard
+
+Fri Nov 27 03:09:42 1998 Assar Westerlund <assar@sics.se>
+
+ * resolve.c (stot): constify
+ (type_to_string): always declare
+ (dns_lookup_int): correct debug output
+
+Thu Nov 26 23:43:55 1998 Assar Westerlund <assar@sics.se>
+
+ * resolve.c (dns_lookup_int): send rr_class to res_search
+
+Thu Nov 26 17:09:47 1998 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * resolve.c: some cleanup
+
+ * resolve.h: add T_NAPTR
+
+Sun Nov 22 10:23:07 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (WFLAGS): set
+
+ * k_getpwnam.c (k_getpwnam): check for `struct spwd'
+
+ * k_getpwuid.c (k_getpwuid): check for `struct spwd'
+
+Tue Sep 8 05:18:31 1998 Assar Westerlund <assar@sics.se>
+
+ * recvmsg.c (recvmsg): patch from bpreece@unity.ncsu.edu
+
+Fri Sep 4 16:29:27 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * vsyslog.c: asprintf -> vasprintf
+
+Tue Aug 18 22:25:52 1998 Assar Westerlund <assar@sics.se>
+
+ * getarg.h (arg_printusage): new signature
+
+ * getarg.c (arg_printusage): new parameter `progname'. NULL means
+ __progname.
+
+Sun Aug 9 14:53:44 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * Makefile.am: net_{read,write}.c
+
+Fri Jul 24 21:56:02 1998 Assar Westerlund <assar@sics.se>
+
+ * simple_exec.c (simple_execvp): loop around waitpid when errno ==
+ EINTR
+
+Thu Jul 23 20:24:35 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * Makefile.am: net_{read,write}.c
+
+Wed Jul 22 21:38:35 1998 Assar Westerlund <assar@sics.se>
+
+ * simple_exec.c (simple_execlp): initialize `argv'
+
+Mon Jul 13 23:01:22 1998 Assar Westerlund <assar@sics.se>
+
+ * inaddr2str.c (inaddr2str): don't advance hostent->h_addr_list,
+ use a copy instead
+
+Fri Jul 10 01:20:08 1998 Assar Westerlund <assar@sics.se>
+
+ * roken.h.in (net_write, net_read): add prototypes
+
+ * Makefile.in: net_{read,write}.c: add
+
+ * net_{read,write}.c: new files
+
+Tue Jun 30 17:29:09 1998 Assar Westerlund <assar@sics.se>
+
+ * roken.h.in (issuid): add
+
+ * get_window_size.c: fix misspelling of TIOCGWINSZ and bad use of
+ fields
+
+Sun May 31 03:24:34 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c (mandoc_template): Put short and long options in
+ SYNOPSIS within the same [ ] pair.
+
+Sat May 30 00:13:01 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c (arg_printusage): try to keep options shorter than
+ column width
+
+ * get_window_size.c (get_window_size): check COLUMNS and LINES
+
+Fri May 29 00:05:04 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c (mandoc_template): Put short and long options in
+ DESCRIPTION on the same line.
+
+ * getarg.c (arg_match_long): make sure you only get an exact match
+ if the strings are the same length
+
+Thu May 14 02:23:40 1998 Assar Westerlund <assar@sics.se>
+
+ * roken.awk: stupid cray awk wants \#
+
+Fri May 1 01:29:36 1998 Assar Westerlund <assar@sics.se>
+
+ * print_version.c (print_version): according to ISO/ANSI C the
+ elements of `arg' are not constant and therefore not settable at
+ compile-time. Set the at run-time instead.
+
+Sun Apr 19 10:00:06 1998 Assar Westerlund <assar@sics.se>
+
+ * roken.h.in: include paths.h
+
+Sun Apr 5 12:30:49 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (SOURCES): add roken_gethostby.c to make solaris
+ make happy
+
+Thu Mar 19 20:41:25 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * simple_exec.c: Simple fork+exec system() replacement.
+
+Fri Mar 6 00:21:53 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * roken_gethostby.c: Make `roken_gethostby_setup' take url-like
+ specification instead of split up versions. Makes it easier for
+ calling applications.
+
+ * roken_gethostby.c: Another miracle of the 20th century:
+ gethostby* over HTTP.
+
+Sat Feb 21 15:18:36 1998 assar westerlund <assar@sics.se>
+
+ * parse_time.c (unparse_time_approx): new function that calls
+ `unparse_units_approx'
+
+ * parse_units.c (unparse_units_approx): new function that will
+ only print the first unit.
+
+ * Makefile.in: include parse_{time,units}
+
+Thu Feb 12 03:30:08 1998 Assar Westerlund <assar@sics.se>
+
+ * parse_time.c (print_time_table): don't return a void value.
+
+Tue Feb 3 11:06:24 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c (mandoc_template): Change date format to full month
+ name, and day of month without leading zero.
+
+Thu Jan 22 21:23:23 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c: Fix long form of negative flags.
+
+Mon Dec 29 23:31:10 1997 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * roken.h.in: Include <err.h>, to get linux __progname.
+
+Sun Dec 21 09:45:18 1997 Assar Westerlund <assar@sics.se>
+
+ * parse_time.c (print_time_table): new function
+
+ * parse_units.c (print_flags_table, print_units_table): new
+ functions.
+
+Thu Dec 4 02:51:46 1997 Assar Westerlund <assar@sics.se>
+
+ * iruserok.c: moved here.
+
+ * snprintf.c (sn_append_char): don't write any terminating zero.
+ (as_reserve): don't loop. better heuristic for how much space to
+ realloc.
+ (vasnprintf): simplify initializing to one.
+
+Sun Nov 30 14:56:59 1997 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * getarg.c: Add mandoc help back-end to getarg.
+
+Wed Nov 12 01:09:17 1997 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * verr.c, verrx.c: Fix warnings by moving exit from.
+
+Tue Nov 11 21:12:09 1997 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * parse_units.c: Change the list of separating characters (between
+ units) to comma, space, and tab, removing digits. Having digits in
+ this list makes a flag like `T42 generate a parse error. This
+ change makes `17m3s' an invalid time-spec (you need a space).
+
+Tue Nov 11 02:38:44 1997 Assar Westerlund <assar@sics.se>
+
+ * roken.h: add <sys/socket.h>
+
+Sun Nov 9 04:48:46 1997 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * fnmatch.c: Add fnmatch from NetBSD
+
+Sun Nov 9 02:00:08 1997 Assar Westerlund <assar@sics.se>
+
+ * parse_units.c (parse_something): ignore white-space and ','
+
+Mon Nov 3 22:38:32 1997 Assar Westerlund <assar@sics.se>
+
+ * roken.h: fclose prototype
+
+ * roken.h: add prototype for vsyslog
+
+ * Makefile.in: add some more source files to make soriasis make
+ happy
+
+Sat Nov 1 00:19:21 1997 Assar Westerlund <assar@sics.se>
+
+ * roken.h: include <sys/uio.h> and <errno.h>.
+ prototypes for readv and writev
+
+ * readv.c, writev.c: new files
+
+Wed Oct 29 02:21:38 1997 Assar Westerlund <assar@sics.se>
+
+ * roken.h: Add ugly macros for openlog, gethostbyname,
+ gethostbyaddr, and getservbyname for the benefit of Crays. Add
+ default definition of MAXPATHLEN
diff --git a/crypto/kerberosIV/lib/roken/Makefile.am b/crypto/kerberosIV/lib/roken/Makefile.am
new file mode 100644
index 0000000..7f1e06e
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/Makefile.am
@@ -0,0 +1,157 @@
+# $Id: Makefile.am,v 1.38 1999/06/15 02:47:26 assar Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+CLEANFILES = roken.h make-roken.c print_version.h
+
+lib_LTLIBRARIES = libroken.la
+libroken_la_LDFLAGS = -version-info 0:0:0
+
+noinst_PROGRAMS = make-roken make-print-version
+
+if KRB4
+if KRB5
+## need to link with des here; otherwise, if krb4 is shared the link
+## will fail with unresolved references
+make_print_version_LDADD += $(LIB_krb4) -ldes
+endif
+endif
+
+libroken_la_SOURCES = \
+ base64.c \
+ concat.c \
+ emalloc.c \
+ eread.c \
+ erealloc.c \
+ estrdup.c \
+ ewrite.c \
+ get_default_username.c \
+ get_window_size.c \
+ getarg.c \
+ inaddr2str.c \
+ issuid.c \
+ k_getpwnam.c \
+ k_getpwuid.c \
+ mini_inetd.c \
+ net_read.c \
+ net_write.c \
+ parse_time.c \
+ parse_units.c \
+ parse_units.h \
+ print_version.c \
+ resolve.c \
+ roken_gethostby.c \
+ signal.c \
+ simple_exec.c \
+ snprintf.c \
+ strcat_truncate.c \
+ strcpy_truncate.c \
+ tm2time.c \
+ verify.c \
+ warnerr.c \
+ xdbm.h
+
+EXTRA_libroken_la_SOURCES = \
+ chown.c \
+ daemon.c \
+ err.c \
+ err.h \
+ errx.c \
+ fchown.c \
+ flock.c \
+ fnmatch.c \
+ fnmatch.h \
+ getdtablesize.c \
+ getegid.c \
+ geteuid.c \
+ getgid.c \
+ gethostname.c \
+ getopt.c \
+ gettimeofday.c \
+ getuid.c \
+ getusershell.c \
+ glob.h \
+ hstrerror.c \
+ inet_aton.c \
+ initgroups.c \
+ innetgr.c \
+ iruserok.c \
+ lstat.c \
+ memmove.c \
+ mkstemp.c \
+ putenv.c \
+ rcmd.c \
+ readv.c \
+ recvmsg.c \
+ sendmsg.c \
+ setegid.c \
+ setenv.c \
+ seteuid.c \
+ strcasecmp.c \
+ strdup.c \
+ strerror.c \
+ strftime.c \
+ strlwr.c \
+ strncasecmp.c \
+ strndup.c \
+ strnlen.c \
+ strsep.c \
+ strtok_r.c \
+ strupr.c \
+ swab.c \
+ unsetenv.c \
+ verr.c \
+ verrx.c \
+ vsyslog.c \
+ vwarn.c \
+ vwarnx.c \
+ warn.c \
+ warnx.c \
+ writev.c
+
+EXTRA_DIST = resource.h roken.awk roken.def roken.dsp roken.h.in \
+ roken.mak roken.rc
+
+
+
+libroken_la_LIBADD = @LTLIBOBJS@
+
+$(LTLIBOBJS) $(libroken_la_OBJECTS): roken.h
+
+include_HEADERS = $(err_h) base64.h getarg.h parse_time.h parse_units.h \
+ resolve.h roken.h roken-common.h
+
+build_HEADERZ = $(err_h) $(fnmatch_h) $(glob_h) xdbm.h
+
+if have_err_h
+err_h =
+else
+err_h = err.h
+endif
+
+if have_fnmatch_h
+fnmatch_h =
+else
+fnmatch_h = fnmatch.h
+endif
+
+if have_glob_h
+glob_h =
+else
+glob_h = glob.h
+endif
+
+roken.h: make-roken
+ @./make-roken > tmp.h ;\
+ if [ -f roken.h ] && cmp -s tmp.h roken.h ; then rm -f tmp.h ; \
+ else rm -f roken.h; mv tmp.h roken.h; fi
+
+make-roken.c: roken.h.in roken.awk
+ $(AWK) -f $(srcdir)/roken.awk $(srcdir)/roken.h.in > make-roken.c
+
+print_version.lo: print_version.h
+
+print_version.h: make-print-version
+ ./make-print-version print_version.h
+
+make-print-version.o: $(top_builddir)/include/version.h
diff --git a/crypto/kerberosIV/lib/roken/Makefile.in b/crypto/kerberosIV/lib/roken/Makefile.in
index 26f3142..1226913 100644
--- a/crypto/kerberosIV/lib/roken/Makefile.in
+++ b/crypto/kerberosIV/lib/roken/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.34 1997/05/28 05:23:39 assar Exp $
+# $Id: Makefile.in,v 1.69 1999/06/15 03:14:11 assar Exp $
#
SHELL = /bin/sh
@@ -8,11 +8,14 @@ srcdir = @srcdir@
VPATH = @srcdir@
CC = @CC@
+LINK = @LINK@
CPP = @CPP@
AR = ar
RANLIB = @RANLIB@
DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
+AWK = @AWK@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -21,7 +24,7 @@ MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
-
+EXECSUFFIX = @EXECSUFFIX@
PICFLAGS = # @PICFLAGS@
LIBNAME = $(LIBPREFIX)roken
@@ -33,40 +36,138 @@ LDSHARED = @LDSHARED@
LIB = $(LIBNAME).$(LIBEXT)
SOURCES = \
- chown.c daemon.c err.c errx.c fchown.c get_window_size.c \
- getcwd.c getdtablesize.c getopt.c getusershell.c \
- hstrerror.c inaddr2str.c inet_aton.c \
- initgroups.c k_getpwnam.c k_getpwuid.c lstat.c \
- memmove.c mini_inetd.c mkstemp.c putenv.c rcmd.c setegid.c \
- setenv.c seteuid.c signal.c snprintf.c \
- strcasecmp.c strdup.c strerror.c strftime.c \
- strlwr.c strnlen.c strtok_r.c strupr.c tm2time.c \
- unsetenv.c verify.c verr.c verrx.c vwarn.c \
- vwarnx.c warn.c warnerr.c warnx.c
-
-OBJECTS = k_getpwuid.o k_getpwnam.o signal.o tm2time.o \
- verify.o inaddr2str.o mini_inetd.o get_window_size.o \
- warnerr.o snprintf.o @LIBOBJS@
-
-all: $(LIB)
+ base64.c \
+ chown.c \
+ concat.c \
+ daemon.c \
+ emalloc.c \
+ erealloc.c \
+ estrdup.c \
+ eread.c \
+ err.c \
+ errx.c \
+ ewrite.c \
+ fchown.c \
+ flock.c \
+ fnmatch.c \
+ get_window_size.c \
+ getarg.c \
+ getcwd.c \
+ get_default_username.c \
+ getdtablesize.c \
+ gethostname.c \
+ getopt.c \
+ getusershell.c \
+ glob.c \
+ hstrerror.c \
+ inaddr2str.c \
+ inet_aton.c \
+ initgroups.c \
+ iruserok.c \
+ issuid.c \
+ k_getpwnam.c \
+ k_getpwuid.c \
+ lstat.c \
+ memmove.c \
+ mini_inetd.c \
+ mkstemp.c \
+ net_read.c \
+ net_write.c \
+ parse_time.c \
+ parse_units.c \
+ print_version.c \
+ putenv.c \
+ resolve.c \
+ rcmd.c \
+ roken_gethostby.c \
+ readv.c \
+ setegid.c \
+ setenv.c \
+ seteuid.c \
+ signal.c \
+ simple_exec.c \
+ snprintf.c \
+ strcasecmp.c \
+ strcat_truncate.c \
+ strcpy_truncate.c \
+ strdup.c \
+ strerror.c \
+ strftime.c \
+ strlwr.c \
+ strncasecmp.c \
+ strndup.c \
+ strnlen.c \
+ strsep.c \
+ strtok_r.c \
+ strupr.c \
+ tm2time.c \
+ unsetenv.c \
+ verify.c \
+ verr.c \
+ verrx.c \
+ vsyslog.c \
+ vwarn.c \
+ vwarnx.c \
+ warn.c \
+ warnerr.c \
+ warnx.c
+
+EXTRA_SOURCES = \
+ make-print-version.c
+
+OBJECTS = \
+ base64.o \
+ concat.o \
+ emalloc.o \
+ eread.o \
+ erealloc.o \
+ estrdup.o \
+ ewrite.o \
+ get_default_username.o \
+ get_window_size.o \
+ getarg.o \
+ inaddr2str.o \
+ issuid.o \
+ k_getpwnam.o \
+ k_getpwuid.o \
+ mini_inetd.o \
+ net_read.o \
+ net_write.o \
+ parse_time.o \
+ parse_units.o \
+ print_version.o \
+ resolve.o \
+ roken_gethostby.o \
+ strcat_truncate.o \
+ strcpy_truncate.o \
+ signal.o \
+ simple_exec.o \
+ snprintf.o \
+ tm2time.o \
+ verify.o \
+ warnerr.o \
+ @LIBOBJS@
+
+all: $(LIB) install-roken-h
Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I. -I../../include -I$(srcdir) $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
uninstall:
-TAGS: $(SOURCES)
- etags $(SOURCES)
+TAGS: $(SOURCES) $(EXTRA_SOURCES)
+ etags $(SOURCES) $(EXTRA_SOURCES)
check:
clean:
- rm -f $(LIB) *.o *.a
+ rm -f $(LIB) *.o *.a roken.h make-roken$(EXECSUFFIX) make-roken.c \
+ make-print-version$(EXECSUFFIX) print_version.h
mostlyclean: clean
@@ -76,12 +177,6 @@ distclean: clean
realclean: distclean
rm -f TAGS
-dist: $(DISTFILES)
- for file in $(DISTFILES); do \
- ln $$file ../`cat ../.fname`/lib \
- || cp -p $$file ../`cat ../.fname`/lib; \
- done
-
$(LIBNAME).a: $(OBJECTS)
rm -f $@
$(AR) cr $@ $(OBJECTS)
@@ -91,4 +186,31 @@ $(LIBNAME).$(SHLIBEXT): $(OBJECTS)
rm -f $@
$(LDSHARED) -o $@ $(OBJECTS)
-$(OBJECTS): ../../include/config.h
+roken.h: make-roken$(EXECSUFFIX)
+ @./make-roken > tmp.h ;\
+ if [ -f roken.h ] && cmp -s tmp.h roken.h ; then rm -f tmp.h ; \
+ else rm -f roken.h; mv tmp.h roken.h; fi
+
+make-roken$(EXECSUFFIX): make-roken.o
+ $(LINK) $(CFLAGS) -o $@ make-roken.o
+
+make-roken.c: roken.h.in roken.awk
+ $(AWK) -f $(srcdir)/roken.awk $(srcdir)/roken.h.in > make-roken.c
+
+print_version.o: print_version.h
+
+print_version.h: make-print-version$(EXECSUFFIX)
+ @./make-print-version$(EXECSUFFIX) print_version.h
+
+make-print-version$(EXECSUFFIX): make-print-version.o
+ $(LINK) $(CFLAGS) -o $@ make-print-version.o
+
+install-roken-h: roken.h
+ @if [ -f ../../include/roken.h ] && cmp -s ../../include/roken.h roken.h ; \
+ then :; else \
+ echo " $(INSTALL) roken.h ../../include/roken.h"; \
+ $(INSTALL) roken.h ../../include/roken.h; fi
+
+$(OBJECTS): ../../include/config.h roken.h
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean install-roken-h
diff --git a/crypto/kerberosIV/lib/roken/base64.c b/crypto/kerberosIV/lib/roken/base64.c
new file mode 100644
index 0000000..cbc5859
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/base64.c
@@ -0,0 +1,151 @@
+/*
+ * 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: base64.c,v 1.2 1997/12/05 02:37:15 assar Exp $");
+#endif
+#include <stdlib.h>
+#include <string.h>
+#include "base64.h"
+
+static char base64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+
+static int pos(char c)
+{
+ char *p;
+ for(p = base64; *p; p++)
+ if(*p == c)
+ return p - base64;
+ return -1;
+}
+
+int base64_encode(const void *data, int size, char **str)
+{
+ char *s, *p;
+ int i;
+ int c;
+ unsigned char *q;
+
+ p = s = (char*)malloc(size*4/3+4);
+ if (p == NULL)
+ return -1;
+ q = (unsigned char*)data;
+ i=0;
+ for(i = 0; i < size;){
+ c=q[i++];
+ c*=256;
+ if(i < size)
+ c+=q[i];
+ i++;
+ c*=256;
+ if(i < size)
+ c+=q[i];
+ i++;
+ p[0]=base64[(c&0x00fc0000) >> 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;
+ *str = s;
+ return strlen(s);
+}
+
+int base64_decode(const char *str, void *data)
+{
+ const char *p;
+ unsigned char *q;
+ int c;
+ int x;
+ int done = 0;
+ q=(unsigned char*)data;
+ for(p=str; *p && !done; p+=4){
+ x = pos(p[0]);
+ if(x >= 0)
+ c = x;
+ else{
+ done = 3;
+ break;
+ }
+ c*=64;
+
+ x = pos(p[1]);
+ if(x >= 0)
+ c += x;
+ else
+ return -1;
+ c*=64;
+
+ if(p[2] == '=')
+ done++;
+ else{
+ x = pos(p[2]);
+ if(x >= 0)
+ c += x;
+ else
+ return -1;
+ }
+ c*=64;
+
+ if(p[3] == '=')
+ done++;
+ else{
+ if(done)
+ return -1;
+ x = pos(p[3]);
+ if(x >= 0)
+ c += x;
+ else
+ return -1;
+ }
+ if(done < 3)
+ *q++=(c&0x00ff0000)>>16;
+
+ if(done < 2)
+ *q++=(c&0x0000ff00)>>8;
+ if(done < 1)
+ *q++=(c&0x000000ff)>>0;
+ }
+ return q - (unsigned char*)data;
+}
diff --git a/crypto/kerberosIV/lib/roken/base64.h b/crypto/kerberosIV/lib/roken/base64.h
new file mode 100644
index 0000000..59104ff
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/base64.h
@@ -0,0 +1,47 @@
+/*
+ * 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.1 1997/08/27 22:41:48 joda Exp $ */
+
+#ifndef _BASE64_H_
+#define _BASE64_H_
+
+int base64_encode(const void *data, int size, char **str);
+int base64_decode(const char *str, void *data);
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/concat.c b/crypto/kerberosIV/lib/roken/concat.c
new file mode 100644
index 0000000..d4177ea
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/concat.c
@@ -0,0 +1,117 @@
+/*
+ * 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: concat.c,v 1.3 1998/06/09 19:25:35 joda Exp $");
+#endif
+#include "roken.h"
+
+int
+roken_concat (char *s, size_t len, ...)
+{
+ int ret;
+ va_list args;
+
+ va_start(args, len);
+ ret = roken_vconcat (s, len, args);
+ va_end(args);
+ return ret;
+}
+
+int
+roken_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;
+ memcpy (s, a, n);
+ s += n;
+ len -= n;
+ }
+ *s = '\0';
+ return 0;
+}
+
+size_t
+roken_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;
+ 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;
+ memcpy (p + len - 1, a, n);
+ len += n;
+ }
+ p[len - 1] = '\0';
+ *s = p;
+ return len;
+}
+
+size_t
+roken_mconcat (char **s, size_t max_len, ...)
+{
+ int ret;
+ va_list args;
+
+ va_start(args, max_len);
+ ret = roken_vmconcat (s, max_len, args);
+ va_end(args);
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/daemon.c b/crypto/kerberosIV/lib/roken/daemon.c
index ffab298..758856c 100644
--- a/crypto/kerberosIV/lib/roken/daemon.c
+++ b/crypto/kerberosIV/lib/roken/daemon.c
@@ -39,7 +39,7 @@ static char sccsid[] = "@(#)daemon.c 8.1 (Berkeley) 6/4/93";
#include <config.h>
#endif
-RCSID("$Id: daemon.c,v 1.2 1997/05/28 05:38:09 assar Exp $");
+RCSID("$Id: daemon.c,v 1.3 1997/10/04 21:55:48 joda Exp $");
#ifndef HAVE_DAEMON
@@ -56,34 +56,33 @@ RCSID("$Id: daemon.c,v 1.2 1997/05/28 05:38:09 assar Exp $");
#include "roken.h"
int
-daemon(nochdir, noclose)
- int nochdir, noclose;
+daemon(int nochdir, int noclose)
{
- int fd;
+ int fd;
- switch (fork()) {
- case -1:
- return (-1);
- case 0:
- break;
- default:
- _exit(0);
- }
+ switch (fork()) {
+ case -1:
+ return (-1);
+ case 0:
+ break;
+ default:
+ _exit(0);
+ }
- if (setsid() == -1)
- return (-1);
+ if (setsid() == -1)
+ return (-1);
- if (!nochdir)
- (void)chdir("/");
+ if (!nochdir)
+ chdir("/");
- if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
- (void)dup2(fd, STDIN_FILENO);
- (void)dup2(fd, STDOUT_FILENO);
- (void)dup2(fd, STDERR_FILENO);
- if (fd > 2)
- (void)close (fd);
- }
- return (0);
+ if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
+ dup2(fd, STDIN_FILENO);
+ dup2(fd, STDOUT_FILENO);
+ dup2(fd, STDERR_FILENO);
+ if (fd > 2)
+ close (fd);
+ }
+ return (0);
}
#endif /* HAVE_DAEMON */
diff --git a/crypto/kerberosIV/lib/roken/emalloc.c b/crypto/kerberosIV/lib/roken/emalloc.c
new file mode 100644
index 0000000..a5740a9
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/emalloc.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: emalloc.c,v 1.3 1999/03/11 14:02:20 joda Exp $");
+#endif
+
+#include <stdlib.h>
+#include <err.h>
+
+#include <roken.h>
+
+/*
+ * Like malloc but never fails.
+ */
+
+void *
+emalloc (size_t sz)
+{
+ void *tmp = malloc (sz);
+
+ if (tmp == NULL && sz != 0)
+ err (1, "malloc %lu", (unsigned long)sz);
+ return tmp;
+}
diff --git a/crypto/kerberosIV/lib/roken/eread.c b/crypto/kerberosIV/lib/roken/eread.c
new file mode 100644
index 0000000..3ea4022
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/eread.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: eread.c,v 1.1 1999/03/19 20:30:20 assar Exp $");
+#endif
+
+#include <unistd.h>
+#include <err.h>
+
+#include <roken.h>
+
+/*
+ * Like read but never fails (and never returns partial data).
+ */
+
+ssize_t
+eread (int fd, void *buf, size_t nbytes)
+{
+ ssize_t ret;
+
+ ret = net_read (fd, buf, nbytes);
+ if (ret < 0)
+ err (1, "read");
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/erealloc.c b/crypto/kerberosIV/lib/roken/erealloc.c
new file mode 100644
index 0000000..2b0b6bb
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/erealloc.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: erealloc.c,v 1.3 1999/03/11 14:02:28 joda Exp $");
+#endif
+
+#include <stdlib.h>
+#include <err.h>
+
+#include <roken.h>
+
+/*
+ * Like realloc but never fails.
+ */
+
+void *
+erealloc (void *ptr, size_t sz)
+{
+ void *tmp = realloc (ptr, sz);
+
+ if (tmp == NULL && sz != 0)
+ err (1, "realloc %lu", (unsigned long)sz);
+ return tmp;
+}
diff --git a/crypto/kerberosIV/lib/roken/err.h b/crypto/kerberosIV/lib/roken/err.h
index 6f25435..a134949 100644
--- a/crypto/kerberosIV/lib/roken/err.h
+++ b/crypto/kerberosIV/lib/roken/err.h
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-/* $Id: err.h,v 1.13 1997/05/02 14:29:30 assar Exp $ */
+/* $Id: err.h,v 1.14 1997/11/12 00:08:57 joda Exp $ */
#ifndef __ERR_H__
#define __ERR_H__
@@ -53,8 +53,8 @@ extern const char *__progname;
#define __attribute__(x)
#endif
-void warnerr(int doexit, int eval, int doerrno, const char *fmt, va_list ap)
- __attribute__ ((format (printf, 4, 0)));
+void warnerr(int doerrno, const char *fmt, va_list ap)
+ __attribute__ ((format (printf, 2, 0)));
void verr(int eval, const char *fmt, va_list ap)
__attribute__ ((noreturn, format (printf, 2, 0)));
diff --git a/crypto/kerberosIV/lib/roken/estrdup.c b/crypto/kerberosIV/lib/roken/estrdup.c
new file mode 100644
index 0000000..7f3bae3
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/estrdup.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: estrdup.c,v 1.1 1999/02/13 05:13:06 assar Exp $");
+#endif
+
+#include <stdlib.h>
+#include <err.h>
+
+#include <roken.h>
+
+/*
+ * Like strdup but never fails.
+ */
+
+char *
+estrdup (const char *str)
+{
+ char *tmp = strdup (str);
+
+ if (tmp == NULL)
+ err (1, "strdup");
+ return tmp;
+}
diff --git a/crypto/kerberosIV/lib/roken/ewrite.c b/crypto/kerberosIV/lib/roken/ewrite.c
new file mode 100644
index 0000000..d1ffba4
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/ewrite.c
@@ -0,0 +1,62 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: ewrite.c,v 1.1 1999/03/19 20:30:21 assar Exp $");
+#endif
+
+#include <unistd.h>
+#include <err.h>
+
+#include <roken.h>
+
+/*
+ * Like write but never fails (and never returns partial data).
+ */
+
+ssize_t
+ewrite (int fd, const void *buf, size_t nbytes)
+{
+ ssize_t ret;
+
+ ret = net_write (fd, buf, nbytes);
+ if (ret < 0)
+ err (1, "write");
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/flock.c b/crypto/kerberosIV/lib/roken/flock.c
new file mode 100644
index 0000000..b8fbfc3
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/flock.c
@@ -0,0 +1,92 @@
+/*
+ * 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>
+#endif
+
+#ifndef HAVE_FLOCK
+RCSID("$Id: flock.c,v 1.3 1997/12/11 15:02:20 bg Exp $");
+
+#include "roken.h"
+
+
+#define OP_MASK (LOCK_SH | LOCK_EX | LOCK_UN)
+
+int
+flock(int fd, int operation)
+{
+#if 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 & LOCK_NB)
+ cmd = F_SETLK;
+ else
+ cmd = F_SETLKW; /* Blocking */
+
+ switch (operation & OP_MASK) {
+ case LOCK_UN:
+ arg.l_type = F_UNLCK;
+ code = fcntl(fd, F_SETLK, &arg);
+ break;
+ case LOCK_SH:
+ arg.l_type = F_RDLCK;
+ code = fcntl(fd, cmd, &arg);
+ break;
+ case 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
+}
+
+#endif
+
diff --git a/crypto/kerberosIV/lib/roken/fnmatch.c b/crypto/kerberosIV/lib/roken/fnmatch.c
new file mode 100644
index 0000000..dc01d6e
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/fnmatch.c
@@ -0,0 +1,173 @@
+/* $NetBSD: fnmatch.c,v 1.11 1995/02/27 03:43:06 cgd Exp $ */
+
+/*
+ * Copyright (c) 1989, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#if defined(LIBC_SCCS) && !defined(lint)
+#if 0
+static char sccsid[] = "@(#)fnmatch.c 8.2 (Berkeley) 4/16/94";
+#else
+static char rcsid[] = "$NetBSD: fnmatch.c,v 1.11 1995/02/27 03:43:06 cgd Exp $";
+#endif
+#endif /* LIBC_SCCS and not lint */
+
+/*
+ * Function fnmatch() as specified in POSIX 1003.2-1992, section B.6.
+ * Compares a filename or pathname to a pattern.
+ */
+
+#include <fnmatch.h>
+#include <string.h>
+
+#define EOS '\0'
+
+static const char *rangematch (const char *, int, int);
+
+int
+fnmatch(const char *pattern, const char *string, int flags)
+{
+ const char *stringstart;
+ char c, test;
+
+ for (stringstart = string;;)
+ switch (c = *pattern++) {
+ case EOS:
+ return (*string == EOS ? 0 : FNM_NOMATCH);
+ case '?':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && (flags & FNM_PATHNAME))
+ return (FNM_NOMATCH);
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+ ++string;
+ break;
+ case '*':
+ c = *pattern;
+ /* Collapse multiple stars. */
+ while (c == '*')
+ c = *++pattern;
+
+ if (*string == '.' && (flags & FNM_PERIOD) &&
+ (string == stringstart ||
+ ((flags & FNM_PATHNAME) && *(string - 1) == '/')))
+ return (FNM_NOMATCH);
+
+ /* Optimize for pattern with * at end or before /. */
+ if (c == EOS)
+ if (flags & FNM_PATHNAME)
+ return (strchr(string, '/') == NULL ?
+ 0 : FNM_NOMATCH);
+ else
+ return (0);
+ else if (c == '/' && flags & FNM_PATHNAME) {
+ if ((string = strchr(string, '/')) == NULL)
+ return (FNM_NOMATCH);
+ break;
+ }
+
+ /* General case, use recursion. */
+ while ((test = *string) != EOS) {
+ if (!fnmatch(pattern, string, flags & ~FNM_PERIOD))
+ return (0);
+ if (test == '/' && flags & FNM_PATHNAME)
+ break;
+ ++string;
+ }
+ return (FNM_NOMATCH);
+ case '[':
+ if (*string == EOS)
+ return (FNM_NOMATCH);
+ if (*string == '/' && flags & FNM_PATHNAME)
+ return (FNM_NOMATCH);
+ if ((pattern =
+ rangematch(pattern, *string, flags)) == NULL)
+ return (FNM_NOMATCH);
+ ++string;
+ break;
+ case '\\':
+ if (!(flags & FNM_NOESCAPE)) {
+ if ((c = *pattern++) == EOS) {
+ c = '\\';
+ --pattern;
+ }
+ }
+ /* FALLTHROUGH */
+ default:
+ if (c != *string++)
+ return (FNM_NOMATCH);
+ break;
+ }
+ /* NOTREACHED */
+}
+
+static const char *
+rangematch(const char *pattern, int test, int flags)
+{
+ int negate, ok;
+ char c, c2;
+
+ /*
+ * A bracket expression starting with an unquoted circumflex
+ * character produces unspecified results (IEEE 1003.2-1992,
+ * 3.13.2). This implementation treats it like '!', for
+ * consistency with the regular expression syntax.
+ * J.T. Conklin (conklin@ngai.kaleida.com)
+ */
+ if (negate = (*pattern == '!' || *pattern == '^'))
+ ++pattern;
+
+ for (ok = 0; (c = *pattern++) != ']';) {
+ if (c == '\\' && !(flags & FNM_NOESCAPE))
+ c = *pattern++;
+ if (c == EOS)
+ return (NULL);
+ if (*pattern == '-'
+ && (c2 = *(pattern+1)) != EOS && c2 != ']') {
+ pattern += 2;
+ if (c2 == '\\' && !(flags & FNM_NOESCAPE))
+ c2 = *pattern++;
+ if (c2 == EOS)
+ return (NULL);
+ if (c <= test && test <= c2)
+ ok = 1;
+ } else if (c == test)
+ ok = 1;
+ }
+ return (ok == negate ? NULL : pattern);
+}
diff --git a/crypto/kerberosIV/lib/roken/fnmatch.h b/crypto/kerberosIV/lib/roken/fnmatch.h
new file mode 100644
index 0000000..95c91d6
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/fnmatch.h
@@ -0,0 +1,49 @@
+/* $NetBSD: fnmatch.h,v 1.5 1994/10/26 00:55:53 cgd Exp $ */
+
+/*-
+ * Copyright (c) 1992, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)fnmatch.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _FNMATCH_H_
+#define _FNMATCH_H_
+
+#define FNM_NOMATCH 1 /* Match failed. */
+
+#define FNM_NOESCAPE 0x01 /* Disable backslash escaping. */
+#define FNM_PATHNAME 0x02 /* Slash must be matched by slash. */
+#define FNM_PERIOD 0x04 /* Period must be matched by period. */
+
+int fnmatch (const char *, const char *, int);
+
+#endif /* !_FNMATCH_H_ */
diff --git a/crypto/kerberosIV/lib/roken/get_default_username.c b/crypto/kerberosIV/lib/roken/get_default_username.c
new file mode 100644
index 0000000..209bcf0
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/get_default_username.c
@@ -0,0 +1,85 @@
+/*
+ * Copyright (c) 1997 - 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: get_default_username.c,v 1.1.2.1 1999/07/22 03:19:27 assar Exp $");
+#endif /* HAVE_CONFIG_H */
+
+#include "roken.h"
+
+/*
+ * Try to return what should be considered the default username or
+ * NULL if we can't guess at all.
+ */
+
+const char *
+get_default_username (void)
+{
+ const char *user;
+
+ user = getenv ("USER");
+ if (user == NULL)
+ user = getenv ("LOGNAME");
+ if (user == NULL)
+ user = getenv ("USERNAME");
+
+#if defined(HAVE_GETLOGIN) && !defined(POSIX_GETLOGIN)
+ if (user == NULL) {
+ user = (const char *)getlogin ();
+ if (user != NULL)
+ return user;
+ }
+#endif
+#ifdef HAVE_PWD_H
+ {
+ uid_t uid = getuid ();
+ struct passwd *pwd;
+
+ if (user != NULL) {
+ pwd = k_getpwnam ((char *)user);
+ if (pwd != NULL && pwd->pw_uid == uid)
+ return user;
+ }
+ pwd = k_getpwuid (uid);
+ if (pwd != NULL)
+ return pwd->pw_name;
+ }
+#endif
+ return user;
+}
diff --git a/crypto/kerberosIV/lib/roken/get_window_size.c b/crypto/kerberosIV/lib/roken/get_window_size.c
index d31d18d..4ac3e53 100644
--- a/crypto/kerberosIV/lib/roken/get_window_size.c
+++ b/crypto/kerberosIV/lib/roken/get_window_size.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: get_window_size.c,v 1.4 1997/04/01 08:18:59 joda Exp $");
+RCSID("$Id: get_window_size.c,v 1.8 1998/07/31 09:40:21 bg Exp $");
#endif
#include <stdlib.h>
@@ -68,29 +68,40 @@ RCSID("$Id: get_window_size.c,v 1.4 1997/04/01 08:18:59 joda Exp $");
int
get_window_size(int fd, struct winsize *wp)
{
+ int ret = -1;
+
+ memset(wp, 0, sizeof(*wp));
+
#if defined(TIOCGWINSZ)
- return ioctl(fd, TIOCGWINSZ, wp);
+ ret = ioctl(fd, TIOCGWINSZ, wp);
#elif defined(TIOCGSIZE)
- struct ttysize ts;
- int error;
-
- if ((error = ioctl(0, TIOCGSIZE, &ts)) != 0)
- return (error);
- wp->ws_row = ts.ts_lines;
- wp->ws_col = ts.ts_cols;
- wp->ws_xpixel = 0;
- wp->ws_ypixel = 0;
- return 0;
+ {
+ struct ttysize ts;
+
+ ret = ioctl(fd, TIOCGSIZE, &ts);
+ if(ret == 0) {
+ wp->ws_row = ts.ts_lines;
+ wp->ws_col = ts.ts_cols;
+ }
+ }
#elif defined(HAVE__SCRSIZE)
- int dst[2];
-
- _scrsize(dst);
- wp->ws_row = dst[1];
- wp->ws_col = dst[0];
- wp->ws_xpixel = 0;
- wp->ws_ypixel = 0;
- return 0;
-#else
- return -1;
+ {
+ int dst[2];
+
+ _scrsize(dst);
+ wp->ws_row = dst[1];
+ wp->ws_col = dst[0];
+ ret = 0;
+ }
#endif
+ if (ret != 0) {
+ char *s;
+ if((s = getenv("COLUMNS")))
+ wp->ws_col = atoi(s);
+ if((s = getenv("LINES")))
+ wp->ws_row = atoi(s);
+ if(wp->ws_col > 0 && wp->ws_row > 0)
+ ret = 0;
+ }
+ return ret;
}
diff --git a/crypto/kerberosIV/lib/roken/getarg.c b/crypto/kerberosIV/lib/roken/getarg.c
new file mode 100644
index 0000000..7de5b55
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/getarg.c
@@ -0,0 +1,488 @@
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: getarg.c,v 1.25 1998/11/22 09:45:05 assar Exp $");
+#endif
+
+#include <stdio.h>
+#include <roken.h>
+#include "getarg.h"
+
+#define ISFLAG(X) ((X).type == arg_flag || (X).type == arg_negative_flag)
+
+static size_t
+print_arg (char *string, size_t len, int mdoc, int longp, struct getargs *arg)
+{
+ const char *s;
+
+ *string = '\0';
+
+ if (ISFLAG(*arg))
+ return 0;
+
+ if(mdoc){
+ if(longp)
+ strcat_truncate(string, "= Ns", len);
+ strcat_truncate(string, " Ar ", len);
+ }else
+ if (longp)
+ strcat_truncate (string, "=", len);
+ else
+ strcat_truncate (string, " ", len);
+
+ if (arg->arg_help)
+ s = arg->arg_help;
+ else if (arg->type == arg_integer)
+ s = "number";
+ else if (arg->type == arg_string)
+ s = "string";
+ else
+ s = "<undefined>";
+
+ strcat_truncate(string, s, len);
+ return 1 + strlen(s);
+}
+
+static void
+mandoc_template(struct getargs *args,
+ size_t num_args,
+ const char *progname,
+ const char *extra_string)
+{
+ int i;
+ char timestr[64], cmd[64];
+ char buf[128];
+ const char *p;
+ time_t t;
+
+ printf(".\\\" Things to fix:\n");
+ printf(".\\\" * correct section, and operating system\n");
+ printf(".\\\" * remove Op from mandatory flags\n");
+ printf(".\\\" * use better macros for arguments (like .Pa for files)\n");
+ printf(".\\\"\n");
+ t = time(NULL);
+ strftime(timestr, sizeof(timestr), "%B %e, %Y", localtime(&t));
+ printf(".Dd %s\n", timestr);
+ p = strrchr(progname, '/');
+ if(p) p++; else p = progname;
+ strcpy_truncate(cmd, p, sizeof(cmd));
+ strupr(cmd);
+
+ printf(".Dt %s SECTION\n", cmd);
+ printf(".Os OPERATING_SYSTEM\n");
+ printf(".Sh NAME\n");
+ printf(".Nm %s\n", p);
+ printf(".Nd\n");
+ printf("in search of a description\n");
+ printf(".Sh SYNOPSIS\n");
+ printf(".Nm\n");
+ for(i = 0; i < num_args; i++){
+ /* we seem to hit a limit on number of arguments if doing
+ short and long flags with arguments -- split on two lines */
+ if(ISFLAG(args[i]) ||
+ args[i].short_name == 0 || args[i].long_name == NULL) {
+ printf(".Op ");
+
+ if(args[i].short_name) {
+ print_arg(buf, sizeof(buf), 1, 0, args + i);
+ printf("Fl %c%s", args[i].short_name, buf);
+ if(args[i].long_name)
+ printf(" | ");
+ }
+ if(args[i].long_name) {
+ print_arg(buf, sizeof(buf), 1, 1, args + i);
+ printf("Fl -%s%s", args[i].long_name, buf);
+ }
+ printf("\n");
+ } else {
+ print_arg(buf, sizeof(buf), 1, 0, args + i);
+ printf(".Oo Fl %c%s \\*(Ba Xo\n", args[i].short_name, buf);
+ print_arg(buf, sizeof(buf), 1, 1, args + i);
+ printf(".Fl -%s%s Oc\n.Xc\n", args[i].long_name, buf);
+ }
+ /*
+ if(args[i].type == arg_strings)
+ fprintf (stderr, "...");
+ */
+ }
+ if (extra_string && *extra_string)
+ printf (".Ar %s\n", extra_string);
+ printf(".Sh DESCRIPTION\n");
+ printf("Supported options:\n");
+ printf(".Bl -tag -width Ds\n");
+ for(i = 0; i < num_args; i++){
+ printf(".It Xo\n");
+ if(args[i].short_name){
+ printf(".Fl %c", args[i].short_name);
+ print_arg(buf, sizeof(buf), 1, 0, args + i);
+ printf("%s", buf);
+ if(args[i].long_name)
+ printf(" Ns ,");
+ printf("\n");
+ }
+ if(args[i].long_name){
+ printf(".Fl -%s", args[i].long_name);
+ print_arg(buf, sizeof(buf), 1, 1, args + i);
+ printf("%s\n", buf);
+ }
+ printf(".Xc\n");
+ if(args[i].help)
+ printf("%s\n", args[i].help);
+ /*
+ if(args[i].type == arg_strings)
+ fprintf (stderr, "...");
+ */
+ }
+ printf(".El\n");
+ printf(".\\\".Sh ENVIRONMENT\n");
+ printf(".\\\".Sh FILES\n");
+ printf(".\\\".Sh EXAMPLES\n");
+ printf(".\\\".Sh DIAGNOSTICS\n");
+ printf(".\\\".Sh SEE ALSO\n");
+ printf(".\\\".Sh STANDARDS\n");
+ printf(".\\\".Sh HISTORY\n");
+ printf(".\\\".Sh AUTHORS\n");
+ printf(".\\\".Sh BUGS\n");
+}
+
+static int
+check_column(FILE *f, int col, int len, int columns)
+{
+ if(col + len > columns) {
+ fprintf(f, "\n");
+ col = fprintf(f, " ");
+ }
+ return col;
+}
+
+void
+arg_printusage (struct getargs *args,
+ size_t num_args,
+ const char *progname,
+ const char *extra_string)
+{
+ int i;
+ size_t max_len = 0;
+ char buf[128];
+ int col = 0, columns;
+ struct winsize ws;
+
+ if (progname == NULL)
+ progname = __progname;
+
+ if(getenv("GETARGMANDOC")){
+ mandoc_template(args, num_args, progname, extra_string);
+ return;
+ }
+ if(get_window_size(2, &ws) == 0)
+ columns = ws.ws_col;
+ else
+ columns = 80;
+ col = 0;
+ col += fprintf (stderr, "Usage: %s", progname);
+ for (i = 0; i < num_args; ++i) {
+ size_t len = 0;
+
+ if (args[i].long_name) {
+ buf[0] = '\0';
+ strcat_truncate(buf, "[--", sizeof(buf));
+ len += 2;
+ if(args[i].type == arg_negative_flag) {
+ strcat_truncate(buf, "no-", sizeof(buf));
+ len += 3;
+ }
+ strcat_truncate(buf, args[i].long_name, sizeof(buf));
+ len += strlen(args[i].long_name);
+ len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
+ 0, 1, &args[i]);
+ strcat_truncate(buf, "]", sizeof(buf));
+ if(args[i].type == arg_strings)
+ strcat_truncate(buf, "...", sizeof(buf));
+ col = check_column(stderr, col, strlen(buf) + 1, columns);
+ col += fprintf(stderr, " %s", buf);
+ }
+ if (args[i].short_name) {
+ snprintf(buf, sizeof(buf), "[-%c", args[i].short_name);
+ len += 2;
+ len += print_arg(buf + strlen(buf), sizeof(buf) - strlen(buf),
+ 0, 0, &args[i]);
+ strcat_truncate(buf, "]", sizeof(buf));
+ if(args[i].type == arg_strings)
+ strcat_truncate(buf, "...", sizeof(buf));
+ col = check_column(stderr, col, strlen(buf) + 1, columns);
+ col += fprintf(stderr, " %s", buf);
+ }
+ if (args[i].long_name && args[i].short_name)
+ len += 2; /* ", " */
+ max_len = max(max_len, len);
+ }
+ if (extra_string) {
+ col = check_column(stderr, col, strlen(extra_string) + 1, columns);
+ fprintf (stderr, " %s\n", extra_string);
+ } else
+ fprintf (stderr, "\n");
+ for (i = 0; i < num_args; ++i) {
+ if (args[i].help) {
+ size_t count = 0;
+
+ if (args[i].short_name) {
+ count += fprintf (stderr, "-%c", args[i].short_name);
+ print_arg (buf, sizeof(buf), 0, 0, &args[i]);
+ count += fprintf(stderr, "%s", buf);
+ }
+ if (args[i].short_name && args[i].long_name)
+ count += fprintf (stderr, ", ");
+ if (args[i].long_name) {
+ count += fprintf (stderr, "--");
+ if (args[i].type == arg_negative_flag)
+ count += fprintf (stderr, "no-");
+ count += fprintf (stderr, "%s", args[i].long_name);
+ print_arg (buf, sizeof(buf), 0, 1, &args[i]);
+ count += fprintf(stderr, "%s", buf);
+ }
+ while(count++ <= max_len)
+ putc (' ', stderr);
+ fprintf (stderr, "%s\n", args[i].help);
+ }
+ }
+}
+
+static void
+add_string(getarg_strings *s, char *value)
+{
+ s->strings = realloc(s->strings, (s->num_strings + 1) * sizeof(*s->strings));
+ s->strings[s->num_strings] = value;
+ s->num_strings++;
+}
+
+static int
+arg_match_long(struct getargs *args, size_t num_args,
+ char *argv)
+{
+ int i;
+ char *optarg = NULL;
+ int negate = 0;
+ int partial_match = 0;
+ struct getargs *partial = NULL;
+ struct getargs *current = NULL;
+ int argv_len;
+ char *p;
+
+ argv_len = strlen(argv);
+ p = strchr (argv, '=');
+ if (p != NULL)
+ argv_len = p - argv;
+
+ for (i = 0; i < num_args; ++i) {
+ if(args[i].long_name) {
+ int len = strlen(args[i].long_name);
+ char *p = argv;
+ int p_len = argv_len;
+ negate = 0;
+
+ for (;;) {
+ if (strncmp (args[i].long_name, p, p_len) == 0) {
+ if(p_len == len)
+ current = &args[i];
+ else {
+ ++partial_match;
+ partial = &args[i];
+ }
+ optarg = p + p_len;
+ } else if (ISFLAG(args[i]) && strncmp (p, "no-", 3) == 0) {
+ negate = !negate;
+ p += 3;
+ p_len -= 3;
+ continue;
+ }
+ break;
+ }
+ if (current)
+ break;
+ }
+ }
+ if (current == NULL) {
+ if (partial_match == 1)
+ current = partial;
+ else
+ return ARG_ERR_NO_MATCH;
+ }
+
+ if(*optarg == '\0' && !ISFLAG(*current))
+ return ARG_ERR_NO_MATCH;
+ switch(current->type){
+ case arg_integer:
+ {
+ int tmp;
+ if(sscanf(optarg + 1, "%d", &tmp) != 1)
+ return ARG_ERR_BAD_ARG;
+ *(int*)current->value = tmp;
+ return 0;
+ }
+ case arg_string:
+ {
+ *(char**)current->value = optarg + 1;
+ return 0;
+ }
+ case arg_strings:
+ {
+ add_string((getarg_strings*)current->value, optarg + 1);
+ return 0;
+ }
+ case arg_flag:
+ case arg_negative_flag:
+ {
+ int *flag = current->value;
+ if(*optarg == '\0' ||
+ strcmp(optarg + 1, "yes") == 0 ||
+ strcmp(optarg + 1, "true") == 0){
+ *flag = !negate;
+ return 0;
+ } else if (*optarg && strcmp(optarg + 1, "maybe") == 0) {
+ *flag = rand() & 1;
+ } else {
+ *flag = negate;
+ return 0;
+ }
+ return ARG_ERR_BAD_ARG;
+ }
+ default:
+ abort ();
+ }
+}
+
+int
+getarg(struct getargs *args, size_t num_args,
+ int argc, char **argv, int *optind)
+{
+ int i, j, k;
+ int ret = 0;
+
+ srand (time(NULL));
+ (*optind)++;
+ for(i = *optind; i < argc; i++) {
+ if(argv[i][0] != '-')
+ break;
+ if(argv[i][1] == '-'){
+ if(argv[i][2] == 0){
+ i++;
+ break;
+ }
+ ret = arg_match_long (args, num_args, argv[i] + 2);
+ if(ret)
+ return ret;
+ }else{
+ for(j = 1; argv[i][j]; j++) {
+ for(k = 0; k < num_args; k++) {
+ char *optarg;
+ if(args[k].short_name == 0)
+ continue;
+ if(argv[i][j] == args[k].short_name){
+ if(args[k].type == arg_flag){
+ *(int*)args[k].value = 1;
+ break;
+ }
+ if(args[k].type == arg_negative_flag){
+ *(int*)args[k].value = 0;
+ break;
+ }
+ if(argv[i][j + 1])
+ optarg = &argv[i][j + 1];
+ else{
+ i++;
+ optarg = argv[i];
+ }
+ if(optarg == NULL)
+ return ARG_ERR_NO_ARG;
+ if(args[k].type == arg_integer){
+ int tmp;
+ if(sscanf(optarg, "%d", &tmp) != 1)
+ return ARG_ERR_BAD_ARG;
+ *(int*)args[k].value = tmp;
+ goto out;
+ }else if(args[k].type == arg_string){
+ *(char**)args[k].value = optarg;
+ goto out;
+ }else if(args[k].type == arg_strings){
+ add_string((getarg_strings*)args[k].value, optarg);
+ goto out;
+ }
+ return ARG_ERR_BAD_ARG;
+ }
+
+ }
+ if (k == num_args)
+ return ARG_ERR_NO_MATCH;
+ }
+ out:;
+ }
+ }
+ *optind = i;
+ return 0;
+}
+
+#if TEST
+int foo_flag = 2;
+int flag1 = 0;
+int flag2 = 0;
+int bar_int;
+char *baz_string;
+
+struct getargs args[] = {
+ { NULL, '1', arg_flag, &flag1, "one", NULL },
+ { NULL, '2', arg_flag, &flag2, "two", NULL },
+ { "foo", 'f', arg_negative_flag, &foo_flag, "foo", NULL },
+ { "bar", 'b', arg_integer, &bar_int, "bar", "seconds"},
+ { "baz", 'x', arg_string, &baz_string, "baz", "name" },
+};
+
+int main(int argc, char **argv)
+{
+ int optind = 0;
+ while(getarg(args, 5, argc, argv, &optind))
+ printf("Bad arg: %s\n", argv[optind]);
+ printf("flag1 = %d\n", flag1);
+ printf("flag2 = %d\n", flag2);
+ printf("foo_flag = %d\n", foo_flag);
+ printf("bar_int = %d\n", bar_int);
+ printf("baz_flag = %s\n", baz_string);
+ arg_printusage (args, 5, argv[0], "nothing here");
+}
+#endif
diff --git a/crypto/kerberosIV/lib/roken/getarg.h b/crypto/kerberosIV/lib/roken/getarg.h
new file mode 100644
index 0000000..8a02fa2
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/getarg.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 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 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: getarg.h,v 1.5 1998/08/18 20:26:11 assar Exp $ */
+
+#ifndef __GETARG_H__
+#define __GETARG_H__
+
+#include <stddef.h>
+
+struct getargs{
+ const char *long_name;
+ char short_name;
+ enum { arg_integer, arg_string, arg_flag, arg_negative_flag, arg_strings } type;
+ void *value;
+ const char *help;
+ const char *arg_help;
+};
+
+enum {
+ ARG_ERR_NO_MATCH = 1,
+ ARG_ERR_BAD_ARG,
+ ARG_ERR_NO_ARG
+};
+
+typedef struct getarg_strings {
+ int num_strings;
+ char **strings;
+} getarg_strings;
+
+int getarg(struct getargs *args, size_t num_args,
+ int argc, char **argv, int *optind);
+
+void arg_printusage (struct getargs *args,
+ size_t num_args,
+ const char *progname,
+ const char *extra_string);
+
+#endif /* __GETARG_H__ */
diff --git a/crypto/kerberosIV/lib/roken/getcwd.c b/crypto/kerberosIV/lib/roken/getcwd.c
index a27451f..ac80a79 100644
--- a/crypto/kerberosIV/lib/roken/getcwd.c
+++ b/crypto/kerberosIV/lib/roken/getcwd.c
@@ -38,13 +38,16 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: getcwd.c,v 1.7 1997/04/01 08:19:00 joda Exp $");
+RCSID("$Id: getcwd.c,v 1.10 1998/06/09 19:25:36 joda Exp $");
#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
+#endif
-#include "protos.h"
#include "roken.h"
char*
@@ -54,6 +57,6 @@ getcwd(char *path, size_t size)
char *ret;
ret = getwd(xxx);
if(ret)
- strncpy(path, xxx, size);
+ strcpy_truncate(path, xxx, size);
return ret;
}
diff --git a/crypto/kerberosIV/lib/roken/getdtablesize.c b/crypto/kerberosIV/lib/roken/getdtablesize.c
index afd47d2b..029f5f6 100644
--- a/crypto/kerberosIV/lib/roken/getdtablesize.c
+++ b/crypto/kerberosIV/lib/roken/getdtablesize.c
@@ -38,12 +38,14 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: getdtablesize.c,v 1.8 1997/04/20 05:51:06 assar Exp $");
+RCSID("$Id: getdtablesize.c,v 1.9 1997/07/11 20:20:26 assar Exp $");
#endif
#include "roken.h"
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
@@ -55,7 +57,9 @@ RCSID("$Id: getdtablesize.c,v 1.8 1997/04/20 05:51:06 assar Exp $");
#ifdef HAVE_SYS_PARAM_H
#include <sys/param.h>
#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#ifdef HAVE_SYS_RESOURCE_H
#include <sys/resource.h>
diff --git a/crypto/kerberosIV/lib/roken/getegid.c b/crypto/kerberosIV/lib/roken/getegid.c
new file mode 100644
index 0000000..ba5828d
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/getegid.c
@@ -0,0 +1,53 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_GETEGID
+
+RCSID("$Id: getegid.c,v 1.1 1998/05/09 17:17:18 joda Exp $");
+
+int getegid(void)
+{
+ return getgid();
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/geteuid.c b/crypto/kerberosIV/lib/roken/geteuid.c
new file mode 100644
index 0000000..bc20d3c
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/geteuid.c
@@ -0,0 +1,53 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_GETEUID
+
+RCSID("$Id: geteuid.c,v 1.1 1998/05/09 17:17:38 joda Exp $");
+
+int geteuid(void)
+{
+ return getuid();
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/getgid.c b/crypto/kerberosIV/lib/roken/getgid.c
new file mode 100644
index 0000000..1512139
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/getgid.c
@@ -0,0 +1,53 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_GETGID
+
+RCSID("$Id: getgid.c,v 1.1 1998/05/09 17:17:29 joda Exp $");
+
+int getgid(void)
+{
+ return 17;
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/gethostname.c b/crypto/kerberosIV/lib/roken/gethostname.c
new file mode 100644
index 0000000..9795fb3
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/gethostname.c
@@ -0,0 +1,77 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_GETHOSTNAME
+
+#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
+gethostname(char *name, int namelen)
+{
+#if defined(HAVE_UNAME)
+ {
+ struct utsname utsname;
+ int ret;
+
+ ret = uname (&utsname);
+ if (ret < 0)
+ return ret;
+ strcpy_truncate (name, utsname.nodename, namelen);
+ return 0;
+ }
+#else
+ strcpy_truncate (name, "some.random.host", namelen);
+ return 0;
+#endif
+}
+
+#endif /* GETHOSTNAME */
diff --git a/crypto/kerberosIV/lib/roken/gettimeofday.c b/crypto/kerberosIV/lib/roken/gettimeofday.c
new file mode 100644
index 0000000..8752ba2
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/gettimeofday.c
@@ -0,0 +1,60 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+#ifndef HAVE_GETTIMEOFDAY
+
+RCSID("$Id: gettimeofday.c,v 1.7 1997/12/04 22:51:48 joda Exp $");
+
+/*
+ * 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/roken/getuid.c b/crypto/kerberosIV/lib/roken/getuid.c
new file mode 100644
index 0000000..1b7d70a
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/getuid.c
@@ -0,0 +1,53 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_GETUID
+
+RCSID("$Id: getuid.c,v 1.2 1997/12/04 22:51:20 joda Exp $");
+
+int getuid(void)
+{
+ return 17;
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/glob.c b/crypto/kerberosIV/lib/roken/glob.c
new file mode 100644
index 0000000..7dd6951
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/glob.c
@@ -0,0 +1,835 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * glob(3) -- a superset of the one defined in POSIX 1003.2.
+ *
+ * The [!...] convention to negate a range is supported (SysV, Posix, ksh).
+ *
+ * Optional extra services, controlled by flags not defined by POSIX:
+ *
+ * GLOB_QUOTE:
+ * Escaping convention: \ inhibits any special meaning the following
+ * character might have (except \ at end of string is retained).
+ * GLOB_MAGCHAR:
+ * Set in gl_flags if pattern contained a globbing character.
+ * GLOB_NOMAGIC:
+ * Same as GLOB_NOCHECK, but it will only append pattern if it did
+ * not contain any magic characters. [Used in csh style globbing]
+ * GLOB_ALTDIRFUNC:
+ * Use alternately specified directory access functions.
+ * GLOB_TILDE:
+ * expand ~user/foo to the /home/dir/of/user/foo
+ * GLOB_BRACE:
+ * expand {1,2}{a,b} to 1a 1b 2a 2b
+ * gl_matchc:
+ * Number of matches in the current invocation of glob.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+
+#include <ctype.h>
+#ifdef HAVE_DIRENT_H
+#include <dirent.h>
+#endif
+#include <errno.h>
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+#endif
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+
+#include "glob.h"
+#include "roken.h"
+
+#define CHAR_DOLLAR '$'
+#define CHAR_DOT '.'
+#define CHAR_EOS '\0'
+#define CHAR_LBRACKET '['
+#define CHAR_NOT '!'
+#define CHAR_QUESTION '?'
+#define CHAR_QUOTE '\\'
+#define CHAR_RANGE '-'
+#define CHAR_RBRACKET ']'
+#define CHAR_SEP '/'
+#define CHAR_STAR '*'
+#define CHAR_TILDE '~'
+#define CHAR_UNDERSCORE '_'
+#define CHAR_LBRACE '{'
+#define CHAR_RBRACE '}'
+#define CHAR_SLASH '/'
+#define CHAR_COMMA ','
+
+#ifndef DEBUG
+
+#define M_QUOTE 0x8000
+#define M_PROTECT 0x4000
+#define M_MASK 0xffff
+#define M_ASCII 0x00ff
+
+typedef u_short Char;
+
+#else
+
+#define M_QUOTE 0x80
+#define M_PROTECT 0x40
+#define M_MASK 0xff
+#define M_ASCII 0x7f
+
+typedef char Char;
+
+#endif
+
+
+#define CHAR(c) ((Char)((c)&M_ASCII))
+#define META(c) ((Char)((c)|M_QUOTE))
+#define M_ALL META('*')
+#define M_END META(']')
+#define M_NOT META('!')
+#define M_ONE META('?')
+#define M_RNG META('-')
+#define M_SET META('[')
+#define ismeta(c) (((c)&M_QUOTE) != 0)
+
+
+static int compare (const void *, const void *);
+static void g_Ctoc (const Char *, char *);
+static int g_lstat (Char *, struct stat *, glob_t *);
+static DIR *g_opendir (Char *, glob_t *);
+static Char *g_strchr (Char *, int);
+#ifdef notdef
+static Char *g_strcat (Char *, const Char *);
+#endif
+static int g_stat (Char *, struct stat *, glob_t *);
+static int glob0 (const Char *, glob_t *);
+static int glob1 (Char *, glob_t *);
+static int glob2 (Char *, Char *, Char *, glob_t *);
+static int glob3 (Char *, Char *, Char *, Char *, glob_t *);
+static int globextend (const Char *, glob_t *);
+static const Char * globtilde (const Char *, Char *, glob_t *);
+static int globexp1 (const Char *, glob_t *);
+static int globexp2 (const Char *, const Char *, glob_t *, int *);
+static int match (Char *, Char *, Char *);
+#ifdef DEBUG
+static void qprintf (const char *, Char *);
+#endif
+
+int
+glob(const char *pattern,
+ int flags,
+ int (*errfunc)(const char *, int),
+ glob_t *pglob)
+{
+ const u_char *patnext;
+ int c;
+ Char *bufnext, *bufend, patbuf[MaxPathLen+1];
+
+ patnext = (u_char *) pattern;
+ if (!(flags & GLOB_APPEND)) {
+ pglob->gl_pathc = 0;
+ pglob->gl_pathv = NULL;
+ if (!(flags & GLOB_DOOFFS))
+ pglob->gl_offs = 0;
+ }
+ pglob->gl_flags = flags & ~GLOB_MAGCHAR;
+ pglob->gl_errfunc = errfunc;
+ pglob->gl_matchc = 0;
+
+ bufnext = patbuf;
+ bufend = bufnext + MaxPathLen;
+ if (flags & GLOB_QUOTE) {
+ /* Protect the quoted characters. */
+ while (bufnext < bufend && (c = *patnext++) != CHAR_EOS)
+ if (c == CHAR_QUOTE) {
+ if ((c = *patnext++) == CHAR_EOS) {
+ c = CHAR_QUOTE;
+ --patnext;
+ }
+ *bufnext++ = c | M_PROTECT;
+ }
+ else
+ *bufnext++ = c;
+ }
+ else
+ while (bufnext < bufend && (c = *patnext++) != CHAR_EOS)
+ *bufnext++ = c;
+ *bufnext = CHAR_EOS;
+
+ if (flags & GLOB_BRACE)
+ return globexp1(patbuf, pglob);
+ else
+ return glob0(patbuf, pglob);
+}
+
+/*
+ * Expand recursively a glob {} pattern. When there is no more expansion
+ * invoke the standard globbing routine to glob the rest of the magic
+ * characters
+ */
+static int globexp1(const Char *pattern, glob_t *pglob)
+{
+ const Char* ptr = pattern;
+ int rv;
+
+ /* Protect a single {}, for find(1), like csh */
+ if (pattern[0] == CHAR_LBRACE && pattern[1] == CHAR_RBRACE && pattern[2] == CHAR_EOS)
+ return glob0(pattern, pglob);
+
+ while ((ptr = (const Char *) g_strchr((Char *) ptr, CHAR_LBRACE)) != NULL)
+ if (!globexp2(ptr, pattern, pglob, &rv))
+ return rv;
+
+ return glob0(pattern, pglob);
+}
+
+
+/*
+ * Recursive brace globbing helper. Tries to expand a single brace.
+ * If it succeeds then it invokes globexp1 with the new pattern.
+ * If it fails then it tries to glob the rest of the pattern and returns.
+ */
+static int globexp2(const Char *ptr, const Char *pattern,
+ glob_t *pglob, int *rv)
+{
+ int i;
+ Char *lm, *ls;
+ const Char *pe, *pm, *pl;
+ Char patbuf[MaxPathLen + 1];
+
+ /* copy part up to the brace */
+ for (lm = patbuf, pm = pattern; pm != ptr; *lm++ = *pm++)
+ continue;
+ ls = lm;
+
+ /* Find the balanced brace */
+ for (i = 0, pe = ++ptr; *pe; pe++)
+ if (*pe == CHAR_LBRACKET) {
+ /* Ignore everything between [] */
+ for (pm = pe++; *pe != CHAR_RBRACKET && *pe != CHAR_EOS; pe++)
+ continue;
+ if (*pe == CHAR_EOS) {
+ /*
+ * We could not find a matching CHAR_RBRACKET.
+ * Ignore and just look for CHAR_RBRACE
+ */
+ pe = pm;
+ }
+ }
+ else if (*pe == CHAR_LBRACE)
+ i++;
+ else if (*pe == CHAR_RBRACE) {
+ if (i == 0)
+ break;
+ i--;
+ }
+
+ /* Non matching braces; just glob the pattern */
+ if (i != 0 || *pe == CHAR_EOS) {
+ *rv = glob0(patbuf, pglob);
+ return 0;
+ }
+
+ for (i = 0, pl = pm = ptr; pm <= pe; pm++)
+ switch (*pm) {
+ case CHAR_LBRACKET:
+ /* Ignore everything between [] */
+ for (pl = pm++; *pm != CHAR_RBRACKET && *pm != CHAR_EOS; pm++)
+ continue;
+ if (*pm == CHAR_EOS) {
+ /*
+ * We could not find a matching CHAR_RBRACKET.
+ * Ignore and just look for CHAR_RBRACE
+ */
+ pm = pl;
+ }
+ break;
+
+ case CHAR_LBRACE:
+ i++;
+ break;
+
+ case CHAR_RBRACE:
+ if (i) {
+ i--;
+ break;
+ }
+ /* FALLTHROUGH */
+ case CHAR_COMMA:
+ if (i && *pm == CHAR_COMMA)
+ break;
+ else {
+ /* Append the current string */
+ for (lm = ls; (pl < pm); *lm++ = *pl++)
+ continue;
+ /*
+ * Append the rest of the pattern after the
+ * closing brace
+ */
+ for (pl = pe + 1; (*lm++ = *pl++) != CHAR_EOS;)
+ continue;
+
+ /* Expand the current pattern */
+#ifdef DEBUG
+ qprintf("globexp2:", patbuf);
+#endif
+ *rv = globexp1(patbuf, pglob);
+
+ /* move after the comma, to the next string */
+ pl = pm + 1;
+ }
+ break;
+
+ default:
+ break;
+ }
+ *rv = 0;
+ return 0;
+}
+
+
+
+/*
+ * expand tilde from the passwd file.
+ */
+static const Char *
+globtilde(const Char *pattern, Char *patbuf, glob_t *pglob)
+{
+ struct passwd *pwd;
+ char *h;
+ const Char *p;
+ Char *b;
+
+ if (*pattern != CHAR_TILDE || !(pglob->gl_flags & GLOB_TILDE))
+ return pattern;
+
+ /* Copy up to the end of the string or / */
+ for (p = pattern + 1, h = (char *) patbuf; *p && *p != CHAR_SLASH;
+ *h++ = *p++)
+ continue;
+
+ *h = CHAR_EOS;
+
+ if (((char *) patbuf)[0] == CHAR_EOS) {
+ /*
+ * handle a plain ~ or ~/ by expanding $HOME
+ * first and then trying the password file
+ */
+ if ((h = getenv("HOME")) == NULL) {
+ if ((pwd = k_getpwuid(getuid())) == NULL)
+ return pattern;
+ else
+ h = pwd->pw_dir;
+ }
+ }
+ else {
+ /*
+ * Expand a ~user
+ */
+ if ((pwd = k_getpwnam((char*) patbuf)) == NULL)
+ return pattern;
+ else
+ h = pwd->pw_dir;
+ }
+
+ /* Copy the home directory */
+ for (b = patbuf; *h; *b++ = *h++)
+ continue;
+
+ /* Append the rest of the pattern */
+ while ((*b++ = *p++) != CHAR_EOS)
+ continue;
+
+ return patbuf;
+}
+
+
+/*
+ * The main glob() routine: compiles the pattern (optionally processing
+ * quotes), calls glob1() to do the real pattern matching, and finally
+ * sorts the list (unless unsorted operation is requested). Returns 0
+ * if things went well, nonzero if errors occurred. It is not an error
+ * to find no matches.
+ */
+static int
+glob0(const Char *pattern, glob_t *pglob)
+{
+ const Char *qpatnext;
+ int c, err, oldpathc;
+ Char *bufnext, patbuf[MaxPathLen+1];
+
+ qpatnext = globtilde(pattern, patbuf, pglob);
+ oldpathc = pglob->gl_pathc;
+ bufnext = patbuf;
+
+ /* We don't need to check for buffer overflow any more. */
+ while ((c = *qpatnext++) != CHAR_EOS) {
+ switch (c) {
+ case CHAR_LBRACKET:
+ c = *qpatnext;
+ if (c == CHAR_NOT)
+ ++qpatnext;
+ if (*qpatnext == CHAR_EOS ||
+ g_strchr((Char *) qpatnext+1, CHAR_RBRACKET) == NULL) {
+ *bufnext++ = CHAR_LBRACKET;
+ if (c == CHAR_NOT)
+ --qpatnext;
+ break;
+ }
+ *bufnext++ = M_SET;
+ if (c == CHAR_NOT)
+ *bufnext++ = M_NOT;
+ c = *qpatnext++;
+ do {
+ *bufnext++ = CHAR(c);
+ if (*qpatnext == CHAR_RANGE &&
+ (c = qpatnext[1]) != CHAR_RBRACKET) {
+ *bufnext++ = M_RNG;
+ *bufnext++ = CHAR(c);
+ qpatnext += 2;
+ }
+ } while ((c = *qpatnext++) != CHAR_RBRACKET);
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_END;
+ break;
+ case CHAR_QUESTION:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ *bufnext++ = M_ONE;
+ break;
+ case CHAR_STAR:
+ pglob->gl_flags |= GLOB_MAGCHAR;
+ /* collapse adjacent stars to one,
+ * to avoid exponential behavior
+ */
+ if (bufnext == patbuf || bufnext[-1] != M_ALL)
+ *bufnext++ = M_ALL;
+ break;
+ default:
+ *bufnext++ = CHAR(c);
+ break;
+ }
+ }
+ *bufnext = CHAR_EOS;
+#ifdef DEBUG
+ qprintf("glob0:", patbuf);
+#endif
+
+ if ((err = glob1(patbuf, pglob)) != 0)
+ return(err);
+
+ /*
+ * If there was no match we are going to append the pattern
+ * if GLOB_NOCHECK was specified or if GLOB_NOMAGIC was specified
+ * and the pattern did not contain any magic characters
+ * GLOB_NOMAGIC is there just for compatibility with csh.
+ */
+ if (pglob->gl_pathc == oldpathc &&
+ ((pglob->gl_flags & GLOB_NOCHECK) ||
+ ((pglob->gl_flags & GLOB_NOMAGIC) &&
+ !(pglob->gl_flags & GLOB_MAGCHAR))))
+ return(globextend(pattern, pglob));
+ else if (!(pglob->gl_flags & GLOB_NOSORT))
+ qsort(pglob->gl_pathv + pglob->gl_offs + oldpathc,
+ pglob->gl_pathc - oldpathc, sizeof(char *), compare);
+ return(0);
+}
+
+static int
+compare(const void *p, const void *q)
+{
+ return(strcmp(*(char **)p, *(char **)q));
+}
+
+static int
+glob1(Char *pattern, glob_t *pglob)
+{
+ Char pathbuf[MaxPathLen+1];
+
+ /* A null pathname is invalid -- POSIX 1003.1 sect. 2.4. */
+ if (*pattern == CHAR_EOS)
+ return(0);
+ return(glob2(pathbuf, pathbuf, pattern, pglob));
+}
+
+/*
+ * The functions glob2 and glob3 are mutually recursive; there is one level
+ * of recursion for each segment in the pattern that contains one or more
+ * meta characters.
+ */
+
+#ifndef S_ISLNK
+#if defined(S_IFLNK) && defined(S_IFMT)
+#define S_ISLNK(mode) (((mode) & S_IFMT) == S_IFLNK)
+#else
+#define S_ISLNK(mode) 0
+#endif
+#endif
+
+static int
+glob2(Char *pathbuf, Char *pathend, Char *pattern, glob_t *pglob)
+{
+ struct stat sb;
+ Char *p, *q;
+ int anymeta;
+
+ /*
+ * Loop over pattern segments until end of pattern or until
+ * segment with meta character found.
+ */
+ for (anymeta = 0;;) {
+ if (*pattern == CHAR_EOS) { /* End of pattern? */
+ *pathend = CHAR_EOS;
+ if (g_lstat(pathbuf, &sb, pglob))
+ return(0);
+
+ if (((pglob->gl_flags & GLOB_MARK) &&
+ pathend[-1] != CHAR_SEP) && (S_ISDIR(sb.st_mode)
+ || (S_ISLNK(sb.st_mode) &&
+ (g_stat(pathbuf, &sb, pglob) == 0) &&
+ S_ISDIR(sb.st_mode)))) {
+ *pathend++ = CHAR_SEP;
+ *pathend = CHAR_EOS;
+ }
+ ++pglob->gl_matchc;
+ return(globextend(pathbuf, pglob));
+ }
+
+ /* Find end of next segment, copy tentatively to pathend. */
+ q = pathend;
+ p = pattern;
+ while (*p != CHAR_EOS && *p != CHAR_SEP) {
+ if (ismeta(*p))
+ anymeta = 1;
+ *q++ = *p++;
+ }
+
+ if (!anymeta) { /* No expansion, do next segment. */
+ pathend = q;
+ pattern = p;
+ while (*pattern == CHAR_SEP)
+ *pathend++ = *pattern++;
+ } else /* Need expansion, recurse. */
+ return(glob3(pathbuf, pathend, pattern, p, pglob));
+ }
+ /* CHAR_NOTREACHED */
+}
+
+static int
+glob3(Char *pathbuf, Char *pathend, Char *pattern, Char *restpattern,
+ glob_t *pglob)
+{
+ struct dirent *dp;
+ DIR *dirp;
+ int err;
+ char buf[MaxPathLen];
+
+ /*
+ * The readdirfunc declaration can't be prototyped, because it is
+ * assigned, below, to two functions which are prototyped in glob.h
+ * and dirent.h as taking pointers to differently typed opaque
+ * structures.
+ */
+ struct dirent *(*readdirfunc)(void *);
+
+ *pathend = CHAR_EOS;
+ errno = 0;
+
+ if ((dirp = g_opendir(pathbuf, pglob)) == NULL) {
+ /* TODO: don't call for ENOENT or ENOTDIR? */
+ if (pglob->gl_errfunc) {
+ g_Ctoc(pathbuf, buf);
+ if (pglob->gl_errfunc(buf, errno) ||
+ pglob->gl_flags & GLOB_ERR)
+ return (GLOB_ABEND);
+ }
+ return(0);
+ }
+
+ err = 0;
+
+ /* Search directory for matching names. */
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ readdirfunc = pglob->gl_readdir;
+ else
+ readdirfunc = (struct dirent *(*)(void *))readdir;
+ while ((dp = (*readdirfunc)(dirp))) {
+ u_char *sc;
+ Char *dc;
+
+ /* Initial CHAR_DOT must be matched literally. */
+ if (dp->d_name[0] == CHAR_DOT && *pattern != CHAR_DOT)
+ continue;
+ for (sc = (u_char *) dp->d_name, dc = pathend;
+ (*dc++ = *sc++) != CHAR_EOS;)
+ continue;
+ if (!match(pathend, pattern, restpattern)) {
+ *pathend = CHAR_EOS;
+ continue;
+ }
+ err = glob2(pathbuf, --dc, restpattern, pglob);
+ if (err)
+ break;
+ }
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ (*pglob->gl_closedir)(dirp);
+ else
+ closedir(dirp);
+ return(err);
+}
+
+
+/*
+ * Extend the gl_pathv member of a glob_t structure to accomodate a new item,
+ * add the new item, and update gl_pathc.
+ *
+ * This assumes the BSD realloc, which only copies the block when its size
+ * crosses a power-of-two boundary; for v7 realloc, this would cause quadratic
+ * behavior.
+ *
+ * Return 0 if new item added, error code if memory couldn't be allocated.
+ *
+ * Invariant of the glob_t structure:
+ * Either gl_pathc is zero and gl_pathv is NULL; or gl_pathc > 0 and
+ * gl_pathv points to (gl_offs + gl_pathc + 1) items.
+ */
+static int
+globextend(const Char *path, glob_t *pglob)
+{
+ char **pathv;
+ int i;
+ u_int newsize;
+ char *copy;
+ const Char *p;
+
+ newsize = sizeof(*pathv) * (2 + pglob->gl_pathc + pglob->gl_offs);
+ pathv = pglob->gl_pathv ?
+ realloc(pglob->gl_pathv, newsize) :
+ malloc(newsize);
+ if (pathv == NULL)
+ return(GLOB_NOSPACE);
+
+ if (pglob->gl_pathv == NULL && pglob->gl_offs > 0) {
+ /* first time around -- clear initial gl_offs items */
+ pathv += pglob->gl_offs;
+ for (i = pglob->gl_offs; --i >= 0; )
+ *--pathv = NULL;
+ }
+ pglob->gl_pathv = pathv;
+
+ for (p = path; *p++;)
+ continue;
+ if ((copy = malloc(p - path)) != NULL) {
+ g_Ctoc(path, copy);
+ pathv[pglob->gl_offs + pglob->gl_pathc++] = copy;
+ }
+ pathv[pglob->gl_offs + pglob->gl_pathc] = NULL;
+ return(copy == NULL ? GLOB_NOSPACE : 0);
+}
+
+
+/*
+ * pattern matching function for filenames. Each occurrence of the *
+ * pattern causes a recursion level.
+ */
+static int
+match(Char *name, Char *pat, Char *patend)
+{
+ int ok, negate_range;
+ Char c, k;
+
+ while (pat < patend) {
+ c = *pat++;
+ switch (c & M_MASK) {
+ case M_ALL:
+ if (pat == patend)
+ return(1);
+ do
+ if (match(name, pat, patend))
+ return(1);
+ while (*name++ != CHAR_EOS);
+ return(0);
+ case M_ONE:
+ if (*name++ == CHAR_EOS)
+ return(0);
+ break;
+ case M_SET:
+ ok = 0;
+ if ((k = *name++) == CHAR_EOS)
+ return(0);
+ if ((negate_range = ((*pat & M_MASK) == M_NOT)) != CHAR_EOS)
+ ++pat;
+ while (((c = *pat++) & M_MASK) != M_END)
+ if ((*pat & M_MASK) == M_RNG) {
+ if (c <= k && k <= pat[1])
+ ok = 1;
+ pat += 2;
+ } else if (c == k)
+ ok = 1;
+ if (ok == negate_range)
+ return(0);
+ break;
+ default:
+ if (*name++ != c)
+ return(0);
+ break;
+ }
+ }
+ return(*name == CHAR_EOS);
+}
+
+/* Free allocated data belonging to a glob_t structure. */
+void
+globfree(glob_t *pglob)
+{
+ int i;
+ char **pp;
+
+ if (pglob->gl_pathv != NULL) {
+ pp = pglob->gl_pathv + pglob->gl_offs;
+ for (i = pglob->gl_pathc; i--; ++pp)
+ if (*pp)
+ free(*pp);
+ free(pglob->gl_pathv);
+ }
+}
+
+static DIR *
+g_opendir(Char *str, glob_t *pglob)
+{
+ char buf[MaxPathLen];
+
+ if (!*str)
+ strcpy_truncate(buf, ".", sizeof(buf));
+ else
+ g_Ctoc(str, buf);
+
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_opendir)(buf));
+
+ return(opendir(buf));
+}
+
+static int
+g_lstat(Char *fn, struct stat *sb, glob_t *pglob)
+{
+ char buf[MaxPathLen];
+
+ g_Ctoc(fn, buf);
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_lstat)(buf, sb));
+ return(lstat(buf, sb));
+}
+
+static int
+g_stat(Char *fn, struct stat *sb, glob_t *pglob)
+{
+ char buf[MaxPathLen];
+
+ g_Ctoc(fn, buf);
+ if (pglob->gl_flags & GLOB_ALTDIRFUNC)
+ return((*pglob->gl_stat)(buf, sb));
+ return(stat(buf, sb));
+}
+
+static Char *
+g_strchr(Char *str, int ch)
+{
+ do {
+ if (*str == ch)
+ return (str);
+ } while (*str++);
+ return (NULL);
+}
+
+#ifdef notdef
+static Char *
+g_strcat(Char *dst, const Char *src)
+{
+ Char *sdst = dst;
+
+ while (*dst++)
+ continue;
+ --dst;
+ while((*dst++ = *src++) != CHAR_EOS)
+ continue;
+
+ return (sdst);
+}
+#endif
+
+static void
+g_Ctoc(const Char *str, char *buf)
+{
+ char *dc;
+
+ for (dc = buf; (*dc++ = *str++) != CHAR_EOS;)
+ continue;
+}
+
+#ifdef DEBUG
+static void
+qprintf(const Char *str, Char *s)
+{
+ Char *p;
+
+ printf("%s:\n", str);
+ for (p = s; *p; p++)
+ printf("%c", CHAR(*p));
+ printf("\n");
+ for (p = s; *p; p++)
+ printf("%c", *p & M_PROTECT ? '"' : ' ');
+ printf("\n");
+ for (p = s; *p; p++)
+ printf("%c", ismeta(*p) ? '_' : ' ');
+ printf("\n");
+}
+#endif
diff --git a/crypto/kerberosIV/lib/roken/glob.h b/crypto/kerberosIV/lib/roken/glob.h
new file mode 100644
index 0000000..bece48a
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/glob.h
@@ -0,0 +1,84 @@
+/*
+ * Copyright (c) 1989, 1993
+ * The Regents of the University of California. All rights reserved.
+ *
+ * This code is derived from software contributed to Berkeley by
+ * Guido van Rossum.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ *
+ * @(#)glob.h 8.1 (Berkeley) 6/2/93
+ */
+
+#ifndef _GLOB_H_
+#define _GLOB_H_
+
+struct stat;
+typedef struct {
+ int gl_pathc; /* Count of total paths so far. */
+ int gl_matchc; /* Count of paths matching pattern. */
+ int gl_offs; /* Reserved at beginning of gl_pathv. */
+ int gl_flags; /* Copy of flags parameter to glob. */
+ char **gl_pathv; /* List of paths matching pattern. */
+ /* Copy of errfunc parameter to glob. */
+ int (*gl_errfunc) (const char *, int);
+
+ /*
+ * Alternate filesystem access methods for glob; replacement
+ * versions of closedir(3), readdir(3), opendir(3), stat(2)
+ * and lstat(2).
+ */
+ void (*gl_closedir) (void *);
+ struct dirent *(*gl_readdir) (void *);
+ void *(*gl_opendir) (const char *);
+ int (*gl_lstat) (const char *, struct stat *);
+ int (*gl_stat) (const char *, struct stat *);
+} glob_t;
+
+#define GLOB_APPEND 0x0001 /* Append to output from previous call. */
+#define GLOB_DOOFFS 0x0002 /* Use gl_offs. */
+#define GLOB_ERR 0x0004 /* Return on error. */
+#define GLOB_MARK 0x0008 /* Append / to matching directories. */
+#define GLOB_NOCHECK 0x0010 /* Return pattern itself if nothing matches. */
+#define GLOB_NOSORT 0x0020 /* Don't sort. */
+
+#define GLOB_ALTDIRFUNC 0x0040 /* Use alternately specified directory funcs. */
+#define GLOB_BRACE 0x0080 /* Expand braces ala csh. */
+#define GLOB_MAGCHAR 0x0100 /* Pattern had globbing characters. */
+#define GLOB_NOMAGIC 0x0200 /* GLOB_NOCHECK without magic chars (csh). */
+#define GLOB_QUOTE 0x0400 /* Quote special chars with \. */
+#define GLOB_TILDE 0x0800 /* Expand tilde names from the passwd file. */
+
+#define GLOB_NOSPACE (-1) /* Malloc call failed. */
+#define GLOB_ABEND (-2) /* Unignored error. */
+
+int glob (const char *, int, int (*)(const char *, int), glob_t *);
+void globfree (glob_t *);
+
+#endif /* !_GLOB_H_ */
diff --git a/crypto/kerberosIV/lib/roken/hstrerror.c b/crypto/kerberosIV/lib/roken/hstrerror.c
index 9e47cb5..3653352 100644
--- a/crypto/kerberosIV/lib/roken/hstrerror.c
+++ b/crypto/kerberosIV/lib/roken/hstrerror.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,15 +38,22 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: hstrerror.c,v 1.17 1997/06/01 03:37:25 assar Exp $");
+RCSID("$Id: hstrerror.c,v 1.20.2.1 1999/07/22 03:20:06 assar Exp $");
#endif
-#include "roken.h"
-
#ifndef HAVE_HSTRERROR
+#include "roken.h"
+
#include <stdio.h>
+
+#ifdef HAVE_NETDB_H
+#if (defined(SunOS) && (SunOS >= 50))
+#define hstrerror broken_proto
+#endif
#include <netdb.h>
+#undef hstrerror
+#endif
#ifndef HAVE_H_ERRNO
int h_errno = -17; /* Some magic number */
@@ -73,11 +80,11 @@ extern int h_nerr;
#endif
-char *
+const char *
hstrerror(int herr)
{
if (0 <= herr && herr < h_nerr)
- return (char *) h_errlist[herr];
+ return h_errlist[herr];
else if(herr == -17)
return "unknown error";
else
diff --git a/crypto/kerberosIV/lib/roken/inaddr2str.c b/crypto/kerberosIV/lib/roken/inaddr2str.c
index af158aa..a676bca 100644
--- a/crypto/kerberosIV/lib/roken/inaddr2str.c
+++ b/crypto/kerberosIV/lib/roken/inaddr2str.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: inaddr2str.c,v 1.6 1997/04/01 08:19:02 joda Exp $");
+RCSID("$Id: inaddr2str.c,v 1.10 1998/07/13 13:59:46 assar Exp $");
#endif
#include <stdlib.h>
@@ -52,6 +52,13 @@ RCSID("$Id: inaddr2str.c,v 1.6 1997/04/01 08:19:02 joda Exp $");
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+
#ifdef HAVE_ARPA_INET_H
#include <arpa/inet.h>
#endif
@@ -69,20 +76,20 @@ void
inaddr2str(struct in_addr addr, char *s, size_t len)
{
struct hostent *h;
- char *p;
+ char **p;
- h = gethostbyaddr ((const char *)&addr, sizeof(addr), AF_INET);
+ h = roken_gethostbyaddr ((const char *)&addr, sizeof(addr), AF_INET);
if (h) {
- h = gethostbyname (h->h_name);
+ h = roken_gethostbyname (h->h_name);
if(h)
- while ((p = *(h->h_addr_list)++))
- if (memcmp (p, &addr, sizeof(addr)) == 0) {
- strncpy (s, h->h_name, len);
- s[len - 1] = '\0';
+ for(p = h->h_addr_list;
+ *p;
+ ++p)
+ if (memcmp (*p, &addr, sizeof(addr)) == 0) {
+ strcpy_truncate (s, h->h_name, len);
return;
}
}
- strncpy (s, inet_ntoa (addr), len);
- s[len - 1] = '\0';
+ strcpy_truncate (s, inet_ntoa (addr), len);
return;
}
diff --git a/crypto/kerberosIV/lib/roken/inet_aton.c b/crypto/kerberosIV/lib/roken/inet_aton.c
index c97ef74..65687c7 100644
--- a/crypto/kerberosIV/lib/roken/inet_aton.c
+++ b/crypto/kerberosIV/lib/roken/inet_aton.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: inet_aton.c,v 1.10 1997/05/20 19:57:03 bg Exp $");
+RCSID("$Id: inet_aton.c,v 1.11 1997/09/29 14:00:28 assar Exp $");
#endif
#include "roken.h"
@@ -50,6 +50,13 @@ RCSID("$Id: inet_aton.c,v 1.10 1997/05/20 19:57:03 bg Exp $");
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+
#ifdef HAVE_NETDB_H
#include <netdb.h>
#endif
diff --git a/crypto/kerberosIV/lib/roken/innetgr.c b/crypto/kerberosIV/lib/roken/innetgr.c
new file mode 100644
index 0000000..4bc57f9
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/innetgr.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. Neither the name of KTH nor the names of its contributors may be
+ * used to endorse or promote products derived from this software without
+ * specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY KTH AND ITS CONTRIBUTORS ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL KTH OR ITS CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+ * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_INNETGR
+
+RCSID("$Id: innetgr.c,v 1.1 1999/03/11 14:04:01 joda Exp $");
+
+int
+innetgr(const char *netgroup, const char *machine,
+ const char *user, const char *domain)
+{
+ return 0;
+}
+#endif
+
diff --git a/crypto/kerberosIV/lib/roken/iruserok.c b/crypto/kerberosIV/lib/roken/iruserok.c
new file mode 100644
index 0000000..63eaccf
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/iruserok.c
@@ -0,0 +1,294 @@
+/*
+ * Copyright (c) 1983, 1993, 1994
+ * The Regents of the University of California. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by the University of
+ * California, Berkeley and its contributors.
+ * 4. Neither the name of the University nor the names of its contributors
+ * may be used to endorse or promote products derived from this software
+ * without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+ * SUCH DAMAGE.
+ */
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+RCSID("$Id: iruserok.c,v 1.21 1999/03/11 14:04:15 joda Exp $");
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+#ifdef HAVE_RPCSVC_YPCLNT_H
+#include <rpcsvc/ypclnt.h>
+#endif
+
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#include "roken.h"
+
+int __check_rhosts_file = 1;
+char *__rcmd_errstr = 0;
+
+/*
+ * Returns "true" if match, 0 if no match.
+ */
+static
+int
+__icheckhost(unsigned raddr, const char *lhost)
+{
+ struct hostent *hp;
+ u_long laddr;
+ char **pp;
+
+ /* Try for raw ip address first. */
+ if (isdigit((unsigned char)*lhost)
+ && (long)(laddr = inet_addr(lhost)) != -1)
+ return (raddr == laddr);
+
+ /* Better be a hostname. */
+ if ((hp = gethostbyname(lhost)) == NULL)
+ return (0);
+
+ /* Spin through ip addresses. */
+ for (pp = hp->h_addr_list; *pp; ++pp)
+ if (memcmp(&raddr, *pp, sizeof(u_long)) == 0)
+ return (1);
+
+ /* No match. */
+ return (0);
+}
+
+/*
+ * Returns 0 if ok, -1 if not ok.
+ */
+static
+int
+__ivaliduser(FILE *hostf, unsigned raddr, const char *luser,
+ const char *ruser)
+{
+ char *user, *p;
+ int ch;
+ char buf[MaxHostNameLen + 128]; /* host + login */
+ char hname[MaxHostNameLen];
+ struct hostent *hp;
+ /* Presumed guilty until proven innocent. */
+ int userok = 0, hostok = 0;
+#ifdef HAVE_YP_GET_DEFAULT_DOMAIN
+ char *ypdomain;
+
+ if (yp_get_default_domain(&ypdomain))
+ ypdomain = NULL;
+#else
+#define ypdomain NULL
+#endif
+ /* We need to get the damn hostname back for netgroup matching. */
+ if ((hp = gethostbyaddr((char *)&raddr,
+ sizeof(u_long),
+ AF_INET)) == NULL)
+ return (-1);
+ strcpy_truncate(hname, hp->h_name, sizeof(hname));
+
+ while (fgets(buf, sizeof(buf), hostf)) {
+ p = buf;
+ /* Skip lines that are too long. */
+ if (strchr(p, '\n') == NULL) {
+ while ((ch = getc(hostf)) != '\n' && ch != EOF);
+ continue;
+ }
+ if (*p == '\n' || *p == '#') {
+ /* comment... */
+ continue;
+ }
+ while (*p != '\n' && *p != ' ' && *p != '\t' && *p != '\0') {
+ if (isupper((unsigned char)*p))
+ *p = tolower((unsigned char)*p);
+ p++;
+ }
+ if (*p == ' ' || *p == '\t') {
+ *p++ = '\0';
+ while (*p == ' ' || *p == '\t')
+ p++;
+ user = p;
+ while (*p != '\n' && *p != ' ' &&
+ *p != '\t' && *p != '\0')
+ p++;
+ } else
+ user = p;
+ *p = '\0';
+ /*
+ * Do +/- and +@/-@ checking. This looks really nasty,
+ * but it matches SunOS's behavior so far as I can tell.
+ */
+ switch(buf[0]) {
+ case '+':
+ if (!buf[1]) { /* '+' matches all hosts */
+ hostok = 1;
+ break;
+ }
+ if (buf[1] == '@') /* match a host by netgroup */
+ hostok = innetgr((char *)&buf[2],
+ (char *)&hname, NULL, ypdomain);
+ else /* match a host by addr */
+ hostok = __icheckhost(raddr,(char *)&buf[1]);
+ break;
+ case '-': /* reject '-' hosts and all their users */
+ if (buf[1] == '@') {
+ if (innetgr((char *)&buf[2],
+ (char *)&hname, NULL, ypdomain))
+ return(-1);
+ } else {
+ if (__icheckhost(raddr,(char *)&buf[1]))
+ return(-1);
+ }
+ break;
+ default: /* if no '+' or '-', do a simple match */
+ hostok = __icheckhost(raddr, buf);
+ break;
+ }
+ switch(*user) {
+ case '+':
+ if (!*(user+1)) { /* '+' matches all users */
+ userok = 1;
+ break;
+ }
+ if (*(user+1) == '@') /* match a user by netgroup */
+ userok = innetgr(user+2, NULL, (char *)ruser,
+ ypdomain);
+ else /* match a user by direct specification */
+ userok = !(strcmp(ruser, user+1));
+ break;
+ case '-': /* if we matched a hostname, */
+ if (hostok) { /* check for user field rejections */
+ if (!*(user+1))
+ return(-1);
+ if (*(user+1) == '@') {
+ if (innetgr(user+2, NULL,
+ (char *)ruser, ypdomain))
+ return(-1);
+ } else {
+ if (!strcmp(ruser, user+1))
+ return(-1);
+ }
+ }
+ break;
+ default: /* no rejections: try to match the user */
+ if (hostok)
+ userok = !(strcmp(ruser,*user ? user : luser));
+ break;
+ }
+ if (hostok && userok)
+ return(0);
+ }
+ return (-1);
+}
+
+/*
+ * New .rhosts strategy: We are passed an ip address. We spin through
+ * hosts.equiv and .rhosts looking for a match. When the .rhosts only
+ * has ip addresses, we don't have to trust a nameserver. When it
+ * contains hostnames, we spin through the list of addresses the nameserver
+ * gives us and look for a match.
+ *
+ * Returns 0 if ok, -1 if not ok.
+ */
+int
+iruserok(unsigned raddr, int superuser, const char *ruser, const char *luser)
+{
+ char *cp;
+ struct stat sbuf;
+ struct passwd *pwd;
+ FILE *hostf;
+ uid_t uid;
+ int first;
+ char pbuf[MaxPathLen];
+
+ first = 1;
+ hostf = superuser ? NULL : fopen(_PATH_HEQUIV, "r");
+again:
+ if (hostf) {
+ if (__ivaliduser(hostf, raddr, luser, ruser) == 0) {
+ fclose(hostf);
+ return (0);
+ }
+ fclose(hostf);
+ }
+ if (first == 1 && (__check_rhosts_file || superuser)) {
+ first = 0;
+ if ((pwd = k_getpwnam((char*)luser)) == NULL)
+ return (-1);
+ snprintf (pbuf, sizeof(pbuf), "%s/.rhosts", pwd->pw_dir);
+
+ /*
+ * Change effective uid while opening .rhosts. If root and
+ * reading an NFS mounted file system, can't read files that
+ * are protected read/write owner only.
+ */
+ uid = geteuid();
+ seteuid(pwd->pw_uid);
+ hostf = fopen(pbuf, "r");
+ seteuid(uid);
+
+ if (hostf == NULL)
+ return (-1);
+ /*
+ * If not a regular file, or is owned by someone other than
+ * user or root or if writeable by anyone but the owner, quit.
+ */
+ cp = NULL;
+ if (lstat(pbuf, &sbuf) < 0)
+ cp = ".rhosts lstat failed";
+ else if (!S_ISREG(sbuf.st_mode))
+ cp = ".rhosts not regular file";
+ else if (fstat(fileno(hostf), &sbuf) < 0)
+ cp = ".rhosts fstat failed";
+ else if (sbuf.st_uid && sbuf.st_uid != pwd->pw_uid)
+ cp = "bad .rhosts owner";
+ else if (sbuf.st_mode & (S_IWGRP|S_IWOTH))
+ cp = ".rhosts writeable by other than owner";
+ /* If there were any problems, quit. */
+ if (cp) {
+ __rcmd_errstr = cp;
+ fclose(hostf);
+ return (-1);
+ }
+ goto again;
+ }
+ return (-1);
+}
diff --git a/crypto/kerberosIV/lib/roken/issuid.c b/crypto/kerberosIV/lib/roken/issuid.c
new file mode 100644
index 0000000..9b84621
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/issuid.c
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: issuid.c,v 1.2 1998/05/09 17:35:47 joda Exp $");
+#endif
+
+#include "roken.h"
+
+int
+issuid(void)
+{
+#if defined(HAVE_GETUID) && defined(HAVE_GETEUID)
+ if(getuid() != geteuid())
+ return 1;
+#endif
+#if defined(HAVE_GETGID) && defined(HAVE_GETEGID)
+ if(getgid() != getegid())
+ return 2;
+#endif
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/roken/k_getpwnam.c b/crypto/kerberosIV/lib/roken/k_getpwnam.c
index 580b1a2..b11be41 100644
--- a/crypto/kerberosIV/lib/roken/k_getpwnam.c
+++ b/crypto/kerberosIV/lib/roken/k_getpwnam.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: k_getpwnam.c,v 1.6 1997/04/01 08:19:03 joda Exp $");
+RCSID("$Id: k_getpwnam.c,v 1.7 1998/11/22 09:23:18 assar Exp $");
#endif /* HAVE_CONFIG_H */
#include "roken.h"
@@ -52,7 +52,7 @@ k_getpwnam (char *user)
struct passwd *p;
p = getpwnam (user);
-#ifdef HAVE_GETSPNAM
+#if defined(HAVE_GETSPNAM) && defined(HAVE_STRUCT_SPWD)
if(p)
{
struct spwd *spwd;
diff --git a/crypto/kerberosIV/lib/roken/k_getpwuid.c b/crypto/kerberosIV/lib/roken/k_getpwuid.c
index a3a8f04..76f7f85 100644
--- a/crypto/kerberosIV/lib/roken/k_getpwuid.c
+++ b/crypto/kerberosIV/lib/roken/k_getpwuid.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: k_getpwuid.c,v 1.6 1997/04/01 08:19:04 joda Exp $");
+RCSID("$Id: k_getpwuid.c,v 1.7 1998/11/22 09:23:04 assar Exp $");
#endif /* HAVE_CONFIG_H */
#include "roken.h"
@@ -52,7 +52,7 @@ k_getpwuid (uid_t uid)
struct passwd *p;
p = getpwuid (uid);
-#ifdef HAVE_GETSPUID
+#if defined(HAVE_GETSPUID) && defined(HAVE_STRUCT_SPWD)
if (p)
{
struct spwd *spwd;
diff --git a/crypto/kerberosIV/lib/roken/make-print-version.c b/crypto/kerberosIV/lib/roken/make-print-version.c
new file mode 100644
index 0000000..ef39372
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/make-print-version.c
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: make-print-version.c,v 1.1 1998/05/11 20:38:06 joda Exp $");
+#endif
+
+#include <stdio.h>
+
+#ifdef KRB5
+extern char *heimdal_version;
+#endif
+#ifdef KRB4
+extern char *krb4_version;
+#endif
+#include <version.h>
+
+int
+main(int argc, char **argv)
+{
+ FILE *f;
+ if(argc != 2)
+ return 1;
+ f = fopen(argv[1], "w");
+ if(f == NULL)
+ return 1;
+ fprintf(f, "#define VERSIONLIST { ");
+#ifdef KRB5
+ fprintf(f, "\"%s\", ", heimdal_version);
+#endif
+#ifdef KRB4
+ fprintf(f, "\"%s\", ", krb4_version);
+#endif
+ fprintf(f, "}\n");
+ fclose(f);
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/roken/memmove.c b/crypto/kerberosIV/lib/roken/memmove.c
index 315ff05..e3f7d5a 100644
--- a/crypto/kerberosIV/lib/roken/memmove.c
+++ b/crypto/kerberosIV/lib/roken/memmove.c
@@ -38,14 +38,16 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: memmove.c,v 1.5 1997/04/01 08:19:05 joda Exp $");
+RCSID("$Id: memmove.c,v 1.6 1997/07/11 20:20:30 assar Exp $");
#endif
/*
* memmove for systems that doesn't have it
*/
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
void* memmove(void *s1, const void *s2, size_t n)
{
diff --git a/crypto/kerberosIV/lib/roken/mini_inetd.c b/crypto/kerberosIV/lib/roken/mini_inetd.c
index ccfcfe7..75169d3 100644
--- a/crypto/kerberosIV/lib/roken/mini_inetd.c
+++ b/crypto/kerberosIV/lib/roken/mini_inetd.c
@@ -38,9 +38,11 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: mini_inetd.c,v 1.10 1997/05/02 14:30:07 assar Exp $");
+RCSID("$Id: mini_inetd.c,v 1.13 1998/02/05 22:54:33 assar Exp $");
#endif
+#include <stdio.h>
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -53,6 +55,13 @@ RCSID("$Id: mini_inetd.c,v 1.10 1997/05/02 14:30:07 assar Exp $");
#ifdef HAVE_NETINET_IN_H
#include <netinet/in.h>
#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+
#include <roken.h>
@@ -60,18 +69,23 @@ void
mini_inetd (int port)
{
struct sockaddr_in sa;
- int s = socket(AF_INET, SOCK_STREAM, 0);
+ int s;
int s2;
- int one = 1;
- if(s < 0){
+
+ s = socket(AF_INET, SOCK_STREAM, 0);
+ if(s < 0) {
perror("socket");
exit(1);
}
#if defined(SO_REUSEADDR) && defined(HAVE_SETSOCKOPT)
- if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *)&one,
- sizeof(one)) < 0){
- perror("setsockopt");
- exit(1);
+ {
+ int one = 1;
+
+ if(setsockopt(s, SOL_SOCKET, SO_REUSEADDR, (void *)&one,
+ sizeof(one)) < 0){
+ perror("setsockopt");
+ exit(1);
+ }
}
#endif
memset(&sa, 0, sizeof(sa));
diff --git a/crypto/kerberosIV/lib/roken/net_read.c b/crypto/kerberosIV/lib/roken/net_read.c
new file mode 100644
index 0000000..2d47d96
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/net_read.c
@@ -0,0 +1,79 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: net_read.c,v 1.2 1998/11/22 09:45:16 assar Exp $");
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <roken.h>
+
+/*
+ * Like read but never return partial data.
+ */
+
+ssize_t
+net_read (int fd, void *buf, size_t nbytes)
+{
+ char *cbuf = (char *)buf;
+ ssize_t count;
+ size_t rem = nbytes;
+
+ while (rem > 0) {
+#ifdef WIN32
+ count = recv (fd, cbuf, rem, 0);
+#else
+ count = read (fd, cbuf, rem);
+#endif
+ if (count < 0) {
+ if (errno == EINTR)
+ continue;
+ else
+ return count;
+ } else if (count == 0) {
+ return count;
+ }
+ cbuf += count;
+ rem -= count;
+ }
+ return nbytes;
+}
diff --git a/crypto/kerberosIV/lib/roken/net_write.c b/crypto/kerberosIV/lib/roken/net_write.c
new file mode 100644
index 0000000..35c2d73
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/net_write.c
@@ -0,0 +1,77 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: net_write.c,v 1.2 1998/11/22 09:45:21 assar Exp $");
+#endif
+
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+
+#include <roken.h>
+
+/*
+ * Like write but never return partial data.
+ */
+
+ssize_t
+net_write (int fd, const void *buf, size_t nbytes)
+{
+ const char *cbuf = (char *)buf;
+ ssize_t count;
+ size_t rem = nbytes;
+
+ while (rem > 0) {
+#ifdef WIN32
+ count = send (fd, cbuf, rem, 0);
+#else
+ count = write (fd, cbuf, rem);
+#endif
+ if (count < 0) {
+ if (errno == EINTR)
+ continue;
+ else
+ return count;
+ }
+ cbuf += count;
+ rem -= count;
+ }
+ return nbytes;
+}
diff --git a/crypto/kerberosIV/lib/roken/parse_time.c b/crypto/kerberosIV/lib/roken/parse_time.c
new file mode 100644
index 0000000..8428251
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/parse_time.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: parse_time.c,v 1.4 1998/02/20 07:51:44 assar Exp $");
+#endif
+
+#include <parse_units.h>
+#include "parse_time.h"
+
+static units time_units[] = {
+ {"year", 365 * 24 * 60 * 60},
+ {"month", 30 * 24 * 60 * 60},
+ {"week", 7 * 24 * 60 * 60},
+ {"day", 24 * 60 * 60},
+ {"hour", 60 * 60},
+ {"h", 60 * 60},
+ {"minute", 60},
+ {"m", 60},
+ {"second", 1},
+ {"s", 1},
+ {NULL, 0},
+};
+
+int
+parse_time (const char *s, const char *def_unit)
+{
+ return parse_units (s, time_units, def_unit);
+}
+
+size_t
+unparse_time (int t, char *s, size_t len)
+{
+ return unparse_units (t, time_units, s, len);
+}
+
+size_t
+unparse_time_approx (int t, char *s, size_t len)
+{
+ return unparse_units_approx (t, time_units, s, len);
+}
+
+void
+print_time_table (FILE *f)
+{
+ print_units_table (time_units, f);
+}
diff --git a/crypto/kerberosIV/lib/roken/parse_time.h b/crypto/kerberosIV/lib/roken/parse_time.h
new file mode 100644
index 0000000..d05d37e
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/parse_time.h
@@ -0,0 +1,56 @@
+/*
+ * Copyright (c) 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 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: parse_time.h,v 1.3 1998/02/20 07:51:55 assar Exp $ */
+
+#ifndef __PARSE_TIME_H__
+#define __PARSE_TIME_H__
+
+int
+parse_time (const char *s, const char *def_unit);
+
+size_t
+unparse_time (int t, char *s, size_t len);
+
+size_t
+unparse_time_approx (int t, char *s, size_t len);
+
+void
+print_time_table (FILE *f);
+
+#endif /* __PARSE_TIME_H__ */
diff --git a/crypto/kerberosIV/lib/roken/parse_units.c b/crypto/kerberosIV/lib/roken/parse_units.c
new file mode 100644
index 0000000..7dafa77
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/parse_units.c
@@ -0,0 +1,327 @@
+/*
+ * Copyright (c) 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: parse_units.c,v 1.10 1999/06/23 12:41:35 assar Exp $");
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+#include <string.h>
+#include <roken.h>
+#include "parse_units.h"
+
+/*
+ * Parse string in `s' according to `units' and return value.
+ * def_unit defines the default unit.
+ */
+
+static int
+parse_something (const char *s, const struct units *units,
+ const char *def_unit,
+ int (*func)(int res, int val, unsigned mult),
+ int init,
+ int accept_no_val_p)
+{
+ const char *p;
+ int res = init;
+ unsigned def_mult = 1;
+
+ if (def_unit != NULL) {
+ const struct units *u;
+
+ for (u = units; u->name; ++u) {
+ if (strcasecmp (u->name, def_unit) == 0) {
+ def_mult = u->mult;
+ break;
+ }
+ }
+ if (u->name == NULL)
+ return -1;
+ }
+
+ p = s;
+ while (*p) {
+ double val;
+ char *next;
+ const struct units *u, *partial_unit;
+ size_t u_len;
+ unsigned partial;
+
+ while(isspace((unsigned char)*p) || *p == ',')
+ ++p;
+
+ val = strtod (p, &next); /* strtol(p, &next, 0); */
+ if (val == 0 && p == next) {
+ if(!accept_no_val_p)
+ return -1;
+ }
+ p = next;
+ while (isspace((unsigned char)*p))
+ ++p;
+ if (*p == '\0') {
+ res = (*func)(res, val, def_mult);
+ if (res < 0)
+ return res;
+ break;
+ } else if (*p == '+') {
+ ++p;
+ val = 1;
+ } else if (*p == '-') {
+ ++p;
+ val = -1;
+ }
+ if (val == 0)
+ val = 1;
+ u_len = strcspn (p, ", \t");
+ partial = 0;
+ partial_unit = NULL;
+ if (u_len > 1 && p[u_len - 1] == 's')
+ --u_len;
+ for (u = units; u->name; ++u) {
+ if (strncasecmp (p, u->name, u_len) == 0) {
+ if (u_len == strlen (u->name)) {
+ p += u_len;
+ res = (*func)(res, val, u->mult);
+ if (res < 0)
+ return res;
+ break;
+ } else {
+ ++partial;
+ partial_unit = u;
+ }
+ }
+ }
+ if (u->name == NULL) {
+ if (partial == 1) {
+ p += u_len;
+ res = (*func)(res, val, partial_unit->mult);
+ if (res < 0)
+ return res;
+ } else {
+ return -1;
+ }
+ }
+ if (*p == 's')
+ ++p;
+ }
+ return res;
+}
+
+/*
+ * The string consists of a sequence of `n unit'
+ */
+
+static int
+acc_units(int res, int val, unsigned mult)
+{
+ return res + val * mult;
+}
+
+int
+parse_units (const char *s, const struct units *units,
+ const char *def_unit)
+{
+ return parse_something (s, units, def_unit, acc_units, 0, 0);
+}
+
+/*
+ * The string consists of a sequence of `[+-]flag'. `orig' consists
+ * the original set of flags, those are then modified and returned as
+ * the function value.
+ */
+
+static int
+acc_flags(int res, int val, unsigned mult)
+{
+ if(val == 1)
+ return res | mult;
+ else if(val == -1)
+ return res & ~mult;
+ else if (val == 0)
+ return mult;
+ else
+ return -1;
+}
+
+int
+parse_flags (const char *s, const struct units *units,
+ int orig)
+{
+ return parse_something (s, units, NULL, acc_flags, orig, 1);
+}
+
+/*
+ * Return a string representation according to `units' of `num' in `s'
+ * with maximum length `len'. The actual length is the function value.
+ */
+
+static size_t
+unparse_something (int num, const struct units *units, char *s, size_t len,
+ int (*print) (char *s, size_t len, int div,
+ const char *name, int rem),
+ int (*update) (int in, unsigned mult),
+ const char *zero_string)
+{
+ const struct units *u;
+ size_t ret = 0, tmp;
+
+ if (num == 0)
+ return snprintf (s, len, "%s", zero_string);
+
+ for (u = units; num > 0 && u->name; ++u) {
+ int div;
+
+ div = num / u->mult;
+ if (div) {
+ num = (*update) (num, u->mult);
+ tmp = (*print) (s, len, div, u->name, num);
+
+ len -= tmp;
+ s += tmp;
+ ret += tmp;
+ }
+ }
+ return ret;
+}
+
+static int
+print_unit (char *s, size_t len, int div, const char *name, int rem)
+{
+ return snprintf (s, len, "%u %s%s%s",
+ div, name,
+ div == 1 ? "" : "s",
+ rem > 0 ? " " : "");
+}
+
+static int
+update_unit (int in, unsigned mult)
+{
+ return in % mult;
+}
+
+static int
+update_unit_approx (int in, unsigned mult)
+{
+ if (in / mult > 0)
+ return 0;
+ else
+ return update_unit (in, mult);
+}
+
+size_t
+unparse_units (int num, const struct units *units, char *s, size_t len)
+{
+ return unparse_something (num, units, s, len,
+ print_unit,
+ update_unit,
+ "0");
+}
+
+size_t
+unparse_units_approx (int num, const struct units *units, char *s, size_t len)
+{
+ return unparse_something (num, units, s, len,
+ print_unit,
+ update_unit_approx,
+ "0");
+}
+
+void
+print_units_table (const struct units *units, FILE *f)
+{
+ const struct units *u, *u2;
+ unsigned max_sz = 0;
+
+ for (u = units; u->name; ++u) {
+ max_sz = max(max_sz, strlen(u->name));
+ }
+
+ for (u = units; u->name;) {
+ char buf[1024];
+ const struct units *next;
+
+ for (next = u + 1; next->name && next->mult == u->mult; ++next)
+ ;
+
+ if (next->name) {
+ for (u2 = next;
+ u2->name && u->mult % u2->mult != 0;
+ ++u2)
+ ;
+ if (u2->name == NULL)
+ --u2;
+ unparse_units (u->mult, u2, buf, sizeof(buf));
+ fprintf (f, "1 %*s = %s\n", max_sz, u->name, buf);
+ } else {
+ fprintf (f, "1 %s\n", u->name);
+ }
+ u = next;
+ }
+}
+
+static int
+print_flag (char *s, size_t len, int div, const char *name, int rem)
+{
+ return snprintf (s, len, "%s%s", name, rem > 0 ? ", " : "");
+}
+
+static int
+update_flag (int in, unsigned mult)
+{
+ return in - mult;
+}
+
+size_t
+unparse_flags (int num, const struct units *units, char *s, size_t len)
+{
+ return unparse_something (num, units, s, len,
+ print_flag,
+ update_flag,
+ "");
+}
+
+void
+print_flags_table (const struct units *units, FILE *f)
+{
+ const struct units *u;
+
+ for(u = units; u->name; ++u)
+ fprintf(f, "%s%s", u->name, (u+1)->name ? ", " : "\n");
+}
diff --git a/crypto/kerberosIV/lib/roken/parse_units.h b/crypto/kerberosIV/lib/roken/parse_units.h
new file mode 100644
index 0000000..e3c0341
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/parse_units.h
@@ -0,0 +1,78 @@
+/*
+ * Copyright (c) 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 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: parse_units.h,v 1.5 1998/02/20 07:51:18 assar Exp $ */
+
+#ifndef __PARSE_UNITS_H__
+#define __PARSE_UNITS_H__
+
+#include <stdio.h>
+#include <stddef.h>
+
+struct units {
+ const char *name;
+ unsigned mult;
+};
+
+typedef struct units units;
+
+int
+parse_units (const char *s, const struct units *units,
+ const char *def_unit);
+
+void
+print_units_table (const struct units *units, FILE *f);
+
+int
+parse_flags (const char *s, const struct units *units,
+ int orig);
+
+size_t
+unparse_units (int num, const struct units *units, char *s, size_t len);
+
+size_t
+unparse_units_approx (int num, const struct units *units, char *s,
+ size_t len);
+
+size_t
+unparse_flags (int num, const struct units *units, char *s, size_t len);
+
+void
+print_flags_table (const struct units *units, FILE *f);
+
+#endif /* __PARSE_UNITS_H__ */
diff --git a/crypto/kerberosIV/lib/roken/print_version.c b/crypto/kerberosIV/lib/roken/print_version.c
new file mode 100644
index 0000000..00e612f
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/print_version.c
@@ -0,0 +1,83 @@
+/*
+ * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: print_version.c,v 1.4 1999/02/20 14:48:43 joda Exp $");
+#endif
+#include "roken.h"
+
+#include "print_version.h"
+
+void
+print_version(const char *progname)
+{
+ const char *arg[] = VERSIONLIST;
+ const int num_args = sizeof(arg) / sizeof(arg[0]);
+ char *msg;
+ size_t len = 0;
+ int i;
+
+ if(progname == NULL)
+ progname = __progname;
+
+ if(num_args == 0)
+ msg = "no version information";
+ else {
+ for(i = 0; i < num_args; i++) {
+ if(i > 0)
+ len += 2;
+ len += strlen(arg[i]);
+ }
+ msg = malloc(len + 1);
+ if(msg == NULL) {
+ fprintf(stderr, "%s: out of memory\n", progname);
+ return;
+ }
+ msg[0] = '\0';
+ for(i = 0; i < num_args; i++) {
+ if(i > 0)
+ strcat(msg, ", ");
+ strcat(msg, arg[i]);
+ }
+ }
+ fprintf(stderr, "%s (%s)\n", progname, msg);
+ fprintf(stderr, "Copyright (c) 1999 Kungliga Tekniska Högskolan\n");
+ if(num_args != 0)
+ free(msg);
+}
diff --git a/crypto/kerberosIV/lib/roken/readv.c b/crypto/kerberosIV/lib/roken/readv.c
new file mode 100644
index 0000000..aee8441
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/readv.c
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: readv.c,v 1.4 1999/07/06 04:01:06 assar Exp $");
+#endif
+
+#include "roken.h"
+
+ssize_t
+readv(int d, const struct iovec *iov, int iovcnt)
+{
+ ssize_t ret, nb;
+ size_t tot = 0;
+ int i;
+ char *buf, *p;
+
+ for(i = 0; i < iovcnt; ++i)
+ tot += iov[i].iov_len;
+ buf = malloc(tot);
+ if (tot != 0 && buf == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ nb = ret = read (d, buf, tot);
+ p = buf;
+ while (nb > 0) {
+ ssize_t cnt = min(nb, iov->iov_len);
+
+ memcpy (iov->iov_base, p, cnt);
+ p += cnt;
+ nb -= cnt;
+ }
+ free(buf);
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/recvmsg.c b/crypto/kerberosIV/lib/roken/recvmsg.c
new file mode 100644
index 0000000..cf1fed7
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/recvmsg.c
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: recvmsg.c,v 1.4 1999/07/03 02:35:48 assar Exp $");
+#endif
+
+#include "roken.h"
+
+ssize_t
+recvmsg(int s, struct msghdr *msg, int flags)
+{
+ ssize_t ret, nb;
+ size_t tot = 0;
+ int i;
+ char *buf, *p;
+ struct iovec *iov = msg->msg_iov;
+
+ for(i = 0; i < msg->msg_iovlen; ++i)
+ tot += iov[i].iov_len;
+ buf = malloc(tot);
+ if (tot != 0 && buf == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ nb = ret = recvfrom (s, buf, tot, flags, msg->msg_name, &msg->msg_namelen);
+ p = buf;
+ while (nb > 0) {
+ ssize_t cnt = min(nb, iov->iov_len);
+
+ memcpy (iov->iov_base, p, cnt);
+ p += cnt;
+ nb -= cnt;
+ ++iov;
+ }
+ free(buf);
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/resolve.c b/crypto/kerberosIV/lib/roken/resolve.c
new file mode 100644
index 0000000..d7c2218
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/resolve.c
@@ -0,0 +1,358 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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>
+#endif
+#include "roken.h"
+#ifdef HAVE_ARPA_NAMESER_H
+#include <arpa/nameser.h>
+#endif
+#ifdef HAVE_RESOLV_H
+#include <resolv.h>
+#endif
+#include "resolve.h"
+
+RCSID("$Id: resolve.c,v 1.21 1999/07/03 02:36:26 assar Exp $");
+
+#if defined(HAVE_RES_SEARCH) && defined(HAVE_DN_EXPAND)
+
+#define DECL(X) {#X, T_##X}
+
+static struct stot{
+ const char *name;
+ int type;
+}stot[] = {
+ DECL(A),
+ DECL(NS),
+ DECL(CNAME),
+ DECL(PTR),
+ DECL(MX),
+ DECL(TXT),
+ DECL(AFSDB),
+ DECL(SRV),
+ {NULL, 0}
+};
+
+int _resolve_debug;
+
+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;
+}
+
+static const 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;
+}
+
+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 = calloc(1, sizeof(*r));
+ if (r == NULL)
+ return NULL;
+
+ p = data;
+#if 0
+ /* doesn't work on Crays */
+ memcpy(&r->h, p, sizeof(HEADER));
+ p += sizeof(HEADER);
+#else
+ memcpy(&r->h, p, 12); /* XXX this will probably be mostly garbage */
+ p += 12;
+#endif
+ status = dn_expand(data, data + len, p, host, sizeof(host));
+ if(status < 0){
+ dns_free_data(r);
+ return NULL;
+ }
+ r->q.domain = strdup(host);
+ if(r->q.domain == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ 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));
+ if(*rr == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ (*rr)->domain = strdup(host);
+ if((*rr)->domain == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ (*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);
+ if((*rr)->u.txt == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ 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));
+ if((*rr)->u.mx == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ (*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));
+ if((*rr)->u.srv == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ (*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);
+ if((*rr)->u.txt == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ strncpy((*rr)->u.txt, (char*)p + 1, *p);
+ (*rr)->u.txt[*p] = 0;
+ break;
+ }
+
+ default:
+ (*rr)->u.data = (unsigned char*)malloc(size);
+ if(size != 0 && (*rr)->u.data == NULL) {
+ dns_free_data(r);
+ return NULL;
+ }
+ memcpy((*rr)->u.data, p, size);
+ }
+ p += size;
+ rr = &(*rr)->next;
+ }
+ *rr = NULL;
+ return r;
+}
+
+static struct dns_reply *
+dns_lookup_int(const char *domain, int rr_class, int rr_type)
+{
+ unsigned char reply[1024];
+ int len;
+ struct dns_reply *r = NULL;
+ u_long old_options = 0;
+
+ if (_resolve_debug) {
+ old_options = _res.options;
+ _res.options |= RES_DEBUG;
+ fprintf(stderr, "dns_lookup(%s, %d, %s)\n", domain,
+ rr_class, type_to_string(rr_type));
+ }
+ len = res_search(domain, rr_class, rr_type, reply, sizeof(reply));
+ if (_resolve_debug) {
+ _res.options = old_options;
+ fprintf(stderr, "dns_lookup(%s, %d, %s) --> %d\n",
+ domain, rr_class, type_to_string(rr_type), len);
+ }
+ if (len >= 0)
+ r = parse_reply(reply, len);
+ return r;
+}
+
+struct dns_reply *
+dns_lookup(const char *domain, const char *type_name)
+{
+ int type;
+
+ type = string_to_type(type_name);
+ if(type == -1) {
+ if(_resolve_debug)
+ fprintf(stderr, "dns_lookup: unknown resource type: `%s'\n",
+ type_name);
+ return NULL;
+ }
+ return dns_lookup_int(domain, C_IN, type);
+}
+
+#else /* NOT 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->u.data);
+ break;
+ case T_A:
+ printf("%d.%d.%d.%d\n",
+ ((unsigned char*)rr->u.data)[0],
+ ((unsigned char*)rr->u.data)[1],
+ ((unsigned char*)rr->u.data)[2],
+ ((unsigned char*)rr->u.data)[3]);
+ break;
+ case T_MX:
+ case T_AFSDB:{
+ struct mx_record *mx = (struct mx_record*)rr->u.data;
+ printf("%d %s\n", mx->preference, mx->domain);
+ break;
+ }
+ case T_SRV:{
+ struct srv_record *srv = (struct srv_record*)rr->u.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/roken/resolve.h b/crypto/kerberosIV/lib/roken/resolve.h
new file mode 100644
index 0000000..a77827f
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/resolve.h
@@ -0,0 +1,108 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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.7 1998/11/26 16:09:41 joda Exp $ */
+
+#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
+#ifndef T_NAPTR
+#define T_NAPTR 35
+#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 T_A /* XXX if <arpa/nameser.h> isn't included */
+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 *);
+
+#endif /* __RESOLVE_H__ */
diff --git a/crypto/kerberosIV/lib/roken/resource.h b/crypto/kerberosIV/lib/roken/resource.h
new file mode 100644
index 0000000..01cd01d
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/resource.h
@@ -0,0 +1,15 @@
+//{{NO_DEPENDENCIES}}
+// Microsoft Developer Studio generated include file.
+// Used by roken.rc
+//
+
+// Next default values for new objects
+//
+#ifdef APSTUDIO_INVOKED
+#ifndef APSTUDIO_READONLY_SYMBOLS
+#define _APS_NEXT_RESOURCE_VALUE 101
+#define _APS_NEXT_COMMAND_VALUE 40001
+#define _APS_NEXT_CONTROL_VALUE 1000
+#define _APS_NEXT_SYMED_VALUE 101
+#endif
+#endif
diff --git a/crypto/kerberosIV/lib/roken/roken-common.h b/crypto/kerberosIV/lib/roken/roken-common.h
new file mode 100644
index 0000000..53003a9
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken-common.h
@@ -0,0 +1,147 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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-common.h,v 1.13 1999/03/20 02:46:16 assar Exp $ */
+
+#ifndef __ROKEN_COMMON_H__
+#define __ROKEN_COMMON_H__
+
+#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
+
+#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
+
+#ifndef F_OK
+#define F_OK 0
+#endif
+
+#ifndef O_ACCMODE
+#define O_ACCMODE 003
+#endif
+
+#ifndef _PATH_DEVNULL
+#define _PATH_DEVNULL "/dev/null"
+#endif
+
+#ifndef _PATH_HEQUIV
+#define _PATH_HEQUIV "/etc/hosts.equiv"
+#endif
+
+#ifndef MAXPATHLEN
+#define MAXPATHLEN (1024+4)
+#endif
+
+#ifndef SIG_ERR
+#define SIG_ERR ((RETSIGTYPE (*)())-1)
+#endif
+
+#ifndef HAVE___ATTRIBUTE__
+#define __attribute__(x)
+#endif
+
+#if IRIX != 4 /* fix for compiler bug */
+#ifdef RETSIGTYPE
+typedef RETSIGTYPE (*SigAction)(/* int??? */);
+SigAction signal(int iSig, SigAction pAction); /* BSD compatible */
+#endif
+#endif
+
+int ROKEN_LIB_FUNCTION simple_execvp(const char*, char *const[]);
+int ROKEN_LIB_FUNCTION simple_execlp(const char*, ...);
+
+void ROKEN_LIB_FUNCTION print_version(const char *);
+
+void *ROKEN_LIB_FUNCTION emalloc (size_t);
+void *ROKEN_LIB_FUNCTION erealloc (void *, size_t);
+char *ROKEN_LIB_FUNCTION estrdup (const char *);
+
+ssize_t ROKEN_LIB_FUNCTION eread (int fd, void *buf, size_t nbytes);
+ssize_t ROKEN_LIB_FUNCTION ewrite (int fd, const void *buf, size_t nbytes);
+
+#endif /* __ROKEN_COMMON_H__ */
diff --git a/crypto/kerberosIV/lib/roken/roken.awk b/crypto/kerberosIV/lib/roken/roken.awk
new file mode 100644
index 0000000..c9ecab3
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken.awk
@@ -0,0 +1,35 @@
+BEGIN {
+ print "#include <stdio.h>"
+ print "#ifdef HAVE_CONFIG_H"
+ print "#include <config.h>"
+ print "#endif"
+ print ""
+ print "int main()"
+ print "{"
+ print "puts(\"/* This is an OS dependent, generated file */\");"
+ print "puts(\"\\n\");"
+ print "puts(\"#ifndef __ROKEN_H__\");"
+ print "puts(\"#define __ROKEN_H__\");"
+ print "puts(\"\");"
+}
+END {
+ print "puts(\"#endif /* __ROKEN_H__ */\");"
+ print "exit(0);"
+ print "}"
+}
+
+$1 == "\#ifdef" || $1 == "\#ifndef" || $1 == "\#if" || $1 == "\#else" || $1 == "\#elif" || $1 == "\#endif" {
+ print $0;
+ next
+}
+
+{
+ s = ""
+ for(i = 1; i <= length; i++){
+ x = substr($0, i, 1)
+ if(x == "\"" || x == "\\")
+ s = s "\\";
+ s = s x;
+ }
+ print "puts(\"" s "\");"
+}
diff --git a/crypto/kerberosIV/lib/roken/roken.def b/crypto/kerberosIV/lib/roken/roken.def
index 13e3572..f9b0369 100644
--- a/crypto/kerberosIV/lib/roken/roken.def
+++ b/crypto/kerberosIV/lib/roken/roken.def
@@ -1,4 +1,17 @@
-LIBRARY roken
+LIBRARY roken BASE=0x68f0000
EXPORTS
gettimeofday
strcasecmp
+ strtok_r
+ snprintf
+ asprintf
+ vsnprintf
+ base64_decode
+ base64_encode
+ roken_concat
+ roken_vconcat
+ roken_vmconcat
+ roken_mconcat
+ getuid
+ dns_free_data
+ dns_lookup
diff --git a/crypto/kerberosIV/lib/roken/roken.dsp b/crypto/kerberosIV/lib/roken/roken.dsp
new file mode 100644
index 0000000..d84854e
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken.dsp
@@ -0,0 +1,156 @@
+# Microsoft Developer Studio Project File - Name="roken" - Package Owner=<4>
+# Microsoft Developer Studio Generated Build File, Format Version 5.00
+# ** DO NOT EDIT **
+
+# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
+
+CFG=roken - Win32 Release
+!MESSAGE This is not a valid makefile. To build this project using NMAKE,
+!MESSAGE use the Export Makefile command and run
+!MESSAGE
+!MESSAGE NMAKE /f "roken.mak".
+!MESSAGE
+!MESSAGE You can specify a configuration when running NMAKE
+!MESSAGE by defining the macro CFG on the command line. For example:
+!MESSAGE
+!MESSAGE NMAKE /f "roken.mak" CFG="roken - Win32 Release"
+!MESSAGE
+!MESSAGE Possible choices for configuration are:
+!MESSAGE
+!MESSAGE "roken - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE "roken - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library")
+!MESSAGE
+
+# Begin Project
+# PROP Scc_ProjName ""
+# PROP Scc_LocalPath ""
+CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
+
+!IF "$(CFG)" == "roken - Win32 Release"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 0
+# PROP BASE Output_Dir ".\Release"
+# PROP BASE Intermediate_Dir ".\Release"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 0
+# PROP Output_Dir ".\Release"
+# PROP Intermediate_Dir ".\Release"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MT /GX /O2 /I "..\krb" /I "..\des" /I "..\..\include" /I "..\..\include\win32" /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "NDEBUG" /win32
+# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "NDEBUG"
+# ADD RSC /l 0x409 /d "NDEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /base:"0x68e7780" /subsystem:windows /dll /machine:I386
+
+!ELSEIF "$(CFG)" == "roken - Win32 Debug"
+
+# PROP BASE Use_MFC 0
+# PROP BASE Use_Debug_Libraries 1
+# PROP BASE Output_Dir ".\Debug"
+# PROP BASE Intermediate_Dir ".\Debug"
+# PROP BASE Target_Dir ""
+# PROP Use_MFC 0
+# PROP Use_Debug_Libraries 1
+# PROP Output_Dir ".\Debug"
+# PROP Intermediate_Dir ".\Debug"
+# PROP Ignore_Export_Lib 0
+# PROP Target_Dir ""
+# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
+# ADD CPP /nologo /MDd /Gm /GX /Zi /Od /I "..\krb" /I "..\des" /I "..\..\include" /I "..\..\include\win32" /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /FD /c
+# ADD BASE MTL /nologo /D "_DEBUG" /win32
+# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
+# ADD BASE RSC /l 0x409 /d "_DEBUG"
+# ADD RSC /l 0x409 /d "_DEBUG"
+BSC32=bscmake.exe
+# ADD BASE BSC32 /nologo
+# ADD BSC32 /nologo
+LINK32=link.exe
+# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
+# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo /subsystem:windows /dll /debug /machine:I386 /def:".\roken.def"
+# SUBTRACT LINK32 /pdb:none
+
+!ENDIF
+
+# Begin Target
+
+# Name "roken - Win32 Release"
+# Name "roken - Win32 Debug"
+# Begin Group "Source Files"
+
+# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;hpj;bat;for;f90"
+# Begin Source File
+
+SOURCE=.\base64.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\concat.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\gettimeofday.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\getuid.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\resolve.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\roken.def
+
+!IF "$(CFG)" == "roken - Win32 Release"
+
+!ELSEIF "$(CFG)" == "roken - Win32 Debug"
+
+# PROP Exclude_From_Build 1
+
+!ENDIF
+
+# End Source File
+# Begin Source File
+
+SOURCE=.\snprintf.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strcasecmp.c
+# End Source File
+# Begin Source File
+
+SOURCE=.\strtok_r.c
+# End Source File
+# End Group
+# Begin Group "Header Files"
+
+# PROP Default_Filter "h;hpp;hxx;hm;inl;fi;fd"
+# Begin Source File
+
+SOURCE=.\resolve.h
+# End Source File
+# End Group
+# Begin Group "Resource Files"
+
+# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;cnt;rtf;gif;jpg;jpeg;jpe"
+# Begin Source File
+
+SOURCE=.\roken.rc
+# End Source File
+# End Group
+# End Target
+# End Project
diff --git a/crypto/kerberosIV/lib/roken/roken.h.in b/crypto/kerberosIV/lib/roken/roken.h.in
new file mode 100644
index 0000000..b86da81
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken.h.in
@@ -0,0 +1,435 @@
+/* -*- C -*- */
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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.in,v 1.113.2.1 1999/07/22 03:20:59 assar Exp $ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <signal.h>
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#ifdef HAVE_SYS_SOCKET_H
+#include <sys/socket.h>
+#endif
+#ifdef HAVE_SYS_UIO_H
+#include <sys/uio.h>
+#endif
+#ifdef HAVE_GRP_H
+#include <grp.h>
+#endif
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_NETINET_IN_H
+#include <netinet/in.h>
+#endif
+#ifdef HAVE_NETINET_IN6_H
+#include <netinet/in6.h>
+#endif
+#ifdef HAVE_NETINET6_IN6_H
+#include <netinet6/in6.h>
+#endif
+#ifdef HAVE_SYSLOG_H
+#include <syslog.h>
+#endif
+#ifdef HAVE_WINSOCK_H
+#include <winsock.h>
+#endif
+#ifdef HAVE_FCNTL_H
+#include <fcntl.h>
+#endif
+#ifdef HAVE_ERRNO_H
+#include <errno.h>
+#endif
+#ifdef HAVE_ERR_H
+#include <err.h>
+#endif
+#ifdef HAVE_TERMIOS_H
+#include <termios.h>
+#endif
+#if defined(HAVE_SYS_IOCTL_H) && SunOS != 40
+#include <sys/ioctl.h>
+#endif
+#ifdef TIME_WITH_SYS_TIME
+#include <sys/time.h>
+#include <time.h>
+#elif defined(HAVE_SYS_TIME_H)
+#include <sys/time.h>
+#else
+#include <time.h>
+#endif
+
+#ifdef HAVE_PATHS_H
+#include <paths.h>
+#endif
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#ifndef ROKEN_LIB_FUNCTION
+#if defined(__BORLANDC__)
+#define ROKEN_LIB_FUNCTION /* not-ready-definition-yet */
+#elif defined(_MSC_VER)
+#define ROKEN_LIB_FUNCTION /* not-ready-definition-yet2 */
+#else
+#define ROKEN_LIB_FUNCTION
+#endif
+#endif
+
+#include <roken-common.h>
+
+#if !defined(HAVE_SETSID) && defined(HAVE__SETSID)
+#define setsid _setsid
+#endif
+
+#ifndef HAVE_PUTENV
+int putenv(const char *string);
+#endif
+
+#if !defined(HAVE_SETENV) || defined(NEED_SETENV_PROTO)
+int setenv(const char *var, const char *val, int rewrite);
+#endif
+
+#if !defined(HAVE_UNSETENV) || defined(NEED_UNSETENV_PROTO)
+void unsetenv(const char *name);
+#endif
+
+#if !defined(HAVE_GETUSERSHELL) || defined(NEED_GETUSERSHELL_PROTO)
+char *getusershell(void);
+void endusershell(void);
+#endif
+
+#if !defined(HAVE_SNPRINTF) || defined(NEED_SNPRINTF_PROTO)
+int snprintf (char *str, size_t sz, const char *format, ...)
+ __attribute__ ((format (printf, 3, 4)));
+#endif
+
+#if !defined(HAVE_VSNPRINTF) || defined(NEED_VSNPRINTF_PROTO)
+int vsnprintf (char *str, size_t sz, const char *format, va_list ap)
+ __attribute__((format (printf, 3, 0)));
+#endif
+
+#if !defined(HAVE_ASPRINTF) || defined(NEED_ASPRINTF_PROTO)
+int asprintf (char **ret, const char *format, ...)
+ __attribute__ ((format (printf, 2, 3)));
+#endif
+
+#if !defined(HAVE_VASPRINTF) || defined(NEED_VASPRINTF_PROTO)
+int vasprintf (char **ret, const char *format, va_list ap)
+ __attribute__((format (printf, 2, 0)));
+#endif
+
+#if !defined(HAVE_ASNPRINTF) || defined(NEED_ASNPRINTF_PROTO)
+int asnprintf (char **ret, size_t max_sz, const char *format, ...)
+ __attribute__ ((format (printf, 3, 4)));
+#endif
+
+#if !defined(HAVE_VASNPRINTF) || defined(NEED_VASNPRINTF_PROTO)
+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_STRNDUP
+char * strndup(const char *old, size_t sz);
+#endif
+
+#ifndef HAVE_STRLWR
+char * strlwr(char *);
+#endif
+
+#ifndef HAVE_STRNLEN
+size_t strnlen(const char*, size_t);
+#endif
+
+#if !defined(HAVE_STRSEP) || defined(NEED_STRSEP_PROTO)
+char *strsep(char**, const char*);
+#endif
+
+#ifndef HAVE_STRCASECMP
+int strcasecmp(const char *s1, const char *s2);
+#endif
+
+#ifdef NEED_FCLOSE_PROTO
+int fclose(FILE *);
+#endif
+
+#ifdef NEED_STRTOK_R_PROTO
+char *strtok_r(char *s1, const char *s2, char **lasts);
+#endif
+
+#ifndef HAVE_STRUPR
+char * strupr(char *);
+#endif
+
+#ifndef HAVE_STRCPY_TRUNCATE
+int strcpy_truncate (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_STRCAT_TRUNCATE
+int strcat_truncate (char *dst, const char *src, size_t dst_sz);
+#endif
+
+#ifndef HAVE_GETDTABLESIZE
+int getdtablesize(void);
+#endif
+
+#if !defined(HAVE_STRERROR) && !defined(strerror)
+char *strerror(int eno);
+#endif
+
+#if !defined(HAVE_HSTRERROR) || defined(NEED_HSTRERROR_PROTO)
+/* This causes a fatal error under Psoriasis */
+#if !(defined(SunOS) && (SunOS >= 50))
+const char *hstrerror(int herr);
+#endif
+#endif
+
+#ifndef HAVE_H_ERRNO_DECLARATION
+extern int h_errno;
+#endif
+
+#if !defined(HAVE_INET_ATON) || defined(NEED_INET_ATON_PROTO)
+int inet_aton(const char *cp, struct in_addr *adr);
+#endif
+
+#if !defined(HAVE_GETCWD)
+char* getcwd(char *path, size_t size);
+#endif
+
+#ifdef HAVE_PWD_H
+#include <pwd.h>
+struct passwd *k_getpwnam (char *user);
+struct passwd *k_getpwuid (uid_t uid);
+#endif
+
+const char *get_default_username (void);
+
+#ifndef HAVE_SETEUID
+int seteuid(uid_t euid);
+#endif
+
+#ifndef HAVE_SETEGID
+int setegid(gid_t egid);
+#endif
+
+#ifndef HAVE_LSTAT
+int lstat(const char *path, struct stat *buf);
+#endif
+
+#if !defined(HAVE_MKSTEMP) || defined(NEED_MKSTEMP_PROTO)
+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_DAEMON
+int daemon(int nochdir, int noclose);
+#endif
+
+#ifndef HAVE_INNETGR
+int innetgr(const char *netgroup, const char *machine,
+ const char *user, const char *domain);
+#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
+
+#if !defined(HAVE_INNETGR) || defined(NEED_INNETGR_PROTO)
+int innetgr(const char*, const char*, const char*, const char*);
+#endif
+
+#ifndef HAVE_IRUSEROK
+int iruserok(unsigned raddr, int superuser, const char *ruser,
+ const char *luser);
+#endif
+
+#if !defined(HAVE_GETHOSTNAME) || defined(NEED_GETHOSTNAME_PROTO)
+int gethostname(char *name, int namelen);
+#endif
+
+#ifndef HAVE_WRITEV
+ssize_t
+writev(int d, const struct iovec *iov, int iovcnt);
+#endif
+
+#ifndef HAVE_READV
+ssize_t
+readv(int d, const struct iovec *iov, int iovcnt);
+#endif
+
+#ifndef HAVE_MKSTEMP
+int
+mkstemp(char *template);
+#endif
+
+#ifndef HAVE_FLOCK
+#ifndef LOCK_SH
+#define LOCK_SH 1 /* Shared lock */
+#endif
+#ifndef LOCK_EX
+#define LOCK_EX 2 /* Exclusive lock */
+#endif
+#ifndef LOCK_NB
+#define LOCK_NB 4 /* Don't block when locking */
+#endif
+#ifndef LOCK_UN
+#define LOCK_UN 8 /* Unlock */
+#endif
+
+int flock(int fd, int operation);
+#endif /* HAVE_FLOCK */
+
+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);
+
+int roken_concat (char *s, size_t len, ...);
+
+size_t roken_mconcat (char **s, size_t max_len, ...);
+
+int roken_vconcat (char *s, size_t len, va_list args);
+
+size_t roken_vmconcat (char **s, size_t max_len, va_list args);
+
+ssize_t net_write (int fd, const void *buf, size_t nbytes);
+
+ssize_t net_read (int fd, void *buf, size_t nbytes);
+
+int issuid(void);
+
+#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 HAVE_VSYSLOG
+void vsyslog(int pri, const char *fmt, va_list ap);
+#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
+
+#ifndef HAVE_ENVIRON_DECLARATION
+extern char **environ;
+#endif
+
+/*
+ * kludges and such
+ */
+
+#if 1
+int roken_gethostby_setup(const char*, const char*);
+struct hostent* roken_gethostbyname(const char*);
+struct hostent* roken_gethostbyaddr(const void*, size_t, int);
+#else
+#ifdef GETHOSTBYNAME_PROTO_COMPATIBLE
+#define roken_gethostbyname(x) gethostbyname(x)
+#else
+#define roken_gethostbyname(x) gethostbyname((char *)x)
+#endif
+
+#ifdef GETHOSTBYADDR_PROTO_COMPATIBLE
+#define roken_gethostbyaddr(a, l, t) gethostbyaddr(a, l, t)
+#else
+#define roken_gethostbyaddr(a, l, t) gethostbyaddr((char *)a, l, t)
+#endif
+#endif
+
+#ifdef GETSERVBYNAME_PROTO_COMPATIBLE
+#define roken_getservbyname(x,y) getservbyname(x,y)
+#else
+#define roken_getservbyname(x,y) getservbyname((char *)x, (char *)y)
+#endif
+
+#ifdef OPENLOG_PROTO_COMPATIBLE
+#define roken_openlog(a,b,c) openlog(a,b,c)
+#else
+#define roken_openlog(a,b,c) openlog((char *)a,b,c)
+#endif
+
+void set_progname(char *argv0);
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/crypto/kerberosIV/lib/roken/roken.mak b/crypto/kerberosIV/lib/roken/roken.mak
index d0c4a6f..da9a834 100644
--- a/crypto/kerberosIV/lib/roken/roken.mak
+++ b/crypto/kerberosIV/lib/roken/roken.mak
@@ -1,19 +1,15 @@
-# Microsoft Developer Studio Generated NMAKE File, Format Version 4.10
-# ** DO NOT EDIT **
-
-# TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102
-
+# Microsoft Developer Studio Generated NMAKE File, Based on roken.dsp
!IF "$(CFG)" == ""
-CFG=roken - Win32 Debug
-!MESSAGE No configuration specified. Defaulting to roken - Win32 Debug.
+CFG=roken - Win32 Release
+!MESSAGE No configuration specified. Defaulting to roken - Win32 Release.
!ENDIF
!IF "$(CFG)" != "roken - Win32 Release" && "$(CFG)" != "roken - Win32 Debug"
!MESSAGE Invalid configuration "$(CFG)" specified.
-!MESSAGE You can specify a configuration when running NMAKE on this makefile
+!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
-!MESSAGE NMAKE /f "roken.mak" CFG="roken - Win32 Debug"
+!MESSAGE NMAKE /f "roken.mak" CFG="roken - Win32 Release"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
@@ -28,251 +24,293 @@ NULL=
!ELSE
NULL=nul
!ENDIF
-################################################################################
-# Begin Project
-# PROP Target_Last_Scanned "roken - Win32 Debug"
-RSC=rc.exe
-MTL=mktyplib.exe
+
CPP=cl.exe
+MTL=midl.exe
+RSC=rc.exe
!IF "$(CFG)" == "roken - Win32 Release"
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 0
-# PROP BASE Output_Dir "Release"
-# PROP BASE Intermediate_Dir "Release"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 0
-# PROP Output_Dir "Release"
-# PROP Intermediate_Dir "Release"
-# PROP Target_Dir ""
OUTDIR=.\Release
INTDIR=.\Release
+# Begin Custom Macros
+OutDir=.\.\Release
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
+
+ALL : "$(OUTDIR)\roken.dll"
-ALL : ".\Release\roken.dll"
+!ELSE
+
+ALL : "$(OUTDIR)\roken.dll"
+
+!ENDIF
CLEAN :
- -@erase ".\Release\gettimeofday.obj"
- -@erase ".\Release\roken.dll"
- -@erase ".\Release\roken.exp"
- -@erase ".\Release\roken.lib"
- -@erase ".\Release\strcasecmp.obj"
+ -@erase "$(INTDIR)\base64.obj"
+ -@erase "$(INTDIR)\concat.obj"
+ -@erase "$(INTDIR)\gettimeofday.obj"
+ -@erase "$(INTDIR)\getuid.obj"
+ -@erase "$(INTDIR)\resolve.obj"
+ -@erase "$(INTDIR)\roken.res"
+ -@erase "$(INTDIR)\snprintf.obj"
+ -@erase "$(INTDIR)\strcasecmp.obj"
+ -@erase "$(INTDIR)\strtok_r.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(OUTDIR)\roken.dll"
+ -@erase "$(OUTDIR)\roken.exp"
+ -@erase "$(OUTDIR)\roken.lib"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-# ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MT /W3 /GX /O2 /I "..\krb" /I "..\des" /I "..\..\include" /I "..\..\include\win32" /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /c
-CPP_PROJ=/nologo /MT /W3 /GX /O2 /I "..\krb" /I "..\des" /I "..\..\include" /I\
+CPP_PROJ=/nologo /MT /GX /O2 /I "..\krb" /I "..\des" /I "..\..\include" /I\
"..\..\include\win32" /I "." /D "NDEBUG" /D "WIN32" /D "_WINDOWS" /D\
- "HAVE_CONFIG_H" /Fp"$(INTDIR)/roken.pch" /YX /Fo"$(INTDIR)/" /c
+ "HAVE_CONFIG_H" /Fp"$(INTDIR)\roken.pch" /YX /Fo"$(INTDIR)\\" /Fd"$(INTDIR)\\"\
+ /FD /c
CPP_OBJS=.\Release/
-CPP_SBRS=.\.
-# ADD BASE MTL /nologo /D "NDEBUG" /win32
-# ADD MTL /nologo /D "NDEBUG" /win32
-MTL_PROJ=/nologo /D "NDEBUG" /win32
-# ADD BASE RSC /l 0x409 /d "NDEBUG"
-# ADD RSC /l 0x409 /d "NDEBUG"
+CPP_SBRS=.
+MTL_PROJ=/nologo /D "NDEBUG" /mktyplib203 /win32
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\roken.res" /d "NDEBUG"
BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/roken.bsc"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\roken.bsc"
BSC32_SBRS= \
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
- odbccp32.lib /nologo /subsystem:windows /dll /incremental:no\
- /pdb:"$(OUTDIR)/roken.pdb" /machine:I386 /def:".\roken.def"\
- /out:"$(OUTDIR)/roken.dll" /implib:"$(OUTDIR)/roken.lib"
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\
+ /base:"0x68e7780" /subsystem:windows /dll /incremental:no\
+ /pdb:"$(OUTDIR)\roken.pdb" /machine:I386 /def:".\roken.def"\
+ /out:"$(OUTDIR)\roken.dll" /implib:"$(OUTDIR)\roken.lib"
DEF_FILE= \
".\roken.def"
LINK32_OBJS= \
- ".\Release\gettimeofday.obj" \
- ".\Release\strcasecmp.obj"
-
-".\Release\roken.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ "$(INTDIR)\base64.obj" \
+ "$(INTDIR)\concat.obj" \
+ "$(INTDIR)\gettimeofday.obj" \
+ "$(INTDIR)\getuid.obj" \
+ "$(INTDIR)\resolve.obj" \
+ "$(INTDIR)\roken.res" \
+ "$(INTDIR)\snprintf.obj" \
+ "$(INTDIR)\strcasecmp.obj" \
+ "$(INTDIR)\strtok_r.obj"
+
+"$(OUTDIR)\roken.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ELSEIF "$(CFG)" == "roken - Win32 Debug"
-# PROP BASE Use_MFC 0
-# PROP BASE Use_Debug_Libraries 1
-# PROP BASE Output_Dir "Debug"
-# PROP BASE Intermediate_Dir "Debug"
-# PROP BASE Target_Dir ""
-# PROP Use_MFC 0
-# PROP Use_Debug_Libraries 1
-# PROP Output_Dir "Debug"
-# PROP Intermediate_Dir "Debug"
-# PROP Target_Dir ""
OUTDIR=.\Debug
INTDIR=.\Debug
+# Begin Custom Macros
+OutDir=.\.\Debug
+# End Custom Macros
+
+!IF "$(RECURSE)" == "0"
-ALL : ".\Debug\roken.dll"
+ALL : "$(OUTDIR)\roken.dll"
+
+!ELSE
+
+ALL : "$(OUTDIR)\roken.dll"
+
+!ENDIF
CLEAN :
- -@erase ".\Debug\gettimeofday.obj"
- -@erase ".\Debug\roken.dll"
- -@erase ".\Debug\roken.exp"
- -@erase ".\Debug\roken.ilk"
- -@erase ".\Debug\roken.lib"
- -@erase ".\Debug\roken.pdb"
- -@erase ".\Debug\strcasecmp.obj"
- -@erase ".\Debug\vc40.idb"
- -@erase ".\Debug\vc40.pdb"
+ -@erase "$(INTDIR)\base64.obj"
+ -@erase "$(INTDIR)\concat.obj"
+ -@erase "$(INTDIR)\gettimeofday.obj"
+ -@erase "$(INTDIR)\getuid.obj"
+ -@erase "$(INTDIR)\resolve.obj"
+ -@erase "$(INTDIR)\roken.res"
+ -@erase "$(INTDIR)\snprintf.obj"
+ -@erase "$(INTDIR)\strcasecmp.obj"
+ -@erase "$(INTDIR)\strtok_r.obj"
+ -@erase "$(INTDIR)\vc50.idb"
+ -@erase "$(INTDIR)\vc50.pdb"
+ -@erase "$(OUTDIR)\roken.dll"
+ -@erase "$(OUTDIR)\roken.exp"
+ -@erase "$(OUTDIR)\roken.ilk"
+ -@erase "$(OUTDIR)\roken.lib"
+ -@erase "$(OUTDIR)\roken.pdb"
"$(OUTDIR)" :
if not exist "$(OUTDIR)/$(NULL)" mkdir "$(OUTDIR)"
-# ADD BASE CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /c
-# ADD CPP /nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\krb" /I "..\des" /I "..\..\include" /I "..\..\include\win32" /I "." /D "_DEBUG" /D "WIN32" /D "_WINDOWS" /D "HAVE_CONFIG_H" /YX /c
-CPP_PROJ=/nologo /MTd /W3 /Gm /GX /Zi /Od /I "..\krb" /I "..\des" /I\
+CPP_PROJ=/nologo /MDd /Gm /GX /Zi /Od /I "..\krb" /I "..\des" /I\
"..\..\include" /I "..\..\include\win32" /I "." /D "_DEBUG" /D "WIN32" /D\
- "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)/roken.pch" /YX /Fo"$(INTDIR)/"\
- /Fd"$(INTDIR)/" /c
+ "_WINDOWS" /D "HAVE_CONFIG_H" /Fp"$(INTDIR)\roken.pch" /YX /Fo"$(INTDIR)\\"\
+ /Fd"$(INTDIR)\\" /FD /c
CPP_OBJS=.\Debug/
-CPP_SBRS=.\.
-# ADD BASE MTL /nologo /D "_DEBUG" /win32
-# ADD MTL /nologo /D "_DEBUG" /win32
-MTL_PROJ=/nologo /D "_DEBUG" /win32
-# ADD BASE RSC /l 0x409 /d "_DEBUG"
-# ADD RSC /l 0x409 /d "_DEBUG"
+CPP_SBRS=.
+MTL_PROJ=/nologo /D "_DEBUG" /mktyplib203 /win32
+RSC_PROJ=/l 0x409 /fo"$(INTDIR)\roken.res" /d "_DEBUG"
BSC32=bscmake.exe
-# ADD BASE BSC32 /nologo
-# ADD BSC32 /nologo
-BSC32_FLAGS=/nologo /o"$(OUTDIR)/roken.bsc"
+BSC32_FLAGS=/nologo /o"$(OUTDIR)\roken.bsc"
BSC32_SBRS= \
LINK32=link.exe
-# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
-# ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:windows /dll /debug /machine:I386
LINK32_FLAGS=kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib\
- advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib\
- odbccp32.lib /nologo /subsystem:windows /dll /incremental:yes\
- /pdb:"$(OUTDIR)/roken.pdb" /debug /machine:I386 /def:".\roken.def"\
- /out:"$(OUTDIR)/roken.dll" /implib:"$(OUTDIR)/roken.lib"
-DEF_FILE= \
- ".\roken.def"
+ advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib /nologo\
+ /subsystem:windows /dll /incremental:yes /pdb:"$(OUTDIR)\roken.pdb" /debug\
+ /machine:I386 /def:".\roken.def" /out:"$(OUTDIR)\roken.dll"\
+ /implib:"$(OUTDIR)\roken.lib"
LINK32_OBJS= \
- ".\Debug\gettimeofday.obj" \
- ".\Debug\strcasecmp.obj"
-
-".\Debug\roken.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
+ "$(INTDIR)\base64.obj" \
+ "$(INTDIR)\concat.obj" \
+ "$(INTDIR)\gettimeofday.obj" \
+ "$(INTDIR)\getuid.obj" \
+ "$(INTDIR)\resolve.obj" \
+ "$(INTDIR)\roken.res" \
+ "$(INTDIR)\snprintf.obj" \
+ "$(INTDIR)\strcasecmp.obj" \
+ "$(INTDIR)\strtok_r.obj"
+
+"$(OUTDIR)\roken.dll" : "$(OUTDIR)" $(DEF_FILE) $(LINK32_OBJS)
$(LINK32) @<<
$(LINK32_FLAGS) $(LINK32_OBJS)
<<
!ENDIF
-.c{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
-
-.cpp{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
+.c{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-.cxx{$(CPP_OBJS)}.obj:
- $(CPP) $(CPP_PROJ) $<
+.cpp{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-.c{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
+.cxx{$(CPP_OBJS)}.obj::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-.cpp{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
+.c{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-.cxx{$(CPP_SBRS)}.sbr:
- $(CPP) $(CPP_PROJ) $<
+.cpp{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-################################################################################
-# Begin Target
+.cxx{$(CPP_SBRS)}.sbr::
+ $(CPP) @<<
+ $(CPP_PROJ) $<
+<<
-# Name "roken - Win32 Release"
-# Name "roken - Win32 Debug"
-!IF "$(CFG)" == "roken - Win32 Release"
+!IF "$(CFG)" == "roken - Win32 Release" || "$(CFG)" == "roken - Win32 Debug"
+SOURCE=.\base64.c
+DEP_CPP_BASE6=\
+ "..\..\include\win32\config.h"\
+ ".\base64.h"\
-!ELSEIF "$(CFG)" == "roken - Win32 Debug"
-!ENDIF
+"$(INTDIR)\base64.obj" : $(SOURCE) $(DEP_CPP_BASE6) "$(INTDIR)"
-################################################################################
-# Begin Source File
-SOURCE=\TEMP\jimpa3\lib\krb\gettimeofday.c
-DEP_CPP_GETTI=\
- "..\..\include\protos.h"\
- "..\..\include\sys/bitypes.h"\
- "..\..\include\sys/cdefs.h"\
+SOURCE=.\concat.c
+DEP_CPP_CONCA=\
"..\..\include\win32\config.h"\
- "..\des\des.h"\
- "..\krb\krb.h"\
- "..\krb\krb_locl.h"\
- "..\krb\prot.h"\
- "..\krb\resolve.h"\
- ".\roken.h"\
- {$(INCLUDE)}"\sys\stat.h"\
- {$(INCLUDE)}"\sys\types.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!IF "$(CFG)" == "roken - Win32 Release"
+"$(INTDIR)\concat.obj" : $(SOURCE) $(DEP_CPP_CONCA) "$(INTDIR)"
-".\Release\gettimeofday.obj" : $(SOURCE) $(DEP_CPP_GETTI) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
+SOURCE=.\gettimeofday.c
+DEP_CPP_GETTI=\
+ "..\..\include\win32\config.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
+
+"$(INTDIR)\gettimeofday.obj" : $(SOURCE) $(DEP_CPP_GETTI) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "roken - Win32 Debug"
+SOURCE=.\getuid.c
+DEP_CPP_GETUI=\
+ "..\..\include\win32\config.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
+
-".\Debug\gettimeofday.obj" : $(SOURCE) $(DEP_CPP_GETTI) "$(INTDIR)"
- $(CPP) $(CPP_PROJ) $(SOURCE)
+"$(INTDIR)\getuid.obj" : $(SOURCE) $(DEP_CPP_GETUI) "$(INTDIR)"
-!ENDIF
+SOURCE=.\resolve.c
+DEP_CPP_RESOL=\
+ "..\..\include\win32\config.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\resolve.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
+
-# End Source File
-################################################################################
-# Begin Source File
+"$(INTDIR)\resolve.obj" : $(SOURCE) $(DEP_CPP_RESOL) "$(INTDIR)"
-SOURCE=.\roken.def
-!IF "$(CFG)" == "roken - Win32 Release"
+SOURCE=.\snprintf.c
+DEP_CPP_SNPRI=\
+ "..\..\include\win32\config.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
+
-!ELSEIF "$(CFG)" == "roken - Win32 Debug"
+"$(INTDIR)\snprintf.obj" : $(SOURCE) $(DEP_CPP_SNPRI) "$(INTDIR)"
-!ENDIF
-
-# End Source File
-################################################################################
-# Begin Source File
SOURCE=.\strcasecmp.c
DEP_CPP_STRCA=\
- "..\..\include\sys/cdefs.h"\
"..\..\include\win32\config.h"\
- {$(INCLUDE)}"\sys\types.h"\
+ {$(INCLUDE)}"sys\types.h"\
-!IF "$(CFG)" == "roken - Win32 Release"
+"$(INTDIR)\strcasecmp.obj" : $(SOURCE) $(DEP_CPP_STRCA) "$(INTDIR)"
-".\Release\strcasecmp.obj" : $(SOURCE) $(DEP_CPP_STRCA) "$(INTDIR)"
+SOURCE=.\strtok_r.c
+DEP_CPP_STRTO=\
+ "..\..\include\win32\config.h"\
+ "..\..\include\win32\roken.h"\
+ ".\err.h"\
+ ".\roken-common.h"\
+ {$(INCLUDE)}"sys\stat.h"\
+ {$(INCLUDE)}"sys\types.h"\
+
+"$(INTDIR)\strtok_r.obj" : $(SOURCE) $(DEP_CPP_STRTO) "$(INTDIR)"
-!ELSEIF "$(CFG)" == "roken - Win32 Debug"
+SOURCE=.\roken.rc
-".\Debug\strcasecmp.obj" : $(SOURCE) $(DEP_CPP_STRCA) "$(INTDIR)"
+"$(INTDIR)\roken.res" : $(SOURCE) "$(INTDIR)"
+ $(RSC) $(RSC_PROJ) $(SOURCE)
+
!ENDIF
-# End Source File
-# End Target
-# End Project
-################################################################################
diff --git a/crypto/kerberosIV/lib/roken/roken.rc b/crypto/kerberosIV/lib/roken/roken.rc
new file mode 100644
index 0000000..e7e2f3e
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken.rc
@@ -0,0 +1,105 @@
+//Microsoft Developer Studio generated resource script.
+//
+#include "resource.h"
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#include "afxres.h"
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// Swedish resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_SVE)
+#ifdef _WIN32
+LANGUAGE LANG_SWEDISH, SUBLANG_DEFAULT
+#pragma code_page(1252)
+#endif //_WIN32
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "#include ""afxres.h""\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE DISCARDABLE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+#ifndef _MAC
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION 1,0,0,1
+ PRODUCTVERSION 1,0,0,1
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x40004L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "CompanyName", "Royal Institute of Technology (KTH)\0"
+ VALUE "FileDescription", "roken\0"
+ VALUE "FileVersion", "4, 0, 9, 9\0"
+ VALUE "InternalName", "roken\0"
+ VALUE "LegalCopyright", "Copyright © 1996 - 1998 Royal Institute of Technology (KTH)\0"
+ VALUE "OriginalFilename", "roken.dll\0"
+ VALUE "ProductName", "KTH Kerberos\0"
+ VALUE "ProductVersion", "4,0,9,9\0"
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+#endif // !_MAC
+
+#endif // Swedish resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/crypto/kerberosIV/lib/roken/roken_gethostby.c b/crypto/kerberosIV/lib/roken/roken_gethostby.c
new file mode 100644
index 0000000..a671099
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/roken_gethostby.c
@@ -0,0 +1,285 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: roken_gethostby.c,v 1.3 1998/07/24 07:25:27 assar Exp $");
+#endif
+
+#include <roken.h>
+#ifdef HAVE_NETDB_H
+#include <netdb.h>
+#endif
+#ifdef HAVE_ARPA_INET_H
+#include <arpa/inet.h>
+#endif
+
+#undef roken_gethostbyname
+#undef roken_gethostbyaddr
+
+static struct sockaddr_in dns_addr;
+static char *dns_req;
+
+static int
+make_address(const char *address, struct in_addr *ip)
+{
+ if(inet_aton(address, ip) == 0){
+ /* try to resolve as hostname, it might work if the address we
+ are trying to lookup is local, for instance a web proxy */
+ struct hostent *he = gethostbyname(address);
+ if(he) {
+ unsigned char *p = (unsigned char*)he->h_addr;
+ ip->s_addr = (p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3];
+ } else {
+ return -1;
+ }
+ }
+ return 0;
+}
+
+static int
+setup_int(const char *proxy_host, short proxy_port,
+ const char *dns_host, short dns_port,
+ const char *dns_path)
+{
+ memset(&dns_addr, 0, sizeof(dns_addr));
+ if(dns_req)
+ free(dns_req);
+ if(proxy_host) {
+ if(make_address(proxy_host, &dns_addr.sin_addr) != 0)
+ return -1;
+ dns_addr.sin_port = htons(proxy_port);
+ asprintf(&dns_req, "http://%s:%d%s", dns_host, dns_port, dns_path);
+ } else {
+ if(make_address(dns_host, &dns_addr.sin_addr) != 0)
+ return -1;
+ dns_addr.sin_port = htons(dns_port);
+ asprintf(&dns_req, "%s", dns_path);
+ }
+ dns_addr.sin_family = AF_INET;
+ return 0;
+}
+
+static void
+split_spec(const char *spec, char **host, int *port, char **path, int def_port)
+{
+ char *p;
+ *host = strdup(spec);
+ p = strchr(*host, ':');
+ if(p) {
+ *p++ = '\0';
+ if(sscanf(p, "%d", port) != 1)
+ *port = def_port;
+ } else
+ *port = def_port;
+ p = strchr(p ? p : *host, '/');
+ if(p) {
+ if(path)
+ *path = strdup(p);
+ *p = '\0';
+ }else
+ if(path)
+ *path = NULL;
+}
+
+
+int
+roken_gethostby_setup(const char *proxy_spec, const char *dns_spec)
+{
+ char *proxy_host = NULL;
+ int proxy_port;
+ char *dns_host, *dns_path;
+ int dns_port;
+
+ int ret = -1;
+
+ split_spec(dns_spec, &dns_host, &dns_port, &dns_path, 80);
+ if(dns_path == NULL)
+ goto out;
+ if(proxy_spec)
+ split_spec(proxy_spec, &proxy_host, &proxy_port, NULL, 80);
+ ret = setup_int(proxy_host, proxy_port, dns_host, dns_port, dns_path);
+out:
+ free(proxy_host);
+ free(dns_host);
+ free(dns_path);
+ return ret;
+}
+
+
+/* Try to lookup a name or an ip-address using http as transport
+ mechanism. See the end of this file for an example program. */
+static struct hostent*
+roken_gethostby(const char *hostname)
+{
+ int s;
+ struct sockaddr_in sin;
+ char *request;
+ char buf[1024];
+ int offset = 0;
+ int n;
+ char *p, *foo;
+
+ if(dns_addr.sin_family == 0)
+ return NULL; /* no configured host */
+ sin = dns_addr;
+ asprintf(&request, "GET %s?%s HTTP/1.0\r\n\r\n", dns_req, hostname);
+ if(request == NULL)
+ return NULL;
+ s = socket(AF_INET, SOCK_STREAM, 0);
+ if(s < 0) {
+ free(request);
+ return NULL;
+ }
+ if(connect(s, (struct sockaddr*)&sin, sizeof(sin)) < 0) {
+ close(s);
+ free(request);
+ return NULL;
+ }
+ if(write(s, request, strlen(request)) != strlen(request)) {
+ close(s);
+ free(request);
+ return NULL;
+ }
+ free(request);
+ while(1) {
+ n = read(s, buf + offset, sizeof(buf) - offset);
+ if(n <= 0)
+ break;
+ offset += n;
+ }
+ buf[offset] = '\0';
+ close(s);
+ p = strstr(buf, "\r\n\r\n"); /* find end of header */
+ if(p) p += 4;
+ else return NULL;
+ foo = NULL;
+ p = strtok_r(p, " \t\r\n", &foo);
+ if(p == NULL)
+ return NULL;
+ {
+ /* make a hostent to return */
+#define MAX_ADDRS 16
+ static struct hostent he;
+ static char addrs[4 * MAX_ADDRS];
+ static char *addr_list[MAX_ADDRS];
+ int num_addrs = 0;
+
+ he.h_name = p;
+ he.h_aliases = NULL;
+ he.h_addrtype = AF_INET;
+ he.h_length = 4;
+
+ while((p = strtok_r(NULL, " \t\r\n", &foo)) && num_addrs < MAX_ADDRS) {
+ struct in_addr ip;
+ inet_aton(p, &ip);
+ ip.s_addr = ntohl(ip.s_addr);
+ addr_list[num_addrs] = &addrs[num_addrs * 4];
+ addrs[num_addrs * 4 + 0] = (ip.s_addr >> 24) & 0xff;
+ addrs[num_addrs * 4 + 1] = (ip.s_addr >> 16) & 0xff;
+ addrs[num_addrs * 4 + 2] = (ip.s_addr >> 8) & 0xff;
+ addrs[num_addrs * 4 + 3] = (ip.s_addr >> 0) & 0xff;
+ addr_list[++num_addrs] = NULL;
+ }
+ he.h_addr_list = addr_list;
+ return &he;
+ }
+}
+
+struct hostent*
+roken_gethostbyname(const char *hostname)
+{
+ struct hostent *he;
+ he = gethostbyname(hostname);
+ if(he)
+ return he;
+ return roken_gethostby(hostname);
+}
+
+struct hostent*
+roken_gethostbyaddr(const void *addr, size_t len, int type)
+{
+ struct in_addr a;
+ const char *p;
+ struct hostent *he;
+ he = gethostbyaddr(addr, len, type);
+ if(he)
+ return he;
+ if(type != AF_INET || len != 4)
+ return NULL;
+ p = addr;
+ a.s_addr = htonl((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+ return roken_gethostby(inet_ntoa(a));
+}
+
+#if 0
+
+/* this program can be used as a cgi `script' to lookup names and
+ ip-addresses */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <netdb.h>
+#include <sys/param.h>
+
+int
+main(int argc, char **argv)
+{
+ char *query = getenv("QUERY_STRING");
+ char host[MAXHOSTNAMELEN];
+ int i;
+ struct hostent *he;
+
+ printf("Content-type: text/plain\n\n");
+ if(query == NULL)
+ exit(0);
+ he = gethostbyname(query);
+ strncpy(host, he->h_name, sizeof(host));
+ host[sizeof(host) - 1] = '\0';
+ he = gethostbyaddr(he->h_addr, he->h_length, AF_INET);
+ printf("%s\n", he->h_name);
+ for(i = 0; he->h_addr_list[i]; i++) {
+ struct in_addr ip;
+ unsigned char *p = (unsigned char*)he->h_addr_list[i];
+ ip.s_addr = htonl((p[0] << 24) | (p[1] << 16) | (p[2] << 8) | p[3]);
+ printf("%s\n", inet_ntoa(ip));
+ }
+ exit(0);
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/sendmsg.c b/crypto/kerberosIV/lib/roken/sendmsg.c
new file mode 100644
index 0000000..3f54a3b
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/sendmsg.c
@@ -0,0 +1,70 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: sendmsg.c,v 1.3 1999/07/03 02:37:15 assar Exp $");
+#endif
+
+#include "roken.h"
+
+ssize_t
+sendmsg(int s, const struct msghdr *msg, int flags)
+{
+ ssize_t ret;
+ size_t tot = 0;
+ int i;
+ char *buf, *p;
+ struct iovec *iov = msg->msg_iov;
+
+ for(i = 0; i < msg->msg_iovlen; ++i)
+ tot += iov[i].iov_len;
+ buf = malloc(tot);
+ if (tot != 0 && buf == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ p = buf;
+ for (i = 0; i < msg->msg_iovlen; ++i) {
+ memcpy (p, iov[i].iov_base, iov[i].iov_len);
+ p += iov[i].iov_len;
+ }
+ ret = sendto (s, buf, tot, flags, msg->msg_name, msg->msg_namelen);
+ free (buf);
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/setegid.c b/crypto/kerberosIV/lib/roken/setegid.c
index b79bdd5..926261a 100644
--- a/crypto/kerberosIV/lib/roken/setegid.c
+++ b/crypto/kerberosIV/lib/roken/setegid.c
@@ -38,15 +38,17 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: setegid.c,v 1.7 1997/04/01 08:19:07 joda Exp $");
+RCSID("$Id: setegid.c,v 1.8 1997/07/11 20:20:32 assar Exp $");
#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "roken.h"
int
-setegid(int egid)
+setegid(gid_t egid)
{
#ifdef HAVE_SETREGID
return setregid(-1, egid);
diff --git a/crypto/kerberosIV/lib/roken/seteuid.c b/crypto/kerberosIV/lib/roken/seteuid.c
index b831318..1f57ba9 100644
--- a/crypto/kerberosIV/lib/roken/seteuid.c
+++ b/crypto/kerberosIV/lib/roken/seteuid.c
@@ -38,15 +38,17 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: seteuid.c,v 1.7 1997/04/01 08:19:08 joda Exp $");
+RCSID("$Id: seteuid.c,v 1.9 1997/07/11 20:33:14 assar Exp $");
#endif
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
#include "roken.h"
int
-seteuid(int euid)
+seteuid(uid_t euid)
{
#ifdef HAVE_SETREUID
return setreuid(-1, euid);
diff --git a/crypto/kerberosIV/lib/roken/simple_exec.c b/crypto/kerberosIV/lib/roken/simple_exec.c
new file mode 100644
index 0000000..9e2e699
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/simple_exec.c
@@ -0,0 +1,124 @@
+/*
+ * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: simple_exec.c,v 1.4 1999/03/20 02:43:16 assar Exp $");
+#endif
+
+#include <stdarg.h>
+#include <stdlib.h>
+#ifdef HAVE_SYS_TYPES_H
+#include <sys/types.h>
+#endif
+#ifdef HAVE_SYS_WAIT_H
+#include <sys/wait.h>
+#endif
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
+#include <errno.h>
+
+#include <roken.h>
+
+#define EX_NOEXEC 126
+#define EX_NOTFOUND 127
+
+/* return values:
+ -1 on `unspecified' system errors
+ -2 on fork failures
+ -3 on waitpid errors
+ 0- is return value from subprocess
+ 126 if the program couldn't be executed
+ 127 if the program couldn't be found
+ 128- is 128 + signal that killed subprocess
+ */
+
+int
+simple_execvp(const char *file, char *const args[])
+{
+ pid_t pid = fork();
+ switch(pid){
+ case -1:
+ return -2;
+ case 0:
+ execvp(file, args);
+ exit((errno == ENOENT) ? EX_NOTFOUND : EX_NOEXEC);
+ default:
+ while(1) {
+ int status;
+
+ while(waitpid(pid, &status, 0) < 0)
+ if (errno != EINTR)
+ return -3;
+ if(WIFSTOPPED(status))
+ continue;
+ if(WIFEXITED(status))
+ return WEXITSTATUS(status);
+ if(WIFSIGNALED(status))
+ return WTERMSIG(status) + 128;
+ }
+ }
+}
+
+int
+simple_execlp(const char *file, ...)
+{
+ va_list ap;
+ char **argv = NULL;
+ int argc, i;
+
+ argc = i = 0;
+ va_start(ap, file);
+ do {
+ if(i == argc) {
+ char **tmp = realloc(argv, (argc + 5) * sizeof(*argv));
+ if(tmp == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ argv = tmp;
+ argc += 5;
+ }
+ argv[i++] = va_arg(ap, char*);
+ } while(argv[i - 1] != NULL);
+ va_end(ap);
+ i = simple_execvp(file, argv);
+ free(argv);
+ return i;
+}
diff --git a/crypto/kerberosIV/lib/roken/snprintf.c b/crypto/kerberosIV/lib/roken/snprintf.c
index b0757e5..62f5b10 100644
--- a/crypto/kerberosIV/lib/roken/snprintf.c
+++ b/crypto/kerberosIV/lib/roken/snprintf.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995-1997, 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: snprintf.c,v 1.13 1997/05/25 02:00:31 assar Exp $");
+RCSID("$Id: snprintf.c,v 1.19 1999/03/27 16:32:57 joda Exp $");
#endif
#include <stdio.h>
#include <stdarg.h>
@@ -47,21 +47,30 @@ RCSID("$Id: snprintf.c,v 1.13 1997/05/25 02:00:31 assar Exp $");
#include <ctype.h>
#include <roken.h>
+enum format_flags {
+ minus_flag = 1,
+ plus_flag = 2,
+ space_flag = 4,
+ alternate_flag = 8,
+ zero_flag = 16
+};
+
/*
* Common state
*/
struct state {
- char *str;
- char *s;
- char *theend;
+ unsigned char *str;
+ unsigned char *s;
+ unsigned char *theend;
size_t sz;
size_t max_sz;
- int (*append_char)(struct state *, char);
+ int (*append_char)(struct state *, unsigned char);
int (*reserve)(struct state *, size_t);
/* XXX - methods */
};
+#ifndef HAVE_VSNPRINTF
static int
sn_reserve (struct state *state, size_t n)
{
@@ -69,31 +78,30 @@ sn_reserve (struct state *state, size_t n)
}
static int
-sn_append_char (struct state *state, char c)
+sn_append_char (struct state *state, unsigned char c)
{
if (sn_reserve (state, 1)) {
- *state->s++ = '\0';
return 1;
} else {
*state->s++ = c;
return 0;
}
}
+#endif
static int
as_reserve (struct state *state, size_t n)
{
- while (state->s + n > state->theend) {
+ if (state->s + n > state->theend) {
int off = state->s - state->str;
- char *tmp;
+ unsigned char *tmp;
if (state->max_sz && state->sz >= state->max_sz)
return 1;
+ state->sz = max(state->sz * 2, state->sz + n);
if (state->max_sz)
- state->sz = min(state->max_sz, state->sz*2);
- else
- state->sz *= 2;
+ state->sz = min(state->sz, state->max_sz);
tmp = realloc (state->str, state->sz);
if (tmp == NULL)
return 1;
@@ -105,7 +113,7 @@ as_reserve (struct state *state, size_t n)
}
static int
-as_append_char (struct state *state, char c)
+as_append_char (struct state *state, unsigned char c)
{
if(as_reserve (state, 1))
return 1;
@@ -116,61 +124,110 @@ as_append_char (struct state *state, char c)
}
static int
-append_number (struct state *state,
- unsigned long num, unsigned base, char *rep,
- int width, int zerop, int minusp)
+append_number(struct state *state,
+ unsigned long num, unsigned base, unsigned char *rep,
+ int width, int prec, int flags, int minusp)
{
- int i, len;
+ int len = 0;
+ int i;
- len = 0;
- if (num == 0) {
- ++len;
- if((*state->append_char) (state, '0'))
- return 1;
- }
- while (num > 0) {
- ++len;
- if ((*state->append_char) (state, rep[num % base]))
+ /* given precision, ignore zero flag */
+ if(prec != -1)
+ flags &= ~zero_flag;
+ else
+ prec = 1;
+ /* zero value with zero precision -> "" */
+ if(prec == 0 && num == 0)
+ return 0;
+ do{
+ if((*state->append_char)(state, rep[num % base]))
return 1;
+ len++;
num /= base;
+ }while(num);
+ prec -= len;
+ /* pad with prec zeros */
+ while(prec-- > 0){
+ if((*state->append_char)(state, '0'))
+ return 1;
+ len++;
}
- if (minusp) {
- ++len;
- if ((*state->append_char) (state, '-'))
+ /* add length of alternate prefix (added later) to len */
+ if(flags & alternate_flag && (base == 16 || base == 8))
+ len += base / 8;
+ /* pad with zeros */
+ if(flags & zero_flag){
+ width -= len;
+ if(minusp || (flags & space_flag) || (flags & plus_flag))
+ width--;
+ while(width-- > 0){
+ if((*state->append_char)(state, '0'))
+ return 1;
+ len++;
+ }
+ }
+ /* add alternate prefix */
+ if(flags & alternate_flag && (base == 16 || base == 8)){
+ if(base == 16)
+ if((*state->append_char)(state, rep[10] + 23)) /* XXX */
+ return 1;
+ if((*state->append_char)(state, '0'))
return 1;
}
-
- for (i = 0; i < len / 2; ++i) {
- char c;
-
- c = state->s[-i-1];
- state->s[-i-1] = state->s[-len+i];
- state->s[-len+i] = c;
+ /* add sign */
+ if(minusp){
+ if((*state->append_char)(state, '-'))
+ return 1;
+ len++;
+ } else if(flags & plus_flag) {
+ if((*state->append_char)(state, '+'))
+ return 1;
+ len++;
+ } else if(flags & space_flag) {
+ if((*state->append_char)(state, ' '))
+ return 1;
+ len++;
}
-
- if (width > len) {
- if ((*state->reserve) (state, width - len))
+ if(flags & minus_flag)
+ /* swap before padding with spaces */
+ for(i = 0; i < len / 2; i++){
+ char c = state->s[-i-1];
+ state->s[-i-1] = state->s[-len+i];
+ state->s[-len+i] = c;
+ }
+ width -= len;
+ while(width-- > 0){
+ if((*state->append_char)(state, ' '))
return 1;
-
-#ifdef HAVE_MEMMOVE
- memmove (state->s + width - 2 * len, state->s - len, len);
-#else
- bcopy (state->s - len, state->s + width - 2 * len, len);
-#endif
- for (i = 0; i < width - len; ++i)
- state->s[-len+i] = (zerop ? '0' : ' ');
- state->s += width - len;
-
+ len++;
}
+ if(!(flags & minus_flag))
+ /* swap after padding with spaces */
+ for(i = 0; i < len / 2; i++){
+ char c = state->s[-i-1];
+ state->s[-i-1] = state->s[-len+i];
+ state->s[-len+i] = c;
+ }
+
return 0;
}
static int
append_string (struct state *state,
- char *arg,
- int prec)
+ unsigned char *arg,
+ int width,
+ int prec,
+ int flags)
{
- if (prec) {
+ if(prec != -1)
+ width -= prec;
+ else
+ width -= strlen(arg);
+ if(!(flags & minus_flag))
+ while(width-- > 0)
+ if((*state->append_char) (state, ' '))
+ return 1;
+ if (prec != -1) {
while (*arg && prec--)
if ((*state->append_char) (state, *arg++))
return 1;
@@ -179,6 +236,29 @@ append_string (struct state *state,
if ((*state->append_char) (state, *arg++))
return 1;
}
+ if(flags & minus_flag)
+ while(width-- > 0)
+ if((*state->append_char) (state, ' '))
+ return 1;
+ return 0;
+}
+
+static int
+append_char(struct state *state,
+ unsigned char arg,
+ int width,
+ int flags)
+{
+ while(!(flags & minus_flag) && --width > 0)
+ if((*state->append_char) (state, ' '))
+ return 1;
+
+ if((*state->append_char) (state, arg))
+ return 1;
+ while((flags & minus_flag) && --width > 0)
+ if((*state->append_char) (state, ' '))
+ return 1;
+
return 0;
}
@@ -199,25 +279,40 @@ else \
*/
static int
-xyzprintf (struct state *state, const char *format, va_list ap)
+xyzprintf (struct state *state, const char *char_format, va_list ap)
{
- char c;
+ const unsigned char *format = (const unsigned char *)char_format;
+ unsigned char c;
while((c = *format++)) {
if (c == '%') {
- int zerop = 0;
+ int flags = 0;
int width = 0;
- int prec = 0;
+ int prec = -1;
int long_flag = 0;
int short_flag = 0;
- c = *format++;
-
/* flags */
- if (c == '0') {
- zerop = 1;
- c = *format++;
+ while((c = *format++)){
+ if(c == '-')
+ flags |= minus_flag;
+ else if(c == '+')
+ flags |= plus_flag;
+ else if(c == ' ')
+ flags |= space_flag;
+ else if(c == '#')
+ flags |= alternate_flag;
+ else if(c == '0')
+ flags |= zero_flag;
+ else
+ break;
}
+
+ if((flags & space_flag) && (flags & plus_flag))
+ flags ^= space_flag;
+
+ if((flags & minus_flag) && (flags & zero_flag))
+ flags ^= zero_flag;
/* width */
if (isdigit(c))
@@ -232,6 +327,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
/* precision */
if (c == '.') {
+ prec = 0;
c = *format++;
if (isdigit(c))
do {
@@ -256,13 +352,15 @@ xyzprintf (struct state *state, const char *format, va_list ap)
switch (c) {
case 'c' :
- if ((*state->append_char)(state, (unsigned char)va_arg(ap, int)))
+ if(append_char(state, va_arg(ap, int), width, flags))
return -1;
break;
case 's' :
if (append_string(state,
- va_arg(ap, char*),
- prec))
+ va_arg(ap, unsigned char*),
+ width,
+ prec,
+ flags))
return -1;
break;
case 'd' :
@@ -271,7 +369,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
unsigned long num;
int minusp = 0;
- PARSE_INT_FORMAT(arg, ap, );
+ PARSE_INT_FORMAT(arg, ap, signed);
if (arg < 0) {
minusp = 1;
@@ -280,7 +378,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
num = arg;
if (append_number (state, num, 10, "0123456789",
- width, zerop, minusp))
+ width, prec, flags, minusp))
return -1;
break;
}
@@ -290,7 +388,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
PARSE_INT_FORMAT(arg, ap, unsigned);
if (append_number (state, arg, 10, "0123456789",
- width, zerop, 0))
+ width, prec, flags, 0))
return -1;
break;
}
@@ -300,7 +398,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
PARSE_INT_FORMAT(arg, ap, unsigned);
if (append_number (state, arg, 010, "01234567",
- width, zerop, 0))
+ width, prec, flags, 0))
return -1;
break;
}
@@ -310,7 +408,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
PARSE_INT_FORMAT(arg, ap, unsigned);
if (append_number (state, arg, 0x10, "0123456789abcdef",
- width, zerop, 0))
+ width, prec, flags, 0))
return -1;
break;
}
@@ -320,7 +418,7 @@ xyzprintf (struct state *state, const char *format, va_list ap)
PARSE_INT_FORMAT(arg, ap, unsigned);
if (append_number (state, arg, 0x10, "0123456789ABCDEF",
- width, zerop, 0))
+ width, prec, flags, 0))
return -1;
break;
}
@@ -328,10 +426,15 @@ xyzprintf (struct state *state, const char *format, va_list ap)
unsigned long arg = (unsigned long)va_arg(ap, void*);
if (append_number (state, arg, 0x10, "0123456789ABCDEF",
- width, zerop, 0))
+ width, prec, flags, 0))
return -1;
break;
}
+ case 'n' : {
+ int *arg = va_arg(ap, int*);
+ *arg = state->s - state->str;
+ break;
+ }
case '%' :
if ((*state->append_char)(state, c))
return -1;
@@ -458,10 +561,7 @@ vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
struct state state;
state.max_sz = max_sz;
- if (max_sz)
- state.sz = min(1, max_sz);
- else
- state.sz = 1;
+ state.sz = 1;
state.str = malloc(state.sz);
if (state.str == NULL) {
*ret = NULL;
@@ -483,7 +583,7 @@ vasnprintf (char **ret, size_t max_sz, const char *format, va_list args)
*state.s = '\0';
len = state.s - state.str;
tmp = realloc (state.str, len+1);
- if (state.str == NULL) {
+ if (tmp == NULL) {
free (state.str);
*ret = NULL;
return -1;
diff --git a/crypto/kerberosIV/lib/roken/strcasecmp.c b/crypto/kerberosIV/lib/roken/strcasecmp.c
index a268c29..9dee51a 100644
--- a/crypto/kerberosIV/lib/roken/strcasecmp.c
+++ b/crypto/kerberosIV/lib/roken/strcasecmp.c
@@ -1,118 +1,63 @@
/*
- * Copyright (c) 1987, 1993
- * The Regents of the University of California. All rights reserved.
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
*
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- * 3. All advertising materials mentioning features or use of this software
- * must display the following acknowledgement:
- * This product includes software developed by the University of
- * California, Berkeley and its contributors.
- * 4. Neither the name of the University nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
*
- * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
+ * 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 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: strcasecmp.c,v 1.3 1997/04/20 18:04:23 assar Exp $");
+RCSID("$Id: strcasecmp.c,v 1.8 1998/07/24 06:13:03 assar Exp $");
#endif
#include <string.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#include <sys/cdefs.h>
-
-#if defined(LIBC_SCCS) && !defined(lint)
-static char sccsid[] = "@(#)strcasecmp.c 8.1 (Berkeley) 6/4/93";
-#endif /* LIBC_SCCS and not lint */
+#include <ctype.h>
+#include <stddef.h>
+#include "roken.h"
-/*
- * This array is designed for mapping upper and lower case letter
- * together for a case independent comparison. The mappings are
- * based upon ascii character sequences.
- */
-static const unsigned char charmap[] = {
- '\000', '\001', '\002', '\003', '\004', '\005', '\006', '\007',
- '\010', '\011', '\012', '\013', '\014', '\015', '\016', '\017',
- '\020', '\021', '\022', '\023', '\024', '\025', '\026', '\027',
- '\030', '\031', '\032', '\033', '\034', '\035', '\036', '\037',
- '\040', '\041', '\042', '\043', '\044', '\045', '\046', '\047',
- '\050', '\051', '\052', '\053', '\054', '\055', '\056', '\057',
- '\060', '\061', '\062', '\063', '\064', '\065', '\066', '\067',
- '\070', '\071', '\072', '\073', '\074', '\075', '\076', '\077',
- '\100', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\133', '\134', '\135', '\136', '\137',
- '\140', '\141', '\142', '\143', '\144', '\145', '\146', '\147',
- '\150', '\151', '\152', '\153', '\154', '\155', '\156', '\157',
- '\160', '\161', '\162', '\163', '\164', '\165', '\166', '\167',
- '\170', '\171', '\172', '\173', '\174', '\175', '\176', '\177',
- '\200', '\201', '\202', '\203', '\204', '\205', '\206', '\207',
- '\210', '\211', '\212', '\213', '\214', '\215', '\216', '\217',
- '\220', '\221', '\222', '\223', '\224', '\225', '\226', '\227',
- '\230', '\231', '\232', '\233', '\234', '\235', '\236', '\237',
- '\240', '\241', '\242', '\243', '\244', '\245', '\246', '\247',
- '\250', '\251', '\252', '\253', '\254', '\255', '\256', '\257',
- '\260', '\261', '\262', '\263', '\264', '\265', '\266', '\267',
- '\270', '\271', '\272', '\273', '\274', '\275', '\276', '\277',
- '\300', '\301', '\302', '\303', '\304', '\305', '\306', '\307',
- '\310', '\311', '\312', '\313', '\314', '\315', '\316', '\317',
- '\320', '\321', '\322', '\323', '\324', '\325', '\326', '\327',
- '\330', '\331', '\332', '\333', '\334', '\335', '\336', '\337',
- '\340', '\341', '\342', '\343', '\344', '\345', '\346', '\347',
- '\350', '\351', '\352', '\353', '\354', '\355', '\356', '\357',
- '\360', '\361', '\362', '\363', '\364', '\365', '\366', '\367',
- '\370', '\371', '\372', '\373', '\374', '\375', '\376', '\377',
-};
+#ifndef HAVE_STRCASECMP
int
strcasecmp(const char *s1, const char *s2)
{
- const unsigned char *cm = charmap,
- *us1 = (const unsigned char *)s1,
- *us2 = (const unsigned char *)s2;
-
- while (cm[*us1] == cm[*us2++])
- if (*us1++ == '\0')
- return (0);
- return (cm[*us1] - cm[*--us2]);
+ while(toupper(*s1) == toupper(*s2)) {
+ if(*s1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ }
+ return toupper(*s1) - toupper(*s2);
}
-int
-strncasecmp(const char *s1, const char *s2, size_t n)
-{
- if (n != 0) {
- const unsigned char *cm = charmap,
- *us1 = (const unsigned char *)s1,
- *us2 = (const unsigned char *)s2;
-
- do {
- if (cm[*us1] != cm[*us2++])
- return (cm[*us1] - cm[*--us2]);
- if (*us1++ == '\0')
- break;
- } while (--n != 0);
- }
- return (0);
-}
+#endif
diff --git a/crypto/kerberosIV/lib/roken/strcat_truncate.c b/crypto/kerberosIV/lib/roken/strcat_truncate.c
new file mode 100644
index 0000000..bbd808d
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/strcat_truncate.c
@@ -0,0 +1,55 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+RCSID("$Id: strcat_truncate.c,v 1.2 1998/05/29 18:25:06 joda Exp $");
+
+#ifndef HAVE_STRCAT_TRUNCATE
+
+int
+strcat_truncate (char *dst, const char *src, size_t dst_sz)
+{
+ int len = strlen(dst);
+
+ return len + strcpy_truncate (dst + len, src, dst_sz - len);
+}
+#endif
diff --git a/crypto/kerberosIV/lib/roken/strcpy_truncate.c b/crypto/kerberosIV/lib/roken/strcpy_truncate.c
new file mode 100644
index 0000000..ba3668b
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/strcpy_truncate.c
@@ -0,0 +1,65 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+RCSID("$Id: strcpy_truncate.c,v 1.2 1998/06/09 19:25:38 joda Exp $");
+
+#ifndef HAVE_STRCPY_TRUNCATE
+
+int
+strcpy_truncate (char *dst, const char *src, size_t dst_sz)
+{
+ int n;
+ char *p;
+
+ for (p = dst, n = 0;
+ n + 1 < dst_sz && *src != '\0';
+ ++p, ++src, ++n)
+ *p = *src;
+ *p = '\0';
+ if (*src == '\0')
+ return n;
+ else
+ return dst_sz;
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/strerror.c b/crypto/kerberosIV/lib/roken/strerror.c
index 3d7b45c..752ac62 100644
--- a/crypto/kerberosIV/lib/roken/strerror.c
+++ b/crypto/kerberosIV/lib/roken/strerror.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: strerror.c,v 1.8 1997/05/02 14:29:33 assar Exp $");
+RCSID("$Id: strerror.c,v 1.9 1998/06/09 19:25:38 joda Exp $");
#endif
#include <stdio.h>
@@ -56,7 +56,7 @@ strerror(int eno)
if(eno < 0 || eno >= sys_nerr)
snprintf(emsg, sizeof(emsg), "Error %d occurred.", eno);
else
- strcpy(emsg, sys_errlist[eno]);
+ snprintf(emsg, sizeof(emsg), "%s", sys_errlist[eno]);
return emsg;
}
diff --git a/crypto/kerberosIV/lib/roken/strftime.c b/crypto/kerberosIV/lib/roken/strftime.c
index 3473778..673d448 100644
--- a/crypto/kerberosIV/lib/roken/strftime.c
+++ b/crypto/kerberosIV/lib/roken/strftime.c
@@ -34,7 +34,9 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
#endif
+#ifdef HAVE_SYS_TYPES_H
#include <sys/types.h>
+#endif
#ifdef TIME_WITH_SYS_TIME
#include <sys/time.h>
#include <time.h>
diff --git a/crypto/kerberosIV/lib/roken/strncasecmp.c b/crypto/kerberosIV/lib/roken/strncasecmp.c
new file mode 100644
index 0000000..0d7d59d
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/strncasecmp.c
@@ -0,0 +1,65 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: strncasecmp.c,v 1.1 1998/05/22 19:16:17 joda Exp $");
+#endif
+
+#include <string.h>
+#include <ctype.h>
+#include <stddef.h>
+
+#ifndef HAVE_STRNCASECMP
+
+int
+strncasecmp(const char *s1, const char *s2, size_t n)
+{
+ while(n > 0 && toupper(*s1) == toupper(*s2)) {
+ if(*s1 == '\0')
+ return 0;
+ s1++;
+ s2++;
+ n--;
+ }
+ if(n == 0)
+ return 0;
+ return toupper(*s1) - toupper(*s2);
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/strndup.c b/crypto/kerberosIV/lib/roken/strndup.c
new file mode 100644
index 0000000..53c2224
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/strndup.c
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: strndup.c,v 1.1 1999/05/07 23:54:47 assar Exp $");
+#endif
+#include <stdlib.h>
+#include <string.h>
+
+#include <roken.h>
+
+#ifndef HAVE_STRNDUP
+char *
+strndup(const char *old, size_t sz)
+{
+ size_t len = strnlen (old, sz);
+ char *t = malloc(len + 1);
+
+ if (t != NULL) {
+ memcpy (t, old, len);
+ t[len] = '\0';
+ }
+ return t;
+}
+#endif /* HAVE_STRNDUP */
diff --git a/crypto/kerberosIV/lib/roken/strnlen.c b/crypto/kerberosIV/lib/roken/strnlen.c
index 51588f6..e29f830 100644
--- a/crypto/kerberosIV/lib/roken/strnlen.c
+++ b/crypto/kerberosIV/lib/roken/strnlen.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,15 +38,16 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: strnlen.c,v 1.5 1997/04/01 08:19:11 joda Exp $");
+RCSID("$Id: strnlen.c,v 1.6 1999/05/07 23:56:25 assar Exp $");
#endif
#include "roken.h"
-int
-strnlen(char *s, int len)
+size_t
+strnlen(const char *s, size_t len)
{
- int i;
+ size_t i;
+
for(i = 0; i < len && s[i]; i++)
;
return i;
diff --git a/crypto/kerberosIV/lib/roken/strsep.c b/crypto/kerberosIV/lib/roken/strsep.c
new file mode 100644
index 0000000..6db51fc
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/strsep.c
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 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 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: strsep.c,v 1.2 1997/07/24 07:08:23 joda Exp $");
+#endif
+
+#include <string.h>
+
+#include "roken.h"
+
+#ifndef HAVE_STRSEP
+
+char *
+strsep(char **str, const char *delim)
+{
+ char *save = *str;
+ if(*str == NULL)
+ return NULL;
+ *str = *str + strcspn(*str, delim);
+ if(**str == 0)
+ *str = NULL;
+ else{
+ **str = 0;
+ (*str)++;
+ }
+ return save;
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/swab.c b/crypto/kerberosIV/lib/roken/swab.c
new file mode 100644
index 0000000..8626bfa
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/swab.c
@@ -0,0 +1,59 @@
+/*
+ * 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>
+#endif
+#include "roken.h"
+
+#ifndef HAVE_SWAB
+
+RCSID("$Id: swab.c,v 1.6 1997/12/04 22:51:53 joda Exp $");
+
+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/roken/verr.c b/crypto/kerberosIV/lib/roken/verr.c
index f5d8f25..9ebe199 100644
--- a/crypto/kerberosIV/lib/roken/verr.c
+++ b/crypto/kerberosIV/lib/roken/verr.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: verr.c,v 1.6 1997/03/30 08:05:38 joda Exp $");
+RCSID("$Id: verr.c,v 1.7 1997/11/12 00:10:19 joda Exp $");
#endif
#include "err.h"
@@ -46,5 +46,6 @@ RCSID("$Id: verr.c,v 1.6 1997/03/30 08:05:38 joda Exp $");
void
verr(int eval, const char *fmt, va_list ap)
{
- warnerr(1, eval, 1, fmt, ap);
+ warnerr(1, fmt, ap);
+ exit(eval);
}
diff --git a/crypto/kerberosIV/lib/roken/verrx.c b/crypto/kerberosIV/lib/roken/verrx.c
index bc25aa0..e7355ce 100644
--- a/crypto/kerberosIV/lib/roken/verrx.c
+++ b/crypto/kerberosIV/lib/roken/verrx.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: verrx.c,v 1.6 1997/03/30 08:05:39 joda Exp $");
+RCSID("$Id: verrx.c,v 1.7 1997/11/12 00:10:26 joda Exp $");
#endif
#include "err.h"
@@ -46,5 +46,6 @@ RCSID("$Id: verrx.c,v 1.6 1997/03/30 08:05:39 joda Exp $");
void
verrx(int eval, const char *fmt, va_list ap)
{
- warnerr(1, eval, 0, fmt, ap);
+ warnerr(0, fmt, ap);
+ exit(eval);
}
diff --git a/crypto/kerberosIV/lib/roken/vsyslog.c b/crypto/kerberosIV/lib/roken/vsyslog.c
new file mode 100644
index 0000000..2b32e32
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/vsyslog.c
@@ -0,0 +1,62 @@
+/*
+ * 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: vsyslog.c,v 1.2 1999/02/11 21:03:59 joda Exp $");
+#endif
+
+#ifndef HAVE_VSYSLOG
+
+#include <stdio.h>
+#include <syslog.h>
+#include <stdarg.h>
+
+#include "roken.h"
+
+void
+vsyslog(int pri, const char *fmt, va_list ap)
+{
+ char *p;
+
+ vasprintf (&p, fmt, ap);
+ syslog (pri, "%s", p);
+ free (p);
+}
+
+#endif
diff --git a/crypto/kerberosIV/lib/roken/vwarn.c b/crypto/kerberosIV/lib/roken/vwarn.c
index 144dd08..f6698ae 100644
--- a/crypto/kerberosIV/lib/roken/vwarn.c
+++ b/crypto/kerberosIV/lib/roken/vwarn.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: vwarn.c,v 1.6 1997/03/30 08:05:39 joda Exp $");
+RCSID("$Id: vwarn.c,v 1.7 1997/11/12 00:10:32 joda Exp $");
#endif
#include "err.h"
@@ -46,5 +46,5 @@ RCSID("$Id: vwarn.c,v 1.6 1997/03/30 08:05:39 joda Exp $");
void
vwarn(const char *fmt, va_list ap)
{
- warnerr(0, 0, 1, fmt, ap);
+ warnerr(1, fmt, ap);
}
diff --git a/crypto/kerberosIV/lib/roken/vwarnx.c b/crypto/kerberosIV/lib/roken/vwarnx.c
index 540c2a6..50d0432 100644
--- a/crypto/kerberosIV/lib/roken/vwarnx.c
+++ b/crypto/kerberosIV/lib/roken/vwarnx.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: vwarnx.c,v 1.6 1997/03/30 08:05:40 joda Exp $");
+RCSID("$Id: vwarnx.c,v 1.7 1997/11/12 00:09:45 joda Exp $");
#endif
#include "err.h"
@@ -46,6 +46,6 @@ RCSID("$Id: vwarnx.c,v 1.6 1997/03/30 08:05:40 joda Exp $");
void
vwarnx(const char *fmt, va_list ap)
{
- warnerr(0, 0, 0, fmt, ap);
+ warnerr(0, fmt, ap);
}
diff --git a/crypto/kerberosIV/lib/roken/warnerr.c b/crypto/kerberosIV/lib/roken/warnerr.c
index 61fa26a..a92d7b1 100644
--- a/crypto/kerberosIV/lib/roken/warnerr.c
+++ b/crypto/kerberosIV/lib/roken/warnerr.c
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: warnerr.c,v 1.6 1997/04/02 14:59:54 bg Exp $");
+RCSID("$Id: warnerr.c,v 1.7 1997/11/12 00:09:08 joda Exp $");
#endif
#include "roken.h"
@@ -65,7 +65,7 @@ set_progname(char *argv0)
}
void
-warnerr(int doexit, int eval, int doerrno, const char *fmt, va_list ap)
+warnerr(int doerrno, const char *fmt, va_list ap)
{
int sverrno = errno;
if(__progname != NULL){
@@ -81,6 +81,4 @@ warnerr(int doexit, int eval, int doerrno, const char *fmt, va_list ap)
if(doerrno)
fprintf(stderr, "%s", strerror(sverrno));
fprintf(stderr, "\n");
- if(doexit)
- exit(eval);
}
diff --git a/crypto/kerberosIV/lib/roken/writev.c b/crypto/kerberosIV/lib/roken/writev.c
new file mode 100644
index 0000000..c541b83
--- /dev/null
+++ b/crypto/kerberosIV/lib/roken/writev.c
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 1995, 1996, 1997, 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. 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: writev.c,v 1.2 1999/07/03 02:37:57 assar Exp $");
+#endif
+
+#include "roken.h"
+
+ssize_t
+writev(int d, const struct iovec *iov, int iovcnt)
+{
+ ssize_t ret;
+ size_t tot = 0;
+ int i;
+ char *buf, *p;
+
+ for(i = 0; i < iovcnt; ++i)
+ tot += iov[i].iov_len;
+ buf = malloc(tot);
+ if (tot != 0 && buf == NULL) {
+ errno = ENOMEM;
+ return -1;
+ }
+ p = buf;
+ for (i = 0; i < iovcnt; ++i) {
+ memcpy (p, iov[i].iov_base, iov[i].iov_len);
+ p += iov[i].iov_len;
+ }
+ ret = write (d, buf, tot);
+ free (buf);
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/roken/xdbm.h b/crypto/kerberosIV/lib/roken/xdbm.h
index c3e4781..26e8dcc 100644
--- a/crypto/kerberosIV/lib/roken/xdbm.h
+++ b/crypto/kerberosIV/lib/roken/xdbm.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995 - 1999 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-/* $Id: xdbm.h,v 1.2 1997/04/01 08:19:16 joda Exp $ */
+/* $Id: xdbm.h,v 1.3 1999/05/08 02:25:22 assar Exp $ */
/* Generic *dbm include file */
@@ -49,6 +49,9 @@
#include <dbm.h>
#elif defined(HAVE_RPCSVC_DBM_H)
#include <rpcsvc/dbm.h>
+#elif defined(HAVE_DB_H)
+#define DB_DBM_HSEARCH 1
+#include <db.h>
#endif
/* Macros to convert ndbm names to dbm names.
diff --git a/crypto/kerberosIV/lib/sl/ChangeLog b/crypto/kerberosIV/lib/sl/ChangeLog
new file mode 100644
index 0000000..a8647de
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/ChangeLog
@@ -0,0 +1,112 @@
+Thu Apr 1 17:03:59 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * make_cmds.c: use getarg
+
+Tue Mar 23 14:36:21 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: don't rename
+
+Sun Mar 21 14:13:29 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: don't roken-rename
+
+Sat Mar 20 03:43:30 1999 Assar Westerlund <assar@sics.se>
+
+ * parse.y: replace return with YYACCEPT
+
+Fri Mar 19 14:53:20 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: add libss; add version-info
+
+Thu Mar 18 15:07:06 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.am: clean lex.c parse.c parse.h
+
+ * Makefile.am: install ss.h
+
+ * Makefile.am: include Makefile.am.common
+
+Thu Mar 11 15:01:01 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * parse.y: prototype for error_message
+
+Tue Feb 9 23:45:37 1999 Johan Danielsson <joda@hella.pdc.kth.se>
+
+ * Makefile.in: add snprintf.o to make_cmds
+
+Sun Nov 22 10:46:23 1998 Assar Westerlund <assar@sics.se>
+
+ * sl.c (sl_command_loop): remove unused variable
+
+ * ss.c (ss_error): remove unused variable
+
+ * make_cmds.c: include err.h
+ (main): remove unused variable
+
+ * Makefile.in (WFLAGS): set
+
+Sun Sep 27 01:28:21 1998 Assar Westerlund <assar@sics.se>
+
+ * make_cmds.c: clean-up and simplification
+
+Mon May 25 02:54:13 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in (clean): try to remove shared library debris
+
+ * Makefile.in: make symlink magic work
+
+Sun Apr 19 10:00:26 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.in: add symlink magic for linux
+
+Sun Apr 5 09:21:43 1998 Assar Westerlund <assar@sics.se>
+
+ * parse.y: define alloca to malloc in case we're using bison but
+ don't have alloca
+
+Sat Mar 28 11:39:00 1998 Assar Westerlund <assar@sics.se>
+
+ * sl.c (sl_loop): s/2/1
+
+Sat Mar 21 00:46:51 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * sl.c (sl_loop): check that there is at least one argument before
+ calling sl_command
+
+Sun Mar 1 05:14:37 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * sl.c (sl_loop): Fix general broken-ness.
+
+ * sl.c: Cleanup printing of help strings.
+
+Thu Feb 26 02:22:02 1998 Assar Westerlund <assar@sics.se>
+
+ * Makefile.am: @LEXLIB@
+
+Sat Feb 21 15:18:21 1998 assar westerlund <assar@sics.se>
+
+ * Makefile.in: set YACC and LEX
+
+Mon Feb 16 16:08:25 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * Makefile.am: Some fixes for ss/mk_cmds.
+
+Sun Feb 15 05:12:11 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * Makefile.in: Install libsl under the `libss' name too. Install
+ mk_cmds, and ss.h.
+
+ * make_cmds.c: A mk_cmds clone that creates SL structures.
+
+ * ss.c: SS compatibility functions.
+
+ * sl.c: Move command line split to function `sl_make_argv'.
+
+Tue Feb 3 16:45:44 1998 Johan Danielsson <joda@emma.pdc.kth.se>
+
+ * sl.c: Add sl_command_loop, that is the loop body of sl_loop.
+
+Mon Oct 20 01:13:21 1997 Assar Westerlund <assar@sics.se>
+
+ * sl.c (sl_help): actually use the `help' field of `SL_cmd'
+
diff --git a/crypto/kerberosIV/lib/sl/Makefile.am b/crypto/kerberosIV/lib/sl/Makefile.am
new file mode 100644
index 0000000..54bc75b
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/Makefile.am
@@ -0,0 +1,44 @@
+# $Id: Makefile.am,v 1.14 1999/04/09 18:28:29 assar Exp $
+
+include $(top_srcdir)/Makefile.am.common
+
+YFLAGS = -d
+
+include_HEADERS = sl.h
+
+lib_LTLIBRARIES = libsl.la libss.la
+libsl_la_LDFLAGS = -version-info 0:0:0
+libss_la_LDFLAGS = -version-info 0:0:0
+
+RENAME_SRC = roken_rename.h strtok_r.c snprintf.c
+
+libsl_la_SOURCES = sl_locl.h sl.c
+libss_la_SOURCES = $(libsl_la_SOURCES) ss.c ss.h
+
+EXTRA_libsl_la_SOURCES = strtok_r.c snprintf.c roken_rename.h
+
+# install these?
+
+noinst_PROGRAMS = mk_cmds
+
+mk_cmds_SOURCES = make_cmds.c make_cmds.h parse.y lex.l
+
+RENAME_mk_cmds_SRC = roken_rename.h snprintf.c
+
+EXTRA_mk_cmds_SOURCES = snprintf.c roken_rename.h
+
+ssincludedir = $(includedir)/ss
+ssinclude_HEADERS = ss.h
+
+CLEANFILES = lex.c parse.c parse.h snprintf.c strtok_r.c
+
+$(mk_cmds_OBJECTS): parse.h
+
+LDADD = \
+ $(LIB_roken) \
+ $(LEXLIB)
+
+strtok_r.c:
+ $(LN_S) $(srcdir)/../roken/strtok_r.c .
+snprintf.c:
+ $(LN_S) $(srcdir)/../roken/snprintf.c .
diff --git a/crypto/kerberosIV/lib/sl/Makefile.in b/crypto/kerberosIV/lib/sl/Makefile.in
index b89799b..6cdb8a6 100644
--- a/crypto/kerberosIV/lib/sl/Makefile.in
+++ b/crypto/kerberosIV/lib/sl/Makefile.in
@@ -1,5 +1,5 @@
#
-# $Id: Makefile.in,v 1.8 1997/05/06 03:47:56 assar Exp $
+# $Id: Makefile.in,v 1.31 1999/03/10 19:01:17 joda Exp $
#
SHELL = /bin/sh
@@ -7,11 +7,19 @@ SHELL = /bin/sh
srcdir = @srcdir@
VPATH = @srcdir@
+top_builddir=../..
+
CC = @CC@
+LINK = @LINK@
AR = ar
RANLIB = @RANLIB@
-DEFS = @DEFS@
-CFLAGS = @CFLAGS@
+LN_S = @LN_S@
+DEFS = @DEFS@ -DROKEN_RENAME
+CFLAGS = @CFLAGS@ $(WFLAGS)
+WFLAGS = @WFLAGS@
+LD_FLAGS = @LD_FLAGS@
+YACC = @YACC@
+LEX = @LEX@
INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
@@ -20,39 +28,65 @@ MKINSTALLDIRS = @top_srcdir@/mkinstalldirs
prefix = @prefix@
exec_prefix = @exec_prefix@
libdir = @libdir@
+bindir = @bindir@
+includedir = @includedir@
+
+LIB_DEPS = @lib_deps_yes@ @LIB_readline@ -lc
+build_symlink_command = @build_symlink_command@
+install_symlink_command = @install_symlink_command@
+install_symlink_command2 = @install_symlink_command2@
PICFLAGS = @PICFLAGS@
+EXECSUFFIX = @EXECSUFFIX@
-LIBNAME = $(LIBPREFIX)sl
LIBEXT = @LIBEXT@
SHLIBEXT = @SHLIBEXT@
LIBPREFIX = @LIBPREFIX@
+LIBNAME = $(LIBPREFIX)sl
+sl_LIB = $(LIBNAME).$(LIBEXT)
+LIB = $(sl_LIB)
+LIBNAME2 = $(LIBPREFIX)ss
+ss_LIB = $(LIBNAME2).$(LIBEXT)
+LIB2 = $(ss_LIB)
LDSHARED = @LDSHARED@
-LIB = $(LIBNAME).$(LIBEXT)
-PROGS =
+PROGS = mk_cmds$(EXECSUFFIX)
+
+LIB_SOURCES = sl.c ss.c
+EXTRA_SOURCES = strtok_r.c snprintf.c
+
+SOURCES = $(LIB_SOURCES) make_cmds.c $(EXTRA_SOURCES)
-LIB_SOURCES = sl.c
+LIBADD = strtok_r.o snprintf.o
-SOURCES = $(LIB_SOURCES)
+LIB_OBJECTS = sl.o ss.o $(LIBADD)
-LIB_OBJECTS = sl.o
+mk_cmds_OBJECTS = make_cmds.o parse.o lex.o snprintf.o
-OBJECTS = $(LIB_OBJECTS)
+OBJECTS = $(LIB_OBJECTS) $(mk_cmds_OBJECTS)
-all: $(LIB) $(PROGS)
+all: $(sl_LIB) $(PROGS)
Wall:
make CFLAGS="-g -Wall -Wno-comment -Wmissing-prototypes -Wmissing-declarations -D__USE_FIXED_PROTOTYPES__"
.c.o:
- $(CC) -c $(CPPFLAGS) $(DEFS) -I../../include -I$(srcdir) -I$(srcdir)/../des $(CFLAGS) $(PICFLAGS) $<
+ $(CC) -c $(DEFS) -I../../include -I. -I$(srcdir) -I$(srcdir)/../des $(CFLAGS) $(CPPFLAGS) $(PICFLAGS) $<
install: all
- $(MKINSTALLDIRS) $(libdir)
- $(INSTALL_DATA) -m 0555 $(LIB) $(libdir)
+ $(MKINSTALLDIRS) $(DESTDIR)$(includedir)/ss
+ $(INSTALL_DATA) $(srcdir)/ss.h $(DESTDIR)$(includedir)/ss/ss.h
+ $(MKINSTALLDIRS) $(DESTDIR)$(libdir)
+ $(INSTALL) -m 555 $(sl_LIB) $(DESTDIR)$(libdir)/$(sl_LIB)
+ $(INSTALL) -m 555 $(sl_LIB) $(DESTDIR)$(libdir)/$(ss_LIB)
+ @install_symlink_command@
+ @install_symlink_command2@
+ $(MKINSTALLDIRS) $(DESTDIR)$(bindir)
+ $(INSTALL) -m 0555 $(PROGS) $(DESTDIR)$(bindir)/$(PROGS)
uninstall:
- rm -f $(libdir)/$(LIB)
+ rm -f $(DESTDIR)$(includedir)/ss/ss.h
+ rm -f $(DESTDIR)$(libdir)/$(sl_LIB) $(DESTDIR)$(libdir)/$(ss_LIB)
+ rm -f $(DESTDIR)$(bindir)/$(PROGS)
TAGS: $(SOURCES)
etags $(SOURCES)
@@ -60,7 +94,7 @@ TAGS: $(SOURCES)
check:
clean:
- rm -f $(LIB) $(PROGS) *.o *.a
+ rm -f $(sl_LIB) $(PROGS) lex.c parse.c parse.h *.o *.a *.so *.so.* so_locations
mostlyclean: clean
@@ -77,8 +111,29 @@ $(LIBNAME).a: $(LIB_OBJECTS)
$(LIBNAME).$(SHLIBEXT): $(LIB_OBJECTS)
rm -f $@
- $(LDSHARED) -o $@ $(LIB_OBJECTS)
+ $(LDSHARED) -o $@ $(LIB_OBJECTS) $(LIB_DEPS)
+ @build_symlink_command@
$(OBJECTS): ../../include/config.h
-.PHONY: all install uninstall check clean mostlyclean distclean realclean
+$(mk_cmds_OBJECTS): parse.h
+
+mk_cmds$(EXECSUFFIX): $(mk_cmds_OBJECTS)
+ $(LINK) $(CFLAGS) -o $@ $(mk_cmds_OBJECTS) -L../roken -lroken
+
+parse.c: parse.h
+parse.h: $(srcdir)/parse.y
+ $(YACC) -d $(srcdir)/parse.y
+ mv -f y.tab.h parse.h
+ mv -f y.tab.c parse.c
+
+lex.c: $(srcdir)/lex.l
+ $(LEX) $(srcdir)/lex.l
+ mv -f lex.yy.c lex.c
+
+strtok_r.c:
+ $(LN_S) $(srcdir)/../roken/strtok_r.c .
+snprintf.c:
+ $(LN_S) $(srcdir)/../roken/snprintf.c .
+
+.PHONY: all Wall install uninstall check clean mostlyclean distclean realclean
diff --git a/crypto/kerberosIV/lib/sl/lex.l b/crypto/kerberosIV/lib/sl/lex.l
new file mode 100644
index 0000000..10bff59
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/lex.l
@@ -0,0 +1,119 @@
+%{
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "make_cmds.h"
+#include "parse.h"
+
+RCSID("$Id: lex.l,v 1.2 1998/09/26 21:01:29 joda Exp $");
+
+static unsigned lineno = 1;
+void error_message(char *, ...);
+int getstring(void);
+
+%}
+
+
+%%
+command_table { return TABLE; }
+request { return REQUEST; }
+unknown { return UNKNOWN; }
+unimplemented { return UNIMPLEMENTED; }
+end { return END; }
+#[^\n]* ;
+[ \t] ;
+\n { lineno++; }
+\" { return getstring(); }
+[a-zA-Z0-9_]+ { yylval.string = strdup(yytext); return STRING; }
+. { return *yytext; }
+%%
+
+#ifndef yywrap /* XXX */
+int
+yywrap ()
+{
+ return 1;
+}
+#endif
+
+int
+getstring(void)
+{
+ char x[128];
+ int i = 0;
+ int c;
+ int backslash = 0;
+ while((c = input()) != EOF){
+ if(backslash) {
+ if(c == 'n')
+ c = '\n';
+ else if(c == 't')
+ c = '\t';
+ x[i++] = c;
+ backslash = 0;
+ continue;
+ }
+ if(c == '\n'){
+ error_message("unterminated string");
+ lineno++;
+ break;
+ }
+ if(c == '\\'){
+ backslash++;
+ continue;
+ }
+ if(c == '\"')
+ break;
+ x[i++] = c;
+ }
+ x[i] = '\0';
+ yylval.string = strdup(x);
+ return STRING;
+}
+
+void
+error_message (char *format, ...)
+{
+ va_list args;
+
+ va_start (args, format);
+ fprintf (stderr, "%s:%d: ", filename, lineno);
+ vfprintf (stderr, format, args);
+ va_end (args);
+ numerror++;
+}
diff --git a/crypto/kerberosIV/lib/sl/make_cmds.c b/crypto/kerberosIV/lib/sl/make_cmds.c
new file mode 100644
index 0000000..b2e733f
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/make_cmds.c
@@ -0,0 +1,245 @@
+/*
+ * Copyright (c) 1998-1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "make_cmds.h"
+#include <getarg.h>
+
+RCSID("$Id: make_cmds.c,v 1.5 1999/04/01 15:03:57 joda Exp $");
+
+#include <roken.h>
+#include <err.h>
+#include "parse.h"
+
+int numerror;
+extern FILE *yyin;
+FILE *c_file;
+
+extern void yyparse(void);
+
+#ifdef YYDEBUG
+extern int yydebug = 1;
+#endif
+
+char *filename;
+char *table_name;
+
+static struct command_list *commands;
+
+void
+add_command(char *function,
+ char *help,
+ struct string_list *aliases,
+ unsigned flags)
+{
+ struct command_list *cl = malloc(sizeof(*cl));
+
+ if (cl == NULL)
+ err (1, "malloc");
+ cl->function = function;
+ cl->help = help;
+ cl->aliases = aliases;
+ cl->flags = flags;
+ cl->next = NULL;
+ if(commands) {
+ *commands->tail = cl;
+ commands->tail = &cl->next;
+ return;
+ }
+ cl->tail = &cl->next;
+ commands = cl;
+}
+
+static char *
+quote(const char *str)
+{
+ char buf[1024]; /* XXX */
+ const char *p;
+ char *q;
+ q = buf;
+
+ *q++ = '\"';
+ for(p = str; *p != '\0'; p++) {
+ if(*p == '\n') {
+ *q++ = '\\';
+ *q++ = 'n';
+ continue;
+ }
+ if(*p == '\t') {
+ *q++ = '\\';
+ *q++ = 't';
+ continue;
+ }
+ if(*p == '\"' || *p == '\\')
+ *q++ = '\\';
+ *q++ = *p;
+ }
+ *q++ = '\"';
+ *q++ = '\0';
+ return strdup(buf);
+}
+
+static void
+generate_commands(void)
+{
+ char *base;
+ char *cfn;
+ char *p;
+
+ p = strrchr(table_name, '/');
+ if(p == NULL)
+ p = table_name;
+ else
+ p++;
+
+ base = strdup (p);
+ if (base == NULL)
+ err (1, "strdup");
+
+ p = strrchr(base, '.');
+ if(p)
+ *p = '\0';
+
+ asprintf(&cfn, "%s.c", base);
+ if (cfn == NULL)
+ err (1, "asprintf");
+
+ c_file = fopen(cfn, "w");
+ if (c_file == NULL)
+ err (1, "cannot fopen %s", cfn);
+
+ fprintf(c_file, "/* Generated from %s */\n", filename);
+ fprintf(c_file, "\n");
+ fprintf(c_file, "#include <stddef.h>\n");
+ fprintf(c_file, "#include <sl.h>\n");
+ fprintf(c_file, "\n");
+
+ {
+ struct command_list *cl, *xl;
+ char *p, *q;
+
+ for(cl = commands; cl; cl = cl->next) {
+ for(xl = commands; xl != cl; xl = xl->next)
+ if(strcmp(cl->function, xl->function) == 0)
+ break;
+ if(xl != cl)
+ continue;
+ /* XXX hack for ss_quit */
+ if(strcmp(cl->function, "ss_quit") == 0) {
+ fprintf(c_file, "int %s (int, char**);\n", cl->function);
+ fprintf(c_file, "#define _ss_quit_wrap ss_quit\n\n");
+ continue;
+ }
+ fprintf(c_file, "void %s (int, char**);\n", cl->function);
+ fprintf(c_file, "static int _%s_wrap (int argc, char **argv)\n",
+ cl->function);
+ fprintf(c_file, "{\n");
+ fprintf(c_file, " %s (argc, argv);\n", cl->function);
+ fprintf(c_file, " return 0;\n");
+ fprintf(c_file, "}\n\n");
+ }
+
+ fprintf(c_file, "SL_cmd %s[] = {\n", table_name);
+ for(cl = commands; cl; cl = cl->next) {
+ struct string_list *sl;
+ sl = cl->aliases;
+ p = quote(sl->string);
+ q = quote(cl->help);
+ fprintf(c_file, " { %s, _%s_wrap, %s },\n", p, cl->function, q);
+ free(p);
+ free(q);
+
+ for(sl = sl->next; sl; sl = sl->next) {
+ p = quote(sl->string);
+ fprintf(c_file, " { %s },\n", p);
+ free(p);
+ }
+ }
+ fprintf(c_file, " { NULL },\n");
+ fprintf(c_file, "};\n");
+ fprintf(c_file, "\n");
+ }
+ fclose(c_file);
+ free(base);
+ free(cfn);
+}
+
+int version_flag;
+int help_flag;
+struct getargs args[] = {
+ { "version", 0, arg_flag, &version_flag },
+ { "help", 0, arg_flag, &help_flag }
+};
+int num_args = sizeof(args) / sizeof(args[0]);
+
+static void
+usage(int code)
+{
+ arg_printusage(args, num_args, NULL, "command-table");
+ exit(code);
+}
+
+int
+main(int argc, char **argv)
+{
+ int optind = 0;
+
+ set_progname(argv[0]);
+ if(getarg(args, num_args, argc, argv, &optind))
+ usage(1);
+ if(help_flag)
+ usage(0);
+ if(version_flag) {
+ print_version(NULL);
+ exit(0);
+ }
+
+ if(argc == optind)
+ usage(1);
+ filename = argv[optind];
+ yyin = fopen(filename, "r");
+ if(yyin == NULL)
+ err(1, "%s", filename);
+
+ yyparse();
+
+ generate_commands();
+
+ if(numerror)
+ return 1;
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/sl/make_cmds.h b/crypto/kerberosIV/lib/sl/make_cmds.h
new file mode 100644
index 0000000..5278a46
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/make_cmds.h
@@ -0,0 +1,74 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: make_cmds.h,v 1.1 1998/02/15 04:15:40 joda Exp $ */
+
+#ifndef __MAKE_CMDS_H__
+#define __MAKE_CMDS_H__
+
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
+#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <stdarg.h>
+
+extern char *filename;
+extern char *table_name;
+extern int numerror;
+
+struct command_list {
+ char *function;
+ char *help;
+ struct string_list *aliases;
+ unsigned flags;
+ struct command_list *next;
+ struct command_list **tail;
+};
+
+struct string_list {
+ char *string;
+ struct string_list *next;
+ struct string_list **tail;
+};
+
+void add_command(char*, char*, struct string_list*, unsigned);
+
+#endif /* __MAKE_CMDS_H__ */
diff --git a/crypto/kerberosIV/lib/sl/parse.y b/crypto/kerberosIV/lib/sl/parse.y
new file mode 100644
index 0000000..dbb952b
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/parse.y
@@ -0,0 +1,199 @@
+%{
+/*
+ * Copyright (c) 1998, 1999 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "make_cmds.h"
+RCSID("$Id: parse.y,v 1.4 1999/03/20 02:43:45 assar Exp $");
+
+void yyerror (char *s);
+long name2number(const char *str);
+void error_message(char *, ...);
+
+struct string_list* append_string(struct string_list*, char*);
+void free_string_list(struct string_list *list);
+unsigned string_to_flag(const char *);
+
+/* This is for bison */
+
+#if !defined(alloca) && !defined(HAVE_ALLOCA)
+#define alloca(x) malloc(x)
+#endif
+
+%}
+
+%union {
+ char *string;
+ unsigned number;
+ struct string_list *list;
+}
+
+%token TABLE REQUEST UNKNOWN UNIMPLEMENTED END
+%token <string> STRING
+%type <number> flag flags
+%type <list> aliases
+
+%%
+
+file : /* */
+ | statements
+ ;
+
+statements : statement
+ | statements statement
+ ;
+
+statement : TABLE STRING ';'
+ {
+ table_name = $2;
+ }
+ | REQUEST STRING ',' STRING ',' aliases ',' '(' flags ')' ';'
+ {
+ add_command($2, $4, $6, $9);
+ }
+ | REQUEST STRING ',' STRING ',' aliases ';'
+ {
+ add_command($2, $4, $6, 0);
+ }
+ | UNIMPLEMENTED STRING ',' STRING ',' aliases ';'
+ {
+ free($2);
+ free($4);
+ free_string_list($6);
+ }
+ | UNKNOWN aliases ';'
+ {
+ free_string_list($2);
+ }
+ | END ';'
+ {
+ YYACCEPT;
+ }
+ ;
+
+aliases : STRING
+ {
+ $$ = append_string(NULL, $1);
+ }
+ | aliases ',' STRING
+ {
+ $$ = append_string($1, $3);
+ }
+ ;
+
+flags : flag
+ {
+ $$ = $1;
+ }
+ | flags ',' flag
+ {
+ $$ = $1 | $3;
+ }
+ ;
+flag : STRING
+ {
+ $$ = string_to_flag($1);
+ free($1);
+ }
+ ;
+
+
+
+%%
+
+long
+name2number(const char *str)
+{
+ const char *p;
+ long base = 0;
+ const char *x = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
+ "abcdefghijklmnopqrstuvwxyz0123456789_";
+ if(strlen(str) > 4) {
+ yyerror("table name too long");
+ return 0;
+ }
+ for(p = str; *p; p++){
+ char *q = strchr(x, *p);
+ if(q == NULL) {
+ yyerror("invalid character in table name");
+ return 0;
+ }
+ base = (base << 6) + (q - x) + 1;
+ }
+ base <<= 8;
+ if(base > 0x7fffffff)
+ base = -(0xffffffff - base + 1);
+ return base;
+}
+
+void
+yyerror (char *s)
+{
+ error_message ("%s\n", s);
+}
+
+struct string_list*
+append_string(struct string_list *list, char *str)
+{
+ struct string_list *sl = malloc(sizeof(*sl));
+ sl->string = str;
+ sl->next = NULL;
+ if(list) {
+ *list->tail = sl;
+ list->tail = &sl->next;
+ return list;
+ }
+ sl->tail = &sl->next;
+ return sl;
+}
+
+void
+free_string_list(struct string_list *list)
+{
+ while(list) {
+ struct string_list *sl = list->next;
+ free(list->string);
+ free(list);
+ list = sl;
+ }
+}
+
+unsigned
+string_to_flag(const char *string)
+{
+ return 0;
+}
diff --git a/crypto/kerberosIV/lib/sl/roken_rename.h b/crypto/kerberosIV/lib/sl/roken_rename.h
new file mode 100644
index 0000000..f3e947c
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/roken_rename.h
@@ -0,0 +1,66 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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_rename.h,v 1.2 1999/01/25 10:01:46 joda Exp $ */
+
+#ifndef __roken_rename_h__
+#define __roken_rename_h__
+
+#ifndef HAVE_STRTOK_R
+#define strtok_r _sl_strtok_r
+#endif
+#ifndef HAVE_SNPRINTF
+#define snprintf _sl_snprintf
+#endif
+#ifndef HAVE_ASPRINTF
+#define asprintf _sl_asprintf
+#endif
+#ifndef HAVE_ASNPRINTF
+#define asnprintf _sl_asnprintf
+#endif
+#ifndef HAVE_VASPRINTF
+#define vasprintf _sl_vasprintf
+#endif
+#ifndef HAVE_VASNPRINTF
+#define vasnprintf _sl_vasnprintf
+#endif
+#ifndef HAVE_VSNPRINTF
+#define vsnprintf _sl_vsnprintf
+#endif
+
+#endif /* __roken_rename_h__ */
diff --git a/crypto/kerberosIV/lib/sl/sl.c b/crypto/kerberosIV/lib/sl/sl.c
index adf71f5..2de8868 100644
--- a/crypto/kerberosIV/lib/sl/sl.c
+++ b/crypto/kerberosIV/lib/sl/sl.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -38,7 +38,7 @@
#ifdef HAVE_CONFIG_H
#include <config.h>
-RCSID("$Id: sl.c,v 1.12 1997/06/01 03:15:07 assar Exp $");
+RCSID("$Id: sl.c,v 1.24 1998/11/22 09:47:49 assar Exp $");
#endif
#include "sl_locl.h"
@@ -89,16 +89,19 @@ sl_help (SL_cmd *cmds, int argc, char **argv)
} else {
c = sl_match (cmds, argv[1], 0);
if (c == NULL)
- printf ("No such command: %s. Try \"help\" for a list of all commands\n",
+ printf ("No such command: %s. "
+ "Try \"help\" for a list of all commands\n",
argv[1]);
else {
- printf ("%s\t%s", c->name, c->usage);
+ printf ("%s\t%s\n", c->name, c->usage);
+ if(c->help && *c->help)
+ printf ("%s\n", c->help);
if((++c)->name && c->func == NULL) {
- printf ("\nSynonyms:");
+ printf ("Synonyms:");
while (c->name && c->func == NULL)
printf ("\t%s", (c++)->name);
+ printf ("\n");
}
- printf ("\n");
}
}
}
@@ -131,60 +134,95 @@ add_history(char *p)
#endif
int
-sl_loop (SL_cmd *cmds, char *prompt)
+sl_command(SL_cmd *cmds, int argc, char **argv)
{
- unsigned max_count;
- char **ptr;
-
- max_count = 17;
- ptr = malloc(max_count * sizeof(*ptr));
- if (ptr == NULL) {
- printf ("sl_loop: failed to allocate %u bytes of memory\n",
- (int) max_count * sizeof(*ptr));
+ SL_cmd *c;
+ c = sl_match (cmds, argv[0], 0);
+ if (c == NULL)
return -1;
- }
+ return (*c->func)(argc, argv);
+}
+
+struct sl_data {
+ int max_count;
+ char **ptr;
+};
- for (;;) {
- char *buf;
- unsigned count;
- SL_cmd *c;
-
- buf = readline(prompt);
- if(buf == NULL)
- break;
-
- if(*buf)
- add_history(buf);
- count = 0;
- {
- char *foo = NULL;
- char *p;
-
- for(p = strtok_r (buf, " \t", &foo);
- p;
- p = strtok_r (NULL, " \t", &foo)) {
- if(count == max_count) {
- max_count *= 2;
- ptr = realloc (ptr, max_count * sizeof(*ptr));
- if (ptr == NULL) {
- printf ("sl_loop: failed to allocate %u "
- "bytes of memory\n",
- (unsigned) max_count * sizeof(*ptr));
- return -1;
- }
- }
- ptr[count++] = p;
+int
+sl_make_argv(char *line, int *ret_argc, char ***ret_argv)
+{
+ char *foo = NULL;
+ char *p;
+ int argc, nargv;
+ char **argv;
+
+ nargv = 10;
+ argv = malloc(nargv * sizeof(*argv));
+ if(argv == NULL)
+ return ENOMEM;
+ argc = 0;
+
+ for(p = strtok_r (line, " \t", &foo);
+ p;
+ p = strtok_r (NULL, " \t", &foo)) {
+ if(argc == nargv - 1) {
+ char **tmp;
+ nargv *= 2;
+ tmp = realloc (argv, nargv * sizeof(*argv));
+ if (tmp == NULL) {
+ free(argv);
+ return ENOMEM;
}
+ argv = tmp;
}
- if (count > 0) {
- c = sl_match (cmds, ptr[0], 0);
- if (c)
- (*c->func)(count, ptr);
- else
- printf ("Unrecognized command: %s\n", ptr[0]);
- }
- free(buf);
+ argv[argc++] = p;
}
- free (ptr);
+ argv[argc] = NULL;
+ *ret_argc = argc;
+ *ret_argv = argv;
return 0;
}
+
+/* return values: 0 on success, -1 on fatal error, or return value of command */
+int
+sl_command_loop(SL_cmd *cmds, char *prompt, void **data)
+{
+ int ret = 0;
+ char *buf;
+ int argc;
+ char **argv;
+
+ ret = 0;
+ buf = readline(prompt);
+ if(buf == NULL)
+ return 1;
+
+ if(*buf)
+ add_history(buf);
+ ret = sl_make_argv(buf, &argc, &argv);
+ if(ret) {
+ fprintf(stderr, "sl_loop: out of memory\n");
+ free(buf);
+ return -1;
+ }
+ if (argc >= 1) {
+ ret = sl_command(cmds, argc, argv);
+ if(ret == -1) {
+ printf ("Unrecognized command: %s\n", argv[0]);
+ ret = 0;
+ }
+ }
+ free(buf);
+ free(argv);
+ return ret;
+}
+
+int
+sl_loop(SL_cmd *cmds, char *prompt)
+{
+ void *data = NULL;
+ int ret;
+ while((ret = sl_command_loop(cmds, prompt, &data)) == 0)
+ ;
+ return ret;
+}
diff --git a/crypto/kerberosIV/lib/sl/sl.h b/crypto/kerberosIV/lib/sl/sl.h
index 158e590..2606e0f 100644
--- a/crypto/kerberosIV/lib/sl/sl.h
+++ b/crypto/kerberosIV/lib/sl/sl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-/* $Id: sl.h,v 1.2 1997/04/01 08:19:18 joda Exp $ */
+/* $Id: sl.h,v 1.6 1998/06/09 19:25:40 joda Exp $ */
#ifndef _SL_H
#define _SL_H
-typedef void (*cmd_func)(int, char **);
+typedef int (*cmd_func)(int, char **);
struct sl_cmd {
char *name;
@@ -54,5 +54,9 @@ typedef struct sl_cmd SL_cmd;
void sl_help (SL_cmd *, int argc, char **argv);
int sl_loop (SL_cmd *, char *prompt);
+int sl_command_loop (SL_cmd *cmds, char *prompt, void **data);
+int sl_command (SL_cmd *cmds, int argc, char **argv);
+int sl_make_argv(char*, int*, char***);
+
#endif /* _SL_H */
diff --git a/crypto/kerberosIV/lib/sl/sl_locl.h b/crypto/kerberosIV/lib/sl/sl_locl.h
index ddf25bb..cf5805f 100644
--- a/crypto/kerberosIV/lib/sl/sl_locl.h
+++ b/crypto/kerberosIV/lib/sl/sl_locl.h
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 1996, 1997 Kungliga Tekniska Högskolan
+ * Copyright (c) 1995, 1996, 1997, 1998 Kungliga Tekniska Högskolan
* (Royal Institute of Technology, Stockholm, Sweden).
* All rights reserved.
*
@@ -36,13 +36,16 @@
* SUCH DAMAGE.
*/
-/* $Id: sl_locl.h,v 1.3 1997/04/01 08:19:18 joda Exp $ */
+/* $Id: sl_locl.h,v 1.5 1998/02/15 04:14:08 joda Exp $ */
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <stdarg.h>
#include <roken.h>
-#include <protos.h>
#include <sl.h>
diff --git a/crypto/kerberosIV/lib/sl/ss.c b/crypto/kerberosIV/lib/sl/ss.c
new file mode 100644
index 0000000..748613b
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/ss.c
@@ -0,0 +1,138 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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 "sl_locl.h"
+#include <com_err.h>
+#include "ss.h"
+
+RCSID("$Id: ss.c,v 1.3 1998/11/22 09:47:24 assar Exp $");
+
+struct ss_subst {
+ char *name;
+ char *version;
+ char *info;
+ ss_request_table *table;
+};
+
+static struct ss_subst subsystems[2];
+static int num_subsystems;
+
+int
+ss_create_invocation(const char *subsystem,
+ const char *version,
+ const char *info,
+ ss_request_table *table,
+ int *code)
+{
+ struct ss_subst *ss;
+ if(num_subsystems >= sizeof(subsystems) / sizeof(subsystems[0])) {
+ *code = 17;
+ return 0;
+ }
+ ss = &subsystems[num_subsystems];
+ ss->name = subsystem ? strdup(subsystem) : NULL;
+ ss->version = version ? strdup(version) : NULL;
+ ss->info = info ? strdup(info) : NULL;
+ ss->table = table;
+ *code = 0;
+ return num_subsystems++;
+}
+
+void
+ss_error (int index, long code, const char *fmt, ...)
+{
+ va_list ap;
+ va_start(ap, fmt);
+ com_err_va (subsystems[index].name, code, fmt, ap);
+ va_end(ap);
+}
+
+void
+ss_perror (int index, long code, const char *msg)
+{
+ ss_error(index, code, "%s", msg);
+}
+
+int
+ss_execute_command(int index, char **argv)
+{
+ int argc = 0;
+ while(argv[argc++]);
+ sl_command(subsystems[index].table, argc, argv);
+ return 0;
+}
+
+int
+ss_execute_line (int index, const char *line)
+{
+ char *buf = strdup(line);
+ int argc;
+ char **argv;
+
+ sl_make_argv(buf, &argc, &argv);
+ sl_command(subsystems[index].table, argc, argv);
+ free(buf);
+ return 0;
+}
+
+int
+ss_listen (int index)
+{
+ char *prompt = malloc(strlen(subsystems[index].name) + 3);
+ if(prompt == NULL) {
+ abort();
+ }
+ strcpy(prompt, subsystems[index].name);
+ strcat(prompt, ": ");
+ sl_loop(subsystems[index].table, prompt);
+ free(prompt);
+ return 0;
+}
+
+int
+ss_list_requests(int argc, char **argv /* , int index, void *info */)
+{
+ sl_help(subsystems[0 /* index */].table, argc, argv);
+ return 0;
+}
+
+int
+ss_quit(int argc, char **argv)
+{
+ return 1;
+}
diff --git a/crypto/kerberosIV/lib/sl/ss.h b/crypto/kerberosIV/lib/sl/ss.h
new file mode 100644
index 0000000..c7f0098
--- /dev/null
+++ b/crypto/kerberosIV/lib/sl/ss.h
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 1998 Kungliga Tekniska Högskolan
+ * (Royal Institute of Technology, Stockholm, Sweden).
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * 3. All advertising materials mentioning features or use of this software
+ * must display the following acknowledgement:
+ * This product includes software developed by 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: ss.h,v 1.1 1998/02/15 04:13:34 joda Exp $ */
+
+/* SS compatibility for SL */
+
+#ifndef __ss_h__
+#define __ss_h__
+
+#include <sl.h>
+
+typedef SL_cmd ss_request_table;
+
+int ss_create_invocation (const char *, const char *, const char*,
+ ss_request_table*, int*);
+
+void ss_error (int, long, const char*, ...);
+int ss_execute_command (int, char**);
+int ss_execute_line (int, const char*);
+int ss_list_requests (int argc, char**);
+int ss_listen (int);
+void ss_perror (int, long, const char*);
+int ss_quit (int argc, char**);
+
+#endif /* __ss_h__ */
OpenPOWER on IntegriCloud