6 this->configFile = strdup(configFile);
7 if(!title)title =
ident;
8 log =
new(std::nothrow) SysLog(title, logDirection | OPT_ISO8601);
23 this->ident = strdup(ident);
56 log->Put(E_CONFIG, LEV_ERR,
"Config file don't exists");
62 log->Put(E_MEMORY, LEV_EMERG,
"Can't allocate memory");
68 log->Put(E_MEMORY, LEV_EMERG,
"Can't allocate memory");
76 log->setMaxLevel(maxLogLevel);
80 log->Put(E_MEMORY, LEV_EMERG,
"Can't allocate memory");
88 char *adminHost = NULL;
94 log->Put(E_MEMORY, LEV_EMERG,
"Can't allocate memory");
118 log->setLogPath(path);
123 bool ApplicationPattern::setUser(
const char *user)
125 char *buf =
new(std::nothrow)
char[sysconf(_SC_GETPW_R_SIZE_MAX)];
131 struct passwd *ppwd = NULL;
132 memset(&pwd, 0,
sizeof(pwd));
133 int ret = getpwnam_r(user, &pwd, buf,
size_t(sysconf(_SC_GETPW_R_SIZE_MAX)), &ppwd);
136 if(setgid(pwd.pw_gid) == 0)
138 if(setuid(pwd.pw_uid) == 0)
140 log->Put(E_OK, LEV_INFO,
"Change user %s succefull", user);
146 log->Put(E_SETUID, LEV_ERR,
"Can't set uid to %d", pwd.pw_gid);
151 log->Put(E_SETGID, LEV_ERR,
"Can't set gid to %d", pwd.pw_gid);
156 log->Put(E_GETUIDGID, LEV_ERR,
"Can't get uid & gid for user: %s", user);
163 void ApplicationPattern::signalFunc(
int sigNum)
165 if(sigNum != SIGPIPE && sigNum != SIGUSR1)