mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-30 00:01:50 +00:00
in DEBUG builds, created a PRLogModuleInfo for LDAP (gLDAPLogModule), and migrated most PR_fprintf(STDERR) bracketed by DEBUG_dmose to PR_LOG. a=r=(not built)
This commit is contained in:
parent
9aa82a567b
commit
49bb645f0b
@ -75,9 +75,6 @@ housecleaning
|
||||
error conditions (eg network & data errors). should audit interface
|
||||
boundaries to make sure they do appropriate checking.
|
||||
|
||||
* migrate from "#ifdef DEBUG_dmose PR_fprintf(PR_STDERR)" to a more
|
||||
general logging mechanism (PR_Log)
|
||||
|
||||
* does always using this-> for member vars cause inheritance problems? if so,
|
||||
does it matter in an XPCOM world?
|
||||
|
||||
@ -114,6 +111,10 @@ rdf datasource (in progress: dmose)
|
||||
|
||||
* nsILDAPURL (see nsIIOService.idl: extractScheme())
|
||||
|
||||
testing
|
||||
-------
|
||||
* see how the browser copes when it does such a big search that the server
|
||||
only returns partial results and an error.
|
||||
|
||||
perf
|
||||
----
|
||||
|
@ -1,5 +1,6 @@
|
||||
#include "ldap.h"
|
||||
#include "nsError.h"
|
||||
#include "nspr.h"
|
||||
|
||||
#define NS_ERROR_LDAP_OPERATIONS_ERROR \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, LDAP_OPERATIONS_ERROR)
|
||||
@ -12,3 +13,7 @@
|
||||
|
||||
#define NS_ERROR_LDAP_NOT_SUPPORTED \
|
||||
NS_ERROR_GENERATE_FAILURE(NS_ERROR_MODULE_LDAP, LDAP_NOT_SUPPORTED)
|
||||
|
||||
#ifdef DEBUG
|
||||
extern PRLogModuleInfo *gLDAPLogModule; // defn in nsLDAPProtocolModule.cpp
|
||||
#endif
|
||||
|
@ -32,6 +32,7 @@
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#include "nsLDAP.h"
|
||||
#include "nsLDAPConnection.h"
|
||||
#include "nsLDAPChannel.h"
|
||||
#include "nsString.h"
|
||||
@ -48,9 +49,6 @@
|
||||
//
|
||||
#include "nsIEventQueueService.h"
|
||||
|
||||
#ifdef DEBUG
|
||||
#include "nspr.h"
|
||||
#endif
|
||||
|
||||
NS_IMPL_THREADSAFE_ISUPPORTS3(nsLDAPChannel, nsIChannel, nsIRequest,
|
||||
nsILDAPMessageListener);
|
||||
@ -604,13 +602,13 @@ nsLDAPChannel::AsyncRead(nsIStreamListener* aListener,
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// kick off a bind operation
|
||||
// XXXdmose better error handling / passthrough; deal with password
|
||||
//
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "initiating SimpleBind\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("initiating SimpleBind\n"));
|
||||
rv = mCurrentOperation->SimpleBind(NULL);
|
||||
if (NS_FAILED(rv)) {
|
||||
|
||||
// XXXdmose better error handling / passthrough; deal with password
|
||||
//
|
||||
#ifdef DEBUG
|
||||
PR_fprintf(PR_STDERR, "mCurrentOperation->SimpleBind failed. rv=%d\n",
|
||||
rv);
|
||||
@ -756,9 +754,8 @@ nsLDAPChannel::OnLDAPBind(nsILDAPMessage *aMessage)
|
||||
// XXX what about timeouts?
|
||||
// XXX failure is a reasonable thing; don't assert
|
||||
//
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "bind completed; starting search\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
|
||||
("bind completed; starting search\n"));
|
||||
rv = mCurrentOperation->SearchExt(baseDn, scope, filter, 0, LDAP_NO_LIMIT);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
@ -773,9 +770,7 @@ nsLDAPChannel::OnLDAPSearchResult(nsILDAPMessage *aMessage)
|
||||
PRInt32 errorCode; // the LDAP error code
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "result returned\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("result returned\n"));
|
||||
|
||||
// XXX should use GetErrorString here?
|
||||
//
|
||||
@ -816,9 +811,7 @@ nsLDAPChannel::OnLDAPSearchEntry(nsILDAPMessage *aMessage)
|
||||
nsresult rv;
|
||||
char *dn, *attr;
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "entry returned!\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("entry returned!\n"));
|
||||
|
||||
// get the DN
|
||||
// XXX better err handling
|
||||
|
@ -31,7 +31,7 @@
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#include "nspr.h"
|
||||
#include "nsLDAP.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsLDAPConnection.h"
|
||||
#include "nsLDAPMessage.h"
|
||||
@ -56,9 +56,7 @@ nsLDAPConnection::~nsLDAPConnection()
|
||||
{
|
||||
int rc;
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR,"unbinding\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("unbinding\n"));
|
||||
|
||||
rc = ldap_unbind_s(this->mConnectionHandle);
|
||||
if (rc != LDAP_SUCCESS) {
|
||||
@ -68,9 +66,7 @@ nsLDAPConnection::~nsLDAPConnection()
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR,"unbound\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("unbound\n"));
|
||||
|
||||
// XXX can delete fail?
|
||||
//
|
||||
@ -97,6 +93,17 @@ nsLDAPConnection::Init(const char *aHost, PRInt16 aPort, const char *aBindName)
|
||||
NS_ENSURE_ARG(aHost);
|
||||
NS_ENSURE_ARG(aPort);
|
||||
|
||||
#ifdef DEBUG
|
||||
// initialize logging, if it hasn't been already
|
||||
//
|
||||
if (!gLDAPLogModule) {
|
||||
gLDAPLogModule = PR_NewLogModule("ldap");
|
||||
|
||||
NS_ABORT_IF_FALSE(gLDAPLogModule,
|
||||
"failed to initialize LDAP log module");
|
||||
}
|
||||
#endif
|
||||
|
||||
// XXXdmose - is a bindname of "" equivalent to a bind name of
|
||||
// NULL (which which means bind anonymously)? if so, we don't
|
||||
// need to go through these contortions.
|
||||
@ -337,9 +344,8 @@ nsLDAPConnection::Run(void)
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "nsLDAPConnection::Run() entered\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG,
|
||||
("nsLDAPConnection::Run() entered\n"));
|
||||
|
||||
// wait for results
|
||||
//
|
||||
@ -355,11 +361,11 @@ nsLDAPConnection::Run(void)
|
||||
switch (returnCode) {
|
||||
|
||||
case 0: // timeout
|
||||
|
||||
// the connection may not exist yet. sleep for a while
|
||||
// and try again
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "ldap_result() timed out.\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_WARNING,
|
||||
("ldap_result() timed out.\n"));
|
||||
PR_Sleep(2000);
|
||||
continue;
|
||||
|
||||
@ -421,9 +427,7 @@ nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
|
||||
nsCOMPtr<nsILDAPOperation> operation;
|
||||
nsCOMPtr<nsILDAPMessageListener> listener;
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "InvokeMessageCallback entered\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("InvokeMessageCallback entered\n"));
|
||||
|
||||
// get the message id corresponding to this operation
|
||||
//
|
||||
@ -447,10 +451,10 @@ nsLDAPConnection::InvokeMessageCallback(LDAPMessage *aMsgHandle,
|
||||
//
|
||||
nsISupports *data = mPendingOperations->Get(key);
|
||||
if (data == nsnull) {
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "InvokeMessageCallback(): couldn't find "
|
||||
"nsILDAPOperation corresponding to this message id\n");
|
||||
#endif
|
||||
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_WARNING,
|
||||
("InvokeMessageCallback(): couldn't find "
|
||||
"nsILDAPOperation corresponding to this message id\n"));
|
||||
delete key;
|
||||
|
||||
// this may well be ok, since it could just mean that the operation
|
||||
|
@ -42,6 +42,7 @@
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsILDAPMessageListener.h"
|
||||
#include "nsHashtable.h"
|
||||
#include "nspr.h"
|
||||
|
||||
// 0d871e30-1dd2-11b2-8ea9-831778c78e93
|
||||
//
|
||||
|
@ -71,3 +71,7 @@ static nsModuleComponentInfo components[] =
|
||||
// implement the NSGetModule() exported function
|
||||
//
|
||||
NS_IMPL_NSGETMODULE("nsLDAPProtocolModule", components);
|
||||
|
||||
#ifdef DEBUG
|
||||
PRLogModuleInfo *gLDAPLogModule = 0;
|
||||
#endif
|
||||
|
@ -31,11 +31,9 @@
|
||||
* GPL.
|
||||
*/
|
||||
|
||||
#include "nsLDAP.h"
|
||||
#include "nsLDAPService.h"
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
#include "nspr.h"
|
||||
#endif
|
||||
|
||||
// constructor
|
||||
//
|
||||
@ -60,10 +58,6 @@ nsLDAPService::Init(void)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "nsLDAPService::Init() entered!\n");
|
||||
#endif
|
||||
|
||||
NS_ASSERTION(!mThread, "nsLDAPService already initialized!");
|
||||
|
||||
rv = NS_NewThread(getter_AddRefs(mThread),
|
||||
@ -78,9 +72,7 @@ nsLDAPService::Init(void)
|
||||
NS_IMETHODIMP
|
||||
nsLDAPService::Run(void)
|
||||
{
|
||||
#ifdef DEBUG_dmose
|
||||
PR_fprintf(PR_STDERR, "nsLDAPService::Run() entered!\n");
|
||||
#endif
|
||||
PR_LOG(gLDAPLogModule, PR_LOG_DEBUG, ("nsLDAPService::Run() entered\n"));
|
||||
|
||||
// XXX - should use mThreadRunning here
|
||||
//
|
||||
|
Loading…
Reference in New Issue
Block a user