From 23a41ce888caaea871bf3c20c83136e3f6002f2a Mon Sep 17 00:00:00 2001 From: Arthur de Jong Date: Mon, 25 Nov 2013 18:27:36 +0100 Subject: Add a test for pam_get_item() argument type This checks whether pam_get_item() takes a const void ** or void ** item value argument and defines a PAM_ITEM_CONST macro that is const when it should. This avoids some compiler warnings. --- compat/pam_get_authtok.c | 6 +++--- compat/pam_prompt.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'compat') diff --git a/compat/pam_get_authtok.c b/compat/pam_get_authtok.c index 9b8825b..d83ddbe 100644 --- a/compat/pam_get_authtok.c +++ b/compat/pam_get_authtok.c @@ -44,7 +44,7 @@ int pam_get_authtok(pam_handle_t *pamh, int item, const char **authtok, char retype_prompt[80]; /* first try to see if the value is already on the stack */ *authtok = NULL; - rc = pam_get_item(pamh, item, (const void **)authtok); + rc = pam_get_item(pamh, item, (PAM_ITEM_CONST void **)authtok); if ((rc == PAM_SUCCESS) && (*authtok != NULL)) return PAM_SUCCESS; /* check what to prompt for and provide default prompt */ @@ -53,7 +53,7 @@ int pam_get_authtok(pam_handle_t *pamh, int item, const char **authtok, prompt = (prompt != NULL) ? prompt : "Old Password: "; else { - rc = pam_get_item(pamh, PAM_OLDAUTHTOK, (const void **)&oldauthtok); + rc = pam_get_item(pamh, PAM_OLDAUTHTOK, (PAM_ITEM_CONST void **)&oldauthtok); if ((rc == PAM_SUCCESS) && (oldauthtok != NULL)) { prompt = (prompt != NULL) ? prompt : "New Password: "; @@ -90,5 +90,5 @@ int pam_get_authtok(pam_handle_t *pamh, int item, const char **authtok, if (rc != PAM_SUCCESS) return rc; /* return token from the stack */ - return pam_get_item(pamh, item, (const void **)authtok); + return pam_get_item(pamh, item, (PAM_ITEM_CONST void **)authtok); } diff --git a/compat/pam_prompt.c b/compat/pam_prompt.c index d2fd761..8a9a8a8 100644 --- a/compat/pam_prompt.c +++ b/compat/pam_prompt.c @@ -38,7 +38,7 @@ int pam_prompt(pam_handle_t *pamh, int style, char **response, struct pam_message msg, *pmsg; struct pam_response *resp; /* the the conversion function */ - rc = pam_get_item(pamh, PAM_CONV, (const void **)&aconv); + rc = pam_get_item(pamh, PAM_CONV, (PAM_ITEM_CONST void **)&aconv); if (rc != PAM_SUCCESS) return rc; /* make the message string */ -- cgit v1.2.3