Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 370833
Collapse All | Expand All

(-)lsof_4.84_src.orig/Configure (+7 lines)
Lines 2740-2745 Link Here
2740
      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
2740
      LSOF_CFGF="$LSOF_CFGF -DHASIPv6"
2741
    fi	# }
2741
    fi	# }
2742
2742
2743
    # Test for rpc/rpc.h
2744
2745
    if ! test -r ${LSOF_INCLUDE}/rpc/rpc.h	# {
2746
    then
2747
      LSOF_CFGF="$LSOF_CFGF -DHASNOTRPC"
2748
    fi	# }
2749
2743
    # Test for SELinux support.
2750
    # Test for SELinux support.
2744
2751
2745
    LSOF_TMP1=0
2752
    LSOF_TMP1=0
(-)lsof_4.84_src.orig/dialects/linux/dlsof.h (+2 lines)
Lines 56-63 Link Here
56
#include <linux/tcp.h>
56
#include <linux/tcp.h>
57
# endif	/* defined(GLIBCV) || defined(__UCLIBC__) */
57
# endif	/* defined(GLIBCV) || defined(__UCLIBC__) */
58
58
59
# if	!defined(HASNOTRPC)
59
#include <rpc/rpc.h>
60
#include <rpc/rpc.h>
60
#include <rpc/pmap_prot.h>
61
#include <rpc/pmap_prot.h>
62
# endif	/* !defined(HASNOTRPC) */
61
 
63
 
62
#if	defined(HASSELINUX)
64
#if	defined(HASSELINUX)
63
#include <selinux/selinux.h>
65
#include <selinux/selinux.h>
(-)lsof_4.84_src.orig/lsof.h (+2 lines)
Lines 609-615 Link Here
609
extern int Foffset;
609
extern int Foffset;
610
extern int Fovhd;
610
extern int Fovhd;
611
extern int Fport;
611
extern int Fport;
612
#if	!defined(HASNOTRPC)
612
extern int FportMap;
613
extern int FportMap;
614
#endif	/* !defined(HASNOTRPC) */
613
extern int Fpgid;
615
extern int Fpgid;
614
extern int Fppid;
616
extern int Fppid;
615
extern int Fsize;
617
extern int Fsize;
(-)lsof_4.84_src.orig/main.c (-1 / +9 lines)
Lines 154-160 Link Here
154
 * Create option mask.
154
 * Create option mask.
155
 */
155
 */
