1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-22 08:58:47 +00:00

Unbreak on 8 after the recent jail changes.

Submitted by:	bz, pointyhat
Reviewed by:	miwi
This commit is contained in:
Erwin Lansing 2008-12-23 21:15:21 +00:00
parent 45c503bfb2
commit 4be5597b17
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=224657
2 changed files with 48 additions and 0 deletions

View File

@ -32,5 +32,8 @@ PLIST_FILES= %%PYTHON_SITELIBDIR%%/freebsd.so \
.if ${OSVERSION} >= 700000
EXTRA_PATCHES+= ${FILESDIR}/freebsd7_patch-src-netstat.c
.endif
.if ${OSVERSION} >= 800056
EXTRA_PATCHES+= ${FILESDIR}/freebsd8_patch-src-jail.c
.endif
.include <bsd.port.post.mk>

View File

@ -0,0 +1,45 @@
--- src/jail.c.orig 2005-05-08 06:55:00.000000000 +0000
+++ src/jail.c 2008-12-23 13:54:31.000000000 +0000
@@ -40,21 +40,37 @@ static PyObject *
PyFB_jail(PyObject *self, PyObject *args)
{
struct jail jp;
+ struct in_addr ia;
char *ipaddr;
+ int error;
if (!PyArg_ParseTuple(args, "sss:jail", &(jp.path),
&(jp.hostname), &ipaddr))
return NULL;
- jp.version = 0;
- jp.ip_number = inet_addr(ipaddr);
-
- if (jp.ip_number == INADDR_NONE) {
+ ia.s_addr = inet_addr(ipaddr);
+ if (ia.s_addr == INADDR_NONE) {
PyErr_SetString(PyExc_ValueError, "malformed internet address");
return NULL;
}
- if (jail(&jp) == -1)
+ jp.version = JAIL_API_VERSION;
+ jp.jailname = NULL;
+ jp.ip4s = 1;
+ jp.ip4 = malloc(jp.ip4s * sizeof(struct in_addr));
+ if (jp.ip4 == NULL) {
+ PyErr_SetString(PyExc_ValueError, "Cannot allocate memory");
+ return NULL;
+ }
+ jp.ip4->s_addr = ia.s_addr;
+ jp.ip6s = 0;
+ jp.ip6 = NULL;
+
+ error = jail(&jp);
+
+ free(jp.ip4);
+
+ if (error == -1)
return OSERROR();
Py_RETURN_NONE;