mirror of
https://github.com/postgres/postgres.git
synced 2025-06-11 20:28:21 +03:00
Allow sepgsql labels to depend on object name.
The main change here is to call security_compute_create_name_raw() rather than security_compute_create_raw(). This ups the minimum requirement for libselinux from 2.0.99 to 2.1.10, but it looks like most distributions will have picked that up before 9.3 is out. KaiGai Kohei
This commit is contained in:
@ -836,7 +836,8 @@ sepgsql_compute_avd(const char *scontext,
|
||||
char *
|
||||
sepgsql_compute_create(const char *scontext,
|
||||
const char *tcontext,
|
||||
uint16 tclass)
|
||||
uint16 tclass,
|
||||
const char *objname)
|
||||
{
|
||||
security_context_t ncontext;
|
||||
security_class_t tclass_ex;
|
||||
@ -853,9 +854,11 @@ sepgsql_compute_create(const char *scontext,
|
||||
* Ask SELinux what is the default context for the given object class on a
|
||||
* pair of security contexts
|
||||
*/
|
||||
if (security_compute_create_raw((security_context_t) scontext,
|
||||
(security_context_t) tcontext,
|
||||
tclass_ex, &ncontext) < 0)
|
||||
if (security_compute_create_name_raw((security_context_t) scontext,
|
||||
(security_context_t) tcontext,
|
||||
tclass_ex,
|
||||
objname,
|
||||
&ncontext) < 0)
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_INTERNAL_ERROR),
|
||||
errmsg("SELinux could not compute a new context: "
|
||||
|
Reference in New Issue
Block a user