@@ -1314,22 +1314,24 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
13141314 if (breach_vals ) {
13151315 for (size_t i = 0 ; breach_vals [i ] != NULL ; i ++ ) {
13161316 const char * pwd = slapi_value_get_string (breach_vals [i ]);
1317- int breach_count = hibp_check_password (pwd , pwpolicy );
1318- if (breach_count > 0 ) {
1319- slapi_log_err (SLAPI_LOG_WARNING , "op_shared_allow_pw_change" ,
1320- "Rejecting password for %s - found in breach database (%d occurrences)\n" ,
1321- dn , breach_count );
1322- if (pwresponse_req == 1 ) {
1323- slapi_pwpolicy_make_response_control (pb , -1 , -1 , LDAP_PWPOLICY_INVALIDPWDSYNTAX );
1317+ if (pwd && !slapi_is_encoded ((char * )pwd )) {
1318+ int breach_count = hibp_check_password (pwd , pwpolicy );
1319+ if (breach_count > 0 ) {
1320+ slapi_log_err (SLAPI_LOG_WARNING , "op_shared_allow_pw_change" ,
1321+ "Rejecting password for %s - found in breach database (%d occurrences)\n" ,
1322+ dn , breach_count );
1323+ if (pwresponse_req == 1 ) {
1324+ slapi_pwpolicy_make_response_control (pb , -1 , -1 , LDAP_PWPOLICY_INVALIDPWDSYNTAX );
1325+ }
1326+ send_ldap_result (pb , LDAP_CONSTRAINT_VIOLATION , NULL ,
1327+ "Password found in breach database - choose a different password" , 0 , NULL );
1328+ valuearray_free (& breach_vals );
1329+ rc = -1 ;
1330+ goto done ;
1331+ } else if (breach_count < 0 ) {
1332+ slapi_log_err (SLAPI_LOG_WARNING , "op_shared_allow_pw_change" ,
1333+ "Failed to check password against breach database for %s\n" , dn );
13241334 }
1325- send_ldap_result (pb , LDAP_CONSTRAINT_VIOLATION , NULL ,
1326- "Password found in breach database - choose a different password" , 0 , NULL );
1327- valuearray_free (& breach_vals );
1328- rc = -1 ;
1329- goto done ;
1330- } else if (breach_count < 0 ) {
1331- slapi_log_err (SLAPI_LOG_WARNING , "op_shared_allow_pw_change" ,
1332- "Failed to check password against breach database for %s\n" , dn );
13331335 }
13341336 }
13351337 valuearray_free (& breach_vals );
@@ -1437,8 +1439,8 @@ op_shared_allow_pw_change(Slapi_PBlock *pb, LDAPMod *mod, char **old_pw, Slapi_M
14371439 goto done ;
14381440 }
14391441 } else if (pw_is_pwp_admin (pb , pwpolicy , PWP_ADMIN_OR_ROOTDN )) {
1440- /* This is an internal operation, but we still need to check if this
1441- * is a password admin */
1442+ /* This is an internal operation, but we still need to check if this
1443+ is a password admin */
14421444 if (!SLAPI_IS_MOD_DELETE (mod -> mod_op ) && pwpolicy -> pw_history ) {
14431445 /* Updating pw history, get the old password */
14441446 get_old_pw (pb , & sdn , old_pw );
0 commit comments