[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: smtpserver/router server init call problem
> When smtpserver uses the router "server" function, it starts by calling
> server with key="init" with two arguments: a host name (potentially from
> the HELO command?) and the IP address of the socket. These are the
> same two values that end up on the "rcvdfrom" line in the router
> control file. The second argument is at least fairly reliable and I hope
> to use it as the basis of my filtering.
>
> So the problem: the IP address is passed in brackets ("[]"), just as it is
> in the router control file. Somewhere along the line, this gets evaluated
> as a "test" command in zmsh. It returns a value of ".". So, instead of getting:
> Escaping the open bracket fixed the problem. Diff follows sig.
> --- smtpserver.c Thu Apr 3 01:22:04 1997
> +++ smtpserver.c.orig Mon Nov 18 02:55:20 1996
> @@ -2488,7 +2488,7 @@
> if (rhostname[strlen(rhostname)-1] == '\\')
> rhostname[strlen(rhostname)-1] = '?';
>
> - fprintf(tofp, "PS1='%s' ; %s %s '%s' '\\%s'\n", promptbuf,
> + fprintf(tofp, "PS1='%s' ; %s %s '%s' '%s'\n", promptbuf,
> ROUTER_SERVER, RKEY_INIT, rhostname, ihostaddr);
> fflush(tofp);
>
>
>
>
A more elegant solution:
server.cf:
case $key in
init) # If you want to log incoming connections, it can be done here
#echo server "$@" >> /tmp/server
# turn off filename globbing <---------------------
set -f <--------------------- add this
# redefine the log function
log () {
}
;;
I use this method in my policy based smtp filter without any problems.
See details at ftp://ftp.sztaki.hu/pub/private/kissg/zmailer/
Regards
Gabor