00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #include <config.h>
00020
00021 #include "dchroot-session-base.h"
00022
00023 #include <cassert>
00024 #include <cerrno>
00025 #include <cstdlib>
00026 #include <cstring>
00027 #include <iostream>
00028 #include <memory>
00029
00030 #include <unistd.h>
00031
00032 #include <syslog.h>
00033
00034 #include <boost/format.hpp>
00035
00036 using std::cout;
00037 using std::endl;
00038 using sbuild::_;
00039 using boost::format;
00040 using namespace dchroot;
00041
00042 session_base::session_base (std::string const& service,
00043 config_ptr& config,
00044 operation operation,
00045 sbuild::string_list const& chroots,
00046 bool compat):
00047 sbuild::session(service, config, operation, chroots),
00048 compat(compat)
00049 {
00050 }
00051
00052 session_base::~session_base ()
00053 {
00054 }
00055
00056 bool
00057 session_base::get_compat () const
00058 {
00059 return this->compat;
00060 }
00061
00062 void
00063 session_base::set_compat (bool state)
00064 {
00065 this->compat = state;
00066 }
00067
00068 void
00069 session_base::run_impl ()
00070 {
00071 if (get_ruid() != get_uid())
00072 throw error(get_ruser(), get_user(), USER_SWITCH,
00073 _("dchroot session restriction"));
00074
00075 sbuild::session::run_impl();
00076 }
00077
00078 sbuild::string_list
00079 session_base::get_command_directories () const
00080 {
00081
00082
00083 return get_login_directories();
00084 }