+ if (rhost == 0)
+ goto normal;
+ if (getuid()) {
+ rflag = 0;
+ goto normal;
+ }
+ setpwent();
+ pwd = getpwnam(lusername);
+ if (pwd == NULL) {
+ fprintf(stderr, "Login incorrect.\n");
+ exit(1);
+ }
+ endpwent();
+ hostf = fopen("/etc/hosts.equiv", "r");
+ again:
+ if (hostf) {
+ char ahost[32];
+ while (fgets(ahost, sizeof (ahost), hostf)) {
+ char *user;
+ if (index(ahost, '\n'))
+ *index(ahost, '\n') = 0;
+ user = index(ahost, ' ');
+ if (user)
+ *user++ = 0;
+ if (!strcmp(rhost, ahost) &&
+ !strcmp(rusername, user ? user : lusername))
+ goto normal;
+ }
+ fclose(hostf);
+ }
+ if (first == 1) {
+ first = 0;
+ if (chdir(pwd->pw_dir) < 0)
+ goto again;
+ hostf = fopen(".rhosts", "r");
+ goto again;
+ }
+ rhost = 0;
+ rflag = -1;