2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
8 #include "credentials.hpp"
12 uid_t
lttng_credentials_get_uid(const struct lttng_credentials
*creds
)
14 return LTTNG_OPTIONAL_GET(creds
->uid
);
17 gid_t
lttng_credentials_get_gid(const struct lttng_credentials
*creds
)
19 return LTTNG_OPTIONAL_GET(creds
->gid
);
22 bool lttng_credentials_is_equal_uid(const struct lttng_credentials
*a
,
23 const struct lttng_credentials
*b
)
28 /* XOR on the is_set value */
29 if (!!a
->uid
.is_set
!= !!b
->uid
.is_set
) {
33 if (!a
->uid
.is_set
&& !b
->uid
.is_set
) {
37 /* Both a and b are set. */
38 return a
->uid
.value
== b
->uid
.value
;
41 bool lttng_credentials_is_equal_gid(const struct lttng_credentials
*a
,
42 const struct lttng_credentials
*b
)
47 /* XOR on the is_set value */
48 if (!!a
->gid
.is_set
!= !!b
->gid
.is_set
) {
52 if (!a
->gid
.is_set
&& !b
->gid
.is_set
) {
56 /* Both a and b are set. */
57 return a
->gid
.value
== b
->gid
.value
;
60 bool lttng_credentials_is_equal(const struct lttng_credentials
*a
,
61 const struct lttng_credentials
*b
)
66 return lttng_credentials_is_equal_uid(a
, b
) && lttng_credentials_is_equal_gid(a
, b
);
This page took 0.031219 seconds and 4 git commands to generate.