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