diff options
author | Darren Tucker <dtucker@zip.com.au> | 2010-11-05 14:47:01 +1100 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2010-11-05 14:47:01 +1100 |
commit | b12fe272a0e850175417aa56e6efef8f08250977 (patch) | |
tree | abd6a1ee2fefd9b12525a85d21667bee3b8cb99a /platform.c | |
parent | cc12418e18242ce1f61d7035da4956274ba13a96 (diff) |
- (dtucker) [platform.c platform.h session.c] Move the Cygwin special-case
check into platform.c
Diffstat (limited to 'platform.c')
-rw-r--r-- | platform.c | 18 |
1 files changed, 17 insertions, 1 deletions
@@ -1,4 +1,4 @@ -/* $Id: platform.c,v 1.13 2010/11/05 02:32:53 dtucker Exp $ */ +/* $Id: platform.c,v 1.14 2010/11/05 03:47:01 dtucker Exp $ */ /* * Copyright (c) 2006 Darren Tucker. All rights reserved. @@ -17,6 +17,10 @@ */ #include "config.h" + +#include <sys/types.h> +#include <unistd.h> + #include "platform.h" #include "openbsd-compat/openbsd-compat.h" @@ -59,6 +63,18 @@ platform_post_fork_child(void) #endif } +/* return 1 if we are running with privilege to swap UIDs, 0 otherwise */ +int +platform_privileged_uidswap(void) +{ +#ifdef HAVE_CYGWIN + /* uid 0 is not special on Cygwin so always try */ + return 1; +#else + return (getuid() == 0 || geteuid() == 0); +#endif +} + /* * This gets called before switching UIDs, and is called even when sshd is * not running as root. |