#include "postgres.h"#include "commands/seclabel.h"#include "miscadmin.h"#include "utils/rel.h"
Go to the source code of this file.
Functions | |
| void | _PG_init (void) |
| static void | dummy_object_relabel (const ObjectAddress *object, const char *seclabel) |
Variables | |
| PG_MODULE_MAGIC | |
| void _PG_init | ( | void | ) |
Definition at line 47 of file dummy_seclabel.c.
References dummy_object_relabel(), and register_label_provider().
{
register_label_provider("dummy", dummy_object_relabel);
}
| static void dummy_object_relabel | ( | const ObjectAddress * | object, | |
| const char * | seclabel | |||
| ) | [static] |
Definition at line 25 of file dummy_seclabel.c.
References ereport, errcode(), errmsg(), ERROR, NULL, and superuser().
Referenced by _PG_init().
{
if (seclabel == NULL ||
strcmp(seclabel, "unclassified") == 0 ||
strcmp(seclabel, "classified") == 0)
return;
if (strcmp(seclabel, "secret") == 0 ||
strcmp(seclabel, "top secret") == 0)
{
if (!superuser())
ereport(ERROR,
(errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
errmsg("only superuser can set '%s' label", seclabel)));
return;
}
ereport(ERROR,
(errcode(ERRCODE_INVALID_NAME),
errmsg("'%s' is not a valid security label", seclabel)));
}
Definition at line 19 of file dummy_seclabel.c.
1.7.1