Fix issue #18308 by adding a retry mechanism in validate_windows_cred function