Re: Protocol error

Kezdőlap
Üzenet törlése
Válasz az üzenetre
Szerző: Philip Hazel
Dátum:  
Címzett: Jon Morby, David Sheryn
CC: exim-users, David Sheryn
Tárgy: Re: Protocol error
On Thu, 25 Sep 1997, Jon Morby wrote:

> Should exim really be logging to the socket in such a fashion?


On Thu, 25 Sep 1997, David Sheryn wrote:

> This looks very similar to a problem I had recently. Phil very promptly issued
> me with a patch which I've been testing and appears to have fixed the problem.
> I obviously can't speak for Phil, bu *if* it is the same problem I would
> expect the official patch RSN :-)


I agree that it looks to be exactly the problem David had and which I
couldn't replicate on my workstation. Nevertheless, we eventually sorted
it out. As nobody else was shouting, I didn't publish anything on the
list, but just incorporated the fix into the development source, as I'm
expecting to issue a maintenance release (there have been several minor
fixes) in the next week or so.

Since someone else has hit it, I append the patch below.

-- 
Philip Hazel                   University Computing Service,
ph10@???             New Museums Site, Cambridge CB2 3QG,
P.Hazel@???          England.  Phone: +44 1223 334714



This patch stops Exim trying to write paniclog messages to stderr from the
daemon or any of its subprocesses.

*** exim-1.71/src/daemon.c     Tue Sep  9 14:07:23 1997
--- src/daemon.c    Fri Sep 19 16:27:37 1997
***************
*** 561,570 ****


    /* Ensure cached files for searches and expands, which might have been
    opened while reading the configuration, are closed before doing a general
!   close on all file descriptors. */


    search_tidyup();
    for (fd = mac_maxfd; fd >= 0; fd--) close(fd);


    /* Fork, in case current process is a process group leader (see 'man
    setsid' for an explanation). */
--- 561,572 ----


    /* Ensure cached files for searches and expands, which might have been
    opened while reading the configuration, are closed before doing a general
!   close on all file descriptors. Set log_stderr NULL so log doesn't try to
!   use it to copy paniclog output. */


    search_tidyup();
    for (fd = mac_maxfd; fd >= 0; fd--) close(fd);
+   log_stderr = NULL;


    /* Fork, in case current process is a process group leader (see 'man
    setsid' for an explanation). */


*** exim-1.71/src/log.c        Tue Sep  9 14:07:26 1997
--- src/log.c    Fri Sep 19 16:30:07 1997
***************
*** 63,70 ****
    {
    char *s = "log file path too long: aborting";
    if (debug_file != NULL) fprintf(debug_file, "exim: %s\n", s);
!   if (stderr != NULL && stderr != debug_file)
!     fprintf(stderr, "exim: %s\n", s);
    openlog("exim", LOG_PID|LOG_CONS, LOG_MAIL);
    syslog(LOG_CRIT, s);
    closelog();
--- 63,70 ----
    {
    char *s = "log file path too long: aborting";
    if (debug_file != NULL) fprintf(debug_file, "exim: %s\n", s);
!   if (log_stderr != NULL && log_stderr != debug_file)
!     fprintf(log_stderr, "exim: %s\n", s);
    openlog("exim", LOG_PID|LOG_CONS, LOG_MAIL);
    syslog(LOG_CRIT, s);
    closelog();
***************
*** 355,372 ****
  /* Handle the panic log, which is not kept open like the others. If it fails to
  open, there will be a recursive call that ends up here. We detect this and
  attempt to write to the system log as a last-ditch try at telling somebody. In
! all cases, try to write to stderr and/or debug_file. */


  if ((flags & LOG_PANIC) != 0)
    {
!   if (stderr != NULL && stderr != debug_file) fprintf(stderr, "%s", log_buffer);


    if (panic_recurseflag)
      {
      if (debug_file != NULL)
        fprintf(debug_file, "exim: could not open panic log: aborting\n");
!     if (stderr != NULL && stderr != debug_file)
!       fprintf(stderr, "exim: could not open panic log: aborting\n");
      openlog("exim", LOG_PID|LOG_CONS, LOG_MAIL);
      syslog(LOG_CRIT, "could not open panic log - original error was: %s",
        log_buffer);
--- 355,373 ----
  /* Handle the panic log, which is not kept open like the others. If it fails to
  open, there will be a recursive call that ends up here. We detect this and
  attempt to write to the system log as a last-ditch try at telling somebody. In
! all cases, try to write to log_stderr and/or debug_file. */


  if ((flags & LOG_PANIC) != 0)
    {
!   if (log_stderr != NULL && log_stderr != debug_file)
!     fprintf(log_stderr, "%s", log_buffer);


    if (panic_recurseflag)
      {
      if (debug_file != NULL)
        fprintf(debug_file, "exim: could not open panic log: aborting\n");
!     if (log_stderr != NULL && log_stderr != debug_file)
!       fprintf(log_stderr, "exim: could not open panic log: aborting\n");
      openlog("exim", LOG_PID|LOG_CONS, LOG_MAIL);
      syslog(LOG_CRIT, "could not open panic log - original error was: %s",
        log_buffer);


*** exim-1.71/src/globals.c    Tue Sep  9 14:07:25 1997
--- src/globals.c    Fri Sep 19 16:24:42 1997
***************
*** 243,249 ****
  int    log_level              = 5;
  BOOL   log_received_recipients = FALSE;
  BOOL   log_refused_recipients = FALSE;
! BOOL   log_smtp_confirmation = FALSE;
  BOOL   log_subject = FALSE;
  char  *lookup_key = NULL;


--- 243,250 ----
  int    log_level              = 5;
  BOOL   log_received_recipients = FALSE;
  BOOL   log_refused_recipients = FALSE;
! BOOL   log_smtp_confirmation  = FALSE;
! FILE  *log_stderr;
  BOOL   log_subject = FALSE;
  char  *lookup_key = NULL;


*** exim-1.71/src/globals.h    Tue Sep    9 14:07:25 1997
--- src/globals.h    Fri Sep 19 16:24:06 1997
***************
*** 157,162 ****
--- 157,163 ----
  extern BOOL   log_received_recipients; /* As it says */
  extern BOOL   log_refused_recipients; /* Sic */
  extern BOOL   log_smtp_confirmation;  /* Log response after "." */
+ extern FILE  *log_stderr;             /* Copy of stderr for log use, or NULL */
  extern BOOL   log_subject;            /* As it says */
  extern char  *lookup_key;             /* For query expansion */


*** exim-1.71/src/exim.c       Tue Sep    9 14:07:24 1997
--- src/exim.c    Fri Sep 19 16:26:59 1997
***************
*** 204,209 ****
--- 199,210 ----
    exit(EXIT_FAILURE);
    }


+ /* Set log_stderr to stderr. This gets reset to NULL when the daemon is
+ run. We have to use this indirection, because some systems don't allow writing
+ to the variable "stderr". */
+
+ log_stderr = stderr;
+
/* Ensure there is a big buffer for temporary use in several places. */

big_buffer = store_malloc(big_buffer_size);


--
* This is sent by the exim-users mailing list.  To unsubscribe send a
    mail with subject "unsubscribe" to exim-users-request@???
* Exim information can be found at http://www.exim.org/