From: Ken Raeburn Date: Tue, 16 Nov 2004 05:04:56 +0000 (+0000) Subject: Create a ccache get-flags operation. X-Git-Tag: ms-bug-test-20060525~464 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=3830070bf398ef7253101c6a8b2855a00e74330f;p=krb5.git Create a ccache get-flags operation. The MSLSA and CCAPI versions are untested! * cc_file.c (krb5_fcc_get_flags): New function. (krb5_fcc_ops, krb5_cc_file_ops): Add it. * cc_memory.c (krb5_mcc_get_flags): New function. (krb5_mcc_ops): Add it. * cc_mslsa.c (krb5_lcc_get_flags): New function. (krb5_lcc_ops): Add it. * ccfns.c (krb5_cc_get_flags): New function. * ccapi/stdcc.c (krb5_stdcc_get_flags): New function. (krb5_cc_stdcc_ops): Add it. * ccapi/stdcc.h (krb5_stdcc_get_flags): Declare. ticket: 2763 status: open git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@16871 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index 757ce389c..9fe362e51 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,13 @@ +2004-11-15 Ken Raeburn + + * cc_file.c (krb5_fcc_get_flags): New function. + (krb5_fcc_ops, krb5_cc_file_ops): Add it. + * cc_memory.c (krb5_mcc_get_flags): New function. + (krb5_mcc_ops): Add it. + * cc_mslsa.c (krb5_lcc_get_flags): New function. + (krb5_lcc_ops): Add it. + * ccfns.c (krb5_cc_get_flags): New function. + 2004-10-07 Jeffrey Altman * cc_mslsa.c: Fix the forced setting of the Initial Ticket Flag on Win2000 and add it to XP and 2003 SP1 diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index f247c425d..14e59a146 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -2246,6 +2246,30 @@ krb5_fcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags) return ret; } +/* + * Requires: + * id is a cred cache returned by krb5_fcc_resolve or + * krb5_fcc_generate_new, but has not been opened by krb5_fcc_initialize. + * + * Modifies: + * id (mutex only; temporary) + * + * Effects: + * Returns the operational flags of id. + */ +static krb5_error_code KRB5_CALLCONV +krb5_fcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags) +{ + krb5_error_code ret = KRB5_OK; + + ret = k5_mutex_lock(&((krb5_fcc_data *) id->data)->lock); + if (ret) + return ret; + *flags = ((krb5_fcc_data *) id->data)->flags; + k5_mutex_unlock(&((krb5_fcc_data *) id->data)->lock); + return ret; +} + static krb5_error_code krb5_fcc_interpret(krb5_context context, int errnum) @@ -2314,6 +2338,7 @@ const krb5_cc_ops krb5_fcc_ops = { krb5_fcc_end_seq_get, krb5_fcc_remove_cred, krb5_fcc_set_flags, + krb5_fcc_get_flags, }; #if defined(_WIN32) @@ -2374,4 +2399,5 @@ const krb5_cc_ops krb5_cc_file_ops = { krb5_fcc_end_seq_get, krb5_fcc_remove_cred, krb5_fcc_set_flags, + krb5_fcc_get_flags, }; diff --git a/src/lib/krb5/ccache/cc_memory.c b/src/lib/krb5/ccache/cc_memory.c index 3dc9a7c2b..1417aabb7 100644 --- a/src/lib/krb5/ccache/cc_memory.c +++ b/src/lib/krb5/ccache/cc_memory.c @@ -564,6 +564,13 @@ krb5_mcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags) return KRB5_OK; } +krb5_error_code KRB5_CALLCONV +krb5_mcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags) +{ + *flags = 0; + return KRB5_OK; +} + /* store: Save away creds in the ccache. */ krb5_error_code KRB5_CALLCONV krb5_mcc_store(krb5_context ctx, krb5_ccache id, krb5_creds *creds) @@ -606,4 +613,5 @@ const krb5_cc_ops krb5_mcc_ops = { krb5_mcc_end_seq_get, krb5_mcc_remove_cred, krb5_mcc_set_flags, + krb5_mcc_get_flags, }; diff --git a/src/lib/krb5/ccache/cc_mslsa.c b/src/lib/krb5/ccache/cc_mslsa.c index c12f5817e..82f4a86ee 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -1798,6 +1798,9 @@ static krb5_error_code KRB5_CALLCONV krb5_lcc_store static krb5_error_code KRB5_CALLCONV krb5_lcc_set_flags (krb5_context, krb5_ccache id, krb5_flags flags); +static krb5_error_code KRB5_CALLCONV krb5_lcc_get_flags + (krb5_context, krb5_ccache id, krb5_flags *flags); + extern const krb5_cc_ops krb5_lcc_ops; krb5_error_code krb5_change_cache (void); @@ -2529,6 +2532,18 @@ krb5_lcc_set_flags(krb5_context context, krb5_ccache id, krb5_flags flags) return KRB5_OK; } +static krb5_error_code KRB5_CALLCONV +krb5_lcc_get_flags(krb5_context context, krb5_ccache id, krb5_flags *flags) +{ + krb5_lcc_data *data = (krb5_lcc_data *)id->data; + + if (!is_windows_2000()) + return KRB5_FCC_NOFILE; + + *flags = data->flags; + return KRB5_OK; +} + const krb5_cc_ops krb5_lcc_ops = { 0, "MSLSA", @@ -2545,6 +2560,7 @@ const krb5_cc_ops krb5_lcc_ops = { krb5_lcc_next_cred, krb5_lcc_end_seq_get, krb5_lcc_remove_cred, - krb5_lcc_set_flags + krb5_lcc_set_flags, + krb5_lcc_get_flags, }; #endif /* _WIN32 */ diff --git a/src/lib/krb5/ccache/ccapi/ChangeLog b/src/lib/krb5/ccache/ccapi/ChangeLog index e7d80c22a..4c9777709 100644 --- a/src/lib/krb5/ccache/ccapi/ChangeLog +++ b/src/lib/krb5/ccache/ccapi/ChangeLog @@ -1,3 +1,9 @@ +2004-11-15 Ken Raeburn + + * stdcc.c (krb5_stdcc_get_flags): New function. + (krb5_cc_stdcc_ops): Add it. + * stdcc.h (krb5_stdcc_get_flags): Declare. + 2004-06-22 Ken Raeburn * stdcc_util.c (dupK5toCC): Don't test macintosh. diff --git a/src/lib/krb5/ccache/ccapi/stdcc.c b/src/lib/krb5/ccache/ccapi/stdcc.c index 6bad56a3d..7e6ffe72c 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc.c +++ b/src/lib/krb5/ccache/ccapi/stdcc.c @@ -78,6 +78,7 @@ krb5_cc_ops krb5_cc_stdcc_ops = { krb5_stdcc_end_seq_get, krb5_stdcc_remove, krb5_stdcc_set_flags, + krb5_stdcc_get_flags, }; #if defined(_WIN32) @@ -715,6 +716,23 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags return 0; } +/* + * get_flags + * + * - currently a NOP since we don't store any flags in the NC + */ +krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags + (krb5_context context, krb5_ccache id , krb5_flags *flags) +{ + stdccCacheDataPtr ccapi_data = id->data; + krb5_error_code retval; + + if ((retval = stdcc_setup(context, ccapi_data))) + return retval; + + return 0; +} + /* * remove * diff --git a/src/lib/krb5/ccache/ccapi/stdcc.h b/src/lib/krb5/ccache/ccapi/stdcc.h index 2f653e5cc..81ce883cb 100644 --- a/src/lib/krb5/ccache/ccapi/stdcc.h +++ b/src/lib/krb5/ccache/ccapi/stdcc.h @@ -73,5 +73,8 @@ krb5_error_code KRB5_CALLCONV krb5_stdcc_store krb5_error_code KRB5_CALLCONV krb5_stdcc_set_flags (krb5_context, krb5_ccache id , krb5_flags flags ); +krb5_error_code KRB5_CALLCONV krb5_stdcc_get_flags + (krb5_context, krb5_ccache id , krb5_flags *flags ); + krb5_error_code KRB5_CALLCONV krb5_stdcc_remove (krb5_context, krb5_ccache id , krb5_flags flags, krb5_creds *creds); diff --git a/src/lib/krb5/ccache/ccfns.c b/src/lib/krb5/ccache/ccfns.c index a8715b402..5e80059ae 100644 --- a/src/lib/krb5/ccache/ccfns.c +++ b/src/lib/krb5/ccache/ccfns.c @@ -117,6 +117,12 @@ krb5_cc_set_flags (krb5_context context, krb5_ccache cache, krb5_flags flags) return cache->ops->set_flags(context, cache, flags); } +krb5_error_code KRB5_CALLCONV +krb5_cc_get_flags (krb5_context context, krb5_ccache cache, krb5_flags *flags) +{ + return cache->ops->get_flags(context, cache, flags); +} + const char * KRB5_CALLCONV krb5_cc_get_type (krb5_context context, krb5_ccache cache) {