Skip to content

Commit

Permalink
chore: Refactor tsig_integration_tests.rs
Browse files Browse the repository at this point in the history
The code changes in this commit refactor the `tsig_integration_tests.rs` file. Specifically, the changes reorder the `tsigErrorCode` and clean the code from warnings. This commit does not introduce any new features or fix any bugs.
  • Loading branch information
Litr0 committed Jul 25, 2024
1 parent b676c51 commit a7c43cd
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions tests/tsig_integration_tests.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
use std::{collections::HashMap, net:: UdpSocket, thread, time::Duration};
use dns_rust::{domain_name::DomainName, message::{rdata::{tsig_rdata::TSigRdata, Rdata}, rrtype::Rrtype, DnsMessage},tsig::{process_tsig, sign_tsig, string_to_tsig_alg, TsigAlgorithm, TsigErrorCode}};
use dns_rust::{domain_name::DomainName, message::{rdata::{tsig_rdata::TSigRdata, Rdata}, rrtype::Rrtype, DnsMessage},tsig::{process_tsig, sign_tsig, TsigErrorCode}};
use dns_rust::tsig::tsig_algorithm::TsigAlgorithm;
use dns_rust::message::rclass::Rclass;


Expand Down Expand Up @@ -110,12 +111,12 @@ async fn tsig_signature() {
let key_found = keys[&name];

//el servidor verifica la estructura del tsig recibido. Sumamos un pequeño delay al time para simular retraso
let (answer,error) = process_tsig(&data, key_found, key_name.clone(), time + 50, list, vec![]);
let (_,error) = process_tsig(&data, key_found, key_name.clone(), time + 50, list, vec![]);
//se setea el aditional sin el ultimo resource record, para que sign_tsig lo regenere
data.set_additional(addit);
data.update_header_counters();
// se firma el mensaje recibido con el digest de la respuesta. Notar que el vector final ahora no está vacío
sign_tsig(&mut data, key_found,string_to_tsig_alg(alg_name),fudge,time, key_name, mac);
sign_tsig(&mut data, key_found,TsigAlgorithm::from(alg_name),fudge,time, key_name, mac);
let response = &DnsMessage::to_bytes(&data);
//se verifica que la request haya pasado proces_tsig
assert_eq!(error,TsigErrorCode::NOERR);
Expand Down

0 comments on commit a7c43cd

Please sign in to comment.