Remove NO_IPPORT_RESERVED_CONCEPT

Replace by defining IPPORT_RESERVED to zero on Cygwin, which should have
the same effect without causing problems syncing patches with OpenBSD.
Resync the two affected functions with OpenBSD.  ok djm, sanity checked
by Corinna.
This commit is contained in:
Darren Tucker 2016-04-08 21:14:13 +10:00
parent 34a01b2cf7
commit 5f41f030e2
3 changed files with 6 additions and 12 deletions

View File

@ -586,9 +586,8 @@ case "$host" in
[Define if you want to disable shadow passwords]) [Define if you want to disable shadow passwords])
AC_DEFINE([NO_X11_UNIX_SOCKETS], [1], AC_DEFINE([NO_X11_UNIX_SOCKETS], [1],
[Define if X11 doesn't support AF_UNIX sockets on that system]) [Define if X11 doesn't support AF_UNIX sockets on that system])
AC_DEFINE([NO_IPPORT_RESERVED_CONCEPT], [1], AC_DEFINE([IPPORT_RESERVED], [0],
[Define if the concept of ports only accessible to [Cygwin has no notion of ports only accessible to superusers])
superusers isn't known])
AC_DEFINE([DISABLE_FD_PASSING], [1], AC_DEFINE([DISABLE_FD_PASSING], [1],
[Define if your platform needs to skip post auth [Define if your platform needs to skip post auth
file descriptor passing]) file descriptor passing])

View File

@ -294,14 +294,12 @@ void
add_local_forward(Options *options, const struct Forward *newfwd) add_local_forward(Options *options, const struct Forward *newfwd)
{ {
struct Forward *fwd; struct Forward *fwd;
int i;
#ifndef NO_IPPORT_RESERVED_CONCEPT
extern uid_t original_real_uid; extern uid_t original_real_uid;
int i;
if (newfwd->listen_port < IPPORT_RESERVED && original_real_uid != 0 && if (newfwd->listen_port < IPPORT_RESERVED && original_real_uid != 0 &&
newfwd->listen_path == NULL) newfwd->listen_path == NULL)
fatal("Privileged ports can only be forwarded by root."); fatal("Privileged ports can only be forwarded by root.");
#endif
/* Don't add duplicates */ /* Don't add duplicates */
for (i = 0; i < options->num_local_forwards; i++) { for (i = 0; i < options->num_local_forwards; i++) {
if (forward_equals(newfwd, options->local_forwards + i)) if (forward_equals(newfwd, options->local_forwards + i))

View File

@ -1243,12 +1243,9 @@ server_input_global_request(int type, u_int32_t seq, void *ctxt)
/* check permissions */ /* check permissions */
if ((options.allow_tcp_forwarding & FORWARD_REMOTE) == 0 || if ((options.allow_tcp_forwarding & FORWARD_REMOTE) == 0 ||
no_port_forwarding_flag || no_port_forwarding_flag ||
(!want_reply && fwd.listen_port == 0) (!want_reply && fwd.listen_port == 0) ||
#ifndef NO_IPPORT_RESERVED_CONCEPT (fwd.listen_port != 0 && fwd.listen_port < IPPORT_RESERVED &&
|| (fwd.listen_port != 0 && fwd.listen_port < IPPORT_RESERVED && pw->pw_uid != 0)) {
pw->pw_uid != 0)
#endif
) {
success = 0; success = 0;
packet_send_debug("Server has disabled port forwarding."); packet_send_debug("Server has disabled port forwarding.");
} else { } else {