SQLBOX_ROLE_HIER_GEN(3)

NAME
sqlbox_role_hier_gen - generate hierarchical roles

LIBRARY
sqlbox

SYNOPSIS
#include <stdint.h>
#include <sqlbox.h>
int
sqlbox_role_hier_gen(const struct sqlbox_role_hier *p, struct sqlbox_roles *roles, size_t defrole);

DESCRIPTION
Generate hierarchical roles in roles from p. Any data already set in roles is discarded. Also accepts defrole, the initial role for the system.

sqlbox_role_hier_gen() creates the hierchical system from prior calls to sqlbox_role_hier_child(3) for the hierarchy specification, sqlbox_role_hier_src(3) for permitted database sources, and sqlbox_role_hier_stmt(3) for permitted statements.

On success, the allocated roles are set in roles. These may be freed by later invoking sqlbox_role_hier_gen_free(3).

RETURN VALUES
Returns zero on memory allocation failure or if defrole is not a valid role. An exception to this is if sqlbox_role_hier_alloc(3) was passed zero as the number or roles, in which case defrole must be zero. On success, the pointer must be freed with sqlbox_role_hier_free(3).

SEE ALSO
sqlbox_role_hier_child(3), sqlbox_role_hier_free(3)