Make guid.patch more robust

This update to guid.patch does two things:

  1. Handle null pointer returned from getpwuid, which happens if the uid does not resolve to a user name. Previously this would cause a segfault.
  2. If either the getpwduid or initgroups call fails, revert to the upstream behaviour of calling setgroups.

In cups-exec.c we also log a warning, to reveal such misconfiguration errors in /var/log/cups/error_log, e.g.:

W [16/May/2025:16:27:34 +0200] [CGI] getpwuid failed to find user 9999; permissions of supplementary groups will not be applied

It's not clear to me whether it's possible to log anything from util.c, so there the errors are silently swallowed.

Fixes #3 (closed).

Merge request reports

Loading