diff options
author | Alexandra Ellwood <lxs@mit.edu> | 2007-06-04 22:24:27 +0000 |
---|---|---|
committer | Alexandra Ellwood <lxs@mit.edu> | 2007-06-04 22:24:27 +0000 |
commit | da1cf3db22a047b6336522dfe2d6fb18278b5ab3 (patch) | |
tree | 1ba2074d425e8bd7367b3d20481e103a3230ed05 /src/ccapi/server | |
parent | 73bbe4b2b50163861c7c46b6997d2f66593bbe3d (diff) | |
download | krb5-da1cf3db22a047b6336522dfe2d6fb18278b5ab3.zip krb5-da1cf3db22a047b6336522dfe2d6fb18278b5ab3.tar.gz krb5-da1cf3db22a047b6336522dfe2d6fb18278b5ab3.tar.bz2 |
Fixed bugs introduced while moving to krb5 repository
Fixed memory leak in ccs_ccache_t and ccs_cache_collection_t when returning
the reply data. Changed to "will_block" semantics for flow control in all
server function so it doesn't get confusing. Fixed bug in
ccs_server_send_reply() which was preventing ipc from working (was using
the wrong variable for the reply stream).
ticket:new
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@19567 dc483132-0cff-0310-8789-dd5450dbe970
Diffstat (limited to 'src/ccapi/server')
-rw-r--r-- | src/ccapi/server/ccs_cache_collection.c | 8 | ||||
-rw-r--r-- | src/ccapi/server/ccs_ccache.c | 8 | ||||
-rw-r--r-- | src/ccapi/server/ccs_lock_state.c | 2 | ||||
-rw-r--r-- | src/ccapi/server/ccs_server.c | 23 |
4 files changed, 26 insertions, 15 deletions
diff --git a/src/ccapi/server/ccs_cache_collection.c b/src/ccapi/server/ccs_cache_collection.c index 4927aaa..44cf5a8 100644 --- a/src/ccapi/server/ccs_cache_collection.c +++ b/src/ccapi/server/ccs_cache_collection.c @@ -939,8 +939,12 @@ static cc_int32 ccs_cache_collection_unlock (ccs_pipe_t in_client_pi if (!err) { *out_will_block = will_block; - *out_reply_data = reply_data; - reply_data = NULL; /* take ownership */ + if (!will_block) { + *out_reply_data = reply_data; + reply_data = NULL; /* take ownership */ + } else { + *out_reply_data = NULL; + } } cci_stream_release (reply_data); diff --git a/src/ccapi/server/ccs_ccache.c b/src/ccapi/server/ccs_ccache.c index aaeed97..dfe6686 100644 --- a/src/ccapi/server/ccs_ccache.c +++ b/src/ccapi/server/ccs_ccache.c @@ -991,8 +991,12 @@ cc_int32 ccs_ccache_handle_message (ccs_pipe_t in_client_pipe, if (!err) { *out_will_block = will_block; - *out_reply_data = reply_data; - reply_data = NULL; /* take ownership */ + if (!will_block) { + *out_reply_data = reply_data; + reply_data = NULL; /* take ownership */ + } else { + *out_reply_data = NULL; + } } cci_stream_release (reply_data); diff --git a/src/ccapi/server/ccs_lock_state.c b/src/ccapi/server/ccs_lock_state.c index f9bb614..6276306 100644 --- a/src/ccapi/server/ccs_lock_state.c +++ b/src/ccapi/server/ccs_lock_state.c @@ -81,7 +81,7 @@ cc_int32 ccs_lock_state_release (ccs_lock_state_t io_lock_state) { cc_int32 err = ccNoError; - if (!io_lock_state) { err = cci_check_error (ccErrBadParam); } + if (!io_lock_state) { err = ccErrBadParam; } if (!err) { ccs_lock_array_release (io_lock_state->locks); diff --git a/src/ccapi/server/ccs_server.c b/src/ccapi/server/ccs_server.c index b7d3be4..6f8fffe 100644 --- a/src/ccapi/server/ccs_server.c +++ b/src/ccapi/server/ccs_server.c @@ -144,14 +144,14 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe enum cci_msg_id_t in_request_name, cci_identifier_t in_request_identifier, cci_stream_t in_request_data, - cc_uint32 *out_reply_immediately, + cc_uint32 *out_will_block, cci_stream_t *out_reply_data) { cc_int32 err = ccNoError; if (!ccs_pipe_valid (in_reply_pipe)) { err = cci_check_error (ccErrBadParam); } if (!in_request_data ) { err = cci_check_error (ccErrBadParam); } - if (!out_reply_immediately ) { err = cci_check_error (ccErrBadParam); } + if (!out_will_block ) { err = cci_check_error (ccErrBadParam); } if (!out_reply_data ) { err = cci_check_error (ccErrBadParam); } if (!err) { @@ -166,7 +166,7 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe in_cache_collection, in_request_name, in_request_data, - out_reply_immediately, + out_will_block, out_reply_data); } @@ -185,7 +185,7 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe in_cache_collection, in_request_name, in_request_data, - out_reply_immediately, + out_will_block, out_reply_data); } @@ -206,7 +206,7 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe } if (!err) { - *out_reply_immediately = 1; /* can't block */ + *out_will_block = 0; /* can't block */ } } else if (in_request_name > cci_credentials_iterator_first_msg_id && @@ -228,7 +228,7 @@ static cc_int32 ccs_server_request_demux (ccs_pipe_t in_client_pipe } if (!err) { - *out_reply_immediately = 1; /* can't block */ + *out_will_block = 0; /* can't block */ } } else { @@ -250,7 +250,7 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, cc_int32 err = ccNoError; enum cci_msg_id_t request_name = 0; cci_identifier_t request_identifier = NULL; - cc_uint32 reply_immediately = 1; + cc_uint32 will_block = 0; cci_stream_t reply_data = NULL; if (!ccs_pipe_valid (in_client_pipe)) { err = cci_check_error (ccErrBadParam); } @@ -288,16 +288,19 @@ cc_int32 ccs_server_handle_request (ccs_pipe_t in_client_pipe, request_name, request_identifier, in_request, - &reply_immediately, + &will_block, &reply_data); } - if (server_err || reply_immediately) { + if (server_err || !will_block) { + + /* send a reply now if the server isn't blocked on something */ err = ccs_server_send_reply (in_reply_pipe, server_err, reply_data); } } cci_identifier_release (request_identifier); + cci_stream_release (reply_data); return cci_check_error (err); } @@ -318,7 +321,7 @@ cc_int32 ccs_server_send_reply (ccs_pipe_t in_reply_pipe, } if (!err && in_reply_data && cci_stream_size (in_reply_data) > 0) { - err = cci_stream_write (in_reply_data, + err = cci_stream_write (reply, cci_stream_data (in_reply_data), cci_stream_size (in_reply_data)); } |