Address sr comments for style & error-handling in bug 242789. Patch from bienvenu@nventure.com, r=sspitzer, sr=dmose

This commit is contained in:
dmose%mozilla.org 2005-04-04 21:01:15 +00:00
Родитель be3b927e1a
Коммит c8aee1997b
1 изменённых файлов: 25 добавлений и 22 удалений

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

@ -718,23 +718,26 @@ CheckLDAPOperationResult(nsHashKey *aKey, void *aData, void* aClosure)
switch (rv) {
case NS_OK:
{
case NS_OK: {
PRInt32 errorCode;
rawMsg->GetErrorCode(&errorCode);
if (errorCode == LDAP_PROTOCOL_ERROR)
{
// maybe a version error, e.g., using v3 on a v2 server.
// if we're using v3, try v2.
if (loop->mRawConn->mVersion == nsILDAPConnection::VERSION3)
{
//
if (errorCode == LDAP_PROTOCOL_ERROR &&
loop->mRawConn->mVersion == nsILDAPConnection::VERSION3) {
nsCAutoString password;
loop->mRawConn->mVersion = nsILDAPConnection::VERSION2;
ldap_set_option(loop->mRawConn->mConnectionHandle, LDAP_OPT_PROTOCOL_VERSION, &loop->mRawConn->mVersion);
nsCOMPtr <nsILDAPOperation> operation = NS_STATIC_CAST(nsILDAPOperation *, NS_STATIC_CAST(nsISupports *, aData));
// we pass in an empty password to tell the operation that it
// should use the cached password.
operation->SimpleBind(password);
ldap_set_option(loop->mRawConn->mConnectionHandle,
LDAP_OPT_PROTOCOL_VERSION, &loop->mRawConn->mVersion);
nsCOMPtr <nsILDAPOperation> operation =
NS_STATIC_CAST(nsILDAPOperation *,
NS_STATIC_CAST(nsISupports *, aData));
// we pass in an empty password to tell the operation that
// it should use the cached password.
//
rv = operation->SimpleBind(password);
if (NS_SUCCEEDED(rv)) {
operationFinished = PR_FALSE;
// we don't want to notify callers that we're done...
return PR_TRUE;