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