mirror of
https://github.com/kanidm/kanidm.git
synced 2025-02-23 20:47:01 +01:00
adding a check for rustc MSRV (#542)
This commit is contained in:
parent
5069df9939
commit
25961b2c46
5
Cargo.lock
generated
5
Cargo.lock
generated
|
@ -1819,6 +1819,7 @@ dependencies = [
|
|||
"regex",
|
||||
"rpassword",
|
||||
"rusqlite",
|
||||
"rustc_version 0.4.0",
|
||||
"serde",
|
||||
"serde_cbor",
|
||||
"serde_derive",
|
||||
|
@ -3931,7 +3932,9 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "webauthn-rs"
|
||||
version = "0.3.0-alpha.9"
|
||||
version = "0.3.0-alpha.10"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "18010e64d5f6286eab221881ed6237a3a1f0aa420e78fb6faa48843c7dd93da1"
|
||||
dependencies = [
|
||||
"base64 0.13.0",
|
||||
"js-sys",
|
||||
|
|
|
@ -111,6 +111,8 @@ serde = "1.0"
|
|||
serde_derive = "1.0"
|
||||
toml = "0.5"
|
||||
|
||||
rustc_version = "0.4.0"
|
||||
|
||||
[[bench]]
|
||||
name = "scaling_10k"
|
||||
harness = false
|
||||
|
|
|
@ -3,13 +3,15 @@ extern crate serde_derive;
|
|||
|
||||
use std::env;
|
||||
|
||||
use std::fs::File;
|
||||
use std::fs::{read_to_string, File};
|
||||
use std::io::Read;
|
||||
|
||||
use std::path::PathBuf;
|
||||
use structopt::clap::Shell;
|
||||
use structopt::StructOpt;
|
||||
|
||||
use rustc_version::{version, Version};
|
||||
|
||||
include!("src/lib/audit_loglevel.rs");
|
||||
include!("src/server/opt.rs");
|
||||
|
||||
|
@ -21,6 +23,18 @@ fn main() {
|
|||
Some(outdir) => outdir,
|
||||
};
|
||||
|
||||
// check to see if the rust version matches the rust minimum version we require for this build
|
||||
let rust_minver = match read_to_string("../RUST_MSRV") {
|
||||
Ok(value) => value,
|
||||
Err(error) => panic!("Couldn't load RUST_MSRV: {:?}", error),
|
||||
};
|
||||
let required_rust_ver = Version::parse(&rust_minver.replace("\n", "")).unwrap();
|
||||
println!("Rust version: {}", version().unwrap());
|
||||
println!("Required version: {}", required_rust_ver);
|
||||
if version().unwrap() <= required_rust_ver {
|
||||
panic!("This crate requires rustc >= {}, quitting.", rust_minver);
|
||||
}
|
||||
|
||||
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Bash, outdir.clone());
|
||||
KanidmdOpt::clap().gen_completions("kanidmd", Shell::Zsh, outdir);
|
||||
|
||||
|
@ -41,10 +55,10 @@ fn main() {
|
|||
|
||||
let mut contents = String::new();
|
||||
f.read_to_string(&mut contents)
|
||||
.expect(format!("Failed to read {:?}", profile_path).as_str());
|
||||
.unwrap_or_else(|_| panic!("Failed to read {:?}", profile_path));
|
||||
|
||||
let profile_cfg: ProfileConfig = toml::from_str(contents.as_str())
|
||||
.expect(format!("Failed to parse {:?}", profile_path).as_str());
|
||||
.unwrap_or_else(|_| panic!("Failed to parse {:?}", profile_path));
|
||||
|
||||
/*
|
||||
* x86-64: CMOV, CMPXCHG8B, FPU, FXSR, MMX, FXSR, SCE, SSE, SSE2
|
||||
|
|
|
@ -1014,24 +1014,19 @@ impl QueryServerReadV1 {
|
|||
uat: Option<String>,
|
||||
eventid: Uuid,
|
||||
) -> Result<(), OperationError> {
|
||||
let mut audit =
|
||||
AuditScope::new("auth_valid", eventid, self.log_level);
|
||||
let mut audit = AuditScope::new("auth_valid", eventid, self.log_level);
|
||||
let ct = duration_from_epoch_now();
|
||||
let idms_prox_read = self.idms.proxy_read_async().await;
|
||||
|
||||
let res = lperf_op_segment!(
|
||||
&mut audit,
|
||||
"actors::v1_read::handle<AuthValid>",
|
||||
|| {
|
||||
idms_prox_read
|
||||
.validate_and_parse_uat(&mut audit, uat.as_deref(), ct)
|
||||
.map(|_| ())
|
||||
.map_err(|e| {
|
||||
ladmin_error!(audit, "Invalid token: {:?}", e);
|
||||
e
|
||||
})
|
||||
}
|
||||
);
|
||||
let res = lperf_op_segment!(&mut audit, "actors::v1_read::handle<AuthValid>", || {
|
||||
idms_prox_read
|
||||
.validate_and_parse_uat(&mut audit, uat.as_deref(), ct)
|
||||
.map(|_| ())
|
||||
.map_err(|e| {
|
||||
ladmin_error!(audit, "Invalid token: {:?}", e);
|
||||
e
|
||||
})
|
||||
});
|
||||
self.log.send(audit).map_err(|_| {
|
||||
error!("CRITICAL: UNABLE TO COMMIT LOGS");
|
||||
OperationError::InvalidState
|
||||
|
|
|
@ -270,11 +270,10 @@ pub trait IdlSqliteTransaction {
|
|||
})?;
|
||||
|
||||
let idl = match idl_raw {
|
||||
Some(d) => serde_cbor::from_slice(d.as_slice())
|
||||
.map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?,
|
||||
Some(d) => serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?,
|
||||
// We don't have this value, it must be empty (or we
|
||||
// have a corrupted index .....
|
||||
None => IDLBitRange::new(),
|
||||
|
@ -341,11 +340,10 @@ pub trait IdlSqliteTransaction {
|
|||
|
||||
let spn: Option<Value> = match spn_raw {
|
||||
Some(d) => {
|
||||
let dbv = serde_cbor::from_slice(d.as_slice())
|
||||
.map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
let dbv = serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
let spn = Value::from_db_valuev1(dbv)
|
||||
.map_err(|_| OperationError::CorruptedIndex("uuid2spn".to_string()))?;
|
||||
Some(spn)
|
||||
|
@ -406,12 +404,10 @@ pub trait IdlSqliteTransaction {
|
|||
.map_err(|_| OperationError::SqliteError)?;
|
||||
|
||||
Ok(match data {
|
||||
Some(d) => Some(
|
||||
serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?,
|
||||
),
|
||||
Some(d) => Some(serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?),
|
||||
None => None,
|
||||
})
|
||||
}
|
||||
|
@ -433,12 +429,10 @@ pub trait IdlSqliteTransaction {
|
|||
.map_err(|_| OperationError::SqliteError)?;
|
||||
|
||||
Ok(match data {
|
||||
Some(d) => Some(
|
||||
serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?,
|
||||
),
|
||||
Some(d) => Some(serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?),
|
||||
None => None,
|
||||
})
|
||||
}
|
||||
|
@ -506,7 +500,10 @@ pub trait IdlSqliteTransaction {
|
|||
let allids = self.get_identry_raw(audit, &IdList::AllIds)?;
|
||||
allids
|
||||
.into_iter()
|
||||
.map(|data| data.into_dbentry(audit).map(|(id, db_e)| (id, db_e.to_string())))
|
||||
.map(|data| {
|
||||
data.into_dbentry(audit)
|
||||
.map(|(id, db_e)| (id, db_e.to_string()))
|
||||
})
|
||||
.collect()
|
||||
}
|
||||
|
||||
|
@ -743,11 +740,10 @@ impl IdlSqliteWriteTransaction {
|
|||
entry: &Entry<EntrySealed, EntryCommitted>,
|
||||
) -> Result<(), OperationError> {
|
||||
let dbe = entry.to_dbentry();
|
||||
let data = serde_cbor::to_vec(&dbe).map_err(|e|
|
||||
{
|
||||
ladmin_error!(au, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
let data = serde_cbor::to_vec(&dbe).map_err(|e| {
|
||||
ladmin_error!(au, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
|
||||
let raw_entries = std::iter::once(IdRawEntry {
|
||||
id: entry.get_id(),
|
||||
|
@ -989,11 +985,10 @@ impl IdlSqliteWriteTransaction {
|
|||
match k {
|
||||
Some(k) => {
|
||||
let dbv1 = k.to_db_valuev1();
|
||||
let data =
|
||||
serde_cbor::to_vec(&dbv1).map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
let data = serde_cbor::to_vec(&dbv1).map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
self.conn
|
||||
.prepare("INSERT OR REPLACE INTO idx_uuid2spn (uuid, spn) VALUES(:uuid, :spn)")
|
||||
.and_then(|mut stmt| {
|
||||
|
@ -1284,12 +1279,10 @@ impl IdlSqliteWriteTransaction {
|
|||
.map_err(|_| OperationError::SqliteError)?;
|
||||
|
||||
Ok(match data {
|
||||
Some(d) => Some(
|
||||
serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?,
|
||||
),
|
||||
Some(d) => Some(serde_cbor::from_slice(d.as_slice()).map_err(|e| {
|
||||
eprintln!("CRITICAL: Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?),
|
||||
None => None,
|
||||
})
|
||||
}
|
||||
|
|
|
@ -135,11 +135,10 @@ impl IdRawEntry {
|
|||
self,
|
||||
audit: &mut AuditScope,
|
||||
) -> Result<Entry<EntrySealed, EntryCommitted>, OperationError> {
|
||||
let db_e = serde_cbor::from_slice(self.data.as_slice())
|
||||
.map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
let db_e = serde_cbor::from_slice(self.data.as_slice()).map_err(|e| {
|
||||
ladmin_error!(audit, "Serde CBOR Error -> {:?}", e);
|
||||
OperationError::SerdeCborError
|
||||
})?;
|
||||
// let id = u64::try_from(self.id).map_err(|_| OperationError::InvalidEntryId)?;
|
||||
Entry::from_dbentry(audit, db_e, self.id)
|
||||
.map_err(|_| OperationError::CorruptedEntry(self.id))
|
||||
|
|
Loading…
Reference in a new issue