krb5.h, which is built after util/et, which is built after the support
authorKen Raeburn <raeburn@mit.edu>
Wed, 8 Mar 2006 02:56:48 +0000 (02:56 +0000)
committerKen Raeburn <raeburn@mit.edu>
Wed, 8 Mar 2006 02:56:48 +0000 (02:56 +0000)
code.

Fix: Put service location decls in k5-locate.h, pull plugin support
decls out of k5-int.h into k5-plugin.h, and make it stand on its own,
which includes changing the return type from krb5_error_code to
int32_t.

Oops: The plugin support code included k5-int.h, which includes

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17707 dc483132-0cff-0310-8789-dd5450dbe970

src/include/ChangeLog
src/include/k5-int.h
src/include/k5-locate.h [new file with mode: 0644]
src/include/k5-plugin.h
src/lib/krb5/os/ChangeLog
src/lib/krb5/os/locate_kdc.c
src/plugins/locate/python/ChangeLog
src/plugins/locate/python/py-locate.c
src/util/support/ChangeLog
src/util/support/plugins.c

index 9dad2a2564c9983be04fb06c7ac9297d631b15fb..4065aae96a27dbbaf9014b29ee67a6d9313833f1 100644 (file)
@@ -1,3 +1,11 @@
+2006-03-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * k5-locate.h: Renamed from k5-plugin.h.
+       * k5-plugin.h: New file, with plugin support function declarations
+       moved from k5-int.h.  Change return types from krb5_error_code to
+       int32_t.
+       * k5-int.h: Include both of them.
+
 2006-03-06  Ken Raeburn  <raeburn@mit.edu>
 
        * k5-plugin.h: New file.
index bf068828e8e3d86a22c177ac032c675cc68a1862..ff8b342057ef361c90372f78288422468e173a2e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 1989,1990,1991,1992,1993,1994,1995,2000,2001, 2003 by the Massachusetts Institute of Technology,
+ * Copyright (C) 1989,1990,1991,1992,1993,1994,1995,2000,2001, 2003,2006 by the Massachusetts Institute of Technology,
  * Cambridge, MA, USA.  All Rights Reserved.
  * 
  * This software is being provided to you, the LICENSEE, by the 
@@ -535,7 +535,7 @@ 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"
+#include "k5-locate.h"
 krb5_error_code
 krb5int_locate_server (krb5_context, const krb5_data *realm,
                       struct addrlist *, enum locate_service_type svc,
@@ -1009,38 +1009,7 @@ 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));
+#include "k5-plugin.h"
 
 struct _krb5_context {
        krb5_magic      magic;
diff --git a/src/include/k5-locate.h b/src/include/k5-locate.h
new file mode 100644 (file)
index 0000000..a49c79a
--- /dev/null
@@ -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
index a49c79ad241366e57633b1f77bbc20a0caf99d11..2ce5b9f972e28d08e52bce1d004d148450e3a110 100644 (file)
@@ -1,30 +1,93 @@
-#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
-};
+/*
+ * Copyright (C) 2006 Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ * 
+ * This software is being provided to you, the LICENSEE, by the 
+ * Massachusetts Institute of Technology (M.I.T.) under the following 
+ * license.  By obtaining, using and/or copying this software, you agree 
+ * that you have read, understood, and will comply with these terms and 
+ * conditions:  
+ * 
+ * Export of this software from the United States of America may
+ * require a specific license from the United States Government.
+ * It is the responsibility of any person or organization contemplating
+ * export to obtain such a license before exporting.
+ * 
+ * WITHIN THAT CONSTRAINT, permission to use, copy, modify and distribute 
+ * this software and its documentation for any purpose and without fee or 
+ * royalty is hereby granted, provided that you agree to comply with the 
+ * following copyright notice and statements, including the disclaimer, and 
+ * that the same appear on ALL copies of the software and documentation, 
+ * including modifications that you make for internal use or for 
+ * distribution:
+ * 
+ * THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. MAKES NO REPRESENTATIONS 
+ * OR WARRANTIES, EXPRESS OR IMPLIED.  By way of example, but not 
+ * limitation, M.I.T. MAKES NO REPRESENTATIONS OR WARRANTIES OF 
+ * MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT THE USE OF 
+ * THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE ANY THIRD PARTY 
+ * PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.   
+ * 
+ * The name of the Massachusetts Institute of Technology or M.I.T. may NOT 
+ * be used in advertising or publicity pertaining to distribution of the 
+ * software.  Title to copyright in this software and any associated 
+ * documentation shall at all times remain with M.I.T., and USER agrees to 
+ * preserve same.
+ *
+ * Furthermore if you modify this software you must label
+ * your software as modified software and not distribute it in such a
+ * fashion that it might be confused with the original M.I.T. software.  
+ */
 
