Commit 6f98b9ba authored by Jussi Laakkonen's avatar Jussi Laakkonen

[systemd login] Register to storage notifications. JB#49506

Register to storage notifications to receive uid changes. Set the uid
always to login_data, if it exists.
parent 0befa35a
......@@ -1031,6 +1031,22 @@ static void clean_restore_sd_connection(gpointer user_data)
}
}
static void uid_changed(uid_t uid)
{
if (!login_data)
return;
DBG("uid change from %u to %u", login_data->active_uid, uid);
login_data->active_uid = uid;
}
static struct connman_notifier systemd_login_notifier = {
.name = "systemd_login",
.priority = CONNMAN_NOTIFIER_PRIORITY_DEFAULT,
.storage_uid_changed = uid_changed
};
int __systemd_login_init()
{
int err;
......@@ -1041,6 +1057,7 @@ int __systemd_login_init()
return -EALREADY;
login_data = g_new0(struct systemd_login_data, 1);
connman_notifier_register(&systemd_login_notifier);
err = init_sd_login_monitor(login_data);
if (err) {
......@@ -1086,6 +1103,8 @@ void __systemd_login_cleanup()
close_io_channel(login_data);
close_sd_login_monitor(login_data);
connman_notifier_unregister(&systemd_login_notifier);
g_free(login_data);
login_data = NULL;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment