diff options
| author | Alexandra Ellwood <lxs@mit.edu> | 2008-09-30 21:23:17 +0000 |
|---|---|---|
| committer | Alexandra Ellwood <lxs@mit.edu> | 2008-09-30 21:23:17 +0000 |
| commit | 89db2820d03f280d0bf0e217d520e89c2bb8acd2 (patch) | |
| tree | baf4c5e5930974bf928509aea9d511d947b623f2 /src/ccapi/lib | |
| parent | 6b6d24e1ae0aadffb9062ac94ae8e600e09dbef0 (diff) | |
| download | krb5-89db2820d03f280d0bf0e217d520e89c2bb8acd2.tar.gz krb5-89db2820d03f280d0bf0e217d520e89c2bb8acd2.tar.xz krb5-89db2820d03f280d0bf0e217d520e89c2bb8acd2.zip | |
CCAPI should use common ipc and stream code
KIM and CCAPI should share the same IPC and stream object types.
Modified CCAPI to use code in src/util (stream) and src/util/mac (ipc)
ticket: new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20787 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/lib')
| -rw-r--r-- | src/ccapi/lib/ccapi_ccache.c | 132 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_ccache.h | 2 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_ccache_iterator.c | 10 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_ccache_iterator.h | 2 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_context.c | 118 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_credentials.c | 4 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_credentials.h | 4 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_credentials_iterator.c | 10 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_credentials_iterator.h | 2 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_ipc.c | 28 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_ipc.h | 8 | ||||
| -rw-r--r-- | src/ccapi/lib/ccapi_os_ipc.h | 4 | ||||
| -rw-r--r-- | src/ccapi/lib/mac/ccapi_os_ipc.c | 242 | ||||
| -rw-r--r-- | src/ccapi/lib/win/ccapi_os_ipc.cxx | 16 | ||||
| -rw-r--r-- | src/ccapi/lib/win/ccs_reply_proc.c | 6 | ||||
| -rw-r--r-- | src/ccapi/lib/win/debug.exports | 6 |
16 files changed, 187 insertions, 407 deletions
diff --git a/src/ccapi/lib/ccapi_ccache.c b/src/ccapi/lib/ccapi_ccache.c index cdef6a5d00..57c6f83aa3 100644 --- a/src/ccapi/lib/ccapi_ccache.c +++ b/src/ccapi/lib/ccapi_ccache.c @@ -121,7 +121,7 @@ cc_int32 cci_ccache_new (cc_ccache_t *out_ccache, /* ------------------------------------------------------------------------ */ cc_int32 cci_ccache_write (cc_ccache_t in_ccache, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; @@ -208,7 +208,7 @@ cc_int32 ccapi_ccache_get_credentials_version (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_credentials_version) { err = cci_check_error (ccErrBadParam); } @@ -221,10 +221,10 @@ cc_int32 ccapi_ccache_get_credentials_version (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_uint32 (reply, out_credentials_version); + err = k5_ipc_stream_read_uint32 (reply, out_credentials_version); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -236,7 +236,7 @@ cc_int32 ccapi_ccache_get_name (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; char *name = NULL; if (!in_ccache) { err = cci_check_error (ccErrBadParam); } @@ -250,15 +250,15 @@ cc_int32 ccapi_ccache_get_name (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_string (reply, &name); + err = k5_ipc_stream_read_string (reply, &name); } if (!err) { err = cci_string_new (out_name, name); } - cci_stream_release (reply); - free (name); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (name); return cci_check_error (err); } @@ -271,19 +271,19 @@ cc_int32 ccapi_ccache_get_principal (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; char *principal = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_principal) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -294,16 +294,16 @@ cc_int32 ccapi_ccache_get_principal (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_string (reply, &principal); + err = k5_ipc_stream_read_string (reply, &principal); } if (!err) { err = cci_string_new (out_principal, principal); } - cci_stream_release (request); - cci_stream_release (reply); - free (principal); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (principal); return cci_check_error (err); } @@ -316,21 +316,21 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_principal) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -340,7 +340,7 @@ cc_int32 ccapi_ccache_set_principal (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -352,13 +352,13 @@ cc_int32 ccapi_ccache_store_credentials (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_credentials_union) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -372,7 +372,7 @@ cc_int32 ccapi_ccache_store_credentials (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -384,13 +384,13 @@ cc_int32 ccapi_ccache_remove_credentials (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache ) { err = cci_check_error (ccErrBadParam); } if (!in_credentials) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -404,7 +404,7 @@ cc_int32 ccapi_ccache_remove_credentials (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -416,7 +416,7 @@ cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_cc { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } @@ -437,7 +437,7 @@ cc_int32 ccapi_ccache_new_credentials_iterator (cc_ccache_t in_cc err = cci_credentials_iterator_new (out_credentials_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -453,13 +453,13 @@ cc_int32 ccapi_ccache_move (cc_ccache_t io_source_ccache, cc_int32 err = ccNoError; cci_ccache_t source_ccache = (cci_ccache_t) io_source_ccache; cci_ccache_t destination_ccache = (cci_ccache_t) io_destination_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_source_ccache ) { err = cci_check_error (ccErrBadParam); } if (!io_destination_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { @@ -473,7 +473,7 @@ cc_int32 ccapi_ccache_move (cc_ccache_t io_source_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -486,20 +486,20 @@ cc_int32 ccapi_ccache_lock (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_lock_type); + err = k5_ipc_stream_write_uint32 (request, in_lock_type); } if (!err) { - err = cci_stream_write_uint32 (request, in_block); + err = k5_ipc_stream_write_uint32 (request, in_block); } if (!err) { @@ -509,7 +509,7 @@ cc_int32 ccapi_ccache_lock (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -540,7 +540,7 @@ cc_int32 ccapi_ccache_get_last_default_time (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_last_default_time) { err = cci_check_error (ccErrBadParam); } @@ -553,10 +553,10 @@ cc_int32 ccapi_ccache_get_last_default_time (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_last_default_time); + err = k5_ipc_stream_read_time (reply, out_last_default_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -568,7 +568,7 @@ cc_int32 ccapi_ccache_get_change_time (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_change_time) { err = cci_check_error (ccErrBadParam); } @@ -581,10 +581,10 @@ cc_int32 ccapi_ccache_get_change_time (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_change_time); + err = k5_ipc_stream_read_time (reply, out_change_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -595,17 +595,17 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache) { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_time (request, ccache->last_wait_for_change_time); + err = k5_ipc_stream_write_time (request, ccache->last_wait_for_change_time); } if (!err) { @@ -616,11 +616,11 @@ cc_int32 ccapi_ccache_wait_for_change (cc_ccache_t in_ccache) } if (!err) { - err = cci_stream_read_time (reply, &ccache->last_wait_for_change_time); + err = k5_ipc_stream_read_time (reply, &ccache->last_wait_for_change_time); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -656,18 +656,18 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) in_ccache; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_ccache ) { err = cci_check_error (ccErrBadParam); } if (!out_time_offset) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -678,11 +678,11 @@ cc_int32 ccapi_ccache_get_kdc_time_offset (cc_ccache_t in_ccache, } if (!err) { - err = cci_stream_read_time (reply, out_time_offset); + err = k5_ipc_stream_read_time (reply, out_time_offset); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -695,20 +695,20 @@ cc_int32 ccapi_ccache_set_kdc_time_offset (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { - err = cci_stream_write_time (request, in_time_offset); + err = k5_ipc_stream_write_time (request, in_time_offset); } if (!err) { @@ -718,7 +718,7 @@ cc_int32 ccapi_ccache_set_kdc_time_offset (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -730,16 +730,16 @@ cc_int32 ccapi_ccache_clear_kdc_time_offset (cc_ccache_t io_ccache, { cc_int32 err = ccNoError; cci_ccache_t ccache = (cci_ccache_t) io_ccache; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!io_ccache) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_credentials_version); + err = k5_ipc_stream_write_uint32 (request, in_credentials_version); } if (!err) { @@ -749,7 +749,7 @@ cc_int32 ccapi_ccache_clear_kdc_time_offset (cc_ccache_t io_ccache, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_ccache.h b/src/ccapi/lib/ccapi_ccache.h index 73091b7a0d..1a449c2fb1 100644 --- a/src/ccapi/lib/ccapi_ccache.h +++ b/src/ccapi/lib/ccapi_ccache.h @@ -35,7 +35,7 @@ cc_int32 cci_ccache_new (cc_ccache_t *out_ccache, cc_int32 ccapi_ccache_release (cc_ccache_t io_ccache); cc_int32 cci_ccache_write (cc_ccache_t in_ccache, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_ccache_destroy (cc_ccache_t io_ccache); diff --git a/src/ccapi/lib/ccapi_ccache_iterator.c b/src/ccapi/lib/ccapi_ccache_iterator.c index 1d4dd6c556..0f5d241f94 100644 --- a/src/ccapi/lib/ccapi_ccache_iterator.c +++ b/src/ccapi/lib/ccapi_ccache_iterator.c @@ -100,7 +100,7 @@ cc_int32 cci_ccache_iterator_new (cc_ccache_iterator_t *out_ccache_iterator, /* ------------------------------------------------------------------------ */ cc_int32 cci_ccache_iterator_write (cc_ccache_iterator_t in_ccache_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; @@ -160,7 +160,7 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator, { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_ccache_iterator) { err = cci_check_error (ccErrBadParam); } @@ -193,7 +193,7 @@ cc_int32 ccapi_ccache_iterator_next (cc_ccache_iterator_t in_ccache_iterator, err = cci_ccache_new (out_ccache, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -206,7 +206,7 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator, { cc_int32 err = ccNoError; cci_ccache_iterator_t ccache_iterator = (cci_ccache_iterator_t) in_ccache_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cc_uint32 initialized = 0; cci_identifier_t identifier = NULL; @@ -240,7 +240,7 @@ cc_int32 ccapi_ccache_iterator_clone (cc_ccache_iterator_t in_ccache_iterator, } cci_identifier_release (identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_ccache_iterator.h b/src/ccapi/lib/ccapi_ccache_iterator.h index 8b07b07639..9556aa0eb2 100644 --- a/src/ccapi/lib/ccapi_ccache_iterator.h +++ b/src/ccapi/lib/ccapi_ccache_iterator.h @@ -33,7 +33,7 @@ cc_int32 cci_ccache_iterator_new (cc_ccache_iterator_t *out_ccache_iterator, cci_identifier_t in_identifier); cc_int32 cci_ccache_iterator_write (cc_ccache_iterator_t in_ccache_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_ccache_iterator_release (cc_ccache_iterator_t io_ccache_iterator); diff --git a/src/ccapi/lib/ccapi_context.c b/src/ccapi/lib/ccapi_context.c index 3e405679f9..0f1712ea48 100644 --- a/src/ccapi/lib/ccapi_context.c +++ b/src/ccapi/lib/ccapi_context.c @@ -233,7 +233,7 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } if (!out_change_time) { err = cci_check_error (ccErrBadParam); } @@ -248,11 +248,11 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, NULL, &reply); } - if (!err && cci_stream_size (reply) > 0) { + if (!err && k5_ipc_stream_size (reply) > 0) { cc_time_t change_time = 0; /* got a response from the server */ - err = cci_stream_read_time (reply, &change_time); + err = k5_ipc_stream_read_time (reply, &change_time); if (!err) { err = cci_context_change_time_update (context->identifier, @@ -264,7 +264,7 @@ cc_int32 ccapi_context_get_change_time (cc_context_t in_context, err = cci_context_change_time_get (out_change_time); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -275,17 +275,17 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context) { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_time (request, context->last_wait_for_change_time); + err = k5_ipc_stream_write_time (request, context->last_wait_for_change_time); } if (!err) { @@ -300,11 +300,11 @@ cc_int32 ccapi_context_wait_for_change (cc_context_t in_context) } if (!err) { - err = cci_stream_read_time (reply, &context->last_wait_for_change_time); + err = k5_ipc_stream_read_time (reply, &context->last_wait_for_change_time); } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -316,7 +316,7 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; char *reply_name = NULL; char *name = NULL; @@ -335,9 +335,9 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { /* got a response from the server */ - err = cci_stream_read_string (reply, &reply_name); + err = k5_ipc_stream_read_string (reply, &reply_name); if (!err) { name = reply_name; @@ -351,8 +351,8 @@ cc_int32 ccapi_context_get_default_ccache_name (cc_context_t in_context, err = cci_string_new (out_name, name); } - cci_stream_release (reply); - free (reply_name); + k5_ipc_stream_release (reply); + k5_ipc_stream_free_string (reply_name); return cci_check_error (err); } @@ -365,8 +365,8 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -374,11 +374,11 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_string (request, in_name); + err = k5_ipc_stream_write_string (request, in_name); } if (!err) { @@ -392,7 +392,7 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, &reply); } - if (!err && !(cci_stream_size (reply) > 0)) { + if (!err && !(k5_ipc_stream_size (reply) > 0)) { err = ccErrCCacheNotFound; } @@ -405,8 +405,8 @@ cc_int32 ccapi_context_open_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -418,7 +418,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } @@ -435,7 +435,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, &reply); } - if (!err && !(cci_stream_size (reply) > 0)) { + if (!err && !(k5_ipc_stream_size (reply) > 0)) { err = ccErrCCacheNotFound; } @@ -448,7 +448,7 @@ cc_int32 ccapi_context_open_default_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -463,8 +463,8 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -473,19 +473,19 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_string (request, in_name); + err = k5_ipc_stream_write_string (request, in_name); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -508,8 +508,8 @@ cc_int32 ccapi_context_create_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -523,8 +523,8 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -532,15 +532,15 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -563,8 +563,8 @@ cc_int32 ccapi_context_create_default_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -578,8 +578,8 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -587,15 +587,15 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, if (!out_ccache ) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_cred_vers); + err = k5_ipc_stream_write_uint32 (request, in_cred_vers); } if (!err) { - err = cci_stream_write_string (request, in_principal); + err = k5_ipc_stream_write_string (request, in_principal); } if (!err) { @@ -618,8 +618,8 @@ cc_int32 ccapi_context_create_new_ccache (cc_context_t in_context, } cci_identifier_release (identifier); - cci_stream_release (reply); - cci_stream_release (request); + k5_ipc_stream_release (reply); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -631,7 +631,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_context ) { err = cci_check_error (ccErrBadParam); } @@ -649,7 +649,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { err = cci_identifier_read (&identifier, reply); } else { identifier = cci_identifier_uninitialized; @@ -660,7 +660,7 @@ cc_int32 ccapi_context_new_ccache_iterator (cc_context_t in_context, err = cci_ccache_iterator_new (out_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); @@ -674,20 +674,20 @@ cc_int32 ccapi_context_lock (cc_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t request = NULL; + k5_ipc_stream request = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } if (!err) { - err = cci_stream_new (&request); + err = k5_ipc_stream_new (&request); } if (!err) { - err = cci_stream_write_uint32 (request, in_lock_type); + err = k5_ipc_stream_write_uint32 (request, in_lock_type); } if (!err) { - err = cci_stream_write_uint32 (request, in_block); + err = k5_ipc_stream_write_uint32 (request, in_block); } if (!err) { @@ -701,7 +701,7 @@ cc_int32 ccapi_context_lock (cc_context_t in_context, NULL); } - cci_stream_release (request); + k5_ipc_stream_release (request); return cci_check_error (err); } @@ -773,7 +773,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, { cc_int32 err = ccNoError; cci_context_t context = (cci_context_t) in_context; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t new_identifier = NULL; if (!in_context) { err = cci_check_error (ccErrBadParam); } @@ -796,7 +796,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, } if (!err) { - if (cci_stream_size (reply) > 0) { + if (k5_ipc_stream_size (reply) > 0) { err = cci_identifier_read (&new_identifier, reply); } else { new_identifier = cci_identifier_uninitialized; @@ -828,7 +828,7 @@ static cc_int32 cci_context_sync (cci_context_t in_context, } cci_identifier_release (new_identifier); - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } diff --git a/src/ccapi/lib/ccapi_credentials.c b/src/ccapi/lib/ccapi_credentials.c index 3c40478fbe..6a3b4cb91a 100644 --- a/src/ccapi/lib/ccapi_credentials.c +++ b/src/ccapi/lib/ccapi_credentials.c @@ -61,7 +61,7 @@ cc_credentials_union cci_credentials_union_initializer = { /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_t credentials = NULL; @@ -108,7 +108,7 @@ cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_write (cc_credentials_t in_credentials, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_t credentials = (cci_credentials_t) in_credentials; diff --git a/src/ccapi/lib/ccapi_credentials.h b/src/ccapi/lib/ccapi_credentials.h index bde0b2c03d..9307e684bf 100644 --- a/src/ccapi/lib/ccapi_credentials.h +++ b/src/ccapi/lib/ccapi_credentials.h @@ -30,10 +30,10 @@ #include "cci_common.h" cc_int32 cci_credentials_read (cc_credentials_t *out_credentials, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 cci_credentials_write (cc_credentials_t in_credentials, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_credentials_compare (cc_credentials_t in_credentials, cc_credentials_t in_compare_to_credentials, diff --git a/src/ccapi/lib/ccapi_credentials_iterator.c b/src/ccapi/lib/ccapi_credentials_iterator.c index b6cd85c5d4..4571b64f84 100644 --- a/src/ccapi/lib/ccapi_credentials_iterator.c +++ b/src/ccapi/lib/ccapi_credentials_iterator.c @@ -100,7 +100,7 @@ cc_int32 cci_credentials_iterator_new (cc_credentials_iterator_t *out_credential /* ------------------------------------------------------------------------ */ cc_int32 cci_credentials_iterator_write (cc_credentials_iterator_t in_credentials_iterator, - cci_stream_t in_stream) + k5_ipc_stream in_stream) { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; @@ -152,7 +152,7 @@ cc_int32 ccapi_credentials_iterator_next (cc_credentials_iterator_t in_credenti { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; if (!in_credentials_iterator) { err = cci_check_error (ccErrBadParam); } if (!out_credentials ) { err = cci_check_error (ccErrBadParam); } @@ -168,7 +168,7 @@ cc_int32 ccapi_credentials_iterator_next (cc_credentials_iterator_t in_credenti err = cci_credentials_read (out_credentials, reply); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -180,7 +180,7 @@ cc_int32 ccapi_credentials_iterator_clone (cc_credentials_iterator_t in_credent { cc_int32 err = ccNoError; cci_credentials_iterator_t credentials_iterator = (cci_credentials_iterator_t) in_credentials_iterator; - cci_stream_t reply = NULL; + k5_ipc_stream reply = NULL; cci_identifier_t identifier = NULL; if (!in_credentials_iterator ) { err = cci_check_error (ccErrBadParam); } @@ -201,7 +201,7 @@ cc_int32 ccapi_credentials_iterator_clone (cc_credentials_iterator_t in_credent err = cci_credentials_iterator_new (out_credentials_iterator, identifier); } - cci_stream_release (reply); + k5_ipc_stream_release (reply); cci_identifier_release (identifier); return cci_check_error (err); diff --git a/src/ccapi/lib/ccapi_credentials_iterator.h b/src/ccapi/lib/ccapi_credentials_iterator.h index 12647d4ee2..84c3d2e229 100644 --- a/src/ccapi/lib/ccapi_credentials_iterator.h +++ b/src/ccapi/lib/ccapi_credentials_iterator.h @@ -33,7 +33,7 @@ cc_int32 cci_credentials_iterator_new (cc_credentials_iterator_t *out_credential cci_identifier_t in_identifier); cc_int32 cci_credentials_iterator_write (cc_credentials_iterator_t in_credentials_iterator, - cci_stream_t in_stream); + k5_ipc_stream in_stream); cc_int32 ccapi_credentials_iterator_release (cc_credentials_iterator_t io_credentials_iterator); diff --git a/src/ccapi/lib/ccapi_ipc.c b/src/ccapi/lib/ccapi_ipc.c index fe541db4eb..43993dc76d 100644 --- a/src/ccapi/lib/ccapi_ipc.c +++ b/src/ccapi/lib/ccapi_ipc.c @@ -46,12 +46,12 @@ void cci_ipc_thread_fini (void) static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 in_launch_server, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { cc_int32 err = ccNoError; - cci_stream_t request = NULL; - cci_stream_t reply = NULL; + k5_ipc_stream request = NULL; + k5_ipc_stream reply = NULL; cc_int32 reply_error = 0; if (!in_identifier) { err = cci_check_error (ccErrBadParam); } @@ -65,15 +65,15 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, } if (!err && in_request_data) { - err = cci_stream_write (request, - cci_stream_data (in_request_data), - cci_stream_size (in_request_data)); + err = k5_ipc_stream_write (request, + k5_ipc_stream_data (in_request_data), + k5_ipc_stream_size (in_request_data)); } if (!err) { err = cci_os_ipc (in_launch_server, request, &reply); - if (!err && cci_stream_size (reply) > 0) { + if (!err && k5_ipc_stream_size (reply) > 0) { err = cci_message_read_reply_header (reply, &reply_error); } } @@ -87,8 +87,8 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, reply = NULL; /* take ownership */ } - cci_stream_release (request); - cci_stream_release (reply); + k5_ipc_stream_release (request); + k5_ipc_stream_release (reply); return cci_check_error (err); } @@ -97,8 +97,8 @@ static cc_int32 _cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { return cci_check_error (_cci_ipc_send (in_request_name, 1, in_identifier, @@ -110,8 +110,8 @@ cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cc_int32 cci_ipc_send_no_launch (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data) + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data) { return cci_check_error (_cci_ipc_send (in_request_name, 0, in_identifier, diff --git a/src/ccapi/lib/ccapi_ipc.h b/src/ccapi/lib/ccapi_ipc.h index 2ba7637ac6..5b7d5d3745 100644 --- a/src/ccapi/lib/ccapi_ipc.h +++ b/src/ccapi/lib/ccapi_ipc.h @@ -34,12 +34,12 @@ void cci_ipc_thread_fini (void); cc_int32 cci_ipc_send (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); cc_int32 cci_ipc_send_no_launch (enum cci_msg_id_t in_request_name, cci_identifier_t in_identifier, - cci_stream_t in_request_data, - cci_stream_t *out_reply_data); + k5_ipc_stream in_request_data, + k5_ipc_stream *out_reply_data); #endif /* CCAPI_IPC_H */ diff --git a/src/ccapi/lib/ccapi_os_ipc.h b/src/ccapi/lib/ccapi_os_ipc.h index 0121adadb7..b5e0405997 100644 --- a/src/ccapi/lib/ccapi_os_ipc.h +++ b/src/ccapi/lib/ccapi_os_ipc.h @@ -33,7 +33,7 @@ cc_int32 cci_os_ipc_thread_init (void); void cci_os_ipc_thread_fini (void); cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t *out_reply_stream); + k5_ipc_stream in_request_stream, + k5_ipc_stream *out_reply_stream); #endif /* CCAPI_OS_IPC_H */ diff --git a/src/ccapi/lib/mac/ccapi_os_ipc.c b/src/ccapi/lib/mac/ccapi_os_ipc.c index bde357e16b..e0a81d8786 100644 --- a/src/ccapi/lib/mac/ccapi_os_ipc.c +++ b/src/ccapi/lib/mac/ccapi_os_ipc.c @@ -26,10 +26,7 @@ #include "ccapi_os_ipc.h" -#include <Kerberos/kipc_client.h> -#include "cci_mig_request.h" -#include "cci_mig_replyServer.h" -#include "k5-thread.h" +#include "k5_mig_client.h" #define cci_server_bundle_id "edu.mit.Kerberos.CCacheServer" @@ -37,243 +34,26 @@ cc_int32 cci_os_ipc_thread_init (void) { - cc_int32 err = ccNoError; - - err = k5_key_register (K5_KEY_CCAPI_REQUEST_PORT, free); - - if (!err) { - err = k5_key_register (K5_KEY_CCAPI_REPLY_STREAM, NULL); - } - - if (!err) { - err = k5_key_register (K5_KEY_CCAPI_SERVER_DIED, NULL); - } - - return err; + /* k5_ipc_send_request handles all thread data for us */ + return 0; } /* ------------------------------------------------------------------------ */ void cci_os_ipc_thread_fini (void) -{ - k5_key_delete (K5_KEY_CCAPI_REQUEST_PORT); - k5_key_delete (K5_KEY_CCAPI_REPLY_STREAM); - k5_key_delete (K5_KEY_CCAPI_SERVER_DIED); -} - -#pragma mark - - -/* ------------------------------------------------------------------------ */ - -static boolean_t cci_server_demux (mach_msg_header_t *request, - mach_msg_header_t *reply) -{ - boolean_t handled = false; - - if (!handled && request->msgh_id == MACH_NOTIFY_NO_SENDERS) { - cc_int32 *server_died = k5_getspecific (K5_KEY_CCAPI_SERVER_DIED); - if (!server_died) { - *server_died = 1; - } - - handled = 1; /* server died */ - } - - if (!handled) { - handled = cci_server (request, reply); - } - - return handled; -} - -/* ------------------------------------------------------------------------ */ - -kern_return_t cci_mipc_reply (mach_port_t in_reply_port, - cci_mipc_inl_reply_t in_inl_reply, - mach_msg_type_number_t in_inl_replyCnt, - cci_mipc_ool_reply_t in_ool_reply, - mach_msg_type_number_t in_ool_replyCnt) { - kern_return_t err = KERN_SUCCESS; - cci_stream_t reply_stream = NULL; - - if (!err) { - reply_stream = k5_getspecific (K5_KEY_CCAPI_REPLY_STREAM); - if (!reply_stream) { err = cci_check_error (ccErrBadInternalMessage); } - } - - if (!err) { - if (in_inl_replyCnt) { - err = cci_stream_write (reply_stream, in_inl_reply, in_inl_replyCnt); - - } else if (in_ool_replyCnt) { - err = cci_stream_write (reply_stream, in_ool_reply, in_ool_replyCnt); - - } else { - err = cci_check_error (ccErrBadInternalMessage); - } - } - - if (in_ool_replyCnt) { vm_deallocate (mach_task_self (), (vm_address_t) in_ool_reply, in_ool_replyCnt); } - - return cci_check_error (err); + /* k5_ipc_send_request handles all thread data for us */ + return; } -#pragma mark - - /* ------------------------------------------------------------------------ */ cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t *out_reply_stream) + k5_ipc_stream in_request_stream, + k5_ipc_stream *out_reply_stream) { - cc_int32 err = ccNoError; - cc_int32 done = 0; - cc_int32 try_count = 0; - cc_int32 server_died = 0; - mach_port_t server_port = MACH_PORT_NULL; - mach_port_t *request_port = NULL; - mach_port_t reply_port = MACH_PORT_NULL; - const char *inl_request = NULL; /* char * so we can pass the buffer in directly */ - mach_msg_type_number_t inl_request_length = 0; - cci_mipc_ool_request_t ool_request = NULL; - mach_msg_type_number_t ool_request_length = 0; - cci_stream_t reply_stream = NULL; - - if (!in_request_stream) { err = cci_check_error (ccErrBadParam); } - if (!out_reply_stream ) { err = cci_check_error (ccErrBadParam); } - - if (!err) { - /* depending on how big the message is, use the fast inline buffer or - * the slow dynamically allocated buffer */ - mach_msg_type_number_t request_length = cci_stream_size (in_request_stream); - - if (request_length > kCCAPIMaxILMsgSize) { - cci_debug_printf ("%s choosing out of line buffer (size is %d)", - __FUNCTION__, request_length); - - err = vm_read (mach_task_self (), - (vm_address_t) cci_stream_data (in_request_stream), request_length, - (vm_address_t *) &ool_request, &ool_request_length); - } else { - //cci_debug_printf ("%s choosing in line buffer (size is %d)", - // __FUNCTION__, request_length); - - inl_request_length = request_length; - inl_request = cci_stream_data (in_request_stream); - } - } - - if (!err) { - request_port = k5_getspecific (K5_KEY_CCAPI_REQUEST_PORT); - - if (!request_port) { - request_port = malloc (sizeof (mach_port_t)); - if (!request_port) { err = cci_check_error (ccErrNoMem); } - - if (!err) { - *request_port = MACH_PORT_NULL; - err = k5_setspecific (K5_KEY_CCAPI_REQUEST_PORT, request_port); - } - } - } - - if (!err) { - err = mach_port_allocate (mach_task_self (), MACH_PORT_RIGHT_RECEIVE, &reply_port); - } - - if (!err) { - err = kipc_client_lookup_server (cci_server_bundle_id, - in_launch_server, TRUE, &server_port); - } - - while (!err && !done) { - if (!err && !MACH_PORT_VALID (*request_port)) { - err = cci_mipc_create_client_connection (server_port, request_port); - } - - if (!err) { - err = cci_mipc_request (*request_port, reply_port, - inl_request, inl_request_length, - ool_request, ool_request_length); - - } - - if (err == MACH_SEND_INVALID_DEST) { - if (try_count < 2) { - try_count++; - err = ccNoError; - } - - if (request_port && MACH_PORT_VALID (*request_port)) { - mach_port_mod_refs (mach_task_self(), *request_port, MACH_PORT_RIGHT_SEND, -1 ); - *request_port = MACH_PORT_NULL; - } - - /* Look up server name again without using the cached copy */ - err = kipc_client_lookup_server (cci_server_bundle_id, - in_launch_server, FALSE, &server_port); - - } else { - /* Talked to server, though we may have gotten an error */ - done = 1; - - /* Because we use ",dealloc" ool_request will be freed by mach. - * Don't double free it. */ - ool_request = NULL; - ool_request_length = 0; - } - } - - if (!err) { - err = cci_stream_new (&reply_stream); - } - - if (!err) { - err = k5_setspecific (K5_KEY_CCAPI_REPLY_STREAM, reply_stream); - } - - if (!err) { - err = k5_setspecific (K5_KEY_CCAPI_SERVER_DIED, &server_died); - } - - if (!err) { - mach_port_t old_notification_target = MACH_PORT_NULL; - - /* request no-senders notification so we can get a message when server dies */ - err = mach_port_request_notification (mach_task_self (), reply_port, - MACH_NOTIFY_NO_SENDERS, 1, reply_port, - MACH_MSG_TYPE_MAKE_SEND_ONCE, - &old_notification_target); - - if (!err && old_notification_target != MACH_PORT_NULL) { - mach_port_deallocate (mach_task_self (), old_notification_target); - } - } - - if (!err) { - err = mach_msg_server_once (cci_server_demux, kkipc_max_message_size, - reply_port, MACH_MSG_TIMEOUT_NONE); - } - - if (!err && server_died) { - err = cci_check_error (ccErrServerUnavailable); - } - - if (err == BOOTSTRAP_UNKNOWN_SERVICE && !in_launch_server) { - err = ccNoError; /* If the server is not running just return an empty stream. */ - } - - if (!err) { - *out_reply_stream = reply_stream; - reply_stream = NULL; - } - - k5_setspecific (K5_KEY_CCAPI_REPLY_STREAM, NULL); - k5_setspecific (K5_KEY_CCAPI_SERVER_DIED, NULL); - if (reply_port != MACH_PORT_NULL) { mach_port_destroy (mach_task_self (), reply_port); } - if (ool_request_length ) { vm_deallocate (mach_task_self (), (vm_address_t) ool_request, ool_request_length); } - if (reply_stream ) { cci_stream_release (reply_stream); } - - return cci_check_error (err); + return cci_check_error (k5_ipc_send_request (cci_server_bundle_id, + in_launch_server, + in_request_stream, + out_reply_stream)); } diff --git a/src/ccapi/lib/win/ccapi_os_ipc.cxx b/src/ccapi/lib/win/ccapi_os_ipc.cxx index 4b00e2de38..6ccd59b9ab 100644 --- a/src/ccapi/lib/win/ccapi_os_ipc.cxx +++ b/src/ccapi/lib/win/ccapi_os_ipc.cxx @@ -68,9 +68,9 @@ static DWORD handle_exception(DWORD code); extern "C" { cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, - cci_stream_t in_request_stream, + k5_ipc_stream in_request_stream, cc_int32 in_msg, - cci_stream_t* out_reply_stream); + k5_ipc_stream* out_reply_stream); } /* ------------------------------------------------------------------------ */ @@ -128,8 +128,8 @@ void cci_os_ipc_thread_fini (void) /* ------------------------------------------------------------------------ */ cc_int32 cci_os_ipc (cc_int32 in_launch_server, - cci_stream_t in_request_stream, - cci_stream_t* out_reply_stream) { + k5_ipc_stream in_request_stream, + k5_ipc_stream* out_reply_stream) { return cci_os_ipc_msg( in_launch_server, in_request_stream, CCMSG_REQUEST, @@ -137,9 +137,9 @@ cc_int32 cci_os_ipc (cc_int32 in_launch_server, } extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, - cci_stream_t in_request_stream, + k5_ipc_stream in_request_stream, cc_int32 in_msg, - cci_stream_t* out_reply_stream) { + k5_ipc_stream* out_reply_stream) { cc_int32 err = ccNoError; cc_int32 done = FALSE; @@ -207,8 +207,8 @@ extern "C" cc_int32 cci_os_ipc_msg( cc_int32 in_launch_server, in_msg, /* Message type */ (unsigned char*)&ptspdata, /* Our tspdata* will be sent back to the reply proc. */ (unsigned char*)uuid, - cci_stream_size(in_request_stream), - (unsigned char*)cci_stream_data(in_request_stream), /* Data buffer */ + k5_ipc_stream_size(in_request_stream), + (unsigned char*)k5_ipc_stream_data(in_request_stream), /* Data buffer */ sst, /* session start time */ (long*)(&err) ); /* Return code */ } diff --git a/src/ccapi/lib/win/ccs_reply_proc.c b/src/ccapi/lib/win/ccs_reply_proc.c index 79f45e4c81..8eb3408367 100644 --- a/src/ccapi/lib/win/ccs_reply_proc.c +++ b/src/ccapi/lib/win/ccs_reply_proc.c @@ -47,17 +47,17 @@ void ccs_rpc_request_reply( HANDLE hEvent = openThreadEvent(uuid, REPLY_SUFFIX); DWORD* p = (DWORD*)(tspHandle); struct tspdata* tsp = (struct tspdata*)*p; - cci_stream_t stream; + k5_ipc_stream stream; long status = 0; #if 0 cci_debug_printf("%s! msg#:%d SST:%ld uuid:%s", __FUNCTION__, rpcmsg, srvStartTime, uuid); #endif if (!status) { - status = cci_stream_new (&stream); /* Create a stream for the request data */ + status = k5_ipc_stream_new (&stream); /* Create a stream for the request data */ } if (!status) { /* Put the data into the stream */ - status = cci_stream_write (stream, chIn, cbIn); + status = k5_ipc_stream_write (stream, chIn, cbIn); } if (!status) { /* Put the data into the stream */ diff --git a/src/ccapi/lib/win/debug.exports b/src/ccapi/lib/win/debug.exports index 0c3765325a..d7fbcc152d 100644 --- a/src/ccapi/lib/win/debug.exports +++ b/src/ccapi/lib/win/debug.exports @@ -3,9 +3,9 @@ cci_os_ipc
cci_os_ipc_msg
cci_os_ipc_thread_init
- cci_stream_data
- cci_stream_write
- cci_stream_new
+ k5_ipc_stream_data
+ k5_ipc_stream_write
+ k5_ipc_stream_new
ccs_authenticate
|