-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);
-};
+/* Just those definitions which are needed by util/support/plugins.c,
+   which gets compiled before util/et is built, which happens before
+   we can construct krb5.h, which is included by k5-int.h.
+
+   So, no krb5 types.  */
+
+#if defined(_MSDOS) || defined(_WIN32)
+#include "win-mac.h"
 #endif
+#include "autoconf.h"
+#ifndef KRB5_CALLCONV
+#define KRB5_CALLCONV
+#define KRB5_CALLCONV_C
+#endif
+
+#ifdef HAVE_STDINT_H
+# include <stdint.h>
+#elif defined(HAVE_INTTYPES_H)
+# include <inttypes.h>
+#endif
+
+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)
+
+int32_t KRB5_CALLCONV
+krb5int_open_plugin (const char *, struct plugin_file_handle **);
+
+int32_t KRB5_CALLCONV
+krb5int_get_plugin_data (struct plugin_file_handle *, const char *, void **);
+
+int32_t KRB5_CALLCONV
+krb5int_get_plugin_func (struct plugin_file_handle *, const char *,
+                        void (**)());
+
+void KRB5_CALLCONV
+krb5int_close_plugin (struct plugin_file_handle *);
+
+int32_t 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 **);
+int32_t KRB5_CALLCONV krb5int_get_plugin_dir_data (struct plugin_dir_handle *,
+                                                  const char *, void ***);
+void KRB5_CALLCONV krb5int_free_plugin_dir_func (void (**)(void));
+int32_t KRB5_CALLCONV krb5int_get_plugin_dir_func (struct plugin_dir_handle *,
+                                                  const char *, void (***)(void));
index 889a8f314bc45cb427ec826e9f62793313d7da3d..0b02869b306b67d7900d7eb96d868ccbd3fc0f01 100644 (file)
@@ -1,3 +1,7 @@
+2006-03-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * locate_kdc.c: Include k5-locate.h instead of k5-plugin.h.
+
 2006-03-06  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in (DEFINES): New variable.
index e751ca24d075cb8271e4c94c588287f87233a6c6..bed9c932f65db0e5e366ed8a6cef9c26945671b4 100644 (file)
@@ -543,7 +543,7 @@ krb5_locate_srv_dns_1 (const krb5_data *realm,
 }
 #endif
 
-#include "k5-plugin.h"
+#include "k5-locate.h"
 
 static const char objdir[] = LIBDIR "/krb5/plugins/libkrb5";
 
index 6824a2945e0dd5b8f1093a896d3256020fe23d1c..897919e11059ad44729ea4f57acfd9610caf2524 100644 (file)
@@ -1,3 +1,7 @@
+2006-03-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * py-locate.c: Include k5-locate.h instead of k5-plugin.h.
+
 2006-03-06  Ken Raeburn  <raeburn@mit.edu>
 
        * Makefile.in, configure.in, py-locate.c, python.exports,
index a315e35552d333aa92e5ab6bfbe48b633fff77d1..548210a6bde8bcb7d8af9fad5baa658ce5945071 100644 (file)
@@ -66,7 +66,7 @@
 #include <errno.h>
 #include "k5-int.h"
 
