Fix more ident lookup bugs - #1406
Conversation
|
Maybe related/fixing #809? |
|
Please resolve conflicts, thanks |
done. ready for review again. |
caa6694 to
8a3879d
Compare
|
Overall very good change, but this does change the behavior of open_telnet_raw which previously had a select timeout of 1s which would detect ECONNREFUSED within that timeframe, now the timeout is 0 (return instantly) which never detects that and always returns a valid socket (unless it's localhost I guess). |
|
eggdrop did select() with a timeout of 1 sec, when it should be nonblocking. to have it fully nonblocking, the main loop select() would have to handle the econnrefused. to keep this PR small, this PR lowers the timeout to 0.5 sec, to mitigate long blocking but still detect econnrefused. |
Found by: michaelortmann
Patch by: michaelortmann
Fixes:
One-line summary:
Fix more ident lookup bugs
Additional description (if needed):
If a socket is set
O_NONBLOCKandconnect()returnsEINPROGRESS, it must be checked forECONNREFUSED.Here, this was done properly:
eggdrop/src/net.c
Lines 560 to 580 in 2a6a368
But here it was not and a write was committed:
eggdrop/src/dcc.c
Lines 1383 to 1404 in 2a6a368
Additionally
O_NONBLOCKis POSIX 2001 and old quirk code is removed, see: https://www.gaertner.de/~neitzel/susv3/basedefs/fcntl.h.htmlAdditionally also the proper code mentioned above had an issue, it did
select()with an timeout of 1 sec, when it should be nonblocking. to have it fully nonblocking, the main loopselect()would have to handle the econnrefused. to keep this PR small, this PR lowers the timeout to 0.5 sec, to mitigate long blocking but still detect econnrefused.Additionally there was a bug here:
eggdrop/src/dcc.c
Lines 1388 to 1403 in 2a6a368
Were this line
j = 0ever executed, the gates of tartaros would have opened fordcc[0].Test cases demonstrating functionality (if applicable):
Without this fix:
When telnetting to the bot and the user has no identd running, the bot would log like:
With this fix:
Test without identd:
Test wih identd:
Additionally i applied this patch to windrop and it also works under cygwin.