Committer : entrope
CVSROOT : /cvsroot/undernet-ircu
Module : ircu2.10
Branch tags: u2_10_12_branch
Commit time: 2007-11-17 14:12:47 UTC
Modified files:
Tag: u2_10_12_branch
ircd/s_auth.c ChangeLog
Log message:
Handle iauth stderr EOF events like iauth stdout EOF events.
---------------------- diff included ----------------------
Index: ircu2.10/ChangeLog
diff -u ircu2.10/ChangeLog:1.710.2.213 ircu2.10/ChangeLog:1.710.2.214
--- ircu2.10/ChangeLog:1.710.2.213 Sat Nov 17 05:48:15 2007
+++ ircu2.10/ChangeLog Sat Nov 17 06:12:37 2007
@@ -1,3 +1,10 @@
+2007-11-17 Michael Poole <[EMAIL PROTECTED]>
+
+ * ircd/s_auth.c (iauth_disconnect): Avoid destroying invalid
+ sockets.
+ (iauth_stderr_callback): Disconnect iauth child if stderr has
+ EOF (in case stdin notification is delayed somehow).
+
2007-11-04 Michael Poole <[EMAIL PROTECTED]>
* ircd/umkpasswd.c (sum): Typecast buffer to avoid a warning about
Index: ircu2.10/ircd/s_auth.c
diff -u ircu2.10/ircd/s_auth.c:1.37.2.25 ircu2.10/ircd/s_auth.c:1.37.2.26
--- ircu2.10/ircd/s_auth.c:1.37.2.25 Wed Aug 8 20:46:20 2007
+++ ircu2.10/ircd/s_auth.c Sat Nov 17 06:12:36 2007
@@ -31,7 +31,7 @@
*/
/** @file
* @brief Implementation of DNS and ident lookups.
- * @version $Id: s_auth.c,v 1.37.2.25 2007/08/09 03:46:20 entrope Exp $
+ * @version $Id: s_auth.c,v 1.37.2.26 2007/11/17 14:12:36 entrope Exp $
*/
#include "config.h"
@@ -1325,18 +1325,22 @@
*/
static void iauth_disconnect(struct IAuth *iauth)
{
- if (!i_GetConnected(iauth))
+ if (iauth == NULL)
return;
/* Close main socket. */
- close(s_fd(i_socket(iauth)));
- socket_del(i_socket(iauth));
- s_fd(i_socket(iauth)) = -1;
+ if (s_fd(i_socket(iauth)) != -1) {
+ close(s_fd(i_socket(iauth)));
+ socket_del(i_socket(iauth));
+ s_fd(i_socket(iauth)) = -1;
+ }
/* Close error socket. */
- close(s_fd(i_stderr(iauth)));
- socket_del(i_stderr(iauth));
- s_fd(i_stderr(iauth)) = -1;
+ if (s_fd(i_stderr(iauth)) != -1) {
+ close(s_fd(i_stderr(iauth)));
+ socket_del(i_stderr(iauth));
+ s_fd(i_stderr(iauth)) = -1;
+ }
}
/** Close all %IAuth connections marked as closing. */
@@ -2172,14 +2176,17 @@
assert(0 != iauth);
switch (ev_type(ev)) {
+ case ET_DESTROY:
+ /* We do not restart iauth here: the stdout handler does that for us. */
+ break;
case ET_READ:
iauth_read_stderr(iauth);
break;
case ET_ERROR:
log_write(LS_IAUTH, L_ERROR, 0, "IAuth stderr error: %s",
strerror(ev_data(ev)));
- /* and fall through to the ET_EOF/ET_DESTROY case */
- case ET_DESTROY:
+ /* and fall through to the ET_EOF case */
case ET_EOF:
+ iauth_disconnect(iauth);
break;
default:
assert(0 && "Unrecognized event type");
----------------------- End of diff -----------------------
_______________________________________________
Patches mailing list
[email protected]
http://undernet.sbg.org/mailman/listinfo/patches