[prev in list] [next in list] [prev in thread] [next in thread] 

List:       majordomo-users
Subject:    Re: sh: cannot use | in command
From:       Ed Kasky <ed () wrenkasky ! com>
Date:       2001-01-28 7:50:13
[Download RAW message or body]

At 12:27 AM Sunday, 1/28/2001, D. Liston wrote -=>
>I think I know what the problem is.
>
>Grep your /var/spool/mail/mail file for the following text;
>X-ApprovalRequired: true
>
>If the above header line has been added to messages, your filter is working.
>It also means your filter has a typo.  This,
>* ^TO_test@wrenkasky\.com
>should be this;
>* !^TO_test@wrenkasky\.com


No header there.

I tried using a default procmailrc ie: not specifying a file in the alias 
just to see if that would change the behavior as I was getting an error 
message in the maillog about the kind of file the test filer was.  I had a 
very interesting result sending a test message:

Jan 27 23:16:34 yoda sendmail[32764]: XAA32764: from=<ed@wrenkasky.com>, 
size=20679, class=0, pri=50679, nrcpts=1, 
msgid=<4.3.2.7.2.20010127231625.00b74728@mail.wrenkasky.com>, proto=ESMTP, 
relay=eds.wrenkasky.com [10.0.0.11]
Jan 27 23:16:34 yoda sendmail[32765]: XAA32765: clone XAA32764, 
owner=owner-test
Jan 27 23:16:35 yoda demime[300]: One argument required - the relay to 
address.
Jan 27 23:16:35 yoda sendmail[305]: XAA00305: 
from=owner-test@wrenkasky.com, size=232, class=0, pri=30232, nrcpts=1, 
msgid=<200101280716.XAA00305@wrenkasky.com>, relay=majordom@localhost
Jan 27 23:16:35 yoda sendmail[32765]: XAA32765: to="|usr/bin/procmail -f-" 
, delay=00:00:01, xdelay=00:00:01, mailer=prog, stat=Sent
Jan 27 23:16:35 yoda sendmail[307]: XAA00305: to=ed@wrenkasky.com, 
delay=00:00:00, xdelay=00:00:00, mailer=local, stat=Sent
Jan 27 23:16:35 yoda demime[312]: One argument required - the relay to 
address.

and then just kept trying to send over and over until I killed 
resend.  What's interesting is that demime works fine from the alias when 
allowed by the shell.  I have no idea why it's saying that it's missing the 
relay to address.



