Skip to content

Commit

Permalink
git - Merge pull request #318 from DinoTools/fix_blackhole_connection…
Browse files Browse the repository at this point in the history
…_issue

Fix blackhole connection issue
  • Loading branch information
phibos authored Dec 27, 2020
2 parents 1a06a0a + 9504062 commit e041620
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 2 deletions.
18 changes: 17 additions & 1 deletion modules/python/binding.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@
#
# SPDX-License-Identifier: GPL-2.0-or-later

import inspect
import logging
import weakref
from dionaea.exception import LoaderError


logger = logging.getLogger("binding")
Expand Down Expand Up @@ -439,8 +441,22 @@ cdef class connection:


def __init__(self, con_type=None):
cdef c_connection_transport enum_type
_sig = inspect.signature(self.__init__)
for n, v in _sig.parameters.items():
if n == "self" and v.default == v.empty:
continue
if v.kind in (v.VAR_POSITIONAL, v.VAR_KEYWORD):
# Skip *args and **kwargs type vars
continue
if v.default == v.empty:
msg = "All arguments of __init__ must have a default value. class: '{}', arg: '{}'".format(
self.__class__.__name__,
n
)
logger.warning(msg)
raise LoaderError(msg)

cdef c_connection_transport enum_type
if self.thisptr == NULL:
if isinstance(con_type, unicode):
con_type_utf8 = con_type.encode(u'UTF-8')
Expand Down
2 changes: 1 addition & 1 deletion modules/python/dionaea/blackhole.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def start(cls, addr, iface=None, config=None):


class Blackhole(connection):
def __init__(self, proto):
def __init__(self, proto=None):
logger.debug("start blackhole")
connection.__init__(self, proto)

Expand Down

0 comments on commit e041620

Please sign in to comment.