[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Remote .forward lookups
> Our site has two main servers: one strictly for mail and one the users log
> into. Their home directories are housed on their home machine. Is there
> a way (other than NFS mounting the partitions) to query the users machine
> for their .forward file information? My guess is that someone has run
> into this problem before and I wouldn't want to "re-invent the wheel".
>
> The reason why NFS mounting is not a viable alternative is not easily
> explained and not particularly relevant to the problem, anyway.
Had I decided to go and implement that, I would have done
following kind of program:
for (pwd = getpwent(); pwd != NULL; pwd = getnextpwent()) {
char buf[500];
struct stat stbuf;
sprintf(buf,"%s/.forward",pwd->pw_home);
if (stat(buf,&stbuf) == 0) { /* Exists */
/* Print out:
username \t uid \t contents of .forward on one line with ","s in between input lines
*/
}
}
The output would be then collected into a file several times a day,
and copied into another machine to use it.
I leave it as an excercise on how to use the produced database :-)
Do note that printing the contents of .forward is not quite trivial..
There are a LOT of assuptions, like implicite " , " at the newline,
IF there is something non-white following. Also an always happening
parsing break at that newline causes abrupt RFC-822 stop (well,
only on .forward, not on email headers!)
Such parser should be pretty smart... (Or its limitations be
acknowledged.)
I understand that you have no escape from running some user
programs on the mailer machine, if users decide to want such.
(As email filters.)
> If it is relevant, we are running SunOS 4.1.4 and Rayan's zmailer.
>
> Thanks for your time and any hints or pointers.
>
> --
> _/_/_/_/ _/_/_/ _/_/_/ _/ _/ Gordon J. Cook
> _/ _/ _/ _/ _/_/ _/ Erindale College Computing Services
> _/_/_/ _/_/_/ _/ _/ _/ _/ University of Toronto, Canada
> _/ _/ _/ _/ _/ _/_/ gcook@credit.erin.utoronto.ca
> _/_/_/_/ _/ _/ _/_/_/ _/ _/ (905)828-5339
/Matti Aarnio <mea@utu.fi> <mea@nic.funet.fi>