Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/lib/libc/rpc The two unchanged interfaces (svc_create and cl...



details:   https://anonhg.NetBSD.org/src/rev/aa92df0ff8b8
branches:  trunk
changeset: 487425:aa92df0ff8b8
user:      fvdl <fvdl%NetBSD.org@localhost>
date:      Wed Jun 07 18:27:39 2000 +0000

description:
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.

diffstat:

 lib/libc/rpc/clnt_generic.c |   4 +++-
 lib/libc/rpc/svc_generic.c  |  20 +++++++++++---------
 2 files changed, 14 insertions(+), 10 deletions(-)

diffs (52 lines):

diff -r af9db338eb2e -r aa92df0ff8b8 lib/libc/rpc/clnt_generic.c
--- a/lib/libc/rpc/clnt_generic.c       Wed Jun 07 17:37:07 2000 +0000
+++ b/lib/libc/rpc/clnt_generic.c       Wed Jun 07 18:27:39 2000 +0000
@@ -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 @@
                servtype = nconf->nc_semantics;
                if (!__rpc_fd2sockinfo(fd, &si))
                        goto err;
+
+               bindresvport(fd, NULL);
        } else {
                if (!__rpc_fd2sockinfo(fd, &si))
                        goto err;
diff -r af9db338eb2e -r aa92df0ff8b8 lib/libc/rpc/svc_generic.c
--- a/lib/libc/rpc/svc_generic.c        Wed Jun 07 17:37:07 2000 +0000
+++ b/lib/libc/rpc/svc_generic.c        Wed Jun 07 18:27:39 2000 +0000
@@ -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 @@
         */
        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 {



Home | Main Index | Thread Index | Old Index