Fix some 32/64-bit bugs. IPv4 addresses are 32-bits, not longs. On the

alpha these bugs didn't cause any problems because it was little endian,
but on sparc64, we ended up with garbage for the IP address when we tried
to contact the server.  (Usually 3.253.0.0)

Not objected to by:	wpaul
This commit is contained in:
jhb 2002-01-08 18:05:03 +00:00
parent 4749f26598
commit 6e3fd09860

View File

@ -402,10 +402,12 @@ _yp_dobind(dom, ypdb)
bzero(&ysd->dom_server_addr, sizeof ysd->dom_server_addr);
ysd->dom_server_addr.sin_family = AF_INET;
ysd->dom_server_addr.sin_len = sizeof(struct sockaddr_in);
ysd->dom_server_addr.sin_addr.s_addr =
*(u_long *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr;
ysd->dom_server_addr.sin_port =
*(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port;
bcopy(&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
&ysd->dom_server_addr.sin_addr.s_addr,
sizeof(ysd->dom_server_addr.sin_addr.s_addr));
bcopy(&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
&ysd->dom_server_addr.sin_port,
sizeof(ysd->dom_server_addr.sin_port));
ysd->dom_server_port = ysd->dom_server_addr.sin_port;
_close(fd);
@ -497,10 +499,12 @@ _yp_dobind(dom, ypdb)
bzero((char *)&ysd->dom_server_addr, sizeof ysd->dom_server_addr);
ysd->dom_server_addr.sin_family = AF_INET;
ysd->dom_server_addr.sin_port =
*(u_short *)&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port;
ysd->dom_server_addr.sin_addr.s_addr =
*(u_long *)&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr;
bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port,
&ysd->dom_server_addr.sin_port,
sizeof(ysd->dom_server_addr.sin_port));
bcopy(&ypbr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_addr,
&ysd->dom_server_addr.sin_addr.s_addr,
sizeof(ysd->dom_server_addr.sin_addr.s_addr));
/*
* We could do a reserved port check here too, but this