diff options
author | Othmar Gsenger <otti@anytun.org> | 2010-01-23 22:58:51 +0000 |
---|---|---|
committer | Othmar Gsenger <otti@anytun.org> | 2010-01-23 22:58:51 +0000 |
commit | 4b91b6003cc6b6a50426e327f4b69ee6e4eb7a48 (patch) | |
tree | 0cf42f061dbd91445b3b24338a6a4be5c4c717b9 /src/anytun-controld.cpp | |
parent | now using sigtimedwait instead of sigwait (diff) |
fixed init script for differend Config dirs and multiconnection with no default key derivation
important: fixed priviledge dropping with multi connection (anytun-controlld), was not working with default config files
Diffstat (limited to 'src/anytun-controld.cpp')
-rw-r--r-- | src/anytun-controld.cpp | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/src/anytun-controld.cpp b/src/anytun-controld.cpp index c70f770..dd9be12 100644 --- a/src/anytun-controld.cpp +++ b/src/anytun-controld.cpp @@ -47,17 +47,15 @@ #include "syncServer.h" #include "daemon.hpp" +#include <vector> + +std::list<std::string> config_; void syncOnConnect(SyncTcpConnection * connptr) { - std::ifstream file(gOpt.getFileName().c_str()); - if(file.is_open()) { - std::string line; - while (!file.eof()) { - getline (file,line); - connptr->Send(line); - } - file.close(); + for(std::list<std::string>::const_iterator it=config_.begin(); it!=config_.end();++it) + { + connptr->Send(*it); } } @@ -106,8 +104,14 @@ int main(int argc, char* argv[]) std::ifstream file( gOpt.getFileName().c_str() ); if( file.is_open() ) + { + std::string line; + while (!file.eof()) { + getline (file,line); + config_.push_back(line); + } file.close(); - else { + } else { std::cout << "ERROR: unable to open file!" << std::endl; exit(-1); } @@ -118,13 +122,11 @@ int main(int argc, char* argv[]) daemonized = true; } - gSignalController.init(); - gResolver.init(); - if(gOpt.getChrootDir() != "") do_chroot(gOpt.getChrootDir()); - privs.drop(); + gSignalController.init(); + gResolver.init(); boost::thread * syncListenerThread; syncListenerThread = new boost::thread(boost::bind(syncListener)); |