-#include "k5-plugin.h"
+#include "k5-locate.h"
 
 #define LIBDIR                 "/tmp" /* should be imported from configure */
 #define SCRIPT_PATH            LIBDIR "/krb5/locate-service.py"
index 4ec482f24323c0d0e518b54d8cddd394cae194c2..6de06486230f93d39d4a17511d2bc71d654def84 100644 (file)
@@ -1,3 +1,13 @@
+2006-03-07  Ken Raeburn  <raeburn@mit.edu>
+
+       * plugins.c: Don't include k5-int.h, it depends on krb5.h which
+       hasn't been built yet.  Instead, include k5-plugin.h and a bunch
+       of system headers.
+       (krb5int_open_plugin, krb5int_get_plugin_data,
+       krb5int_get_plugin_func, krb5int_open_plugin_dir,
+       krb5int_get_plugin_dir_data, krb5int_get_plugin_dir_func): Change
+       return types from krb5_error_code to int32_t.
+
 2006-03-06  Ken Raeburn  <raeburn@mit.edu>
 
        * plugins.c: New file.
index bc93aa2b4c32969fad12b7e714547a5b152eeede..206ccb5df64035ab415190e2b4423c8a4d3b4578 100644 (file)
  * Plugin module support, and shims around dlopen/whatever.
  */
 
-#include "k5-int.h"
+#include "k5-plugin.h"
 #include <dlfcn.h>
+#include <stdio.h>
+#include <sys/types.h>
+#ifdef HAVE_SYS_STAT_H
+#include <sys/stat.h>
+#endif
+#ifdef HAVE_SYS_PARAM_H
+#include <sys/param.h>
+#endif
+#include <errno.h>
+#include <stdlib.h>
+#include <string.h>
+#ifdef HAVE_UNISTD_H
+#include <unistd.h>
+#endif
 
 #include <stdarg.h>
 static void Tprintf (const char *fmt, ...)
@@ -54,7 +68,7 @@ struct plugin_file_handle {
 #endif
 };
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_open_plugin (const char *filename, struct plugin_file_handle **h)
 {
     struct plugin_file_handle *htmp;
@@ -78,7 +92,7 @@ krb5int_open_plugin (const char *filename, struct plugin_file_handle **h)
     return 0;
 }
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_get_plugin_data (struct plugin_file_handle *h, const char *csymname,
                         void **ptr)
 {
@@ -95,7 +109,7 @@ krb5int_get_plugin_data (struct plugin_file_handle *h, const char *csymname,
     return 0;
 }
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_get_plugin_func (struct plugin_file_handle *h, const char *csymname,
                         void (**ptr)())
 {
@@ -105,7 +119,7 @@ krb5int_get_plugin_func (struct plugin_file_handle *h, const char *csymname,
        handling is the same for both data and functions.  (And the
        casting we do here works, etc.)  */
     void *dptr;
-    krb5_error_code err;
+    int32_t err;
 
     err = krb5int_get_plugin_data (h, csymname, &dptr);
     if (err == 0)
@@ -137,7 +151,7 @@ krb5int_close_plugin (struct plugin_file_handle *h)
 #endif
 #endif
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_open_plugin_dir (const char *dirname,
                         struct plugin_dir_handle *dirhandle)
 {
@@ -235,7 +249,7 @@ krb5int_free_plugin_dir_data (void **ptrs)
     free(ptrs);
 }
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_get_plugin_dir_data (struct plugin_dir_handle *dirhandle,
                             const char *symname,
                             void ***ptrs)
@@ -297,7 +311,7 @@ krb5int_free_plugin_dir_func (void (**ptrs)(void))
     free(ptrs);
 }
 
-krb5_error_code KRB5_CALLCONV
+int32_t KRB5_CALLCONV
 krb5int_get_plugin_dir_func (struct plugin_dir_handle *dirhandle,
                             const char *symname,
                             void (***ptrs)(void))