PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/genam.h"
#include "access/htup_details.h"
#include "access/relation.h"
#include "access/table.h"
#include "catalog/catalog.h"
#include "catalog/indexing.h"
#include "catalog/pg_seclabel.h"
#include "catalog/pg_shseclabel.h"
#include "commands/seclabel.h"
#include "miscadmin.h"
#include "utils/builtins.h"
#include "utils/fmgroids.h"
#include "utils/memutils.h"
#include "utils/rel.h"
Go to the source code of this file.
Data Structures | |
struct | LabelProvider |
Functions | |
static bool | SecLabelSupportsObjectType (ObjectType objtype) |
ObjectAddress | ExecSecLabelStmt (SecLabelStmt *stmt) |
static char * | GetSharedSecurityLabel (const ObjectAddress *object, const char *provider) |
char * | GetSecurityLabel (const ObjectAddress *object, const char *provider) |
static void | SetSharedSecurityLabel (const ObjectAddress *object, const char *provider, const char *label) |
void | SetSecurityLabel (const ObjectAddress *object, const char *provider, const char *label) |
void | DeleteSharedSecurityLabel (Oid objectId, Oid classId) |
void | DeleteSecurityLabel (const ObjectAddress *object) |
void | register_label_provider (const char *provider_name, check_object_relabel_type hook) |
Variables | |
static List * | label_provider_list = NIL |
void DeleteSecurityLabel | ( | const ObjectAddress * | object | ) |
Definition at line 523 of file seclabel.c.
References Assert, BTEqualStrategyNumber, CatalogTupleDelete(), ObjectAddress::classId, DeleteSharedSecurityLabel(), HeapTupleIsValid, Int32GetDatum(), IsSharedRelation(), ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by deleteOneObject().
Definition at line 491 of file seclabel.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), HeapTupleIsValid, ObjectIdGetDatum(), RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), and table_open().
Referenced by DeleteSecurityLabel(), dropdb(), DropRole(), and DropTableSpace().
ObjectAddress ExecSecLabelStmt | ( | SecLabelStmt * | stmt | ) |
Definition at line 115 of file seclabel.c.
References check_object_ownership(), ereport, errcode(), errdetail_relkind_not_supported(), errmsg(), ERROR, get_object_address(), GetUserId(), label_provider_list, lfirst, linitial, list_length(), NIL, NoLock, OBJECT_COLUMN, provider, LabelProvider::provider_name, RelationData::rd_rel, relation_close(), RelationGetRelationName, SecLabelSupportsObjectType(), SetSecurityLabel(), ShareUpdateExclusiveLock, and stmt.
Referenced by ProcessUtilitySlow(), and standard_ProcessUtility().
char* GetSecurityLabel | ( | const ObjectAddress * | object, |
const char * | provider | ||
) |
Definition at line 272 of file seclabel.c.
References AccessShareLock, BTEqualStrategyNumber, ObjectAddress::classId, CStringGetTextDatum, GetSharedSecurityLabel(), heap_getattr(), HeapTupleIsValid, Int32GetDatum(), IsSharedRelation(), ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, provider, RelationGetDescr, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and TextDatumGetCString.
Referenced by sepgsql_avc_check_perms(), sepgsql_avc_trusted_proc(), and sepgsql_get_label().
|
static |
Definition at line 224 of file seclabel.c.
References AccessShareLock, BTEqualStrategyNumber, ObjectAddress::classId, criticalSharedRelcachesBuilt, CStringGetTextDatum, heap_getattr(), HeapTupleIsValid, ObjectAddress::objectId, ObjectIdGetDatum(), provider, RelationGetDescr, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), table_close(), table_open(), and TextDatumGetCString.
Referenced by GetSecurityLabel().
void register_label_provider | ( | const char * | provider_name, |
check_object_relabel_type | hook | ||
) |
Definition at line 570 of file seclabel.c.
References label_provider_list, lappend(), MemoryContextSwitchTo(), palloc(), provider, pstrdup(), and TopMemoryContext.
Referenced by _PG_init().
|
static |
Definition at line 37 of file seclabel.c.
References OBJECT_ACCESS_METHOD, OBJECT_AGGREGATE, OBJECT_AMOP, OBJECT_AMPROC, OBJECT_ATTRIBUTE, OBJECT_CAST, OBJECT_COLLATION, OBJECT_COLUMN, OBJECT_CONVERSION, OBJECT_DATABASE, OBJECT_DEFACL, OBJECT_DEFAULT, OBJECT_DOMAIN, OBJECT_DOMCONSTRAINT, OBJECT_EVENT_TRIGGER, OBJECT_EXTENSION, OBJECT_FDW, OBJECT_FOREIGN_SERVER, OBJECT_FOREIGN_TABLE, OBJECT_FUNCTION, OBJECT_INDEX, OBJECT_LANGUAGE, OBJECT_LARGEOBJECT, OBJECT_MATVIEW, OBJECT_OPCLASS, OBJECT_OPERATOR, OBJECT_OPFAMILY, OBJECT_PARAMETER_ACL, OBJECT_POLICY, OBJECT_PROCEDURE, OBJECT_PUBLICATION, OBJECT_PUBLICATION_NAMESPACE, OBJECT_PUBLICATION_REL, OBJECT_ROLE, OBJECT_ROUTINE, OBJECT_RULE, OBJECT_SCHEMA, OBJECT_SEQUENCE, OBJECT_STATISTIC_EXT, OBJECT_SUBSCRIPTION, OBJECT_TABCONSTRAINT, OBJECT_TABLE, OBJECT_TABLESPACE, OBJECT_TRANSFORM, OBJECT_TRIGGER, OBJECT_TSCONFIGURATION, OBJECT_TSDICTIONARY, OBJECT_TSPARSER, OBJECT_TSTEMPLATE, OBJECT_TYPE, OBJECT_USER_MAPPING, and OBJECT_VIEW.
Referenced by ExecSecLabelStmt().
void SetSecurityLabel | ( | const ObjectAddress * | object, |
const char * | provider, | ||
const char * | label | ||
) |
Definition at line 404 of file seclabel.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), CatalogTupleInsert(), CatalogTupleUpdate(), ObjectAddress::classId, CStringGetTextDatum, heap_form_tuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, Int32GetDatum(), IsSharedRelation(), label, ObjectAddress::objectId, ObjectIdGetDatum(), ObjectAddress::objectSubId, provider, RelationGetDescr, RowExclusiveLock, ScanKeyInit(), SetSharedSecurityLabel(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by exec_object_restorecon(), ExecSecLabelStmt(), sepgsql_attribute_post_create(), sepgsql_database_post_create(), sepgsql_proc_post_create(), sepgsql_relation_post_create(), and sepgsql_schema_post_create().
|
static |
Definition at line 329 of file seclabel.c.
References BTEqualStrategyNumber, CatalogTupleDelete(), CatalogTupleInsert(), CatalogTupleUpdate(), ObjectAddress::classId, CStringGetTextDatum, heap_form_tuple(), heap_freetuple(), heap_modify_tuple(), HeapTupleIsValid, label, ObjectAddress::objectId, ObjectIdGetDatum(), provider, RelationGetDescr, RowExclusiveLock, ScanKeyInit(), systable_beginscan(), systable_endscan(), systable_getnext(), HeapTupleData::t_self, table_close(), table_open(), and values.
Referenced by SetSecurityLabel().
Definition at line 34 of file seclabel.c.
Referenced by ExecSecLabelStmt(), and register_label_provider().