check to see if hostname has changed in thaw(); if it has, ignore
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 3 Oct 1991 05:21:22 +0000 (21:21 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 3 Oct 1991 05:21:22 +0000 (21:21 -0800)
the frozen config (with the wrong hostname)

SCCS-vsn: usr.sbin/sendmail/src/main.c 5.34
SCCS-vsn: usr.sbin/sendmail/src/version.c 5.73

usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/version.c

index df76c6e..499a7a2 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     5.33 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     5.34 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -105,7 +105,7 @@ main(argc, argv, envp)
        bool queuemode = FALSE;         /* process queue requests */
        bool nothaw;
        static bool reenter = FALSE;
        bool queuemode = FALSE;         /* process queue requests */
        bool nothaw;
        static bool reenter = FALSE;
-       char jbuf[30];                  /* holds MyHostName */
+       char jbuf[60];                  /* holds MyHostName */
        extern bool safefile();
        extern time_t convtime();
        extern putheader(), putbody();
        extern bool safefile();
        extern time_t convtime();
        extern putheader(), putbody();
@@ -932,10 +932,14 @@ thaw(freezefile)
        char *freezefile;
 {
        int f;
        char *freezefile;
 {
        int f;
+       register char *p;
        union frz fhdr;
        union frz fhdr;
+       char hbuf[60];
        extern char edata, end;
        extern char Version[];
        extern caddr_t brk();
        extern char edata, end;
        extern char Version[];
        extern caddr_t brk();
+       extern char **myhostname();
+       extern char *macvalue();
 
        if (freezefile == NULL)
                return (FALSE);
 
        if (freezefile == NULL)
                return (FALSE);
@@ -985,7 +989,17 @@ thaw(freezefile)
        }
 
        (void) close(f);
        }
 
        (void) close(f);
-       return (TRUE);
+
+       /* verify that the host name was correct on the freeze */
+       (void) myhostname(hbuf, sizeof hbuf);
+       p = macvalue('w', CurEnv);
+       if (p == NULL)
+               p = "";
+       if (strcmp(hbuf, macvalue('w', CurEnv)) == 0)
+               return (TRUE);
+       syslog(LOG_WARNING, "Hostname changed since freeze (%s => %s)",
+               p, hbuf);
+       return (FALSE);
 }
 \f/*
 **  DISCONNECT -- remove our connection with any foreground process
 }
 \f/*
 **  DISCONNECT -- remove our connection with any foreground process
index 99db967..9592546 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  5.72 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  5.73 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "5.72";
+char   Version[] = "5.73";