1
0
Fork 0
mirror of https://github.com/dani-garcia/vaultwarden.git synced 2025-05-28 14:33:56 +00:00

Move backend checks to build.rs to fail fast, and updated dependencies

This commit is contained in:
Daniel García 2019-07-09 17:26:34 +02:00
parent cef38bf40b
commit 05a1137828
No known key found for this signature in database
GPG key ID: FC8A7D14C3CD543A
9 changed files with 359 additions and 266 deletions

View file

@ -563,7 +563,7 @@ pub struct YubikeyMetadata {
}
use yubico::config::Config;
use yubico::Yubico;
use yubico::verify;
fn parse_yubikeys(data: &EnableYubikeyData) -> Vec<String> {
let data_keys = [&data.Key1, &data.Key2, &data.Key3, &data.Key4, &data.Key5];
@ -591,12 +591,11 @@ fn get_yubico_credentials() -> Result<(String, String), Error> {
fn verify_yubikey_otp(otp: String) -> EmptyResult {
let (yubico_id, yubico_secret) = get_yubico_credentials()?;
let yubico = Yubico::new();
let config = Config::default().set_client_id(yubico_id).set_key(yubico_secret);
match CONFIG.yubico_server() {
Some(server) => yubico.verify(otp, config.set_api_hosts(vec![server])),
None => yubico.verify(otp, config),
Some(server) => verify(otp, config.set_api_hosts(vec![server])),
None => verify(otp, config),
}
.map_res("Failed to verify OTP")
.and(Ok(()))

View file

@ -48,7 +48,7 @@ pub fn get_connection() -> Result<Connection, ConnectionError> {
/// Creates a back-up of the database using sqlite3
pub fn backup_database() -> Result<(), Error> {
let now: DateTime<Utc> = Utc::now();
let file_date = String::from(now.format("%Y%m%d").to_string());
let file_date = now.format("%Y%m%d").to_string();
let backup_command: String = format!("{}{}{}", ".backup 'db_", file_date, ".sqlite3'");
Command::new("sqlite3")

View file

@ -45,12 +45,6 @@ fn main() {
init_logging().ok();
}
#[cfg(all(feature = "sqlite", feature = "mysql"))]
compile_error!("Can't enable both backends");
#[cfg(not(any(feature = "sqlite", feature = "mysql")))]
compile_error!("You need to enable one DB backend. To build with previous defaults do: cargo build --features sqlite");
check_db();
check_rsa_keys();
check_web_vault();