1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*-
2 *
3 * The contents of this file are subject to the Mozilla Public
4 * License Version 1.1 (the "License"); you may not use this file
5 * except in compliance with the License. You may obtain a copy of
6 * the License at http://www.mozilla.org/MPL/
7 *
8 * Software distributed under the License is distributed on an "AS
9 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
10 * implied. See the License for the specific language governing
11 * rights and limitations under the License.
12 *
13 * The Original Code is the mozilla.org LDAP XPCOM SDK.
14 *
15 * The Initial Developer of the Original Code is Netscape
16 * Communications Corporation. Portions created by Netscape are
17 * Copyright (C) 2000 Netscape Communications Corporation. All
18 * Rights Reserved.
19 *
20 * Contributor(s): Dan Mosedale <dmose@mozilla.org>
21 * Leif Hedstrom <leif@netscape.com>
22 *
23 * Alternatively, the contents of this file may be used under the
24 * terms of the GNU General Public License Version 2 or later (the
25 * "GPL"), in which case the provisions of the GPL are applicable
26 * instead of those above. If you wish to allow use of your
27 * version of this file only under the terms of the GPL and not to
28 * allow others to use your version of this file under the MPL,
29 * indicate your decision by deleting the provisions above and
30 * replace them with the notice and other provisions required by
31 * the GPL. If you do not delete the provisions above, a recipient
32 * may use your version of this file under either the MPL or the
33 * GPL.
34 */
35
36 #include "nsLDAPURL.h"
37 #include "nsReadableUtils.h"
38 #include "netCore.h"
39 #include "plstr.h"
40
41 // The two schemes we support, LDAP and LDAPS
42 //
43 static const char kLDAPScheme[] = "ldap";
44 static const char kLDAPSSLScheme[] = "ldaps";
45
46
47 // Constructor and destructor
48 //
49 NS_IMPL_THREADSAFE_ISUPPORTS2(nsLDAPURL, nsILDAPURL, nsIURI)
50
51 nsLDAPURL::nsLDAPURL()
52 : mPort(0),
53 mScope(SCOPE_BASE),
54 mOptions(0),
55 mAttributes(0)
56 {
57 }
58
59 nsLDAPURL::~nsLDAPURL()
60 {
61 // Delete the array of attributes
62 delete mAttributes;
63 }
64
65 nsresult
66 nsLDAPURL::Init()
67 {
68 if (!mAttributes) {
69 mAttributes = new nsCStringArray();
70 if (!mAttributes) {
71 NS_ERROR("nsLDAPURL::Init: out of memory ");
72 return NS_ERROR_OUT_OF_MEMORY;
73 }
74 }
75
|