From 78d1f8d88334f711eaaf6555d3a962a504d3e80e Mon Sep 17 00:00:00 2001 From: Andrew Deason Date: Wed, 13 Apr 2011 10:52:50 -0500 Subject: [PATCH] pam: Use PAM_CONST more often Some callers of pam_get_item et al were just casting their argument to a const void **. Some PAM implementations (Linux) want a const void**, but others (Solaris) do not. Use the PAM_CONST symbol already defined by autoconf to declare or cast the relevant variable const or not as appropriate. Change-Id: I81c7863797396eb146b78ffbb2586e4f3a1e854e Reviewed-on: http://gerrit.openafs.org/4470 Tested-by: BuildBot Reviewed-by: Derrick Brashear --- src/pam/afs_auth.c | 10 +++++----- src/pam/afs_password.c | 10 +++++----- src/pam/afs_setcred.c | 8 ++++---- 3 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/pam/afs_auth.c b/src/pam/afs_auth.c index 0fff2fd..fe18df9 100644 --- a/src/pam/afs_auth.c +++ b/src/pam/afs_auth.c @@ -55,11 +55,11 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, int use_klog = 0; int set_expires = 0; /* This option is only used in pam_set_cred() */ int got_authtok = 0; /* got PAM_AUTHTOK upon entry */ - char *user = NULL, *password = NULL; + PAM_CONST char *user = NULL, *password = NULL; afs_int32 password_expires = -1; int torch_password = 1; int i; - struct pam_conv *pam_convp = NULL; + PAM_CONST struct pam_conv *pam_convp = NULL; int auth_ok; struct passwd unix_pwd, *upwd = NULL; char upwd_buf[2048]; /* size is a guess. */ @@ -146,7 +146,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, refresh_token, set_token, dont_fork, use_klog); /* Try to get the user-interaction info, if available. */ - errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp); + errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp); if (errcode != PAM_SUCCESS) { pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT); pam_convp = NULL; @@ -154,7 +154,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, /* Who are we trying to authenticate here? */ if ((errcode = - pam_get_user(pamh, (const char **)&user, + pam_get_user(pamh, &user, "login: ")) != PAM_SUCCESS) { pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode); RET(PAM_USER_UNKNOWN); @@ -194,7 +194,7 @@ pam_sm_authenticate(pam_handle_t * pamh, int flags, int argc, RET(PAM_AUTH_ERR); } #endif - errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **)&password); + errcode = pam_get_item(pamh, PAM_AUTHTOK, (PAM_CONST void **)&password); if (errcode != PAM_SUCCESS || password == NULL) { if (use_first_pass) { pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user); diff --git a/src/pam/afs_password.c b/src/pam/afs_password.c index a315d2e..6ca838f 100644 --- a/src/pam/afs_password.c +++ b/src/pam/afs_password.c @@ -46,14 +46,14 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv) char realm[256]; char cell[256]; char *localcell; - char *user = NULL, *password = NULL; + PAM_CONST char *user = NULL, *password = NULL; char *new_password = NULL, *verify_password = NULL; char upwd_buf[2048]; /* size is a guess. */ char *reason = NULL; struct ktc_encryptionKey oldkey, newkey; struct ktc_token token; struct ubik_client *conn = 0; - struct pam_conv *pam_convp = NULL; + PAM_CONST struct pam_conv *pam_convp = NULL; struct passwd unix_pwd, *upwd = NULL; #ifndef AFS_SUN56_ENV @@ -93,7 +93,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv) } /* Try to get the user-interaction info, if available. */ - errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp); + errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp); if (errcode != PAM_SUCCESS) { pam_afs_syslog(LOG_WARNING, PAMAFS_NO_USER_INT); pam_convp = NULL; @@ -101,7 +101,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv) /* Who are we trying to authenticate here? */ if ((errcode = - pam_get_user(pamh, (const char **)&user, + pam_get_user(pamh, &user, "AFS username: ")) != PAM_SUCCESS) { pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode); RET(PAM_USER_UNKNOWN); @@ -139,7 +139,7 @@ pam_sm_chauthtok(pam_handle_t * pamh, int flags, int argc, const char **argv) } #endif - errcode = pam_get_item(pamh, PAM_AUTHTOK, (const void **)&password); + errcode = pam_get_item(pamh, PAM_AUTHTOK, (PAM_CONST void **)&password); if (errcode != PAM_SUCCESS || password == NULL) { if (use_first_pass) { pam_afs_syslog(LOG_ERR, PAMAFS_PASSWD_REQ, user); diff --git a/src/pam/afs_setcred.c b/src/pam/afs_setcred.c index 88062c6..bd03c11 100644 --- a/src/pam/afs_setcred.c +++ b/src/pam/afs_setcred.c @@ -46,7 +46,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) int set_expires = 0; /* the default is to not to set the env variable */ int use_klog = 0; int i; - struct pam_conv *pam_convp = NULL; + PAM_CONST struct pam_conv *pam_convp = NULL; char my_password_buf[256]; char *cell_ptr = NULL; char sbuffer[100]; @@ -54,7 +54,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) int torch_password = 1; int auth_ok = 0; char *lh; - char *user = NULL; + PAM_CONST char *user = NULL; int password_expires = -1; char *reason = NULL; struct passwd unix_pwd, *upwd = NULL; @@ -128,7 +128,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) pam_afs_syslog(LOG_DEBUG, PAMAFS_OPTIONS, nowarn, use_first_pass, try_first_pass, ignore_uid, ignore_uid_id, 8, 8, 8, 8); /* Try to get the user-interaction info, if available. */ - errcode = pam_get_item(pamh, PAM_CONV, (const void **)&pam_convp); + errcode = pam_get_item(pamh, PAM_CONV, (PAM_CONST void **)&pam_convp); if (errcode != PAM_SUCCESS) { if (logmask && LOG_MASK(LOG_DEBUG)) pam_afs_syslog(LOG_DEBUG, PAMAFS_NO_USER_INT); @@ -137,7 +137,7 @@ pam_sm_setcred(pam_handle_t * pamh, int flags, int argc, const char **argv) /* Who are we trying to authenticate here? */ if ((errcode = - pam_get_user(pamh, (const char **)&user, + pam_get_user(pamh, (PAM_CONST char **)&user, "AFS username:")) != PAM_SUCCESS) { pam_afs_syslog(LOG_ERR, PAMAFS_NOUSER, errcode); RET(PAM_USER_UNKNOWN); -- 1.9.4