add suport env variable
This commit is contained in:
parent
c85cb24277
commit
8a50e7c476
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE QtCreatorProject>
|
<!DOCTYPE QtCreatorProject>
|
||||||
<!-- Written by QtCreator 4.8.2, 2020-06-01T12:35:56. -->
|
<!-- Written by QtCreator 4.8.2, 2020-06-02T15:21:19. -->
|
||||||
<qtcreator>
|
<qtcreator>
|
||||||
<data>
|
<data>
|
||||||
<variable>EnvironmentId</variable>
|
<variable>EnvironmentId</variable>
|
||||||
|
@ -20,7 +20,6 @@ bool session_manager::validate_pass(){
|
|||||||
std::string user=buffer;
|
std::string user=buffer;
|
||||||
this->read_data(buffer, 256);
|
this->read_data(buffer, 256);
|
||||||
std::string pass=std::string(data_acces::get_hash(buffer));
|
std::string pass=std::string(data_acces::get_hash(buffer));
|
||||||
delete[] (buffer);
|
|
||||||
if(this->data->get_passwd(user)==pass){
|
if(this->data->get_passwd(user)==pass){
|
||||||
this->write_data("pass");
|
this->write_data("pass");
|
||||||
if(this->data->get_admin(user)){
|
if(this->data->get_admin(user)){
|
||||||
@ -30,7 +29,15 @@ bool session_manager::validate_pass(){
|
|||||||
this->write_data("norma");
|
this->write_data("norma");
|
||||||
this->admin=false;
|
this->admin=false;
|
||||||
}
|
}
|
||||||
|
this->read_data(buffer, 256);
|
||||||
|
std::string env=std::string(buffer);
|
||||||
|
if(env=="no"){
|
||||||
|
this->env="";
|
||||||
|
}else{
|
||||||
|
this->env=env+"-";
|
||||||
|
}
|
||||||
this->user=user;
|
this->user=user;
|
||||||
|
delete[] (buffer);
|
||||||
return true;
|
return true;
|
||||||
}else{
|
}else{
|
||||||
this->write_data("fail");
|
this->write_data("fail");
|
||||||
@ -103,12 +110,13 @@ int session_manager::remove(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::string session_manager::appli_command(char comand[], char* n_package){
|
std::string session_manager::appli_command(char comand[], char* n_package){
|
||||||
char** args=new char*[5];
|
char** args=new char*[6];
|
||||||
args[0]="sudo";
|
args[0]="sudo";
|
||||||
args[1]="emerge";
|
args[1]=strcat(&this->env[0],"emerge");
|
||||||
args[2]=comand;
|
args[2]="--buildpkg";
|
||||||
args[3]=n_package;
|
args[3]=comand;
|
||||||
args[4]=nullptr;
|
args[4]=n_package;
|
||||||
|
args[5]=nullptr;
|
||||||
int pid = fork();
|
int pid = fork();
|
||||||
int status=-2;
|
int status=-2;
|
||||||
std::string ret;
|
std::string ret;
|
||||||
|
@ -79,26 +79,11 @@ public:
|
|||||||
* @return Number of bytes writed
|
* @return Number of bytes writed
|
||||||
*/
|
*/
|
||||||
virtual int write_data(std::string output);
|
virtual int write_data(std::string output);
|
||||||
/**
|
|
||||||
* @brief fd
|
|
||||||
* Socket file desccriptor
|
|
||||||
*/
|
|
||||||
int fd;
|
int fd;
|
||||||
/**
|
|
||||||
* @brief data
|
|
||||||
* Object that contain media used to store and read information
|
|
||||||
*/
|
|
||||||
data_acces* data;
|
data_acces* data;
|
||||||
/**
|
|
||||||
* @brief user
|
|
||||||
* Name of the session owner
|
|
||||||
*/
|
|
||||||
std::string user;
|
std::string user;
|
||||||
/**
|
|
||||||
* @brief admin
|
|
||||||
* Privileges abut the user
|
|
||||||
*/
|
|
||||||
bool admin;
|
bool admin;
|
||||||
|
std::string env;
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // LAUNCHER_H
|
#endif // LAUNCHER_H
|
||||||
|
Loading…
Reference in New Issue
Block a user