fix crash doing ldap replication, r/sr=mscott a=chofmann 230211

This commit is contained in:
bienvenu%nventure.com 2004-03-23 20:35:06 +00:00
Родитель 15e13e45fe
Коммит 20738f7f45
3 изменённых файлов: 27 добавлений и 2 удалений

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

@ -20,6 +20,7 @@
*
* Contributor(s):
* Rajiv Dayal <rdayal@netscape.com>
* David Bienvenu <bienvenu@nventure.com>
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
@ -120,6 +121,9 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryAuthDN(const nsACString & aValueUsedT
if(NS_FAILED(rv))
return rv;
rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->SearchExt(dn, nsILDAPURL::SCOPE_SUBTREE, filter,
attributes.GetSize(), attributes.GetArray(),
0, 0);
@ -130,8 +134,9 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryRootDSE()
if(!mInitialized)
return NS_ERROR_NOT_INITIALIZED;
return
mOperation->SearchExt(EmptyCString(), nsILDAPURL::SCOPE_BASE,
nsresult rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->SearchExt(EmptyCString(), nsILDAPURL::SCOPE_BASE,
NS_LITERAL_CSTRING("objectclass=*"),
MozillaLdapPropertyRelator::rootDSEAttribCount,
MozillaLdapPropertyRelator::changeLogRootDSEAttribs,
@ -151,6 +156,9 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryChangeLog(const nsACString & aChangeL
nsCAutoString filter (NS_LITERAL_CSTRING("changenumber>="));
filter.AppendInt(mDirServer->replInfo->lastChangeNumber+1);
nsresult rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->SearchExt(aChangeLogDN,
nsILDAPURL::SCOPE_ONELEVEL,
filter,
@ -181,6 +189,8 @@ NS_IMETHODIMP nsAbLDAPChangeLogQuery::QueryChangedEntries(const nsACString & aCh
if(NS_FAILED(rv))
return rv;
rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->SearchExt(aChangedEntryDN, scope, urlFilter,
attributes.GetSize(), attributes.GetArray(),
0, 0);

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

@ -111,6 +111,18 @@ nsresult nsAbLDAPReplicationQuery::InitLDAPData()
return rv;
}
nsresult nsAbLDAPReplicationQuery::CreateNewLDAPOperation()
{
nsresult rv;
nsCOMPtr <nsILDAPMessageListener> oldListener;
mOperation->GetMessageListener(getter_AddRefs(oldListener));
// release old and create a new instance
mOperation = do_CreateInstance(NS_LDAPOPERATION_CONTRACTID, &rv);
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->Init(mConnection, oldListener, nsnull);
}
NS_IMETHODIMP nsAbLDAPReplicationQuery::ConnectToLDAPServer(nsILDAPURL *aURL, const nsACString & aAuthDN)
{
NS_ENSURE_ARG_POINTER(aURL);
@ -232,6 +244,8 @@ NS_IMETHODIMP nsAbLDAPReplicationQuery::QueryAllEntries()
if (NS_FAILED(rv))
return rv;
rv = CreateNewLDAPOperation();
NS_ENSURE_SUCCESS(rv, rv);
return mOperation->SearchExt(dn, scope, urlFilter,
attributes.GetSize(), attributes.GetArray(),
0, 0);

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

@ -58,6 +58,7 @@ public:
virtual ~nsAbLDAPReplicationQuery();
nsresult InitLDAPData();
nsresult CreateNewLDAPOperation();
protected :
// pointer to interfaces used by this object