diff options
author | Pavan Deolasee | 2017-06-14 05:42:18 +0000 |
---|---|---|
committer | Pavan Deolasee | 2017-06-14 05:42:18 +0000 |
commit | 15dd5274c323fb93e4e3ea9ad2185aaaec10f79c (patch) | |
tree | 9dafb4c7f735d9429ea461dc792933af87493c33 /contrib/sepgsql/label.c | |
parent | dfbb88e3bbb526dcb204b456b9e5cfd9d10d0d0a (diff) | |
parent | d5cb3bab564e0927ffac7c8729eacf181a12dd40 (diff) |
Merge from PG master upto d5cb3bab564e0927ffac7c8729eacf181a12dd40
This is the result of the "git merge remotes/PGSQL/master" upto the said commit
point. We have done some basic analysis, fixed compilation problems etc, but
bulk of the logical problems in conflict resolution etc will be handled by
subsequent commits.
Diffstat (limited to 'contrib/sepgsql/label.c')
-rw-r--r-- | contrib/sepgsql/label.c | 24 |
1 files changed, 17 insertions, 7 deletions
diff --git a/contrib/sepgsql/label.c b/contrib/sepgsql/label.c index e12a0e8cb6..6239800189 100644 --- a/contrib/sepgsql/label.c +++ b/contrib/sepgsql/label.c @@ -4,12 +4,22 @@ * * Routines to support SELinux labels (security context) * - * Copyright (c) 2010-2016, PostgreSQL Global Development Group + * Copyright (c) 2010-2017, PostgreSQL Global Development Group * * ------------------------------------------------------------------------- */ #include "postgres.h" +#include <selinux/label.h> + +/* + * <selinux/label.h> includes <stdbool.h>, which creates an incompatible + * #define for bool. Get rid of that so we can use our own typedef. + * (We don't care if <stdbool.h> redefines "true"/"false"; those are close + * enough.) + */ +#undef bool + #include "access/heapam.h" #include "access/htup_details.h" #include "access/genam.h" @@ -37,8 +47,6 @@ #include "sepgsql.h" -#include <selinux/label.h> - /* * Saved hook entries (if stacked) */ @@ -590,7 +598,7 @@ PG_FUNCTION_INFO_V1(sepgsql_mcstrans_in); Datum sepgsql_mcstrans_in(PG_FUNCTION_ARGS) { - text *label = PG_GETARG_TEXT_P(0); + text *label = PG_GETARG_TEXT_PP(0); char *raw_label; char *result; @@ -630,7 +638,7 @@ PG_FUNCTION_INFO_V1(sepgsql_mcstrans_out); Datum sepgsql_mcstrans_out(PG_FUNCTION_ARGS) { - text *label = PG_GETARG_TEXT_P(0); + text *label = PG_GETARG_TEXT_PP(0); char *qual_label; char *result; @@ -779,7 +787,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case RelationRelationId: relForm = (Form_pg_class) GETSTRUCT(tuple); - if (relForm->relkind == RELKIND_RELATION) + if (relForm->relkind == RELKIND_RELATION || + relForm->relkind == RELKIND_PARTITIONED_TABLE) objtype = SELABEL_DB_TABLE; else if (relForm->relkind == RELKIND_SEQUENCE) objtype = SELABEL_DB_SEQUENCE; @@ -803,7 +812,8 @@ exec_object_restorecon(struct selabel_handle * sehnd, Oid catalogId) case AttributeRelationId: attForm = (Form_pg_attribute) GETSTRUCT(tuple); - if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION) + if (get_rel_relkind(attForm->attrelid) != RELKIND_RELATION && + get_rel_relkind(attForm->attrelid) != RELKIND_PARTITIONED_TABLE) continue; /* no need to assign security label */ objtype = SELABEL_DB_COLUMN; |