mirror of
https://github.com/Devolutions/IronRDP.git
synced 2025-08-04 15:18:17 +00:00
clean up
This commit is contained in:
parent
9ebe578333
commit
84745e5ef2
6 changed files with 23 additions and 36 deletions
|
@ -291,25 +291,21 @@ impl Config {
|
|||
args.clipboard_type
|
||||
};
|
||||
|
||||
let credentials = if args.username.is_none() && args.password.is_none() {
|
||||
Credentials::None
|
||||
} else {
|
||||
let username = args.username.unwrap_or_else(|| {
|
||||
inquire::Text::new("Username:")
|
||||
.prompt()
|
||||
.context("Username prompt")
|
||||
.unwrap_or_else(|_| "Administrator".to_owned())
|
||||
});
|
||||
let username = args.username.unwrap_or_else(|| {
|
||||
inquire::Text::new("Username:")
|
||||
.prompt()
|
||||
.context("Username prompt")
|
||||
.unwrap_or_else(|_| "Administrator".to_owned())
|
||||
});
|
||||
|
||||
let password = args.password.unwrap_or_else(|| {
|
||||
inquire::Password::new("Password:")
|
||||
.prompt()
|
||||
.context("Password prompt")
|
||||
.unwrap_or_else(|_| "password".to_owned())
|
||||
});
|
||||
let password = args.password.unwrap_or_else(|| {
|
||||
inquire::Password::new("Password:")
|
||||
.prompt()
|
||||
.context("Password prompt")
|
||||
.unwrap_or_else(|_| "password".to_owned())
|
||||
});
|
||||
|
||||
Credentials::UsernamePassword { username, password }
|
||||
};
|
||||
let credentials = Credentials::UsernamePassword { username, password };
|
||||
|
||||
let connector = connector::Config {
|
||||
credentials,
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
use ironrdp::cliprdr::backend::{ClipboardMessage, CliprdrBackendFactory};
|
||||
use ironrdp::connector::connection_activation::ConnectionActivationState;
|
||||
use ironrdp::connector::{ConnectionResult, ConnectorResult};
|
||||
use ironrdp::core::Encode;
|
||||
use ironrdp::displaycontrol::client::DisplayControlClient;
|
||||
use ironrdp::displaycontrol::pdu::MonitorLayoutEntry;
|
||||
use ironrdp::graphics::image_processing::PixelFormat;
|
||||
|
@ -9,7 +8,7 @@ use ironrdp::pdu::input::fast_path::FastPathInputEvent;
|
|||
use ironrdp::session::image::DecodedImage;
|
||||
use ironrdp::session::{fast_path, ActiveStage, ActiveStageOutput, GracefulDisconnectReason, SessionResult};
|
||||
use ironrdp::{cliprdr, connector, rdpdr, rdpsnd, session};
|
||||
use ironrdp_core::{WriteBuf, WriteCursor};
|
||||
use ironrdp_core::WriteBuf;
|
||||
use ironrdp_rdpsnd_native::cpal;
|
||||
use ironrdp_tokio::reqwest::ReqwestNetworkClient;
|
||||
use ironrdp_tokio::{single_sequence_step_read, split_tokio_framed, FramedWrite};
|
||||
|
|
|
@ -5,7 +5,7 @@ use picky_asn1_x509::{oids, Certificate, ExtensionView, GeneralName};
|
|||
use sspi::credssp::{self, ClientState, CredSspClient};
|
||||
use sspi::generator::{Generator, NetworkRequest};
|
||||
use sspi::negotiate::ProtocolConfig;
|
||||
use sspi::{AuthIdentity, Username};
|
||||
use sspi::Username;
|
||||
|
||||
use crate::{ConnectorError, ConnectorErrorKind, ConnectorResult, Credentials, ServerName, Written};
|
||||
|
||||
|
@ -134,11 +134,6 @@ impl CredsspSequence {
|
|||
return Err(general_err!("smart card configuration missing"));
|
||||
}
|
||||
},
|
||||
Credentials::None => sspi::AuthIdentity {
|
||||
username: Username::new("", None).map_err(|e| custom_err!("invalid username", e))?,
|
||||
password: String::new().into(),
|
||||
}
|
||||
.into(),
|
||||
};
|
||||
|
||||
let server_name = server_name.into_inner();
|
||||
|
|
|
@ -67,7 +67,6 @@ pub struct SmartCardIdentity {
|
|||
|
||||
#[derive(Debug, Clone)]
|
||||
pub enum Credentials {
|
||||
None,
|
||||
UsernamePassword {
|
||||
username: String,
|
||||
password: String,
|
||||
|
@ -81,7 +80,6 @@ pub enum Credentials {
|
|||
impl Credentials {
|
||||
fn username(&self) -> Option<&str> {
|
||||
match self {
|
||||
Self::None => None,
|
||||
Self::UsernamePassword { username, .. } => Some(username),
|
||||
Self::SmartCard { .. } => None, // Username is ultimately provided by the smart card certificate.
|
||||
}
|
||||
|
@ -89,15 +87,10 @@ impl Credentials {
|
|||
|
||||
fn secret(&self) -> &str {
|
||||
match self {
|
||||
Self::None => "",
|
||||
Self::UsernamePassword { password, .. } => password,
|
||||
Self::SmartCard { pin, .. } => pin,
|
||||
}
|
||||
}
|
||||
|
||||
fn is_none(&self) -> bool {
|
||||
matches!(self, Self::None)
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue