]> granicus.if.org Git - python/commitdiff
Patch #781722: Reject AF_INET6 if IPv6 is disabled. Will backport to 2.3.
authorMartin v. Löwis <martin@v.loewis.de>
Tue, 5 Aug 2003 06:25:06 +0000 (06:25 +0000)
committerMartin v. Löwis <martin@v.loewis.de>
Tue, 5 Aug 2003 06:25:06 +0000 (06:25 +0000)
Modules/socketmodule.c

index 0884d9dcabcbc0bc797837c5a9e234543a18a4ad..d40233902e9e9ac66a5505453c9bd15559d3eea9 100644 (file)
@@ -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);