How to simply print the contents of PAM_AUTHTOK when debugging? To make sense of using it, you must have some kind of contract or agreement between the modules.
By the way, there is a difference between saving the password in the clear and erasing it from there as soon as possible (or better: blocking this region in RAM or with an encrypted swap) and writing this plaintext to disk, the latter is just not sure, do not do this.
source share