Miguel Brito <miguel.mdebr...@gmail.com> added the comment:

I tried debugging this and from what I can see it's because there's an if that 
checks if the authkey is not None in the Client constructor:

https://github.com/python/cpython/blob/v3.9.4/Lib/multiprocessing/connection.py#L512

```
    if authkey is not None:
        answer_challenge(c, authkey)
        deliver_challenge(c, authkey)
```

Whereas in the Listener, the check is different:

https://github.com/python/cpython/blob/v3.9.4/Lib/multiprocessing/connection.py#L469

```
        c = self._listener.accept()
        if self._authkey:
            deliver_challenge(c, self._authkey)
            answer_challenge(c, self._authkey)
        return c
```

If I change the Listener to:

```
        if self._authkey is not None:
            deliver_challenge(c, self._authkey)
            answer_challenge(c, self._authkey)
        return c
```

it works.


The docs say:

"""
If authkey is given and not None, it should be a byte string and will be used 
as the secret key for an HMAC-based authentication challenge. No authentication 
is done if authkey is None. AuthenticationError is raised if authentication 
fails. See Authentication keys.
"""


Now the question is, if None is OK because no auth will be done what about 
empty bytes? Can it be used as secret key? If empty bytes is not accepted 
shouldn't Listener/Client raise an exception in the constructor?

----------
nosy: +miguendes

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue43952>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to