MCPcopy Create free account
hub / github.com/apache/cloudberry / sepgsql_avc_trusted_proc

Function sepgsql_avc_trusted_proc

contrib/sepgsql/uavc.c:443–468  ·  view source on GitHub ↗

* sepgsql_avc_trusted_proc * * If the supplied function OID is configured as a trusted procedure, this * function will return a security label to be used during the execution of * that function. Otherwise, it returns NULL. */

Source from the content-addressed store, hash-verified

441 * that function. Otherwise, it returns NULL.
442 */
443char *
444sepgsql_avc_trusted_proc(Oid functionId)
445{
446 char *scontext = sepgsql_get_client_label();
447 char *tcontext;
448 ObjectAddress tobject;
449 avc_cache *cache;
450
451 tobject.classId = ProcedureRelationId;
452 tobject.objectId = functionId;
453 tobject.objectSubId = 0;
454 tcontext = GetSecurityLabel(&tobject, SEPGSQL_LABEL_TAG);
455
456 sepgsql_avc_check_valid();
457 do
458 {
459 if (tcontext)
460 cache = sepgsql_avc_lookup(scontext, tcontext,
461 SEPG_CLASS_DB_PROCEDURE);
462 else
463 cache = sepgsql_avc_lookup(scontext, sepgsql_avc_unlabeled(),
464 SEPG_CLASS_DB_PROCEDURE);
465 } while (!sepgsql_avc_check_valid());
466
467 return cache->ncontext;
468}
469
470/*
471 * sepgsql_avc_exit

Callers 2

sepgsql_needs_fmgr_hookFunction · 0.85
sepgsql_fmgr_hookFunction · 0.85

Calls 5

sepgsql_get_client_labelFunction · 0.85
GetSecurityLabelFunction · 0.85
sepgsql_avc_check_validFunction · 0.85
sepgsql_avc_lookupFunction · 0.85
sepgsql_avc_unlabeledFunction · 0.85

Tested by

no test coverage detected