From 2f6abd2781807b1e41a292cb41e824133a831298 Mon Sep 17 00:00:00 2001 From: holger krekel Date: Tue, 10 Dec 2019 12:25:09 +0100 Subject: [PATCH] use hostname-0.1.5 for now --- Cargo.toml | 2 +- src/smtp/extension.rs | 11 ++--------- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index da8a79b..561c62a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ nom = { version = "^5.0", optional = true } bufstream = { version = "^0.1", optional = true } rustls = { version = "^0.16", optional = true } base64 = { version = "^0.11", optional = true } -hostname = { version = "^0.2", optional = true } +hostname = { version = "0.1.5", optional = true } serde = { version = "^1.0", optional = true } serde_json = { version = "^1.0", optional = true } serde_derive = { version = "^1.0", optional = true } diff --git a/src/smtp/extension.rs b/src/smtp/extension.rs index 5aa48d3..20c25e4 100644 --- a/src/smtp/extension.rs +++ b/src/smtp/extension.rs @@ -4,7 +4,7 @@ use crate::smtp::authentication::Mechanism; use crate::smtp::error::Error; use crate::smtp::response::Response; use crate::smtp::util::XText; -use hostname::get as get_hostname; +use hostname::get_hostname; use std::collections::HashSet; use std::fmt::{self, Display, Formatter}; use std::net::{Ipv4Addr, Ipv6Addr}; @@ -47,14 +47,7 @@ impl ClientId { /// Defines a `ClientId` with the current hostname, of `localhost` if hostname could not be /// found pub fn hostname() -> ClientId { - ClientId::Domain( - get_hostname() - .map(|s| { - s.into_string() - .unwrap_or_else(|_| DEFAULT_DOMAIN_CLIENT_ID.to_string()) - }) - .unwrap_or_else(|_| DEFAULT_DOMAIN_CLIENT_ID.to_string()), - ) + ClientId::Domain(get_hostname().unwrap_or_else(|| DEFAULT_DOMAIN_CLIENT_ID.to_string())) } }