]> andersk Git - openssh.git/commitdiff
- (djm) Sync bsd-* support files:
authordjm <djm>
Wed, 24 Jan 2001 23:32:00 +0000 (23:32 +0000)
committerdjm <djm>
Wed, 24 Jan 2001 23:32:00 +0000 (23:32 +0000)
   - deraadt@cvs.openbsd.org 2000/01/26 03:43:20
     [rresvport.c bindresvport.c]
     new bindresvport() semantics that itojun, shin, jean-luc and i have
     agreed on, which will be happy for the future. bindresvport_sa() for
     sockaddr *, too.  docs later..
   - deraadt@cvs.openbsd.org 2000/01/24 02:24:21
     [bindresvport.c]
     in bindresvport(), if sin is non-NULL, example sin->sin_family for
     the actual family being processed

ChangeLog
bsd-bindresvport.c
bsd-bindresvport.h
bsd-rresvport.c
configure.in

index d15dd1d70d0777ec45258726618a43f9816df893..eafed7e09caf2405e357a47c32d3a4756e87ab5b 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,15 @@
+20010125
+ - (djm) Sync bsd-* support files:
+   - deraadt@cvs.openbsd.org 2000/01/26 03:43:20
+     [rresvport.c bindresvport.c]
+     new bindresvport() semantics that itojun, shin, jean-luc and i have 
+     agreed on, which will be happy for the future. bindresvport_sa() for
+     sockaddr *, too.  docs later..
+   - deraadt@cvs.openbsd.org 2000/01/24 02:24:21
+     [bindresvport.c]
+     in bindresvport(), if sin is non-NULL, example sin->sin_family for 
+     the actual family being processed
+
 20010124
  - (bal) OpenBSD Resync
    - markus@cvs.openbsd.org 2001/01/23 10:45:10
index 7faf73191b13a355b7b378317aedd3da65b3f6c0..332bcb016a40ba2a15e1efeb1c4f7184d14562f9 100644 (file)
@@ -1,3 +1,5 @@
+/* This file has be modified from the original OpenBSD source */
+
 /*
  * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  * unrestricted use provided that this legend is included on all tape
 
 #include "config.h"
 
-#ifndef HAVE_BINDRESVPORT_AF
+#ifndef HAVE_BINDRESVPORT_SA
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: bindresvport.c,v 1.11 1999/12/17 19:22:08 deraadt Exp $";
+static char *rcsid = "$OpenBSD: bindresvport.c,v 1.13 2000/01/26 03:43:21 deraadt Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 /*
@@ -51,12 +53,11 @@ static char *rcsid = "$OpenBSD: bindresvport.c,v 1.11 1999/12/17 19:22:08 deraad
  * Bind a socket to a privileged IP port
  */
 int
-bindresvport_af(sd, sa, af)
+bindresvport_sa(sd, sa)
        int sd;
        struct sockaddr *sa;
-       int af;
 {
-       int error;
+       int error, af;
        struct sockaddr_storage myaddr;
        struct sockaddr_in *sin;
        struct sockaddr_in6 *sin6;
@@ -68,7 +69,14 @@ bindresvport_af(sd, sa, af)
        if (sa == NULL) {
                memset(&myaddr, 0, sizeof(myaddr));
                sa = (struct sockaddr *)&myaddr;
-       }
+
+               if (getsockname(sd, sa, &salen) == -1)
+                       return -1;      /* errno is correctly set */
+
+               af = sa->sa_family;
+               memset(&myaddr, 0, salen);
+       } else
+               af = sa->sa_family;
 
        if (af == AF_INET) {
                sin = (struct sockaddr_in *)sa;
@@ -95,7 +103,7 @@ bindresvport_af(sd, sa, af)
                *portp = htons(port);
                
                error = bind(sd, sa, salen);
-               
+
                /* Terminate on success */
                if (error == 0)
                        break;
@@ -112,4 +120,4 @@ bindresvport_af(sd, sa, af)
        return (error);
 }
 
-#endif /* HAVE_BINDRESVPORT_AF */
+#endif /* HAVE_BINDRESVPORT_SA */
index 4ef4c2f3acae9f013e53a04fb58235fcf9f14eda..6dbf8a2cb93dbf938d62844efdfac745285524a5 100644 (file)
@@ -3,8 +3,8 @@
 
 #include "config.h"
 
-#ifndef HAVE_BINDRESVPORT_AF
-int bindresvport_af(int sd, struct sockaddr *sa, int af);
-#endif /* !HAVE_BINDRESVPORT_AF */
+#ifndef HAVE_BINDRESVPORT_SA
+int bindresvport_sa(int sd, struct sockaddr *sa);
+#endif /* !HAVE_BINDRESVPORT_SA */
 
 #endif /* _BSD_BINDRESVPORT_H */
index 392768c02f9012e1db7e4118c324af369589c9dc..44eac203631251c163afba885f215a4188aec21f 100644 (file)
@@ -38,7 +38,7 @@
 #ifndef HAVE_RRESVPORT_AF
 
 #if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rresvport.c,v 1.4 1999/12/17 20:48:03 deraadt Exp $";
+static char *rcsid = "$OpenBSD: rresvport.c,v 1.5 2000/01/26 03:43:20 deraadt Exp $";
 #endif /* LIBC_SCCS and not lint */
 
 #include "includes.h"
@@ -94,7 +94,8 @@ rresvport_af(int *alport, sa_family_t af)
        }
 
        *portp = 0;
-       if (bindresvport_af(s, sa, af) == -1) {
+       sa->sa_family = af;
+       if (bindresvport_sa(s, sa) == -1) {
                (void)close(s);
                return (-1);
        }
index 7cc58582bc5d6aaf19f7488b15522a92c7e29f10..f217e5ae9c1540ac2f96553d9da2f79cc31b6dfc 100644 (file)
@@ -315,7 +315,7 @@ AC_CHECK_FUNC(utimes,
 AC_CHECK_HEADERS(bstring.h endian.h floatingpoint.h getopt.h lastlog.h limits.h login.h login_cap.h maillock.h netdb.h netgroup.h netinet/in_systm.h paths.h poll.h pty.h regex.h shadow.h security/pam_appl.h sys/bitypes.h sys/bsdtty.h sys/cdefs.h sys/poll.h sys/queue.h sys/select.h sys/stat.h sys/stropts.h sys/sysmacros.h sys/time.h sys/ttcompat.h sys/un.h stddef.h time.h ttyent.h usersec.h util.h utime.h utmp.h utmpx.h vis.h)
 
 dnl    Checks for library functions.
-AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_af clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
+AC_CHECK_FUNCS(arc4random atexit b64_ntop bcopy bindresvport_sa clock fchmod freeaddrinfo futimes gai_strerror getcwd getaddrinfo getgrouplist getnameinfo getrlimit getrusage getttyent inet_aton inet_ntoa innetgr login_getcapbool md5_crypt memmove mkdtemp on_exit openpty realpath rresvport_af setdtablesize setenv seteuid setlogin setproctitle setreuid setrlimit setsid sigaction sigvec snprintf strerror strlcat strlcpy strmode strsep strtok_r sysconf utimes vsnprintf vhangup vis waitpid _getpty __b64_ntop)
 dnl    Checks for time functions
 AC_CHECK_FUNCS(gettimeofday time)
 dnl    Checks for libutil functions
This page took 0.055187 seconds and 5 git commands to generate.