156
	(void) snpf(options, sizeof(options),
156
	(void) snpf(options, sizeof(options),
157
	    "?a%sbc:D:d:%sf:F:g:hi:%s%slL:%sMnNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
157
	    "?a%sbc:D:d:%sf:F:g:hi:%s%slL:%s%snNo:Op:Pr:%ss:S:tT:u:UvVwx:%s%s%s",
158
158
159
#if	defined(HAS_AFS) && defined(HASAOPT)
159
#if	defined(HAS_AFS) && defined(HASAOPT)
160
	    "A:",
160
	    "A:",
Lines 186-191 Link Here
186
	    "",
186
	    "",
187
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
187
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
188
188
189
#if	!defined(HASNOTRPC)
190
	    "M",
191
#else	/* defined(HASNOTRPC) */
192
	    "",
193
#endif	/* defined(HASNOTRPC) */
194
189
#if	defined(HASPPID)
195
#if	defined(HASPPID)
190
	    "R",
196
	    "R",
191
#else	/* !defined(HASPPID) */
197
#else	/* !defined(HASPPID) */
Lines 643-651 Link Here
643
		break;
649
		break;
644
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
650
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
645
651
652
#if	!defined(HASNOTRPC)
646
	    case 'M':
653
	    case 'M':
647
		FportMap = (GOp == '+') ? 1 : 0;
654
		FportMap = (GOp == '+') ? 1 : 0;
648
		break;
655
		break;
656
#endif	/* !defined(HASNOTRPC) */
649
	    case 'n':
657
	    case 'n':
650
		Fhost = (GOp == '-') ? 0 : 1;
658
		Fhost = (GOp == '-') ? 0 : 1;
651
		break;
659
		break;
(-)lsof_4.84_src.orig/print.c (-5 / +28 lines)
Lines 67-74 Link Here
67
	struct porttab *next;
67
	struct porttab *next;
68
};
68
};
69
69
70
70
#if	defined(HASNOTRPC)
71
static struct porttab **Pth[2] = { NULL, NULL };
72
#else	/* !defined(HASNOTRPC) */
71
static struct porttab **Pth[4] = { NULL, NULL, NULL, NULL };
73
static struct porttab **Pth[4] = { NULL, NULL, NULL, NULL };
74
#endif	/* !defined(HASNOTRPC) */
72
						/* port hash buckets:
75
						/* port hash buckets:
73
						 * Pth[0] for TCP service names
76
						 * Pth[0] for TCP service names
74
						 * Pth[1] for UDP service names
77
						 * Pth[1] for UDP service names
Lines 78-89 Link Here
78
#define HASHPORT(p)	(((((int)(p)) * 31415) >> 3) & (PORTHASHBUCKETS - 1))
81
#define HASHPORT(p)	(((((int)(p)) * 31415) >> 3) & (PORTHASHBUCKETS - 1))
79
82
80
83
84
#if	!defined(HASNOTRPC)
81
_PROTOTYPE(static void fill_portmap,(void));
85
_PROTOTYPE(static void fill_portmap,(void));
86
_PROTOTYPE(static void update_portmap,(struct porttab *pt, char *pn));
87
#endif	/* !defined(HASNOTRPC) */
82
_PROTOTYPE(static void fill_porttab,(void));
88
_PROTOTYPE(static void fill_porttab,(void));
83
_PROTOTYPE(static char *lkup_port,(int p, int pr, int src));
89
_PROTOTYPE(static char *lkup_port,(int p, int pr, int src));
84
_PROTOTYPE(static char *lkup_svcnam,(int h, int p, int pr, int ss));
90
_PROTOTYPE(static char *lkup_svcnam,(int h, int p, int pr, int ss));
85
_PROTOTYPE(static int printinaddr,(void));
91
_PROTOTYPE(static int printinaddr,(void));
86
_PROTOTYPE(static void update_portmap,(struct porttab *pt, char *pn));
87
92
88
93
89
/*
94
/*
Lines 104-109 Link Here
104
}
109
}
105
110
106
111
112
#if	!defined(HASNOTRPC)
107
/*
113
/*
108
 * fill_portmap() -- fill the RPC portmap program name table via a conversation
114
 * fill_portmap() -- fill the RPC portmap program name table via a conversation
109
 *		     with the portmapper
115
 *		     with the portmapper
Lines 267-272 Link Here
267
	}
273
	}
268
	clnt_destroy(c);
274
	clnt_destroy(c);
269
}
275
}
276
#endif	/* !defined(HASNOTRPC) */
270
277
271
278
272
/*
279
/*
Lines 468-475 Link Here
468
 * If the hash buckets haven't been allocated, do so.
475
 * If the hash buckets haven't been allocated, do so.
469
 */
476
 */
