From 50f58269a251ef9931aab895982f8b69f4ab7780 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 7 Oct 2006 07:39:24 +0000 Subject: [PATCH] Move ASN.1 routines for KDB LDAP plugin into main krb5 library, accessed via krb5int_access. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18666 dc483132-0cff-0310-8789-dd5450dbe970 --- src/appl/gssftp/ftpd/Makefile.in | 1 - src/include/k5-int.h | 26 ++ src/lib/krb5/asn.1/Makefile.in | 13 + .../krb5/asn.1/ldap_key_seq.c} | 4 +- src/lib/krb5/os/accessor.c | 2 + src/plugins/kdb/ldap/Makefile.in | 14 +- src/plugins/kdb/ldap/libkdb_ldap/Makefile.in | 223 +++++++++++------- src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c | 14 ++ .../kdb/ldap/libkdb_ldap/ldap_principal2.c | 41 +++- .../libkdb_ldap/princ_key_encode_decode.h | 9 - 10 files changed, 250 insertions(+), 97 deletions(-) rename src/{plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.c => lib/krb5/asn.1/ldap_key_seq.c} (98%) delete mode 100644 src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.h diff --git a/src/appl/gssftp/ftpd/Makefile.in b/src/appl/gssftp/ftpd/Makefile.in index 1f0444c65..005089326 100644 --- a/src/appl/gssftp/ftpd/Makefile.in +++ b/src/appl/gssftp/ftpd/Makefile.in @@ -111,4 +111,3 @@ $(OUTPRE)secure.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(SRCTOP)/include/kerberosIV/des.h $(SRCTOP)/include/kerberosIV/krb.h \ $(srcdir)/../arpa/ftp.h $(srcdir)/../ftp/secure.c secure.h $(OUTPRE)getdtablesize.$(OBJEXT): $(srcdir)/../../bsd/getdtablesize.c -$(OUTPRE)setenv.$(OBJEXT): $(srcdir)/../../bsd/setenv.c diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 8455fe47d..8672d691e 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -1476,6 +1476,19 @@ krb5_error_code decode_krb5_pa_enc_ts krb5_error_code decode_krb5_sam_key (const krb5_data *, krb5_sam_key **); +struct _krb5_key_data; /* kdb.h */ +krb5_error_code +krb5int_ldap_encode_sequence_of_keys (struct _krb5_key_data *key_data, + krb5_int16 n_key_data, + krb5_int32 mkvno, + krb5_data **code); + +krb5_error_code +krb5int_ldap_decode_sequence_of_keys (krb5_data *in, + struct _krb5_key_data **out, + krb5_int16 *n_key_data, + int *mkvno); + /************************************************************************* * End of prototypes for krb5_decode.c *************************************************************************/ @@ -1718,6 +1731,19 @@ typedef struct _krb5int_access { (krb5_int64, krb5_octet **, size_t *); krb5_error_code (KRB5_CALLCONV *krb5_ser_unpack_int64) (krb5_int64 *, krb5_octet **, size_t *); + + /* Used for KDB LDAP back end. */ + krb5_error_code + (*asn1_ldap_encode_sequence_of_keys) (struct _krb5_key_data *key_data, + krb5_int16 n_key_data, + krb5_int32 mkvno, + krb5_data **code); + + krb5_error_code + (*asn1_ldap_decode_sequence_of_keys) (krb5_data *in, + struct _krb5_key_data **out, + krb5_int16 *n_key_data, + int *mkvno); } krb5int_access; #define KRB5INT_ACCESS_VERSION \ diff --git a/src/lib/krb5/asn.1/Makefile.in b/src/lib/krb5/asn.1/Makefile.in index 560f8df3c..0c375a91a 100644 --- a/src/lib/krb5/asn.1/Makefile.in +++ b/src/lib/krb5/asn.1/Makefile.in @@ -20,6 +20,7 @@ STLIBOBJS= \ krb5_decode.o\ krb5_encode.o\ asn1_k_encode.o\ + ldap_key_seq.o\ asn1_misc.o SRCS= \ @@ -32,6 +33,7 @@ SRCS= \ $(srcdir)/krb5_decode.c\ $(srcdir)/krb5_encode.c\ $(srcdir)/asn1_k_encode.c\ + $(srcdir)/ldap_key_seq.c\ $(srcdir)/asn1_misc.c OBJS= \ @@ -44,6 +46,7 @@ OBJS= \ $(OUTPRE)krb5_decode.$(OBJEXT)\ $(OUTPRE)krb5_encode.$(OBJEXT)\ $(OUTPRE)asn1_k_encode.$(OBJEXT)\ + $(OUTPRE)ldap_key_seq.$(OBJEXT)\ $(OUTPRE)asn1_misc.$(OBJEXT) ##DOS##LIBOBJS = $(OBJS) @@ -144,6 +147,16 @@ asn1_k_encode.so asn1_k_encode.po $(OUTPRE)asn1_k_encode.$(OBJEXT): \ $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ asn1_encode.h asn1_k_encode.c asn1_k_encode.h asn1_make.h \ asn1buf.h krbasn1.h +ldap_key_seq.so ldap_key_seq.po $(OUTPRE)ldap_key_seq.$(OBJEXT): \ + $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ + $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ + $(COM_ERR_DEPS) $(SRCTOP)/include/k5-err.h $(SRCTOP)/include/k5-int.h \ + $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ + $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ + $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h asn1_decode.h asn1_encode.h \ + asn1_get.h asn1_make.h asn1buf.h krbasn1.h ldap_key_seq.c asn1_misc.so asn1_misc.po $(OUTPRE)asn1_misc.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ diff --git a/src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.c b/src/lib/krb5/asn.1/ldap_key_seq.c similarity index 98% rename from src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.c rename to src/lib/krb5/asn.1/ldap_key_seq.c index bde22e409..68a93554d 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.c +++ b/src/lib/krb5/asn.1/ldap_key_seq.c @@ -33,13 +33,15 @@ #include #include -#include "princ_key_encode_decode.h" #include "krbasn1.h" #include "asn1_encode.h" #include "asn1_decode.h" #include "asn1_make.h" #include "asn1_get.h" +#define asn1_encode_sequence_of_keys krb5int_ldap_encode_sequence_of_keys +#define asn1_decode_sequence_of_keys krb5int_ldap_decode_sequence_of_keys + #define cleanup(err) \ { \ ret = err; \ diff --git a/src/lib/krb5/os/accessor.c b/src/lib/krb5/os/accessor.c index 0a2f8e8db..12038ac99 100644 --- a/src/lib/krb5/os/accessor.c +++ b/src/lib/krb5/os/accessor.c @@ -61,6 +61,8 @@ krb5int_accessor(krb5int_access *internals, krb5_int32 version) internals_temp.krb5int_c_mandatory_cksumtype = krb5int_c_mandatory_cksumtype; internals_temp.krb5_ser_pack_int64 = krb5_ser_pack_int64; internals_temp.krb5_ser_unpack_int64 = krb5_ser_unpack_int64; + internals_temp.asn1_ldap_encode_sequence_of_keys = krb5int_ldap_encode_sequence_of_keys; + internals_temp.asn1_ldap_decode_sequence_of_keys = krb5int_ldap_decode_sequence_of_keys; *internals = internals_temp; return 0; } diff --git a/src/plugins/kdb/ldap/Makefile.in b/src/plugins/kdb/ldap/Makefile.in index b7378bd5b..a3c483218 100644 --- a/src/plugins/kdb/ldap/Makefile.in +++ b/src/plugins/kdb/ldap/Makefile.in @@ -57,8 +57,12 @@ ldap_exp.so ldap_exp.po $(OUTPRE)ldap_exp.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h $(srcdir)/libkdb_ldap/kdb_ldap.h \ - $(srcdir)/libkdb_ldap/ldap_krbcontainer.h $(srcdir)/libkdb_ldap/ldap_principal.h \ - $(srcdir)/libkdb_ldap/ldap_pwd_policy.h $(srcdir)/libkdb_ldap/ldap_realm.h \ - $(srcdir)/libkdb_ldap/ldap_tkt_policy.h ldap_exp.c + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + $(srcdir)/libkdb_ldap/kdb_ldap.h $(srcdir)/libkdb_ldap/ldap_krbcontainer.h \ + $(srcdir)/libkdb_ldap/ldap_principal.h $(srcdir)/libkdb_ldap/ldap_pwd_policy.h \ + $(srcdir)/libkdb_ldap/ldap_realm.h $(srcdir)/libkdb_ldap/ldap_tkt_policy.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + ldap_exp.c diff --git a/src/plugins/kdb/ldap/libkdb_ldap/Makefile.in b/src/plugins/kdb/ldap/libkdb_ldap/Makefile.in index ca5b7851f..2cf9ae3cd 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/Makefile.in +++ b/src/plugins/kdb/ldap/libkdb_ldap/Makefile.in @@ -35,6 +35,9 @@ SHLIB_EXPLIBS= $(GSSRPC_LIBS) -lkrb5 -lk5crypto $(COM_ERR_LIB) $(SUPPORT_LIB) @L SHLIB_DIRS=-L$(TOPLIBD) SHLIB_RDIRS=$(KRB5_LIBDIR) +LIBINITFUNC= kldap_init_fn +LIBFINIFUNC= + SRCS= $(srcdir)/kdb_ldap.c \ $(srcdir)/kdb_ldap_conn.c \ $(srcdir)/ldap_realm.c \ @@ -52,8 +55,7 @@ SRCS= $(srcdir)/kdb_ldap.c \ $(srcdir)/ldap_fetch_mkey.c \ $(srcdir)/ldap_service_stash.c \ $(srcdir)/kdb_xdr.c \ - $(srcdir)/ldap_err.c \ - $(srcdir)/princ_key_encode_decode.c + $(srcdir)/ldap_err.c STOBJLISTS=OBJS.ST STLIBOBJS= kdb_ldap.o \ @@ -73,8 +75,7 @@ STLIBOBJS= kdb_ldap.o \ ldap_fetch_mkey.o \ ldap_service_stash.o \ kdb_xdr.o \ - ldap_err.o \ - princ_key_encode_decode.o + ldap_err.o all-unix:: all-liblinks install-unix:: install-libs @@ -95,9 +96,13 @@ kdb_ldap.so kdb_ldap.po $(OUTPRE)kdb_ldap.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.c kdb_ldap.h ldap_err.h \ - ldap_krbcontainer.h ldap_misc.h ldap_realm.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.c kdb_ldap.h ldap_err.h ldap_krbcontainer.h \ + ldap_misc.h ldap_realm.h ldap_services.h kdb_ldap_conn.so kdb_ldap_conn.po $(OUTPRE)kdb_ldap_conn.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -105,10 +110,14 @@ kdb_ldap_conn.so kdb_ldap_conn.po $(OUTPRE)kdb_ldap_conn.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h kdb_ldap_conn.c \ - ldap_handle.h ldap_krbcontainer.h ldap_main.h ldap_misc.h \ - ldap_realm.h ldap_service_stash.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h kdb_ldap_conn.c ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_service_stash.h \ + ldap_services.h ldap_realm.so ldap_realm.po $(OUTPRE)ldap_realm.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -116,10 +125,29 @@ ldap_realm.so ldap_realm.po $(OUTPRE)ldap_realm.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_principal.h \ - ldap_realm.c ldap_realm.h ldap_services.h ldap_tkt_policy.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_principal.h ldap_realm.c \ + ldap_realm.h ldap_services.h ldap_tkt_policy.h +ldap_create.so ldap_create.po $(OUTPRE)ldap_create.$(OBJEXT): \ + $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ + $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ + $(COM_ERR_DEPS) $(SRCTOP)/include/k5-err.h $(SRCTOP)/include/k5-int.h \ + $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ + $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ + $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_create.c ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_principal.h ldap_realm.h \ + ldap_services.h ldap_tkt_policy.h ldap_krbcontainer.so ldap_krbcontainer.po $(OUTPRE)ldap_krbcontainer.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -127,10 +155,14 @@ ldap_krbcontainer.so ldap_krbcontainer.po $(OUTPRE)ldap_krbcontainer.$(OBJEXT): $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.c ldap_krbcontainer.h ldap_main.h \ - ldap_misc.h ldap_realm.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.c \ + ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_realm.h \ + ldap_services.h ldap_principal.so ldap_principal.po $(OUTPRE)ldap_principal.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \ $(BUILDTOP)/include/gssrpc/types.h $(BUILDTOP)/include/krb5/krb5.h \ @@ -144,11 +176,14 @@ ldap_principal.so ldap_principal.po $(OUTPRE)ldap_principal.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_principal.c \ - ldap_principal.h ldap_realm.h ldap_services.h ldap_tkt_policy.h \ - princ_xdr.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_principal.c ldap_principal.h \ + ldap_realm.h ldap_services.h ldap_tkt_policy.h princ_xdr.h ldap_principal2.so ldap_principal2.po $(OUTPRE)ldap_principal2.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \ $(BUILDTOP)/include/gssrpc/types.h $(BUILDTOP)/include/krb5/krb5.h \ @@ -162,11 +197,15 @@ ldap_principal2.so ldap_principal2.po $(OUTPRE)ldap_principal2.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_principal.h \ - ldap_principal2.c ldap_pwd_policy.h ldap_realm.h ldap_services.h \ - ldap_tkt_policy.h princ_xdr.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_principal.h ldap_principal2.c \ + ldap_pwd_policy.h ldap_realm.h ldap_services.h ldap_tkt_policy.h \ + princ_xdr.h ldap_pwd_policy.so ldap_pwd_policy.po $(OUTPRE)ldap_pwd_policy.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -174,10 +213,14 @@ ldap_pwd_policy.so ldap_pwd_policy.po $(OUTPRE)ldap_pwd_policy.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_pwd_policy.c \ - ldap_pwd_policy.h ldap_realm.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_pwd_policy.c ldap_pwd_policy.h \ + ldap_realm.h ldap_services.h ldap_misc.so ldap_misc.po $(OUTPRE)ldap_misc.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -185,9 +228,13 @@ ldap_misc.so ldap_misc.po $(OUTPRE)ldap_misc.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_krbcontainer.h \ - ldap_misc.c ldap_misc.h ldap_realm.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_krbcontainer.h ldap_misc.c \ + ldap_misc.h ldap_realm.h ldap_services.h ldap_handle.so ldap_handle.po $(OUTPRE)ldap_handle.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -195,10 +242,13 @@ ldap_handle.so ldap_handle.po $(OUTPRE)ldap_handle.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_handle.c ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_realm.h \ - ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_handle.c ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_services.h ldap_tkt_policy.so ldap_tkt_policy.po $(OUTPRE)ldap_tkt_policy.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -206,10 +256,14 @@ ldap_tkt_policy.so ldap_tkt_policy.po $(OUTPRE)ldap_tkt_policy.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_realm.h \ - ldap_services.h ldap_tkt_policy.c ldap_tkt_policy.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_services.h \ + ldap_tkt_policy.c ldap_tkt_policy.h ldap_services.so ldap_services.po $(OUTPRE)ldap_services.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -217,10 +271,14 @@ ldap_services.so ldap_services.po $(OUTPRE)ldap_services.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_realm.h \ - ldap_services.c ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_services.c \ + ldap_services.h ldap_service_rights.so ldap_service_rights.po $(OUTPRE)ldap_service_rights.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -228,10 +286,14 @@ ldap_service_rights.so ldap_service_rights.po $(OUTPRE)ldap_service_rights.$(OBJ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_err.h ldap_handle.h \ - ldap_krbcontainer.h ldap_main.h ldap_misc.h ldap_realm.h \ - ldap_service_rights.c ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_err.h ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_service_rights.c \ + ldap_services.h princ_xdr.so princ_xdr.po $(OUTPRE)princ_xdr.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/gssapi/gssapi.h \ $(BUILDTOP)/include/gssrpc/types.h $(BUILDTOP)/include/krb5/krb5.h \ @@ -245,10 +307,13 @@ princ_xdr.so princ_xdr.po $(OUTPRE)princ_xdr.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_krbcontainer.h \ - ldap_principal.h ldap_realm.h ldap_tkt_policy.h princ_xdr.c \ - princ_xdr.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_krbcontainer.h ldap_principal.h ldap_realm.h \ + ldap_tkt_policy.h princ_xdr.c princ_xdr.h ldap_fetch_mkey.so ldap_fetch_mkey.po $(OUTPRE)ldap_fetch_mkey.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -256,10 +321,13 @@ ldap_fetch_mkey.so ldap_fetch_mkey.po $(OUTPRE)ldap_fetch_mkey.$(OBJEXT): \ $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_fetch_mkey.c \ - ldap_handle.h ldap_krbcontainer.h ldap_main.h ldap_misc.h \ - ldap_realm.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_fetch_mkey.c ldap_handle.h ldap_krbcontainer.h \ + ldap_main.h ldap_misc.h ldap_realm.h ldap_services.h ldap_service_stash.so ldap_service_stash.po $(OUTPRE)ldap_service_stash.$(OBJEXT): \ $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ @@ -267,30 +335,25 @@ ldap_service_stash.so ldap_service_stash.po $(OUTPRE)ldap_service_stash.$(OBJEXT $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/kdb/kdb5.h kdb_ldap.h ldap_handle.h ldap_krbcontainer.h \ - ldap_main.h ldap_misc.h ldap_realm.h ldap_service_stash.c \ - ldap_service_stash.h ldap_services.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h $(SRCTOP)/lib/kdb/kdb5.h \ + /var/raeburn/openldap/Install/include/lber.h /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + kdb_ldap.h ldap_handle.h ldap_krbcontainer.h ldap_main.h \ + ldap_misc.h ldap_realm.h ldap_service_stash.c ldap_service_stash.h \ + ldap_services.h kdb_xdr.so kdb_xdr.po $(OUTPRE)kdb_xdr.$(OBJEXT): $(BUILDTOP)/include/autoconf.h \ $(BUILDTOP)/include/krb5/krb5.h $(BUILDTOP)/include/osconf.h \ $(BUILDTOP)/include/profile.h $(COM_ERR_DEPS) $(SRCTOP)/include/k5-err.h \ $(SRCTOP)/include/k5-int.h $(SRCTOP)/include/k5-platform.h \ $(SRCTOP)/include/k5-plugin.h $(SRCTOP)/include/k5-thread.h \ $(SRCTOP)/include/kdb.h $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - kdb_xdr.c kdb_xdr.h + $(SRCTOP)/include/krb5/preauth_plugin.h $(SRCTOP)/include/port-sockets.h \ + $(SRCTOP)/include/socket-utils.h kdb_xdr.c kdb_xdr.h ldap_err.so ldap_err.po $(OUTPRE)ldap_err.$(OBJEXT): \ - $(BUILDTOP)/include/kdb5_err.h $(COM_ERR_DEPS) ldap_err.c \ - ldap_err.h -princ_key_encode_decode.so princ_key_encode_decode.po $(OUTPRE)princ_key_encode_decode.$(OBJEXT): \ - $(BUILDTOP)/include/autoconf.h $(BUILDTOP)/include/krb5/krb5.h \ - $(BUILDTOP)/include/osconf.h $(BUILDTOP)/include/profile.h \ - $(COM_ERR_DEPS) $(SRCTOP)/include/k5-err.h $(SRCTOP)/include/k5-int.h \ - $(SRCTOP)/include/k5-platform.h $(SRCTOP)/include/k5-plugin.h \ - $(SRCTOP)/include/k5-thread.h $(SRCTOP)/include/kdb.h \ - $(SRCTOP)/include/krb5.h $(SRCTOP)/include/krb5/locate_plugin.h \ - $(SRCTOP)/include/port-sockets.h $(SRCTOP)/include/socket-utils.h \ - $(SRCTOP)/lib/krb5/asn.1/krbasn1.h $(SRCTOP)/lib/krb5/asn.1/asn1_encode.h \ - $(SRCTOP)/lib/krb5/asn.1/asn1_decode.h $(SRCTOP)/lib/krb5/asn.1/asn1_make.h \ - $(SRCTOP)/lib/krb5/asn.1/asn1_get.h \ - princ_key_encode_decode.c princ_key_encode_decode.h + $(BUILDTOP)/include/kdb5_err.h $(COM_ERR_DEPS) /var/raeburn/openldap/Install/include/lber.h \ + /var/raeburn/openldap/Install/include/lber_types.h \ + /var/raeburn/openldap/Install/include/ldap.h /var/raeburn/openldap/Install/include/ldap_cdefs.h \ + /var/raeburn/openldap/Install/include/ldap_features.h \ + ldap_err.c ldap_err.h diff --git a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c index cd4c1f070..236ff190b 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/kdb_ldap.c @@ -435,3 +435,17 @@ prepend_err_str (krb5_context ctx, const char *str, krb5_error_code err, omsg = krb5_get_error_message (ctx, err); krb5_set_error_message (ctx, err, "%s %s", str, omsg); } + +extern krb5int_access accessor; +MAKE_INIT_FUNCTION(kldap_init_fn); + +int kldap_init_fn(void) +{ + /* Global (per-module) initialization. */ + return krb5int_accessor (&accessor, KRB5INT_ACCESS_VERSION); +} + +int kldap_ensure_initialized(void) +{ + return CALL_INIT_FUNCTION (kldap_init_fn); +} diff --git a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c index 2f3987cb0..cb0d4c50f 100644 --- a/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c +++ b/src/plugins/kdb/ldap/libkdb_ldap/ldap_principal2.c @@ -36,7 +36,6 @@ #include "ldap_tkt_policy.h" #include "ldap_pwd_policy.h" #include "ldap_err.h" -#include "princ_key_encode_decode.h" extern char* principal_attributes[]; extern char* max_pwd_life_attr[]; @@ -559,6 +558,46 @@ cleanup: return st; } +krb5int_access accessor; +extern int kldap_ensure_initialized (void); + +static krb5_error_code +asn1_encode_sequence_of_keys (krb5_key_data *key_data, krb5_int16 n_key_data, + krb5_int32 mkvno, krb5_data **code) +{ + krb5_error_code err; + + /* + * This should be pushed back into other library initialization + * code. + */ + err = kldap_ensure_initialized (); + if (err) + return err; + + return accessor.asn1_ldap_encode_sequence_of_keys(key_data, n_key_data, + mkvno, code); +} + +static krb5_error_code +asn1_decode_sequence_of_keys (krb5_data *in, krb5_key_data **out, + krb5_int16 *n_key_data, int *mkvno) +{ + krb5_error_code err; + + /* + * This should be pushed back into other library initialization + * code. + */ + err = kldap_ensure_initialized (); + if (err) + return err; + + return accessor.asn1_ldap_decode_sequence_of_keys(in, out, n_key_data, + mkvno); +} + + /* Decoding ASN.1 encoded key */ static struct berval ** krb5_encode_krbsecretkey(krb5_key_data *key_data, int n_key_data) { diff --git a/src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.h b/src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.h deleted file mode 100644 index aed83f11b..000000000 --- a/src/plugins/kdb/ldap/libkdb_ldap/princ_key_encode_decode.h +++ /dev/null @@ -1,9 +0,0 @@ -krb5_error_code asn1_encode_sequence_of_keys (krb5_key_data *key_data, - krb5_int16 n_key_data, - krb5_int32 mkvno, - krb5_data **code); - -krb5_error_code asn1_decode_sequence_of_keys (krb5_data *in, - krb5_key_data **out, - krb5_int16 *n_key_data, - int *mkvno); -- 2.26.2