You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 2d704d2
Browse filesBrowse the repository at this point in the historyBrowse files
fix: correct directory ownership when creating cache dirs with sudo
When running `sudo deepin-log-viewer --reportcoredump`, directories created
under ~/.cache/deepin/deepin-log-viewer/ are owned by root, causing subsequent
normal launches to fail writing to them.
Add Utils::fixDirOwnership() to chown newly created directories to the real
logged-in user (detected via lstat(homePath)) when getuid() differs from the
real user UID. Apply it to all mkpath call sites that create cache directories
under the user's home: updateRepeatCoredumpExePaths, UserLogAccess constructor,
and UserLogAccess::createExtractSubdir.
Harden fixDirOwnership() against symlink attacks: walk the target path from
root using openat(O_DIRECTORY | O_NOFOLLOW) at each level, then fchown() the
resulting fd. This prevents a non-privileged user from pre-creating a symlink
along the path to trick the privileged sudo process into chowning arbitrary
targets outside the home directory.
Add error handling for createExtractSubdir() returning empty string (mkpath
failure) at all three call sites: skip unzip and fall back to returning
original file paths directly, preventing silent file loss.
Also add qCWarning logging for unchecked mkpath return values across the
project.
PMS: TASK-395141
0 commit comments