diff options
-rw-r--r-- | nsswitch/pam_winbind.c | 46 |
1 files changed, 15 insertions, 31 deletions
diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index d4df8b169a..682af8ee88 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -164,25 +164,6 @@ static inline void textdomain_init(void) #endif -/* - * Work around the pam API that has functions with void ** as parameters - * These lead to strict aliasing warnings with gcc. - */ -static int _pam_get_item(const pam_handle_t *pamh, - int item_type, - const void *_item) -{ - const void **item = (const void **)_item; - return pam_get_item(pamh, item_type, item); -} -static int _pam_get_data(const pam_handle_t *pamh, - const char *module_data_name, - const void *_data) -{ - const void **data = (const void **)_data; - return pam_get_data(pamh, module_data_name, data); -} - /* some syslogging */ #ifdef HAVE_PAM_VSYSLOG @@ -202,7 +183,7 @@ static void _pam_log_int(const pam_handle_t *pamh, char *format2 = NULL; const char *service; - _pam_get_item(pamh, PAM_SERVICE, &service); + pam_get_item(pamh, PAM_SERVICE, (const void **) &service); format2 = (char *)malloc(strlen(MODULE_NAME)+strlen(format)+strlen(service)+5); if (format2 == NULL) { @@ -645,7 +626,7 @@ static int converse(const pam_handle_t *pamh, int retval; struct pam_conv *conv; - retval = _pam_get_item(pamh, PAM_CONV, &conv); + retval = pam_get_item(pamh, PAM_CONV, (const void **) &conv); if (retval == PAM_SUCCESS) { retval = conv->conv(nargs, (const struct pam_message **)message, @@ -2121,7 +2102,9 @@ static int _winbind_read_password(struct pwb_context *ctx, if (on(WINBIND_TRY_FIRST_PASS_ARG, ctrl) || on(WINBIND_USE_FIRST_PASS_ARG, ctrl)) { - retval = _pam_get_item(ctx->pamh, authtok_flag, &item); + retval = pam_get_item(ctx->pamh, + authtok_flag, + (const void **) &item); if (retval != PAM_SUCCESS) { /* very strange. */ _pam_log(ctx, LOG_ALERT, @@ -2229,7 +2212,7 @@ static int _winbind_read_password(struct pwb_context *ctx, retval = pam_set_item(ctx->pamh, authtok_flag, token); _pam_delete(token); /* clean it up */ if (retval != PAM_SUCCESS || - (retval = _pam_get_item(ctx->pamh, authtok_flag, &item)) != PAM_SUCCESS) { + (retval = pam_get_item(ctx->pamh, authtok_flag, (const void **) &item)) != PAM_SUCCESS) { _pam_log(ctx, LOG_CRIT, "error manipulating password"); return retval; @@ -2800,7 +2783,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, { const char *username; int ret = PAM_USER_UNKNOWN; - void *tmp = NULL; + const char *tmp = NULL; struct pwb_context *ctx = NULL; ret = _pam_winbind_init_context(pamh, flags, argc, argv, &ctx); @@ -2841,7 +2824,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, pam_get_data(pamh, PAM_WINBIND_NEW_AUTHTOK_REQD, (const void **)&tmp); if (tmp != NULL) { - ret = atoi((const char *)tmp); + ret = atoi(tmp); switch (ret) { case PAM_AUTHTOK_EXPIRED: /* fall through, since new token is required in this case */ @@ -2967,8 +2950,8 @@ static bool _pam_require_krb5_auth_after_chauthtok(struct pwb_context *ctx, char *new_authtok_reqd_during_auth = NULL; struct passwd *pwd = NULL; - _pam_get_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH, - &new_authtok_reqd_during_auth); + pam_get_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH, + (const void **) &new_authtok_reqd_during_auth); pam_set_data(ctx->pamh, PAM_WINBIND_NEW_AUTHTOK_REQD_DURING_AUTH, NULL, NULL); @@ -2999,7 +2982,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, /* <DO NOT free() THESE> */ const char *user; - char *pass_old, *pass_new; + const char *pass_old; + const char *pass_new; /* </DO NOT free() THESE> */ char *Announce; @@ -3122,7 +3106,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, * get the old token back. */ - ret = _pam_get_item(pamh, PAM_OLDAUTHTOK, &pass_old); + ret = pam_get_item(pamh, PAM_OLDAUTHTOK, (const void **) &pass_old); if (ret != PAM_SUCCESS) { _pam_log(ctx, LOG_NOTICE, @@ -3172,8 +3156,8 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, * By reaching here we have approved the passwords and must now * rebuild the password database file. */ - _pam_get_data(pamh, PAM_WINBIND_PWD_LAST_SET, - &pwdlastset_update); + pam_get_data(pamh, PAM_WINBIND_PWD_LAST_SET, + (const void **) &pwdlastset_update); /* * if cached creds were enabled, make sure to set the |