From a1950248ee3fb08374b5733afc3d9f123634319b Mon Sep 17 00:00:00 2001 From: Thorsten Kukuk Date: Mon, 30 May 2011 19:36:56 +0200 Subject: [PATCH] 2011-05-30 Thorsten Kukuk * modules/pam_timestamp/pam_timestamp.c (main): Remove unsused variable pretval. * modules/pam_stress/pam_stress.c (converse): **message is const. (stress_get_password): pmsg is const. (pam_sm_chauthtok): Likewise. * libpam/pam_item.c (pam_get_user): Make pmsg const and remove casts. --- ChangeLog | 11 +++++++++++ libpam/pam_item.c | 6 +++--- modules/pam_stress/pam_stress.c | 11 ++++++----- modules/pam_timestamp/pam_timestamp.c | 3 +-- 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/ChangeLog b/ChangeLog index 986a78fb..c60a1436 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2011-05-30 Thorsten Kukuk + + * modules/pam_timestamp/pam_timestamp.c (main): Remove unsused + variable pretval. + + * modules/pam_stress/pam_stress.c (converse): **message is const. + (stress_get_password): pmsg is const. + (pam_sm_chauthtok): Likewise. + * libpam/pam_item.c (pam_get_user): Make pmsg const and remove + casts. + 2011-05-30 Thorsten Kukuk * modules/pam_env/pam_env.c (_pam_parse): Implement debug option. diff --git a/libpam/pam_item.c b/libpam/pam_item.c index ed478a4a..00e00c29 100644 --- a/libpam/pam_item.c +++ b/libpam/pam_item.c @@ -274,7 +274,8 @@ int pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt) { const char *use_prompt; int retval; - struct pam_message msg,*pmsg; + struct pam_message msg; + const struct pam_message *pmsg; struct pam_response *resp; D(("called.")); @@ -340,8 +341,7 @@ int pam_get_user(pam_handle_t *pamh, const char **user, const char *prompt) resp = NULL; retval = pamh->pam_conversation-> - conv(1, (const struct pam_message **) &pmsg, &resp, - pamh->pam_conversation->appdata_ptr); + conv(1, &pmsg, &resp, pamh->pam_conversation->appdata_ptr); if (retval == PAM_CONV_AGAIN) { /* conversation function is waiting for an event - save state */ diff --git a/modules/pam_stress/pam_stress.c b/modules/pam_stress/pam_stress.c index 01587fea..b75a597d 100644 --- a/modules/pam_stress/pam_stress.c +++ b/modules/pam_stress/pam_stress.c @@ -116,7 +116,7 @@ _pam_parse (const pam_handle_t *pamh, int argc, const char **argv) } static int converse(pam_handle_t *pamh, int nargs - , struct pam_message **message + , const struct pam_message **message , struct pam_response **response) { int retval; @@ -126,8 +126,7 @@ static int converse(pam_handle_t *pamh, int nargs retval = pam_get_item(pamh,PAM_CONV,&void_conv); conv = void_conv; if (retval == PAM_SUCCESS && conv) { - retval = conv->conv(nargs, (const struct pam_message **) message - , response, conv->appdata_ptr); + retval = conv->conv(nargs, message, response, conv->appdata_ptr); if (retval != PAM_SUCCESS) { pam_syslog(pamh, LOG_ERR, "converse returned %d: %s", retval, pam_strerror(pamh, retval)); @@ -159,7 +158,8 @@ static int stress_get_password(pam_handle_t *pamh, int flags pam_syslog(pamh, LOG_WARNING, "no forwarded password"); return PAM_PERM_DENIED; } else { /* we will have to get one */ - struct pam_message msg[1],*pmsg[1]; + struct pam_message msg[1]; + const struct pam_message *pmsg[1]; struct pam_response *resp; int retval; @@ -412,7 +412,8 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, return PAM_SUCCESS; } else if (flags & PAM_UPDATE_AUTHTOK) { /* second call */ - struct pam_message msg[3],*pmsg[3]; + struct pam_message msg[3]; + const struct pam_message *pmsg[3]; struct pam_response *resp; const void *text; char *txt=NULL; diff --git a/modules/pam_timestamp/pam_timestamp.c b/modules/pam_timestamp/pam_timestamp.c index 26876769..7bcf3d12 100644 --- a/modules/pam_timestamp/pam_timestamp.c +++ b/modules/pam_timestamp/pam_timestamp.c @@ -684,7 +684,7 @@ struct pam_module _pam_timestamp_modstruct = { int main(int argc, char **argv) { - int i, pretval = -1, retval = 0, dflag = 0, kflag = 0; + int i, retval = 0, dflag = 0, kflag = 0; const char *target_user = NULL, *user = NULL, *tty = NULL; struct passwd *pwd; struct timeval tv; @@ -826,7 +826,6 @@ main(int argc, char **argv) select(STDOUT_FILENO + 1, NULL, NULL, &write_fds, &tv); - pretval = retval; retval = 0; } } while (dflag > 0); -- 2.40.0