diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-03-31 11:57:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 11:57:06 (GMT) |
commit | 6a0ee60db4cee4a01bae1a2922d21a859e9ea2ed (patch) | |
tree | e0bbdc81cac241010112b8712b9328dec5b16c0f /Modules/socketmodule.c | |
parent | 6c9a2a831ea235fad7a6398bba395f4c776dc85c (diff) | |
download | cpython-6a0ee60db4cee4a01bae1a2922d21a859e9ea2ed.zip cpython-6a0ee60db4cee4a01bae1a2922d21a859e9ea2ed.tar.gz cpython-6a0ee60db4cee4a01bae1a2922d21a859e9ea2ed.tar.bz2 |
bpo-40121: Fixes audit event raised on creating a new socket (GH-19238)
(cherry picked from commit 63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3)
Co-authored-by: Steve Dower <steve.dower@python.org>
Diffstat (limited to 'Modules/socketmodule.c')
-rw-r--r-- | Modules/socketmodule.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c index 594a0d6..5dc5f4e 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -5069,7 +5069,7 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) #ifdef MS_WINDOWS /* In this case, we don't use the family, type and proto args */ - if (fdobj != NULL && fdobj != Py_None) + if (fdobj == NULL || fdobj == Py_None) #endif { if (PySys_Audit("socket.__new__", "Oiii", @@ -5091,8 +5091,9 @@ sock_initobj(PyObject *self, PyObject *args, PyObject *kwds) } memcpy(&info, PyBytes_AS_STRING(fdobj), sizeof(info)); - if (PySys_Audit("socket()", "iii", info.iAddressFamily, - info.iSocketType, info.iProtocol) < 0) { + if (PySys_Audit("socket.__new__", "Oiii", s, + info.iAddressFamily, info.iSocketType, + info.iProtocol) < 0) { return -1; } |