Skip to content

Commit

Permalink
fix: using default values for verify_name_on_connect
Browse files Browse the repository at this point in the history
Signed-off-by: Gabriele Baldoni <gabriele.baldoni@gmail.com>
  • Loading branch information
gabrik committed Oct 3, 2024
1 parent 3d5da78 commit 2226121
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 13 deletions.
2 changes: 1 addition & 1 deletion io/zenoh-links/zenoh-link-quic/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,5 +111,5 @@ pub mod config {
pub const TLS_ENABLE_MTLS: &str = "enable_mtls";

pub const TLS_VERIFY_NAME_ON_CONNECT: &str = "verify_name_on_connect";
pub const TLS_VERIFY_NAME_ON_CONNECT_DEFAULT: &str = "true";
pub const TLS_VERIFY_NAME_ON_CONNECT_DEFAULT: bool = true;
}
13 changes: 7 additions & 6 deletions io/zenoh-links/zenoh-link-quic/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -133,12 +133,13 @@ impl ConfigurationInspector<ZenohConfig> for TlsConfigurator {
_ => {}
}

if let Some(server_name_verification) = c.verify_name_on_connect() {
match server_name_verification {
true => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "true")),
false => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "false")),
};
}
match c
.verify_name_on_connect()
.unwrap_or(TLS_VERIFY_NAME_ON_CONNECT_DEFAULT)
{
true => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "true")),
false => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "false")),
};

Ok(parameters::from_iter(ps.drain(..)))
}
Expand Down
1 change: 1 addition & 0 deletions io/zenoh-links/zenoh-link-tls/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -107,4 +107,5 @@ pub mod config {
pub const TLS_ENABLE_MTLS: &str = "enable_mtls";

pub const TLS_VERIFY_NAME_ON_CONNECT: &str = "verify_name_on_connect";
pub const TLS_VERIFY_NAME_ON_CONNECT_DEFAULT: bool = true;
}
13 changes: 7 additions & 6 deletions io/zenoh-links/zenoh-link-tls/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,12 +135,13 @@ impl ConfigurationInspector<ZenohConfig> for TlsConfigurator {
_ => {}
}

if let Some(server_name_verification) = c.verify_name_on_connect() {
match server_name_verification {
true => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "true")),
false => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "false")),
};
}
match c
.verify_name_on_connect()
.unwrap_or(TLS_VERIFY_NAME_ON_CONNECT_DEFAULT)
{
true => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "true")),
false => ps.push((TLS_VERIFY_NAME_ON_CONNECT, "false")),
};

Ok(parameters::from_iter(ps.drain(..)))
}
Expand Down

0 comments on commit 2226121

Please sign in to comment.