forked from enlightenment/enlightenment
feature: revive personal desklock passwords
these were previously disabled because hashing a password was too much work (I guess?), but now they're back. config dialog has changed accordingly
This commit is contained in:
parent
bf7a2e8c47
commit
cb956069d5
|
@ -569,8 +569,7 @@ _e_config_edd_init(Eina_Bool old)
|
|||
E_CONFIG_LIST(D, T, gadcons, _e_config_gadcon_edd);
|
||||
E_CONFIG_LIST(D, T, shelves, _e_config_shelf_edd);
|
||||
E_CONFIG_VAL(D, T, font_hinting, INT); /**/
|
||||
E_CONFIG_VAL(D, T, desklock_personal_passwd, STR);
|
||||
E_CONFIG_VAL(D, T, desklock_background, STR);
|
||||
E_CONFIG_VAL(D, T, desklock_passwd, INT);
|
||||
E_CONFIG_LIST(D, T, desklock_backgrounds, _e_config_desklock_bg_edd); /**/
|
||||
E_CONFIG_VAL(D, T, desklock_auth_method, INT);
|
||||
E_CONFIG_VAL(D, T, desklock_login_box_zone, INT);
|
||||
|
@ -1299,6 +1298,12 @@ e_config_load(void)
|
|||
ecore_file_recursive_rm(buf);
|
||||
}
|
||||
}
|
||||
CONFIG_VERSION_CHECK(15)
|
||||
{
|
||||
CONFIG_VERSION_UPDATE_INFO(15);
|
||||
if (e_config->desklock_use_custom_desklock)
|
||||
e_config->desklock_auth_method = E_DESKLOCK_AUTH_METHOD_EXTERNAL;
|
||||
}
|
||||
}
|
||||
if (!e_config->remember_internal_fm_windows)
|
||||
e_config->remember_internal_fm_windows = !!(e_config->remember_internal_windows & E_REMEMBER_INTERNAL_FM_WINS);
|
||||
|
@ -1399,6 +1404,7 @@ e_config_load(void)
|
|||
E_CONFIG_LIMIT(e_config->desklock_autolock_idle, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->desklock_autolock_idle_timeout, 1.0, 5400.0);
|
||||
E_CONFIG_LIMIT(e_config->desklock_use_custom_desklock, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->desklock_auth_method, 0, E_DESKLOCK_AUTH_METHOD_LAST);
|
||||
E_CONFIG_LIMIT(e_config->desklock_ask_presentation, 0, 1);
|
||||
E_CONFIG_LIMIT(e_config->desklock_ask_presentation_timeout, 1.0, 300.0);
|
||||
E_CONFIG_LIMIT(e_config->border_raise_on_mouse_action, 0, 1);
|
||||
|
@ -1483,11 +1489,6 @@ e_config_load(void)
|
|||
|
||||
/* FIXME: disabled auto apply because it causes problems */
|
||||
e_config->cfgdlg_auto_apply = 0;
|
||||
/* FIXME: desklock personalized password id disabled for security reasons */
|
||||
e_config->desklock_auth_method = 0;
|
||||
if (e_config->desklock_personal_passwd)
|
||||
eina_stringshare_del(e_config->desklock_personal_passwd);
|
||||
e_config->desklock_personal_passwd = NULL;
|
||||
|
||||
ecore_event_add(E_EVENT_CONFIG_LOADED, NULL, NULL, NULL);
|
||||
}
|
||||
|
@ -2244,8 +2245,6 @@ _e_config_free(E_Config *ecf)
|
|||
if (ecf->transition_change) eina_stringshare_del(ecf->transition_change);
|
||||
if (ecf->input_method) eina_stringshare_del(ecf->input_method);
|
||||
if (ecf->exebuf_term_cmd) eina_stringshare_del(ecf->exebuf_term_cmd);
|
||||
if (ecf->desklock_personal_passwd) eina_stringshare_del(ecf->desklock_personal_passwd);
|
||||
if (ecf->desklock_background) eina_stringshare_del(ecf->desklock_background);
|
||||
if (ecf->icon_theme) eina_stringshare_del(ecf->icon_theme);
|
||||
if (ecf->wallpaper_import_last_dev) eina_stringshare_del(ecf->wallpaper_import_last_dev);
|
||||
if (ecf->wallpaper_import_last_path) eina_stringshare_del(ecf->wallpaper_import_last_path);
|
||||
|
|
|
@ -48,7 +48,7 @@ typedef enum
|
|||
/* increment this whenever a new set of config values are added but the users
|
||||
* config doesn't need to be wiped - simply new values need to be put in
|
||||
*/
|
||||
#define E_CONFIG_FILE_GENERATION 14
|
||||
#define E_CONFIG_FILE_GENERATION 15
|
||||
#define E_CONFIG_FILE_VERSION ((E_CONFIG_FILE_EPOCH * 1000000) + E_CONFIG_FILE_GENERATION)
|
||||
|
||||
#define E_CONFIG_BINDINGS_VERSION 0 // DO NOT INCREMENT UNLESS YOU WANT TO WIPE ALL BINDINGS!!!!!
|
||||
|
@ -206,8 +206,7 @@ struct _E_Config
|
|||
Eina_List *shelves; // GUI
|
||||
int font_hinting; // GUI
|
||||
|
||||
const char *desklock_personal_passwd; // GUI
|
||||
const char *desklock_background; // OLD DON'T USE
|
||||
int desklock_passwd; // GUI // hashed
|
||||
Eina_List *desklock_backgrounds; // GUI
|
||||
int desklock_auth_method; // GUI
|
||||
int desklock_login_box_zone; // GUI
|
||||
|
|
|
@ -128,8 +128,6 @@ e_desklock_init(void)
|
|||
_e_desklock_idle_poller = ecore_poller_add(ECORE_POLLER_CORE, 256,
|
||||
_e_desklock_cb_idle_poller, NULL);
|
||||
|
||||
if (e_config->desklock_background)
|
||||
e_filereg_register(e_config->desklock_background);
|
||||
EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, bg)
|
||||
e_filereg_register(bg->file);
|
||||
|
||||
|
@ -152,8 +150,6 @@ e_desklock_shutdown(void)
|
|||
if (edd) waslocked = EINA_TRUE;
|
||||
if (!x_fatal)
|
||||
e_desklock_hide();
|
||||
if (e_config->desklock_background)
|
||||
e_filereg_deregister(e_config->desklock_background);
|
||||
|
||||
if (waslocked) e_util_env_set("E_DESKLOCK_LOCKED", "locked");
|
||||
|
||||
|
@ -163,8 +159,6 @@ e_desklock_shutdown(void)
|
|||
if (job) ecore_job_del(job);
|
||||
job = NULL;
|
||||
|
||||
if (e_config->desklock_background)
|
||||
e_filereg_deregister(e_config->desklock_background);
|
||||
EINA_LIST_FOREACH(e_config->desklock_backgrounds, l, bg)
|
||||
e_filereg_deregister(bg->file);
|
||||
|
||||
|
@ -249,7 +243,7 @@ e_desklock_show(Eina_Bool suspend)
|
|||
|
||||
if (_e_desklock_state) return EINA_TRUE;
|
||||
|
||||
if (e_config->desklock_use_custom_desklock && e_config->desklock_custom_desklock_cmd && e_config->desklock_custom_desklock_cmd[0])
|
||||
if (e_desklock_is_external() && e_config->desklock_custom_desklock_cmd && e_config->desklock_custom_desklock_cmd[0])
|
||||
{
|
||||
e_menu_hide_all();
|
||||
_e_custom_desklock_exe_handler =
|
||||
|
@ -268,19 +262,22 @@ e_desklock_show(Eina_Bool suspend)
|
|||
}
|
||||
|
||||
#ifndef HAVE_PAM
|
||||
e_util_dialog_show(_("Error - no PAM support"),
|
||||
_("No PAM support was built into Enlightenment, so<br>"
|
||||
"desk locking is disabled."));
|
||||
return 0;
|
||||
if (e_desklock_is_system())
|
||||
{
|
||||
e_util_dialog_show(_("Error - no PAM support"),
|
||||
_("No PAM support was built into Enlightenment, so<br>"
|
||||
"desk locking is disabled."));
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (edd) return 0;
|
||||
|
||||
#ifdef HAVE_PAM
|
||||
if (e_config->desklock_auth_method == 1)
|
||||
if (e_desklock_is_personal())
|
||||
{
|
||||
#endif
|
||||
if (!e_config->desklock_personal_passwd)
|
||||
if (!e_config->desklock_passwd)
|
||||
{
|
||||
E_Zone *zone;
|
||||
|
||||
|
@ -381,7 +378,7 @@ e_desklock_hide(void)
|
|||
ev->suspend = 1;
|
||||
ecore_event_add(E_EVENT_DESKLOCK, ev, NULL, NULL);
|
||||
|
||||
if (e_config->desklock_use_custom_desklock)
|
||||
if (e_desklock_is_external())
|
||||
{
|
||||
_e_custom_desklock_exe = NULL;
|
||||
return;
|
||||
|
@ -819,10 +816,8 @@ _e_desklock_check_auth(void)
|
|||
else if (e_config->desklock_auth_method == 1)
|
||||
{
|
||||
#endif
|
||||
if ((e_config->desklock_personal_passwd) &&
|
||||
(!strcmp(!edd->passwd ? "" : edd->passwd,
|
||||
!e_config->desklock_personal_passwd ? "" :
|
||||
e_config->desklock_personal_passwd)))
|
||||
if ((e_config->desklock_passwd) && (edd->passwd && edd->passwd[0]) &&
|
||||
(e_config->desklock_passwd == eina_hash_djb2(edd->passwd, strlen(edd->passwd))))
|
||||
{
|
||||
/* password ok */
|
||||
/* security - null out passwd string once we are done with it */
|
||||
|
|
|
@ -10,6 +10,14 @@ typedef enum _E_Desklock_Background_Method {
|
|||
E_DESKLOCK_BACKGROUND_METHOD_WALLPAPER,
|
||||
E_DESKLOCK_BACKGROUND_METHOD_CUSTOM,
|
||||
} E_Desklock_Background_Method;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
E_DESKLOCK_AUTH_METHOD_SYSTEM = 0,
|
||||
E_DESKLOCK_AUTH_METHOD_PERSONAL = 1,
|
||||
E_DESKLOCK_AUTH_METHOD_EXTERNAL = 2,
|
||||
} E_Desklock_Auth_Method;
|
||||
|
||||
#else
|
||||
#ifndef E_DESKLOCK_H
|
||||
#define E_DESKLOCK_H
|
||||
|
@ -35,5 +43,23 @@ EAPI void e_desklock_hide_hook_del(E_Desklock_Hide_Cb cb);
|
|||
|
||||
extern EAPI int E_EVENT_DESKLOCK;
|
||||
|
||||
static inline Eina_Bool
|
||||
e_desklock_is_external(void)
|
||||
{
|
||||
return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_EXTERNAL;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
e_desklock_is_personal(void)
|
||||
{
|
||||
return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL;
|
||||
}
|
||||
|
||||
static inline Eina_Bool
|
||||
e_desklock_is_system(void)
|
||||
{
|
||||
return e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_SYSTEM;
|
||||
}
|
||||
|
||||
#endif
|
||||
#endif
|
||||
|
|
|
@ -9,6 +9,7 @@ static int _basic_check_changed(E_Config_Dialog *cfd, E_Config_Dialog_D
|
|||
static Evas_Object *_basic_create(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
||||
|
||||
static void _cb_method_change(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _login_method_change(void *data, Evas_Object *obj, void *event_info);
|
||||
static void _cb_login_change(void *data, Evas_Object *obj);
|
||||
static int _zone_count_get(void);
|
||||
|
||||
|
@ -16,6 +17,7 @@ static void _cb_bg_mouse_down(void *data, Evas *evas, Evas_Object *obj,
|
|||
|
||||
struct _E_Config_Dialog_Data
|
||||
{
|
||||
Evas_Object *lock_cmd_entry, *passwd_entry;
|
||||
E_Config_Dialog *cfd, *bg_fsel;
|
||||
|
||||
/* Common vars */
|
||||
|
@ -26,9 +28,10 @@ struct _E_Config_Dialog_Data
|
|||
int start_locked;
|
||||
int lock_on_suspend;
|
||||
int auto_lock;
|
||||
int locking_method;
|
||||
int desklock_auth_method;
|
||||
int login_zone;
|
||||
int zone;
|
||||
char *desklock_personal_passwd;
|
||||
char *custom_lock_cmd;
|
||||
|
||||
/* Layout */
|
||||
|
@ -43,7 +46,6 @@ struct _E_Config_Dialog_Data
|
|||
E_Desklock_Background_Method bg_method;
|
||||
int bg_method_prev;
|
||||
Eina_List *bgs;
|
||||
int custom_lock;
|
||||
int ask_presentation;
|
||||
double ask_presentation_timeout;
|
||||
|
||||
|
@ -125,7 +127,7 @@ _fill_data(E_Config_Dialog_Data *cfdata)
|
|||
cfdata->bg_method_prev = cfdata->bg_method;
|
||||
cfdata->use_xscreensaver = ecore_x_screensaver_event_available_get();
|
||||
|
||||
cfdata->custom_lock = e_config->desklock_use_custom_desklock;
|
||||
cfdata->desklock_auth_method = e_config->desklock_auth_method;
|
||||
if (e_config->desklock_custom_desklock_cmd)
|
||||
cfdata->custom_lock_cmd = strdup(e_config->desklock_custom_desklock_cmd);
|
||||
|
||||
|
@ -170,6 +172,7 @@ _free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
if (cfdata->bg_fsel)
|
||||
e_object_del(E_OBJECT(cfdata->bg_fsel));
|
||||
E_FREE(cfdata->custom_lock_cmd);
|
||||
E_FREE(cfdata->desklock_personal_passwd);
|
||||
EINA_LIST_FREE(cfdata->bgs, bg)
|
||||
eina_stringshare_del(bg);
|
||||
E_FREE(cfdata);
|
||||
|
@ -187,7 +190,7 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
E_Comp *comp;
|
||||
int screen_count, x = 0;
|
||||
|
||||
screen_count = ecore_x_xinerama_screen_count_get();
|
||||
screen_count = eina_list_count(e_xinerama_screens_get());
|
||||
|
||||
otb = e_widget_toolbook_add(evas, (24 * e_scale), (24 * e_scale));
|
||||
|
||||
|
@ -200,12 +203,32 @@ _basic_create(E_Config_Dialog *cfd __UNUSED__, Evas *evas, E_Config_Dialog_Data
|
|||
e_widget_disabled_set(ow, !cfdata->use_xscreensaver);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Custom Screenlock Command"), 0);
|
||||
ow = e_widget_entry_add(evas, &(cfdata->custom_lock_cmd), NULL, NULL, NULL);
|
||||
rg = e_widget_radio_group_new(&(cfdata->desklock_auth_method));
|
||||
ow = e_widget_radio_add(evas, _("Use System Authentication"), E_DESKLOCK_AUTH_METHOD_SYSTEM, rg);
|
||||
evas_object_smart_callback_add(ow, "changed", _login_method_change, cfdata);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
ow = e_widget_radio_add(evas, _("Use Personal Screenlock Password"), E_DESKLOCK_AUTH_METHOD_PERSONAL, rg);
|
||||
evas_object_smart_callback_add(ow, "changed", _login_method_change, cfdata);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
ow = e_widget_radio_add(evas, _("Use External Screenlock Command"), E_DESKLOCK_AUTH_METHOD_EXTERNAL, rg);
|
||||
evas_object_smart_callback_add(ow, "changed", _login_method_change, cfdata);
|
||||
e_widget_list_object_append(ol, ow, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("Personal Screenlock Password"), 0);
|
||||
cfdata->passwd_entry = ow = e_widget_entry_add(evas, &(cfdata->desklock_personal_passwd), NULL, NULL, NULL);
|
||||
e_widget_entry_password_set(ow, 1);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
e_widget_list_object_append(ol, of, 1, 1, 0.5);
|
||||
|
||||
of = e_widget_framelist_add(evas, _("External Screenlock Command"), 0);
|
||||
cfdata->lock_cmd_entry = ow = e_widget_entry_add(evas, &(cfdata->custom_lock_cmd), NULL, NULL, NULL);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
|
||||
ow = e_widget_check_add(evas, _("Use Custom Screenlock Command"), &cfdata->custom_lock);
|
||||
e_widget_framelist_object_append(of, ow);
|
||||
e_widget_disabled_set(cfdata->passwd_entry,
|
||||
(cfdata->desklock_auth_method != E_DESKLOCK_AUTH_METHOD_PERSONAL));
|
||||
e_widget_disabled_set(cfdata->lock_cmd_entry,
|
||||
(cfdata->desklock_auth_method != E_DESKLOCK_AUTH_METHOD_EXTERNAL));
|
||||
|
||||
e_widget_list_object_append(ol, of, 1, 1, 0.5);
|
||||
e_widget_toolbook_page_append(otb, NULL, _("Locking"), ol,
|
||||
1, 0, 1, 0, 0.5, 0.0);
|
||||
|
@ -367,6 +390,13 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
const char *bg;
|
||||
E_Config_Desklock_Background *cbg;
|
||||
|
||||
e_config->desklock_auth_method = cfdata->desklock_auth_method;
|
||||
if (e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL)
|
||||
{
|
||||
e_config->desklock_passwd =
|
||||
eina_hash_djb2(cfdata->desklock_personal_passwd,
|
||||
strlen(cfdata->desklock_personal_passwd));
|
||||
}
|
||||
e_config->desklock_start_locked = cfdata->start_locked;
|
||||
e_config->desklock_on_suspend = cfdata->lock_on_suspend;
|
||||
e_config->desklock_autolock_idle = cfdata->auto_lock;
|
||||
|
@ -414,7 +444,6 @@ _basic_apply(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
|||
else
|
||||
e_config->desklock_login_box_zone = cfdata->zone;
|
||||
|
||||
e_config->desklock_use_custom_desklock = cfdata->custom_lock;
|
||||
if (cfdata->custom_lock_cmd)
|
||||
eina_stringshare_replace(&e_config->desklock_custom_desklock_cmd,
|
||||
cfdata->custom_lock_cmd);
|
||||
|
@ -442,6 +471,16 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
|
|||
if (e_config->desklock_autolock_idle != cfdata->auto_lock)
|
||||
return 1;
|
||||
|
||||
if (e_config->desklock_auth_method != cfdata->desklock_auth_method)
|
||||
return 1;
|
||||
if (e_config->desklock_auth_method == E_DESKLOCK_AUTH_METHOD_PERSONAL)
|
||||
{
|
||||
if (e_config->desklock_passwd !=
|
||||
eina_hash_djb2(cfdata->desklock_personal_passwd,
|
||||
strlen(cfdata->desklock_personal_passwd)))
|
||||
return 1;
|
||||
}
|
||||
|
||||
if (e_config->desklock_autolock_screensaver != cfdata->screensaver_lock)
|
||||
return 1;
|
||||
|
||||
|
@ -472,9 +511,6 @@ _basic_check_changed(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
|
|||
return 1;
|
||||
}
|
||||
|
||||
if (e_config->desklock_use_custom_desklock != cfdata->custom_lock)
|
||||
return 1;
|
||||
|
||||
if (e_config->desklock_custom_desklock_cmd && cfdata->custom_lock_cmd)
|
||||
{
|
||||
if (strcmp(e_config->desklock_custom_desklock_cmd, cfdata->custom_lock_cmd) != 0)
|
||||
|
@ -596,6 +632,27 @@ _cb_method_change(void *data, Evas_Object *obj __UNUSED__, void *event_info __UN
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_login_method_change(void *data, Evas_Object *obj EINA_UNUSED, void *event_info EINA_UNUSED)
|
||||
{
|
||||
E_Config_Dialog_Data *cfdata = data;
|
||||
|
||||
e_widget_disabled_set(cfdata->passwd_entry,
|
||||
(cfdata->desklock_auth_method != E_DESKLOCK_AUTH_METHOD_PERSONAL));
|
||||
if (!e_widget_disabled_get(cfdata->passwd_entry))
|
||||
{
|
||||
e_widget_entry_select_all(cfdata->passwd_entry);
|
||||
e_widget_focus_set(cfdata->passwd_entry, 1);
|
||||
}
|
||||
e_widget_disabled_set(cfdata->lock_cmd_entry,
|
||||
(cfdata->desklock_auth_method != E_DESKLOCK_AUTH_METHOD_EXTERNAL));
|
||||
if (!e_widget_disabled_get(cfdata->lock_cmd_entry))
|
||||
{
|
||||
e_widget_entry_select_all(cfdata->lock_cmd_entry);
|
||||
e_widget_focus_set(cfdata->lock_cmd_entry, 1);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
_cb_login_change(void *data, Evas_Object *obj __UNUSED__)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue