Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Several small fixes for open issues #4143

Merged
merged 7 commits into from
Dec 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 18 additions & 19 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ libsqlite3-sys = { version = "0.27.0", features = ["bundled"], optional = true }

# Crypto-related libraries
rand = { version = "0.8.5", features = ["small_rng"] }
ring = "0.17.6"
ring = "0.17.7"

# UUID generation
uuid = { version = "1.6.1", features = ["v4"] }
Expand Down Expand Up @@ -139,10 +139,7 @@ cookie = "0.16.2"
cookie_store = "0.19.1"

# Used by U2F, JWT and PostgreSQL
openssl = "=0.10.57"
# Set openssl-sys fixed to v0.9.92 to prevent building issues with musl, arm and 32bit pointer width
# It will force add a dynamically linked library which prevents the build from being static
openssl-sys = "=0.9.92"
openssl = "0.10.61"

# CLI argument parsing
pico-args = "0.5.0"
Expand Down
5 changes: 5 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,11 @@ fn run(args: &[&str]) -> Result<String, std::io::Error> {
/// - env!("GIT_REV")
/// - env!("VW_VERSION")
fn version_from_git_info() -> Result<String, std::io::Error> {
// Rerun when these paths are changed.
// Someone could have checked-out a tag or specific commit, but no other files changed.
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs/tags/");

// The exact tag for the current commit, can be empty when
// the current commit doesn't have an associated tag
let exact_tag = run(&["git", "describe", "--abbrev=0", "--tags", "--exact-match"]).ok();
Expand Down
10 changes: 10 additions & 0 deletions docker/healthcheck.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,16 @@

CONFIG_FILE="${DATA_FOLDER}"/config.json

# Check if there is a .env file configured
# If that is the case, load it into the environment before running any check
if [ -z "${ENV_FILE}" ]; then
ENV_FILE=".env"
fi
if [ -r "${ENV_FILE}" ]; then
# shellcheck disable=SC1090
. "${ENV_FILE}"
fi

# Given a config key, return the corresponding config value from the
# config file. If the key doesn't exist, return an empty string.
get_config_val() {
Expand Down
8 changes: 3 additions & 5 deletions src/api/core/ciphers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -849,7 +849,6 @@ async fn put_cipher_share_selected(
nt: Notify<'_>,
) -> EmptyResult {
let mut data: ShareSelectedCipherData = data.into_inner().data;
let mut cipher_ids: Vec<String> = Vec::new();

if data.Ciphers.is_empty() {
err!("You must select at least one cipher.")
Expand All @@ -860,10 +859,9 @@ async fn put_cipher_share_selected(
}

for cipher in data.Ciphers.iter() {
match cipher.Id {
Some(ref id) => cipher_ids.push(id.to_string()),
None => err!("Request missing ids field"),
};
if cipher.Id.is_none() {
err!("Request missing ids field")
}
}

while let Some(cipher) = data.Ciphers.pop() {
Expand Down
1 change: 1 addition & 0 deletions src/api/core/emergency_access.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ pub fn routes() -> Vec<Route> {
get_grantees,
get_emergency_access,
put_emergency_access,
post_emergency_access,
delete_emergency_access,
post_delete_emergency_access,
send_invite,
Expand Down
2 changes: 1 addition & 1 deletion src/db/models/organization.rs
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ impl UserOrganization {
}

pub fn restore(&mut self) -> bool {
if self.status < UserOrgStatus::Accepted as i32 {
if self.status < UserOrgStatus::Invited as i32 {
self.status += ACTIVATE_REVOKE_DIFF;
return true;
}
Expand Down
10 changes: 1 addition & 9 deletions src/util.rs
Original file line number Diff line number Diff line change
Expand Up @@ -363,15 +363,7 @@ pub fn write_file(path: &str, content: &[u8]) -> Result<(), crate::error::Error>
}

pub fn delete_file(path: &str) -> IOResult<()> {
let res = fs::remove_file(path);

if let Some(parent) = Path::new(path).parent() {
// If the directory isn't empty, this returns an error, which we ignore
// We only want to delete the folder if it's empty
fs::remove_dir(parent).ok();
}

res
fs::remove_file(path)
}

pub fn get_display_size(size: i32) -> String {
Expand Down