>Since procmail exits on the first pipe, file, or address that can accept
>delivery of the message, the message was passing the first test and getting
>a header line added, but not getting sent on to resend.  The majority of
>messages should fail the first test and fall through to the catchall of no
>test at all.  This is why the ! is required, it negates the value of the
>first test.
>
>If the message "does not" contain a To: or Cc: with test@wrenkasky.com, pipe
>to formail which will add another header line.  Your filter is adding the
>header to messages "does" contain it.
>
>Dan Liston
>
>Ed Kasky wrote:
> >
> > At 01:25 PM Friday, 1/26/2001, Don wrote -=>
> > >Have you read through or edited the demime script to make
> > >sure the directory structures are correct?  The location of
> > >perl for example.  The existence of sysexits.ph.  The control
> > >file location.  There might be a missing perl module...
> >
> > I tested demime from the command line and it's working fine.  It even works
> > from the alias
> > "/usr/local/majordomo/demime '| /usr/local/majordomo/wrapper resend -l test
> > test-list,nobody" when I change Mprog to sh instead of smrsh.
> >
> > >Otherwise, I guess it is time to put in some check points.
> > >I will assume your address is already in the subscriber file.
> >
> > The test messages are getting as far as /var/spool/mail/mail and no 
> further...
> >
> > ls -al /var/spool/mail
> >
> > [before]
> > -rw-rw----   1 mail     mail        61558 Jan 27 00:24 mail
> >
> > [after]
> > -rw-rw----   1 mail     mail        80800 Jan 27 08:08 mail
> >
> > Here's the alias as it stands:
> > test:         "|usr/bin/procmail -f- /usr/local/majordomo/filter/test"
> >
> > I verified the that path to procmail is correct.
> >
> > And here's /usr/local/majordomo/filter/test:\
> > :0fhw
> > * ^TO_test@wrenkasky\.com
> > | formail -I "X-ApprovalRequired: true"
> > :0 c
> > ! ed@wrenkasky.com
> > :0
> > |/usr/local/majordomo/demime |/usr/local/majordomo/wrapper resend -l test
> > test-list,nobody
> >
> > Here's the resulting maillog entries:
> >
> > Jan 27 13:43:48 yoda sendmail[32001]: NAA32001: from=<ed@wrenkasky.com>,
> > size=19986, class=0, pri=49986, nrcpts=1,
> > msgid=<4.3.2.7.2.20010127134341.00b66278@mail.wrenkasky.com>, proto=ESMTP,
> > relay=eds.wrenkasky.com [10.0.0.11]
> >
> > Jan 27 13:43:48 yoda sendmail[32002]: NAA32002: clone NAA32001,
> > owner=owner-test
> >
> > Jan 27 13:43:48 yoda sendmail[32002]: NAA32002: to="|usr/bin/procmail -f-
> > /usr/local/majordomo/filter/test", delay=00:00:00, xdelay=00:00:00,
> > mailer=prog, stat=Sent
> >
> > >Add your address to the alias for test in the aliases file.
> > >Change ,nobody in the filter to ,ed
> > >Between :0 and |/usr/local....  insert;
> > >:0 c
> > >! ed@wrenkasky.com
> > >
> > >In fact, if you have multiple addresses, it would be good to
> > >use different ones in each location to see how far the mail
> > >actually gets.
> > >
> > >Another test, remove the demime portion of the filter and
> > >see if that much of everything is working.  If so, time to
> > >examine the demime script very carefully.
> >
> > Same result with or without the demime in the filter...
> >
> > In fact, the message in mail are the same both ways which leads me to think
> > that the messages are getting to that mailbox and never even getting to the
> > command line..
> >
> > Time for me to dig a little deeper into the procmail stuff I think.
> >
> > Ed
> > ~~
> >
> > >Ed Kasky wrote:
> > > >
> > > > At 11:23 AM 1/26/2001 -0600, you wrote:
> > > > >Is the missing ":"
> > > > >at the beginning of your filter a typo?
> > > >
> > > > Yes - it's there in the file...
> > > >
> > > > >Your filter directory should not be world or group writable.
> > > > >The "test" filter should be 644 majordom:majordom.
> > > >
> > > > I changed it - thanks.
> > > >
> > > > drwxr-xr-x   2 majordom majordom     1024 Jan 26 07:30 .
> > > > drwxr-xr-x  19 majordom majordom     2048 Jan 26 07:26 ..
> > > > -rw-r--r--   1 majordom majordom      176 Jan 26 10:15 test
> > > >
> > > > >I am not positive, but you might need to put " marks around
> > > > >the last line of the filter, and make sure the last line is
> > > > >all one line beginning at the first |.
> > > >
> > > > There are no breaks in the last line and I also tried it with " marks
> > > > around the last line....
> > > >
> > > > I still get:
> > > >
> > > > Jan 26 10:15:31 yoda procmail[23352]: Suspicious rcfile
> > > > "/usr/local/majordomo/filter/test"
> > > > Jan 26 10:15:31 yoda sendmail[23351]: KAA23351: 
> to="|usr/bin/procmail -f-
> > > > /usr/local/majordomo/filter/test", delay=00:00:00, xdelay=00:00:00,
> > > > mailer=prog, stat=Sent
> > > >
> > > > ...and no mail.
> > > >
> > > > I'm stumped.
> > > >
> > > > Ed
> > > >
> > > > > > >Aliases file:
> > > > > > >test: "|/usr/bin/procmail -f- /var/lib/majordomo/filter/test"
> > > > > > >
> > > > > > >test filter:
> > > > > > >:0fhw
> > > > > > >* !^TO_test@example\.com
> > > > > > >| formail -I "X-ApprovalRequired: true"
> > > > > > >:0
> > > > > > >| /var/lib/majordomo/wrapper resend -l test test-outgoing,nobody
> > > > > > >
> > > > > > >The last line of the filter could be changed to include demime
> > > like so:
> > > > > > >"|/usr/lib/majordomo/demime - |/usr/lib/majordomo/wrapper resend
> > > -l test
> > > > > > >test-list,nobody"
> > > > > >
> > > > > > Using procmail and the filter seems to be working but the mail
> > > didn't go
> > > > > > anywhere:
> > > > > >
> > > > > >  From the maillog:
> > > > > >
> > > > > > Suspicious rcfile "/usr/local/majordomo/filter/test"
> > > > > > "/usr/bin/procmail -f- /usr/local/majordomo/filter/test",
> > > delay=00:00:01,
> > > > > > xdelay=00:00:00, mailer=prog, stat=Sent
> > > > > >
> > > > > > The mail never went to the list and is not in a queue...
> > > > > >
> > > > > > Here's my test filter:
> > > > > >
> > > > > > :0fhw
> > > > > > * !^TO_test@mydomain\.net
> > > > > > | formail -I "X-ApprovalRequired: true"
> > > > > > :0
> > > > > > "|/usr/local/majordomo/demime - |/usr/local/majordomo/wrapper 
> resend -l
> > > > > test test-list,nobody"
> >
> > Ed Kasky
> > Los Angeles, CA
> > . . . . . . . .
> > Let us be of good cheer, remembering that the misfortunes hardest to 
> bear are
> > those which never happen. -James Russell Lowell (1819-1891)

Ed Kasky
Los Angeles, CA
. . . . . . . .
"Not everything that counts can be counted, and not everything
  that can be counted counts."
  (Sign hanging in Einstein's office at Princeton)

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic