mirror of
https://github.com/lakinduakash/linux-wifi-hotspot.git
synced 2024-11-10 14:10:10 +00:00
Read macfilter file
This commit is contained in:
parent
8b60cf5bda
commit
7b0e88eebb
@ -57,6 +57,7 @@ char cmd_write_mac[BUFSIZE];
|
||||
char h_running_info[BUFSIZE];
|
||||
char interface_list[BUFSIZE];
|
||||
char wifi_interface_list[BUFSIZE];
|
||||
char accepted_macs[BUFSIZE];
|
||||
|
||||
const char* g_ssid=NULL;
|
||||
const char* g_pass=NULL;
|
||||
@ -164,6 +165,26 @@ void write_accepted_macs(char* filename, char* accepted_macs){
|
||||
|
||||
}
|
||||
|
||||
char * read_mac_filter_file(char * filename){
|
||||
|
||||
char ch;
|
||||
FILE *fp;
|
||||
|
||||
fp = fopen(filename, "r"); // read mode
|
||||
|
||||
if (fp == NULL)
|
||||
{
|
||||
perror("Error while opening the file.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while((ch = (char)fgetc(fp)) != EOF)
|
||||
strcat(accepted_macs, &ch);
|
||||
|
||||
fclose(fp);
|
||||
return accepted_macs;
|
||||
}
|
||||
|
||||
//int write_config(char* file){
|
||||
//
|
||||
// config_t cfg;
|
||||
|
@ -57,4 +57,6 @@ char** get_wifi_interface_list(int *length);
|
||||
|
||||
void write_accepted_macs(char* filename, char* accepted_macs);
|
||||
|
||||
char * read_mac_filter_file(char * filename);
|
||||
|
||||
#endif //WIHOTSPOT_H_PROP_H
|
||||
|
@ -483,6 +483,15 @@ void init_ui_from_config(){
|
||||
gtk_toggle_button_set_active((GtkToggleButton*) cb_novirt,TRUE);
|
||||
}
|
||||
|
||||
if(strcmp(values->mac_filter,"1")==0){
|
||||
gtk_toggle_button_set_active((GtkToggleButton*) cb_mac_filter,TRUE);
|
||||
}
|
||||
|
||||
char *macs =read_mac_filter_file(values->accepted_mac_file);
|
||||
if (macs!=NULL || strlen(macs)<1){
|
||||
gtk_text_buffer_set_text(buffer_mac_filter,macs,strlen(macs));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user