]> granicus.if.org Git - cronie/commitdiff
Cron doesn't use environment values from /etc/security/pam_env.conf.
authorMarcela Mašláňová <mmaslano@redhat.com>
Mon, 21 Dec 2009 12:58:08 +0000 (13:58 +0100)
committerMarcela Mašláňová <mmaslano@redhat.com>
Mon, 21 Dec 2009 12:58:08 +0000 (13:58 +0100)
This was fixed by moving pam_setcred into first part of authentication
of pam.

src/security.c

index c41c06b4212c1aa8feb4fa0553545671d12f5d75..5a2cdfabd78ca0904fe58b1c4fdff9a421a5187c 100644 (file)
@@ -159,6 +159,8 @@ int cron_start_pam(struct passwd *pw) {
        PAM_FAIL_CHECK;
        retcode = pam_acct_mgmt(pamh, PAM_SILENT);
        PAM_FAIL_CHECK;
+       retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
+       PAM_FAIL_CHECK;
 #endif
 
        return retcode;
@@ -168,8 +170,6 @@ static int cron_open_pam_session(struct passwd *pw) {
        int retcode = 0;
 
 #if defined(WITH_PAM)
-       retcode = pam_setcred(pamh, PAM_ESTABLISH_CRED | PAM_SILENT);
-       PAM_FAIL_CHECK;
        retcode = pam_open_session(pamh, PAM_SILENT);
        PAM_FAIL_CHECK;
        if (retcode == PAM_SUCCESS)