[Raw Msg Headers][Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Trouble using "sendmail" w/ inetd for incoming mail



Brian Fisk tells about his tcp-wrapper usage with zmailer smtp input:
...
> Yes. You specify the SMTPOPTIONS variable in the zmailer.conf file, so
> that when you type "zmailer smtpserver", it is started with the options
> you specify.  But when you startup a server in standalone mode via the
> "sendmail -bs" command, none of these commands are passed in to the
> subsequent smtpserver call. Specifically:
> 
>       (path is set to the path to the smtpserver program).
>       execl(path, "smtp-in", "-i", (char *)NULL); 
> 
> It makes sense to also pass in the arguments specified in zmailer.conf,
> doesn't it? For example, how do you tell it where to log without the -l
> option?

	By calling the smtpserver straight ?
	Well, here is the small code you need to do what you want at
	compat/sendmail/sendmail.c:

-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-
	if (speaksmtp) {
		char *argv[30+1];
		path = emalloc((unsigned)(strlen(mailbin)+1+strlen(SMTPSERVER)+1));
		sprintf(path, "%s/%s", mailbin, SMTPSERVER);
		argv[0] = "smtp-in";
		argv[1] = "-i";
		n = 2;
		cp = getzenv("SMTPOPTIONS"); /* Normal smtp-server options */
		/* pass on suidness */
		s = strtok(cp, " \t");
		do {
		  argv[n++] = s;
		  s = strtok(NULL, " \t");
		} while (s != NULL && n < 30);
		argv[n] = NULL;
		execv(path, argv);
		perror(path);
	} else if (daemon_flg) {
-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-

	Actually I suspect that this way it does not flag properly
	an external message as external..  I could be wrong, of course.

> > 	How about integrating tcp-wrapper into the server itself ?
> 
> All the better--it would cut down on the overhead of firing up another
> copy every time there is an incoming connection.

	Indeed, how do people have set up their tcp-wrapper libraries,
	and includes ?   If I add a configuration option:
		--with-tcp-wrappers=DIRPATH
	can I assume that at that directory there are both the
		libwrap.a
	and the include file:
		tcpd.h
 	(I have them so, but I am not everybody..)

	( .. and like some put the figure of speech, apparently the tcp-wrapper
	  'sucks rocks' -- it should allow parse of the interesting bit of
	  data from the config file, and use that in-core data to check at
	  the connections.  Just in case if the allow/deny files have changed,
	  it should be able to check at them too instead of automatic socket-
	  oriented  request_init() that it does now...  That way I could let
	  the wrapper to act FAST on the incoming connections by initing the
	  interesting bits before the accept() loop, and then just act on
	  those. )
	( yes, I did read Andy Polings comments on this topic )
	( I sent also some questions, and comments to Weitse Venema )
...

> -- Brian Fisk * bfisk@netspace.org * http://www.netspace.org/users/bfisk --

	/Matti Aarnio <mea@nic.funet.fi>