diff -up cups-1.3.10/scheduler/conf.c.str3167 cups-1.3.10/scheduler/conf.c
--- cups-1.3.10/scheduler/conf.c.str3167 2009-04-16 20:32:04.000000000 +0100
+++ cups-1.3.10/scheduler/conf.c 2009-04-24 18:12:56.000000000 +0100
@@ -653,38 +653,44 @@ cupsdReadConfiguration(void)
}
cupsdSetString(&ServerName, temp);
- add_alias(temp);
+ }
- if (HostNameLookups || RemoteAccessEnabled)
- {
- struct hostent *host; /* Host entry to get FQDN */
- if ((host = gethostbyname(temp)) != NULL)
+ add_alias(ServerName);
+
+ if (HostNameLookups || RemoteAccessEnabled)
+ {
+ struct hostent *host; /* Host entry to get FQDN */
+
+ if ((host = gethostbyname(ServerName)) != NULL)
+ {
+ if (strcasecmp(ServerName, host->h_name))
{
- if (strcasecmp(temp, host->h_name))
- {
- cupsdSetString(&ServerName, host->h_name);
- add_alias(host->h_name);
- }
+ cupsdSetString(&ServerName, host->h_name);
+ add_alias(host->h_name);
+ }
- if (host->h_aliases)
- {
- for (i = 0; host->h_aliases[i]; i ++)
- if (strcasecmp(temp, host->h_aliases[i]))
- add_alias(host->h_aliases[i]);
- }
+ if (host->h_aliases)
+ {
+ for (i = 0; host->h_aliases[i]; i ++)
+ if (strcasecmp(ServerName, host->h_aliases[i]))
+ add_alias(host->h_aliases[i]);
}
}
+ }
- /*
- * Make sure we have the base hostname added as an alias, too!
- */
+ /*
+ * Make sure we have the base hostname added as an alias, too!
+ */
- if ((slash = strchr(temp, '.')) != NULL)
- {
- *slash = '\0';
- add_alias(temp);
- }
+ if ((slash = strchr(ServerName, '.')) != NULL)
+ {
+ size_t n = slash - ServerName;
+ if (n > sizeof(temp) - 1)
+ n = sizeof(temp) - 1;
+ memcpy (temp, ServerName, n);
+ temp[n] = '\0';
+ add_alias(temp);
}
for (slash = ServerName; isdigit(*slash & 255) || *slash == '.'; slash ++);