From 4e824737afa8bb05db07d92a04855149c2fba5d8 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Fri, 19 May 2006 09:18:37 +0000 Subject: Updates of portable CCAPI sources. All code compiles git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18022 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/CredentialsCache.h | 122 +++++++++++++++++++----------- src/lib/ccapi/include/CredentialsCache2.h | 64 ++++++++-------- src/lib/ccapi/include/cc_rpc.h | 52 +++++++++++++ src/lib/ccapi/include/generic_lists.h | 95 +++++++++++++++++++++++ src/lib/ccapi/include/marshall.h | 31 ++++++-- src/lib/ccapi/include/msg.h | 51 ++++++++----- src/lib/ccapi/include/msg_headers.h | 73 ++++++++---------- 7 files changed, 346 insertions(+), 142 deletions(-) create mode 100644 src/lib/ccapi/include/cc_rpc.h create mode 100644 src/lib/ccapi/include/generic_lists.h (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/CredentialsCache.h b/src/lib/ccapi/include/CredentialsCache.h index dd60fa46d6..7143da4e25 100644 --- a/src/lib/ccapi/include/CredentialsCache.h +++ b/src/lib/ccapi/include/CredentialsCache.h @@ -1,6 +1,6 @@ /* $Copyright: * - * Copyright 1998-2004 by the Massachusetts Institute of Technology. + * Copyright 1998-2006 by the Massachusetts Institute of Technology. * * All rights reserved. * @@ -46,12 +46,12 @@ /* * Declarations for Credentials Cache API Library * - * API specification: + * API specification: * * Revision 1: Frank Dabek, 6/4/1998 * Revision 2: meeroh, 2/24/1999 * Revision 3: meeroh, 11/12/1999 - * Revision 4: jaltman, 10/27/2004 + * Revision 6: jaltman, 10/27/2004 * */ @@ -81,6 +81,17 @@ extern "C" { #pragma options align=mac68k #endif +#if defined(_WIN32) +#define CCACHE_API __declspec(dllexport) + +#if _INTEGRAL_MAX_BITS >= 64 && _MSC_VER >= 1400 && !defined(_WIN64) && !defined(_USE_32BIT_TIME_T) +#if defined(_TIME_T_DEFINED) || defined(_INC_IO) || defined(_INC_TIME) || defined(_INC_WCHAR) +#error time_t has been defined as a 64-bit integer which is incompatible with Kerberos on this platform. +#endif /* _TIME_T_DEFINED */ +#define _USE_32BIT_TIME_T +#endif +#endif + #include /* @@ -92,14 +103,16 @@ enum { ccapi_version_2 = 2, ccapi_version_3 = 3, ccapi_version_4 = 4, - ccapi_version_5 = 5 + ccapi_version_5 = 5, + ccapi_version_6 = 6, + ccapi_version_max = ccapi_version_6 }; /* Errors */ enum { - ccNoError = 0, + ccNoError = 0, - ccIteratorEnd = 201, + ccIteratorEnd = 201, ccErrBadParam, ccErrNoMem, ccErrInvalidContext, @@ -111,7 +124,7 @@ enum { ccErrInvalidCredentialsIterator, ccErrInvalidLock, - ccErrBadName, /* 211 */ + ccErrBadName, /* 211 */ ccErrBadCredentialsVersion, ccErrBadAPIVersion, ccErrContextLocked, @@ -123,7 +136,7 @@ enum { ccErrNeverDefault, ccErrCredentialsNotFound, - ccErrCCacheNotFound, /* 221 */ + ccErrCCacheNotFound, /* 221 */ ccErrContextNotFound, ccErrServerUnavailable, ccErrServerInsecure, @@ -135,20 +148,22 @@ enum { }; /* Credentials versions */ -enum { +enum cc_credential_versions { cc_credentials_v4 = 1, cc_credentials_v5 = 2, cc_credentials_v4_v5 = 3 }; /* Lock types */ -enum { - cc_lock_read = 1, - cc_lock_write = 2 +enum cc_lock_types { + cc_lock_read = 0, + cc_lock_write = 1, + cc_lock_upgrade = 2, + cc_lock_downgrade = 3 }; /* Locking Modes */ -enum { +enum cc_lock_modes { cc_lock_noblock = 0, cc_lock_block = 1 }; @@ -157,12 +172,20 @@ enum { * Basic types */ -typedef char cc_int8; -typedef unsigned char cc_uint8; -typedef int cc_int32; -typedef unsigned int cc_uint32; -typedef time_t cc_time_t; -typedef void * cc_handle; +typedef char cc_int8; +typedef unsigned char cc_uint8; +typedef int cc_int32; +typedef unsigned int cc_uint32; +#if defined (WIN32) +typedef __int64 cc_int64; +typedef unsigned __int64 cc_uint64; +#else +typedef long long cc_int64; +typedef unsigned long long cc_uint64; +#endif +typedef time_t cc_time; +typedef cc_int64 cc_time64; +typedef cc_uint64 cc_handle; /* * API types @@ -190,10 +213,11 @@ typedef struct cc_credentials_f cc_credentials_f; /* Credentials types */ enum { /* Make sure all of these are multiples of four (for alignment sanity) */ - cc_v4_name_size = 40, + cc_v4_name_size = 40, cc_v4_instance_size = 40, cc_v4_realm_size = 40, - cc_v4_ticket_size = 1254 + cc_v4_ticket_size = 1254, + cc_v4_key_size = 8 }; enum cc_string_to_key_type { @@ -211,10 +235,10 @@ struct cc_credentials_v4_t { char service [cc_v4_name_size]; char service_instance [cc_v4_instance_size]; char realm [cc_v4_realm_size]; - unsigned char session_key [8]; + unsigned char session_key [cc_v4_key_size]; cc_int32 kvno; cc_int32 string_to_key_type; - cc_time_t issue_date; + cc_time issue_date; cc_int32 lifetime; cc_uint32 address; cc_int32 ticket_size; @@ -233,10 +257,10 @@ struct cc_credentials_v5_t { char* client; char* server; cc_data keyblock; - cc_time_t authtime; - cc_time_t starttime; - cc_time_t endtime; - cc_time_t renew_till; + cc_time authtime; + cc_time starttime; + cc_time endtime; + cc_time renew_till; cc_uint32 is_skey; cc_uint32 ticket_flags; cc_data** addresses; @@ -320,7 +344,7 @@ struct cc_context_f { cc_context_t context); cc_int32 (*get_change_time) ( cc_context_t context, - cc_time_t* time); + cc_time* time); cc_int32 (*get_default_ccache_name) ( cc_context_t context, cc_string_t* name); @@ -397,16 +421,16 @@ struct cc_ccache_f { cc_ccache_t destination); cc_int32 (*lock) ( cc_ccache_t ccache, - cc_uint32 block, - cc_uint32 lock_type); + cc_uint32 lock_type, + cc_uint32 block); cc_int32 (*unlock) ( cc_ccache_t ccache); cc_int32 (*get_last_default_time) ( cc_ccache_t ccache, - cc_time_t* time); + cc_time* time); cc_int32 (*get_change_time) ( cc_ccache_t ccache, - cc_time_t* time); + cc_time* time); cc_int32 (*compare) ( cc_ccache_t ccache, cc_ccache_t compare_to, @@ -414,11 +438,11 @@ struct cc_ccache_f { cc_int32 (*get_kdc_time_offset) ( cc_ccache_t ccache, cc_int32 credentials_version, - cc_time_t* time_offset); + cc_time* time_offset); cc_int32 (*set_kdc_time_offset) ( cc_ccache_t ccache, cc_int32 credentials_version, - cc_time_t time_offset); + cc_time time_offset); cc_int32 (*clear_kdc_time_offset) ( cc_ccache_t ccache, @@ -446,6 +470,9 @@ struct cc_ccache_iterator_f { cc_int32 (*next) ( cc_ccache_iterator_t iter, cc_ccache_t* ccache); + + cc_int32 (*clone) ( cc_ccache_iterator_t iter, + cc_ccache_iterator_t* new_iter); }; struct cc_credentials_iterator_f { @@ -454,16 +481,19 @@ struct cc_credentials_iterator_f { cc_int32 (*next) ( cc_credentials_iterator_t iter, cc_credentials_t* ccache); + + cc_int32 (*clone) ( cc_credentials_iterator_t iter, + cc_credentials_iterator_t* new_iter); }; /* * API functions */ -cc_int32 cc_initialize ( +CCACHE_API cc_int32 cc_initialize ( cc_context_t* outContext, - cc_int32 inVersion, - cc_int32* outSupportedVersion, + cc_int32 inVersion, + cc_int32* outSupportedVersion, char const** outVendor); /* @@ -488,8 +518,8 @@ cc_int32 cc_initialize ( ((context) -> functions -> create_new_ccache (context, version, principal, ccache)) #define cc_context_new_ccache_iterator(context, iterator) \ ((context) -> functions -> new_ccache_iterator (context, iterator)) -#define cc_context_lock(context, type, lock) \ - ((context) -> functions -> lock (context, type, lock)) +#define cc_context_lock(context, type, block) \ + ((context) -> functions -> lock (context, type, block)) #define cc_context_unlock(context) \ ((context) -> functions -> unlock (context)) #define cc_context_compare(context, compare_to, equal) \ @@ -515,8 +545,8 @@ cc_int32 cc_initialize ( ((ccache) -> functions -> remove_credentials (ccache, credentials)) #define cc_ccache_new_credentials_iterator(ccache, iterator) \ ((ccache) -> functions -> new_credentials_iterator (ccache, iterator)) -#define cc_ccache_lock(ccache, lock) \ - ((ccache) -> functions -> lock (ccache, lock)) +#define cc_ccache_lock(ccache, type, block) \ + ((ccache) -> functions -> lock (ccache, type, block)) #define cc_ccache_unlock(ccache, unlock) \ ((ccache) -> functions -> unlock (ccache, unlock)) #define cc_ccache_get_last_default_time(ccache, time) \ @@ -528,11 +558,11 @@ cc_int32 cc_initialize ( #define cc_ccache_compare(ccache, compare_to, equal) \ ((ccache) -> functions -> compare (ccache, compare_to, equal)) #define cc_ccache_get_kdc_time_offset(ccache, version, time) \ - ((ccache) -> functions -> get_kdc_time_offset (version, time)) + ((ccache) -> functions -> get_kdc_time_offset (version, time)) #define cc_ccache_set_kdc_time_offset(ccache, version, time) \ - ((ccache) -> functions -> set_kdc_time_offset (version, time)) + ((ccache) -> functions -> set_kdc_time_offset (version, time)) #define cc_ccache_clear_kdc_time_offset(ccache, version) \ - ((ccache) -> functions -> clear_kdc_time_offset (version)) + ((ccache) -> functions -> clear_kdc_time_offset (version)) #define cc_string_release(string) \ ((string) -> functions -> release (string)) @@ -546,11 +576,15 @@ cc_int32 cc_initialize ( ((iterator) -> functions -> release (iterator)) #define cc_ccache_iterator_next(iterator, ccache) \ ((iterator) -> functions -> next (iterator, ccache)) +#define cc_ccache_iterator_clone(iterator, new_iter) \ + ((iterator) -> functions -> clone (iterator, new_iter)) #define cc_credentials_iterator_release(iterator) \ ((iterator) -> functions -> release (iterator)) #define cc_credentials_iterator_next(iterator, credentials) \ ((iterator) -> functions -> next (iterator, credentials)) +#define cc_credentials_iterator_clone(iterator, new_iter) \ + ((iterator) -> functions -> clone (iterator, new_iter)) #if TARGET_OS_MAC #if defined(__MWERKS__) diff --git a/src/lib/ccapi/include/CredentialsCache2.h b/src/lib/ccapi/include/CredentialsCache2.h index 401e093f43..214d93a02f 100644 --- a/src/lib/ccapi/include/CredentialsCache2.h +++ b/src/lib/ccapi/include/CredentialsCache2.h @@ -1,6 +1,6 @@ /* $Copyright: * - * Copyright 1998-2004 by the Massachusetts Institute of Technology. + * Copyright 1998-2006 by the Massachusetts Institute of Technology. * * All rights reserved. * @@ -48,7 +48,7 @@ #ifndef __CREDENTIALSCACHE2__ #define __CREDENTIALSCACHE2__ -#include +#include "CredentialsCache.h" #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) #include #if TARGET_RT_MAC_CFM @@ -185,25 +185,25 @@ enum { CC_CRED_MAX }; -cc_int32 cc_shutdown ( +CCACHE_API cc_int32 cc_shutdown ( apiCB** ioContext); -cc_int32 cc_get_NC_info ( +CCACHE_API cc_int32 cc_get_NC_info ( apiCB* inContext, infoNC*** outInfo); -cc_int32 cc_get_change_time ( +CCACHE_API cc_int32 cc_get_change_time ( apiCB* inContext, cc_time_t* outTime); -cc_int32 cc_open ( +CCACHE_API cc_int32 cc_open ( apiCB* inContext, const char* inName, cc_int32 inVersion, cc_uint32 inFlags, ccache_p** outCCache); -cc_int32 cc_create ( +CCACHE_API cc_int32 cc_create ( apiCB* inContext, const char* inName, const char* inPrincipal, @@ -211,85 +211,85 @@ cc_int32 cc_create ( cc_uint32 inFlags, ccache_p** outCCache); -cc_int32 cc_close ( +CCACHE_API cc_int32 cc_close ( apiCB* inContext, ccache_p** ioCCache); -cc_int32 cc_destroy ( +CCACHE_API cc_int32 cc_destroy ( apiCB* inContext, ccache_p** ioCCache); -cc_int32 cc_seq_fetch_NCs_begin ( +CCACHE_API cc_int32 cc_seq_fetch_NCs_begin ( apiCB* inContext, - ccache_cit** outIterator); + ccache_cit** outIterator); -cc_int32 cc_seq_fetch_NCs_next ( +CCACHE_API cc_int32 cc_seq_fetch_NCs_next ( apiCB* inContext, ccache_p** outCCache, ccache_cit* inIterator); -cc_int32 cc_seq_fetch_NCs_end ( +CCACHE_API cc_int32 cc_seq_fetch_NCs_end ( apiCB* inContext, - ccache_cit** ioIterator); + ccache_cit** ioIterator); -cc_int32 cc_get_name ( +CCACHE_API cc_int32 cc_get_name ( apiCB* inContext, ccache_p* inCCache, char** outName); -cc_int32 cc_get_cred_version ( +CCACHE_API cc_int32 cc_get_cred_version ( apiCB* inContext, ccache_p* inCCache, cc_int32* outVersion); -cc_int32 cc_set_principal ( +CCACHE_API cc_int32 cc_set_principal ( apiCB* inContext, ccache_p* inCCache, cc_int32 inVersion, char* inPrincipal); -cc_int32 cc_get_principal ( +CCACHE_API cc_int32 cc_get_principal ( apiCB* inContext, ccache_p* inCCache, char** outPrincipal); -cc_int32 cc_store ( +CCACHE_API cc_int32 cc_store ( apiCB* inContext, ccache_p* inCCache, cred_union inCredentials); -cc_int32 cc_remove_cred ( +CCACHE_API cc_int32 cc_remove_cred ( apiCB* inContext, ccache_p* inCCache, cred_union inCredentials); -cc_int32 cc_seq_fetch_creds_begin ( +CCACHE_API cc_int32 cc_seq_fetch_creds_begin ( apiCB* inContext, - const ccache_p* inCCache, - ccache_cit** outIterator); + const ccache_p* inCCache, + ccache_cit** outIterator); -cc_int32 cc_seq_fetch_creds_next ( +CCACHE_API cc_int32 cc_seq_fetch_creds_next ( apiCB* inContext, - cred_union** outCreds, + cred_union** outCreds, ccache_cit* inIterator); -cc_int32 cc_seq_fetch_creds_end ( +CCACHE_API cc_int32 cc_seq_fetch_creds_end ( apiCB* inContext, - ccache_cit** ioIterator); + ccache_cit** ioIterator); -cc_int32 cc_free_principal ( +CCACHE_API cc_int32 cc_free_principal ( apiCB* inContext, char** ioPrincipal); -cc_int32 cc_free_name ( +CCACHE_API cc_int32 cc_free_name ( apiCB* inContext, char** ioName); -cc_int32 cc_free_creds ( +CCACHE_API cc_int32 cc_free_creds ( apiCB* inContext, - cred_union** creds); + cred_union** creds); -cc_int32 cc_free_NC_info ( +CCACHE_API cc_int32 cc_free_NC_info ( apiCB* inContext, infoNC*** ioInfo); diff --git a/src/lib/ccapi/include/cc_rpc.h b/src/lib/ccapi/include/cc_rpc.h new file mode 100644 index 0000000000..0f14724b90 --- /dev/null +++ b/src/lib/ccapi/include/cc_rpc.h @@ -0,0 +1,52 @@ +/* $Copyright: + * + * Copyright 2004-2006 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 MIT 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. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Individual source code files are copyright MIT, Cygnus Support, + * OpenVision, Oracle, Sun Soft, FundsXpress, and others. + * + * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, + * and Zephyr are trademarks of the Massachusetts Institute of Technology + * (MIT). No commercial use of these trademarks may be made without prior + * written permission of MIT. + * + * "Commercial use" means use of a name in a product or other for-profit + * manner. It does NOT prevent a commercial firm from referring to the MIT + * trademarks in order to convey information (although in doing so, + * recognition of their trademark status should be given). + * $ + */ + + +#ifndef __CC_RPC_H__ +#define __CC_RPC_H__ + +#include "msg.h" + +cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response); + +#endif /* __CC_RPC_H__ */ diff --git a/src/lib/ccapi/include/generic_lists.h b/src/lib/ccapi/include/generic_lists.h new file mode 100644 index 0000000000..4d49e276bd --- /dev/null +++ b/src/lib/ccapi/include/generic_lists.h @@ -0,0 +1,95 @@ +/* $Copyright: + * + * Copyright 2004-2006 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 MIT 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. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Individual source code files are copyright MIT, Cygnus Support, + * OpenVision, Oracle, Sun Soft, FundsXpress, and others. + * + * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, + * and Zephyr are trademarks of the Massachusetts Institute of Technology + * (MIT). No commercial use of these trademarks may be made without prior + * written permission of MIT. + * + * "Commercial use" means use of a name in a product or other for-profit + * manner. It does NOT prevent a commercial firm from referring to the MIT + * trademarks in order to convey information (although in doing so, + * recognition of their trademark status should be given). + * $ + */ +/* + * Prototypes and data structures for datastore. + * + */ + + +#ifndef __CC_GENERIC_LISTS_H_ +#define __CC_GENERIC_LISTS_H_ + +struct cc_generic_list_node_t { + cc_uint8* data; + cc_uint32 len; + struct cc_generic_list_node_t* next; + struct cc_generic_list_node_t* prev; +}; +typedef struct cc_generic_list_node_t cc_generic_list_node_t; + +struct cc_generic_list_head_t { + enum cc_list_type type; + cc_generic_list_node_t* head; + cc_generic_list_node_t* tail; +}; +typedef struct cc_generic_list_head_t cc_generic_list_head_t; + + +struct cc_generic_iterate_t { + cc_generic_list_node_t* next; +}; +typedef struct cc_generic_iterate_t cc_generic_iterate_t; + +typedef cc_generic_list_head_t cc_context_list_head_t; +typedef cc_generic_list_node_t cc_context_list_node_t; + +typedef cc_generic_list_head_t cc_ccache_list_head_t; +typedef cc_generic_list_node_t cc_ccache_list_node_t; + +typedef cc_generic_list_head_t cc_credentials_list_head_t; +typedef cc_generic_list_node_t cc_credentials_list_node_t; + +cc_int32 cci_generic_iterate_has_next(cc_generic_iterate_t *iterate); +cc_int32 cci_generic_iterate_next(cc_generic_iterate_t *iterate, cc_generic_list_node_t**); + +cc_int32 cci_generic_list_new(cc_generic_list_head_t **); +cc_int32 cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**); +cc_int32 cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**); +cc_int32 cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem); +cc_int32 cci_generic_free_element(cc_generic_list_node_t* node); +cc_int32 cci_generic_list_destroy(cc_generic_list_head_t* head); +cc_int32 cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t**); +cc_int32 cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t**); +cc_int32 cci_generic_free_iterator(cc_generic_iterate_t* iterator); + +#endif /* __CC_GENERIC_LISTS_H_ */ diff --git a/src/lib/ccapi/include/marshall.h b/src/lib/ccapi/include/marshall.h index 19b9463b08..ca6b12e968 100644 --- a/src/lib/ccapi/include/marshall.h +++ b/src/lib/ccapi/include/marshall.h @@ -1,6 +1,6 @@ /* $Copyright: * - * Copyright 2004 by the Massachusetts Institute of Technology. + * Copyright 2004-2006 by the Massachusetts Institute of Technology. * * All rights reserved. * @@ -41,7 +41,6 @@ * $ */ -#define FLAT_CREDS_V5_VERSION 1 struct cc_flat_data { cc_uint32 type; cc_uint32 length; @@ -49,15 +48,16 @@ struct cc_flat_data { }; typedef struct cc_flat_data cc_flat_data; +#define FLAT_CREDS_V5_VERSION 1 struct cci_flat_creds_v5 { cc_uint32 version; /* version of this structure */ cc_flat_data client; cc_flat_data server; cc_flat_data keyblock; - cc_time_t authtime; - cc_time_t starttime; - cc_time_t endtime; - cc_time_t renew_till; + cc_time64 authtime; + cc_time64 starttime; + cc_time64 endtime; + cc_time64 renew_till; cc_uint32 is_skey; cc_uint32 ticket_flags; cc_uint32 address_count; @@ -67,6 +67,25 @@ struct cci_flat_creds_v5 { cc_uint32 authdata_count; cc_uint32 authdata; /* offset to array */ }; +typedef struct cci_flat_creds_v5 cci_flat_creds_v5_t; + +struct cci_flat_creds_v4 { + cc_uint32 version; + char principal [cc_v4_name_size]; + char principal_instance [cc_v4_instance_size]; + char service [cc_v4_name_size]; + char service_instance [cc_v4_instance_size]; + char realm [cc_v4_realm_size]; + unsigned char session_key [cc_v4_key_size]; + cc_int32 kvno; + cc_int32 string_to_key_type; + cc_time64 issue_date; + cc_int32 lifetime; + cc_uint32 address; + cc_int32 ticket_size; + unsigned char ticket [cc_v4_ticket_size]; +}; +typedef struct cci_flat_creds_v4 cci_flat_creds_v4_t; cc_int32 cci_creds_v4_marshall( cc_credentials_v4_t * creds, diff --git a/src/lib/ccapi/include/msg.h b/src/lib/ccapi/include/msg.h index 0d712d6664..182ebc1611 100644 --- a/src/lib/ccapi/include/msg.h +++ b/src/lib/ccapi/include/msg.h @@ -1,6 +1,6 @@ /* $Copyright: * - * Copyright 2004 by the Massachusetts Institute of Technology. + * Copyright 2004-2006 by the Massachusetts Institute of Technology. * * All rights reserved. * @@ -43,7 +43,7 @@ /* * Verifiable, extensible message format. - * + * * Format: * * @@ -60,13 +60,13 @@ * If the header has variable length data it is included in the data blobs. * The header field has the offset from the beginning of the message of the 1st * byte of the data and the length of the data. - * */ #ifndef __CC_MSG_H__ #define __CC_MSG_H__ #include "CredentialsCache.h" +#include "generic_lists.h" struct cc_msg_t { cc_uint32 type; /*type of message*/ @@ -87,16 +87,15 @@ enum { ccmsg_CTX_RELEASE, ccmsg_CTX_GET_CHANGE_TIME, ccmsg_CTX_GET_DEFAULT_CCACHE_NAME, - ccmsg_CTX_COMPARE, + ccmsg_CTX_CCACHE_OPEN, + ccmsg_CTX_CCACHE_OPEN_DEFAULT, + ccmsg_CTX_CCACHE_CREATE, + ccmsg_CTX_CCACHE_CREATE_DEFAULT, + ccmsg_CTX_CCACHE_CREATE_UNIQUE, ccmsg_CTX_NEW_CCACHE_ITERATOR, ccmsg_CTX_LOCK, ccmsg_CTX_UNLOCK, - ccmsg_CTX_CLONE, - ccmsg_CCACHE_OPEN, - ccmsg_CCACHE_OPEN_DEFAULT, - ccmsg_CCACHE_CREATE, - ccmsg_CCACHE_CREATE_DEFAULT, - ccmsg_CCACHE_CREATE_UNIQUE, + ccmsg_CTX_COMPARE, ccmsg_CCACHE_RELEASE, ccmsg_CCACHE_DESTROY, ccmsg_CCACHE_SET_DEFAULT, @@ -104,29 +103,28 @@ enum { ccmsg_CCACHE_GET_NAME, ccmsg_CCACHE_GET_PRINCIPAL, ccmsg_CCACHE_SET_PRINCIPAL, - ccmsg_CCACHE_CREDS_ITERATOR, + ccmsg_CCACHE_NEW_CREDS_ITERATOR, ccmsg_CCACHE_STORE_CREDS, ccmsg_CCACHE_REM_CREDS, + ccmsg_CCACHE_MOVE, + ccmsg_CCACHE_LOCK, + ccmsg_CCACHE_UNLOCK, ccmsg_CCACHE_GET_LAST_DEFAULT_TIME, ccmsg_CCACHE_GET_CHANGE_TIME, - ccmsg_CCACHE_MOVE, ccmsg_CCACHE_COMPARE, ccmsg_CCACHE_GET_KDC_TIME_OFFSET, ccmsg_CCACHE_SET_KDC_TIME_OFFSET, ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET, ccmsg_CCACHE_ITERATOR_RELEASE, ccmsg_CCACHE_ITERATOR_NEXT, - ccmsg_CCACHE_LOCK, - ccmsg_CCACHE_UNLOCK, + ccmsg_CCACHE_ITERATOR_CLONE, ccmsg_CREDS_ITERATOR_RELEASE, ccmsg_CREDS_ITERATOR_NEXT, - ccmsg_CREDS_RELEASE, - ccmsg_CREDS_V4, - ccmsg_CREDS_V5 + ccmsg_CREDS_ITERATOR_CLONE }; #define CC_MSG_MAX_SIZE 1073741824 /*2^30*/ -#define CC_MSG_MAX_TYPE ccmsg_CREDS_V5 +#define CC_MSG_MAX_TYPE ccmsg_CREDS_ITERATOR_CLONE #define BLOB_LEN (sizeof(cc_uint32)) #define MAGIC_DATA_LEN (sizeof(cc_uint32)) #define MAGIC_HEAD_LEN (sizeof(cc_uint32)) @@ -143,4 +141,21 @@ cc_int32 cci_msg_verify(void* flat, int flat_len, cc_uint32 * sizep); cc_int32 cci_msg_unflatten(void *flat, int flat_len, cc_msg_t** msgpp); cc_int32 cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, void **); cc_int32 cci_msg_destroy(cc_msg_t* msg); + +/* Add missing byte swapping macros for 64-bit values */ +#ifdef MAC +#define htonll(x) OSSwapHostToBigInt64(x) +#define ntohll(x) OSSwapBigToHostInt64(x) +#else +#ifdef _WIN32 +#ifdef _M_IX86 +#define htonll(x) _byteswap_uint64(x) +#define ntohll(x) _byteswap_uint64(x) +#else +#define htonll(x) (x) +#define ntohll(x) (x) +#endif +#endif +#endif + #endif /*__CC_MSG_H__*/ diff --git a/src/lib/ccapi/include/msg_headers.h b/src/lib/ccapi/include/msg_headers.h index a27c2d2f12..b5a9acd6d5 100644 --- a/src/lib/ccapi/include/msg_headers.h +++ b/src/lib/ccapi/include/msg_headers.h @@ -1,6 +1,6 @@ /* $Copyright: * - * Copyright 2004 by the Massachusetts Institute of Technology. + * Copyright 2004-2006 by the Massachusetts Institute of Technology. * * All rights reserved. * @@ -57,6 +57,8 @@ * size divisible by 4. This is to ensure correct alignment * and stop different compilers from inserting padding bytes in * different places. + * + * All values are stored in network byte order. */ struct ccmsg_ctx_only_t { @@ -81,18 +83,18 @@ struct ccmsg_init_resp_t { typedef struct ccmsg_init_t ccmsg_init_t; typedef struct ccmsg_init_resp_t ccmsg_init_resp_t; -struct ccmsg_clone_t { +struct ccmsg_ctx_clone_t { cc_handle ctx; cc_uint32 in_version; /*client API version*/ }; -struct ccmsg_clone_resp_t { +struct ccmsg_ctx_clone_resp_t { cc_handle out_ctx; /*handle on this ctx*/ cc_uint32 out_version; /*server API version*/ cc_uint32 vendor_offset; /*offset of vendor blob*/ cc_uint32 vendor_length; /*length of vendor blob*/ }; -typedef struct ccmsg_clone_t ccmsg_clone_t; -typedef struct ccmsg_clone_resp_t ccmsg_clone_resp_t; +typedef struct ccmsg_ctx_clone_t ccmsg_ctx_clone_t; +typedef struct ccmsg_ctx_clone_resp_t ccmsg_ctx_clone_resp_t; struct ccmsg_ctx_release_t { cc_handle ctx; /*# of ctx to release*/ @@ -103,7 +105,7 @@ struct ccmsg_ctx_get_change_time_t { cc_handle ctx; }; struct ccmsg_ctx_get_change_time_resp_t { - cc_time_t time; + cc_time64 time; }; typedef struct ccmsg_ctx_get_change_time_t ccmsg_ctx_get_change_time_t; typedef struct ccmsg_ctx_get_change_time_resp_t ccmsg_ctx_get_change_time_resp_t; @@ -304,7 +306,7 @@ struct ccmsg_ccache_get_last_default_time_t { cc_handle ccache; }; struct ccmsg_ccache_get_last_default_time_resp_t { - cc_time_t last_default_time; + cc_time64 last_default_time; }; typedef struct ccmsg_ccache_get_last_default_time_t ccmsg_ccache_get_last_default_time_t; typedef struct ccmsg_ccache_get_last_default_time_resp_t ccmsg_ccache_get_last_default_time_resp_t; @@ -314,7 +316,7 @@ struct ccmsg_ccache_get_change_time_t { cc_handle ccache; }; struct ccmsg_ccache_get_change_time_resp_t { - cc_time_t time; + cc_time64 time; }; typedef struct ccmsg_ccache_get_change_time_t ccmsg_ccache_get_change_time_t; typedef struct ccmsg_ccache_get_change_time_resp_t ccmsg_ccache_get_change_time_resp_t; @@ -336,7 +338,7 @@ struct ccmsg_ccache_get_kdc_time_offset_t { cc_int32 creds_version; }; struct ccmsg_ccache_get_kdc_time_offset_resp_t { - cc_time_t offset; + cc_time64 offset; }; typedef struct ccmsg_ccache_get_kdc_time_offset_t ccmsg_ccache_get_kdc_time_offset_t; typedef struct ccmsg_ccache_get_kdc_time_offset_resp_t ccmsg_ccache_get_kdc_time_offset_resp_t; @@ -344,7 +346,7 @@ typedef struct ccmsg_ccache_get_kdc_time_offset_resp_t ccmsg_ccache_get_kdc_time struct ccmsg_ccache_set_kdc_time_offset_t { cc_handle ctx; cc_handle ccache; - cc_time_t offset; + cc_time64 offset; cc_int32 creds_version; }; typedef struct ccmsg_ccache_set_kdc_time_offset_t ccmsg_ccache_set_kdc_time_offset_t; @@ -372,6 +374,16 @@ struct ccmsg_ccache_iterator_next_resp_t { typedef struct ccmsg_ccache_iterator_next_t ccmsg_ccache_iterator_next_t; typedef struct ccmsg_ccache_iterator_next_resp_t ccmsg_ccache_iterator_next_resp_t; +struct ccmsg_ccache_iterator_clone_t { + cc_handle ctx; + cc_handle iterator; +}; +struct ccmsg_ccache_iterator_clone_resp_t { + cc_handle iterator; +}; +typedef struct ccmsg_ccache_iterator_clone_t ccmsg_ccache_iterator_clone_t; +typedef struct ccmsg_ccache_iterator_clone_resp_t ccmsg_ccache_iterator_clone_resp_t; + struct ccmsg_creds_iterator_release_t { cc_handle ctx; cc_handle ccache; @@ -393,37 +405,14 @@ struct ccmsg_creds_iterator_next_resp_t { typedef struct ccmsg_creds_iterator_next_t ccmsg_creds_iterator_next_t; typedef struct ccmsg_creds_iterator_next_resp_t ccmsg_creds_iterator_next_resp_t; -struct ccmsg_creds_v4_t { - cc_uint32 offset; - cc_uint32 len; -}; -typedef struct ccmsg_creds_v4_t ccmsg_creds_v4_t; - -struct ccmsg_creds_v5_t { - cc_uint32 client_offset; - cc_uint32 client_len; - cc_uint32 server_offset; - cc_uint32 server_len; - cc_uint32 keyblock_offset; - cc_uint32 keyblock_len; - cc_time_t authtime; - cc_time_t starttime; - cc_time_t endtime; - cc_time_t renewtime; - cc_uint32 is_skey; - cc_uint32 ticket_flags; - cc_uint32 address_count; - cc_uint32 address_offset; - cc_uint32 address_len; - cc_uint32 ticket_offset; - cc_uint32 ticket_len; - cc_uint32 ticket2_offset; - cc_uint32 ticket2_len; - cc_uint32 authdata_count; - cc_uint32 authdata_offset; - cc_uint32 authdata_len; -}; -typedef struct ccmsg_creds_v5_t ccmsg_creds_v5_t; - +struct ccmsg_creds_iterator_clone_t { + cc_handle ctx; + cc_handle iterator; +}; +struct ccmsg_creds_iterator_clone_resp_t { + cc_handle iterator; +}; +typedef struct ccmsg_creds_iterator_clone_t ccmsg_creds_iterator_clone_t; +typedef struct ccmsg_creds_iterator_clone_resp_t ccmsg_creds_iterator_clone_resp_t; #endif /*__MSG_HEADERS_H__*/ -- cgit From 3d6591dd63c23bcc0ae68e94a960c85fd53daad0 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Mon, 5 Jun 2006 04:30:35 +0000 Subject: more updates git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18082 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/CredentialsCache.h | 4 + src/lib/ccapi/include/CredentialsCache2.h | 22 +++- src/lib/ccapi/include/datastore.h | 189 ++++++++++++++++++++++++++++++ src/lib/ccapi/include/rpc_auth.h | 71 +++++++++++ 4 files changed, 281 insertions(+), 5 deletions(-) create mode 100644 src/lib/ccapi/include/datastore.h create mode 100644 src/lib/ccapi/include/rpc_auth.h (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/CredentialsCache.h b/src/lib/ccapi/include/CredentialsCache.h index 7143da4e25..12748bb9d4 100644 --- a/src/lib/ccapi/include/CredentialsCache.h +++ b/src/lib/ccapi/include/CredentialsCache.h @@ -69,6 +69,10 @@ #include #endif +#if defined(_WIN32) +#include +#endif + #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ diff --git a/src/lib/ccapi/include/CredentialsCache2.h b/src/lib/ccapi/include/CredentialsCache2.h index 214d93a02f..706c869133 100644 --- a/src/lib/ccapi/include/CredentialsCache2.h +++ b/src/lib/ccapi/include/CredentialsCache2.h @@ -87,10 +87,10 @@ typedef struct cc_credentials_v5_compat { char* client; char* server; cc_data_compat keyblock; - cc_time_t authtime; - cc_time_t starttime; - cc_time_t endtime; - cc_time_t renew_till; + cc_time authtime; + cc_time starttime; + cc_time endtime; + cc_time renew_till; cc_uint32 is_skey; cc_uint32 ticket_flags; cc_data_compat** addresses; @@ -185,6 +185,13 @@ enum { CC_CRED_MAX }; +enum { + CC_LOCK_UNLOCK = 1, + CC_LOCK_READER = 2, + CC_LOCK_WRITER = 3, + CC_LOCK_NOBLOCK = 16 +}; + CCACHE_API cc_int32 cc_shutdown ( apiCB** ioContext); @@ -194,7 +201,7 @@ CCACHE_API cc_int32 cc_get_NC_info ( CCACHE_API cc_int32 cc_get_change_time ( apiCB* inContext, - cc_time_t* outTime); + cc_time* outTime); CCACHE_API cc_int32 cc_open ( apiCB* inContext, @@ -293,6 +300,11 @@ CCACHE_API cc_int32 cc_free_NC_info ( apiCB* inContext, infoNC*** ioInfo); +CCACHE_API cc_int32 cc_lock_request( + apiCB* inContext, + const ccache_p* inCCache, + const cc_int32 lock_type); + #if TARGET_OS_MAC #if defined(__MWERKS__) #pragma enumsalwaysint reset diff --git a/src/lib/ccapi/include/datastore.h b/src/lib/ccapi/include/datastore.h new file mode 100644 index 0000000000..4f119f969f --- /dev/null +++ b/src/lib/ccapi/include/datastore.h @@ -0,0 +1,189 @@ +/* $Copyright: + * + * Copyright 2004-2006 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 MIT 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. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Individual source code files are copyright MIT, Cygnus Support, + * OpenVision, Oracle, Sun Soft, FundsXpress, and others. + * + * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, + * and Zephyr are trademarks of the Massachusetts Institute of Technology + * (MIT). No commercial use of these trademarks may be made without prior + * written permission of MIT. + * + * "Commercial use" means use of a name in a product or other for-profit + * manner. It does NOT prevent a commercial firm from referring to the MIT + * trademarks in order to convey information (although in doing so, + * recognition of their trademark status should be given). + * $ + */ +/* + * Prototypes and data structures for datastore. + * + */ + + +#ifndef __CCDATASTOREH__ +#define __CCDATASTOREH__ + +#include "CredentialsCache.h" +#include "rpc_auth.h" +#include "generic_lists.h" + +enum cc_list_type { + generic = 0, + context, + cache, + credentials +}; + +struct cc_context_iterate_t { + cc_context_list_node_t* next; +}; +typedef struct cc_context_iterate_t cc_context_iterate_t; + +struct cc_ccache_iterate_t { + cc_ccache_list_node_t* next; +}; +typedef struct cc_ccache_iterate_t cc_ccache_iterate_t; + +struct cc_credentials_iterate_t { + cc_credentials_list_node_t* next; +}; +typedef struct cc_credentials_iterate_t cc_credentials_iterate_t; + +struct cc_lock { + cc_uint32 read_locks; /* count of read locks (>= 0) */ + cc_uint32 write_locks; /* count of write locks (0 or 1) */ + void * platform_data; /* platform specific implementation data */ +}; +typedef struct cc_lock cc_lock_t; + + +struct cc_server_context_t { + cc_ccache_list_head_t* ccaches; /*our ccaches*/ + cc_generic_list_head_t* active_iterators; /*active ccache iterators*/ + cc_int32 api_version; /*Version our client passed in on init (ccapi_version_X) */ + cc_auth_info_t* auth_info; /*auth info passed in from RPC*/ + cc_session_info_t* session_info; /*session info passed in from RPC*/ + cc_time64 changed; /*date of last change to this context*/ + cc_int32 error; /*last error code*/ + cc_lock_t locks; /*are we locked?*/ +}; +typedef struct cc_server_context_t cc_server_context_t; + +struct cc_server_ccache_t { + char* name; /*name of this ccache*/ + char* principal_v4; /*v4 principal associated with this cache*/ + char* principal_v5; /*v5 principal associated with this cache*/ + cc_uint32 versions; /*versions of creds supported (from cc_credentials enum in CredentialsCache.h)*/ + cc_time64 changed; /*date of last change to ccache*/ + cc_int32 kdc_set; /*is the KDC time offset initialized?*/ + cc_time64 kdc_offset; /*offset of our clock relative kdc*/ + cc_time64 last_default; /*the last date when we were default*/ + cc_int32 is_default; /*is this the default cred on this ccache?*/ + cc_generic_list_head_t* active_iterators; /*iterators which clients have opened on this cache*/ + cc_credentials_list_head_t* creds; /*list of creds stored in this ccache*/ + cc_server_context_t* mycontext; /*context to which I belong*/ + cc_lock_t locks; /*are we locked?*/ +}; +typedef struct cc_server_ccache_t cc_server_ccache_t; + +struct cc_server_credentials_t { + cc_int32 is_default; /*Are we the default cred? (first in list)*/ + cc_credentials_union creds; +}; +typedef struct cc_server_credentials_t cc_server_credentials_t; + + +/*Note: cci means Credential Cache Internal, to differentiate from exported API macros*/ + +cc_int32 ccs_context_iterate_has_next(struct cc_context_iterate_t *iterate); +cc_int32 ccs_context_iterate_next(struct cc_context_iterate_t *iterate, cc_context_list_node_t**); + +cc_int32 ccs_ccache_iterate_has_next(struct cc_ccache_iterate_t *iterate); +cc_int32 ccs_ccache_iterate_next(struct cc_ccache_iterate_t *iterate, cc_ccache_list_node_t**); + +cc_int32 ccs_credentials_iterate_has_next(cc_credentials_iterate_t *iterate); +cc_int32 ccs_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t **); + +cc_int32 ccs_context_list_new(cc_context_list_head_t**); +cc_int32 ccs_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**); +cc_int32 ccs_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t**); +cc_int32 ccs_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem); +cc_int32 ccs_context_list_iterator(cc_context_list_head_t *head, struct cc_context_iterate_t**); +cc_int32 ccs_context_free_iterator(struct cc_context_iterate_t *iterator); +cc_int32 ccs_context_list_destroy(cc_context_list_head_t* head) ; +cc_int32 ccs_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t**); + +cc_int32 ccs_ccache_list_new(cc_ccache_list_head_t**); +cc_int32 ccs_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**); +cc_int32 ccs_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t**); +cc_int32 ccs_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem); +cc_int32 ccs_ccache_list_iterator(cc_ccache_list_head_t *head, struct cc_ccache_iterate_t**); +cc_int32 ccs_ccache_free_iterator(struct cc_ccache_iterate_t *iterator); +cc_int32 ccs_ccache_list_destroy(cc_ccache_list_head_t* head) ; +cc_int32 ccs_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t**); + + +cc_int32 ccs_credentials_list_new(cc_credentials_list_head_t**); +cc_int32 ccs_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**); +cc_int32 ccs_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t**); +cc_int32 ccs_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem); +cc_int32 ccs_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t**); +cc_int32 ccs_credentials_free_iterator(cc_credentials_iterate_t* iterator); +cc_int32 ccs_credentials_list_destroy(cc_credentials_list_head_t* head) ; +cc_int32 ccs_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t**) ; + + +cc_int32 ccs_context_new(int api_version, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_server_context_t** ) ; +cc_int32 ccs_context_get_default_ccache_name(cc_server_context_t* ctx, char **); +cc_int32 ccs_context_find_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t**); +cc_int32 ccs_context_open_ccache(cc_server_context_t* ctx, char *name, cc_server_ccache_t** ); +cc_int32 ccs_context_create_ccache(cc_server_context_t* ctx, char *name, int creds_version, char *principal, cc_server_ccache_t**); +cc_int32 ccs_context_create_default_ccache(cc_server_context_t* ctx, int creds_version, char *principal, cc_server_ccache_t**); +cc_int32 ccs_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t**); +cc_int32 ccs_context_compare(cc_server_context_t* a, cc_server_context_t* b); +cc_int32 ccs_context_destroy(cc_server_context_t* ctx); +cc_int32 ccs_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache); + +cc_int32 ccs_ccache_new(char *name, char *principal, int cred_vers, cc_server_ccache_t**); +cc_int32 ccs_ccache_check_version(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat); +cc_int32 ccs_ccache_check_principal(const cc_server_ccache_t *ccache, const cc_credentials_union* creds, cc_uint32* compat); +cc_int32 ccs_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials); +cc_int32 ccs_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials); +cc_int32 ccs_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination); +cc_int32 ccs_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64* offset); +cc_int32 ccs_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64 offset); +cc_int32 ccs_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache); +cc_int32 ccs_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator); +cc_int32 ccs_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal); +cc_int32 ccs_ccache_set_principal(cc_server_ccache_t* ccache, cc_int32 version, char * principal); +cc_int32 ccs_ccache_free_principal(char * principal); +cc_int32 ccs_ccache_destroy(cc_server_ccache_t* ccache); +void ccs_ccache_changed(cc_server_ccache_t* ccache); +cc_int32 ccs_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result); +#endif /*__CCDATASTOREH__*/ diff --git a/src/lib/ccapi/include/rpc_auth.h b/src/lib/ccapi/include/rpc_auth.h new file mode 100644 index 0000000000..010a1e2a51 --- /dev/null +++ b/src/lib/ccapi/include/rpc_auth.h @@ -0,0 +1,71 @@ +/* $Copyright: + * + * Copyright 2004-2006 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 MIT 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. + * + * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED + * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF + * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE. + * + * Individual source code files are copyright MIT, Cygnus Support, + * OpenVision, Oracle, Sun Soft, FundsXpress, and others. + * + * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira, + * and Zephyr are trademarks of the Massachusetts Institute of Technology + * (MIT). No commercial use of these trademarks may be made without prior + * written permission of MIT. + * + * "Commercial use" means use of a name in a product or other for-profit + * manner. It does NOT prevent a commercial firm from referring to the MIT + * trademarks in order to convey information (although in doing so, + * recognition of their trademark status should be given). + * $ + */ + + +/* + * Types for RPC auth + session info + * + */ + +#ifndef __RPC_AUTH_H__ +#define __RPC_AUTH_H__ + +#include "CredentialsCache.h" + +/*preliminary*/ +struct cc_auth_info_t { + cc_uint8 *info; + cc_uint32 len; +}; +typedef struct cc_auth_info_t cc_auth_info_t; + +/*preliminary*/ +struct cc_session_info_t { + cc_uint8 *info; + cc_uint32 len; +}; +typedef struct cc_session_info_t cc_session_info_t; + +cc_int32 ccs_rpc_is_authorized(cc_auth_info_t* msg_auth, cc_session_info_t* msg_session, cc_auth_info_t* stored_auth, cc_session_info_t* stored_session, cc_uint32 *authorizedp); + +#endif /*__RPC_AUTH_H__*/ -- cgit From 2ab8b381a83da20415f8b6f52b329154276c59c2 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Fri, 9 Jun 2006 21:46:24 +0000 Subject: cci_msg_retrieve_blob(): changed argument 4 from void** to char** to suppress the warnings from gcc. git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18095 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/msg.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/msg.h b/src/lib/ccapi/include/msg.h index 182ebc1611..79b9a7f72e 100644 --- a/src/lib/ccapi/include/msg.h +++ b/src/lib/ccapi/include/msg.h @@ -139,7 +139,7 @@ cc_int32 cci_msg_flatten(cc_msg_t* msg, void **); cc_int32 cci_msg_calc_magic(void *flat, int flat_len, cc_uint32 * sizep); cc_int32 cci_msg_verify(void* flat, int flat_len, cc_uint32 * sizep); cc_int32 cci_msg_unflatten(void *flat, int flat_len, cc_msg_t** msgpp); -cc_int32 cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, void **); +cc_int32 cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, char **); cc_int32 cci_msg_destroy(cc_msg_t* msg); /* Add missing byte swapping macros for 64-bit values */ -- cgit From 816c50541d4af289c6dc737ab0cb945457d8bcaa Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Fri, 9 Jun 2006 21:55:32 +0000 Subject: moved enum cc_list_type to generic_lists.h to avoid "incomplete enum" warnings when compiling generic_lists.c git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18096 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/datastore.h | 7 ------- src/lib/ccapi/include/generic_lists.h | 7 +++++++ 2 files changed, 7 insertions(+), 7 deletions(-) (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/datastore.h b/src/lib/ccapi/include/datastore.h index 4f119f969f..7bb8b093d8 100644 --- a/src/lib/ccapi/include/datastore.h +++ b/src/lib/ccapi/include/datastore.h @@ -53,13 +53,6 @@ #include "rpc_auth.h" #include "generic_lists.h" -enum cc_list_type { - generic = 0, - context, - cache, - credentials -}; - struct cc_context_iterate_t { cc_context_list_node_t* next; }; diff --git a/src/lib/ccapi/include/generic_lists.h b/src/lib/ccapi/include/generic_lists.h index 4d49e276bd..14b7ae28c3 100644 --- a/src/lib/ccapi/include/generic_lists.h +++ b/src/lib/ccapi/include/generic_lists.h @@ -49,6 +49,13 @@ #ifndef __CC_GENERIC_LISTS_H_ #define __CC_GENERIC_LISTS_H_ +enum cc_list_type { + generic = 0, + context, + cache, + credentials +}; + struct cc_generic_list_node_t { cc_uint8* data; cc_uint32 len; -- cgit From 5432daabf38c08ca2d61dbc6aaefc5f1a3586ee3 Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Fri, 9 Jun 2006 21:56:15 +0000 Subject: Removed ancient Metrowerks tests from public headers git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18097 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/CredentialsCache.h | 25 ++++++------------------- src/lib/ccapi/include/CredentialsCache2.h | 20 +++++--------------- 2 files changed, 11 insertions(+), 34 deletions(-) (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/CredentialsCache.h b/src/lib/ccapi/include/CredentialsCache.h index 12748bb9d4..45b9ac4c47 100644 --- a/src/lib/ccapi/include/CredentialsCache.h +++ b/src/lib/ccapi/include/CredentialsCache.h @@ -59,14 +59,7 @@ #define __CREDENTIALSCACHE__ #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) - #include - #if TARGET_RT_MAC_CFM - #error "Use KfM 4.0 SDK headers for CFM compilation." - #endif -#endif - -#if TARGET_OS_MAC - #include +#include #endif #if defined(_WIN32) @@ -78,13 +71,9 @@ extern "C" { #endif /* __cplusplus */ #if TARGET_OS_MAC - #if defined(__MWERKS__) - #pragma import on - #pragma enumsalwaysint on - #endif - #pragma options align=mac68k +#pragma options align=mac68k #endif - + #if defined(_WIN32) #define CCACHE_API __declspec(dllexport) @@ -94,6 +83,8 @@ extern "C" { #endif /* _TIME_T_DEFINED */ #define _USE_32BIT_TIME_T #endif +#else +#define CCACHE_API #endif #include @@ -591,11 +582,7 @@ CCACHE_API cc_int32 cc_initialize ( ((iterator) -> functions -> clone (iterator, new_iter)) #if TARGET_OS_MAC - #if defined(__MWERKS__) - #pragma enumsalwaysint reset - #pragma import reset - #endif - #pragma options align=reset +#pragma options align=reset #endif #ifdef __cplusplus diff --git a/src/lib/ccapi/include/CredentialsCache2.h b/src/lib/ccapi/include/CredentialsCache2.h index 706c869133..5505bf29fe 100644 --- a/src/lib/ccapi/include/CredentialsCache2.h +++ b/src/lib/ccapi/include/CredentialsCache2.h @@ -49,11 +49,9 @@ #define __CREDENTIALSCACHE2__ #include "CredentialsCache.h" + #if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__)) - #include - #if TARGET_RT_MAC_CFM - #error "Use KfM 4.0 SDK headers for CFM compilation." - #endif +#include #endif #ifdef __cplusplus @@ -61,13 +59,9 @@ extern "C" { #endif /* __cplusplus */ #if TARGET_OS_MAC - #if defined(__MWERKS__) - #pragma import on - #pragma enumsalwaysint on - #endif - #pragma options align=mac68k +#pragma options align=mac68k #endif - + /* Some old types get directly mapped to new types */ typedef cc_context_d apiCB; @@ -306,11 +300,7 @@ CCACHE_API cc_int32 cc_lock_request( const cc_int32 lock_type); #if TARGET_OS_MAC - #if defined(__MWERKS__) - #pragma enumsalwaysint reset - #pragma import reset - #endif - #pragma options align=reset +#pragma options align=reset #endif #ifdef __cplusplus -- cgit From 66b03de7fa804d6b56810c7b986fa1b9f989b3b4 Mon Sep 17 00:00:00 2001 From: Jeffrey Altman Date: Thu, 22 Jun 2006 16:58:37 +0000 Subject: Fix parameter name in cc_credentials_iterator_t next() git-svn-id: svn://anonsvn.mit.edu/krb5/branches/ccapi@18194 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/ccapi/include/CredentialsCache.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lib/ccapi/include') diff --git a/src/lib/ccapi/include/CredentialsCache.h b/src/lib/ccapi/include/CredentialsCache.h index 45b9ac4c47..95c4fe79ba 100644 --- a/src/lib/ccapi/include/CredentialsCache.h +++ b/src/lib/ccapi/include/CredentialsCache.h @@ -475,7 +475,7 @@ struct cc_credentials_iterator_f { cc_credentials_iterator_t iter); cc_int32 (*next) ( cc_credentials_iterator_t iter, - cc_credentials_t* ccache); + cc_credentials_t* cred); cc_int32 (*clone) ( cc_credentials_iterator_t iter, cc_credentials_iterator_t* new_iter); -- cgit