fix: support python2 fail2ban
Python2 pickles use different class names for some types. Specifically, builtins.str is __builtin__.str.
This commit is contained in:
parent
f18bd78d4e
commit
7932ccbe23
@ -59,7 +59,7 @@ func (s *Fail2BanSocket) read() (interface{}, error) {
|
|||||||
unpickler := pickle.NewUnpickler(bufReader)
|
unpickler := pickle.NewUnpickler(bufReader)
|
||||||
|
|
||||||
unpickler.FindClass = func(module, name string) (interface{}, error) {
|
unpickler.FindClass = func(module, name string) (interface{}, error) {
|
||||||
if module == "builtins" && name == "str" {
|
if (module == "builtins" || module == "__builtin__") && name == "str" {
|
||||||
return &Py_builtins_str{}, nil
|
return &Py_builtins_str{}, nil
|
||||||
}
|
}
|
||||||
return nil, fmt.Errorf("class not found: " + module + " : " + name)
|
return nil, fmt.Errorf("class not found: " + module + " : " + name)
|
||||||
|
Loading…
Reference in New Issue
Block a user