3 #include "../datatypes.h"
6 #include "../signalController.h"
11 // void chrootAndDrop(string const& chrootdir, string const& username)
15 // std::cerr << "this programm has to be run as root in order to run in a chroot" << std::endl;
19 // struct passwd *pw = getpwnam(username.c_str());
21 // if(chroot(chrootdir.c_str()))
23 // std::cerr << "can't chroot to " << chrootdir << std::endl;
26 // std::cout << "we are in chroot jail (" << chrootdir << ") now" << std::endl;
28 // if (initgroups(pw->pw_name, pw->pw_gid) || setgid(pw->pw_gid) || setuid(pw->pw_uid))
30 // std::cerr << "can't drop to user " << username << " " << pw->pw_uid << ":" << pw->pw_gid << std::endl;
33 // std::cout << "dropped user to " << username << " " << pw->pw_uid << ":" << pw->pw_gid << std::endl;
37 // std::cerr << "unknown user " << username << std::endl;
52 // std::cout << "running in background now..." << std::endl;
55 // for (fd=getdtablesize();fd>=0;--fd) // close all file descriptors
57 // fd=open("/dev/null",O_RDWR); // stdin
64 int main(int argc
, char* argv
[])
66 std::cout
<< "plain_tool" << std::endl
;
67 if(!gOpt
.parse(argc
, argv
))
74 // chrootAndDrop(gOpt.getChrootDir, gOpt.getUsername);
75 // if(testSetPid(gOpt.pidFilename))
77 // std::cout << "exiting..." << std::endl;
81 // daemonize(gOpt.pidFilename);
84 cLog
.msg(Log::PRIO_NOTICE
) << "plain_tool started...";
89 // pthread_t senderThread;
90 // pthread_create(&senderThread, NULL, sender, &p);
91 // pthread_detach(senderThread);