Initial interface and implementation of a class that represents the unique characteristics of an nsILDAPConnection (bug 70421). Patch from Leif Hedstrom <leif@netscape.com>. r=<dmose@netscape.com>, sr=<shaver@mozilla.org>.

This commit is contained in:
dmose%netscape.com 2001-03-24 07:09:55 +00:00
Родитель 4e353b1e1c
Коммит 3ff909bbd5
11 изменённых файлов: 348 добавлений и 1 удалений

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

@ -4,3 +4,4 @@ nsILDAPMessage.idl
nsILDAPURL.idl
nsILDAPMessageListener.idl
nsILDAPErrors.idl
nsILDAPServer.idl

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

@ -48,6 +48,7 @@ XPIDLSRCS = \
nsILDAPMessageListener.idl \
nsILDAPURL.idl \
nsILDAPErrors.idl \
nsILDAPServer.idl \
$(NULL)
ifdef MOZ_LDAP_XPCOM_EXPERIMENTAL

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

@ -30,7 +30,8 @@ XPIDLSRCS= .\nsILDAPConnection.idl \
.\nsILDAPMessage.idl \
.\nsILDAPURL.idl \
.\nsILDAPMessageListener.idl \
.\nsILDAPErrors.idl \
.\nsILDAPErrors.idl \
.\nsILDAPServer.idl \
!if defined(ENABLE_LDAP_EXPERIMENTAL)
!endif
$(NULL)

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

@ -0,0 +1,103 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the mozilla.org LDAP XPCOM component.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Leif Hedstrom <leif@netscape.com>
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
#include "nsISupports.idl"
interface nsILDAPURL;
/**
* this interface provides a way to store, retrieve and manipulate
* information related to a specific LDAP server. This includes the
* LDAP URL, as well as certain user specific data (e.g. credentials).
*
* The implementation of nsILDAPService relies heavily on this
* interface, managing all LDAP connections (nsILDAPConnection).
* The Service manages LDAP connections (connect and disconnect etc.),
* using the information available from these LDAP Server objects.
*/
[scriptable, uuid(8aa717a4-1dd2-11b2-99c7-f01e2d449ded)]
interface nsILDAPServer : nsISupports {
/**
* unique identifier for this server, used (typically) to identify a
* particular server object in a list of servers. This key can be
* any "string", but in our case it will most likely be the same
* identifier as used in a Mozilla preferences files.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
* @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
*/
attribute wstring key;
/**
* the password string used to bind to this server. An empty
* string here implies binding as anonymous.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
* @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
*/
attribute wstring password;
/**
* the user name to authenticate as. An empty string here would
* imply binding as anonymous.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
* @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
*/
attribute wstring username;
/**
* the bind DN (Distinguished Name).
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
* @exception NS_ERROR_OUT_OF_MEMORY ran out of memory
*/
attribute wstring binddn;
/** maximum number of hits we want to accept from an LDAP search
* operation.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
*/
attribute unsigned long sizelimit;
/**
* the URL for this server.
*
* @exception NS_ERROR_NULL_POINTER NULL pointer to GET method
*/
attribute nsILDAPURL url;
};

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

@ -51,6 +51,7 @@ CPPSRCS = \
nsLDAPConnection.cpp \
nsLDAPOperation.cpp \
nsLDAPURL.cpp \
nsLDAPServer.cpp \
$(NULL)
ifdef MOZ_LDAP_XPCOM_EXPERIMENTAL

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

@ -33,6 +33,7 @@ CPP_OBJS = .\$(OBJDIR)\nsLDAPURL.obj \
.\$(OBJDIR)\nsLDAPMessage.obj \
.\$(OBJDIR)\nsLDAPConnection.obj \
.\$(OBJDIR)\nsLDAPOperation.obj \
.\$(OBJDIR)\nsLDAPServer.obj \
!if defined(ENABLE_LDAP_EXPERIMENTAL)
.\$(OBJDIR)\nsLDAPProtocolHandler.obj \
.\$(OBJDIR)\nsLDAPChannel.obj \
@ -40,6 +41,8 @@ CPP_OBJS = .\$(OBJDIR)\nsLDAPURL.obj \
!endif
$(NULL)
# There might be some issues here with how DEFINES might get duplicated
# in the LCFLAGS.
!if defined(ENABLE_LDAP_EXPERIMENTAL)
DEFINES = -DMOZ_LDAP_XPCOM_EXPERIMENTAL $(DEFINES)
LCFLAGS = \

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

