summaryrefslogtreecommitdiff
path: root/platform.c
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2010-11-05 14:47:01 +1100
committerDarren Tucker <dtucker@zip.com.au>2010-11-05 14:47:01 +1100
commitb12fe272a0e850175417aa56e6efef8f08250977 (patch)
treeabd6a1ee2fefd9b12525a85d21667bee3b8cb99a /platform.c
parentcc12418e18242ce1f61d7035da4956274ba13a96 (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.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/platform.c b/platform.c
index b4fb88e5f..f2cf11f56 100644
--- a/platform.c
+++ b/platform.c
@@ -1,4 +1,4 @@
1/* $Id: platform.c,v 1.13 2010/11/05 02:32:53 dtucker Exp $ */ 1/* $Id: platform.c,v 1.14 2010/11/05 03:47:01 dtucker Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 2006 Darren Tucker. All rights reserved. 4 * Copyright (c) 2006 Darren Tucker. All rights reserved.
@@ -17,6 +17,10 @@
17 */ 17 */
18 18
19#include "config.h" 19#include "config.h"
20
21#include <sys/types.h>
22#include <unistd.h>
23
20#include "platform.h" 24#include "platform.h"
21 25
22#include "openbsd-compat/openbsd-compat.h" 26#include "openbsd-compat/openbsd-compat.h"
@@ -59,6 +63,18 @@ platform_post_fork_child(void)
59#endif 63#endif
60} 64}
61 65
66/* return 1 if we are running with privilege to swap UIDs, 0 otherwise */
67int
68platform_privileged_uidswap(void)
69{
70#ifdef HAVE_CYGWIN
71 /* uid 0 is not special on Cygwin so always try */
72 return 1;
73#else
74 return (getuid() == 0 || geteuid() == 0);
75#endif
76}
77
62/* 78/*
63 * This gets called before switching UIDs, and is called even when sshd is 79 * This gets called before switching UIDs, and is called even when sshd is
64 * not running as root. 80 * not running as root.