fix problem with address delimitor inside quotes; define $k and $=k
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 21 Jan 1993 05:22:05 +0000 (21:22 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 21 Jan 1993 05:22:05 +0000 (21:22 -0800)
to be the name (from the uname call)

SCCS-vsn: usr.sbin/sendmail/src/macro.c 6.3
SCCS-vsn: usr.sbin/sendmail/src/main.c 6.8
SCCS-vsn: usr.sbin/sendmail/src/conf.h 6.3
SCCS-vsn: usr.sbin/sendmail/src/parseaddr.c 6.9
SCCS-vsn: usr.sbin/sendmail/src/version.c 6.11
SCCS-vsn: usr.sbin/sendmail/src/conf.c 6.9

usr/src/usr.sbin/sendmail/src/conf.c
usr/src/usr.sbin/sendmail/src/conf.h
usr/src/usr.sbin/sendmail/src/macro.c
usr/src/usr.sbin/sendmail/src/main.c
usr/src/usr.sbin/sendmail/src/parseaddr.c
usr/src/usr.sbin/sendmail/src/version.c

index ceb93fa..cde6b78 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)conf.c     6.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)conf.c     6.9 (Berkeley) %G%";
 #endif /* not lint */
 
 # include <sys/ioctl.h>
 #endif /* not lint */
 
 # include <sys/ioctl.h>
@@ -846,3 +846,62 @@ getdtablesize()
 }
 
 #endif
 }
 
 #endif
+\f/*
+**  UNAME -- get the UUCP name of this system.
+*/
+
+#ifndef UNAME
+
+int
+uname(name)
+       struct utsname *name;
+{
+       FILE *file;
+       char *n;
+
+       name->nodename[0] = '\0';
+
+       if ((file = fopen("/etc/whoami", "r")) != NULL)
+       {
+               (void) fgets(name->nodename, NODE_LENGTH+1, file);
+               (void) fclose(file);
+               n = index(name->nodename, '\n');
+               if (n != NULL)
+                       *n = '\0';
+               if (name->nodename[0] != '\0')
+                       return (0);
+       }
+
+       if ((file = fopen("/usr/include/whoami.h", "r")) != NULL)
+       {
+               char buf[MAXLINE];
+
+               while (fgets(buf, MAXLINE, file) != NULL)
+                       if (sscanf(buf, "#define sysname \"%*[^\"]\"",
+                                       NODE_LENGTH, name->nodename) > 0)
+                               break;
+               (void) fclose(file);
+               if (name->nodename[0] != '\0')
+                       return (0);
+       }
+
+#ifdef TRUST_POPEN
+       /*
+       **  Popen is known to have security holes.
+       */
+
+       if ((file = popen("uuname -l", "r")) != NULL)
+       {
+               (void) fgets(name, NODE_LENGTH+1, file);
+               (void) pclose(file);
+               n = index(name, '\n');
+               if (n != NULL)
+                       *n = '\0';
+               if (name->nodename[0])
+                       return (0);
+       }
+#endif
+       
+       return (-1);
+}
+#endif /* UNAME */
index 6c78da3..31627f6 100644 (file)
@@ -5,7 +5,7 @@
  *
  * %sccs.include.redist.c%
  *
  *
  * %sccs.include.redist.c%
  *
