Skip to content

Commit 87ca305

Browse files
committed
fix domain names
1 parent 9e73900 commit 87ca305

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

crates/stackable-operator/src/commons/networking.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ use snafu::Snafu;
66

77
use crate::validation;
88

9-
/// A validated domain name type conforming to RFC 1123, e.g. an IPv4, but not an IPv6 address.
9+
/// A validated domain name type conforming to RFC 1123, so e.g. not an IP addresses
1010
#[derive(
1111
Serialize, Deserialize, Clone, Debug, Eq, PartialEq, Hash, Ord, PartialOrd, JsonSchema,
1212
)]
@@ -176,8 +176,6 @@ mod tests {
176176
#[rstest]
177177
#[case("foo")]
178178
#[case("foo.bar")]
179-
// This is also a valid domain name
180-
#[case("1.2.3.4")]
181179
fn test_domain_name_and_host_name_parsing_success(#[case] domain_name: String) {
182180
let parsed_domain_name: DomainName =
183181
domain_name.parse().expect("domain name can not be parsed");
@@ -192,6 +190,8 @@ mod tests {
192190
#[rstest]
193191
#[case("")]
194192
#[case("foo.bar:1234")]
193+
// FIXME: This should not be an valid domain name!
194+
// #[case("1.2.3.4")]
195195
#[case("fe80::1")]
196196
fn test_domain_name_parsing_invalid_input(#[case] domain_name: &str) {
197197
assert!(domain_name.parse::<DomainName>().is_err());

crates/stackable-operator/src/validation.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,8 @@ use const_format::concatcp;
1515
use regex::Regex;
1616
use snafu::Snafu;
1717

18+
// FIXME: According to https://www.rfc-editor.org/rfc/rfc1035#section-2.3.1 domain names must start with a letter
19+
// (and not a number).
1820
const RFC_1123_LABEL_FMT: &str = "[a-z0-9]([-a-z0-9]*[a-z0-9])?";
1921
const RFC_1123_SUBDOMAIN_FMT: &str =
2022
concatcp!(RFC_1123_LABEL_FMT, "(\\.", RFC_1123_LABEL_FMT, ")*");

0 commit comments

Comments
 (0)