Skip to content

fix(occ): set GID before UID to ensure success#60331

Open
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-occ-gid-before-uid
Open

fix(occ): set GID before UID to ensure success#60331
joshtrichards wants to merge 1 commit into
masterfrom
jtr/fix-occ-gid-before-uid

Conversation

@joshtrichards
Copy link
Copy Markdown
Member

@joshtrichards joshtrichards commented May 12, 2026

Summary

The previous implementation attempted to set GID after dropping root UID, which would fail (silently) and made the posix_setgid() call effectively a no-op. This swaps the order to set the target GID first.

Also refactored for clarity:

  • Renamed dropPrivileges to switchToConfigFileOwner for clearer intent
  • Update docblock to explicitly state best-effort limitations
  • Use more descriptive variable names
  • Re-organized for readability

TODO

  • ...

Checklist

AI (if applicable)

  • The content of this PR was partly or fully generated using AI

The previous implementation attempted to set GID after dropping root UID, which would fail (silently) and made the posix_setgid() call effectively a no-op. This swaps the order to set the target GID first.

Also refactored for clarity:
- Renamed dropPrivileges to switchToConfigFileOwner for clearer intent
- Update docblock to explicitly state best-effort limitations
- Use more descriptive variable names
- Re-organized for readability

Signed-off-by: Josh <josh.t.richards@gmail.com>
@joshtrichards joshtrichards added this to the Nextcloud 34 milestone May 12, 2026
@joshtrichards joshtrichards requested a review from a team as a code owner May 12, 2026 13:37
@joshtrichards joshtrichards requested review from Altahrim, ArtificialOwl and icewind1991 and removed request for a team May 12, 2026 13:37
Comment thread occ
@provokateurin provokateurin enabled auto-merge May 13, 2026 06:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants