View | Details | Raw Unified | Return to bug 274331 | Differences between
and this patch

Collapse All | Expand All

(-)b/net/rinetd/Makefile (-11 / +14 lines)
Lines 1-9 Link Here
1
PORTNAME=	rinetd
1
PORTNAME=	rinetd
2
PORTVERSION=	0.62
2
PORTVERSION=	0.73
3
PORTREVISION=	4
3
DISTVERSIONPREFIX=  v
4
PORTREVISION=	0
4
CATEGORIES=	net
5
CATEGORIES=	net
5
MASTER_SITES=	http://www.boutell.com/rinetd/http/ \
6
6
		GENTOO
7
USE_GITHUB=     yes
8
GH_ACCOUNT=     samhocevar
9
GH_TAGNAME=     d4e0a60
10
7
DISTNAME=	rinetd
11
DISTNAME=	rinetd
8
12
9
MAINTAINER=	garga@FreeBSD.org
13
MAINTAINER=	garga@FreeBSD.org
Lines 13-21 LICENSE= GPLv2 Link Here
13
17
14
OPTIONS_DEFINE=	DOCS
18
OPTIONS_DEFINE=	DOCS
15
19
16
WRKSRC=		${WRKDIR}/rinetd-${PORTVERSION}
20
WRKSRC=		${WRKDIR}/rinetd-${GH_TAGNAME}
17
21
18
USES=		cpe dos2unix
22
USES=		cpe dos2unix autoreconf
23
GNU_CONFIGURE=  yes
19
24
20
PORTDOCS=	index.html
25
PORTDOCS=	index.html
21
PLIST_FILES=	sbin/rinetd \
26
PLIST_FILES=	sbin/rinetd \
Lines 23-37 PLIST_FILES= sbin/rinetd \ Link Here
23
28
24
USE_RC_SUBR=	rinetd
29
USE_RC_SUBR=	rinetd
25
30
26
post-extract:
27
	@${MV} ${WRKDIR}/rinetd ${WRKSRC}
28
29
post-patch:
31
post-patch:
30
	@${REINPLACE_CMD} -E "s,(/etc/rinetd.conf),${PREFIX}\1," \
32
	@${REINPLACE_CMD} -E "s,(/etc/rinetd.conf),${PREFIX}\1," \
31
		${WRKSRC}/rinetd.[8c]
33
		${WRKSRC}/rinetd.8
34
	@${REINPLACE_CMD} -E "s,(/etc/rinetd.conf),${PREFIX}\1," \
35
		${WRKSRC}/src/rinetd.h
32
	@${REINPLACE_CMD} -E "s,/usr(/sbin/rinetd),${PREFIX}\1," \
36
	@${REINPLACE_CMD} -E "s,/usr(/sbin/rinetd),${PREFIX}\1," \
33
		${WRKSRC}/rinetd.8
37
		${WRKSRC}/rinetd.8
34
	@${REINPLACE_CMD} -e "s,cc ,${CC} ,g" ${WRKSRC}/Makefile
35
38
36
post-install:
39
post-install:
37
	${MKDIR} ${STAGEDIR}${DOCSDIR}
40
	${MKDIR} ${STAGEDIR}${DOCSDIR}
(-)b/net/rinetd/distinfo (-2 / +3 lines)
Lines 1-2 Link Here
1
SHA256 (rinetd.tar.gz) = 0c68d27c5bd4b16ce4f58a6db514dd6ff37b2604a88b02c1dfcdc00fc1059898
1
TIMESTAMP = 1696686326
2
SIZE (rinetd.tar.gz) = 115541
2
SHA256 (samhocevar-rinetd-v0.73-d4e0a60_GH0.tar.gz) = 76eef19e0af8459c9434ac8ac0b58edac1bba353f5aaceb1d5f971fb3f6a3016
3
SIZE (samhocevar-rinetd-v0.73-d4e0a60_GH0.tar.gz) = 45544
(-)a/net/rinetd/files/patch-Makefile (-22 lines)
Removed Link Here
1
--- ../rinetd.orig/Makefile	Mon Mar  1 13:41:50 1999
2
+++ Makefile	Sat Jun 12 12:54:48 1999
3
@@ -1,9 +1,14 @@
4
-CFLAGS=-DLINUX -g
5
+CFLAGS+=-I. -DLINUX
6
 