@ -37,6 +37,7 @@
#include "nsLDAPConnection.h"
#include "nsLDAPOperation.h"
#include "nsLDAPMessage.h"
#include "nsLDAPServer.h"
#ifdef MOZ_LDAP_XPCOM_EXPERIMENTAL
#include "nsLDAPProtocolHandler.h"
@ -50,6 +51,7 @@ NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPConnection);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPOperation);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPMessage);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPURL);
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPServer);
#ifdef MOZ_LDAP_XPCOM_EXPERIMENTAL
NS_GENERIC_FACTORY_CONSTRUCTOR(nsLDAPProtocolHandler);
@ -69,6 +71,8 @@ static nsModuleComponentInfo components[] =
nsLDAPOperationConstructor },
{ "LDAP Message", NS_LDAPMESSAGE_CID,
"@mozilla.org/network/ldap-message;1", nsLDAPMessageConstructor },
{ "LDAP Server", NS_LDAPSERVER_CID,
"@mozilla.org/network/ldap-server;1", nsLDAPServerConstructor },
#ifdef MOZ_LDAP_XPCOM_EXPERIMENTAL
{ "LDAP Protocol Handler", NS_LDAPPROTOCOLHANDLER_CID,
NS_NETWORK_PROTOCOL_CONTRACTID_PREFIX "ldap",

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

@ -0,0 +1,166 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the mozilla.org LDAP XPCOM component.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Leif Hedstrom <leif@netscape.com>
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
#include "nsLDAPServer.h"
NS_IMPL_THREADSAFE_ISUPPORTS1(nsLDAPServer, nsILDAPServer)
nsLDAPServer::nsLDAPServer()
{
NS_INIT_ISUPPORTS();
mSizeLimit = 0;
}
nsLDAPServer::~nsLDAPServer()
{
}
// attribute wstring key;
NS_IMETHODIMP nsLDAPServer::GetKey(PRUnichar **_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetKey: null pointer ");
return NS_ERROR_NULL_POINTER;
}
*_retval = mKey.ToNewUnicode();
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetKey(const PRUnichar *aKey)
{
mKey = aKey;
return NS_OK;
}
// attribute wstring password;
NS_IMETHODIMP nsLDAPServer::GetUsername(PRUnichar **_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetUsername: null pointer ");
return NS_ERROR_NULL_POINTER;
}
*_retval = mUsername.ToNewUnicode();
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetUsername(const PRUnichar *aUsername)
{
mUsername = aUsername;
return NS_OK;
}
// attribute wstring username;
NS_IMETHODIMP nsLDAPServer::GetPassword(PRUnichar **_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetPassword: null pointer ");
return NS_ERROR_NULL_POINTER;
}
*_retval = mPassword.ToNewUnicode();
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetPassword(const PRUnichar *aPassword)
{
mPassword = aPassword;
return NS_OK;
}
// attribute wstring binddn;
NS_IMETHODIMP nsLDAPServer::GetBinddn(PRUnichar **_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetBinddn: null pointer ");
return NS_ERROR_NULL_POINTER;
}
*_retval = mBindDN.ToNewUnicode();
if (!*_retval) {
return NS_ERROR_OUT_OF_MEMORY;
}
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetBinddn(const PRUnichar *aBindDN)
{
mBindDN = aBindDN;
return NS_OK;
}
// attribute unsigned long sizelimit;
NS_IMETHODIMP nsLDAPServer::GetSizelimit(PRUint32 *_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetSizelimit: null pointer ");
return NS_ERROR_NULL_POINTER;
}
*_retval = mSizeLimit;
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetSizelimit(PRUint32 aSizeLimit)
{
mSizeLimit = aSizeLimit;
return NS_OK;
}
// attribute nsILDAPURL url;
NS_IMETHODIMP nsLDAPServer::GetUrl(nsILDAPURL **_retval)
{
if (!_retval) {
NS_ERROR("nsLDAPServer::GetUrl: null pointer ");
return NS_ERROR_NULL_POINTER;
}
NS_IF_ADDREF(*_retval = mURL);
return NS_OK;
}
NS_IMETHODIMP nsLDAPServer::SetUrl(nsILDAPURL *aURL)
{
mURL = aURL;
return NS_OK;
}

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

@ -0,0 +1,67 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
*
* The contents of this file are subject to the Mozilla Public
* License Version 1.1 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS
* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
* implied. See the License for the specific language governing
* rights and limitations under the License.
*
* The Original Code is the mozilla.org LDAP XPCOM component.
*
* The Initial Developer of the Original Code is Netscape
* Communications Corporation. Portions created by Netscape are
* Copyright (C) 2000 Netscape Communications Corporation. All
* Rights Reserved.
*
* Contributor(s): Leif Hedstrom <leif@netscape.com>
*
* Alternatively, the contents of this file may be used under the
* terms of the GNU General Public License Version 2 or later (the
* "GPL"), in which case the provisions of the GPL are applicable
* instead of those above. If you wish to allow use of your
* version of this file only under the terms of the GPL and not to
* allow others to use your version of this file under the MPL,
* indicate your decision by deleting the provisions above and
* replace them with the notice and other provisions required by
* the GPL. If you do not delete the provisions above, a recipient
* may use your version of this file under either the MPL or the
* GPL.
*/
#include "nsCOMPtr.h"
#include "nsLDAP.h"
#include "nsString.h"
#include "nsILDAPServer.h"
#include "nsILDAPURL.h"
// 8aa717a4-1dd2-11b2-99c7-f01e2d449ded
#define NS_LDAPSERVER_CID \
{ 0x8aa717a4, 0x1dd2, 0x11b2, \
{ 0x99, 0xc7, 0xf0, 0x1e, 0x2d, 0x44, 0x9d, 0xed}}
class nsLDAPServer : public nsILDAPServer
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSILDAPSERVER
// Constructor & destructor
//
nsLDAPServer();
virtual ~nsLDAPServer();
protected:
nsString mKey; // Unique identifier for this server object
nsString mUsername; // Username / UID
nsString mPassword; // Password to bind with
nsString mBindDN; // DN associated with the UID above
PRUint32 mSizeLimit; // Limit the LDAP search to this # of entries
// This "links" to a LDAP URL object, which holds further information
// related to the LDAP server. Like Host, port, base-DN and scope.
nsCOMPtr<nsILDAPURL> mURL;
};

Двоичные данные
directory/xpcom/macbuild/mozldap.mcp

Двоичный файл не отображается.

Двоичные данные
directory/xpcom/macbuild/mozldapIDL.mcp

Двоичный файл не отображается.