+#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 fromlen;
+ struct sockaddr_in from;
+
+#ifndef VMS
+ fromlen = sizeof(from);
+ if (getpeername(0, &from, &fromlen) < 0) {
+ logent(Rmtname, "NOT A TCP CONNECTION");
+ omsg('R', "NOT TCP", Ofn);
+ cleanup(0);
+ }
+#else VMS
+ from.sin_addr.s_addr = Hostnumber;
+ from.sin_family = AF_INET;
+#endif VMS
+ 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(aliases)
+ * given its network number (remote machine) in our
+ * host table.
+ */
+ if (strncmp(q, hp->h_name, 7) == 0) {
+ if (Debug > 99)
+ logent(q,"Found in host Tables");
+ } else { /* Scan The host aliases */
+ for(alias=hp->h_aliases; *alias!=0 &&
+ strncmp(q, *alias, 7) != 0; ++alias)
+ ;
+ if (strncmp(q, *alias, 7) != 0) {
+ logent(q, "FORGED HOSTNAME");
+ logent(inet_ntoa(from.sin_addr), "ORIGINATED AT");
+ omsg('R',"You're not who you claim to be");
+ cleanup(0);
+ }
+#ifdef DEBUG
+ if (Debug> 99)
+ logent(q,"Found in host Tables");
+#endif
+ }
+ }
+#endif BSDTCP
+
+#ifdef NOSTRANGERS
+ /* If we don't know them, we won't talk to them... */
+ if (versys(Rmtname)) {
+ logent(Rmtname, "UNKNOWN HOST");
+ omsg('R', "You are unknown to me", Ofn);
+ cleanup(0);
+ }
+#endif NOSTRANGERS