+++ /dev/null
-CD = cd\r
-\r
-all:\r
- $(CD) common\r
- $(MAKE) -f NTMakefile all\r
- $(CD) ../client\r
- $(MAKE) -f NTMakefile all\r
- $(CD) ../server\r
- $(MAKE) -f NTMakefile all\r
- $(CD) ../windows\r
- $(MAKE) -f NTMakefile all\r
- $(CD) ..\r
-\r
-clean:\r
- $(CD) common\r
- $(MAKE) -f NTMakefile clean\r
- $(CD) ../client\r
- $(MAKE) -f NTMakefile clean\r
- $(CD) ../server\r
- $(MAKE) -f NTMakefile clean\r
- $(CD) ../windows\r
- $(MAKE) -f NTMakefile clean\r
- $(CD) ..\r
-\r
-\r
+++ /dev/null
-!INCLUDE <WIN32.MAK>
-
-CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)
-
-CC_CLIENT_OBJS = cacheapi.obj context.obj ccache.obj credentials.obj ccache_iterator.obj \
- credentials_iterator.obj ccstring.obj ccapiv2.obj
-
-CC_CLIENT_LIB = cc_client.lib
-
-CC_COMMON_LIB = ..\common\cc_common.lib
-
-$(CC_CLIENT_LIB): $(CC_CLIENT_OBJS)
- $(implib) /NOLOGO /OUT:$@ $**
-
-all: $(CC_CLIENT_LIB)
-
-clean:
- del *.obj *.lib
+++ /dev/null
-/* $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).
- * $
- */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <CredentialsCache.h>
-#include "ccache.h"
-#include "ccache_iterator.h"
-#include "context.h"
-#include "cc_rpc.h"
-#include "msg.h"
-#include "msg_headers.h"
-
-/*! \fn cc_initialize
- * \brief A function that initializes a ccapi context for the caller.
- * \param[out] outContext a cc_context_t pointer to which is assigned the newly created context upon success.
- * \param[in] inVersion a cc_int32 that specifies the
- */
-
-CCACHE_API cc_int32
-cc_initialize ( cc_context_t* outContext,
- cc_int32 inVersion,
- cc_int32* outSupportedVersion,
- char const** outVendor)
-{
- static char vendor[128] = "";
- cc_msg_t *request = NULL;
- ccmsg_init_t *request_header;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- ccmsg_init_resp_t *response_header;
- cc_int32 code;
-
- if ((inVersion != ccapi_version_2) &&
- (inVersion != ccapi_version_3) &&
- (inVersion != ccapi_version_4) &&
- (inVersion != ccapi_version_5) &&
- (inVersion != ccapi_version_6)) {
-
- if (outSupportedVersion != NULL) {
- *outSupportedVersion = ccapi_version_6;
- }
- return ccErrBadAPIVersion;
- }
-
- request_header = (ccmsg_init_t*)malloc(sizeof(ccmsg_init_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- /* If the version number is 2, the caller will be passing
- * the structure into the v2 compatibility functions which
- * in turn will call the v6 functions. Set the version to
- * ccapi_version_max since that is what the compatibility
- * functions will be expecting.
- */
- if (inVersion == ccapi_version_2)
- inVersion = ccapi_version_max;
-
- /* Construct the request */
- request_header->in_version = htonl(inVersion);
-
- code = cci_msg_new(ccmsg_INIT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_init_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_init_resp_t *)response->header;
- *outSupportedVersion = ntohl(response_header->out_version);
- code = cc_int_context_new(outContext, ntohll(response_header->out_ctx), ntohl(response_header->out_version));
-
- if (!vendor[0]) {
- char * string;
- code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);
- strncpy(vendor, string, sizeof(vendor)-1);
- vendor[sizeof(vendor)-1] = '\0';
- free(string);
- }
- *outVendor = vendor;
-
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
-
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
+++ /dev/null
-/* $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).
- * $
- */
-
-
-/* ccache.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <CredentialsCache.h>
-#include "credentials.h"
-#include "credentials_iterator.h"
-#include "ccache.h"
-#include "cc_rpc.h"
-#include "msg.h"
-#include "msg_headers.h"
-#include "ccstring.h"
-
-/*
- * cc_int_ccache_new
- *
- * Input parameters in host order.
- */
-
-cc_int32
-cc_int_ccache_new( cc_ccache_t * pccache, cc_handle hctx, cc_handle hccache )
-{
- cc_int_ccache_t ccache = (cc_int_ccache_t)malloc(sizeof(cc_int_ccache_d));
- if ( ccache == NULL )
- return ccErrNoMem;
-
- ccache->functions = (cc_ccache_f*)malloc(sizeof(cc_ccache_f));
- if ( ccache->functions == NULL ) {
- free(ccache);
- return ccErrNoMem;
- }
-
- ccache->functions->release = cc_int_ccache_release;
- ccache->functions->destroy = cc_int_ccache_destroy;
- ccache->functions->set_default = cc_int_ccache_set_default;
- ccache->functions->get_credentials_version = cc_int_ccache_get_credentials_version;
- ccache->functions->get_name = cc_int_ccache_get_name;
- ccache->functions->get_principal = cc_int_ccache_get_principal;
- ccache->functions->set_principal = cc_int_ccache_set_principal;
- ccache->functions->store_credentials = cc_int_ccache_store_credentials;
- ccache->functions->remove_credentials = cc_int_ccache_remove_credentials;
- ccache->functions->new_credentials_iterator = cc_int_ccache_new_credentials_iterator;
- ccache->functions->move = cc_int_ccache_move;
- ccache->functions->lock = cc_int_ccache_lock;
- ccache->functions->unlock = cc_int_ccache_unlock;
- ccache->functions->get_last_default_time = cc_int_ccache_get_last_default_time;
- ccache->functions->get_change_time = cc_int_ccache_get_change_time;
- ccache->functions->compare = cc_int_ccache_compare;
- ccache->functions->get_kdc_time_offset = cc_int_ccache_get_kdc_time_offset;
- ccache->functions->set_kdc_time_offset = cc_int_ccache_set_kdc_time_offset;
- ccache->functions->clear_kdc_time_offset = cc_int_ccache_clear_kdc_time_offset;
-
- ccache->magic = CC_CCACHE_MAGIC;
- ccache->ctx = hctx;
- ccache->handle = hccache;
-
- *pccache = (cc_ccache_t)ccache;
-
- return ccNoError;
-}
-
-cc_int32
-cc_int_ccache_release( cc_ccache_t ccache )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_release_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_release_t*)malloc(sizeof(ccmsg_ccache_release_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_RELEASE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_release_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- if (int_ccache->functions)
- free(int_ccache->functions);
- free(int_ccache);
- return code;
-}
-
-
-cc_int32
-cc_int_ccache_destroy( cc_ccache_t ccache )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_destroy_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_destroy_t*)malloc(sizeof(ccmsg_ccache_destroy_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_DESTROY, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_destroy_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- free(ccache);
- return code;
-}
-
-
-cc_int32
-cc_int_ccache_set_default( cc_ccache_t ccache )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_set_default_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_set_default_t*)malloc(sizeof(ccmsg_ccache_set_default_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_SET_DEFAULT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_default_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_get_credentials_version( cc_ccache_t ccache,
- cc_uint32* credentials_version)
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_creds_version_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_creds_version_t*)malloc(sizeof(ccmsg_ccache_get_creds_version_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_CREDS_VERSION, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_creds_version_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_get_creds_version_resp_t * response_header = (ccmsg_ccache_get_creds_version_resp_t*)response->header;
- *credentials_version = ntohl(response_header->version);
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_get_name( cc_ccache_t ccache, cc_string_t* name )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_name_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_name_t*)malloc(sizeof(ccmsg_ccache_get_name_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_NAME, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_name_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- char * string;
- ccmsg_ccache_get_name_resp_t * response_header = (ccmsg_ccache_get_name_resp_t*)response->header;
- code = cci_msg_retrieve_blob(response, response_header->name_offset,
- response_header->name_len, &string);
- if (code == ccNoError) {
- code = cci_string_new(name, string);
- free(string);
- }
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_get_principal( cc_ccache_t ccache,
- cc_uint32 credentials_version,
- cc_string_t* principal )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_principal_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_principal_t*)malloc(sizeof(ccmsg_ccache_get_principal_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->version = htonl(credentials_version);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_PRINCIPAL, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_principal_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- char * string;
- ccmsg_ccache_get_principal_resp_t * response_header = (ccmsg_ccache_get_principal_resp_t*)response->header;
- code = cci_msg_retrieve_blob(response, response_header->principal_offset,
- response_header->principal_len, &string);
- if (code == ccNoError) {
- code = cci_string_new(principal, string);
- free(string);
- }
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_set_principal( cc_ccache_t ccache,
- cc_uint32 credentials_version,
- const char* principal )
-{
- cc_uint32 blob_pos;
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_set_principal_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_set_principal_t*)malloc(sizeof(ccmsg_ccache_set_principal_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->version = htonl(credentials_version);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_PRINCIPAL, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_data_blob(request, (void*)principal, strlen(principal) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->principal_offset = htonl(blob_pos);
- request_header->principal_len = htonl(strlen(principal) + 1);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_principal_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_new_credentials_iterator( cc_ccache_t ccache,
- cc_credentials_iterator_t* iterator )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_creds_iterator_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_creds_iterator_t*)malloc(sizeof(ccmsg_ccache_creds_iterator_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_NEW_CREDS_ITERATOR, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_creds_iterator_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_creds_iterator_resp_t * response_header = (ccmsg_ccache_creds_iterator_resp_t*)response->header;
- code = cc_int_credentials_iterator_new(iterator, int_ccache->ctx, int_ccache->handle,
- ntohll(response_header->iterator));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_store_credentials( cc_ccache_t ccache,
- const cc_credentials_union* credentials )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_store_creds_t *request_header = NULL;
- cc_msg_t *response = NULL;
- char *flat_cred = 0;
- cc_uint32 flat_cred_len = 0;
- cc_uint32 blob_pos;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL || credentials == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_store_creds_t*)malloc(sizeof(ccmsg_ccache_store_creds_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_STORE_CREDS, &request);
- if (code != ccNoError)
- goto cleanup;
-
- switch ( credentials->version ) {
- case cc_credentials_v4:
- code = cci_creds_v4_marshall(credentials->credentials.credentials_v4, &flat_cred, &flat_cred_len);
- break;
- case cc_credentials_v5:
- code = cci_creds_v5_marshall(credentials->credentials.credentials_v5, &flat_cred, &flat_cred_len);
- break;
- default:
- code = ccErrBadCredentialsVersion;
- }
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_data_blob(request, (void*)flat_cred, flat_cred_len, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->creds_version = htonl(credentials->version);
- request_header->creds_offset = htonl(blob_pos);
- request_header->creds_len = htonl(flat_cred_len);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_store_creds_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (flat_cred)
- free(flat_cred);
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_remove_credentials( cc_ccache_t ccache,
- cc_credentials_t credentials )
-{
- cc_int_ccache_t int_ccache;
- cc_int_credentials_t int_creds;
- cc_msg_t *request = NULL;
- ccmsg_ccache_rem_creds_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL || credentials == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
- int_creds = (cc_int_credentials_t)credentials;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- if ( int_creds->magic != CC_CREDS_MAGIC )
- return ccErrInvalidCredentials;
-
- request_header = (ccmsg_ccache_rem_creds_t*)malloc(sizeof(ccmsg_ccache_rem_creds_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->creds = htonll(int_creds->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_REM_CREDS, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_rem_creds_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-
-cc_int32
-cc_int_ccache_move( cc_ccache_t source,
- cc_ccache_t destination )
-{
- cc_int_ccache_t int_ccache_source;
- cc_int_ccache_t int_ccache_dest;
- cc_msg_t *request = NULL;
- ccmsg_ccache_move_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( source == NULL || destination == NULL )
- return ccErrBadParam;
-
- int_ccache_source = (cc_int_ccache_t)source;
- int_ccache_dest = (cc_int_ccache_t)destination;
-
- if ( int_ccache_source->magic != CC_CCACHE_MAGIC ||
- int_ccache_dest->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- if ( int_ccache_source->ctx != int_ccache_dest->ctx )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_move_t*)malloc(sizeof(ccmsg_ccache_move_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CCACHE_MOVE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_ccache_source->ctx);
- request_header->ccache_source = htonll(int_ccache_source->handle);
- request_header->ccache_dest = htonll(int_ccache_dest->handle);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_move_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_lock( cc_ccache_t ccache,
- cc_uint32 lock_type,
- cc_uint32 block )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_lock_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL ||
- (lock_type != cc_lock_read && lock_type != cc_lock_write &&
- lock_type != cc_lock_upgrade && lock_type != cc_lock_downgrade) ||
- (block != cc_lock_block && block != cc_lock_noblock) )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_lock_t*)malloc(sizeof(ccmsg_ccache_lock_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CCACHE_LOCK, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->lock_type = htonl(lock_type);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_lock_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
-
- // TODO: if (block == cc_lock_block) .....
- } else if (response->type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_unlock( cc_ccache_t ccache )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_unlock_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_unlock_t*)malloc(sizeof(ccmsg_ccache_unlock_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CCACHE_UNLOCK, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_unlock_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = htonl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = htonl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-
-cc_int32
-cc_int_ccache_get_last_default_time( cc_ccache_t ccache,
- cc_time* time_offset )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_last_default_time_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_time64 t64;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_last_default_time_t*)malloc(sizeof(ccmsg_ccache_get_last_default_time_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_LAST_DEFAULT_TIME, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_last_default_time_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_get_last_default_time_resp_t * response_header = (ccmsg_ccache_get_last_default_time_resp_t*)response->header;
- t64 = ntohll(response_header->last_default_time);
- /* TODO: validate that we do not overflow the max value of time_offset */
- *time_offset = t64;
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_get_change_time( cc_ccache_t ccache, cc_time* change_time )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_change_time_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_time64 t64;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_change_time_t*)malloc(sizeof(ccmsg_ccache_get_change_time_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_CHANGE_TIME, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_change_time_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_get_change_time_resp_t * response_header = (ccmsg_ccache_get_change_time_resp_t*)response->header;
- t64 = htonll(response_header->time);
- /* TODO: validate that we do not overflow 'time' */
- *change_time = t64;
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_compare( cc_ccache_t ccache,
- cc_ccache_t compare_to,
- cc_uint32* equal )
-{
- cc_int_ccache_t int_ccache;
- cc_int_ccache_t int_compare_to;
- cc_msg_t *request = NULL;
- ccmsg_ccache_compare_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
- int_compare_to = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC ||
- int_compare_to->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_compare_t*)malloc(sizeof(ccmsg_ccache_compare_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache1 = htonll(int_ccache->handle);
- request_header->ccache2 = htonll(int_compare_to->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_COMPARE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_compare_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_compare_resp_t * response_header = (ccmsg_ccache_compare_resp_t*)response->header;
- *equal = ntohl(response_header->is_equal);
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_get_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version,
- cc_time* time_offset )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_get_kdc_time_offset_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_get_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_get_kdc_time_offset_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->creds_version = htonl(credentials_version);
-
- code = cci_msg_new(ccmsg_CCACHE_GET_KDC_TIME_OFFSET, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_get_kdc_time_offset_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (response->type == ccmsg_ACK) {
- ccmsg_ccache_get_kdc_time_offset_resp_t * response_header = (ccmsg_ccache_get_kdc_time_offset_resp_t*)response->header;
- *time_offset = (cc_time64)ntohll(response_header->offset);
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_set_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version,
- cc_time time_offset )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_set_kdc_time_offset_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_int64 t64;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_set_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_set_kdc_time_offset_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->creds_version = htonl(credentials_version);
- t64 = time_offset;
- request_header->offset = htonll(t64);
-
- code = cci_msg_new(ccmsg_CCACHE_SET_KDC_TIME_OFFSET, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_set_kdc_time_offset_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_clear_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version )
-{
- cc_int_ccache_t int_ccache;
- cc_msg_t *request = NULL;
- ccmsg_ccache_clear_kdc_time_offset_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_ccache = (cc_int_ccache_t)ccache;
-
- if ( int_ccache->magic != CC_CCACHE_MAGIC )
- return ccErrInvalidCCache;
-
- request_header = (ccmsg_ccache_clear_kdc_time_offset_t*)malloc(sizeof(ccmsg_ccache_clear_kdc_time_offset_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_ccache->ctx);
- request_header->ccache = htonll(int_ccache->handle);
- request_header->creds_version = htonl(credentials_version);
-
- code = cci_msg_new(ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_clear_kdc_time_offset_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
+++ /dev/null
-/* $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).
- * $
- */
-
-/* ccache.h */
-
-#define CC_CCACHE_MAGIC ('C'<<24 | 'C'<<16 | 'A'<<8 | 'C')
-
-struct cc_int_ccache_d {
- cc_ccache_f* functions;
-#if TARGET_OS_MAC
- const cc_ccache_f* otherFunctions;
-#endif
- cc_uint32 magic;
- cc_handle handle;
- cc_handle ctx;
-};
-typedef struct cc_int_ccache_d cc_int_ccache_d;
-typedef cc_int_ccache_d* cc_int_ccache_t;
-
-
-cc_int32
-cc_int_ccache_new( cc_ccache_t * pccache, cc_handle hctx, cc_handle hccache );
-
-cc_int32
-cc_int_ccache_release( cc_ccache_t ccache );
-
-cc_int32
-cc_int_ccache_destroy( cc_ccache_t ccache );
-
-cc_int32
-cc_int_ccache_set_default( cc_ccache_t ccache );
-
-cc_int32
-cc_int_ccache_get_credentials_version( cc_ccache_t ccache,
- cc_uint32* credentials_version);
-
-cc_int32
-cc_int_ccache_get_name( cc_ccache_t ccache,
- cc_string_t* name );
-
-cc_int32
-cc_int_ccache_get_principal( cc_ccache_t ccache,
- cc_uint32 credentials_version,
- cc_string_t* principal );
-
-cc_int32
-cc_int_ccache_set_principal( cc_ccache_t ccache,
- cc_uint32 credentials_version,
- const char* principal );
-
-cc_int32
-cc_int_ccache_store_credentials( cc_ccache_t ccache,
- const cc_credentials_union* credentials );
-
-cc_int32
-cc_int_ccache_remove_credentials( cc_ccache_t ccache,
- cc_credentials_t credentials );
-
-cc_int32
-cc_int_ccache_new_credentials_iterator( cc_ccache_t ccache,
- cc_credentials_iterator_t* iterator );
-
-cc_int32
-cc_int_ccache_move( cc_ccache_t source,
- cc_ccache_t destination );
-
-cc_int32
-cc_int_ccache_lock( cc_ccache_t ccache,
- cc_uint32 block,
- cc_uint32 lock_type );
-
-cc_int32
-cc_int_ccache_unlock( cc_ccache_t ccache );
-
-cc_int32
-cc_int_ccache_get_last_default_time( cc_ccache_t ccache,
- cc_time* last_default_tim );
-
-cc_int32
-cc_int_ccache_get_change_time( cc_ccache_t ccache,
- cc_time* change_time );
-
-cc_int32
-cc_int_ccache_compare( cc_ccache_t ccache,
- cc_ccache_t compare_to,
- cc_uint32* equal );
-
-cc_int32
-cc_int_ccache_get_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version,
- cc_time* kdc_time_offset );
-
-cc_int32
-cc_int_ccache_set_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version,
- cc_time kdc_time_offset );
-
-cc_int32
-cc_int_ccache_clear_kdc_time_offset( cc_ccache_t ccache,
- cc_int32 credentials_version );
-
-
-cc_int32
-cc_int_ccache_compat_clone( cc_int_ccache_t ccache,
- cc_int_ccache_t *clone );
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/* ccache_iterator.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <CredentialsCache.h>
-#include "ccache.h"
-#include "ccache_iterator.h"
-#include "cc_rpc.h"
-#include "msg.h"
-#include "msg_headers.h"
-
-
-cc_int32
-cc_int_ccache_iterator_new( cc_ccache_iterator_t * piter,
- cc_handle ctx,
- cc_handle handle )
-{
- cc_int_ccache_iterator_t iter = NULL;
-
- if ( piter == NULL )
- return ccErrBadParam;
-
- iter = (cc_int_ccache_iterator_t) malloc( sizeof(cc_int_ccache_iterator_d) );
- if ( iter == NULL )
- return ccErrNoMem;
-
- iter->functions = (cc_ccache_iterator_f*)malloc( sizeof(cc_ccache_iterator_f));
- if ( iter->functions == NULL ) {
- free(iter);
- return ccErrNoMem;
- }
-
- iter->functions->release = cc_int_ccache_iterator_release;
- iter->functions->next = cc_int_ccache_iterator_next;
- iter->magic = CC_CCACHE_ITER_MAGIC;
- iter->ctx = ctx;
- iter->handle = handle;
-
- *piter = (cc_ccache_iterator_t)iter;
- return ccNoError;
-}
-
-cc_int32
-cc_int_ccache_iterator_release( cc_ccache_iterator_t iter )
-{
- cc_int_ccache_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_ccache_iterator_release_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
-
- if ( iter == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_ccache_iterator_t) iter;
-
- if ( int_iter->magic != CC_CCACHE_ITER_MAGIC )
- return ccErrInvalidCCacheIterator;
-
- request_header = (ccmsg_ccache_iterator_release_t*)malloc(sizeof(ccmsg_ccache_iterator_release_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->iterator = htonll(int_iter->handle);
- code = cci_msg_new(ccmsg_CCACHE_ITERATOR_RELEASE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_release_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
-
- if (int_iter->functions)
- free(int_iter->functions);
- if (iter)
- free(int_iter);
- return ccNoError;
-}
-
-cc_int32
-cc_int_ccache_iterator_next( cc_ccache_iterator_t iter,
- cc_ccache_t * ccache )
-{
- cc_int_ccache_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_ccache_iterator_next_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( ccache == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_ccache_iterator_t)iter;
-
- if ( int_iter->magic != CC_CCACHE_ITER_MAGIC )
- return ccErrInvalidCCacheIterator;
-
- request_header = (ccmsg_ccache_iterator_next_t*)malloc(sizeof(ccmsg_ccache_iterator_next_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->iterator = htonll(int_iter->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_ITERATOR_NEXT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_next_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = nack_header->err_code;
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_iterator_next_resp_t * response_header = (ccmsg_ccache_iterator_next_resp_t*)response->header;
- code = cc_int_ccache_new(ccache, int_iter->ctx, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_ccache_iterator_clone( cc_ccache_iterator_t iter,
- cc_ccache_iterator_t * new_iter )
-{
- cc_int_ccache_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_ccache_iterator_clone_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( iter == NULL || new_iter == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_ccache_iterator_t)iter;
-
- if ( int_iter->magic != CC_CCACHE_ITER_MAGIC )
- return ccErrInvalidCCacheIterator;
-
- request_header = (ccmsg_ccache_iterator_clone_t*)malloc(sizeof(ccmsg_ccache_iterator_clone_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->iterator = htonll(int_iter->handle);
-
- code = cci_msg_new(ccmsg_CCACHE_ITERATOR_CLONE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_iterator_clone_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_ccache_iterator_clone_resp_t * response_header = (ccmsg_ccache_iterator_clone_resp_t*)response->header;
- code = cc_int_ccache_iterator_new(new_iter, int_iter->ctx, ntohll(response_header->iterator));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
+++ /dev/null
-/* $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).
- * $
- */
-
-/* ccache_iterator.h */
-
-#define CC_CCACHE_ITER_MAGIC ('C'<<24 | 'C'<<16 | 'I'<<8 | 'T')
-
-struct cc_int_ccache_iterator_d {
- cc_ccache_iterator_f* functions;
-#if TARGET_OS_MAC
- cc_ccache_iterator_f* otherFunctions;
-#endif
- cc_uint32 magic;
- cc_handle handle;
- cc_handle ctx;
-
- cc_uint32 repeat_count;
- cc_ccache_t compat_copy;
-};
-typedef struct cc_int_ccache_iterator_d cc_int_ccache_iterator_d;
-typedef cc_int_ccache_iterator_d* cc_int_ccache_iterator_t;
-
-
-cc_int32
-cc_int_ccache_iterator_new( cc_ccache_iterator_t * piter,
- cc_handle ctx,
- cc_handle handle );
-
-cc_int32
-cc_int_ccache_iterator_release( cc_ccache_iterator_t iter );
-
-cc_int32
-cc_int_ccache_iterator_next( cc_ccache_iterator_t iter,
- cc_ccache_t * ccache );
-
-cc_int32
-cc_int_ccache_iterator_clone( cc_ccache_iterator_t iter,
- cc_ccache_iterator_t * iter_new );
-
-cc_int32
-cc_int_ccache_iterator_set_repeat_count( cc_int_ccache_iterator_t iter,
- cc_uint32 count );
-
-cc_int32
-cc_int_ccache_iterator_get_repeat_count( cc_int_ccache_iterator_t iter,
- cc_uint32 * count );
-
-
-
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 1998-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-/*\r
- * This is backwards compatibility for CCache API v2 clients to be able to run \r
- * against the CCache API v3 library\r
- */\r
- \r
-#include "CredentialsCache2.h"\r
-\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif /* __cplusplus */\r
-\r
-CCACHE_API cc_int32 cc_shutdown (\r
- apiCB** ioContext)\r
-{\r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_get_NC_info (\r
- apiCB* inContext,\r
- infoNC*** outInfo)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_get_change_time (\r
- apiCB* inContext,\r
- cc_time* outTime)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_open (\r
- apiCB* inContext,\r
- const char* inName,\r
- cc_int32 inVersion,\r
- cc_uint32 inFlags,\r
- ccache_p** outCCache)\r
-{\r
- if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
- return CC_ERR_CRED_VERSION;\r
-\r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_create (\r
- apiCB* inContext,\r
- const char* inName,\r
- const char* inPrincipal,\r
- cc_int32 inVersion,\r
- cc_uint32 inFlags,\r
- ccache_p** outCCache)\r
-{\r
- if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
- return CC_ERR_CRED_VERSION;\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_close (\r
- apiCB* inContext,\r
- ccache_p** ioCCache)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_destroy (\r
- apiCB* inContext,\r
- ccache_p** ioCCache)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_seq_fetch_NCs_begin (\r
- apiCB* inContext,\r
- ccache_cit** outIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_seq_fetch_NCs_next (\r
- apiCB* inContext,\r
- ccache_p** outCCache,\r
- ccache_cit* inIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_seq_fetch_NCs_end (\r
- apiCB* inContext,\r
- ccache_cit** ioIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_get_name (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- char** outName)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_get_cred_version (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- cc_int32* outVersion)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_set_principal (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- cc_int32 inVersion,\r
- char* inPrincipal)\r
-{\r
- if (inVersion != CC_CRED_V4 && inVersion != CC_CRED_V5)\r
- return CC_ERR_CRED_VERSION;\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_get_principal (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- char** outPrincipal)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_store (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- cred_union inCredentials)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_remove_cred (\r
- apiCB* inContext,\r
- ccache_p* inCCache,\r
- cred_union inCredentials)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_seq_fetch_creds_begin (\r
- apiCB* inContext,\r
- const ccache_p* inCCache,\r
- ccache_cit** outIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_seq_fetch_creds_next (\r
- apiCB* inContext,\r
- cred_union** outCreds,\r
- ccache_cit* inIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_seq_fetch_creds_end (\r
- apiCB* inContext,\r
- ccache_cit** ioIterator)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
- \r
-CCACHE_API cc_int32 cc_free_principal (\r
- apiCB* inContext,\r
- char** ioPrincipal)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_free_name (\r
- apiCB* inContext,\r
- char** ioName)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_free_creds (\r
- apiCB* inContext,\r
- cred_union** creds)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_free_NC_info (\r
- apiCB* inContext,\r
- infoNC*** ioInfo)\r
-{\r
- \r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-CCACHE_API cc_int32 cc_lock_request(\r
- apiCB* inContext,\r
- const ccache_p* inCCache,\r
- const cc_int32 lock_type)\r
-{\r
- /* replace this return value when the function is implemented */\r
- return CC_NOT_SUPP;\r
-}\r
-\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif /* __cplusplus */\r
-\r
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-/* ccstring.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <CredentialsCache.h>
-#include "ccstring.h"
-
-cc_int32
-cci_string_new( cc_string_t * pstring, char * data )
-{
- cci_string_t string = (cci_string_t)malloc(sizeof(cci_string_d));
- if ( string == NULL )
- return ccErrNoMem;
-
- string->functions = (cc_string_f *)malloc(sizeof(cc_string_f));
- if ( string->functions == NULL ) {
- free(string);
- return ccErrNoMem;
- }
-
- string->magic = CC_STRING_MAGIC;
- string->functions->release = cci_string_release;
-
- string->data = strdup(data);
- if ( string->data == NULL ) {
- free(string->functions);
- free(string);
- return ccErrNoMem;
- }
-
- *pstring = (cc_string_t)string;
- return ccNoError;
-}
-
-cc_int32
-cci_string_release( cc_string_t str )
-{
- cci_string_t int_string;
- if ( str == NULL )
- return ccErrBadParam;
-
- int_string = (cci_string_t)str;
- if ( int_string->magic != CC_STRING_MAGIC )
- return ccErrInvalidString;
-
- free(int_string->functions);
- free(int_string->data);
- free(int_string);
- return ccNoError;
-}
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-/* ccstring.h */
-
-#define CC_STRING_MAGIC ('S'<<24 | 'T'<<16 | 'R'<<8 | 'I')
-
-struct cci_string_d {
- char* data;
- cc_string_f* functions;
-#if TARGET_OS_MAC
- cc_string_f* otherFunctions;
-#endif
- cc_uint32 magic;
-};
-typedef struct cci_string_d cci_string_d;
-typedef cci_string_d* cci_string_t;
-
-cc_int32
-cci_string_new( cc_string_t * pstring, char * data );
-
-cc_int32
-cci_string_release( cc_string_t string );
-
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/* context.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <CredentialsCache.h>
-#include "context.h"
-#include "ccache.h"
-#include "ccache_iterator.h"
-#include "cc_rpc.h"
-#include "msg.h"
-#include "msg_headers.h"
-#include "ccstring.h"
-
-/* cc_int_context_new
- *
- * input parameters (handle, version) are in host order
- */
-
-cc_int32
-cc_int_context_new( cc_context_t * pcontext, cc_handle handle, cc_uint32 version )
-{
- cc_int_context_t context = (cc_int_context_t)malloc(sizeof(cc_int_context_d));
- if (context == NULL)
- return ccErrNoMem;
-
- context->functions = (cc_context_f*)malloc(sizeof(cc_context_f));
- if (context->functions == NULL) {
- free(context);
- return ccErrNoMem;
- }
-
- context->functions->release = cc_int_context_release;
- context->functions->get_change_time = cc_int_context_get_change_time;
- context->functions->get_default_ccache_name = cc_int_context_get_default_ccache_name;
- context->functions->open_ccache = cc_int_context_open_ccache;
- context->functions->open_default_ccache = cc_int_context_open_default_ccache;
- context->functions->create_ccache = cc_int_context_create_ccache;
- context->functions->create_default_ccache = cc_int_context_create_default_ccache;
- context->functions->create_new_ccache = cc_int_context_create_new_ccache;
- context->functions->new_ccache_iterator = cc_int_context_new_ccache_iterator;
- context->functions->lock = cc_int_context_lock;
- context->functions->unlock = cc_int_context_unlock;
- context->functions->compare = cc_int_context_compare;
-
- context->magic = CC_CONTEXT_MAGIC;
- context->handle = handle;
- context->api_version = version;
-
- *pcontext = (cc_context_t)context;
- return ccNoError;
-}
-
-cc_int32
-cc_int_context_release( cc_context_t context )
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_release_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_release_t*)malloc(sizeof(ccmsg_ctx_release_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_new(ccmsg_CTX_RELEASE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_release_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- request_header = NULL;
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- free(int_context->functions);
- free(int_context);
- return code;
-}
-
-cc_int32
-cc_int_context_get_change_time( cc_context_t context,
- cc_time* change_time)
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_get_change_time_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ctx_get_change_time_resp_t *response_header;
- cc_time64 t64;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || time == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_get_change_time_t*)malloc(sizeof(ccmsg_ctx_get_change_time_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_new(ccmsg_CTX_GET_CHANGE_TIME, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_get_change_time_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (response->type == ccmsg_ACK) {
- response_header = (ccmsg_ctx_get_change_time_resp_t*)response->header;
- t64 = ntohll(response_header->time);
- /* TODO: validate that value is not greater than can fit in cc_time */
- *change_time = (cc_time)t64;
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_get_default_ccache_name( cc_context_t context,
- cc_string_t* name )
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_get_default_ccache_name_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ctx_get_default_ccache_name_resp_t *response_header;
- char *string = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || name == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_get_default_ccache_name_t*)malloc(sizeof(ccmsg_ctx_get_default_ccache_name_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_new(ccmsg_CTX_GET_DEFAULT_CCACHE_NAME, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_get_default_ccache_name_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ctx_get_default_ccache_name_resp_t*)response->header;
- code = cci_msg_retrieve_blob(response, response_header->name_offset,
- response_header->name_len, &string);
- if (code == ccNoError)
- code = cci_string_new(name, string);
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (string)
- free(string);
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_compare( cc_context_t context,
- cc_context_t compare_to,
- cc_uint32* equal )
-{
- cc_int_context_t int_context, int_compare_to;
- cc_msg_t *request = NULL;
- ccmsg_ctx_compare_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ctx_compare_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || compare_to == NULL ||
- equal == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
- int_compare_to = (cc_int_context_t)compare_to;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC ||
- int_compare_to->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_compare_t*)malloc(sizeof(ccmsg_ctx_compare_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx1 = htonll(int_context->handle);
- request_header->ctx2 = htonll(int_compare_to->handle);
-
- code = cci_msg_new(ccmsg_CTX_COMPARE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_compare_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ctx_compare_resp_t*)response->header;
- *equal = ntohl(response_header->is_equal);
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-
-cc_int32
-cc_int_context_new_ccache_iterator( cc_context_t context,
- cc_ccache_iterator_t* iterator )
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_new_ccache_iterator_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ctx_new_ccache_iterator_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || iterator == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_new_ccache_iterator_t*)malloc(sizeof(ccmsg_ctx_new_ccache_iterator_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_new(ccmsg_CTX_NEW_CCACHE_ITERATOR, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_new_ccache_iterator_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ctx_new_ccache_iterator_resp_t*)response->header;
- code = cc_int_ccache_iterator_new(iterator, int_context->handle,
- ntohll(response_header->iterator));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_open_ccache( cc_context_t context,
- const char* name,
- cc_ccache_t* ccache )
-{
- cc_uint32 blob_pos;
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ccache_open_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ccache_open_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || name == NULL || ccache == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_open_t*)malloc(sizeof(ccmsg_ccache_open_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_CCACHE_OPEN, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_data_blob(request, (void *)name, strlen(name) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->name_offset = htonl(blob_pos);
- request_header->name_len = htonl(strlen(name) + 1);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_open_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ccache_open_resp_t*)response->header;
- code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_open_default_ccache( cc_context_t context,
- cc_ccache_t* ccache)
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ccache_open_default_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ccache_open_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || ccache == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_open_default_t*)malloc(sizeof(ccmsg_ccache_open_default_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_CCACHE_OPEN_DEFAULT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_open_default_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ccache_open_resp_t*)response->header;
- code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_create_ccache( cc_context_t context,
- const char* name,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache )
-{
- cc_uint32 blob_pos;
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ccache_create_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ccache_create_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL || name == NULL ||
- cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
- principal == NULL || ccache == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_create_t*)malloc(sizeof(ccmsg_ccache_create_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_data_blob(request, (void *)name, strlen(name) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->version = htonl(cred_vers);
- request_header->name_offset = htonl(blob_pos);
- request_header->name_len = htonl(strlen(name) + 1);
-
- code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->principal_offset = htonl(blob_pos);
- request_header->principal_len = htonl(strlen(principal) + 1);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ccache_create_resp_t*)response->header;
- code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_create_default_ccache( cc_context_t context,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache )
-{
- cc_uint32 blob_pos;
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ccache_create_default_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ccache_create_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL ||
- cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
- principal == NULL || ccache == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_create_default_t*)malloc(sizeof(ccmsg_ccache_create_default_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE_DEFAULT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->version = htonl(cred_vers);
-
- code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->principal_offset = htonl(blob_pos);
- request_header->principal_len = htonl(strlen(principal) + 1);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_default_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ccache_create_resp_t*)response->header;
- code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_create_new_ccache( cc_context_t context,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache )
-{
- cc_uint32 blob_pos;
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ccache_create_unique_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ccache_create_resp_t *response_header;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL ||
- cred_vers == 0 || cred_vers > cc_credentials_v4_v5 ||
- principal == NULL || ccache == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ccache_create_unique_t*)malloc(sizeof(ccmsg_ccache_create_unique_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_CCACHE_CREATE_UNIQUE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->version = htonl(cred_vers);
-
- code = cci_msg_add_data_blob(request, (void *)principal, strlen(principal) + 1, &blob_pos);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->principal_offset = htonl(blob_pos);
- request_header->principal_len = htonl(strlen(principal) + 1);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ccache_create_unique_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = htonl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ccache_create_resp_t*)response-> header;
- code = cc_int_ccache_new(ccache, int_context->handle, ntohll(response_header->ccache));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_lock( cc_context_t context,
- cc_uint32 lock_type,
- cc_uint32 block )
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_lock_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL ||
- (lock_type != cc_lock_read && lock_type != cc_lock_write &&
- lock_type != cc_lock_upgrade && lock_type != cc_lock_downgrade) ||
- (block != cc_lock_block && block != cc_lock_noblock) )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_lock_t*)malloc(sizeof(ccmsg_ctx_lock_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_LOCK, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->lock_type = htonl(lock_type);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_lock_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
-
- // TODO: if (block == cc_lock_block) .....
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_unlock( cc_context_t context )
-{
- cc_int_context_t int_context;
- cc_msg_t *request = NULL;
- ccmsg_ctx_unlock_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( context == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- request_header = (ccmsg_ctx_unlock_t*)malloc(sizeof(ccmsg_ctx_unlock_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_CTX_UNLOCK, &request);
- if (code != ccNoError)
- goto cleanup;
-
- request_header->ctx = htonll(int_context->handle);
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_unlock_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_clone( cc_context_t inContext,
- cc_context_t* outContext,
- cc_int32 requestedVersion,
- cc_int32* supportedVersion,
- char const** vendor )
-{
- cc_int_context_t int_context;
- static char vendor_st[128] = "";
- cc_msg_t *request = NULL;
- ccmsg_ctx_clone_t *request_header = NULL;
- cc_msg_t *response = NULL;
- ccmsg_ctx_clone_resp_t *response_header;
- char *string = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( inContext == NULL ||
- outContext == NULL ||
- supportedVersion == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)inContext;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- if ((requestedVersion != ccapi_version_2) &&
- (requestedVersion != ccapi_version_3) &&
- (requestedVersion != ccapi_version_4) &&
- (requestedVersion != ccapi_version_5) &&
- (requestedVersion != ccapi_version_6)) {
-
- if (supportedVersion != NULL) {
- *supportedVersion = ccapi_version_max;
- }
- return ccErrBadAPIVersion;
- }
-
- request_header = (ccmsg_ctx_clone_t*)malloc(sizeof(ccmsg_ctx_clone_t));
- if (request_header == NULL)
- return ccErrNoMem;
-
- request_header->ctx = htonll(int_context->handle);
- request_header->in_version = htonl(requestedVersion);
-
- code = cci_msg_new(ccmsg_INIT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_ctx_clone_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- response_header = (ccmsg_ctx_clone_resp_t *)response->header;
- *supportedVersion = ntohl(response_header->out_version);
- code = cc_int_context_new(outContext, ntohll(response_header->out_ctx), ntohl(response_header->out_version));
-
- if (!vendor_st[0]) {
- code = cci_msg_retrieve_blob(response, ntohl(response_header->vendor_offset), ntohl(response_header->vendor_length), &string);
- strncpy(vendor_st, string, sizeof(vendor_st)-1);
- vendor_st[sizeof(vendor_st)-1] = '\0';
- }
- *vendor = vendor_st;
-
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (string)
- free(string);
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_context_get_version( cc_context_t context,
- cc_int32* version )
-{
- cc_int_context_t int_context;
-
- if ( context == NULL ||
- version == NULL )
- return ccErrBadParam;
-
- int_context = (cc_int_context_t)context;
-
- if ( int_context->magic != CC_CONTEXT_MAGIC )
- return ccErrInvalidContext;
-
- *version = int_context->api_version;
- return ccNoError;
-}
-
-
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-/* context.h */
-
-#define CC_CONTEXT_MAGIC ('C'<<24 | 'C'<<16 | 'T'<<8 | 'X')
-
-struct cc_int_context {
- cc_context_f* functions;
-
- cc_uint32 magic;
-#ifdef CCAPI_V2_COMPAT
- cc_uint32 version;
-#endif
- cc_uint32 api_version;
- cc_handle handle;
-};
-typedef struct cc_int_context cc_int_context_d;
-typedef cc_int_context_d* cc_int_context_t;
-
-cc_int32
-cc_int_context_new( cc_context_t *pcontext, cc_handle handle, cc_uint32 version );
-
-cc_int32
-cc_int_context_release( cc_context_t context );
-
-cc_int32
-cc_int_context_get_change_time( cc_context_t context,
- cc_time* change_time);
-
-cc_int32
-cc_int_context_get_default_ccache_name( cc_context_t context,
- cc_string_t* name );
-
-cc_int32
-cc_int_context_open_ccache( cc_context_t context,
- const char* name,
- cc_ccache_t* ccache );
-
-cc_int32
-cc_int_context_open_default_ccache( cc_context_t context,
- cc_ccache_t* ccache );
-
-cc_int32
-cc_int_context_create_ccache( cc_context_t context,
- const char* name,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache );
-
-cc_int32
-cc_int_context_create_default_ccache( cc_context_t context,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache );
-
-cc_int32
-cc_int_context_create_new_ccache( cc_context_t context,
- cc_uint32 cred_vers,
- const char* principal,
- cc_ccache_t* ccache );
-
-cc_int32
-cc_int_context_new_ccache_iterator( cc_context_t context,
- cc_ccache_iterator_t* iterator );
-
-cc_int32
-cc_int_context_lock( cc_context_t context,
- cc_uint32 lock_type,
- cc_uint32 block );
-
-cc_int32
-cc_int_context_unlock( cc_context_t context );
-
-cc_int32
-cc_int_context_compare( cc_context_t context,
- cc_context_t compare_to,
- cc_uint32* equal );
-
-cc_int32
-cc_int_context_clone( cc_context_t inContext,
- cc_context_t* outContext,
- cc_int32 requestedVersion,
- cc_int32* supportedVersion,
- char const** vendor );
-
-cc_int32
-cc_int_context_get_version( cc_context_t context,
- cc_int32* version );
-
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/* credentials.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <CredentialsCache.h>
-#include "credentials.h"
-#include "msg.h"
-#include "msg_headers.h"
-
-
-cc_int32
-cc_int_credentials_new( cc_credentials_t *pcredentials, cc_uint32 version,
- cc_handle ctx, cc_handle ccache, cc_handle handle,
- char * data, cc_uint32 len )
-{
- cc_int_credentials_t credentials;
- cc_int32 code;
-
- if ( pcredentials == NULL )
- return ccErrBadParam;
-
- credentials = (cc_int_credentials_t)malloc(sizeof(cc_int_credentials_d));
- if ( credentials == NULL )
- return ccErrNoMem;
-
- credentials->data = (cc_credentials_union *)malloc(sizeof(cc_credentials_union));
- if ( credentials->data == NULL ) {
- free(credentials);
- return ccErrNoMem;
- }
-
- credentials->functions = (cc_credentials_f *)malloc(sizeof(cc_credentials_f));
- if ( credentials->functions == NULL ) {
- free(credentials->data);
- free(credentials);
- return ccErrNoMem;
- }
-
- credentials->functions->release = cc_int_credentials_release;
- credentials->functions->compare = cc_int_credentials_compare;
- credentials->magic = CC_CREDS_MAGIC;
- credentials->ctx = ctx;
- credentials->ccache = ccache;
- credentials->handle = handle;
-
- switch ( version ) {
- case cc_credentials_v4:
- code = cci_creds_v4_unmarshall(data, len, credentials->data);
- break;
- case cc_credentials_v5:
- code = cci_creds_v5_unmarshall(data, len, credentials->data);
- break;
- default:
- free(credentials);
- return ccErrBadCredentialsVersion;
- }
-
- *pcredentials = (cc_credentials_t)credentials;
- return ccNoError;
-}
-
-
-cc_int32
-cc_int_credentials_release( cc_credentials_t creds )
-{
- cc_int_credentials_t int_creds;
- unsigned short i;
-
- if ( creds == NULL )
- return ccErrBadParam;
-
- int_creds = (cc_int_credentials_t)creds;
-
- if ( int_creds->magic != CC_CREDS_MAGIC )
- return ccErrInvalidCredentials;
-
- switch (int_creds->data->version) {
- case cc_credentials_v4:
- free(int_creds->data->credentials.credentials_v4);
- break;
- case cc_credentials_v5:
- if ( int_creds->data->credentials.credentials_v5->client )
- free(int_creds->data->credentials.credentials_v5->client);
- if ( int_creds->data->credentials.credentials_v5->server )
- free(int_creds->data->credentials.credentials_v5->server );
- if ( int_creds->data->credentials.credentials_v5->keyblock.data )
- free(int_creds->data->credentials.credentials_v5->keyblock.data);
- if ( int_creds->data->credentials.credentials_v5->ticket.data )
- free(int_creds->data->credentials.credentials_v5->ticket.data);
- if ( int_creds->data->credentials.credentials_v5->second_ticket.data )
- free(int_creds->data->credentials.credentials_v5->second_ticket.data);
- if ( int_creds->data->credentials.credentials_v5->addresses ) {
- for ( i=0; int_creds->data->credentials.credentials_v5->addresses[i]; i++) {
- if (int_creds->data->credentials.credentials_v5->addresses[i]->data)
- free(int_creds->data->credentials.credentials_v5->addresses[i]->data);
- }
- free(int_creds->data->credentials.credentials_v5->addresses);
- }
- if ( int_creds->data->credentials.credentials_v5->authdata ) {
- for ( i=0; int_creds->data->credentials.credentials_v5->authdata[i]; i++) {
- if ( int_creds->data->credentials.credentials_v5->authdata[i]->data )
- free(int_creds->data->credentials.credentials_v5->authdata[i]->data);
- }
- free(int_creds->data->credentials.credentials_v5->authdata);
- }
- break;
- default:
- return ccErrBadCredentialsVersion;
- }
-
- free(int_creds->functions);
- free(int_creds->data);
- free(int_creds);
- return ccNoError;
-}
-
-cc_int32
-cc_int_credentials_compare( cc_credentials_t credentials,
- cc_credentials_t compare_to,
- cc_uint32* equal )
-{
- cc_int_credentials_t int_credentials;
- cc_int_credentials_t int_compare_to;
-
- if ( credentials == NULL || compare_to == NULL || equal == NULL )
- return ccErrBadParam;
-
- int_credentials = (cc_int_credentials_t)credentials;
- int_compare_to = (cc_int_credentials_t)compare_to;
-
- if ( int_credentials->magic != CC_CREDS_MAGIC ||
- int_compare_to->magic != CC_CREDS_MAGIC )
- return ccErrInvalidCredentials;
-
- *equal = (int_credentials->handle == int_compare_to->handle);
-
- return ccNoError;
-}
+++ /dev/null
-/* $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).
- * $
- */
-
-/* credentials.h */
-
-#define CC_CREDS_MAGIC ('C'<<24 | 'R'<<16 | 'E'<<8 | 'D')
-
-struct cc_int_credentials_d {
- cc_credentials_union* data;
- cc_credentials_f* functions;
-#if TARGET_OS_MAC
- cc_credentials_f* otherFunctions;
-#endif
- cc_uint32 magic;
- cc_handle ctx;
- cc_handle ccache;
- cc_handle handle;
-};
-typedef struct cc_int_credentials_d cc_int_credentials_d;
-typedef cc_int_credentials_d* cc_int_credentials_t;
-
-cc_int32
-cc_int_credentials_new( cc_credentials_t * pcredentials, cc_uint32 version,
- cc_handle ctx, cc_handle ccache, cc_handle handle,
- char * data, cc_uint32 len);
-
-cc_int32
-cc_int_credentials_release( cc_credentials_t credentials );
-
-cc_int32
-cc_int_credentials_compare( cc_credentials_t credentials,
- cc_credentials_t compare_to,
- cc_uint32* equal );
-
-cc_int32
-cci_creds_v4_marshall( cc_credentials_v4_t * creds,
- char ** flat,
- cc_uint32 * len);
-
-cc_int32
-cci_creds_v5_marshall( cc_credentials_v5_t * creds,
- char ** flat,
- cc_uint32 * len);
-
-cc_int32
-cci_creds_v4_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds);
-
-cc_int32
-cci_creds_v5_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds);
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/* credentials_iterator.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <CredentialsCache.h>
-#include "credentials.h"
-#include "credentials_iterator.h"
-#include "cc_rpc.h"
-#include "msg.h"
-#include "msg_headers.h"
-
-
-cc_int32
-cc_int_credentials_iterator_new( cc_credentials_iterator_t * piter,
- cc_handle ctx,
- cc_handle ccache,
- cc_handle handle )
-{
- cc_int_credentials_iterator_t iter;
-
- if ( piter == NULL )
- return ccErrBadParam;
-
- iter = (cc_int_credentials_iterator_t) malloc( sizeof(cc_int_credentials_iterator_d) );
- if ( iter == NULL )
- return ccErrNoMem;
-
- iter->functions = (cc_credentials_iterator_f*)malloc(sizeof(cc_credentials_iterator_f));
- if ( iter->functions == NULL ) {
- free(iter);
- return ccErrNoMem;
- }
-
- iter->functions->release = cc_int_credentials_iterator_release;
- iter->functions->next = cc_int_credentials_iterator_next;
- iter->functions->clone = cc_int_credentials_iterator_clone;
- iter->magic = CC_CREDS_ITER_MAGIC;
- iter->ctx = ctx;
- iter->ccache = ccache;
- iter->handle = handle;
-
- *piter = (cc_credentials_iterator_t) iter;
- return ccNoError;
-}
-
-cc_int32
-cc_int_credentials_iterator_release( cc_credentials_iterator_t iter )
-{
- cc_int_credentials_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_creds_iterator_release_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( iter == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_credentials_iterator_t) iter;
-
- if ( int_iter->magic != CC_CREDS_ITER_MAGIC )
- return ccErrInvalidCredentialsIterator;
-
- request_header = (ccmsg_creds_iterator_release_t*)malloc(sizeof(ccmsg_creds_iterator_release_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->ccache = htonll(int_iter->ccache);
- request_header->iterator = htonll(int_iter->handle);
-
- code = cci_msg_new(ccmsg_CREDS_ITERATOR_RELEASE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_release_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = htonl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = htonl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- code = ccNoError;
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
-
- free(int_iter->functions);
- free(int_iter);
- return ccNoError;
-}
-
-cc_int32
-cc_int_credentials_iterator_next( cc_credentials_iterator_t iter,
- cc_credentials_t * credentials )
-{
- cc_int_credentials_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_creds_iterator_next_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( credentials == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_credentials_iterator_t)iter;
-
- if ( int_iter->magic != CC_CREDS_ITER_MAGIC )
- return ccErrInvalidCredentialsIterator;
-
- request_header = (ccmsg_creds_iterator_next_t*)malloc(sizeof(ccmsg_creds_iterator_next_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->ccache = htonll(int_iter->ccache);
- request_header->iterator = htonll(int_iter->handle);
-
- code = cci_msg_new(ccmsg_CREDS_ITERATOR_NEXT, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_next_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- char * blob;
- ccmsg_creds_iterator_next_resp_t * response_header = (ccmsg_creds_iterator_next_resp_t*)response->header;
- code = cci_msg_retrieve_blob(response, ntohl(response_header->creds_offset), ntohl(response_header->creds_len), &blob);
- code = cc_int_credentials_new(credentials, ntohl(response_header->version),
- int_iter->ctx, int_iter->ccache, ntohll(response_header->creds_handle),
- blob, ntohl(response_header->creds_len));
- free(blob);
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
-cc_int32
-cc_int_credentials_iterator_clone( cc_credentials_iterator_t iter,
- cc_credentials_iterator_t* new_iter)
-{
- cc_int_credentials_iterator_t int_iter;
- cc_msg_t *request = NULL;
- ccmsg_creds_iterator_clone_t *request_header = NULL;
- cc_msg_t *response = NULL;
- cc_uint32 type;
- cc_int32 code;
-
- if ( iter == NULL || new_iter == NULL )
- return ccErrBadParam;
-
- int_iter = (cc_int_credentials_iterator_t)iter;
-
- if ( int_iter->magic != CC_CREDS_ITER_MAGIC )
- return ccErrInvalidCCacheIterator;
-
- request_header = (ccmsg_creds_iterator_clone_t*)malloc(sizeof(ccmsg_creds_iterator_clone_t));
- if (request_header == NULL)
- return ccErrNoMem;
- request_header->ctx = htonll(int_iter->ctx);
- request_header->iterator = htonll(int_iter->handle);
-
- code = cci_msg_new(ccmsg_CREDS_ITERATOR_CLONE, &request);
- if (code != ccNoError)
- goto cleanup;
-
- code = cci_msg_add_header(request, request_header, sizeof(ccmsg_creds_iterator_clone_t));
- if (code != ccNoError)
- goto cleanup;
- request_header = NULL;
-
- code = cci_perform_rpc(request, &response);
- if (code != ccNoError)
- goto cleanup;
-
- type = ntohl(response->type);
- if (type == ccmsg_NACK) {
- ccmsg_nack_t * nack_header = (ccmsg_nack_t *)response->header;
- code = ntohl(nack_header->err_code);
- } else if (type == ccmsg_ACK) {
- ccmsg_creds_iterator_clone_resp_t * response_header = (ccmsg_creds_iterator_clone_resp_t*)response->header;
- code = cc_int_credentials_iterator_new(new_iter, int_iter->ctx, int_iter->ccache, ntohll(response_header->iterator));
- } else {
- code = ccErrBadInternalMessage;
- }
-
- cleanup:
- if (request_header)
- free(request_header);
- if (request)
- cci_msg_destroy(request);
- if (response)
- cci_msg_destroy(response);
- return code;
-}
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/* credentials_iterator.h */
-
-#define CC_CREDS_ITER_MAGIC ('C'<<24 | 'R'<<16 | 'I'<<8 | 'T')
-
-struct cc_int_credentials_iterator_d {
- cc_credentials_iterator_f* functions;
-#if TARGET_OS_MAC
- cc_credentials_iterator_f* otherFunctions;
-#endif
- cc_uint32 magic;
- cc_handle handle;
- cc_handle ccache;
- cc_handle ctx;
-};
-typedef struct cc_int_credentials_iterator_d cc_int_credentials_iterator_d;
-typedef cc_int_credentials_iterator_d* cc_int_credentials_iterator_t;
-
-
-cc_int32
-cc_int_credentials_iterator_new( cc_credentials_iterator_t * piter, cc_handle ctx, cc_handle ccache, cc_handle iter );
-
-cc_int32
-cc_int_credentials_iterator_release( cc_credentials_iterator_t iter );
-
-cc_int32
-cc_int_credentials_iterator_next( cc_credentials_iterator_t iter,
- cc_credentials_t * credentials );
-
-cc_int32
-cc_int_credentials_iterator_clone( cc_credentials_iterator_t iter,
- cc_credentials_iterator_t * new_iter );
-
-
+++ /dev/null
-!INCLUDE <WIN32.MAK>\r
-\r
-CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
-\r
-CC_COMMON_OBJS = marshall.obj msg.obj generic_lists.obj\r
-\r
-CC_COMMON_LIB = cc_common.lib\r
-\r
-$(CC_COMMON_LIB): $(CC_COMMON_OBJS)\r
- $(implib) /NOLOGO /OUT:$@ $**\r
-\r
-all: $(CC_COMMON_LIB)\r
-\r
-clean:\r
- del *.obj *.lib\r
+++ /dev/null
-/* $Copyright:\r
-*\r
-* Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
-* \r
-* All rights reserved.\r
-* \r
-* Export of this software from the United States of America may require a\r
-* specific license from the United States Government. It is the\r
-* responsibility of any person or organization contemplating export to\r
-* obtain such a license before exporting.\r
-* \r
-* WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
-* this software and its documentation for any purpose and without fee is\r
-* hereby granted, provided that the above copyright notice appear in all\r
-* copies and that both that copyright notice and this permission notice\r
-* appear in supporting documentation, and that the name of M.I.T. not be\r
-* used in advertising or publicity pertaining to distribution of the\r
-* software without specific, written prior permission. Furthermore if you\r
-* modify this software you must label your software as modified software\r
-* and not distribute it in such a fashion that it might be confused with\r
-* the original MIT software. M.I.T. makes no representations about the\r
-* suitability of this software for any purpose. It is provided "as is"\r
-* without express or implied warranty.\r
-* \r
-* THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
-* WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
-* MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
-* \r
-* Individual source code files are copyright MIT, Cygnus Support,\r
-* OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
-* \r
-* Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
-* and Zephyr are trademarks of the Massachusetts Institute of Technology\r
-* (MIT). No commercial use of these trademarks may be made without prior\r
-* written permission of MIT.\r
-* \r
-* "Commercial use" means use of a name in a product or other for-profit\r
-* manner. It does NOT prevent a commercial firm from referring to the MIT\r
-* trademarks in order to convey information (although in doing so,\r
-* recognition of their trademark status should be given).\r
-* $\r
-*/\r
-\r
-\r
-/*\r
- * Lists implementation.\r
- * \r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <memory.h>\r
-\r
-#include "CredentialsCache.h"\r
-#include "generic_lists.h"\r
-\r
-/**\r
- * cci_generic_iterate_has_next()\r
- *\r
- * Purpose: Determine if an iterator has a next element\r
- *\r
- * Return: 1 if another element exists\r
- * 0 if no additional elements exist\r
- *\r
- * Errors: None\r
- *\r
- */\r
-cc_int32 \r
-cci_generic_iterate_has_next(cc_generic_iterate_t *iterate) \r
-{\r
- return ((iterate == NULL || iterate->next == NULL) ? 0 : 1);\r
-}\r
-\r
-/**\r
- * cci_generic_iterate_next()\r
- *\r
- * Purpose: Retrieve the next element from an iterator and advance\r
- * the iterator\r
- *\r
- * Return: non-NULL, the next element in the iterator\r
- * NULL, the iterator list is empty or iterator is invalid\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-cci_generic_iterate_next(cc_generic_iterate_t *iterator, cc_generic_list_node_t** nodepp) \r
-{\r
- cc_generic_list_node_t* ret;\r
- \r
- if (iterator == NULL || nodepp == NULL)\r
- return ccErrBadParam;\r
-\r
- ret = iterator->next;\r
- if (iterator->next != NULL)\r
- iterator->next = iterator->next->next;\r
-\r
- *nodepp = ret;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_list_new()\r
- *\r
- * Purpose: Allocate new generic list\r
- *\r
- * Return: non-NULL, an empty list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-cci_generic_list_new(cc_generic_list_head_t ** listpp) \r
-{\r
- cc_generic_list_head_t* ret = (cc_generic_list_head_t *)malloc(sizeof(cc_generic_list_head_t));\r
- if (ret == NULL)\r
- return ccErrNoMem;\r
- \r
- ret->type = cc_generic_list;\r
- ret->head = ret->tail = NULL;\r
- *listpp = ret;\r
-\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_list_append()\r
- *\r
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) \r
-{\r
- cc_generic_list_node_t* new_node;\r
-\r
- if ( data == NULL || len == 0 )\r
- return ccErrBadParam;\r
-\r
- new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));\r
- if (new_node == NULL)\r
- return ccErrNoMem;\r
-\r
- new_node->data = malloc(len);\r
- if ( new_node->data == NULL ) {\r
- free(new_node);\r
- return ccErrNoMem; \r
- }\r
- \r
- memcpy(new_node->data,data,len);\r
- new_node->len = len;\r
-\r
- if (head->head == NULL) { /*empty list*/\r
- head->head = new_node;\r
- head->tail = new_node;\r
- new_node->next = new_node->prev = NULL;\r
- } else {\r
- new_node->prev = head->tail;\r
- head->tail->next = new_node;\r
- head->tail = new_node;\r
- new_node->next = NULL;\r
- }\r
- if (nodepp != NULL)\r
- *nodepp = new_node;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_list_prepend()\r
- *\r
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data'\r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem, ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t** nodepp) \r
-{\r
- cc_generic_list_node_t* new_node;\r
-\r
- if ( data == NULL || len == 0 )\r
- return ccErrBadParam;\r
-\r
- new_node = (cc_generic_list_node_t *)malloc(sizeof(cc_generic_list_node_t));\r
- if (new_node == NULL)\r
- return ccErrNoMem;\r
-\r
- new_node->data = malloc(len);\r
- if ( new_node->data == NULL ) {\r
- free(new_node);\r
- return ccErrNoMem;\r
- }\r
- \r
- memcpy(new_node->data,data,len);\r
- new_node->len = len;\r
- \r
- if (head->head == NULL) { /*empty list*/\r
- head->head = new_node;\r
- head->tail = new_node;\r
- new_node->prev = new_node->next = NULL;\r
- } else {\r
- new_node->next = head->head;\r
- head->head->prev = new_node;\r
- new_node->prev = NULL;\r
- head->head = new_node;\r
- }\r
-\r
- if (nodepp != NULL)\r
- *nodepp = new_node;\r
-\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_list_remove_element()\r
- *\r
- * Purpose: Remove a node from the list\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem) \r
-{\r
- if (head->head == NULL || rem == NULL)\r
- return ccErrBadParam;\r
-\r
- if (head->head == rem && head->tail == rem) { /*removing only element of list*/\r
- head->head = head->tail = NULL;\r
- } else if (head->head == rem) { /*removing head*/\r
- head->head = head->head->next;\r
- } else if (head->tail == rem) { /*removing tail*/\r
- head->tail = head->tail->prev;\r
- head->tail->next = NULL;\r
- } else {\r
- rem->prev->next = rem->next;\r
- rem->next->prev = rem->prev;\r
- }\r
- free(rem);\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_free_element()\r
- *\r
- * Purpose: Free the memory associated with a node\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-cci_generic_free_element(cc_generic_list_node_t* node)\r
-{\r
- if ( node == NULL )\r
- return ccErrBadParam;\r
-\r
- if ( node->data ) {\r
- free(node->data);\r
- node->data = NULL;\r
- }\r
- node->len = 0;\r
- node->next = node->prev = NULL;\r
- free(node);\r
- return ccNoError;\r
-}\r
-\r
-\r
-/**\r
- * cci_generic_list_destroy()\r
- *\r
- * Purpose: Deallocate a list and all of its contents\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32\r
-cci_generic_list_destroy(cc_generic_list_head_t* head) \r
-{\r
- cc_generic_list_node_t *cur, *next;\r
- cc_int32 ret = ccNoError;\r
-\r
- if ( head == NULL )\r
- return ccErrBadParam;\r
- \r
- for (cur = head->head; ret == ccNoError && cur != NULL; cur = next) {\r
- next = cur->next;\r
- ret = cci_generic_free_element(cur);\r
- } \r
- free(head);\r
- return(ret);\r
-}\r
-\r
-/**\r
- * cci_generic_list_copy()\r
- *\r
- * Purpose: Copy a list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrBadParam, ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t** headpp) \r
-{\r
- cc_generic_list_head_t* copy;\r
- cc_generic_list_node_t *src_node, *dst_node;\r
- cc_int32 code;\r
-\r
- if (head == NULL || headpp == NULL)\r
- return ccErrBadParam;\r
-\r
- code = cci_generic_list_new(©);\r
- if (code != ccNoError)\r
- return code;\r
-\r
- for (src_node = head->head; src_node != NULL; src_node = src_node->next) {\r
- code = cci_generic_list_append(copy, src_node->data, src_node->len, &dst_node);\r
- if (code != ccNoError) {\r
- cci_generic_list_destroy(copy);\r
- return code;\r
- }\r
- }\r
- *headpp = copy;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_list_iterator()\r
- *\r
- * Purpose: Allocate an iterator for the specified list\r
- *\r
- * Return: non-NULL, an iterator\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t** headpp) \r
-{\r
- cc_generic_iterate_t* iterator;\r
-\r
- if ( head == NULL || headpp == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator = (cc_generic_iterate_t*)malloc(sizeof(cc_generic_iterate_t));\r
- if (iterator == NULL)\r
- return ccErrNoMem;\r
- \r
- iterator->next = head->head;\r
- *headpp = iterator;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * cci_generic_free_iterator()\r
- *\r
- * Purpose: Deallocate memory associated with an iterator\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-cci_generic_free_iterator(cc_generic_iterate_t* iterator)\r
-{\r
- if ( iterator == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator->next = NULL;\r
- free(iterator);\r
- return ccNoError;\r
-}\r
-\r
-\r
-\r
+++ /dev/null
-/* $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).
- * $
- */
-
-import "mig_types.h";
-
-#include <mach/std_types.defs>
-#include <mach/mach_types.defs>
-
-subsystem ccapi 128;
-
-type msg_request_t = array [] of char;
-type msg_reply_t = array [] of char;
-type msg_error_t = int32;
-
-routine ccapi_msg (in_server_port : mach_port_t;
- in_request : msg_request_t;
- out out_reply : msg_reply_t;
- out out_error : msg_error_t);
+++ /dev/null
-/* $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).
-* $
-*/
-
-#include "CredentialsCache.h"
-
-typedef const char *msg_request_t;
-typedef char *msg_reply_t;
-typedef cc_int32 msg_error_t;
+++ /dev/null
-/* $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).
- * $
- */
-
-/* marshall.c */
-
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-#include <CredentialsCache.h>
-#include "msg.h"
-#include "msg_headers.h"
-#include "marshall.h"
-
-cc_int32
-cci_creds_v4_marshall( cc_credentials_v4_t * creds,
- char ** pflat,
- cc_uint32 * plen)
-{
- cc_uint32 len;
- char * flat;
- cci_flat_creds_v4_t * header;
- cc_time64 t64;
-
- if ( creds == NULL || pflat == NULL || plen == NULL )
- return ccErrBadParam;
-
- len = sizeof(cci_flat_creds_v4_t);
- flat = (char *)malloc(len);
- if ( flat == NULL )
- return ccErrNoMem;
- memset(flat, 0, len);
-
- header = (cci_flat_creds_v4_t *)flat;
- header->version = htonl(creds->version);
- memcpy(header->principal, creds->principal, cc_v4_name_size);
- memcpy(header->principal_instance, creds->principal_instance, cc_v4_instance_size);
- memcpy(header->service, creds->service, cc_v4_name_size);
- memcpy(header->service_instance, creds->service_instance, cc_v4_instance_size);
- memcpy(header->realm, creds->realm, cc_v4_realm_size);
- memcpy(header->session_key, creds->session_key, cc_v4_key_size);
- header->kvno = htonl(creds->kvno);
- header->string_to_key_type = htonl(creds->string_to_key_type);
- t64 = creds->issue_date;
- header->issue_date = htonll(t64);
- header->lifetime = htonl(creds->lifetime);
- /* TODO: verify that address is stored in host order */
- header->address = htonl(creds->address);
- header->ticket_size = htonl(creds->ticket_size);
- memcpy(header->ticket, creds->ticket, cc_v4_ticket_size);
-
- *pflat = flat;
- *plen = len;
-
- return ccNoError;
-}
-
-cc_int32
-cci_creds_v4_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds_union)
-{
- struct cci_flat_creds_v4 * header;
- cc_credentials_v4_t * creds;
- cc_time64 t64;
-
- if ( flat == NULL || len == 0 || creds_union == NULL )
- return ccErrBadParam;
-
- creds_union->version = cc_credentials_v4;
-
- header = (cci_flat_creds_v4_t *)flat;
-
- creds = (cc_credentials_v4_t *)malloc(sizeof(cc_credentials_v4_t));
- if ( creds == NULL )
- return ccErrNoMem;
-
- creds->version = ntohl(header->version);
- memcpy(creds->principal, header->principal, cc_v4_name_size);
- memcpy(creds->principal_instance, header->principal_instance, cc_v4_instance_size);
- memcpy(creds->service, header->service, cc_v4_name_size);
- memcpy(creds->service_instance, header->service_instance, cc_v4_instance_size);
- memcpy(creds->realm, header->realm, cc_v4_realm_size);
- memcpy(creds->session_key, header->session_key, cc_v4_key_size);
- creds->kvno = htonl(header->kvno);
- creds->string_to_key_type = htonl(header->string_to_key_type);
- t64 = header->issue_date;
- creds->issue_date = (cc_time64)ntohll(t64);
- creds->lifetime = (cc_int32)ntohl(header->lifetime);
- /* TODO: verify that address is stored in host order */
- creds->address = ntohl(header->address);
- creds->ticket_size = ntohl(header->ticket_size);
- memcpy(creds->ticket, header->ticket, cc_v4_ticket_size);
-
- creds_union->credentials.credentials_v4 = creds;
-
- return ccNoError;
-}
-
-
-static cc_int32
-cci_creds_cc_data_array_count_entries( cc_data ** array, cc_uint32 * pcount)
-{
- cc_uint32 count;
-
- if (array == NULL) {
- *pcount = 0;
- return ccNoError;
- }
-
- for ( count=0; array[count] != NULL ; count++) ;
-
- *pcount = count;
- return ccNoError;
-}
-
-static cc_int32
-cci_creds_v5_compute_flat_size( cc_credentials_v5_t * creds, cc_uint32 * plen)
-{
- cc_uint32 len;
- cc_uint32 i, count;
-
- len = sizeof(struct cci_flat_creds_v5);
-
- if (creds->client)
- len += strlen(creds->client) + 1;
-
- if (creds->server)
- len += strlen(creds->server) + 1;
-
- len += creds->keyblock.length;
-
- cci_creds_cc_data_array_count_entries( creds->addresses, &count );
- len += count * sizeof(cc_flat_data);
- for ( i=0; i<count; i++ ) {
- len += creds->addresses[i]->length;
- }
-
- len += creds->ticket.length;
- len += creds->second_ticket.length;
-
- cci_creds_cc_data_array_count_entries( creds->authdata, &count );
- len += count * sizeof(cc_flat_data);
- for ( i=0; i<count; i++ ) {
- len += creds->authdata[i]->length;
- }
-
- *plen = len;
- return ccNoError;
-}
-
-cc_int32
-cci_creds_v5_marshall( cc_credentials_v5_t * creds,
- char ** pflat,
- cc_uint32 * plen)
-{
- cc_uint32 len;
- char * flat;
- struct cci_flat_creds_v5 * header;
- cc_uint32 length;
- cc_uint32 offset;
- cc_time64 t64;
- cc_uint32 count;
- cc_uint32 i;
-
- if ( creds == NULL || pflat == NULL || plen == NULL )
- return ccErrBadParam;
-
- cci_creds_v5_compute_flat_size(creds, &len);
-
- flat = (char *)malloc(len);
- if ( flat == NULL )
- return ccErrNoMem;
- memset(flat, 0, len);
-
- offset = sizeof(struct cci_flat_creds_v5);
- header = (struct cci_flat_creds_v5 *)flat;
- header->version = htonl(FLAT_CREDS_V5_VERSION);
- if (creds->client) {
- length = strlen(creds->client) + 1;
- header->client.length = htonl(length);
- header->client.data = htonl(offset);
- memcpy(flat + offset, creds->client, length);
- offset += length;
- }
-
- if (creds->server) {
- length = strlen(creds->server) + 1;
- header->server.length = htonl(length);
- header->server.data = htonl(offset);
- memcpy(flat + offset, creds->server, length);
- offset += length;
- }
-
- header->keyblock.type = htonl(creds->keyblock.type);
- if (creds->keyblock.length) {
- length = creds->keyblock.length;
- header->keyblock.length = htonl(length);
- header->keyblock.data = htonl(offset);
- memcpy(flat + offset, creds->keyblock.data, length);
- offset += length;
- }
-
- t64 = creds->authtime;
- header->authtime = htonll(t64);
- t64 = creds->starttime;
- header->starttime = htonll(t64);
- t64 = creds->endtime;
- header->endtime = htonll(t64);
- t64 = creds->renew_till;
- header->renew_till = htonll(t64);
-
- header->is_skey = htonl(creds->is_skey);
- header->ticket_flags = htonl(creds->ticket_flags);
-
- cci_creds_cc_data_array_count_entries( creds->addresses, &count );
- if ( count ) {
- cc_flat_data * addresses = (cc_flat_data *)flat + offset;
- header->address_count = htonl(count);
- header->addresses = htonl(offset);
- offset += count * sizeof(cc_flat_data);
-
- for ( i=0; i < count; i++ ) {
- addresses[i].type = htonl(creds->addresses[i]->type);
- if (creds->addresses[i]->length) {
- length = creds->addresses[i]->length;
- addresses[i].length = htonl(length);
- addresses[i].data = htonl(offset);
- /* TODO: verify that addresses are stored in network order */
- memcpy(flat + offset, creds->addresses[i]->data, length);
- offset += length;
- }
- }
- }
-
- header->ticket.type = htonl(creds->ticket.type);
- if (creds->ticket.length) {
- length = creds->ticket.length;
- header->ticket.length = htonl(length);
- header->ticket.data = htonl(offset);
- memcpy(flat + offset, creds->ticket.data, length);
- offset += length;
- }
-
- header->second_ticket.type = htonl(creds->second_ticket.type);
- if (creds->second_ticket.length) {
- length = creds->second_ticket.length;
- header->second_ticket.length = htonl(length);
- header->second_ticket.data = htonl(offset);
- memcpy(flat + offset, creds->second_ticket.data, length);
- offset += length;
- }
-
- cci_creds_cc_data_array_count_entries( creds->authdata, &count );
- if ( count ) {
- cc_flat_data * authdata = (cc_flat_data *)flat + offset;
-
- header->authdata_count = htonl(count);
- header->authdata = (offset);
- offset += count * sizeof(cc_flat_data);
-
- for ( i=0; i < count; i++ ) {
- authdata[i].type = htonl(creds->authdata[i]->type);
- if (creds->authdata[i]->length) {
- length = creds->authdata[i]->length;
- authdata[i].length = htonl(length);
- authdata[i].data = htonl(offset);
- memcpy(flat + offset, creds->authdata[i]->data, length);
- offset += length;
- }
- }
- }
-
- *pflat = flat;
- *plen = len;
- return ccNoError;
-}
-
-
-// TODO: a much better job of checking for out of memory errors
-// and validating that we do not read beyond the flat input
-// data buffer
-
-cc_int32
-cci_creds_v5_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds_union)
-{
- struct cci_flat_creds_v5 * header;
- cc_credentials_v5_t * creds;
- cc_flat_data * flat_data;
- cc_time64 t64;
- cc_uint32 length;
- cc_uint32 count;
- cc_uint32 i;
-
- if ( flat == NULL || len == 0 || creds_union == NULL )
- return ccErrBadParam;
-
- creds_union->version = cc_credentials_v5;
-
- header = (struct cci_flat_creds_v5 *)flat;
-
- if ( ntohl(header->version) != FLAT_CREDS_V5_VERSION )
- return ccErrBadParam;
-
- creds = (cc_credentials_v5_t *)malloc(sizeof(cc_credentials_v5_t));
- if ( creds == NULL )
- return ccErrNoMem;
- memset(creds, 0, sizeof(cc_credentials_v5_t));
-
- if ( header->client.length ) {
- length = ntohl(header->client.length);
- creds->client = (char *)malloc(length);
- memcpy(creds->client, flat + header->client.data, length);
- }
-
- if ( header->server.length ) {
- length = ntohl(header->server.length);
- creds->server = (char *)malloc(length);
- memcpy(creds->server, flat + header->server.data, length);
- }
-
- creds->keyblock.type = ntohl(header->keyblock.type);
- if ( header->keyblock.length ) {
- length = ntohl(header->keyblock.length);
- creds->keyblock.length = length;
- creds->keyblock.data = malloc(length);
- memcpy(creds->keyblock.data, flat + header->keyblock.data, length);
- }
-
- /* TODO: need to perform overflow validation checks to ensure
- * that we do not attempt to store too large a value into cc_time_t
- * when it is a 32-bit field.
- */
- t64 = ntohll(header->authtime);
- creds->authtime = (cc_time)t64;
- t64 = ntohll(header->starttime);
- creds->starttime = (cc_time)t64;
- t64 = ntohll(header->endtime);
- creds->endtime = (cc_time)t64;
- t64 = ntohll(header->renew_till);
- creds->renew_till = (cc_time)t64;
-
- creds->is_skey = ntohl(header->is_skey);
- creds->ticket_flags = ntohl(header->ticket_flags);
-
- count = ntohl(header->address_count);
- creds->addresses = (cc_data **) malloc((count + 1) * sizeof(cc_data *));
- flat_data = (cc_flat_data *)flat + header->addresses;
- for ( i=0 ; i < count ; i++ ) {
- creds->addresses[i] = (cc_data *)malloc(sizeof(cc_data));
- creds->addresses[i]->type = ntohl(flat_data[i].type);
- length = ntohl(flat_data[i].length);
- creds->addresses[i]->length = length;
- if ( length ) {
- creds->addresses[i]->data = malloc(length);
- /* TODO: verify that addresses are stored in network order */
- memcpy(creds->addresses[i]->data, flat + flat_data[i].data, length);
- } else {
- creds->addresses[i]->data = NULL;
- }
- }
- creds->addresses[i] = NULL;
-
- creds->ticket.type = ntohl(header->ticket.type);
- length = ntohl(header->ticket.length);
- if ( length ) {
- creds->ticket.length = length;
- creds->ticket.data = malloc(length);
- memcpy(creds->ticket.data, flat + header->ticket.data, length);
- }
-
- creds->second_ticket.type = header->second_ticket.type;
- if ( header->second_ticket.length ) {
- creds->second_ticket.length = header->second_ticket.length;
- creds->second_ticket.data = malloc(creds->second_ticket.length);
- memcpy(creds->second_ticket.data, flat + header->second_ticket.data, creds->second_ticket.length);
- }
-
- count = ntohl(header->authdata_count);
- creds->authdata = (cc_data **) malloc((count + 1) * sizeof(cc_data *));
- flat_data = (cc_flat_data *)flat + header->authdata;
- for ( i=0 ; i < count ; i++ ) {
- creds->authdata[i] = (cc_data *)malloc(sizeof(cc_data));
- creds->authdata[i]->type = ntohl(flat_data[i].type);
- length = ntohl(flat_data[i].length);
- creds->authdata[i]->length = length;
- if ( length ) {
- creds->authdata[i]->data = malloc(length);
- memcpy(creds->authdata[i]->data, flat + flat_data[i].data, length);
- } else {
- creds->authdata[i]->data = NULL;
- }
- }
- creds->authdata[i] = NULL;
-
- creds_union->credentials.credentials_v5 = creds;
-
- return ccNoError;
-}
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/*
- * Verifiable, extensible message format.
- *
- * Format:
- * <size of header block (header_len)>
- * <size of *entire* message, including previous field (flat_len)>
- * <message type (type)>
- * <type specific header (header)>
- * <magic number (magic)>
- * <data blob 1 length>
- * <data blob 1>
- * <data blob 2 length>
- * <data blob 2>
- * ...
- * <magic number (magic)>
- *
- * 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.
- */
-
-#include "CredentialsCache.h"
-#include "msg.h"
-#include "generic_lists.h"
-
-#include <stdlib.h>
-#include <memory.h>
-#include <stdio.h>
-#include <string.h>
-
-/**
- * cci_msg_new()
- *
- * Purpose: Allocate and initialize a new cc_msg_t structure
- *
- * Input parameter (type) in host order
- *
- * Return: non-NULL, the msg
- * NULL, failure
- *
- * Errors: ccErrNoMem
- *
- */
-cc_int32
-cci_msg_new(cc_uint32 type, cc_msg_t** msgpp)
-{
- // type should be validated. If invalid set error to ccErrBadParam
- cc_msg_t* msg;
-
- if ( type > CC_MSG_MAX_TYPE || msgpp == NULL )
- return ccErrBadParam;
-
- msg = (cc_msg_t*)malloc(sizeof(cc_msg_t));
- if (msg == NULL)
- return ccErrNoMem;
-
- msg->type = type;
- msg->flat = NULL;
- msg->header = NULL;
- msg->flat_len = 0;
- msg->header_len = 0;
- msg->magic = 0;
- cci_generic_list_new(&msg->data_blobs);
- if (msg->data_blobs == NULL) {
- // pass on error from previous call
- free(msg);
- return ccErrNoMem;
- }
-
- *msgpp = msg;
- return ccNoError;
-}
-
-/**
- * cci_msg_calc_header_size()
- *
- * Purpose: Calculates the size of the header
- *
- * Return: the size in bytes
- *
- * Errors: ccErrBadParam
- *
- */
-cc_int32
-cci_msg_calc_header_size(cc_msg_t* msg, cc_uint32 * lenp)
-{
- int header_len = 12; /* header size, entire size, type */
-
- if ( msg == NULL || lenp == NULL )
- return ccErrBadParam;
-
- header_len += msg->header_len;
- *lenp = header_len;
- return ccNoError;
-}
-
-/**
- * cci_msg_calc_size()
- *
- * Purpose: Calculates the size of the message
- * (does not include the magic bytes)
- *
- * Return: the size in bytes
- *
- * Errors: ccErrBadParam
- *
- */
-cc_int32
-cci_msg_calc_size(cc_msg_t* msg, cc_uint32 * lenp)
-{
- cc_uint32 flat_len;
- cc_generic_list_node_t* gen_node;
- cc_generic_iterate_t* gen_iterator;
- cc_int32 code;
-
- if ( msg == NULL || lenp == NULL )
- return ccErrBadParam;
-
- code = cci_msg_calc_header_size(msg, &flat_len);
- if (code != ccNoError)
- goto bad;
-
- code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
- if ( code != ccNoError )
- goto bad;
-
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- if (code != ccNoError)
- break;
- flat_len += gen_node->len + BLOB_LEN;
- }
- cci_generic_free_iterator(gen_iterator);
- if (code != ccNoError)
- goto bad;
-
- flat_len += MAGIC_HEAD_LEN + MAGIC_DATA_LEN;
- *lenp = flat_len;
-
- bad:
- return code;
-}
-
-/**
- * cci_msg_add_data_blob()
- *
- * Purpose: Adds 'len' bytes of data to the msg
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_add_data_blob(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 *lenp)
-{
- cc_int32 code;
-
- if (msg == NULL || data == NULL || len <= 0 || lenp == NULL)
- return ccErrBadParam;
-
- code = cci_generic_list_append(msg->data_blobs, data, len, NULL);
- if ( code != ccNoError )
- return code;
- return cci_msg_calc_blob_pos(msg, data, len, lenp);
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_calc_blob_pos(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 * posp)
-{
- cc_uint32 pos;
- cc_generic_list_node_t* gen_node;
- cc_generic_iterate_t* gen_iterator;
- cc_int32 code;
-
- code = cci_msg_calc_header_size(msg, &pos);
- pos += sizeof(cc_uint32); /*+ sizeof(cc_uint32) for magic*/
-
- code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- if (gen_node->len != len && gen_node->data != data) {
- pos += gen_node->len + sizeof(cc_uint32);
- } else {
- cci_generic_free_iterator(gen_iterator);
- *posp = pos + sizeof(cc_uint32);
- return ccNoError;
- }
- }
-
- cci_generic_free_iterator(gen_iterator);
- return ccIteratorEnd;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_add_header(cc_msg_t* msg, void *header, cc_uint32 header_len)
-{
- if ( msg == NULL || header == NULL )
- return ccErrBadParam;
-
- msg->header = header;
- msg->header_len = header_len;
- return ccNoError;
-}
-
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_flatten(cc_msg_t* msg, void **flatpp)
-{
- cc_generic_list_node_t* gen_node;
- cc_generic_iterate_t* gen_iterator;
- unsigned char *cur_pos;
- cc_uint32 zero = 0;
- cc_uint32 magic = 0;
- cc_uint32 msg_len;
- cc_uint32 u32;
- cc_int32 code;
-
- if (msg == NULL)
- return ccErrBadParam;
-
- code = cci_msg_calc_size(msg,&msg->flat_len);
- if ( code != ccNoError )
- return code;
-
- if (msg->flat_len > CC_MSG_MAX_SIZE)
- return ccErrBadParam;
-
- msg->flat = (void *)malloc(msg->flat_len);
- if (msg->flat == NULL)
- return ccErrNoMem;
-
- cur_pos = msg->flat;
-
- u32 = htonl(msg->header_len);
- memcpy(cur_pos,&u32,sizeof(cc_uint32));
- cur_pos+=sizeof(cc_uint32);
-
- u32 = htonl(msg->flat_len);
- memcpy(cur_pos,&u32,sizeof(cc_uint32));
- cur_pos+=sizeof(cc_uint32);
-
- u32 = htonl(msg->type);
- memcpy(cur_pos,&u32,sizeof(cc_uint32));
- cur_pos+=sizeof(cc_uint32);
-
- /* header data is already in network order */
- memcpy(cur_pos, msg->header, msg->header_len);
- cur_pos += msg->header_len;
-
- u32 = htonl(zero);
- memcpy(cur_pos, &u32, sizeof(cc_uint32)); /*will be magic number later*/
- cur_pos += sizeof(cc_uint32);
-
- code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
- if ( code != ccNoError ) {
- free(msg->flat);
- return code;
- }
-
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- if (code != ccNoError) {
- free(gen_iterator);
- free(msg->flat);
- return code;
- }
- u32 = htonl(gen_node->len);
- memcpy(cur_pos, &u32, sizeof(cc_uint32));
- cur_pos+=sizeof(cc_uint32);
-
- /* data already in network order */
- memcpy(cur_pos, gen_node->data, gen_node->len);
- cur_pos += gen_node->len;
- }
- free(gen_iterator);
-
- u32 = htonl(zero);
- memcpy(cur_pos, &u32, sizeof(cc_uint32)); /*magic number will go here later*/
- cur_pos += sizeof(cc_uint32);
-
- if (cur_pos - (unsigned char *)msg->flat != msg->flat_len) {
- fprintf(stderr, "ERROR cur_pos - msg->flat = %d\n",msg->flat_len);
- }
-
- cci_msg_calc_magic(msg->flat, msg->flat_len, &magic);
- printf("magic = %d\n",magic);
-
- cci_msg_calc_header_size(msg, &msg_len);
- memcpy((char *)msg->flat + msg_len, &magic, sizeof(cc_uint32));
- memcpy((char *)msg->flat + msg->flat_len - sizeof(cc_uint32), &magic, sizeof(cc_uint32));
-
- if ( flatpp != NULL )
- *flatpp = msg->flat;
-
- return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_calc_magic(void *flat, cc_uint32 flat_len, cc_uint32 * magicp)
-{
- cc_uint32 magic = 0;
- cc_uint32 i;
-
- for (i = 0; i < flat_len; i += sizeof(cc_uint32)) {
- magic = magic ^ *(int *)((char *)flat + i);
- }
- *magicp = htonl(magic);
- return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_verify(void *flat, cc_uint32 flat_len, cc_uint32 * validp)
-{
- cc_uint32 *magic1, *magic2;
- cc_uint32 *pheader_len;
- cc_uint32 header_len;
- cc_uint32 *ptotal_len;
- cc_uint32 total_len;
- cc_uint32 *pblob_len;
- cc_uint32 blob_len;
- cc_uint32 *ptype;
- cc_uint32 type;
- cc_uint32 num_blobs = 0;
- cc_uint32 zero = 0;
- cc_uint32 msg_magic, msg_magic2;
-
- if (flat == NULL || flat_len <= 0 || validp == NULL)
- return ccErrBadParam;
-
- pheader_len = flat;
- ptotal_len = (cc_uint32 *)((char *)pheader_len + sizeof(cc_uint32));
- ptype = (cc_uint32 *)((char *)ptotal_len + sizeof(cc_uint32));
-
- header_len = ntohl(*pheader_len);
- total_len = ntohl(*ptotal_len);
- type = ntohl(*ptype);
-
- if (total_len != flat_len) {
- *validp = 0;
- return ccNoError;
- }
-
- if (header_len > flat_len) {
- /*too weak. We could verify header_len against type spec header.*/
- *validp = 0;
- return ccNoError;
- }
- if (type > CC_MSG_MAX_TYPE) {
- *validp = 0;
- return ccNoError;
- }
-
- magic1 = (cc_uint32 *)((char *)ptype + sizeof(cc_uint32) + header_len);
- if ((char *)magic1 - (char *)flat == (flat_len - 8)) {
- /*There are no data blobs*/
- magic2 = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));
- num_blobs = 0;
- } else {
- pblob_len = (cc_uint32 *)((char *)magic1 + sizeof(cc_uint32));
- num_blobs = 1;
- blob_len = ntohl(*pblob_len);
-
- while (blob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) < (flat_len - sizeof(cc_uint32))) {
- pblob_len = (cc_uint32 *)((char *)pblob_len + blob_len + sizeof(cc_uint32));
- num_blobs++;
- blob_len = ntohl(*pblob_len);
- }
-
- if (blob_len + sizeof(cc_uint32) + ((char *)pblob_len - (char *)flat) != (flat_len - sizeof(cc_uint32))) {
- /*blobs didn't line up*/
- *validp = 0;
- return ccNoError;
- }
- magic2 = (cc_uint32 *)((char *)pblob_len + blob_len + sizeof(cc_uint32)); /*2nd magic should be directly after the last blob*/
- }
-
- if (*magic1 != *magic2) {
- *validp = 0;
- return ccNoError;
- }
- msg_magic = *magic1;
-
- printf("%d %d\n", (char *)magic1 - (char *)flat, (char *)magic2 - (char *)flat);
-
- memcpy(magic1, &zero, sizeof(cc_uint32));
- memcpy(magic2, &zero, sizeof(cc_uint32));
- cci_msg_calc_magic(flat, flat_len, &msg_magic2);
- /* both msg_magic and msg_magic2 are in network order */
- if (msg_magic != msg_magic2) {
- *validp = 0;
- return ccNoError;
- }
- memcpy(magic1, &msg_magic, sizeof(cc_uint32));
- memcpy(magic2, &msg_magic, sizeof(cc_uint32));
-
- *validp = 1;
- return ccNoError;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_unflatten(void *flat, cc_uint32 flat_len, cc_msg_t** msgpp)
-{
- cc_msg_t* msg;
- char *cur_pos;
- cc_uint32 blob_len;
- char *blob;
- cc_uint32 valid;
- cc_int32 code;
-
- if ( flat == NULL || flat_len <= 0 || msgpp == NULL )
- return ccErrBadParam;
-
- code = cci_msg_new(0, &msg);
- if (code)
- return code;
-
- cci_msg_verify(flat, flat_len, &valid);
- if (valid != 1) {
- cci_msg_destroy(msg);
- return ccErrBadParam;
- }
-
- cur_pos = flat;
- msg->flat = flat;
-
- msg->header_len = ntohl(*(cc_uint32 *)cur_pos);
- cur_pos += sizeof(cc_uint32);
-
- msg->flat_len = ntohl(*(cc_uint32 *)cur_pos);
- cur_pos += sizeof(cc_uint32);
-
- msg->type = ntohl(*(cc_uint32 *)cur_pos);
- cur_pos += sizeof(cc_uint32);
-
- msg->header = (void *)malloc(msg->header_len);
- if (msg->header == NULL) {
- cci_msg_destroy(msg);
- return ccErrNoMem;
- }
- memcpy(msg->header, cur_pos, msg->header_len);
- cur_pos += msg->header_len;
-
- msg->magic = ntohl(*(cc_uint32 *)cur_pos);
- cur_pos += sizeof(cc_uint32);
-
- if (cur_pos - (char *)flat != flat_len - 8) { /*at least 1 blob*/
- blob_len = ntohl(*(cc_uint32 *)cur_pos);
- while (blob_len + (cur_pos - (char *)flat) + sizeof(cc_uint32) <= flat_len - sizeof(cc_uint32)) {
- blob = (void *)malloc(blob_len);
- if (blob == NULL) {
- cci_msg_destroy(msg);
- return ccErrNoMem;
- }
- memcpy(blob, cur_pos + sizeof(cc_uint32), blob_len);
- cci_generic_list_append(msg->data_blobs, blob, blob_len, NULL);
-
- cur_pos += sizeof(cc_uint32) + blob_len;
- blob_len = ntohl(*(int *)cur_pos);
- }
- }
- *msgpp = msg;
- return ccNoError;
-}
-
-cc_int32
-cci_msg_retrieve_blob(cc_msg_t* msg, cc_uint32 blob_offset, cc_uint32 blob_len, char **blobp)
-{
- cc_generic_iterate_t* gen_iterator;
- cc_generic_list_node_t* gen_node;
- void *ret;
- cc_uint32 blob_pos;
- cc_int32 code;
-
- /*Ensure that the message has been unflattened*/
- if ( msg == NULL || msg->flat == NULL || blob_offset > msg->flat_len ||
- blob_len > msg->flat_len - blob_offset || blobp == NULL)
- return ccErrBadParam;
-
- code = cci_generic_list_iterator(msg->data_blobs, &gen_iterator);
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- code = cci_msg_calc_blob_pos(msg, gen_node->data, gen_node->len, &blob_pos);
- if (blob_pos == blob_offset && gen_node->len == blob_len) {
- free(gen_iterator);
- ret = (void *)malloc(blob_len);
- if (ret == NULL)
- return ccErrNoMem;
- memcpy(ret,(char *)msg->flat + blob_offset, blob_len);
- *blobp = ret;
- return ccNoError;
- }
- }
- free(gen_iterator);
- return ccIteratorEnd;
-}
-
-/**
- * cc_msg_
- *
- * Purpose:
- *
- * Return:
- *
- * Errors:
- *
- */
-cc_int32
-cci_msg_destroy(cc_msg_t* msg)
-{
- if (msg->flat != NULL)
- free(msg->flat);
- if (msg->header != NULL)
- free(msg->header);
- cci_generic_list_destroy(msg->data_blobs);
- free(msg);
- return ccNoError;
-}
-
+++ /dev/null
-The following are notes describing the requirements of the Platform\r
-Specific code necessary for constructing a Portable CCAPI.\r
-\r
-Directory structure:\r
-\r
- lib/ccapi/client - platform independent client library\r
- lib/ccapi/common - platform independent common library\r
- lib/ccapi/include - platform independent header files\r
- lib/ccapi/mac - macosx specific headers, libraries, executables\r
- lib/ccapi/server - platform independent server library\r
- lib/ccapi/windows - windows specific headers, libraries, executables\r
-\r
-\r
-Platform Independent Design:\r
-\r
-The functionality of the Portable CCAPI is implemented in the platform\r
-independent libraries. The common library encapsulates the functions\r
-for managing generic lists, iterators, and messages as well as routines\r
-formarshalling and unmarshalling. The client library provides the\r
-client side routines for issuing requests to the ccapi server minus the\r
-platform dependent glue required for shared library initialization,\r
-cleanup, and interprocess communications. The server library provides\r
-server side functionality for managing credential cache collections,\r
-caches, credentials, iterators, and their handles minus the platform\r
-dependent glue for process initialization, interprocess communication,\r
-session security, and critical section enforcement.\r
-\r
-\r
-Platform Dependent Design Requirements:\r
-\r
-The platform dependent code is responsible for producing a shared\r
-client library:\r
-\r
- + the shared library is built from cc_client.lib and cc_common.lib plus\r
- platform dependent glue\r
-\r
- - [windows] link cc_client.lib and cc_common.lib with platform\r
- dependent routines and export list (.def) to produce\r
- krbcc32.{lib,dll}\r
-\r
- + initialization and cleanup\r
-\r
- - [windows] provide DllMain entry point providing Process and Thread\r
- attachment and detachment routines\r
-\r
- + implement cci_perform_rpc() function used by cc_client.lib\r
- cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response)\r
-\r
- - cci_perform_rpc() takes an input request cc_msg_t object, flattens\r
- it with cci_msg_flatten() and sends the contents of unsigned char\r
- buffer request->flat of length request->flat_len to the server\r
- utilizing a platform specific interprocess communication method.\r
-\r
- - upon IPC success, cci_perform_rpc() unflattens the response buffer\r
- with cci_msg_unflatten() and returns the new cc_msg_t response\r
- object to the caller.\r
-\r
- - cci_perform_rpc() is responsible for performing any necessary\r
- session security management. For example, on Windows the Logon\r
- Provider executes under the local machine's "SYSTEM" account within\r
- session 0 and not under the account of the user that is logging in\r
- nor within the session the user's desktop and applications will be\r
- running within. It is the responsibility of cci_perform_rpc() and\r
- the platform dependent IPC mechanism to communicate the user's\r
- security identifiers to the server.\r
-\r
- For Windows, this means that the platform specific IPC messaging\r
- allows a username and session identifier to be sent separate from\r
- the username and session identifier that will be obtained via the\r
- use of Local RPC. If the Local RPC authenticates the user as\r
- "SYSTEM" and session 0, then the communicated values (if provided)\r
- will be used instead.\r
-\r
- + implement client side of IPC routine.\r
-\r
- - [windows] the client side IPC routine is produced by compiling a\r
- IDL file. The IDL defines an interface with a single function:\r
-\r
- __int32 ccapi_Message (\r
- [in] handle_t h,\r
- [in, string] unsigned char * client_name,\r
- [in] struct _LUID luid,\r
- [in] __int32 in_len,\r
- [in, string, size_is(in_len)] unsigned char * in_buf,\r
- [in] __int32 out_size,\r
- [out] __int32 * out_len,\r
- [out, string, size_is(out_size)] unsigned char\r
- out_buf[*]);\r
-\r
- The handle is a Local RPC specific handle used to identify the\r
- request. The client_name and luid are the override values for the\r
- username and session identifier for use during Windows login. The\r
- rest of the parameters provide the input and output buffers as well\r
- as allow communication of the actual length of the message data\r
- that is required by cci_msg_unflatten().\r
-\r
- + if the CCAPI server is per-session, the shared client library is\r
- responsible for ensuring that an instance of the server is running in\r
- the current session. If not, the library must initiate an instance\r
- of the CCAPI server prior to performing any IPC requests.\r
-\r
-The platform dependent code is responsible for producing a server\r
-executable:\r
-\r
- + The server executable is built from cc_server.lib and cc_common.lib\r
- plus platform dependent glue.\r
-\r
- - [windows] The Windows CCAPI Server is being built using the\r
- per-system model. The platform specific code is responsible for\r
- providing NT Service Management routines for installation and\r
- removal as well as the NT Service Entry Points used when the\r
- process is started as an NT Service.\r
-\r
- link cc_server.lib and cc_common.lib with platform dependent\r
- routines to produce krbcc32s.exe.\r
-\r
- + Based upon the platform requirements, the server may be constructed\r
- to be per-session or per-system. The selected IPC mechanism must\r
- enforce the appropriate scoping.\r
-\r
- + The platform dependent startup routines will perform platform\r
- specific initialization including the IPC engine and call the\r
- platform independent initialization routine ccs_serv_initialize()\r
-\r
- + The platform dependent shutdown routines will perform platform\r
- specific cleanup including the IPC engine and call the platform\r
- independent function ccs_serv_cleanup() prior to process termination.\r
-\r
- + For each inbound CCAPI request, the server will unmarshall the\r
- request using cci_msg_unflatten() to produce a cc_msg_t object,\r
- construct cc_auth_info_t and cc_session_info_t objects to represent\r
- the platform dependent authentication and session data, call\r
- ccs_serv_process_msg() to process the request, call cci_msg_flatten()\r
- to marhall the response, transmit the response to the caller, and\r
- then cleanup the request and response cc_msg_t objects with\r
- cci_msg_destroy().\r
-\r
- + The cc_auth_info_t and cc_session_info_t objects are structures\r
- storing opaque binary (data, length) representations of the\r
- authentication and session data. These are stored as part of ccache\r
- collection and ccaches. ccs_serv_process_msg() will perform a binary\r
- comparison of the stored data with the data provided in the current\r
- request. If they do not match, the request will be denied. It is\r
- necessary that the data generated data always be the same. If\r
- username strings are not case-sensitive, they should be normalized\r
- before being passed to ccs_serv_process_msg().\r
-\r
- + The current cc_server.lib routines assume that one request at a time\r
- is being processed. If the IPC engine allows for more than one\r
- request to be simultaneously received in separate threads, then the\r
- call to ccs_serv_process_msg() must be wrapped by a critical section.\r
- Future enhancements to cc_server.lib will allow for per-object\r
- mutexes. When available the platform specific glue must provide\r
- functions to create, obtain, release, and destroy mutex objects.\r
-\r
-\r
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 1998-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).
- * $
- */
-
-/* $Header$ */
-
-/*
- * Declarations for Credentials Cache API Library
- *
- * API specification: <http://web.mit.edu/pismere/kerberos/ccache-api-v3.html>
- *
- * Revision 1: Frank Dabek, 6/4/1998
- * Revision 2: meeroh, 2/24/1999
- * Revision 3: meeroh, 11/12/1999
- * Revision 6: jaltman, 10/27/2004
- *
- */
-
-#ifndef __CREDENTIALSCACHE__
-#define __CREDENTIALSCACHE__
-
-#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
-#include <TargetConditionals.h>
-#endif
-
-#if defined(_WIN32)
-#include <winsock.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if TARGET_OS_MAC
-#pragma pack(push,2)
-#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
-#else
-#define CCACHE_API
-#endif
-
-#include <time.h>
-
-/*
- * Constants
- */
-
-/* API versions */
-enum {
- ccapi_version_2 = 2,
- ccapi_version_3 = 3,
- ccapi_version_4 = 4,
- ccapi_version_5 = 5,
- ccapi_version_6 = 6,
- ccapi_version_max = ccapi_version_6
-};
-
-/* Errors */
-enum {
- ccNoError = 0,
-
- ccIteratorEnd = 201,
- ccErrBadParam,
- ccErrNoMem,
- ccErrInvalidContext,
- ccErrInvalidCCache,
-
- ccErrInvalidString, /* 206 */
- ccErrInvalidCredentials,
- ccErrInvalidCCacheIterator,
- ccErrInvalidCredentialsIterator,
- ccErrInvalidLock,
-
- ccErrBadName, /* 211 */
- ccErrBadCredentialsVersion,
- ccErrBadAPIVersion,
- ccErrContextLocked,
- ccErrContextUnlocked,
-
- ccErrCCacheLocked, /* 216 */
- ccErrCCacheUnlocked,
- ccErrBadLockType,
- ccErrNeverDefault,
- ccErrCredentialsNotFound,
-
- ccErrCCacheNotFound, /* 221 */
- ccErrContextNotFound,
- ccErrServerUnavailable,
- ccErrServerInsecure,
- ccErrServerCantBecomeUID,
-
- ccErrTimeOffsetNotSet, /* 226 */
- ccErrBadInternalMessage,
- ccErrNotImplemented
-};
-
-/* Credentials versions */
-enum cc_credential_versions {
- cc_credentials_v4 = 1,
- cc_credentials_v5 = 2,
- cc_credentials_v4_v5 = 3
-};
-
-/* Lock types */
-enum cc_lock_types {
- cc_lock_read = 0,
- cc_lock_write = 1,
- cc_lock_upgrade = 2,
- cc_lock_downgrade = 3
-};
-
-/* Locking Modes */
-enum cc_lock_modes {
- cc_lock_noblock = 0,
- cc_lock_block = 1
-};
-
-/*
- * Basic types
- */
-
-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
- */
-
-/* Forward declarations */
-struct cc_context_f;
-typedef struct cc_context_f cc_context_f;
-
-struct cc_ccache_f;
-typedef struct cc_ccache_f cc_ccache_f;
-
-struct cc_ccache_iterator_f;
-typedef struct cc_ccache_iterator_f cc_ccache_iterator_f;
-
-struct cc_ccache_iterator_f;
-typedef struct cc_credentials_iterator_f cc_credentials_iterator_f;
-
-struct cc_string_f;
-typedef struct cc_string_f cc_string_f;
-
-struct cc_credentials_f;
-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_instance_size = 40,
- cc_v4_realm_size = 40,
- cc_v4_ticket_size = 1254,
- cc_v4_key_size = 8
-};
-
-enum cc_string_to_key_type {
- cc_v4_stk_afs = 0,
- cc_v4_stk_des = 1,
- cc_v4_stk_columbia_special = 2,
- cc_v4_stk_krb5 = 3,
- cc_v4_stk_unknown = 4
-};
-
-struct cc_credentials_v4_t {
- 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_time issue_date;
- cc_int32 lifetime;
- cc_uint32 address;
- cc_int32 ticket_size;
- unsigned char ticket [cc_v4_ticket_size];
-};
-typedef struct cc_credentials_v4_t cc_credentials_v4_t;
-
-struct cc_data {
- cc_uint32 type;
- cc_uint32 length;
- void* data;
-};
-typedef struct cc_data cc_data;
-
-struct cc_credentials_v5_t {
- char* client;
- char* server;
- cc_data keyblock;
- cc_time authtime;
- cc_time starttime;
- cc_time endtime;
- cc_time renew_till;
- cc_uint32 is_skey;
- cc_uint32 ticket_flags;
- cc_data** addresses;
- cc_data ticket;
- cc_data second_ticket;
- cc_data** authdata;
-};
-typedef struct cc_credentials_v5_t cc_credentials_v5_t;
-
-struct cc_credentials_union {
- cc_int32 version;
- union {
- cc_credentials_v4_t* credentials_v4;
- cc_credentials_v5_t* credentials_v5;
- } credentials;
-};
-typedef struct cc_credentials_union cc_credentials_union;
-
-/* Exposed parts */
-
-struct cc_context_d {
- const cc_context_f *functions;
-#if TARGET_OS_MAC
- const cc_context_f *otherFunctions;
-#endif
-};
-typedef struct cc_context_d cc_context_d;
-typedef cc_context_d *cc_context_t;
-
-struct cc_ccache_d {
- const cc_ccache_f *functions;
-#if TARGET_OS_MAC
- const cc_ccache_f *otherFunctions;
-#endif
-};
-typedef struct cc_ccache_d cc_ccache_d;
-typedef cc_ccache_d *cc_ccache_t;
-
-struct cc_ccache_iterator_d {
- const cc_ccache_iterator_f *functions;
-#if TARGET_OS_MAC
- const cc_ccache_iterator_f *otherFunctions;
-#endif
-};
-typedef struct cc_ccache_iterator_d cc_ccache_iterator_d;
-typedef cc_ccache_iterator_d *cc_ccache_iterator_t;
-
-struct cc_credentials_iterator_d {
- const cc_credentials_iterator_f *functions;
-#if TARGET_OS_MAC
- const cc_credentials_iterator_f *otherFunctions;
-#endif
-};
-typedef struct cc_credentials_iterator_d cc_credentials_iterator_d;
-typedef cc_credentials_iterator_d *cc_credentials_iterator_t;
-
-struct cc_string_d {
- const char *data;
- const cc_string_f *functions;
-#if TARGET_OS_MAC
- const cc_string_f *otherFunctions;
-#endif
-};
-typedef struct cc_string_d cc_string_d;
-typedef cc_string_d *cc_string_t;
-
-struct cc_credentials_d {
- const cc_credentials_union *data;
- const cc_credentials_f *functions;
-#if TARGET_OS_MAC
- const cc_credentials_f *otherFunctions;
-#endif
-};
-typedef struct cc_credentials_d cc_credentials_d;
-typedef cc_credentials_d *cc_credentials_t;
-
-/* Function pointer structs */
-
-struct cc_context_f {
- cc_int32 (*release) (cc_context_t in_context);
-
- cc_int32 (*get_change_time) (cc_context_t in_context,
- cc_time *out_time);
-
- cc_int32 (*get_default_ccache_name) (cc_context_t in_context,
- cc_string_t *out_name);
-
- cc_int32 (*open_ccache) (cc_context_t in_context,
- const char *in_name,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*open_default_ccache) (cc_context_t in_context,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*create_ccache) (cc_context_t in_context,
- const char *in_name,
- cc_uint32 in_cred_vers,
- const char *in_principal,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*create_default_ccache) (cc_context_t in_context,
- cc_uint32 in_cred_vers,
- const char *in_principal,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*create_new_ccache) (cc_context_t in_context,
- cc_uint32 in_cred_vers,
- const char *in_principal,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*new_ccache_iterator) (cc_context_t in_context,
- cc_ccache_iterator_t *out_iterator);
-
- cc_int32 (*lock) (cc_context_t in_context,
- cc_uint32 in_lock_type,
- cc_uint32 in_block);
-
- cc_int32 (*unlock) (cc_context_t in_cc_context);
-
- cc_int32 (*compare) (cc_context_t in_cc_context,
- cc_context_t in_compare_to_context,
- cc_uint32 *out_equal);
-};
-
-struct cc_ccache_f {
- cc_int32 (*release) (cc_ccache_t io_ccache);
-
- cc_int32 (*destroy) (cc_ccache_t io_ccache);
-
- cc_int32 (*set_default) (cc_ccache_t io_ccache);
-
- cc_int32 (*get_credentials_version) (cc_ccache_t in_ccache,
- cc_uint32 *in_credentials_version);
-
- cc_int32 (*get_name) (cc_ccache_t in_ccache,
- cc_string_t *out_name);
-
- cc_int32 (*get_principal) (cc_ccache_t in_ccache,
- cc_uint32 in_credentials_version,
- cc_string_t *out_principal);
-
- cc_int32 (*set_principal) (cc_ccache_t io_ccache,
- cc_uint32 in_credentials_version,
- const char *in_principal);
-
- cc_int32 (*store_credentials) (cc_ccache_t io_ccache,
- const cc_credentials_union *in_credentials_union);
-
- cc_int32 (*remove_credentials) (cc_ccache_t io_ccache,
- cc_credentials_t in_credentials);
-
- cc_int32 (*new_credentials_iterator) (cc_ccache_t in_ccache,
- cc_credentials_iterator_t *out_credentials_iterator);
-
- cc_int32 (*move) (cc_ccache_t io_source_ccache,
- cc_ccache_t io_destination_ccache);
-
- cc_int32 (*lock) (cc_ccache_t io_ccache,
- cc_uint32 in_lock_type,
- cc_uint32 in_block);
-
- cc_int32 (*unlock) (cc_ccache_t io_ccache);
-
- cc_int32 (*get_last_default_time) (cc_ccache_t in_ccache,
- cc_time *out_last_default_time);
-
- cc_int32 (*get_change_time) (cc_ccache_t in_ccache,
- cc_time *out_change_time);
-
- cc_int32 (*compare) (cc_ccache_t in_ccache,
- cc_ccache_t in_compare_to_ccache,
- cc_uint32 *out_equal);
-
- cc_int32 (*get_kdc_time_offset) (cc_ccache_t in_ccache,
- cc_int32 in_credentials_version,
- cc_time *out_time_offset);
-
- cc_int32 (*set_kdc_time_offset) (cc_ccache_t io_ccache,
- cc_int32 in_credentials_version,
- cc_time in_time_offset);
-
- cc_int32 (*clear_kdc_time_offset) (cc_ccache_t in_ccache,
- cc_int32 in_credentials_version);
-};
-
-struct cc_string_f {
- cc_int32 (*release) (cc_string_t in_string);
-};
-
-struct cc_credentials_f {
- cc_int32 (*release) (cc_credentials_t io_credentials);
-
- cc_int32 (*compare) (cc_credentials_t in_credentials,
- cc_credentials_t in_compare_to_credentials,
- cc_uint32 *out_equal);
-};
-
-
-struct cc_ccache_iterator_f {
- cc_int32 (*release) (cc_ccache_iterator_t io_ccache_iterator);
-
- cc_int32 (*next) (cc_ccache_iterator_t in_ccache_iterator,
- cc_ccache_t *out_ccache);
-
- cc_int32 (*clone) (cc_ccache_iterator_t in_ccache_iterator,
- cc_ccache_iterator_t *out_ccache_iterator);
-};
-
-struct cc_credentials_iterator_f {
- cc_int32 (*release) (cc_credentials_iterator_t io_credentials_iterator);
-
- cc_int32 (*next) (cc_credentials_iterator_t in_credentials_iterator,
- cc_credentials_t *out_credentials);
-
- cc_int32 (*clone) (cc_credentials_iterator_t in_credentials_iterator,
- cc_credentials_iterator_t *out_credentials_iterator);
-};
-
-/*
- * API functions
- */
-
-CCACHE_API cc_int32 cc_initialize (cc_context_t *out_context,
- cc_int32 in_version,
- cc_int32 *out_supported_version,
- char const **out_vendor);
-
-/*
- * Convenience macros
- */
-
-#define cc_context_release(context) \
- ((context) -> functions -> release (context))
-#define cc_context_get_change_time(context, time) \
- ((context) -> functions -> get_change_time (context, time))
-#define cc_context_get_default_ccache_name(context, name) \
- ((context) -> functions -> get_default_ccache_name (context, name))
-#define cc_context_open_ccache(context, name, ccache) \
- ((context) -> functions -> open_ccache (context, name, ccache))
-#define cc_context_open_default_ccache(context, ccache) \
- ((context) -> functions -> open_default_ccache (context, ccache))
-#define cc_context_create_ccache(context, name, version, principal, ccache) \
- ((context) -> functions -> create_ccache (context, name, version, principal, ccache))
-#define cc_context_create_default_ccache(context, version, principal, ccache) \
- ((context) -> functions -> create_default_ccache (context, version, principal, ccache))
-#define cc_context_create_new_ccache(context, version, principal, ccache) \
- ((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, block) \
- ((context) -> functions -> lock (context, type, block))
-#define cc_context_unlock(context) \
- ((context) -> functions -> unlock (context))
-#define cc_context_compare(context, compare_to, equal) \
- ((context) -> functions -> compare (context, compare_to, equal))
-
-#define cc_ccache_release(ccache) \
- ((ccache) -> functions -> release (ccache))
-#define cc_ccache_destroy(ccache) \
- ((ccache) -> functions -> destroy (ccache))
-#define cc_ccache_set_default(ccache) \
- ((ccache) -> functions -> set_default (ccache))
-#define cc_ccache_get_credentials_version(ccache, version) \
- ((ccache) -> functions -> get_credentials_version (ccache, version))
-#define cc_ccache_get_name(ccache, name) \
- ((ccache) -> functions -> get_name (ccache, name))
-#define cc_ccache_get_principal(ccache, version, principal) \
- ((ccache) -> functions -> get_principal (ccache, version, principal))
-#define cc_ccache_set_principal(ccache, version, principal) \
- ((ccache) -> functions -> set_principal (ccache, version, principal))
-#define cc_ccache_store_credentials(ccache, credentials) \
- ((ccache) -> functions -> store_credentials (ccache, credentials))
-#define cc_ccache_remove_credentials(ccache, credentials) \
- ((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, 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) \
- ((ccache) -> functions -> get_last_default_time (ccache, time))
-#define cc_ccache_get_change_time(ccache, time) \
- ((ccache) -> functions -> get_change_time (ccache, time))
-#define cc_ccache_move(source, destination) \
- ((source) -> functions -> move (source, destination))
-#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))
-#define cc_ccache_set_kdc_time_offset(ccache, 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))
-
-#define cc_string_release(string) \
- ((string) -> functions -> release (string))
-
-#define cc_credentials_release(credentials) \
- ((credentials) -> functions -> release (credentials))
-#define cc_credentials_compare(credentials, compare_to, equal) \
- ((credentials) -> functions -> compare (credentials, compare_to, equal))
-
-#define cc_ccache_iterator_release(iterator) \
- ((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
-#pragma pack(pop)
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CREDENTIALSCACHE__ */
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 1998-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).
- * $
- */
-/*
- * This is backwards compatibility for CCache API v2 clients to be able to run
- * against the CCache API v3 library
- */
-
-#ifndef __CREDENTIALSCACHE2__
-#define __CREDENTIALSCACHE2__
-
-#include "CredentialsCache.h"
-
-#if defined(macintosh) || (defined(__MACH__) && defined(__APPLE__))
-#include <TargetConditionals.h>
-#endif
-
-#ifdef __cplusplus
-extern "C" {
-#endif /* __cplusplus */
-
-#if TARGET_OS_MAC
-#pragma pack(push,2)
-#endif
-
-/* Some old types get directly mapped to new types */
-
-typedef cc_context_d apiCB;
-typedef cc_ccache_d ccache_p;
-typedef cc_credentials_iterator_d ccache_cit_creds;
-typedef cc_ccache_iterator_d ccache_cit_ccache;
-typedef cc_data cc_data_compat;
-typedef cc_int32 cc_cred_vers;
-typedef cc_int32 cc_result;
-
-/* This doesn't exist in API v3 */
-typedef cc_uint32 cc_flags;
-
-/* Credentials types are visible to the caller so we have to keep binary compatibility */
-
-typedef struct cc_credentials_v5_compat {
- char* client;
- char* server;
- cc_data_compat keyblock;
- 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;
- cc_data_compat ticket;
- cc_data_compat second_ticket;
- cc_data_compat** authdata;
-} cc_credentials_v5_compat;
-
-enum {
- MAX_V4_CRED_LEN = 1250
-};
-
-enum {
- KRB_NAME_SZ = 40,
- KRB_INSTANCE_SZ = 40,
- KRB_REALM_SZ = 40
-};
-
-typedef struct cc_credentials_v4_compat {
- unsigned char kversion;
- char principal[KRB_NAME_SZ+1];
- char principal_instance[KRB_INSTANCE_SZ+1];
- char service[KRB_NAME_SZ+1];
- char service_instance[KRB_INSTANCE_SZ+1];
- char realm[KRB_REALM_SZ+1];
- unsigned char session_key[8];
- cc_int32 kvno;
- cc_int32 str_to_key;
- long issue_date;
- cc_int32 lifetime;
- cc_uint32 address;
- cc_int32 ticket_sz;
- unsigned char ticket[MAX_V4_CRED_LEN];
- unsigned long oops;
-} cc_credentials_v4_compat;
-
-typedef union cred_ptr_union_compat {
- cc_credentials_v4_compat* pV4Cred;
- cc_credentials_v5_compat* pV5Cred;
-} cred_ptr_union_compat;
-
-typedef struct cred_union {
- cc_int32 cred_type; // cc_cred_vers
- cred_ptr_union_compat cred;
-} cred_union;
-
-/* NC info structure is gone in v3 */
-
-struct infoNC {
- char* name;
- char* principal;
- cc_int32 vers;
-};
-
-typedef struct infoNC infoNC;
-
-/* Some old type names */
-
-typedef cc_credentials_v4_compat V4Cred_type;
-typedef cc_credentials_v5_compat cc_creds;
-struct ccache_cit;
-typedef struct ccache_cit ccache_cit;
-
-enum {
- CC_API_VER_2 = ccapi_version_2
-};
-
-enum {
- CC_NOERROR,
- CC_BADNAME,
- CC_NOTFOUND,
- CC_END,
- CC_IO,
- CC_WRITE,
- CC_NOMEM,
- CC_FORMAT,
- CC_LOCKED,
- CC_BAD_API_VERSION,
- CC_NO_EXIST,
- CC_NOT_SUPP,
- CC_BAD_PARM,
- CC_ERR_CACHE_ATTACH,
- CC_ERR_CACHE_RELEASE,
- CC_ERR_CACHE_FULL,
- CC_ERR_CRED_VERSION
-};
-
-enum {
- CC_CRED_UNKNOWN,
- CC_CRED_V4,
- CC_CRED_V5,
- 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);
-
-CCACHE_API cc_int32 cc_get_NC_info (
- apiCB* inContext,
- infoNC*** outInfo);
-
-CCACHE_API cc_int32 cc_get_change_time (
- apiCB* inContext,
- cc_time* outTime);
-
-CCACHE_API cc_int32 cc_open (
- apiCB* inContext,
- const char* inName,
- cc_int32 inVersion,
- cc_uint32 inFlags,
- ccache_p** outCCache);
-
-CCACHE_API cc_int32 cc_create (
- apiCB* inContext,
- const char* inName,
- const char* inPrincipal,
- cc_int32 inVersion,
- cc_uint32 inFlags,
- ccache_p** outCCache);
-
-CCACHE_API cc_int32 cc_close (
- apiCB* inContext,
- ccache_p** ioCCache);
-
-CCACHE_API cc_int32 cc_destroy (
- apiCB* inContext,
- ccache_p** ioCCache);
-
-CCACHE_API cc_int32 cc_seq_fetch_NCs_begin (
- apiCB* inContext,
- ccache_cit** outIterator);
-
-CCACHE_API cc_int32 cc_seq_fetch_NCs_next (
- apiCB* inContext,
- ccache_p** outCCache,
- ccache_cit* inIterator);
-
-CCACHE_API cc_int32 cc_seq_fetch_NCs_end (
- apiCB* inContext,
- ccache_cit** ioIterator);
-
-CCACHE_API cc_int32 cc_get_name (
- apiCB* inContext,
- ccache_p* inCCache,
- char** outName);
-
-CCACHE_API cc_int32 cc_get_cred_version (
- apiCB* inContext,
- ccache_p* inCCache,
- cc_int32* outVersion);
-
-CCACHE_API cc_int32 cc_set_principal (
- apiCB* inContext,
- ccache_p* inCCache,
- cc_int32 inVersion,
- char* inPrincipal);
-
-CCACHE_API cc_int32 cc_get_principal (
- apiCB* inContext,
- ccache_p* inCCache,
- char** outPrincipal);
-
-CCACHE_API cc_int32 cc_store (
- apiCB* inContext,
- ccache_p* inCCache,
- cred_union inCredentials);
-
-CCACHE_API cc_int32 cc_remove_cred (
- apiCB* inContext,
- ccache_p* inCCache,
- cred_union inCredentials);
-
-CCACHE_API cc_int32 cc_seq_fetch_creds_begin (
- apiCB* inContext,
- const ccache_p* inCCache,
- ccache_cit** outIterator);
-
-CCACHE_API cc_int32 cc_seq_fetch_creds_next (
- apiCB* inContext,
- cred_union** outCreds,
- ccache_cit* inIterator);
-
-CCACHE_API cc_int32 cc_seq_fetch_creds_end (
- apiCB* inContext,
- ccache_cit** ioIterator);
-
-CCACHE_API cc_int32 cc_free_principal (
- apiCB* inContext,
- char** ioPrincipal);
-
-CCACHE_API cc_int32 cc_free_name (
- apiCB* inContext,
- char** ioName);
-
-CCACHE_API cc_int32 cc_free_creds (
- apiCB* inContext,
- cred_union** creds);
-
-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
-#pragma pack(pop)
-#endif
-
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
-
-#endif /* __CREDENTIALSCACHE2__ */
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-\r
-\r
-#ifndef __CC_RPC_H__\r
-#define __CC_RPC_H__\r
-\r
-#include "msg.h"\r
-\r
-cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response);\r
-\r
-#endif /* __CC_RPC_H__ */\r
+++ /dev/null
-/* $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"
-
-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__*/
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-/*\r
- * Prototypes and data structures for datastore.\r
- *\r
- */\r
-\r
-\r
-#ifndef __CC_GENERIC_LISTS_H_\r
-#define __CC_GENERIC_LISTS_H_\r
-\r
-enum cc_list_type {\r
- cc_generic_list = 0,\r
- cc_context_list,\r
- cc_cache_list,\r
- cc_credentials_list\r
-};\r
-\r
-struct cc_generic_list_node_t {\r
- cc_uint8* data;\r
- cc_uint32 len;\r
- struct cc_generic_list_node_t* next;\r
- struct cc_generic_list_node_t* prev;\r
-};\r
-typedef struct cc_generic_list_node_t cc_generic_list_node_t;\r
-\r
-struct cc_generic_list_head_t {\r
- enum cc_list_type type;\r
- cc_generic_list_node_t* head;\r
- cc_generic_list_node_t* tail; \r
-}; \r
-typedef struct cc_generic_list_head_t cc_generic_list_head_t;\r
-\r
-\r
-struct cc_generic_iterate_t {\r
- cc_generic_list_node_t* next;\r
-};\r
-typedef struct cc_generic_iterate_t cc_generic_iterate_t;\r
-\r
-typedef cc_generic_list_head_t cc_context_list_head_t;\r
-typedef cc_generic_list_node_t cc_context_list_node_t;\r
-\r
-typedef cc_generic_list_head_t cc_ccache_list_head_t;\r
-typedef cc_generic_list_node_t cc_ccache_list_node_t;\r
-\r
-typedef cc_generic_list_head_t cc_credentials_list_head_t;\r
-typedef cc_generic_list_node_t cc_credentials_list_node_t;\r
-\r
-cc_int32 cci_generic_iterate_has_next(cc_generic_iterate_t *iterate);\r
-cc_int32 cci_generic_iterate_next(cc_generic_iterate_t *iterate, cc_generic_list_node_t**);\r
-\r
-cc_int32 cci_generic_list_new(cc_generic_list_head_t **);\r
-cc_int32 cci_generic_list_append(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);\r
-cc_int32 cci_generic_list_prepend(cc_generic_list_head_t *head, void *data, cc_uint32 len, cc_generic_list_node_t**);\r
-cc_int32 cci_generic_list_remove_element(cc_generic_list_head_t* head, cc_generic_list_node_t* rem);\r
-cc_int32 cci_generic_free_element(cc_generic_list_node_t* node);\r
-cc_int32 cci_generic_list_destroy(cc_generic_list_head_t* head);\r
-cc_int32 cci_generic_list_copy(cc_generic_list_head_t* head, cc_generic_list_head_t**);\r
-cc_int32 cci_generic_list_iterator(cc_generic_list_head_t *head, cc_generic_iterate_t**);\r
-cc_int32 cci_generic_free_iterator(cc_generic_iterate_t* iterator);\r
-\r
-#endif /* __CC_GENERIC_LISTS_H_ */\r
+++ /dev/null
-/* $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).
- * $
- */
-
-struct cc_flat_data {
- cc_uint32 type;
- cc_uint32 length;
- cc_uint32 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_time64 authtime;
- cc_time64 starttime;
- cc_time64 endtime;
- cc_time64 renew_till;
- cc_uint32 is_skey;
- cc_uint32 ticket_flags;
- cc_uint32 address_count;
- cc_uint32 addresses; /* offset to array */
- cc_flat_data ticket;
- cc_flat_data second_ticket;
- 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,
- char ** flat,
- cc_uint32 * len);
-
-cc_int32
-cci_creds_v4_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds);
-
-cc_int32
-cci_creds_v5_marshall( cc_credentials_v5_t * creds,
- char ** pflat,
- cc_uint32 * plen);
-
-cc_int32
-cci_creds_v5_unmarshall( char * flat,
- cc_uint32 len,
- cc_credentials_union * creds_union);
-
-
-
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/*
- * Verifiable, extensible message format.
- *
- * Format:
- * <size of header block (header_len)>
- * <size of *entire* message, including previous field (flat_len)>
- * <message type (type)>
- * <type specific header (header)>
- * <magic number (magic)>
- * <data blob 1 length>
- * <data blob 1>
- * <data blob 2 length>
- * <data blob 2>
- * ...
- * <magic number (magic)>
- *
- * 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"
-
-#if TARGET_OS_MAC
-#define htonll(x) OSSwapHostToBigInt64(x)
-#define ntohll(x) OSSwapBigToHostInt64(x)
-#endif
-
-struct cc_msg_t {
- cc_uint32 type; /*type of message*/
- cc_uint8 *flat; /*flattened representation of this message*/
- cc_uint8 *header; /*fixed length header determined by message type*/
- cc_uint32 flat_len; /*length of flat rep*/
- cc_uint32 header_len; /*length of header*/
- cc_uint32 magic; /*magic number for verification purposes*/
- cc_generic_list_head_t* data_blobs; /*variable length data*/
-};
-typedef struct cc_msg_t cc_msg_t;
-
-/*Types of messages*/
-enum {
- ccmsg_ACK,
- ccmsg_NACK,
- ccmsg_INIT,
- ccmsg_CTX_RELEASE,
- ccmsg_CTX_GET_CHANGE_TIME,
- ccmsg_CTX_GET_DEFAULT_CCACHE_NAME,
- 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_COMPARE,
- ccmsg_CCACHE_RELEASE,
- ccmsg_CCACHE_DESTROY,
- ccmsg_CCACHE_SET_DEFAULT,
- ccmsg_CCACHE_GET_CREDS_VERSION,
- ccmsg_CCACHE_GET_NAME,
- ccmsg_CCACHE_GET_PRINCIPAL,
- ccmsg_CCACHE_SET_PRINCIPAL,
- 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_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_ITERATOR_CLONE,
- ccmsg_CREDS_ITERATOR_RELEASE,
- ccmsg_CREDS_ITERATOR_NEXT,
- ccmsg_CREDS_ITERATOR_CLONE
-};
-
-#define CC_MSG_MAX_SIZE 1073741824 /*2^30*/
-#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))
-
-cc_int32 cci_msg_new(cc_uint32 type, cc_msg_t** msgpp);
-cc_int32 cci_msg_calc_size(cc_msg_t* msg, cc_uint32 * sizep);
-cc_int32 cci_msg_calc_header_size(cc_msg_t* msg, cc_uint32 * sizep);
-cc_int32 cci_msg_add_data_blob(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 * sizep);
-cc_int32 cci_msg_add_header(cc_msg_t* msg, void *header, cc_uint32 header_len);
-cc_int32 cci_msg_calc_blob_pos(cc_msg_t* msg, void *data, cc_uint32 len, cc_uint32 * sizep);
-cc_int32 cci_msg_flatten(cc_msg_t* msg, void **);
-cc_int32 cci_msg_calc_magic(void *flat, cc_uint32 flat_len, cc_uint32 * sizep);
-cc_int32 cci_msg_verify(void* flat, cc_uint32 flat_len, cc_uint32 * sizep);
-cc_int32 cci_msg_unflatten(void *flat, cc_uint32 flat_len, cc_msg_t** msgpp);
-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 */
-#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__*/
+++ /dev/null
-/* $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).
- * $
- */
-
-/*
- * Message type specific header structures.
- *
- */
-
-#ifndef __MSG_HEADERS_H__
-#define __MSG_HEADERS_H__
-
-#include "CredentialsCache.h"
-
-/*
- * All header structs must have sizes divisible by 4, and
- * all individual fields within the structs must also have
- * 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 {
- cc_handle ctx;
-};
-typedef struct ccmsg_ctx_only_t ccmsg_ctx_only_t;
-
-struct ccmsg_nack_t {
- cc_uint32 err_code; /*error code that caused failure*/
-};
-typedef struct ccmsg_nack_t ccmsg_nack_t;
-
-struct ccmsg_init_t {
- cc_uint32 in_version; /*client API version*/
-};
-struct ccmsg_init_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_init_t ccmsg_init_t;
-typedef struct ccmsg_init_resp_t ccmsg_init_resp_t;
-
-struct ccmsg_ctx_clone_t {
- cc_handle ctx;
- cc_uint32 in_version; /*client API version*/
-};
-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_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*/
-};
-typedef struct ccmsg_ctx_release_t ccmsg_ctx_release_t;
-
-struct ccmsg_ctx_get_change_time_t {
- cc_handle ctx;
-};
-struct ccmsg_ctx_get_change_time_resp_t {
- 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;
-
-struct ccmsg_ctx_get_default_ccache_name_t {
- cc_handle ctx;
-};
-struct ccmsg_ctx_get_default_ccache_name_resp_t {
- cc_uint32 name_offset;
- cc_uint32 name_len;
-};
-typedef struct ccmsg_ctx_get_default_ccache_name_t ccmsg_ctx_get_default_ccache_name_t;
-typedef struct ccmsg_ctx_get_default_ccache_name_resp_t ccmsg_ctx_get_default_ccache_name_resp_t;
-
-struct ccmsg_ctx_compare_t {
- cc_handle ctx1;
- cc_handle ctx2;
-};
-struct ccmsg_ctx_compare_resp_t {
- cc_uint32 is_equal;
-};
-typedef struct ccmsg_ctx_compare_t ccmsg_ctx_compare_t;
-typedef struct ccmsg_ctx_compare_resp_t ccmsg_ctx_compare_resp_t;
-
-struct ccmsg_ctx_new_ccache_iterator_t {
- cc_handle ctx;
-};
-struct ccmsg_ctx_new_ccache_iterator_resp_t {
- cc_handle iterator;
-};
-typedef struct ccmsg_ctx_new_ccache_iterator_t ccmsg_ctx_new_ccache_iterator_t;
-typedef struct ccmsg_ctx_new_ccache_iterator_resp_t ccmsg_ctx_new_ccache_iterator_resp_t;
-
-struct ccmsg_ctx_lock_t {
- cc_handle ctx;
- cc_uint32 lock_type;
-};
-typedef struct ccmsg_ctx_lock_t ccmsg_ctx_lock_t;
-
-struct ccmsg_ctx_unlock_t {
- cc_handle ctx;
-};
-typedef struct ccmsg_ctx_unlock_t ccmsg_ctx_unlock_t;
-
-struct ccmsg_ccache_open_t {
- cc_handle ctx;
- cc_uint32 name_offset;
- cc_uint32 name_len;
-};
-struct ccmsg_ccache_open_resp_t {
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_open_t ccmsg_ccache_open_t;
-typedef struct ccmsg_ccache_open_resp_t ccmsg_ccache_open_resp_t;
-
-struct ccmsg_ccache_open_default_t {
- cc_handle ctx;
-};
-typedef struct ccmsg_ccache_open_default_t ccmsg_ccache_open_default_t;
-
-struct ccmsg_ccache_create_t {
- cc_handle ctx;
- cc_uint32 version;
- cc_uint32 principal_offset;
- cc_uint32 principal_len;
- cc_uint32 name_offset;
- cc_uint32 name_len;
-};
-struct ccmsg_ccache_create_default_t {
- cc_handle ctx;
- cc_uint32 version;
- cc_uint32 principal_offset;
- cc_uint32 principal_len;
-};
-struct ccmsg_ccache_create_unique_t {
- cc_handle ctx;
- cc_uint32 version;
- cc_uint32 principal_offset;
- cc_uint32 principal_len;
-};
-
-struct ccmsg_ccache_create_resp_t {
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_create_t ccmsg_ccache_create_t;
-typedef struct ccmsg_ccache_create_default_t ccmsg_ccache_create_default_t;
-typedef struct ccmsg_ccache_create_unique_t ccmsg_ccache_create_unique_t;
-typedef struct ccmsg_ccache_create_resp_t ccmsg_ccache_create_resp_t;
-
-struct ccmsg_ccache_release_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_release_t ccmsg_ccache_release_t;
-
-struct ccmsg_ccache_destroy_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_destroy_t ccmsg_ccache_destroy_t;
-
-struct ccmsg_ccache_set_default_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_set_default_t ccmsg_ccache_set_default_t;
-
-struct ccmsg_ccache_get_creds_version_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-struct ccmsg_ccache_get_creds_version_resp_t {
- cc_uint32 version;
-};
-typedef struct ccmsg_ccache_get_creds_version_t ccmsg_ccache_get_creds_version_t;
-typedef struct ccmsg_ccache_get_creds_version_resp_t ccmsg_ccache_get_creds_version_resp_t;
-
-struct ccmsg_ccache_get_name_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-struct ccmsg_ccache_get_name_resp_t {
- cc_uint32 name_offset;
- cc_uint32 name_len;
-};
-typedef struct ccmsg_ccache_get_name_t ccmsg_ccache_get_name_t;
-typedef struct ccmsg_ccache_get_name_resp_t ccmsg_ccache_get_name_resp_t;
-
-struct ccmsg_ccache_get_principal_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_uint32 version;
-};
-struct ccmsg_ccache_get_principal_resp_t {
- cc_uint32 principal_offset;
- cc_uint32 principal_len;
-};
-typedef struct ccmsg_ccache_get_principal_t ccmsg_ccache_get_principal_t;
-typedef struct ccmsg_ccache_get_principal_resp_t ccmsg_ccache_get_principal_resp_t;
-
-struct ccmsg_ccache_set_principal_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_uint32 version;
- cc_uint32 principal_offset;
- cc_uint32 principal_len;
-};
-typedef struct ccmsg_ccache_set_principal_t ccmsg_ccache_set_principal_t;
-
-struct ccmsg_ccache_creds_iterator_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-struct ccmsg_ccache_creds_iterator_resp_t {
- cc_handle iterator;
-};
-typedef struct ccmsg_ccache_creds_iterator_t ccmsg_ccache_creds_iterator_t;
-typedef struct ccmsg_ccache_creds_iterator_resp_t ccmsg_ccache_creds_iterator_resp_t;
-
-struct ccmsg_ccache_store_creds_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_uint32 creds_version;
- cc_uint32 creds_offset;
- cc_uint32 creds_len;
-};
-typedef struct ccmsg_ccache_store_creds_t ccmsg_ccache_store_creds_t;
-
-struct ccmsg_ccache_rem_creds_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_handle creds;
-};
-typedef struct ccmsg_ccache_rem_creds_t ccmsg_ccache_rem_creds_t;
-
-struct ccmsg_ccache_lock_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_uint32 lock_type;
-};
-typedef struct ccmsg_ccache_lock_t ccmsg_ccache_lock_t;
-
-struct ccmsg_ccache_unlock_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-typedef struct ccmsg_ccache_unlock_t ccmsg_ccache_unlock_t;
-
-struct ccmsg_ccache_move_t {
- cc_handle ctx;
- cc_handle ccache_source;
- cc_handle ccache_dest;
-};
-typedef struct ccmsg_ccache_move_t ccmsg_ccache_move_t;
-
-struct ccmsg_ccache_get_last_default_time_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-struct ccmsg_ccache_get_last_default_time_resp_t {
- 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;
-
-struct ccmsg_ccache_get_change_time_t {
- cc_handle ctx;
- cc_handle ccache;
-};
-struct ccmsg_ccache_get_change_time_resp_t {
- 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;
-
-struct ccmsg_ccache_compare_t {
- cc_handle ctx;
- cc_handle ccache1;
- cc_handle ccache2;
-};
-struct ccmsg_ccache_compare_resp_t {
- cc_uint32 is_equal;
-};
-typedef struct ccmsg_ccache_compare_t ccmsg_ccache_compare_t;
-typedef struct ccmsg_ccache_compare_resp_t ccmsg_ccache_compare_resp_t;
-
-struct ccmsg_ccache_get_kdc_time_offset_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_int32 creds_version;
-};
-struct ccmsg_ccache_get_kdc_time_offset_resp_t {
- 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;
-
-struct ccmsg_ccache_set_kdc_time_offset_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_time64 offset;
- cc_int32 creds_version;
-};
-typedef struct ccmsg_ccache_set_kdc_time_offset_t ccmsg_ccache_set_kdc_time_offset_t;
-
-struct ccmsg_ccache_clear_kdc_time_offset_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_int32 creds_version;
-};
-typedef struct ccmsg_ccache_clear_kdc_time_offset_t ccmsg_ccache_clear_kdc_time_offset_t;
-
-struct ccmsg_ccache_iterator_release_t {
- cc_handle ctx;
- cc_handle iterator;
-};
-typedef struct ccmsg_ccache_iterator_release_t ccmsg_ccache_iterator_release_t;
-
-struct ccmsg_ccache_iterator_next_t {
- cc_handle ctx;
- cc_handle iterator;
-};
-struct ccmsg_ccache_iterator_next_resp_t {
- cc_handle ccache;
-};
-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;
- cc_handle iterator;
-};
-typedef struct ccmsg_creds_iterator_release_t ccmsg_creds_iterator_release_t;
-
-struct ccmsg_creds_iterator_next_t {
- cc_handle ctx;
- cc_handle ccache;
- cc_handle iterator;
-};
-struct ccmsg_creds_iterator_next_resp_t {
- cc_uint32 version;
- cc_handle creds_handle;
- cc_uint32 creds_offset;
- cc_uint32 creds_len;
-};
-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_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__*/
+++ /dev/null
-/* $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__*/
+++ /dev/null
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 42;
- objects = {
-
-/* Begin PBXBuildFile section */
- A1E70D480A38B5D5007BE3E3 /* cacheapi.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D000A38B5BB007BE3E3 /* cacheapi.c */; };
- A1E70D490A38B5D5007BE3E3 /* ccache.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D010A38B5BB007BE3E3 /* ccache.c */; };
- A1E70D4A0A38B5D5007BE3E3 /* ccache_iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */; };
- A1E70D4B0A38B5D5007BE3E3 /* ccapiv2.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */; };
- A1E70D4C0A38B5D5007BE3E3 /* ccstring.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D060A38B5BB007BE3E3 /* ccstring.c */; };
- A1E70D4D0A38B5D5007BE3E3 /* context.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D080A38B5BB007BE3E3 /* context.c */; };
- A1E70D4E0A38B5D5007BE3E3 /* credentials.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D0A0A38B5BB007BE3E3 /* credentials.c */; };
- A1E70D4F0A38B5D5007BE3E3 /* credentials_iterator.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */; };
- A1E70D510A38B60C007BE3E3 /* generic_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */; };
- A1E70D520A38B60C007BE3E3 /* marshall.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */; };
- A1E70D530A38B60C007BE3E3 /* msg.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D140A38B5BB007BE3E3 /* msg.c */; };
- A1E70D890A38BB47007BE3E3 /* ccs_ccache.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */; };
- A1E70D8A0A38BB47007BE3E3 /* ccs_context.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D290A38B5BB007BE3E3 /* ccs_context.c */; };
- A1E70D8B0A38BB47007BE3E3 /* ccs_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */; };
- A1E70D8C0A38BB47007BE3E3 /* rpc_auth.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */; };
- A1E70D8D0A38BB47007BE3E3 /* serv_ops.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */; };
- A1E70D8E0A38BB4F007BE3E3 /* generic_lists.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D120A38B5BB007BE3E3 /* generic_lists.c */; };
- A1E70D8F0A38BB4F007BE3E3 /* marshall.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D130A38B5BB007BE3E3 /* marshall.c */; };
- A1E70D900A38BB4F007BE3E3 /* msg.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D140A38B5BB007BE3E3 /* msg.c */; };
- A1E70D9B0A38BBE2007BE3E3 /* main.c in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D930A38BB67007BE3E3 /* main.c */; };
- A1E70D9F0A38BCAD007BE3E3 /* mig.defs in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */; };
- A1E70DA00A38BCAD007BE3E3 /* mig.defs in Sources */ = {isa = PBXBuildFile; fileRef = A1E70D9E0A38BCAD007BE3E3 /* mig.defs */; settings = {ATTRIBUTES = (Server, ); }; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- A1E70D000A38B5BB007BE3E3 /* cacheapi.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = cacheapi.c; sourceTree = "<group>"; };
- A1E70D010A38B5BB007BE3E3 /* ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccache.c; sourceTree = "<group>"; };
- A1E70D020A38B5BB007BE3E3 /* ccache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccache.h; sourceTree = "<group>"; };
- A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccache_iterator.c; sourceTree = "<group>"; };
- A1E70D040A38B5BB007BE3E3 /* ccache_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccache_iterator.h; sourceTree = "<group>"; };
- A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccapiv2.c; sourceTree = "<group>"; };
- A1E70D060A38B5BB007BE3E3 /* ccstring.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccstring.c; sourceTree = "<group>"; };
- A1E70D070A38B5BB007BE3E3 /* ccstring.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ccstring.h; sourceTree = "<group>"; };
- A1E70D080A38B5BB007BE3E3 /* context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = context.c; sourceTree = "<group>"; };
- A1E70D090A38B5BB007BE3E3 /* context.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = context.h; sourceTree = "<group>"; };
- A1E70D0A0A38B5BB007BE3E3 /* credentials.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = credentials.c; sourceTree = "<group>"; };
- A1E70D0B0A38B5BB007BE3E3 /* credentials.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = credentials.h; sourceTree = "<group>"; };
- A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = credentials_iterator.c; sourceTree = "<group>"; };
- A1E70D0D0A38B5BB007BE3E3 /* credentials_iterator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = credentials_iterator.h; sourceTree = "<group>"; };
- A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D120A38B5BB007BE3E3 /* generic_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = generic_lists.c; sourceTree = "<group>"; };
- A1E70D130A38B5BB007BE3E3 /* marshall.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = marshall.c; sourceTree = "<group>"; };
- A1E70D140A38B5BB007BE3E3 /* msg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = msg.c; sourceTree = "<group>"; };
- A1E70D150A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D170A38B5BB007BE3E3 /* implementation-notes.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = "implementation-notes.txt"; sourceTree = "<group>"; };
- A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = cc_rpc.h; sourceTree = "<group>"; };
- A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialsCache.h; sourceTree = "<group>"; };
- A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CredentialsCache2.h; sourceTree = "<group>"; };
- A1E70D1C0A38B5BB007BE3E3 /* datastore.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = datastore.h; sourceTree = "<group>"; };
- A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = generic_lists.h; sourceTree = "<group>"; };
- A1E70D1E0A38B5BB007BE3E3 /* marshall.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = marshall.h; sourceTree = "<group>"; };
- A1E70D1F0A38B5BB007BE3E3 /* msg.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msg.h; sourceTree = "<group>"; };
- A1E70D200A38B5BB007BE3E3 /* msg_headers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = msg_headers.h; sourceTree = "<group>"; };
- A1E70D210A38B5BB007BE3E3 /* rpc_auth.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = rpc_auth.h; sourceTree = "<group>"; };
- A1E70D260A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = NTMakefile; path = ../NTMakefile; sourceTree = SOURCE_ROOT; };
- A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_ccache.c; sourceTree = "<group>"; };
- A1E70D290A38B5BB007BE3E3 /* ccs_context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_context.c; sourceTree = "<group>"; };
- A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = ccs_lists.c; sourceTree = "<group>"; };
- A1E70D2C0A38B5BB007BE3E3 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
- A1E70D2D0A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = rpc_auth.c; sourceTree = "<group>"; };
- A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = serv_ops.c; sourceTree = "<group>"; };
- A1E70D300A38B5BB007BE3E3 /* serv_ops.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = serv_ops.h; sourceTree = "<group>"; };
- A1E70D330A38B5BB007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D340A38B5BB007BE3E3 /* t_ccache.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_ccache.c; sourceTree = "<group>"; };
- A1E70D350A38B5BB007BE3E3 /* t_context.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_context.c; sourceTree = "<group>"; };
- A1E70D360A38B5BB007BE3E3 /* t_lists.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_lists.c; sourceTree = "<group>"; };
- A1E70D370A38B5BB007BE3E3 /* t_msg.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_msg.c; sourceTree = "<group>"; };
- A1E70D380A38B5BB007BE3E3 /* t_server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = t_server.c; sourceTree = "<group>"; };
- A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cacheapi.def; sourceTree = "<group>"; };
- A1E70D3B0A38B5BB007BE3E3 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = "<group>"; };
- A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = dllmain.c; sourceTree = "<group>"; };
- A1E70D3D0A38B5BC007BE3E3 /* ntccrpc.acf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ntccrpc.acf; sourceTree = "<group>"; };
- A1E70D3E0A38B5BC007BE3E3 /* ntccrpc.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ntccrpc.idl; sourceTree = "<group>"; };
- A1E70D3F0A38B5BC007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D410A38B5BC007BE3E3 /* client.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = client.c; sourceTree = "<group>"; };
- A1E70D420A38B5BC007BE3E3 /* cstest.acf */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cstest.acf; sourceTree = "<group>"; };
- A1E70D430A38B5BC007BE3E3 /* cstest.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = cstest.idl; sourceTree = "<group>"; };
- A1E70D440A38B5BC007BE3E3 /* NTMakefile */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = NTMakefile; sourceTree = "<group>"; };
- A1E70D450A38B5BC007BE3E3 /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = "<group>"; };
- A1E70D460A38B5BC007BE3E3 /* server.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = server.c; sourceTree = "<group>"; };
- A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = CCacheServer.app; sourceTree = BUILT_PRODUCTS_DIR; };
- A1E70D910A38BB67007BE3E3 /* CCacheServer.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CCacheServer.plist; sourceTree = "<group>"; };
- A1E70D920A38BB67007BE3E3 /* CCacheServerInfo.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = CCacheServerInfo.plist; sourceTree = "<group>"; };
- A1E70D930A38BB67007BE3E3 /* main.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = main.c; sourceTree = "<group>"; };
- A1E70D9E0A38BCAD007BE3E3 /* mig.defs */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.mig; path = mig.defs; sourceTree = "<group>"; };
- A1E70DB10A38C01E007BE3E3 /* mig_types.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mig_types.h; sourceTree = "<group>"; };
- D2AAC046055464E500DB518D /* libCCAPI.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libCCAPI.a; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- A1E70D5B0A38B796007BE3E3 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D289987405E68DCB004EDB86 /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 08FB7794FE84155DC02AAC07 /* CCAPI */ = {
- isa = PBXGroup;
- children = (
- A1E70CFF0A38B5BB007BE3E3 /* client */,
- A1E70D110A38B5BB007BE3E3 /* common */,
- A1E70D160A38B5BB007BE3E3 /* doc */,
- A1E70D180A38B5BB007BE3E3 /* include */,
- A1E70D260A38B5BB007BE3E3 /* NTMakefile */,
- A1E70D270A38B5BB007BE3E3 /* server */,
- A1E70D320A38B5BB007BE3E3 /* unit-test */,
- A1E70D390A38B5BB007BE3E3 /* windows */,
- 1AB674ADFE9D54B511CA2CBB /* Products */,
- );
- name = CCAPI;
- sourceTree = "<group>";
- };
- 1AB674ADFE9D54B511CA2CBB /* Products */ = {
- isa = PBXGroup;
- children = (
- D2AAC046055464E500DB518D /* libCCAPI.a */,
- A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */,
- );
- name = Products;
- sourceTree = "<group>";
- };
- A1E70CFF0A38B5BB007BE3E3 /* client */ = {
- isa = PBXGroup;
- children = (
- A1E70D000A38B5BB007BE3E3 /* cacheapi.c */,
- A1E70D010A38B5BB007BE3E3 /* ccache.c */,
- A1E70D020A38B5BB007BE3E3 /* ccache.h */,
- A1E70D030A38B5BB007BE3E3 /* ccache_iterator.c */,
- A1E70D040A38B5BB007BE3E3 /* ccache_iterator.h */,
- A1E70D050A38B5BB007BE3E3 /* ccapiv2.c */,
- A1E70D060A38B5BB007BE3E3 /* ccstring.c */,
- A1E70D070A38B5BB007BE3E3 /* ccstring.h */,
- A1E70D080A38B5BB007BE3E3 /* context.c */,
- A1E70D090A38B5BB007BE3E3 /* context.h */,
- A1E70D0A0A38B5BB007BE3E3 /* credentials.c */,
- A1E70D0B0A38B5BB007BE3E3 /* credentials.h */,
- A1E70D0C0A38B5BB007BE3E3 /* credentials_iterator.c */,
- A1E70D0D0A38B5BB007BE3E3 /* credentials_iterator.h */,
- A1E70D0E0A38B5BB007BE3E3 /* mac */,
- A1E70D0F0A38B5BB007BE3E3 /* NTMakefile */,
- A1E70D100A38B5BB007BE3E3 /* windows */,
- );
- name = client;
- path = ../client;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D0E0A38B5BB007BE3E3 /* mac */ = {
- isa = PBXGroup;
- children = (
- );
- path = mac;
- sourceTree = "<group>";
- };
- A1E70D100A38B5BB007BE3E3 /* windows */ = {
- isa = PBXGroup;
- children = (
- );
- path = windows;
- sourceTree = "<group>";
- };
- A1E70D110A38B5BB007BE3E3 /* common */ = {
- isa = PBXGroup;
- children = (
- A1E70D7E0A38BAC5007BE3E3 /* mac */,
- A1E70D120A38B5BB007BE3E3 /* generic_lists.c */,
- A1E70D130A38B5BB007BE3E3 /* marshall.c */,
- A1E70D140A38B5BB007BE3E3 /* msg.c */,
- A1E70D150A38B5BB007BE3E3 /* NTMakefile */,
- );
- name = common;
- path = ../common;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D160A38B5BB007BE3E3 /* doc */ = {
- isa = PBXGroup;
- children = (
- A1E70D170A38B5BB007BE3E3 /* implementation-notes.txt */,
- );
- name = doc;
- path = ../doc;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D180A38B5BB007BE3E3 /* include */ = {
- isa = PBXGroup;
- children = (
- A1E70D190A38B5BB007BE3E3 /* cc_rpc.h */,
- A1E70D1A0A38B5BB007BE3E3 /* CredentialsCache.h */,
- A1E70D1B0A38B5BB007BE3E3 /* CredentialsCache2.h */,
- A1E70D1C0A38B5BB007BE3E3 /* datastore.h */,
- A1E70D1D0A38B5BB007BE3E3 /* generic_lists.h */,
- A1E70D1E0A38B5BB007BE3E3 /* marshall.h */,
- A1E70D1F0A38B5BB007BE3E3 /* msg.h */,
- A1E70D200A38B5BB007BE3E3 /* msg_headers.h */,
- A1E70D210A38B5BB007BE3E3 /* rpc_auth.h */,
- );
- name = include;
- path = ../include;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D270A38B5BB007BE3E3 /* server */ = {
- isa = PBXGroup;
- children = (
- A1E70D280A38B5BB007BE3E3 /* ccs_ccache.c */,
- A1E70D290A38B5BB007BE3E3 /* ccs_context.c */,
- A1E70D2A0A38B5BB007BE3E3 /* ccs_lists.c */,
- A1E70D2B0A38B5BB007BE3E3 /* mac */,
- A1E70D2C0A38B5BB007BE3E3 /* main.c */,
- A1E70D2D0A38B5BB007BE3E3 /* NTMakefile */,
- A1E70D2E0A38B5BB007BE3E3 /* rpc_auth.c */,
- A1E70D2F0A38B5BB007BE3E3 /* serv_ops.c */,
- A1E70D300A38B5BB007BE3E3 /* serv_ops.h */,
- A1E70D310A38B5BB007BE3E3 /* windows */,
- );
- name = server;
- path = ../server;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D2B0A38B5BB007BE3E3 /* mac */ = {
- isa = PBXGroup;
- children = (
- A1E70D910A38BB67007BE3E3 /* CCacheServer.plist */,
- A1E70D920A38BB67007BE3E3 /* CCacheServerInfo.plist */,
- A1E70D930A38BB67007BE3E3 /* main.c */,
- );
- path = mac;
- sourceTree = "<group>";
- };
- A1E70D310A38B5BB007BE3E3 /* windows */ = {
- isa = PBXGroup;
- children = (
- );
- path = windows;
- sourceTree = "<group>";
- };
- A1E70D320A38B5BB007BE3E3 /* unit-test */ = {
- isa = PBXGroup;
- children = (
- A1E70D330A38B5BB007BE3E3 /* NTMakefile */,
- A1E70D340A38B5BB007BE3E3 /* t_ccache.c */,
- A1E70D350A38B5BB007BE3E3 /* t_context.c */,
- A1E70D360A38B5BB007BE3E3 /* t_lists.c */,
- A1E70D370A38B5BB007BE3E3 /* t_msg.c */,
- A1E70D380A38B5BB007BE3E3 /* t_server.c */,
- );
- name = "unit-test";
- path = "../unit-test";
- sourceTree = SOURCE_ROOT;
- };
- A1E70D390A38B5BB007BE3E3 /* windows */ = {
- isa = PBXGroup;
- children = (
- A1E70D3A0A38B5BB007BE3E3 /* cacheapi.def */,
- A1E70D3B0A38B5BB007BE3E3 /* client.c */,
- A1E70D3C0A38B5BB007BE3E3 /* dllmain.c */,
- A1E70D3D0A38B5BC007BE3E3 /* ntccrpc.acf */,
- A1E70D3E0A38B5BC007BE3E3 /* ntccrpc.idl */,
- A1E70D3F0A38B5BC007BE3E3 /* NTMakefile */,
- A1E70D400A38B5BC007BE3E3 /* rpcsstest */,
- A1E70D460A38B5BC007BE3E3 /* server.c */,
- );
- name = windows;
- path = ../windows;
- sourceTree = SOURCE_ROOT;
- };
- A1E70D400A38B5BC007BE3E3 /* rpcsstest */ = {
- isa = PBXGroup;
- children = (
- A1E70D410A38B5BC007BE3E3 /* client.c */,
- A1E70D420A38B5BC007BE3E3 /* cstest.acf */,
- A1E70D430A38B5BC007BE3E3 /* cstest.idl */,
- A1E70D440A38B5BC007BE3E3 /* NTMakefile */,
- A1E70D450A38B5BC007BE3E3 /* server.c */,
- );
- path = rpcsstest;
- sourceTree = "<group>";
- };
- A1E70D7E0A38BAC5007BE3E3 /* mac */ = {
- isa = PBXGroup;
- children = (
- A1E70D9E0A38BCAD007BE3E3 /* mig.defs */,
- A1E70DB10A38C01E007BE3E3 /* mig_types.h */,
- );
- path = mac;
- sourceTree = "<group>";
- };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- D2AAC043055464E500DB518D /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
- A1E70D5C0A38B796007BE3E3 /* CCacheServer */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = A1E70D600A38B797007BE3E3 /* Build configuration list for PBXNativeTarget "CCacheServer" */;
- buildPhases = (
- A1E70D590A38B796007BE3E3 /* Resources */,
- A1E70D5A0A38B796007BE3E3 /* Sources */,
- A1E70D5B0A38B796007BE3E3 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = CCacheServer;
- productName = CCacheServer;
- productReference = A1E70D5D0A38B796007BE3E3 /* CCacheServer.app */;
- productType = "com.apple.product-type.application";
- };
- D2AAC045055464E500DB518D /* CCAPI */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "CCAPI" */;
- buildPhases = (
- D2AAC043055464E500DB518D /* Headers */,
- D2AAC044055464E500DB518D /* Sources */,
- D289987405E68DCB004EDB86 /* Frameworks */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = CCAPI;
- productName = CCAPI;
- productReference = D2AAC046055464E500DB518D /* libCCAPI.a */;
- productType = "com.apple.product-type.library.static";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 08FB7793FE84155DC02AAC07 /* Project object */ = {
- isa = PBXProject;
- buildConfigurationList = 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "CCAPI" */;
- hasScannedForEncodings = 1;
- mainGroup = 08FB7794FE84155DC02AAC07 /* CCAPI */;
- projectDirPath = "";
- targets = (
- D2AAC045055464E500DB518D /* CCAPI */,
- A1E70D5C0A38B796007BE3E3 /* CCacheServer */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXResourcesBuildPhase section */
- A1E70D590A38B796007BE3E3 /* Resources */ = {
- isa = PBXResourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXResourcesBuildPhase section */
-
-/* Begin PBXSourcesBuildPhase section */
- A1E70D5A0A38B796007BE3E3 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- A1E70DA00A38BCAD007BE3E3 /* mig.defs in Sources */,
- A1E70D9B0A38BBE2007BE3E3 /* main.c in Sources */,
- A1E70D890A38BB47007BE3E3 /* ccs_ccache.c in Sources */,
- A1E70D8A0A38BB47007BE3E3 /* ccs_context.c in Sources */,
- A1E70D8B0A38BB47007BE3E3 /* ccs_lists.c in Sources */,
- A1E70D8C0A38BB47007BE3E3 /* rpc_auth.c in Sources */,
- A1E70D8D0A38BB47007BE3E3 /* serv_ops.c in Sources */,
- A1E70D8E0A38BB4F007BE3E3 /* generic_lists.c in Sources */,
- A1E70D8F0A38BB4F007BE3E3 /* marshall.c in Sources */,
- A1E70D900A38BB4F007BE3E3 /* msg.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
- D2AAC044055464E500DB518D /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- A1E70D9F0A38BCAD007BE3E3 /* mig.defs in Sources */,
- A1E70D480A38B5D5007BE3E3 /* cacheapi.c in Sources */,
- A1E70D490A38B5D5007BE3E3 /* ccache.c in Sources */,
- A1E70D4A0A38B5D5007BE3E3 /* ccache_iterator.c in Sources */,
- A1E70D4B0A38B5D5007BE3E3 /* ccapiv2.c in Sources */,
- A1E70D4C0A38B5D5007BE3E3 /* ccstring.c in Sources */,
- A1E70D4D0A38B5D5007BE3E3 /* context.c in Sources */,
- A1E70D4E0A38B5D5007BE3E3 /* credentials.c in Sources */,
- A1E70D4F0A38B5D5007BE3E3 /* credentials_iterator.c in Sources */,
- A1E70D510A38B60C007BE3E3 /* generic_lists.c in Sources */,
- A1E70D520A38B60C007BE3E3 /* marshall.c in Sources */,
- A1E70D530A38B60C007BE3E3 /* msg.c in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 1DEB91EC08733DB70010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- GCC_DYNAMIC_NO_PIC = NO;
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- ../client,
- ../client/mac,
- ../common,
- ../common/mac,
- ../common/mac/KerberosIPC,
- );
- PRODUCT_NAME = CCAPI;
- };
- name = Debug;
- };
- 1DEB91ED08733DB70010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- ../client,
- ../client/mac,
- ../common,
- ../common/mac,
- ../common/mac/KerberosIPC,
- );
- PRODUCT_NAME = CCAPI;
- };
- name = Release;
- };
- 1DEB91F008733DB70010E9CD /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = (
- i386,
- ppc,
- );
- COPY_PHASE_STRIP = NO;
- GCC_ENABLE_FIX_AND_CONTINUE = YES;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- PREBINDING = NO;
- ZERO_LINK = YES;
- };
- name = Debug;
- };
- 1DEB91F108733DB70010E9CD /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ARCHS = "$(NATIVE_ARCH)";
- COPY_PHASE_STRIP = YES;
- GCC_ENABLE_FIX_AND_CONTINUE = NO;
- GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
- GCC_OPTIMIZATION_LEVEL = 3;
- PREBINDING = NO;
- ZERO_LINK = NO;
- };
- name = Release;
- };
- A1E70D610A38B797007BE3E3 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- ../server,
- ../server/mac,
- ../common,
- ../common/mac,
- ../common/mac/KerberosIPC,
- );
- INFOPLIST_FILE = ../server/mac/CCacheServerInfo.plist;
- INSTALL_PATH = /System/Library/CoreServices;
- PRODUCT_NAME = CCacheServer;
- WRAPPER_EXTENSION = app;
- };
- name = Debug;
- };
- A1E70D620A38B797007BE3E3 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- HEADER_SEARCH_PATHS = (
- "$(inherited)",
- ../server,
- ../server/mac,
- ../common,
- ../common/mac,
- ../common/mac/KerberosIPC,
- );
- INFOPLIST_FILE = ../server/mac/CCacheServerInfo.plist;
- INSTALL_PATH = /System/Library/CoreServices;
- PRODUCT_NAME = CCacheServer;
- WRAPPER_EXTENSION = app;
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 1DEB91EB08733DB70010E9CD /* Build configuration list for PBXNativeTarget "CCAPI" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB91EC08733DB70010E9CD /* Debug */,
- 1DEB91ED08733DB70010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- 1DEB91EF08733DB70010E9CD /* Build configuration list for PBXProject "CCAPI" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 1DEB91F008733DB70010E9CD /* Debug */,
- 1DEB91F108733DB70010E9CD /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
- A1E70D600A38B797007BE3E3 /* Build configuration list for PBXNativeTarget "CCacheServer" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- A1E70D610A38B797007BE3E3 /* Debug */,
- A1E70D620A38B797007BE3E3 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
-}
+++ /dev/null
-# Makefile for the CCAPI Server Library
-
-!INCLUDE <WIN32.MAK>
-
-CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)
-
-CC_SERVER_OBJS = ccs_context.obj ccs_ccache.obj ccs_lists.obj rpc_auth.obj serv_ops.obj
-
-CC_SERVER_LIB = cc_server.lib
-
-CC_COMMON_LIB = ../common/cc_common.lib
-
-$(CC_SERVER_LIB): $(CC_SERVER_OBJS)
- $(implib) /NOLOGO /OUT:$@ $**
-
-all: $(CC_SERVER_LIB)
-
-clean:
- del *.obj *.lib
-
-
\ No newline at end of file
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-\r
-/*\r
- * Manages ccache objects.\r
- *\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <string.h>\r
-#include <time.h>\r
-#include "CredentialsCache.h"\r
-#include "datastore.h"\r
-\r
-/**\r
- * ccache_new()\r
- * \r
- * Purpose: Allocate and initialize new credentials cache for the specified principal\r
- * and version\r
- * \r
- * Return: ccNoError - success\r
- * ccErrInvalidString - name or principal is NULL\r
- * ccErrBadCredentialsVersion - unsupported creds type\r
- * ccErrBadParam - outCcachepp is NULL\r
- * ccErrNoMem - malloc failed\r
- */\r
-cc_int32\r
-ccs_ccache_new( char *name, char *principal, int cred_vers, \r
- cc_server_ccache_t** outCCachepp)\r
-{\r
- cc_server_ccache_t* ccache;\r
-\r
- if (name == NULL || principal == NULL)\r
- return ccErrInvalidString;\r
-\r
- if (cred_vers != cc_credentials_v4 && cred_vers != cc_credentials_v5 && \r
- cred_vers != cc_credentials_v4_v5)\r
- return ccErrBadCredentialsVersion;\r
-\r
- if (outCCachepp == NULL)\r
- return ccErrBadParam;\r
-\r
- ccache = (cc_server_ccache_t*)malloc(sizeof(cc_server_ccache_t));\r
- if (ccache == NULL)\r
- return ccErrNoMem;\r
-\r
- ccache->name = name;\r
- ccache->principal_v4 = NULL;\r
- ccache->principal_v5 = NULL;\r
- ccache->changed = time(NULL);\r
- ccache->kdc_offset = 0;\r
- ccache->last_default = 0;\r
- cci_generic_list_new(&ccache->active_iterators);\r
- ccs_credentials_list_new(&ccache->creds);\r
- ccache->is_default = 0;\r
- ccache->kdc_set = 0;\r
- ccache->versions = cred_vers;\r
- ccache->mycontext = NULL;\r
-\r
- ccs_ccache_set_principal(ccache, cred_vers, principal);\r
- *outCCachepp = ccache;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_check_version()\r
- * \r
- * Purpose: Check to see if the ccache and the creds have compatible versions. \r
- * \r
- * Return: ccNoError and compat = 1 if they are compatible \r
- * ccNoError and compat = 0 if they are not compatible\r
- * \r
- * Errors: ccErrInvalidCCache - ccache is NULL\r
- * ccErrBadParam - either creds or compat are NULL\r
- */\r
-cc_int32 \r
-ccs_ccache_check_version( const cc_server_ccache_t *ccache,\r
- const cc_credentials_union* creds,\r
- cc_uint32* compat)\r
-{\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- if (creds == NULL || compat == NULL)\r
- return ccErrBadParam;\r
-\r
- if (ccache->versions == cc_credentials_v4_v5)\r
- *compat = 1;\r
- else if (ccache->versions == creds->version)\r
- *compat = 1;\r
- else\r
- *compat = 0;\r
-\r
- return ccNoError;\r
-}\r
-\r
-/** \r
-ccs_ccache_check_principal()\r
-\r
-Check to see if the client principal from the credentials matches\r
-the principal associated with the cache.\r
-\r
-* Return: ccNoError and compat = 1 if they are compatible \r
-* ccNoError and compat = 0 if they are not compatible\r
-* \r
-* Errors: ccErrInvalidCCache - ccache is NULL\r
-* ccErrBadParam - either creds or compat are NULL\r
-* ccErrBadCredentialVersion - unsupported credential type\r
-*/\r
-cc_int32 \r
-ccs_ccache_check_principal( const cc_server_ccache_t *ccache,\r
- const cc_credentials_union* creds,\r
- cc_uint32* compat)\r
-{\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- if (creds == NULL || compat == NULL)\r
- return ccErrBadParam;\r
-\r
- if (creds->version == cc_credentials_v4) {\r
- if (strcmp(creds->credentials.credentials_v4->principal, ccache->principal_v4) == 0) \r
- *compat = 1;\r
- else \r
- *compat = 0;\r
- } else if (creds->version == cc_credentials_v5) {\r
- if (strcmp(creds->credentials.credentials_v5->client, ccache->principal_v5) == 0)\r
- *compat = 1;\r
- else \r
- *compat = 0;\r
- } else { \r
- return ccErrBadCredentialsVersion;\r
- }\r
- return ccNoError;\r
-}\r
-\r
-\r
-/** \r
- * ccs_ccache_store_creds()\r
- *\r
- * Purpose: Stores the provided credentials into the provided cache. Validates the\r
- * ability of the cache to store credentials of the given version and client\r
- * principal.\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccErrNoMem\r
- * ccErrBadCredentialsVersion\r
- * ccErrBadInvalidCredentials\r
- * ccErrInvalidCache\r
- * ccErrBadParam\r
- */\r
-cc_int32 \r
-ccs_ccache_store_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) \r
-{\r
- cc_server_credentials_t* stored_cred=NULL;\r
- cc_uint32 valid_version, valid_principal;\r
- cc_int32 code;\r
-\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
- \r
- if (credentials == NULL)\r
- return ccErrBadParam;\r
-\r
- code = ccs_ccache_check_version(ccache, credentials, &valid_version);\r
- if (code != ccNoError) {\r
- /* pass error on to caller */\r
- goto bad;\r
- }\r
- code = ccs_ccache_check_principal(ccache, credentials, &valid_principal);\r
- if (code != ccNoError) {\r
- /* pass error on to caller */\r
- goto bad;\r
- }\r
- if (valid_version && valid_principal) {\r
- stored_cred = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));\r
- if (stored_cred == NULL) {\r
- code = ccErrNoMem;\r
- goto bad;\r
- }\r
- memcpy(&stored_cred->creds, credentials, sizeof(cc_credentials_union));\r
-\r
- if (credentials->version == cc_credentials_v4) {\r
- stored_cred->creds.credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));\r
- if (stored_cred->creds.credentials.credentials_v4 == NULL) {\r
- code = ccErrNoMem;\r
- goto bad;\r
- }\r
-\r
- memcpy(stored_cred->creds.credentials.credentials_v4, credentials->credentials.credentials_v4, sizeof(cc_credentials_v4_t));\r
- } else if (credentials->version == cc_credentials_v5) {\r
- stored_cred->creds.credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));\r
- if (stored_cred->creds.credentials.credentials_v5 == NULL) {\r
- code = ccErrNoMem;\r
- goto bad;\r
- }\r
-\r
- memcpy(stored_cred->creds.credentials.credentials_v5, credentials->credentials.credentials_v5, sizeof(cc_credentials_v5_t));\r
- } else {\r
- code = ccErrBadCredentialsVersion;\r
- goto bad;\r
- }\r
-\r
- code = ccs_credentials_list_append(ccache->creds, stored_cred, NULL);\r
- if ( code != ccNoError ) {\r
- /* pass error on to caller */\r
- goto bad;\r
- }\r
- if (ccache->creds->head->data == (cc_uint8 *)stored_cred) \r
- stored_cred->is_default = 1; /*we're first on the list, so we're default*/\r
-\r
- ccs_ccache_changed(ccache);\r
- return ccNoError;\r
- } else {\r
-#ifdef DEBUG\r
- printf("vers: %d\tprincipal: %d\n",\r
- valid_version, valid_principal);\r
-#endif /* DEBUG */\r
- code = ccErrInvalidCredentials;\r
- goto bad;\r
- }\r
-\r
- bad:\r
- if (stored_cred)\r
- free(stored_cred);\r
- return code; /* error */\r
-}\r
-\r
-/**\r
- * ccs_ccache_changed()\r
- *\r
- * Purpose: Updates the last update time for the ccache and its associated context.\r
- * Provides a location from which interested parties should be notified\r
- * of cache updates.\r
- *\r
- * Return: none\r
- *\r
- * Errors: none\r
- */\r
-void \r
-ccs_ccache_changed(cc_server_ccache_t* ccache) \r
-{\r
- ccache->changed = time(NULL);\r
- if (ccache->mycontext != NULL)\r
- ccache->mycontext->changed = time(NULL);\r
-\r
- /* XXX - notify registered listeners when implemented */\r
-}\r
-\r
-/**\r
- * ccs_ccache_rem_creds()\r
- *\r
- * Purpose: Removes the specified credential object from the specified cache if\r
- * it exists\r
- *\r
- * Return: 0 on success (credential is not in the cache)\r
- * -1 on error\r
- *\r
- * Errors: ccErrBadParam, ccErrNoMem (from cc_credentials_list_iterator)\r
- *\r
- * Verify: does the memory associated with stored_cred->creds need to be freed?\r
- *\r
- */\r
-cc_int32 \r
-ccs_ccache_rem_creds(cc_server_ccache_t *ccache, const cc_credentials_union* credentials) \r
-{\r
- cc_credentials_iterate_t* credentials_iterator=NULL, *active;\r
- cc_generic_iterate_t* generic_iterator=NULL;\r
- cc_credentials_list_node_t* credentials_node;\r
- cc_generic_list_node_t* generic_node;\r
- cc_server_credentials_t* stored_cred;\r
- cc_int8 changed = 0;\r
- cc_int32 code = 0;\r
-\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- if (credentials == NULL)\r
- return ccErrBadParam;\r
-\r
- code = ccs_credentials_list_iterator(ccache->creds, &credentials_iterator);\r
- if (code != ccNoError) {\r
- /* pass error to caller */\r
- goto cleanup;\r
- }\r
-\r
- while (ccs_credentials_iterate_has_next(credentials_iterator)) {\r
- code = ccs_credentials_iterate_next(credentials_iterator, &credentials_node);\r
- stored_cred = (cc_server_credentials_t*)credentials_node->data;\r
- if (memcmp(&stored_cred->creds,credentials,sizeof(cc_credentials_union)) == 0) {\r
- /* XXX - do we need to free(stored_cred->creds) ? */\r
- free(credentials_node->data);\r
- changed = 1;\r
- \r
- /*If any iterator's next points to the deleted node, make it point to the next node*/\r
- code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);\r
- while (cci_generic_iterate_has_next(generic_iterator)) {\r
- code = cci_generic_iterate_next(generic_iterator, &generic_node); \r
- active = (cc_credentials_iterate_t*)generic_node->data;\r
- if (active->next == credentials_node) \r
- active->next = active->next->next;\r
- }\r
- code = cci_generic_free_iterator(generic_iterator);\r
- generic_iterator = NULL;\r
-\r
- if (credentials_node == ccache->creds->head) { /*removing the default, must make next cred default*/\r
- code = ccs_credentials_list_remove_element(ccache->creds, credentials_node);\r
-\r
- if (ccache->creds->head != NULL)\r
- ((cc_server_credentials_t*)ccache->creds->head->data)->is_default = 1;\r
- } else {\r
- code = ccs_credentials_list_remove_element(ccache->creds, credentials_node);\r
- }\r
- break;\r
- }\r
- }\r
-\r
- cleanup:\r
- if (changed)\r
- ccs_ccache_changed(ccache);\r
- if (credentials_iterator)\r
- ccs_credentials_free_iterator(credentials_iterator);\r
- if (generic_iterator)\r
- cci_generic_free_iterator(generic_iterator);\r
- return code;\r
-}\r
-\r
-/**\r
- * ccs_ccache_move()\r
- * \r
- * Purpose: Destroys the existing contents of the destination and copies\r
- * all credentials from the source to the destination\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccBadNoMem\r
- *\r
- */\r
-\r
-cc_int32 \r
-ccs_ccache_move(cc_server_ccache_t *source, cc_server_ccache_t* destination) \r
-{\r
- cc_generic_list_node_t* node;\r
- cc_generic_iterate_t* iterator;\r
- cc_credentials_iterate_t* cur;\r
- cc_int32 code;\r
-\r
- if (source == NULL || destination == NULL)\r
- return ccErrBadParam;\r
- \r
- code = ccs_credentials_list_destroy(destination->creds);\r
- if ( code != ccNoError )\r
- return code;\r
-\r
- code = ccs_credentials_list_copy(source->creds, &destination->creds);\r
- if ( code != ccNoError ) \r
- return code;\r
-\r
- destination->versions = source->versions;\r
- destination->kdc_offset = source->kdc_offset;\r
- destination->last_default = 0;\r
-\r
- /*reset all active iterators to point to the head of the new creds list*/\r
- if (destination->active_iterators->head != NULL) {\r
- code = cci_generic_list_iterator(destination->active_iterators, &iterator);\r
- while (cci_generic_iterate_has_next(iterator)) {\r
- code = cci_generic_iterate_next(iterator, &node);\r
- cur = (cc_credentials_iterate_t*)node->data;\r
- cur->next = destination->creds->head;\r
- }\r
- code = cci_generic_free_iterator(iterator);\r
- }\r
-\r
- ccs_ccache_changed(destination);\r
- return code;\r
-}\r
-\r
-/**\r
- * ccs_ccache_get_kdc_time_offset()\r
- * \r
- * Purpose: Retrieves the kdc_time_offset from the ccache if set\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccErrBadParam, ccErrTimeOffsetNotSet\r
- *\r
- */\r
-cc_int32 \r
-ccs_ccache_get_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64* offset) \r
-{\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
- \r
- if (offset == NULL)\r
- return ccErrBadParam;\r
-\r
- if (!ccache->kdc_set)\r
- return ccErrTimeOffsetNotSet;\r
-\r
- *offset = ccache->kdc_offset;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_set_kdc_time_offset()\r
- *\r
- * Purpose: Sets the kdc time offset in the designated ccache\r
- * \r
- * Return: 0 on success\r
- * -1 on error\r
- * \r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-ccs_ccache_set_kdc_time_offset(cc_server_ccache_t* ccache, cc_time64 offset) \r
-{\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- ccache->kdc_offset = offset;\r
- ccache->kdc_set = 1;\r
- ccs_ccache_changed(ccache);\r
-\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_clear_kdc_time_offset()\r
- *\r
- * Purpose: Clear the kdc time offset in the designated ccache\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32 \r
-ccs_ccache_clear_kdc_time_offset(cc_server_ccache_t* ccache) \r
-{\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- ccache->kdc_offset = 0;\r
- ccache->kdc_set = 0;\r
- ccs_ccache_changed(ccache);\r
-\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_new_iterator()\r
- *\r
- * Purpose: Retrieve an iterator for the designated cache\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccErrBadParam, ccBadNoMem\r
- */\r
-cc_int32 \r
-ccs_ccache_new_iterator(cc_server_ccache_t* ccache, cc_credentials_iterate_t** iterator)\r
-{\r
- cc_int32 code;\r
-\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
-\r
- if (iterator == NULL)\r
- return ccErrBadParam;\r
-\r
- code = ccs_credentials_list_iterator(ccache->creds, iterator);\r
- if (code != ccNoError)\r
- return code;\r
-\r
- code = cci_generic_list_prepend(ccache->active_iterators, *iterator, sizeof(cc_credentials_iterate_t), NULL);\r
- if (code != ccNoError)\r
- return code;\r
-\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_get_principal()\r
- * \r
- * Purpose: Retrieves the client principal associated with the designated cache.\r
- * The value is returned \r
- * Return:\r
- *\r
- * Errors:\r
- */\r
-cc_int32 \r
-ccs_ccache_get_principal(cc_server_ccache_t* ccache, cc_int32 version, char ** principal) \r
-{\r
- char *p = NULL;\r
- \r
- switch ( version ) {\r
- case cc_credentials_v4:\r
- p = ccache->principal_v4;\r
- break;\r
- case cc_credentials_v5:\r
- p = ccache->principal_v5;\r
- break;\r
- default:\r
- return ccErrBadCredentialsVersion;\r
- }\r
-\r
- *principal = (char *)malloc(strlen(p)+1);\r
- if ( *principal == NULL )\r
- return ccErrNoMem;\r
-\r
- strcpy(*principal, p);\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * Purpose: Releases the memory associated with a ccache principal\r
- * \r
- * Return:\r
- *\r
- * Errors:\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_free_principal(char * principal)\r
-{\r
- if ( principal == NULL )\r
- return ccErrBadParam;\r
-\r
- free(principal);\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccache_set_principal()\r
- *\r
- * Purpose: Assigns a principal to the designated ccache and credential version.\r
- * If the api version is 2, the cache is cleared of all existing\r
- * credentials.\r
- *\r
- * Return: 0 on success\r
- * -1 on error\r
- *\r
- * Errors: ccErrNoMem, ccErrBadCredentialsVersion\r
- */\r
-cc_int32 \r
-ccs_ccache_set_principal( cc_server_ccache_t* ccache, cc_int32 cred_version, \r
- char* principal)\r
-{\r
- cc_generic_iterate_t* generic_iterator;\r
- cc_generic_list_node_t* generic_node;\r
- cc_ccache_iterate_t* ccache_iterator;\r
- cc_int32 code = ccNoError;\r
-\r
- if (ccache == NULL)\r
- return ccErrInvalidCCache;\r
- \r
- if (principal == NULL)\r
- return ccErrInvalidString;\r
-\r
- switch (cred_version) {\r
- case cc_credentials_v4:\r
- case cc_credentials_v4_v5:\r
- ccache->principal_v4 = (char *)malloc(strlen(principal) + 1);\r
- if (ccache->principal_v4 == NULL)\r
- return ccErrNoMem;\r
- strcpy(ccache->principal_v4, principal);\r
- if (cred_version != cc_credentials_v4_v5)\r
- break;\r
- /* fall-through if we are v4_v5 */\r
- case cc_credentials_v5:\r
- ccache->principal_v5 = (char *)malloc(strlen(principal) + 1);\r
- if (ccache->principal_v5 == NULL) {\r
- if (cred_version == cc_credentials_v4_v5) {\r
- free(ccache->principal_v4);\r
- ccache->principal_v4 = NULL;\r
- }\r
- return ccErrNoMem;\r
- }\r
- strcpy(ccache->principal_v5, principal);\r
- break;\r
- default:\r
- return ccErrBadCredentialsVersion;\r
- }\r
-\r
- /*For API version 2 clients set_principal implies a flush of all creds*/\r
- if (ccache->mycontext != NULL && ccache->mycontext->api_version == ccapi_version_2) {\r
- ccs_credentials_list_destroy(ccache->creds);\r
- ccs_credentials_list_new(&ccache->creds);\r
-\r
- /*clean up active_iterators*/\r
- code = cci_generic_list_iterator(ccache->active_iterators, &generic_iterator);\r
- if (code == ccNoError) {\r
- while (cci_generic_iterate_has_next(generic_iterator)) {\r
- code = cci_generic_iterate_next(generic_iterator, &generic_node);\r
- ccache_iterator = (cc_ccache_iterate_t*)generic_node->data;\r
- ccache_iterator->next = NULL;\r
- }\r
- }\r
- }\r
-\r
- ccs_ccache_changed(ccache);\r
-\r
- return code;\r
-}\r
-\r
-/**\r
- * ccs_ccache_destroy()\r
- *\r
- * Purpose: Destroys an existing ccache \r
- *\r
- * Return: 0 on success\r
- * -1 on errors\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32 \r
-ccs_ccache_destroy(cc_server_ccache_t* ccache) \r
-{\r
- cc_int32 code;\r
-\r
- if ( ccache == NULL )\r
- return ccErrInvalidCCache;\r
-\r
- code = cci_generic_list_destroy(ccache->active_iterators);\r
- code = ccs_credentials_list_destroy(ccache->creds);\r
-\r
- if (ccache->mycontext != NULL)\r
- code = ccs_context_rem_ccache(ccache->mycontext, ccache);\r
-\r
- return code;\r
-}\r
-\r
-/**\r
- * ccs_ccache_compare()\r
- *\r
- * Purpose: Returns a boolean value indicating if two caches are identical\r
- * Implemented as pointer equivalence.\r
- *\r
- * Return: 1 if TRUE\r
- * 0 if FALSE\r
- *\r
- * Errors: No errors\r
- */\r
-cc_int32 \r
-ccs_ccache_compare(cc_server_ccache_t* ccache1, cc_server_ccache_t* ccache2, cc_uint32 *result) \r
-{\r
- if ( ccache1 == NULL || ccache2 == NULL )\r
- return ccErrInvalidCCache;\r
-\r
- if (ccache1 == ccache2)\r
- *result = 1;\r
- else \r
- *result = 0;\r
-\r
- return ccNoError;\r
-}\r
-\r
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-\r
-/*\r
- * Functions to manipulate datastore layer contexts.\r
- *\r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <time.h>\r
-#include <string.h>\r
-\r
-#include "CredentialsCache.h"\r
-#include "datastore.h"\r
-\r
-int cc_myversion = 5;\r
-char cc_vendor[] = "MIT C lang CCache V5";\r
-char cc_default_ccache_name[] = "krb5cc";\r
-\r
-\r
-cc_int32\r
-ccs_context_new( int api_version, cc_auth_info_t* auth_info, \r
- cc_session_info_t* session_info, cc_server_context_t** outContextpp )\r
-{\r
- cc_server_context_t* ctx;\r
- \r
- if ( outContextpp == NULL )\r
- return ccErrBadParam;\r
-\r
- ctx = (cc_server_context_t*)malloc(sizeof(cc_server_context_t));\r
- if (ctx == NULL)\r
- return ccErrNoMem;\r
- \r
- ccs_ccache_list_new(&ctx->ccaches);\r
- cci_generic_list_new(&ctx->active_iterators); \r
- ctx->api_version = api_version;\r
- ctx->auth_info = auth_info;\r
- ctx->session_info = session_info;\r
- ctx->changed = time(NULL);\r
-\r
- *outContextpp = ctx;\r
- return ccNoError;\r
-}\r
-\r
-cc_int32\r
-ccs_context_get_default_ccache_name(cc_server_context_t* ctx, char ** outNamepp) \r
-{\r
- cc_server_ccache_t* default_ccache;\r
-\r
- if (outNamepp == NULL)\r
- return ccErrBadParam;\r
- \r
- if (ctx == NULL)\r
- return ccErrInvalidContext;\r
-\r
- if (ctx->ccaches->head != NULL) {\r
- default_ccache = (cc_server_ccache_t*)ctx->ccaches->head->data;\r
- *outNamepp = default_ccache->name;\r
- } else {\r
- *outNamepp = cc_default_ccache_name;\r
- }\r
- return ccNoError;\r
-}\r
-\r
-\r
-cc_int32\r
-ccs_context_find_ccache( cc_server_context_t* ctx, char *name, \r
- cc_server_ccache_t** outCcachepp )\r
-{\r
- cc_ccache_iterate_t* ccache_iterator;\r
- cc_ccache_list_node_t* ccache_node;\r
- cc_server_ccache_t* ccache;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
- \r
- if (name == NULL)\r
- return ccErrInvalidString;\r
-\r
- if (outCcachepp == NULL)\r
- return ccErrBadParam;\r
-\r
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
- ccache = (cc_server_ccache_t *)ccache_node->data;\r
- if (strcmp(ccache->name, name) == 0) {\r
- free(ccache_iterator);\r
- *outCcachepp = ccache;\r
- return ccNoError;\r
- }\r
- }\r
- free(ccache_iterator);\r
- return ccErrCCacheNotFound;\r
-} \r
-\r
-cc_int32\r
-ccs_context_open_ccache( cc_server_context_t* ctx, char *name, \r
- cc_server_ccache_t** outCcachepp )\r
-{\r
- return ccs_context_find_ccache(ctx, name, outCcachepp);\r
-}\r
-\r
-\r
-cc_int32\r
-ccs_context_create_ccache( cc_server_context_t* ctx, char *name, int creds_version, \r
- char *principal, cc_server_ccache_t** outCcachepp )\r
-{\r
- cc_server_ccache_t* ccache;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
- \r
- if (outCcachepp == NULL)\r
- return ccErrBadParam;\r
-\r
- if (name == NULL || principal == NULL)\r
- return ccErrInvalidString;\r
-\r
- if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && \r
- creds_version != cc_credentials_v4_v5)\r
- return ccErrBadCredentialsVersion;\r
- \r
- code = ccs_context_find_ccache(ctx, name, &ccache);\r
- if (code == ccNoError) {\r
- code = ccs_ccache_set_principal(ccache, creds_version, principal);\r
- } else {\r
- code = ccs_ccache_new(name, principal, creds_version, &ccache);\r
- if (code != ccNoError)\r
- return code; /*let caller deal with error*/\r
-\r
- ccache->mycontext = ctx;\r
- ctx->changed = time(NULL);\r
- ccs_ccache_list_append(ctx->ccaches, ccache, NULL);\r
-\r
- if (ctx->ccaches->head->data == (cc_uint8 *)ccache) {\r
- ccache->is_default = 1;\r
- }\r
- }\r
- *outCcachepp = ccache;\r
- return ccNoError;\r
-}\r
-\r
-cc_int32\r
-ccs_context_create_default_ccache( cc_server_context_t* ctx, int creds_version, \r
- char *principal, cc_server_ccache_t** outCcachepp )\r
-{\r
- cc_server_ccache_t* ccache, *old_default;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
- \r
- if (outCcachepp == NULL)\r
- return ccErrBadParam;\r
-\r
- if (principal == NULL)\r
- return ccErrInvalidString;\r
-\r
- if (creds_version != cc_credentials_v4 && creds_version != cc_credentials_v5 && \r
- creds_version != cc_credentials_v4_v5)\r
- return ccErrBadCredentialsVersion;\r
- \r
- code = ccs_context_find_ccache(ctx, cc_default_ccache_name, &ccache);\r
- if (code == ccNoError) {\r
- ccs_ccache_set_principal(ccache, creds_version, principal);\r
- } else {\r
- code = ccs_ccache_new(cc_default_ccache_name, principal, creds_version, &ccache);\r
- if (code != ccNoError)\r
- return code; /*let caller deal with error*/\r
-\r
- ccache->mycontext = ctx;\r
- ccache->is_default = 1;\r
- ctx->changed = time(NULL);\r
- \r
- if (ctx->ccaches->head != NULL) {\r
- old_default = (cc_server_ccache_t *)ctx->ccaches->head->data;\r
- old_default->is_default = 0;\r
- old_default->last_default = time(NULL);\r
- }\r
-\r
- ccs_ccache_list_prepend(ctx->ccaches, ccache, NULL);\r
- }\r
- *outCcachepp = ccache;\r
- return ccNoError;\r
-}\r
-\r
-cc_int32\r
-ccs_context_ccache_iterator(cc_server_context_t* ctx, cc_ccache_iterate_t** iterpp) \r
-{\r
- cc_ccache_iterate_t* ccache_iterator;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
- \r
- if (iterpp == NULL)\r
- return ccErrBadParam;\r
-\r
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
- if (code != ccNoError)\r
- return code;\r
- cci_generic_list_prepend(ctx->active_iterators, ccache_iterator, sizeof(cc_ccache_iterate_t), NULL);\r
-\r
- *iterpp = ccache_iterator;\r
- return ccNoError;\r
-}\r
-\r
-cc_int32 \r
-ccs_context_compare(cc_server_context_t* a, cc_server_context_t* b) \r
-{\r
- if (a == b)\r
- return 1;\r
- else\r
- return 0;\r
-}\r
-\r
-cc_int32 \r
-ccs_context_destroy(cc_server_context_t* ctx) \r
-{\r
- cc_ccache_iterate_t* ccache_iterator;\r
- cc_ccache_list_node_t* ccache_node;\r
- cc_server_ccache_t* ccache;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
-\r
- cci_generic_list_destroy(ctx->active_iterators);\r
- \r
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
- ccache = (cc_server_ccache_t *)ccache_node->data;\r
- ccache_node->data = NULL;\r
- ccs_ccache_destroy(ccache);\r
- }\r
- ccs_ccache_list_destroy(ctx->ccaches);\r
-\r
- return ccNoError;\r
-}\r
-\r
-cc_int32 \r
-ccs_context_rem_ccache(cc_server_context_t* ctx, cc_server_ccache_t* ccache) \r
-{\r
- cc_ccache_iterate_t* ccache_iterator;\r
- cc_ccache_iterate_t* active_ccache_iterator;\r
- cc_ccache_list_node_t* ccache_node;\r
- cc_server_ccache_t* list_ccache;\r
- cc_generic_list_node_t* gen_node;\r
- cc_generic_iterate_t* gen_iterator;\r
- cc_int32 code;\r
-\r
- if (ctx == NULL) \r
- return ccErrInvalidContext;\r
-\r
- if (ccache == NULL) \r
- return ccErrInvalidCCache;\r
-\r
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);\r
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {\r
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);\r
- list_ccache = (cc_server_ccache_t *)ccache_node->data;\r
-\r
- if (list_ccache == ccache) {\r
- code = cci_generic_list_iterator(ctx->active_iterators, &gen_iterator);\r
- while (cci_generic_iterate_has_next(gen_iterator)) {\r
- code = cci_generic_iterate_next(gen_iterator, &gen_node);\r
- active_ccache_iterator = (cc_ccache_iterate_t *)gen_node->data;\r
- if (active_ccache_iterator->next == ccache_node) {\r
- active_ccache_iterator->next = active_ccache_iterator->next->next;\r
- }\r
- }\r
- free(gen_iterator);\r
- code = ccs_ccache_list_remove_element(ctx->ccaches, ccache_node);\r
- break;\r
- }\r
- }\r
- free(ccache_iterator);\r
- return ccNoError;\r
-}\r
-\r
+++ /dev/null
-/* $Copyright:\r
- *\r
- * Copyright 2004-2006 by the Massachusetts Institute of Technology.\r
- * \r
- * All rights reserved.\r
- * \r
- * Export of this software from the United States of America may require a\r
- * specific license from the United States Government. It is the\r
- * responsibility of any person or organization contemplating export to\r
- * obtain such a license before exporting.\r
- * \r
- * WITHIN THAT CONSTRAINT, permission to use, copy, modify, and distribute\r
- * this software and its documentation for any purpose and without fee is\r
- * hereby granted, provided that the above copyright notice appear in all\r
- * copies and that both that copyright notice and this permission notice\r
- * appear in supporting documentation, and that the name of M.I.T. not be\r
- * used in advertising or publicity pertaining to distribution of the\r
- * software without specific, written prior permission. Furthermore if you\r
- * modify this software you must label your software as modified software\r
- * and not distribute it in such a fashion that it might be confused with\r
- * the original MIT software. M.I.T. makes no representations about the\r
- * suitability of this software for any purpose. It is provided "as is"\r
- * without express or implied warranty.\r
- * \r
- * THIS SOFTWARE IS PROVIDED ``AS IS'' AND WITHOUT ANY EXPRESS OR IMPLIED\r
- * WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\r
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.\r
- * \r
- * Individual source code files are copyright MIT, Cygnus Support,\r
- * OpenVision, Oracle, Sun Soft, FundsXpress, and others.\r
- * \r
- * Project Athena, Athena, Athena MUSE, Discuss, Hesiod, Kerberos, Moira,\r
- * and Zephyr are trademarks of the Massachusetts Institute of Technology\r
- * (MIT). No commercial use of these trademarks may be made without prior\r
- * written permission of MIT.\r
- * \r
- * "Commercial use" means use of a name in a product or other for-profit\r
- * manner. It does NOT prevent a commercial firm from referring to the MIT\r
- * trademarks in order to convey information (although in doing so,\r
- * recognition of their trademark status should be given).\r
- * $\r
- */\r
-\r
-\r
-/*\r
- * Lists implementation.\r
- * \r
- */\r
-\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <memory.h>\r
-\r
-#include "CredentialsCache.h"\r
-#include "datastore.h"\r
-\r
-/**\r
- * ccs_context_iterate_has_next()\r
- *\r
- * Purpose: Determine if a context iterator has a next element\r
- *\r
- * Return: 1 if another element exists\r
- * 0 if no additional elements exist\r
- */\r
-cc_int32 \r
-ccs_context_iterate_has_next(cc_context_iterate_t *iterate) \r
-{\r
- if ( iterate == NULL )\r
- return 0;\r
- \r
- return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
-}\r
-\r
-/**\r
- * ccs_context_iterate_next()\r
- *\r
- * Purpose: Retrieve the next element from a context iterator and advance\r
- * the iterator\r
- *\r
- * Return: non-NULL, the next element in the iterator\r
- * NULL, the iterator list is empty or iterator is invalid\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_context_iterate_next(cc_context_iterate_t *iterate, cc_context_list_node_t ** nodepp)\r
-{\r
- if ( iterate == NULL || nodepp == NULL)\r
- return ccErrBadParam;\r
- \r
- return cci_generic_iterate_next((cc_generic_iterate_t*)iterate,(cc_context_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_ccache_iterate_has_next()\r
- *\r
- * Purpose: Determine if a cache iterator has a next element\r
- *\r
- * Return: 1 if another element exists\r
- * 0 if no additional elements exist\r
- * -1 if error\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-ccs_ccache_iterate_has_next(cc_ccache_iterate_t *iterate) \r
-{\r
- if ( iterate == NULL )\r
- return 0;\r
- return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
-}\r
-\r
-/**\r
- * ccs_ccache_iterate_next()\r
- * \r
- * Purpose: Retrieve the next element from a ccache iterator and advance\r
- * the iterator\r
- *\r
- * Return: non-NULL, the next element in the iterator\r
- * NULL, the iterator list is empty or iterator is invalid\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_iterate_next(cc_ccache_iterate_t *iterate, cc_ccache_list_node_t ** nodepp)\r
-{\r
- if ( iterate == NULL || nodepp == NULL)\r
- return ccErrBadParam;\r
- \r
- return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_ccache_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_credentials_iterate_has_next()\r
- *\r
- * Purpose: Determine if a credentials iterator has a next element\r
- *\r
- * Return: 1 if another element exists\r
- * 0 if no additional elements exist\r
- * -1 if error\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-ccs_credentials_iterate_has_next(cc_credentials_iterate_t *iterate) \r
-{\r
- if ( iterate == NULL )\r
- return 0;\r
- \r
- return cci_generic_iterate_has_next((cc_generic_iterate_t*)iterate);\r
-}\r
-\r
-/**\r
- * ccs_credentials_iterate_next()\r
- * \r
- * Purpose: Retrieve the next element from a credentials iterator and advance\r
- * the iterator\r
- *\r
- * Return: non-NULL, the next element in the iterator\r
- * NULL, the iterator list is empty or iterator is invalid\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_iterate_next(cc_credentials_iterate_t *iterate, cc_credentials_list_node_t** nodepp) \r
-{\r
- if ( iterate == NULL || nodepp == NULL )\r
- return ccErrBadParam;\r
- return cci_generic_iterate_next((cc_generic_iterate_t*)iterate, (cc_credentials_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_context_list_destroy()\r
- *\r
- * Purpose: Deallocate a list and all of its contents\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32\r
-ccs_context_list_destroy(cc_context_list_head_t* head) \r
-{\r
- return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_destroy()\r
- *\r
- * Purpose: Deallocate a list and all of its contents\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32\r
-ccs_ccache_list_destroy(cc_ccache_list_head_t* head) \r
-{\r
- return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_destroy()\r
- *\r
- * Purpose: Deallocate a list and all of its contents\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32\r
-ccs_credentials_list_destroy(cc_credentials_list_head_t* head) \r
-{\r
- return cci_generic_list_destroy((cc_generic_list_head_t*)head);\r
-}\r
-\r
-/**\r
- * ccs_context_list_copy()\r
- *\r
- * Purpose: Copy a list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrBadParam, ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_context_list_copy(cc_context_list_head_t* head, cc_context_list_head_t** headpp ) \r
-{\r
- return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_context_list_head_t **)headpp);\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_copy()\r
- *\r
- * Purpose: Copy a list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrBadParam, ccErrNoMem\r
- */\r
-cc_int32\r
-ccs_ccache_list_copy(cc_ccache_list_head_t* head, cc_ccache_list_head_t** headpp)\r
-{\r
- return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_ccache_list_head_t **)headpp);\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_copy()\r
- *\r
- * Purpose: Copy a list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrBadParam, ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_list_copy(cc_credentials_list_head_t* head, cc_credentials_list_head_t** headpp) \r
-{\r
- return cci_generic_list_copy((cc_generic_list_head_t*)head, (cc_credentials_list_head_t **)headpp);\r
-}\r
-\r
-\r
-/**\r
- * ccs_context_list_new()\r
- *\r
- * Purpose: Allocate a new context list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_context_list_new(cc_context_list_head_t ** headpp) \r
-{\r
- cc_context_list_head_t *ret;\r
- \r
- if ( headpp == NULL )\r
- return ccErrBadParam;\r
-\r
- ret = (cc_context_list_head_t *)malloc(sizeof(cc_context_list_head_t));\r
- if (ret == NULL)\r
- return ccErrNoMem;\r
- ret->head = ret->tail = NULL;\r
- ret->type = cc_context_list;\r
- *headpp = ret;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_context_list_append()\r
- *\r
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_context_list_append(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp) \r
-{\r
- return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_context_list_prepend()\r
- *\r
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_context_list_prepend(cc_context_list_head_t *head, cc_server_context_t *data, cc_context_list_node_t** nodepp ) \r
-{\r
- return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_context_t), (cc_context_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_context_list_remove_element\r
- *\r
- * Purpose: Remove a node from the list\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- */\r
-cc_int32\r
-ccs_context_list_remove_element(cc_context_list_head_t* head, cc_context_list_node_t* rem) \r
-{\r
- return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
-}\r
-\r
-/**\r
- * ccs_context_list_iterator()\r
- *\r
- * Purpose: Allocate an iterator for the specified list\r
- *\r
- * Return: non-NULL, an iterator\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_context_list_iterator(cc_context_list_head_t *head, cc_context_iterate_t** iterpp) \r
-{\r
- cc_context_iterate_t* iterator;\r
- \r
- if ( head == NULL || iterpp == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator = (cc_context_iterate_t*)malloc(sizeof(cc_context_iterate_t));\r
- if (iterator == NULL)\r
- return ccErrNoMem;\r
-\r
- iterator->next = head->head;\r
- *iterpp = iterator;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_context_free_iterator()\r
- *\r
- * Purpose: Deallocate memory associated with an iterator\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_context_free_iterator(cc_context_iterate_t* iterator)\r
-{\r
- if ( iterator == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator->next = NULL;\r
- free(iterator);\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_new()\r
- *\r
- * Purpose: Allocate a new ccache list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- */\r
-cc_int32\r
-ccs_ccache_list_new(cc_ccache_list_head_t ** listpp)\r
-{\r
- cc_ccache_list_head_t *ret;\r
- \r
- if ( listpp == NULL )\r
- return ccErrBadParam;\r
-\r
- ret = (cc_ccache_list_head_t *)malloc(sizeof(cc_ccache_list_head_t));\r
- if (ret == NULL)\r
- return ccErrNoMem;\r
-\r
- ret->head = ret->tail = NULL;\r
- *listpp = ret;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_append()\r
- *\r
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_list_append(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) \r
-{\r
- return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_prepend()\r
- *\r
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_list_prepend(cc_ccache_list_head_t *head, cc_server_ccache_t *data, cc_ccache_list_node_t** nodepp) \r
-{\r
- return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_ccache_t), (cc_ccache_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_remove_element()\r
- *\r
- * Purpose: Remove a node from the list\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_list_remove_element(cc_ccache_list_head_t* head, cc_ccache_list_node_t* rem) \r
-{\r
- return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
-}\r
-\r
-/**\r
- * ccs_ccache_list_iterator()\r
- *\r
- * Purpose: Allocate an iterator for the specified list\r
- *\r
- * Return: non-NULL, an iterator\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_list_iterator(cc_ccache_list_head_t *head, cc_ccache_iterate_t** iterpp) \r
-{\r
- cc_ccache_iterate_t* iterator;\r
- \r
- if ( head == NULL || iterpp == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator = (cc_ccache_iterate_t*)malloc(sizeof(cc_ccache_iterate_t));\r
- if (iterator == NULL)\r
- return ccErrNoMem;\r
-\r
- iterator->next = head->head;\r
- *iterpp = iterator;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_ccache_free_iterator()\r
- *\r
- * Purpose: Deallocate memory associated with an iterator\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_ccache_free_iterator(cc_ccache_iterate_t* iterator)\r
-{\r
- if ( iterator == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator->next = NULL;\r
- free(iterator);\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_new()\r
- *\r
- * Purpose: Allocate a new ccache list\r
- *\r
- * Return: non-NULL, a new list\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_list_new(cc_credentials_list_head_t ** list) \r
-{\r
- if ( list == NULL )\r
- return ccErrBadParam;\r
-\r
- *list = (cc_credentials_list_head_t *)malloc(sizeof(cc_credentials_list_head_t));\r
- if (*list == NULL)\r
- return ccErrNoMem;\r
-\r
- (*list)->head = (*list)->tail = NULL;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_append()\r
- *\r
- * Purpose: Appends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_list_append(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp ) \r
-{\r
- return cci_generic_list_append((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_prepend()\r
- *\r
- * Purpose: Prepends a new node containing a copy of 'len' bytes of 'data' \r
- *\r
- * Return: non-NULL, a pointer to the newly allocated node\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem,ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_list_prepend(cc_credentials_list_head_t *head, cc_server_credentials_t *data, cc_credentials_list_node_t** nodepp) \r
-{\r
- return cci_generic_list_prepend((cc_generic_list_head_t *)head, (void *)data, sizeof(cc_server_credentials_t), (cc_credentials_list_node_t**)nodepp);\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_remove_element()\r
- *\r
- * Purpose: Remove a node from the list\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32 \r
-ccs_credentials_list_remove_element(cc_credentials_list_head_t* head, cc_credentials_list_node_t* rem) \r
-{\r
- return cci_generic_list_remove_element((cc_generic_list_head_t*)head, (cc_generic_list_node_t*)rem);\r
-}\r
-\r
-/**\r
- * ccs_credentials_list_iterator()\r
- *\r
- * Purpose: Allocate an iterator for the specified list\r
- *\r
- * Return: non-NULL, an iterator\r
- * NULL, failure\r
- *\r
- * Errors: ccErrNoMem\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_list_iterator(cc_credentials_list_head_t *head, cc_credentials_iterate_t** iterpp) \r
-{\r
- cc_credentials_iterate_t* iterator;\r
- \r
- if ( head == NULL || iterpp == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator = (cc_credentials_iterate_t*)malloc(sizeof(cc_credentials_iterate_t));\r
- if (iterator == NULL)\r
- return ccErrNoMem;\r
-\r
- iterator->next = head->head;\r
- *iterpp = iterator;\r
- return ccNoError;\r
-}\r
-\r
-/**\r
- * ccs_credentials_free_iterator()\r
- *\r
- * Purpose: Deallocate memory associated with an iterator\r
- *\r
- * Return: 0, success\r
- * -1, failure\r
- *\r
- * Errors: ccErrBadParam\r
- *\r
- */\r
-cc_int32\r
-ccs_credentials_free_iterator(cc_credentials_iterate_t* iterator)\r
-{\r
- if ( iterator == NULL )\r
- return ccErrBadParam;\r
-\r
- iterator->next = NULL;\r
- free(iterator);\r
- return ccNoError;\r
-}\r
-\r
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>ServiceName</key>
- <string>edu.mit.Kerberos.CCacheServer.ipcService</string>
- <key>Command</key>
- <string>/System/Library/CoreServices/CCacheServer.app/Contents/MacOS/CCacheServer</string>
- <key>OnDemand</key>
- <true/>
-</dict>
-</plist>
+++ /dev/null
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
-<plist version="1.0">
-<dict>
- <key>CFBundleDevelopmentRegion</key>
- <string>English</string>
- <key>CFBundleExecutable</key>
- <string>CCacheServer</string>
- <key>CFBundleGetInfoString</key>
- <string>4.1</string>
- <key>CFBundleIconFile</key>
- <string></string>
- <key>CFBundleIdentifier</key>
- <string>edu.mit.Kerberos.CCacheServer</string>
- <key>CFBundleInfoDictionaryVersion</key>
- <string>6.0</string>
- <key>CFBundleName</key>
- <string>Kerberos Credentials Cache Server</string>
- <key>CFBundlePackageType</key>
- <string>APPL</string>
- <key>CFBundleSignature</key>
- <string>CCSa</string>
- <key>CFBundleVersion</key>
- <string>0.0.1d1</string>
- <key>CFBundleShortVersionString</key>
- <string>5.5</string>
- <key>CFBundleGetInfoString</key>
- <string>5.5 Copyright MIT</string>
- <key>KfMDisplayVersion</key>
- <string>5.5 Copyright MIT</string>
- <key>KfMDisplayCopyright</key>
- <string>Copyright MIT</string>
- <key>NSHumanReadableCopyright</key>
- <string>5.5 Copyright MIT</string>
- <key>LSBackgroundOnly</key>
- <string>1</string>
-</dict>
-</plist>
+++ /dev/null
-#include <stdarg.h>
-#include <stdio.h>
-#include <syslog.h>
-#include "CredentialsCache.h"
-#include "msg.h"
-#include "migServer.h"
-#include "serv_ops.h"
-
-#include <Kerberos/kipc_server.h>
-
-int main (int argc, const char *argv[])
-{
- cc_int32 code = 0;
-
- openlog (argv[0], LOG_CONS | LOG_PID, LOG_AUTH);
- syslog (LOG_INFO, "Starting up.");
-
- if (!code) {
- code = ccs_serv_initialize();
- }
-
- if (!code) {
- code = kipc_server_run_server (ccapi_server);
- }
-
- /* cleanup ccs resources */
- ccs_serv_cleanup();
-
- syslog (LOG_NOTICE, "Exiting: %s (%d)", kipc_error_string (code), code);
-
- /* exit */
- return code ? 1 : 0;
-}
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-/*
- * Stubs for rpc_auth.
- */
-
-#include "CredentialsCache.h"
-#include "rpc_auth.h"
-#include <string.h>
-
-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)
-{
- if (msg_auth->len == stored_auth->len &&
- !memcmp(msg_auth->info, stored_auth->info, msg_auth->len) &&
- msg_session->len == stored_session->len &&
- !memcmp(msg_session->info, stored_session->info, msg_session->len))
- *authorizedp = 1;
- else
- *authorizedp = 0;
-
- return ccNoError;
-}
-
-
+++ /dev/null
-/* $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).
- * $
- */
-
-/*
- * Server side implementation of each API function.
- */
-
-#include "CredentialsCache.h"
-#include "serv_ops.h"
-#include "datastore.h"
-#include "rpc_auth.h"
-#include "msg_headers.h"
-#include "marshall.h"
-
-#include <stdlib.h>
-#include <string.h>
-
-cc_context_list_head_t* AllContexts = NULL;
-type_to_op_mapping_t* TypeToOpMapping = NULL;
-
-extern int cc_err_code;
-extern int cc_myversion;
-extern char cc_vendor[];
-
-cc_int32
-ccs_serv_initialize(void)
-{
- cc_int32 code;
-
- code = ccs_context_list_new(&AllContexts);
- if ( code != ccNoError )
- return code;
- TypeToOpMapping = (type_to_op_mapping_t*)malloc(sizeof(type_to_op_mapping_t));
- if (TypeToOpMapping == NULL) {
- ccs_context_list_destroy(AllContexts);
- return ccErrNoMem;
- }
-
-#if 0
- /* These message types are only generated by the server in response
- * to a request. They are never received.
- */
- TypeToOpMapping->operations[ccmsg_ACK] = ccop_ACK;
- TypeToOpMapping->operations[ccmsg_NACK] = ccop_NACK;
-#endif
- TypeToOpMapping->operations[ccmsg_INIT] = ccop_INIT;
- TypeToOpMapping->operations[ccmsg_CTX_RELEASE] = ccop_CTX_RELEASE;
- TypeToOpMapping->operations[ccmsg_CTX_GET_CHANGE_TIME] = ccop_CTX_GET_CHANGE_TIME;
- TypeToOpMapping->operations[ccmsg_CTX_GET_DEFAULT_CCACHE_NAME] = ccop_CTX_GET_DEFAULT_CCACHE_NAME;
- TypeToOpMapping->operations[ccmsg_CTX_CCACHE_OPEN] = ccop_CTX_CCACHE_OPEN;
- TypeToOpMapping->operations[ccmsg_CTX_CCACHE_OPEN_DEFAULT] = ccop_CTX_CCACHE_OPEN_DEFAULT;
- TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE] = ccop_CTX_CCACHE_CREATE;
- TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE_DEFAULT] = ccop_CTX_CCACHE_CREATE_DEFAULT;
- TypeToOpMapping->operations[ccmsg_CTX_CCACHE_CREATE_UNIQUE] = ccop_CTX_CCACHE_CREATE_UNIQUE;
- TypeToOpMapping->operations[ccmsg_CTX_NEW_CCACHE_ITERATOR] = ccop_CTX_NEW_CCACHE_ITERATOR;
- TypeToOpMapping->operations[ccmsg_CTX_LOCK] = ccop_CTX_LOCK;
- TypeToOpMapping->operations[ccmsg_CTX_UNLOCK] = ccop_CTX_UNLOCK;
- TypeToOpMapping->operations[ccmsg_CTX_COMPARE] = ccop_CTX_COMPARE;
- TypeToOpMapping->operations[ccmsg_CCACHE_RELEASE] = ccop_CCACHE_RELEASE;
- TypeToOpMapping->operations[ccmsg_CCACHE_DESTROY] = ccop_CCACHE_DESTROY;
- TypeToOpMapping->operations[ccmsg_CCACHE_SET_DEFAULT] = ccop_CCACHE_SET_DEFAULT;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_CREDS_VERSION] = ccop_CCACHE_GET_CREDS_VERSION;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_NAME] = ccop_CCACHE_GET_NAME;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_PRINCIPAL] = ccop_CCACHE_GET_PRINCIPAL;
- TypeToOpMapping->operations[ccmsg_CCACHE_SET_PRINCIPAL] = ccop_CCACHE_SET_PRINCIPAL;
- TypeToOpMapping->operations[ccmsg_CCACHE_NEW_CREDS_ITERATOR] = ccop_CCACHE_NEW_CREDS_ITERATOR;
- TypeToOpMapping->operations[ccmsg_CCACHE_STORE_CREDS] = ccop_CCACHE_STORE_CREDS;
- TypeToOpMapping->operations[ccmsg_CCACHE_REM_CREDS] = ccop_CCACHE_REM_CREDS;
- TypeToOpMapping->operations[ccmsg_CCACHE_MOVE] = ccop_CCACHE_MOVE;
- TypeToOpMapping->operations[ccmsg_CCACHE_LOCK] = ccop_CCACHE_LOCK;
- TypeToOpMapping->operations[ccmsg_CCACHE_UNLOCK] = ccop_CCACHE_UNLOCK;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_LAST_DEFAULT_TIME] = ccop_CCACHE_GET_LAST_DEFAULT_TIME;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_CHANGE_TIME] = ccop_CCACHE_GET_CHANGE_TIME;
- TypeToOpMapping->operations[ccmsg_CCACHE_COMPARE] = ccop_CCACHE_COMPARE;
- TypeToOpMapping->operations[ccmsg_CCACHE_GET_KDC_TIME_OFFSET] = ccop_CCACHE_GET_KDC_TIME_OFFSET;
- TypeToOpMapping->operations[ccmsg_CCACHE_SET_KDC_TIME_OFFSET] = ccop_CCACHE_SET_KDC_TIME_OFFSET;
- TypeToOpMapping->operations[ccmsg_CCACHE_CLEAR_KDC_TIME_OFFSET] = ccop_CCACHE_CLEAR_KDC_TIME_OFFSET;
- TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_RELEASE] = ccop_CCACHE_ITERATOR_RELEASE;
- TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_NEXT] = ccop_CCACHE_ITERATOR_NEXT;
- TypeToOpMapping->operations[ccmsg_CCACHE_ITERATOR_CLONE] = ccop_CCACHE_ITERATOR_CLONE;
- TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_RELEASE] = ccop_CREDS_ITERATOR_RELEASE;
- TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_NEXT] = ccop_CREDS_ITERATOR_NEXT;
- TypeToOpMapping->operations[ccmsg_CREDS_ITERATOR_CLONE] = ccop_CREDS_ITERATOR_CLONE;
-
- return ccNoError;
-};
-
-cc_int32
-ccs_serv_cleanup(void)
-{
- return ccNoError;
-}
-
-cc_int32
-ccs_serv_process_msg(cc_msg_t * msg, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg)
-{
- cc_server_context_t* ctx;
- ccmsg_ctx_only_t* header = (ccmsg_ctx_only_t *)msg->header;
- cc_uint32 type;
- cc_uint32 header_len;
- cc_handle handle;
- cc_int32 code;
-
- if (msg == NULL || msg->header == NULL || auth_info == NULL || session_info == NULL)
- return ccErrBadParam;
-
- if (AllContexts == NULL) {
- code = ccs_serv_initialize();
- if ( code != ccNoError )
- return code;
- }
-
- type = msg->type;
- if (type == ccmsg_INIT) {
- return TypeToOpMapping->operations[type] (NULL, auth_info, session_info, msg, resp_msg);
- } else {
- header_len = msg->header_len;
- if (header_len < sizeof(ccmsg_ctx_only_t)) {
- return ccErrBadParam;
- }
-
- handle = ntohll(header->ctx);
- code = ccs_serv_find_ctx_by_handle(handle, auth_info, session_info, &ctx);
- if (code != ccNoError) {
- ccs_serv_make_nack(ccErrContextNotFound, auth_info, session_info, resp_msg);
- return code;
- }
- return TypeToOpMapping->operations[type] (ctx, auth_info, session_info, msg, resp_msg);
- }
-}
-
-/*deprecated*/
-cc_int32
-ccs_serv_find_ctx(cc_auth_info_t* auth_info, cc_session_info_t* session_info,
- cc_server_context_t** ctxpp)
-{
- cc_context_iterate_t* ctx_iterator;
- cc_context_list_node_t* ctx_node;
- cc_server_context_t* ctx;
- cc_int32 code;
- cc_uint32 authorized;
-
- code = ccs_context_list_iterator(AllContexts, &ctx_iterator);
- if (code != ccNoError)
- return code;
-
- while (ccs_context_iterate_has_next(ctx_iterator)) {
- code = ccs_context_iterate_next(ctx_iterator, &ctx_node);
- if (code != ccNoError) {
- ccs_context_free_iterator(ctx_iterator);
- return code;
- }
- ctx = (cc_server_context_t *)ctx_node->data;
- code = ccs_rpc_is_authorized(auth_info, session_info, ctx->auth_info, ctx->session_info, &authorized);
- if (code != ccNoError) {
- ccs_context_free_iterator(ctx_iterator);
- return code;
- }
-
- if (authorized) {
- ccs_context_free_iterator(ctx_iterator);
- *ctxpp = ctx;
- return ccNoError;
- }
- }
- ccs_context_free_iterator(ctx_iterator);
- return ccIteratorEnd;
-}
-
-cc_int32
-ccs_serv_find_ctx_by_handle(cc_handle ctx_num, cc_auth_info_t* auth, cc_session_info_t* session, cc_server_context_t** ctxpp)
-{
- cc_server_context_t* input_ctx = (cc_server_context_t*)ctx_num;
- cc_context_iterate_t* ctx_iterator;
- cc_context_list_node_t* ctx_node;
- cc_server_context_t* ctx;
- cc_uint32 authorized;
- cc_int32 code;
-
- code = ccs_context_list_iterator(AllContexts, &ctx_iterator);
- if (code != ccNoError)
- return code;
-
- while (ccs_context_iterate_has_next(ctx_iterator)) {
- code = ccs_context_iterate_next(ctx_iterator, &ctx_node);
- ctx = (cc_server_context_t *)ctx_node->data;
- if (code != ccNoError) {
- ccs_context_free_iterator(ctx_iterator);
- return code;
- }
-
- code = ccs_rpc_is_authorized(auth, session, ctx->auth_info, ctx->session_info, &authorized);
- if (code != ccNoError) {
- ccs_context_free_iterator(ctx_iterator);
- return code;
- }
-
- if (ctx == input_ctx && authorized) {
- ccs_context_free_iterator(ctx_iterator);
- *ctxpp = ctx;
- return ccNoError;
- }
- }
- ccs_context_free_iterator(ctx_iterator);
- return ccIteratorEnd;
-}
-
-cc_int32
-ccs_serv_find_ccache_by_handle(cc_server_context_t* ctx, cc_handle ccache, cc_server_ccache_t** ccachepp )
-{
- cc_ccache_iterate_t* ccache_iterator;
- cc_ccache_list_node_t* ccache_node;
- cc_server_ccache_t* stored_ccache;
- cc_server_ccache_t* target_ccache = (cc_server_ccache_t*)ccache;
- cc_int32 code;
-
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
- if (code != ccNoError)
- return code;
-
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
- if (code != ccNoError) {
- ccs_ccache_free_iterator(ccache_iterator);
- return code;
- }
-
- stored_ccache = (cc_server_ccache_t *)ccache_node->data;
-
- if (stored_ccache == target_ccache) {
- ccs_ccache_free_iterator(ccache_iterator);
- *ccachepp = stored_ccache;
- return ccNoError;
- }
- }
- ccs_ccache_free_iterator(ccache_iterator);
- return ccIteratorEnd;
-}
-
-cc_int32
-ccs_serv_find_ccache_iterator_by_handle(cc_server_context_t* ctx, cc_handle iterator, cc_generic_list_node_t** nodepp )
-{
- cc_generic_iterate_t* gen_iterator;
- cc_generic_list_node_t* gen_node;
- cc_ccache_iterate_t* stored_iterator;
- cc_ccache_iterate_t* target_iterator = (cc_ccache_iterate_t*)iterator;
- cc_int32 code;
-
- code = cci_generic_list_iterator(ctx->active_iterators, &gen_iterator);
- if (code != ccNoError)
- return code;
-
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- if (code != ccNoError) {
- cci_generic_free_iterator(gen_iterator);
- return code;
- }
-
- stored_iterator = (cc_ccache_iterate_t *)gen_node->data;
- if (stored_iterator == target_iterator) {
- cci_generic_free_iterator(gen_iterator);
- *nodepp = gen_node;
- return ccNoError;
- }
- }
- cci_generic_free_iterator(gen_iterator);
- return ccIteratorEnd;
-}
-
-cc_int32
-ccs_serv_find_creds_iterator_by_handle(cc_server_ccache_t* ccache, cc_handle iterator, cc_generic_list_node_t** nodepp)
-{
- cc_generic_iterate_t* gen_iterator;
- cc_generic_list_node_t* gen_node;
- cc_ccache_iterate_t* stored_iterator;
- cc_ccache_iterate_t* target_iterator = (cc_ccache_iterate_t*)iterator;
- cc_int32 code;
-
- code = cci_generic_list_iterator(ccache->active_iterators, &gen_iterator);
- if (code != ccNoError)
- return code;
-
- while (cci_generic_iterate_has_next(gen_iterator)) {
- code = cci_generic_iterate_next(gen_iterator, &gen_node);
- if (code != ccNoError) {
- cci_generic_free_iterator(gen_iterator);
- return code;
- }
-
- stored_iterator = (cc_ccache_iterate_t *)gen_node->data;
- if (stored_iterator == target_iterator) {
- cci_generic_free_iterator(gen_iterator);
- *nodepp = gen_node;
- return ccNoError;
- }
- }
- cci_generic_free_iterator(gen_iterator);
- return ccIteratorEnd;
-}
-
-cc_int32
-ccs_serv_make_nack(cc_int32 err_code, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg)
-{
- ccmsg_nack_t* nack_header;
- cc_int32 code;
-
- code = cci_msg_new(ccmsg_NACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- nack_header = (ccmsg_nack_t*)malloc(sizeof(ccmsg_nack_t));
- if (nack_header == NULL) {
- cci_msg_destroy(*resp_msg);
- *resp_msg = 0;
- return ccErrNoMem;
- }
-
- nack_header->err_code = htonl(err_code);
- code = cci_msg_add_header(*resp_msg, nack_header, sizeof(ccmsg_nack_t));
- if (code != ccNoError) {
- cci_msg_destroy(*resp_msg);
- *resp_msg = 0;
- return code;
- }
-
- return ccNoError;
-}
-
-cc_int32
-ccs_serv_make_ack(void * header, cc_int32 header_len, cc_auth_info_t* auth_info, cc_session_info_t* session_info, cc_msg_t** resp_msg)
-{
- cc_int32 code;
-
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- if (header != NULL) {
- code = cci_msg_add_header(*resp_msg, header, header_len);
- if (code != ccNoError) {
- cci_msg_destroy(*resp_msg);
- resp_msg = 0;
- return code;
- }
- }
- return ccNoError;
-}
-
-cc_int32
-ccop_INIT( cc_server_context_t* ctx, /* not used */
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_uint32 blob_pos;
- cc_server_context_t *new_ctx;
- ccmsg_init_resp_t *resp_header;
- ccmsg_init_t *header = (ccmsg_init_t *)msg->header;
- cc_context_list_node_t* ctx_node;
- cc_uint32 header_len, in_version;
-
- cc_int32 code;
-
- *resp_msg = 0;
-
- header_len = msg->header_len;
- if (ctx != NULL || header_len != sizeof(ccmsg_init_t)) {
- return ccErrBadParam;
- }
-
- in_version = ntohl(header->in_version);
- code = ccs_context_new(in_version, auth_info, session_info, &new_ctx);
- if (code != ccNoError) {
- return code;
- }
-
- code = ccs_context_list_append(AllContexts, new_ctx, &ctx_node);
- if (code != ccNoError) {
- ccs_context_destroy(new_ctx);
- return code;
- }
-
- resp_header = (ccmsg_init_resp_t*)malloc(sizeof(ccmsg_init_resp_t));
- if (resp_header == NULL) {
- ccs_context_destroy(new_ctx);
- return ccErrNoMem;
- }
-
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError) {
- free(resp_header);
- ccs_context_destroy(new_ctx);
- return code;
- }
- code = cci_msg_add_data_blob(*resp_msg, cc_vendor, strlen(cc_vendor) + 1, &blob_pos);
- if (code != ccNoError) {
- free(resp_header);
- ccs_context_destroy(new_ctx);
- cci_msg_destroy(*resp_msg);
- *resp_msg = 0;
- return code;
- }
-
- resp_header->out_ctx = htonll((cc_handle) new_ctx);
- resp_header->out_version = htonl(cc_myversion);
- resp_header->vendor_offset = htonl(blob_pos);
- resp_header->vendor_length = htonl(strlen(cc_vendor) + 1);
- code = cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_init_resp_t));
- if (code != ccNoError) {
- free(resp_header);
- ccs_context_destroy(new_ctx);
- cci_msg_destroy(*resp_msg);
- *resp_msg = 0;
- return code;
- }
-
- return ccNoError;
-}
-
-cc_int32
-ccop_CTX_RELEASE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ctx_release_t* header = (ccmsg_ctx_release_t *)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_handle handle = ntohll(header->ctx);
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ctx_release_t)) {
- return ccErrBadParam;
- }
-
- code = ccs_context_destroy((cc_server_context_t *)handle);
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_GET_CHANGE_TIME( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ctx_get_change_time_resp_t* resp_header;
- ccmsg_ctx_get_change_time_t *header = (ccmsg_ctx_get_change_time_t *)msg->header;
- cc_uint32 header_len = msg->header_len;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ctx_get_change_time_t)) {
- return ccErrBadParam;
- }
-
- resp_header = (ccmsg_ctx_get_change_time_resp_t*)malloc(sizeof(ccmsg_ctx_get_change_time_resp_t));
- if (resp_header == NULL) {
- return ccErrNoMem;
- }
-
- resp_header->time = htonll(ctx->changed);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_get_change_time_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_GET_DEFAULT_CCACHE_NAME( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- char * name;
- ccmsg_ctx_get_default_ccache_name_resp_t* resp_header;
- ccmsg_ctx_get_default_ccache_name_t* header = (ccmsg_ctx_get_default_ccache_name_t *)msg->header;
- cc_uint32 header_len = htonl(msg->header_len);
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ctx_get_default_ccache_name_t)) {
- return ccErrBadParam;
- }
-
- code = ccs_context_get_default_ccache_name(ctx, &name);
- if (code != ccNoError)
- return code;
-
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ctx_get_default_ccache_name_resp_t*)malloc(sizeof(ccmsg_ctx_get_default_ccache_name_resp_t));
- if (resp_header == NULL) {
- cci_msg_destroy(*resp_msg);
- *resp_msg = 0;
- return ccErrNoMem;
- }
-
- code = cci_msg_add_data_blob(*resp_msg, name, strlen(name) + 1, &resp_header->name_offset);
- resp_header->name_len = htonl(strlen(name) + 1);
- return ccNoError;
-}
-
-cc_int32
-ccop_CTX_COMPARE(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_server_context_t *ctx2;
- ccmsg_ctx_compare_resp_t* resp_header;
- ccmsg_ctx_compare_t* header = (ccmsg_ctx_compare_t *)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ctx_compare_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ctx_by_handle(header->ctx2, auth_info, session_info, &ctx2);
-
- resp_header = (ccmsg_ctx_compare_resp_t*)malloc(sizeof(ccmsg_ctx_compare_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->is_equal = htonl(ccs_context_compare(ctx, ctx2));
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_compare_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_NEW_CCACHE_ITERATOR(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_ccache_iterate_t* ccache_iterator;
- ccmsg_ctx_new_ccache_iterator_resp_t* resp_header;
- ccmsg_ctx_new_ccache_iterator_t* header = (ccmsg_ctx_new_ccache_iterator_t*)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ctx_new_ccache_iterator_t))
- return ccErrBadParam;
-
- code = ccs_context_ccache_iterator(ctx, &ccache_iterator);
-
- resp_header = (ccmsg_ctx_new_ccache_iterator_resp_t*)malloc(sizeof(ccmsg_ctx_new_ccache_iterator_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->iterator = htonll((cc_handle) ccache_iterator);
-
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ctx_new_ccache_iterator_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_LOCK( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_UNLOCK( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_CLONE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_CCACHE_OPEN(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- char *name;
- cc_server_ccache_t* ccache;
- ccmsg_ccache_open_resp_t* resp_header;
- ccmsg_ccache_open_t* header = (ccmsg_ccache_open_t*)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_open_t))
- return ccErrBadParam;
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->name_offset), ntohl(header->name_len), &name);
- code = ccs_context_find_ccache(ctx, name, &ccache);
-
- free(name);
-
- if (ccache == NULL)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_open_resp_t*)malloc(sizeof(ccmsg_ccache_open_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->ccache = htonll((cc_handle) ccache);
- ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
- return ccNoError;
-}
-
-cc_int32
-ccop_CTX_CCACHE_OPEN_DEFAULT(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_open_default_t* header = (ccmsg_ccache_open_default_t*)msg->header;
- ccmsg_ccache_open_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_open_default_t))
- return ccErrBadParam;
-
- if (ctx->ccaches->head->data == NULL)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- ccache = (cc_server_ccache_t*) ctx->ccaches->head->data;
-
- resp_header = (ccmsg_ccache_open_resp_t*)malloc(sizeof(ccmsg_ccache_open_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->ccache = htonll((cc_handle) ccache);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_open_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_CCACHE_CREATE(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_create_resp_t* resp_header;
- ccmsg_ccache_create_t* header = (ccmsg_ccache_create_t*)msg->header;
- cc_server_ccache_t* ccache;
- char* principal;
- char* name;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_create_t))
- return ccErrBadParam;
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
- if (code != ccNoError)
- return code;
- principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->name_offset), ntohl(header->name_len), &name);
- if (code != ccNoError)
- return code;
- name[ntohl(header->name_len)] = '\0'; /*Ensure null termination*/
-
- code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ccache_create_resp_t*)malloc(sizeof(ccmsg_ccache_create_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->ccache = htonll((cc_handle) ccache);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_CCACHE_CREATE_DEFAULT( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_create_resp_t* resp_header;
- ccmsg_ccache_create_t* header = (ccmsg_ccache_create_t*)msg->header;
- cc_server_ccache_t* ccache;
- char* principal;
- char* name;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_create_t))
- return ccErrBadParam;
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
- if (code != ccNoError)
- return code;
- principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
-
- code = ccs_context_get_default_ccache_name(ctx, &name);
- if (code != ccNoError)
- return code;
-
- code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ccache_create_resp_t*)malloc(sizeof(ccmsg_ccache_create_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->ccache = htonll((cc_handle) ccache);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CTX_CCACHE_CREATE_UNIQUE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_create_resp_t* resp_header;
- ccmsg_ccache_create_t* header = (ccmsg_ccache_create_t*)msg->header;
- cc_server_ccache_t* ccache;
- char* principal;
- char* name;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_create_t))
- return ccErrBadParam;
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), htonl(header->principal_len), &principal);
- if (code != ccNoError)
- return code;
- principal[ntohl(header->principal_len)] = '\0'; /*Ensure null termination*/
-
- // TODO: Generate a unique ccache name
- name = "unique";
-
- code = ccs_context_create_ccache(ctx, name, ntohl(header->version), principal, &ccache);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ccache_create_resp_t*)malloc(sizeof(ccmsg_ccache_create_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->ccache = htonll((cc_handle) ccache);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_create_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_RELEASE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO: This is probably wrong.
- return ccop_CCACHE_DESTROY(ctx, auth_info, session_info, msg, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_DESTROY( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_release_t* header = (ccmsg_ccache_release_t*)msg->header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_release_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- ccs_ccache_destroy(ccache);
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_SET_DEFAULT(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_server_ccache_t* ccache, *stored_ccache, *old_default;
- ccmsg_ccache_set_default_t* header = (ccmsg_ccache_set_default_t*)msg->header;
- cc_ccache_iterate_t* ccache_iterator;
- cc_ccache_list_node_t* ccache_node;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_set_default_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- if (ccache == (cc_server_ccache_t*)ctx->ccaches->head->data) /*already default*/
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-
- old_default = (cc_server_ccache_t*)ctx->ccaches->head->data;
- old_default->last_default = time(NULL);
-
- code = ccs_ccache_list_iterator(ctx->ccaches, &ccache_iterator);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {
- code = ccs_ccache_iterate_next(ccache_iterator,&ccache_node);
- stored_ccache = (cc_server_ccache_t*)ccache_node->data;
-
- if (stored_ccache == ccache) {
- ccache_node->data = NULL; /*don't want list removal code free()ing ccache*/
- ccs_ccache_list_remove_element(ctx->ccaches, ccache_node);
- ccs_ccache_list_prepend(ctx->ccaches, ccache, NULL);
- break;
- }
- }
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_GET_CREDS_VERSION(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_creds_version_t* header = (ccmsg_ccache_get_creds_version_t*)msg->header;
- ccmsg_ccache_get_creds_version_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_creds_version_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_get_creds_version_resp_t*)malloc(sizeof(ccmsg_ccache_get_creds_version_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->version = htonl(ccache->versions);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_creds_version_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_GET_NAME(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_name_t* header = (ccmsg_ccache_get_name_t*)msg->header;
- ccmsg_ccache_get_name_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_uint32 name_offset;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_name_resp_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (ccache == NULL)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_get_name_resp_t*)malloc(sizeof(ccmsg_ccache_get_name_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- code = cci_msg_add_data_blob(*resp_msg, ccache->name, strlen(ccache->name) + 1, &name_offset);
- if (code == 0) {
- resp_header->name_len = htonl(strlen(ccache->name) + 1);
- resp_header->name_offset = htonl(name_offset);
- }
- cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_ccache_get_name_resp_t));
-
- return ccNoError;
-}
-
-cc_int32
-ccop_CCACHE_GET_PRINCIPAL(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_principal_t* header = (ccmsg_ccache_get_principal_t*)msg->header;
- ccmsg_ccache_get_principal_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- char * principal;
- cc_uint32 header_len = msg->header_len;
- cc_uint32 principal_offset;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_principal_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_ccache_get_principal(ccache, ntohl(header->version), &principal);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ccache_get_principal_resp_t*)malloc(sizeof(ccmsg_ccache_get_principal_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- code = cci_msg_add_data_blob(*resp_msg, principal, strlen(principal) + 1, &principal_offset);
- if (code == 0) {
- resp_header->principal_len = htonl(strlen(principal) + 1);
- resp_header->principal_offset = htonl(principal_offset);
- }
- cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_ccache_get_principal_resp_t));
-
- return ccNoError;
-}
-
-cc_int32
-ccop_CCACHE_SET_PRINCIPAL(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_set_principal_t* header = (ccmsg_ccache_set_principal_t*)msg->header;
- cc_server_ccache_t* ccache;
- char *principal;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_set_principal_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->principal_offset), ntohl(header->principal_len), &principal);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- code = ccs_ccache_set_principal(ccache, ntohl(header->version), principal);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_NEW_CREDS_ITERATOR( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_server_ccache_t* ccache;
- cc_credentials_iterate_t* creds_iterator;
- ccmsg_ccache_creds_iterator_t* header = (ccmsg_ccache_creds_iterator_t*)msg->header;
- ccmsg_ccache_creds_iterator_resp_t* resp_header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_creds_iterator_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_ccache_new_iterator(ccache, &creds_iterator);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_ccache_creds_iterator_resp_t*)malloc(sizeof(ccmsg_ccache_creds_iterator_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->iterator = htonll((cc_handle) creds_iterator);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_creds_iterator_resp_t), auth_info, session_info, resp_msg);
-}
-
-
-static cc_int32
-ccs_credentials_union_release( cc_credentials_union * creds )
-{
- int i;
-
- switch (creds->version) {
- case cc_credentials_v4:
- free(creds->credentials.credentials_v4);
- break;
- case cc_credentials_v5:
- if ( creds->credentials.credentials_v5->client )
- free(creds->credentials.credentials_v5->client);
- if ( creds->credentials.credentials_v5->server )
- free(creds->credentials.credentials_v5->server );
- if ( creds->credentials.credentials_v5->keyblock.data )
- free(creds->credentials.credentials_v5->keyblock.data);
- if ( creds->credentials.credentials_v5->ticket.data )
- free(creds->credentials.credentials_v5->ticket.data);
- if ( creds->credentials.credentials_v5->second_ticket.data )
- free(creds->credentials.credentials_v5->second_ticket.data);
- if ( creds->credentials.credentials_v5->addresses ) {
- for ( i=0; creds->credentials.credentials_v5->addresses[i]; i++) {
- if (creds->credentials.credentials_v5->addresses[i]->data)
- free(creds->credentials.credentials_v5->addresses[i]->data);
- }
- free(creds->credentials.credentials_v5->addresses);
- }
- if ( creds->credentials.credentials_v5->authdata ) {
- for ( i=0; creds->credentials.credentials_v5->authdata[i]; i++) {
- if ( creds->credentials.credentials_v5->authdata[i]->data )
- free(creds->credentials.credentials_v5->authdata[i]->data);
- }
- free(creds->credentials.credentials_v5->authdata);
- }
- break;
- default:
- return ccErrBadCredentialsVersion;
- }
- return ccNoError;
-}
-
-cc_int32
-ccop_CCACHE_STORE_CREDS(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_store_creds_t* header = (ccmsg_ccache_store_creds_t*)msg->header;
- cc_server_ccache_t* ccache;
- char *flat_creds;
- cc_credentials_union *creds;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_store_creds_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = cci_msg_retrieve_blob(msg, ntohl(header->creds_offset), ntohl(header->creds_len), &flat_creds);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- creds = (cc_credentials_union *)malloc(sizeof(cc_credentials_union));
- if ( creds == NULL )
- return ccErrNoMem;
-
- switch ( creds->version ) {
- case cc_credentials_v4:
- code = cci_creds_v4_unmarshall(flat_creds, ntohl(header->creds_len), creds);
- break;
- case cc_credentials_v5:
- code = cci_creds_v5_unmarshall(flat_creds, ntohl(header->creds_len), creds);
- break;
- default:
- return ccs_serv_make_nack(ccErrBadCredentialsVersion, auth_info, session_info, resp_msg);
- }
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- code = ccs_ccache_store_creds(ccache, creds);
- ccs_credentials_union_release(creds);
- if (code != ccNoError) {
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
- }
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_REM_CREDS(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_rem_creds_t* header = (ccmsg_ccache_rem_creds_t*)msg->header;
- cc_server_ccache_t* ccache;
- cc_credentials_union *creds;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
- if (header_len != sizeof(ccmsg_ccache_rem_creds_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_ccache_rem_creds(ccache, (const cc_credentials_union *)(ntohll(header->creds)));
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_LOCK( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_UNLOCK( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_MOVE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-
-cc_int32
-ccop_CCACHE_GET_LAST_DEFAULT_TIME(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_last_default_time_t* header = (ccmsg_ccache_get_last_default_time_t*)msg->header;
- ccmsg_ccache_get_last_default_time_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_last_default_time_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_get_last_default_time_resp_t*)malloc(sizeof(ccmsg_ccache_get_last_default_time_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->last_default_time = htonll(ccache->last_default);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_last_default_time_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_GET_CHANGE_TIME( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_change_time_resp_t* resp_header;
- ccmsg_ccache_get_change_time_t *header = (ccmsg_ccache_get_change_time_t *)msg->header;
- cc_server_ccache_t* ccache = (cc_server_ccache_t *)header->ccache;
- cc_uint32 header_len = msg->header_len;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_change_time_t)) {
- return ccErrBadParam;
- }
-
- resp_header = (ccmsg_ccache_get_change_time_resp_t*)malloc(sizeof(ccmsg_ccache_get_change_time_resp_t));
- if (resp_header == NULL) {
- return ccErrNoMem;
- }
-
- resp_header->time = htonll(ccache->changed);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_change_time_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_COMPARE(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_compare_t* header = (ccmsg_ccache_compare_t*)msg->header;
- ccmsg_ccache_compare_resp_t* resp_header;
- cc_server_ccache_t* ccache1, *ccache2;
- cc_uint32 header_len = msg->header_len;
- cc_uint32 is_equal;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_compare_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache1), &ccache1);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache2), &ccache2);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_compare_resp_t*)malloc(sizeof(ccmsg_ccache_compare_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- ccs_ccache_compare(ccache1, ccache2, &is_equal);
- resp_header->is_equal = htonl(is_equal);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_compare_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_GET_KDC_TIME_OFFSET(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_get_kdc_time_offset_t* header = (ccmsg_ccache_get_kdc_time_offset_t*)msg->header;
- ccmsg_ccache_get_kdc_time_offset_resp_t* resp_header;
- cc_server_ccache_t* ccache;
- cc_time64 offset;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_get_kdc_time_offset_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- // TODO How is the header->creds_version supposed to be used?
-
- code = ccs_ccache_get_kdc_time_offset(ccache, &offset);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- resp_header = (ccmsg_ccache_get_kdc_time_offset_resp_t*)malloc(sizeof(ccmsg_ccache_get_kdc_time_offset_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- resp_header->offset = htonll(offset);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_get_kdc_time_offset_resp_t), auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_SET_KDC_TIME_OFFSET(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_set_kdc_time_offset_t* header = (ccmsg_ccache_set_kdc_time_offset_t*)msg->header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_set_kdc_time_offset_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- // TODO How is the header->creds_version supposed to be used?
-
- ccs_ccache_set_kdc_time_offset(ccache, htonll(header->offset));
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_CLEAR_KDC_TIME_OFFSET(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_clear_kdc_time_offset_t* header = (ccmsg_ccache_clear_kdc_time_offset_t*)msg->header;
- cc_server_ccache_t* ccache;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_clear_kdc_time_offset_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- // TODO How is the header->creds_version supposed to be used?
-
- ccs_ccache_clear_kdc_time_offset(ccache);
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_ITERATOR_RELEASE(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_generic_list_node_t* gen_node;
- ccmsg_ccache_iterator_release_t* header = (ccmsg_ccache_iterator_release_t*)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_iterator_release_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_iterator_by_handle(ctx, ntohll(header->iterator), &gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- code = cci_generic_list_remove_element(ctx->active_iterators, gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_ITERATOR_CLONE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CCACHE_ITERATOR_NEXT(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_ccache_iterator_release_t* header = (ccmsg_ccache_iterator_release_t*)msg->header;
- ccmsg_ccache_iterator_next_resp_t* resp_header;
- cc_generic_list_node_t* gen_node;
- cc_ccache_iterate_t* ccache_iterator;
- cc_ccache_list_node_t *ccache_node;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_ccache_iterator_next_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_iterator_by_handle(ctx, ntohll(header->iterator), &gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- ccache_iterator = (cc_ccache_iterate_t*)gen_node->data;
- if (ccs_ccache_iterate_has_next(ccache_iterator)) {
- resp_header = (ccmsg_ccache_iterator_next_resp_t*)malloc(sizeof(ccmsg_ccache_iterator_next_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(code, auth_info, session_info, resp_msg);
-
- resp_header->ccache = htonll((cc_handle) ccache_node);
- return ccs_serv_make_ack(resp_header, sizeof(ccmsg_ccache_iterator_next_resp_t), auth_info, session_info, resp_msg);
- } else {
- return ccs_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
- }
-}
-
-cc_int32
-ccop_CREDS_ITERATOR_RELEASE(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- cc_generic_list_node_t* gen_node;
- cc_server_ccache_t* ccache;
- ccmsg_creds_iterator_release_t* header = (ccmsg_creds_iterator_release_t*)msg->header;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_creds_iterator_release_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_serv_find_creds_iterator_by_handle(ccache, ntohll(header->iterator), &gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- code = cci_generic_list_remove_element(ccache->active_iterators, gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- return ccs_serv_make_ack(NULL, 0, auth_info, session_info, resp_msg);
-}
-
-cc_int32
-ccop_CREDS_ITERATOR_CLONE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- // TODO
- return ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
-}
-
-
-cc_int32
-ccop_CREDS_ITERATOR_NEXT(cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
- ccmsg_creds_iterator_next_t* header = (ccmsg_creds_iterator_next_t*)msg->header;
- ccmsg_creds_iterator_next_resp_t* resp_header;
- cc_credentials_iterate_t* creds_iterator;
- cc_generic_list_node_t* gen_node;
- cc_credentials_list_node_t* creds_node;
- cc_server_ccache_t* ccache;
- cc_server_credentials_t* stored_creds;
- cc_credentials_union *creds_union;
- cc_uint32 header_len = msg->header_len;
- cc_int32 code;
-
- *resp_msg = 0;
-
- if (header_len != sizeof(ccmsg_creds_iterator_next_t))
- return ccErrBadParam;
-
- code = ccs_serv_find_ccache_by_handle(ctx, ntohll(header->ccache), &ccache);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrCCacheNotFound, auth_info, session_info, resp_msg);
-
- code = ccs_serv_find_creds_iterator_by_handle(ccache, ntohll(header->iterator), &gen_node);
- if (code != ccNoError)
- return ccs_serv_make_nack(ccErrBadParam, auth_info, session_info, resp_msg);
-
- creds_iterator = (cc_credentials_iterate_t*)gen_node->data;
- if (ccs_credentials_iterate_has_next(creds_iterator)) {
- code = cci_msg_new(ccmsg_ACK, resp_msg);
- if (code != ccNoError)
- return code;
-
- resp_header = (ccmsg_creds_iterator_next_resp_t*)malloc(sizeof(ccmsg_creds_iterator_next_resp_t));
- if (resp_header == NULL)
- return ccErrNoMem;
-
- code = ccs_credentials_iterate_next(creds_iterator, &creds_node);
- stored_creds = (cc_server_credentials_t*)creds_node->data;
- creds_union = &stored_creds->creds;
-
- code = cci_msg_add_data_blob(*resp_msg, creds_union, sizeof(cc_credentials_union), &resp_header->creds_offset);
- code = cci_msg_add_header(*resp_msg, resp_header, sizeof(ccmsg_creds_iterator_next_resp_t));
- } else {
- ccs_serv_make_nack(ccIteratorEnd, auth_info, session_info, resp_msg);
- }
- return ccNoError;
-}
-
-cc_int32
-ccop_CREDS_RELEASE( cc_server_context_t* ctx,
- cc_auth_info_t* auth_info,
- cc_session_info_t* session_info,
- cc_msg_t *msg, cc_msg_t **resp_msg)
-{
-
- ccs_serv_make_nack(ccErrNotImplemented, auth_info, session_info, resp_msg);
- return ccNoError;
-}
+++ /dev/null
-!include <win32.mak>\r
-\r
-CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
-\r
-WINLIBS = ws2_32.lib rpcrt4.lib $(guilibsdll)\r
-\r
-T_CCACHE = t_ccache.exe\r
-\r
-T_CONTEXT = t_context.exe\r
-\r
-T_LISTS = t_lists.exe\r
-\r
-T_MSG = t_msg.exe\r
-\r
-T_SERVER = t_server.exe\r
-\r
-T_CCAPI = t_ccapi.exe\r
-\r
-all: $(T_CCAPI) $(T_CCACHE) $(T_CONTEXT) $(T_LISTS) $(T_MSG) $(T_SERVER)\r
-\r
-ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf\r
- midl ntccrpc.idl /acf ntccrpc.acf\r
-\r
-CC_CLIENT_LIB = ..\client\cc_client.lib\r
-\r
-CC_COMMON_LIB = ..\common\cc_common.lib\r
-\r
-CC_SERVER_LIB = ..\server\cc_server.lib\r
-\r
-CC_API_LIB = ..\windows\krbcc32.lib\r
-\r
-$(T_CCACHE): t_ccache.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-$(T_CONTEXT): t_context.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-$(T_LISTS): t_lists.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-$(T_MSG): t_msg.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-$(T_SERVER): t_server.obj $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-$(T_CCAPI): t_ccapi.obj $(CC_API_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-clean:\r
- del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h\r
-\r
-\r
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-int main() {
- cc_server_credentials_t *cred1, *cred2, *cred3;
- cc_credentials_iterate_t* iterator;
- cc_server_credentials_t* stored_cred;
- cc_credentials_list_node_t *node;
- cc_server_ccache_t *c1, *c2;
- char p1[] = "Spike";
- char p2[] = "Jeff";
- int i;
- cc_int32 code;
-
- code = ccs_ccache_new("The first", p1, cc_credentials_v4_v5, &c1);
- code = ccs_ccache_new("The 2nd", p2, cc_credentials_v4_v5, &c2);
-
- cred1 = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));
- memset(cred1,0,sizeof(cc_server_credentials_t));
- cred2 = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));
- memset(cred2,0,sizeof(cc_server_credentials_t));
- cred3 = (cc_server_credentials_t*)malloc(sizeof(cc_server_credentials_t));
- memset(cred3,0,sizeof(cc_server_credentials_t));
-
- cred1->creds.version = cred2->creds.version = cc_credentials_v4;
- cred3->creds.version = cc_credentials_v5;
-
- cred1->creds.credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
- memset(cred1->creds.credentials.credentials_v4,0,sizeof(cc_credentials_v4_t));
- cred2->creds.credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
- memset(cred2->creds.credentials.credentials_v4,0,sizeof(cc_credentials_v4_t));
- cred3->creds.credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));
- memset(cred3->creds.credentials.credentials_v5,0,sizeof(cc_credentials_v5_t));
-
- strncpy(cred1->creds.credentials.credentials_v4->principal, p1, strlen(p1));
- strncpy(cred2->creds.credentials.credentials_v4->principal, p1, strlen(p1));
- cred3->creds.credentials.credentials_v5->client = p1;
-
- code = ccs_ccache_store_creds(c1, &cred1->creds);
- printf("(c1, cred1) -> %d\n",code);
-
- code = ccs_ccache_store_creds(c1, &cred2->creds);
- printf("(c1, cred2) -> %d\n",code);
-
- code = ccs_ccache_store_creds(c2, &cred3->creds);
- printf("(c2, cred3) -> %d\n",code);
-
- code = ccs_ccache_store_creds(c1, &cred3->creds);
- printf("(c1, cred3) -> %d\n",code);
-
- i = 0;
- code = ccs_ccache_move(c1, c2);
- code = ccs_ccache_destroy(c1);
- code = ccs_ccache_new_iterator(c2, &iterator);
- while (ccs_credentials_iterate_has_next(iterator)) {
- i++;
- code = ccs_credentials_iterate_next(iterator, &node);
- stored_cred = (cc_server_credentials_t *)node->data;
- printf("%d %d %s\n", stored_cred->is_default, stored_cred->creds.version, stored_cred->creds.credentials.credentials_v4->principal);
-
- if (i == 1) {
- code = ccs_ccache_rem_creds(c2,&cred2->creds);
- printf("(c2 rem cred2) -> %d\n",code);
- }
- }
- return 0;
-}
-
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <time.h>
-#include <string.h>
-
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-
-/*testing code*/
-int main() {
- int uid = 1;
- int session = 1;
- cc_server_ccache_t *ccache;
- cc_credentials_union* creds;
- cc_ccache_iterate_t* ccache_iterator;
- cc_ccache_list_node_t* ccache_node;
- cc_credentials_iterate_t* creds_iterator;
- cc_credentials_list_node_t* creds_node;
- cc_server_credentials_t* server_creds;
- cc_auth_info_t* auth_info = NULL;
- cc_session_info_t* session_info = NULL;
- cc_server_context_t* ctx = NULL;
- char *name;
- int i;
- cc_int32 code;
-
- code = ccs_context_new(5, auth_info, session_info, &ctx);
- code = ccs_context_create_default_ccache(ctx, cc_credentials_v4, "Spike", &ccache);
- code = ccs_context_get_default_ccache_name(ctx, &name);
- code = ccs_context_open_ccache(ctx, name, &ccache);
-
- for (i = 0; i < 5; i++) {
- creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union));
- creds->version = cc_credentials_v4;
- creds->credentials.credentials_v4 = (cc_credentials_v4_t*)malloc(sizeof(cc_credentials_v4_t));
- strcpy(creds->credentials.credentials_v4->principal, "Spike");
-
- code = ccs_ccache_store_creds(ccache, creds);
- }
-
- code = ccs_context_create_ccache(ctx, "ccache 2", cc_credentials_v4_v5, "Jeff", &ccache);
- code = ccs_context_open_ccache(ctx, "ccache 2", &ccache);
-
- for (i = 0; i < 5; i++) {
- creds = (cc_credentials_union*)malloc(sizeof(cc_credentials_union));
- creds->version = cc_credentials_v5;
- creds->credentials.credentials_v5 = (cc_credentials_v5_t*)malloc(sizeof(cc_credentials_v5_t));
- strcpy(creds->credentials.credentials_v5->principal, "Jeff");
-
- ccs_ccache_store_creds(ccache, creds);
- }
-
- code = ccs_context_ccache_iterator(ctx, &ccache_iterator);
- while (ccs_ccache_iterate_has_next(ccache_iterator)) {
- code = ccs_ccache_iterate_next(ccache_iterator, &ccache_node);
- ccache = (cc_server_ccache_t *)ccache_node->data;
- printf("%x for %s %s default = %d v %d\n",
- ccache, ccache->principal_v4, ccache->principal_v5,
- ccache->is_default, ccache->versions);
-
- code = ccs_ccache_new_iterator(ccache, &creds_iterator);
- while (ccs_credentials_iterate_has_next(creds_iterator)) {
- code = ccs_credentials_iterate_next(creds_iterator, &creds_node);
- server_creds = (cc_server_credentials_t *)creds_node->data;
- printf("\t%s %d\n",
- server_creds->creds.credentials.credentials_v4->principal,
- creds->version);
- }
- }
- return 0;
-}
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <memory.h>
-
-#include "CredentialsCache.h"
-#include "datastore.h"
-
-
-int main() {
- cc_generic_list_head_t* head;
- cc_generic_list_head_t* copy;// = cc_generic_list_copy(head);
- cc_generic_list_node_t *head_node,*tail,*middle, *node;
- cc_generic_iterate_t* iterate;
- int x1 = 1;
- int x2 = 2;
- int x3 = 3;
- int x4 = 4;
- int x5 = 5;
- int x6 = 6;
- cc_int32 code;
-
- code = cci_generic_list_new(&head);
- code = cci_generic_list_append(head,&x4,sizeof(x4),NULL);
- code = cci_generic_list_append(head,&x5,sizeof(x5),NULL);
- code = cci_generic_list_append(head,&x6,sizeof(x6),&tail);
-
- code = cci_generic_list_prepend(head,&x3,sizeof(x3),&middle);
- code = cci_generic_list_prepend(head,&x2,sizeof(x2),NULL);
- code = cci_generic_list_prepend(head,&x1,sizeof(x1), &head_node);
-
- code = cci_generic_list_iterator(head, &iterate);
- while (cci_generic_iterate_has_next(iterate)) {
- code = cci_generic_iterate_next(iterate, &node);
- printf("%d\n",*((int *)(node->data)));
- }
- printf("----------\n");
- cci_generic_list_remove_element(head,head_node);
- cci_generic_list_remove_element(head,middle);
- cci_generic_list_remove_element(head,tail);
-
- code = cci_generic_list_iterator(head, &iterate);
- while (cci_generic_iterate_has_next(iterate)) {
- code = cci_generic_iterate_next(iterate, &node);
- printf("%d\n",*((int *)(node->data)));
- }
-
- printf("----------\n");
- code = cci_generic_list_copy(head, ©);
- code = cci_generic_list_iterator(copy, &iterate);
- while (cci_generic_iterate_has_next(iterate)) {
- code = cci_generic_iterate_next(iterate, &node);
- printf("%d\n",*((int *)(node->data)));
- }
-
- cci_generic_list_destroy(copy);
- return 0;
-}
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-#include "CredentialsCache.h"
-#include "msg.h"
-#include "datastore.h"
-
-#include <stdlib.h>
-#include <memory.h>
-#include <stdio.h>
-#include <string.h>
-
-/*testing code*/
-int main()
-{
- cc_msg_t* msg;
- double header = 4.05;
- char blob1[] = "This is blob one.1234";
- int blob2 = 2;
- char blob3[] = "This is blob 3.";
- int pos1,pos2,pos3;
- void *flat;
- char *p;
- cc_uint32 valid = 0;
- cc_int32 code;
-
- code = cci_msg_new(ccmsg_INIT, &msg);
- code = cci_msg_add_header(msg, &header, sizeof(double));
- //cc_msg_add_header(msg, NULL, 0);
- code = cci_msg_add_data_blob(msg, blob1, strlen(blob1) + 1,&pos1);
- code = cci_msg_add_data_blob(msg, &blob2, sizeof(int),&pos2);
- code = cci_msg_add_data_blob(msg, blob3, strlen(blob3) + 1,&pos3);
-
- cci_msg_flatten(msg,&flat);
-
- printf("%s\n",(char *)((char *)msg->flat + pos1));
- printf("%d\n",*(int *)((char *)msg->flat + pos2));
- printf("%s\n",(char *)((char *)msg->flat + pos3));
-
- cci_msg_verify(msg->flat, msg->flat_len, &valid);
- printf("%d\n",valid);
-
- code = cci_msg_unflatten(msg->flat, msg->flat_len, &msg);
-
- code = cci_msg_retrieve_blob(msg, pos3, strlen(blob3) + 1, &p);
- printf("%s PPP\n",p);
- return 0;
-}
+++ /dev/null
-/* $Copyright:
- *
- * Copyright 2004 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).
- * $
- */
-
-
-#include "CredentialsCache.h"
-#include "serv_ops.h"
-#include "datastore.h"
-#include "rpc_auth.h"
-#include "msg_headers.h"
-
-#include <stdlib.h>
-
-static int
-read_flat_msg(char ** flat_msg, cc_uint32 * flat_len)
-{
-
- /* TODO - read length of message */
- *flat_len = 999;
-
- *flat_msg = (char *)malloc(*flat_len);
-
- /* TODO - read message into buffer */
-
- return 0;
-}
-
-static int
-send_flat_msg(char * flag_msg, cc_uint32 flat_len)
-{
-
- return 0;
-}
-
-static int
-obtain_auth_info(cc_auth_info_t ** auth)
-{
- if (auth == NULL)
- return ccErrBadParam;
-
- *auth = malloc(sizeof(cc_auth_info_t));
- if (auth == NULL)
- return ccErrNoMem;
-
- memset(*auth,0,sizeof(cc_auth_info_t));
-
- /* TODO: obtain real auth data from connection */
-
- return ccNoError;
-}
-
-static int
-destroy_auth_info(cc_auth_info_t * auth)
-{
- if (auth == NULL)
- return ccErrBadParam;
-
- if (auth->info)
- free(auth->info);
-
- free(auth);
-
- return ccNoError;
-}
-
-static int
-obtain_session_info(cc_session_info_t ** session)
-{
- if (session == NULL)
- return ccErrBadParam;
-
- *session = malloc(sizeof(cc_session_info_t));
- if (session == NULL)
- return ccErrNoMem;
-
- memset(*session,0,sizeof(cc_session_info_t));
-
- /* TODO: obtain real session data from connection */
-
- return ccNoError;
-}
-
-static int
-destroy_session_info(cc_session_info_t * session)
-{
- if (session == NULL)
- return ccErrBadParam;
-
- if (session->info)
- free(session->info);
-
- free(session);
-
- return ccNoError;
-}
-
-
-int
-main(void)
-{
- cc_msg_t * msg;
- cc_msg_t * resp;
- cc_auth_info_t * auth_info;
- cc_session_info_t * session_info;
- cc_int32 code;
-
- if ( ccs_serv_initialize() != ccNoError )
- return 1;
-
- while ( 1 ) {
- msg = (cc_msg_t *)malloc(sizeof(cc_msg_t));
-
- /* read message */
- if (read_flat_msg(&msg->flat, &msg->flat_len))
- continue;
-
- /* unflatten message */
- code = cci_msg_unflatten(msg->flat, msg->flat_len, &msg);
-
- /* obtain auth info */
- code = obtain_auth_info(&auth_info);
-
- /* obtain session info */
- code = obtain_session_info(&session_info);
-
- /* process message */
- code = ccs_serv_process_msg(msg, auth_info, session_info, &resp);
-
- /* flatten response */
- code = cci_msg_flatten(resp, NULL);
-
- /* send response */
- code = send_flat_msg(resp->flat, resp->flat_len);
-
- code = destroy_auth_info(auth_info);
-
- code = destroy_session_info(session_info);
-
- /* free message */
- code = cci_msg_destroy(msg);
-
- /* free response */
- code = cci_msg_destroy(resp);
- }
- return 0;
-}
+++ /dev/null
-!include <win32.mak>\r
-\r
-CFLAGS = -I../include $(cdebug) $(cflags) $(cvarsmt)\r
-\r
-CCAPI_SERVER = ccapi_server.exe\r
-\r
-CCAPI_DLLFILE = krbcc32.dll\r
-\r
-WINLIBS = ws2_32.lib rpcrt4.lib $(guilibsdll)\r
-\r
-all: $(CCAPI_DLLFILE) $(CCAPI_SERVER)\r
-\r
-ntccrpc_c.c ntccrpc_s.c ntccrpc.h: ntccrpc.idl ntccrpc.acf\r
- midl ntccrpc.idl /acf ntccrpc.acf\r
-\r
-CLIENT_OBJS = ntccrpc_c.obj client.obj dllmain.obj\r
-\r
-SERVER_OBJS = ntccrpc_s.obj server.obj\r
-\r
-CC_CLIENT_LIB = ..\client\cc_client.lib\r
-\r
-CC_COMMON_LIB = ..\common\cc_common.lib\r
-\r
-CC_SERVER_LIB = ..\server\cc_server.lib\r
-\r
-$(CCAPI_DLLFILE): $(CLIENT_OBJS) $(CC_CLIENT_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO /OUT:$@ $(ldebug) $(dlllflags) $(guilibsmt) -def:cacheapi.def $** $(WINLIBS)\r
-\r
-$(CCAPI_SERVER): $(SERVER_OBJS) $(CC_SERVER_LIB) $(CC_COMMON_LIB)\r
- $(link) /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $** $(WINLIBS)\r
-\r
-clean:\r
- del *.exe *.dll *.lib *.exp *.obj ntccrpc_c.c ntccrpc_s.c ntccrpc.h\r
-\r
-\r
+++ /dev/null
-EXPORTS\r
- ; ccapi v3 only exports one function\r
- cc_initialize @14\r
-\r
- ; ccapi v2 compatibility functions\r
- cc_close @2\r
- cc_create @3\r
- cc_destroy @4\r
- cc_free_NC_info @5\r
- cc_free_creds @6\r
- cc_free_name @7\r
- cc_free_principal @8\r
- cc_get_NC_info @9\r
- cc_get_change_time @10\r
- cc_get_cred_version @11\r
- cc_get_name @12\r
- cc_get_principal @13\r
- cc_lock_request @15\r
- cc_open @16\r
- cc_remove_cred @17\r
- cc_seq_fetch_NCs_begin @18\r
- cc_seq_fetch_NCs_end @19\r
- cc_seq_fetch_NCs_next @20\r
- cc_seq_fetch_creds_begin @21\r
- cc_seq_fetch_creds_end @22\r
- cc_seq_fetch_creds_next @23\r
- cc_set_principal @24\r
- cc_shutdown @25\r
- cc_store @26\r
+++ /dev/null
-#include <windows.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <tchar.h>\r
-#include "ntccrpc.h"\r
-#include <strsafe.h>\r
-#include "CredentialsCache.h"\r
-#include "msg.h"\r
-\r
-static RPC_BINDING_HANDLE hRpcBinding;\r
-\r
-void * __RPC_USER MIDL_user_allocate(size_t s) {\r
- return malloc(s);\r
-}\r
-\r
-void __RPC_USER MIDL_user_free(void * p) {\r
- free(p);\r
-}\r
-\r
-int cc_rpc_init(void) {\r
- RPC_STATUS status;\r
- TCHAR * bindstring = NULL;\r
- RPC_SECURITY_QOS sqos;\r
-\r
- status = RpcStringBindingCompose(NULL,\r
- _T("ncalrpc"),\r
- NULL,\r
- NULL,\r
- NULL,\r
- &bindstring);\r
-\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcStringBindingCompose failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- status = RpcBindingFromStringBinding(bindstring,\r
- &hRpcBinding);\r
-\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcBindingFromStringBinding failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- status = RpcStringFree(&bindstring);\r
-\r
- ZeroMemory(&sqos, sizeof(sqos));\r
-\r
- sqos.Version = 1;\r
- sqos.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;\r
- sqos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;\r
- sqos.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;\r
-\r
- status = RpcBindingSetAuthInfoEx(hRpcBinding,\r
- NULL,\r
- RPC_C_AUTHN_LEVEL_CALL,\r
- RPC_C_AUTHN_WINNT,\r
- NULL,\r
- 0,\r
- &sqos);\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcBindingSetAuthInfoEx failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- return 0;\r
-}\r
-\r
-int cc_rpc_cleanup(void) {\r
- RPC_STATUS status;\r
-\r
- status = RpcBindingFree(&hRpcBinding);\r
-\r
- return 0;\r
-}\r
-\r
-cc_int32 cci_set_thread_session_id(unsigned char * client_name, LUID luid) {\r
- return 0;\r
-}\r
-\r
-void cci_get_thread_session_id(unsigned char * client_name, int len, LUID *pluid) {\r
- client_name[0] = '\0';\r
- pluid->HighPart = 0;\r
- pluid->LowPart = 0;\r
-}\r
-\r
-\r
-/* __int32 ccapi_Message(\r
- * [in] handle_t h,\r
- * [string][in] unsigned char *client_name,\r
- * [in] struct _LUID luid,\r
- * [in] __int32 cb_buffer,\r
- * [out] __int32 *cb_len,\r
- * [size_is][string][out] unsigned char buffer[ ]);\r
- */\r
-\r
-cc_int32 cci_perform_rpc(cc_msg_t *request, cc_msg_t **response)\r
-{\r
- cc_int32 code;\r
- unsigned char client_name[256];\r
- LUID luid;\r
- struct __LUID __luid;\r
- unsigned char out_buf[MAXMSGLEN];\r
- __int32 out_len = MAXMSGLEN;\r
-\r
- if (cc_rpc_init())\r
- return -1;\r
-\r
- cci_get_thread_session_id(client_name, sizeof(client_name), &luid);\r
-\r
- __luid.HighPart = luid.HighPart;\r
- __luid.LowPart = luid.LowPart;\r
-\r
- /* flatten response */\r
- code = cci_msg_flatten(request, NULL);\r
- if (code)\r
- goto cleanup;\r
-\r
- RpcTryExcept {\r
- code = ccapi_Message(hRpcBinding, client_name, __luid, \r
- request->flat, request->flat_len, \r
- out_buf, &out_len);\r
- } \r
- RpcExcept(1) {\r
- code = RpcExceptionCode();\r
- }\r
- RpcEndExcept;\r
- if (code)\r
- goto cleanup;\r
-\r
- /* unflatten message */\r
- code = cci_msg_unflatten(out_buf, out_len, response);\r
- if (code)\r
- goto cleanup;\r
-\r
- cleanup:\r
- return code;\r
-}\r
+++ /dev/null
-#include <windows.h>\r
-\r
-BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, \r
- LPVOID lpvReserved)\r
-{\r
- switch (fdwReason) {\r
- case DLL_PROCESS_ATTACH:\r
- case DLL_THREAD_ATTACH:\r
- case DLL_THREAD_DETACH:\r
- case DLL_PROCESS_DETACH:\r
- default:\r
- return TRUE;\r
- }\r
-}\r
-\r
+++ /dev/null
-[\r
- explicit_handle\r
-]\r
-\r
-interface portable_ccapi\r
-{\r
-\r
-}
\ No newline at end of file
+++ /dev/null
-[\r
- uuid(0012a1de-f7ad-44b0-b597-8ba53159c6fa),\r
- version(1.0),\r
- pointer_default(unique)\r
-]\r
-\r
-interface portable_ccapi\r
-{\r
- const short MAXMSGLEN = 65536;\r
-\r
- // Locally Unique Identifier\r
- //\r
-\r
- struct __LUID {\r
- __int32 LowPart;\r
- long HighPart;\r
- };\r
-\r
-\r
- // The Generic CCAPI Message RPC\r
-\r
- __int32 ccapi_Message (\r
- [in] handle_t h,\r
- [in, string] unsigned char * client_name,\r
- [in] struct __LUID luid,\r
- [in, length_is(in_len), size_is(MAXMSGLEN)] unsigned char in_buf[],\r
- [in] __int32 in_len,\r
- [out, length_is(*out_len), size_is(MAXMSGLEN)] unsigned char out_buf[],\r
- [out] __int32 * out_len);\r
-}\r
+++ /dev/null
-\r
-!include <win32.mak>\r
-\r
-{}.c{}.obj:\r
- $(CC) $(cdebug) $(cflags) /Fo"$@" /c $**\r
-\r
-EXECONLINK=link /NOLOGO $(conlibsmt) $(ldebug) $(conlflags) /OUT:$@ $**\r
-\r
-CLIENTEXE=csclient.exe\r
-\r
-SERVEREXE=csserver.exe\r
-\r
-SDKLIBS=rpcrt4.lib\r
-\r
-cstest_c.c cstest_s.c cstest.h: cstest.idl cstest.acf\r
- midl cstest.idl /acf cstest.acf\r
-\r
-$(CLIENTEXE): client.obj cstest_c.obj\r
- $(EXECONLINK) $(SDKLIBS)\r
-\r
-$(SERVEREXE): server.obj cstest_s.obj\r
- $(EXECONLINK) $(SDKLIBS)\r
-\r
-all: $(SERVEREXE) $(CLIENTEXE)\r
+++ /dev/null
-#include<windows.h>\r
-#include<stdio.h>\r
-#include<stdlib.h>\r
-#include<tchar.h>\r
-#include"cstest.h"\r
-#include<strsafe.h>\r
-\r
-void * __RPC_USER MIDL_user_allocate(size_t s) {\r
- return malloc(s);\r
-}\r
-\r
-void __RPC_USER MIDL_user_free(void * p) {\r
- free(p);\r
-}\r
-\r
-int main(int argc, char ** argv) {\r
- RPC_STATUS status;\r
- RPC_BINDING_HANDLE h;\r
- TCHAR * bindstring = NULL;\r
- RPC_SECURITY_QOS sqos;\r
- char inbuf[256];\r
- char outbuf[256];\r
- long cb_out;\r
-\r
- status = RpcStringBindingCompose(NULL,\r
- _T("ncalrpc"),\r
- NULL,\r
- NULL,\r
- NULL,\r
- &bindstring);\r
-\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcStringBindingCompose failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- status = RpcBindingFromStringBinding(bindstring,\r
- &h);\r
-\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcBindingFromStringBinding failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- ZeroMemory(&sqos, sizeof(sqos));\r
-\r
- sqos.Version = 1;\r
- sqos.Capabilities = RPC_C_QOS_CAPABILITIES_DEFAULT;\r
- sqos.IdentityTracking = RPC_C_QOS_IDENTITY_STATIC;\r
- sqos.ImpersonationType = RPC_C_IMP_LEVEL_IMPERSONATE;\r
-\r
- status = RpcBindingSetAuthInfoEx(h,\r
- NULL,\r
- RPC_C_AUTHN_LEVEL_CALL,\r
- RPC_C_AUTHN_WINNT,\r
- NULL,\r
- 0,\r
- &sqos);\r
-\r
- if (status != RPC_S_OK) {\r
- fprintf(stderr, "RpcBindingSetAuthInfoEx failed: %d\n",\r
- status);\r
- return 1;\r
- }\r
-\r
- StringCbCopyA(inbuf, sizeof(inbuf), "Echo Test 1");\r
- StringCbCopyA(outbuf, sizeof(outbuf), "Blank blank blank");\r
-\r
- printf("Before call: in[%s], out[%s]\n", inbuf, outbuf);\r
- cb_out = 0;\r
-\r
- status = EchoString(h, inbuf, sizeof(outbuf), &cb_out, outbuf);\r
-\r
- if (status) {\r
- printf("Call failed: status = %d\n", status);\r
- } else {\r
- printf("After call: out[%s], outlen[%d]\n", outbuf, cb_out);\r
- }\r
-\r
- status = RpcBindingFree(&h);\r
-\r
- status = RpcStringFree(&bindstring);\r
-\r
- return 0;\r
-}\r
+++ /dev/null
-[\r
- explicit_handle\r
-]\r
-\r
-interface ccapi_cstest\r
-{\r
-\r
-}
\ No newline at end of file
+++ /dev/null
-[\r
-uuid(c8b4a635-e9e4-4650-a073-b25610324950),\r
- version(1.0),\r
- pointer_default(unique)\r
-]\r
-\r
-interface ccapi_cstest\r
-{\r
- long EchoString([in] handle_t h,\r
- [in, string] unsigned char * in_str,\r
- [in] long cb_buffer,\r
- [out] long * cb_len,\r
- [out, string, size_is(cb_buffer)] unsigned char buffer[*]);\r
-}\r
+++ /dev/null
-#include<windows.h>\r
-#include<stdio.h>\r
-#include<process.h>\r
-#include<tchar.h>\r
-#include<rpc.h>\r
-#include"cstest.h"\r
-#include<strsafe.h>\r
-\r
-#define SVCNAME "CCAPICSTest"\r
-\r
-SERVICE_STATUS_HANDLE h_service_status = NULL;\r
-SERVICE_STATUS service_status;\r
-FILE * logfile = NULL;\r
-\r
-void begin_log(void) {\r
- char temppath[512];\r
-\r
- temppath[0] = L'\0';\r
-\r
- GetTempPathA(sizeof(temppath), temppath);\r
- StringCbCatA(temppath, sizeof(temppath), "csserverconn.log");\r
- logfile = fopen(temppath, "w");\r
-}\r
-\r
-void end_log(void) {\r
- if (logfile) {\r
- fclose(logfile);\r
- logfile = NULL;\r
- }\r
-}\r
-\r
-BOOL report_status(DWORD state,\r
- DWORD exit_code,\r
- DWORD wait_hint) {\r
- static DWORD checkpoint = 1;\r
- BOOL rv = TRUE;\r
-\r
- if (state == SERVICE_START_PENDING)\r
- service_status.dwControlsAccepted = 0;\r
- else\r
- service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;\r
-\r
- service_status.dwCurrentState = state;\r
- service_status.dwWin32ExitCode = exit_code;\r
- service_status.dwWaitHint = wait_hint;\r
-\r
- if (state == SERVICE_RUNNING ||\r
- state == SERVICE_STOPPED)\r
- service_status.dwCheckPoint = 0;\r
- else\r
- service_status.dwCheckPoint = checkpoint++;\r
-\r
- rv = SetServiceStatus(h_service_status, &service_status);\r
-\r
- return rv;\r
-}\r
-\r
-void service_start(DWORD argc, LPTSTR * argv) {\r
- RPC_STATUS status;\r
- RPC_BINDING_VECTOR * bv;\r
-\r
- status = RpcServerUseProtseq("ncalrpc",\r
- RPC_C_PROTSEQ_MAX_REQS_DEFAULT,\r
- NULL);\r
-\r
- if (status != RPC_S_OK) {\r
- return;\r
- }\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerRegisterIf(ccapi_cstest_v1_0_s_ifspec,\r
- 0, 0);\r
-\r
- if (status != RPC_S_OK)\r
- return;\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerInqBindings(&bv);\r
-\r
- if (status != RPC_S_OK)\r
- return;\r
-\r
- status = RpcEpRegister(ccapi_cstest_v1_0_s_ifspec,\r
- bv, 0, 0);\r
-\r
- if (status != RPC_S_OK)\r
- return;\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerRegisterAuthInfo(NULL,\r
- RPC_C_AUTHN_WINNT,\r
- 0, 0);\r
-\r
- if (status != RPC_S_OK)\r
- return;\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerListen(1,\r
- RPC_C_LISTEN_MAX_CALLS_DEFAULT,\r
- TRUE);\r
-\r
- if (status != RPC_S_OK)\r
- return;\r
-\r
- report_status(SERVICE_RUNNING, NO_ERROR, 0);\r
-\r
- begin_log();\r
-\r
- status = RpcMgmtWaitServerListen();\r
-\r
- end_log();\r
-\r
- RpcEpUnregister(ccapi_cstest_v1_0_s_ifspec, bv, 0);\r
-\r
- RpcBindingVectorFree(&bv);\r
-}\r
-\r
-void service_stop(void) {\r
- RpcMgmtStopServerListening(0);\r
-}\r
-\r
-void * __RPC_USER MIDL_user_allocate(size_t s) {\r
- return malloc(s);\r
-}\r
-\r
-void __RPC_USER MIDL_user_free(void * p) {\r
- free(p);\r
-}\r
-\r
-typedef struct tag_client_info {\r
- char client_name[512];\r
- LUID luid; \r
-} client_info_t;\r
-\r
-RPC_STATUS check_auth(handle_t h, client_info_t * client_info) {\r
- RPC_BINDING_HANDLE bh = (RPC_BINDING_HANDLE) h;\r
- RPC_STATUS status;\r
- HANDLE htoken = NULL;\r
- char name[256];\r
- char domain[256];\r
- DWORD name_len;\r
- DWORD domain_len;\r
- SID_NAME_USE snu = 0;\r
-\r
- struct {\r
- TOKEN_ORIGIN origin;\r
- char pad[512];\r
- } torigin;\r
-\r
- struct {\r
- TOKEN_OWNER owner;\r
- char pad[4096];\r
- } towner;\r
-\r
- DWORD len;\r
-\r
- status = RpcImpersonateClient(bh);\r
-\r
- if (status != RPC_S_OK)\r
- return status;\r
-\r
- if (!OpenThreadToken(GetCurrentThread(),\r
- TOKEN_READ | TOKEN_QUERY_SOURCE,\r
- FALSE,\r
- &htoken)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- len = 0;\r
-\r
- if (!GetTokenInformation(htoken,\r
- TokenOrigin,\r
- &torigin.origin,\r
- sizeof(torigin),\r
- &len)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- if (!GetTokenInformation(htoken,\r
- TokenOwner,\r
- &towner.owner,\r
- sizeof(towner),\r
- &len)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
-\r
- name_len = sizeof(name)/sizeof(name[0]);\r
- domain_len = sizeof(domain)/sizeof(domain[0]);\r
-\r
- if (!LookupAccountSidA(NULL,\r
- towner.owner.Owner,\r
- name,\r
- &name_len,\r
- domain,\r
- &domain_len,\r
- &snu)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- client_info->luid = torigin.origin.OriginatingLogonSession;\r
- StringCbPrintfA(client_info->client_name,\r
- sizeof(client_info->client_name),\r
- "%s\\%s", domain, name);\r
-\r
- status = 0;\r
-\r
- _cleanup:\r
-\r
- RpcRevertToSelf();\r
-\r
- return status;\r
-}\r
-\r
-long EchoString(\r
- /* [in] */ handle_t h,\r
- /* [string][in] */ unsigned char *in_str,\r
- /* [in] */ long cb_buffer,\r
- /* [out] */ long *cb_len,\r
- /* [size_is][string][out] */ unsigned char buffer[ ]) {\r
-\r
- size_t cb;\r
- long rv = 0;\r
- client_info_t client_info;\r
-\r
- rv = check_auth(h, &client_info);\r
-\r
- if (rv == 0 && logfile) {\r
- fprintf(logfile,\r
- "Client name [%s], LUID [%x:%x]\n",\r
- client_info.client_name,\r
- (client_info.luid.HighPart),\r
- (client_info.luid.LowPart));\r
- fflush(logfile);\r
- }\r
-\r
- if (!in_str) {\r
- rv = 1;\r
- if (cb_len)\r
- *cb_len = 0;\r
- if (buffer)\r
- buffer[0] = '\0';\r
- } else {\r
- if (FAILED(StringCbLengthA(in_str, 256, &cb))) {\r
- rv = 2;\r
- goto _exit_f;\r
- }\r
-\r
- cb += sizeof(char);\r
-\r
- if (((long)cb) > cb_buffer) {\r
- rv = 3;\r
- goto _exit_f;\r
- }\r
-\r
- *cb_len = cb;\r
-\r
- if (buffer)\r
- StringCbCopyA(buffer, cb_buffer, in_str);\r
-\r
- rv = 0;\r
- }\r
-\r
- _exit_f:\r
-\r
- return rv;\r
-}\r
-\r
-void WINAPI service_control(DWORD ctrl_code) {\r
- switch(ctrl_code) {\r
- case SERVICE_CONTROL_STOP:\r
- report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);\r
- service_stop();\r
- return;\r
-\r
- /* everything else falls through */\r
- }\r
-\r
- report_status(service_status.dwCurrentState, NO_ERROR, 0);\r
-}\r
-\r
-void WINAPI service_main(DWORD argc, LPTSTR * argv) {\r
-\r
- h_service_status = RegisterServiceCtrlHandler( _T(SVCNAME), service_control);\r
-\r
- if (!h_service_status)\r
- goto cleanup;\r
-\r
- ZeroMemory(&service_status, sizeof(service_status));\r
-\r
- service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;\r
- service_status.dwServiceSpecificExitCode = 0;\r
-\r
- if (!report_status(SERVICE_START_PENDING,\r
- NO_ERROR,\r
- 3000))\r
- goto cleanup;\r
-\r
- service_start(argc, argv);\r
-\r
- cleanup:\r
-\r
- if (h_service_status) {\r
- report_status(SERVICE_STOPPED, NO_ERROR, 0);\r
- }\r
-}\r
-\r
-\r
-BOOL\r
-IsInstalled()\r
-{\r
- BOOL bResult = FALSE;\r
- SC_HANDLE hSCM;\r
- SC_HANDLE hService;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (hSCM) {\r
-\r
- // Try to open the service\r
- hService = OpenService( hSCM,\r
- SVCNAME,\r
- SERVICE_QUERY_CONFIG);\r
- if (hService) {\r
- bResult = TRUE;\r
- CloseServiceHandle(hService);\r
- }\r
-\r
- CloseServiceHandle(hSCM);\r
- }\r
-\r
- return bResult;\r
-}\r
-\r
-BOOL\r
-Install()\r
-{\r
- char szFilePath[_MAX_PATH];\r
- SC_HANDLE hSCM;\r
- SC_HANDLE hService;\r
- TCHAR szKey[256];\r
- HKEY hKey = NULL;\r
- DWORD dwData;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (!hSCM)\r
- return FALSE;\r
-\r
- // Get the executable file path\r
- GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
-\r
- // Create the service\r
- hService = CreateService( hSCM,\r
- SVCNAME,\r
- SVCNAME,\r
- SERVICE_ALL_ACCESS,\r
- SERVICE_WIN32_OWN_PROCESS,\r
- SERVICE_AUTO_START, // start condition\r
- SERVICE_ERROR_NORMAL,\r
- szFilePath,\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL);\r
- if (!hService) {\r
- CloseServiceHandle(hSCM);\r
- return FALSE;\r
- }\r
-\r
- // make registry entries to support logging messages\r
- // Add the source name as a subkey under the Application\r
- // key in the EventLog service portion of the registry.\r
- StringCbCopyA(szKey, 256, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\IKSD");\r
- if (RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hKey) != ERROR_SUCCESS) {\r
- CloseServiceHandle(hService);\r
- CloseServiceHandle(hSCM);\r
- return FALSE;\r
- }\r
-\r
- // Add the Event ID message-file name to the 'EventMessageFile' subkey.\r
- RegSetValueEx( hKey,\r
- "EventMessageFile",\r
- 0,\r
- REG_EXPAND_SZ,\r
- (CONST BYTE*)szFilePath,\r
- strlen(szFilePath) + 1);\r
-\r
- // Set the supported types flags.\r
- dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;\r
- RegSetValueEx( hKey,\r
- "TypesSupported",\r
- 0,\r
- REG_DWORD,\r
- (CONST BYTE*)&dwData,\r
- sizeof(DWORD));\r
- RegCloseKey(hKey);\r
-\r
- // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, SVCNAME);\r
-\r
- // tidy up\r
- CloseServiceHandle(hService);\r
- CloseServiceHandle(hSCM);\r
- return TRUE;\r
-}\r
-\r
-BOOL\r
-Uninstall()\r
-{\r
- BOOL bResult = FALSE;\r
- SC_HANDLE hService;\r
- SC_HANDLE hSCM;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (!hSCM)\r
- return FALSE;\r
-\r
- hService = OpenService( hSCM,\r
- SVCNAME,\r
- DELETE);\r
- if (hService) {\r
- if (DeleteService(hService)) {\r
- // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_REMOVED, SVCNAME);\r
- bResult = TRUE;\r
- } else {\r
- // LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_NOTREMOVED, SVCNAME);\r
- }\r
- CloseServiceHandle(hService);\r
- }\r
-\r
- CloseServiceHandle(hSCM);\r
- return bResult;\r
-}\r
-\r
-\r
-// Returns TRUE if it found an arg it recognised, FALSE if not\r
-// Note: processing some arguments causes output to stdout to be generated.\r
-BOOL\r
-ParseStandardArgs(int argc, char* argv[])\r
-{\r
- char szFilePath[_MAX_PATH];\r
-\r
- // See if we have any command line args we recognize\r
- if (argc <= 1)\r
- return FALSE;\r
-\r
- if ( _stricmp(argv[1], "-h") == 0 ||\r
- _stricmp(argv[1], "-?") == 0 ||\r
- _stricmp(argv[1], "/h") == 0 ||\r
- _stricmp(argv[1], "/?") == 0) {\r
-\r
- //\r
- GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
- fprintf(stderr, "usage: %s [-v | -i | -u | -h]\r\n",szFilePath);\r
- return TRUE;\r
- } else if (_stricmp(argv[1], "-v") == 0 ||\r
- _stricmp(argv[1], "/v") == 0 ) {\r
-\r
- // Spit out version info\r
- fprintf(stderr, "%s Version 0.1\n",_T(SVCNAME));\r
- fprintf(stderr, "The service is %s installed\n",\r
- IsInstalled() ? "currently" : "not");\r
- return TRUE; // say we processed the argument\r
-\r
- } else if (_stricmp(argv[1], "-i") == 0 ||\r
- _stricmp(argv[1], "/i") == 0) {\r
-\r
- // Request to install.\r
- if (IsInstalled()) {\r
- fprintf(stderr, "%s is already installed\n", _T(SVCNAME));\r
- } else {\r
- // Try and install the copy that's running\r
- if (Install()) {\r
- fprintf(stderr, "%s installed\n", _T(SVCNAME));\r
- } else {\r
- fprintf(stderr, "%s failed to install. Error %d\n", _T(SVCNAME), GetLastError());\r
- }\r
- }\r
- return TRUE; // say we processed the argument\r
-\r
- } else if (_stricmp(argv[1], "-u") == 0 ||\r
- _stricmp(argv[1], "/u") == 0) {\r
-\r
- // Request to uninstall.\r
- if (!IsInstalled()) {\r
- fprintf(stderr, "%s is not installed\n", _T(SVCNAME));\r
- } else {\r
- // Try and remove the copy that's installed\r
- if (Uninstall()) {\r
- // Get the executable file path\r
- GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
- fprintf(stderr, "%s removed. (You must delete the file (%s) yourself.)\n"\r
- _T(SVCNAME), szFilePath);\r
- } else {\r
- fprintf(stderr, "Could not remove %s. Error %d\n", _T(SVCNAME), GetLastError());\r
- }\r
- }\r
- return TRUE; // say we processed the argument\r
-\r
- }\r
-\r
- // Don't recognise the args\r
- return FALSE;\r
-}\r
-\r
-int main(int argc, char ** argv) {\r
-\r
- SERVICE_TABLE_ENTRY dispatch_table[] = {\r
- { _T(SVCNAME), (LPSERVICE_MAIN_FUNCTION) service_main },\r
- { NULL, NULL }\r
- };\r
-\r
- if ( ParseStandardArgs(argc, argv) )\r
- return 0;\r
-\r
- if (!StartServiceCtrlDispatcher(dispatch_table)) {\r
- fprintf(stderr, "Can't start service control dispatcher\n");\r
- }\r
-\r
- return 0;\r
-}\r
+++ /dev/null
-\r
-#include <windows.h>\r
-#include "msg.h"\r
-#include "marshall.h"\r
-#include "serv_ops.h"\r
-#include "datastore.h"\r
-#include <stdio.h>\r
-#include <process.h>\r
-#include <tchar.h>\r
-#include <rpc.h>\r
-#include <rpcndr.h>\r
-#include "ntccrpc.h"\r
-#include <strsafe.h>\r
-\r
-#define SVCNAME "MIT_CCAPI_NT_Service"\r
-\r
-HANDLE hMainThread = 0;\r
-HANDLE WaitToTerminate = 0;\r
-\r
-SERVICE_STATUS_HANDLE h_service_status = NULL;\r
-SERVICE_STATUS service_status;\r
-FILE * logfile = NULL;\r
-\r
-/* Log File */\r
-void begin_log(void) {\r
- char temppath[512];\r
-\r
- temppath[0] = L'\0';\r
-\r
- GetTempPathA(sizeof(temppath), temppath);\r
- StringCbCatA(temppath, sizeof(temppath), "mit_nt_ccapi.log");\r
- logfile = fopen(temppath, "w");\r
-}\r
-\r
-void end_log(void) {\r
- if (logfile) {\r
- fclose(logfile);\r
- logfile = NULL;\r
- }\r
-}\r
-\r
-BOOL report_status(DWORD state,\r
- DWORD exit_code,\r
- DWORD wait_hint) {\r
- static DWORD checkpoint = 1;\r
- BOOL rv = TRUE;\r
-\r
- if (state == SERVICE_START_PENDING)\r
- service_status.dwControlsAccepted = 0;\r
- else\r
- service_status.dwControlsAccepted = SERVICE_ACCEPT_STOP;\r
-\r
- service_status.dwCurrentState = state;\r
- service_status.dwWin32ExitCode = exit_code;\r
- service_status.dwWaitHint = wait_hint;\r
-\r
- if (state == SERVICE_RUNNING ||\r
- state == SERVICE_STOPPED)\r
- service_status.dwCheckPoint = 0;\r
- else\r
- service_status.dwCheckPoint = checkpoint++;\r
-\r
- rv = SetServiceStatus(h_service_status, &service_status);\r
-\r
- return rv;\r
-}\r
-\r
-void service_start(DWORD argc, LPTSTR * argv) {\r
- RPC_STATUS status;\r
- RPC_BINDING_VECTOR * bv;\r
-\r
- status = RpcServerUseProtseq("ncalrpc",\r
- RPC_C_PROTSEQ_MAX_REQS_DEFAULT,\r
- NULL);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcServerUseProtseq = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerRegisterIf(portable_ccapi_v1_0_s_ifspec,\r
- 0, 0);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcServerRegisterIf = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerInqBindings(&bv);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcServerInqBindings = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- status = RpcEpRegister(portable_ccapi_v1_0_s_ifspec,\r
- bv, 0, 0);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcEpRegister = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerRegisterAuthInfo(NULL,\r
- RPC_C_AUTHN_WINNT,\r
- 0, 0);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcServerRegisterAuthInfo = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- report_status(SERVICE_START_PENDING, NO_ERROR, 3000);\r
-\r
- status = RpcServerListen(2,\r
- RPC_C_LISTEN_MAX_CALLS_DEFAULT,\r
- TRUE);\r
-\r
- if (status != RPC_S_OK) {\r
- if (logfile) fprintf(logfile, "service_start RpcServerListen = 0x%x\n", status);\r
- goto cleanup;\r
- }\r
-\r
- report_status(SERVICE_RUNNING, NO_ERROR, 0);\r
-\r
-\r
- if (logfile) fprintf(logfile, "service_start calling RpcMgmtWaitServerListen\n");\r
- status = RpcMgmtWaitServerListen();\r
- if (logfile) fprintf(logfile, "service_start RpcMgmtWaitServerListen = 0x%x\n", status);\r
-\r
- cleanup:\r
- RpcEpUnregister(portable_ccapi_v1_0_s_ifspec, bv, 0);\r
-\r
- RpcBindingVectorFree(&bv);\r
-}\r
-\r
-void service_stop(void) {\r
- if (logfile) fprintf(logfile, "service_stop\n");\r
- RpcMgmtStopServerListening(0);\r
-}\r
-\r
-void * __RPC_USER MIDL_user_allocate(size_t s) {\r
- return malloc(s);\r
-}\r
-\r
-void __RPC_USER MIDL_user_free(void * p) {\r
- free(p);\r
-}\r
-\r
-typedef struct tag_client_info {\r
- char client_name[512];\r
- LUID luid; \r
-} client_info_t;\r
-\r
-int obtain_auth_info(client_info_t * client_info, cc_auth_info_t ** pauth_info)\r
-{\r
- *pauth_info = (cc_auth_info_t *)malloc(sizeof(cc_auth_info_t));\r
- if ( !*pauth_info )\r
- return ccErrNoMem;\r
- \r
- (*pauth_info)->len = strlen(client_info->client_name) + 1;\r
- (*pauth_info)->info = malloc((*pauth_info)->len);\r
- if ( !(*pauth_info)->info ) {\r
- free(*pauth_info);\r
- return ccErrNoMem;\r
- }\r
-\r
- memcpy((*pauth_info)->info, client_info->client_name, (*pauth_info)->len);\r
- \r
- return 0;\r
-}\r
-\r
-void destroy_auth_info(cc_auth_info_t *auth_info)\r
-{\r
- free(auth_info->info);\r
- free(auth_info);\r
-}\r
-\r
-int obtain_session_info(client_info_t * client_info, cc_session_info_t ** psession_info)\r
-{\r
- *psession_info = (cc_session_info_t *)malloc(sizeof(cc_session_info_t));\r
- if ( !*psession_info )\r
- return ccErrNoMem;\r
- \r
- (*psession_info)->len = sizeof(LUID);\r
- (*psession_info)->info = malloc((*psession_info)->len);\r
- if ( !(*psession_info)->info ) {\r
- free(*psession_info);\r
- return ccErrNoMem;\r
- }\r
-\r
- memcpy((*psession_info)->info, &client_info->luid, (*psession_info)->len);\r
- \r
- return 0;\r
-}\r
-\r
-void destroy_session_info(cc_session_info_t *session_info)\r
-{\r
- free(session_info->info);\r
- free(session_info);\r
-}\r
-\r
-RPC_STATUS check_auth(handle_t h, client_info_t * client_info) {\r
- RPC_BINDING_HANDLE bh = (RPC_BINDING_HANDLE) h;\r
- RPC_STATUS status;\r
- HANDLE htoken = NULL;\r
- char name[256];\r
- char domain[256];\r
- DWORD name_len;\r
- DWORD domain_len;\r
- SID_NAME_USE snu = 0;\r
-\r
- struct {\r
- TOKEN_ORIGIN origin;\r
- char pad[512];\r
- } torigin;\r
-\r
- struct {\r
- TOKEN_OWNER owner;\r
- char pad[4096];\r
- } towner;\r
-\r
- DWORD len;\r
-\r
- status = RpcImpersonateClient(bh);\r
-\r
- if (status != RPC_S_OK)\r
- return status;\r
-\r
- if (!OpenThreadToken(GetCurrentThread(),\r
- TOKEN_READ | TOKEN_QUERY_SOURCE,\r
- FALSE,\r
- &htoken)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- len = 0;\r
-\r
- if (!GetTokenInformation(htoken,\r
- TokenOrigin,\r
- &torigin.origin,\r
- sizeof(torigin),\r
- &len)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- if (!GetTokenInformation(htoken,\r
- TokenOwner,\r
- &towner.owner,\r
- sizeof(towner),\r
- &len)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
-\r
- name_len = sizeof(name)/sizeof(name[0]);\r
- domain_len = sizeof(domain)/sizeof(domain[0]);\r
-\r
- if (!LookupAccountSidA(NULL,\r
- towner.owner.Owner,\r
- name,\r
- &name_len,\r
- domain,\r
- &domain_len,\r
- &snu)) {\r
- status = GetLastError();\r
- goto _cleanup;\r
- }\r
-\r
- client_info->luid = torigin.origin.OriginatingLogonSession;\r
- StringCbPrintfA(client_info->client_name,\r
- sizeof(client_info->client_name),\r
- "%s\\%s", domain, name);\r
-\r
- status = 0;\r
-\r
- _cleanup:\r
-\r
- RpcRevertToSelf();\r
-\r
- return status;\r
-}\r
-\r
-__int32 ccapi_Message( \r
- /* [in] */ handle_t h,\r
- /* [string][in] */ unsigned char *client_name,\r
- /* [in] */ struct __LUID luid,\r
- /* [size_is][length_is][in] */ unsigned char in_buf[],\r
- /* [in] */ __int32 in_len,\r
- /* [size_is][length_is][out] */ unsigned char out_buf[],\r
- /* [out] */ __int32 *out_len)\r
-{\r
- client_info_t client_info;\r
- cc_msg_t * msg = NULL;\r
- cc_msg_t * resp = NULL;\r
- cc_auth_info_t * auth_info = NULL;\r
- cc_session_info_t * session_info = NULL;\r
- cc_int32 code;\r
-\r
- if (logfile) fprintf(logfile, "ccapi_Message\n");\r
-\r
- if ( ccs_serv_initialize() != ccNoError ) {\r
- code = ccErrServerUnavailable;\r
- goto done;\r
- }\r
-\r
- code = check_auth(h, &client_info);\r
- if (code == 0) {\r
- if (!strcmp("SYSTEM",client_info.client_name) &&\r
- client_info.luid.HighPart == 0 &&\r
- client_info.luid.LowPart == 0 &&\r
- client_name != NULL &&\r
- client_name[0] != '\0') {\r
- StringCbPrintfA(client_info.client_name,\r
- sizeof(client_info.client_name),\r
- "%s", client_name);\r
- client_info.luid.HighPart = luid.HighPart;\r
- client_info.luid.LowPart = luid.LowPart;\r
- }\r
- } else {\r
- code = ccErrServerCantBecomeUID;\r
- goto done;\r
- }\r
-\r
- /* allocate message */\r
- msg = (cc_msg_t *)malloc(sizeof(cc_msg_t));\r
- if (!msg) {\r
- code = ccErrNoMem;\r
- goto done;\r
- }\r
-\r
- /* unflatten message */\r
- code = cci_msg_unflatten(in_buf, in_len, &msg);\r
- if (code)\r
- goto cleanup;\r
-\r
- /* obtain auth info */\r
- code = obtain_auth_info(&client_info, &auth_info);\r
- if (code)\r
- goto cleanup;\r
-\r
- /* obtain session info */\r
- code = obtain_session_info(&client_info, &session_info);\r
- if (code)\r
- goto cleanup;\r
-\r
- /* process message */\r
- code = ccs_serv_process_msg(msg, auth_info, session_info, &resp);\r
- if (code)\r
- goto cleanup;\r
-\r
- /* flatten response */\r
- code = cci_msg_flatten(resp, NULL);\r
- if (code)\r
- goto cleanup;\r
-\r
- /* send response */\r
- if (resp->flat_len > MAXMSGLEN) {\r
- code = ccErrBadInternalMessage;\r
- goto cleanup;\r
- }\r
- memcpy(out_buf, resp->flat, resp->flat_len);\r
- *out_len = resp->flat_len;\r
- code = ccNoError;\r
-\r
- cleanup:\r
- if (auth_info)\r
- destroy_auth_info(auth_info);\r
-\r
- if (session_info)\r
- destroy_session_info(session_info);\r
-\r
- /* free message */\r
- if (msg)\r
- cci_msg_destroy(msg);\r
-\r
- /* free response */\r
- if (resp)\r
- cci_msg_destroy(resp);\r
-\r
- done:\r
- return code ? -1 : 0;\r
-}\r
-\r
-void WINAPI service_control(DWORD ctrl_code) {\r
- switch(ctrl_code) {\r
- case SERVICE_CONTROL_STOP:\r
- report_status(SERVICE_STOP_PENDING, NO_ERROR, 0);\r
- service_stop();\r
- return;\r
-\r
- /* everything else falls through */\r
- }\r
-\r
- report_status(service_status.dwCurrentState, NO_ERROR, 0);\r
-}\r
-\r
-void WINAPI service_main(DWORD argc, LPTSTR * argv) {\r
-\r
- begin_log();\r
-\r
- h_service_status = RegisterServiceCtrlHandler( _T(SVCNAME), service_control);\r
-\r
- if (!h_service_status)\r
- goto cleanup;\r
-\r
- ZeroMemory(&service_status, sizeof(service_status));\r
-\r
- service_status.dwServiceType = SERVICE_WIN32_OWN_PROCESS;\r
- service_status.dwServiceSpecificExitCode = 0;\r
-\r
- if (!report_status(SERVICE_START_PENDING,\r
- NO_ERROR,\r
- 3000))\r
- goto cleanup;\r
-\r
- service_start(argc, argv);\r
-\r
- cleanup:\r
-\r
- if (h_service_status) {\r
- report_status(SERVICE_STOPPED, NO_ERROR, 0);\r
- }\r
-\r
- end_log();\r
-}\r
-\r
-\r
-BOOL\r
-IsInstalled()\r
-{\r
- BOOL bResult = FALSE;\r
- SC_HANDLE hSCM;\r
- SC_HANDLE hService;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (hSCM) {\r
-\r
- // Try to open the service\r
- hService = OpenService( hSCM,\r
- SVCNAME,\r
- SERVICE_QUERY_CONFIG);\r
- if (hService) {\r
- bResult = TRUE;\r
- CloseServiceHandle(hService);\r
- }\r
-\r
- CloseServiceHandle(hSCM);\r
- }\r
-\r
- return bResult;\r
-}\r
-\r
-BOOL\r
-Install()\r
-{\r
- char szFilePath[_MAX_PATH];\r
- SC_HANDLE hSCM;\r
- SC_HANDLE hService;\r
- TCHAR szKey[256];\r
- HKEY hKey = NULL;\r
- DWORD dwData;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (!hSCM)\r
- return FALSE;\r
-\r
- // Get the executable file path\r
- GetModuleFileName(NULL, szFilePath, sizeof(szFilePath));\r
-\r
- // Create the service\r
- hService = CreateService( hSCM,\r
- SVCNAME,\r
- SVCNAME,\r
- SERVICE_ALL_ACCESS,\r
- SERVICE_WIN32_OWN_PROCESS,\r
- SERVICE_AUTO_START, // start condition\r
- SERVICE_ERROR_NORMAL,\r
- szFilePath,\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL,\r
- NULL);\r
- if (!hService) {\r
- CloseServiceHandle(hSCM);\r
- return FALSE;\r
- }\r
-\r
- // make registry entries to support logging messages\r
- // Add the source name as a subkey under the Application\r
- // key in the EventLog service portion of the registry.\r
- StringCbCopyA(szKey, 256, "SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\IKSD");\r
- if (RegCreateKey(HKEY_LOCAL_MACHINE, szKey, &hKey) != ERROR_SUCCESS) {\r
- CloseServiceHandle(hService);\r
- CloseServiceHandle(hSCM);\r
- return FALSE;\r
- }\r
-\r
- // Add the Event ID message-file name to the 'EventMessageFile' subkey.\r
- RegSetValueEx( hKey,\r
- "EventMessageFile",\r
- 0,\r
- REG_EXPAND_SZ,\r
- (CONST BYTE*)szFilePath,\r
- strlen(szFilePath) + 1);\r
-\r
- // Set the supported types flags.\r
- dwData = EVENTLOG_ERROR_TYPE | EVENTLOG_WARNING_TYPE | EVENTLOG_INFORMATION_TYPE;\r
- RegSetValueEx( hKey,\r
- "TypesSupported",\r
- 0,\r
- REG_DWORD,\r
- (CONST BYTE*)&dwData,\r
- sizeof(DWORD));\r
- RegCloseKey(hKey);\r
-\r
- // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_INSTALLED, SVCNAME);\r
-\r
- // tidy up\r
- CloseServiceHandle(hService);\r
- CloseServiceHandle(hSCM);\r
- return TRUE;\r
-}\r
-\r
-BOOL\r
-Uninstall()\r
-{\r
- BOOL bResult = FALSE;\r
- SC_HANDLE hService;\r
- SC_HANDLE hSCM;\r
-\r
- // Open the Service Control Manager\r
- hSCM = OpenSCManager( NULL, // local machine\r
- NULL, // ServicesActive database\r
- SC_MANAGER_ALL_ACCESS); // full access\r
- if (!hSCM)\r
- return FALSE;\r
-\r
- hService = OpenService( hSCM,\r
- _T(SVCNAME),\r
- DELETE);\r
- if (hService) {\r
- if (DeleteService(hService)) {\r
- // LogEvent(EVENTLOG_INFORMATION_TYPE, EVMSG_REMOVED, SVCNAME);\r
- bResult = TRUE;\r
- } else {\r
- // LogEvent(EVENTLOG_ERROR_TYPE, EVMSG_NOTREMOVED, SVCNAME);\r
- }\r
- CloseServiceHandle(hService);\r
- }\r
-\r
- CloseServiceHandle(hSCM);\r
- return bResult;\r
-}\r
-\r
-\r
-// Returns TRUE if it found an arg it recognised, FALSE if not\r
-// Note: processing some arguments causes output to stdout to be generated.\r
-BOOL\r
-ParseStandardArgs(int argc, char* argv[])\r
-{\r
- char szFilePath[_MAX_PATH]="not a file name";\r
-\r
- // See if we have any command line args we recognize\r
- if (argc <= 1)\r
- return FALSE;\r
-\r
- if ( _stricmp(argv[1], "-h") == 0 ||\r
- _stricmp(argv[1], "-?") == 0 ||\r
- _stricmp(argv[1], "/h") == 0 ||\r
- _stricmp(argv[1], "/?") == 0) {\r
-\r
- //\r
- GetModuleFileNameA(NULL, szFilePath, sizeof(szFilePath));\r
- fprintf(stderr, "usage: %s [-v | -i | -u | -h]\r\n",szFilePath);\r
- return TRUE;\r
- } else if (_stricmp(argv[1], "-v") == 0 ||\r
- _stricmp(argv[1], "/v") == 0 ) {\r
-\r
- // Spit out version info\r
- fprintf(stderr, "%s Version 0.1\n",_T(SVCNAME));\r
- fprintf(stderr, "The service is %s installed\n",\r
- IsInstalled() ? "currently" : "not");\r
- return TRUE; // say we processed the argument\r
-\r
- } else if (_stricmp(argv[1], "-i") == 0 ||\r
- _stricmp(argv[1], "/i") == 0) {\r
-\r
- // Request to install.\r
- if (IsInstalled()) {\r
- fprintf(stderr, "%s is already installed\n", _T(SVCNAME));\r
- } else {\r
- // Try and install the copy that's running\r
- if (Install()) {\r
- fprintf(stderr, "%s installed\n", _T(SVCNAME));\r
- } else {\r
- fprintf(stderr, "%s failed to install. Error %d\n", _T(SVCNAME), GetLastError());\r
- }\r
- }\r
- return TRUE; // say we processed the argument\r
-\r
- } else if (_stricmp(argv[1], "-u") == 0 ||\r
- _stricmp(argv[1], "/u") == 0) {\r
-\r
- // Request to uninstall.\r
- if (!IsInstalled()) {\r
- fprintf(stderr, "%s is not installed\n", _T(SVCNAME));\r
- } else {\r
- // Try and remove the copy that's installed\r
- if (Uninstall()) {\r
- // Get the executable file path\r
- GetModuleFileNameA(NULL, szFilePath, sizeof(szFilePath));\r
- fprintf(stderr, "%s removed. (You must delete the file (%s) yourself.)\n",\r
- _T(SVCNAME), szFilePath);\r
- } else {\r
- fprintf(stderr, "Could not remove %s. Error %d\n", _T(SVCNAME), GetLastError());\r
- }\r
- }\r
- return TRUE; // say we processed the argument\r
-\r
- }\r
-\r
- // Don't recognise the args\r
- return FALSE;\r
-}\r
-\r
-DWORD __stdcall Main_thread(void* notUsed)\r
-{\r
- char * argv[2] = {SVCNAME, NULL};\r
- begin_log();\r
- service_start(1, (LPTSTR*)argv);\r
- end_log();\r
- return(0);\r
-}\r
-\r
-int main(int argc, char ** argv) {\r
- SERVICE_TABLE_ENTRY dispatch_table[] = {\r
- { _T(SVCNAME), (LPSERVICE_MAIN_FUNCTION) service_main },\r
- { NULL, NULL }\r
- };\r
-\r
- if ( ParseStandardArgs(argc, argv) )\r
- return 0;\r
-\r
- if (!StartServiceCtrlDispatcher(dispatch_table)) {\r
- LONG status = GetLastError();\r
- if (status == ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)\r
- {\r
- DWORD tid;\r
- hMainThread = CreateThread(NULL, 0, Main_thread, 0, 0, &tid);\r
-\r
- printf("Hit <Enter> to terminate MIT CCAPI Server\n");\r
- getchar();\r
- service_stop();\r
- }\r
- }\r
-\r
- if ( hMainThread ) {\r
- WaitForSingleObject( hMainThread, INFINITE );\r
- CloseHandle( hMainThread );\r
- }\r
- return 0;\r
-}\r