Bugzilla – Attachment 1166 Details for
Bug 1211
option BindAddress is ignored by option UsePrivilegedPort
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
simple fix for ssh_create_socket()
patch-crypto::openssh::sshconnect.c (text/plain), 1.91 KB, created by
swp
on 2006-07-18 14:58:31 AEST
(
hide
)
Description:
simple fix for ssh_create_socket()
Filename:
MIME Type:
Creator:
swp
Created:
2006-07-18 14:58:31 AEST
Size:
1.91 KB
patch
obsolete
>Index: crypto/openssh/sshconnect.c >=================================================================== >RCS file: /usr/cvs/freebsd/ncvs/src/crypto/openssh/sshconnect.c,v >retrieving revision 1.29.2.1 >diff -u -r1.29.2.1 sshconnect.c >--- crypto/openssh/sshconnect.c 11 Sep 2005 16:50:35 -0000 1.29.2.1 >+++ crypto/openssh/sshconnect.c 17 Jul 2006 05:29:41 -0000 >@@ -153,29 +153,15 @@ > int sock, gaierr; > struct addrinfo hints, *res; > >- /* >- * If we are running as root and want to connect to a privileged >- * port, bind our own socket to a privileged port. >- */ >- if (privileged) { >- int p = IPPORT_RESERVED - 1; >- PRIV_START; >- sock = rresvport_af(&p, ai->ai_family); >- PRIV_END; >- if (sock < 0) >- error("rresvport: af=%d %.100s", ai->ai_family, >- strerror(errno)); >- else >- debug("Allocated local port %d.", p); >- return sock; >- } > sock = socket(ai->ai_family, ai->ai_socktype, ai->ai_protocol); >- if (sock < 0) >+ if (sock < 0) { > error("socket: %.100s", strerror(errno)); >+ return sock; >+ } >+ if (!privileged && !options.bind_address) >+ return sock; > > /* Bind the socket to an alternative local IP address */ >- if (options.bind_address == NULL) >- return sock; > > memset(&hints, 0, sizeof(hints)); > hints.ai_family = ai->ai_family; >@@ -189,12 +175,27 @@ > close(sock); > return -1; > } >- if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { >- error("bind: %s: %s", options.bind_address, strerror(errno)); >- close(sock); >- freeaddrinfo(res); >- return -1; >- } >+ >+ if (privileged) { >+ int rc; >+ >+ PRIV_START; >+ rc = bindresvport_sa(sock, res->ai_addr); >+ PRIV_END; >+ if (rc < 0) { >+ error("bindresvport_sa: %s: %s", options.bind_address, >+ strerror(errno)); >+ close(sock); >+ sock = -1; >+ } >+ } else >+ if (bind(sock, res->ai_addr, res->ai_addrlen) < 0) { >+ error("bind: %s: %s", options.bind_address, >+ strerror(errno)); >+ close(sock); >+ sock = -1; >+ } >+ > freeaddrinfo(res); > return sock; > }
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 1211
:
1165
|
1166
|
2340