diff options
-rw-r--r-- | xorg-server/hw/xwin/winerror.c | 6 | ||||
-rw-r--r-- | xorg-server/os/access.c | 127 | ||||
-rw-r--r-- | xorg-server/os/log.c | 5 | ||||
-rw-r--r-- | xorg-server/os/xdmcp.c | 26 |
4 files changed, 104 insertions, 60 deletions
diff --git a/xorg-server/hw/xwin/winerror.c b/xorg-server/hw/xwin/winerror.c index b6b780ec4..97ac23998 100644 --- a/xorg-server/hw/xwin/winerror.c +++ b/xorg-server/hw/xwin/winerror.c @@ -99,6 +99,7 @@ OsVendorVErrorF (const char *pszFormat, va_list va_args) *
* Attempt to do last-ditch, safe, important cleanup here.
*/
+char g_FatalErrorMessage[1024];
void
OsVendorFatalError (void)
{
@@ -114,8 +115,9 @@ OsVendorFatalError (void) winMessageBoxF (
"A fatal error has occurred and " PROJECT_NAME " will now exit.\n" \
- "Please open %s for more information.\n",
- MB_ICONERROR, (g_pszLogFile?g_pszLogFile:"the logfile"));
+ "%s\n"
+ "Please open %s for more information.\n",
+ MB_ICONERROR, g_FatalErrorMessage, (g_pszLogFile?g_pszLogFile:"the logfile"));
}
diff --git a/xorg-server/os/access.c b/xorg-server/os/access.c index bce861d34..6398a6f92 100644 --- a/xorg-server/os/access.c +++ b/xorg-server/os/access.c @@ -394,70 +394,81 @@ DefineSelf (int fd) hp = _XGethostbyname(name.nodename, hparams);
if (hp != NULL)
{
- saddr.sa.sa_family = hp->h_addrtype;
- switch (hp->h_addrtype) {
- case AF_INET:
- inetaddr = (struct sockaddr_in *) (&(saddr.sa));
- acopy ( hp->h_addr, &(inetaddr->sin_addr), hp->h_length);
- len = sizeof(saddr.sa);
- break;
-#if defined(IPv6) && defined(AF_INET6)
- case AF_INET6:
- inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
- acopy ( hp->h_addr, &(inet6addr->sin6_addr), hp->h_length);
- len = sizeof(saddr.in6);
- break;
-#endif
- default:
- goto DefineLocalHost;
- }
- family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr);
- if ( family != -1 && family != FamilyLocal )
+ #ifdef h_addr
+ #define hp_addr *list
+ char **list;
+
+ /* iterate over the addresses */
+ for (list = hp->h_addr_list; *list; list++)
+ #else
+ #define hp_addr hp->h_addr
+ #endif
{
- for (host = selfhosts;
- host && !addrEqual (family, addr, len, host);
- host = host->next) ;
- if (!host)
+ saddr.sa.sa_family = hp->h_addrtype;
+ switch (hp->h_addrtype) {
+ case AF_INET:
+ inetaddr = (struct sockaddr_in *) (&(saddr.sa));
+ acopy ( hp_addr, &(inetaddr->sin_addr), hp->h_length);
+ len = sizeof(saddr.sa);
+ break;
+#if defined(IPv6) && defined(AF_INET6)
+ case AF_INET6:
+ inet6addr = (struct sockaddr_in6 *) (&(saddr.sa));
+ acopy ( hp_addr, &(inet6addr->sin6_addr), hp->h_length);
+ len = sizeof(saddr.in6);
+ break;
+#endif
+ default:
+ goto DefineLocalHost;
+ }
+ family = ConvertAddr ( &(saddr.sa), &len, (pointer *)&addr);
+ if ( family != -1 && family != FamilyLocal )
{
- /* add this host to the host list. */
- MakeHost(host,len)
- if (host)
- {
- host->family = family;
- host->len = len;
- acopy ( addr, host->addr, len);
- host->next = selfhosts;
- selfhosts = host;
- }
-#ifdef XDMCP
- /*
- * If this is an Internet Address, but not the localhost
- * address (127.0.0.1), nor the bogus address (0.0.0.0),
- * register it.
- */
- if (family == FamilyInternet &&
- !(len == 4 &&
- ((addr[0] == 127) ||
- (addr[0] == 0 && addr[1] == 0 &&
- addr[2] == 0 && addr[3] == 0)))
- )
+ for (host = selfhosts;
+ host && !addrEqual (family, addr, len, host);
+ host = host->next) ;
+ if (!host)
{
- XdmcpRegisterConnection (family, (char *)addr, len);
- broad_addr = *inetaddr;
- ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
+ /* add this host to the host list. */
+ MakeHost(host,len)
+ if (host)
+ {
+ host->family = family;
+ host->len = len;
+ acopy ( addr, host->addr, len);
+ host->next = selfhosts;
+ selfhosts = host;
+ }
+ #ifdef XDMCP
+ /*
+ * If this is an Internet Address, but not the localhost
+ * address (127.0.0.1), nor the bogus address (0.0.0.0),
+ * register it.
+ */
+ if (family == FamilyInternet &&
+ !(len == 4 &&
+ ((addr[0] == 127) ||
+ (addr[0] == 0 && addr[1] == 0 &&
+ addr[2] == 0 && addr[3] == 0)))
+ )
+ {
+ XdmcpRegisterConnection (family, (char *)addr, len);
+ broad_addr = *inetaddr;
+ ((struct sockaddr_in *) &broad_addr)->sin_addr.s_addr =
htonl (INADDR_BROADCAST);
- XdmcpRegisterBroadcastAddress ((struct sockaddr_in *)
+ XdmcpRegisterBroadcastAddress ((struct sockaddr_in *)
&broad_addr);
+ }
+ #if defined(IPv6) && defined(AF_INET6)
+ else if (family == FamilyInternet6 &&
+ !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)))
+ {
+ XdmcpRegisterConnection (family, (char *)addr, len);
+ }
+ #endif
+
+ #endif /* XDMCP */
}
-#if defined(IPv6) && defined(AF_INET6)
- else if (family == FamilyInternet6 &&
- !(IN6_IS_ADDR_LOOPBACK((struct in6_addr *)addr)))
- {
- XdmcpRegisterConnection (family, (char *)addr, len);
- }
-#endif
-
-#endif /* XDMCP */
}
}
}
diff --git a/xorg-server/os/log.c b/xorg-server/os/log.c index 42a4efefa..0d45b7791 100644 --- a/xorg-server/os/log.c +++ b/xorg-server/os/log.c @@ -534,6 +534,8 @@ VAuditF(const char *f, va_list args) free(prefix); } +extern char g_FatalErrorMessage[1024]; + void FatalError(const char *f, ...) { @@ -549,6 +551,9 @@ FatalError(const char *f, ...) #ifdef __APPLE__ (void)vsnprintf(__crashreporter_info_buff__, sizeof(__crashreporter_info_buff__), f, args); #endif +#ifdef WIN32 + vsnprintf(g_FatalErrorMessage, 1024, f, args); +#endif VErrorF(f, args); va_end(args); ErrorF("\n"); diff --git a/xorg-server/os/xdmcp.c b/xorg-server/os/xdmcp.c index 901a91d41..b16fba61e 100644 --- a/xorg-server/os/xdmcp.c +++ b/xorg-server/os/xdmcp.c @@ -592,6 +592,32 @@ XdmcpInit(void) (pointer) 0);
timeOutRtx = 0;
DisplayNumber = (CARD16) atoi(display);
+ if (ConnectionTypes.length>1 && xdm_from==NULL)
+ {
+ unsigned i=0;
+ char ErrorMessage[1024];
+ sprintf(ErrorMessage,"Multiple ip-addresses detected:\n");
+ for (i=0; i<ConnectionTypes.length; i++)
+ {
+ int AddrLen=ConnectionAddresses.data[i].length;
+ if (AddrLen==4)
+ sprintf(ErrorMessage+strlen(ErrorMessage)," %d.%d.%d.%d\n",
+ ConnectionAddresses.data[i].data[0],
+ ConnectionAddresses.data[i].data[1],
+ ConnectionAddresses.data[i].data[2],
+ ConnectionAddresses.data[i].data[3]);
+ else
+ {
+ int j;
+ sprintf(ErrorMessage+strlen(ErrorMessage)," ");
+ for (j=0; j<AddrLen; j++)
+ sprintf(ErrorMessage+strlen(ErrorMessage),"%02x",ConnectionAddresses.data[i].data[j]);
+ sprintf(ErrorMessage+strlen(ErrorMessage),"\n");
+ }
+ }
+ sprintf(ErrorMessage+strlen(ErrorMessage),"Please specify the ip-address you want to use with -from\n");
+ FatalError(ErrorMessage);
+ }
get_xdmcp_sock();
send_packet();
}
|