diff options
author | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-07 00:03:33 +0000 |
---|---|---|
committer | eea1 <eea1@ae88bc3d-4319-0410-8dbf-d08b4c9d3795> | 1999-07-07 00:03:33 +0000 |
commit | 3aaf850347c4cd5751e5c9fb9498787cdf392432 (patch) | |
tree | b9cea7d77d05462b29bc551335150d9298f1e856 /ace | |
parent | b865e170fd3c848d0331fff799f6ad390814b3ca (diff) | |
download | ATCD-3aaf850347c4cd5751e5c9fb9498787cdf392432.tar.gz |
Files Token_Request_Reply.{h, cpp, i}
Added ACE_TOKEN_REQUEST_HEADER_SIZE to represent the size of the
fixed-length portion of ACE_Token_Request's Transfer struct, and
changed length calculations accordingly. Added two bytes to the
buffer to accomodate '\0' values after the strings.
File Remote_Tokens.cpp
In ACE_Remote_Token_Proxy::request_reply, changed the check for
failure when receiving the reply.
Diffstat (limited to 'ace')
-rw-r--r-- | ace/Remote_Tokens.cpp | 2 | ||||
-rw-r--r-- | ace/Token_Request_Reply.cpp | 14 | ||||
-rw-r--r-- | ace/Token_Request_Reply.h | 10 | ||||
-rw-r--r-- | ace/Token_Request_Reply.i | 6 |
4 files changed, 20 insertions, 12 deletions
diff --git a/ace/Remote_Tokens.cpp b/ace/Remote_Tokens.cpp index d9476c4ee15..23c8426e0e6 100644 --- a/ace/Remote_Tokens.cpp +++ b/ace/Remote_Tokens.cpp @@ -161,7 +161,7 @@ ACE_Remote_Token_Proxy::request_reply (ACE_Token_Request &request, // Receive reply via blocking read. - if (peer->recv (&reply, sizeof reply) == -1) + if (peer->recv (&reply, sizeof reply) != sizeof reply) ACE_ERROR_RETURN ((LM_ERROR, ASYS_TEXT ("%p\n"), ASYS_TEXT ("recv failed")), -1); if (reply.decode () == -1) diff --git a/ace/Token_Request_Reply.cpp b/ace/Token_Request_Reply.cpp index a74e0d61348..e88f40e6505 100644 --- a/ace/Token_Request_Reply.cpp +++ b/ace/Token_Request_Reply.cpp @@ -72,11 +72,15 @@ ACE_Token_Request::decode (void) else // Skip this->tokenName_ + '\0' + ':'. this->client_id_ = &this->token_name_[token_len + 2]; - size_t data_size = ((sizeof this->transfer_ - - sizeof this->transfer_.data_) // Fixed-size header. - + ACE_OS::strlen (this->token_name_) + 1 // this->tokenName_ + '\0' - + ACE_OS::strlen (this->client_id_) + 1 // this->clientId_ + '\0' - + 1); // Space for ':' + // Fixed size header + // token_name_ plus '\0' + // ':' + // client_id_ plus '\0' + size_t data_size = ACE_TOKEN_REQUEST_HEADER_SIZE + + ACE_OS::strlen (this->token_name_) + 1 + + ACE_OS::strlen (this->client_id_) + 1 + + 1; + // Make sure the message was correctly received and framed. return this->length () == data_size ? 0 : -1; } diff --git a/ace/Token_Request_Reply.h b/ace/Token_Request_Reply.h index 072842c23cf..d08a5a74df5 100644 --- a/ace/Token_Request_Reply.h +++ b/ace/Token_Request_Reply.h @@ -30,6 +30,10 @@ #include "ace/Time_Value.h" +// Specifies the size of the fixed length portion of +// the Transfer structure in ACE_Token_Request +#define ACE_TOKEN_REQUEST_HEADER_SIZE 40 + class ACE_Export ACE_Token_Request { // = TITLE @@ -152,9 +156,9 @@ private: ACE_UINT32 arg_; // value returned in Token_Reply::arg (); - char data_[ACE_MAXTOKENNAMELEN + ACE_MAXCLIENTIDLEN + 1]; - // The data portion contains the <tokenName_> followed by a ':' - // followed by the <clientId_>. + char data_[ACE_MAXTOKENNAMELEN + ACE_MAXCLIENTIDLEN + 3]; + // The data portion contains the <tokenName_> including a 0 terminator, + // a ':', then the <clientId> including a 0 terminator } transfer_; char *token_name_; diff --git a/ace/Token_Request_Reply.i b/ace/Token_Request_Reply.i index 66428003359..b58f0b89d3a 100644 --- a/ace/Token_Request_Reply.i +++ b/ace/Token_Request_Reply.i @@ -129,9 +129,9 @@ ACE_Token_Request::token_name (const char *token_name, const char *client_id) (void) ACE_OS::memcpy (token_name_, token_name, token_name_length); (void) ACE_OS::memcpy (client_id_, client_id, client_id_length); - // Compute size of the fixed portion of the message... - size_t len = sizeof this->transfer_ - sizeof this->transfer_.data_; - + // Fixed length header size + size_t len = ACE_TOKEN_REQUEST_HEADER_SIZE; + // ... then add in the amount of the variable-sized portion. len += token_name_length + client_id_length + 1; |