Cargo fix

This commit is contained in:
Nadja Reitzenstein 2022-03-15 20:00:43 +01:00
parent 2e5f343d52
commit c0b311e14c
29 changed files with 128 additions and 133 deletions

View File

@ -3,20 +3,20 @@ use crate::resources::state::State;
use crate::{Config, ResourcesHandle}; use crate::{Config, ResourcesHandle};
use async_compat::CompatExt; use async_compat::CompatExt;
use executor::pool::Executor; use executor::pool::Executor;
use futures_signals::signal::{MutableSignalRef, ReadOnlyMutable, Signal}; use futures_signals::signal::{Signal};
use futures_util::future::BoxFuture; use futures_util::future::BoxFuture;
use rumqttc::{AsyncClient, ConnectionError, Event, Incoming, MqttOptions}; use rumqttc::{AsyncClient, ConnectionError, Event, Incoming, MqttOptions};
use std::cell::Cell; use std::cell::Cell;
use std::collections::HashMap; use std::collections::HashMap;
use std::future::Future; use std::future::Future;
use std::ops::Deref;
use std::pin::Pin; use std::pin::Pin;
use std::sync::Mutex;
use std::task::{Context, Poll}; use std::task::{Context, Poll};
use std::time::Duration; use std::time::Duration;
use anyhow::Context as _;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rustls::{Certificate, RootCertStore}; use rustls::{RootCertStore};
use url::Url; use url::Url;
use crate::actors::dummy::Dummy; use crate::actors::dummy::Dummy;
use crate::actors::process::Process; use crate::actors::process::Process;

View File

