From 3bbddf92797339694a9881d6f08b5bb0aea5adbe Mon Sep 17 00:00:00 2001 From: Alexandra Ellwood Date: Tue, 15 Jan 2008 22:13:27 +0000 Subject: [PATCH] Add ccs_pipe_compare Added a pipe comparison function. Forgot it when I was adding support for non-integer pipe types (such as used by Windows). ticket: new git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20200 dc483132-0cff-0310-8789-dd5450dbe970 --- src/ccapi/server/ccs_callback.c | 3 ++- src/ccapi/server/ccs_client.c | 2 +- src/ccapi/server/ccs_os_pipe.h | 4 ++++ src/ccapi/server/ccs_pipe.c | 9 +++++++++ src/ccapi/server/ccs_pipe.h | 4 ++++ src/ccapi/server/mac/ccs_os_pipe.c | 19 +++++++++++++++++++ 6 files changed, 39 insertions(+), 2 deletions(-) diff --git a/src/ccapi/server/ccs_callback.c b/src/ccapi/server/ccs_callback.c index a962460ed..6a5281c2f 100644 --- a/src/ccapi/server/ccs_callback.c +++ b/src/ccapi/server/ccs_callback.c @@ -213,7 +213,8 @@ cc_int32 ccs_callback_is_for_client_pipe (ccs_callback_t in_callback, if (!out_is_for_client_pipe ) { err = cci_check_error (ccErrBadParam); } if (!err) { - *out_is_for_client_pipe = (in_callback->client_pipe == in_client_pipe); + err = ccs_pipe_compare (in_callback->client_pipe, in_client_pipe, + out_is_for_client_pipe); } return cci_check_error (err); diff --git a/src/ccapi/server/ccs_client.c b/src/ccapi/server/ccs_client.c index b29616f34..5ec5de33d 100644 --- a/src/ccapi/server/ccs_client.c +++ b/src/ccapi/server/ccs_client.c @@ -161,7 +161,7 @@ cc_int32 ccs_client_uses_pipe (ccs_client_t in_client, if (!out_uses_pipe) { err = cci_check_error (ccErrBadParam); } if (!err) { - *out_uses_pipe = (in_client->client_pipe == in_pipe); + err = ccs_pipe_compare (in_client->client_pipe, in_pipe, out_uses_pipe); } return cci_check_error (err); diff --git a/src/ccapi/server/ccs_os_pipe.h b/src/ccapi/server/ccs_os_pipe.h index 0311ffa2b..ade4b2edb 100644 --- a/src/ccapi/server/ccs_os_pipe.h +++ b/src/ccapi/server/ccs_os_pipe.h @@ -31,6 +31,10 @@ cc_int32 ccs_os_pipe_valid (ccs_pipe_t in_pipe); +cc_int32 ccs_os_pipe_compare (ccs_pipe_t in_pipe, + ccs_pipe_t in_compare_to_pipe, + cc_uint32 *out_equal); + cc_int32 ccs_os_pipe_copy (ccs_pipe_t *out_pipe, ccs_pipe_t in_pipe); diff --git a/src/ccapi/server/ccs_pipe.c b/src/ccapi/server/ccs_pipe.c index ac02f95df..0a65a0aeb 100644 --- a/src/ccapi/server/ccs_pipe.c +++ b/src/ccapi/server/ccs_pipe.c @@ -36,6 +36,15 @@ cc_int32 ccs_pipe_valid (ccs_pipe_t in_pipe) /* ------------------------------------------------------------------------ */ +cc_int32 ccs_pipe_compare (ccs_pipe_t in_pipe, + ccs_pipe_t in_compare_to_pipe, + cc_uint32 *out_equal) +{ + return ccs_os_pipe_compare (in_pipe, in_compare_to_pipe, out_equal); +} + +/* ------------------------------------------------------------------------ */ + cc_int32 ccs_pipe_copy (ccs_pipe_t *out_pipe, ccs_pipe_t in_pipe) { diff --git a/src/ccapi/server/ccs_pipe.h b/src/ccapi/server/ccs_pipe.h index 7e21be6cc..daf6630b7 100644 --- a/src/ccapi/server/ccs_pipe.h +++ b/src/ccapi/server/ccs_pipe.h @@ -31,6 +31,10 @@ cc_int32 ccs_pipe_valid (ccs_pipe_t in_pipe); +cc_int32 ccs_pipe_compare (ccs_pipe_t in_pipe, + ccs_pipe_t in_compare_to_pipe, + cc_uint32 *out_equal); + cc_int32 ccs_pipe_copy (ccs_pipe_t *out_pipe, ccs_pipe_t in_pipe); diff --git a/src/ccapi/server/mac/ccs_os_pipe.c b/src/ccapi/server/mac/ccs_os_pipe.c index 494c91f58..91227676c 100644 --- a/src/ccapi/server/mac/ccs_os_pipe.c +++ b/src/ccapi/server/mac/ccs_os_pipe.c @@ -39,6 +39,25 @@ cc_int32 ccs_os_pipe_valid (ccs_pipe_t in_pipe) /* ------------------------------------------------------------------------ */ +cc_int32 ccs_os_pipe_compare (ccs_pipe_t in_pipe, + ccs_pipe_t in_compare_to_pipe, + cc_uint32 *out_equal) +{ + cc_int32 err = ccNoError; + + if (!in_pipe ) { err = cci_check_error (ccErrBadParam); } + if (!in_compare_to_pipe) { err = cci_check_error (ccErrBadParam); } + if (!out_equal ) { err = cci_check_error (ccErrBadParam); } + + if (!err) { + *out_equal = (in_pipe == in_compare_to_pipe); + } + + return cci_check_error (err); +} + +/* ------------------------------------------------------------------------ */ + cc_int32 ccs_os_pipe_copy (ccs_pipe_t *out_pipe, ccs_pipe_t in_pipe) { -- 2.26.2