httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Rob Hartill <r...@imdb.com>
Subject get_local_host and NIS (fwd)
Date Thu, 20 Mar 1997 21:07:41 GMT

---------- Forwarded message ----------
Date: Thu, 20 Mar 1997 16:28:12 +0100
From: Volker Borchert <bt@teknon.de>
To: apache-bugs@apache.org
Subject: get_local_host and NIS

Hi there,

get_local_host fails on my SunOS 4.1.2 sparc running NIS, because when NIS
is running, gethostbyname() won't return a fqdn unless pushed and beat. I
snatched the following code fragment from the inn1.4sec sources, and at
least on my box, it works (as it does in innd):

*** util.c.orig Tue Feb 18 17:27:26 1997
--- util.c      Thu Mar 20 15:55:26 1997
***************
*** 1187,1203 ****
  char *get_local_host(pool *a)
  {
!     char str[128];
      int len = 128;
      char *server_hostname;
- 
      struct hostent *p;
      gethostname(str, len);
!     if((!(p=gethostbyname(str))) || (!(server_hostname = find_fqdn(a, p)))) {
!         fprintf(stderr,"httpd: cannot determine local host name.\n");
!       fprintf(stderr,"Use ServerName to set it manually.\n");
!       exit(1);
!     }
  
!     return server_hostname;
  }
  
--- 1187,1210 ----
  char *get_local_host(pool *a)
  {
!     char str[130];
      int len = 128;
      char *server_hostname;
      struct hostent *p;
+ 
      gethostname(str, len);
!     if((p=gethostbyname(str)) && (server_hostname = find_fqdn(a, p)))
!       return server_hostname;
! 
! #ifdef SUNOS4
!     /* The following code is snatched from inn1.4sec/lib/getfqdn.c. */
!     /* Try to force DNS lookup if NIS/whatever gets in the way. */
!     strcat(str, ".");
!     if((p=gethostbyname(str)) && (server_hostname = find_fqdn(a, p)))
!       return server_hostname;
! #endif
  
!     fprintf(stderr,"httpd: cannot determine local host name.\n");
!     fprintf(stderr,"Use ServerName to set it manually.\n");
!     exit(1);
  }

How about a starter which binds to port 80, then sets uid and forks httpd?
I (and many other sysops, btw) do not like big programs running suid root
or starting with root privileges. An example on how this can be done is
innd, too. The starter is only 157 lines and easily understood.

cu,
	Volker

-- 

"I'm a doctor, not a mechanic." Dr Leonard McCoy <mccoy@ncc1701.starfleet.fed>
"I'm a mechanic, not a doctor." Volker Borchert  <bt@teknon.de>



Mime
View raw message