2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
10 #include "credentials.h"
13 uid_t
lttng_credentials_get_uid(const struct lttng_credentials
*creds
)
15 return LTTNG_OPTIONAL_GET(creds
->uid
);
19 gid_t
lttng_credentials_get_gid(const struct lttng_credentials
*creds
)
21 return LTTNG_OPTIONAL_GET(creds
->gid
);
25 bool lttng_credentials_is_equal_uid(const struct lttng_credentials
*a
,
26 const struct lttng_credentials
*b
)
31 /* XOR on the is_set value */
32 if (!!a
->uid
.is_set
!= !!b
->uid
.is_set
) {
36 if (!a
->uid
.is_set
&& !b
->uid
.is_set
) {
40 /* Both a and b are set. */
41 return a
->uid
.value
== b
->uid
.value
;
45 bool lttng_credentials_is_equal_gid(const struct lttng_credentials
*a
,
46 const struct lttng_credentials
*b
)
51 /* XOR on the is_set value */
52 if (!!a
->gid
.is_set
!= !!b
->gid
.is_set
) {
56 if (!a
->gid
.is_set
&& !b
->gid
.is_set
) {
60 /* Both a and b are set. */
61 return a
->gid
.value
== b
->gid
.value
;
65 bool lttng_credentials_is_equal(const struct lttng_credentials
*a
,
66 const struct lttng_credentials
*b
)
71 return lttng_credentials_is_equal_uid(a
, b
) &&
72 lttng_credentials_is_equal_gid(a
, b
);
This page took 0.029926 seconds and 4 git commands to generate.