cleanup
This commit is contained in:
parent
1dcb11643c
commit
f254f3370d
5 changed files with 4 additions and 9 deletions
|
@ -9,7 +9,6 @@ use k2v_client::{BatchDeleteOp, BatchReadOp, Filter, K2vClient, K2vValue};
|
||||||
use rusoto_s3::{
|
use rusoto_s3::{
|
||||||
DeleteObjectRequest, GetObjectRequest, ListObjectsV2Request, PutObjectRequest, S3Client, S3,
|
DeleteObjectRequest, GetObjectRequest, ListObjectsV2Request, PutObjectRequest, S3Client, S3,
|
||||||
};
|
};
|
||||||
use rusoto_signature::Region;
|
|
||||||
|
|
||||||
use crate::cryptoblob::*;
|
use crate::cryptoblob::*;
|
||||||
use crate::login::Credentials;
|
use crate::login::Credentials;
|
||||||
|
|
|
@ -5,7 +5,7 @@ use anyhow::{anyhow, Result};
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use zstd::stream::{decode_all as zstd_decode, encode_all as zstd_encode};
|
use zstd::stream::{decode_all as zstd_decode, encode_all as zstd_encode};
|
||||||
|
|
||||||
use sodiumoxide::crypto::box_ as publicbox;
|
//use sodiumoxide::crypto::box_ as publicbox;
|
||||||
use sodiumoxide::crypto::secretbox::xsalsa20poly1305 as secretbox;
|
use sodiumoxide::crypto::secretbox::xsalsa20poly1305 as secretbox;
|
||||||
|
|
||||||
pub use sodiumoxide::crypto::box_::{
|
pub use sodiumoxide::crypto::box_::{
|
||||||
|
|
|
@ -32,8 +32,7 @@ impl LoginProvider for StaticLoginProvider {
|
||||||
match self.users.get(username) {
|
match self.users.get(username) {
|
||||||
None => bail!("User {} does not exist", username),
|
None => bail!("User {} does not exist", username),
|
||||||
Some(u) => {
|
Some(u) => {
|
||||||
if u.password != password {
|
if !verify_password(password, &u.password) {
|
||||||
// TODO cryptographic password compare
|
|
||||||
bail!("Wrong password");
|
bail!("Wrong password");
|
||||||
}
|
}
|
||||||
let bucket = u
|
let bucket = u
|
||||||
|
@ -56,7 +55,7 @@ impl LoginProvider for StaticLoginProvider {
|
||||||
(Some(m), Some(s)) => {
|
(Some(m), Some(s)) => {
|
||||||
let master_key = Key::from_slice(&base64::decode(m)?)
|
let master_key = Key::from_slice(&base64::decode(m)?)
|
||||||
.ok_or(anyhow!("Invalid master key"))?;
|
.ok_or(anyhow!("Invalid master key"))?;
|
||||||
let secret_key = SecretKey::from_slice(&base64::decode(m)?)
|
let secret_key = SecretKey::from_slice(&base64::decode(s)?)
|
||||||
.ok_or(anyhow!("Invalid secret key"))?;
|
.ok_or(anyhow!("Invalid secret key"))?;
|
||||||
CryptoKeys::open_without_password(&storage, &master_key, &secret_key).await?
|
CryptoKeys::open_without_password(&storage, &master_key, &secret_key).await?
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ use anyhow::Result;
|
||||||
use k2v_client::K2vClient;
|
use k2v_client::K2vClient;
|
||||||
use rand::prelude::*;
|
use rand::prelude::*;
|
||||||
use rusoto_s3::S3Client;
|
use rusoto_s3::S3Client;
|
||||||
use rusoto_signature::Region;
|
|
||||||
|
|
||||||
use crate::bayou::Bayou;
|
use crate::bayou::Bayou;
|
||||||
use crate::cryptoblob::Key;
|
use crate::cryptoblob::Key;
|
||||||
|
|
|
@ -8,7 +8,6 @@ mod time;
|
||||||
mod uidindex;
|
mod uidindex;
|
||||||
|
|
||||||
use std::path::PathBuf;
|
use std::path::PathBuf;
|
||||||
use std::sync::Arc;
|
|
||||||
|
|
||||||
use anyhow::{bail, Result};
|
use anyhow::{bail, Result};
|
||||||
use clap::{Parser, Subcommand};
|
use clap::{Parser, Subcommand};
|
||||||
|
@ -18,8 +17,7 @@ use rusoto_signature::Region;
|
||||||
|
|
||||||
use config::*;
|
use config::*;
|
||||||
use cryptoblob::*;
|
use cryptoblob::*;
|
||||||
use login::{ldap_provider::*, static_provider::*, *};
|
use login::{static_provider::*, *};
|
||||||
use mailbox::Mailbox;
|
|
||||||
use server::Server;
|
use server::Server;
|
||||||
|
|
||||||
#[derive(Parser, Debug)]
|
#[derive(Parser, Debug)]
|
||||||
|
|
Loading…
Reference in a new issue