mirror of
https://git.proxmox.com/git/proxmox
synced 2025-07-04 06:59:03 +00:00
ldap: avoid superfluous allocation when calling .search()
The `attrs` parameter of `Ldap::search()` is an `impl AsRef<[impl AsRef<str>]>` anyway, so replace `vec![..]` with `&[..]`. Suggested-by: Wolfgang Bumiller <w.bumiller@proxmox.com> Signed-off-by: Christoph Heiss <c.heiss@proxmox.com>
This commit is contained in:
parent
78bf05a458
commit
84fbfb22ec
@ -181,12 +181,7 @@ impl Connection {
|
|||||||
|
|
||||||
// only search base to make sure the base_dn exists while avoiding most common size limits
|
// only search base to make sure the base_dn exists while avoiding most common size limits
|
||||||
let (_, _) = ldap
|
let (_, _) = ldap
|
||||||
.search(
|
.search(&self.config.base_dn, Scope::Base, "(objectClass=*)", &["*"])
|
||||||
&self.config.base_dn,
|
|
||||||
Scope::Base,
|
|
||||||
"(objectClass=*)",
|
|
||||||
vec!["*"],
|
|
||||||
)
|
|
||||||
.await?
|
.await?
|
||||||
.success()
|
.success()
|
||||||
.context("Could not search LDAP realm, base_dn could be incorrect")?;
|
.context("Could not search LDAP realm, base_dn could be incorrect")?;
|
||||||
@ -319,7 +314,7 @@ impl Connection {
|
|||||||
let query = format!("(&({}={}))", self.config.user_attr, username);
|
let query = format!("(&({}={}))", self.config.user_attr, username);
|
||||||
|
|
||||||
let (entries, _res) = ldap
|
let (entries, _res) = ldap
|
||||||
.search(&self.config.base_dn, Scope::Subtree, &query, vec!["dn"])
|
.search(&self.config.base_dn, Scope::Subtree, &query, &["dn"])
|
||||||
.await?
|
.await?
|
||||||
.success()?;
|
.success()?;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user