fix: support python2 fail2ban

Python2 pickles use different class names for some types. Specifically,
builtins.str is __builtin__.str.
This commit is contained in:
Private Creator 2021-12-18 06:58:40 +00:00 committed by Hector
parent f18bd78d4e
commit 7932ccbe23

View file

@ -59,7 +59,7 @@ func (s *Fail2BanSocket) read() (interface{}, error) {
unpickler := pickle.NewUnpickler(bufReader)
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 nil, fmt.Errorf("class not found: " + module + " : " + name)