fielding 97/03/10 19:24:26
Modified: src CHANGES util.c
Log:
Deal with long hostnames by making use of the MAXHOSTNAMELEN symbol
when available, or 256 (the Internet default) when not.
Submitted by: Dean Gaudet
Reviewed by: Roy Fielding, Chuck Murcko
Revision Changes Path
1.194 +3 -0 apache/src/CHANGES
Index: CHANGES
===================================================================
RCS file: /export/home/cvs/apache/src/CHANGES,v
retrieving revision 1.193
retrieving revision 1.194
diff -C3 -r1.193 -r1.194
*** CHANGES 1997/03/10 09:27:41 1.193
--- CHANGES 1997/03/11 03:24:24 1.194
***************
*** 47,52 ****
--- 47,55 ----
*) Remove unnecessary call to va_end() in create_argv() which
caused a SEGV on some systems.
+ *) Use proper MAXHOSTNAMELEN symbol for limiting length of server name.
+ [Dean Gaudet]
+
Changes with Apache 1.2b7
*) Port to UXP/DS(V20) [Toshiaki Nomura <[EMAIL PROTECTED]>]
1.49 +10 -4 apache/src/util.c
Index: util.c
===================================================================
RCS file: /export/home/cvs/apache/src/util.c,v
retrieving revision 1.48
retrieving revision 1.49
diff -C3 -r1.48 -r1.49
*** util.c 1997/03/07 14:35:46 1.48
--- util.c 1997/03/11 03:24:24 1.49
***************
*** 1192,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");
--- 1192,1209 ----
char *get_local_host(pool *a)
{
! #ifndef MAXHOSTNAMELEN
! #define MAXHOSTNAMELEN 256
! #endif
! char str[MAXHOSTNAMELEN+1];
char *server_hostname;
struct hostent *p;
!
! if( gethostname( str, sizeof( str ) - 1 ) != 0 ) {
! perror( "Unable to gethostname" );
! exit(1);
! }
! str[MAXHOSTNAMELEN] = '\0';
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");