summaryrefslogtreecommitdiff
path: root/crypto/heimdal/lib/hdb
diff options
context:
space:
mode:
Diffstat (limited to 'crypto/heimdal/lib/hdb')
-rw-r--r--crypto/heimdal/lib/hdb/Makefile686
-rw-r--r--crypto/heimdal/lib/hdb/Makefile.am62
-rw-r--r--crypto/heimdal/lib/hdb/Makefile.in678
-rw-r--r--crypto/heimdal/lib/hdb/common.c143
-rw-r--r--crypto/heimdal/lib/hdb/convert_db.c213
-rw-r--r--crypto/heimdal/lib/hdb/db.c299
-rw-r--r--crypto/heimdal/lib/hdb/db3.c328
-rw-r--r--crypto/heimdal/lib/hdb/hdb-ldap.c1303
-rw-r--r--crypto/heimdal/lib/hdb/hdb-private.h27
-rw-r--r--crypto/heimdal/lib/hdb/hdb-protos.h188
-rw-r--r--crypto/heimdal/lib/hdb/hdb.asn170
-rw-r--r--crypto/heimdal/lib/hdb/hdb.c240
-rw-r--r--crypto/heimdal/lib/hdb/hdb.h91
-rw-r--r--crypto/heimdal/lib/hdb/hdb_err.et27
-rw-r--r--crypto/heimdal/lib/hdb/hdb_locl.h64
-rw-r--r--crypto/heimdal/lib/hdb/keytab.c264
-rw-r--r--crypto/heimdal/lib/hdb/libasn1.h51
-rw-r--r--crypto/heimdal/lib/hdb/mkey.c525
-rw-r--r--crypto/heimdal/lib/hdb/ndbm.c361
-rw-r--r--crypto/heimdal/lib/hdb/print.c262
20 files changed, 0 insertions, 5882 deletions
diff --git a/crypto/heimdal/lib/hdb/Makefile b/crypto/heimdal/lib/hdb/Makefile
deleted file mode 100644
index b1c2f969fc972..0000000000000
--- a/crypto/heimdal/lib/hdb/Makefile
+++ /dev/null
@@ -1,686 +0,0 @@
-# Makefile.in generated by automake 1.6.3 from Makefile.am.
-# lib/hdb/Makefile. Generated from Makefile.in by configure.
-
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-
-
-# $Id: Makefile.am,v 1.53 2002/08/19 16:17:16 joda Exp $
-
-# $Id: Makefile.am.common,v 1.5 2002/05/19 18:35:37 joda Exp $
-
-# $Id: Makefile.am.common,v 1.36 2002/08/19 16:10:25 joda Exp $
-SHELL = /bin/sh
-
-srcdir = .
-top_srcdir = ../..
-
-prefix = /usr/heimdal
-exec_prefix = ${prefix}
-
-bindir = ${exec_prefix}/bin
-sbindir = ${exec_prefix}/sbin
-libexecdir = ${exec_prefix}/libexec
-datadir = ${prefix}/share
-sysconfdir = /etc
-sharedstatedir = ${prefix}/com
-localstatedir = /var/heimdal
-libdir = ${exec_prefix}/lib
-infodir = ${prefix}/info
-mandir = ${prefix}/man
-includedir = ${prefix}/include
-oldincludedir = /usr/include
-pkgdatadir = $(datadir)/heimdal
-pkglibdir = $(libdir)/heimdal
-pkgincludedir = $(includedir)/heimdal
-top_builddir = ../..
-
-ACLOCAL = ${SHELL} /usr/home/nectar/devel/heimdal/missing --run aclocal-1.6
-AUTOCONF = ${SHELL} /usr/home/nectar/devel/heimdal/missing --run autoconf
-AUTOMAKE = ${SHELL} /usr/home/nectar/devel/heimdal/missing --run automake-1.6
-AUTOHEADER = ${SHELL} /usr/home/nectar/devel/heimdal/missing --run autoheader
-
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = /usr/bin/install -c
-INSTALL_PROGRAM = ${INSTALL}
-INSTALL_DATA = ${INSTALL} -m 644
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_SCRIPT = ${INSTALL}
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = s,x,x,
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-host_alias =
-host_triplet = i386-unknown-freebsd5.0
-
-EXEEXT =
-OBJEXT = o
-PATH_SEPARATOR = :
-AIX_EXTRA_KAFS =
-AMTAR = ${SHELL} /usr/home/nectar/devel/heimdal/missing --run tar
-AS = @AS@
-AWK = gawk
-CANONICAL_HOST = i386-unknown-freebsd5.0
-CATMAN = /usr/bin/nroff -mdoc $< > $@
-CATMANEXT = $$section
-CC = gcc
-COMPILE_ET = compile_et
-CPP = gcc -E
-DBLIB =
-DEPDIR = .deps
-DIR_com_err =
-DIR_des =
-DIR_roken = roken
-DLLTOOL = @DLLTOOL@
-ECHO = echo
-EXTRA_LIB45 =
-GROFF = /usr/bin/groff
-INCLUDES_roken = -I$(top_builddir)/lib/roken -I$(top_srcdir)/lib/roken
-INCLUDE_ = @INCLUDE_@
-INCLUDE_des =
-INSTALL_STRIP_PROGRAM = ${SHELL} $(install_sh) -c -s
-LEX = flex
-
-LEXLIB = -lfl
-LEX_OUTPUT_ROOT = lex.yy
-LIBTOOL = $(SHELL) $(top_builddir)/libtool
-LIB_ = @LIB_@
-LIB_AUTH_SUBDIRS =
-LIB_NDBM =
-LIB_com_err = -lcom_err
-LIB_com_err_a =
-LIB_com_err_so =
-LIB_des = -lcrypto
-LIB_des_a = -lcrypto
-LIB_des_appl = -lcrypto
-LIB_des_so = -lcrypto
-LIB_kdb =
-LIB_otp = $(top_builddir)/lib/otp/libotp.la
-LIB_roken = $(top_builddir)/lib/vers/libvers.la $(top_builddir)/lib/roken/libroken.la $(LIB_crypt) $(LIB_dbopen)
-LIB_security =
-LN_S = ln -s
-LTLIBOBJS = copyhostent.lo ecalloc.lo emalloc.lo erealloc.lo estrdup.lo strlwr.lo strndup.lo strnlen.lo strsep_copy.lo strupr.lo
-NEED_WRITEAUTH_FALSE =
-NEED_WRITEAUTH_TRUE = #
-NROFF = /usr/bin/nroff
-OBJDUMP = @OBJDUMP@
-PACKAGE = heimdal
-RANLIB = ranlib
-STRIP = strip
-VERSION = 0.4f
-VOID_RETSIGTYPE =
-WFLAGS = -Wall -Wmissing-prototypes -Wpointer-arith -Wbad-function-cast -Wmissing-declarations -Wnested-externs
-WFLAGS_NOIMPLICITINT =
-WFLAGS_NOUNUSED =
-X_CFLAGS = -I/usr/X11R6/include
-X_EXTRA_LIBS =
-X_LIBS = -L/usr/X11R6/lib
-X_PRE_LIBS = -lSM -lICE
-YACC = bison -y
-am__include = include
-am__quote =
-dpagaix_cflags = -D_THREAD_SAFE -D_AIX_PTHREADS_D7 -D_AIX32_THREADS=1 -D_AES_SOURCE -D_AIX41 -I/usr/include/dce
-dpagaix_ldadd = -L/usr/lib/threads -ldcelibc_r -ldcepthreads -lpthreads_compat lpthreads -lc_r
-dpagaix_ldflags = -Wl,-bI:dfspag.exp
-install_sh = /usr/home/nectar/devel/heimdal/install-sh
-
-AUTOMAKE_OPTIONS = foreign no-dependencies 1.6
-
-SUFFIXES = .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-
-INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) -I../asn1 -I$(srcdir)/../asn1 $(INCLUDE_des) $(INCLUDE_openldap)
-
-ROKEN_RENAME = -DROKEN_RENAME
-
-AM_CFLAGS = $(WFLAGS)
-
-CP = cp
-
-buildinclude = $(top_builddir)/include
-
-LIB_XauReadAuth = -lXau
-LIB_crypt = -lcrypt
-LIB_dbm_firstkey =
-LIB_dbopen =
-LIB_dlopen =
-LIB_dn_expand =
-LIB_el_init = -ledit
-LIB_getattr = @LIB_getattr@
-LIB_gethostbyname =
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_getpwnam_r =
-LIB_getsockopt =
-LIB_logout = -lutil
-LIB_logwtmp = -lutil
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_openpty = -lutil
-LIB_pidfile =
-LIB_res_search =
-LIB_setpcred = @LIB_setpcred@
-LIB_setsockopt =
-LIB_socket =
-LIB_syslog =
-LIB_tgetent = -ltermcap
-
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-INCLUDE_hesiod =
-LIB_hesiod =
-
-INCLUDE_krb4 =
-LIB_krb4 =
-
-INCLUDE_openldap =
-LIB_openldap =
-
-INCLUDE_readline =
-LIB_readline = $(top_builddir)/lib/editline/libel_compat.la $(LIB_el_init) $(LIB_tgetent)
-
-NROFF_MAN = groff -mandoc -Tascii
-
-#LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-
-LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
- $(top_builddir)/lib/asn1/libasn1.la
-
-LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-
-#LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-
-BUILT_SOURCES = asn1_Key.c asn1_Event.c asn1_HDBFlags.c asn1_hdb_entry.c \
- asn1_Salt.c hdb_err.c hdb_err.h asn1_GENERATION.c
-
-
-foo = asn1_Key.x asn1_GENERATION.x asn1_Event.x asn1_HDBFlags.x asn1_hdb_entry.x asn1_Salt.x
-
-CLEANFILES = $(BUILT_SOURCES) $(foo) hdb_asn1.h asn1_files
-
-noinst_PROGRAMS = convert_db
-LDADD = libhdb.la \
- $(LIB_openldap) \
- ../krb5/libkrb5.la \
- ../asn1/libasn1.la \
- $(LIB_des) \
- $(LIB_roken)
-
-
-lib_LTLIBRARIES = libhdb.la
-libhdb_la_LDFLAGS = -version-info 7:5:0
-
-libhdb_la_SOURCES = \
- common.c \
- db.c \
- db3.c \
- hdb-ldap.c \
- hdb.c \
- keytab.c \
- mkey.c \
- ndbm.c \
- print.c \
- $(BUILT_SOURCES)
-
-
-include_HEADERS = hdb.h hdb_err.h hdb_asn1.h hdb-protos.h hdb-private.h
-
-libhdb_la_LIBADD = ../krb5/libkrb5.la ../asn1/libasn1.la ../roken/libroken.la $(LIB_openldap) $(DBLIB) $(LIB_NDBM)
-subdir = lib/hdb
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(lib_LTLIBRARIES)
-
-libhdb_la_DEPENDENCIES = ../krb5/libkrb5.la ../asn1/libasn1.la \
- ../roken/libroken.la
-am__objects_1 = asn1_Key.lo asn1_Event.lo asn1_HDBFlags.lo \
- asn1_hdb_entry.lo asn1_Salt.lo hdb_err.lo asn1_GENERATION.lo
-am_libhdb_la_OBJECTS = common.lo db.lo db3.lo hdb-ldap.lo hdb.lo \
- keytab.lo mkey.lo ndbm.lo print.lo $(am__objects_1)
-libhdb_la_OBJECTS = $(am_libhdb_la_OBJECTS)
-noinst_PROGRAMS = convert_db$(EXEEXT)
-PROGRAMS = $(noinst_PROGRAMS)
-
-convert_db_SOURCES = convert_db.c
-convert_db_OBJECTS = convert_db.$(OBJEXT)
-convert_db_LDADD = $(LDADD)
-convert_db_DEPENDENCIES = libhdb.la ../krb5/libkrb5.la \
- ../asn1/libasn1.la
-convert_db_LDFLAGS =
-
-DEFS = -DHAVE_CONFIG_H
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
-CPPFLAGS =
-LDFLAGS =
-LIBS =
-depcomp =
-am__depfiles_maybe =
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
- $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CFLAGS = -DINET6 -g -O2
-DIST_SOURCES = $(libhdb_la_SOURCES) convert_db.c
-HEADERS = $(include_HEADERS)
-
-DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in
-SOURCES = $(libhdb_la_SOURCES) convert_db.c
-
-all: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj
-$(srcdir)/Makefile.in: Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign lib/hdb/Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-libLTLIBRARIES_INSTALL = $(INSTALL)
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
- $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
- done
-
-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
-libhdb.la: $(libhdb_la_OBJECTS) $(libhdb_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libhdb_la_LDFLAGS) $(libhdb_la_OBJECTS) $(libhdb_la_LIBADD) $(LIBS)
-
-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
-convert_db$(EXEEXT): $(convert_db_OBJECTS) $(convert_db_DEPENDENCIES)
- @rm -f convert_db$(EXEEXT)
- $(LINK) $(convert_db_LDFLAGS) $(convert_db_OBJECTS) $(convert_db_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT) core *.core
-
-distclean-compile:
- -rm -f *.tab.c
-
-.c.o:
- $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
-
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.c.lo:
- $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
- -rm -f libtool
-uninstall-info-am:
-includeHEADERS_INSTALL = $(INSTALL_HEADER)
-install-includeHEADERS: $(include_HEADERS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- @list='$(include_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
- $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
- done
-
-uninstall-includeHEADERS:
- @$(NORMAL_UNINSTALL)
- @list='$(include_HEADERS)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
- rm -f $(DESTDIR)$(includedir)/$$f; \
- done
-
-ETAGS = etags
-ETAGSFLAGS =
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- mkid -fID $$unique
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
-
-distdir: $(DISTFILES)
- @list='$(DISTFILES)'; for file in $$list; 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 \
- dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
- if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="${top_distdir}" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local
-
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
-
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-clean: clean-am
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
- clean-noinstPROGRAMS mostlyclean-am
-
-distclean: distclean-am
-
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-libtool distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-data-local install-includeHEADERS
-
-install-exec-am: install-libLTLIBRARIES
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-uninstall-am: uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
-
-.PHONY: GTAGS all all-am all-local check check-am check-local clean \
- clean-generic clean-libLTLIBRARIES clean-libtool \
- clean-noinstPROGRAMS distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am info info-am install install-am install-data \
- install-data-am install-data-local install-exec install-exec-am \
- install-includeHEADERS install-info install-info-am \
- install-libLTLIBRARIES install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool tags uninstall \
- uninstall-am uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
- @foo='$(include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if ./$$i --version > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-local: install-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-$(libhdb_la_OBJECTS): $(srcdir)/hdb-protos.h $(srcdir)/hdb-private.h
-
-$(srcdir)/hdb-protos.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -o hdb-protos.h $(libhdb_la_SOURCES) || rm -f hdb-protos.h
-
-$(srcdir)/hdb-private.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -p hdb-private.h $(libhdb_la_SOURCES) || rm -f hdb-private.h
-
-$(foo) hdb_asn1.h: asn1_files
-
-asn1_files: ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1
- ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1 hdb_asn1
-
-$(libhdb_la_OBJECTS): hdb_asn1.h hdb_err.h
-
-$(convert_db_OBJECTS): hdb_asn1.h hdb_err.h
-
-# to help stupid solaris make
-
-hdb_err.h: hdb_err.et
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/crypto/heimdal/lib/hdb/Makefile.am b/crypto/heimdal/lib/hdb/Makefile.am
deleted file mode 100644
index 3bee373bcfd0b..0000000000000
--- a/crypto/heimdal/lib/hdb/Makefile.am
+++ /dev/null
@@ -1,62 +0,0 @@
-# $Id: Makefile.am,v 1.53.4.1 2003/05/12 15:20:46 joda Exp $
-
-include $(top_srcdir)/Makefile.am.common
-
-INCLUDES += -I../asn1 -I$(srcdir)/../asn1 $(INCLUDE_des)
-
-BUILT_SOURCES = asn1_Key.c asn1_Event.c asn1_HDBFlags.c asn1_hdb_entry.c \
- asn1_Salt.c hdb_err.c hdb_err.h asn1_GENERATION.c
-
-foo = asn1_Key.x asn1_GENERATION.x asn1_Event.x asn1_HDBFlags.x asn1_hdb_entry.x asn1_Salt.x
-
-CLEANFILES = $(BUILT_SOURCES) $(foo) hdb_asn1.h asn1_files
-
-noinst_PROGRAMS = convert_db
-LDADD = libhdb.la \
- $(LIB_openldap) \
- ../krb5/libkrb5.la \
- ../asn1/libasn1.la \
- $(LIB_des) \
- $(LIB_roken)
-
-lib_LTLIBRARIES = libhdb.la
-libhdb_la_LDFLAGS = -version-info 7:6:0
-
-libhdb_la_SOURCES = \
- common.c \
- db.c \
- db3.c \
- hdb-ldap.c \
- hdb.c \
- keytab.c \
- mkey.c \
- ndbm.c \
- print.c \
- $(BUILT_SOURCES)
-
-INCLUDES += $(INCLUDE_openldap)
-
-include_HEADERS = hdb.h hdb_err.h hdb_asn1.h hdb-protos.h hdb-private.h
-
-libhdb_la_LIBADD = ../krb5/libkrb5.la ../asn1/libasn1.la ../roken/libroken.la $(LIB_openldap) $(DBLIB) $(LIB_NDBM)
-
-$(libhdb_la_OBJECTS): $(srcdir)/hdb-protos.h $(srcdir)/hdb-private.h
-
-$(srcdir)/hdb-protos.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -o hdb-protos.h $(libhdb_la_SOURCES) || rm -f hdb-protos.h
-
-$(srcdir)/hdb-private.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -p hdb-private.h $(libhdb_la_SOURCES) || rm -f hdb-private.h
-
-$(foo) hdb_asn1.h: asn1_files
-
-asn1_files: ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1
- ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1 hdb_asn1
-
-$(libhdb_la_OBJECTS): hdb_asn1.h hdb_err.h
-
-$(convert_db_OBJECTS): hdb_asn1.h hdb_err.h
-
-# to help stupid solaris make
-
-hdb_err.h: hdb_err.et
diff --git a/crypto/heimdal/lib/hdb/Makefile.in b/crypto/heimdal/lib/hdb/Makefile.in
deleted file mode 100644
index bcd1d0bad7836..0000000000000
--- a/crypto/heimdal/lib/hdb/Makefile.in
+++ /dev/null
@@ -1,678 +0,0 @@
-# Makefile.in generated by automake 1.6.1 from Makefile.am.
-# @configure_input@
-
-# Copyright 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002
-# Free Software Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# $Id: Makefile.am,v 1.53.4.1 2003/05/12 15:20:46 joda Exp $
-
-# $Id: Makefile.am.common,v 1.5 2002/05/19 18:35:37 joda Exp $
-
-# $Id: Makefile.am.common,v 1.37.2.1 2003/05/08 17:08:09 joda Exp $
-SHELL = @SHELL@
-
-srcdir = @srcdir@
-top_srcdir = @top_srcdir@
-VPATH = @srcdir@
-prefix = @prefix@
-exec_prefix = @exec_prefix@
-
-bindir = @bindir@
-sbindir = @sbindir@
-libexecdir = @libexecdir@
-datadir = @datadir@
-sysconfdir = @sysconfdir@
-sharedstatedir = @sharedstatedir@
-localstatedir = @localstatedir@
-libdir = @libdir@
-infodir = @infodir@
-mandir = @mandir@
-includedir = @includedir@
-oldincludedir = /usr/include
-pkgdatadir = $(datadir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-top_builddir = ../..
-
-ACLOCAL = @ACLOCAL@
-AUTOCONF = @AUTOCONF@
-AUTOMAKE = @AUTOMAKE@
-AUTOHEADER = @AUTOHEADER@
-
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-INSTALL = @INSTALL@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_DATA = @INSTALL_DATA@
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = @program_transform_name@
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-host_alias = @host_alias@
-host_triplet = @host@
-
-EXEEXT = @EXEEXT@
-OBJEXT = @OBJEXT@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-AIX_EXTRA_KAFS = @AIX_EXTRA_KAFS@
-AMTAR = @AMTAR@
-AS = @AS@
-AWK = @AWK@
-CANONICAL_HOST = @CANONICAL_HOST@
-CATMAN = @CATMAN@
-CATMANEXT = @CATMANEXT@
-CC = @CC@
-COMPILE_ET = @COMPILE_ET@
-CPP = @CPP@
-DBLIB = @DBLIB@
-DEPDIR = @DEPDIR@
-DIR_com_err = @DIR_com_err@
-DIR_des = @DIR_des@
-DIR_roken = @DIR_roken@
-DLLTOOL = @DLLTOOL@
-ECHO = @ECHO@
-EXTRA_LIB45 = @EXTRA_LIB45@
-GROFF = @GROFF@
-INCLUDES_roken = @INCLUDES_roken@
-INCLUDE_ = @INCLUDE_@
-INCLUDE_des = @INCLUDE_des@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LEX = @LEX@
-
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBTOOL = @LIBTOOL@
-LIB_ = @LIB_@
-LIB_AUTH_SUBDIRS = @LIB_AUTH_SUBDIRS@
-LIB_NDBM = @LIB_NDBM@
-LIB_com_err = @LIB_com_err@
-LIB_com_err_a = @LIB_com_err_a@
-LIB_com_err_so = @LIB_com_err_so@
-LIB_des = @LIB_des@
-LIB_des_a = @LIB_des_a@
-LIB_des_appl = @LIB_des_appl@
-LIB_des_so = @LIB_des_so@
-LIB_kdb = @LIB_kdb@
-LIB_otp = @LIB_otp@
-LIB_roken = @LIB_roken@
-LIB_security = @LIB_security@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-MAINT = @MAINT@
-NEED_WRITEAUTH_FALSE = @NEED_WRITEAUTH_FALSE@
-NEED_WRITEAUTH_TRUE = @NEED_WRITEAUTH_TRUE@
-NROFF = @NROFF@
-OBJDUMP = @OBJDUMP@
-PACKAGE = @PACKAGE@
-RANLIB = @RANLIB@
-STRIP = @STRIP@
-VERSION = @VERSION@
-VOID_RETSIGTYPE = @VOID_RETSIGTYPE@
-WFLAGS = @WFLAGS@
-WFLAGS_NOIMPLICITINT = @WFLAGS_NOIMPLICITINT@
-WFLAGS_NOUNUSED = @WFLAGS_NOUNUSED@
-X_CFLAGS = @X_CFLAGS@
-X_EXTRA_LIBS = @X_EXTRA_LIBS@
-X_LIBS = @X_LIBS@
-X_PRE_LIBS = @X_PRE_LIBS@
-YACC = @YACC@
-am__include = @am__include@
-am__quote = @am__quote@
-dpagaix_cflags = @dpagaix_cflags@
-dpagaix_ldadd = @dpagaix_ldadd@
-dpagaix_ldflags = @dpagaix_ldflags@
-install_sh = @install_sh@
-
-AUTOMAKE_OPTIONS = foreign no-dependencies 1.6
-
-SUFFIXES = .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8
-
-INCLUDES = -I$(top_builddir)/include $(INCLUDES_roken) -I../asn1 -I$(srcdir)/../asn1 $(INCLUDE_des) $(INCLUDE_openldap)
-
-@do_roken_rename_TRUE@ROKEN_RENAME = -DROKEN_RENAME
-
-AM_CFLAGS = $(WFLAGS)
-
-CP = cp
-
-buildinclude = $(top_builddir)/include
-
-LIB_XauReadAuth = @LIB_XauReadAuth@
-LIB_crypt = @LIB_crypt@
-LIB_dbm_firstkey = @LIB_dbm_firstkey@
-LIB_dbopen = @LIB_dbopen@
-LIB_dlopen = @LIB_dlopen@
-LIB_dn_expand = @LIB_dn_expand@
-LIB_el_init = @LIB_el_init@
-LIB_getattr = @LIB_getattr@
-LIB_gethostbyname = @LIB_gethostbyname@
-LIB_getpwent_r = @LIB_getpwent_r@
-LIB_getpwnam_r = @LIB_getpwnam_r@
-LIB_getsockopt = @LIB_getsockopt@
-LIB_logout = @LIB_logout@
-LIB_logwtmp = @LIB_logwtmp@
-LIB_odm_initialize = @LIB_odm_initialize@
-LIB_openpty = @LIB_openpty@
-LIB_pidfile = @LIB_pidfile@
-LIB_res_search = @LIB_res_search@
-LIB_setpcred = @LIB_setpcred@
-LIB_setsockopt = @LIB_setsockopt@
-LIB_socket = @LIB_socket@
-LIB_syslog = @LIB_syslog@
-LIB_tgetent = @LIB_tgetent@
-
-HESIODLIB = @HESIODLIB@
-HESIODINCLUDE = @HESIODINCLUDE@
-INCLUDE_hesiod = @INCLUDE_hesiod@
-LIB_hesiod = @LIB_hesiod@
-
-INCLUDE_krb4 = @INCLUDE_krb4@
-LIB_krb4 = @LIB_krb4@
-
-INCLUDE_openldap = @INCLUDE_openldap@
-LIB_openldap = @LIB_openldap@
-
-INCLUDE_readline = @INCLUDE_readline@
-LIB_readline = @LIB_readline@
-
-NROFF_MAN = groff -mandoc -Tascii
-
-LIB_kafs = $(top_builddir)/lib/kafs/libkafs.la $(AIX_EXTRA_KAFS)
-
-@KRB5_TRUE@LIB_krb5 = $(top_builddir)/lib/krb5/libkrb5.la \
-@KRB5_TRUE@ $(top_builddir)/lib/asn1/libasn1.la
-
-@KRB5_TRUE@LIB_gssapi = $(top_builddir)/lib/gssapi/libgssapi.la
-
-@DCE_TRUE@LIB_kdfs = $(top_builddir)/lib/kdfs/libkdfs.la
-
-BUILT_SOURCES = asn1_Key.c asn1_Event.c asn1_HDBFlags.c asn1_hdb_entry.c \
- asn1_Salt.c hdb_err.c hdb_err.h asn1_GENERATION.c
-
-
-foo = asn1_Key.x asn1_GENERATION.x asn1_Event.x asn1_HDBFlags.x asn1_hdb_entry.x asn1_Salt.x
-
-CLEANFILES = $(BUILT_SOURCES) $(foo) hdb_asn1.h asn1_files
-
-noinst_PROGRAMS = convert_db
-LDADD = libhdb.la \
- $(LIB_openldap) \
- ../krb5/libkrb5.la \
- ../asn1/libasn1.la \
- $(LIB_des) \
- $(LIB_roken)
-
-
-lib_LTLIBRARIES = libhdb.la
-libhdb_la_LDFLAGS = -version-info 7:6:0
-
-libhdb_la_SOURCES = \
- common.c \
- db.c \
- db3.c \
- hdb-ldap.c \
- hdb.c \
- keytab.c \
- mkey.c \
- ndbm.c \
- print.c \
- $(BUILT_SOURCES)
-
-
-include_HEADERS = hdb.h hdb_err.h hdb_asn1.h hdb-protos.h hdb-private.h
-
-libhdb_la_LIBADD = ../krb5/libkrb5.la ../asn1/libasn1.la ../roken/libroken.la $(LIB_openldap) $(DBLIB) $(LIB_NDBM)
-subdir = lib/hdb
-mkinstalldirs = $(SHELL) $(top_srcdir)/mkinstalldirs
-CONFIG_HEADER = $(top_builddir)/include/config.h
-CONFIG_CLEAN_FILES =
-LTLIBRARIES = $(lib_LTLIBRARIES)
-
-libhdb_la_DEPENDENCIES = ../krb5/libkrb5.la ../asn1/libasn1.la \
- ../roken/libroken.la
-am__objects_5 = asn1_Key.lo asn1_Event.lo asn1_HDBFlags.lo \
- asn1_hdb_entry.lo asn1_Salt.lo hdb_err.lo asn1_GENERATION.lo
-am_libhdb_la_OBJECTS = common.lo db.lo db3.lo hdb-ldap.lo hdb.lo \
- keytab.lo mkey.lo ndbm.lo print.lo $(am__objects_5)
-libhdb_la_OBJECTS = $(am_libhdb_la_OBJECTS)
-noinst_PROGRAMS = convert_db$(EXEEXT)
-PROGRAMS = $(noinst_PROGRAMS)
-
-convert_db_SOURCES = convert_db.c
-convert_db_OBJECTS = convert_db.$(OBJEXT)
-convert_db_LDADD = $(LDADD)
-convert_db_DEPENDENCIES = libhdb.la ../krb5/libkrb5.la \
- ../asn1/libasn1.la
-convert_db_LDFLAGS =
-
-DEFS = @DEFS@
-DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)/include
-CPPFLAGS = @CPPFLAGS@
-LDFLAGS = @LDFLAGS@
-LIBS = @LIBS@
-depcomp =
-am__depfiles_maybe =
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) \
- $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(AM_LDFLAGS) $(LDFLAGS) -o $@
-CFLAGS = @CFLAGS@
-DIST_SOURCES = $(libhdb_la_SOURCES) convert_db.c
-HEADERS = $(include_HEADERS)
-
-DIST_COMMON = $(include_HEADERS) Makefile.am Makefile.in
-SOURCES = $(libhdb_la_SOURCES) convert_db.c
-
-all: $(BUILT_SOURCES)
- $(MAKE) $(AM_MAKEFLAGS) all-am
-
-.SUFFIXES:
-.SUFFIXES: .et .h .x .1 .3 .5 .8 .cat1 .cat3 .cat5 .cat8 .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ Makefile.am $(top_srcdir)/Makefile.am.common $(top_srcdir)/cf/Makefile.am.common $(top_srcdir)/configure.in $(ACLOCAL_M4)
- cd $(top_srcdir) && \
- $(AUTOMAKE) --foreign lib/hdb/Makefile
-Makefile: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.in $(top_builddir)/config.status
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)
-libLTLIBRARIES_INSTALL = $(INSTALL)
-install-libLTLIBRARIES: $(lib_LTLIBRARIES)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(libdir)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- if test -f $$p; then \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f"; \
- $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) $$p $(DESTDIR)$(libdir)/$$f; \
- else :; fi; \
- done
-
-uninstall-libLTLIBRARIES:
- @$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
- p="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p"; \
- $(LIBTOOL) --mode=uninstall rm -f $(DESTDIR)$(libdir)/$$p; \
- done
-
-clean-libLTLIBRARIES:
- -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
-libhdb.la: $(libhdb_la_OBJECTS) $(libhdb_la_DEPENDENCIES)
- $(LINK) -rpath $(libdir) $(libhdb_la_LDFLAGS) $(libhdb_la_OBJECTS) $(libhdb_la_LIBADD) $(LIBS)
-
-clean-noinstPROGRAMS:
- -test -z "$(noinst_PROGRAMS)" || rm -f $(noinst_PROGRAMS)
-convert_db$(EXEEXT): $(convert_db_OBJECTS) $(convert_db_DEPENDENCIES)
- @rm -f convert_db$(EXEEXT)
- $(LINK) $(convert_db_LDFLAGS) $(convert_db_OBJECTS) $(convert_db_LDADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT) core *.core
-
-distclean-compile:
- -rm -f *.tab.c
-
-.c.o:
- $(COMPILE) -c `test -f '$<' || echo '$(srcdir)/'`$<
-
-.c.obj:
- $(COMPILE) -c `cygpath -w $<`
-
-.c.lo:
- $(LTCOMPILE) -c -o $@ `test -f '$<' || echo '$(srcdir)/'`$<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-distclean-libtool:
- -rm -f libtool
-uninstall-info-am:
-includeHEADERS_INSTALL = $(INSTALL_HEADER)
-install-includeHEADERS: $(include_HEADERS)
- @$(NORMAL_INSTALL)
- $(mkinstalldirs) $(DESTDIR)$(includedir)
- @list='$(include_HEADERS)'; for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f"; \
- $(includeHEADERS_INSTALL) $$d$$p $(DESTDIR)$(includedir)/$$f; \
- done
-
-uninstall-includeHEADERS:
- @$(NORMAL_UNINSTALL)
- @list='$(include_HEADERS)'; for p in $$list; do \
- f="`echo $$p | sed -e 's|^.*/||'`"; \
- echo " rm -f $(DESTDIR)$(includedir)/$$f"; \
- rm -f $(DESTDIR)$(includedir)/$$f; \
- done
-
-ETAGS = etags
-ETAGSFLAGS =
-
-tags: TAGS
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- mkid -fID $$unique
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- tags=; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) ' { files[$$0] = 1; } \
- END { for (i in files) print i; }'`; \
- test -z "$(ETAGS_ARGS)$$tags$$unique" \
- || $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$tags $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && cd $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) $$here
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-
-top_distdir = ../..
-distdir = $(top_distdir)/$(PACKAGE)-$(VERSION)
-
-distdir: $(DISTFILES)
- @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 \
- dir="/$$dir"; \
- $(mkinstalldirs) "$(distdir)$$dir"; \
- else \
- dir=''; \
- fi; \
- if test -d $$d/$$file; then \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
- fi; \
- cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
- else \
- test -f $(distdir)/$$file \
- || cp -p $$d/$$file $(distdir)/$$file \
- || exit 1; \
- fi; \
- done
- $(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="${top_distdir}" distdir="$(distdir)" \
- dist-hook
-check-am: all-am
- $(MAKE) $(AM_MAKEFLAGS) check-local
-check: check-am
-all-am: Makefile $(LTLIBRARIES) $(PROGRAMS) $(HEADERS) all-local
-
-installdirs:
- $(mkinstalldirs) $(DESTDIR)$(libdir) $(DESTDIR)$(includedir)
-
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- INSTALL_STRIP_FLAG=-s \
- `test -z '$(STRIP)' || \
- echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
-mostlyclean-generic:
-
-clean-generic:
- -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
-
-distclean-generic:
- -rm -f Makefile $(CONFIG_CLEAN_FILES) stamp-h stamp-h[0-9]*
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
- -test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
-clean: clean-am
-
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
- clean-noinstPROGRAMS mostlyclean-am
-
-distclean: distclean-am
-
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-libtool distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-info: info-am
-
-info-am:
-
-install-data-am: install-includeHEADERS
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
-
-install-exec-am: install-libLTLIBRARIES
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-exec-hook
-
-install-info: install-info-am
-
-install-man:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
-
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-uninstall-am: uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
-
-.PHONY: GTAGS all all-am all-local check check-am check-local clean \
- clean-generic clean-libLTLIBRARIES clean-libtool \
- clean-noinstPROGRAMS distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am info info-am install install-am install-data \
- install-data-am install-exec install-exec-am \
- install-includeHEADERS install-info install-info-am \
- install-libLTLIBRARIES install-man install-strip installcheck \
- installcheck-am installdirs maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool tags uninstall \
- uninstall-am uninstall-includeHEADERS uninstall-info-am \
- uninstall-libLTLIBRARIES
-
-
-install-suid-programs:
- @foo='$(bin_SUIDS)'; \
- for file in $$foo; do \
- x=$(DESTDIR)$(bindir)/$$file; \
- if chown 0:0 $$x && chmod u+s $$x; then :; else \
- echo "*"; \
- echo "* Failed to install $$x setuid root"; \
- echo "*"; \
- fi; done
-
-install-exec-hook: install-suid-programs
-
-install-build-headers:: $(include_HEADERS) $(build_HEADERZ)
- @foo='$(include_HEADERS) $(nodist_include_HEADERS) $(build_HEADERZ)'; \
- for f in $$foo; do \
- f=`basename $$f`; \
- if test -f "$(srcdir)/$$f"; then file="$(srcdir)/$$f"; \
- else file="$$f"; fi; \
- if cmp -s $$file $(buildinclude)/$$f 2> /dev/null ; then \
- : ; else \
- echo " $(CP) $$file $(buildinclude)/$$f"; \
- $(CP) $$file $(buildinclude)/$$f; \
- fi ; \
- done
-
-all-local: install-build-headers
-
-check-local::
- @if test '$(CHECK_LOCAL)'; then \
- foo='$(CHECK_LOCAL)'; else \
- foo='$(PROGRAMS)'; fi; \
- if test "$$foo"; then \
- failed=0; all=0; \
- for i in $$foo; do \
- all=`expr $$all + 1`; \
- if ./$$i --version > /dev/null 2>&1; then \
- echo "PASS: $$i"; \
- else \
- echo "FAIL: $$i"; \
- failed=`expr $$failed + 1`; \
- fi; \
- done; \
- if test "$$failed" -eq 0; then \
- banner="All $$all tests passed"; \
- else \
- banner="$$failed of $$all tests failed"; \
- fi; \
- dashes=`echo "$$banner" | sed s/./=/g`; \
- echo "$$dashes"; \
- echo "$$banner"; \
- echo "$$dashes"; \
- test "$$failed" -eq 0; \
- fi
-
-.x.c:
- @cmp -s $< $@ 2> /dev/null || cp $< $@
-#NROFF_MAN = nroff -man
-.1.cat1:
- $(NROFF_MAN) $< > $@
-.3.cat3:
- $(NROFF_MAN) $< > $@
-.5.cat5:
- $(NROFF_MAN) $< > $@
-.8.cat8:
- $(NROFF_MAN) $< > $@
-
-dist-cat1-mans:
- @foo='$(man1_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.1) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat1/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat3-mans:
- @foo='$(man3_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.3) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat3/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat5-mans:
- @foo='$(man5_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.5) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat5/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-cat8-mans:
- @foo='$(man8_MANS)'; \
- bar='$(man_MANS)'; \
- for i in $$bar; do \
- case $$i in \
- *.8) foo="$$foo $$i";; \
- esac; done ;\
- for i in $$foo; do \
- x=`echo $$i | sed 's/\.[^.]*$$/.cat8/'`; \
- echo "$(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x"; \
- $(NROFF_MAN) $(srcdir)/$$i > $(distdir)/$$x; \
- done
-
-dist-hook: dist-cat1-mans dist-cat3-mans dist-cat5-mans dist-cat8-mans
-
-install-cat-mans:
- $(SHELL) $(top_srcdir)/cf/install-catman.sh "$(INSTALL_DATA)" "$(mkinstalldirs)" "$(srcdir)" "$(DESTDIR)$(mandir)" '$(CATMANEXT)' $(man_MANS) $(man1_MANS) $(man3_MANS) $(man5_MANS) $(man8_MANS)
-
-install-data-hook: install-cat-mans
-
-.et.h:
- $(COMPILE_ET) $<
-.et.c:
- $(COMPILE_ET) $<
-
-$(libhdb_la_OBJECTS): $(srcdir)/hdb-protos.h $(srcdir)/hdb-private.h
-
-$(srcdir)/hdb-protos.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -o hdb-protos.h $(libhdb_la_SOURCES) || rm -f hdb-protos.h
-
-$(srcdir)/hdb-private.h:
- cd $(srcdir); perl ../../cf/make-proto.pl -q -P comment -p hdb-private.h $(libhdb_la_SOURCES) || rm -f hdb-private.h
-
-$(foo) hdb_asn1.h: asn1_files
-
-asn1_files: ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1
- ../asn1/asn1_compile$(EXEEXT) $(srcdir)/hdb.asn1 hdb_asn1
-
-$(libhdb_la_OBJECTS): hdb_asn1.h hdb_err.h
-
-$(convert_db_OBJECTS): hdb_asn1.h hdb_err.h
-
-# to help stupid solaris make
-
-hdb_err.h: hdb_err.et
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/crypto/heimdal/lib/hdb/common.c b/crypto/heimdal/lib/hdb/common.c
deleted file mode 100644
index 6f0e73071c8d3..0000000000000
--- a/crypto/heimdal/lib/hdb/common.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/*
- * Copyright (c) 1997-2002 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 "hdb_locl.h"
-
-RCSID("$Id: common.c,v 1.12 2003/01/14 06:54:32 lha Exp $");
-
-int
-hdb_principal2key(krb5_context context, krb5_principal p, krb5_data *key)
-{
- Principal new;
- size_t len;
- int ret;
-
- ret = copy_Principal(p, &new);
- if(ret)
- return ret;
- new.name.name_type = 0;
-
- ASN1_MALLOC_ENCODE(Principal, key->data, key->length, &new, &len, ret);
- free_Principal(&new);
- return ret;
-}
-
-int
-hdb_key2principal(krb5_context context, krb5_data *key, krb5_principal p)
-{
- return decode_Principal(key->data, key->length, p, NULL);
-}
-
-int
-hdb_entry2value(krb5_context context, hdb_entry *ent, krb5_data *value)
-{
- size_t len;
- int ret;
-
- ASN1_MALLOC_ENCODE(hdb_entry, value->data, value->length, ent, &len, ret);
- return ret;
-}
-
-int
-hdb_value2entry(krb5_context context, krb5_data *value, hdb_entry *ent)
-{
- return decode_hdb_entry(value->data, value->length, ent, NULL);
-}
-
-krb5_error_code
-_hdb_fetch(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- krb5_data key, value;
- int code;
-
- hdb_principal2key(context, entry->principal, &key);
- code = db->_get(context, db, key, &value);
- krb5_data_free(&key);
- if(code)
- return code;
- code = hdb_value2entry(context, &value, entry);
- krb5_data_free(&value);
- if (code)
- return code;
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- code = hdb_unseal_keys (context, db, entry);
- if (code)
- hdb_free_entry(context, entry);
- }
- return code;
-}
-
-krb5_error_code
-_hdb_store(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- krb5_data key, value;
- int code;
-
- if(entry->generation == NULL) {
- struct timeval t;
- entry->generation = malloc(sizeof(*entry->generation));
- if(entry->generation == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- gettimeofday(&t, NULL);
- entry->generation->time = t.tv_sec;
- entry->generation->usec = t.tv_usec;
- entry->generation->gen = 0;
- } else
- entry->generation->gen++;
- hdb_principal2key(context, entry->principal, &key);
- code = hdb_seal_keys(context, db, entry);
- if (code) {
- krb5_data_free(&key);
- return code;
- }
- hdb_entry2value(context, entry, &value);
- code = db->_put(context, db, flags & HDB_F_REPLACE, key, value);
- krb5_data_free(&value);
- krb5_data_free(&key);
- return code;
-}
-
-krb5_error_code
-_hdb_remove(krb5_context context, HDB *db, hdb_entry *entry)
-{
- krb5_data key;
- int code;
-
- hdb_principal2key(context, entry->principal, &key);
- code = db->_del(context, db, key);
- krb5_data_free(&key);
- return code;
-}
-
diff --git a/crypto/heimdal/lib/hdb/convert_db.c b/crypto/heimdal/lib/hdb/convert_db.c
deleted file mode 100644
index 0b300a55fcce7..0000000000000
--- a/crypto/heimdal/lib/hdb/convert_db.c
+++ /dev/null
@@ -1,213 +0,0 @@
-/*
- * Copyright (c) 1999 - 2001 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. */
-
-/* Converts a database from version 0.0* to 0.1. This is done by
- * making three copies of each DES key (DES-CBC-CRC, DES-CBC-MD4, and
- * DES-CBC-MD5).
- *
- * Use with care.
- */
-
-#include "hdb_locl.h"
-#include <getarg.h>
-#include <err.h>
-
-RCSID("$Id: convert_db.c,v 1.12 2001/02/20 01:44:53 assar Exp $");
-
-static krb5_error_code
-update_keytypes(krb5_context context, HDB *db, hdb_entry *entry, void *data)
-{
- int i;
- int n = 0;
- Key *k;
- int save_len;
- Key *save_val;
- HDB *new = data;
- krb5_error_code ret;
-
- for(i = 0; i < entry->keys.len; i++)
- if(entry->keys.val[i].key.keytype == KEYTYPE_DES)
- n += 2;
- else if(entry->keys.val[i].key.keytype == KEYTYPE_DES3)
- n += 1;
- k = malloc(sizeof(*k) * (entry->keys.len + n));
- n = 0;
- for(i = 0; i < entry->keys.len; i++) {
- copy_Key(&entry->keys.val[i], &k[n]);
- if(entry->keys.val[i].key.keytype == KEYTYPE_DES) {
- copy_Key(&entry->keys.val[i], &k[n+1]);
- k[n+1].key.keytype = ETYPE_DES_CBC_MD4;
- copy_Key(&entry->keys.val[i], &k[n+2]);
- k[n+2].key.keytype = ETYPE_DES_CBC_MD5;
- n += 2;
- }
- else if(entry->keys.val[i].key.keytype == KEYTYPE_DES3) {
- copy_Key(&entry->keys.val[i], &k[n+1]);
- k[n+1].key.keytype = ETYPE_DES3_CBC_MD5;
- n += 1;
- }
- n++;
- }
- save_len = entry->keys.len;
- save_val = entry->keys.val;
- entry->keys.len = n;
- entry->keys.val = k;
- ret = new->store(context, new, HDB_F_REPLACE, entry);
- entry->keys.len = save_len;
- entry->keys.val = save_val;
- for(i = 0; i < n; i++)
- free_Key(&k[i]);
- free(k);
- return 0;
-}
-
-static krb5_error_code
-update_version2(krb5_context context, HDB *db, hdb_entry *entry, void *data)
-{
- HDB *new = data;
- if(!db->master_key_set) {
- int i;
- for(i = 0; i < entry->keys.len; i++) {
- free(entry->keys.val[i].mkvno);
- entry->keys.val[i].mkvno = NULL;
- }
- }
- new->store(context, new, HDB_F_REPLACE, entry);
- return 0;
-}
-
-char *old_database = HDB_DEFAULT_DB;
-char *new_database = HDB_DEFAULT_DB ".new";
-char *mkeyfile;
-int update_version;
-int help_flag;
-int version_flag;
-
-struct getargs args[] = {
- { "old-database", 0, arg_string, &old_database,
- "name of database to convert", "file" },
- { "new-database", 0, arg_string, &new_database,
- "name of converted database", "file" },
- { "master-key", 0, arg_string, &mkeyfile,
- "v5 master key file", "file" },
- { "update-version", 0, arg_flag, &update_version,
- "update the database to the current version" },
- { "help", 'h', arg_flag, &help_flag },
- { "version", 0, arg_flag, &version_flag }
-};
-
-static int num_args = sizeof(args) / sizeof(args[0]);
-
-int
-main(int argc, char **argv)
-{
- krb5_error_code ret;
- krb5_context context;
- HDB *db, *new;
- int optind = 0;
- int master_key_set = 0;
-
- setprogname(argv[0]);
-
- if(getarg(args, num_args, argc, argv, &optind))
- krb5_std_usage(1, args, num_args);
-
- if(help_flag)
- krb5_std_usage(0, args, num_args);
-
- if(version_flag){
- print_version(NULL);
- exit(0);
- }
-
- ret = krb5_init_context(&context);
- if(ret != 0)
- errx(1, "krb5_init_context failed: %d", ret);
-
- ret = hdb_create(context, &db, old_database);
- if(ret != 0)
- krb5_err(context, 1, ret, "hdb_create");
-
- ret = hdb_set_master_keyfile(context, db, mkeyfile);
- if (ret)
- krb5_err(context, 1, ret, "hdb_set_master_keyfile");
- master_key_set = 1;
- ret = hdb_create(context, &new, new_database);
- if(ret != 0)
- krb5_err(context, 1, ret, "hdb_create");
- if (master_key_set) {
- ret = hdb_set_master_keyfile(context, new, mkeyfile);
- if (ret)
- krb5_err(context, 1, ret, "hdb_set_master_keyfile");
- }
- ret = db->open(context, db, O_RDONLY, 0);
- if(ret == HDB_ERR_BADVERSION) {
- krb5_data tag;
- krb5_data version;
- int foo;
- unsigned ver;
- tag.data = HDB_DB_FORMAT_ENTRY;
- tag.length = strlen(tag.data);
- ret = (*db->_get)(context, db, tag, &version);
- if(ret)
- krb5_errx(context, 1, "database is wrong version, "
- "but couldn't find version key (%s)",
- HDB_DB_FORMAT_ENTRY);
- foo = sscanf(version.data, "%u", &ver);
- krb5_data_free (&version);
- if(foo != 1)
- krb5_errx(context, 1, "database version is not a number");
- if(ver == 1 && HDB_DB_FORMAT == 2) {
- krb5_warnx(context, "will upgrade database from version %d to %d",
- ver, HDB_DB_FORMAT);
- krb5_warnx(context, "rerun to do other conversions");
- update_version = 1;
- } else
- krb5_errx(context, 1,
- "don't know how to upgrade from version %d to %d",
- ver, HDB_DB_FORMAT);
- } else if(ret)
- krb5_err(context, 1, ret, "%s", old_database);
- ret = new->open(context, new, O_CREAT|O_EXCL|O_RDWR, 0600);
- if(ret)
- krb5_err(context, 1, ret, "%s", new_database);
- if(update_version)
- ret = hdb_foreach(context, db, 0, update_version2, new);
- else
- ret = hdb_foreach(context, db, 0, update_keytypes, new);
- if(ret != 0)
- krb5_err(context, 1, ret, "hdb_foreach");
- db->close(context, db);
- new->close(context, new);
- krb5_warnx(context, "wrote converted database to `%s'", new_database);
- return 0;
-}
diff --git a/crypto/heimdal/lib/hdb/db.c b/crypto/heimdal/lib/hdb/db.c
deleted file mode 100644
index 4dfbc66b8d758..0000000000000
--- a/crypto/heimdal/lib/hdb/db.c
+++ /dev/null
@@ -1,299 +0,0 @@
-/*
- * Copyright (c) 1997 - 2001 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 "hdb_locl.h"
-
-RCSID("$Id: db.c,v 1.30 2001/08/09 08:41:48 assar Exp $");
-
-#if HAVE_DB1
-
-#if defined(HAVE_DB_185_H)
-#include <db_185.h>
-#elif defined(HAVE_DB_H)
-#include <db.h>
-#endif
-
-static krb5_error_code
-DB_close(krb5_context context, HDB *db)
-{
- DB *d = (DB*)db->db;
- d->close(d);
- return 0;
-}
-
-static krb5_error_code
-DB_destroy(krb5_context context, HDB *db)
-{
- krb5_error_code ret;
-
- ret = hdb_clear_master_key (context, db);
- free(db->name);
- free(db);
- return ret;
-}
-
-static krb5_error_code
-DB_lock(krb5_context context, HDB *db, int operation)
-{
- DB *d = (DB*)db->db;
- int fd = (*d->fd)(d);
- if(fd < 0)
- return HDB_ERR_CANT_LOCK_DB;
- return hdb_lock(fd, operation);
-}
-
-static krb5_error_code
-DB_unlock(krb5_context context, HDB *db)
-{
- DB *d = (DB*)db->db;
- int fd = (*d->fd)(d);
- if(fd < 0)
- return HDB_ERR_CANT_LOCK_DB;
- return hdb_unlock(fd);
-}
-
-
-static krb5_error_code
-DB_seq(krb5_context context, HDB *db,
- unsigned flags, hdb_entry *entry, int flag)
-{
- DB *d = (DB*)db->db;
- DBT key, value;
- krb5_data key_data, data;
- int code;
-
- code = db->lock(context, db, HDB_RLOCK);
- if(code == -1)
- return HDB_ERR_DB_INUSE;
- code = d->seq(d, &key, &value, flag);
- db->unlock(context, db); /* XXX check value */
- if(code == -1)
- return errno;
- if(code == 1)
- return HDB_ERR_NOENTRY;
-
- key_data.data = key.data;
- key_data.length = key.size;
- data.data = value.data;
- data.length = value.size;
- if (hdb_value2entry(context, &data, entry))
- return DB_seq(context, db, flags, entry, R_NEXT);
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- code = hdb_unseal_keys (context, db, entry);
- if (code)
- hdb_free_entry (context, entry);
- }
- if (code == 0 && entry->principal == NULL) {
- entry->principal = malloc(sizeof(*entry->principal));
- if (entry->principal == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- code = ENOMEM;
- hdb_free_entry (context, entry);
- } else {
- hdb_key2principal(context, &key_data, entry->principal);
- }
- }
- return code;
-}
-
-
-static krb5_error_code
-DB_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return DB_seq(context, db, flags, entry, R_FIRST);
-}
-
-
-static krb5_error_code
-DB_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return DB_seq(context, db, flags, entry, R_NEXT);
-}
-
-static krb5_error_code
-DB_rename(krb5_context context, HDB *db, const char *new_name)
-{
- int ret;
- char *old, *new;
-
- asprintf(&old, "%s.db", db->name);
- asprintf(&new, "%s.db", new_name);
- ret = rename(old, new);
- free(old);
- free(new);
- if(ret)
- return errno;
-
- free(db->name);
- db->name = strdup(new_name);
- return 0;
-}
-
-static krb5_error_code
-DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply)
-{
- DB *d = (DB*)db->db;
- DBT k, v;
- int code;
-
- k.data = key.data;
- k.size = key.length;
- code = db->lock(context, db, HDB_RLOCK);
- if(code)
- return code;
- code = d->get(d, &k, &v, 0);
- db->unlock(context, db);
- if(code < 0)
- return errno;
- if(code == 1)
- return HDB_ERR_NOENTRY;
-
- krb5_data_copy(reply, v.data, v.size);
- return 0;
-}
-
-static krb5_error_code
-DB__put(krb5_context context, HDB *db, int replace,
- krb5_data key, krb5_data value)
-{
- DB *d = (DB*)db->db;
- DBT k, v;
- int code;
-
- k.data = key.data;
- k.size = key.length;
- v.data = value.data;
- v.size = value.length;
- code = db->lock(context, db, HDB_WLOCK);
- if(code)
- return code;
- code = d->put(d, &k, &v, replace ? 0 : R_NOOVERWRITE);
- db->unlock(context, db);
- if(code < 0)
- return errno;
- if(code == 1)
- return HDB_ERR_EXISTS;
- return 0;
-}
-
-static krb5_error_code
-DB__del(krb5_context context, HDB *db, krb5_data key)
-{
- DB *d = (DB*)db->db;
- DBT k;
- krb5_error_code code;
- k.data = key.data;
- k.size = key.length;
- code = db->lock(context, db, HDB_WLOCK);
- if(code)
- return code;
- code = d->del(d, &k, 0);
- db->unlock(context, db);
- if(code == 1)
- return HDB_ERR_NOENTRY;
- if(code < 0)
- return errno;
- return 0;
-}
-
-static krb5_error_code
-DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
-{
- char *fn;
- krb5_error_code ret;
-
- asprintf(&fn, "%s.db", db->name);
- if (fn == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- db->db = dbopen(fn, flags, mode, DB_BTREE, NULL);
- free(fn);
- /* try to open without .db extension */
- if(db->db == NULL && errno == ENOENT)
- db->db = dbopen(db->name, flags, mode, DB_BTREE, NULL);
- if(db->db == NULL) {
- ret = errno;
- krb5_set_error_string(context, "dbopen (%s): %s",
- db->name, strerror(ret));
- return ret;
- }
- if((flags & O_ACCMODE) == O_RDONLY)
- ret = hdb_check_db_format(context, db);
- else
- ret = hdb_init_db(context, db);
- if(ret == HDB_ERR_NOENTRY) {
- krb5_clear_error_string(context);
- return 0;
- }
- return ret;
-}
-
-krb5_error_code
-hdb_db_create(krb5_context context, HDB **db,
- const char *filename)
-{
- *db = malloc(sizeof(**db));
- if (*db == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- (*db)->db = NULL;
- (*db)->name = strdup(filename);
- if ((*db)->name == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- free(*db);
- *db = NULL;
- return ENOMEM;
- }
- (*db)->master_key_set = 0;
- (*db)->openp = 0;
- (*db)->open = DB_open;
- (*db)->close = DB_close;
- (*db)->fetch = _hdb_fetch;
- (*db)->store = _hdb_store;
- (*db)->remove = _hdb_remove;
- (*db)->firstkey = DB_firstkey;
- (*db)->nextkey= DB_nextkey;
- (*db)->lock = DB_lock;
- (*db)->unlock = DB_unlock;
- (*db)->rename = DB_rename;
- (*db)->_get = DB__get;
- (*db)->_put = DB__put;
- (*db)->_del = DB__del;
- (*db)->destroy = DB_destroy;
- return 0;
-}
-
-#endif /* HAVE_DB1 */
diff --git a/crypto/heimdal/lib/hdb/db3.c b/crypto/heimdal/lib/hdb/db3.c
deleted file mode 100644
index 92525fc28993d..0000000000000
--- a/crypto/heimdal/lib/hdb/db3.c
+++ /dev/null
@@ -1,328 +0,0 @@
-/*
- * Copyright (c) 1997 - 2001 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 "hdb_locl.h"
-
-RCSID("$Id: db3.c,v 1.8 2001/08/09 08:41:48 assar Exp $");
-
-#if HAVE_DB3
-
-#include <db.h>
-
-static krb5_error_code
-DB_close(krb5_context context, HDB *db)
-{
- DB *d = (DB*)db->db;
- DBC *dbcp = (DBC*)db->dbc;
-
- dbcp->c_close(dbcp);
- db->dbc = 0;
- d->close(d, 0);
- return 0;
-}
-
-static krb5_error_code
-DB_destroy(krb5_context context, HDB *db)
-{
- krb5_error_code ret;
-
- ret = hdb_clear_master_key (context, db);
- free(db->name);
- free(db);
- return ret;
-}
-
-static krb5_error_code
-DB_lock(krb5_context context, HDB *db, int operation)
-{
- DB *d = (DB*)db->db;
- int fd;
- if ((*d->fd)(d, &fd))
- return HDB_ERR_CANT_LOCK_DB;
- return hdb_lock(fd, operation);
-}
-
-static krb5_error_code
-DB_unlock(krb5_context context, HDB *db)
-{
- DB *d = (DB*)db->db;
- int fd;
- if ((*d->fd)(d, &fd))
- return HDB_ERR_CANT_LOCK_DB;
- return hdb_unlock(fd);
-}
-
-
-static krb5_error_code
-DB_seq(krb5_context context, HDB *db,
- unsigned flags, hdb_entry *entry, int flag)
-{
- DB *d = (DB*)db->db;
- DBT key, value;
- DBC *dbcp = db->dbc;
- krb5_data key_data, data;
- int code;
-
- memset(&key, 0, sizeof(DBT));
- memset(&value, 0, sizeof(DBT));
- if (db->lock(context, db, HDB_RLOCK))
- return HDB_ERR_DB_INUSE;
- code = dbcp->c_get(dbcp, &key, &value, flag);
- db->unlock(context, db); /* XXX check value */
- if (code == DB_NOTFOUND)
- return HDB_ERR_NOENTRY;
- if (code)
- return code;
-
- key_data.data = key.data;
- key_data.length = key.size;
- data.data = value.data;
- data.length = value.size;
- if (hdb_value2entry(context, &data, entry))
- return DB_seq(context, db, flags, entry, DB_NEXT);
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- code = hdb_unseal_keys (context, db, entry);
- if (code)
- hdb_free_entry (context, entry);
- }
- if (entry->principal == NULL) {
- entry->principal = malloc(sizeof(*entry->principal));
- if (entry->principal == NULL) {
- hdb_free_entry (context, entry);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- } else {
- hdb_key2principal(context, &key_data, entry->principal);
- }
- }
- return 0;
-}
-
-
-static krb5_error_code
-DB_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return DB_seq(context, db, flags, entry, DB_FIRST);
-}
-
-
-static krb5_error_code
-DB_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return DB_seq(context, db, flags, entry, DB_NEXT);
-}
-
-static krb5_error_code
-DB_rename(krb5_context context, HDB *db, const char *new_name)
-{
- int ret;
- char *old, *new;
-
- asprintf(&old, "%s.db", db->name);
- asprintf(&new, "%s.db", new_name);
- ret = rename(old, new);
- free(old);
- free(new);
- if(ret)
- return errno;
-
- free(db->name);
- db->name = strdup(new_name);
- return 0;
-}
-
-static krb5_error_code
-DB__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply)
-{
- DB *d = (DB*)db->db;
- DBT k, v;
- int code;
-
- memset(&k, 0, sizeof(DBT));
- memset(&v, 0, sizeof(DBT));
- k.data = key.data;
- k.size = key.length;
- k.flags = 0;
- if ((code = db->lock(context, db, HDB_RLOCK)))
- return code;
- code = d->get(d, NULL, &k, &v, 0);
- db->unlock(context, db);
- if(code == DB_NOTFOUND)
- return HDB_ERR_NOENTRY;
- if(code)
- return code;
-
- krb5_data_copy(reply, v.data, v.size);
- return 0;
-}
-
-static krb5_error_code
-DB__put(krb5_context context, HDB *db, int replace,
- krb5_data key, krb5_data value)
-{
- DB *d = (DB*)db->db;
- DBT k, v;
- int code;
-
- memset(&k, 0, sizeof(DBT));
- memset(&v, 0, sizeof(DBT));
- k.data = key.data;
- k.size = key.length;
- k.flags = 0;
- v.data = value.data;
- v.size = value.length;
- v.flags = 0;
- if ((code = db->lock(context, db, HDB_WLOCK)))
- return code;
- code = d->put(d, NULL, &k, &v, replace ? 0 : DB_NOOVERWRITE);
- db->unlock(context, db);
- if(code == DB_KEYEXIST)
- return HDB_ERR_EXISTS;
- if(code)
- return errno;
- return 0;
-}
-
-static krb5_error_code
-DB__del(krb5_context context, HDB *db, krb5_data key)
-{
- DB *d = (DB*)db->db;
- DBT k;
- krb5_error_code code;
- memset(&k, 0, sizeof(DBT));
- k.data = key.data;
- k.size = key.length;
- k.flags = 0;
- code = db->lock(context, db, HDB_WLOCK);
- if(code)
- return code;
- code = d->del(d, NULL, &k, 0);
- db->unlock(context, db);
- if(code == DB_NOTFOUND)
- return HDB_ERR_NOENTRY;
- if(code)
- return code;
- return 0;
-}
-
-static krb5_error_code
-DB_open(krb5_context context, HDB *db, int flags, mode_t mode)
-{
- char *fn;
- krb5_error_code ret;
- DB *d;
- int myflags = 0;
-
- if (flags & O_CREAT)
- myflags |= DB_CREATE;
-
- if (flags & O_EXCL)
- myflags |= DB_EXCL;
-
- if (flags & O_RDONLY)
- myflags |= DB_RDONLY;
-
- if (flags & O_TRUNC)
- myflags |= DB_TRUNCATE;
-
- asprintf(&fn, "%s.db", db->name);
- if (fn == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- db_create(&d, NULL, 0);
- db->db = d;
- if ((ret = d->open(db->db, fn, NULL, DB_BTREE, myflags, mode))) {
- if(ret == ENOENT)
- /* try to open without .db extension */
- if (d->open(db->db, db->name, NULL, DB_BTREE, myflags, mode)) {
- free(fn);
- krb5_set_error_string(context, "opening %s: %s",
- db->name, strerror(ret));
- return ret;
- }
- }
- free(fn);
-
- ret = d->cursor(d, NULL, (DBC **)&db->dbc, 0);
- if (ret) {
- krb5_set_error_string(context, "d->cursor: %s", strerror(ret));
- return ret;
- }
-
- if((flags & O_ACCMODE) == O_RDONLY)
- ret = hdb_check_db_format(context, db);
- else
- ret = hdb_init_db(context, db);
- if(ret == HDB_ERR_NOENTRY)
- return 0;
- return ret;
-}
-
-krb5_error_code
-hdb_db_create(krb5_context context, HDB **db,
- const char *filename)
-{
- *db = malloc(sizeof(**db));
- if (*db == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- (*db)->db = NULL;
- (*db)->name = strdup(filename);
- if ((*db)->name == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- free(*db);
- *db = NULL;
- return ENOMEM;
- }
- (*db)->master_key_set = 0;
- (*db)->openp = 0;
- (*db)->open = DB_open;
- (*db)->close = DB_close;
- (*db)->fetch = _hdb_fetch;
- (*db)->store = _hdb_store;
- (*db)->remove = _hdb_remove;
- (*db)->firstkey = DB_firstkey;
- (*db)->nextkey= DB_nextkey;
- (*db)->lock = DB_lock;
- (*db)->unlock = DB_unlock;
- (*db)->rename = DB_rename;
- (*db)->_get = DB__get;
- (*db)->_put = DB__put;
- (*db)->_del = DB__del;
- (*db)->destroy = DB_destroy;
- return 0;
-}
-#endif /* HAVE_DB3 */
diff --git a/crypto/heimdal/lib/hdb/hdb-ldap.c b/crypto/heimdal/lib/hdb/hdb-ldap.c
deleted file mode 100644
index 8e90798b36140..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb-ldap.c
+++ /dev/null
@@ -1,1303 +0,0 @@
-/*
- * Copyright (c) 1999-2001, PADL Software Pty Ltd.
- * 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 PADL Software 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 PADL SOFTWARE 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 PADL SOFTWARE 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 "hdb_locl.h"
-
-RCSID("$Id: hdb-ldap.c,v 1.10 2002/09/04 18:42:22 joda Exp $");
-
-#ifdef OPENLDAP
-
-#include <lber.h>
-#include <ldap.h>
-#include <ctype.h>
-#include <sys/un.h>
-
-static krb5_error_code LDAP__connect(krb5_context context, HDB * db);
-
-static krb5_error_code
-LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
- hdb_entry * ent);
-
-static char *krb5kdcentry_attrs[] =
- { "krb5PrincipalName", "cn", "krb5PrincipalRealm",
- "krb5KeyVersionNumber", "krb5Key",
- "krb5ValidStart", "krb5ValidEnd", "krb5PasswordEnd",
- "krb5MaxLife", "krb5MaxRenew", "krb5KDCFlags", "krb5EncryptionType",
- "modifiersName", "modifyTimestamp", "creatorsName", "createTimestamp",
- NULL
-};
-
-static char *krb5principal_attrs[] =
- { "krb5PrincipalName", "cn", "krb5PrincipalRealm",
- "modifiersName", "modifyTimestamp", "creatorsName", "createTimestamp",
- NULL
-};
-
-/* based on samba: source/passdb/ldap.c */
-static krb5_error_code
-LDAP_addmod_len(LDAPMod *** modlist, int modop, const char *attribute,
- unsigned char *value, size_t len)
-{
- LDAPMod **mods = *modlist;
- int i, j;
-
- if (mods == NULL) {
- mods = (LDAPMod **) calloc(1, sizeof(LDAPMod *));
- if (mods == NULL) {
- return ENOMEM;
- }
- mods[0] = NULL;
- }
-
- for (i = 0; mods[i] != NULL; ++i) {
- if ((mods[i]->mod_op & (~LDAP_MOD_BVALUES)) == modop
- && (!strcasecmp(mods[i]->mod_type, attribute))) {
- break;
- }
- }
-
- if (mods[i] == NULL) {
- mods = (LDAPMod **) realloc(mods, (i + 2) * sizeof(LDAPMod *));
- if (mods == NULL) {
- return ENOMEM;
- }
- mods[i] = (LDAPMod *) malloc(sizeof(LDAPMod));
- if (mods[i] == NULL) {
- return ENOMEM;
- }
- mods[i]->mod_op = modop | LDAP_MOD_BVALUES;
- mods[i]->mod_bvalues = NULL;
- mods[i]->mod_type = strdup(attribute);
- if (mods[i]->mod_type == NULL) {
- return ENOMEM;
- }
- mods[i + 1] = NULL;
- }
-
- if (value != NULL) {
- j = 0;
- if (mods[i]->mod_bvalues != NULL) {
- for (; mods[i]->mod_bvalues[j] != NULL; j++);
- }
- mods[i]->mod_bvalues =
- (struct berval **) realloc(mods[i]->mod_bvalues,
- (j + 2) * sizeof(struct berval *));
- if (mods[i]->mod_bvalues == NULL) {
- return ENOMEM;
- }
- /* Caller allocates memory on our behalf, unlike LDAP_addmod. */
- mods[i]->mod_bvalues[j] =
- (struct berval *) malloc(sizeof(struct berval));
- if (mods[i]->mod_bvalues[j] == NULL) {
- return ENOMEM;
- }
- mods[i]->mod_bvalues[j]->bv_val = value;
- mods[i]->mod_bvalues[j]->bv_len = len;
- mods[i]->mod_bvalues[j + 1] = NULL;
- }
- *modlist = mods;
- return 0;
-}
-
-static krb5_error_code
-LDAP_addmod(LDAPMod *** modlist, int modop, const char *attribute,
- const char *value)
-{
- LDAPMod **mods = *modlist;
- int i, j;
-
- if (mods == NULL) {
- mods = (LDAPMod **) calloc(1, sizeof(LDAPMod *));
- if (mods == NULL) {
- return ENOMEM;
- }
- mods[0] = NULL;
- }
-
- for (i = 0; mods[i] != NULL; ++i) {
- if (mods[i]->mod_op == modop
- && (!strcasecmp(mods[i]->mod_type, attribute))) {
- break;
- }
- }
-
- if (mods[i] == NULL) {
- mods = (LDAPMod **) realloc(mods, (i + 2) * sizeof(LDAPMod *));
- if (mods == NULL) {
- return ENOMEM;
- }
- mods[i] = (LDAPMod *) malloc(sizeof(LDAPMod));
- if (mods[i] == NULL) {
- return ENOMEM;
- }
- mods[i]->mod_op = modop;
- mods[i]->mod_values = NULL;
- mods[i]->mod_type = strdup(attribute);
- if (mods[i]->mod_type == NULL) {
- return ENOMEM;
- }
- mods[i + 1] = NULL;
- }
-
- if (value != NULL) {
- j = 0;
- if (mods[i]->mod_values != NULL) {
- for (; mods[i]->mod_values[j] != NULL; j++);
- }
- mods[i]->mod_values = (char **) realloc(mods[i]->mod_values,
- (j + 2) * sizeof(char *));
- if (mods[i]->mod_values == NULL) {
- return ENOMEM;
- }
- mods[i]->mod_values[j] = strdup(value);
- if (mods[i]->mod_values[j] == NULL) {
- return ENOMEM;
- }
- mods[i]->mod_values[j + 1] = NULL;
- }
- *modlist = mods;
- return 0;
-}
-
-static krb5_error_code
-LDAP_addmod_generalized_time(LDAPMod *** mods, int modop,
- const char *attribute, KerberosTime * time)
-{
- char buf[22];
- struct tm *tm;
-
- /* XXX not threadsafe */
- tm = gmtime(time);
- strftime(buf, sizeof(buf), "%Y%m%d%H%M%SZ", tm);
-
- return LDAP_addmod(mods, modop, attribute, buf);
-}
-
-static krb5_error_code
-LDAP_get_string_value(HDB * db, LDAPMessage * entry,
- const char *attribute, char **ptr)
-{
- char **vals;
- int ret;
-
- vals = ldap_get_values((LDAP *) db->db, entry, (char *) attribute);
- if (vals == NULL) {
- return HDB_ERR_NOENTRY;
- }
- *ptr = strdup(vals[0]);
- if (*ptr == NULL) {
- ret = ENOMEM;
- } else {
- ret = 0;
- }
-
- ldap_value_free(vals);
-
- return ret;
-}
-
-static krb5_error_code
-LDAP_get_integer_value(HDB * db, LDAPMessage * entry,
- const char *attribute, int *ptr)
-{
- char **vals;
-
- vals = ldap_get_values((LDAP *) db->db, entry, (char *) attribute);
- if (vals == NULL) {
- return HDB_ERR_NOENTRY;
- }
- *ptr = atoi(vals[0]);
- ldap_value_free(vals);
- return 0;
-}
-
-static krb5_error_code
-LDAP_get_generalized_time_value(HDB * db, LDAPMessage * entry,
- const char *attribute, KerberosTime * kt)
-{
- char *tmp, *gentime;
- struct tm tm;
- int ret;
-
- *kt = 0;
-
- ret = LDAP_get_string_value(db, entry, attribute, &gentime);
- if (ret != 0) {
- return ret;
- }
-
- tmp = strptime(gentime, "%Y%m%d%H%M%SZ", &tm);
- if (tmp == NULL) {
- free(gentime);
- return HDB_ERR_NOENTRY;
- }
-
- free(gentime);
-
- *kt = timegm(&tm);
-
- return 0;
-}
-
-static krb5_error_code
-LDAP_entry2mods(krb5_context context, HDB * db, hdb_entry * ent,
- LDAPMessage * msg, LDAPMod *** pmods)
-{
- krb5_error_code ret;
- krb5_boolean is_new_entry;
- int rc, i;
- char *tmp = NULL;
- LDAPMod **mods = NULL;
- hdb_entry orig;
- unsigned long oflags, nflags;
-
- if (msg != NULL) {
- ret = LDAP_message2entry(context, db, msg, &orig);
- if (ret != 0) {
- goto out;
- }
- is_new_entry = FALSE;
- } else {
- /* to make it perfectly obvious we're depending on
- * orig being intiialized to zero */
- memset(&orig, 0, sizeof(orig));
- is_new_entry = TRUE;
- }
-
- if (is_new_entry) {
- ret = LDAP_addmod(&mods, LDAP_MOD_ADD, "objectClass", "top");
- if (ret != 0) {
- goto out;
- }
- /* person is the structural object class */
- ret = LDAP_addmod(&mods, LDAP_MOD_ADD, "objectClass", "person");
- if (ret != 0) {
- goto out;
- }
- ret =
- LDAP_addmod(&mods, LDAP_MOD_ADD, "objectClass",
- "krb5Principal");
- if (ret != 0) {
- goto out;
- }
- ret = LDAP_addmod(&mods, LDAP_MOD_ADD, "objectClass",
- "krb5KDCEntry");
- if (ret != 0) {
- goto out;
- }
- }
-
- if (is_new_entry ||
- krb5_principal_compare(context, ent->principal, orig.principal) ==
- FALSE) {
- ret = krb5_unparse_name(context, ent->principal, &tmp);
- if (ret != 0) {
- goto out;
- }
- ret =
- LDAP_addmod(&mods, LDAP_MOD_REPLACE, "krb5PrincipalName", tmp);
- if (ret != 0) {
- free(tmp);
- goto out;
- }
- free(tmp);
- }
-
- if (ent->kvno != orig.kvno) {
- rc = asprintf(&tmp, "%d", ent->kvno);
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_addmod(&mods, LDAP_MOD_REPLACE, "krb5KeyVersionNumber",
- tmp);
- free(tmp);
- if (ret != 0) {
- goto out;
- }
- }
-
- if (ent->valid_start) {
- if (orig.valid_end == NULL
- || (*(ent->valid_start) != *(orig.valid_start))) {
- ret =
- LDAP_addmod_generalized_time(&mods, LDAP_MOD_REPLACE,
- "krb5ValidStart",
- ent->valid_start);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- if (ent->valid_end) {
- if (orig.valid_end == NULL
- || (*(ent->valid_end) != *(orig.valid_end))) {
- ret =
- LDAP_addmod_generalized_time(&mods, LDAP_MOD_REPLACE,
- "krb5ValidEnd",
- ent->valid_end);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- if (ent->pw_end) {
- if (orig.pw_end == NULL || (*(ent->pw_end) != *(orig.pw_end))) {
- ret =
- LDAP_addmod_generalized_time(&mods, LDAP_MOD_REPLACE,
- "krb5PasswordEnd",
- ent->pw_end);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- if (ent->max_life) {
- if (orig.max_life == NULL
- || (*(ent->max_life) != *(orig.max_life))) {
- rc = asprintf(&tmp, "%d", *(ent->max_life));
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret = LDAP_addmod(&mods, LDAP_MOD_REPLACE, "krb5MaxLife", tmp);
- free(tmp);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- if (ent->max_renew) {
- if (orig.max_renew == NULL
- || (*(ent->max_renew) != *(orig.max_renew))) {
- rc = asprintf(&tmp, "%d", *(ent->max_renew));
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_addmod(&mods, LDAP_MOD_REPLACE, "krb5MaxRenew", tmp);
- free(tmp);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- memset(&oflags, 0, sizeof(oflags));
- memcpy(&oflags, &orig.flags, sizeof(HDBFlags));
- memset(&nflags, 0, sizeof(nflags));
- memcpy(&nflags, &ent->flags, sizeof(HDBFlags));
-
- if (memcmp(&oflags, &nflags, sizeof(HDBFlags))) {
- rc = asprintf(&tmp, "%lu", nflags);
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret = LDAP_addmod(&mods, LDAP_MOD_REPLACE, "krb5KDCFlags", tmp);
- free(tmp);
- if (ret != 0) {
- goto out;
- }
- }
-
- if (is_new_entry == FALSE && orig.keys.len > 0) {
- /* for the moment, clobber and replace keys. */
- ret = LDAP_addmod(&mods, LDAP_MOD_DELETE, "krb5Key", NULL);
- if (ret != 0) {
- goto out;
- }
- }
-
- for (i = 0; i < ent->keys.len; i++) {
- unsigned char *buf;
- size_t len;
-
- ASN1_MALLOC_ENCODE(Key, buf, len, &ent->keys.val[i], &len, ret);
- if (ret != 0)
- goto out;
-
- /* addmod_len _owns_ the key, doesn't need to copy it */
- ret = LDAP_addmod_len(&mods, LDAP_MOD_ADD, "krb5Key", buf, len);
- if (ret != 0) {
- goto out;
- }
- }
-
- if (ent->etypes) {
- /* clobber and replace encryption types. */
- if (is_new_entry == FALSE) {
- ret =
- LDAP_addmod(&mods, LDAP_MOD_DELETE, "krb5EncryptionType",
- NULL);
- }
- for (i = 0; i < ent->etypes->len; i++) {
- rc = asprintf(&tmp, "%d", ent->etypes->val[i]);
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- free(tmp);
- ret =
- LDAP_addmod(&mods, LDAP_MOD_ADD, "krb5EncryptionType",
- tmp);
- if (ret != 0) {
- goto out;
- }
- }
- }
-
- /* for clarity */
- ret = 0;
-
- out:
-
- if (ret == 0) {
- *pmods = mods;
- } else if (mods != NULL) {
- ldap_mods_free(mods, 1);
- *pmods = NULL;
- }
-
- if (msg != NULL) {
- hdb_free_entry(context, &orig);
- }
-
- return ret;
-}
-
-static krb5_error_code
-LDAP_dn2principal(krb5_context context, HDB * db, const char *dn,
- krb5_principal * principal)
-{
- krb5_error_code ret;
- int rc, limit = 1;
- char **values;
- LDAPMessage *res = NULL, *e;
-
- rc = ldap_set_option((LDAP *) db->db, LDAP_OPT_SIZELIMIT, (const void *)&limit);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_set_option: %s", ldap_err2string(rc));
- ret = HDB_ERR_BADVERSION;
- goto out;
- }
-
- rc = ldap_search_s((LDAP *) db->db, dn, LDAP_SCOPE_BASE,
- "(objectclass=krb5Principal)", krb5principal_attrs,
- 0, &res);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_search_s: %s", ldap_err2string(rc));
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- e = ldap_first_entry((LDAP *) db->db, res);
- if (e == NULL) {
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- values = ldap_get_values((LDAP *) db->db, e, "krb5PrincipalName");
- if (values == NULL) {
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- ret = krb5_parse_name(context, values[0], principal);
- ldap_value_free(values);
-
- out:
- if (res != NULL) {
- ldap_msgfree(res);
- }
- return ret;
-}
-
-static krb5_error_code
-LDAP__lookup_princ(krb5_context context, HDB * db, const char *princname,
- LDAPMessage ** msg)
-{
- krb5_error_code ret;
- int rc, limit = 1;
- char *filter = NULL;
-
- (void) LDAP__connect(context, db);
-
- rc =
- asprintf(&filter,
- "(&(objectclass=krb5KDCEntry)(krb5PrincipalName=%s))",
- princname);
- if (rc < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
-
- rc = ldap_set_option((LDAP *) db->db, LDAP_OPT_SIZELIMIT, (const void *)&limit);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_set_option: %s", ldap_err2string(rc));
- ret = HDB_ERR_BADVERSION;
- goto out;
- }
-
- rc = ldap_search_s((LDAP *) db->db, db->name, LDAP_SCOPE_ONELEVEL, filter,
- krb5kdcentry_attrs, 0, msg);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_search_s: %s", ldap_err2string(rc));
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- ret = 0;
-
- out:
- if (filter != NULL) {
- free(filter);
- }
- return ret;
-}
-
-static krb5_error_code
-LDAP_principal2message(krb5_context context, HDB * db,
- krb5_principal princ, LDAPMessage ** msg)
-{
- char *princname = NULL;
- krb5_error_code ret;
-
- ret = krb5_unparse_name(context, princ, &princname);
- if (ret != 0) {
- return ret;
- }
-
- ret = LDAP__lookup_princ(context, db, princname, msg);
- free(princname);
-
- return ret;
-}
-
-/*
- * Construct an hdb_entry from a directory entry.
- */
-static krb5_error_code
-LDAP_message2entry(krb5_context context, HDB * db, LDAPMessage * msg,
- hdb_entry * ent)
-{
- char *unparsed_name = NULL, *dn = NULL;
- int ret;
- unsigned long tmp;
- struct berval **keys;
- char **values;
-
- memset(ent, 0, sizeof(*ent));
- memset(&ent->flags, 0, sizeof(HDBFlags));
-
- ret =
- LDAP_get_string_value(db, msg, "krb5PrincipalName",
- &unparsed_name);
- if (ret != 0) {
- return ret;
- }
-
- ret = krb5_parse_name(context, unparsed_name, &ent->principal);
- if (ret != 0) {
- goto out;
- }
-
- ret =
- LDAP_get_integer_value(db, msg, "krb5KeyVersionNumber",
- &ent->kvno);
- if (ret != 0) {
- ent->kvno = 0;
- }
-
- keys = ldap_get_values_len((LDAP *) db->db, msg, "krb5Key");
- if (keys != NULL) {
- int i;
- size_t l;
-
- ent->keys.len = ldap_count_values_len(keys);
- ent->keys.val = (Key *) calloc(ent->keys.len, sizeof(Key));
- if (ent->keys.val == NULL) {
- krb5_set_error_string(context, "calloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- for (i = 0; i < ent->keys.len; i++) {
- decode_Key((unsigned char *) keys[i]->bv_val,
- (size_t) keys[i]->bv_len, &ent->keys.val[i], &l);
- }
- ber_bvecfree(keys);
- } else {
-#if 1
- /*
- * This violates the ASN1 but it allows a principal to
- * be related to a general directory entry without creating
- * the keys. Hopefully it's OK.
- */
- ent->keys.len = 0;
- ent->keys.val = NULL;
-#else
- ret = HDB_ERR_NOENTRY;
- goto out;
-#endif
- }
-
- ret =
- LDAP_get_generalized_time_value(db, msg, "createTimestamp",
- &ent->created_by.time);
- if (ret != 0) {
- ent->created_by.time = time(NULL);
- }
-
- ent->created_by.principal = NULL;
-
- ret = LDAP_get_string_value(db, msg, "creatorsName", &dn);
- if (ret == 0) {
- if (LDAP_dn2principal(context, db, dn, &ent->created_by.principal)
- != 0) {
- ent->created_by.principal = NULL;
- }
- free(dn);
- }
-
- ent->modified_by = (Event *) malloc(sizeof(Event));
- if (ent->modified_by == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_get_generalized_time_value(db, msg, "modifyTimestamp",
- &ent->modified_by->time);
- if (ret == 0) {
- ret = LDAP_get_string_value(db, msg, "modifiersName", &dn);
- if (LDAP_dn2principal
- (context, db, dn, &ent->modified_by->principal) != 0) {
- ent->modified_by->principal = NULL;
- }
- free(dn);
- } else {
- free(ent->modified_by);
- ent->modified_by = NULL;
- }
-
- if ((ent->valid_start = (KerberosTime *) malloc(sizeof(KerberosTime)))
- == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_get_generalized_time_value(db, msg, "krb5ValidStart",
- ent->valid_start);
- if (ret != 0) {
- /* OPTIONAL */
- free(ent->valid_start);
- ent->valid_start = NULL;
- }
-
- if ((ent->valid_end = (KerberosTime *) malloc(sizeof(KerberosTime))) ==
- NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_get_generalized_time_value(db, msg, "krb5ValidEnd",
- ent->valid_end);
- if (ret != 0) {
- /* OPTIONAL */
- free(ent->valid_end);
- ent->valid_end = NULL;
- }
-
- if ((ent->pw_end = (KerberosTime *) malloc(sizeof(KerberosTime))) ==
- NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret =
- LDAP_get_generalized_time_value(db, msg, "krb5PasswordEnd",
- ent->pw_end);
- if (ret != 0) {
- /* OPTIONAL */
- free(ent->pw_end);
- ent->pw_end = NULL;
- }
-
- ent->max_life = (int *) malloc(sizeof(int));
- if (ent->max_life == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret = LDAP_get_integer_value(db, msg, "krb5MaxLife", ent->max_life);
- if (ret != 0) {
- free(ent->max_life);
- ent->max_life = NULL;
- }
-
- ent->max_renew = (int *) malloc(sizeof(int));
- if (ent->max_renew == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ret = LDAP_get_integer_value(db, msg, "krb5MaxRenew", ent->max_renew);
- if (ret != 0) {
- free(ent->max_renew);
- ent->max_renew = NULL;
- }
-
- values = ldap_get_values((LDAP *) db->db, msg, "krb5KDCFlags");
- if (values != NULL) {
- tmp = strtoul(values[0], (char **) NULL, 10);
- if (tmp == ULONG_MAX && errno == ERANGE) {
- krb5_set_error_string(context, "strtoul: could not convert flag");
- ret = ERANGE;
- goto out;
- }
- } else {
- tmp = 0;
- }
- memcpy(&ent->flags, &tmp, sizeof(HDBFlags));
-
- values = ldap_get_values((LDAP *) db->db, msg, "krb5EncryptionType");
- if (values != NULL) {
- int i;
-
- ent->etypes = malloc(sizeof(*(ent->etypes)));
- if (ent->etypes == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- ret = ENOMEM;
- goto out;
- }
- ent->etypes->len = ldap_count_values(values);
- ent->etypes->val = calloc(ent->etypes->len, sizeof(int));
- for (i = 0; i < ent->etypes->len; i++) {
- ent->etypes->val[i] = atoi(values[i]);
- }
- ldap_value_free(values);
- }
-
- ret = 0;
-
- out:
- if (unparsed_name != NULL) {
- free(unparsed_name);
- }
-
- if (ret != 0) {
- /* I don't think this frees ent itself. */
- hdb_free_entry(context, ent);
- }
-
- return ret;
-}
-
-static krb5_error_code LDAP_close(krb5_context context, HDB * db)
-{
- ldap_unbind_ext((LDAP *) db->db, NULL, NULL);
- db->db = NULL;
-
- return 0;
-}
-
-static krb5_error_code
-LDAP_lock(krb5_context context, HDB * db, int operation)
-{
- return 0;
-}
-
-static krb5_error_code LDAP_unlock(krb5_context context, HDB * db)
-{
- return 0;
-}
-
-static krb5_error_code
-LDAP_seq(krb5_context context, HDB * db, unsigned flags, hdb_entry * entry)
-{
- int msgid, rc, parserc;
- krb5_error_code ret;
- LDAPMessage *e;
-
- msgid = db->openp; /* BOGUS OVERLOADING */
- if (msgid < 0) {
- return HDB_ERR_NOENTRY;
- }
-
- do {
- rc = ldap_result((LDAP *) db->db, msgid, LDAP_MSG_ONE, NULL, &e);
- switch (rc) {
- case LDAP_RES_SEARCH_ENTRY:
- /* We have an entry. Parse it. */
- ret = LDAP_message2entry(context, db, e, entry);
- ldap_msgfree(e);
- break;
- case LDAP_RES_SEARCH_RESULT:
- /* We're probably at the end of the results. If not, abandon. */
- parserc =
- ldap_parse_result((LDAP *) db->db, e, NULL, NULL, NULL,
- NULL, NULL, 1);
- if (parserc != LDAP_SUCCESS
- && parserc != LDAP_MORE_RESULTS_TO_RETURN) {
- krb5_set_error_string(context, "ldap_parse_result: %s", ldap_err2string(parserc));
- ldap_abandon((LDAP *) db->db, msgid);
- }
- ret = HDB_ERR_NOENTRY;
- db->openp = -1;
- break;
- case 0:
- case -1:
- default:
- /* Some unspecified error (timeout?). Abandon. */
- ldap_msgfree(e);
- ldap_abandon((LDAP *) db->db, msgid);
- ret = HDB_ERR_NOENTRY;
- db->openp = -1;
- break;
- }
- } while (rc == LDAP_RES_SEARCH_REFERENCE);
-
- if (ret == 0) {
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- ret = hdb_unseal_keys(context, db, entry);
- if (ret)
- hdb_free_entry(context,entry);
- }
- }
-
- return ret;
-}
-
-static krb5_error_code
-LDAP_firstkey(krb5_context context, HDB * db, unsigned flags,
- hdb_entry * entry)
-{
- int msgid, limit = LDAP_NO_LIMIT, rc;
-
- (void) LDAP__connect(context, db);
-
- rc = ldap_set_option((LDAP *) db->db, LDAP_OPT_SIZELIMIT, (const void *)&limit);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_set_option: %s", ldap_err2string(rc));
- return HDB_ERR_BADVERSION;
- }
-
- msgid = ldap_search((LDAP *) db->db, db->name,
- LDAP_SCOPE_ONELEVEL, "(objectclass=krb5KDCEntry)",
- krb5kdcentry_attrs, 0);
- if (msgid < 0) {
- return HDB_ERR_NOENTRY;
- }
-
- db->openp = msgid;
-
- return LDAP_seq(context, db, flags, entry);
-}
-
-static krb5_error_code
-LDAP_nextkey(krb5_context context, HDB * db, unsigned flags,
- hdb_entry * entry)
-{
- return LDAP_seq(context, db, flags, entry);
-}
-
-static krb5_error_code
-LDAP_rename(krb5_context context, HDB * db, const char *new_name)
-{
- return HDB_ERR_DB_INUSE;
-}
-
-static krb5_error_code LDAP__connect(krb5_context context, HDB * db)
-{
- int rc, version = LDAP_VERSION3;
-
- if (db->db != NULL) {
- /* connection has been opened. ping server. */
- struct sockaddr_un addr;
- socklen_t len;
- int sd;
-
- if (ldap_get_option((LDAP *) db->db, LDAP_OPT_DESC, &sd) == 0 &&
- getpeername(sd, (struct sockaddr *) &addr, &len) < 0) {
- /* the other end has died. reopen. */
- LDAP_close(context, db);
- }
- }
-
- if (db->db != NULL) {
- /* server is UP */
- return 0;
- }
-
- rc = ldap_initialize((LDAP **) & db->db, "ldapi:///");
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_initialize: %s", ldap_err2string(rc));
- return HDB_ERR_NOENTRY;
- }
-
- rc = ldap_set_option((LDAP *) db->db, LDAP_OPT_PROTOCOL_VERSION, (const void *)&version);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_set_option: %s", ldap_err2string(rc));
- ldap_unbind_ext((LDAP *) db->db, NULL, NULL);
- db->db = NULL;
- return HDB_ERR_BADVERSION;
- }
-
- return 0;
-}
-
-static krb5_error_code
-LDAP_open(krb5_context context, HDB * db, int flags, mode_t mode)
-{
- /* Not the right place for this. */
-#ifdef HAVE_SIGACTION
- struct sigaction sa;
-
- sa.sa_flags = 0;
- sa.sa_handler = SIG_IGN;
- sigemptyset(&sa.sa_mask);
-
- sigaction(SIGPIPE, &sa, NULL);
-#else
- signal(SIGPIPE, SIG_IGN);
-#endif /* HAVE_SIGACTION */
-
- return LDAP__connect(context, db);
-}
-
-static krb5_error_code
-LDAP_fetch(krb5_context context, HDB * db, unsigned flags,
- hdb_entry * entry)
-{
- LDAPMessage *msg, *e;
- krb5_error_code ret;
-
- ret = LDAP_principal2message(context, db, entry->principal, &msg);
- if (ret != 0) {
- return ret;
- }
-
- e = ldap_first_entry((LDAP *) db->db, msg);
- if (e == NULL) {
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- ret = LDAP_message2entry(context, db, e, entry);
- if (ret == 0) {
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- ret = hdb_unseal_keys(context, db, entry);
- if (ret)
- hdb_free_entry(context,entry);
- }
- }
-
- out:
- ldap_msgfree(msg);
-
- return ret;
-}
-
-static krb5_error_code
-LDAP_store(krb5_context context, HDB * db, unsigned flags,
- hdb_entry * entry)
-{
- LDAPMod **mods = NULL;
- krb5_error_code ret;
- const char *errfn;
- int rc;
- LDAPMessage *msg = NULL, *e = NULL;
- char *dn = NULL, *name = NULL;
-
- ret = krb5_unparse_name(context, entry->principal, &name);
- if (ret != 0) {
- goto out;
- }
-
- ret = LDAP__lookup_princ(context, db, name, &msg);
- if (ret == 0) {
- e = ldap_first_entry((LDAP *) db->db, msg);
- }
-
- ret = hdb_seal_keys(context, db, entry);
- if (ret != 0) {
- goto out;
- }
-
- /* turn new entry into LDAPMod array */
- ret = LDAP_entry2mods(context, db, entry, e, &mods);
- if (ret != 0) {
- goto out;
- }
-
- if (e == NULL) {
- /* Doesn't exist yet. */
- char *p;
-
- e = NULL;
-
- /* normalize the naming attribute */
- for (p = name; *p != '\0'; p++) {
- *p = (char) tolower((int) *p);
- }
-
- /*
- * We could do getpwnam() on the local component of
- * the principal to find cn/sn but that's probably
- * bad thing to do from inside a KDC. Better leave
- * it to management tools.
- */
- ret = LDAP_addmod(&mods, LDAP_MOD_ADD, "cn", name);
- if (ret < 0) {
- goto out;
- }
-
- ret = LDAP_addmod(&mods, LDAP_MOD_ADD, "sn", name);
- if (ret < 0) {
- goto out;
- }
-
- if (db->name != NULL) {
- ret = asprintf(&dn, "cn=%s,%s", name, db->name);
- } else {
- /* A bit bogus, but we don't have a search base */
- ret = asprintf(&dn, "cn=%s", name, db->name);
- }
- if (ret < 0) {
- krb5_set_error_string(context, "asprintf: out of memory");
- ret = ENOMEM;
- goto out;
- }
- } else if (flags & HDB_F_REPLACE) {
- /* Entry exists, and we're allowed to replace it. */
- dn = ldap_get_dn((LDAP *) db->db, e);
- } else {
- /* Entry exists, but we're not allowed to replace it. Bail. */
- ret = HDB_ERR_EXISTS;
- goto out;
- }
-
- /* write entry into directory */
- if (e == NULL) {
- /* didn't exist before */
- rc = ldap_add_s((LDAP *) db->db, dn, mods);
- errfn = "ldap_add_s";
- } else {
- /* already existed, send deltas only */
- rc = ldap_modify_s((LDAP *) db->db, dn, mods);
- errfn = "ldap_modify_s";
- }
-
- if (rc == LDAP_SUCCESS) {
- ret = 0;
- } else {
- krb5_set_error_string(context, "%s: %s", errfn, ldap_err2string(rc));
- ret = HDB_ERR_CANT_LOCK_DB;
- }
-
- out:
- /* free stuff */
- if (dn != NULL) {
- free(dn);
- }
-
- if (msg != NULL) {
- ldap_msgfree(msg);
- }
-
- if (mods != NULL) {
- ldap_mods_free(mods, 1);
- }
-
- if (name != NULL) {
- free(name);
- }
-
- return ret;
-}
-
-static krb5_error_code
-LDAP_remove(krb5_context context, HDB * db, hdb_entry * entry)
-{
- krb5_error_code ret;
- LDAPMessage *msg, *e;
- char *dn = NULL;
- int rc, limit = LDAP_NO_LIMIT;
-
- ret = LDAP_principal2message(context, db, entry->principal, &msg);
- if (ret != 0) {
- goto out;
- }
-
- e = ldap_first_entry((LDAP *) db->db, msg);
- if (e == NULL) {
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- dn = ldap_get_dn((LDAP *) db->db, e);
- if (dn == NULL) {
- ret = HDB_ERR_NOENTRY;
- goto out;
- }
-
- rc = ldap_set_option((LDAP *) db->db, LDAP_OPT_SIZELIMIT, (const void *)&limit);
- if (rc != LDAP_SUCCESS) {
- krb5_set_error_string(context, "ldap_set_option: %s", ldap_err2string(rc));
- ret = HDB_ERR_BADVERSION;
- goto out;
- }
-
- rc = ldap_delete_s((LDAP *) db->db, dn);
- if (rc == LDAP_SUCCESS) {
- ret = 0;
- } else {
- krb5_set_error_string(context, "ldap_delete_s: %s", ldap_err2string(rc));
- ret = HDB_ERR_CANT_LOCK_DB;
- }
-
- out:
- if (dn != NULL) {
- free(dn);
- }
-
- if (msg != NULL) {
- ldap_msgfree(msg);
- }
-
- return ret;
-}
-
-static krb5_error_code
-LDAP__get(krb5_context context, HDB * db, krb5_data key, krb5_data * reply)
-{
- fprintf(stderr, "LDAP__get not implemented\n");
- abort();
- return 0;
-}
-
-static krb5_error_code
-LDAP__put(krb5_context context, HDB * db, int replace,
- krb5_data key, krb5_data value)
-{
- fprintf(stderr, "LDAP__put not implemented\n");
- abort();
- return 0;
-}
-
-static krb5_error_code
-LDAP__del(krb5_context context, HDB * db, krb5_data key)
-{
- fprintf(stderr, "LDAP__del not implemented\n");
- abort();
- return 0;
-}
-
-static krb5_error_code LDAP_destroy(krb5_context context, HDB * db)
-{
- krb5_error_code ret;
-
- ret = hdb_clear_master_key(context, db);
- if (db->name != NULL) {
- free(db->name);
- }
- free(db);
-
- return ret;
-}
-
-krb5_error_code
-hdb_ldap_create(krb5_context context, HDB ** db, const char *arg)
-{
- *db = malloc(sizeof(**db));
- if (*db == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- (*db)->db = NULL;
-
- if (arg == NULL || arg[0] == '\0') {
- /*
- * if no argument specified in the configuration file
- * then use NULL, which tells OpenLDAP to look in
- * the ldap.conf file. This doesn't work for
- * writing entries because we don't know where to
- * put new principals.
- */
- (*db)->name = NULL;
- } else {
- (*db)->name = strdup(arg);
- if ((*db)->name == NULL) {
- krb5_set_error_string(context, "strdup: out of memory");
- free(*db);
- *db = NULL;
- return ENOMEM;
- }
- }
-
- (*db)->master_key_set = 0;
- (*db)->openp = 0;
- (*db)->open = LDAP_open;
- (*db)->close = LDAP_close;
- (*db)->fetch = LDAP_fetch;
- (*db)->store = LDAP_store;
- (*db)->remove = LDAP_remove;
- (*db)->firstkey = LDAP_firstkey;
- (*db)->nextkey = LDAP_nextkey;
- (*db)->lock = LDAP_lock;
- (*db)->unlock = LDAP_unlock;
- (*db)->rename = LDAP_rename;
- /* can we ditch these? */
- (*db)->_get = LDAP__get;
- (*db)->_put = LDAP__put;
- (*db)->_del = LDAP__del;
- (*db)->destroy = LDAP_destroy;
-
- return 0;
-}
-
-#endif /* OPENLDAP */
diff --git a/crypto/heimdal/lib/hdb/hdb-private.h b/crypto/heimdal/lib/hdb/hdb-private.h
deleted file mode 100644
index a47de70210640..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb-private.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/* This is a generated file */
-#ifndef __hdb_private_h__
-#define __hdb_private_h__
-
-#include <stdarg.h>
-
-krb5_error_code
-_hdb_fetch (
- krb5_context /*context*/,
- HDB */*db*/,
- unsigned /*flags*/,
- hdb_entry */*entry*/);
-
-krb5_error_code
-_hdb_remove (
- krb5_context /*context*/,
- HDB */*db*/,
- hdb_entry */*entry*/);
-
-krb5_error_code
-_hdb_store (
- krb5_context /*context*/,
- HDB */*db*/,
- unsigned /*flags*/,
- hdb_entry */*entry*/);
-
-#endif /* __hdb_private_h__ */
diff --git a/crypto/heimdal/lib/hdb/hdb-protos.h b/crypto/heimdal/lib/hdb/hdb-protos.h
deleted file mode 100644
index ce85fcb056423..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb-protos.h
+++ /dev/null
@@ -1,188 +0,0 @@
-/* This is a generated file */
-#ifndef __hdb_protos_h__
-#define __hdb_protos_h__
-
-#include <stdarg.h>
-
-krb5_error_code
-hdb_add_master_key (
- krb5_context /*context*/,
- krb5_keyblock */*key*/,
- hdb_master_key */*inout*/);
-
-krb5_error_code
-hdb_check_db_format (
- krb5_context /*context*/,
- HDB */*db*/);
-
-krb5_error_code
-hdb_clear_master_key (
- krb5_context /*context*/,
- HDB */*db*/);
-
-krb5_error_code
-hdb_create (
- krb5_context /*context*/,
- HDB **/*db*/,
- const char */*filename*/);
-
-krb5_error_code
-hdb_db_create (
- krb5_context /*context*/,
- HDB **/*db*/,
- const char */*filename*/);
-
-krb5_error_code
-hdb_enctype2key (
- krb5_context /*context*/,
- hdb_entry */*e*/,
- krb5_enctype /*enctype*/,
- Key **/*key*/);
-
-krb5_error_code
-hdb_entry2string (
- krb5_context /*context*/,
- hdb_entry */*ent*/,
- char **/*str*/);
-
-int
-hdb_entry2value (
- krb5_context /*context*/,
- hdb_entry */*ent*/,
- krb5_data */*value*/);
-
-krb5_error_code
-hdb_foreach (
- krb5_context /*context*/,
- HDB */*db*/,
- unsigned /*flags*/,
- hdb_foreach_func_t /*func*/,
- void */*data*/);
-
-void
-hdb_free_entry (
- krb5_context /*context*/,
- hdb_entry */*ent*/);
-
-void
-hdb_free_key (Key */*key*/);
-
-void
-hdb_free_master_key (
- krb5_context /*context*/,
- hdb_master_key /*mkey*/);
-
-krb5_error_code
-hdb_init_db (
- krb5_context /*context*/,
- HDB */*db*/);
-
-int
-hdb_key2principal (
- krb5_context /*context*/,
- krb5_data */*key*/,
- krb5_principal /*p*/);
-
-krb5_error_code
-hdb_ldap_create (
- krb5_context /*context*/,
- HDB ** /*db*/,
- const char */*arg*/);
-
-krb5_error_code
-hdb_lock (
- int /*fd*/,
- int /*operation*/);
-
-krb5_error_code
-hdb_ndbm_create (
- krb5_context /*context*/,
- HDB **/*db*/,
- const char */*filename*/);
-
-krb5_error_code
-hdb_next_enctype2key (
- krb5_context /*context*/,
- const hdb_entry */*e*/,
- krb5_enctype /*enctype*/,
- Key **/*key*/);
-
-int
-hdb_principal2key (
- krb5_context /*context*/,
- krb5_principal /*p*/,
- krb5_data */*key*/);
-
-krb5_error_code
-hdb_print_entry (
- krb5_context /*context*/,
- HDB */*db*/,
- hdb_entry */*entry*/,
- void */*data*/);
-
-krb5_error_code
-hdb_process_master_key (
- krb5_context /*context*/,
- int /*kvno*/,
- krb5_keyblock */*key*/,
- krb5_enctype /*etype*/,
- hdb_master_key */*mkey*/);
-
-krb5_error_code
-hdb_read_master_key (
- krb5_context /*context*/,
- const char */*filename*/,
- hdb_master_key */*mkey*/);
-
-krb5_error_code
-hdb_seal_keys (
- krb5_context /*context*/,
- HDB */*db*/,
- hdb_entry */*ent*/);
-
-krb5_error_code
-hdb_seal_keys_mkey (
- krb5_context /*context*/,
- hdb_entry */*ent*/,
- hdb_master_key /*mkey*/);
-
-krb5_error_code
-hdb_set_master_key (
- krb5_context /*context*/,
- HDB */*db*/,
- krb5_keyblock */*key*/);
-
-krb5_error_code
-hdb_set_master_keyfile (
- krb5_context /*context*/,
- HDB */*db*/,
- const char */*keyfile*/);
-
-krb5_error_code
-hdb_unlock (int /*fd*/);
-
-krb5_error_code
-hdb_unseal_keys (
- krb5_context /*context*/,
- HDB */*db*/,
- hdb_entry */*ent*/);
-
-krb5_error_code
-hdb_unseal_keys_mkey (
- krb5_context /*context*/,
- hdb_entry */*ent*/,
- hdb_master_key /*mkey*/);
-
-int
-hdb_value2entry (
- krb5_context /*context*/,
- krb5_data */*value*/,
- hdb_entry */*ent*/);
-
-krb5_error_code
-hdb_write_master_key (
- krb5_context /*context*/,
- const char */*filename*/,
- hdb_master_key /*mkey*/);
-
-#endif /* __hdb_protos_h__ */
diff --git a/crypto/heimdal/lib/hdb/hdb.asn1 b/crypto/heimdal/lib/hdb/hdb.asn1
deleted file mode 100644
index 084d5a1bb2c50..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb.asn1
+++ /dev/null
@@ -1,70 +0,0 @@
--- $Id: hdb.asn1,v 1.9 2001/06/21 14:54:53 joda Exp $
-HDB DEFINITIONS ::=
-BEGIN
-
-IMPORTS EncryptionKey, KerberosTime, Principal FROM krb5;
-
-HDB_DB_FORMAT INTEGER ::= 2 -- format of database,
- -- update when making changes
-
--- these must have the same value as the pa-* counterparts
-hdb-pw-salt INTEGER ::= 3
-hdb-afs3-salt INTEGER ::= 10
-
-Salt ::= SEQUENCE {
- type[0] INTEGER,
- salt[1] OCTET STRING
-}
-
-Key ::= SEQUENCE {
- mkvno[0] INTEGER OPTIONAL, -- master key version number
- key[1] EncryptionKey,
- salt[2] Salt OPTIONAL
-}
-
-Event ::= SEQUENCE {
- time[0] KerberosTime,
- principal[1] Principal OPTIONAL
-}
-
-HDBFlags ::= BIT STRING {
- initial(0), -- require as-req
- forwardable(1), -- may issue forwardable
- proxiable(2), -- may issue proxiable
- renewable(3), -- may issue renewable
- postdate(4), -- may issue postdatable
- server(5), -- may be server
- client(6), -- may be client
- invalid(7), -- entry is invalid
- require-preauth(8), -- must use preauth
- change-pw(9), -- change password service
- require-hwauth(10), -- must use hwauth
- ok-as-delegate(11), -- as in TicketFlags
- user-to-user(12), -- may use user-to-user auth
- immutable(13) -- may not be deleted
-}
-
-GENERATION ::= SEQUENCE {
- time[0] KerberosTime, -- timestamp
- usec[1] INTEGER, -- microseconds
- gen[2] INTEGER -- generation number
-}
-
-hdb_entry ::= SEQUENCE {
- principal[0] Principal OPTIONAL, -- this is optional only
- -- for compatibility with libkrb5
- kvno[1] INTEGER,
- keys[2] SEQUENCE OF Key,
- created-by[3] Event,
- modified-by[4] Event OPTIONAL,
- valid-start[5] KerberosTime OPTIONAL,
- valid-end[6] KerberosTime OPTIONAL,
- pw-end[7] KerberosTime OPTIONAL,
- max-life[8] INTEGER OPTIONAL,
- max-renew[9] INTEGER OPTIONAL,
- flags[10] HDBFlags,
- etypes[11] SEQUENCE OF INTEGER OPTIONAL,
- generation[12] GENERATION OPTIONAL
-}
-
-END
diff --git a/crypto/heimdal/lib/hdb/hdb.c b/crypto/heimdal/lib/hdb/hdb.c
deleted file mode 100644
index 95fde19db70b0..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/*
- * Copyright (c) 1997 - 2001 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 "hdb_locl.h"
-
-RCSID("$Id: hdb.c,v 1.44 2001/08/09 08:41:48 assar Exp $");
-
-struct hdb_method {
- const char *prefix;
- krb5_error_code (*create)(krb5_context, HDB **, const char *filename);
-};
-
-static struct hdb_method methods[] = {
-#if HAVE_DB1 || HAVE_DB3
- {"db:", hdb_db_create},
-#endif
-#if HAVE_NDBM
- {"ndbm:", hdb_ndbm_create},
-#endif
-#ifdef OPENLDAP
- {"ldap:", hdb_ldap_create},
-#endif
-#if HAVE_DB1 || HAVE_DB3
- {"", hdb_db_create},
-#elif defined(HAVE_NDBM)
- {"", hdb_ndbm_create},
-#elif defined(OPENLDAP)
- {"", hdb_ldap_create},
-#endif
- {NULL, NULL}
-};
-
-krb5_error_code
-hdb_next_enctype2key(krb5_context context,
- const hdb_entry *e,
- krb5_enctype enctype,
- Key **key)
-{
- Key *k;
-
- for (k = *key ? (*key) + 1 : e->keys.val;
- k < e->keys.val + e->keys.len;
- k++)
- if(k->key.keytype == enctype){
- *key = k;
- return 0;
- }
- return KRB5_PROG_ETYPE_NOSUPP; /* XXX */
-}
-
-krb5_error_code
-hdb_enctype2key(krb5_context context,
- hdb_entry *e,
- krb5_enctype enctype,
- Key **key)
-{
- *key = NULL;
- return hdb_next_enctype2key(context, e, enctype, key);
-}
-
-void
-hdb_free_key(Key *key)
-{
- memset(key->key.keyvalue.data,
- 0,
- key->key.keyvalue.length);
- free_Key(key);
- free(key);
-}
-
-
-krb5_error_code
-hdb_lock(int fd, int operation)
-{
- int i, code = 0;
-
- for(i = 0; i < 3; i++){
- code = flock(fd, (operation == HDB_RLOCK ? LOCK_SH : LOCK_EX) | LOCK_NB);
- if(code == 0 || errno != EWOULDBLOCK)
- break;
- sleep(1);
- }
- if(code == 0)
- return 0;
- if(errno == EWOULDBLOCK)
- return HDB_ERR_DB_INUSE;
- return HDB_ERR_CANT_LOCK_DB;
-}
-
-krb5_error_code
-hdb_unlock(int fd)
-{
- int code;
- code = flock(fd, LOCK_UN);
- if(code)
- return 4711 /* XXX */;
- return 0;
-}
-
-void
-hdb_free_entry(krb5_context context, hdb_entry *ent)
-{
- int i;
-
- for(i = 0; i < ent->keys.len; ++i) {
- Key *k = &ent->keys.val[i];
-
- memset (k->key.keyvalue.data, 0, k->key.keyvalue.length);
- }
- free_hdb_entry(ent);
-}
-
-krb5_error_code
-hdb_foreach(krb5_context context,
- HDB *db,
- unsigned flags,
- hdb_foreach_func_t func,
- void *data)
-{
- krb5_error_code ret;
- hdb_entry entry;
- ret = db->firstkey(context, db, flags, &entry);
- while(ret == 0){
- ret = (*func)(context, db, &entry, data);
- hdb_free_entry(context, &entry);
- if(ret == 0)
- ret = db->nextkey(context, db, flags, &entry);
- }
- if(ret == HDB_ERR_NOENTRY)
- ret = 0;
- return ret;
-}
-
-krb5_error_code
-hdb_check_db_format(krb5_context context, HDB *db)
-{
- krb5_data tag;
- krb5_data version;
- krb5_error_code ret;
- unsigned ver;
- int foo;
-
- tag.data = HDB_DB_FORMAT_ENTRY;
- tag.length = strlen(tag.data);
- ret = (*db->_get)(context, db, tag, &version);
- if(ret)
- return ret;
- foo = sscanf(version.data, "%u", &ver);
- krb5_data_free (&version);
- if (foo != 1)
- return HDB_ERR_BADVERSION;
- if(ver != HDB_DB_FORMAT)
- return HDB_ERR_BADVERSION;
- return 0;
-}
-
-krb5_error_code
-hdb_init_db(krb5_context context, HDB *db)
-{
- krb5_error_code ret;
- krb5_data tag;
- krb5_data version;
- char ver[32];
-
- ret = hdb_check_db_format(context, db);
- if(ret != HDB_ERR_NOENTRY)
- return ret;
-
- tag.data = HDB_DB_FORMAT_ENTRY;
- tag.length = strlen(tag.data);
- snprintf(ver, sizeof(ver), "%u", HDB_DB_FORMAT);
- version.data = ver;
- version.length = strlen(version.data) + 1; /* zero terminated */
- ret = (*db->_put)(context, db, 0, tag, version);
- return ret;
-}
-
-/*
- * find the relevant method for `filename', returning a pointer to the
- * rest in `rest'.
- * return NULL if there's no such method.
- */
-
-static const struct hdb_method *
-find_method (const char *filename, const char **rest)
-{
- const struct hdb_method *h;
-
- for (h = methods; h->prefix != NULL; ++h)
- if (strncmp (filename, h->prefix, strlen(h->prefix)) == 0) {
- *rest = filename + strlen(h->prefix);
- return h;
- }
- return NULL;
-}
-
-krb5_error_code
-hdb_create(krb5_context context, HDB **db, const char *filename)
-{
- const struct hdb_method *h;
- const char *residual;
-
- if(filename == NULL)
- filename = HDB_DEFAULT_DB;
- krb5_add_et_list(context, initialize_hdb_error_table_r);
- h = find_method (filename, &residual);
- if (h == NULL)
- krb5_errx(context, 1, "No database support! (hdb_create)");
- return (*h->create)(context, db, residual);
-}
diff --git a/crypto/heimdal/lib/hdb/hdb.h b/crypto/heimdal/lib/hdb/hdb.h
deleted file mode 100644
index 21d739b98b86d..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/*
- * Copyright (c) 1997 - 2000 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id: hdb.h,v 1.31 2000/07/08 16:03:37 joda Exp $ */
-
-#ifndef __HDB_H__
-#define __HDB_H__
-
-#include <hdb_err.h>
-
-#include <hdb_asn1.h>
-
-enum hdb_lockop{ HDB_RLOCK, HDB_WLOCK };
-
-/* flags for various functions */
-#define HDB_F_DECRYPT 1 /* decrypt keys */
-#define HDB_F_REPLACE 2 /* replace entry */
-
-/* key usage for master key */
-#define HDB_KU_MKEY 0x484442
-
-typedef struct hdb_master_key_data *hdb_master_key;
-
-typedef struct HDB{
- void *db;
- void *dbc;
- char *name;
- int master_key_set;
- hdb_master_key master_key;
- int openp;
-
- krb5_error_code (*open)(krb5_context, struct HDB*, int, mode_t);
- krb5_error_code (*close)(krb5_context, struct HDB*);
- krb5_error_code (*fetch)(krb5_context, struct HDB*, unsigned, hdb_entry*);
- krb5_error_code (*store)(krb5_context, struct HDB*, unsigned, hdb_entry*);
- krb5_error_code (*remove)(krb5_context, struct HDB*, hdb_entry*);
- krb5_error_code (*firstkey)(krb5_context, struct HDB*,
- unsigned, hdb_entry*);
- krb5_error_code (*nextkey)(krb5_context, struct HDB*,
- unsigned, hdb_entry*);
- krb5_error_code (*lock)(krb5_context, struct HDB*, int operation);
- krb5_error_code (*unlock)(krb5_context, struct HDB*);
- krb5_error_code (*rename)(krb5_context, struct HDB*, const char*);
- krb5_error_code (*_get)(krb5_context, struct HDB*, krb5_data, krb5_data*);
- krb5_error_code (*_put)(krb5_context, struct HDB*, int,
- krb5_data, krb5_data);
- krb5_error_code (*_del)(krb5_context, struct HDB*, krb5_data);
- krb5_error_code (*destroy)(krb5_context, struct HDB*);
-}HDB;
-
-#define HDB_DB_DIR "/var/heimdal"
-#define HDB_DEFAULT_DB HDB_DB_DIR "/heimdal"
-#define HDB_DB_FORMAT_ENTRY "hdb/db-format"
-
-typedef krb5_error_code (*hdb_foreach_func_t)(krb5_context, HDB*,
- hdb_entry*, void*);
-extern krb5_kt_ops hdb_kt_ops;
-
-#include <hdb-protos.h>
-
-#endif /* __HDB_H__ */
diff --git a/crypto/heimdal/lib/hdb/hdb_err.et b/crypto/heimdal/lib/hdb/hdb_err.et
deleted file mode 100644
index 9929a56311e56..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb_err.et
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Error messages for the hdb library
-#
-# This might look like a com_err file, but is not
-#
-id "$Id: hdb_err.et,v 1.5 2001/01/28 23:05:52 assar Exp $"
-
-error_table hdb
-
-prefix HDB_ERR
-
-index 1
-#error_code INUSE, "Entry already exists in database"
-error_code UK_SERROR, "Database store error"
-error_code UK_RERROR, "Database read error"
-error_code NOENTRY, "No such entry in the database"
-error_code DB_INUSE, "Database is locked or in use--try again later"
-error_code DB_CHANGED, "Database was modified during read"
-error_code RECURSIVELOCK, "Attempt to lock database twice"
-error_code NOTLOCKED, "Attempt to unlock database when not locked"
-error_code BADLOCKMODE, "Invalid kdb lock mode"
-error_code CANT_LOCK_DB, "Insufficient access to lock database"
-error_code EXISTS, "Entry already exists in database"
-error_code BADVERSION, "Wrong database version"
-error_code NO_MKEY, "No correct master key"
-
-end
diff --git a/crypto/heimdal/lib/hdb/hdb_locl.h b/crypto/heimdal/lib/hdb/hdb_locl.h
deleted file mode 100644
index 95c706040085d..0000000000000
--- a/crypto/heimdal/lib/hdb/hdb_locl.h
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright (c) 1997-2001 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id: hdb_locl.h,v 1.18 2002/09/10 20:03:48 joda Exp $ */
-
-#ifndef __HDB_LOCL_H__
-#define __HDB_LOCL_H__
-
-#include <config.h>
-
-#include <stdio.h>
-#include <string.h>
-#include <stdlib.h>
-#include <errno.h>
-#ifdef HAVE_SYS_TYPES_H
-#include <sys/types.h>
-#endif
-#ifdef HAVE_UNISTD_H
-#include <unistd.h>
-#endif
-#ifdef HAVE_FCNTL_H
-#include <fcntl.h>
-#endif
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-#include <roken.h>
-
-#include "crypto-headers.h"
-#include <krb5.h>
-#include <hdb.h>
-#include <hdb-private.h>
-
-#endif /* __HDB_LOCL_H__ */
diff --git a/crypto/heimdal/lib/hdb/keytab.c b/crypto/heimdal/lib/hdb/keytab.c
deleted file mode 100644
index 6ede2b9c1f007..0000000000000
--- a/crypto/heimdal/lib/hdb/keytab.c
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * Copyright (c) 1999 - 2002 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 "hdb_locl.h"
-
-/* keytab backend for HDB databases */
-
-RCSID("$Id: keytab.c,v 1.5 2002/08/26 13:28:11 assar Exp $");
-
-struct hdb_data {
- char *dbname;
- char *mkey;
-};
-
-/*
- * the format for HDB keytabs is:
- * HDB:[database:mkey]
- */
-
-static krb5_error_code
-hdb_resolve(krb5_context context, const char *name, krb5_keytab id)
-{
- struct hdb_data *d;
- const char *db, *mkey;
-
- d = malloc(sizeof(*d));
- if(d == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- db = name;
- mkey = strchr(name, ':');
- if(mkey == NULL || mkey[1] == '\0') {
- if(*name == '\0')
- d->dbname = NULL;
- else {
- d->dbname = strdup(name);
- if(d->dbname == NULL) {
- free(d);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- }
- d->mkey = NULL;
- } else {
- if((mkey - db) == 0) {
- d->dbname = NULL;
- } else {
- d->dbname = malloc(mkey - db);
- if(d->dbname == NULL) {
- free(d);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- memmove(d->dbname, db, mkey - db);
- d->dbname[mkey - db] = '\0';
- }
- d->mkey = strdup(mkey + 1);
- if(d->mkey == NULL) {
- free(d->dbname);
- free(d);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- }
- id->data = d;
- return 0;
-}
-
-static krb5_error_code
-hdb_close(krb5_context context, krb5_keytab id)
-{
- struct hdb_data *d = id->data;
-
- free(d->dbname);
- free(d->mkey);
- free(d);
- return 0;
-}
-
-static krb5_error_code
-hdb_get_name(krb5_context context,
- krb5_keytab id,
- char *name,
- size_t namesize)
-{
- struct hdb_data *d = id->data;
-
- snprintf(name, namesize, "%s%s%s",
- d->dbname ? d->dbname : "",
- (d->dbname || d->mkey) ? ":" : "",
- d->mkey ? d->mkey : "");
- return 0;
-}
-
-static void
-set_config (krb5_context context,
- krb5_config_binding *binding,
- const char **dbname,
- const char **mkey)
-{
- *dbname = krb5_config_get_string(context, binding, "dbname", NULL);
- *mkey = krb5_config_get_string(context, binding, "mkey_file", NULL);
-}
-
-/*
- * try to figure out the database (`dbname') and master-key (`mkey')
- * that should be used for `principal'.
- */
-
-static void
-find_db (krb5_context context,
- const char **dbname,
- const char **mkey,
- krb5_const_principal principal)
-{
- const krb5_config_binding *top_bind = NULL;
- krb5_config_binding *default_binding = NULL;
- krb5_config_binding *db;
- krb5_realm *prealm = krb5_princ_realm(context, (krb5_principal)principal);
-
- *dbname = *mkey = NULL;
-
- while ((db = (krb5_config_binding *)
- krb5_config_get_next(context,
- NULL,
- &top_bind,
- krb5_config_list,
- "kdc",
- "database",
- NULL)) != NULL) {
- const char *p;
-
- p = krb5_config_get_string (context, db, "realm", NULL);
- if (p == NULL) {
- if(default_binding) {
- krb5_warnx(context, "WARNING: more than one realm-less "
- "database specification");
- krb5_warnx(context, "WARNING: using the first encountered");
- } else
- default_binding = db;
- } else if (strcmp (*prealm, p) == 0) {
- set_config (context, db, dbname, mkey);
- break;
- }
- }
- if (*dbname == NULL && default_binding != NULL)
- set_config (context, default_binding, dbname, mkey);
- if (*dbname == NULL)
- *dbname = HDB_DEFAULT_DB;
-}
-
-/*
- * find the keytab entry in `id' for `principal, kvno, enctype' and return
- * it in `entry'. return 0 or an error code
- */
-
-static krb5_error_code
-hdb_get_entry(krb5_context context,
- krb5_keytab id,
- krb5_const_principal principal,
- krb5_kvno kvno,
- krb5_enctype enctype,
- krb5_keytab_entry *entry)
-{
- hdb_entry ent;
- krb5_error_code ret;
- struct hdb_data *d = id->data;
- int i;
- HDB *db;
- const char *dbname = d->dbname;
- const char *mkey = d->mkey;
-
- if (dbname == NULL)
- find_db (context, &dbname, &mkey, principal);
-
- ret = hdb_create (context, &db, dbname);
- if (ret)
- return ret;
- ret = hdb_set_master_keyfile (context, db, mkey);
- if (ret) {
- (*db->destroy)(context, db);
- return ret;
- }
-
- ret = (*db->open)(context, db, O_RDONLY, 0);
- if (ret) {
- (*db->destroy)(context, db);
- return ret;
- }
- ent.principal = (krb5_principal)principal;
- ret = (*db->fetch)(context, db, HDB_F_DECRYPT, &ent);
- (*db->close)(context, db);
- (*db->destroy)(context, db);
-
- if(ret == HDB_ERR_NOENTRY)
- return KRB5_KT_NOTFOUND;
- else if(ret)
- return ret;
- if(kvno && ent.kvno != kvno) {
- hdb_free_entry(context, &ent);
- return KRB5_KT_NOTFOUND;
- }
- if(enctype == 0)
- if(ent.keys.len > 0)
- enctype = ent.keys.val[0].key.keytype;
- ret = KRB5_KT_NOTFOUND;
- for(i = 0; i < ent.keys.len; i++) {
- if(ent.keys.val[i].key.keytype == enctype) {
- krb5_copy_principal(context, principal, &entry->principal);
- entry->vno = ent.kvno;
- krb5_copy_keyblock_contents(context,
- &ent.keys.val[i].key,
- &entry->keyblock);
- ret = 0;
- break;
- }
- }
- hdb_free_entry(context, &ent);
- return ret;
-}
-
-krb5_kt_ops hdb_kt_ops = {
- "HDB",
- hdb_resolve,
- hdb_get_name,
- hdb_close,
- hdb_get_entry,
- NULL, /* start_seq_get */
- NULL, /* next_entry */
- NULL, /* end_seq_get */
- NULL, /* add */
- NULL /* remove */
-};
diff --git a/crypto/heimdal/lib/hdb/libasn1.h b/crypto/heimdal/lib/hdb/libasn1.h
deleted file mode 100644
index ef02d7c7e7aee..0000000000000
--- a/crypto/heimdal/lib/hdb/libasn1.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 1997, 2001 Kungliga Tekniska Högskolan
- * (Royal Institute of Technology, Stockholm, Sweden).
- * All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- *
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
- * documentation and/or other materials provided with the distribution.
- *
- * 3. Neither the name of the Institute nor the names of its contributors
- * may be used to endorse or promote products derived from this software
- * without specific prior written permission.
- *
- * THIS SOFTWARE IS PROVIDED BY THE INSTITUTE AND CONTRIBUTORS ``AS IS'' AND
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
- * ARE DISCLAIMED. IN NO EVENT SHALL THE INSTITUTE OR CONTRIBUTORS BE LIABLE
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGE.
- */
-
-/* $Id: libasn1.h,v 1.5 2001/04/18 16:21:33 joda Exp $ */
-
-#ifndef __LIBASN1_H__
-#define __LIBASN1_H__
-
-#ifdef HAVE_CONFIG_H
-#include <config.h>
-#endif
-
-#include <stdlib.h>
-#include <errno.h>
-#include <krb5_asn1.h>
-#include <der.h>
-#include "hdb_asn1.h"
-#include <asn1_err.h>
-#include <parse_units.h>
-
-#endif /* __LIBASN1_H__ */
diff --git a/crypto/heimdal/lib/hdb/mkey.c b/crypto/heimdal/lib/hdb/mkey.c
deleted file mode 100644
index 92bcd86f3ad8d..0000000000000
--- a/crypto/heimdal/lib/hdb/mkey.c
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Copyright (c) 2000 - 2002 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 "hdb_locl.h"
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
-RCSID("$Id: mkey.c,v 1.15 2003/03/28 02:01:33 lha Exp $");
-
-struct hdb_master_key_data {
- krb5_keytab_entry keytab;
- krb5_crypto crypto;
- struct hdb_master_key_data *next;
-};
-
-void
-hdb_free_master_key(krb5_context context, hdb_master_key mkey)
-{
- struct hdb_master_key_data *ptr;
- while(mkey) {
- krb5_kt_free_entry(context, &mkey->keytab);
- if (mkey->crypto)
- krb5_crypto_destroy(context, mkey->crypto);
- ptr = mkey;
- mkey = mkey->next;
- free(ptr);
- }
-}
-
-krb5_error_code
-hdb_process_master_key(krb5_context context,
- int kvno, krb5_keyblock *key, krb5_enctype etype,
- hdb_master_key *mkey)
-{
- krb5_error_code ret;
-
- *mkey = calloc(1, sizeof(**mkey));
- if(*mkey == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- (*mkey)->keytab.vno = kvno;
- ret = krb5_parse_name(context, "K/M", &(*mkey)->keytab.principal);
- if(ret)
- goto fail;
- ret = krb5_copy_keyblock_contents(context, key, &(*mkey)->keytab.keyblock);
- if(ret)
- goto fail;
- if(etype != 0)
- (*mkey)->keytab.keyblock.keytype = etype;
- (*mkey)->keytab.timestamp = time(NULL);
- ret = krb5_crypto_init(context, key, etype, &(*mkey)->crypto);
- if(ret)
- goto fail;
- return 0;
- fail:
- hdb_free_master_key(context, *mkey);
- *mkey = NULL;
- return ret;
-}
-
-krb5_error_code
-hdb_add_master_key(krb5_context context, krb5_keyblock *key,
- hdb_master_key *inout)
-{
- int vno = 0;
- hdb_master_key p;
- krb5_error_code ret;
-
- for(p = *inout; p; p = p->next)
- vno = max(vno, p->keytab.vno);
- vno++;
- ret = hdb_process_master_key(context, vno, key, 0, &p);
- if(ret)
- return ret;
- p->next = *inout;
- *inout = p;
- return 0;
-}
-
-static krb5_error_code
-read_master_keytab(krb5_context context, const char *filename,
- hdb_master_key *mkey)
-{
- krb5_error_code ret;
- krb5_keytab id;
- krb5_kt_cursor cursor;
- krb5_keytab_entry entry;
- hdb_master_key p;
-
- ret = krb5_kt_resolve(context, filename, &id);
- if(ret)
- return ret;
-
- ret = krb5_kt_start_seq_get(context, id, &cursor);
- if(ret)
- goto out;
- *mkey = NULL;
- while(krb5_kt_next_entry(context, id, &entry, &cursor) == 0) {
- p = calloc(1, sizeof(*p));
- p->keytab = entry;
- ret = krb5_crypto_init(context, &p->keytab.keyblock, 0, &p->crypto);
- p->next = *mkey;
- *mkey = p;
- }
- krb5_kt_end_seq_get(context, id, &cursor);
- out:
- krb5_kt_close(context, id);
- return ret;
-}
-
-/* read a MIT master keyfile */
-static krb5_error_code
-read_master_mit(krb5_context context, const char *filename,
- hdb_master_key *mkey)
-{
- int fd;
- krb5_error_code ret;
- krb5_storage *sp;
- u_int16_t enctype;
- krb5_keyblock key;
-
- fd = open(filename, O_RDONLY | O_BINARY);
- if(fd < 0) {
- int save_errno = errno;
- krb5_set_error_string(context, "failed to open %s: %s", filename,
- strerror(save_errno));
- return save_errno;
- }
- sp = krb5_storage_from_fd(fd);
- if(sp == NULL) {
- close(fd);
- return errno;
- }
- krb5_storage_set_flags(sp, KRB5_STORAGE_HOST_BYTEORDER);
-#if 0
- /* could possibly use ret_keyblock here, but do it with more
- checks for now */
- ret = krb5_ret_keyblock(sp, &key);
-#else
- ret = krb5_ret_int16(sp, &enctype);
- if((htons(enctype) & 0xff00) == 0x3000) {
- krb5_set_error_string(context, "unknown keytype in %s: %#x, expected %#x",
- filename, htons(enctype), 0x3000);
- ret = HEIM_ERR_BAD_MKEY;
- goto out;
- }
- key.keytype = enctype;
- ret = krb5_ret_data(sp, &key.keyvalue);
- if(ret)
- goto out;
-#endif
- ret = hdb_process_master_key(context, 0, &key, 0, mkey);
- krb5_free_keyblock_contents(context, &key);
- out:
- krb5_storage_free(sp);
- close(fd);
- return ret;
-}
-
-/* read an old master key file */
-static krb5_error_code
-read_master_encryptionkey(krb5_context context, const char *filename,
- hdb_master_key *mkey)
-{
- int fd;
- krb5_keyblock key;
- krb5_error_code ret;
- unsigned char buf[256];
- ssize_t len;
- size_t ret_len;
-
- fd = open(filename, O_RDONLY | O_BINARY);
- if(fd < 0) {
- int save_errno = errno;
- krb5_set_error_string(context, "failed to open %s: %s",
- filename, strerror(save_errno));
- return save_errno;
- }
-
- len = read(fd, buf, sizeof(buf));
- close(fd);
- if(len < 0) {
- int save_errno = errno;
- krb5_set_error_string(context, "error reading %s: %s",
- filename, strerror(save_errno));
- return save_errno;
- }
-
- ret = decode_EncryptionKey(buf, len, &key, &ret_len);
- memset(buf, 0, sizeof(buf));
- if(ret)
- return ret;
-
- /* Originally, the keytype was just that, and later it got changed
- to des-cbc-md5, but we always used des in cfb64 mode. This
- should cover all cases, but will break if someone has hacked
- this code to really use des-cbc-md5 -- but then that's not my
- problem. */
- if(key.keytype == KEYTYPE_DES || key.keytype == ETYPE_DES_CBC_MD5)
- key.keytype = ETYPE_DES_CFB64_NONE;
-
- ret = hdb_process_master_key(context, 0, &key, 0, mkey);
- krb5_free_keyblock_contents(context, &key);
- return ret;
-}
-
-/* read a krb4 /.k style file */
-static krb5_error_code
-read_master_krb4(krb5_context context, const char *filename,
- hdb_master_key *mkey)
-{
- int fd;
- krb5_keyblock key;
- krb5_error_code ret;
- unsigned char buf[256];
- ssize_t len;
-
- fd = open(filename, O_RDONLY | O_BINARY);
- if(fd < 0) {
- int save_errno = errno;
- krb5_set_error_string(context, "failed to open %s: %s",
- filename, strerror(save_errno));
- return save_errno;
- }
-
- len = read(fd, buf, sizeof(buf));
- close(fd);
- if(len < 0) {
- int save_errno = errno;
- krb5_set_error_string(context, "error reading %s: %s",
- filename, strerror(save_errno));
- return save_errno;
- }
- if(len != 8) {
- krb5_set_error_string(context, "bad contents of %s", filename);
- return HEIM_ERR_EOF; /* XXX file might be too large */
- }
-
- memset(&key, 0, sizeof(key));
- key.keytype = ETYPE_DES_PCBC_NONE;
- ret = krb5_data_copy(&key.keyvalue, buf, len);
- memset(buf, 0, sizeof(buf));
- if(ret)
- return ret;
-
- ret = hdb_process_master_key(context, 0, &key, 0, mkey);
- krb5_free_keyblock_contents(context, &key);
- return ret;
-}
-
-krb5_error_code
-hdb_read_master_key(krb5_context context, const char *filename,
- hdb_master_key *mkey)
-{
- FILE *f;
- unsigned char buf[16];
- krb5_error_code ret;
-
- off_t len;
-
- *mkey = NULL;
-
- if(filename == NULL)
- filename = HDB_DB_DIR "/m-key";
-
- f = fopen(filename, "r");
- if(f == NULL) {
- int save_errno = errno;
- krb5_set_error_string(context, "failed to open %s: %s",
- filename, strerror(save_errno));
- return save_errno;
- }
-
- if(fread(buf, 1, 2, f) != 2) {
- krb5_set_error_string(context, "end of file reading %s", filename);
- fclose(f);
- return HEIM_ERR_EOF;
- }
-
- fseek(f, 0, SEEK_END);
- len = ftell(f);
-
- if(fclose(f) != 0)
- return errno;
-
- if(len < 0)
- return errno;
-
- if(len == 8) {
- ret = read_master_krb4(context, filename, mkey);
- } else if(buf[0] == 0x30 && len <= 127 && buf[1] == len - 2) {
- ret = read_master_encryptionkey(context, filename, mkey);
- } else if(buf[0] == 5 && buf[1] >= 1 && buf[1] <= 2) {
- ret = read_master_keytab(context, filename, mkey);
- } else {
- ret = read_master_mit(context, filename, mkey);
- }
- return ret;
-}
-
-krb5_error_code
-hdb_write_master_key(krb5_context context, const char *filename,
- hdb_master_key mkey)
-{
- krb5_error_code ret;
- hdb_master_key p;
- krb5_keytab kt;
-
- if(filename == NULL)
- filename = HDB_DB_DIR "/m-key";
-
- ret = krb5_kt_resolve(context, filename, &kt);
- if(ret)
- return ret;
-
- for(p = mkey; p; p = p->next) {
- ret = krb5_kt_add_entry(context, kt, &p->keytab);
- }
-
- krb5_kt_close(context, kt);
-
- return ret;
-}
-
-static hdb_master_key
-find_master_key(Key *key, hdb_master_key mkey)
-{
- hdb_master_key ret = NULL;
- while(mkey) {
- if(ret == NULL && mkey->keytab.vno == 0)
- ret = mkey;
- if(key->mkvno == NULL) {
- if(ret == NULL || mkey->keytab.vno > ret->keytab.vno)
- ret = mkey;
- } else if(mkey->keytab.vno == *key->mkvno)
- return mkey;
- mkey = mkey->next;
- }
- return ret;
-}
-
-krb5_error_code
-hdb_unseal_keys_mkey(krb5_context context, hdb_entry *ent, hdb_master_key mkey)
-{
- int i;
- krb5_error_code ret;
- krb5_data res;
- size_t keysize;
- Key *k;
-
- for(i = 0; i < ent->keys.len; i++){
- hdb_master_key key;
-
- k = &ent->keys.val[i];
- if(k->mkvno == NULL)
- continue;
-
- key = find_master_key(&ent->keys.val[i], mkey);
-
- if (key == NULL)
- return HDB_ERR_NO_MKEY;
-
- ret = krb5_decrypt(context, key->crypto, HDB_KU_MKEY,
- k->key.keyvalue.data,
- k->key.keyvalue.length,
- &res);
- if (ret)
- return ret;
-
- /* fixup keylength if the key got padded when encrypting it */
- ret = krb5_enctype_keysize(context, k->key.keytype, &keysize);
- if (ret) {
- krb5_data_free(&res);
- return ret;
- }
- if (keysize > res.length) {
- krb5_data_free(&res);
- return KRB5_BAD_KEYSIZE;
- }
-
- memset(k->key.keyvalue.data, 0, k->key.keyvalue.length);
- free(k->key.keyvalue.data);
- k->key.keyvalue = res;
- k->key.keyvalue.length = keysize;
- free(k->mkvno);
- k->mkvno = NULL;
- }
- return 0;
-}
-
-krb5_error_code
-hdb_unseal_keys(krb5_context context, HDB *db, hdb_entry *ent)
-{
- if (db->master_key_set == 0)
- return 0;
- return hdb_unseal_keys_mkey(context, ent, db->master_key);
-}
-
-krb5_error_code
-hdb_seal_keys_mkey(krb5_context context, hdb_entry *ent, hdb_master_key mkey)
-{
- int i;
- krb5_error_code ret;
- krb5_data res;
- for(i = 0; i < ent->keys.len; i++){
- Key *k = &ent->keys.val[i];
- hdb_master_key key;
-
- if(k->mkvno != NULL)
- continue;
-
- key = find_master_key(k, mkey);
-
- if (key == NULL)
- return HDB_ERR_NO_MKEY;
-
- ret = krb5_encrypt(context, key->crypto, HDB_KU_MKEY,
- k->key.keyvalue.data,
- k->key.keyvalue.length,
- &res);
- if (ret)
- return ret;
-
- memset(k->key.keyvalue.data, 0, k->key.keyvalue.length);
- free(k->key.keyvalue.data);
- k->key.keyvalue = res;
-
- k->mkvno = malloc(sizeof(*k->mkvno));
- if (k->mkvno == NULL)
- return ENOMEM;
- *k->mkvno = key->keytab.vno;
- }
- return 0;
-}
-
-krb5_error_code
-hdb_seal_keys(krb5_context context, HDB *db, hdb_entry *ent)
-{
- if (db->master_key_set == 0)
- return 0;
-
- return hdb_seal_keys_mkey(context, ent, db->master_key);
-}
-
-krb5_error_code
-hdb_set_master_key (krb5_context context,
- HDB *db,
- krb5_keyblock *key)
-{
- krb5_error_code ret;
- hdb_master_key mkey;
-
- ret = hdb_process_master_key(context, 0, key, 0, &mkey);
- if (ret)
- return ret;
- db->master_key = mkey;
-#if 0 /* XXX - why? */
- des_set_random_generator_seed(key.keyvalue.data);
-#endif
- db->master_key_set = 1;
- return 0;
-}
-
-krb5_error_code
-hdb_set_master_keyfile (krb5_context context,
- HDB *db,
- const char *keyfile)
-{
- hdb_master_key key;
- krb5_error_code ret;
-
- ret = hdb_read_master_key(context, keyfile, &key);
- if (ret) {
- if (ret != ENOENT)
- return ret;
- krb5_clear_error_string(context);
- return 0;
- }
- db->master_key = key;
- db->master_key_set = 1;
- return ret;
-}
-
-krb5_error_code
-hdb_clear_master_key (krb5_context context,
- HDB *db)
-{
- if (db->master_key_set) {
- hdb_free_master_key(context, db->master_key);
- db->master_key_set = 0;
- }
- return 0;
-}
diff --git a/crypto/heimdal/lib/hdb/ndbm.c b/crypto/heimdal/lib/hdb/ndbm.c
deleted file mode 100644
index c162145294d17..0000000000000
--- a/crypto/heimdal/lib/hdb/ndbm.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- * Copyright (c) 1997 - 2001 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 "hdb_locl.h"
-
-RCSID("$Id: ndbm.c,v 1.33 2001/09/03 05:03:01 assar Exp $");
-
-#if HAVE_NDBM
-
-#if defined(HAVE_GDBM_NDBM_H)
-#include <gdbm/ndbm.h>
-#elif defined(HAVE_NDBM_H)
-#include <ndbm.h>
-#elif defined(HAVE_DBM_H)
-#include <dbm.h>
-#endif
-
-struct ndbm_db {
- DBM *db;
- int lock_fd;
-};
-
-static krb5_error_code
-NDBM_destroy(krb5_context context, HDB *db)
-{
- krb5_error_code ret;
-
- ret = hdb_clear_master_key (context, db);
- free(db->name);
- free(db);
- return 0;
-}
-
-static krb5_error_code
-NDBM_lock(krb5_context context, HDB *db, int operation)
-{
- struct ndbm_db *d = db->db;
- return hdb_lock(d->lock_fd, operation);
-}
-
-static krb5_error_code
-NDBM_unlock(krb5_context context, HDB *db)
-{
- struct ndbm_db *d = db->db;
- return hdb_unlock(d->lock_fd);
-}
-
-static krb5_error_code
-NDBM_seq(krb5_context context, HDB *db,
- unsigned flags, hdb_entry *entry, int first)
-
-{
- struct ndbm_db *d = (struct ndbm_db *)db->db;
- datum key, value;
- krb5_data key_data, data;
- krb5_error_code ret = 0;
-
- if(first)
- key = dbm_firstkey(d->db);
- else
- key = dbm_nextkey(d->db);
- if(key.dptr == NULL)
- return HDB_ERR_NOENTRY;
- key_data.data = key.dptr;
- key_data.length = key.dsize;
- ret = db->lock(context, db, HDB_RLOCK);
- if(ret) return ret;
- value = dbm_fetch(d->db, key);
- db->unlock(context, db);
- data.data = value.dptr;
- data.length = value.dsize;
- if(hdb_value2entry(context, &data, entry))
- return NDBM_seq(context, db, flags, entry, 0);
- if (db->master_key_set && (flags & HDB_F_DECRYPT)) {
- ret = hdb_unseal_keys (context, db, entry);
- if (ret)
- hdb_free_entry (context, entry);
- }
- if (entry->principal == NULL) {
- entry->principal = malloc (sizeof(*entry->principal));
- if (entry->principal == NULL) {
- ret = ENOMEM;
- hdb_free_entry (context, entry);
- krb5_set_error_string(context, "malloc: out of memory");
- } else {
- hdb_key2principal (context, &key_data, entry->principal);
- }
- }
- return ret;
-}
-
-
-static krb5_error_code
-NDBM_firstkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return NDBM_seq(context, db, flags, entry, 1);
-}
-
-
-static krb5_error_code
-NDBM_nextkey(krb5_context context, HDB *db, unsigned flags, hdb_entry *entry)
-{
- return NDBM_seq(context, db, flags, entry, 0);
-}
-
-static krb5_error_code
-NDBM_rename(krb5_context context, HDB *db, const char *new_name)
-{
- /* XXX this function will break */
- struct ndbm_db *d = db->db;
-
- int ret;
- char *old_dir, *old_pag, *new_dir, *new_pag;
- char *new_lock;
- int lock_fd;
-
- /* lock old and new databases */
- ret = db->lock(context, db, HDB_WLOCK);
- if(ret)
- return ret;
- asprintf(&new_lock, "%s.lock", new_name);
- if(new_lock == NULL) {
- db->unlock(context, db);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- lock_fd = open(new_lock, O_RDWR | O_CREAT, 0600);
- if(lock_fd < 0) {
- ret = errno;
- db->unlock(context, db);
- krb5_set_error_string(context, "open(%s): %s", new_lock,
- strerror(ret));
- free(new_lock);
- return ret;
- }
- free(new_lock);
- ret = hdb_lock(lock_fd, HDB_WLOCK);
- if(ret) {
- db->unlock(context, db);
- close(lock_fd);
- return ret;
- }
-
- asprintf(&old_dir, "%s.dir", db->name);
- asprintf(&old_pag, "%s.pag", db->name);
- asprintf(&new_dir, "%s.dir", new_name);
- asprintf(&new_pag, "%s.pag", new_name);
-
- ret = rename(old_dir, new_dir) || rename(old_pag, new_pag);
- free(old_dir);
- free(old_pag);
- free(new_dir);
- free(new_pag);
- hdb_unlock(lock_fd);
- db->unlock(context, db);
-
- if(ret) {
- ret = errno;
- close(lock_fd);
- krb5_set_error_string(context, "rename: %s", strerror(ret));
- return ret;
- }
-
- close(d->lock_fd);
- d->lock_fd = lock_fd;
-
- free(db->name);
- db->name = strdup(new_name);
- return 0;
-}
-
-static krb5_error_code
-NDBM__get(krb5_context context, HDB *db, krb5_data key, krb5_data *reply)
-{
- struct ndbm_db *d = (struct ndbm_db *)db->db;
- datum k, v;
- int code;
-
- k.dptr = key.data;
- k.dsize = key.length;
- code = db->lock(context, db, HDB_RLOCK);
- if(code)
- return code;
- v = dbm_fetch(d->db, k);
- db->unlock(context, db);
- if(v.dptr == NULL)
- return HDB_ERR_NOENTRY;
-
- krb5_data_copy(reply, v.dptr, v.dsize);
- return 0;
-}
-
-static krb5_error_code
-NDBM__put(krb5_context context, HDB *db, int replace,
- krb5_data key, krb5_data value)
-{
- struct ndbm_db *d = (struct ndbm_db *)db->db;
- datum k, v;
- int code;
-
- k.dptr = key.data;
- k.dsize = key.length;
- v.dptr = value.data;
- v.dsize = value.length;
-
- code = db->lock(context, db, HDB_WLOCK);
- if(code)
- return code;
- code = dbm_store(d->db, k, v, replace ? DBM_REPLACE : DBM_INSERT);
- db->unlock(context, db);
- if(code == 1)
- return HDB_ERR_EXISTS;
- if (code < 0)
- return code;
- return 0;
-}
-
-static krb5_error_code
-NDBM__del(krb5_context context, HDB *db, krb5_data key)
-{
- struct ndbm_db *d = (struct ndbm_db *)db->db;
- datum k;
- int code;
- krb5_error_code ret;
-
- k.dptr = key.data;
- k.dsize = key.length;
- ret = db->lock(context, db, HDB_WLOCK);
- if(ret) return ret;
- code = dbm_delete(d->db, k);
- db->unlock(context, db);
- if(code < 0)
- return errno;
- return 0;
-}
-
-static krb5_error_code
-NDBM_open(krb5_context context, HDB *db, int flags, mode_t mode)
-{
- krb5_error_code ret;
- struct ndbm_db *d = malloc(sizeof(*d));
- char *lock_file;
-
- if(d == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- asprintf(&lock_file, "%s.lock", (char*)db->name);
- if(lock_file == NULL) {
- free(d);
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- d->db = dbm_open((char*)db->name, flags, mode);
- if(d->db == NULL){
- ret = errno;
- free(d);
- free(lock_file);
- krb5_set_error_string(context, "dbm_open(%s): %s", db->name,
- strerror(ret));
- return ret;
- }
- d->lock_fd = open(lock_file, O_RDWR | O_CREAT, 0600);
- if(d->lock_fd < 0){
- ret = errno;
- dbm_close(d->db);
- free(d);
- krb5_set_error_string(context, "open(%s): %s", lock_file,
- strerror(ret));
- free(lock_file);
- return ret;
- }
- free(lock_file);
- db->db = d;
- if((flags & O_ACCMODE) == O_RDONLY)
- ret = hdb_check_db_format(context, db);
- else
- ret = hdb_init_db(context, db);
- if(ret == HDB_ERR_NOENTRY)
- return 0;
- return ret;
-}
-
-static krb5_error_code
-NDBM_close(krb5_context context, HDB *db)
-{
- struct ndbm_db *d = db->db;
- dbm_close(d->db);
- close(d->lock_fd);
- free(d);
- return 0;
-}
-
-krb5_error_code
-hdb_ndbm_create(krb5_context context, HDB **db,
- const char *filename)
-{
- *db = malloc(sizeof(**db));
- if (*db == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- (*db)->db = NULL;
- (*db)->name = strdup(filename);
- if ((*db)->name == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- free(*db);
- *db = NULL;
- return ENOMEM;
- }
- (*db)->master_key_set = 0;
- (*db)->openp = 0;
- (*db)->open = NDBM_open;
- (*db)->close = NDBM_close;
- (*db)->fetch = _hdb_fetch;
- (*db)->store = _hdb_store;
- (*db)->remove = _hdb_remove;
- (*db)->firstkey = NDBM_firstkey;
- (*db)->nextkey= NDBM_nextkey;
- (*db)->lock = NDBM_lock;
- (*db)->unlock = NDBM_unlock;
- (*db)->rename = NDBM_rename;
- (*db)->_get = NDBM__get;
- (*db)->_put = NDBM__put;
- (*db)->_del = NDBM__del;
- (*db)->destroy = NDBM_destroy;
- return 0;
-}
-
-#endif /* HAVE_NDBM */
diff --git a/crypto/heimdal/lib/hdb/print.c b/crypto/heimdal/lib/hdb/print.c
deleted file mode 100644
index 5ad172f7489d6..0000000000000
--- a/crypto/heimdal/lib/hdb/print.c
+++ /dev/null
@@ -1,262 +0,0 @@
-/*
- * Copyright (c) 1999-2002 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 "hdb_locl.h"
-#include <ctype.h>
-
-RCSID("$Id: print.c,v 1.8 2002/05/24 15:18:02 joda Exp $");
-
-/*
- This is the present contents of a dump line. This might change at
- any time. Fields are separated by white space.
-
- principal
- keyblock
- kvno
- keys...
- mkvno
- enctype
- keyvalue
- salt (- means use normal salt)
- creation date and principal
- modification date and principal
- principal valid from date (not used)
- principal valid end date (not used)
- principal key expires (not used)
- max ticket life
- max renewable life
- flags
- generation number
- */
-
-static krb5_error_code
-append_string(krb5_context context, krb5_storage *sp, const char *fmt, ...)
-{
- krb5_error_code ret;
- char *s;
- va_list ap;
- va_start(ap, fmt);
- vasprintf(&s, fmt, ap);
- va_end(ap);
- if(s == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
- ret = krb5_storage_write(sp, s, strlen(s));
- free(s);
- return ret;
-}
-
-static krb5_error_code
-append_hex(krb5_context context, krb5_storage *sp, krb5_data *data)
-{
- int i, printable = 1;
- char *p;
-
- p = data->data;
- for(i = 0; i < data->length; i++)
- if(!isalnum((unsigned char)p[i]) && p[i] != '.'){
- printable = 0;
- break;
- }
- if(printable)
- return append_string(context, sp, "\"%.*s\"",
- data->length, data->data);
- for(i = 0; i < data->length; i++)
- append_string(context, sp, "%02x", ((unsigned char*)data->data)[i]);
- return 0;
-}
-
-static char *
-time2str(time_t t)
-{
- static char buf[128];
- strftime(buf, sizeof(buf), "%Y%m%d%H%M%S", gmtime(&t));
- return buf;
-}
-
-static krb5_error_code
-append_event(krb5_context context, krb5_storage *sp, Event *ev)
-{
- char *pr = NULL;
- krb5_error_code ret;
- if(ev == NULL)
- return append_string(context, sp, "- ");
- if (ev->principal != NULL) {
- ret = krb5_unparse_name(context, ev->principal, &pr);
- if(ret)
- return ret;
- }
- ret = append_string(context, sp, "%s:%s ",
- time2str(ev->time), pr ? pr : "UNKNOWN");
- free(pr);
- return ret;
-}
-
-static krb5_error_code
-entry2string_int (krb5_context context, krb5_storage *sp, hdb_entry *ent)
-{
- char *p;
- int i;
- krb5_error_code ret;
-
- /* --- principal */
- ret = krb5_unparse_name(context, ent->principal, &p);
- if(ret)
- return ret;
- append_string(context, sp, "%s ", p);
- free(p);
- /* --- kvno */
- append_string(context, sp, "%d", ent->kvno);
- /* --- keys */
- for(i = 0; i < ent->keys.len; i++){
- /* --- mkvno, keytype */
- if(ent->keys.val[i].mkvno)
- append_string(context, sp, ":%d:%d:",
- *ent->keys.val[i].mkvno,
- ent->keys.val[i].key.keytype);
- else
- append_string(context, sp, "::%d:",
- ent->keys.val[i].key.keytype);
- /* --- keydata */
- append_hex(context, sp, &ent->keys.val[i].key.keyvalue);
- append_string(context, sp, ":");
- /* --- salt */
- if(ent->keys.val[i].salt){
- append_string(context, sp, "%u/", ent->keys.val[i].salt->type);
- append_hex(context, sp, &ent->keys.val[i].salt->salt);
- }else
- append_string(context, sp, "-");
- }
- append_string(context, sp, " ");
- /* --- created by */
- append_event(context, sp, &ent->created_by);
- /* --- modified by */
- append_event(context, sp, ent->modified_by);
-
- /* --- valid start */
- if(ent->valid_start)
- append_string(context, sp, "%s ", time2str(*ent->valid_start));
- else
- append_string(context, sp, "- ");
-
- /* --- valid end */
- if(ent->valid_end)
- append_string(context, sp, "%s ", time2str(*ent->valid_end));
- else
- append_string(context, sp, "- ");
-
- /* --- password ends */
- if(ent->pw_end)
- append_string(context, sp, "%s ", time2str(*ent->pw_end));
- else
- append_string(context, sp, "- ");
-
- /* --- max life */
- if(ent->max_life)
- append_string(context, sp, "%d ", *ent->max_life);
- else
- append_string(context, sp, "- ");
-
- /* --- max renewable life */
- if(ent->max_renew)
- append_string(context, sp, "%d ", *ent->max_renew);
- else
- append_string(context, sp, "- ");
-
- /* --- flags */
- append_string(context, sp, "%d ", HDBFlags2int(ent->flags));
-
- /* --- generation number */
- if(ent->generation) {
- append_string(context, sp, "%s:%d:%d", time2str(ent->generation->time),
- ent->generation->usec,
- ent->generation->gen);
- } else
- append_string(context, sp, "-");
-
- return 0;
-}
-
-krb5_error_code
-hdb_entry2string (krb5_context context, hdb_entry *ent, char **str)
-{
- krb5_error_code ret;
- krb5_data data;
- krb5_storage *sp;
-
- sp = krb5_storage_emem();
- if(sp == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- ret = entry2string_int(context, sp, ent);
- if(ret) {
- krb5_storage_free(sp);
- return ret;
- }
-
- krb5_storage_write(sp, "\0", 1);
- krb5_storage_to_data(sp, &data);
- krb5_storage_free(sp);
- *str = data.data;
- return 0;
-}
-
-/* print a hdb_entry to (FILE*)data; suitable for hdb_foreach */
-
-krb5_error_code
-hdb_print_entry(krb5_context context, HDB *db, hdb_entry *entry, void *data)
-{
- krb5_error_code ret;
- krb5_storage *sp;
-
- FILE *f = data;
-
- fflush(f);
- sp = krb5_storage_from_fd(fileno(f));
- if(sp == NULL) {
- krb5_set_error_string(context, "malloc: out of memory");
- return ENOMEM;
- }
-
- ret = entry2string_int(context, sp, entry);
- if(ret) {
- krb5_storage_free(sp);
- return ret;
- }
-
- krb5_storage_write(sp, "\n", 1);
- krb5_storage_free(sp);
- return 0;
-}