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

(-)a/xdmcp.c (-4 / +20 lines)
Lines 791-798 forward_respond ( Link Here
791
		{
791
		{
792
		    struct sockaddr_in6	in6_addr;
792
		    struct sockaddr_in6	in6_addr;
793
793
794
		    if (clientAddress.length != 16 ||
794
		    if ((clientAddress.length != 16 && clientAddress.length != 4) ||
795
		        clientPort.length != 2)
795
		        (clientPort.length != 2))
796
		    {
796
		    {
797
			goto badAddress;
797
			goto badAddress;
798
		    }
798
		    }
Lines 801-807 forward_respond ( Link Here
801
		    in6_addr.sin6_len = sizeof(in6_addr);
801
		    in6_addr.sin6_len = sizeof(in6_addr);
802
#  endif
802
#  endif
803
		    in6_addr.sin6_family = AF_INET6;
803
		    in6_addr.sin6_family = AF_INET6;
804
		    memmove(&in6_addr.sin6_addr,clientAddress.data,clientAddress.length);
804
		    if (clientAddress.length == 16) {
805
			memmove(in6_addr.sin6_addr.s6_addr, clientAddress.data, 16);
806
		    } else {
807
			/* If the client wants to forward the xdm server to an
808
			   ipv4 hosts it sends an ipv4 address in the forward
809
			   packet. On dual-stack hosts the packet arrives as a
810
			   ipv6 packet. To respond to the ipv4 host one has
811
			   to create an ipv4-mapped address of the form
812
813
			   ::ffff::xxx.xxx.xxx.xxx
814
815
			   One example where this is necessary is an ipv4-only
816
			   thin client that connects to a dual-stacked xdm.
817
			*/
818
			in6_addr.sin6_addr.s6_addr[10] = 0xff;
819
			in6_addr.sin6_addr.s6_addr[11] = 0xff;
820
			memmove(in6_addr.sin6_addr.s6_addr + 12, clientAddress.data, 4);
821
		    }
805
		    memmove((char *) &in6_addr.sin6_port, clientPort.data, 2);
822
		    memmove((char *) &in6_addr.sin6_port, clientPort.data, 2);
806
		    client = (struct sockaddr *) &in6_addr;
823
		    client = (struct sockaddr *) &in6_addr;
807
		    clientlen = sizeof (in6_addr);
824
		    clientlen = sizeof (in6_addr);
808
- 

Return to bug 546632