take underscore as well as space to separate parts of a person's
authorEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 17 Sep 1981 11:04:26 +0000 (03:04 -0800)
committerEric Allman <eric@ucbvax.Berkeley.EDU>
Thu, 17 Sep 1981 11:04:26 +0000 (03:04 -0800)
full name.  Dot notation should be made to work someday also.

SCCS-vsn: usr.sbin/sendmail/src/recipient.c 3.21
SCCS-vsn: usr.sbin/sendmail/src/version.c 3.33

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

index d7be218..73151ee 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.20    %G%";
+static char SccsId[] = "@(#)recipient.c        3.21    %G%";
 
 /*
 **  SENDTO -- Designate a send list.
 
 /*
 **  SENDTO -- Designate a send list.
@@ -232,6 +232,7 @@ recipient(a)
                        register struct passwd *pw;
                        extern struct passwd *finduser();
 
                        register struct passwd *pw;
                        extern struct passwd *finduser();
 
+                       /* warning -- finduser may trash buf */
                        pw = finduser(buf);
                        if (pw == NULL)
                        {
                        pw = finduser(buf);
                        if (pw == NULL)
                        {
@@ -269,7 +270,7 @@ recipient(a)
 **             NULL if name is unknown or ambiguous.
 **
 **     Side Effects:
 **             NULL if name is unknown or ambiguous.
 **
 **     Side Effects:
-**             none.
+**             may modify name.
 */
 
 struct passwd *
 */
 
 struct passwd *
@@ -278,25 +279,28 @@ finduser(name)
 {
        extern struct passwd *getpwent();
        register struct passwd *pw;
 {
        extern struct passwd *getpwent();
        register struct passwd *pw;
+       register char *p;
+
+       /*
+       **  Make name canonical.
+       */
+
+       for (p = name; *p != '\0'; p++)
+       {
+               if (*p == (SPACESUB & 0177) || *p == '_')
+                       *p = ' ';
+       }
 
        setpwent();
        while ((pw = getpwent()) != NULL)
        {
                char buf[MAXNAME];
 
        setpwent();
        while ((pw = getpwent()) != NULL)
        {
                char buf[MAXNAME];
-               register char *p;
                extern bool sameword();
                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; )
-               {
-                       *p++ = SPACESUB & 0177;
-                       gotaspace = TRUE;
-               }
-               if (gotaspace && sameword(buf, name))
+               if (index(buf, ' ') != NULL && sameword(buf, name))
                {
                        if (Verbose)
                                message(Arpa_Info, "sending to login name %s",
                {
                        if (Verbose)
                                message(Arpa_Info, "sending to login name %s",
index 216025d..2433980 100644 (file)
@@ -1,3 +1,3 @@
-static char    SccsId[] = "@(#)SendMail version 3.32 of %G%";
+static char    SccsId[] = "@(#)SendMail version 3.33 of %G%";
 
 
-char   Version[] = "3.32 [%G%]";
+char   Version[] = "3.33 [%G%]";