Github user nonstop-qfchen commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/523#discussion_r65929050
  
    --- Diff: core/sql/cli/ExSqlComp.cpp ---
    @@ -677,14 +677,19 @@ ExSqlComp::ReturnStatus 
ExSqlComp::resendControls(NABoolean ctxSw)   // Genesis
     
       if (ret != ERROR)
       {
    -    // Send database credentials in a string as follows:
    -    //    Database userID
    -    //    Delimiter
    -    //    Database username
    +    // The message contains the following:
    +    //   (auth state and user ID are delimited by commas)
    +    //     authorization state (0 - off, 1 - on)
    +    //     integer user ID
    +    //     database user name
    +    // See CmpStatement::process (CmpMessageDatabaseUser) for more details
         Int32 *userID = ctxt->getDatabaseUserID();
         Int32 userAsInt = *userID;
    -    char userMessage [MAX_AUTHID_AS_STRING_LEN + 1 + MAX_USERNAME_LEN + 1];
    -    str_sprintf(userMessage, "%d,%s", userAsInt, 
ctxt->getDatabaseUserName());
    +    CmpContext *cmpCntxt = CmpCommon::context();
    +    NABoolean authOn = cmpCntxt ? cmpCntxt->isAuthorizationEnabled() : 
FALSE;
    +
    +    char userMessage [MAX_AUTHID_AS_STRING_LEN + 1 + MAX_USERNAME_LEN + 1 
+ 2];
    --- End diff --
    
    Same comment on the length for userAsInt.  Maybe refactor the two instances 
of the usage into a method. 


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to