0d8b9a17 | /* Copyright (C) CJ Affiliate * * You may use, distribute and modify this code under the * terms of the GNU General Public License version 2 or * later. * * You should have received a copy of the license with this * file. If not, you will find a copy in the "LICENSE" file * at https://github.com/cjdev/dual-control. */ |
21e4960f | #ifndef _BECOME_H #define _BECOME_H #include "user.h" #include "sys_unistd.h" class become { |
0d8b9a17 | private: |
21e4960f | unistd unistd_; |
0d8b9a17 | public: become (user user, unistd &unistd) : unistd_ (unistd) |
21e4960f | { uid_t uid = user.uid(); |
0d8b9a17 | unistd_.seteuid (uid); |
21e4960f | } ~become() { |
0d8b9a17 | unistd_.seteuid (0); |
21e4960f | } }; #endif |
0d8b9a17 |