diff options
author | dtucker@openbsd.org <dtucker@openbsd.org> | 2016-10-23 22:04:05 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2016-10-24 10:42:57 +1100 |
commit | 1c4ef0b808d3d38232aeeb1cebb7e9a43def42c5 (patch) | |
tree | a50f4076f566c6182fa931c28fe0ede424aabba3 /readconf.c | |
parent | 0b9ee623d57e5de7e83e66fd61a7ba9a5be98894 (diff) |
upstream commit
Factor out "can bind to low ports" check into its own function. This will
make it easier for Portable to support platforms with permissions models
other than uid==0 (eg bz#2625). ok djm@, "doesn't offend me too much"
deraadt@.
Upstream-ID: 86213df4183e92b8f189a6d2dac858c994bfface
Diffstat (limited to 'readconf.c')
-rw-r--r-- | readconf.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/readconf.c b/readconf.c index 351a22c32..1be564856 100644 --- a/readconf.c +++ b/readconf.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: readconf.c,v 1.260 2016/08/25 23:56:51 djm Exp $ */ | 1 | /* $OpenBSD: readconf.c,v 1.261 2016/10/23 22:04:05 dtucker Exp $ */ |
2 | /* | 2 | /* |
3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> | 3 | * Author: Tatu Ylonen <ylo@cs.hut.fi> |
4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland | 4 | * Copyright (c) 1995 Tatu Ylonen <ylo@cs.hut.fi>, Espoo, Finland |
@@ -312,7 +312,7 @@ add_local_forward(Options *options, const struct Forward *newfwd) | |||
312 | extern uid_t original_real_uid; | 312 | extern uid_t original_real_uid; |
313 | int i; | 313 | int i; |
314 | 314 | ||
315 | if (newfwd->listen_port < IPPORT_RESERVED && original_real_uid != 0 && | 315 | if (bind_permitted(newfwd->listen_port, original_real_uid) && |
316 | newfwd->listen_path == NULL) | 316 | newfwd->listen_path == NULL) |
317 | fatal("Privileged ports can only be forwarded by root."); | 317 | fatal("Privileged ports can only be forwarded by root."); |
318 | /* Don't add duplicates */ | 318 | /* Don't add duplicates */ |