X-Git-Url: https://git.lttng.org/?p=lttng-tools.git;a=blobdiff_plain;f=src%2Fcommon%2Fcredentials.c;h=fd8b4477bb9ad1b0861ab8a76a10bce35fed60ac;hp=0aeaabaeb3a4249cc7c9e25e54f1906fb97dffd0;hb=HEAD;hpb=84e46494ef78e9ede2f7bfa64d56f138d40300b6 diff --git a/src/common/credentials.c b/src/common/credentials.c deleted file mode 100644 index 0aeaabaeb..000000000 --- a/src/common/credentials.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * Copyright (C) 2020 Jonathan Rajotte - * - * SPDX-License-Identifier: LGPL-2.1-only - * - */ - -#include -#include -#include "credentials.h" - -LTTNG_HIDDEN -uid_t lttng_credentials_get_uid(const struct lttng_credentials *creds) -{ - return LTTNG_OPTIONAL_GET(creds->uid); -} - -LTTNG_HIDDEN -gid_t lttng_credentials_get_gid(const struct lttng_credentials *creds) -{ - return LTTNG_OPTIONAL_GET(creds->gid); -} - -LTTNG_HIDDEN -bool lttng_credentials_is_equal_uid(const struct lttng_credentials *a, - const struct lttng_credentials *b) -{ - assert(a); - assert(b); - - /* XOR on the is_set value */ - if (!!a->uid.is_set != !!b->uid.is_set) { - return false; - } - - if (!a->uid.is_set && !b->uid.is_set) { - return true; - } - - /* Both a and b are set. */ - return a->uid.value == b->uid.value; -} - -LTTNG_HIDDEN -bool lttng_credentials_is_equal_gid(const struct lttng_credentials *a, - const struct lttng_credentials *b) -{ - assert(a); - assert(b); - - /* XOR on the is_set value */ - if (!!a->gid.is_set != !!b->gid.is_set) { - return false; - } - - if (!a->gid.is_set && !b->gid.is_set) { - return true; - } - - /* Both a and b are set. */ - return a->gid.value == b->gid.value; -} - -LTTNG_HIDDEN -bool lttng_credentials_is_equal(const struct lttng_credentials *a, - const struct lttng_credentials *b) -{ - assert(a); - assert(b); - - return lttng_credentials_is_equal_uid(a, b) && - lttng_credentials_is_equal_gid(a, b); -}