mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-02 09:01:46 -05:00
core-util: Fix permissions handling while creating directories
This makes updating of permissions on existing directories optional with pa_make_secure_dir() and pa_make_secure_parent_dir(). This makes sure that the recursive directory creation doesn't end up modifying existing directories, and also fixes a problem where creating an auth cookie (specifically ~/.esd_auth) would end up modifying permissions on ~. Thanks to Frédéric Danis for reporting this.
This commit is contained in:
parent
508ca489d2
commit
1ff604c298
5 changed files with 20 additions and 15 deletions
|
|
@ -202,12 +202,12 @@ static int change_user(void) {
|
|||
if (!pa_streq(pw->pw_dir, PA_SYSTEM_RUNTIME_PATH))
|
||||
pa_log_warn(_("Home directory of user '%s' is not '%s', ignoring."), PA_SYSTEM_USER, PA_SYSTEM_RUNTIME_PATH);
|
||||
|
||||
if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid) < 0) {
|
||||
if (pa_make_secure_dir(PA_SYSTEM_RUNTIME_PATH, 0755, pw->pw_uid, gr->gr_gid, TRUE) < 0) {
|
||||
pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_RUNTIME_PATH, pa_cstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid) < 0) {
|
||||
if (pa_make_secure_dir(PA_SYSTEM_STATE_PATH, 0700, pw->pw_uid, gr->gr_gid, TRUE) < 0) {
|
||||
pa_log(_("Failed to create '%s': %s"), PA_SYSTEM_STATE_PATH, pa_cstrerror(errno));
|
||||
return -1;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue