2 * Copyright (C) 2020 Jonathan Rajotte <jonathan.rajotte-julien@efficios.com>
4 * SPDX-License-Identifier: LGPL-2.1-only
9 #include "credentials.h"
12 uid_t
lttng_credentials_get_uid(const struct lttng_credentials
*creds
)
14 return LTTNG_OPTIONAL_GET(creds
->uid
);
18 gid_t
lttng_credentials_get_gid(const struct lttng_credentials
*creds
)
20 return LTTNG_OPTIONAL_GET(creds
->gid
);
24 bool lttng_credentials_is_equal_uid(const struct lttng_credentials
*a
,
25 const struct lttng_credentials
*b
)
30 /* XOR on the is_set value */
31 if (!!a
->uid
.is_set
!= !!b
->uid
.is_set
) {
35 if (!a
->uid
.is_set
&& !b
->uid
.is_set
) {
39 /* Both a and b are set. */
40 return a
->uid
.value
== b
->uid
.value
;
44 bool lttng_credentials_is_equal_gid(const struct lttng_credentials
*a
,
45 const struct lttng_credentials
*b
)
50 /* XOR on the is_set value */
51 if (!!a
->gid
.is_set
!= !!b
->gid
.is_set
) {
55 if (!a
->gid
.is_set
&& !b
->gid
.is_set
) {
59 /* Both a and b are set. */
60 return a
->gid
.value
== b
->gid
.value
;
64 bool lttng_credentials_is_equal(const struct lttng_credentials
*a
,
65 const struct lttng_credentials
*b
)
70 return lttng_credentials_is_equal_uid(a
, b
) &&
71 lttng_credentials_is_equal_gid(a
, b
);
This page took 0.040754 seconds and 4 git commands to generate.