Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用自定义pam模块,登录界面无密码输入框 #6244 #346

Open
pinkkmin opened this issue Nov 22, 2023 · 1 comment
Open

使用自定义pam模块,登录界面无密码输入框 #6244 #346

pinkkmin opened this issue Nov 22, 2023 · 1 comment

Comments

@pinkkmin
Copy link

SUMMARY | 问题概要

UOS20 1060系统上编写自定义的pam模块,代码如下(只是一个样例):

#include <security/pam_modules.h>
#include <security/pam_ext.h>
#include <string.h>

// PAM模块入口函数,实现用户认证功能
PAM_EXTERN int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) {
const char *username = NULL;
const char *password = NULL;
int retval;

// 获取用户名和密码
retval = pam_get_user(pamh, &username, "Username: ");
if (retval != PAM_SUCCESS) {
    return retval;
}

retval = pam_get_authtok(pamh, PAM_AUTHTOK, &password, "Password: ");
if (retval != PAM_SUCCESS || password == NULL) {
    return retval;
}

// 进行身份验证
if (strcmp(username, "test") != 0 || strcmp(password, "123abc") != 0) {
    return PAM_AUTH_ERR;
}

return PAM_SUCCESS;
}

pam配置文件如下(/etc/pam.d/common-auth):
auth [success=done auth_err=die ignore=ignore default=bad] /usr/lib/security/libtest_pam.so

test@uos-PC:~$ ls /usr/lib/security/
libtest_pam.so pam_udcp.so

SOFTWARE/OS VERSIONS | 软件/系统版本信息

OS: UOS20 1060 桌面专业版
dde-session-shell 5.6.21-1
dde-session-ui 5.6.16-1
lightdm 1.26.7.19-1+dde

PRE-REQUIREMENT | 预置条件

No response

STEPS TO REPRODUCE | 复现步骤

  1. 修改pam配置文件使用自定义pam
  2. 注销或重启

OBSERVED RESULT | 观察到的结果

登录界面无密码输入框
image

EXPECTED RESULT | 期望的结果

image

ADDITIONAL INFORMATION | 额外补充

No response

@pinkkmin
Copy link
Author

dde-session-shell 5.6.21-1
修复???
src\lightdm-deepin-greeter\greeterworker.cpp
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant