mirror of
https://github.com/python/cpython.git
synced 2025-09-26 18:29:57 +00:00
Patch #781722: Reject AF_INET6 if IPv6 is disabled. Will backport to 2.3.
This commit is contained in:
parent
0d8e16c7ad
commit
106490915b
1 changed files with 8 additions and 0 deletions
|
@ -2962,6 +2962,14 @@ socket_inet_pton(PyObject *self, PyObject *args)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef ENABLE_IPV6
|
||||||
|
if(af == AF_INET6) {
|
||||||
|
PyErr_SetString(socket_error,
|
||||||
|
"can't use AF_INET6, IPv6 is disabled");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
retval = inet_pton(af, ip, packed);
|
retval = inet_pton(af, ip, packed);
|
||||||
if (retval < 0) {
|
if (retval < 0) {
|
||||||
PyErr_SetFromErrno(socket_error);
|
PyErr_SetFromErrno(socket_error);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue