| 1 |
/* SPDX-License-Identifier: LGPL-2.1-or-later */ |
| 2 |
|
| 3 |
#include "bus-polkit.h" |
| 4 |
#include "logind.h" |
| 5 |
#include "logind-polkit.h" |
| 6 |
|
| 7 |
int check_polkit_chvt(sd_bus_message *message, Manager *manager, sd_bus_error *error) { |
| 8 |
#if ENABLE_POLKIT |
| 9 |
return bus_verify_polkit_async( |
| 10 |
message, |
| 11 |
"org.freedesktop.login1.chvt", |
| 12 |
/* details= */ NULL, |
| 13 |
&manager->polkit_registry, |
| 14 |
error); |
| 15 |
#else |
| 16 |
/* Allow chvt when polkit is not present. This allows a service to start a graphical session as a |
| 17 |
* non-root user when polkit is not compiled in, more closely matching the default polkit policy */ |
| 18 |
return 1; |
| 19 |
#endif |
| 20 |
} |