On Monday 04 July 2005 00:17, Sameer N Ingole wrote:
> >On Sunday 03 July 2005 01:26, Sameer N Ingole wrote:
> >>Ed Cates wrote:
> >>>On Saturday 02 July 2005 23:23, Sameer N Ingole wrote:
> >>>>Ed Cates wrote:
> >>>>>Sameer,
> >>>>>
> >>>>>I've taken the qmail-queue-custom-error patch and modified it so it
> >>>>>patches cleanly and compiles against qmail-ldap-1.03-20050401a with no
> >>>>>other patches installed.
> >>>>>
> >>>>>Note I didn't say "runs." I haven't tried to run it yet. But it at
> >>>>>least patches and compiles. ;-)
> >>>>>
> >>>>>Please let me know if this works with simscan.
> >>>>>
> >>>>>--Ed
> >>>>
> >>>>I patched qmail-ldap-1.03-20050401a manually with
> >>>>qmail-queue-custom-error patch
> >>>>and *it works fine* with simscan. I woud rather preffer to check the
> >>>>diff (your patch)
> >>>>against my manually patched code with qmail-ldap-1.03-20050401a code.
> >>>
> >>>I'll bet our efforts are remarkably similar. That is all that I did
> >>>(found
> >>
> >>So it seems but..
> >>there is some difference with your diff and my diff.
> >>This is what I did.
> >>1. I patched qmail-ldap-1.03-20050401a with
> >> qmail-queue-custom-error.patch 2. I patched qmail-ldap-1.03-20050401a
> >> manually with rejected hunks of qmail-queue-custom-error.patch
> >> seperately again in a different directory. 3. diff'ed the files using
> >> command
> >> diff -b -u tmp/qmail-1.03/qmail.c qmail-1.03_0/qmail.c
> >>where
> >>tmp/qmail-1.03/qmail.c is from point 1 above and
> >>qmail-1.03_0/qmail.c is from point 2 above
> >>
> >>My diff output agrees with your diff output till first two hunks, but
> >>third hunk is
> >>a difference between your diff and my diff. What went wrong?
> >>here is my diff output...
> >>
> >>-------8<------
> >>
> >>--- tmp/qmail-1.03/qmail.c 2005-07-03 11:31:17.134903720 +0530
> >>+++ qmail-1.03_0/qmail.c 2005-06-30 18:07:07.557029720 +0530
> >>@@ -32,6 +32,7 @@
> >> {
> >> int pim[2];
> >> int pie[2];
> >>+ int pierr[2];
> >>
> >> #ifdef ALTQUEUE
> >> setup_qqargs();
> >>@@ -39,17 +40,26 @@
> >>
> >> if (pipe(pim) == -1) return -1;
> >> if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
> >>+ if (pipe(pierr) == -1) {
> >>+ close(pim[0]); close(pim[1]);
> >>+ close(pie[0]); close(pie[1]);
> >>+ close(pierr[0]); close(pierr[1]);
> >>+ return -1;
> >>+ }
> >>
> >> switch(qq->pid = vfork()) {
> >> case -1:
> >>+ close(pierr[0]); close(pierr[1]);
> >> close(pim[0]); close(pim[1]);
> >> close(pie[0]); close(pie[1]);
> >> return -1;
> >> case 0:
> >> close(pim[1]);
> >> close(pie[1]);
> >>+ close(pierr[0]); /* we want to receive data */
> >> if (fd_move(0,pim[0]) == -1) _exit(120);
> >> if (fd_move(1,pie[0]) == -1) _exit(120);
> >>+ if (fd_move(4,pierr[1]) == -1) _exit(120);
> >> if (chdir(auto_qmail) == -1) _exit(61);
> >> execv(*binqqargs,binqqargs);
> >> _exit(120);
> >>@@ -57,6 +67,7 @@
> >>
> >> qq->fdm = pim[1]; close(pim[0]);
> >> qq->fde = pie[1]; close(pie[0]);
> >>+ qq->fderr = pierr[0]; close(pierr[1]);
> >> substdio_fdbuf(&qq->ss,subwrite,qq->fdm,qq->buf,sizeof(qq->buf));
> >> qq->flagerr = 0;
> >> return 0;
> >>
> >>------->8------
> >>
> >>>the code hunks, added the lines from the custom-error patch), then
> >>> diff'ed it against the original files.
> >>>
> >>>Glad to know it works with Simscan! Thanks!
> >>>
> >>>>The original qmail-queue-custom-error patch fails with 2 rejected hunks
> >>>>in file qmail.c
> >>>>of qmail-ldap-1.03-20050401a source.
> >>>>
> >>>>>On Thursday 30 June 2005 06:53, you wrote:
> >>>>>>Hi All,
> >>>>>>I am wondering if there is some functionality like one provided by
> >>>>>>qmail-queue-custom-error.patch
> >>>>>>in qmail-ldap. Or do I have to use this patch?
> >>>>>>
> >>>>>>I have qmail-ldap running patched with
> >>>>>> qmail-ldap-1.03-20050401a.patch
> >>>>>>
> >>>>>>I want to send some custom error messages and using simscan, clamav
> >>>>>> and spamassassin.
> >>>>>>I tried to pach the qmail-ldap source with this patch but it failed.
> >>>>>>
> >>>>>>Thank you.
> >>>>>>
> >>>>>>
> >>>>>>---------------------------------------------------------------------
> >>>>>>-- -
> >>>>>>
> >>>>>>--- qmail.c.old 2005-07-02 11:11:29.000000000 -0500
> >>>>>>+++ qmail.c 2005-07-02 11:11:34.000000000 -0500
> >>>>>>@@ -32,6 +32,7 @@
> >>>>>>{
> >>>>>> int pim[2];
> >>>>>> int pie[2];
> >>>>>>+ int pierr[2];
> >>>>>>
> >>>>>>#ifdef ALTQUEUE
> >>>>>> setup_qqargs();
> >>>>>>@@ -39,17 +40,26 @@
> >>>>>>
> >>>>>> if (pipe(pim) == -1) return -1;
> >>>>>> if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
> >>>>>>+ if (pipe(pierr) == -1) {
> >>>>>>+ close(pim[0]); close(pim[1]);
> >>>>>>+ close(pie[0]); close(pie[1]);
> >>>>>>+ close(pierr[0]); close(pierr[1]);
> >>>>>>+ return -1;
> >>>>>>+ }
> >>>>>>
> >>>>>> switch(qq->pid = vfork()) {
> >>>>>> case -1:
> >>>>>>+ close(pierr[0]); close(pierr[1]);
> >>>>>> close(pim[0]); close(pim[1]);
> >>>>>> close(pie[0]); close(pie[1]);
> >>>>>> return -1;
> >>>>>> case 0:
> >>>>>> close(pim[1]);
> >>>>>> close(pie[1]);
> >>>>>>+ close(pierr[0]); /* we want to receive data */
> >>>>>> if (fd_move(0,pim[0]) == -1) _exit(120);
> >>>>>> if (fd_move(1,pie[0]) == -1) _exit(120);
> >>>>>>+ if (fd_move(4,pierr[1]) == -1) _exit(120);
> >>>>>> if (chdir(auto_qmail) == -1) _exit(61);
> >>>>>> execv(*binqqargs,binqqargs);
> >>>>>> _exit(120);
> >>>>>>@@ -57,6 +67,7 @@
> >>>>>>
> >>>>>> qq->fdm = pim[1]; close(pim[0]);
> >>>>>> qq->fde = pie[1]; close(pie[0]);
> >>>>>>+ qq->fderr = pierr[0]; close(pierr[1]);
> >>>>>> substdio_fdbuf(&qq->ss,subwrite,qq->fdm,qq->buf,sizeof(qq->buf));
> >>>>>> qq->flagerr = 0;
> >>>>>> return 0;
> >>>>>>@@ -141,10 +152,21 @@
> >>>>>>{
> >>>>>> int wstat;
> >>>>>> int exitcode;
> >>>>>>+ int match;
> >>>>>>+ char ch;
> >>>>>>+ static char errstr[256];
> >>>>>>+ int len = 0;
> >>>>>>
> >>>>>> qmail_put(qq,"",1);
> >>>>>> if (!qq->flagerr) if (substdio_flush(&qq->ss) == -1) qq->flagerr =
> >>>>>> 1; close(qq->fde);
> >>>>>>+ substdio_fdbuf(&qq->ss,read,qq->fderr,qq->buf,sizeof(qq->buf));
> >>>>>>+ while( substdio_bget(&qq->ss,&ch,1) && len < 255){
> >>>>>>+ errstr[len]=ch;
> >>>>>>+ len++;
> >>>>>>+ }
> >>>>>>+ if (len > 0) errstr[len]='\0'; /* add str-term */
> >>>>>>+ close(qq->fderr);
> >>>>>>
> >>>>>> if ((unsigned long)wait_pid(&wstat,qq->pid) != qq->pid)
> >>>>>> return "Zqq waitpid surprise (#4.3.0)";
> >>>>>>--- qmail.h.old 2005-07-02 11:10:19.000000000 -0500
> >>>>>>+++ qmail.h 2005-07-02 11:10:00.000000000 -0500
> >>>>>>@@ -8,6 +8,7 @@
> >>>>>> unsigned long pid;
> >>>>>> int fdm;
> >>>>>> int fde;
> >>>>>>+ int fderr;
> >>>>>> substdio ss;
> >>>>>> char buf[1024];
> >>>>>>} ;
> >
> >Ed Cates wrote:
> >
> > Well, which qmail-queue-custom-error.patch were you working from
> > originally? I used the one that came with Simscan, and added the changes
> > in manually.
> >
> >I'm not quite sure I understand the nature of the problem.
>
> Please do not top post. I have reformatted your message in this post to
> read properly.
>
> I am using qmail-queue-custom-error.patch that came with simscan in
> ~/contrib directory.
> The patch I produced for qmail qmail-ldap-1.03-20050401a is not
> identical to the one you
> produced. Take a look at last hunk in your patch above, its not there in
> my patch. Either
> its me making some mistake or its you.
>
> I think we should sort this out. This will be helpful for those who will
> search the archives.
Maybe I should stop working so late. ;-) I did fail to add in an entire
chunk of code when I hand-merged the files ( the "if (exitcode == 82 ...)"
part). I'm attaching the new diff. Thanks for helping me see this.
--Ed
--- qmail.c.old 2005-07-04 08:22:18.000000000 -0500
+++ qmail.c 2005-07-04 08:23:01.000000000 -0500
@@ -32,6 +32,7 @@
{
int pim[2];
int pie[2];
+ int pierr[2];
#ifdef ALTQUEUE
setup_qqargs();
@@ -39,17 +40,26 @@
if (pipe(pim) == -1) return -1;
if (pipe(pie) == -1) { close(pim[0]); close(pim[1]); return -1; }
+ if (pipe(pierr) == -1) {
+ close(pim[0]); close(pim[1]);
+ close(pie[0]); close(pie[1]);
+ close(pierr[0]); close(pierr[1]);
+ return -1;
+ }
switch(qq->pid = vfork()) {
case -1:
+ close(pierr[0]); close(pierr[1]);
close(pim[0]); close(pim[1]);
close(pie[0]); close(pie[1]);
return -1;
case 0:
close(pim[1]);
close(pie[1]);
+ close(pierr[0]); /* we want to receive data */
if (fd_move(0,pim[0]) == -1) _exit(120);
if (fd_move(1,pie[0]) == -1) _exit(120);
+ if (fd_move(4,pierr[1]) == -1) _exit(120);
if (chdir(auto_qmail) == -1) _exit(61);
execv(*binqqargs,binqqargs);
_exit(120);
@@ -57,6 +67,7 @@
qq->fdm = pim[1]; close(pim[0]);
qq->fde = pie[1]; close(pie[0]);
+ qq->fderr = pierr[0]; close(pierr[1]);
substdio_fdbuf(&qq->ss,subwrite,qq->fdm,qq->buf,sizeof(qq->buf));
qq->flagerr = 0;
return 0;
@@ -141,10 +152,21 @@
{
int wstat;
int exitcode;
+ int match;
+ char ch;
+ static char errstr[256];
+ int len = 0;
qmail_put(qq,"",1);
if (!qq->flagerr) if (substdio_flush(&qq->ss) == -1) qq->flagerr = 1;
close(qq->fde);
+ substdio_fdbuf(&qq->ss,read,qq->fderr,qq->buf,sizeof(qq->buf));
+ while( substdio_bget(&qq->ss,&ch,1) && len < 255){
+ errstr[len]=ch;
+ len++;
+ }
+ if (len > 0) errstr[len]='\0'; /* add str-term */
+ close(qq->fderr);
if ((unsigned long)wait_pid(&wstat,qq->pid) != qq->pid)
return "Zqq waitpid surprise (#4.3.0)";
@@ -177,8 +199,11 @@
case 81: return "Zqq internal bug (#4.3.0)";
case 120: return "Zunable to exec qq (#4.3.0)";
default:
+ if (exitcode == 82 && len > 2){
+ return errstr;
+ }
if ((exitcode >= 11) && (exitcode <= 40))
- return "Dqq permanent problem (#5.3.0)";
+ return "Dqq permanent problem (#5.3.0)";
return "Zqq temporary problem (#4.3.0)";
}
}
--- qmail.h.old 2005-07-04 08:22:18.000000000 -0500
+++ qmail.h 2005-07-04 08:22:36.000000000 -0500
@@ -8,6 +8,7 @@
unsigned long pid;
int fdm;
int fde;
+ int fderr;
substdio ss;
char buf[1024];
} ;