]>
Commit | Line | Data |
---|---|---|
3bd189cb JR |
1 | From: avalon@coombs.anu.edu.au (Darren Reed) |
2 | Subject: IDENT patch for 2.7.2g | |
3 | To: operlist@eff.org (Operator Mailing List) | |
4 | Date: Fri, 19 Feb 93 15:06:31 EST | |
5 | ||
6 | There have been numerous people having problems with server's hanging due | |
7 | to problems with the ident operations. To fix the problem of the server | |
8 | hanging unexpectadly, apply the following bug. | |
9 | ||
10 | All servers which compile with #define IDENT should apply the patch | |
11 | below to ircd/authuser.c. | |
12 | ||
13 | avalon | |
14 | ||
15 | ||
16 | *** authuser.c.orig Tue Dec 8 13:07:05 1992 | |
17 | --- authuser.c Tue Dec 8 13:13:55 1992 | |
18 | *************** | |
19 | *** 203,209 | |
20 | FD_SET(s,&wfds); | |
21 | r = select(s + 1,(fd_set *) 0,&wfds,(fd_set *) 0,&tv); | |
22 | /* XXX: how to handle EINTR? */ | |
23 | ! if (r == -1) | |
24 | CLORETS(0) | |
25 | if (!FD_ISSET(s,&wfds)) | |
26 | { | |
27 | ||
28 | --- 203,209 ----- | |
29 | FD_SET(s,&wfds); | |
30 | r = select(s + 1,(fd_set *) 0,&wfds,(fd_set *) 0,&tv); | |
31 | /* XXX: how to handle EINTR? */ | |
32 | ! if (r <= 0) | |
33 | CLORETS(0) | |
34 | if (!FD_ISSET(s,&wfds)) | |
35 | { | |
36 | *************** | |
37 | *** 211,217 | |
38 | errno = ETIMEDOUT; | |
39 | return 0; | |
40 | } | |
41 | ! return auth_sockuser(s,local,remote); | |
42 | } | |
43 | ||
44 | char *auth_sockuser(s,local,remote) | |
45 | ||
46 | --- 211,217 ----- | |
47 | errno = ETIMEDOUT; | |
48 | return 0; | |
49 | } | |
50 | ! return auth_sockuser(s,local,remote,timeout); | |
51 | } | |
52 | ||
53 | char *auth_sockuser(s,local,remote,timeout) | |
54 | *************** | |
55 | *** 214,220 | |
56 | return auth_sockuser(s,local,remote); | |
57 | } | |
58 | ||
59 | ! char *auth_sockuser(s,local,remote) | |
60 | register int s; | |
61 | register unsigned short local; | |
62 | register unsigned short remote; | |
63 | ||
64 | --- 214,220 ----- | |
65 | return auth_sockuser(s,local,remote,timeout); | |
66 | } | |
67 | ||
68 | ! char *auth_sockuser(s,local,remote,timeout) | |
69 | register int s; | |
70 | register unsigned short local; | |
71 | register unsigned short remote,timeout; | |
72 | *************** | |
73 | *** 217,223 | |
74 | char *auth_sockuser(s,local,remote) | |
75 | register int s; | |
76 | register unsigned short local; | |
77 | ! register unsigned short remote; | |
78 | { | |
79 | register int buflen; | |
80 | register int w; | |
81 | ||
82 | --- 217,223 ----- | |
83 | char *auth_sockuser(s,local,remote,timeout) | |
84 | register int s; | |
85 | register unsigned short local; | |
86 | ! register unsigned short remote,timeout; | |
87 | { | |
88 | register int buflen; | |
89 | register int w; | |
90 | *************** | |
91 | *** 226,232 | |
92 | unsigned short rlocal; | |
93 | unsigned short rremote; | |
94 | register int fl; | |
95 | ! fd_set wfds; | |
96 | void *old_sig; | |
97 | ||
98 | old_sig = signal(SIGPIPE, SIG_IGN); | |
99 | ||
100 | --- 226,233 ----- | |
101 | unsigned short rlocal; | |
102 | unsigned short rremote; | |
103 | register int fl; | |
104 | ! struct timeval tv; | |
105 | ! fd_set wfds,rfds; | |
106 | void *old_sig; | |
107 | ||
108 | old_sig = signal(SIGPIPE, SIG_IGN); | |
109 | *************** | |
110 | *** 261,266 | |
111 | buflen -= w; | |
112 | } | |
113 | buf = realbuf; | |
114 | while ((w = read(s,&ch,1)) == 1) | |
115 | { | |
116 | *buf = ch; | |
117 | ||
118 | --- 262,274 ----- | |
119 | buflen -= w; | |
120 | } | |
121 | buf = realbuf; | |
122 | + FD_ZERO(&rfds); | |
123 | + FD_SET(s,&rfds); | |
124 | + tv.tv_sec = timeout; | |
125 | + tv.tv_usec = 0; | |
126 | + w = select(s + 1,&rfds,(fd_set *) 0,(fd_set *) 0,&tv); | |
127 | + if (w <= 0 || !FD_ISSET(s,&wfds)) | |
128 | + CLORETS(0) | |
129 | while ((w = read(s,&ch,1)) == 1) | |
130 | { | |
131 | *buf = ch; | |
132 |