summaryrefslogtreecommitdiffstats
path: root/src/include
diff options
context:
space:
mode:
authorKen Raeburn <raeburn@mit.edu>2006-03-07 20:45:24 +0000
committerKen Raeburn <raeburn@mit.edu>2006-03-07 20:45:24 +0000
commit8f09bfe9fa0e51c2bd1e2f533eb25655e88ca43b (patch)
tree68c4097fc6650d9d2952fdc0b242263b60ae7f95 /src/include
parentca39d95f3cb9681664d3761f4c0c2ec23d36dfd3 (diff)
downloadkrb5-8f09bfe9fa0e51c2bd1e2f533eb25655e88ca43b.tar.gz
krb5-8f09bfe9fa0e51c2bd1e2f533eb25655e88ca43b.tar.xz
krb5-8f09bfe9fa0e51c2bd1e2f533eb25655e88ca43b.zip
Merge from plugin branch
Add plugin support: - plugin routines in support library (may break windows build!) - plugin support in KDC location code - sample Python-based plugin for KDC location, not built without tweaking sources - changed service location interface to use an enum instead of passing profile string and DNS strings and port numbers - changed pathnames for plugin locations, including kdb back end - remove locate_service from accessor API Also, do build shared libraries for Darwin just like any other UNIX box. Not present yet: - use new plugin interface for kdb back end - Windows support - Mac bundle support (but dlopen support works) - search path for libkrb5 plugins (only one hard-coded directory for now) - sorting of plugin collections for predictable ordering See the various ChangeLogs for specifics. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17706 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/include')
-rw-r--r--src/include/ChangeLog21
-rw-r--r--src/include/k5-int.h74
-rw-r--r--src/include/k5-plugin.h30
-rw-r--r--src/include/krb5/ChangeLog5
-rw-r--r--src/include/krb5/Makefile.in2
-rw-r--r--src/include/krb5/stock/ChangeLog6
-rw-r--r--src/include/krb5/stock/osconf.h4
7 files changed, 117 insertions, 25 deletions
diff --git a/src/include/ChangeLog b/src/include/ChangeLog
index 422de1cb5..9dad2a256 100644
--- a/src/include/ChangeLog
+++ b/src/include/ChangeLog
@@ -1,3 +1,24 @@
+2006-03-06 Ken Raeburn <raeburn@mit.edu>
+
+ * k5-plugin.h: New file.
+ * k5-int.h: Include k5-plugin.h.
+ (struct plugin_file_handle): Declare.
+ (struct plugin_dir_handle): Define.
+ (PLUGIN_DIR_INIT, PLUGIN_DIR_OPEN): New macros.
+ (krb5int_open_plugin, krb5int_close_plugin,
+ krb5int_get_plugin_data, krb5int_get_plugin_func,
+ krb5int_open_plugin_dir, krb5int_close_plugin_dir,
+ krb5int_get_plugin_dir_data, krb5int_get_plugin_dir_func,
+ krb5int_free_plugin_dir_data, krb5int_free_plugin_dir_func):
+ Declare.
+ (struct _krb5_context): Add fields for holding some plugin data.
+ (KRB5INT_ACCESS_STRUCT_VERSION): Bump.
+ (struct _krb5int_access): Remove locate_server field.
+ (struct addrlist): Use an undefined struct tag if fake-addrinfo.h
+ hasn't been included yet. Add free-function and callback pointer
+ fields.
+ (krb5int_locate_server): Update prototype.
+
2006-02-24 Jeffrey Altman <jaltman@mit.edu>
* win-mac.h: support for 64-bit Windows builds
diff --git a/src/include/k5-int.h b/src/include/k5-int.h
index 3f8c60da7..bf068828e 100644
--- a/src/include/k5-int.h
+++ b/src/include/k5-int.h
@@ -517,7 +517,15 @@ krb5_error_code krb5_os_hostaddr
/* N.B.: You need to include fake-addrinfo.h *before* k5-int.h if you're
going to use this structure. */
struct addrlist {
- struct addrinfo **addrs;
+ struct {
+#ifdef FAI_DEFINED
+ struct addrinfo *ai;
+#else
+ struct undefined_addrinfo *ai;
+#endif
+ void (*freefn)(void *);
+ void *data;
+ } *addrs;
int naddrs;
int space;
};
@@ -527,24 +535,11 @@ extern int krb5int_grow_addrlist (struct addrlist *, int);
extern int krb5int_add_host_to_list (struct addrlist *, const char *,
int, int, int, int);
+#include "k5-plugin.h"
krb5_error_code
-krb5int_locate_server (krb5_context,
- const krb5_data *realm,
- struct addrlist *,
- /* Only meaningful for kdc, really... */
- int want_masters,
- /* look up [realms]->$realm->$name in krb5.conf */
- const char *profilename,
- /* SRV record lookup */
- const char *dnsname,
- int is_stream_service,
- /* Port numbers, in network order! For profile
- version only, DNS code gets port numbers
- itself. Use 0 for dflport2 if there's no
- secondary port (most common, except kdc
- case). */
- int dflport1, int dflport2,
- int family);
+krb5int_locate_server (krb5_context, const krb5_data *realm,
+ struct addrlist *, enum locate_service_type svc,
+ int sockettype, int family);
#endif /* KRB5_LIBOS_PROTO__ */
@@ -1015,6 +1010,38 @@ void KRB5_CALLCONV krb5_free_pa_enc_ts
/* #include "krb5/wordsize.h" -- comes in through base-defs.h. */
#include "com_err.h"
+struct plugin_file_handle; /* opaque */
+
+struct plugin_dir_handle {
+ /* This points to a list of plugin_file_handle structs, terminated
+ by one passing NULL_HANDLE. */
+ struct plugin_file_handle *files;
+};
+#define PLUGIN_DIR_INIT(P) ((P)->files = NULL)
+#define PLUGIN_DIR_OPEN(P) ((P)->files != NULL)
+
+krb5_error_code KRB5_CALLCONV
+krb5int_open_plugin (const char *, struct plugin_file_handle **);
+
+krb5_error_code KRB5_CALLCONV
+krb5int_get_plugin_data (struct plugin_file_handle *, const char *, void **);
+
+krb5_error_code KRB5_CALLCONV
+krb5int_get_plugin_func (struct plugin_file_handle *, const char *,
+ void (**)());
+
+void KRB5_CALLCONV
+krb5int_close_plugin (struct plugin_file_handle *);
+
+krb5_error_code KRB5_CALLCONV krb5int_open_plugin_dir (const char *, struct plugin_dir_handle *);
+void KRB5_CALLCONV krb5int_close_plugin_dir (struct plugin_dir_handle *);
+void KRB5_CALLCONV krb5int_free_plugin_dir_data (void **);
+krb5_error_code KRB5_CALLCONV krb5int_get_plugin_dir_data (struct plugin_dir_handle *,
+ const char *, void ***);
+void KRB5_CALLCONV krb5int_free_plugin_dir_func (void (**)(void));
+krb5_error_code KRB5_CALLCONV krb5int_get_plugin_dir_func (struct plugin_dir_handle *,
+ const char *, void (***)(void));
+
struct _krb5_context {
krb5_magic magic;
krb5_enctype *in_tkt_ktypes;
@@ -1066,6 +1093,11 @@ struct _krb5_context {
#ifdef KRB5_DNS_LOOKUP
krb5_boolean profile_in_memory;
#endif /* KRB5_DNS_LOOKUP */
+
+ /* locate_kdc module stuff */
+ struct plugin_dir_handle libkrb5_plugins;
+ struct krb5plugin_service_locate_ftable *vtbl;
+ void (**locate_fptrs)(void);
};
/* could be used in a table to find an etype and initialize a block */
@@ -1661,7 +1693,7 @@ void krb5int_free_srv_dns_data(struct srv_dns_entry *);
/* To keep happy libraries which are (for now) accessing internal stuff */
/* Make sure to increment by one when changing the struct */
-#define KRB5INT_ACCESS_STRUCT_VERSION 9
+#define KRB5INT_ACCESS_STRUCT_VERSION 10
#ifndef ANAME_SZ
struct ktext; /* from krb.h, for krb524 support */
@@ -1675,10 +1707,6 @@ typedef struct _krb5int_access {
unsigned int icount, const krb5_data *input,
krb5_data *output);
/* service location and communication */
- krb5_error_code (*locate_server) (krb5_context, const krb5_data *,
- struct addrlist *, int,
- const char *, const char *,
- int, int, int, int);
krb5_error_code (*sendto_udp) (krb5_context, const krb5_data *msg,
const struct addrlist *, krb5_data *reply,
struct sockaddr *, socklen_t *, int *);
diff --git a/src/include/k5-plugin.h b/src/include/k5-plugin.h
new file mode 100644
index 000000000..a49c79ad2
--- /dev/null
+++ b/src/include/k5-plugin.h
@@ -0,0 +1,30 @@
+#ifndef K5_PLUGIN_H_INCLUDED
+#define K5_PLUGIN_H_INCLUDED
+#include "krb5.h"
+
+enum locate_service_type {
+ locate_service_kdc = 1,
+ locate_service_master_kdc,
+ locate_service_kadmin,
+ locate_service_krb524,
+ locate_service_kpasswd
+};
+
+struct krb5plugin_service_locate_ftable {
+ int vmajor, vminor;
+ /* Per-context setup and teardown. Returned void* blob is
+ private to the plugin. */
+ krb5_error_code (*init)(krb5_context, void **);
+ void (*fini)(void *);
+ /* Callback function returns non-zero if the plugin function
+ should quit and return; this may be because of an error, or may
+ indicate we've already contacted the service, whatever. The
+ lookup function should only return an error if it detects a
+ problem, not if the callback function tells it to quit. */
+ krb5_error_code (*lookup)(void *,
+ enum locate_service_type svc, const char *realm,
+ int socktype, int family,
+ int (*cbfunc)(void *,int,struct sockaddr *),
+ void *cbdata);
+};
+#endif
diff --git a/src/include/krb5/ChangeLog b/src/include/krb5/ChangeLog
index dcce9d0a7..bbc1d8b97 100644
--- a/src/include/krb5/ChangeLog
+++ b/src/include/krb5/ChangeLog
@@ -1,3 +1,8 @@
+2006-03-06 Ken Raeburn <raeburn@mit.edu>
+
+ * Makefile.in (PROCESS_REPLACE): Use MODULE_DIR instead of
+ KRB5_DB_MODULE_DIR.
+
2005-11-17 Ken Raeburn <raeburn@mit.edu>
* Makefile.in (osconf.h): Always remove osconf.new.
diff --git a/src/include/krb5/Makefile.in b/src/include/krb5/Makefile.in
index 429b35515..7ef43d413 100644
--- a/src/include/krb5/Makefile.in
+++ b/src/include/krb5/Makefile.in
@@ -47,7 +47,7 @@ PROCESS_REPLACE = -e "s+@KRB5RCTMPDIR+$(KRB5RCTMPDIR)+" \
-e "s+@BINDIR+$(BINDIR)+" \
-e "s+@LIBDIR+$(LIBDIR)+" \
-e "s+@SBINDIR+$(SBINDIR)+" \
- -e "s+@MODULEDIR+$(KRB5_DB_MODULE_DIR)+" \
+ -e "s+@MODULEDIR+$(MODULE_DIR)+" \
-e 's+@LOCALSTATEDIR+$(LOCALSTATEDIR)+' \
-e 's+@SYSCONFDIR+$(SYSCONFDIR)+'
diff --git a/src/include/krb5/stock/ChangeLog b/src/include/krb5/stock/ChangeLog
index cfa6cb4de..c341acea6 100644
--- a/src/include/krb5/stock/ChangeLog
+++ b/src/include/krb5/stock/ChangeLog
@@ -1,3 +1,9 @@
+2006-03-06 Ken Raeburn <raeburn@mit.edu>
+
+ * osconf.h (DEFAULT_KDB_LIB_PATH): Add "/kdb" on end of
+ MODULEDIR.
+ (MODULE_PATH): New macro.
+
2005-06-29 Ken Raeburn <raeburn@mit.edu>
* osconf.h (DEFAULT_KDB_LIB_PATH): Use @MODULEDIR. Don't use a
diff --git a/src/include/krb5/stock/osconf.h b/src/include/krb5/stock/osconf.h
index 367109b11..03b2ce651 100644
--- a/src/include/krb5/stock/osconf.h
+++ b/src/include/krb5/stock/osconf.h
@@ -63,7 +63,9 @@
/* Location of KDC profile */
#define DEFAULT_KDC_PROFILE "@LOCALSTATEDIR/krb5kdc/kdc.conf"
#define KDC_PROFILE_ENV "KRB5_KDC_PROFILE"
-#define DEFAULT_KDB_LIB_PATH { "@MODULEDIR", NULL }
+
+#define DEFAULT_KDB_LIB_PATH { "@MODULEDIR/kdb", NULL }
+#define MODULE_PATH "@MODULEDIR"
#define DEFAULT_KDC_ENCTYPE ENCTYPE_DES3_CBC_SHA1
#define KDCRCACHE "dfl:krb5kdc_rcache"