diff options
author | Darren Tucker <dtucker@cvs.openbsd.org> | 2016-10-23 22:04:06 +0000 |
---|---|---|
committer | Darren Tucker <dtucker@cvs.openbsd.org> | 2016-10-23 22:04:06 +0000 |
commit | a66befdfb5c63f511ccbf4392a52e8814321abd4 (patch) | |
tree | c058becbfc5906571466ef4d96800171d9de5551 /usr.bin/ssh/misc.c | |
parent | 14d74a64eb6829aa7a909f39670d651e78e1b7db (diff) |
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@.
Diffstat (limited to 'usr.bin/ssh/misc.c')
-rw-r--r-- | usr.bin/ssh/misc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/usr.bin/ssh/misc.c b/usr.bin/ssh/misc.c index 0856543e5d7..578ddef1097 100644 --- a/usr.bin/ssh/misc.c +++ b/usr.bin/ssh/misc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: misc.c,v 1.105 2016/07/15 00:24:30 djm Exp $ */ +/* $OpenBSD: misc.c,v 1.106 2016/10/23 22:04:05 dtucker Exp $ */ /* * Copyright (c) 2000 Markus Friedl. All rights reserved. * Copyright (c) 2005,2006 Damien Miller. All rights reserved. @@ -1179,3 +1179,11 @@ forward_equals(const struct Forward *a, const struct Forward *b) return 1; } +/* returns 1 if bind to specified port by specified user is permitted */ +int +bind_permitted(int port, uid_t uid) +{ + if (port < IPPORT_RESERVED && uid != 0) + return 0; + return 1; +} |