]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/extended.c
Add debug support
[openldap] / libraries / libldap / extended.c
index 3789720d880d82b92df1cb470adef44aaae2341c..0fb11184adb3a756e6cf23b0768adfff64f8c532 100644 (file)
@@ -1,7 +1,19 @@
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2004 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
+ */
+/* Portions Copyright (C) The Internet Society (1997).
+ * ASN.1 fragments are from RFC 2251; see RFC for full legal notices.
  */
 
 /*
@@ -43,6 +55,7 @@ ldap_extended_operation(
 {
        BerElement *ber;
        int rc;
+       ber_int_t id;
 
 #ifdef NEW_LOGGING
        LDAP_LOG ( OPERATION, ENTRY, "ldap_extended_operation\n", 0,0,0 );
@@ -67,15 +80,16 @@ ldap_extended_operation(
                return( ld->ld_errno );
        }
 
+       LDAP_NEXT_MSGID( ld, id );
        if ( reqdata != NULL ) {
                rc = ber_printf( ber, "{it{tstON}", /* '}' */
-                       ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+                       id, LDAP_REQ_EXTENDED,
                        LDAP_TAG_EXOP_REQ_OID, reqoid,
                        LDAP_TAG_EXOP_REQ_VALUE, reqdata );
 
        } else {
                rc = ber_printf( ber, "{it{tsN}", /* '}' */
-                       ++ld->ld_msgid, LDAP_REQ_EXTENDED,
+                       id, LDAP_REQ_EXTENDED,
                        LDAP_TAG_EXOP_REQ_OID, reqoid );
        }
 
@@ -98,7 +112,7 @@ ldap_extended_operation(
        }
 
        /* send the message */
-       *msgidp = ldap_send_initial_request( ld, LDAP_REQ_EXTENDED, NULL, ber );
+       *msgidp = ldap_send_initial_request( ld, LDAP_REQ_EXTENDED, NULL, ber, id );
 
        return( *msgidp < 0 ? ld->ld_errno : LDAP_SUCCESS );
 }
@@ -281,7 +295,7 @@ ldap_parse_extended_result (
 
 /* Parse an extended partial */
 int
-ldap_parse_extended_partial (
+ldap_parse_intermediate (
        LDAP                    *ld,
        LDAPMessage             *res,
        char                    **retoidp,
@@ -301,9 +315,9 @@ ldap_parse_extended_partial (
        assert( res != NULL );
 
 #ifdef NEW_LOGGING
-       LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_extended_partial\n", 0,0,0 );
+       LDAP_LOG ( OPERATION, ENTRY, "ldap_parse_intermediate\n", 0,0,0 );
 #else
-       Debug( LDAP_DEBUG_TRACE, "ldap_parse_extended_partial\n", 0, 0, 0 );
+       Debug( LDAP_DEBUG_TRACE, "ldap_parse_intermediate\n", 0, 0, 0 );
 #endif
 
        if( ld->ld_version < LDAP_VERSION3 ) {
@@ -311,7 +325,7 @@ ldap_parse_extended_partial (
                return ld->ld_errno;
        }
 
-       if( res->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL ) {
+       if( res->lm_msgtype != LDAP_RES_INTERMEDIATE ) {
                ld->ld_errno = LDAP_PARAM_ERROR;
                return ld->ld_errno;
        }
@@ -370,7 +384,7 @@ ldap_parse_extended_partial (
                goto free_and_return;
        }
 
-       rc = ldap_int_get_controls( ber, serverctrls );
+       rc = ldap_pvt_get_controls( ber, serverctrls );
 
 free_and_return:
        ber_free( ber, 0 );
@@ -393,3 +407,4 @@ free_and_return:
 
        return LDAP_SUCCESS;
 }
+