4 * Dummy security label provider.
6 * This module does not provide anything worthwhile from a security
7 * perspective, but allows regression testing independent of platform-specific
8 * features like SELinux.
10 * Portions Copyright (c) 1996-2011, PostgreSQL Global Development Group
11 * Portions Copyright (c) 1994, Regents of the University of California
15 #include "commands/seclabel.h"
16 #include "miscadmin.h"
20 /* Entrypoint of the module */
24 dummy_object_relabel(const ObjectAddress *object, const char *seclabel)
26 if (seclabel == NULL ||
27 strcmp(seclabel, "unclassified") == 0 ||
28 strcmp(seclabel, "classified") == 0)
31 if (strcmp(seclabel, "secret") == 0 ||
32 strcmp(seclabel, "top secret") == 0)
36 (errcode(ERRCODE_INSUFFICIENT_PRIVILEGE),
37 errmsg("only superuser can set '%s' label", seclabel)));
41 (errcode(ERRCODE_INVALID_NAME),
42 errmsg("'%s' is not a valid security label", seclabel)));
48 register_label_provider("dummy", dummy_object_relabel);