Annotation of researchv10no/netfs/libnetb/bsdgetpeer.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * who called me over a socket, 4BSD-style
        !             3:  */
        !             4: 
        !             5: #include <sys/types.h>
        !             6: #include <sys/socket.h>
        !             7: #include <netinet/in.h>
        !             8: #include <netdb.h>
        !             9: 
        !            10: char *
        !            11: _rfbsdpeer(f)
        !            12: int f;
        !            13: {
        !            14:        register struct hostent *hp;
        !            15:        int len;
        !            16:        struct sockaddr_in s;
        !            17: 
        !            18:        /*
        !            19:         * sleaze away, as UCB code usually does:
        !            20:         * assume it's internet family in various places
        !            21:         */
        !            22:        len = sizeof(s);
        !            23:        if (getpeername(f, &s, &len) < 0)
        !            24:                return (0);
        !            25:        if ((hp = gethostbyaddr(&s.sin_addr, sizeof(struct in_addr), s.sin_family)) == 0)
        !            26:                return (0);
        !            27:        return (hp->h_name);
        !            28: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.