增加SM3注释 #15
|
|
@ -132,6 +132,9 @@ typedef struct {
|
|||
DropBehavior behavior;
|
||||
} InternalDefaultACL;
|
||||
|
||||
/*
|
||||
* Privileges information corresponding to different object types.
|
||||
*/
|
||||
const struct AclObjectType {
|
||||
GrantObjectType objtype;
|
||||
AclMode all_privileges;
|
||||
|
|
@ -574,6 +577,7 @@ void ExecuteGrantStmt(GrantStmt* stmt)
|
|||
* bitmask. Note: objtype can't be ACL_OBJECT_COLUMN.
|
||||
*/
|
||||
for (size_t idx = 0; idx < sizeof(acl_object_type) / sizeof(acl_object_type[0]); idx++) {
|
||||
/* Set corresponding privileges according to object type. */
|
||||
if (acl_object_type[idx].objtype == stmt->objtype) {
|
||||
all_privileges = acl_object_type[idx].all_privileges;
|
||||
all_ddl_privileges = acl_object_type[idx].all_ddl_privileges;
|
||||
|
|
@ -672,7 +676,7 @@ void ExecuteGrantStmt(GrantStmt* stmt)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Call privileges management function. */
|
||||
ExecGrantStmt_oids(&istmt);
|
||||
}
|
||||
|
||||
|
|
@ -2102,9 +2106,10 @@ static void ExecGrant_Relation(InternalGrant* istmt)
|
|||
Relation relation = NULL;
|
||||
Relation attRelation = NULL;
|
||||
ListCell* cell = NULL;
|
||||
|
||||
/* Open system table pg_class and pg_attribute. */
|
||||
relation = heap_open(RelationRelationId, RowExclusiveLock);
|
||||
attRelation = heap_open(AttributeRelationId, RowExclusiveLock);
|
||||
/* Loop through each Relation object. */
|
||||
foreach (cell, istmt->objects) {
|
||||
Oid relOid = lfirst_oid(cell);
|
||||
Datum aclDatum;
|
||||
|
|
@ -2125,10 +2130,12 @@ static void ExecGrant_Relation(InternalGrant* istmt)
|
|||
ListCell* cell_colprivs = NULL;
|
||||
|
||||
tuple = SearchSysCache1(RELOID, ObjectIdGetDatum(relOid));
|
||||
/* Check whether the table object to be operated exists. */
|
||||
if (!HeapTupleIsValid(tuple))
|
||||
ereport(ERROR, (errmodule(MOD_SEC), errcode(ERRCODE_CACHE_LOOKUP_FAILED),
|
||||
errmsg("cache lookup failed for relation %u", relOid), errdetail("N/A"),
|
||||
errcause("System error."), erraction("Contact engineer to support.")));
|
||||
/* Get the pointer of the table to be operated. */
|
||||
pg_class_tuple = (Form_pg_class)GETSTRUCT(tuple);
|
||||
|
||||
ExecGrantRelationTypeCheck(pg_class_tuple, istmt, &privileges, &ddl_privileges);
|
||||
|
|
@ -2381,7 +2388,7 @@ static void ExecGrant_Relation(InternalGrant* istmt)
|
|||
/* prevent error when processing duplicate objects */
|
||||
CommandCounterIncrement();
|
||||
}
|
||||
|
||||
/* Close system table pg_class and pg_attribute. */
|
||||
heap_close(attRelation, RowExclusiveLock);
|
||||
heap_close(relation, RowExclusiveLock);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6068,6 +6068,7 @@ Datum calculate_encrypted_password(bool is_encrypted, const char* password, cons
|
|||
* if Password_encryption_type is 0, the encrypted password is md5.
|
||||
* if Password_encryption_type is 1, the encrypted password is sha256 + md5.
|
||||
* if Password_encryption_type is 2, the encrypted password is sha256.
|
||||
* if Password_encryption_type is 3, the encrypted password is SM3.
|
||||
*/
|
||||
if (u_sess->attr.attr_security.Password_encryption_type == 0) {
|
||||
if (!pg_md5_encrypt(password, rolname, strlen(rolname), encrypted_md5_password)) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue