drill-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bitblender <...@git.apache.org>
Subject [GitHub] drill pull request #809: Drill-4335: C++ client changes for supporting encry...
Date Mon, 08 May 2017 23:35:11 GMT
Github user bitblender commented on a diff in the pull request:

    https://github.com/apache/drill/pull/809#discussion_r114442641
  
    --- Diff: contrib/native/client/src/clientlib/drillClientImpl.cpp ---
    @@ -245,6 +264,64 @@ connectionStatus_t DrillClientImpl::sendSync(rpc::OutBoundRpcMessage&
msg){
         }
     }
     
    +/*
    + * Send handler for sending encrypted messages over wire. It encrypts the send buffer
using wrap api provided by
    + * saslAuthenticatorImpl and then transmit the encrypted bytes over wire.
    + *
    + * Return:
    + *  connectionStatus_t  -   CONN_SUCCESS - In case of successful send
    + *                      -   CONN_FAILURE - In case of failure to send
    + */
    +connectionStatus_t DrillClientImpl::sendSyncEncrypted() {
    +
    +    boost::system::error_code ec;
    +
    +    // Split the encoded message into the rawWrapSendSize and then encrypt each chunk.
Each encrypted chunk along with
    +    // its encrypted length in network order (added by Cyrus-SASL plugin) is sent over
wire.
    +    const int wrapChunkSize = m_encryptionCtxt.getRawWrapSendSize();
    +    int numChunks = ceil((double)m_wbuf.size() / wrapChunkSize);
    +    int lengthToEncrypt = m_wbuf.size();
    +    int currentChunkLen = std::min(wrapChunkSize, lengthToEncrypt);
    +    uint32_t startIndex = 0, wrappedLen = 0;
    +    const char* wrappedChunk = NULL;
    +    std::stringstream errorMsg;
    +
    +    // Encrypt and send each chunk
    +    while(numChunks > 0) {
    +        int wrapResult = m_saslAuthenticator->wrap(reinterpret_cast<const char*>(m_wbuf.data()
+ startIndex),
    +                                                   currentChunkLen, &wrappedChunk,
wrappedLen);
    +        if(SASL_OK != wrapResult) {
    +            errorMsg << "Sasl wrap failed while encrypting chunk of length: " <<
currentChunkLen << " , EncodeError: "
    +                     << wrapResult;
    +            DRILL_MT_LOG(DRILL_LOG(LOG_TRACE) << "DrillClientImpl::sendSyncEncrypted
- " << errorMsg.str()
    +                                              << " ,StartIndex: " << startIndex
<< ". ChunkNum: " << numChunks
    --- End diff --
    
    Did you want to print the chunk number or chunks remaining? ChunkNum should be Total chunks
- Chunks Remaining. 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message