]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/result.c
Fix the 1.71 fix - only offset the length if the last character of the
[openldap] / servers / slapd / result.c
index c7f6892dfd7d24b99b013c194abb99b7ac613a5e..bc8dc7aa6114f722f2aa0549c9e56176e899bdd2 100644 (file)
@@ -50,6 +50,8 @@ static char *v2ref( struct berval **ref, const char *text )
                v2[len-1] = '\n';
                memcpy(&v2[len], ref[i]->bv_val, ref[i]->bv_len );
                len += ref[i]->bv_len;
+               if (ref[i]->bv_val[ref[i]->bv_len-1] != '/')
+                       ++len;
        }
 
        v2[len-1] = '\0';
@@ -241,7 +243,7 @@ send_ldap_response(
     const char *text,
        struct berval   **ref,
        const char      *resoid,
-       struct berval   *resdata,
+       struct berval   *data,
        LDAPControl **ctrls
 )
 {
@@ -281,9 +283,8 @@ send_ldap_response(
                        rc = ber_printf( ber, "s", resoid );
                }
 
-               if( rc != -1 && resdata != NULL ) {
-                       rc = ber_printf( ber, "O", resdata );
-
+               if( rc != -1 && data != NULL ) {
+                       rc = ber_printf( ber, "O", data );
                }
 
                if( rc != -1 ) {
@@ -440,6 +441,41 @@ send_ldap_result(
        }
 }
 
+void
+send_ldap_sasl(
+    Connection *conn,
+    Operation  *op,
+    ber_int_t  err,
+    const char *matched,
+    const char *text,
+       struct berval *cred
+)
+{
+       ber_tag_t tag;
+       ber_int_t msgid;
+
+       Debug( LDAP_DEBUG_TRACE, "send_ldap_sasl %ld\n",
+               (long) err, NULL, NULL );
+
+       tag = req2res( op->o_tag );
+       msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
+
+#ifdef LDAP_CONNECTIONLESS
+       if ( op->o_cldap ) {
+               ber_pvt_sb_udp_set_dst( conn->c_sb, &op->o_clientaddr );
+               Debug( LDAP_DEBUG_TRACE, "UDP response to %s port %d\n", 
+                   inet_ntoa(((struct sockaddr_in *)
+                   &op->o_clientaddr)->sin_addr ),
+                   ((struct sockaddr_in *) &op->o_clientaddr)->sin_port,
+                   0 );
+       }
+#endif
+
+       send_ldap_response( conn, op, tag, msgid,
+               err, matched, text, NULL,
+               NULL, cred, NULL );
+}
+
 void
 send_ldap_extended(
     Connection *conn,
@@ -455,8 +491,8 @@ send_ldap_extended(
        ber_int_t msgid;
 
        Debug( LDAP_DEBUG_TRACE,
-               "send_ldap_extended %d:%s\n",
-               err, rspoid ? rspoid : "", NULL );
+               "send_ldap_extended %ld:%s\n",
+               (long) err, rspoid ? rspoid : "", NULL );
 
        tag = req2res( op->o_tag );
        msgid = (tag != LBER_SEQUENCE) ? op->o_msgid : 0;
@@ -833,7 +869,7 @@ send_search_reference(
 
        if( op->o_protocol < LDAP_VERSION3 ) {
                /* save the references for the result */
-               if( *refs == NULL ) {
+               if( *refs != NULL ) {
                        value_add( v2refs, refs );
                }
                return 0;