From 0899feef5ea10df79ded4e215d8f5cfcf75e9451 Mon Sep 17 00:00:00 2001 From: Tom Yu Date: Thu, 5 Oct 2006 22:58:41 +0000 Subject: cursor for iterating over ccaches Some ccache back ends need per-type cursors implemented. * src/include/k5-int.h: Declare krb5_cc_ptcursor. Update krb5_cc_ops vector to include functions for ptcursor and some not-yet-implemented functionality. * src/include/krb5/krb5.hin: Prototype krb5_cccol_cursor_new, krb5_cccol_cursor_next, krb5_cccol_cursor_free. * src/lib/krb5/ccache/Makefile.in: Compile cccursor.c. Build t_cccursor. * src/lib/krb5/ccache/cccursor.c: Implementation of cursor for iterating over ccaches. * src/lib/krb5/ccache/ccbase.c: Add typecursor functionality for iteration over registered ccache types. * src/lib/krb5/ccache/cc_memory.c: Implmement per-type ccache cursor functionality. * src/lib/krb5/ccache/cc_mslsa.c: * src/lib/krb5/ccache/cc_file.c: * src/lib/krb5/ccache/ccapi/stdcc.c: Add place-holder ops vector entries. * src/lib/krb5/ccache/t_cccursor.c: New test of ccache cursor functionality. * src/lib/krb5/os/ccdefname.c (krb5int_cc_os_default_name): New function to return the OS-specific default ccache name. ticket: new status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@18651 dc483132-0cff-0310-8789-dd5450dbe970 --- src/include/k5-int.h | 44 ++++++++++++++++++++++++++++++++++++++++++++ src/include/krb5/krb5.hin | 19 +++++++++++++++++++ 2 files changed, 63 insertions(+) (limited to 'src/include') diff --git a/src/include/k5-int.h b/src/include/k5-int.h index 53b2acbf2b..8455fe47d8 100644 --- a/src/include/k5-int.h +++ b/src/include/k5-int.h @@ -1758,6 +1758,15 @@ struct _krb5_ccache { krb5_pointer data; }; +/* + * Per-type ccache cursor. + */ +struct krb5_cc_ptcursor { + const struct _krb5_cc_ops *ops; + krb5_pointer data; +}; +typedef struct krb5_cc_ptcursor *krb5_cc_ptcursor; + struct _krb5_cc_ops { krb5_magic magic; char *prefix; @@ -1788,10 +1797,45 @@ struct _krb5_cc_ops { krb5_flags); krb5_error_code (KRB5_CALLCONV *get_flags) (krb5_context, krb5_ccache, krb5_flags *); + krb5_error_code (KRB5_CALLCONV *ptcursor_new)(krb5_context, + krb5_cc_ptcursor *); + krb5_error_code (KRB5_CALLCONV *ptcursor_next)(krb5_context, + krb5_cc_ptcursor, + krb5_ccache *); + krb5_error_code (KRB5_CALLCONV *ptcursor_free)(krb5_context, + krb5_cc_ptcursor *); + krb5_error_code (KRB5_CALLCONV *move)(krb5_context, krb5_ccache); + krb5_error_code (KRB5_CALLCONV *lastchange)(krb5_context, + krb5_ccache, krb5_timestamp *); + krb5_error_code (KRB5_CALLCONV *wasdefault)(krb5_context, krb5_ccache, + krb5_timestamp *); }; extern const krb5_cc_ops *krb5_cc_dfl_ops; +krb5_error_code +krb5int_cc_os_default_name(krb5_context context, char **name); + +/* + * Cursor for iterating over ccache types + */ +struct krb5_cc_typecursor; +typedef struct krb5_cc_typecursor *krb5_cc_typecursor; + +krb5_error_code +krb5int_cc_typecursor_new(krb5_context context, krb5_cc_typecursor *cursor); + +krb5_error_code +krb5int_cc_typecursor_next( + krb5_context context, + krb5_cc_typecursor cursor, + const struct _krb5_cc_ops **ops); + +krb5_error_code +krb5int_cc_typecursor_free( + krb5_context context, + krb5_cc_typecursor *cursor); + typedef struct _krb5_donot_replay { krb5_magic magic; krb5_ui_4 hash; diff --git a/src/include/krb5/krb5.hin b/src/include/krb5/krb5.hin index 32b714adb1..354ff12b11 100644 --- a/src/include/krb5/krb5.hin +++ b/src/include/krb5/krb5.hin @@ -1212,6 +1212,12 @@ typedef struct _krb5_ccache *krb5_ccache; struct _krb5_cc_ops; typedef struct _krb5_cc_ops krb5_cc_ops; +/* + * Cursor for iterating over all ccaches + */ +struct krb5_cccol_cursor; +typedef struct krb5_cccol_cursor *krb5_cccol_cursor; + /* for retrieve_cred */ #define KRB5_TC_MATCH_TIMES 0x00000001 #define KRB5_TC_MATCH_IS_SKEY 0x00000002 @@ -1282,6 +1288,19 @@ krb5_cc_get_flags (krb5_context context, krb5_ccache cache, krb5_flags *flags); const char * KRB5_CALLCONV krb5_cc_get_type (krb5_context context, krb5_ccache cache); +krb5_error_code KRB5_CALLCONV +krb5_cccol_cursor_new(krb5_context context, krb5_cccol_cursor *cursor); + +krb5_error_code KRB5_CALLCONV +krb5_cccol_cursor_next( + krb5_context context, + krb5_cccol_cursor cursor, + krb5_ccache *ccache); + +krb5_error_code KRB5_CALLCONV +krb5_cccol_cursor_free(krb5_context context, krb5_cccol_cursor *cursor); + + /* * end "ccache.h" */ -- cgit