Oh, forgot to mention. Pointer to callback should be inside pam_handle_t, not global. I.e.: typedef int pam_log_callback_t ( const char *service, const chat *module, int priority, const char *message); struct pam_handle_t { /* inside libpam */ ... pam_log_callback_t *log_callback; }; int pam_log(pam_handle_t *pamh, int pri, const char *fmt, ...); int pam_vlog(pam_handle_t *pamh, int pri, const char *fmt, va_list args); pam_log_callback_t *pam_set_log_callback(pam_handle_t *pamh, pam_log_callback_t *newcallback); Regards, Michael.