[1/2] trafodion git commit: TRAFODION-3194 update

2018-09-29 Thread rmarton
Repository: trafodion
Updated Branches:
  refs/heads/master 8b19ee7b6 -> 9536c5e38


TRAFODION-3194 update

Fixed issue where revoke all on object did not actually revoke the privilege.
Also fixed an issue where setting up default privileges did not set the
correct default bits for object type.


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/66b854f7
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/66b854f7
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/66b854f7

Branch: refs/heads/master
Commit: 66b854f765d06a1ee49bce75450021daf22198ea
Parents: 8b19ee7
Author: Roberta Marton 
Authored: Fri Sep 28 19:05:29 2018 +
Committer: Roberta Marton 
Committed: Fri Sep 28 19:05:29 2018 +

--
 core/sql/regress/privs2/EXPECTED135|  4 +++-
 core/sql/sqlcomp/PrivMgrPrivileges.cpp | 29 +
 core/sql/sqlcomp/PrivMgrPrivileges.h   |  1 -
 3 files changed, 20 insertions(+), 14 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/trafodion/blob/66b854f7/core/sql/regress/privs2/EXPECTED135
--
diff --git a/core/sql/regress/privs2/EXPECTED135 
b/core/sql/regress/privs2/EXPECTED135
index 055e89a..744b645 100644
--- a/core/sql/regress/privs2/EXPECTED135
+++ b/core/sql/regress/privs2/EXPECTED135
@@ -568,7 +568,9 @@ End of MXCI Session
 --- SQL operation failed with errors.
 >>revoke all on t135_t1 from sql_user3;
 
 SQL operation complete.
+*** ERROR[1025] Request failed.  Dependent object 
TRAFODION.T135SCH_USER3.T135_V1_USER3 exists.
+
+--- SQL operation failed with errors.
 >>
 >>sh sqlci -i "TEST135(user3_drops)" -u sql_user3;
 >>drop table t135_t3 cascade;

http://git-wip-us.apache.org/repos/asf/trafodion/blob/66b854f7/core/sql/sqlcomp/PrivMgrPrivileges.cpp
--
diff --git a/core/sql/sqlcomp/PrivMgrPrivileges.cpp 
b/core/sql/sqlcomp/PrivMgrPrivileges.cpp
index 451b32a..fe2c8d1 100644
--- a/core/sql/sqlcomp/PrivMgrPrivileges.cpp
+++ b/core/sql/sqlcomp/PrivMgrPrivileges.cpp
@@ -1741,7 +1741,6 @@ PrivStatus PrivMgrPrivileges::initGrantRevoke(
   // Generate the list of privilege descriptors that were requested 
   PrivStatus retcode = convertPrivsToDesc(objectType,
isAllSpecified,
-   isGrant,
(isGrant) ? isGOSpecified : true, // WGO
(isGrant) ? false : isGOSpecified, // GOF
privList,
@@ -4973,7 +4972,6 @@ bool PrivMgrPrivileges::isAuthIDGrantedPrivs(
 PrivStatus PrivMgrPrivileges::convertPrivsToDesc( 
   const ComObjectType objectType,
   const bool isAllSpecified,
-  const bool isGrant,
   const bool isWgoSpecified,
   const bool isGofSpecified,
   const std::vector privsList,
@@ -5014,7 +5012,14 @@ PrivStatus PrivMgrPrivileges::convertPrivsToDesc(
   // If all is specified, set bits appropriate for the object type and return
   if (isAllSpecified)
   {
-privsToProcess.setAllObjectPrivileges(objectType, isGrant, isWgoSpecified);
+// For grant:
+//WGO is set if WITH GRANT OPTION specified in syntax
+//GOF is false, so always turn on the priv bits
+// For revoke:
+//WGO is always true, so always remove the WGO bits
+//GOF is set if GRANT OPTION FOR specified in syntax, so don't set 
privs
+//   bit if only removing the grant option (JIRA 3194)
+privsToProcess.setAllObjectPrivileges(objectType, !isGofSpecified, 
isWgoSpecified);
 return STATUS_GOOD;
   }
 
@@ -6249,18 +6254,18 @@ PrivStatus ObjectPrivsMDTable::insertSelect(
   }
 
   // Create bitmaps for all supported object types;
-  PrivMgrCoreDesc privCoreDesc;
-  privCoreDesc.setAllTableGrantPrivileges(true, true);
-  int64_t tableBits = privCoreDesc.getPrivBitmap().to_ulong();
+  PrivMgrDesc privDesc;
+  privDesc.setAllTableGrantPrivileges(true, true);
+  int64_t tableBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
  
-  privCoreDesc.setAllLibraryGrantPrivileges(true, true);
-  int64_t libraryBits = privCoreDesc.getPrivBitmap().to_ulong();
+  privDesc.setAllLibraryGrantPrivileges(true, true);
+  int64_t libraryBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
 
-  privCoreDesc.setAllUdrGrantPrivileges(true, true);
-  int64_t udrBits = privCoreDesc.getPrivBitmap().to_ulong();
+  privDesc.setAllUdrGrantPrivileges(true, true);
+  int64_t udrBits = privDesc.getTablePrivs().getPrivBitmap().to_ulong();
 
-  privCoreDesc.setAllSequenceGrantPrivileges(true, true);
-  int64_t sequenceBits = privCoreDesc.getPrivBitmap().to_ulong();
+  privDesc.setAllSequenceGrantPrivileges(true, true);
+  int64_t sequenceBits = 

[2/2] trafodion git commit: Merge TRAFODION-3194 pr 1720 fix update

2018-09-29 Thread rmarton
Merge TRAFODION-3194 pr 1720 fix update


Project: http://git-wip-us.apache.org/repos/asf/trafodion/repo
Commit: http://git-wip-us.apache.org/repos/asf/trafodion/commit/9536c5e3
Tree: http://git-wip-us.apache.org/repos/asf/trafodion/tree/9536c5e3
Diff: http://git-wip-us.apache.org/repos/asf/trafodion/diff/9536c5e3

Branch: refs/heads/master
Commit: 9536c5e38d78e633dcedda6fccd8c91fceada188
Parents: 8b19ee7 66b854f
Author: Roberta Marton 
Authored: Sat Sep 29 18:54:56 2018 +
Committer: Roberta Marton 
Committed: Sat Sep 29 18:54:56 2018 +

--
 core/sql/regress/privs2/EXPECTED135|  4 +++-
 core/sql/sqlcomp/PrivMgrPrivileges.cpp | 29 +
 core/sql/sqlcomp/PrivMgrPrivileges.h   |  1 -
 3 files changed, 20 insertions(+), 14 deletions(-)
--