]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
Do something with the error text.
[openldap] / servers / slapd / result.c
index a4890e8fc68d876114f4e16a646db22473ac1baa..0248a659aca0330a079ad52cb70ec6e898fe3625 100644 (file)
@@ -323,6 +323,8 @@ send_ldap_response(
                ber_free(ber, 1);
                return;
            }
+       }
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
            rc = ber_printf( ber, "{is{t{ess",
                msgid, "", tag, err,
                matched == NULL ? "" : matched,
@@ -365,7 +367,7 @@ send_ldap_response(
                rc = ber_printf( ber, "N}N}" );
        }
 #ifdef LDAP_CONNECTIONLESS
-       if( conn->c_is_udp && rc != -1 ) {
+       if( conn->c_is_udp && op->o_protocol == LDAP_VERSION2 && rc != -1 ) {
                rc = ber_printf( ber, "N}" );
        }
 #endif
@@ -772,6 +774,8 @@ send_search_entry(
                ber_free(ber, 1);
                return;
            }
+       }
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
            rc = ber_printf( ber, "{is{t{s{",
                op->o_msgid, "", LDAP_RES_SEARCH_ENTRY, e->e_dn );
        } else
@@ -806,7 +810,7 @@ send_search_entry(
 
        for ( a = e->e_attrs; a != NULL; a = a->a_next ) {
                AttributeDescription *desc = a->a_desc;
-               char *type = desc->ad_cname->bv_val;
+               char *type = desc->ad_cname.bv_val;
 
                if ( attrs == NULL ) {
                        /* all addrs request, skip operational attributes */
@@ -832,10 +836,10 @@ send_search_entry(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
                                   "send_search_entry: conn %d  access to attribute %s not allowed\n",
-                                  op->o_connid, desc->ad_cname->bv_val ));
+                                  op->o_connid, desc->ad_cname.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s not allowed\n",
-                           desc->ad_cname->bv_val, 0, 0 );
+                           desc->ad_cname.bv_val, 0, 0 );
 #endif
 
                        continue;
@@ -864,11 +868,11 @@ send_search_entry(
 #ifdef NEW_LOGGING
                                        LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
                                                   "send_search_entry: conn %d  access to attribute %s, value %d not allowed\n",
-                                                  op->o_connid, desc->ad_cname->bv_val, i ));
+                                                  op->o_connid, desc->ad_cname.bv_val, i ));
 #else
                                        Debug( LDAP_DEBUG_ACL,
                                                "acl: access to attribute %s, value %d not allowed\n",
-                                       desc->ad_cname->bv_val, i, 0 );
+                                       desc->ad_cname.bv_val, i, 0 );
 #endif
 
                                        continue;
@@ -939,16 +943,16 @@ send_search_entry(
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
                                   "send_search_entry: conn %s  access to attribute %s not allowed\n",
-                                  op->o_connid, desc->ad_cname->bv_val ));
+                                  op->o_connid, desc->ad_cname.bv_val ));
 #else
                        Debug( LDAP_DEBUG_ACL, "acl: access to attribute %s not allowed\n",
-                           desc->ad_cname->bv_val, 0, 0 );
+                           desc->ad_cname.bv_val, 0, 0 );
 #endif
 
                        continue;
                }
 
-               rc = ber_printf( ber, "{s[" /*]}*/ , desc->ad_cname->bv_val );
+               rc = ber_printf( ber, "{s[" /*]}*/ , desc->ad_cname.bv_val );
                if ( rc == -1 ) {
 #ifdef NEW_LOGGING
                        LDAP_LOG(( "operation", LDAP_LEVEL_ERR,
@@ -961,6 +965,7 @@ send_search_entry(
                        ber_free( ber, 1 );
                        send_ldap_result( conn, op, LDAP_OTHER,
                            NULL, "encoding description error", NULL, NULL );
+                       attrs_free( aa );
                        goto error_return;
                }
 
@@ -972,11 +977,11 @@ send_search_entry(
 #ifdef NEW_LOGGING
                                        LDAP_LOG(( "acl", LDAP_LEVEL_INFO,
                                                   "send_search_entry: conn %d access to %s, value %d not allowed\n",
-                                                  op->o_connid, desc->ad_cname->bv_val, i ));
+                                                  op->o_connid, desc->ad_cname.bv_val, i ));
 #else
                                        Debug( LDAP_DEBUG_ACL,
                                                "acl: access to attribute %s, value %d not allowed\n",
-                                       desc->ad_cname->bv_val, i, 0 );
+                                       desc->ad_cname.bv_val, i, 0 );
 #endif
 
                                        continue;
@@ -996,6 +1001,7 @@ send_search_entry(
                                        ber_free( ber, 1 );
                                        send_ldap_result( conn, op, LDAP_OTHER,
                                                NULL, "encoding values error", NULL, NULL );
+                                       attrs_free( aa );
                                        goto error_return;
                                }
                        }
@@ -1013,6 +1019,7 @@ send_search_entry(
                        ber_free( ber, 1 );
                        send_ldap_result( conn, op, LDAP_OTHER,
                            NULL, "encode end error", NULL, NULL );
+                       attrs_free( aa );
                        goto error_return;
                }
        }
@@ -1022,7 +1029,7 @@ send_search_entry(
        rc = ber_printf( ber, /*{{{*/ "}N}N}" );
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp && rc != -1)
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2 && rc != -1)
                rc = ber_printf( ber, "}" );
 #endif
        if ( rc == -1 ) {
@@ -1210,7 +1217,7 @@ send_search_reference(
        num_pdu_sent++;
        ldap_pvt_thread_mutex_unlock( &num_sent_mutex );
 
-       Statslog( LDAP_DEBUG_STATS2, "conn=%ld op=%ld ENTRY dn=\"%s\"\n",
+       Statslog( LDAP_DEBUG_STATS2, "conn=%ld op=%ld REF dn=\"%s\"\n",
            (long) conn->c_connid, (long) op->o_opid, e->e_dn, 0, 0 );
 
 #ifdef NEW_LOGGING