X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fslapd%2Fresult.c;h=a18ba20a8611ba266c2c212f56e5310cb54e294f;hb=bbdac6ebcac9deaa18302f95fa96e585c8eb97d7;hp=185cc0269d511c3440c573538ba6df451050d801;hpb=b76c56ba3f45576b9c418ea9fe7f7b3440052904;p=openldap diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 185cc0269d..a18ba20a86 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -3,30 +3,16 @@ #include "portable.h" #include + +#include +#include +#include #include #include -#include -#include -#include -#include -#include -#include "slap.h" - -#ifdef DECL_SYS_ERRLIST -extern int sys_nerr; -extern char *sys_errlist[]; -#endif +#include /* get close() */ -extern int active_threads; -extern pthread_mutex_t active_threads_mutex; -extern pthread_mutex_t new_conn_mutex; -extern pthread_t listener_tid; -extern struct acl *acl_get_applicable(); -extern long num_entries_sent; -extern long num_bytes_sent; -extern pthread_mutex_t num_sent_mutex; +#include "slap.h" -void close_connection(); static void send_ldap_result2( @@ -42,6 +28,9 @@ send_ldap_result2( int rc, sd; unsigned long tag, bytes; + if ( err == LDAP_PARTIAL_RESULTS && (text == NULL || *text == '\0') ) + err = LDAP_NO_SUCH_OBJECT; + Debug( LDAP_DEBUG_TRACE, "send_ldap_result %d:%s:%s\n", err, matched ? matched : "", text ? text : "" ); @@ -63,7 +52,7 @@ send_ldap_result2( break; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( (ber = ber_alloc_t( conn->c_version == 30 ? 0 : LBER_USE_DER )) == NULLBER ) { #else @@ -73,13 +62,13 @@ send_ldap_result2( return; } -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( op->o_cldap ) { rc = ber_printf( ber, "{is{t{ess}}}", op->o_msgid, "", tag, err, matched ? matched : "", text ? text : "" ); } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "{it{{ess}}}", op->o_msgid, tag, err, matched ? matched : "", text ? text : "" ); @@ -124,11 +113,7 @@ send_ldap_result2( active_threads--; conn->c_writewaiter = 1; -#ifdef linux - pthread_kill( listener_tid, SIGSTKFLT ); -#else /* !linux */ - pthread_kill( listener_tid, SIGUSR1 ); -#endif /* !linux */ + pthread_kill( listener_tid, LDAP_SIGUSR1 ); pthread_cond_wait( &conn->c_wcv, &active_threads_mutex ); pthread_mutex_unlock( &active_threads_mutex ); @@ -159,7 +144,7 @@ send_ldap_result( char *text ) { -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( op->o_cldap ) { SAFEMEMCPY( (char *)conn->c_sb.sb_useaddr, &op->o_clientaddr, sizeof( struct sockaddr )); @@ -213,7 +198,7 @@ send_search_entry( edn = dn_normalize_case( strdup( e->e_dn ) ); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( (ber = ber_alloc_t( conn->c_version == 30 ? 0 : LBER_USE_DER )) == NULLBER ) #else @@ -226,7 +211,7 @@ send_search_entry( goto error_return; } -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "{it{{s{", op->o_msgid, LDAP_RES_SEARCH_ENTRY, e->e_dn ); @@ -315,7 +300,7 @@ send_search_entry( free(edn); -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( conn->c_version == 30 ) { rc = ber_printf( ber, "}}}}" ); } else @@ -359,7 +344,7 @@ send_search_entry( pthread_mutex_lock( &active_threads_mutex ); active_threads--; conn->c_writewaiter = 1; - pthread_kill( listener_tid, SIGUSR1 ); + pthread_kill( listener_tid, LDAP_SIGUSR1 ); pthread_cond_wait( &conn->c_wcv, &active_threads_mutex ); pthread_mutex_unlock( &active_threads_mutex );