Thanks. I was already aware of this.

Bad spelling notwithstanding, I said already:

<quote>

> I've put the appropriate shortcuts to allow the
> smrsh to execute m program.

</quote>

You see, I've been trying to get this working since before the last installfest. It's not as though I haven't happened on that particular restriction in my search before now.

I've even tried symlinking to the output file in /etc/smrsh just in case, though this was probably unnecessary:

<quote>

[EMAIL PROTECTED] smrsh]$ ll
total 0
lrwxrwxrwx 1 root mailman 30 Feb 20 09:59 mailman -> ../../var/mailman/mail/mailman
lrwxrwxrwx 1 root root 28 Feb 23 14:58 output_file -> /opt/repeat_temp/output_file
lrwxrwxrwx 1 root root 23 Feb 23 14:41 repeat -> /opt/repeat_temp/repeat


</quote>

Somehow, mailman doesn't seem to be working either, but isn't throwing the same errors. I don't really use mailman anyway. The idea was to try to use some sort of production package that used the same feature, namely forwarding to a program, to differentiate between it being a sendmail config problem, and a problem with my code. Just for reference, my code is listed below. For testing purposes, this is necessarily simple, but eventually this will be doing some advanced parsing, and will submit to a MySQL database.

repeat.c:
<quote>
#include <stdio.h>

main()
{
 char path[] = "/opt/repeat_temp/output_file";
 char buffer[1024];
 int i = 0;
 FILE *output_file;



 if ((output_file = fopen(path, "w")) == NULL)
   fprintf(stderr, "Cannot open %s\n", path);



 for(i = 0; i<1024; i++) {
   buffer[i]=0;
 }



 while(!feof(stdin) && !ferror(stdin)) {
   for(i = 0; i<1024; i++) {
     buffer[i]=0;
   }
   fgets(buffer, 1024, stdin);
   //scanf("%s", &buffer);

   fprintf(output_file, "Data read:\n%s\n", buffer);
 }

fclose(output_file);

 exit(0);
}

</quote>

Note that it has been several years since I've done much in C, therefore the code above may not be the most elegant or well written, but it seems to do the job when invoked either directly in bash, or using "smrsh -c repeat".



Lloyd Brown



[uug] Sendmail help

Michael L Torrie torriem at chem.byu.edu
 Mon Feb 23 16:54:09 MST 2004

Previous message: [uug] Sendmail help
Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Mon, 2004-02-23 at 16:41, QuickBrownFox wrote:
> Hello all,
>
> Is there a sendmail guru in the house? I've been trying to get a
> certain feature to work for several weeks now at work, with no luck.
>
> I'm trying to get sendmail to forward email to a program, using the
> "prgmforward: "|/fully/qualified/path/to/script"" syntax in the
> /etc/aliases file. I've put the appropriate shortcuts to allow the
> smrsh to execute m program. Somehow, though, I get errors in my maillog
> like this one:
>


The key is that you have to put a symlink in /etc/smrsh of the program
that you want to run.  For example, the mailman mailing list requires
the mailman binary to be symlinked into the smrsh file.  Sendmail will
only run programs that are symlinked into that directory for security
reasons.

Michael


> <quote>
>
> Feb 23 15:01:55 dbtest2 sendmail[32150]: i1NM0Ohx032097: SYSERR(root):
> mailer prog died with signal 11
> Feb 23 15:01:55 dbtest2 sendmail[32150]: i1NM0Ohx032097:
> to="|/opt/repeat_temp/repeat", ctladdr=<prgmforward at dbtest2.et.byu.edu>
> (8/0), delay=00:01:31, xdelay=00:00:00, mailer=prog, pri=120613,
> dsn=4.0.0, stat=Deferred: prog mailer (/usr/sbin/smrsh) exited with
> EX_TEMPFAIL
>
> </quote>
>
> Any ideas? I've already tried invoking the program by hand, both using
> bash directly, and using "smrsh -c /opt/repeat_temp/repeat". I've also
> hoped that it was just some sort of configuration or package issue, and
> tried using other distros, namely Redhat 9.0, Mandrake 9.2, and SuSE 9.0.
>
> System background info:
>
> Distro: Fedora Core 1
> Kernel: 2.4.22-1.2140.nptl
> Sendmail version: 8.12.10-1.1.1
>
>
>
> Thanks,
> Lloyd Brown
>
> --------------------
> "Open Source is not a crime."
> -Seen on a bumper sticker
> --------------------
>
>
> ____________________
> BYU Unix Users Group
> http://uug.byu.edu/
> ___________________________________________________________________
> List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
--
Michael L Torrie <torriem at chem.byu.edu>



____________________
BYU Unix Users Group http://uug.byu.edu/ ___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to