diff --git a/nslcd/myldap.c b/nslcd/myldap.c index afa1daf..40a03c7 100644 --- a/nslcd/myldap.c +++ b/nslcd/myldap.c @@ -534,10 +534,10 @@ static int do_ppolicy_bind(MYLDAP_SESSION *session, LDAP *ld, const char *uri) requestctrls[1] = NULL; /* build password berval */ cred.bv_val = (char *)session->bindpw; - cred.bv_len = (session->bindpw == NULL) ? 0 : strlen(session->bindpw); + cred.bv_len = strlen(session->bindpw); /* do a SASL simple bind with the binddn and bindpw */ log_log(LOG_DEBUG, "ldap_sasl_bind(\"%s\",%s) (uri=\"%s\")", session->binddn, - ((session->bindpw != NULL) && (session->bindpw[0] != '\0')) ? "\"***\"" : "\"\"", uri); + (session->bindpw[0] != '\0') ? "\"***\"" : "\"\"", uri); rc = ldap_sasl_bind(ld, session->binddn, LDAP_SASL_SIMPLE, &cred, requestctrls, NULL, &msgid); if (rc != LDAP_SUCCESS) return rc; @@ -622,7 +622,7 @@ static int do_bind(MYLDAP_SESSION *session, LDAP *ld, const char *uri) } #endif /* LDAP_OPT_X_TLS */ /* check if the binddn and bindpw are overwritten in the session */ - if ((session->binddn != NULL) && (session->binddn[0] != '\0')) + if (session->binddn[0] != '\0') { #if defined(HAVE_LDAP_SASL_BIND) && defined(LDAP_SASL_SIMPLE) return do_ppolicy_bind(session, ld, uri); diff --git a/pam/pam.c b/pam/pam.c index dcefa46..f927022 100644 --- a/pam/pam.c +++ b/pam/pam.c @@ -462,7 +462,7 @@ int pam_sm_authenticate(pam_handle_t *pamh, int flags, { rc = nslcd_request_config_get(pamh, &cfg, NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE, &resp); - if ((rc == PAM_SUCCESS) && (resp.msg != NULL) && (resp.msg[0] != '\0')) + if ((rc == PAM_SUCCESS) && (resp.msg[0] != '\0')) { /* we silently ignore errors to get the configuration option */ pam_syslog(pamh, LOG_NOTICE, "password change prohibited: %s; user=%s", @@ -665,7 +665,7 @@ int pam_sm_chauthtok(pam_handle_t *pamh, int flags, /* check if password modification is allowed */ rc = nslcd_request_config_get(pamh, &cfg, NSLCD_CONFIG_PAM_PASSWORD_PROHIBIT_MESSAGE, &resp); - if ((rc == PAM_SUCCESS) && (resp.msg != NULL) && (resp.msg[0] != '\0')) + if ((rc == PAM_SUCCESS) && (resp.msg[0] != '\0')) { /* we silently ignore errors to get the configuration option */ pam_syslog(pamh, LOG_NOTICE, "password change prohibited: %s; user=%s",