7
-rinetd: rinetd.o match.o
8
-	gcc rinetd.o match.o -o rinetd
9
+all: rinetd
10
+
11
+rinetd: rinetd.o match.o getopt.o
12
+	${CC} ${CFLAGS} rinetd.o match.o getopt.o -o rinetd
13
+
14
+getopt.o:
15
+	${CC} ${CFLAGS} -c getopt.c
16
 
17
 install: rinetd
18
-	install -m 700 rinetd /usr/sbin
19
-	install -m 644 rinetd.8 /usr/man/man8
20
+	install -s -m 755 rinetd ${DESTDIR}${PREFIX}/sbin
21
+	install -m 644 rinetd.8 ${DESTDIR}${PREFIX}/man/man8
22
 
(-)b/net/rinetd/files/patch-Makefile.am (+11 lines)
Added Link Here
1
--- src/Makefile.am.orig
2
+++ src/Makefile.am
3
@@ -18,7 +18,7 @@ parse.c: parse.peg
4
 # _DARWIN_C_SOURCE is for NI_MAXHOST on OS X
5
 # _XOPEN_SOURCE is for struct sigaction
6
 # _GNU_SOURCE is for h_errno and gethostbyname-related macros
7
-___rinetd_CFLAGS = -std=c99 -D_POSIX_C_SOURCE=200809L \
8
+___rinetd_CFLAGS = -std=c99 \
9
                    -D_XOPEN_SOURCE -D_GNU_SOURCE -D_DARWIN_C_SOURCE \
10
                    -Wall -Wextra -Wwrite-strings 
11
                    
(-)b/net/rinetd/files/patch-rinetd.c (-18 / +11 lines)
Lines 1-18 Link Here
1
--- rinetd.c.orig	Thu Jul 19 22:19:59 2001
1
--- src/rinetd.c.orig	2023-10-07 18:11:38.637201000 +0200
2
+++ rinetd.c	Thu Jul 19 22:20:26 2001
2
+++ src/rinetd.c	2023-10-07 18:13:00.831009000 +0200
3
@@ -243,6 +243,7 @@
3
@@ -927,7 +927,7 @@
4
 			signal(SIGHUP, hup);
4
 
5
 #endif /* WIN32 */
5
 void registerPID(char const *pid_file_name)
6
 			signal(SIGTERM, term);
6
 {
7
+			setsid();
7
-#if defined(__linux__)
8
 			initArrays();
8
+#if defined(__linux__) || defined(__FreeBSD__)
9
 			readConfiguration();
9
 	FILE *pid_file = fopen(pid_file_name, "w");
10
 			RegisterPID();
10
 	if (pid_file == NULL) {
11
@@ -646,6 +646,7 @@
11
 		/* non-fatal, non-Linux may lack /var/run... */
12
 			}
13
 		}
14
 	}
15
+	fclose(in);
16
 	/* Open the log file */
