* Prevent printing in noninteractive mode * Allow PAM modules to be configurated directly in pam.d * Configuration should be redable by everybody * Add a way to read ip address in when no IP is awailable * Enable read ip from pam * Fix veritas BUG
43 lines
1.3 KiB
C++
Executable File
43 lines
1.3 KiB
C++
Executable File
#pragma once
|
|
|
|
#include "rublon/memory.hpp"
|
|
#include <tl/expected.hpp>
|
|
|
|
#include <rublon/bits.hpp>
|
|
#include <rublon/finish.hpp>
|
|
#include <rublon/json.hpp>
|
|
#include <rublon/session.hpp>
|
|
|
|
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 <rublon/init.hpp>
|