/* sendto_ircd() functions */ void vsendto_ircd(char *pattern, va_list va) { char ibuf[4096]; vsprintf(ibuf, pattern, va); DebugLog((ALOG_DSPY, 0, "To ircd: [%s]", ibuf)); strcat(ibuf, "\n"); if (write(0, ibuf, strlen(ibuf)) != (int)strlen(ibuf)) { sendto_log(ALOG_DMISC, LOG_NOTICE, "Daemon exiting. [w %s]", strerror(errno)); exit(0); } }
/* * pipe_work * * This procedure is called whenever there's new data in the buffer. * Returns 0 if everything went fine, and there is more work to be done, * Returns -1 if the module has finished its work (and cleaned up). * * It is responsible for sending error messages where appropriate. */ static int pipe_work(u_int cl) { DebugLog((ALOG_DPIPE, 0, "pipe_work(%d): %d %d buflen=%d %c", cl, cldata[cl].rfd, cldata[cl].wfd, cldata[cl].buflen, cldata[cl].inbuffer[0])); switch (cldata[cl].inbuffer[0]) { case 'Y': break; case 'N': cldata[cl].state |= A_DENY; sendto_ircd("K %d %s %u ", cl, cldata[cl].itsip, cldata[cl].itsport); break; #if 0 /* hm.. need deeper mods to ircd */ case 'y': /* restricted connection only */ cldata[cl].state |= A_RESTRICT; sendto_ircd("k %d %s %u ", cl, cldata[cl].itsip, cldata[cl].itsport); break; #endif default : /* error */ sendto_log(ALOG_FLOG|ALOG_IRCD, LOG_WARNING, "pipe: unexpected %c for %s[%s]", cldata[cl].inbuffer[0], cldata[cl].host, cldata[cl].itsip); break; } /* We're done */ close(cldata[cl].rfd); cldata[cl].rfd = 0; return -1; }