summaryrefslogtreecommitdiffhomepage
path: root/svr-authpubkey.c
diff options
context:
space:
mode:
authorPatrick Stewart <patstew@gmail.com>2019-03-20 14:44:49 +0000
committerMatt Johnston <matt@ucc.asn.au>2019-03-20 22:44:49 +0800
commit0af22aa8e43722082947bb48fa9ec2990f702c49 (patch)
treedf05ce2ebbb44ef528cb02a65da5f1bf28ac54bc /svr-authpubkey.c
parent2fd3b9f560a2d15cff9b2124f2e82073f8783d39 (diff)
Support servers without multiple user support (#76)
Diffstat (limited to 'svr-authpubkey.c')
-rw-r--r--svr-authpubkey.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/svr-authpubkey.c b/svr-authpubkey.c
index dafa99a..4f27986 100644
--- a/svr-authpubkey.c
+++ b/svr-authpubkey.c
@@ -347,6 +347,7 @@ static int checkpubkey(const char* algo, unsigned int algolen,
snprintf(filename, len + 22, "%s/.ssh/authorized_keys",
ses.authstate.pw_dir);
+#if DROPBEAR_SVR_MULTIUSER
/* open the file as the authenticating user. */
origuid = getuid();
origgid = getgid();
@@ -354,13 +355,16 @@ static int checkpubkey(const char* algo, unsigned int algolen,
(seteuid(ses.authstate.pw_uid)) < 0) {
dropbear_exit("Failed to set euid");
}
+#endif
authfile = fopen(filename, "r");
+#if DROPBEAR_SVR_MULTIUSER
if ((seteuid(origuid)) < 0 ||
(setegid(origgid)) < 0) {
dropbear_exit("Failed to revert euid");
}
+#endif
if (authfile == NULL) {
goto out;