summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-08-05 06:25:06 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-08-05 06:25:06 (GMT)
commit106490915b6f1b140cc6ae599cd5dbb71a64b312 (patch)
tree1f59b4ed8938ad75084e593f3ea45ac5fe922662
parent0d8e16c7adb3ac57d74e86bcf2311215ced1d034 (diff)
downloadcpython-106490915b6f1b140cc6ae599cd5dbb71a64b312.zip
cpython-106490915b6f1b140cc6ae599cd5dbb71a64b312.tar.gz
cpython-106490915b6f1b140cc6ae599cd5dbb71a64b312.tar.bz2
Patch #781722: Reject AF_INET6 if IPv6 is disabled. Will backport to 2.3.
-rw-r--r--Modules/socketmodule.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 0884d9d..d402339 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -2962,6 +2962,14 @@ socket_inet_pton(PyObject *self, PyObject *args)
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);
if (retval < 0) {
PyErr_SetFromErrno(socket_error);