470
	if (!Pth[0]) {
477
	if (!Pth[0]) {
478
#if	defined(HASNOTRPC)
479
	    for (h = 0; h < 2; h++) {
480
#else	/* !defined(HASNOTRPC) */
471
	    nh = FportMap ? 4 : 2;
481
	    nh = FportMap ? 4 : 2;
472
	    for (h = 0; h < nh; h++) {
482
	    for (h = 0; h < nh; h++) {
483
#endif	/* !defined(HASNOTRPC) */
473
		if (!(Pth[h] = (struct porttab **)calloc(PORTHASHBUCKETS,
484
		if (!(Pth[h] = (struct porttab **)calloc(PORTHASHBUCKETS,
474
				sizeof(struct porttab *))))
485
				sizeof(struct porttab *))))
475
		{
486
		{
Lines 483-488 Link Here
483
		}
494
		}
484
	    }
495
	    }
485
	}
496
	}
497
#if	!defined(HASNOTRPC)
486
/*
498
/*
487
 * If we're looking up program names for portmapped ports, make sure the
499
 * If we're looking up program names for portmapped ports, make sure the
488
 * portmap table has been loaded.
500
 * portmap table has been loaded.
Lines 491-501 Link Here
491
	    (void) fill_portmap();
503
	    (void) fill_portmap();
492
	    pm++;
504
	    pm++;
493
	}
505
	}
506
#endif	/* !defined(HASNOTRPC) */
494
/*
507
/*
495
 * Hash the port and see if its name has been cached.  Look for a local
508
 * Hash the port and see if its name has been cached.  Look for a local
496
 * port first in the portmap, if portmap searching is enabled.
509
 * port first in the portmap, if portmap searching is enabled.
497
 */
510
 */
498
	h = HASHPORT(p);
511
	h = HASHPORT(p);
512
#if	!defined(HASNOTRPC)
499
	if (!src && FportMap) {
513
	if (!src && FportMap) {
500
	    for (pt = Pth[pr+2][h]; pt; pt = pt->next) {
514
	    for (pt = Pth[pr+2][h]; pt; pt = pt->next) {
501
		if (pt->port != p)
515
		if (pt->port != p)
Lines 511-516 Link Here
511
		return(pt->name);
525
		return(pt->name);
512
	    }
526
	    }
513
	}
527
	}
528
#endif	/* !defined(HASNOTRPC) */
514
	for (pt = Pth[pr][h]; pt; pt = pt->next) {
529
	for (pt = Pth[pr][h]; pt; pt = pt->next) {
515
	    if (pt->port == p)
530
	    if (pt->port == p)
516
		return(pt->name);
531
		return(pt->name);
Lines 1154-1160 Link Here
1154
	 * Process the port number.
1169
	 * Process the port number.
1155
	 */
1170
	 */
1156
	    if (Lf->li[i].p > 0) {
1171
	    if (Lf->li[i].p > 0) {
1157
		if (Fport || FportMap) {
1172
		if (Fport
1173
#if	!defined(HASNOTRPC)
1174
		||  FportMap
1175
#endif	/* !defined(HASNOTRPC) */
1176
		) {
1158
1177
1159
		/*
1178
		/*
1160
		 * If converting port numbers to service names, or looking
1179
		 * If converting port numbers to service names, or looking
Lines 1167-1175 Link Here
1167
		 * loopback address 127.0.0.1.  (Test 2 may not always work
1186
		 * loopback address 127.0.0.1.  (Test 2 may not always work
1168
		 * -- e.g., on hosts with multiple interfaces.)
1187
		 * -- e.g., on hosts with multiple interfaces.)
1169
		 */
1188
		 */
1189
#if	!defined(HASNOTRPC)
1170
		    if ((src = i) && FportMap) {
1190
		    if ((src = i) && FportMap) {
1171
1191
1172
#if	defined(HASIPv6)
1192
# if	defined(HASIPv6)
1173
			if (Lf->li[0].af == AF_INET6) {
1193
			if (Lf->li[0].af == AF_INET6) {
1174
			    if (IN6_IS_ADDR_LOOPBACK(&Lf->li[i].ia.a6)
1194
			    if (IN6_IS_ADDR_LOOPBACK(&Lf->li[i].ia.a6)
1175
			    ||  IN6_ARE_ADDR_EQUAL(&Lf->li[0].ia.a6,
1195
			    ||  IN6_ARE_ADDR_EQUAL(&Lf->li[0].ia.a6,
Lines 1177-1183 Link Here
1177
			    )
1197
			    )
1178
				src = 0;
1198
				src = 0;
1179
			} else
1199
			} else
1180
#endif	/* defined(HASIPv6) */
1200
# endif	/* defined(HASIPv6) */
1181
1201
1182
			if (Lf->li[0].af == AF_INET) {
1202
			if (Lf->li[0].af == AF_INET) {
1183
			    if (Lf->li[i].ia.a4.s_addr == htonl(INADDR_LOOPBACK)
1203
			    if (Lf->li[i].ia.a4.s_addr == htonl(INADDR_LOOPBACK)
Lines 1186-1191 Link Here
1186
				src = 0;
1206
				src = 0;
1187
			}
1207
			}
1188
		    }
1208
		    }
1209
#endif	/* !defined(HASNOTRPC) */
1189
		    if (strcasecmp(Lf->iproto, "TCP") == 0)
1210
		    if (strcasecmp(Lf->iproto, "TCP") == 0)
1190
			port = lkup_port(Lf->li[i].p, 0, src);
1211
			port = lkup_port(Lf->li[i].p, 0, src);
1191
		    else if (strcasecmp(Lf->iproto, "UDP") == 0)
1212
		    else if (strcasecmp(Lf->iproto, "UDP") == 0)
Lines 2748-2753 Link Here
2748
}
2769
}
2749
2770
2750
2771
2772
#if !defined(HASNOTRPC)
2751
/*
2773
/*
2752
 * update_portmap() - update a portmap entry with its port number or service
2774
 * update_portmap() - update a portmap entry with its port number or service
2753
 *		      name
2775
 *		      name
Lines 2780-2782 Link Here
2780
	pt->nl = nl;
2802
	pt->nl = nl;
2781
	pt->ss = 1;
2803
	pt->ss = 1;
2782
}
2804
}
2805
#endif /* !defined(HASNOTRPC) */
(-)lsof_4.84_src.orig/store.c (-3 / +5 lines)
Lines 156-166 Link Here
156
int Fovhd = 0;			/* -O option status */
156
int Fovhd = 0;			/* -O option status */
157
int Fport = 1;			/* -P option status */
157
int Fport = 1;			/* -P option status */
158
158
159
#if	defined(HASPMAPENABLED)
159
#if	!defined(HASNOTRPC)
160
# if	defined(HASPMAPENABLED)
160
int FportMap = 1;		/* +|-M option status */
161
int FportMap = 1;		/* +|-M option status */
161
#else	/* !defined(HASPMAPENABLED) */
162
# else	/* !defined(HASPMAPENABLED) */
162
int FportMap = 0;		/* +|-M option status */
163
int FportMap = 0;		/* +|-M option status */
163
#endif	/* defined(HASPMAPENABLED) */
164
# endif	/* defined(HASPMAPENABLED) */
165
#endif	/* !defined(HASNOTRPC) */
164
166
165
int Fpgid = 0;			/* -g option status */
167
int Fpgid = 0;			/* -g option status */
166
int Fppid = 0;			/* -R option status */
168
int Fppid = 0;			/* -R option status */
(-)lsof_4.84_src.orig/usage.c (-6 / +13 lines)
Lines 453-460 Link Here
453
		);
453
		);
454
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
454
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
455
455
456
#if	!defined(HASNOTRPC)
457
	    (void) fprintf(stderr, " [+|-M]");
458
#endif	/* !defined(HASNOTRPC) */
459
456
	    (void) fprintf(stderr,
460
	    (void) fprintf(stderr,
457
		" [+|-M] [-o [o]] [-p s]\n[+|-r [t]]%s [-S [t]] [-T [t]]",
461
		" [-o [o]] [-p s]\n[+|-r [t]]%s [-S [t]] [-T [t]]",
458
462
459
#if	defined(HASTCPUDPSTATE)
463
#if	defined(HASTCPUDPSTATE)
460
		" [-s [p:s]]"
464
		" [-s [p:s]]"
Lines 690-705 Link Here
690
# endif	/* defined(HASMNTSUP) */
694
# endif	/* defined(HASMNTSUP) */
691
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
695
#endif	/* defined(HASMOPT) || defined(HASMNTSUP) */
692
696
697
#if	!defined(HASNOTRPC)
693
	    (void) snpf(buf, sizeof(buf), "+|-M   portMap registration (%s)",
698
	    (void) snpf(buf, sizeof(buf), "+|-M   portMap registration (%s)",
694
699
# if	defined(HASPMAPENABLED)
695
#if	defined(HASPMAPENABLED)
696
		"+"
700
		"+"
697
#else	/* !defined(HASPMAPENABLED) */
701
# else	/* !defined(HASPMAPENABLED) */
698
		"-"
702
		"-"
699
#endif	/* defined(HASPMAPENABLED) */
703
# endif	/* defined(HASPMAPENABLED) */
700
701
	    );
704
	    );
705
#else	/* defined(HASNOTRPC) */
706
	    buf[0] = '\0';
707
#endif	/* defined(HASNOTRPC) */
702
	    (void) fprintf(stderr, "  %-36.36s", buf);
708
	    (void) fprintf(stderr, "  %-36.36s", buf);
709
703
	    (void) snpf(buf, sizeof(buf), "-o o   o 0t offset digits (%d)",
710
	    (void) snpf(buf, sizeof(buf), "-o o   o 0t offset digits (%d)",
704
		OFFDECDIG);
711
		OFFDECDIG);
705
	    (void) fprintf(stderr, "  %s\n", buf);
712
	    (void) fprintf(stderr, "  %s\n", buf);

Return to bug 370833