Subversion Repositories public

Rev

Rev 47 | Rev 55 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 47 Rev 51
Line 196... Line 196...
196
  ProcData_t pd;
196
  ProcData_t pd;
197
  pd.pid = fork();
197
  pd.pid = fork();
198
  if (pd.pid == 0) {
198
  if (pd.pid == 0) {
199
   
199
   
200
    struct passwd* pwd = getpwnam(m_user.c_str());
200
    struct passwd* pwd = getpwnam(m_user.c_str());
201
    if (pwd == NULL)
201
    if (    pwd == NULL                 // user not found
202
      _exit(1);
-
 
203
     
-
 
204
    if (setuid(pwd->pw_uid) != 0)
202
        ||  setuid(pwd->pw_uid) != 0    // setting UID failed
205
      _exit(1);
-
 
206
   
-
 
207
    if (execvp(argv[0], argv) != 0) {
203
        ||  execvp(argv[0], argv) != 0) // exec failed
-
 
204
    {
208
      _exit(1);
205
      _exit(1);
209
    }
206
    }
210
  }
207
  }
211
  else if (pd.pid > 0) {
208
  else if (pd.pid > 0) {
212
    if (pE->IsNoLoop()) {
209
    if (pE->IsNoLoop()) {
Line 224... Line 221...
224
    if (pE->IsNoLoop())
221
    if (pE->IsNoLoop())
225
      pW->SetEnabled(true);
222
      pW->SetEnabled(true);
226
     
223
     
227
    syslog(LOG_ERR, "cannot fork process: %s", strerror(errno));
224
    syslog(LOG_ERR, "cannot fork process: %s", strerror(errno));
228
  }
225
  }
-
 
226
 
-
 
227
  CleanupArgs(argc, argv);
229
}
228
}
230
229
231
InCronTabEntry* UserTable::FindEntry(InotifyWatch* pWatch)
230
InCronTabEntry* UserTable::FindEntry(InotifyWatch* pWatch)
232
{
231
{
233
  IWCE_MAP::iterator it = m_map.find(pWatch);
232
  IWCE_MAP::iterator it = m_map.find(pWatch);
Line 263... Line 262...
263
  }
262
  }
264
 
263
 
265
  return true;
264
  return true;
266
}
265
}
267
266
-
 
267
void UserTable::CleanupArgs(int argc, char** argv)
-
 
268
{
-
 
269
  for (int i=0; i<argc; i++) {
-
 
270
    delete[] argv[i];
-
 
271
  }
-
 
272
 
-
 
273
  delete[] argv;
-
 
274
}
-
 
275
268
void UserTable::FinishDone()
276
void UserTable::FinishDone()
269
{
277
{
270
  PROC_LIST::iterator it = s_procList.begin();
278
  PROC_LIST::iterator it = s_procList.begin();
271
  while (it != s_procList.end()) {
279
  while (it != s_procList.end()) {
272
    ProcData_t& pd = *it;
280
    ProcData_t& pd = *it;