From: Ken Raeburn Date: Fri, 12 Oct 2001 22:49:02 +0000 (+0000) Subject: Replace keytab function-table dispatch macros in krb5.h with functions defined X-Git-Tag: krb5-1.3-alpha1~1038 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=54295aa631adac66b62f2b9f6b8894540eb78f05;p=krb5.git Replace keytab function-table dispatch macros in krb5.h with functions defined in krb5 library. Make keytab-related structures internal. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@13807 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/include/ChangeLog b/src/include/ChangeLog index ff5b9937c..8f044af33 100644 --- a/src/include/ChangeLog +++ b/src/include/ChangeLog @@ -1,3 +1,13 @@ +2001-10-12 Ken Raeburn + + * 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 * fake-stdlib.h: Make prototypes unconditional. diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 1edd2a135..b7f0c6292 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -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 */ diff --git a/src/include/krb5.hin b/src/include/krb5.hin index ee37016d7..117359631 100644 --- a/src/include/krb5.hin +++ b/src/include/krb5.hin @@ -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 *, diff --git a/src/lib/krb5/keytab/ChangeLog b/src/lib/krb5/keytab/ChangeLog index 95679384c..637819762 100644 --- a/src/lib/krb5/keytab/ChangeLog +++ b/src/lib/krb5/keytab/ChangeLog @@ -1,3 +1,8 @@ +2001-10-12 Ken Raeburn + + * ktfns.c: New file. + * Makefile.in (STLIBOBJS, OBJS, SRCS): Build it. + 2001-10-09 Ken Raeburn * ktbase.c: Make prototypes unconditional. diff --git a/src/lib/krb5/keytab/Makefile.in b/src/lib/krb5/keytab/Makefile.in index bc677eb37..532d40032 100644 --- a/src/lib/krb5/keytab/Makefile.in +++ b/src/lib/krb5/keytab/Makefile.in @@ -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 index 000000000..25e14b60f --- /dev/null +++ b/src/lib/krb5/keytab/ktfns.c @@ -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)); +}