|
|
1.1 ! root 1: /* $Header: */ ! 2: ! 3: /* ! 4: * Copyright (c) 1986, 1987 Xerox Corporation. ! 5: */ ! 6: ! 7: /* contains: ! 8: * Auth_GetFirstAuth ! 9: */ ! 10: ! 11: /* $Log: Authlookup.c,v $ ! 12: * Revision 1.2 87/03/23 10:25:34 ed ! 13: * Minor change. ! 14: * ! 15: * Revision 1.1 87/01/05 11:50:16 ed ! 16: * Initial revision ! 17: * ! 18: */ ! 19: #include <stdio.h> ! 20: #include <sys/types.h> ! 21: #include <netns/ns.h> ! 22: #include <xnscourier/courier.h> ! 23: #include <xnscourier/courierconnection.h> ! 24: #include <xnscourier/except.h> ! 25: #include <sys/file.h> ! 26: ! 27: #ifndef BFS ! 28: #define BFS "/usr/new/xnsbfs -a" ! 29: #endif BFS ! 30: ! 31: struct ns_addr *chaddr; ! 32: ! 33: CourierConnection* ! 34: Auth_GetFirstAuth() ! 35: { ! 36: extern struct ns_addr *getXNSaddr(); ! 37: char buf[BUFSIZ]; ! 38: CourierConnection *result; ! 39: FILE *chfile; ! 40: int i; ! 41: ! 42: result = (CourierConnection *) NULL; ! 43: /* broadcast for Authentication server */ ! 44: /* -- this could be more efficient! */ ! 45: if ((chfile = popen(BFS,"r")) != NULL) { ! 46: while (fgets(buf, BUFSIZ, chfile) != NULL) ! 47: if ((buf[0] != '#') && ! 48: (chaddr = getXNSaddr(buf)) && ! 49: (result = CourierOpen(chaddr))) { ! 50: pclose(chfile); ! 51: return(result); ! 52: } ! 53: pclose(chfile); ! 54: } ! 55: return(result); ! 56: } ! 57:
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.