зеркало из https://github.com/Azure/sonic-openssh.git
- (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
This commit is contained in:
Родитель
12aaa04e96
Коммит
2a5c1cede0
12
ChangeLog
12
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
|
20010124
|
||||||
- (bal) OpenBSD Resync
|
- (bal) OpenBSD Resync
|
||||||
- markus@cvs.openbsd.org 2001/01/23 10:45:10
|
- markus@cvs.openbsd.org 2001/01/23 10:45:10
|
||||||
|
|
|
@ -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
|
* Sun RPC is a product of Sun Microsystems, Inc. and is provided for
|
||||||
* unrestricted use provided that this legend is included on all tape
|
* unrestricted use provided that this legend is included on all tape
|
||||||
|
@ -29,10 +31,10 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef HAVE_BINDRESVPORT_AF
|
#ifndef HAVE_BINDRESVPORT_SA
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#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 */
|
#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
|
* Bind a socket to a privileged IP port
|
||||||
*/
|
*/
|
||||||
int
|
int
|
||||||
bindresvport_af(sd, sa, af)
|
bindresvport_sa(sd, sa)
|
||||||
int sd;
|
int sd;
|
||||||
struct sockaddr *sa;
|
struct sockaddr *sa;
|
||||||
int af;
|
|
||||||
{
|
{
|
||||||
int error;
|
int error, af;
|
||||||
struct sockaddr_storage myaddr;
|
struct sockaddr_storage myaddr;
|
||||||
struct sockaddr_in *sin;
|
struct sockaddr_in *sin;
|
||||||
struct sockaddr_in6 *sin6;
|
struct sockaddr_in6 *sin6;
|
||||||
|
@ -68,7 +69,14 @@ bindresvport_af(sd, sa, af)
|
||||||
if (sa == NULL) {
|
if (sa == NULL) {
|
||||||
memset(&myaddr, 0, sizeof(myaddr));
|
memset(&myaddr, 0, sizeof(myaddr));
|
||||||
sa = (struct sockaddr *)&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) {
|
if (af == AF_INET) {
|
||||||
sin = (struct sockaddr_in *)sa;
|
sin = (struct sockaddr_in *)sa;
|
||||||
|
@ -95,7 +103,7 @@ bindresvport_af(sd, sa, af)
|
||||||
*portp = htons(port);
|
*portp = htons(port);
|
||||||
|
|
||||||
error = bind(sd, sa, salen);
|
error = bind(sd, sa, salen);
|
||||||
|
|
||||||
/* Terminate on success */
|
/* Terminate on success */
|
||||||
if (error == 0)
|
if (error == 0)
|
||||||
break;
|
break;
|
||||||
|
@ -112,4 +120,4 @@ bindresvport_af(sd, sa, af)
|
||||||
return (error);
|
return (error);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif /* HAVE_BINDRESVPORT_AF */
|
#endif /* HAVE_BINDRESVPORT_SA */
|
||||||
|
|
|
@ -3,8 +3,8 @@
|
||||||
|
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#ifndef HAVE_BINDRESVPORT_AF
|
#ifndef HAVE_BINDRESVPORT_SA
|
||||||
int bindresvport_af(int sd, struct sockaddr *sa, int af);
|
int bindresvport_sa(int sd, struct sockaddr *sa);
|
||||||
#endif /* !HAVE_BINDRESVPORT_AF */
|
#endif /* !HAVE_BINDRESVPORT_SA */
|
||||||
|
|
||||||
#endif /* _BSD_BINDRESVPORT_H */
|
#endif /* _BSD_BINDRESVPORT_H */
|
||||||
|
|
|
@ -38,7 +38,7 @@
|
||||||
#ifndef HAVE_RRESVPORT_AF
|
#ifndef HAVE_RRESVPORT_AF
|
||||||
|
|
||||||
#if defined(LIBC_SCCS) && !defined(lint)
|
#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 */
|
#endif /* LIBC_SCCS and not lint */
|
||||||
|
|
||||||
#include "includes.h"
|
#include "includes.h"
|
||||||
|
@ -94,7 +94,8 @@ rresvport_af(int *alport, sa_family_t af)
|
||||||
}
|
}
|
||||||
|
|
||||||
*portp = 0;
|
*portp = 0;
|
||||||
if (bindresvport_af(s, sa, af) == -1) {
|
sa->sa_family = af;
|
||||||
|
if (bindresvport_sa(s, sa) == -1) {
|
||||||
(void)close(s);
|
(void)close(s);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
@ -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)
|
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.
|
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
|
dnl Checks for time functions
|
||||||
AC_CHECK_FUNCS(gettimeofday time)
|
AC_CHECK_FUNCS(gettimeofday time)
|
||||||
dnl Checks for libutil functions
|
dnl Checks for libutil functions
|
||||||
|
|
Загрузка…
Ссылка в новой задаче