diff options
Diffstat (limited to 'src/backend/commands/seclabel.c')
-rw-r--r-- | src/backend/commands/seclabel.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/src/backend/commands/seclabel.c b/src/backend/commands/seclabel.c index 1c96b005d7f..7afb7139a63 100644 --- a/src/backend/commands/seclabel.c +++ b/src/backend/commands/seclabel.c @@ -1,7 +1,7 @@ /* ------------------------------------------------------------------------- * * seclabel.c - * routines to support security label feature. + * routines to support security label feature. * * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California @@ -28,7 +28,7 @@ typedef struct { const char *provider_name; - check_object_relabel_type hook; + check_object_relabel_type hook; } LabelProvider; static List *label_provider_list = NIL; @@ -42,9 +42,9 @@ void ExecSecLabelStmt(SecLabelStmt *stmt) { LabelProvider *provider = NULL; - ObjectAddress address; - Relation relation; - ListCell *lc; + ObjectAddress address; + Relation relation; + ListCell *lc; /* * Find the named label provider, or if none specified, check whether @@ -55,16 +55,16 @@ ExecSecLabelStmt(SecLabelStmt *stmt) if (label_provider_list == NIL) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("no security label providers have been loaded"))); + errmsg("no security label providers have been loaded"))); if (lnext(list_head(label_provider_list)) != NULL) ereport(ERROR, (errcode(ERRCODE_INVALID_PARAMETER_VALUE), - errmsg("must specify provider when multiple security label providers have been loaded"))); + errmsg("must specify provider when multiple security label providers have been loaded"))); provider = (LabelProvider *) linitial(label_provider_list); } else { - foreach (lc, label_provider_list) + foreach(lc, label_provider_list) { LabelProvider *lp = lfirst(lc); @@ -82,10 +82,10 @@ ExecSecLabelStmt(SecLabelStmt *stmt) } /* - * Translate the parser representation which identifies this object - * into an ObjectAddress. get_object_address() will throw an error if - * the object does not exist, and will also acquire a lock on the - * target to guard against concurrent modifications. + * Translate the parser representation which identifies this object into + * an ObjectAddress. get_object_address() will throw an error if the + * object does not exist, and will also acquire a lock on the target to + * guard against concurrent modifications. */ address = get_object_address(stmt->objtype, stmt->objname, stmt->objargs, &relation, ShareUpdateExclusiveLock); @@ -98,6 +98,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt) switch (stmt->objtype) { case OBJECT_COLUMN: + /* * Allow security labels only on columns of tables, views, * composite types, and foreign tables (which are the only @@ -117,7 +118,7 @@ ExecSecLabelStmt(SecLabelStmt *stmt) } /* Provider gets control here, may throw ERROR to veto new label. */ - (*provider->hook)(&address, stmt->label); + (*provider->hook) (&address, stmt->label); /* Apply new label. */ SetSecurityLabel(&address, provider->provider_name, stmt->label); @@ -140,8 +141,8 @@ char * GetSecurityLabel(const ObjectAddress *object, const char *provider) { Relation pg_seclabel; - ScanKeyData keys[4]; - SysScanDesc scan; + ScanKeyData keys[4]; + SysScanDesc scan; HeapTuple tuple; Datum datum; bool isnull; @@ -196,8 +197,8 @@ SetSecurityLabel(const ObjectAddress *object, const char *provider, const char *label) { Relation pg_seclabel; - ScanKeyData keys[4]; - SysScanDesc scan; + ScanKeyData keys[4]; + SysScanDesc scan; HeapTuple oldtup; HeapTuple newtup = NULL; Datum values[Natts_pg_seclabel]; @@ -281,8 +282,8 @@ void DeleteSecurityLabel(const ObjectAddress *object) { Relation pg_seclabel; - ScanKeyData skey[3]; - SysScanDesc scan; + ScanKeyData skey[3]; + SysScanDesc scan; HeapTuple oldtup; int nkeys; @@ -323,8 +324,8 @@ DeleteSecurityLabel(const ObjectAddress *object) void register_label_provider(const char *provider_name, check_object_relabel_type hook) { - LabelProvider *provider; - MemoryContext oldcxt; + LabelProvider *provider; + MemoryContext oldcxt; oldcxt = MemoryContextSwitchTo(TopMemoryContext); provider = palloc(sizeof(LabelProvider)); |