e auth - allow empty password users to auth successfully

devs/bu5hm4n/swipe_real
Carsten Haitzler 2 years ago
parent ec4d9d0460
commit 92700403f7
  1. 9
      src/bin/e_auth.c
  2. 11
      src/bin/e_ckpasswd_main.c

@ -6,17 +6,18 @@ e_auth_begin(char *passwd)
char buf[PATH_MAX];
Ecore_Exe *exe = NULL;
int ret = 0;
size_t pwlen;
size_t pwlen, buflen = 0;
pwlen = strlen(passwd);
if (pwlen == 0) goto out;
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_ckpasswd pw",
e_prefix_lib_get());
exe = ecore_exe_pipe_run(buf, ECORE_EXE_PIPE_WRITE, NULL);
if (!exe) goto out;
if (ecore_exe_send(exe, passwd, pwlen) != EINA_TRUE) goto out;
snprintf(buf, sizeof(buf), "pw %s", passwd);
buflen = strlen(buf);
if (ecore_exe_send(exe, buf, buflen) != EINA_TRUE) goto out;
ecore_exe_close_stdin(exe);
ret = ecore_exe_pid_get(exe);
@ -32,6 +33,7 @@ out:
if (exe) ecore_exe_free(exe);
e_util_memclear(passwd, pwlen);
e_util_memclear(buf, buflen);
return ret;
}
@ -44,7 +46,6 @@ e_auth_polkit_begin(char *passwd, const char *cookie, unsigned int uid)
size_t pwlen, buflen = 0;
pwlen = strlen(passwd);
if (pwlen == 0) goto out;
snprintf(buf, sizeof(buf),
"%s/enlightenment/utils/enlightenment_ckpasswd pk",

@ -266,6 +266,17 @@ main(int argc, char **argv)
// read passwd from stdin
if (polkit_mode == 0)
{
rd = read(0, pw, 3);
if (rd != 3)
{
fprintf(stderr, "AUTH: Error. Can't read passwd preable\n");
goto err;
}
if (!((pw[0] == 'p') && (pw[1] == 'w') && (pw[2] == ' ')))
{
fprintf(stderr, "AUTH: Error. Preable is wrong\n");
goto err;
}
rd = read(0, pw, sizeof(pw) - 1);
if (rd < 0)
{

Loading…
Cancel
Save