|
Lines 32-38
Link Here
|
| 32 |
|
32 |
|
| 33 |
__package__ = '' # workaround for PEP 366 |
33 |
__package__ = '' # workaround for PEP 366 |
| 34 |
import listener |
34 |
import listener |
| 35 |
import string |
|
|
| 36 |
import time |
35 |
import time |
| 37 |
import syslog |
36 |
import syslog |
| 38 |
import re |
37 |
import re |
|
Lines 69-90
filemode = '0640'
Link Here
|
| 69 |
cleanupDellog = True # remove missed dellog entries (after reporting about them) |
68 |
cleanupDellog = True # remove missed dellog entries (after reporting about them) |
| 70 |
digest = listener.configRegistry.get('ldap/logging/hash', 'md5') |
69 |
digest = listener.configRegistry.get('ldap/logging/hash', 'md5') |
| 71 |
|
70 |
|
| 72 |
|
71 |
SAFE_STRING_RE = re.compile(r'^(?:\000|\n|\r| |:|<)|[\000\n\r\200-\377]+|[ ]+$') |
| 73 |
def needsConversion(char): |
|
|
| 74 |
return char > '\x7f' |
| 75 |
|
| 76 |
|
| 77 |
def base64Filter(str): |
| 78 |
if [char for char in str if needsConversion(char)]: |
| 79 |
str = string.rstrip(base64.encodestring(str)) |
| 80 |
return str |
| 81 |
|
72 |
|
| 82 |
|
73 |
|
| 83 |
def ldapEntry2string(entry): |
74 |
def ldapEntry2string(entry): |
| 84 |
str = '' |
75 |
return ''.join( |
| 85 |
for (key, valuelist) in entry.iteritems(): |
76 |
'%s:: %s\n' % (key, base64.standard_b64encode(value)) |
| 86 |
str += ''.join(['%s: %s\n' % (key, base64Filter(value)) for value in valuelist]) |
77 |
if SAFE_STRING_RE.search(value) else |
| 87 |
return str |
78 |
'%s: %s\n' % (key, value) |
|
|
79 |
for key, values in entry.iteritems() |
| 80 |
for value in values |
| 81 |
) |
| 88 |
|
82 |
|
| 89 |
|
83 |
|
| 90 |
def ldapTime2string(timestamp): |
84 |
def ldapTime2string(timestamp): |