- update selinux and inode patches (new versions are based on upstream)
This commit is contained in:
parent
ab6d748549
commit
4027f27adc
@ -1,7 +1,7 @@
|
|||||||
Summary: A utility which lists open files on a Linux/UNIX system
|
Summary: A utility which lists open files on a Linux/UNIX system
|
||||||
Name: lsof
|
Name: lsof
|
||||||
Version: 4.78
|
Version: 4.78
|
||||||
Release: 6%{?dist}
|
Release: 7%{?dist}
|
||||||
License: Distributable
|
License: Distributable
|
||||||
Group: Development/Debuggers
|
Group: Development/Debuggers
|
||||||
|
|
||||||
@ -21,7 +21,7 @@ BuildRequires: libselinux-devel
|
|||||||
|
|
||||||
Patch1: lsof_4.78C-threads.patch
|
Patch1: lsof_4.78C-threads.patch
|
||||||
Patch2: lsof_4.78C-inode.patch
|
Patch2: lsof_4.78C-inode.patch
|
||||||
Patch3: lsof_4.78C-selinux-strerr.patch
|
Patch3: lsof_4.78C-selinux.patch
|
||||||
|
|
||||||
%description
|
%description
|
||||||
Lsof stands for LiSt Open Files, and it does just that: it lists
|
Lsof stands for LiSt Open Files, and it does just that: it lists
|
||||||
@ -59,6 +59,9 @@ rm -rf ${RPM_BUILD_ROOT}
|
|||||||
%{_mandir}/man*/*
|
%{_mandir}/man*/*
|
||||||
|
|
||||||
%changelog
|
%changelog
|
||||||
|
* Wed Oct 3 2007 Karel Zak <kzak@redhat.com> 4.78-7
|
||||||
|
- update selinux and inode patches (new versions are based on upstream)
|
||||||
|
|
||||||
* Tue Oct 2 2007 Karel Zak <kzak@redhat.com> 4.78-6
|
* Tue Oct 2 2007 Karel Zak <kzak@redhat.com> 4.78-6
|
||||||
- fix #280651 - lsof prints entries in multiple lines when SElinux is disabled
|
- fix #280651 - lsof prints entries in multiple lines when SElinux is disabled
|
||||||
- fix #243976 - mmap'd files with large inode numbers confuse lsof
|
- fix #243976 - mmap'd files with large inode numbers confuse lsof
|
||||||
|
@ -1,12 +1,337 @@
|
|||||||
diff -up lsof_4.78C-rh/dialects/linux/dproc.c.kzak lsof_4.78C-rh/dialects/linux/dproc.c
|
diff -up lsof_4.78C-rh/dialects/linux/dnode.c.inode lsof_4.78C-rh/dialects/linux/dnode.c
|
||||||
--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2007-10-02 14:30:25.000000000 +0200
|
--- lsof_4.78C-rh/dialects/linux/dnode.c.inode 2006-06-12 19:10:05.000000000 +0200
|
||||||
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-02 14:31:46.000000000 +0200
|
+++ lsof_4.78C-rh/dialects/linux/dnode.c 2007-10-03 14:01:54.000000000 +0200
|
||||||
@@ -790,7 +790,7 @@ process_proc_map(p, s, ss)
|
@@ -191,7 +191,7 @@ get_locks(p)
|
||||||
|
char buf[MAXPATHLEN], *ec, **fp;
|
||||||
|
dev_t dev;
|
||||||
|
int ex, i, h, mode, pid;
|
||||||
|
- unsigned long inode;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
struct llock *lp, *np;
|
||||||
|
FILE *ls;
|
||||||
|
long maj, min;
|
||||||
|
@@ -267,7 +267,7 @@ get_locks(p)
|
||||||
|
*/
|
||||||
|
ec = (char *)NULL;
|
||||||
|
if (!fp[7] || !*fp[7]
|
||||||
|
- || (inode = strtoul(fp[7], &ec, 0)) == ULONG_MAX
|
||||||
|
+ || (inode = strtoull(fp[7], &ec, 0)) == ULONG_MAX
|
||||||
|
|| !ec || *ec)
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
@@ -297,7 +297,7 @@ get_locks(p)
|
||||||
|
for (lp = LckH[h]; lp; lp = lp->next) {
|
||||||
|
if (lp->pid == pid
|
||||||
|
&& lp->dev == dev
|
||||||
|
- && lp->inode == (INODETYPE)inode
|
||||||
|
+ && lp->inode == inode
|
||||||
|
&& lp->type == type)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
@@ -307,14 +307,15 @@ get_locks(p)
|
||||||
|
* Allocate a new llock structure and link it to the PID hash bucket.
|
||||||
|
*/
|
||||||
|
if (!(lp = (struct llock *)malloc(sizeof(struct llock)))) {
|
||||||
|
+ (void) snpf(buf, sizeof(buf), InodeFmt_d, inode);
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
- "%s: can't allocate llock: PID %d; dev %x; inode %ld\n",
|
||||||
|
- Pn, pid, (int)dev, inode);
|
||||||
|
+ "%s: can't allocate llock: PID %d; dev %x; inode %s\n",
|
||||||
|
+ Pn, pid, (int)dev, buf);
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
lp->pid = pid;
|
||||||
|
lp->dev = dev;
|
||||||
|
- lp->inode = (INODETYPE)inode;
|
||||||
|
+ lp->inode = inode;
|
||||||
|
lp->type = type;
|
||||||
|
lp->next = LckH[h];
|
||||||
|
LckH[h] = lp;
|
||||||
|
diff -up lsof_4.78C-rh/dialects/linux/dproc.c.inode lsof_4.78C-rh/dialects/linux/dproc.c
|
||||||
|
--- lsof_4.78C-rh/dialects/linux/dproc.c.inode 2007-10-03 14:01:54.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-03 14:01:54.000000000 +0200
|
||||||
|
@@ -41,6 +41,9 @@ static char *rcsid = "$Id: dproc.c,v 1.1
|
||||||
|
#include <selinux/selinux.h>
|
||||||
|
#endif /* defined(HASSELINUX) */
|
||||||
|
|
||||||
|
+#if !defined(ULLONG_MAX)
|
||||||
|
+#define ULLONG_MAX 18446744073709551615ULL
|
||||||
|
+#endif /* !defined(ULLONG_MAX) */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Local definitions
|
||||||
|
@@ -790,7 +793,10 @@ process_proc_map(p, s, ss)
|
||||||
dev = (dev_t)makedev((int)maj, (int)min);
|
dev = (dev_t)makedev((int)maj, (int)min);
|
||||||
if (!fp[5] || !*fp[5])
|
if (!fp[5] || !*fp[5])
|
||||||
continue;
|
continue;
|
||||||
- inode = (INODETYPE)atoi(fp[5]);
|
- inode = (INODETYPE)atoi(fp[5]);
|
||||||
+ inode = (INODETYPE)atoll(fp[5]);
|
+ ep = (char *)NULL;
|
||||||
|
+ if ((inode = strtoull(fp[5], &ep, 0)) == ULLONG_MAX
|
||||||
|
+ || !ep || *ep)
|
||||||
|
+ continue;
|
||||||
if (!dev && !inode)
|
if (!dev && !inode)
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
|
diff -up lsof_4.78C-rh/dialects/linux/dsock.c.inode lsof_4.78C-rh/dialects/linux/dsock.c
|
||||||
|
--- lsof_4.78C-rh/dialects/linux/dsock.c.inode 2006-06-12 19:10:05.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/dialects/linux/dsock.c 2007-10-03 14:02:39.000000000 +0200
|
||||||
|
@@ -350,7 +350,8 @@ get_ax25(p)
|
||||||
|
FILE *as;
|
||||||
|
char buf[MAXPATHLEN], *da, *dev_ch, *ep, **fp, *sa;
|
||||||
|
int h, nf;
|
||||||
|
- unsigned long inode, rq, sq, state;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
+ unsigned long rq, sq, state;
|
||||||
|
MALLOC_S len;
|
||||||
|
unsigned char rqs, sqs;
|
||||||
|
/*
|
||||||
|
@@ -410,12 +411,12 @@ get_ax25(p)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[23] || !*fp[23]
|
||||||
|
- || (inode = strtoul(fp[23], &ep, 0)) == ULONG_MAX
|
||||||
|
+ || (inode = strtoull(fp[23], &ep, 0)) == ULONG_MAX
|
||||||
|
|| !ep || *ep)
|
||||||
|
continue;
|
||||||
|
h = INOHASH((INODETYPE)inode);
|
||||||
|
for (ap = AX25sin[h]; ap; ap = ap->next) {
|
||||||
|
- if ((INODETYPE)inode == ap->inode)
|
||||||
|
+ if (inode == ap->inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ap)
|
||||||
|
@@ -496,7 +497,7 @@ get_ax25(p)
|
||||||
|
}
|
||||||
|
ap->da = da;
|
||||||
|
ap->dev_ch = dev_ch;
|
||||||
|
- ap->inode = (INODETYPE)inode;
|
||||||
|
+ ap->inode = inode;
|
||||||
|
ap->rq = rq;
|
||||||
|
ap->rqs = rqs;
|
||||||
|
ap->sa = sa;
|
||||||
|
@@ -521,7 +522,8 @@ get_ipx(p)
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp, *la, *ra;
|
||||||
|
int fl = 1;
|
||||||
|
int h;
|
||||||
|
- unsigned long inode, rxq, state, txq;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
+ unsigned long rxq, state, txq;
|
||||||
|
struct ipxsin *ip, *np;
|
||||||
|
MALLOC_S len;
|
||||||
|
FILE *xs;
|
||||||
|
@@ -588,12 +590,12 @@ get_ipx(p)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[6] || !*fp[6]
|
||||||
|
- || (inode = strtoul(fp[6], &ep, 0)) == ULONG_MAX
|
||||||
|
+ || (inode = strtoull(fp[6], &ep, 0)) == ULONG_MAX
|
||||||
|
|| !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (ip = Ipxsin[h]; ip; ip = ip->next) {
|
||||||
|
- if ((INODETYPE)inode == ip->inode)
|
||||||
|
+ if (inode == ip->inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (ip)
|
||||||
|
@@ -653,7 +655,7 @@ get_ipx(p)
|
||||||
|
Pn, sizeof(struct ipxsin));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- ip->inode = (INODETYPE)inode;
|
||||||
|
+ ip->inode = inode;
|
||||||
|
ip->la = la;
|
||||||
|
ip->ra = ra;
|
||||||
|
ip->txq = txq;
|
||||||
|
@@ -676,7 +678,7 @@ get_raw(p)
|
||||||
|
{
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp, *la, *ra, *sp;
|
||||||
|
int h;
|
||||||
|
- unsigned long inode;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
int nf = 12;
|
||||||
|
struct rawsin *np, *rp;
|
||||||
|
MALLOC_S lal, ral, spl;
|
||||||
|
@@ -741,12 +743,12 @@ get_raw(p)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[9] || !*fp[9]
|
||||||
|
- || (inode = strtoul(fp[9], &ep, 0)) == ULONG_MAX
|
||||||
|
+ || (inode = strtoull(fp[9], &ep, 0)) == ULONG_MAX
|
||||||
|
|| !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (rp = Rawsin[h]; rp; rp = rp->next) {
|
||||||
|
- if ((INODETYPE)inode == rp->inode)
|
||||||
|
+ if (inode == rp->inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (rp)
|
||||||
|
@@ -800,7 +802,7 @@ get_raw(p)
|
||||||
|
Pn, sizeof(struct rawsin));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- rp->inode = (INODETYPE)inode;
|
||||||
|
+ rp->inode = inode;
|
||||||
|
rp->la = la;
|
||||||
|
rp->lal = lal;
|
||||||
|
rp->ra = ra;
|
||||||
|
@@ -825,9 +827,10 @@ get_tcpudp(p, pr, clr)
|
||||||
|
int clr; /* 1 == clear the table */
|
||||||
|
{
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp;
|
||||||
|
- unsigned long faddr, fport, inode, laddr, lport, rxq, state, txq;
|
||||||
|
+ unsigned long faddr, fport, laddr, lport, rxq, state, txq;
|
||||||
|
int h, nf;
|
||||||
|
FILE *fs;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
struct tcp_udp *np, *tp;
|
||||||
|
/*
|
||||||
|
* Delete previous table contents. Allocate a table for the first time.
|
||||||
|
@@ -902,7 +905,7 @@ get_tcpudp(p, pr, clr)
|
||||||
|
|| (fport = strtoul(fp[4], &ep, 16)) == ULONG_MAX || !ep || *ep)
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
- * Get the state, queue sizes, and inode.
|
||||||
|
+ * Get the state and queue sizes.
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[5] || !*fp[5]
|
||||||
|
@@ -921,11 +924,11 @@ get_tcpudp(p, pr, clr)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[13] || !*fp[13]
|
||||||
|
- || (inode = strtoul(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
+ || (inode = strtoull(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (tp = TcpUdp[h]; tp; tp = tp->next) {
|
||||||
|
- if (tp->inode == (INODETYPE)inode)
|
||||||
|
+ if (tp->inode == inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (tp)
|
||||||
|
@@ -939,7 +942,7 @@ get_tcpudp(p, pr, clr)
|
||||||
|
Pn, sizeof(struct tcp_udp));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- tp->inode = (INODETYPE)inode;
|
||||||
|
+ tp->inode = inode;
|
||||||
|
tp->faddr = faddr;
|
||||||
|
tp->fport = (int)(fport & 0xffff);
|
||||||
|
tp->laddr = laddr;
|
||||||
|
@@ -966,7 +969,7 @@ get_raw6(p)
|
||||||
|
{
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp, *la, *ra, *sp;
|
||||||
|
int h;
|
||||||
|
- unsigned long inode;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
int nf = 12;
|
||||||
|
struct rawsin *np, *rp;
|
||||||
|
MALLOC_S lal, ral, spl;
|
||||||
|
@@ -1031,12 +1034,12 @@ get_raw6(p)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[9] || !*fp[9]
|
||||||
|
- || (inode = strtoul(fp[9], &ep, 0)) == ULONG_MAX
|
||||||
|
+ || (inode = strtoull(fp[9], &ep, 0)) == ULONG_MAX
|
||||||
|
|| !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (rp = Rawsin6[h]; rp; rp = rp->next) {
|
||||||
|
- if ((INODETYPE)inode == rp->inode)
|
||||||
|
+ if (inode == rp->inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (rp)
|
||||||
|
@@ -1090,7 +1093,7 @@ get_raw6(p)
|
||||||
|
Pn, sizeof(struct rawsin));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- rp->inode = (INODETYPE)inode;
|
||||||
|
+ rp->inode = inode;
|
||||||
|
rp->la = la;
|
||||||
|
rp->lal = lal;
|
||||||
|
rp->ra = ra;
|
||||||
|
@@ -1116,9 +1119,10 @@ get_tcpudp6(p, pr, clr)
|
||||||
|
{
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp;
|
||||||
|
struct in6_addr faddr, laddr;
|
||||||
|
- unsigned long fport, inode, lport, rxq, state, txq;
|
||||||
|
+ unsigned long fport, lport, rxq, state, txq;
|
||||||
|
int h, nf;
|
||||||
|
FILE *fs;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
struct tcp_udp6 *np6, *tp6;
|
||||||
|
/*
|
||||||
|
* Delete previous table contents. Allocate a table for the first time.
|
||||||
|
@@ -1189,7 +1193,7 @@ get_tcpudp6(p, pr, clr)
|
||||||
|
|| (fport = strtoul(fp[4], &ep, 16)) == ULONG_MAX || !ep || *ep)
|
||||||
|
continue;
|
||||||
|
/*
|
||||||
|
- * Get the state, queue sizes, and inode.
|
||||||
|
+ * Get the state and queue sizes.
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[5] || !*fp[5]
|
||||||
|
@@ -1208,11 +1212,11 @@ get_tcpudp6(p, pr, clr)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[13] || !*fp[13]
|
||||||
|
- || (inode = strtoul(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
+ || (inode = strtoull(fp[13], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (tp6 = TcpUdp6[h]; tp6; tp6 = tp6->next) {
|
||||||
|
- if (tp6->inode == (INODETYPE)inode)
|
||||||
|
+ if (tp6->inode == inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (tp6)
|
||||||
|
@@ -1226,7 +1230,7 @@ get_tcpudp6(p, pr, clr)
|
||||||
|
Pn, sizeof(struct tcp_udp6));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- tp6->inode = (INODETYPE)inode;
|
||||||
|
+ tp6->inode = inode;
|
||||||
|
tp6->faddr = faddr;
|
||||||
|
tp6->fport = (int)(fport & 0xffff);
|
||||||
|
tp6->laddr = laddr;
|
||||||
|
@@ -1254,7 +1258,7 @@ get_unix(p)
|
||||||
|
char buf[MAXPATHLEN], *ep, **fp, *path, *pcb;
|
||||||
|
int fl = 1;
|
||||||
|
int h, nf;
|
||||||
|
- unsigned long inode;
|
||||||
|
+ INODETYPE inode;
|
||||||
|
MALLOC_S len;
|
||||||
|
struct uxsin *np, *up;
|
||||||
|
FILE *us;
|
||||||
|
@@ -1319,11 +1323,11 @@ get_unix(p)
|
||||||
|
*/
|
||||||
|
ep = (char *)NULL;
|
||||||
|
if (!fp[6] || !*fp[6]
|
||||||
|
- || (inode = strtoul(fp[6], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
+ || (inode = strtoull(fp[6], &ep, 0)) == ULONG_MAX || !ep || *ep)
|
||||||
|
continue;
|
||||||
|
- h = INOHASH((INODETYPE)inode);
|
||||||
|
+ h = INOHASH(inode);
|
||||||
|
for (up = Uxsin[h]; up; up = up->next) {
|
||||||
|
- if ((INODETYPE)inode == up->inode)
|
||||||
|
+ if (inode == up->inode)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (up)
|
||||||
|
@@ -1362,7 +1366,7 @@ get_unix(p)
|
||||||
|
Pn, sizeof(struct uxsin));
|
||||||
|
Exit(1);
|
||||||
|
}
|
||||||
|
- up->inode = (INODETYPE)inode;
|
||||||
|
+ up->inode = inode;
|
||||||
|
up->pcb = pcb;
|
||||||
|
up->sb_def = 0;
|
||||||
|
if ((up->path = path) && (*path == '/')) {
|
||||||
|
@ -1,14 +0,0 @@
|
|||||||
diff -up lsof_4.78C-rh/dialects/linux/dproc.c.kzak lsof_4.78C-rh/dialects/linux/dproc.c
|
|
||||||
--- lsof_4.78C-rh/dialects/linux/dproc.c.kzak 2007-10-02 15:34:19.000000000 +0200
|
|
||||||
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-02 15:36:21.000000000 +0200
|
|
||||||
@@ -467,8 +467,8 @@ gather_proc_info()
|
|
||||||
if (getpidcon(pid, &Lp->cntx) == -1) {
|
|
||||||
Lp->cntx = (char *)NULL;
|
|
||||||
if (!Fwarn) {
|
|
||||||
- (void) snpf(nmabuf, sizeof(nmabuf),
|
|
||||||
- "(getpidcon: %s)\n", strerror(errno));
|
|
||||||
+ (void) snpf(nmabuf, sizeof(nmabuf), "(getpidcon: %s)",
|
|
||||||
+ strerror(errno));
|
|
||||||
if (!(Lp->cntx = strdup(nmabuf))) {
|
|
||||||
(void) fprintf(stderr,
|
|
||||||
"%s: no context error space: PID %ld",
|
|
113
lsof_4.78C-selinux.patch
Normal file
113
lsof_4.78C-selinux.patch
Normal file
@ -0,0 +1,113 @@
|
|||||||
|
diff -up lsof_4.78C-rh/proc.c.selinux lsof_4.78C-rh/proc.c
|
||||||
|
--- lsof_4.78C-rh/proc.c.selinux 2006-06-12 19:10:02.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/proc.c 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
@@ -968,7 +968,7 @@ print_proc()
|
||||||
|
#endif /* defined(HASZONES) */
|
||||||
|
|
||||||
|
#if defined(HASSELINUX)
|
||||||
|
- if (FieldSel[LSOF_FIX_CNTX].st && Fcntx && Lp->cntx)
|
||||||
|
+ if (FieldSel[LSOF_FIX_CNTX].st && Fcntx && Lp->cntx && CntxStatus)
|
||||||
|
(void) printf("%c%s%c", LSOF_FID_CNTX, Lp->cntx, Terminator);
|
||||||
|
#endif /* defined(HASSELINUX) */
|
||||||
|
|
||||||
|
diff -up lsof_4.78C-rh/store.c.selinux lsof_4.78C-rh/store.c
|
||||||
|
--- lsof_4.78C-rh/store.c.selinux 2006-06-12 19:10:03.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/store.c 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
@@ -70,7 +70,9 @@ lsof_rx_t *CmdRx = (lsof_rx_t *)NULL;
|
||||||
|
cntxlist_t *CntxArg = (cntxlist_t *)NULL;
|
||||||
|
/* security context arguments supplied with
|
||||||
|
* -Z */
|
||||||
|
-int CntxColW; /* security context column width */
|
||||||
|
+int CntxColW; /* security context column width */
|
||||||
|
+int CntxStatus = 0; /* security context status: 0 == disabled,
|
||||||
|
+ * 1 == enabled */
|
||||||
|
#endif /* defined(HASSELINUX) */
|
||||||
|
|
||||||
|
#if defined(HASDCACHE)
|
||||||
|
diff -up lsof_4.78C-rh/dialects/linux/dproc.c.selinux lsof_4.78C-rh/dialects/linux/dproc.c
|
||||||
|
--- lsof_4.78C-rh/dialects/linux/dproc.c.selinux 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/dialects/linux/dproc.c 2007-10-03 12:17:22.000000000 +0200
|
||||||
|
@@ -468,7 +468,7 @@ gather_proc_info()
|
||||||
|
Lp->cntx = (char *)NULL;
|
||||||
|
if (!Fwarn) {
|
||||||
|
(void) snpf(nmabuf, sizeof(nmabuf),
|
||||||
|
- "(getpidcon: %s)\n", strerror(errno));
|
||||||
|
+ "(getpidcon: %s)", strerror(errno));
|
||||||
|
if (!(Lp->cntx = strdup(nmabuf))) {
|
||||||
|
(void) fprintf(stderr,
|
||||||
|
"%s: no context error space: PID %ld",
|
||||||
|
diff -up lsof_4.78C-rh/usage.c.selinux lsof_4.78C-rh/usage.c
|
||||||
|
--- lsof_4.78C-rh/usage.c.selinux 2006-06-12 19:10:03.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/usage.c 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
@@ -787,7 +788,10 @@ usage(xv, fh, version)
|
||||||
|
continue;
|
||||||
|
#endif /* !defined(HASZONES) */
|
||||||
|
|
||||||
|
-#if !defined(HASSELINUX)
|
||||||
|
+#if defined(HASSELINUX)
|
||||||
|
+ if ((FieldSel[i].id == LSOF_FID_CNTX) && !CntxStatus)
|
||||||
|
+ continue;
|
||||||
|
+#else /* !defined(HASSELINUX) */
|
||||||
|
if (FieldSel[i].id == LSOF_FID_CNTX)
|
||||||
|
continue;
|
||||||
|
#endif /* !defined(HASSELINUX) */
|
||||||
|
diff -up lsof_4.78C-rh/main.c.selinux lsof_4.78C-rh/main.c
|
||||||
|
--- lsof_4.78C-rh/main.c.selinux 2006-06-12 19:10:02.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/main.c 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
@@ -84,14 +84,20 @@ main(argc, argv)
|
||||||
|
int version = 0;
|
||||||
|
int xover = 0;
|
||||||
|
|
||||||
|
-#if defined(HASSELINUX)
|
||||||
|
- cntxlist_t *cntxp;
|
||||||
|
-#endif /* defined(HASSELINUX) */
|
||||||
|
-
|
||||||
|
#if defined(HASZONES)
|
||||||
|
znhash_t *zp;
|
||||||
|
#endif /* defined(HASZONES) */
|
||||||
|
|
||||||
|
+#if defined(HASSELINUX)
|
||||||
|
+/*
|
||||||
|
+ * This stanza must be immediately before the "Save progam name." code, since
|
||||||
|
+ * it contains code itself.
|
||||||
|
+ */
|
||||||
|
+ cntxlist_t *cntxp;
|
||||||
|
+
|
||||||
|
+ CntxStatus = is_selinux_enabled() ? 1 : 0;
|
||||||
|
+#endif /* defined(HASSELINUX) */
|
||||||
|
+
|
||||||
|
/*
|
||||||
|
* Save program name.
|
||||||
|
*/
|
||||||
|
@@ -414,7 +420,10 @@ main(argc, argv)
|
||||||
|
continue;
|
||||||
|
#endif /* !defined(HASZONES) */
|
||||||
|
|
||||||
|
-#if !defined(HASSELINUX)
|
||||||
|
+#if defined(HASSELINUX)
|
||||||
|
+ if ((FieldSel[i].id == LSOF_FID_CNTX) && !CntxStatus)
|
||||||
|
+ continue;
|
||||||
|
+#else /* !defined(HASSELINUX) */
|
||||||
|
if (FieldSel[i].id == LSOF_FID_CNTX)
|
||||||
|
continue;
|
||||||
|
#endif /* !defined(HASSELINUX) */
|
||||||
|
@@ -822,7 +831,7 @@ main(argc, argv)
|
||||||
|
|
||||||
|
#if defined(HASSELINUX)
|
||||||
|
case 'Z':
|
||||||
|
- if (!is_selinux_enabled()) {
|
||||||
|
+ if (!CntxStatus) {
|
||||||
|
(void) fprintf(stderr, "%s: -Z limited to SELinux\n", Pn);
|
||||||
|
err = 1;
|
||||||
|
} else {
|
||||||
|
diff -up lsof_4.78C-rh/lsof.h.selinux lsof_4.78C-rh/lsof.h
|
||||||
|
--- lsof_4.78C-rh/lsof.h.selinux 2006-06-12 19:10:02.000000000 +0200
|
||||||
|
+++ lsof_4.78C-rh/lsof.h 2007-10-03 12:15:57.000000000 +0200
|
||||||
|
@@ -548,6 +548,7 @@ typedef struct cntxlist {
|
||||||
|
struct cntxlist *next; /* next zone hash entry */
|
||||||
|
} cntxlist_t;
|
||||||
|
extern cntxlist_t *CntxArg;
|
||||||
|
+extern int CntxStatus;
|
||||||
|
# endif /* defined(HASSELINUX) */
|
||||||
|
|
||||||
|
# if defined(HASDCACHE)
|
Loading…
Reference in New Issue
Block a user