File: run.cc

package info (click to toggle)
stealth 4.03.03-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 1,548 kB
  • sloc: cpp: 2,767; sh: 151; makefile: 132; ansic: 42
file content (36 lines) | stat: -rw-r--r-- 1,249 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#include "integrityscanner.ih"

void IntegrityScanner::run()
{
    d_active = true;

    ++d_nScans;

    setSentinel();                              // determine d_sentinel

    d_cmdIterator = d_policyFile.firstCmd();        // d_cmdIterator is set to
                                                // the first command. It's a
                                                // true iterator, so we can 
                                                // add values to it, below.

    if (size_t cmdNr = d_options.commandNr())   // is there  a command number?
        foreground(cmdNr);                      // run it in the foreground
    else                                        // no number: process all
    {                                           // commands    
        auto beyond = d_policyFile.beyondCmd();

        for (auto &cmd: ranger(d_cmdIterator, beyond))
        {
            if (d_pending.hasMode(SUSPEND | RELOAD | TERMINATE))
            {
                m1 << "integrity scan interrupted by " << 
                            d_pending << " request" << endl;
                d_active = false;
            }
            execute(cmd);
        }
    }

    m3 << "policy file processed" << endl;
    d_active = false;
}