trafodion-codereview mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sandhyasun <...@git.apache.org>
Subject [GitHub] incubator-trafodion pull request #523: TRAFODION [2025] Initialize authoriza...
Date Tue, 07 Jun 2016 05:24:54 GMT
Github user sandhyasun commented on a diff in the pull request:

    https://github.com/apache/incubator-trafodion/pull/523#discussion_r66011744
  
    --- Diff: core/sql/cli/Context.cpp ---
    @@ -3850,6 +3856,48 @@ void ContextCli::createMxcmpSession()
       mxcmpSessionInUse_ = TRUE;
     }
     
    +// ----------------------------------------------------------------------------
    +// Method:  updateMxcmpSession
    +//
    +// Updates security attributes in child arkcmp
    +//
    +// Returns: 0 = succeeded; -1 = failed
    +// ----------------------------------------------------------------------------
    +Int32 ContextCli::updateMxcmpSession()
    +{
    +  // If no child arkcmp, just return
    +  if (getArkcmp()->getServer() == NULL)
    +    return 0;
    +
    +  // Send changed user information to arkcmp process
    +  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 + 2];
    +  str_sprintf(userMessage, "%d,%d,%s", authOn, userAsInt, databaseUserName_);
    +  char *pMessage = (char *)&userMessage;
    +
    +  // Send message to child arkcmp, if one exists
    +  ExSqlComp::ReturnStatus cmpStatus;
    +  ExSqlComp *exSqlComp = getArkcmp();
    +  ex_assert(exSqlComp, "CliGlobals::getArkcmp() returned NULL");
    +  cmpStatus = exSqlComp->sendRequest(EXSQLCOMP::DATABASE_USER,
    +                     (const char *) pMessage,
    +                     (ULng32) strlen(pMessage));
    +  if (cmpStatus == ExSqlComp::ERROR)
    +    return -1;
    +
    +  return 0;
    +}
    +
    --- End diff --
    
    That's correct .  I meant to ask if you need to take care of propagating the auth info
to the child, grandchild arkcmps as Dave is pointing out. I think you are saying during this
phase of initializing authorization there is never more than 1 level of arkcmp.  And yes the
situation of 2 different arkcmps in the same level isn't supported currently - that support
was initially done  for versioning that is obsolete and not aware of any other use for that.



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