|
|
1.1 ! root 1: #include <syslog.h> ! 2: #include <sys/types.h> ! 3: #include <sys/socket.h> ! 4: ! 5: #include "../common/conf.h" ! 6: ! 7: #ifdef DECNET ! 8: ! 9: #ifndef lint ! 10: static char *sccsid = "@(#)access_dnet.c 1.4 (Berkeley) 10/22/87"; ! 11: #endif ! 12: ! 13: ! 14: /* ! 15: * dnet_netnames -- return the network, subnet, and host names of ! 16: * our peer process for the DECnet domain. Since DECnet doesn't ! 17: * have subnets, we always return "subnet_name"'s first char as '\0'; ! 18: * ! 19: * Parameters: "sock" is the socket connect to our peer. ! 20: * "sap" is a pointer to the result of ! 21: * a getpeername() call. ! 22: * "net_name", "subnet_name", and "host_name" ! 23: * are filled in by this routine with the ! 24: * corresponding ASCII names of our peer. ! 25: * Returns: Nothing. ! 26: * Side effects: None. ! 27: */ ! 28: ! 29: dnet_netnames(sock, sap, net_name, subnet_name, host_name) ! 30: int sock; ! 31: struct sockaddr *sap; ! 32: char *net_name; ! 33: char *subnet_name; ! 34: char *host_name; ! 35: { ! 36: char *cp; ! 37: struct linger l; ! 38: char *getenv(); ! 39: ! 40: cp = getenv("NETWORK"); ! 41: (void) strcpy(net_name, cp ? cp : "DECnet"); ! 42: ! 43: cp = getenv("REMNODE"); ! 44: (void) strcpy(host_name, cp ? cp : "unknown"); ! 45: ! 46: *subnet_name = '\0'; ! 47: ! 48: /* ! 49: * Give decnet a chance to flush its buffers before the ! 50: * link is killed. ! 51: */ ! 52: ! 53: l.l_onoff = 1; /* on */ ! 54: l.l_linger = 15; /* seconds */ ! 55: ! 56: if (setsockopt(sock, SOL_SOCKET, SO_LINGER, (char *) &l, ! 57: sizeof (l)) < 0) { ! 58: #ifdef LOG ! 59: syslog(LOG_ERR, ! 60: "access_dnet: setsockopt SOL_SOCKET SO_LINGER: %m"); ! 61: #endif ! 62: } ! 63: } ! 64: #endif
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.