From dbc0c54430cc59bf77971d62c590589eb8c076dd Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Tue, 6 Jan 2004 23:21:13 +0000 Subject: [PATCH] Add stub function implementations to support krb5_cc_remove_cred() which would cause a null pointer dereference if called. The new KRB5_CC_NOSUPP error is returned to indicate the lack of implementation. ticket: 2106 target_version: 1.3.2 tags: pullup git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@15974 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/krb5/ccache/ChangeLog | 9 +++++++++ src/lib/krb5/ccache/cc_file.c | 16 ++++++++++++++-- src/lib/krb5/ccache/cc_memory.c | 16 +++++++++++++++- src/lib/krb5/ccache/cc_mslsa.c | 15 ++++++++++++++- src/lib/krb5/error_tables/ChangeLog | 4 ++++ src/lib/krb5/error_tables/krb5_err.et | 2 +- 6 files changed, 57 insertions(+), 5 deletions(-) diff --git a/src/lib/krb5/ccache/ChangeLog b/src/lib/krb5/ccache/ChangeLog index 71158eaf3..e6cb33895 100644 --- a/src/lib/krb5/ccache/ChangeLog +++ b/src/lib/krb5/ccache/ChangeLog @@ -1,3 +1,12 @@ +2004-01-06 Jeffrey Altman + + * cc_file.c, cc_memory.c: + Add stub implementations for unimplemented krb5_cc_remove_cred() + Returns KRB5_CC_NOSUPP + + * cc_mslsa.c: + Add implementation for krb5_cc_remove_cred(). Returns KRB5_CC_READONLY. + 2003-12-19 Jeffrey Altman * cc_mslsa.c: fix indirection of a krb5_creds structure which diff --git a/src/lib/krb5/ccache/cc_file.c b/src/lib/krb5/ccache/cc_file.c index 09ce8d55e..a9b45647a 100644 --- a/src/lib/krb5/ccache/cc_file.c +++ b/src/lib/krb5/ccache/cc_file.c @@ -2254,6 +2254,18 @@ lose: #undef TCHECK } +/* + * Non-functional stub implementation for krb5_fcc_remove + * + * Errors: + * KRB5_CC_NOSUPP - not implemented + */ +static krb5_error_code KRB5_CALLCONV +krb5_fcc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, + krb5_creds *creds) +{ + return KRB5_CC_NOSUPP; +} /* * Requires: @@ -2362,7 +2374,7 @@ const krb5_cc_ops krb5_fcc_ops = { krb5_fcc_start_seq_get, krb5_fcc_next_cred, krb5_fcc_end_seq_get, - NULL, /* XXX krb5_fcc_remove, */ + krb5_fcc_remove, krb5_fcc_set_flags, }; @@ -2422,6 +2434,6 @@ const krb5_cc_ops krb5_cc_file_ops = { krb5_fcc_start_seq_get, krb5_fcc_next_cred, krb5_fcc_end_seq_get, - NULL, /* XXX krb5_fcc_remove, */ + krb5_fcc_remove, krb5_fcc_set_flags, }; diff --git a/src/lib/krb5/ccache/cc_memory.c b/src/lib/krb5/ccache/cc_memory.c index 97ec32752..8477e3d45 100644 --- a/src/lib/krb5/ccache/cc_memory.c +++ b/src/lib/krb5/ccache/cc_memory.c @@ -519,6 +519,20 @@ krb5_mcc_store(krb5_context context, krb5_ccache id, krb5_creds *creds) return ret; } +/* + * Non-functional stub implementation for krb5_mcc_remove + * + * Errors: + * KRB5_CC_NOSUPP - not implemented + */ +static krb5_error_code KRB5_CALLCONV +krb5_mcc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, + krb5_creds *creds) +{ + return KRB5_CC_NOSUPP; +} + + /* * Requires: * id is a cred cache returned by krb5_mcc_resolve or @@ -553,6 +567,6 @@ const krb5_cc_ops krb5_mcc_ops = { krb5_mcc_start_seq_get, krb5_mcc_next_cred, krb5_mcc_end_seq_get, - NULL, /* XXX krb5_mcc_remove, */ + krb5_mcc_remove, krb5_mcc_set_flags, }; diff --git a/src/lib/krb5/ccache/cc_mslsa.c b/src/lib/krb5/ccache/cc_mslsa.c index 6d1dfc5a4..3ceda5a09 100644 --- a/src/lib/krb5/ccache/cc_mslsa.c +++ b/src/lib/krb5/ccache/cc_mslsa.c @@ -1386,6 +1386,19 @@ krb5_lcc_store(krb5_context context, krb5_ccache id, krb5_creds *creds) return KRB5_CC_READONLY; } +/* + * The ability to remove a credential from the MS LSA cache cannot be implemented. + * + * Errors: + * KRB5_CC_READONLY: + */ +static krb5_error_code KRB5_CALLCONV +krb5_fcc_remove_cred(krb5_context context, krb5_ccache cache, krb5_flags flags, + krb5_creds *creds) +{ + return KRB5_CC_READONLY; +} + /* * Effects: @@ -1412,7 +1425,7 @@ const krb5_cc_ops krb5_lcc_ops = { krb5_lcc_start_seq_get, krb5_lcc_next_cred, krb5_lcc_end_seq_get, - NULL, /* krb5_lcc_remove, */ + krb5_lcc_remove, krb5_lcc_set_flags }; #endif /* _WIN32 */ \ No newline at end of file diff --git a/src/lib/krb5/error_tables/ChangeLog b/src/lib/krb5/error_tables/ChangeLog index c5f1371b8..7fea34e6c 100644 --- a/src/lib/krb5/error_tables/ChangeLog +++ b/src/lib/krb5/error_tables/ChangeLog @@ -1,3 +1,7 @@ +2004-01-06 Jeffrey Altman + + * krb5_err.et (KRB5_CC_NOSUPP) new ccache error code + 2003-12-12 Jeffrey Altman * krb5_err.et (KRB5_CC_READONLY) new ccache error code diff --git a/src/lib/krb5/error_tables/krb5_err.et b/src/lib/krb5/error_tables/krb5_err.et index 622143b7d..b03d3769d 100644 --- a/src/lib/krb5/error_tables/krb5_err.et +++ b/src/lib/krb5/error_tables/krb5_err.et @@ -339,5 +339,5 @@ error_code KRB5_ERR_BAD_S2K_PARAMS, "Invalid key generation parameters from KDC" error_code KRB5_ERR_NO_SERVICE, "service not available" error_code KRB5_CC_READONLY, "Ccache function not supported: read-only ccache type" - +error_code KRB5_CC_NOSUPP, "Ccache function not supported: not implemented" end -- 2.26.2