mirror of
https://git.freebsd.org/ports.git
synced 2025-07-18 01:39:16 -04:00
sysutils/p5-BSD-Jail-Object: remove legacy code in patch for FreeBSD 7/8
Phabricator: D26646
This commit is contained in:
parent
e4e4c74805
commit
85da70486c
Notes:
svn2git
2021-03-31 03:12:20 +00:00
svn path=/head/; revision=552961
1 changed files with 10 additions and 26 deletions
|
@ -8,9 +8,9 @@
|
||||||
! version information along with the cached data.
|
! version information along with the cached data.
|
||||||
! Look at usr.sbin/{jail,jls,jexec} sources for the right ideas.
|
! Look at usr.sbin/{jail,jls,jexec} sources for the right ideas.
|
||||||
!
|
!
|
||||||
--- ./Object.pm.orig 2006-08-08 04:54:29.000000000 +0000
|
--- Object.pm.orig 2006-08-08 04:54:29 UTC
|
||||||
+++ ./Object.pm 2008-12-28 14:06:27.000000000 +0000
|
+++ Object.pm
|
||||||
@@ -317,21 +317,69 @@
|
@@ -317,21 +317,56 @@ struct xprison
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,19 +22,13 @@
|
||||||
+_is_jail_ip4(char *string, struct xprison *xp)
|
+_is_jail_ip4(char *string, struct xprison *xp)
|
||||||
+{
|
+{
|
||||||
+ struct in_addr in;
|
+ struct in_addr in;
|
||||||
+#if ((__FreeBSD_version >= 800056) || (__FreeBSD_version < 800000) && (__FreeBSD_version >= 701103))
|
|
||||||
+ struct in_addr *iap;
|
+ struct in_addr *iap;
|
||||||
+ char *q;
|
+ char *q;
|
||||||
+ int i;
|
+ int i;
|
||||||
+#endif
|
|
||||||
+
|
+
|
||||||
+ if (inet_pton(AF_INET, string, &in) != 1)
|
+ if (inet_pton(AF_INET, string, &in) != 1)
|
||||||
+ return (0);
|
+ return (0);
|
||||||
+
|
+
|
||||||
+#if ((__FreeBSD_version >= 800000 && __FreeBSD_version < 800056) || __FreeBSD_version < 701103)
|
|
||||||
+ if (in.s_addr == xp->pr_ip)
|
|
||||||
+ return (1);
|
|
||||||
+#else
|
|
||||||
+ if (xp->pr_ip4s == 0)
|
+ if (xp->pr_ip4s == 0)
|
||||||
+ return (0);
|
+ return (0);
|
||||||
+ q = (char *)(xp + 1);
|
+ q = (char *)(xp + 1);
|
||||||
|
@ -42,21 +36,15 @@
|
||||||
+ for (i=0; i < xp->pr_ip4s; i++)
|
+ for (i=0; i < xp->pr_ip4s; i++)
|
||||||
+ if (in.s_addr == iap[i].s_addr)
|
+ if (in.s_addr == iap[i].s_addr)
|
||||||
+ return (1);
|
+ return (1);
|
||||||
+#endif
|
|
||||||
+ return (0);
|
+ return (0);
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
+static void
|
+static void
|
||||||
+_get_jail_ip4(struct xprison *xp, struct in_addr *ia)
|
+_get_jail_ip4(struct xprison *xp, struct in_addr *ia)
|
||||||
+{
|
+{
|
||||||
+#if ((__FreeBSD_version >= 800056) || (__FreeBSD_version < 800000) && (__FreeBSD_version >= 701103))
|
|
||||||
+ struct in_addr *iap;
|
+ struct in_addr *iap;
|
||||||
+ char *q;
|
+ char *q;
|
||||||
+#endif
|
|
||||||
+
|
+
|
||||||
+#if ((__FreeBSD_version >= 800000 && __FreeBSD_version < 800056) || __FreeBSD_version < 701103)
|
|
||||||
+ ia->s_addr = xp->pr_ip;
|
|
||||||
+#else
|
|
||||||
+ if (xp->pr_ip4s == 0)
|
+ if (xp->pr_ip4s == 0)
|
||||||
+ ia->s_addr = 0;
|
+ ia->s_addr = 0;
|
||||||
+ else {
|
+ else {
|
||||||
|
@ -64,7 +52,6 @@
|
||||||
+ iap = (struct in_addr *)(void *)q;
|
+ iap = (struct in_addr *)(void *)q;
|
||||||
+ ia->s_addr = iap[0].s_addr;
|
+ ia->s_addr = iap[0].s_addr;
|
||||||
+ }
|
+ }
|
||||||
+#endif
|
|
||||||
+}
|
+}
|
||||||
+
|
+
|
||||||
// fetch a specific jail's information
|
// fetch a specific jail's information
|
||||||
|
@ -83,7 +70,7 @@
|
||||||
len = sysctl_len();
|
len = sysctl_len();
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -341,15 +389,15 @@
|
@@ -341,15 +376,15 @@ _find_jail( int compare, char *string )
|
||||||
*/
|
*/
|
||||||
|
|
||||||
for (i = 0; i < len / sizeof(*xp); i++) {
|
for (i = 0; i < len / sizeof(*xp); i++) {
|
||||||
|
@ -101,7 +88,7 @@
|
||||||
Inline_Stack_Push( sv_2mortal( newSVpvf( inet_ntoa(in) ) ));
|
Inline_Stack_Push( sv_2mortal( newSVpvf( inet_ntoa(in) ) ));
|
||||||
Inline_Stack_Push( sv_2mortal( newSVpvf( xp->pr_host ) ));
|
Inline_Stack_Push( sv_2mortal( newSVpvf( xp->pr_host ) ));
|
||||||
Inline_Stack_Push( sv_2mortal( newSVpvf( xp->pr_path ) ));
|
Inline_Stack_Push( sv_2mortal( newSVpvf( xp->pr_path ) ));
|
||||||
@@ -360,6 +408,7 @@
|
@@ -360,6 +395,7 @@ _find_jail( int compare, char *string )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -109,7 +96,7 @@
|
||||||
Inline_Stack_Done;
|
Inline_Stack_Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -367,12 +416,12 @@
|
@@ -367,12 +403,12 @@ _find_jail( int compare, char *string )
|
||||||
void
|
void
|
||||||
_find_jids()
|
_find_jids()
|
||||||
{
|
{
|
||||||
|
@ -124,7 +111,7 @@
|
||||||
len = sysctl_len();
|
len = sysctl_len();
|
||||||
|
|
||||||
for (i = 0; i < len / sizeof(*xp); i++) {
|
for (i = 0; i < len / sizeof(*xp); i++) {
|
||||||
@@ -380,6 +429,7 @@
|
@@ -380,6 +416,7 @@ _find_jids()
|
||||||
xp++;
|
xp++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -132,18 +119,15 @@
|
||||||
Inline_Stack_Done;
|
Inline_Stack_Done;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -402,8 +452,14 @@
|
@@ -402,8 +439,9 @@ _create( char *path, char *hostname, char *ipaddr )
|
||||||
|
|
||||||
j.path = path;
|
j.path = path;
|
||||||
j.hostname = hostname;
|
j.hostname = hostname;
|
||||||
+#if ((__FreeBSD_version >= 800000 && __FreeBSD_version < 800056) || __FreeBSD_version < 701103)
|
- j.ip_number = ntohl( ip.s_addr );
|
||||||
j.ip_number = ntohl( ip.s_addr );
|
- j.version = 0;
|
||||||
j.version = 0;
|
|
||||||
+#else
|
|
||||||
+ j.version = JAIL_API_VERSION;
|
+ j.version = JAIL_API_VERSION;
|
||||||
+ j.ip4s = 1;
|
+ j.ip4s = 1;
|
||||||
+ j.ip4 = &ip;
|
+ j.ip4 = &ip;
|
||||||
+#endif
|
|
||||||
|
|
||||||
if ( (jid = jail( &j )) == -1 ) return 0;
|
if ( (jid = jail( &j )) == -1 ) return 0;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue