Logo Search packages:      
Sourcecode: audit version File versions  Download package

def auditd_config::AuditdConfig::__updated_line (   self,
  vals,
  vals2,
  used,
  line 
) [private]

Return line updated with vals and vals2.

If line contains an option, mark it in used.

Definition at line 303 of file auditd_config.py.

00303                                                      :
        '''Return line updated with vals and vals2.

        If line contains an option, mark it in used.

        '''
        orig_line = line.rstrip('\n')
        try:
            a = self.__tokenize_line(line)
        except ParsingError:
            a = None
        if a is None:
            return orig_line
        keyword_lower = a[0].lower()
        used[keyword_lower] = True
        try:
            new_val = vals[keyword_lower]
        except KeyError:
            return orig_line

        new_val2 = vals2.get(keyword_lower)
        changed = False
        if keyword_lower in self.__case_insensitive_values:
            if new_val.lower() != a[2].lower():
                changed = True
        else:
            if new_val != a[2]:
                changed = True
        if new_val2 is not None:
            if len(a) != 4 or a[3] != new_val2:
                changed = True
        else:
            if len(a) != 3:
                changed = True
        if not changed:
            return orig_line
        elif new_val2 is not None:
            return '%s = %s %s' % (a[0], new_val, new_val2)
        else:
            return '%s = %s' % (a[0], new_val)

    def write(self, client):


Generated by  Doxygen 1.6.0   Back to index