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:
wpaul 1995-03-23 17:22:37 +00:00
parent 0e5a707fe6
commit f1a6a16e95

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] == '+') ?