1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
|
--- src/main/util.c.orig Thu Feb 1 04:06:37 2001
+++ src/main/util.c Wed Mar 21 21:12:35 2001
@@ -708,7 +708,7 @@
char *res;
for (x = 0; (*line)[x]; x++) {
- if (ap_isspace((*line)[x])) {
+ if (ap_isspace((*line)[x]) && ((*line)[x] & 0x80)==0) {
pos = x;
break;
}
@@ -2013,12 +2013,14 @@
int x;
if (!strchr(p->h_name, '.')) {
- for (x = 0; p->h_aliases[x]; ++x) {
- if (strchr(p->h_aliases[x], '.') &&
- (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name))))
- return ap_pstrdup(a, p->h_aliases[x]);
- }
- return NULL;
+ if (p->h_aliases) {
+ for (x = 0; p->h_aliases[x]; ++x) {
+ if (p->h_aliases[x] && strchr(p->h_aliases[x], '.') &&
+ (!strncasecmp(p->h_aliases[x], p->h_name, strlen(p->h_name))))
+ return ap_pstrdup(a, p->h_aliases[x]);
+ }
+ }
+ return NULL;
}
return ap_pstrdup(a, (void *) p->h_name);
}
@@ -2040,7 +2042,6 @@
ap_log_error(APLOG_MARK, APLOG_WARNING, NULL,
"%s: gethostname() failed to determine ServerName\n",
ap_server_argv0);
- server_hostname = ap_pstrdup(a, "127.0.0.1");
}
else
{
@@ -2048,14 +2049,14 @@
if ((!(p = gethostbyname(str)))
|| (!(server_hostname = find_fqdn(a, p)))) {
/* Recovery - return the default servername by IP: */
- if (p->h_addr_list[0]) {
+ if (p && p->h_addr_list && p->h_addr_list[0]) {
ap_snprintf(str, sizeof(str), "%pA", p->h_addr_list[0]);
server_hostname = ap_pstrdup(a, str);
/* We will drop through to report the IP-named server */
}
}
else
- /* Since we found a fdqn, return it with no logged message. */
+ /* Since we found a fqdn, return it with no logged message. */
return server_hostname;
}
|