Header And Logo

PostgreSQL
| The world's most advanced open source database.

Functions | Variables

dummy_seclabel.c File Reference

#include "postgres.h"
#include "commands/seclabel.h"
#include "miscadmin.h"
#include "utils/rel.h"
Include dependency graph for dummy_seclabel.c:

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

Function Documentation

void _PG_init ( void   ) 
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)));
}


Variable Documentation

Definition at line 19 of file dummy_seclabel.c.