From b9163c2e1cbfeff9801ee520c393eb285ce967c8 Mon Sep 17 00:00:00 2001 From: Ximon Eighteen <3304436+ximon18@users.noreply.github.com> Date: Mon, 9 Sep 2019 11:27:46 +0200 Subject: [PATCH] Possible fix for #77 to use v4 UUID session_id as per RFC-4122. Warning: NOT tested. --- pubd/Cargo.toml | 1 + pubd/src/lib.rs | 1 + pubd/src/repo.rs | 6 ++---- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pubd/Cargo.toml b/pubd/Cargo.toml index 98a45bce..2f351353 100644 --- a/pubd/Cargo.toml +++ b/pubd/Cargo.toml @@ -10,6 +10,7 @@ derive_more = "^0.13" rand = "^0.5" rpki = "^0.5" serde = { version = "^1.0", features = ["derive"] } +uuid = "0.7" [dependencies.krill_commons] path = "../commons" diff --git a/pubd/src/lib.rs b/pubd/src/lib.rs index a1180638..149cda3d 100644 --- a/pubd/src/lib.rs +++ b/pubd/src/lib.rs @@ -6,6 +6,7 @@ extern crate rand; extern crate rpki; #[macro_use] extern crate serde; +extern crate uuid; extern crate krill_commons; pub mod publishers; diff --git a/pubd/src/repo.rs b/pubd/src/repo.rs index fc8ec6be..723a2924 100644 --- a/pubd/src/repo.rs +++ b/pubd/src/repo.rs @@ -34,10 +34,8 @@ pub struct RrdpInitDetails { impl RrdpInitDetails { pub fn init_new(base_uri: uri::Https, repo_dir: PathBuf) -> RrdpInit { - use rand::{thread_rng, Rng}; - let mut rng = thread_rng(); - let rnd: u32 = rng.gen(); - let session = format!("{}", rnd); + use uuid::Uuid; + let session = format!("{}", Uuid::new_v4()); StoredEvent::new( &id(),