We need to implicitly allow HELLO from users with the same uid as the bus.
Fix the bus-uid tracking to use the original uid, not the uid after
privilege-dropping.
typedef struct {
int fd;
SharedPolicy *policy;
typedef struct {
int fd;
SharedPolicy *policy;
} ClientContext;
static ClientContext *client_context_free(ClientContext *c) {
} ClientContext;
static ClientContext *client_context_free(ClientContext *c) {
- r = proxy_hello_policy(p, getuid());
+ r = proxy_hello_policy(p, c->bus_uid);
-static int loop_clients(int accept_fd) {
+static int loop_clients(int accept_fd, uid_t bus_uid) {
_cleanup_(shared_policy_freep) SharedPolicy *sp = NULL;
pthread_attr_t attr;
int r;
_cleanup_(shared_policy_freep) SharedPolicy *sp = NULL;
pthread_attr_t attr;
int r;
c->fd = fd;
c->policy = sp;
c->fd = fd;
c->policy = sp;
r = pthread_create(&tid, &attr, run_client, c);
if (r < 0) {
r = pthread_create(&tid, &attr, run_client, c);
if (r < 0) {
int main(int argc, char *argv[]) {
const char *user = "systemd-bus-proxy";
int r, accept_fd;
int main(int argc, char *argv[]) {
const char *user = "systemd-bus-proxy";
int r, accept_fd;
gid_t gid;
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
log_parse_environment();
log_open();
gid_t gid;
log_set_target(LOG_TARGET_JOURNAL_OR_KMSG);
log_parse_environment();
log_open();
if (geteuid() == 0) {
r = get_user_creds(&user, &uid, &gid, NULL, NULL);
if (r < 0) {
if (geteuid() == 0) {
r = get_user_creds(&user, &uid, &gid, NULL, NULL);
if (r < 0) {
- r = loop_clients(accept_fd);
+ r = loop_clients(accept_fd, bus_uid);