The two unchanged interfaces (svc_create and clnt_create) resulted

in sockets bound to reserved ports in the old code. Since old binaries
will still expect this, always try to bind to a reserved port in
clnt_cli_create and svc_tli_create, unless we're already bound.
This commit is contained in:
fvdl 2000-06-07 18:27:39 +00:00
parent 4c15219d3b
commit 737db7ee0a
2 changed files with 14 additions and 10 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: clnt_generic.c,v 1.16 2000/06/02 23:11:07 fvdl Exp $ */
/* $NetBSD: clnt_generic.c,v 1.17 2000/06/07 18:27:39 fvdl Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -293,6 +293,8 @@ clnt_tli_create(fd, nconf, svcaddr, prog, vers, sendsz, recvsz)
servtype = nconf->nc_semantics;
if (!__rpc_fd2sockinfo(fd, &si))
goto err;
bindresvport(fd, NULL);
} else {
if (!__rpc_fd2sockinfo(fd, &si))
goto err;

View File

@ -1,4 +1,4 @@
/* $NetBSD: svc_generic.c,v 1.1 2000/06/02 23:11:16 fvdl Exp $ */
/* $NetBSD: svc_generic.c,v 1.2 2000/06/07 18:27:40 fvdl Exp $ */
/*
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
@ -237,14 +237,16 @@ svc_tli_create(fd, nconf, bindaddr, sendsz, recvsz)
*/
if (madefd || !__rpc_sockisbound(fd)) {
if (bindaddr == NULL) {
memset(&ss, 0, sizeof ss);
ss.ss_family = si.si_af;
ss.ss_len = si.si_alen;
if (bind(fd, (struct sockaddr *)(void *)&ss,
si.si_alen) < 0) {
warnx(
"svc_tli_create: could not bind to anonymous port");
goto freedata;
if (bindresvport(fd, NULL) < 0) {
memset(&ss, 0, sizeof ss);
ss.ss_family = si.si_af;
ss.ss_len = si.si_alen;
if (bind(fd, (struct sockaddr *)(void *)&ss,
si.si_alen) < 0) {
warnx(
"svc_tli_create: could not bind to anonymous port");
goto freedata;
}
}
listen(fd, SOMAXCONN);
} else {