diff --git a/Cargo.lock b/Cargo.lock index cc9555568..e1120e967 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -82,9 +82,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.37" +version = "1.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee67c11feeac938fae061b232e38e0b6d94f97a9df10e6271319325ac4c56a86" +checksum = "afddf7f520a80dbf76e6f50a35bca42a2331ef227a28b3b6dc5c2e2338d114b1" [[package]] name = "arrayref" @@ -135,12 +135,15 @@ dependencies = [ [[package]] name = "async-global-executor" -version = "1.4.3" +version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "73079b49cd26b8fd5a15f68fc7707fc78698dc2a3d61430f2a7a9430230dfa04" +checksum = "9586ec52317f36de58453159d48351bc244bc24ced3effc1fce22f3d48664af6" dependencies = [ + "async-channel", "async-executor", "async-io", + "async-mutex", + "blocking", "futures-lite", "num_cpus", "once_cell", @@ -184,6 +187,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "async-lock" +version = "2.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1996609732bde4a9988bc42125f55f2af5f3c36370e27c778d5191a4a1b63bfb" +dependencies = [ + "event-listener", +] + [[package]] name = "async-mutex" version = "1.4.0" @@ -246,16 +258,15 @@ dependencies = [ [[package]] name = "async-std" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f9f84f1280a2b436a2c77c2582602732b6c2f4321d5494d6e799e6c367859a8" +checksum = "d9f06685bad74e0570f5213741bea82158279a4103d988e57bfada11ad230341" dependencies = [ "async-channel", "async-global-executor", "async-io", - "async-mutex", + "async-lock", "async-process", - "blocking", "crossbeam-utils 0.8.1", "futures-channel", "futures-core", @@ -267,7 +278,7 @@ dependencies = [ "memchr", "num_cpus", "once_cell", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "pin-utils", "slab", "wasm-bindgen-futures", @@ -499,9 +510,9 @@ checksum = "ae44d1a3d5a19df61dd0c8beb138458ac2a53a7ac09eba97d55592540004306b" [[package]] name = "bytes" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad1f8e949d755f9d79112b5bb46938e0ef9d3804a0b16dfab13aafcaa5f0fa72" +checksum = "b700ce4376041dcd0a327fd0097c41095743c4c8af8887265942faf1100bd040" [[package]] name = "cache-padded" @@ -590,7 +601,7 @@ dependencies = [ "crossbeam-utils 0.8.1", "num", "parking_lot", - "rand 0.8.1", + "rand 0.8.2", "smallvec", ] @@ -1117,9 +1128,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c70be434c505aee38639abccb918163b63158a4b4bb791b45b7023044bdc3c9c" +checksum = "da9052a1a50244d8d5aa9bf55cbc2fb6f357c86cc52e46c62ed390a7180cf150" dependencies = [ "futures-channel", "futures-core", @@ -1132,9 +1143,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f01c61843314e95f96cc9245702248733a3a3d744e43e2e755e3c7af8348a0a9" +checksum = "f2d31b7ec7efab6eefc7c57233bb10b847986139d88cc2f5a02a1ae6871a1846" dependencies = [ "futures-core", "futures-sink", @@ -1142,15 +1153,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8d3b0917ff63a2a96173133c02818fac4a746b0a57569d3baca9ec0e945e08" +checksum = "79e5145dde8da7d1b3892dad07a9c98fc04bc39892b1ecc9692cf53e2b780a65" [[package]] name = "futures-executor" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ee9ca2f7eb4475772cf39dd1cd06208dce2670ad38f4d9c7262b3e15f127068" +checksum = "e9e59fdc009a4b3096bf94f740a0f2424c082521f20a9b08c5c07c48d90fd9b9" dependencies = [ "futures-core", "futures-task", @@ -1159,9 +1170,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e37c1a51b037b80922864b8eed90692c5cd8abd4c71ce49b77146caa47f3253b" +checksum = "28be053525281ad8259d47e4de5de657b25e7bac113458555bb4b70bc6870500" [[package]] name = "futures-lite" @@ -1174,15 +1185,15 @@ dependencies = [ "futures-io", "memchr", "parking", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "waker-fn", ] [[package]] name = "futures-macro" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8719ca0e1f3c5e34f3efe4570ef2c0610ca6da85ae7990d472e9cbfba13664" +checksum = "c287d25add322d9f9abdcdc5927ca398917996600182178774032e9f8258fedd" dependencies = [ "proc-macro-hack", "proc-macro2", @@ -1192,24 +1203,24 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6adabac1290109cfa089f79192fb6244ad2c3f1cc2281f3e1dd987592b71feb" +checksum = "caf5c69029bda2e743fddd0582d1083951d65cc9539aebf8812f36c3491342d6" [[package]] name = "futures-task" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a92a0843a2ff66823a8f7c77bffe9a09be2b64e533562c412d63075643ec0038" +checksum = "13de07eb8ea81ae445aca7b69f5f7bf15d7bf4912d8ca37d6645c77ae8a58d86" dependencies = [ "once_cell", ] [[package]] name = "futures-util" -version = "0.3.9" +version = "0.3.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "036a2107cdeb57f6d7322f1b6c363dad67cd63ca3b7d1b925bdf75bd5d96cda9" +checksum = "632a8cd0f2a4b3fdea1657f08bde063848c3bd00f9bbf6e256b8be78802e624b" dependencies = [ "futures-channel", "futures-core", @@ -1218,7 +1229,7 @@ dependencies = [ "futures-sink", "futures-task", "memchr", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "pin-utils", "proc-macro-hack", "proc-macro-nested", @@ -1440,9 +1451,9 @@ checksum = "494b4d60369511e7dea41cf646832512a94e542f68bb9c49e54518e0f468eb47" [[package]] name = "humantime" -version = "2.0.1" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c1ad908cc71012b7bea4d0c53ba96a8cba9962f048fa68d143376143d863b7a" +checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" @@ -1489,9 +1500,9 @@ checksum = "b9e0384b61958566e926dc50660321d12159025e767c18e043daf26b70104c39" [[package]] name = "idlset" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b39113f96923ff9f22c1d4cc4d5fb306d259b553be3bb8ef76d8c6a1ba4cabae" +checksum = "9c31544b013c2fc994074229d835610b9b4a796e1d13e4dd0ac5408b7d6a4f6a" dependencies = [ "serde", "serde_derive", @@ -1593,7 +1604,7 @@ dependencies = [ "openssl", "r2d2", "r2d2_sqlite", - "rand 0.8.1", + "rand 0.8.2", "regex", "rpassword", "rusqlite", @@ -1804,9 +1815,9 @@ dependencies = [ [[package]] name = "log" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fabed175da42fed1fa0746b0ea71f412aa9d35e76e95e59b192c64b9dc2bf8b" +checksum = "fcf3805d4480bb5b86070dcfeb9e2cb2ebc148adb753c5cca5f884d1d65a42b2" dependencies = [ "cfg-if 0.1.10", ] @@ -2221,9 +2232,9 @@ checksum = "c917123afa01924fc84bb20c4c03f004d9c38e5127e3c039bbf7f4b9c76a2f6b" [[package]] name = "pin-project-lite" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba36e0a6cc5a4c645073f4984f1ed55d09f5857d4de7c14550baa81a39ef5a17" +checksum = "439697af366c49a6d0a010c56a0d97685bc140ce0d377b13a2ea2aa42d64a827" [[package]] name = "pin-utils" @@ -2311,9 +2322,9 @@ checksum = "dbf0c48bc1d91375ae5c3cd81e3722dff1abcf81a30960240640d223f59fe0e5" [[package]] name = "proc-macro-nested" -version = "0.1.6" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eba180dafb9038b050a4c280019bbedf9f2467b61e5d892dcad585bb57aadc5a" +checksum = "bc881b2c22681370c6a780e47af9840ef841837bc98118431d4e1868bd0c1086" [[package]] name = "proc-macro2" @@ -2388,9 +2399,9 @@ dependencies = [ [[package]] name = "rand" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c24fcd450d3fa2b592732565aa4f17a27a61c65ece4726353e000939b0edee34" +checksum = "18519b42a40024d661e1714153e9ad0c3de27cd495760ceb09710920f1098b1e" dependencies = [ "libc", "rand_chacha 0.3.0", @@ -2487,9 +2498,9 @@ checksum = "41cc0f7e4d5d4544e8861606a285bb08d3e70712ccc7d2b84d7c0ccfaf4b05ce" [[package]] name = "redox_syscall" -version = "0.2.1" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48b82c2a1e8eb6e1bfde608de2bcbebd4072aa32d056ea48a986990cd5ca0f5a" +checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" dependencies = [ "bitflags", ] @@ -2501,7 +2512,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "528532f3d801c87aec9def2add9ca802fe569e44a544afe633765267840abe64" dependencies = [ "getrandom 0.2.1", - "redox_syscall 0.2.1", + "redox_syscall 0.2.4", ] [[package]] @@ -2564,7 +2575,7 @@ dependencies = [ "mime", "native-tls", "percent-encoding", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "serde", "serde_json", "serde_urlencoded", @@ -2743,9 +2754,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "serde" -version = "1.0.118" +version = "1.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06c64263859d87aa2eb554587e2d23183398d617427327cf2b3d0ed8c69e4800" +checksum = "9bdd36f49e35b61d49efd8aa7fc068fd295961fd2286d0b2ee9a4c7a14e99cc3" dependencies = [ "serde_derive", ] @@ -2771,9 +2782,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.118" +version = "1.0.119" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c84d3526699cd55261af4b941e4e725444df67aa4f9e6a3564f18030d12672df" +checksum = "552954ce79a059ddd5fd68c271592374bd15cab2274970380c000118aeffe1cd" dependencies = [ "proc-macro2", "quote", @@ -3067,14 +3078,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.1.0" +version = "3.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a6e24d9338a0a5be79593e2fa15a648add6138caa803e2d5bc782c371732ca9" +checksum = "dac1c663cfc93810f88aed9b8941d48cabf856a1b111c29a40439018d870eb22" dependencies = [ - "cfg-if 0.1.10", + "cfg-if 1.0.0", "libc", - "rand 0.7.3", - "redox_syscall 0.1.57", + "rand 0.8.2", + "redox_syscall 0.2.4", "remove_dir_all", "winapi", ] @@ -3239,9 +3250,9 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d258221f566b6c803c7b4714abadc080172b272090cdc5e244a6d4dd13c3a6bd" +checksum = "0ca04cec6ff2474c638057b65798f60ac183e5e79d3448bb7163d36a39cff6ec" dependencies = [ "autocfg", "bytes", @@ -3251,7 +3262,7 @@ dependencies = [ "num_cpus", "once_cell", "parking_lot", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "signal-hook-registry", "tokio-macros", "winapi", @@ -3292,26 +3303,26 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e4cdeb73537e63f98adcd73138af75e3f368ccaecffaa29d7eb61b9f5a440457" +checksum = "76066865172052eb8796c686f0b441a93df8b08d40a950b062ffb9a426f00edd" dependencies = [ "futures-core", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "tokio", ] [[package]] name = "tokio-util" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36135b7e7da911f5f8b9331209f7fab4cc13498f3fff52f72a710c78187e3148" +checksum = "12ae4751faa60b9f96dd8344d74592e5a17c0c9a220413dbc6942d14139bbfcc" dependencies = [ "bytes", "futures-core", "futures-sink", "log", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "tokio", "tokio-stream", ] @@ -3338,7 +3349,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9f47026cdc4080c07e49b37087de021820269d996f581aac150ef9e5583eefe3" dependencies = [ "cfg-if 1.0.0", - "pin-project-lite 0.2.3", + "pin-project-lite 0.2.4", "tracing-core", ] @@ -3450,11 +3461,11 @@ dependencies = [ [[package]] name = "uuid" -version = "0.8.1" +version = "0.8.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fde2f6a4bea1d6e007c4ad38c6839fa71cbb63b6dbf5b595aa38dc9b1093c11" +checksum = "bc5cf98d8186244414c848017f0e2676b3fcb46807f6668a97dfe67359a3c4b7" dependencies = [ - "rand 0.7.3", + "getrandom 0.2.1", "serde", ] @@ -3625,7 +3636,7 @@ dependencies = [ "log", "nom 4.2.3", "openssl", - "rand 0.8.1", + "rand 0.8.2", "serde", "serde_bytes", "serde_cbor", diff --git a/kanidmd/Cargo.toml b/kanidmd/Cargo.toml index e56a4bde0..4b444e3f2 100644 --- a/kanidmd/Cargo.toml +++ b/kanidmd/Cargo.toml @@ -79,7 +79,7 @@ sshkeys = "0.3" rpassword = "5.0" num_cpus = "1.10" -idlset = { version = "0.1" , features = ["use_smallvec"] } +idlset = { version = "^0.1.12" , features = ["use_smallvec"] } # idlset = { path = "../../idlset", features = ["use_smallvec"] } zxcvbn = "2.0" diff --git a/kanidmd/src/lib/be/mod.rs b/kanidmd/src/lib/be/mod.rs index 41dbb4441..8bf50f3d1 100644 --- a/kanidmd/src/lib/be/mod.rs +++ b/kanidmd/src/lib/be/mod.rs @@ -252,7 +252,7 @@ pub trait BackendTransaction { // When below thres, we have to return partials to trigger the entry_no_match_filter check. // But we only do this when there are actually multiple elements in the and, // because an and with 1 element now is FULLY resolved. - if idl.len() < thres && f_rem_count > 0 { + if idl.below_threshold(thres) && f_rem_count > 0 { let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(idl.clone()), setplan)); } else if idl.is_empty() { @@ -273,7 +273,7 @@ pub trait BackendTransaction { cand_idl = match (cand_idl, inter) { (IDL::Indexed(ia), IDL::Indexed(ib)) => { let r = ia & ib; - if r.len() < thres && f_rem_count > 0 { + if r.below_threshold(thres) && f_rem_count > 0 { // When below thres, we have to return partials to trigger the entry_no_match_filter check. let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(r), setplan)); @@ -290,7 +290,7 @@ pub trait BackendTransaction { | (IDL::Partial(ia), IDL::Indexed(ib)) | (IDL::Partial(ia), IDL::Partial(ib)) => { let r = ia & ib; - if r.len() < thres && f_rem_count > 0 { + if r.below_threshold(thres) && f_rem_count > 0 { // When below thres, we have to return partials to trigger the entry_no_match_filter check. let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(r), setplan)); @@ -304,7 +304,7 @@ pub trait BackendTransaction { | (IDL::PartialThreshold(ia), IDL::Partial(ib)) | (IDL::Partial(ia), IDL::PartialThreshold(ib)) => { let r = ia & ib; - if r.len() < thres && f_rem_count > 0 { + if r.below_threshold(thres) && f_rem_count > 0 { // When below thres, we have to return partials to trigger the entry_no_match_filter check. let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(r), setplan)); @@ -344,7 +344,7 @@ pub trait BackendTransaction { let r = ia.andnot(ib); /* // Don't trigger threshold on and nots if fully indexed. - if r.len() < thres { + if r.below_threshold(thres) { // When below thres, we have to return partials to trigger the entry_no_match_filter check. return Ok(IDL::PartialThreshold(r)); } else { @@ -359,7 +359,7 @@ pub trait BackendTransaction { let r = ia.andnot(ib); // DO trigger threshold on partials, because we have to apply the filter // test anyway, so we may as well shortcut at this point. - if r.len() < thres && f_rem_count > 0 { + if r.below_threshold(thres) && f_rem_count > 0 { let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(r), setplan)); } else { @@ -374,7 +374,7 @@ pub trait BackendTransaction { let r = ia.andnot(ib); // DO trigger threshold on partials, because we have to apply the filter // test anyway, so we may as well shortcut at this point. - if r.len() < thres && f_rem_count > 0 { + if r.below_threshold(thres) && f_rem_count > 0 { let setplan = FilterPlan::AndPartialThreshold(plan); return Ok((IDL::PartialThreshold(r), setplan)); } else { @@ -494,7 +494,8 @@ pub trait BackendTransaction { } } IDL::Partial(idl_br) => { - if idl_br.len() > erl.search_max_filter_test { + // if idl_br.len() > erl.search_max_filter_test { + if !idl_br.below_threshold(erl.search_max_filter_test) { ladmin_error!(au, "filter (search) is partial indexed and greater than search_max_filter_test allowed by resource limits"); return Err(OperationError::ResourceLimit); } @@ -507,7 +508,8 @@ pub trait BackendTransaction { // We know this is resolved here, so we can attempt the limit // check. This has to fold the whole index, but you know, class=pres is // indexed ... - if idl_br.len() > erl.search_max_results { + // if idl_br.len() > erl.search_max_results { + if !idl_br.below_threshold(erl.search_max_results) { ladmin_error!(au, "filter (search) is indexed and greater than search_max_results allowed by resource limits"); return Err(OperationError::ResourceLimit); } @@ -591,7 +593,7 @@ pub trait BackendTransaction { } } IDL::Partial(idl_br) => { - if idl_br.len() > erl.search_max_filter_test { + if !idl_br.below_threshold(erl.search_max_filter_test) { ladmin_error!(au, "filter (exists) is partial indexed and greater than search_max_filter_test allowed by resource limits"); return Err(OperationError::ResourceLimit); }