Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(login) #320

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/session-child.c
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,13 @@ session_child_run (int argc, char **argv)
if (x_authority)
{
gboolean drop_privileges = geteuid () == 0;
if (drop_privileges)
if (drop_privileges) {
if (x_authority_filename && chown (x_authority_filename, user_get_uid (user), user_get_gid (user)) < 0)
g_warning ("Failed to set ownership of user authority file: %s", strerror (errno));
privileges_drop (user_get_uid (user), user_get_gid (user));
if (x_authority_filename && chmod (x_authority_filename, S_IRUSR | S_IWUSR) < 0)
g_warning ("Failed to set access of user authority file: %s", strerror (errno));
}

g_autoptr(GError) error = NULL;
gboolean result = x_authority_write (x_authority, XAUTH_WRITE_MODE_REPLACE, x_authority_filename, &error);
Expand Down
3 changes: 2 additions & 1 deletion src/x-authority.c
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,8 @@ x_authority_write (XAuthority *auth, XAuthWriteMode mode, const gchar *filename,
if (!matched &&
priv->family == a_priv->family &&
address_matches &&
strcmp (priv->number, a_priv->number) == 0)
strcmp (priv->number, a_priv->number) == 0 &&
strcmp (priv->authorization_name, a_priv->authorization_name) == 0)
{
matched = TRUE;
if (mode == XAUTH_WRITE_MODE_REMOVE)
Expand Down
Loading