2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
9 #include "credentials.hpp"
11 uid_t
lttng_credentials_get_uid(const struct lttng_credentials
*creds
)
13 return LTTNG_OPTIONAL_GET(creds
->uid
);
16 gid_t
lttng_credentials_get_gid(const struct lttng_credentials
*creds
)
18 return LTTNG_OPTIONAL_GET(creds
->gid
);
21 bool lttng_credentials_is_equal_uid(const struct lttng_credentials
*a
,
22 const struct lttng_credentials
*b
)
27 /* XOR on the is_set value */
28 if (!!a
->uid
.is_set
!= !!b
->uid
.is_set
) {
32 if (!a
->uid
.is_set
&& !b
->uid
.is_set
) {
36 /* Both a and b are set. */
37 return a
->uid
.value
== b
->uid
.value
;
40 bool lttng_credentials_is_equal_gid(const struct lttng_credentials
*a
,
41 const struct lttng_credentials
*b
)
46 /* XOR on the is_set value */
47 if (!!a
->gid
.is_set
!= !!b
->gid
.is_set
) {
51 if (!a
->gid
.is_set
&& !b
->gid
.is_set
) {
55 /* Both a and b are set. */
56 return a
->gid
.value
== b
->gid
.value
;
59 bool lttng_credentials_is_equal(const struct lttng_credentials
*a
,
60 const struct lttng_credentials
*b
)
65 return lttng_credentials_is_equal_uid(a
, b
) &&
66 lttng_credentials_is_equal_gid(a
, b
);
This page took 0.044335 seconds and 4 git commands to generate.