The following is a minimal implementation of
<citerefentry><refentrytitle>su
</refentrytitle><manvolnum>1
</manvolnum></citerefentry> using PAM. Note that it uses the OpenPAM-specific
<citerefentry><refentrytitle>openpam_ttyconv
</refentrytitle><manvolnum>3
</manvolnum></citerefentry> conversation function, which is prototyped in
<filename>security/openpam.h
</filename>. If you wish build this application on a system with a different PAM library, you will have to provide your own conversation function. A robust conversation function is surprisingly difficult to implement; the one presented in
<xref linkend="pam-sample-conv"/> is a good starting point, but should not be used in real-world applications.