RE: [Exim] exim -bd crashes (Version 4.20, with openldap2 an…

Góra strony
Delete this message
Reply to this message
Autor: Schramm, Dominik
Data:  
Dla: exim-users
Temat: RE: [Exim] exim -bd crashes (Version 4.20, with openldap2 and native bdb)
This is a multi-part message in MIME format.
--
Philip Hazel wrote:

> > It doesn't write its pid there.
> > It is not writeable for root, but this shouldn't be a problem,
> > or could it?


> Yes, is could. The Exim daemon writes its pid file while it is still
> root, because on some systems, all the pid files for all the daemons are
> kept in the same directory (/var/pids or something), which is only
> accessible by root.


but root normally does not get disturbed by the fact that a directory
is not writable for root. so i thougt, why bother?

> To track down the crashing problem, I think you will have to add more
> debugging lines to the daemon.c module, to find out exactly where it is
> crashing. The function of interest is called debug_go(), and starts
> around line 656. If you insert lines like


did that. here's the result:

---------------

root:~/exim4/exim-4.20# /usr/local/exim/bin/exim -d -bd
Exim version 4.20 uid=0 gid=0 pid=2135 D=fbb95cfd
Berkeley DB: Sleepycat Software: Berkeley DB 4.1.25: (December 19, 2002)
Support for:
Authenticators:
Routers: accept dnslookup ipliteral manualroute queryprogram redirect
Transports: appendfile/maildir/mbx autoreply pipe smtp
changed uid/gid: forcing real = effective
uid=0 gid=0 pid=2135
auxiliary group list: <none>
configuration file is /usr/local/exim/configure
log selector = 020d99d8
trusted user
admin user
originator: uid=0 gid=0 login=root name=root
daemon_go: declares and inits done.
2135 daemon_go: debug_selector or'ed.
2135 daemon_go: if (background_daemon) finished.
2135 daemon_go: inside if (daemon_listen) block.
2135 daemon_go: os_getloadavg done.
Segmentation fault

----------------

here's my modified code:

debug_printf("daemon_go: os_getloadavg done.\n");

/* Find the standard SMTP port if no port number given; convert it to host
order. */

  if (default_smtp_port < 0)
    {
    struct servent *smtp_service;
    smtp_service = getservbyname("smtp", "tcp");
    debug_printf("getservbyname done.\n");


    if (smtp_service == NULL)
    {
            debug_printf("about to log_write: cannot find smtp service\n");
      log_write(0, LOG_MAIN|LOG_PANIC_DIE, "cannot find smtp/tcp service "
        "when starting daemon");
    }
    default_smtp_port = ntohs(smtp_service->s_port);
    }


debug_printf("daemon_go: if (default_smtp_port < 0) done.\n");

So the problem must be caused by the system's lookup function
getservbyname, right?
However, the following code compiles and runs correctly:

#include <netdb.h>
#include <stdio.h>
int main(void)
{
struct servent* srvent;
srvent = getservbyname("smtp", "tcp");
printf("official name: %s\nport number: %d\nprotocol: %s\n",
           srvent->s_name, srvent->s_port, srvent->s_proto);
return 0;
}


I'm clueless.

By the way, thanks a lot for your pointers, Philip and Tony.

regards,
dominik

--
[ winmail.dat of type application/ms-tnef deleted ]
--