all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Stefan Reiter <s.reiter@proxmox.com>
To: Dietmar Maurer <dietmar@proxmox.com>,
	"pbs-devel@lists.proxmox.com" <pbs-devel@lists.proxmox.com>
Subject: Re: [pbs-devel] possible problem in get_user_run_dir()
Date: Thu, 6 May 2021 09:26:02 +0200	[thread overview]
Message-ID: <3bf5618b-42bb-099a-72e0-1de8a79272dd@proxmox.com> (raw)
In-Reply-To: <812801204.222.1620283181019@webmail.proxmox.com>

On 06/05/2021 08:39, Dietmar Maurer wrote:
> The code get_user_run_dir() looks wrong, because a normal user does not have
> permissions required for tools::create_run_dir().
> 
> Please can you take a look at that?
> 

Yes, already had an off-list discussion with Fabian about this, the 
problem here is that /run/proxmox-backup might not exist when this is 
run, but only root can create it - so far, only root calls it (despite 
the misleading comment), so it works, but for the future, we might want 
to fall back to XDG_USER_RUNTIME_DIR (doesn't always exist though), /tmp 
or some other guaranteed-user-writeable temp location.

> --- from src/bin/proxmox_client_tools/mod.rs---
> 
> pub fn get_user_run_dir() -> Result<std::path::PathBuf, Error> {
>      let uid = nix::unistd::Uid::current();
>      let mut path: std::path::PathBuf = buildcfg::PROXMOX_BACKUP_RUN_DIR.into();
>      path.push(uid.to_string());
>      tools::create_run_dir()?;
>      std::fs::create_dir_all(&path)?;
>      Ok(path)
> }
> 




  reply	other threads:[~2021-05-06  7:26 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-06  6:39 Dietmar Maurer
2021-05-06  7:26 ` Stefan Reiter [this message]
2021-05-06  7:29 Dietmar Maurer
2021-05-06  7:36 ` Stefan Reiter

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3bf5618b-42bb-099a-72e0-1de8a79272dd@proxmox.com \
    --to=s.reiter@proxmox.com \
    --cc=dietmar@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal