View | Details | Raw Unified | Return to bug 546632
Collapse All | Expand All

(-)xdmcp.c (-2 / +22 lines)
Lines 612-625 Link Here
612
				{
612
				{
613
					struct sockaddr_in6 in6_addr;
613
					struct sockaddr_in6 in6_addr;
614
614
615
					if (clientAddress.length != 16 || clientPort.length != 2)
615
					if ((clientAddress.length != 16 && clientAddress.length != 4) || 
616
                                            clientPort.length != 2)
617
                                        {
616
						goto badAddress;
618
						goto badAddress;
619
					}
617
					bzero( &in6_addr, sizeof(in6_addr) );
620
					bzero( &in6_addr, sizeof(in6_addr) );
618
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
621
#ifdef HAVE_STRUCT_SOCKADDR_IN6_SIN6_LEN
619
					in6_addr.sin6_len = sizeof(in6_addr);
622
					in6_addr.sin6_len = sizeof(in6_addr);
620
#endif
623
#endif
621
					in6_addr.sin6_family = AF_INET6;
624
					in6_addr.sin6_family = AF_INET6;
622
					memmove( &in6_addr,clientAddress.data,clientAddress.length );
625
                                        if (clientAddress.length == 16) {
626
						memmove( in6_addr.sin6_addr.s6_addr, clientAddress.data, 16 );
627
					} else {
628
						/* If the client wants to forward the xdm server to an
629
						   ipv4 hosts it sends an ipv4 address in the forward
630
						   packet. On dual-stack hosts the packet arrives as a
631
						   ipv6 packet. To respond to the ipv4 host one has
632
						   to create an ipv4-mapped address of the form:
633
						   
634
						   ::ffff:xxx.xxx.xxx.xxx
635
636
						   One example where this is necessary is an ipv4-only
637
						   thin client that connects to a dual-stacked xdm.
638
						*/
639
						in6_addr.sin6_addr.s6_addr[10] = 0xff;
640
						in6_addr.sin6_addr.s6_addr[11] = 0xff;
641
						memmove( in6_addr.sin6_addr.s6_addr + 12, clientAddress.data, 4 );
642
					}
623
					memmove( &in6_addr.sin6_port, clientPort.data, 2 );
643
					memmove( &in6_addr.sin6_port, clientPort.data, 2 );
624
					client = (struct sockaddr *)&in6_addr;
644
					client = (struct sockaddr *)&in6_addr;
625
					clientlen = sizeof(in6_addr);
645
					clientlen = sizeof(in6_addr);

Return to bug 546632