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
2 changes: 1 addition & 1 deletion libkrimes/src/asn1/constants/errors.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use num_enum::{IntoPrimitive, TryFromPrimitive};

#[derive(Debug, TryFromPrimitive, IntoPrimitive)]
#[derive(Debug, Clone, TryFromPrimitive, IntoPrimitive)]
#[repr(i32)]
pub enum KrbErrorCode {
KdcErrNone = 0, // No error
Expand Down
1 change: 0 additions & 1 deletion libkrimes/src/asn1/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,5 @@ pub mod tagged_ticket;
pub mod ticket_flags;
pub mod transited_encoding;

pub use der::asn1::BitString;
pub use der::asn1::Ia5String;
pub use der::asn1::OctetString;
26 changes: 14 additions & 12 deletions libkrimes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#![deny(clippy::manual_let_else)]
#![allow(clippy::unreachable)]

pub mod asn1;
mod asn1;
pub mod ccache;
pub(crate) mod cksum;
pub mod cldap;
Expand All @@ -35,10 +35,7 @@ use proto::{KerberosReply, KerberosRequest};
use std::io;
use tokio_util::codec::{Decoder, Encoder};

pub struct KdcTcpCodec {
max_size: usize,
}

// This is the client codec. Decodes into a KerberosReply, encodes into a KerberosRequest
pub struct KerberosTcpCodec {
max_size: usize,
}
Expand Down Expand Up @@ -137,6 +134,11 @@ impl Encoder<KerberosRequest> for KerberosTcpCodec {
}
}

// This is the server codec. Decodes into a KerberosRequest, encodes into a KerberosReply
pub struct KdcTcpCodec {
max_size: usize,
}

impl Default for KdcTcpCodec {
fn default() -> Self {
KdcTcpCodec {
Expand Down Expand Up @@ -242,7 +244,7 @@ mod tests {
use std::time::{Duration, SystemTime};

use super::KerberosTcpCodec;
use crate::proto::{AuthenticationReply, DerivedKey, KerberosRequest, Name, PreauthReply};
use crate::proto::{AuthenticationReply, DerivedKey, KerberosRequest, Name, PreauthErrorReply};
use futures::StreamExt;
use tracing::{trace, warn};

Expand All @@ -266,7 +268,7 @@ mod tests {

let now = SystemTime::now();
let client_name = Name::principal("testuser", "EXAMPLE.COM");
let as_req = KerberosRequest::build_as(
let as_req = KerberosRequest::as_builder(
&client_name,
Name::service_krbtgt("EXAMPLE.COM"),
now + Duration::from_secs(3600),
Expand Down Expand Up @@ -325,7 +327,7 @@ mod tests {
let session_key = cleartext.key;

let now = SystemTime::now();
let tgs_req = KerberosRequest::build_tgs(
let tgs_req = KerberosRequest::tgs_builder(
Name::service("host", "pepper.example.com", "EXAMPLE.COM"),
now,
now + Duration::from_secs(3600),
Expand Down Expand Up @@ -368,7 +370,7 @@ mod tests {
let now = SystemTime::now();

let client_name = Name::principal("testuser_preauth", "EXAMPLE.COM");
let as_req = KerberosRequest::build_as(
let as_req = KerberosRequest::as_builder(
&client_name,
Name::service_krbtgt("EXAMPLE.COM"),
now + Duration::from_secs(3600),
Expand All @@ -390,7 +392,7 @@ mod tests {
assert!(response.is_ok());
let response = response.unwrap();

let KerberosReply::PA(PreauthReply {
let KerberosReply::PA(PreauthErrorReply {
service,
pa_data,
stime: _,
Expand Down Expand Up @@ -432,7 +434,7 @@ mod tests {
.expect("Failed to convert value");

let client_name = Name::principal("testuser_preauth", "EXAMPLE.COM");
let as_req = KerberosRequest::build_as(
let as_req = KerberosRequest::as_builder(
&client_name,
Name::service_krbtgt("EXAMPLE.COM"),
now + Duration::from_secs(3600),
Expand All @@ -452,7 +454,7 @@ mod tests {
)
.unwrap();

let as_req = KerberosRequest::build_asreq(
let as_req = KerberosRequest::as_builder(
Name::principal("testuser_preauth", "EXAMPLE.COM"),
Name::service_krbtgt("EXAMPLE.COM"),
None,
Expand Down
10 changes: 7 additions & 3 deletions libkrimes/src/proto/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ mod reply;
mod request;
mod time;

pub use self::reply::{AuthenticationReply, KerberosReply, PreauthReply, TicketGrantReply};
pub use self::reply::{
AuthenticationReply, AuthenticationReplyBuilder, KerberosReply, PreauthErrorReply,
TicketGrantReply,
};
pub use self::request::{
AuthenticationRequest, KerberosRequest, TicketGrantRequest, TicketGrantRequestUnverified,
AuthenticationRequest, AuthenticationRequestBuilder, KerberosRequest, TicketGrantRequest,
TicketGrantRequestUnverified,
};
pub use self::time::{
AuthenticationTimeBound, TicketGrantTimeBound, TicketRenewTimeBound, TimeBoundError,
Expand Down Expand Up @@ -1520,7 +1524,7 @@ pub async fn get_tgt(

let now = SystemTime::now();
let client_name = Name::principal(principal, realm);
let as_req = KerberosRequest::build_as(
let as_req = KerberosRequest::as_builder(
&client_name,
Name::service_krbtgt(realm),
now + Duration::from_secs(3600),
Expand Down
Loading
Loading