304 |
static int check_directory(Service_T s) { |
static int check_directory(Service_T s) { |
305 |
|
|
306 |
struct stat stat_buf; |
struct stat stat_buf; |
307 |
|
char report[STRLEN]; |
308 |
|
|
309 |
if(stat(s->path, &stat_buf) != 0) { |
if(stat(s->path, &stat_buf) != 0) { |
310 |
Event_post(s, EVENT_RESTART, |
Event_post(s, EVENT_RESTART, |
318 |
return FALSE; |
return FALSE; |
319 |
} |
} |
320 |
|
|
321 |
if(check_perm(s, stat_buf.st_mode)) |
if(check_perm(s, stat_buf.st_mode)) { |
322 |
return FALSE; |
s->perm->event_flag= TRUE; |
323 |
|
if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION)) |
324 |
if(check_uid(s, stat_buf.st_uid)) |
return FALSE; |
325 |
return FALSE; |
} |
326 |
|
|
327 |
if(check_gid(s, stat_buf.st_gid)) |
if(check_uid(s, stat_buf.st_uid)) { |
328 |
return FALSE; |
s->uid->event_flag= TRUE; |
329 |
|
if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID)) |
330 |
|
return FALSE; |
331 |
|
} |
332 |
|
|
333 |
|
if(check_gid(s, stat_buf.st_gid)) { |
334 |
|
s->gid->event_flag= TRUE; |
335 |
|
if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID)) |
336 |
|
return FALSE; |
337 |
|
} |
338 |
|
|
339 |
return TRUE; |
return TRUE; |
340 |
|
|
361 |
return FALSE; |
return FALSE; |
362 |
} |
} |
363 |
|
|
364 |
if(check_checksum(s)) |
if(check_checksum(s)) { |
365 |
return FALSE; |
s->checksum->event_flag= TRUE; |
366 |
|
if(! eval_actions(s->checksum->action, s, report, "checksum", EVENT_CHECKSUM)) |
367 |
|
return FALSE; |
368 |
|
} |
369 |
|
|
370 |
if(check_perm(s, stat_buf.st_mode)) |
if(check_perm(s, stat_buf.st_mode)) { |
371 |
return FALSE; |
s->perm->event_flag= TRUE; |
372 |
|
if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION)) |
373 |
|
return FALSE; |
374 |
|
} |
375 |
|
|
376 |
if(check_uid(s, stat_buf.st_uid)) |
if(check_uid(s, stat_buf.st_uid)) { |
377 |
return FALSE; |
s->uid->event_flag= TRUE; |
378 |
|
if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID)) |
379 |
|
return FALSE; |
380 |
|
} |
381 |
|
|
382 |
if(check_gid(s, stat_buf.st_gid)) |
if(check_gid(s, stat_buf.st_gid)) { |
383 |
return FALSE; |
s->gid->event_flag= TRUE; |
384 |
|
if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID)) |
385 |
|
return FALSE; |
386 |
|
} |
387 |
|
|
388 |
for(sl= s->sizelist; sl; sl= sl->next) { |
for(sl= s->sizelist; sl; sl= sl->next) { |
389 |
if(!check_size_item(s, sl, (unsigned long)stat_buf.st_size, report)) { |
if(!check_size_item(s, sl, (unsigned long)stat_buf.st_size, report)) { |
416 |
return FALSE; |
return FALSE; |
417 |
} |
} |
418 |
|
|
419 |
if(check_perm(s, stat_buf.st_mode)) |
if(check_perm(s, stat_buf.st_mode)) { |
420 |
return FALSE; |
s->perm->event_flag= TRUE; |
421 |
|
if(! eval_actions(s->perm->action, s, report, "permission", EVENT_PERMISSION)) |
422 |
if(check_uid(s, stat_buf.st_uid)) |
return FALSE; |
423 |
return FALSE; |
} |
424 |
|
|
425 |
if(check_gid(s, stat_buf.st_gid)) |
if(check_uid(s, stat_buf.st_uid)) { |
426 |
return FALSE; |
s->uid->event_flag= TRUE; |
427 |
|
if(! eval_actions(s->uid->action, s, report, "uid", EVENT_UID)) |
428 |
|
return FALSE; |
429 |
|
} |
430 |
|
|
431 |
|
if(check_gid(s, stat_buf.st_gid)) { |
432 |
|
s->gid->event_flag= TRUE; |
433 |
|
if(! eval_actions(s->gid->action, s, report, "gid", EVENT_GID)) |
434 |
|
return FALSE; |
435 |
|
} |
436 |
|
|
437 |
/* Test devices */ |
/* Test devices */ |
438 |
if(s->devicelist) { |
if(s->devicelist) { |