Skip to content

Commit

Permalink
nb state tmp file hack
Browse files Browse the repository at this point in the history
Signed-off-by: Renato Westphal <[email protected]>
  • Loading branch information
rwestphal committed Jan 26, 2024
1 parent ad9d2cf commit ccd0cc3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
4 changes: 2 additions & 2 deletions holo-daemon/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,8 +120,8 @@ fn privdrop(user: &str) -> nix::Result<()> {

// Drop to unprivileged user and group.
if let Some(user) = User::from_name(user)? {
nix::unistd::chroot(&user.dir)?;
nix::unistd::chdir("/")?;
//nix::unistd::chroot(&user.dir)?;
//nix::unistd::chdir("/")?;
nix::unistd::setgroups(&[user.gid])?;
nix::unistd::setresgid(user.gid, user.gid, user.gid)?;
nix::unistd::setresuid(user.uid, user.uid, user.uid)?;
Expand Down
10 changes: 10 additions & 0 deletions holo-daemon/src/northbound/core.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,16 @@ impl Northbound {
}
};

// XXX REMOVE ME
let json = dtree
.print_string(
DataFormat::JSON,
DataPrinterFlags::WITH_SIBLINGS | DataPrinterFlags::WD_TRIM,
)
.unwrap()
.unwrap_or_default();
let _ = std::fs::write("/tmp/holo-nb-state", json);

Ok(capi::client::GetResponse { dtree })
}

Expand Down

0 comments on commit ccd0cc3

Please sign in to comment.