Bug 1841348 - Avoid an exception when S/MIME certificates cannot be downloaded from LDAP. r=leftmostcat

Differential Revision: https://phabricator.services.mozilla.com/D182870

--HG--
extra : rebase_source : a306d170f15c97e8130d352622096b4a545d623d
extra : amend_source : 22621704ee02b3cf6890b0caad7a141ae32124b9
This commit is contained in:
Kai Engert 2023-07-06 10:41:46 +02:00
Родитель 3a1a12c59d
Коммит f8bf8dc08d
1 изменённых файлов: 12 добавлений и 3 удалений

Просмотреть файл

@ -223,9 +223,18 @@ class LDAPMessageListener {
}
if (Ci.nsILDAPMessage.RES_SEARCH_ENTRY == message.type) {
let outBinValues = message.getBinaryValues(USER_CERT_ATTRIBUTE);
for (let i = 0; i < outBinValues.length; ++i) {
importCert(outBinValues[i]);
let outBinValues = null;
try {
// This call may throw if the result message is empty or doesn't
// contain this attribute.
// It's an allowed condition that the attribute is missing on
// the server, so we silently ignore a failure to obtain it.
outBinValues = message.getBinaryValues(USER_CERT_ATTRIBUTE);
} catch (ex) {}
if (outBinValues) {
for (let i = 0; i < outBinValues.length; ++i) {
importCert(outBinValues[i]);
}
}
}
}