69 string ip = getenv(
"TCP6REMOTEIP") ? getenv(
"TCP6REMOTEIP") :
70 getenv(
"TCPREMOTEIP") ? getenv(
"TCPREMOTEIP") :
"?";
73 string logtype = session.
getEnv(
"LOG_TYPE");
76 if (logtype ==
"multilog") {
78 }
else if (logtype ==
"" || logtype ==
"syslog") {
79 const string f = session.
getEnv(
"SYSLOG_FACILITY");
83 if (isdigit(f[0])) facility =
atoi(f);
85 if (f ==
"LOG_USER") facility = LOG_USER;
86 else if (f ==
"LOG_LOCAL0") facility = LOG_LOCAL0;
87 else if (f ==
"LOG_LOCAL1") facility = LOG_LOCAL1;
88 else if (f ==
"LOG_LOCAL2") facility = LOG_LOCAL2;
89 else if (f ==
"LOG_LOCAL3") facility = LOG_LOCAL3;
90 else if (f ==
"LOG_LOCAL4") facility = LOG_LOCAL4;
91 else if (f ==
"LOG_LOCAL5") facility = LOG_LOCAL5;
92 else if (f ==
"LOG_LOCAL6") facility = LOG_LOCAL6;
93 else if (f ==
"LOG_LOCAL7") facility = LOG_LOCAL7;
94 else facility = LOG_DAEMON;
101 LOG_NDELAY | LOG_PID,
110 string pid = to_string(session.
getPid());
112 char *logindetails = getenv(
"BINCIMAP_LOGIN");
113 if (logindetails == 0) {
115 <<
"bincimapd: pid " << pid
116 <<
" BINCIMAP_LOGIN missing from environment (are you sure you invoked "
117 << argv[0] <<
" properly?)\n";
126 string depottype = session.
getEnv(
"DEPOT");
127 if (depottype ==
"") depottype =
"Maildir++";
129 if ((depot = depotfactory.
get(depottype)) == 0) {
130 bincLog <<
"bincimapd: pid " << pid
131 <<
" Found no Depot for: " << depottype
132 <<
". Please check your configurations file under the Mailbox section\n";
141 string delimiter = session.
getEnv(
"DELIMITER");
175 if (path ==
"") path =
".";
176 else if (chdir(path.c_str()) != 0) {
177 mkdir(path.c_str(), 0777);
178 if (chdir(path.c_str()) != 0) {
179 bincLog <<
"bincimapd: pid" << pid
181 << strerror(errno) << endl;
189 bincLog <<
"bincimapd: pid " << pid
200 const string details = logindetails;
201 string::size_type det = details.find(
'+');
202 if (det == string::npos) {
203 bincLog <<
"bincimapd: pid " << pid
204 <<
" Invalid content of BINCIMAP_LOGIN - did you invoke "
205 << argv[0] <<
" correctly?" << endl;
210 const string tag = details.substr(det + 1);
211 const string command = details.substr(0, det);
Declaration of the Broker class.
void assign(const std::string &fname, Operator *o)
static BrokerFactory & getInstance(void)
std::string usageString(void) const
const std::vector< std::string > & getUnqualifiedArgs() const
static DepotFactory & getInstance(void)
Depot * get(const std::string &name) const
virtual Mailbox * get(const std::string &path) const
virtual void loadSubscribes(void)
const std::string & getLastError(void) const
virtual void assign(Mailbox *)
virtual bool createMailbox(const std::string &m) const
bool setDefaultType(const std::string &n)
The IODevice class provides a framework for reading and writing to device.
void setMaxOutputBufferSize(unsigned int max)
void setFlags(unsigned int f)
void setOutputLevelLimit(LogLevel level)
static void addDevice(IODevice *dev)
static IODevice & getLogger(void)
static IOFactory & getInstance(void)
bool initialize(int argc, char *argv[])
void setEnv(const std::string &key, const std::string &value)
void assignCommandLineArgs(void)
void setIP(const std::string &ip)
struct Binc::Session::@3 command
bool parseCommandLine(int argc, char *argv[])
static Session & getInstance(void)
std::string getEnv(const std::string &key)
Declaration of miscellaneous convertion functions.
Declaration of the IMAPServer class.
Declaration of the IODevice class.
Declaration of the IOFactory class.
Declaration of the Maildir class.
Declaration of the MultilogDevice class.
std::string toImapString(const std::string &s_in)
std::string toString(int i_in)
int atoi(const std::string &s_in)
void lowercase(std::string &input)
void trim(std::string &s_in, const std::string &chars=" \t\r\n")
Declaration of the StdIODevice class.
Declaration of the SyslogDevice class.