@ -1,11 +1,11 @@
use crate::users::db::UserDB;
use crate::users::Users; use crate::users::Users;
use rsasl::error::{SASLError, SessionError}; use rsasl::error::{SessionError};
use rsasl::mechname::Mechname; use rsasl::mechname::Mechname;
use rsasl::property::{AuthId, Password}; use rsasl::property::{AuthId, Password};
use rsasl::session::{Session, SessionData}; use rsasl::session::{Session, SessionData};
use rsasl::validate::{validations, Validation}; use rsasl::validate::{validations, Validation};
use rsasl::{Property, SASL}; use rsasl::{SASL};
use std::sync::Arc; use std::sync::Arc;
struct Callback { struct Callback {
@ -21,7 +21,7 @@ impl rsasl::callback::Callback for Callback {
&self, &self,
session: &mut SessionData, session: &mut SessionData,
validation: Validation, validation: Validation,
mechanism: &Mechname, _mechanism: &Mechname,
) -> Result<(), SessionError> { ) -> Result<(), SessionError> {
match validation { match validation {
validations::SIMPLE => { validations::SIMPLE => {
@ -38,7 +38,7 @@ impl rsasl::callback::Callback for Callback {
if user if user
.check_password(passwd.as_bytes()) .check_password(passwd.as_bytes())
.map_err(|e| SessionError::AuthenticationFailure)? .map_err(|_e| SessionError::AuthenticationFailure)?
{ {
Ok(()) Ok(())
} else { } else {

View File

@ -1,8 +1,8 @@
use std::sync::Arc;
use crate::authorization::permissions::Permission;
use crate::authorization::roles::{Role, Roles}; use crate::authorization::roles::{Roles};
use crate::Users; use crate::Users;
use crate::users::UserRef;
pub mod permissions; pub mod permissions;
pub mod roles; pub mod roles;

View File

@ -2,10 +2,10 @@ use capnp::capability::Promise;
use capnp::Error; use capnp::Error;
use capnp_rpc::pry; use capnp_rpc::pry;
use rsasl::property::AuthId; use rsasl::property::AuthId;
use rsasl::session::{Session, Step, StepResult}; use rsasl::session::{Session, Step};
use std::io::Cursor; use std::io::Cursor;
use crate::authorization::AuthorizationHandle;
use crate::capnp::session::APISession; use crate::capnp::session::APISession;
use crate::session::SessionManager; use crate::session::SessionManager;
use api::authenticationsystem_capnp::authentication::{ use api::authenticationsystem_capnp::authentication::{

View File

@ -53,7 +53,7 @@ impl bootstrap::Server for BootCap {
fn mechanisms( fn mechanisms(
&mut self, &mut self,
params: bootstrap::MechanismsParams, _params: bootstrap::MechanismsParams,
mut result: bootstrap::MechanismsResults, mut result: bootstrap::MechanismsResults,
) -> Promise<(), ::capnp::Error> { ) -> Promise<(), ::capnp::Error> {
let span = tracing::trace_span!("mechanisms", peer_addr=%self.peer_addr); let span = tracing::trace_span!("mechanisms", peer_addr=%self.peer_addr);
@ -61,7 +61,7 @@ impl bootstrap::Server for BootCap {
tracing::trace!("mechanisms"); tracing::trace!("mechanisms");
let mut builder = result.get(); let builder = result.get();
let mechs: Vec<_> = self.authentication.list_available_mechs() let mechs: Vec<_> = self.authentication.list_available_mechs()
.into_iter() .into_iter()
.map(|m| m.as_str()) .map(|m| m.as_str())

View File

@ -1,4 +1,4 @@
use crate::resources::modules::fabaccess::{MachineState, Status}; use crate::resources::modules::fabaccess::{Status};
use crate::resources::Resource; use crate::resources::Resource;
use crate::session::SessionHandle; use crate::session::SessionHandle;
use api::machine_capnp::machine::{ use api::machine_capnp::machine::{
@ -17,7 +17,7 @@ pub struct Machine {
impl Machine { impl Machine {
/// Builds a machine into the given builder. Re /// Builds a machine into the given builder. Re
pub fn build(session: SessionHandle, resource: Resource, builder: Builder) { pub fn build(session: SessionHandle, resource: Resource, _builder: Builder) {
if resource.visible(&session) {} if resource.visible(&session) {}
} }
} }
@ -178,7 +178,7 @@ impl ManageServer for Machine {
_: manage::ForceFreeResults, _: manage::ForceFreeResults,
) -> Promise<(), ::capnp::Error> { ) -> Promise<(), ::capnp::Error> {
let resource = self.resource.clone(); let resource = self.resource.clone();
let session = self.session.clone(); let _session = self.session.clone();
Promise::from_future(async move { Promise::from_future(async move {
resource.force_set(Status::Free).await; resource.force_set(Status::Free).await;
Ok(()) Ok(())
@ -213,7 +213,7 @@ impl ManageServer for Machine {
_: manage::DisabledParams, _: manage::DisabledParams,
_: manage::DisabledResults, _: manage::DisabledResults,
) -> Promise<(), ::capnp::Error> { ) -> Promise<(), ::capnp::Error> {
let mut resource = self.resource.clone(); let resource = self.resource.clone();
Promise::from_future(async move { Promise::from_future(async move {
resource.force_set(Status::Disabled).await; resource.force_set(Status::Disabled).await;
Ok(()) Ok(())

View File

@ -1,4 +1,4 @@
use crate::authorization::AuthorizationHandle;
use crate::session::SessionHandle; use crate::session::SessionHandle;
use api::machinesystem_capnp::machine_system::{ use api::machinesystem_capnp::machine_system::{
info, InfoParams, InfoResults, Server as MachineSystem, info, InfoParams, InfoResults, Server as MachineSystem,
@ -45,7 +45,7 @@ impl info::Server for Machines {
let mut builder = result.get().init_machine_list(machine_list.len() as u32); let mut builder = result.get().init_machine_list(machine_list.len() as u32);
for (i, m) in machine_list { for (i, m) in machine_list {
let resource = m.clone(); let resource = m.clone();
let mut mbuilder = builder.reborrow().get(i as u32); let mbuilder = builder.reborrow().get(i as u32);
Machine::build(self.session.clone(), resource, mbuilder); Machine::build(self.session.clone(), resource, mbuilder);
} }
@ -61,7 +61,7 @@ impl info::Server for Machines {
let id = pry!(params.get_id()); let id = pry!(params.get_id());
if let Some(resource) = self.resources.get_by_id(id) { if let Some(resource) = self.resources.get_by_id(id) {
let mut builder = result.get(); let builder = result.get();
Machine::build(self.session.clone(), resource.clone(), builder); Machine::build(self.session.clone(), resource.clone(), builder);
} }
@ -77,7 +77,7 @@ impl info::Server for Machines {
let urn = pry!(params.get_urn()); let urn = pry!(params.get_urn());
if let Some(resource) = self.resources.get_by_urn(urn) { if let Some(resource) = self.resources.get_by_urn(urn) {
let mut builder = result.get(); let builder = result.get();
Machine::build(self.session.clone(), resource.clone(), builder); Machine::build(self.session.clone(), resource.clone(), builder);
} }

View File

@ -1,9 +1,9 @@
use crate::config::Listen; use crate::config::Listen;
use crate::{Diflouroborane, TlsConfig};
use anyhow::Context;
use async_net::TcpListener; use async_net::TcpListener;
use capnp::capability::Promise;
use capnp::Error;
use capnp_rpc::rpc_twoparty_capnp::Side; use capnp_rpc::rpc_twoparty_capnp::Side;
use capnp_rpc::twoparty::VatNetwork; use capnp_rpc::twoparty::VatNetwork;
use capnp_rpc::RpcSystem; use capnp_rpc::RpcSystem;
@ -12,17 +12,17 @@ use futures_rustls::server::TlsStream;
use futures_rustls::TlsAcceptor; use futures_rustls::TlsAcceptor;
use futures_util::stream::FuturesUnordered; use futures_util::stream::FuturesUnordered;
use futures_util::{stream, AsyncRead, AsyncWrite, FutureExt, StreamExt}; use futures_util::{stream, AsyncRead, AsyncWrite, FutureExt, StreamExt};
use std::fs::File;
use std::future::Future; use std::future::Future;
use std::io; use std::io;
use std::io::BufReader;
use std::net::SocketAddr;
use std::sync::Arc;
use nix::sys::socket::SockAddr;
use crate::authentication::AuthenticationHandle;
use crate::authorization::AuthorizationHandle;
use crate::error::Result; use std::net::SocketAddr;
use crate::authentication::AuthenticationHandle;
use crate::session::SessionManager; use crate::session::SessionManager;
mod authenticationsystem; mod authenticationsystem;
@ -69,7 +69,7 @@ impl APIServer {
let span = tracing::info_span!("binding API listen sockets"); let span = tracing::info_span!("binding API listen sockets");
let _guard = span.enter(); let _guard = span.enter();
let mut sockets = FuturesUnordered::new(); let sockets = FuturesUnordered::new();
listens listens
.into_iter() .into_iter()

View File

@ -1,11 +1,11 @@
use api::permissionsystem_capnp::permission_system::Server as PermissionSystem; use api::permissionsystem_capnp::permission_system::Server as PermissionSystem;
use crate::authorization::AuthorizationHandle;
use crate::session::SessionHandle; use crate::session::SessionHandle;
pub struct Permissions; pub struct Permissions;
impl Permissions { impl Permissions {
pub fn new(session: SessionHandle) -> Self { pub fn new(_session: SessionHandle) -> Self {
Self Self
} }
} }

View File

@ -1,11 +1,11 @@
use api::authenticationsystem_capnp::response::successful::Builder; use api::authenticationsystem_capnp::response::successful::Builder;
use capnp::capability::Promise;
use crate::authorization::AuthorizationHandle;
use crate::capnp::machinesystem::Machines; use crate::capnp::machinesystem::Machines;
use crate::capnp::permissionsystem::Permissions; use crate::capnp::permissionsystem::Permissions;
use crate::capnp::user_system::Users; use crate::capnp::user_system::Users;
use crate::session::{SessionHandle, SessionManager}; use crate::session::{SessionHandle};
use crate::users::UserRef;
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
pub struct APISession; pub struct APISession;
@ -15,7 +15,7 @@ impl APISession {
Self Self
} }
pub fn build(session: SessionHandle, mut builder: Builder) { pub fn build(session: SessionHandle, builder: Builder) {
let mut builder = builder.init_session(); let mut builder = builder.init_session();
builder.set_machine_system(capnp_rpc::new_client(Machines::new(session.clone()))); builder.set_machine_system(capnp_rpc::new_client(Machines::new(session.clone())));
builder.set_user_system(capnp_rpc::new_client(Users::new(session.clone()))); builder.set_user_system(capnp_rpc::new_client(Users::new(session.clone())));

View File

@ -1,4 +1,4 @@
use api::permissionsystem_capnp::permission_system::Server as PermissionSystem;
use api::user_capnp::user::{ use api::user_capnp::user::{
info, info,
manage, manage,

View File

@ -1,13 +1,11 @@
use capnp::capability::Promise;
use capnp::Error;
use capnp_rpc::pry;
use api::usersystem_capnp::user_system::{ use api::usersystem_capnp::user_system::{
Server as UserSystem, Server as UserSystem, info::Server as InfoServer, manage::Server as ManageServer,
info, info::Server as InfoServer,
manage, manage::Server as ManageServer,
}; };
use crate::authorization::AuthorizationHandle;
use crate::session::SessionHandle; use crate::session::SessionHandle;
#[derive(Clone)] #[derive(Clone)]

View File

@ -2,13 +2,13 @@ use std::default::Default;
use std::path::{Path, PathBuf}; use std::path::{Path, PathBuf};
use std::collections::HashMap; use std::collections::HashMap;
use serde::{Serialize, Deserialize, Deserializer, Serializer}; use serde::{Serialize, Deserialize};
use std::fmt::Formatter; use std::fmt::Formatter;
use std::net::{SocketAddr, IpAddr, ToSocketAddrs}; use std::net::{ToSocketAddrs};
use std::str::FromStr;
use serde::de::Error;
use crate::authorization::permissions::{PermRule, PrivilegesBuf}; use crate::authorization::permissions::{PrivilegesBuf};
use crate::authorization::roles::Role; use crate::authorization::roles::Role;
type Result<T> = std::result::Result<T, serde_dhall::Error>; type Result<T> = std::result::Result<T, serde_dhall::Error>;
@ -153,7 +153,7 @@ impl Default for Config {
fn default() -> Self { fn default() -> Self {
let mut actors: HashMap::<String, ModuleConfig> = HashMap::new(); let mut actors: HashMap::<String, ModuleConfig> = HashMap::new();
let mut initiators: HashMap::<String, ModuleConfig> = HashMap::new(); let mut initiators: HashMap::<String, ModuleConfig> = HashMap::new();
let mut machines = HashMap::new(); let machines = HashMap::new();
actors.insert("Actor".to_string(), ModuleConfig { actors.insert("Actor".to_string(), ModuleConfig {
module: "Shelly".to_string(), module: "Shelly".to_string(),

View File

@ -1,13 +1,13 @@
use std::{fs, io}; use std::{fs};
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::{Debug, Display, Formatter}; use std::fmt::{Debug, Display, Formatter};
use std::io::Write; use std::io::Write;
use std::path::Path; use std::path::Path;
use std::sync::atomic::{AtomicU64, Ordering}; use std::sync::atomic::{AtomicU64, Ordering};
use std::sync::{Mutex, RwLock}; use std::sync::{RwLock};
use anyhow::Context; use anyhow::Context;
use lmdb::Environment;
use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Infallible, Fallible, ArchiveUnsized, SerializeUnsized}; use rkyv::{Archive, Serialize, Deserialize, AlignedVec, Archived, with::Lock, Fallible};
use rkyv::de::deserializers::SharedDeserializeMap; use rkyv::de::deserializers::SharedDeserializeMap;
use rkyv::ser::Serializer; use rkyv::ser::Serializer;
use rkyv::ser::serializers::{AlignedSerializer, AllocScratch, AllocScratchError, AllocSerializer, CompositeSerializer, CompositeSerializerError, FallbackScratch, HeapScratch, ScratchTracker, SharedSerializeMap, SharedSerializeMapError}; use rkyv::ser::serializers::{AlignedSerializer, AllocScratch, AllocScratchError, AllocSerializer, CompositeSerializer, CompositeSerializerError, FallbackScratch, HeapScratch, ScratchTracker, SharedSerializeMap, SharedSerializeMapError};
@ -131,7 +131,7 @@ impl<I> DbIndexManager<I>
let mut serializer = Ser::default(); let mut serializer = Ser::default();
tracing::trace!(?serializer, "serializing db index"); tracing::trace!(?serializer, "serializing db index");
let root = serializer.serialize_value(self).context("serializing database index failed")?; let root = serializer.serialize_value(self).context("serializing database index failed")?;
let (s, c, h) = serializer.0.into_components(); let (s, c, _h) = serializer.0.into_components();
let v = s.into_inner(); let v = s.into_inner();
tracing::trace!(%root, tracing::trace!(%root,
len = v.len(), len = v.len(),

View File

@ -12,7 +12,7 @@ pub use lmdb::{
RwTransaction, RwTransaction,
}; };
use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec, Archived}; use rkyv::{Fallible, Serialize, ser::serializers::AllocSerializer, AlignedVec};
mod raw; mod raw;
pub use raw::RawDB; pub use raw::RawDB;
@ -40,18 +40,18 @@ pub use fix::LMDBorrow;
use lmdb::Error; use lmdb::Error;
use rkyv::Deserialize; use rkyv::Deserialize;
use rkyv::ser::serializers::AlignedSerializer; use rkyv::ser::serializers::AlignedSerializer;
use std::sync::Arc;
use std::path::Path;
use crate::users::db::{User, UserDB}; use crate::users::db::{User};
use std::collections::HashMap; use std::collections::HashMap;
use std::fmt::{Display, Formatter}; use std::fmt::{Display, Formatter};
use rkyv::Infallible; use rkyv::Infallible;
use crate::resources::state::{State, db::StateDB}; use crate::resources::state::{State};
use std::iter::FromIterator; use std::iter::FromIterator;
use std::ops::Deref; use std::ops::Deref;
use crate::resources::search::ResourcesHandle; use crate::resources::search::ResourcesHandle;
use crate::utils::oid::{ArchivedObjectIdentifier, ObjectIdentifier};
use crate::resources::state::value::SerializeValue;
use crate::Users; use crate::Users;
#[derive(Debug)] #[derive(Debug)]

View File

@ -148,7 +148,7 @@ impl<S: Signal<Item=ResourceSink> + Unpin, I: Initiator + Unpin> Future for Init
// TODO: Log initiator error here // TODO: Log initiator error here
} }
} }
} else if let Some(ref mut resource) = self.resource { } else if let Some(ref mut _resource) = self.resource {
let mut s = self.update_sink.clone(); let mut s = self.update_sink.clone();
let f = self.initiator.run(&mut s); let f = self.initiator.run(&mut s);
self.initiator_future.replace(f); self.initiator_future.replace(f);

View File

@ -39,24 +39,24 @@ mod logging;
mod audit; mod audit;
mod session; mod session;
use std::collections::HashMap;
use std::fs::File;
use std::io::BufReader;
use std::path::Path;
use std::sync::{Arc, Mutex}; use std::sync::{Arc};
use std::time::Duration;
use anyhow::Context; use anyhow::Context;
use futures_rustls::TlsAcceptor;
use futures_util::StreamExt; use futures_util::StreamExt;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use rustls::{Certificate, KeyLogFile, PrivateKey, ServerConfig};
use rustls::server::NoClientAuth;
use signal_hook::consts::signal::*; use signal_hook::consts::signal::*;
use executor::pool::Executor; use executor::pool::Executor;
use crate::authentication::AuthenticationHandle; use crate::authentication::AuthenticationHandle;
use crate::authorization::roles::Roles; use crate::authorization::roles::Roles;
use crate::capnp::APIServer; use crate::capnp::APIServer;
use crate::config::{Config, TlsListen}; use crate::config::{Config};
use crate::resources::modules::fabaccess::MachineState; use crate::resources::modules::fabaccess::MachineState;
use crate::resources::Resource; use crate::resources::Resource;
use crate::resources::search::ResourcesHandle; use crate::resources::search::ResourcesHandle;
@ -121,7 +121,7 @@ impl Diflouroborane {
let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone()); let sessionmanager = SessionManager::new(self.users.clone(), self.roles.clone());
let authentication = AuthenticationHandle::new(self.users.clone()); let authentication = AuthenticationHandle::new(self.users.clone());
let mut apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?; let apiserver = self.executor.run(APIServer::bind(self.executor.clone(), &self.config.listens, acceptor, sessionmanager, authentication))?;
let (mut tx, rx) = async_oneshot::oneshot(); let (mut tx, rx) = async_oneshot::oneshot();

View File

@ -1,8 +1,8 @@
use tracing_subscriber::{EnvFilter, fmt}; use tracing_subscriber::{EnvFilter};
use crate::Config; use crate::Config;
pub fn init(config: &Config) { pub fn init(config: &Config) {
let mut builder = tracing_subscriber::fmt() let builder = tracing_subscriber::fmt()
.with_env_filter(EnvFilter::from_default_env()); .with_env_filter(EnvFilter::from_default_env());
let format = config.log_format.to_lowercase(); let format = config.log_format.to_lowercase();
match format.as_str() { match format.as_str() {

View File

@ -1,12 +1,12 @@
use rkyv::{Archive, Serialize, Deserialize}; use rkyv::{Archive, Serialize, Deserialize};
use crate::db::DB;
use crate::db::{AlignedAdapter, AllocAdapter};
use crate::db::RawDB;
use std::sync::Arc;
use crate::db::{Environment, DatabaseFlags};
use crate::db::Result;
use crate::resources::state::db::StateDB;
#[derive(Clone, Debug, PartialEq, Eq)] #[derive(Clone, Debug, PartialEq, Eq)]
#[derive(Archive, Serialize, Deserialize)] #[derive(Archive, Serialize, Deserialize)]

View File

@ -1,4 +1,4 @@
use std::ops::Deref;
use std::sync::Arc; use std::sync::Arc;
use futures_signals::signal::{Mutable, Signal, SignalExt}; use futures_signals::signal::{Mutable, Signal, SignalExt};
use lmdb::RoTransaction; use lmdb::RoTransaction;

View File

@ -1,14 +1,14 @@
use std::ops::Deref;
use crate::utils::oid::ObjectIdentifier; use crate::utils::oid::ObjectIdentifier;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
use rkyv::{Archive, Archived, Deserialize, Serialize, Infallible}; use rkyv::{Archive, Archived, Deserialize, Infallible};
use rkyv_dyn::{DynError, DynSerializer};
use std::str::FromStr; use std::str::FromStr;
use crate::oidvalue; use crate::oidvalue;
use crate::resources::state::{State}; use crate::resources::state::{State};
use crate::resources::state::value::Value;
use crate::session::SessionHandle;
use crate::users::UserRef; use crate::users::UserRef;
/// Status of a Machine /// Status of a Machine
@ -66,7 +66,7 @@ impl MachineState {
} }
pub fn from(dbstate: &Archived<State>) -> Self { pub fn from(dbstate: &Archived<State>) -> Self {
use std::any::TypeId;
let state: &Archived<MachineState> = &dbstate.inner; let state: &Archived<MachineState> = &dbstate.inner;
Deserialize::deserialize(state, &mut Infallible).unwrap() Deserialize::deserialize(state, &mut Infallible).unwrap()
} }

View File

@ -1,8 +1,6 @@
use std::{ use std::{
collections::hash_map::DefaultHasher,
fmt, fmt,
hash::{ hash::{
Hash,
Hasher Hasher
}, },
}; };
@ -11,7 +9,6 @@ use std::ops::Deref;
use rkyv::{ use rkyv::{
Archive, Archive,
Archived,
Deserialize, Deserialize,
out_field, out_field,
Serialize, Serialize,
@ -20,12 +17,12 @@ use serde::de::{Error, MapAccess, Unexpected};
use serde::Deserializer; use serde::Deserializer;
use serde::ser::SerializeMap; use serde::ser::SerializeMap;
use value::{RegisteredImpl, SerializeValue};
use crate::MachineState; use crate::MachineState;
use crate::resources::modules::fabaccess::OID_VALUE; use crate::resources::modules::fabaccess::OID_VALUE;
use crate::utils::oid::ObjectIdentifier; use crate::utils::oid::ObjectIdentifier;
use crate::resources::state::value::{DynOwnedVal, DynVal, TypeOid, Value};
pub mod value; pub mod value;
pub mod db; pub mod db;

View File

@ -6,7 +6,7 @@ use rkyv::{
DeserializeUnsized, Fallible, Serialize, SerializeUnsized, DeserializeUnsized, Fallible, Serialize, SerializeUnsized,
}; };
use rkyv_dyn::{DynDeserializer, DynError, DynSerializer}; use rkyv_dyn::{DynDeserializer, DynError, DynSerializer};
use rkyv_typename::TypeName;
use crate::utils::oid::ObjectIdentifier; use crate::utils::oid::ObjectIdentifier;
use inventory; use inventory;
@ -544,7 +544,7 @@ pub mod macros {
}; };
} }
} }
use macros::*;
lazy_static::lazy_static! { lazy_static::lazy_static! {
pub static ref OID_BOOL: ObjectIdentifier = { pub static ref OID_BOOL: ObjectIdentifier = {

View File

@ -1,9 +1,9 @@
use std::path::PathBuf;
use std::sync::Arc;
use anyhow::Context;
use lmdb::Environment;
use once_cell::sync::OnceCell; use once_cell::sync::OnceCell;
use crate::authorization::roles::{Role, Roles}; use crate::authorization::roles::{Roles};
use crate::resources::Resource; use crate::resources::Resource;
use crate::session::db::SessionCache; use crate::session::db::SessionCache;
use crate::Users; use crate::Users;

View File

@ -3,13 +3,13 @@ use std::io;
use std::io::BufReader; use std::io::BufReader;
use std::path::Path; use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use anyhow::anyhow;
use futures_rustls::TlsAcceptor; use futures_rustls::TlsAcceptor;
use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite}; use rustls::{Certificate, PrivateKey, ServerConfig, SupportedCipherSuite};
use rustls::version::{TLS12, TLS13}; use rustls::version::{TLS12, TLS13};
use tracing::{Level, Span}; use tracing::{Level};
use crate::config; use crate::config;
use crate::config::Listen;
use crate::keylog::KeyLogFile; use crate::keylog::KeyLogFile;
fn lookup_cipher_suite(name: &str) -> Option<SupportedCipherSuite> { fn lookup_cipher_suite(name: &str) -> Option<SupportedCipherSuite> {
@ -84,11 +84,11 @@ impl TlsConfig {
} }
}; };
let mut tls_builder = ServerConfig::builder() let tls_builder = ServerConfig::builder()
.with_safe_default_cipher_suites() .with_safe_default_cipher_suites()
.with_safe_default_kx_groups(); .with_safe_default_kx_groups();
let mut tls_builder = if let Some(ref min) = config.tls_min_version { let tls_builder = if let Some(ref min) = config.tls_min_version {
match min.as_str() { match min.as_str() {
"tls12" => tls_builder.with_protocol_versions(&[&TLS12]), "tls12" => tls_builder.with_protocol_versions(&[&TLS12]),
"tls13" => tls_builder.with_protocol_versions(&[&TLS13]), "tls13" => tls_builder.with_protocol_versions(&[&TLS13]),

View File

@ -1,8 +1,8 @@
use crate::db::{AllocAdapter, Environment, RawDB, Result, DB}; use crate::db::{AllocAdapter, Environment, RawDB, Result, DB};
use crate::db::{DatabaseFlags, LMDBorrow, RoTransaction, WriteFlags}; use crate::db::{DatabaseFlags, LMDBorrow, RoTransaction, WriteFlags};
use lmdb::{RwTransaction, Transaction}; use lmdb::{Transaction};
use std::collections::{HashMap, HashSet}; use std::collections::{HashMap};
use std::path::Path;
use std::sync::Arc; use std::sync::Arc;
use anyhow::Context; use anyhow::Context;

View File

@ -25,8 +25,8 @@ use std::sync::Arc;
pub mod db; pub mod db;
use crate::authorization::roles::Role;
use crate::db::LMDBorrow;
use crate::users::db::UserData; use crate::users::db::UserData;
use crate::UserDB; use crate::UserDB;
@ -93,7 +93,7 @@ impl Users {
pub fn load_file<P: AsRef<Path>>(&self, path: P) -> anyhow::Result<()> { pub fn load_file<P: AsRef<Path>>(&self, path: P) -> anyhow::Result<()> {
let f = std::fs::read(path)?; let f = std::fs::read(path)?;
let mut map: HashMap<String, UserData> = toml::from_slice(&f)?; let map: HashMap<String, UserData> = toml::from_slice(&f)?;
for (uid, mut userdata) in map { for (uid, mut userdata) in map {
userdata.passwd = userdata.passwd.map(|pw| { userdata.passwd = userdata.passwd.map(|pw| {

View File

@ -1,7 +1,7 @@
use std::collections::HashMap; use std::collections::HashMap;
use capnp::capability::Promise;
use capnp::Error;
use capnp_rpc::pry;
use once_cell::sync::Lazy; use once_cell::sync::Lazy;
struct Locales { struct Locales {

View File

@ -1,15 +1,15 @@
use clap::{Arg, Command}; use clap::{Arg, Command};
use diflouroborane::db::Dump; use diflouroborane::db::Dump;
use diflouroborane::{config, Diflouroborane, error::Error}; use diflouroborane::{config, Diflouroborane};
use std::net::ToSocketAddrs;
use std::os::unix::prelude::AsRawFd;
use std::str::FromStr; use std::str::FromStr;
use std::{env, io, io::Write, path::PathBuf}; use std::{env, io, io::Write, path::PathBuf};
use std::sync::Arc;
use anyhow::Context;
use lmdb::{Environment, EnvironmentFlags};
use nix::NixPath; use nix::NixPath;
use diflouroborane::users::Users;
fn main() -> anyhow::Result<()> { fn main() -> anyhow::Result<()> {
// Argument parsing // Argument parsing