Sorry the patch in my last message was reverse, here is the good one.
--- qmail-1.03.orig/auth_mod.c 2005-12-27 13:22:16.000000000 +0100
+++ qmail-1.03/auth_mod.c 2006-01-17 16:22:21.000000000 +0100
@@ -219,7 +219,7 @@
#ifdef QLDAP_CLUSTER
static int allwrite(int (*)(),int, void *,int);
-static void copyloop(int, int, int);
+static void copyloop(int, int, int, int);
static char copybuf[4096];
static int
@@ -242,21 +242,21 @@
}
static void
-copyloop(int infd, int outfd, int timeout)
+copyloop(int infdread, int infdwrite, int outfd, int timeout)
{
fd_set iofds;
struct timeval tv;
int maxfd; /* Maximum numbered fd used */
int bytes, ret;
- ndelay_off(infd); ndelay_off(outfd);
+ ndelay_off(infdread); ndelay_off(infdwrite); ndelay_off(outfd);
while (1) {
/* file descriptor bits */
FD_ZERO(&iofds);
maxfd = -1;
- FD_SET(infd, &iofds);
- if (infd > maxfd)
- maxfd = infd;
+ FD_SET(infdread, &iofds);
+ if (infdread > maxfd)
+ maxfd = infdread;
FD_SET(outfd, &iofds);
if (outfd > maxfd)
maxfd = outfd;
@@ -274,8 +274,8 @@
logit(32, "copyloop: select timeout\n");
break;
}
- if (FD_ISSET(infd, &iofds)) {
- if ((bytes = read(infd, copybuf,
+ if (FD_ISSET(infdread, &iofds)) {
+ if ((bytes = read(infdread, copybuf,
sizeof(copybuf))) < 0) {
logit(1, "copyloop: read failed: %s\n",
error_str(errno));
@@ -299,14 +299,15 @@
logit(32, "copyloop: read in %i bytes read\n",
bytes);
if (bytes == 0)
break;
- if (allwrite(subwrite, infd, copybuf, bytes) != 0) {
+ if (allwrite(subwrite, infdwrite, copybuf, bytes) !=
0) {
logit(1, "copyloop: write in failed: %s\n",
error_str(errno));
break;
}
}
}
- close(infd);
+ close(infdread);
+ close(infdwrite);
close(outfd);
return;
}
@@ -357,7 +358,7 @@
/* We have a connection, first send user and pass */
auth_forward(ffd, name, passwd);
- copyloop(0, ffd, timeout);
+ copyloop(0,1, ffd, timeout);
_exit(0); /* all went ok, exit normaly */
}
EOM