]> git.ipfire.org Git - thirdparty/strongswan.git/commitdiff
capabilities: Return effective UID/GID if user did not configure anything
authorTobias Brunner <tobias@strongswan.org>
Tue, 25 Jun 2013 13:03:51 +0000 (15:03 +0200)
committerTobias Brunner <tobias@strongswan.org>
Tue, 25 Jun 2013 15:16:33 +0000 (17:16 +0200)
src/libstrongswan/utils/capabilities.c

index d1ab686a4f48cbbb372897f1c7e818a53681119a..8bc75b633640157e01b919e3cfc766d04b7414df 100644 (file)
@@ -208,13 +208,13 @@ METHOD(capabilities_t, keep, bool,
 METHOD(capabilities_t, get_uid, uid_t,
        private_capabilities_t *this)
 {
-       return this->uid;
+       return this->uid ?: geteuid();
 }
 
 METHOD(capabilities_t, get_gid, gid_t,
        private_capabilities_t *this)
 {
-       return this->gid;
+       return this->gid ?: getegid();
 }
 
 METHOD(capabilities_t, set_uid, void,