diff options
author | Steve Dower <steve.dower@python.org> | 2020-03-31 11:38:53 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-31 11:38:53 (GMT) |
commit | 63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3 (patch) | |
tree | a249b3a79cce91fe6a8aa5c3d0e55b1793cdb058 /Modules | |
parent | ef67512b40240f765026ad41d60b0c9a6dacd2b9 (diff) | |
download | cpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.zip cpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.tar.gz cpython-63ba5cccf484b9ec23dfbf4cf7ffdc833eda98c3.tar.bz2 |
bpo-40121: Fixes audit event raised on creating a new socket (GH-19238)
Diffstat (limited to 'Modules')
-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 2818ac7..b5c241e 100644 --- a/Modules/socketmodule.c +++ b/Modules/socketmodule.c @@ -5099,7 +5099,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", @@ -5121,8 +5121,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; } |