don't match on one-word gecos entries to avoid stealing mail
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 13 Sep 1981 13:54:44 +0000 (05:54 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Sun, 13 Sep 1981 13:54:44 +0000 (05:54 -0800)
SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.16

usr/src/usr.sbin/sendmail/src/recipient.c

index 62560ce..acece92 100644 (file)
@@ -3,7 +3,7 @@
 # include <sys/stat.h>
 # include "sendmail.h"
 
 # include <sys/stat.h>
 # include "sendmail.h"
 
-static char SccsId[] = "@(#)recipient.c        3.15    %G%";
+static char SccsId[] = "@(#)recipient.c        3.16    %G%";
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -264,16 +264,22 @@ finduser(name)
                char buf[MAXNAME];
                register char *p;
                extern bool sameword();
                char buf[MAXNAME];
                register char *p;
                extern bool sameword();
+               bool gotaspace;
 
                if (strcmp(pw->pw_name, name) == 0)
                        return (pw);
                buildfname(pw->pw_gecos, pw->pw_name, buf);
 
                if (strcmp(pw->pw_name, name) == 0)
                        return (pw);
                buildfname(pw->pw_gecos, pw->pw_name, buf);
+               gotaspace = FALSE;
                for (p = buf; (p = index(p, ' ')) != NULL; )
                for (p = buf; (p = index(p, ' ')) != NULL; )
+               {
                        *p++ = SPACESUB & 0177;
                        *p++ = SPACESUB & 0177;
-               if (sameword(buf, name))
+                       gotaspace = TRUE;
+               }
+               if (gotaspace && sameword(buf, name))
                {
                        if (Verbose)
                {
                        if (Verbose)
-                               message(Arpa_Info, "sending to login name %s", pw->pw_name);
+                               message(Arpa_Info, "sending to login name %s",
+                                   pw->pw_name);
                        return (pw);
                }
        }
                        return (pw);
                }
        }