minor secure fixes
This commit is contained in:
parent
a21f94bb69
commit
782507ecf3
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE QtCreatorProject>
|
||||
<!-- Written by QtCreator 4.8.2, 2020-05-26T01:36:37. -->
|
||||
<!-- Written by QtCreator 4.8.2, 2020-05-27T13:14:37. -->
|
||||
<qtcreator>
|
||||
<data>
|
||||
<variable>EnvironmentId</variable>
|
||||
|
@ -61,10 +61,6 @@ void conexion::start_server(){
|
||||
close(sock);
|
||||
}
|
||||
|
||||
bool conexion::check_pass(std::string username, std::string passwd){
|
||||
return passwd==this->data->get_passwd(username);
|
||||
}
|
||||
|
||||
|
||||
void conexion_client(int client){
|
||||
char buf [256];
|
||||
|
@ -9,7 +9,6 @@ class conexion
|
||||
public:
|
||||
conexion(config_reader &conf);
|
||||
virtual void start_server();
|
||||
bool check_pass(std::string username, std::string passwd);
|
||||
protected:
|
||||
data_acces* data;
|
||||
int create_socket(int port);
|
||||
|
@ -4,7 +4,7 @@ use bin_database;
|
||||
create table users(
|
||||
id int key not null auto_increment,
|
||||
username varchar(30),
|
||||
passwd varchar(30),
|
||||
passwd varchar(200),
|
||||
admin bool
|
||||
);
|
||||
|
||||
|
@ -29,8 +29,10 @@ bool session_manager::validate_pass(){
|
||||
this->write_data("pass");
|
||||
if(this->data->get_admin(user)){
|
||||
this->write_data("admin");
|
||||
this->admin=true;
|
||||
}else{
|
||||
this->write_data("norma");
|
||||
this->admin=false;
|
||||
}
|
||||
this->user=user;
|
||||
return true;
|
||||
@ -50,11 +52,11 @@ void session_manager::start_dialog(){
|
||||
this->send_information();
|
||||
}else if(strcmp(buffer, "remv")==0){
|
||||
this->remove();
|
||||
}else if(strcmp(buffer,"uinf")==0){
|
||||
}else if((strcmp(buffer,"uinf")==0)&&this->admin){
|
||||
this->send_user_info();
|
||||
}else if(strcmp(buffer,"cusr")==0){
|
||||
}else if((strcmp(buffer,"cusr")==0)&&this->admin){
|
||||
this->create_user();
|
||||
}else if(strcmp(buffer,"rusr")==0){
|
||||
}else if((strcmp(buffer,"rusr")==0)&&this->admin){
|
||||
this->remove_user();
|
||||
}else if((strcmp(buffer,"exit")==0)||(n_read==0)){
|
||||
break;
|
||||
|
@ -22,6 +22,7 @@ public:
|
||||
data_acces* data;
|
||||
char** args;
|
||||
std::string user;
|
||||
bool admin;
|
||||
};
|
||||
|
||||
#endif // LAUNCHER_H
|
||||
|
Loading…
Reference in New Issue
Block a user