* Re: [pbs-devel] possible problem in get_user_run_dir()
@ 2021-05-06 7:29 Dietmar Maurer
2021-05-06 7:36 ` Stefan Reiter
0 siblings, 1 reply; 4+ messages in thread
From: Dietmar Maurer @ 2021-05-06 7:29 UTC (permalink / raw)
To: Stefan Reiter, pbs-devel
> 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
Why do you want to use that directory at all? This is meant
for proxmox-backup server status, not for arbitrary user dada?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] possible problem in get_user_run_dir()
2021-05-06 7:29 [pbs-devel] possible problem in get_user_run_dir() Dietmar Maurer
@ 2021-05-06 7:36 ` Stefan Reiter
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Reiter @ 2021-05-06 7:36 UTC (permalink / raw)
To: Dietmar Maurer, pbs-devel
On 06/05/2021 09:29, Dietmar Maurer wrote:
>> 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
>
> Why do you want to use that directory at all? This is meant
> for proxmox-backup server status, not for arbitrary user dada?
>
It's used here for the VM map for single file restore, so temporary
data, just scoped per user.
^ permalink raw reply [flat|nested] 4+ messages in thread
* [pbs-devel] possible problem in get_user_run_dir()
@ 2021-05-06 6:39 Dietmar Maurer
2021-05-06 7:26 ` Stefan Reiter
0 siblings, 1 reply; 4+ messages in thread
From: Dietmar Maurer @ 2021-05-06 6:39 UTC (permalink / raw)
To: Stefan Reiter, pbs-devel
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?
--- 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)
}
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [pbs-devel] possible problem in get_user_run_dir()
2021-05-06 6:39 Dietmar Maurer
@ 2021-05-06 7:26 ` Stefan Reiter
0 siblings, 0 replies; 4+ messages in thread
From: Stefan Reiter @ 2021-05-06 7:26 UTC (permalink / raw)
To: Dietmar Maurer, pbs-devel
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)
> }
>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-06 7:36 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-06 7:29 [pbs-devel] possible problem in get_user_run_dir() Dietmar Maurer
2021-05-06 7:36 ` Stefan Reiter
-- strict thread matches above, loose matches on Subject: below --
2021-05-06 6:39 Dietmar Maurer
2021-05-06 7:26 ` Stefan Reiter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox