From 9ce4a03887c7bc580545597f02108c9a9c67aa3d Mon Sep 17 00:00:00 2001 From: Valient Gough Date: Fri, 11 Apr 2008 08:36:51 +0000 Subject: [PATCH] add error checking to setfsuid/setfsgid calls git-svn-id: http://encfs.googlecode.com/svn/trunk@13 db9cf616-1c43-0410-9cb8-a902689de0d6 --- encfs/FileNode.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/encfs/FileNode.cpp b/encfs/FileNode.cpp index 6b1f577..afe18e3 100644 --- a/encfs/FileNode.cpp +++ b/encfs/FileNode.cpp @@ -176,9 +176,23 @@ int FileNode::mknod(mode_t mode, dev_t rdev, uid_t uid, gid_t gid) int olduid = -1; int oldgid = -1; if(uid != 0) + { olduid = setfsuid( uid ); + if(olduid == -1) + { + rInfo("setfsuid error: %s", strerror(errno)); + return -EPERM; + } + } if(gid != 0) + { oldgid = setfsgid( gid ); + if(oldgid == -1) + { + rInfo("setfsgid error: %s", strerror(errno)); + return -EPERM; + } + } /* * cf. xmp_mknod() in fusexmp.c