[pdm-devel] [PATCH proxmox-datacenter-manager 2/3] api: privileged: fix fchownat call
Lukas Wagner
l.wagner at proxmox.com
Tue Aug 12 09:31:50 CEST 2025
On Mon Aug 11, 2025 at 4:18 PM CEST, Stefan Hanreich wrote:
> When starting the privileged API, the server would fail with the
> following error messages:
>
> Error: unable to set ownership for api socket '/run/proxmox-datacenter-manager/priv.sock' - EINVAL: Invalid argument
>
> chown(2) only supports the AT_SYMLINK_NOFOLLOW, not AT_SYMLINK_FOLLOW
> so this was probably a oversight. Pass empty flags to fchownat
> instead.
>
> Signed-off-by: Stefan Hanreich <s.hanreich at proxmox.com>
> ---
> server/src/bin/proxmox-datacenter-privileged-api.rs | 13 +++----------
> 1 file changed, 3 insertions(+), 10 deletions(-)
>
> diff --git a/server/src/bin/proxmox-datacenter-privileged-api.rs b/server/src/bin/proxmox-datacenter-privileged-api.rs
> index 66033eb..bd2c6dd 100644
> --- a/server/src/bin/proxmox-datacenter-privileged-api.rs
> +++ b/server/src/bin/proxmox-datacenter-privileged-api.rs
> @@ -161,16 +161,9 @@ async fn run() -> Result<(), Error> {
> format_err!("unable to set mode for api socket '{sockpath:?}' - {err}")
> })?;
>
> - fchownat(
> - None,
> - sockpath,
> - None,
> - Some(api_user.gid),
> - AtFlags::AT_SYMLINK_FOLLOW,
> - )
> - .map_err(|err| {
> - format_err!("unable to set ownership for api socket '{sockpath}' - {err}")
> - })?;
> + fchownat(None, sockpath, None, Some(api_user.gid), AtFlags::empty()).map_err(
> + |err| format_err!("unable to set ownership for api socket '{sockpath}' - {err}"),
> + )?;
>
> log::info!("created socket, notifying readiness to systemd and starting API server");
>
For what it's worth, I already sent a similar patch that was already
applied by Thomas, but I guess he did not push the changes.
My patch used AT_SYMLINK_NOFOLLOW instead of passing no flags, but since
the socket is not and probably will never be a symlink, it should not
matter.
https://lore.proxmox.com/pdm-devel/20250807123712.218439-1-l.wagner@proxmox.com/T/#t
More information about the pdm-devel
mailing list