fix(biometric_pam):Fixed an issue where biometrics could not be used on the lock screen after logout

Description:修复注销后锁屏界面无法使用生物识别的问题

Log:【主要】【需求24683】【登录选项】登录界面不显示扫码登录 https://e.gitee.com/openkylin-enterprise/dashboard?issue=I8KQ18
This commit is contained in:
liuyuanpeng 2023-12-12 11:15:59 +08:00
parent 915c5c5c7a
commit ed898eb625
1 changed files with 23 additions and 1 deletions

View File

@ -463,6 +463,28 @@ void get_greeter_session(char buf[], int len)
if (stdout_pidof)
g_free(stdout_pidof);
g_ptr_array_free (args_pidof, TRUE);
//如果ukui-greeter进程不存在进而判断ukui-screensaver-backend进程
args_pidof = g_ptr_array_new ();
g_ptr_array_add(args_pidof, (gpointer)"/usr/bin/pidof");
g_ptr_array_add(args_pidof, (gpointer)"ukui-screensaver-backend");
g_ptr_array_add(args_pidof, NULL);
if (!g_spawn_sync(NULL, (char**)args_pidof->pdata, NULL, G_SPAWN_STDERR_TO_DEV_NULL, NULL, NULL, &stdout_pidof, NULL, NULL, NULL)) {
if (stdout_pidof)
g_free(stdout_pidof);
g_ptr_array_free (args_pidof, TRUE);
}
if (stdout_pidof) {
if (strlen(stdout_pidof) > 0 && atoi(stdout_pidof) > 0) {
g_strlcpy(buf, "ukui-screensaver-backend", len);
}
g_free(stdout_pidof);
}
g_ptr_array_free (args_pidof, TRUE);
return ;
}
if (stdout_pidof) {
@ -668,7 +690,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc,
get_greeter_session(buf, sizeof(buf));
pam_logger("current greeter: %s\n", buf);
if(strcmp(buf, "ukui-greeter") == 0 || strcmp(buf, "ukui-greeter-wayland") == 0 || strcmp(buf, "ukui-session") == 0)
if(strcmp(buf, "ukui-greeter") == 0 || strcmp(buf, "ukui-greeter-wayland") == 0 || strcmp(buf, "ukui-session") == 0 || strcmp(buf,"ukui-screensaver-backend"))
return biometric_auth_embeded(pamh);
// else
// return biometric_auth_independent(pamh, "lightdm", 1);