From 99e61fd287e6ae07f6aa27f9dd3f0e9833b29a93 Mon Sep 17 00:00:00 2001 From: Bartosz Wieczorek Date: Fri, 8 Aug 2025 15:32:53 +0200 Subject: [PATCH] add comments --- PAM/ssh/include/rublon/ip_utils.hpp | 6 +++++- PAM/ssh/include/rublon/pam.hpp | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/PAM/ssh/include/rublon/ip_utils.hpp b/PAM/ssh/include/rublon/ip_utils.hpp index ff25038..191bdf2 100644 --- a/PAM/ssh/include/rublon/ip_utils.hpp +++ b/PAM/ssh/include/rublon/ip_utils.hpp @@ -60,6 +60,9 @@ class unique_fd { } }; +// this function is a little hack just to fix RSUP-1413 +// When loging to rublon from withing the host itself, there is no IP delivered through any 'pam_item' +// but we need to log from what place the request did came. tl::expected< std::pmr::string, Error > getDefaultRouteIp(std::pmr::memory_resource * mr) { log(LogLevel::Debug, "Reading default route IP"); unique_fd sock(::socket(AF_INET, SOCK_DGRAM, 0)); @@ -72,7 +75,8 @@ tl::expected< std::pmr::string, Error > getDefaultRouteIp(std::pmr::memory_resou remote.sin_family = AF_INET; remote.sin_port = htons(53); ::inet_pton(AF_INET, "8.8.8.8", &remote.sin_addr); - + + // we use UDP so no actual connection is estamblished. Only trying to get an interface if(::connect(sock.get(), ( struct sockaddr * ) &remote, sizeof(remote)) < 0) { log(LogLevel::Warning, "Cant connect to socket"); return tl::unexpected{Error{RublonRuntimeException::ConnectionFailed}}; diff --git a/PAM/ssh/include/rublon/pam.hpp b/PAM/ssh/include/rublon/pam.hpp index 9ceb52e..e53dbbd 100644 --- a/PAM/ssh/include/rublon/pam.hpp +++ b/PAM/ssh/include/rublon/pam.hpp @@ -42,7 +42,7 @@ class LinuxPam { template < typename... Ti > void print(const char * fmt, Ti... ti) const noexcept { if(_noninteractive){ - log(LogLevel::Info, "pam_print ommited due worink in noninteractive mode"); + log(LogLevel::Info, "pam_print ommited due working in noninteractive mode"); return; } char buf[256] = {};