How to create conditional behaviour with pam_exec and PAM_TYPE?
Solution 1:
I have this answer from another site:
You cannot depend on jumps in PAM stack in the close_session calls. The pam module stack is "frozen" in the open_session and identical modules in the same order are invoked in the close_session call.
The behavior of my scripts is now clear: My approach is not possible!