Fixed two bugs, first not allowing '.' as a valid login name character

in okname() in util.c and second, returning != 0 when you do have an
error from okname in two places in rcp.c.

Thanks to Garrett for the POSIX defintion of valid login and group names.

PR:		bin/25757
MFC after:	3 weeks
This commit is contained in:
Jim Pirzyk 2001-05-30 16:19:13 +00:00
parent 47fe010cf3
commit af8dcd940f
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=77491
2 changed files with 7 additions and 3 deletions

View file

@ -310,8 +310,10 @@ toremote(targ, argc, argv)
suser = argv[i];
if (*suser == '\0')
suser = pwd->pw_name;
else if (!okname(suser))
else if (!okname(suser)) {
++errs;
continue;
}
(void)snprintf(bp, len,
"%s %s -l %s -n %s %s '%s%s%s:%s'",
_PATH_RSH, host, suser, cmd, src,
@ -391,8 +393,10 @@ tolocal(argc, argv)
suser = argv[i];
if (*suser == '\0')
suser = pwd->pw_name;
else if (!okname(suser))
else if (!okname(suser)) {
++errs;
continue;
}
}
len = strlen(src) + CMDNEEDS + 20;
if ((bp = malloc(len)) == NULL)

View file

@ -98,7 +98,7 @@ okname(cp0)
c = *cp;
if (c & 0200)
goto bad;
if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-')
if (!isalpha(c) && !isdigit(c) && c != '_' && c != '-' && c != '.' )
goto bad;
} while (*++cp);
return (1);