mirror of https://github.com/fail2ban/fail2ban
TST: that we do receive IOError if trying to feed broken symlink into path to be monitored by server
parent
e12d389c65
commit
cf76019cca
|
@ -292,12 +292,23 @@ class Transmitter(TransmitterBase):
|
|||
self.transm.proceed(["set", self.jailName, "dellogpath", value]),
|
||||
(0, []))
|
||||
|
||||
def testJailLogPathInvalidFile(self):
|
||||
# Invalid file
|
||||
value = "this_file_shouldn't_exist"
|
||||
result = self.transm.proceed(
|
||||
["set", self.jailName, "addlogpath", value])
|
||||
self.assertTrue(isinstance(result[1], IOError))
|
||||
|
||||
def testJailLogPathBrokenSymlink(self):
|
||||
# Broken symlink
|
||||
name = tempfile.mktemp(prefix='tmp_fail2ban_broken_symlink')
|
||||
sname = name + '.slink'
|
||||
os.symlink(name, sname)
|
||||
result = self.transm.proceed(
|
||||
["set", self.jailName, "addlogpath", sname])
|
||||
self.assertTrue(isinstance(result[1], IOError))
|
||||
os.unlink(sname)
|
||||
|
||||
def testJailIgnoreIP(self):
|
||||
self.jailAddDelTest(
|
||||
"ignoreip",
|
||||
|
|
Loading…
Reference in New Issue