122700Sdist /* 234920Sbostic * Copyright (c) 1983 Eric P. Allman 333780Sbostic * Copyright (c) 1988 Regents of the University of California. 433780Sbostic * All rights reserved. 533780Sbostic * 642825Sbostic * %sccs.include.redist.c% 733780Sbostic */ 822700Sdist 933932Sbostic #include <errno.h> 1040962Sbostic #include "sendmail.h" 114535Seric 1233780Sbostic #ifndef lint 1333780Sbostic #ifdef DAEMON 14*57736Seric static char sccsid[] = "@(#)daemon.c 6.4 (Berkeley) 01/28/93 (with daemon mode)"; 1533780Sbostic #else 16*57736Seric static char sccsid[] = "@(#)daemon.c 6.4 (Berkeley) 01/28/93 (without daemon mode)"; 1733780Sbostic #endif 1833780Sbostic #endif /* not lint */ 194535Seric 2033780Sbostic #ifdef DAEMON 2133780Sbostic 2223120Seric # include <netdb.h> 2324945Seric # include <sys/signal.h> 2423120Seric # include <sys/wait.h> 2523120Seric # include <sys/time.h> 2623120Seric # include <sys/resource.h> 275978Seric 284535Seric /* 294535Seric ** DAEMON.C -- routines to use when running as a daemon. 307556Seric ** 317556Seric ** This entire file is highly dependent on the 4.2 BSD 327556Seric ** interprocess communication primitives. No attempt has 337556Seric ** been made to make this file portable to Version 7, 347556Seric ** Version 6, MPX files, etc. If you should try such a 357556Seric ** thing yourself, I recommend chucking the entire file 367556Seric ** and starting from scratch. Basic semantics are: 377556Seric ** 387556Seric ** getrequests() 397556Seric ** Opens a port and initiates a connection. 407556Seric ** Returns in a child. Must set InChannel and 417556Seric ** OutChannel appropriately. 4210206Seric ** clrdaemon() 4310206Seric ** Close any open files associated with getting 4410206Seric ** the connection; this is used when running the queue, 4510206Seric ** etc., to avoid having extra file descriptors during 4610206Seric ** the queue run and to avoid confusing the network 4710206Seric ** code (if it cares). 4852106Seric ** makeconnection(host, port, outfile, infile, usesecureport) 497556Seric ** Make a connection to the named host on the given 507556Seric ** port. Set *outfile and *infile to the files 517556Seric ** appropriate for communication. Returns zero on 527556Seric ** success, else an exit status describing the 537556Seric ** error. 5456823Seric ** maphostname(map, hbuf, hbufsiz, avp) 5556823Seric ** Convert the entry in hbuf into a canonical form. 564535Seric */ 574535Seric /* 584535Seric ** GETREQUESTS -- open mail IPC port and get requests. 594535Seric ** 604535Seric ** Parameters: 614535Seric ** none. 624535Seric ** 634535Seric ** Returns: 644535Seric ** none. 654535Seric ** 664535Seric ** Side Effects: 674535Seric ** Waits until some interesting activity occurs. When 684535Seric ** it does, a child is created to process it, and the 694535Seric ** parent waits for completion. Return from this 709886Seric ** routine is always in the child. The file pointers 719886Seric ** "InChannel" and "OutChannel" should be set to point 729886Seric ** to the communication channel. 734535Seric */ 744535Seric 7516144Seric int DaemonSocket = -1; /* fd describing socket */ 7616144Seric 774535Seric getrequests() 784535Seric { 799610Seric int t; 809610Seric register struct servent *sp; 8125027Seric int on = 1; 8253751Seric bool refusingconnections = TRUE; 8352106Seric struct sockaddr_in srvraddr; 8446928Sbostic extern void reapchild(); 857117Seric 869610Seric /* 879610Seric ** Set up the address for the mailer. 889610Seric */ 899610Seric 909610Seric sp = getservbyname("smtp", "tcp"); 919610Seric if (sp == NULL) 929610Seric { 939610Seric syserr("server \"smtp\" unknown"); 9410167Seric goto severe; 959610Seric } 9652106Seric srvraddr.sin_family = AF_INET; 9752106Seric srvraddr.sin_addr.s_addr = INADDR_ANY; 9852106Seric srvraddr.sin_port = sp->s_port; 999610Seric 1009610Seric /* 1019610Seric ** Try to actually open the connection. 1029610Seric */ 1039610Seric 1049610Seric if (tTd(15, 1)) 10552106Seric printf("getrequests: port 0x%x\n", srvraddr.sin_port); 1069610Seric 1079610Seric /* get a socket for the SMTP connection */ 10823120Seric DaemonSocket = socket(AF_INET, SOCK_STREAM, 0); 10910206Seric if (DaemonSocket < 0) 1109610Seric { 1119610Seric /* probably another daemon already */ 1129610Seric syserr("getrequests: can't create socket"); 1139610Seric severe: 1149610Seric # ifdef LOG 1159610Seric if (LogLevel > 0) 11657663Seric syslog(LOG_ALERT, "problem creating SMTP socket"); 11756795Seric # endif /* LOG */ 1189610Seric finis(); 1199610Seric } 12010347Seric 12110347Seric /* turn on network debugging? */ 12256328Seric if (tTd(15, 101)) 12324945Seric (void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on); 12410347Seric 12525027Seric (void) setsockopt(DaemonSocket, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof on); 12625027Seric (void) setsockopt(DaemonSocket, SOL_SOCKET, SO_KEEPALIVE, (char *)&on, sizeof on); 12725027Seric 12852106Seric if (bind(DaemonSocket, (struct sockaddr *)&srvraddr, sizeof srvraddr) < 0) 1299610Seric { 1309610Seric syserr("getrequests: cannot bind"); 13110206Seric (void) close(DaemonSocket); 1329610Seric goto severe; 1339610Seric } 1349610Seric 13524955Seric (void) signal(SIGCHLD, reapchild); 13624945Seric 1379610Seric if (tTd(15, 1)) 13810206Seric printf("getrequests: %d\n", DaemonSocket); 1399610Seric 1404631Seric for (;;) 1414631Seric { 14214875Seric register int pid; 14311147Seric auto int lotherend; 14453751Seric extern bool refuseconnections(); 14511147Seric 14614875Seric /* see if we are rejecting connections */ 14753751Seric CurrentLA = getla(); 14853751Seric if (refuseconnections()) 14936584Sbostic { 15053751Seric if (!refusingconnections) 15153751Seric { 15253751Seric /* don't queue so peer will fail quickly */ 15353751Seric (void) listen(DaemonSocket, 0); 15453751Seric refusingconnections = TRUE; 15553751Seric } 15657385Seric setproctitle("rejecting connections: load average: %d", 15757385Seric CurrentLA); 15814875Seric sleep(5); 15953751Seric continue; 16036584Sbostic } 16114875Seric 16253751Seric if (refusingconnections) 16353751Seric { 16453751Seric /* start listening again */ 16553751Seric if (listen(DaemonSocket, 10) < 0) 16653751Seric { 16753751Seric syserr("getrequests: cannot listen"); 16853751Seric (void) close(DaemonSocket); 16953751Seric goto severe; 17053751Seric } 17153751Seric setproctitle("accepting connections"); 17253751Seric refusingconnections = FALSE; 17353751Seric } 17453751Seric 1759610Seric /* wait for a connection */ 1769610Seric do 1779610Seric { 1789610Seric errno = 0; 17936230Skarels lotherend = sizeof RealHostAddr; 18046928Sbostic t = accept(DaemonSocket, 18146928Sbostic (struct sockaddr *)&RealHostAddr, &lotherend); 1829610Seric } while (t < 0 && errno == EINTR); 1839610Seric if (t < 0) 1845978Seric { 1859610Seric syserr("getrequests: accept"); 1869610Seric sleep(5); 1879610Seric continue; 1885978Seric } 1894631Seric 1905978Seric /* 1915978Seric ** Create a subprocess to process the mail. 1925978Seric */ 1935978Seric 1947677Seric if (tTd(15, 2)) 1959610Seric printf("getrequests: forking (fd = %d)\n", t); 1965978Seric 1974636Seric pid = fork(); 1984636Seric if (pid < 0) 1994631Seric { 2004636Seric syserr("daemon: cannot fork"); 2014636Seric sleep(10); 2029610Seric (void) close(t); 2034636Seric continue; 2044631Seric } 2054631Seric 2064636Seric if (pid == 0) 2074631Seric { 20811147Seric extern struct hostent *gethostbyaddr(); 20911147Seric register struct hostent *hp; 21011147Seric char buf[MAXNAME]; 21157135Seric extern char *inet_ntoa(); 21211147Seric 2134636Seric /* 2144636Seric ** CHILD -- return to caller. 21511147Seric ** Collect verified idea of sending host. 2164636Seric ** Verify calling user id if possible here. 2174636Seric */ 2184631Seric 21924955Seric (void) signal(SIGCHLD, SIG_DFL); 22024950Seric 22111147Seric /* determine host name */ 22236230Skarels hp = gethostbyaddr((char *) &RealHostAddr.sin_addr, sizeof RealHostAddr.sin_addr, AF_INET); 22311147Seric if (hp != NULL) 22423104Seric (void) strcpy(buf, hp->h_name); 22511147Seric else 22616884Seric { 22716884Seric /* produce a dotted quad */ 22816884Seric (void) sprintf(buf, "[%s]", 22936230Skarels inet_ntoa(RealHostAddr.sin_addr)); 23016884Seric } 23116884Seric 23255173Seric #ifdef LOG 23355173Seric if (LogLevel > 9) 23455173Seric { 23555173Seric /* log connection information */ 23655173Seric syslog(LOG_INFO, "connect from %s (%s)", 23755173Seric buf, inet_ntoa(RealHostAddr.sin_addr)); 23855173Seric } 23955173Seric #endif 24055173Seric 24116884Seric /* should we check for illegal connection here? XXX */ 24216884Seric 24311147Seric RealHostName = newstr(buf); 24411147Seric 24510206Seric (void) close(DaemonSocket); 2469610Seric InChannel = fdopen(t, "r"); 24721062Seric OutChannel = fdopen(dup(t), "w"); 2487677Seric if (tTd(15, 2)) 2495978Seric printf("getreq: returning\n"); 2507876Seric # ifdef LOG 2517876Seric if (LogLevel > 11) 2527876Seric syslog(LOG_DEBUG, "connected, pid=%d", getpid()); 25356795Seric # endif /* LOG */ 2544636Seric return; 2554631Seric } 2564631Seric 2577117Seric /* close the port so that others will hang (for a while) */ 2589610Seric (void) close(t); 2594631Seric } 2609886Seric /*NOTREACHED*/ 2614631Seric } 2625978Seric /* 26310206Seric ** CLRDAEMON -- reset the daemon connection 26410206Seric ** 26510206Seric ** Parameters: 26610206Seric ** none. 26710206Seric ** 26810206Seric ** Returns: 26910206Seric ** none. 27010206Seric ** 27110206Seric ** Side Effects: 27210206Seric ** releases any resources used by the passive daemon. 27310206Seric */ 27410206Seric 27510206Seric clrdaemon() 27610206Seric { 27710206Seric if (DaemonSocket >= 0) 27810206Seric (void) close(DaemonSocket); 27910206Seric DaemonSocket = -1; 28010206Seric } 28110206Seric /* 2826039Seric ** MAKECONNECTION -- make a connection to an SMTP socket on another machine. 2836039Seric ** 2846039Seric ** Parameters: 2856039Seric ** host -- the name of the host. 2866633Seric ** port -- the port number to connect to. 28753739Seric ** mci -- a pointer to the mail connection information 28853739Seric ** structure to be filled in. 28952106Seric ** usesecureport -- if set, use a low numbered (reserved) 29052106Seric ** port to provide some rudimentary authentication. 2916039Seric ** 2926039Seric ** Returns: 2936039Seric ** An exit code telling whether the connection could be 2946039Seric ** made and if not why not. 2956039Seric ** 2966039Seric ** Side Effects: 2976039Seric ** none. 2986039Seric */ 2995978Seric 30054967Seric int 30153739Seric makeconnection(host, port, mci, usesecureport) 3026039Seric char *host; 3037286Seric u_short port; 30454967Seric register MCI *mci; 30552106Seric bool usesecureport; 3066039Seric { 30729430Sbloom register int i, s; 30829430Sbloom register struct hostent *hp = (struct hostent *)NULL; 30952106Seric struct sockaddr_in addr; 31052106Seric int sav_errno; 31129430Sbloom extern char *inet_ntoa(); 31235651Seric #ifdef NAMED_BIND 31335651Seric extern int h_errno; 31435651Seric #endif 3156039Seric 3166039Seric /* 3176039Seric ** Set up the address for the mailer. 3189308Seric ** Accept "[a.b.c.d]" syntax for host name. 3196039Seric */ 3206039Seric 32135651Seric #ifdef NAMED_BIND 32225475Smiriam h_errno = 0; 32335651Seric #endif 32425475Smiriam errno = 0; 32525475Smiriam 3269308Seric if (host[0] == '[') 3279308Seric { 32811147Seric long hid; 32956795Seric register char *p = strchr(host, ']'); 3309308Seric 33111147Seric if (p != NULL) 3329308Seric { 33311147Seric *p = '\0'; 33411147Seric hid = inet_addr(&host[1]); 33511147Seric *p = ']'; 3369308Seric } 33711147Seric if (p == NULL || hid == -1) 3389308Seric { 3399308Seric usrerr("Invalid numeric domain spec \"%s\"", host); 3409308Seric return (EX_NOHOST); 3419308Seric } 34252106Seric addr.sin_addr.s_addr = hid; 3439308Seric } 3449610Seric else 3459610Seric { 34629430Sbloom hp = gethostbyname(host); 34725475Smiriam if (hp == NULL) 34824945Seric { 34935651Seric #ifdef NAMED_BIND 35025475Smiriam if (errno == ETIMEDOUT || h_errno == TRY_AGAIN) 35125475Smiriam return (EX_TEMPFAIL); 35225657Seric 35335651Seric /* if name server is specified, assume temp fail */ 35435651Seric if (errno == ECONNREFUSED && UseNameServer) 35535651Seric return (EX_TEMPFAIL); 35635651Seric #endif 35735651Seric 35825657Seric /* 35925657Seric ** XXX Should look for mail forwarder record here 36025657Seric ** XXX if (h_errno == NO_ADDRESS). 36125657Seric */ 36225657Seric 36325475Smiriam return (EX_NOHOST); 36424945Seric } 36552106Seric bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length); 36629430Sbloom i = 1; 3679610Seric } 3689610Seric 3699610Seric /* 3709610Seric ** Determine the port number. 3719610Seric */ 3729610Seric 37310011Seric if (port != 0) 37452106Seric addr.sin_port = htons(port); 37510011Seric else 3769610Seric { 3779610Seric register struct servent *sp = getservbyname("smtp", "tcp"); 3789610Seric 3799610Seric if (sp == NULL) 3809610Seric { 3819610Seric syserr("makeconnection: server \"smtp\" unknown"); 3829610Seric return (EX_OSFILE); 3839610Seric } 38452106Seric addr.sin_port = sp->s_port; 3859610Seric } 3866039Seric 3876039Seric /* 3886039Seric ** Try to actually open the connection. 3896039Seric */ 3906039Seric 391*57736Seric for (;;) 39252106Seric { 393*57736Seric if (tTd(16, 1)) 394*57736Seric printf("makeconnection (%s [%s])\n", host, 395*57736Seric inet_ntoa(addr.sin_addr)); 39652106Seric 397*57736Seric if (usesecureport) 398*57736Seric { 399*57736Seric int rport = IPPORT_RESERVED - 1; 4006039Seric 401*57736Seric s = rresvport(&rport); 402*57736Seric } 403*57736Seric else 404*57736Seric { 405*57736Seric s = socket(AF_INET, SOCK_STREAM, 0); 406*57736Seric } 407*57736Seric if (s < 0) 408*57736Seric { 409*57736Seric sav_errno = errno; 410*57736Seric syserr("makeconnection: no socket"); 411*57736Seric goto failure; 412*57736Seric } 41310347Seric 414*57736Seric if (tTd(16, 1)) 415*57736Seric printf("makeconnection: fd=%d\n", s); 416*57736Seric 417*57736Seric /* turn on network debugging? */ 418*57736Seric if (tTd(16, 101)) 419*57736Seric { 420*57736Seric int on = 1; 421*57736Seric (void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, 422*57736Seric (char *)&on, sizeof on); 423*57736Seric } 424*57736Seric if (CurEnv->e_xfp != NULL) 425*57736Seric (void) fflush(CurEnv->e_xfp); /* for debugging */ 426*57736Seric errno = 0; /* for debugging */ 427*57736Seric addr.sin_family = AF_INET; 428*57736Seric if (connect(s, (struct sockaddr *) &addr, sizeof addr) >= 0) 429*57736Seric break; 430*57736Seric 431*57736Seric /* couldn't connect.... figure out why */ 43227744Sbloom sav_errno = errno; 43327744Sbloom (void) close(s); 43429430Sbloom if (hp && hp->h_addr_list[i]) 43529430Sbloom { 436*57736Seric if (tTd(16, 1)) 437*57736Seric printf("Connect failed; trying new address....\n"); 43852106Seric bcopy(hp->h_addr_list[i++], (char *) &addr.sin_addr, 43952106Seric hp->h_length); 440*57736Seric continue; 44129430Sbloom } 44229430Sbloom 4436039Seric /* failure, decide if temporary or not */ 4446039Seric failure: 44527744Sbloom switch (sav_errno) 4466039Seric { 4476039Seric case EISCONN: 4486039Seric case ETIMEDOUT: 4496897Seric case EINPROGRESS: 4506897Seric case EALREADY: 4516897Seric case EADDRINUSE: 45210123Seric case EHOSTDOWN: 4536897Seric case ENETDOWN: 4546897Seric case ENETRESET: 4556897Seric case ENOBUFS: 4567204Seric case ECONNREFUSED: 45711546Seric case ECONNRESET: 45810081Seric case EHOSTUNREACH: 45910098Seric case ENETUNREACH: 46051995Seric #ifdef ENOSR 46151995Seric case ENOSR: 46251995Seric #endif 4636039Seric /* there are others, I'm sure..... */ 4646039Seric return (EX_TEMPFAIL); 4656039Seric 46611147Seric case EPERM: 46711147Seric /* why is this happening? */ 46811147Seric syserr("makeconnection: funny failure, addr=%lx, port=%x", 46952106Seric addr.sin_addr.s_addr, addr.sin_port); 47014383Seric return (EX_TEMPFAIL); 47111147Seric 4726039Seric default: 47340932Srick { 47440932Srick extern char *errstring(); 47540932Srick 47640932Srick message(Arpa_Info, "%s", errstring(sav_errno)); 47740932Srick return (EX_UNAVAILABLE); 47840932Srick } 4796039Seric } 4806039Seric } 4816039Seric 4826039Seric /* connection ok, put it into canonical form */ 48353739Seric mci->mci_out = fdopen(s, "w"); 48453739Seric mci->mci_in = fdopen(dup(s), "r"); 4856039Seric 48610098Seric return (EX_OK); 4876039Seric } 48810758Seric /* 48910758Seric ** MYHOSTNAME -- return the name of this host. 49010758Seric ** 49110758Seric ** Parameters: 49210758Seric ** hostbuf -- a place to return the name of this host. 49312313Seric ** size -- the size of hostbuf. 49410758Seric ** 49510758Seric ** Returns: 49610758Seric ** A list of aliases for this host. 49710758Seric ** 49810758Seric ** Side Effects: 49910758Seric ** none. 50010758Seric */ 5016039Seric 50210758Seric char ** 50312313Seric myhostname(hostbuf, size) 50410758Seric char hostbuf[]; 50512313Seric int size; 50610758Seric { 50710758Seric extern struct hostent *gethostbyname(); 50811147Seric struct hostent *hp; 50910758Seric 51023120Seric if (gethostname(hostbuf, size) < 0) 51123120Seric { 51223120Seric (void) strcpy(hostbuf, "localhost"); 51323120Seric } 51411147Seric hp = gethostbyname(hostbuf); 51511147Seric if (hp != NULL) 51616877Seric { 51723104Seric (void) strcpy(hostbuf, hp->h_name); 51811147Seric return (hp->h_aliases); 51916877Seric } 52010758Seric else 52110758Seric return (NULL); 52210758Seric } 52351315Seric /* 52453751Seric ** MAPHOSTNAME -- turn a hostname into canonical form 52553751Seric ** 52653751Seric ** Parameters: 52756823Seric ** map -- a pointer to this map (unused). 52853751Seric ** hbuf -- a buffer containing a hostname. 52953751Seric ** hbsize -- the size of hbuf. 53055019Seric ** avp -- unused -- for compatibility with other mapping 53155019Seric ** functions. 53253751Seric ** 53353751Seric ** Returns: 53453751Seric ** The mapping, if found. 53553751Seric ** NULL if no mapping found. 53653751Seric ** 53753751Seric ** Side Effects: 53853751Seric ** Looks up the host specified in hbuf. If it is not 53953751Seric ** the canonical name for that host, return the canonical 54053751Seric ** name. 54153751Seric */ 54251315Seric 54353751Seric char * 54456823Seric maphostname(map, hbuf, hbsize, avp) 54556823Seric MAP *map; 54616911Seric char *hbuf; 54716911Seric int hbsize; 54853751Seric char **avp; 54916911Seric { 55016911Seric register struct hostent *hp; 55133932Sbostic u_long in_addr; 55256823Seric char *cp; 55333932Sbostic struct hostent *gethostbyaddr(); 55416911Seric 55556836Seric /* allow room for null */ 55656823Seric hbsize--; 55753751Seric 55825574Smiriam /* 55933932Sbostic * If first character is a bracket, then it is an address 56033932Sbostic * lookup. Address is copied into a temporary buffer to 56133932Sbostic * strip the brackets and to preserve hbuf if address is 56233932Sbostic * unknown. 56333932Sbostic */ 56453751Seric 56551315Seric if (*hbuf != '[') 56653751Seric { 56755019Seric extern bool getcanonname(); 56855019Seric 56953751Seric if (getcanonname(hbuf, hbsize)) 57053751Seric return hbuf; 57153751Seric else 57253751Seric return NULL; 57353751Seric } 57456823Seric if ((cp = strchr(hbuf, ']')) == NULL) 57553751Seric return (NULL); 57640994Sbostic *cp = '\0'; 57756823Seric in_addr = inet_addr(&hbuf[1]); 57833932Sbostic hp = gethostbyaddr((char *)&in_addr, sizeof(struct in_addr), AF_INET); 57933932Sbostic if (hp == NULL) 58053751Seric return (NULL); 58153751Seric 58253751Seric /* found a match -- copy and dot terminate */ 58356823Seric if (strlen(hp->h_name) > hbsize) 58456823Seric hp->h_name[hbsize] = '\0'; 58553751Seric (void) strcpy(hbuf, hp->h_name); 58653751Seric return hbuf; 58733932Sbostic } 58816911Seric 58956795Seric # else /* DAEMON */ 59016911Seric /* code for systems without sophisticated networking */ 59110758Seric 59210758Seric /* 59310758Seric ** MYHOSTNAME -- stub version for case of no daemon code. 59411297Seric ** 59511297Seric ** Can't convert to upper case here because might be a UUCP name. 59612313Seric ** 59712313Seric ** Mark, you can change this to be anything you want...... 59810758Seric */ 59910758Seric 60010758Seric char ** 60112313Seric myhostname(hostbuf, size) 60210758Seric char hostbuf[]; 60312313Seric int size; 60410758Seric { 60510758Seric register FILE *f; 60610758Seric 60710758Seric hostbuf[0] = '\0'; 60810758Seric f = fopen("/usr/include/whoami", "r"); 60910758Seric if (f != NULL) 61010758Seric { 61112313Seric (void) fgets(hostbuf, size, f); 61210758Seric fixcrlf(hostbuf, TRUE); 61310758Seric (void) fclose(f); 61410758Seric } 61510758Seric return (NULL); 61610758Seric } 61716911Seric /* 61816911Seric ** MAPHOSTNAME -- turn a hostname into canonical form 61916911Seric ** 62016911Seric ** Parameters: 62156823Seric ** map -- a pointer to the database map. 62216911Seric ** hbuf -- a buffer containing a hostname. 62353751Seric ** avp -- a pointer to a (cf file defined) argument vector. 62416911Seric ** 62516911Seric ** Returns: 62653751Seric ** mapped host name 62751315Seric ** FALSE otherwise. 62816911Seric ** 62916911Seric ** Side Effects: 63016911Seric ** Looks up the host specified in hbuf. If it is not 63116911Seric ** the canonical name for that host, replace it with 63216911Seric ** the canonical name. If the name is unknown, or it 63316911Seric ** is already the canonical name, leave it unchanged. 63416911Seric */ 63510758Seric 63616911Seric /*ARGSUSED*/ 63753751Seric char * 63856823Seric maphostname(map, hbuf, hbsize, avp) 63956823Seric MAP *map; 64016911Seric char *hbuf; 64116911Seric int hbsize; 64253751Seric char **avp; 64316911Seric { 64453751Seric return NULL; 64516911Seric } 64616911Seric 64756795Seric #endif /* DAEMON */ 648