17
 	if (logFile) {
18
 		fclose(logFile);
(-)a/net/rinetd/files/patch-select2poll (-194 lines)
Removed Link Here
1
--- rinetd.c.orig	Mon Apr 14 22:19:23 2003
2
+++ rinetd.c	Tue Oct  4 07:25:42 2005
3
@@ -12,6 +12,7 @@
4
 #include <netinet/in.h>
5
 #include <getopt.h>
6
 #include <errno.h>
7
+#include <poll.h>
8
 #define INVALID_SOCKET (-1)
9
 #include <sys/time.h>
10
 #endif /* WIN32 */
11
@@ -94,6 +95,7 @@
12
 #include "match.h"
13
 
14
 SOCKET *seFds = 0;
15
+static int first_set = 0;
16
 /* In network order, for network purposes */
17
 struct in_addr *seLocalAddrs = 0;
18
 unsigned short *seLocalPorts = 0;
19
@@ -750,15 +752,82 @@
20
 void openLocalFd(int se, int i);
21
 int getAddress(char *host, struct in_addr *iaddr);
22
 
23
+inline void poll_init_fds(struct pollfd *pfds, int size) {
24
+	int i;
25
+
26
+	memset(pfds, 0, sizeof(struct pollfd) * size);
27
+	first_set = 1;
28
+	for(i = 0; i < size; i++) 
29
+		pfds[i].fd = -1;
30
+}
31
+
32
+inline int poll_set_fd(struct pollfd *pfds, int size, int count, 
33
+		 int fd, short int ev) {
34
+#ifdef _NEW_POLL_SET_FD
35
+	if(first_set) {
36
+		pfds[count].fd = fd;
37
+		pfds[count].events |= ev;
38
+		first_set = 0;
39
+		return 0;
40
+	}
41
+	if(pfds[count].fd != fd && !first_set) {
42
+		count++;
43
+	}
44
+
45
+	pfds[count].fd = fd;
46
+	pfds[count].events |= ev;
47
+	
48
+	return count;
49
+#else
50
+	int i;
51
+	
52
+	for(i = 0; i < size; i++) {
53
+		if(pfds[i].fd == -1) {
54
+			pfds[i].fd = fd;
55
+			pfds[i].events |= ev;
56
+			count++;
57
+			break;
58
+		}
59
+		if(pfds[i].fd == fd) {
60
+			pfds[i].events |= ev;
61
+			break;
62
+		}
63
+	}
64
+
65
+	return count;
66
+#endif
67
+}
68
+
69
+int poll_fd_isset(struct pollfd *pfds, int nfds, int fd, short event) {
70
+	int i;
71
+
72
+	for(i = 0; i < nfds; i++) {
73
+		if(pfds[i].fd == fd)
74
+			return pfds[i].revents & event;
75
+	}
76
+
77
+	return 0;
78
+}
79
+
80
 void selectPass(void) {
81
 	int i;
82
-	fd_set readfds, writefds;
83
-	FD_ZERO(&readfds);
84
-	FD_ZERO(&writefds);
85
+	int nfds = 0;
86
+	int total = 0;
87
+	static struct pollfd *pfds = NULL;
88
+	
89
 	/* Server sockets */
90
+	total = seTotal + (coTotal * 2);
91
+	
92
+	if(!pfds) {
93
+		pfds = malloc(sizeof(struct pollfd) * total);
94
+	}
95
+	
96
+	poll_init_fds(pfds, total);
97
+	
98
 	for (i = 0; (i < seTotal); i++) {
99
 		if (seFds[i] != INVALID_SOCKET) {
100
-			FD_SET(seFds[i], &readfds);
101
+			//FD_SET(seFds[i], &readfds)
102
+			nfds = poll_set_fd(pfds, total, nfds, seFds[i], POLLIN);
103
 		}
104
 	}
105
 	/* Connection sockets */
106
@@ -768,35 +837,47 @@
107
 		}
108
 		if (coClosing[i]) {
109
 			if (!reClosed[i]) {
110
-				FD_SET(reFds[i], &writefds);
111
-			}	
112
-			if (!loClosed[i]) {
113
-				FD_SET(loFds[i], &writefds);
114
+				//FD_SET(reFds[i], &writefds);
115
+				nfds = poll_set_fd(pfds, total, nfds, 
116
+					    reFds[i], POLLOUT);
117
 			}	
118
 		}
119
 		/* Get more input if we have room for it */
120
 		if ((!reClosed[i]) && (coInputRPos[i] < bufferSpace)) {
121
-			FD_SET(reFds[i], &readfds);
122
+			//FD_SET(reFds[i], &readfds);
123
+			nfds = poll_set_fd(pfds, total, nfds, reFds[i], POLLIN);
124
 		}
125
 		/* Send more output if we have any */	
126
 		if ((!reClosed[i]) && (coOutputWPos[i] < coOutputRPos[i])) {
127
-			FD_SET(reFds[i], &writefds);
128
+			//FD_SET(reFds[i], &writefds);
129
+			nfds = poll_set_fd(pfds, total, nfds, reFds[i], POLLOUT);
130
 		}	
131
+		if (coClosing[i]) {
132
+			if (!loClosed[i]) {
133
+				//FD_SET(loFds[i], &writefds);
134
+				nfds = poll_set_fd(pfds, total, nfds,
135
+					    loFds[i], POLLOUT);
136
+			}
137
+		}
138
 		/* Accept more output from the local 
139
 			server if there's room */
140
 		if ((!loClosed[i]) && (coOutputRPos[i] < bufferSpace)) {
141
-			FD_SET(loFds[i], &readfds);
142
+			//FD_SET(loFds[i], &readfds);
143
+			 nfds = poll_set_fd(pfds, total, nfds, loFds[i], POLLIN);
144
 		}
145
 		/* Send more input to the local server 
146
 			if we have any */
147
 		if ((!loClosed[i]) && (coInputWPos[i] < coInputRPos[i])) {
148
-			FD_SET(loFds[i], &writefds);
149
+			//FD_SET(loFds[i], &writefds);
150
+			nfds = poll_set_fd(pfds, total, nfds, loFds[i], POLLOUT);
151
 		}	
152
 	}
