Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions server/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1012,11 +1012,11 @@ fn create_tls_server(

let subject =
subject_from_cert(cert.as_ref()).expect("Could not parse client certificate");
debug!("Incoming TLS connection from subject '{}'", &subject);
debug!("Incoming TLS connection from subject '{}'", subject);

let issuer = issuer_from_cert(cert.as_ref())
.expect("Could not parse issuer from client certificate");
debug!("Client certificate issued by '{}'", &issuer);
debug!("Client certificate issued by '{}'", issuer);
debug!("Known CAs: {:?}", ca_thumbprints);

// Try to find a trusted CA in the certificate chain
Expand Down
2 changes: 1 addition & 1 deletion server/src/logic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ async fn handle_enumerate(
let current_subscriptions = {
let subscriptions_unlocked = subscriptions.read().unwrap();
let mut current = Vec::with_capacity(subscriptions_unlocked.len());
for (_, subscription) in subscriptions.read().unwrap().iter() {
for subscription in subscriptions.read().unwrap().values() {
current.push(subscription.clone());
}
current
Expand Down
2 changes: 1 addition & 1 deletion server/src/monitoring.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ async fn refresh_machines_task(
let subscriptions_data = {
let subscriptions_unlocked = subscriptions.read().unwrap();
let mut subscriptions_data = Vec::with_capacity(subscriptions_unlocked.len());
for (_, subscription) in subscriptions.read().unwrap().iter() {
for subscription in subscriptions.read().unwrap().values() {
subscriptions_data.push((subscription.uuid_string(), subscription.data().name().to_string(), subscription.data().heartbeat_interval()));
}
subscriptions_data
Expand Down
6 changes: 3 additions & 3 deletions server/src/multipart.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ pub fn read_multipart_body<S: Read>(
// Read the headers (which should end in 2 line terminators, but do not
// for unknown reasons). But there are only headers in this part so this
// is fine :)
buf.truncate(0); // start fresh
buf.clear(); // start fresh
let (_, found) = reader.stream_until_token(middle_boundary.as_bytes(), &mut buf)?;
if !found {
bail!("EofInPartHeaders");
Expand Down Expand Up @@ -78,7 +78,7 @@ pub fn read_multipart_body<S: Read>(
}

// Read Content-Type header
buf.truncate(0); // start fresh
buf.clear(); // start fresh
let (_, found) = reader.stream_until_token(&lt, &mut buf)?;
if !found {
bail!("No cr lf after headers");
Expand Down Expand Up @@ -108,7 +108,7 @@ pub fn read_multipart_body<S: Read>(
}

// Read interesting data
buf.truncate(0); // start fresh
buf.clear(); // start fresh
let (size, found) = reader.stream_until_token(end_boundary.as_bytes(), &mut buf)?;
if !found {
log::error!(
Expand Down
2 changes: 1 addition & 1 deletion server/src/soap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl Serializable for SubscriptionBody {
.write_inner_content(|writer| {
writer.create_element("w:Heartbeats").write_text_content(
BytesText::new(
format!("PT{}.000S", &self.heartbeat_interval).as_str(),
format!("PT{}.000S", self.heartbeat_interval).as_str(),
),
)?;
writer.create_element("e:NotifyTo").write_inner_content(
Expand Down
10 changes: 5 additions & 5 deletions server/src/tls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,18 +76,18 @@ pub fn make_config(args: &common::settings::Tls) -> Result<TlsConfig> {
for root in ca_certs {
let subject = subject_from_cert(root.as_ref())?;
let thumbprint = compute_thumbprint(root.as_ref());
debug!("CA Thumbprint from certificate: {}", &thumbprint);
debug!("CA Thumbprint from certificate: {}", thumbprint);
if let Some(existing) = ca_thumbprints.get(&subject) {
if existing != &thumbprint {
bail!(
"Duplicate CA subject with different thumbprints: {}",
&subject
subject
);
}
// already present, skip, but warn
warn!(
"Duplicate CA certificate found for subject: {}, thumbprint: {}",
&subject, &thumbprint
subject, thumbprint
);
continue;
}
Expand Down Expand Up @@ -204,10 +204,10 @@ pub fn find_matching_ca(
.iter()
.find_map(|cert| {
let issuer = issuer_from_cert(cert.as_ref()).ok()?;
debug!("Checking issuer '{}'", &issuer);
debug!("Checking issuer '{}'", issuer);

ca_thumbprints.get(&issuer).map(|ca_entry| {
debug!("Found matching CA for issuer '{}'", &issuer);
debug!("Found matching CA for issuer '{}'", issuer);
ca_entry.clone()
})
})
Expand Down
Loading