Summarily enable YP as soon as any a '+' is detected instead of generating

special values when +user substitutions are in effect. The new getpwent
code can handle all the special cases itself now.
This commit is contained in:
Bill Paul 1995-03-23 17:22:37 +00:00
parent a1c6084710
commit 34876b9137
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=7277

View File

@ -179,13 +179,8 @@ main(argc, argv)
data.data = (u_char *)buf; data.data = (u_char *)buf;
key.data = (u_char *)tbuf; key.data = (u_char *)tbuf;
for (cnt = 1; scan(fp, &pwd); ++cnt) { for (cnt = 1; scan(fp, &pwd); ++cnt) {
if(pwd.pw_name[0] == '+') { if(pwd.pw_name[0] == '+')
if(pwd.pw_name[1] && !yp_enabled) { yp_enabled = 1;
yp_enabled = 1;
} else if(!pwd.pw_name[1]) {
yp_enabled = -1;
}
}
#define COMPACT(e) t = e; while (*p++ = *t++); #define COMPACT(e) t = e; while (*p++ = *t++);
/* Create insecure data. */ /* Create insecure data. */
p = buf; p = buf;
@ -231,7 +226,7 @@ main(argc, argv)
/* Store insecure special plus and special minus */ /* Store insecure special plus and special minus */
if ((pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-') if ((pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-')
&& pwd.pw_name[1] == '@') { && pwd.pw_name[1]) {
tbuf[0] = (pwd.pw_name[0] == '+') ? tbuf[0] = (pwd.pw_name[0] == '+') ?
_PW_KEYPLUSBYNUM : _PW_KEYMINUSBYNUM; _PW_KEYPLUSBYNUM : _PW_KEYMINUSBYNUM;
memmove(tbuf + 1, (pwd.pw_name[0] == '+') ? memmove(tbuf + 1, (pwd.pw_name[0] == '+') ?
@ -341,7 +336,7 @@ main(argc, argv)
/* Store secure special plus and special minus */ /* Store secure special plus and special minus */
if ((pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-') if ((pwd.pw_name[0] == '+' || pwd.pw_name[0] == '-')
&& pwd.pw_name[1] == '@') { && pwd.pw_name[1]) {
tbuf[0] = (pwd.pw_name[0] == '+') ? tbuf[0] = (pwd.pw_name[0] == '+') ?
_PW_KEYPLUSBYNUM : _PW_KEYMINUSBYNUM; _PW_KEYPLUSBYNUM : _PW_KEYMINUSBYNUM;
memmove(tbuf + 1, (pwd.pw_name[0] == '+') ? memmove(tbuf + 1, (pwd.pw_name[0] == '+') ?