diff options
Diffstat (limited to 'src/session-initialize-bincimapd.cc')
-rw-r--r-- | src/session-initialize-bincimapd.cc | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/src/session-initialize-bincimapd.cc b/src/session-initialize-bincimapd.cc index 871510b..e98f0af 100644 --- a/src/session-initialize-bincimapd.cc +++ b/src/session-initialize-bincimapd.cc @@ -32,8 +32,6 @@ using namespace Binc; using std::endl; using std::string; -extern char **environ; - bool Session::initialize(int argc, char *argv[]) { IOFactory &ioFactory = IOFactory::getInstance(); @@ -65,9 +63,8 @@ bool Session::initialize(int argc, char *argv[]) session.assignCommandLineArgs(); // log settings - string ip = getenv("TCP6REMOTEIP") ? getenv("TCP6REMOTEIP") - : getenv("TCPREMOTEIP") ? getenv("TCPREMOTEIP") - : "?"; + string ip = Tools::getenv("TCP6REMOTEIP") + .value_or(Tools::getenv("TCPREMOTEIP").value_or("?")); session.setIP(ip); string logtype = session.getEnv("LOG_TYPE"); @@ -116,8 +113,8 @@ bool Session::initialize(int argc, char *argv[]) string pid = std::to_string(session.getPid()); - char *logindetails = getenv("BINCIMAP_LOGIN"); - if (logindetails == nullptr) { + auto logindetails = Tools::getenv("BINCIMAP_LOGIN"); + if (!logindetails) { bincLog << "bincimapd: pid " << pid << " BINCIMAP_LOGIN missing from environment (are you sure you invoked " << argv[0] << " properly?)\n"; @@ -199,7 +196,7 @@ bool Session::initialize(int argc, char *argv[]) session.setState(Session::AUTHENTICATED); - const string details = logindetails; + const string details = *logindetails; string::size_type det = details.find('+'); if (det == string::npos) { bincLog << "bincimapd: pid " << pid |