trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From robertamarton <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #523: TRAFODION [2025] Initialize authoriza...
Date Mon, 06 Jun 2016 17:35:23 GMT
Github user robertamarton commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/523#discussion_r65933098
  
    --- Diff: core/sql/cli/Context.cpp ---
    @@ -3718,19 +3719,27 @@ void ContextCli::createMxcmpSession()
         return;
     
       // Steps to perform
    -  // 1. Send the user ID to mxcmp (Linux only)
    -  // 2. Send either the user name or session ID to mxcmp
    -  // 3. Send the LDAP user name to mxcmp
    -  // 4. Set the mxcmpSessionInUse_ flag to TRUE
    +  // 1. Send the user details to mxcmp
    +  // 2. Send CQD's  to mxcmp
    +  // 3. Set the mxcmpSessionInUse_ flag to TRUE
     
    -  // Send the user ID
    +  // Send the user details (auth state, userID, and username
    +  CmpContext *cmpCntxt = CmpCommon::context();
    +  ex_assert(cmpCntxt, "No compiler context exists");
    +  NABoolean authOn = cmpCntxt->isAuthorizationEnabled();
    +
    +  // 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 userAsInt = (Int32) databaseUserID_;
    -  char userMessage [MAX_AUTHID_AS_STRING_LEN + 1 + MAX_USERNAME_LEN + 1];
    -  str_sprintf(userMessage, "%d,%s", userAsInt, databaseUserName_);
    +  char userMessage [MAX_AUTHID_AS_STRING_LEN + 1 + MAX_USERNAME_LEN + 1 + 2];
    --- End diff --
    
    
    We should be good for the size:
    MAX_AUTHID_AS_STRING_LEN is the size for userAsInt converted to a string, MAX_USERNAME_LEN
is the username length, and the remaining should cover commas and authorization state.  
    and 2 it the length of authorization state.
    plus all the commas
    we should be good for the size


---
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