- *     @(#)conf.h      6.2 (Berkeley) %G%
+ *     @(#)conf.h      6.3 (Berkeley) %G%
  */
 
 /*
  */
 
 /*
@@ -77,6 +77,7 @@
 
 # define LOCKF         1       /* use System V lockf instead of flock */
 # define SYS5TZ                1       /* use System V style timezones */
 
 # define LOCKF         1       /* use System V lockf instead of flock */
 # define SYS5TZ                1       /* use System V style timezones */
+# define UNAME         1       /* use System V uname system call */
 
 # endif
 
 
 # endif
 
 # define VA_END                va_end(ap)
 
 # endif
 # define VA_END                va_end(ap)
 
 # endif
+
+#ifdef UNAME
+# include <sys/utsname.h>
+# ifdef newstr
+#  undef newstr
+# endif
+#else /* ! UNAME */
+# define NODE_LENGTH 32
+struct utsname
+{
+       char nodename[NODE_LENGTH+1];
+};
+#endif /* UNAME */
index 6cce25a..2ce1f6e 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)macro.c    6.2 (Berkeley) %G%";
+static char sccsid[] = "@(#)macro.c    6.3 (Berkeley) %G%";
 #endif /* not lint */
 
 # include "sendmail.h"
 #endif /* not lint */
 
 # include "sendmail.h"
@@ -174,6 +174,7 @@ expand(s, buf, buflim, e)
 **             $h   to host
 **             $i   queue id
 **             $j   official SMTP hostname, used in messages+
 **             $h   to host
 **             $i   queue id
 **             $j   official SMTP hostname, used in messages+
+**             $k   UUCP node name
 **             $l   UNIX-style from line+
 **             $n   name of sendmail ("MAILER-DAEMON" on local
 **                  net typically)+
 **             $l   UNIX-style from line+
 **             $n   name of sendmail ("MAILER-DAEMON" on local
 **                  net typically)+
@@ -190,6 +191,7 @@ expand(s, buf, buflim, e)
 **             $x   signature (full name) of from person
 **             $y   the tty id of our terminal
 **             $z   home directory of to person
 **             $x   signature (full name) of from person
 **             $y   the tty id of our terminal
 **             $z   home directory of to person
+**             $<   the return path (sender in envelope) relative to recipient
 **
 **             Macros marked with + must be defined in the
 **             configuration file and are used internally, but
 **
 **             Macros marked with + must be defined in the
 **             configuration file and are used internally, but
index e3e2284..64689fc 100644 (file)
@@ -13,7 +13,7 @@ char copyright[] =
 #endif /* not lint */
 
 #ifndef lint
 #endif /* not lint */
 
 #ifndef lint
-static char sccsid[] = "@(#)main.c     6.7 (Berkeley) %G%";
+static char sccsid[] = "@(#)main.c     6.8 (Berkeley) %G%";
 #endif /* not lint */
 
 #define        _DEFINE
 #endif /* not lint */
 
 #define        _DEFINE
@@ -282,6 +282,7 @@ main(argc, argv, envp)
                av = myhostname(jbuf, sizeof jbuf);
                if (jbuf[0] != '\0')
                {
                av = myhostname(jbuf, sizeof jbuf);
                if (jbuf[0] != '\0')
                {
+                       struct  utsname utsname;
                        extern char *strchr();
 
                        if (tTd(0, 4))
                        extern char *strchr();
 
                        if (tTd(0, 4))
@@ -297,6 +298,19 @@ main(argc, argv, envp)
                                define('m', q, CurEnv);
                        }
                        setclass('w', p);
                                define('m', q, CurEnv);
                        }
                        setclass('w', p);
+
+                       if (uname(&utsname) >= 0)
+                               p = utsname.nodename;
+                       else
+                       {
+                               makelower(jbuf);
+                               p = jbuf;
+                       }
+                       if (tTd(0, 4))
+                               printf("UUCP nodename: %s\n", p);
+                       p = newstr(p);
+                       define('k', p, CurEnv);
+                       setclass('w', p);
                }
                while (av != NULL && *av != NULL)
                {
                }
                while (av != NULL && *av != NULL)
                {
index 268f9f5..59eea16 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)parseaddr.c        6.8 (Berkeley) %G%";
+static char sccsid[] = "@(#)parseaddr.c        6.9 (Berkeley) %G%";
 #endif /* not lint */
 
 #include "sendmail.h"
 #endif /* not lint */
 
 #include "sendmail.h"
@@ -425,8 +425,7 @@ prescan(addr, delim, pvpbuf)
 
                        /* read a new input character */
                        c = *p++;
 
                        /* read a new input character */
                        c = *p++;
-                       if (c == '\0' ||
-                           (c == delim && anglecnt <= 0 && cmntcnt <= 0))
+                       if (c == '\0')
                        {
                                /* diagnose and patch up bad syntax */
                                if (state == QST)
                        {
                                /* diagnose and patch up bad syntax */
                                if (state == QST)
@@ -449,6 +448,9 @@ prescan(addr, delim, pvpbuf)
 
                                p--;
                        }
 
                                p--;
                        }
+                       else if (c == delim && anglecnt <= 0 &&
+                                       cmntcnt <= 0 && state != QST)
+                               break;
 
                        if (tTd(22, 101))
                                printf("c=%c, s=%d; ", c, state);
 
                        if (tTd(22, 101))
                                printf("c=%c, s=%d; ", c, state);
index 52a75ac..b40c8af 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)version.c  6.10 (Berkeley) %G%";
+static char sccsid[] = "@(#)version.c  6.11 (Berkeley) %G%";
 #endif /* not lint */
 
 #endif /* not lint */
 
-char   Version[] = "ALPHA-6.10";
+char   Version[] = "ALPHA-6.11";