Updated hash checking logics

pull/107/head
parent 300c1e5eaf
commit 24625521e6

@ -74,6 +74,18 @@ void yon_interface_update(main_window *widgets){
}
if (parameters_size>1&&!strcmp(parameters[1],"x")) parameters[1]=AUTOMATICALLY_LABEL;
if (parameters_size>2&&!strcmp(parameters[2],"x")) parameters[2]=login;
char *pars = "";
if (parameters_size>5&&strcmp(parameters[5],"x")&&strcmp(parameters[5],"")){
if (!check_is_password_hash(parameters[5])){
pars = ENCRYPTED_LABEL;
} else {
pars = UNENCRYPTED_LABEL;
}
} else {
pars = DEFAULT_USER_LABEL;
}
gtk_list_store_set(widgets->UsersList,&iter,
2,login,
3,parameters_size>0?parameters[0]:"",
@ -81,7 +93,7 @@ void yon_interface_update(main_window *widgets){
4,parameters_size>2&&!yon_char_is_empty(parameters[2])?parameters[2]:login,
5,parameters_size>3?!strcmp(parameters[3],"x")||!strcmp(parameters[3],"")?def_groups:parameters[3]:def_groups,
6,parameters_size>4?parameters[4]:"",
7,parameters_size>5?strcmp(parameters[5],"x")&&strcmp(parameters[5],"")? parameters[5][0]=='%'&&parameters[5][1]=='%'? UNENCRYPTED_LABEL: ENCRYPTED_LABEL : DEFAULT_USER_LABEL : DEFAULT_USER_LABEL,
7,pars,
-1);
if(parameters)
free(parameters);
@ -632,7 +644,7 @@ void on_password_change(GtkWidget *self, dictionary *entry_dict){//
if (!yon_char_is_empty(password)){
password = yon_char_new(password);
if (main_config.load_mode==0){
if (password[0]=='$'){
if (!check_is_password_hash(password)){
gtk_entry_set_text(GTK_ENTRY(window->PasswordHashEntry),password);
} else {
if (password[0]=='%'&&password[1]=='%'){

@ -44,6 +44,7 @@
#define samba_sync_command(user) yon_char_unite("sudo smbpasswd -Las ",user,NULL)
#define samba_sync_password_command(user, password) yon_char_unite("(echo \"",password,"\"; echo \"",password,"\") | sudo smbpasswd -Las ",user,NULL)
#define get_passwords_command "ubconfig --target global get [users] USERADD[*] GROUPADD[*]"
#define check_is_password_hash(password) system(yon_char_append("/lib/ublinux/functions is_hash_password ", password))
#define groups_path "/etc/group"
#define users_path "/etc/passwd"

Loading…
Cancel
Save