首页 > 解决方案 > 在 PAM 模块中刷新 printf 语句

问题描述

我编写了一个带有身份验证过程的 PAM 模块,它输出带有时间延迟的状态消息。

int pam_sm_authenticate(pam_handle_t *pamh, int flags, int argc, const char **argv) {

    printf("Welcome to my PAM Module ... authentication\n");

    /* doing something which lasts about 30 seconds */

    printf("Authentication successfull!\n");
    return PAM_SUCCESS;
}

问题是身份验证过程(使用 sshd 测试)在 30 秒内没有输出任何内容。然后两条线同时出现。

Welcome to my PAM Module ... authentication
Authentication successfull!

我需要第一行立即出现,第二行在 30 秒后出现。

亲切的问候

标签: linuxunixpam

解决方案


推荐阅读