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:
parent
3b9da4da83
commit
7b5f59222e
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=89084
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user