153
-	select(maxfd + 1, &readfds, &writefds, 0, 0);
154
+	//select(maxfd + 1, &readfds, &writefds, 0, 0);
155
+	poll(pfds, nfds + 1, -1);
156
 	for (i = 0; (i < seTotal); i++) {
157
 		if (seFds[i] != -1) {
158
-			if (FD_ISSET(seFds[i], &readfds)) {
159
+			//if (FD_ISSET(seFds[i], &readfds)) {
160
+			if (poll_fd_isset(pfds, nfds, seFds[i], POLLIN)) {
161
 				handleAccept(i);
162
 			}
163
 		}
164
@@ -806,22 +887,26 @@
165
 			continue;
166
 		}
167
 		if (!reClosed[i]) {
168
-			if (FD_ISSET(reFds[i], &readfds)) {
169
+			//if (FD_ISSET(reFds[i], &readfds)) {
170
+			if (poll_fd_isset(pfds, nfds, reFds[i], POLLIN)) {
171
 				handleRemoteRead(i);
172
 			}
173
 		}
174
 		if (!reClosed[i]) {
175
-			if (FD_ISSET(reFds[i], &writefds)) {
176
+			//if (FD_ISSET(reFds[i], &writefds)) {
177
+			if (poll_fd_isset(pfds, nfds, reFds[i], POLLOUT)) {
178
 				handleRemoteWrite(i);
179
 			}
180
 		}
181
 		if (!loClosed[i]) {
182
-			if (FD_ISSET(loFds[i], &readfds)) {
183
+			//if (FD_ISSET(loFds[i], &readfds)) {
184
+			if (poll_fd_isset(pfds, nfds, loFds[i], POLLIN)) {
185
 				handleLocalRead(i);
186
 			}
187
 		}
188
 		if (!loClosed[i]) {
189
-			if (FD_ISSET(loFds[i], &writefds)) {
190
+			//if (FD_ISSET(loFds[i], &writefds)) {
191
+			if (poll_fd_isset(pfds, nfds, loFds[i], POLLOUT)) {
192
 				handleLocalWrite(i);
193
 			}
194
 		}

Return to bug 274331