|
|
DataMuseum.dkPresents historical artifacts from the history of: DKUUG/EUUG Conference tapes |
This is an automatic "excavation" of a thematic subset of
See our Wiki for more about DKUUG/EUUG Conference tapes Excavated with: AutoArchaeologist - Free & Open Source Software. |
top - metrics - downloadIndex: T i
Length: 1677 (0x68d)
Types: TextFile
Names: »identify.c«
└─⟦87ddcff64⟧ Bits:30001253 CPHDIST85 Tape, 1985 Autumn Conference Copenhagen
└─⟦this⟧ »cph85dist/rman/daemon/identify.c«
/*
* Copyright (c) 1985 Jonathan C. Broome and The Regents of the
* University of California.
*
* This software may be freely redistributed without licensing
* provided that this copyright notice remains intact and no profit
* is gained through any redistribution.
*
* Please report any bug fixes or modifications to the author at:
*
* broome@ucb-vax.berkeley.edu
* or:
* ...!ucbvax!broome
*
* The author and the Regents assume no liability for any damages
* or loss of revenue caused directly or indirectly by the use of
* this software.
*/
#include "defs.h"
#include <stdio.h>
#include <sys/types.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>
#ifndef HOSTFILE
#define HOSTFILE "/usr/lib/mand.hosts"
#endif
/*
* Determine the calling host's cpu type if possible, then initialize it.
* If the host is unknown, set to "generic".
* Returns 1 if host is unknown - used if identity checking is strict.
*/
identify (sin)
struct sockaddr_in sin;
{
char **argv = (char **) 0;
char *addr;
char *inet_ntoa();
char line[256];
int found = 0;
FILE *fp;
addr = inet_ntoa (sin.sin_addr.s_addr);
if (fp = fopen (HOSTFILE, "r")) {
while (getline (line, 256, fp)) {
if (parse (line, &argv) == 0)
continue;
if (eq (argv[0], addr)) {
found = 1;
break;
}
}
(void) fclose (fp);
}
if (switchtype (found ? argv[1] : "generic") && found)
switchtype ("generic");
parse ("", &argv); /* free up memory */
return (!found);
}