From: Michael Adam Date: Tue, 8 Sep 2015 16:25:02 +0000 (+0200) Subject: pam_winbind: check != PAM_SUCCESS and != NULL explicitly X-Git-Url: http://git.samba.org/?p=obnox%2Fsamba%2Fsamba-obnox.git;a=commitdiff_plain;h=490a27b69bc2a1ca4c22dcc2e239a0acedfee637 pam_winbind: check != PAM_SUCCESS and != NULL explicitly ...instead of using "if (ret)" or similar. This is just a code cleanup, no changes in behaviour. Signed-off-by: Michael Adam Reviewed-by: Volker Lendecke --- diff --git a/nsswitch/pam_winbind.c b/nsswitch/pam_winbind.c index a2d9f3bde9e..b83a2762092 100644 --- a/nsswitch/pam_winbind.c +++ b/nsswitch/pam_winbind.c @@ -1262,7 +1262,7 @@ static void _pam_setup_krb5_env(struct pwb_context *ctx, } ret = pam_putenv(ctx->pamh, var); - if (ret) { + if (ret != PAM_SUCCESS) { _pam_log(ctx, LOG_ERR, "failed to set KRB5CCNAME to %s: %s", var, pam_strerror(ctx->pamh, ret)); @@ -1328,7 +1328,7 @@ static void _pam_set_data_string(struct pwb_context *ctx, ret = pam_set_data(ctx->pamh, data_name, talloc_strdup(NULL, value), _pam_winbind_cleanup_func); - if (ret) { + if (ret != PAM_SUCCESS) { _pam_log_debug(ctx, LOG_DEBUG, "Could not set data %s: %s\n", data_name, pam_strerror(ctx->pamh, ret)); @@ -1656,7 +1656,7 @@ static int _pam_mkhomedir(struct pwb_context *ctx) } ret = _pam_create_homedir(ctx, create_dir, mode); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } } @@ -2369,7 +2369,7 @@ static const char *get_member_from_config(struct pwb_context *ctx) const char *ret = NULL; ret = get_conf_item_string(ctx, "require_membership_of", WINBIND_REQUIRED_MEMBERSHIP); - if (ret) { + if (ret != NULL) { return ret; } return get_conf_item_string(ctx, "require-membership-of", @@ -2488,7 +2488,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags, ZERO_STRUCT(logoff); retval = _pam_winbind_init_context(pamh, flags, argc, argv, type, &ctx); - if (retval) { + if (retval != PAM_SUCCESS) { return retval; } @@ -2503,7 +2503,7 @@ static int _pam_delete_cred(pam_handle_t *pamh, int flags, struct passwd *pwd = NULL; retval = pam_get_user(pamh, &user, _("Username: ")); - if (retval) { + if (retval != PAM_SUCCESS) { _pam_log(ctx, LOG_ERR, "could not identify user"); goto out; @@ -2624,7 +2624,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, retval = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_AUTHENTICATE, &ctx); - if (retval) { + if (retval != PAM_SUCCESS) { return retval; } @@ -2776,7 +2776,7 @@ int pam_sm_setcred(pam_handle_t *pamh, int flags, ret = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_SETCRED, &ctx); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } @@ -2830,7 +2830,7 @@ int pam_sm_acct_mgmt(pam_handle_t *pamh, int flags, ret = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_ACCT_MGMT, &ctx); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } @@ -2926,7 +2926,7 @@ int pam_sm_open_session(pam_handle_t *pamh, int flags, ret = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_OPEN_SESSION, &ctx); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } @@ -2953,7 +2953,7 @@ int pam_sm_close_session(pam_handle_t *pamh, int flags, ret = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_CLOSE_SESSION, &ctx); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } @@ -3039,7 +3039,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, ret = _pam_winbind_init_context(pamh, flags, argc, argv, PAM_WINBIND_CHAUTHTOK, &ctx); - if (ret) { + if (ret != PAM_SUCCESS) { return ret; } @@ -3054,7 +3054,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, * First get the name of a user */ ret = pam_get_user(pamh, &user, _("Username: ")); - if (ret) { + if (ret != PAM_SUCCESS) { _pam_log(ctx, LOG_ERR, "password - could not identify user"); goto out; @@ -3215,7 +3215,7 @@ int pam_sm_chauthtok(pam_handle_t * pamh, int flags, ret = winbind_chauthtok_request(ctx, user, pass_old, pass_new, pwdlastset_update); - if (ret) { + if (ret != PAM_SUCCESS) { pass_old = pass_new = NULL; goto out; }