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*56823Seric static char sccsid[] = "@(#)daemon.c 5.52 (Berkeley) 11/15/92 (with daemon mode)"; 1533780Sbostic #else 16*56823Seric static char sccsid[] = "@(#)daemon.c 5.52 (Berkeley) 11/15/92 (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. 54*56823Seric ** maphostname(map, hbuf, hbufsiz, avp) 55*56823Seric ** 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) 11624858Seric syslog(LOG_ALERT, "cannot get connection"); 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 } 15653751Seric setproctitle("rejecting connections: load average: %.2f", 15753751Seric (double)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]; 21111147Seric 2124636Seric /* 2134636Seric ** CHILD -- return to caller. 21411147Seric ** Collect verified idea of sending host. 2154636Seric ** Verify calling user id if possible here. 2164636Seric */ 2174631Seric 21824955Seric (void) signal(SIGCHLD, SIG_DFL); 21924950Seric 22011147Seric /* determine host name */ 22136230Skarels hp = gethostbyaddr((char *) &RealHostAddr.sin_addr, sizeof RealHostAddr.sin_addr, AF_INET); 22211147Seric if (hp != NULL) 22323104Seric (void) strcpy(buf, hp->h_name); 22411147Seric else 22516884Seric { 22616884Seric extern char *inet_ntoa(); 22716884Seric 22816884Seric /* produce a dotted quad */ 22916884Seric (void) sprintf(buf, "[%s]", 23036230Skarels inet_ntoa(RealHostAddr.sin_addr)); 23116884Seric } 23216884Seric 23355173Seric #ifdef LOG 23455173Seric if (LogLevel > 9) 23555173Seric { 23655173Seric /* log connection information */ 23755173Seric syslog(LOG_INFO, "connect from %s (%s)", 23855173Seric buf, inet_ntoa(RealHostAddr.sin_addr)); 23955173Seric } 24055173Seric #endif 24155173Seric 24216884Seric /* should we check for illegal connection here? XXX */ 24316884Seric 24411147Seric RealHostName = newstr(buf); 24511147Seric 24610206Seric (void) close(DaemonSocket); 2479610Seric InChannel = fdopen(t, "r"); 24821062Seric OutChannel = fdopen(dup(t), "w"); 2497677Seric if (tTd(15, 2)) 2505978Seric printf("getreq: returning\n"); 2517876Seric # ifdef LOG 2527876Seric if (LogLevel > 11) 2537876Seric syslog(LOG_DEBUG, "connected, pid=%d", getpid()); 25456795Seric # endif /* LOG */ 2554636Seric return; 2564631Seric } 2574631Seric 2587117Seric /* close the port so that others will hang (for a while) */ 2599610Seric (void) close(t); 2604631Seric } 2619886Seric /*NOTREACHED*/ 2624631Seric } 2635978Seric /* 26410206Seric ** CLRDAEMON -- reset the daemon connection 26510206Seric ** 26610206Seric ** Parameters: 26710206Seric ** none. 26810206Seric ** 26910206Seric ** Returns: 27010206Seric ** none. 27110206Seric ** 27210206Seric ** Side Effects: 27310206Seric ** releases any resources used by the passive daemon. 27410206Seric */ 27510206Seric 27610206Seric clrdaemon() 27710206Seric { 27810206Seric if (DaemonSocket >= 0) 27910206Seric (void) close(DaemonSocket); 28010206Seric DaemonSocket = -1; 28110206Seric } 28210206Seric /* 2836039Seric ** MAKECONNECTION -- make a connection to an SMTP socket on another machine. 2846039Seric ** 2856039Seric ** Parameters: 2866039Seric ** host -- the name of the host. 2876633Seric ** port -- the port number to connect to. 28853739Seric ** mci -- a pointer to the mail connection information 28953739Seric ** structure to be filled in. 29052106Seric ** usesecureport -- if set, use a low numbered (reserved) 29152106Seric ** port to provide some rudimentary authentication. 2926039Seric ** 2936039Seric ** Returns: 2946039Seric ** An exit code telling whether the connection could be 2956039Seric ** made and if not why not. 2966039Seric ** 2976039Seric ** Side Effects: 2986039Seric ** none. 2996039Seric */ 3005978Seric 30154967Seric int 30253739Seric makeconnection(host, port, mci, usesecureport) 3036039Seric char *host; 3047286Seric u_short port; 30554967Seric register MCI *mci; 30652106Seric bool usesecureport; 3076039Seric { 30829430Sbloom register int i, s; 30929430Sbloom register struct hostent *hp = (struct hostent *)NULL; 31052106Seric struct sockaddr_in addr; 31152106Seric int sav_errno; 31229430Sbloom extern char *inet_ntoa(); 31335651Seric #ifdef NAMED_BIND 31435651Seric extern int h_errno; 31535651Seric #endif 3166039Seric 3176039Seric /* 3186039Seric ** Set up the address for the mailer. 3199308Seric ** Accept "[a.b.c.d]" syntax for host name. 3206039Seric */ 3216039Seric 32235651Seric #ifdef NAMED_BIND 32325475Smiriam h_errno = 0; 32435651Seric #endif 32525475Smiriam errno = 0; 32625475Smiriam 3279308Seric if (host[0] == '[') 3289308Seric { 32911147Seric long hid; 33056795Seric register char *p = strchr(host, ']'); 3319308Seric 33211147Seric if (p != NULL) 3339308Seric { 33411147Seric *p = '\0'; 33511147Seric hid = inet_addr(&host[1]); 33611147Seric *p = ']'; 3379308Seric } 33811147Seric if (p == NULL || hid == -1) 3399308Seric { 3409308Seric usrerr("Invalid numeric domain spec \"%s\"", host); 3419308Seric return (EX_NOHOST); 3429308Seric } 34352106Seric addr.sin_addr.s_addr = hid; 3449308Seric } 3459610Seric else 3469610Seric { 34729430Sbloom hp = gethostbyname(host); 34825475Smiriam if (hp == NULL) 34924945Seric { 35035651Seric #ifdef NAMED_BIND 35125475Smiriam if (errno == ETIMEDOUT || h_errno == TRY_AGAIN) 35225475Smiriam return (EX_TEMPFAIL); 35325657Seric 35435651Seric /* if name server is specified, assume temp fail */ 35535651Seric if (errno == ECONNREFUSED && UseNameServer) 35635651Seric return (EX_TEMPFAIL); 35735651Seric #endif 35835651Seric 35925657Seric /* 36025657Seric ** XXX Should look for mail forwarder record here 36125657Seric ** XXX if (h_errno == NO_ADDRESS). 36225657Seric */ 36325657Seric 36425475Smiriam return (EX_NOHOST); 36524945Seric } 36652106Seric bcopy(hp->h_addr, (char *) &addr.sin_addr, hp->h_length); 36729430Sbloom i = 1; 3689610Seric } 3699610Seric 3709610Seric /* 3719610Seric ** Determine the port number. 3729610Seric */ 3739610Seric 37410011Seric if (port != 0) 37552106Seric addr.sin_port = htons(port); 37610011Seric else 3779610Seric { 3789610Seric register struct servent *sp = getservbyname("smtp", "tcp"); 3799610Seric 3809610Seric if (sp == NULL) 3819610Seric { 3829610Seric syserr("makeconnection: server \"smtp\" unknown"); 3839610Seric return (EX_OSFILE); 3849610Seric } 38552106Seric addr.sin_port = sp->s_port; 3869610Seric } 3876039Seric 3886039Seric /* 3896039Seric ** Try to actually open the connection. 3906039Seric */ 3916039Seric 39229430Sbloom again: 3937677Seric if (tTd(16, 1)) 39429430Sbloom printf("makeconnection (%s [%s])\n", host, 39552106Seric inet_ntoa(addr.sin_addr)); 3966039Seric 39752106Seric if (usesecureport) 39852106Seric { 39952106Seric int rport = IPPORT_RESERVED - 1; 40052106Seric 40152106Seric s = rresvport(&rport); 40252106Seric } 40352106Seric else 40452106Seric { 40552106Seric s = socket(AF_INET, SOCK_STREAM, 0); 40652106Seric } 4076039Seric if (s < 0) 4086039Seric { 40952106Seric sav_errno = errno; 4106039Seric syserr("makeconnection: no socket"); 4116039Seric goto failure; 4126039Seric } 4136039Seric 4147677Seric if (tTd(16, 1)) 41554967Seric printf("makeconnection: fd=%d\n", s); 41610347Seric 41710347Seric /* turn on network debugging? */ 41856328Seric if (tTd(16, 101)) 41924945Seric { 42024945Seric int on = 1; 42124945Seric (void) setsockopt(DaemonSocket, SOL_SOCKET, SO_DEBUG, (char *)&on, sizeof on); 42224945Seric } 42340932Srick if (CurEnv->e_xfp != NULL) 42440932Srick (void) fflush(CurEnv->e_xfp); /* for debugging */ 42514383Seric errno = 0; /* for debugging */ 42652106Seric addr.sin_family = AF_INET; 42752106Seric if (connect(s, (struct sockaddr *) &addr, sizeof addr) < 0) 4286039Seric { 42927744Sbloom sav_errno = errno; 43027744Sbloom (void) close(s); 43129430Sbloom if (hp && hp->h_addr_list[i]) 43229430Sbloom { 43352106Seric bcopy(hp->h_addr_list[i++], (char *) &addr.sin_addr, 43452106Seric hp->h_length); 43529430Sbloom goto again; 43629430Sbloom } 43729430Sbloom 4386039Seric /* failure, decide if temporary or not */ 4396039Seric failure: 44027744Sbloom switch (sav_errno) 4416039Seric { 4426039Seric case EISCONN: 4436039Seric case ETIMEDOUT: 4446897Seric case EINPROGRESS: 4456897Seric case EALREADY: 4466897Seric case EADDRINUSE: 44710123Seric case EHOSTDOWN: 4486897Seric case ENETDOWN: 4496897Seric case ENETRESET: 4506897Seric case ENOBUFS: 4517204Seric case ECONNREFUSED: 45211546Seric case ECONNRESET: 45310081Seric case EHOSTUNREACH: 45410098Seric case ENETUNREACH: 45551995Seric #ifdef ENOSR 45651995Seric case ENOSR: 45751995Seric #endif 4586039Seric /* there are others, I'm sure..... */ 4596039Seric return (EX_TEMPFAIL); 4606039Seric 46111147Seric case EPERM: 46211147Seric /* why is this happening? */ 46311147Seric syserr("makeconnection: funny failure, addr=%lx, port=%x", 46452106Seric addr.sin_addr.s_addr, addr.sin_port); 46514383Seric return (EX_TEMPFAIL); 46611147Seric 4676039Seric default: 46840932Srick { 46940932Srick extern char *errstring(); 47040932Srick 47140932Srick message(Arpa_Info, "%s", errstring(sav_errno)); 47240932Srick return (EX_UNAVAILABLE); 47340932Srick } 4746039Seric } 4756039Seric } 4766039Seric 4776039Seric /* connection ok, put it into canonical form */ 47853739Seric mci->mci_out = fdopen(s, "w"); 47953739Seric mci->mci_in = fdopen(dup(s), "r"); 4806039Seric 48110098Seric return (EX_OK); 4826039Seric } 48310758Seric /* 48410758Seric ** MYHOSTNAME -- return the name of this host. 48510758Seric ** 48610758Seric ** Parameters: 48710758Seric ** hostbuf -- a place to return the name of this host. 48812313Seric ** size -- the size of hostbuf. 48910758Seric ** 49010758Seric ** Returns: 49110758Seric ** A list of aliases for this host. 49210758Seric ** 49310758Seric ** Side Effects: 49410758Seric ** none. 49510758Seric */ 4966039Seric 49710758Seric char ** 49812313Seric myhostname(hostbuf, size) 49910758Seric char hostbuf[]; 50012313Seric int size; 50110758Seric { 50210758Seric extern struct hostent *gethostbyname(); 50311147Seric struct hostent *hp; 50410758Seric 50523120Seric if (gethostname(hostbuf, size) < 0) 50623120Seric { 50723120Seric (void) strcpy(hostbuf, "localhost"); 50823120Seric } 50911147Seric hp = gethostbyname(hostbuf); 51011147Seric if (hp != NULL) 51116877Seric { 51223104Seric (void) strcpy(hostbuf, hp->h_name); 51311147Seric return (hp->h_aliases); 51416877Seric } 51510758Seric else 51610758Seric return (NULL); 51710758Seric } 51851315Seric /* 51953751Seric ** MAPHOSTNAME -- turn a hostname into canonical form 52053751Seric ** 52153751Seric ** Parameters: 522*56823Seric ** map -- a pointer to this map (unused). 52353751Seric ** hbuf -- a buffer containing a hostname. 52453751Seric ** hbsize -- the size of hbuf. 52555019Seric ** avp -- unused -- for compatibility with other mapping 52655019Seric ** functions. 52753751Seric ** 52853751Seric ** Returns: 52953751Seric ** The mapping, if found. 53053751Seric ** NULL if no mapping found. 53153751Seric ** 53253751Seric ** Side Effects: 53353751Seric ** Looks up the host specified in hbuf. If it is not 53453751Seric ** the canonical name for that host, return the canonical 53553751Seric ** name. 53653751Seric */ 53751315Seric 53853751Seric char * 539*56823Seric maphostname(map, hbuf, hbsize, avp) 540*56823Seric MAP *map; 54116911Seric char *hbuf; 54216911Seric int hbsize; 54353751Seric char **avp; 54416911Seric { 54516911Seric register struct hostent *hp; 54633932Sbostic u_long in_addr; 547*56823Seric char *cp; 54833932Sbostic struct hostent *gethostbyaddr(); 54916911Seric 550*56823Seric /* allow room for null & trailing dot on correct match */ 551*56823Seric hbsize--; 55253751Seric if (ConfigLevel >= 2) 55353751Seric hbsize--; 55453751Seric 55525574Smiriam /* 55633932Sbostic * If first character is a bracket, then it is an address 55733932Sbostic * lookup. Address is copied into a temporary buffer to 55833932Sbostic * strip the brackets and to preserve hbuf if address is 55933932Sbostic * unknown. 56033932Sbostic */ 56153751Seric 56251315Seric if (*hbuf != '[') 56353751Seric { 56455019Seric extern bool getcanonname(); 56555019Seric 56653751Seric if (getcanonname(hbuf, hbsize)) 56753751Seric { 56853751Seric /* found a match -- add the trailing dot */ 56953751Seric if (ConfigLevel >= 2) 57056678Seric { 57156678Seric int i = strlen(hbuf) - 1; 57256678Seric 57356678Seric if (hbuf[i] != '.') 57456678Seric (void) strcpy(&hbuf[++i], "."); 57556678Seric } 57653751Seric return hbuf; 57753751Seric } 57853751Seric else 57953751Seric return NULL; 58053751Seric } 581*56823Seric if ((cp = strchr(hbuf, ']')) == NULL) 58253751Seric return (NULL); 58340994Sbostic *cp = '\0'; 584*56823Seric in_addr = inet_addr(&hbuf[1]); 58533932Sbostic hp = gethostbyaddr((char *)&in_addr, sizeof(struct in_addr), AF_INET); 58633932Sbostic if (hp == NULL) 58753751Seric return (NULL); 58853751Seric 58953751Seric /* found a match -- copy and dot terminate */ 590*56823Seric if (strlen(hp->h_name) > hbsize) 591*56823Seric hp->h_name[hbsize] = '\0'; 59253751Seric (void) strcpy(hbuf, hp->h_name); 59353751Seric if (ConfigLevel >= 2) 59453751Seric (void) strcat(hbuf, "."); 59553751Seric return hbuf; 59633932Sbostic } 59716911Seric 59856795Seric # else /* DAEMON */ 59916911Seric /* code for systems without sophisticated networking */ 60010758Seric 60110758Seric /* 60210758Seric ** MYHOSTNAME -- stub version for case of no daemon code. 60311297Seric ** 60411297Seric ** Can't convert to upper case here because might be a UUCP name. 60512313Seric ** 60612313Seric ** Mark, you can change this to be anything you want...... 60710758Seric */ 60810758Seric 60910758Seric char ** 61012313Seric myhostname(hostbuf, size) 61110758Seric char hostbuf[]; 61212313Seric int size; 61310758Seric { 61410758Seric register FILE *f; 61510758Seric 61610758Seric hostbuf[0] = '\0'; 61710758Seric f = fopen("/usr/include/whoami", "r"); 61810758Seric if (f != NULL) 61910758Seric { 62012313Seric (void) fgets(hostbuf, size, f); 62110758Seric fixcrlf(hostbuf, TRUE); 62210758Seric (void) fclose(f); 62310758Seric } 62410758Seric return (NULL); 62510758Seric } 62616911Seric /* 62716911Seric ** MAPHOSTNAME -- turn a hostname into canonical form 62816911Seric ** 62916911Seric ** Parameters: 630*56823Seric ** map -- a pointer to the database map. 63116911Seric ** hbuf -- a buffer containing a hostname. 63253751Seric ** avp -- a pointer to a (cf file defined) argument vector. 63316911Seric ** 63416911Seric ** Returns: 63553751Seric ** mapped host name 63651315Seric ** FALSE otherwise. 63716911Seric ** 63816911Seric ** Side Effects: 63916911Seric ** Looks up the host specified in hbuf. If it is not 64016911Seric ** the canonical name for that host, replace it with 64116911Seric ** the canonical name. If the name is unknown, or it 64216911Seric ** is already the canonical name, leave it unchanged. 64316911Seric */ 64410758Seric 64516911Seric /*ARGSUSED*/ 64653751Seric char * 647*56823Seric maphostname(map, hbuf, hbsize, avp) 648*56823Seric MAP *map; 64916911Seric char *hbuf; 65016911Seric int hbsize; 65153751Seric char **avp; 65216911Seric { 65353751Seric return NULL; 65416911Seric } 65516911Seric 65656795Seric #endif /* DAEMON */ 657