Replace keytab function-table dispatch macros in krb5.h with functions defined
authorKen Raeburn <raeburn@mit.edu>
Fri, 12 Oct 2001 22:49:02 +0000 (22:49 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 12 Oct 2001 22:49:02 +0000 (22:49 +0000)
in krb5 library.  Make keytab-related structures internal.

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

src/include/ChangeLog
src/include/k5-int.h
src/include/krb5.hin
src/lib/krb5/keytab/ChangeLog
src/lib/krb5/keytab/Makefile.in
src/lib/krb5/keytab/ktfns.c [new file with mode: 0644]

index ff5b9937c675c989cebb95b59df347731a393cdf..8f044af33c8586b458c7bfa0e043396b2319912b 100644 (file)
@@ -1,3 +1,13 @@
+2001-10-12  Ken Raeburn  <raeburn@mit.edu>
+
+       * k5-int.h (struct _krb5_kt_ops, krb5_kt_ops, krb5_kt_dfl_ops):
+       Definitions and declarations moved here...
+       * krb5.hin: ...from here.
+       (krb5_kt_get_type, krb5_kt_get_name, krb5_kt_close,
+       krb5_kt_get_entry, krb5_kt_start_seq_get, krb5_kt_next_entry,
+       krb5_kt_end_seq_get): Replaced macro definitions with declarations
+       for functions now in lib/krb5/keytab/ktfns.c.
+
 2001-10-09  Ken Raeburn  <raeburn@mit.edu>
 
        * fake-stdlib.h: Make prototypes unconditional.
index 1edd2a13578b71cf04a64e1fbaeb03e2bde4939b..b7f0c62922af2fcd244a93f7042ee64c25f1a47a 100644 (file)
@@ -1606,12 +1606,62 @@ struct _krb5_rc_ops {
 
 typedef struct _krb5_rc_ops krb5_rc_ops;
 
-krb5_error_code krb5_rc_register_type 
-       (krb5_context,
-               krb5_rc_ops *);
+krb5_error_code krb5_rc_register_type (krb5_context, krb5_rc_ops *);
 
 extern krb5_rc_ops krb5_rc_dfl_ops;
 
+typedef struct _krb5_kt_ops {
+    krb5_magic magic;
+    char *prefix;
+    /* routines always present */
+    krb5_error_code (KRB5_CALLCONV *resolve) 
+       (krb5_context,
+                krb5_const char *,
+                krb5_keytab *);
+    krb5_error_code (KRB5_CALLCONV *get_name) 
+       (krb5_context,
+                krb5_keytab,
+                char *,
+                unsigned int);
+    krb5_error_code (KRB5_CALLCONV *close) 
+       (krb5_context,
+                krb5_keytab);
+    krb5_error_code (KRB5_CALLCONV *get) 
+       (krb5_context,
+                krb5_keytab,
+                krb5_const_principal,
+                krb5_kvno,
+                krb5_enctype,
+                krb5_keytab_entry *);
+    krb5_error_code (KRB5_CALLCONV *start_seq_get) 
+       (krb5_context,
+                krb5_keytab,
+                krb5_kt_cursor *);     
+    krb5_error_code (KRB5_CALLCONV *get_next) 
+       (krb5_context,
+                krb5_keytab,
+                krb5_keytab_entry *,
+                krb5_kt_cursor *);
+    krb5_error_code (KRB5_CALLCONV *end_get) 
+       (krb5_context,
+                krb5_keytab,
+                krb5_kt_cursor *);
+    /* routines to be included on extended version (write routines) */
+    krb5_error_code (KRB5_CALLCONV *add) 
+       (krb5_context,
+                krb5_keytab,
+                krb5_keytab_entry *);
+    krb5_error_code (KRB5_CALLCONV *remove) 
+       (krb5_context,
+                krb5_keytab,
+                 krb5_keytab_entry *);
+
+    /* Handle for serializer */
+    void * serializer;
+} krb5_kt_ops;
+
+extern krb5_kt_ops krb5_kt_dfl_ops;
+
 extern krb5_error_code krb5int_translate_gai_error (int);
 
 #endif /* _KRB5_INT_H */
index ee37016d7195dd46cec7ba259767ad163caee033..11735963156f5cc7c2bb5b4634abe809f06bf0be 100644 (file)
@@ -1218,75 +1218,33 @@ typedef struct krb5_keytab_entry_st {
 } krb5_keytab_entry;
 
 
+struct _krb5_kt_ops;
 typedef struct _krb5_kt {
     krb5_magic magic;
     struct _krb5_kt_ops *ops;
     krb5_pointer data;
 } *krb5_keytab;
 
-
-typedef struct _krb5_kt_ops {
-    krb5_magic magic;
-    char *prefix;
-    /* routines always present */
-    krb5_error_code (KRB5_CALLCONV *resolve) 
-       (krb5_context,
-                krb5_const char *,
-                krb5_keytab *);
-    krb5_error_code (KRB5_CALLCONV *get_name) 
-       (krb5_context,
-                krb5_keytab,
-                char *,
-                unsigned int);
-    krb5_error_code (KRB5_CALLCONV *close) 
-       (krb5_context,
-                krb5_keytab);
-    krb5_error_code (KRB5_CALLCONV *get) 
-       (krb5_context,
-                krb5_keytab,
-                krb5_const_principal,
-                krb5_kvno,
-                krb5_enctype,
-                krb5_keytab_entry *);
-    krb5_error_code (KRB5_CALLCONV *start_seq_get) 
-       (krb5_context,
-                krb5_keytab,
-                krb5_kt_cursor *);     
-    krb5_error_code (KRB5_CALLCONV *get_next) 
-       (krb5_context,
-                krb5_keytab,
-                krb5_keytab_entry *,
-                krb5_kt_cursor *);
-    krb5_error_code (KRB5_CALLCONV *end_get) 
-       (krb5_context,
-                krb5_keytab,
-                krb5_kt_cursor *);
-    /* routines to be included on extended version (write routines) */
-    krb5_error_code (KRB5_CALLCONV *add) 
-       (krb5_context,
-                krb5_keytab,
-                krb5_keytab_entry *);
-    krb5_error_code (KRB5_CALLCONV *remove) 
-       (krb5_context,
-                krb5_keytab,
-                 krb5_keytab_entry *);
-
-    /* Handle for serializer */
-    void * serializer;
-} krb5_kt_ops;
-
-#define krb5_kt_get_type(context, keytab) ((keytab)->ops->prefix)
-#define krb5_kt_get_name(context, keytab, name, namelen) krb5_x((keytab)->ops->get_name,(context, keytab,name,namelen))
-#define krb5_kt_close(context, keytab) krb5_x((keytab)->ops->close,(context, keytab))
-#define krb5_kt_get_entry(context, keytab, principal, vno, enctype, entry) krb5_x((keytab)->ops->get,(context, keytab, principal, vno, enctype, entry))
-#define krb5_kt_start_seq_get(context, keytab, cursor) krb5_x((keytab)->ops->start_seq_get,(context, keytab, cursor))
-#define krb5_kt_next_entry(context, keytab, entry, cursor) krb5_x((keytab)->ops->get_next,(context, keytab, entry, cursor))
-#define krb5_kt_end_seq_get(context, keytab, cursor) krb5_x((keytab)->ops->end_get,(context, keytab, cursor))
-/* remove and add are functions, so that they can return NOWRITE
-   if not a writable keytab */
-
-
-extern krb5_kt_ops krb5_kt_dfl_ops;
+char *
+krb5_kt_get_type (krb5_context, krb5_keytab keytab);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name,
+                unsigned int namelen);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_close(krb5_context context, krb5_keytab keytab);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_get_entry(krb5_context context, krb5_keytab keytab,
+                 krb5_const_principal principal, krb5_kvno vno,
+                 krb5_enctype enctype, krb5_keytab_entry *entry);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab,
+                     krb5_kt_cursor *cursor);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_next_entry(krb5_context context, krb5_keytab keytab,
+                  krb5_keytab_entry *entry, krb5_kt_cursor *cursor);
+krb5_error_code KRB5_CALLCONV
+krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab,
+                   krb5_kt_cursor *cursor);
 
 /*
  * end "keytab.h"
@@ -1563,7 +1521,7 @@ krb5_error_code KRB5_CALLCONV krb5_chpw_result_code_string
 /* libkt.spec */
 krb5_error_code KRB5_CALLCONV krb5_kt_register
        (krb5_context,
-               krb5_kt_ops * );
+               struct _krb5_kt_ops * );
 krb5_error_code KRB5_CALLCONV krb5_kt_resolve
        (krb5_context,
                krb5_const char *,
index 95679384c56738100422ef8db258da0fb8eeca46..6378197625661a34182b3db996010ee5678d59bb 100644 (file)
@@ -1,3 +1,8 @@
+2001-10-12  Ken Raeburn  <raeburn@mit.edu>
+
+       * ktfns.c: New file.
+       * Makefile.in (STLIBOBJS, OBJS, SRCS): Build it.
+
 2001-10-09  Ken Raeburn  <raeburn@mit.edu>
 
        * ktbase.c: Make prototypes unconditional.
index bc677eb37937b9526f6fd8e63189b8b9d9dff399..532d4003278648256f7b7e74255dbc442ed81409 100644 (file)
@@ -17,6 +17,7 @@ STLIBOBJS= \
        ktdefault.o     \
        ktfr_entry.o    \
        ktremove.o      \
+       ktfns.o         \
        read_servi.o
 
 OBJS=  \
@@ -25,6 +26,7 @@ OBJS= \
        $(OUTPRE)ktdefault.$(OBJEXT)    \
        $(OUTPRE)ktfr_entry.$(OBJEXT)   \
        $(OUTPRE)ktremove.$(OBJEXT)     \
+       $(OUTPRE)ktfns.$(OBJEXT)        \
        $(OUTPRE)read_servi.$(OBJEXT)
 
 SRCS=  \
@@ -33,6 +35,7 @@ SRCS= \
        $(srcdir)/ktdefault.c   \
        $(srcdir)/ktfr_entry.c  \
        $(srcdir)/ktremove.c    \
+       $(srcdir)/ktfns.c       \
        $(srcdir)/read_servi.c
 
 all-windows:: subdirs $(OBJFILE)
diff --git a/src/lib/krb5/keytab/ktfns.c b/src/lib/krb5/keytab/ktfns.c
new file mode 100644 (file)
index 0000000..25e14b6
--- /dev/null
@@ -0,0 +1,79 @@
+/*
+ * lib/krb5/keytab/ktfns.c
+ *
+ * Copyright 2001 by the Massachusetts Institute of Technology.
+ * All Rights Reserved.
+ *
+ * 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 is hereby granted, provided that the above copyright
+ * notice appear in all copies and that both that copyright notice and
+ * this permission notice appear in supporting documentation, and that
+ * the name of M.I.T. not be used in advertising or publicity pertaining
+ * to distribution of the software without specific, written prior
+ * permission.  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.
+ * M.I.T. makes no representations about the suitability of
+ * this software for any purpose.  It is provided "as is" without express
+ * or implied warranty.
+ */
+
+/*
+ * Dispatch methods for keytab code.
+ */
+
+#include "k5-int.h"
+
+char *
+krb5_kt_get_type (krb5_context context, krb5_keytab keytab)
+{
+    return keytab->ops->prefix;
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_get_name(krb5_context context, krb5_keytab keytab, char *name,
+                unsigned int namelen)
+{
+    return krb5_x((keytab)->ops->get_name,(context, keytab,name,namelen));
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_close(krb5_context context, krb5_keytab keytab)
+{
+    return krb5_x((keytab)->ops->close,(context, keytab));
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_get_entry(krb5_context context, krb5_keytab keytab,
+                 krb5_const_principal principal, krb5_kvno vno,
+                 krb5_enctype enctype, krb5_keytab_entry *entry)
+{
+    return krb5_x((keytab)->ops->get,(context, keytab, principal, vno, enctype, entry));
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_start_seq_get(krb5_context context, krb5_keytab keytab,
+                     krb5_kt_cursor *cursor)
+{
+    return krb5_x((keytab)->ops->start_seq_get,(context, keytab, cursor));
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_next_entry(krb5_context context, krb5_keytab keytab,
+                  krb5_keytab_entry *entry, krb5_kt_cursor *cursor)
+{
+    return krb5_x((keytab)->ops->get_next,(context, keytab, entry, cursor));
+}
+
+krb5_error_code KRB5_CALLCONV
+krb5_kt_end_seq_get(krb5_context context, krb5_keytab keytab,
+                   krb5_kt_cursor *cursor)
+{
+    return krb5_x((keytab)->ops->end_get,(context, keytab, cursor));
+}