From 1abd325d288bd51f6ca702d7fbf296a6f47f7e74 Mon Sep 17 00:00:00 2001 From: nectar Date: Sun, 24 Nov 2002 20:59:25 +0000 Subject: Import of Heimdal 0.5.1. Approved by: re --- crypto/heimdal/lib/krb5/Makefile.am | 4 +-- crypto/heimdal/lib/krb5/Makefile.in | 57 ++++++++----------------------- crypto/heimdal/lib/krb5/changepw.c | 2 +- crypto/heimdal/lib/krb5/context.c | 4 +-- crypto/heimdal/lib/krb5/keytab_any.c | 12 ++++--- crypto/heimdal/lib/krb5/keytab_file.c | 12 ++++--- crypto/heimdal/lib/krb5/keytab_keyfile.c | 8 ++--- crypto/heimdal/lib/krb5/krb5_appdefault.3 | 4 +-- crypto/heimdal/lib/krb5/kuserok.c | 2 +- crypto/heimdal/lib/krb5/principal.c | 8 ++++- crypto/heimdal/lib/krb5/prompter_posix.c | 2 +- crypto/heimdal/lib/krb5/store_emem.c | 6 ++-- 12 files changed, 52 insertions(+), 69 deletions(-) (limited to 'crypto/heimdal/lib/krb5') diff --git a/crypto/heimdal/lib/krb5/Makefile.am b/crypto/heimdal/lib/krb5/Makefile.am index ae75808..6332935 100644 --- a/crypto/heimdal/lib/krb5/Makefile.am +++ b/crypto/heimdal/lib/krb5/Makefile.am @@ -1,4 +1,4 @@ -# $Id: Makefile.am,v 1.147 2002/09/03 14:45:13 joda Exp $ +# $Id: Makefile.am,v 1.147.2.1 2002/10/21 15:03:14 joda Exp $ include $(top_srcdir)/Makefile.am.common @@ -130,7 +130,7 @@ libkrb5_la_SOURCES = \ write_message.c \ $(ERR_FILES) -libkrb5_la_LDFLAGS = -version-info 18:3:1 +libkrb5_la_LDFLAGS = -version-info 18:4:1 $(libkrb5_la_OBJECTS): $(srcdir)/krb5-protos.h $(srcdir)/krb5-private.h diff --git a/crypto/heimdal/lib/krb5/Makefile.in b/crypto/heimdal/lib/krb5/Makefile.in index 80ce39f..4613c46 100644 --- a/crypto/heimdal/lib/krb5/Makefile.in +++ b/crypto/heimdal/lib/krb5/Makefile.in @@ -1,4 +1,4 @@ -# Makefile.in generated by automake 1.6.3 from Makefile.am. +# Makefile.in generated by automake 1.6.1 from Makefile.am. # @configure_input@ # Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002 @@ -14,7 +14,7 @@ @SET_MAKE@ -# $Id: Makefile.am,v 1.147 2002/09/03 14:45:13 joda Exp $ +# $Id: Makefile.am,v 1.147.2.1 2002/10/21 15:03:14 joda Exp $ # $Id: Makefile.am.common,v 1.5 2002/05/19 18:35:37 joda Exp $ @@ -55,7 +55,6 @@ INSTALL_PROGRAM = @INSTALL_PROGRAM@ INSTALL_DATA = @INSTALL_DATA@ install_sh_DATA = $(install_sh) -c -m 644 install_sh_PROGRAM = $(install_sh) -c -install_sh_SCRIPT = $(install_sh) -c INSTALL_SCRIPT = @INSTALL_SCRIPT@ INSTALL_HEADER = $(INSTALL_DATA) transform = @program_transform_name@ @@ -332,7 +331,7 @@ libkrb5_la_SOURCES = \ $(ERR_FILES) -libkrb5_la_LDFLAGS = -version-info 18:3:1 +libkrb5_la_LDFLAGS = -version-info 18:4:1 #libkrb5_la_LIBADD = ../com_err/error.lo ../com_err/com_err.lo @@ -378,7 +377,7 @@ LTLIBRARIES = $(lib_LTLIBRARIES) libkrb5_la_DEPENDENCIES = ../com_err/error.lo ../com_err/com_err.lo \ $(top_builddir)/lib/asn1/libasn1.la -am__objects_1 = krb5_err.lo heim_err.lo k524_err.lo +am__objects_14 = krb5_err.lo heim_err.lo k524_err.lo am_libkrb5_la_OBJECTS = acl.lo add_et_list.lo addr_families.lo \ aname_to_localname.lo appdefault.lo asn1_glue.lo \ auth_context.lo build_ap_req.lo build_auth.lo cache.lo \ @@ -402,7 +401,7 @@ am_libkrb5_la_OBJECTS = acl.lo add_et_list.lo addr_families.lo \ sendauth.lo set_default_realm.lo sock_principal.lo store.lo \ store_emem.lo store_fd.lo store_mem.lo ticket.lo time.lo \ transited.lo verify_init.lo verify_user.lo version.lo warn.lo \ - write_message.lo $(am__objects_1) + write_message.lo $(am__objects_14) libkrb5_la_OBJECTS = $(am_libkrb5_la_OBJECTS) bin_PROGRAMS = verify_krb5_conf$(EXEEXT) check_PROGRAMS = n-fold-test$(EXEEXT) string-to-key-test$(EXEEXT) \ @@ -528,12 +527,6 @@ uninstall-libLTLIBRARIES: clean-libLTLIBRARIES: -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) - @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ - dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ - test -z "$dir" && dir=.; \ - echo "rm -f \"$${dir}/so_locations\""; \ - rm -f "$${dir}/so_locations"; \ - done libkrb5.la: $(libkrb5_la_OBJECTS) $(libkrb5_la_DEPENDENCIES) $(LINK) -rpath $(libdir) $(libkrb5_la_LDFLAGS) $(libkrb5_la_OBJECTS) $(libkrb5_la_LIBADD) $(LIBS) binPROGRAMS_INSTALL = $(INSTALL_PROGRAM) @@ -545,7 +538,8 @@ install-binPROGRAMS: $(bin_PROGRAMS) if test -f $$p \ || test -f $$p1 \ ; then \ - f=`echo "$$p1" | sed 's,^.*/,,;$(transform);s/$$/$(EXEEXT)/'`; \ + p1=`echo "$$p1" | sed -e 's,^.*/,,'`; \ + f=`echo $$p1|sed '$(transform);s/$$/$(EXEEXT)/'`; \ echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f"; \ $(INSTALL_PROGRAM_ENV) $(LIBTOOL) --mode=install $(binPROGRAMS_INSTALL) $$p $(DESTDIR)$(bindir)/$$f; \ else :; fi; \ @@ -554,31 +548,20 @@ install-binPROGRAMS: $(bin_PROGRAMS) uninstall-binPROGRAMS: @$(NORMAL_UNINSTALL) @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo "$$p" | sed 's,^.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + f=`echo $$p|sed 's/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/'`; \ + f=`echo "$$f" | sed -e 's,^.*/,,'`; \ echo " rm -f $(DESTDIR)$(bindir)/$$f"; \ rm -f $(DESTDIR)$(bindir)/$$f; \ done clean-binPROGRAMS: - @list='$(bin_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + -test -z "$(bin_PROGRAMS)" || rm -f $(bin_PROGRAMS) clean-checkPROGRAMS: - @list='$(check_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + -test -z "$(check_PROGRAMS)" || rm -f $(check_PROGRAMS) clean-noinstPROGRAMS: - @list='$(noinst_PROGRAMS)'; for p in $$list; do \ - f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \ - echo " rm -f $$p $$f"; \ - rm -f $$p $$f ; \ - done + -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS) derived-key-test$(EXEEXT): $(derived_key_test_OBJECTS) $(derived_key_test_DEPENDENCIES) @rm -f derived-key-test$(EXEEXT) $(LINK) $(derived_key_test_LDFLAGS) $(derived_key_test_OBJECTS) $(derived_key_test_LDADD) $(LIBS) @@ -650,10 +633,6 @@ install-man3: $(man3_MANS) $(man_MANS) if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 3*) ;; \ - *) ext='3' ;; \ - esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ @@ -693,10 +672,6 @@ install-man5: $(man5_MANS) $(man_MANS) if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 5*) ;; \ - *) ext='5' ;; \ - esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ @@ -736,10 +711,6 @@ install-man8: $(man8_MANS) $(man_MANS) if test -f $(srcdir)/$$i; then file=$(srcdir)/$$i; \ else file=$$i; fi; \ ext=`echo $$i | sed -e 's/^.*\\.//'`; \ - case "$$ext" in \ - 8*) ;; \ - *) ext='8' ;; \ - esac; \ inst=`echo $$i | sed -e 's/\\.[0-9a-z]*$$//'`; \ inst=`echo $$inst | sed -e 's/^.*\///'`; \ inst=`echo $$inst | sed '$(transform)'`.$$ext; \ @@ -878,7 +849,7 @@ top_distdir = ../.. distdir = $(top_distdir)/$(PACKAGE)-$(VERSION) distdir: $(DISTFILES) - @list='$(DISTFILES)'; for file in $$list; do \ + @for file in $(DISTFILES); do \ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \ if test "$$dir" != "$$file" && test "$$dir" != "."; then \ @@ -932,7 +903,7 @@ clean-generic: -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) distclean-generic: - -rm -f Makefile $(CONFIG_CLEAN_FILES) + -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]* maintainer-clean-generic: @echo "This command is intended for maintainers to use" diff --git a/crypto/heimdal/lib/krb5/changepw.c b/crypto/heimdal/lib/krb5/changepw.c index a17bf2b..0dcce13 100644 --- a/crypto/heimdal/lib/krb5/changepw.c +++ b/crypto/heimdal/lib/krb5/changepw.c @@ -33,7 +33,7 @@ #include -RCSID("$Id: changepw.c,v 1.38 2002/09/29 11:48:34 joda Exp $"); +RCSID("$Id: changepw.c,v 1.37.2.1 2002/10/21 14:31:58 joda Exp $"); static krb5_error_code send_request (krb5_context context, diff --git a/crypto/heimdal/lib/krb5/context.c b/crypto/heimdal/lib/krb5/context.c index 75fe347..096aff2 100644 --- a/crypto/heimdal/lib/krb5/context.c +++ b/crypto/heimdal/lib/krb5/context.c @@ -34,7 +34,7 @@ #include "krb5_locl.h" #include -RCSID("$Id: context.c,v 1.81 2002/09/02 17:03:12 joda Exp $"); +RCSID("$Id: context.c,v 1.81.2.1 2002/10/21 14:33:34 joda Exp $"); #define INIT_FIELD(C, T, E, D, F) \ (C)->E = krb5_config_get_ ## T ## _default ((C), NULL, (D), \ @@ -259,7 +259,7 @@ krb5_set_config_files(krb5_context context, char **filenames) /* with this enabled and if there are no config files, Kerberos is considererd disabled */ if(tmp == NULL) - return ENOENT; + return ENXIO; #endif krb5_config_file_free(context, context->cf); context->cf = tmp; diff --git a/crypto/heimdal/lib/krb5/keytab_any.c b/crypto/heimdal/lib/krb5/keytab_any.c index 268c8df..fe14d62 100644 --- a/crypto/heimdal/lib/krb5/keytab_any.c +++ b/crypto/heimdal/lib/krb5/keytab_any.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2002 Kungliga Tekniska Högskolan + * Copyright (c) 2001-2002 Kungliga Tekniska Högskolan * (Royal Institute of Technology, Stockholm, Sweden). * All rights reserved. * @@ -33,7 +33,7 @@ #include "krb5_locl.h" -RCSID("$Id: keytab_any.c,v 1.6 2002/04/18 14:02:11 joda Exp $"); +RCSID("$Id: keytab_any.c,v 1.6.4.1 2002/10/21 16:07:00 joda Exp $"); struct any_data { krb5_keytab kt; @@ -42,13 +42,15 @@ struct any_data { }; static void -free_list (struct any_data *a) +free_list (krb5_context context, struct any_data *a) { struct any_data *next; for (; a != NULL; a = next) { next = a->next; free (a->name); + if(a->kt) + krb5_kt_close(context, a->kt); free (a); } } @@ -91,7 +93,7 @@ any_resolve(krb5_context context, const char *name, krb5_keytab id) id->data = a0; return 0; fail: - free_list (a0); + free_list (context, a0); return ret; } @@ -112,7 +114,7 @@ any_close (krb5_context context, { struct any_data *a = id->data; - free_list (a); + free_list (context, a); return 0; } diff --git a/crypto/heimdal/lib/krb5/keytab_file.c b/crypto/heimdal/lib/krb5/keytab_file.c index 7655af5..e9d9fd8 100644 --- a/crypto/heimdal/lib/krb5/keytab_file.c +++ b/crypto/heimdal/lib/krb5/keytab_file.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -RCSID("$Id: keytab_file.c,v 1.11 2002/05/28 12:57:27 joda Exp $"); +RCSID("$Id: keytab_file.c,v 1.11.4.1 2002/10/21 14:35:47 joda Exp $"); #define KRB5_KT_VNO_1 1 #define KRB5_KT_VNO_2 2 @@ -303,7 +303,7 @@ fkt_start_seq_get_int(krb5_context context, c->fd = open (d->filename, flags); if (c->fd < 0) { ret = errno; - krb5_set_error_string(context, "open(%s): %s", d->filename, + krb5_set_error_string(context, "%s: %s", d->filename, strerror(ret)); return ret; } @@ -441,7 +441,7 @@ fkt_add_entry(krb5_context context, fd = open (d->filename, O_RDWR | O_BINARY); if (fd < 0) { - fd = open (d->filename, O_RDWR | O_CREAT | O_BINARY, 0600); + fd = open (d->filename, O_RDWR | O_CREAT | O_EXCL | O_BINARY, 0600); if (fd < 0) { ret = errno; krb5_set_error_string(context, "open(%s): %s", d->filename, @@ -572,8 +572,11 @@ fkt_remove_entry(krb5_context context, krb5_kt_cursor cursor; off_t pos_start, pos_end; int found = 0; + krb5_error_code ret; - fkt_start_seq_get_int(context, id, O_RDWR | O_BINARY, &cursor); + ret = fkt_start_seq_get_int(context, id, O_RDWR | O_BINARY, &cursor); + if(ret != 0) + goto out; /* return other error here? */ while(fkt_next_entry_int(context, id, &e, &cursor, &pos_start, &pos_end) == 0) { if(krb5_kt_compare(context, &e, entry->principal, @@ -592,6 +595,7 @@ fkt_remove_entry(krb5_context context, } } krb5_kt_end_seq_get(context, id, &cursor); + out: if (!found) { krb5_clear_error_string (context); return KRB5_KT_NOTFOUND; diff --git a/crypto/heimdal/lib/krb5/keytab_keyfile.c b/crypto/heimdal/lib/krb5/keytab_keyfile.c index e4c4eb6..7bfc59c 100644 --- a/crypto/heimdal/lib/krb5/keytab_keyfile.c +++ b/crypto/heimdal/lib/krb5/keytab_keyfile.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -RCSID("$Id: keytab_keyfile.c,v 1.14 2002/09/09 14:22:26 nectar Exp $"); +RCSID("$Id: keytab_keyfile.c,v 1.14.2.1 2002/10/21 16:07:26 joda Exp $"); /* afs keyfile operations --------------------------------------- */ @@ -82,8 +82,7 @@ get_cell_and_realm (krb5_context context, krb5_set_error_string (context, "no cell in %s", AFS_SERVERTHISCELL); return EINVAL; } - if (buf[strlen(buf) - 1] == '\n') - buf[strlen(buf) - 1] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; fclose(f); d->cell = strdup (buf); @@ -100,8 +99,7 @@ get_cell_and_realm (krb5_context context, AFS_SERVERMAGICKRBCONF); return EINVAL; } - if (buf[strlen(buf)-1] == '\n') - buf[strlen(buf)-1] = '\0'; + buf[strcspn(buf, "\n")] = '\0'; fclose(f); } /* uppercase */ diff --git a/crypto/heimdal/lib/krb5/krb5_appdefault.3 b/crypto/heimdal/lib/krb5/krb5_appdefault.3 index f82ec7a..750bb75 100644 --- a/crypto/heimdal/lib/krb5/krb5_appdefault.3 +++ b/crypto/heimdal/lib/krb5/krb5_appdefault.3 @@ -1,5 +1,5 @@ .\" Copyright (c) 2000 Kungliga Tekniska Högskolan -.\" $Id: krb5_appdefault.3,v 1.8 2002/09/13 14:49:31 joda Exp $ +.\" $Id: krb5_appdefault.3,v 1.7 2002/08/28 15:30:46 joda Exp $ .Dd July 25, 2000 .Dt KRB5_APPDEFAULT 3 .Os HEIMDAL @@ -19,7 +19,7 @@ Kerberos 5 Library (libkrb5, -lkrb5) .Ft void .Fn krb5_appdefault_time "krb5_context context" "const char *appname" "krb5_realm realm" "const char *option" "time_t def_val" "time_t *ret_val" .Sh DESCRIPTION -These functions get application defaults from the +These functions get application application defaults from the .Dv appdefaults section of the .Xr krb5.conf 5 diff --git a/crypto/heimdal/lib/krb5/kuserok.c b/crypto/heimdal/lib/krb5/kuserok.c index 17770c1..95123699 100644 --- a/crypto/heimdal/lib/krb5/kuserok.c +++ b/crypto/heimdal/lib/krb5/kuserok.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -RCSID("$Id: kuserok.c,v 1.6 2002/09/16 17:32:11 nectar Exp $"); +RCSID("$Id: kuserok.c,v 1.5.12.1 2002/10/21 14:37:55 joda Exp $"); /* * Return TRUE iff `principal' is allowed to login as `luser'. diff --git a/crypto/heimdal/lib/krb5/principal.c b/crypto/heimdal/lib/krb5/principal.c index c5289ce..400ce38 100644 --- a/crypto/heimdal/lib/krb5/principal.c +++ b/crypto/heimdal/lib/krb5/principal.c @@ -41,7 +41,7 @@ #include #include "resolve.h" -RCSID("$Id: principal.c,v 1.81 2002/08/26 13:31:40 assar Exp $"); +RCSID("$Id: principal.c,v 1.81.2.1 2002/10/21 16:08:25 joda Exp $"); #define princ_num_comp(P) ((P)->name.name_string.len) #define princ_type(P) ((P)->name.name_type) @@ -140,6 +140,12 @@ krb5_parse_name(krb5_context context, c = '\b'; else if(c == '0') c = '\0'; + else if(c == '\0') { + krb5_set_error_string (context, + "trailing \\ in principal name"); + ret = KRB5_PARSE_MALFORMED; + goto exit; + } }else if(c == '/' || c == '@'){ if(got_realm){ krb5_set_error_string (context, diff --git a/crypto/heimdal/lib/krb5/prompter_posix.c b/crypto/heimdal/lib/krb5/prompter_posix.c index 4aea3a4..c6cc715 100644 --- a/crypto/heimdal/lib/krb5/prompter_posix.c +++ b/crypto/heimdal/lib/krb5/prompter_posix.c @@ -33,7 +33,7 @@ #include "krb5_locl.h" -RCSID("$Id: prompter_posix.c,v 1.7 2002/09/16 17:32:11 nectar Exp $"); +RCSID("$Id: prompter_posix.c,v 1.6.6.1 2002/10/21 14:47:42 joda Exp $"); int krb5_prompter_posix (krb5_context context, diff --git a/crypto/heimdal/lib/krb5/store_emem.c b/crypto/heimdal/lib/krb5/store_emem.c index 337a81c..47ca1c8 100644 --- a/crypto/heimdal/lib/krb5/store_emem.c +++ b/crypto/heimdal/lib/krb5/store_emem.c @@ -34,7 +34,7 @@ #include "krb5_locl.h" #include "store-int.h" -RCSID("$Id: store_emem.c,v 1.12 2002/04/18 14:00:34 joda Exp $"); +RCSID("$Id: store_emem.c,v 1.12.4.1 2002/10/21 16:08:55 joda Exp $"); typedef struct emem_storage{ unsigned char *base; @@ -61,8 +61,10 @@ emem_store(krb5_storage *sp, const void *data, size_t size) if(size > s->base + s->size - s->ptr){ void *base; size_t sz, off; - sz = 2 * (size + (s->ptr - s->base)); /* XXX */ off = s->ptr - s->base; + sz = off + size; + if (sz < 4096) + sz *= 2; base = realloc(s->base, sz); if(base == NULL) return 0; -- cgit v1.1