From c5c8837f468ddd813e203cf82f49be55505ff5bf Mon Sep 17 00:00:00 2001 From: sebadob Date: Wed, 11 Oct 2023 09:23:11 +0200 Subject: [PATCH] no unwrap on existing session ip --- rauthy-models/src/entity/sessions.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/rauthy-models/src/entity/sessions.rs b/rauthy-models/src/entity/sessions.rs index c6f547f1..a6a32a3f 100644 --- a/rauthy-models/src/entity/sessions.rs +++ b/rauthy-models/src/entity/sessions.rs @@ -440,11 +440,14 @@ impl Session { if (self.state == SessionState::Open || self.state == SessionState::Auth) && self.remote_ip.as_ref() != Some(&ip) { + let session_ip = self + .remote_ip + .as_ref() + .map(|ip| ip.as_str()) + .unwrap_or("UNKNOWN"); warn!( "Invalid access for session {} / {} with different IP: {}", - self.id, - self.remote_ip.as_ref().unwrap(), - ip, + self.id, session_ip, ip, ); return false; }