Add ccs_pipe_compare
authorAlexandra Ellwood <lxs@mit.edu>
Tue, 15 Jan 2008 22:13:27 +0000 (22:13 +0000)
committerAlexandra Ellwood <lxs@mit.edu>
Tue, 15 Jan 2008 22:13:27 +0000 (22:13 +0000)
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
src/ccapi/server/ccs_client.c
src/ccapi/server/ccs_os_pipe.h
src/ccapi/server/ccs_pipe.c
src/ccapi/server/ccs_pipe.h
src/ccapi/server/mac/ccs_os_pipe.c

index a962460ed44366747229a8ad3bb81e5b9596874e..6a5281c2f5a3d37cf58924a3aaffb9eb52ed5c33 100644 (file)
@@ -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);    
index b29616f345cd99a6ffd26a6217a5306e946bbbe6..5ec5de33d78789da6195e102e9452fea922c4ad5 100644 (file)
@@ -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);    
index 0311ffa2b6e066797e74052b4010d7b6fd6c7899..ade4b2edb56b608a00817d95571b12efe803bcf2 100644 (file)
 
 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);
 
index ac02f95dfde43322736234e85b9cc4c975eef2c6..0a65a0aeb09c57ef3d32e30fa00e74ef3539e483 100644 (file)
@@ -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)
 {
index 7e21be6cc2c8c625f28c274d47161450556d111d..daf6630b73575b3063bfb8488500134347ef7711 100644 (file)
 
 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);
 
index 494c91f5828d59bdbb56e9204fc89d75c9d64214..91227676c0983965ec0bcdd19b30ddbec5a3482f 100644 (file)
@@ -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)
 {