]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
Commit of the Proxy Cache contribution (ITS#2062)
[openldap] / servers / slapd / result.c
index 23c4099df7ff1a43e040773e20d0b3de9688859a..2e412aeb5f52eb1f6e14629d3ca1187446f98f2b 100644 (file)
 #include <ac/unistd.h>
 
 #include "slap.h"
+
+#ifdef LDAP_SLAPI
 #include "slapi.h"
+#endif
 
 static char *v2ref( BerVarray ref, const char *text )
 {
@@ -274,7 +277,7 @@ send_ldap_response(
        }
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp && conn->c_protocol == LDAP_VERSION2) {
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
                rc = ber_printf( ber, "t{ess" /*"}}"*/,
                        tag, err,
                matched == NULL ? "" : matched,
@@ -325,6 +328,12 @@ send_ldap_response(
                rc = ber_printf( ber, /*"{"*/ "N}" );
        }
 
+#ifdef LDAP_CONNECTIONLESS
+       if( conn->c_is_udp && op->o_protocol == LDAP_VERSION2 && rc != -1 ) {
+               rc = ber_printf( ber, /*"{"*/ "N}" );
+       }
+#endif
+               
        if ( rc == -1 ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
@@ -480,9 +489,11 @@ slap_send_ldap_result(
        assert( err != LDAP_PARTIAL_RESULTS );
 
        if ( err == LDAP_REFERRAL ) {
-               if( op->o_noreferrals ) {
+#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
+               if( op->o_domain_scope ) {
                        ref = NULL;
                }
+#endif
                if( ref == NULL ) {
                        err = LDAP_NO_SUCH_OBJECT;
                } else if ( op->o_protocol < LDAP_VERSION3 ) {
@@ -582,6 +593,7 @@ slap_send_ldap_extended(
                rspoid, rspdata, NULL, ctrls );
 }
 
+#ifdef LDAP_RES_INTERMEDIATE_RESP
 void
 slap_send_ldap_intermediate_resp(
        Connection  *conn,
@@ -614,6 +626,7 @@ slap_send_ldap_intermediate_resp(
                err, matched, text, refs,
                rspoid, rspdata, NULL, ctrls );
 }
+#endif
 
 void
 slap_send_search_result(
@@ -767,8 +780,8 @@ slap_send_search_entry(
        ber_init_w_nullc( ber, LBER_USE_DER );
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp && conn->c_protocol == LDAP_VERSION2) {
-           rc = ber_printf(ber, "t{0{" /*}}*/,
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
+           rc = ber_printf(ber, "t{O{" /*}}*/,
                LDAP_RES_SEARCH_ENTRY, &e->e_name);
        } else
 #endif
@@ -1243,6 +1256,11 @@ slap_send_search_entry(
                rc = send_ldap_controls( ber, ctrls );
        }
 
+#ifdef LDAP_CONNECTIONLESS
+       if( conn->c_is_udp && op->o_protocol == LDAP_VERSION2 ) {
+               ; /* empty, skip following if */
+       } else
+#endif
        if( rc != -1 ) {
                rc = ber_printf( ber, /*{*/ "N}" );
        }
@@ -1379,19 +1397,21 @@ slap_send_search_reference(
                return( 1 );
        }
 
-       if( op->o_noreferrals ) {
+#ifdef LDAP_CONTROL_X_DOMAIN_SCOPE
+       if( op->o_domain_scope ) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
-                       "send_search_reference: conn %lu noreferrals control in (%s).\n",
+                       "send_search_reference: conn %lu domainScope control in (%s).\n",
                        op->o_connid, e->e_dn, 0 );
 #else
                Debug( LDAP_DEBUG_ANY,
-                       "send_search_reference: noreferrals control in (%s)\n", 
+                       "send_search_reference: domainScope control in (%s)\n", 
                        e->e_dn, 0, 0 );
 #endif
 
                return( 0 );
        }
+#endif
 
        if( refs == NULL ) {
 #ifdef NEW_LOGGING