+ /* The versys will also do an alias on the incoming name */
+ if (versys(&Rmtname)) {
+ /* If we don't know them, we won't talk to them... */
+#ifdef NOSTRANGERS
+ logent(Rmtname, "UNKNOWN HOST");
+ omsg('R', "You are unknown to me", Ofn);
+ cleanup(0);
+#endif NOSTRANGERS
+ }
+#ifdef BSDTCP
+ /* we must make sure they are really who they say they
+ * are. We compare the hostnumber with the number in the hosts
+ * table for the site they claim to be.
+ */
+ if (IsTcpIp) {
+ struct hostent *hp;
+ char *cpnt, *inet_ntoa();
+ int len;
+ struct sockaddr_in from;
+ extern char PhoneNumber[];
+
+#ifdef NOGETPEER
+ from.sin_addr.s_addr = Hostnumber;
+ from.sin_family = AF_INET;
+#else !NOGETPEER
+ len = sizeof(from);
+ if (getpeername(0, &from, &len) < 0) {
+ logent(Rmtname, "NOT A TCP CONNECTION");
+ omsg('R', "NOT TCP", Ofn);
+ cleanup(0);
+ }
+#endif !NOGETPEER
+ hp = gethostbyaddr(&from.sin_addr,
+ sizeof (struct in_addr), from.sin_family);
+ if (hp == 0) {
+ /* security break or just old host table? */
+ logent(Rmtname, "UNKNOWN IP-HOST Name =");
+ cpnt = inet_ntoa(from.sin_addr),
+ logent(cpnt, "UNKNOWN IP-HOST Number =");
+ sprintf(wkpre, "%s/%s isn't in my host table",
+ Rmtname, cpnt);
+ omsg('R' ,wkpre ,Ofn);
+ cleanup(0);
+ }
+ if (Debug>99)
+ logent(Rmtname,"Request from IP-Host name =");
+ /*
+ * The following is to determine if the name given us by
+ * the Remote uucico matches any of the names
+ * given its network number (remote machine) in our
+ * host table.
+ * We could check the aliases, but that won't work in
+ * all cases (like if you are running the domain
+ * server, where you don't get any aliases). The only
+ * reliable way I can think of that works in ALL cases
+ * is too look up the site in L.sys and see if the
+ * sitename matches what we would call him if we
+ * originated the call.
+ */
+ /* PhoneNumber contains the official network name of the host we are checking. (set in versys.c) */
+ if (sncncmp(PhoneNumber, hp->h_name, SYSNSIZE) == 0) {
+ if (Debug > 99)
+ logent(q,"Found in host Tables");
+ } else {
+ logent(hp->h_name, "FORGED HOSTNAME");
+ logent(inet_ntoa(from.sin_addr), "ORIGINATED AT");
+ logent(PhoneNumber, "SHOULD BE");
+ sprintf(wkpre, "You're not who you claim to be: %s != %s", hp->h_name, PhoneNumber);
+ omsg('R', wkpre, Ofn);
+ cleanup(0);
+ }
+ }
+#endif BSDTCP
+
+ if (mlock(Rmtname) == FAIL) {