# define logaudit(tty, username, hostname, pwd, status)
#endif /* HAVE_LIBAUDIT */
+#ifdef HAVE_SECURITY_PAM_MISC_H
+/* encapsulate stupid "void **" pam_get_item() API */
+int
+get_pam_username(pam_handle_t *pamh, char **name)
+{
+ const void *item = (void *) *name;
+ int rc;
+ rc = pam_get_item(pamh, PAM_USER, &item);
+ *name = (char *) item;
+ return rc;
+}
+#endif
+
int
main(int argc, char **argv)
{
int failcount=0;
/* if we didn't get a user on the command line, set it to NULL */
- pam_get_item(pamh, PAM_USER, (const void **) &username);
+ get_pam_username(pamh, &username);
/* there may be better ways to deal with some of these
conditions, but at least this way I don't think we'll
(retcode == PAM_USER_UNKNOWN) ||
(retcode == PAM_CRED_INSUFFICIENT) ||
(retcode == PAM_AUTHINFO_UNAVAIL))) {
- pam_get_item(pamh, PAM_USER, (const void **) &username);
+ get_pam_username(pamh, &username);
syslog(LOG_NOTICE,_("FAILED LOGIN %d FROM %s FOR %s, %s"),
failcount, hostname, username, pam_strerror(pamh, retcode));
}
if (retcode != PAM_SUCCESS) {
- pam_get_item(pamh, PAM_USER, (const void **) &username);
+ get_pam_username(pamh, &username);
if (retcode == PAM_MAXTRIES)
syslog(LOG_NOTICE,_("TOO MANY LOGIN TRIES (%d) FROM %s FOR "
* Grab the user information out of the password file for future usage
* First get the username that we are actually using, though.
*/
- retcode = pam_get_item(pamh, PAM_USER, (const void **) &username);
+ retcode = get_pam_username(pamh, &username);
PAM_FAIL_CHECK;
if (!username || !*username) {