#pragma once #include "rublon/memory.hpp" #include #include #include #include #include namespace rublon { class RublonFactory { public: tl::expected< void, Error > initializeSession(Session & session, [[maybe_unused]]int flags, int argc, const char ** argv) { log(LogLevel::Debug, "Configuration read start"); memory::MonotonicStack_2k_Resource memory_resource; ConfigurationReader reader{&memory_resource, "/etc/rublon.config", argc, argv}; if(auto ok = reader.applyTo(session.config()); not ok) { log(LogLevel::Warning, "Configuration contains errors"); session.pam().print("The configuration file does not exist or contains incorrect values"); return tl::unexpected{ConfigurationError{}}; } log(LogLevel::Debug, "Configuration read success"); // if(flags & PAM_SILENT) { // log(LogLevel::Debug, "nonInteractiveMode enabled (PAM_SILENT flag is set)"); // session.switchToNonInteractiveMode(); // } if(session.inNonInteractiveMode()) session.updateInteractiveFlag(); return {}; } }; } // namespace rublon #include