Files
nt-lite/code/user/system/rssrv/publication_scope.h
T

18 lines
654 B
C

// Exact-path namespace publication policy. A scoped capability can bind or unbind one name.
#pragma once
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
#include <string.h>
#include <ntlite/resource.h>
static inline bool RssrvScopeAllows(const char* scope, uint32_t operation,
const char* path, uint32_t pathLength) {
if (!scope) return true; // Unscoped administrator; separately issued by RSSRV.
return path &&
(operation == NTL_RESOURCE_OP_BIND || operation == NTL_RESOURCE_OP_UNBIND) &&
strlen(scope) == (size_t)pathLength && memcmp(scope, path, pathLength) == 0;
}