1 #pragma ident "%Z%%M% %I% %E% SMI"
4 * The contents of this file are subject to the Netscape Public
5 * License Version 1.1 (the "License"); you may not use this file
6 * except in compliance with the License. You may obtain a copy of
7 * the License at http://www.mozilla.org/NPL/
9 * Software distributed under the License is distributed on an "AS
10 * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
11 * implied. See the License for the specific language governing
12 * rights and limitations under the License.
14 * The Original Code is Mozilla Communicator client code, released
17 * The Initial Developer of the Original Code is Netscape
18 * Communications Corporation. Portions created by Netscape are
19 * Copyright (C) 1998-1999 Netscape Communications Corporation. All
25 * Copyright (c) 1990 Regents of the University of Michigan.
26 * All rights reserved.
33 static char copyright
[] = "@(#) Copyright (c) 1990 Regents of the University of Michigan.\nAll rights reserved.\n";
40 ldap_first_entry( LDAP
*ld
, LDAPMessage
*chain
)
42 if ( !NSLDAPI_VALID_LDAP_POINTER( ld
) || chain
== NULLMSG
) {
46 if ( chain
->lm_msgtype
== LDAP_RES_SEARCH_ENTRY
) {
50 return( ldap_next_entry( ld
, chain
));
56 ldap_next_entry( LDAP
*ld
, LDAPMessage
*entry
)
58 if ( !NSLDAPI_VALID_LDAP_POINTER( ld
) || entry
== NULLMSG
) {
62 for ( entry
= entry
->lm_chain
; entry
!= NULLMSG
;
63 entry
= entry
->lm_chain
) {
64 if ( entry
->lm_msgtype
== LDAP_RES_SEARCH_ENTRY
) {
74 ldap_count_entries( LDAP
*ld
, LDAPMessage
*chain
)
78 if ( !NSLDAPI_VALID_LDAP_POINTER( ld
)) {
82 for ( i
= 0; chain
!= NULL
; chain
= chain
->lm_chain
) {
83 if ( chain
->lm_msgtype
== LDAP_RES_SEARCH_ENTRY
) {
94 ldap_get_entry_controls( LDAP
*ld
, LDAPMessage
*entry
,
95 LDAPControl
***serverctrlsp
)
100 LDAPDebug( LDAP_DEBUG_TRACE
, "ldap_get_entry_controls\n", 0, 0, 0 );
102 if ( !NSLDAPI_VALID_LDAP_POINTER( ld
)) {
103 return( LDAP_PARAM_ERROR
);
106 if ( !NSLDAPI_VALID_LDAPMESSAGE_ENTRY_POINTER( entry
)
107 || serverctrlsp
== NULL
) {
108 rc
= LDAP_PARAM_ERROR
;
109 goto report_error_and_return
;
112 *serverctrlsp
= NULL
;
113 tmpber
= *entry
->lm_ber
; /* struct copy */
115 /* skip past dn and entire attribute/value list */
116 if ( ber_scanf( &tmpber
, "{xx" ) == LBER_ERROR
) {
117 rc
= LDAP_DECODING_ERROR
;
118 goto report_error_and_return
;
121 rc
= nsldapi_get_controls( &tmpber
, serverctrlsp
);
123 report_error_and_return
:
124 LDAP_SET_LDERRNO( ld
, rc
, NULL
, NULL
);