X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;f=servers%2Fldapd%2Fresult.c;h=777aec2e68a6da5459f40fb949c957e6dcc324ca;hb=c9eacbdc6407b65b395c13e1e93e8fe25bbbf041;hp=3f77032342c0a02d1762be5d6e5685593336e1f5;hpb=42e0d83cb3a1a1c5b25183f1ab74ce7edbe25de7;p=openldap diff --git a/servers/ldapd/result.c b/servers/ldapd/result.c index 3f77032342..777aec2e68 100644 --- a/servers/ldapd/result.c +++ b/servers/ldapd/result.c @@ -10,28 +10,23 @@ * is provided ``as is'' without express or implied warranty. */ +#include "portable.h" + #include -#include -#include -#include -#include + +#include +#include +#include + #include #include #include -#ifdef __hpux -#include -#else -#include -#endif + #include "lber.h" +#include "../../libraries/liblber/lber-int.h" /* get struct berelement */ #include "ldap.h" #include "common.h" -extern int dosyslog; -#ifdef COMPAT -extern int ldap_compat; -#endif - /* * dsa_response - called by do_queries() when there is activity on one of * the DSA associations. It is passed the association descriptor on which @@ -131,7 +126,7 @@ dsa_response( return; } if ( m->m_msgtype == LDAP_REQ_SEARCH -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 || m->m_msgtype == OLD_LDAP_REQ_SEARCH #endif ) @@ -154,7 +149,7 @@ dsa_response( int bound, rc; switch ( m->m_msgtype ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 case OLD_LDAP_REQ_ADD: case OLD_LDAP_REQ_MODIFY: case OLD_LDAP_REQ_MODRDN: @@ -162,7 +157,7 @@ dsa_response( case OLD_LDAP_REQ_COMPARE: case OLD_LDAP_REQ_SEARCH: #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 case LDAP_REQ_DELETE_30: #endif case LDAP_REQ_ADD: @@ -283,14 +278,14 @@ send_ldap_msgresult( char *text ) { -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( m->m_cldap ) { - SAFEMEMCPY( (char *)sb->sb_useaddr, &m->m_clientaddr, - sizeof( struct sockaddr )); + lber_pvt_sb_udp_set_dst( &sb, &m->m_clientaddr ); + Debug( LDAP_DEBUG_TRACE, "UDP response to %s port %d\n", inet_ntoa(((struct sockaddr_in *) - sb->sb_useaddr)->sin_addr ), - ((struct sockaddr_in *)sb->sb_useaddr)->sin_port, 0 ); + &m->m_clientaddr)->sin_addr ), + ((struct sockaddr_in *)&m->m_clientaddr)->sin_port, 0 ); } #endif return( send_ldap_result( sb, tag, m->m_msgid, err, matched, text ) ); @@ -308,19 +303,15 @@ send_ldap_result( { BerElement *ber; int rc; -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS int cldap; -#endif - extern int version; - -#ifdef CLDAP - cldap = ( sb->sb_naddr > 0 ); + cldap = ( sb->sb_io == &lber_pvt_sb_io_udp ); #endif Debug( LDAP_DEBUG_TRACE, "send_ldap_result\n", 0, 0, 0 ); if ( tag == LBER_DEFAULT ) -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 tag = ldap_compat == 20 ? OLD_LBER_SEQUENCE : LBER_SEQUENCE; #else tag = LBER_SEQUENCE; @@ -332,20 +323,20 @@ send_ldap_result( } if ( version != 1 ) { -#ifdef COMPAT20 +#ifdef LDAP_COMPAT20 if ( ldap_compat == 20 ) { rc = ber_printf( ber, "t{it{tess}}", OLD_LBER_SEQUENCE, msgid, tag, LBER_INTEGER, err, matched ? matched : "", text ); } else #endif -#ifdef COMPAT30 +#ifdef LDAP_COMPAT30 if ( ldap_compat == 30 ) { rc = ber_printf( ber, "{it{{ess}}}", msgid, tag, err, matched ? matched : "", text ); } else #endif -#ifdef CLDAP +#ifdef LDAP_CONNECTIONLESS if ( cldap ) { rc = ber_printf( ber, "{is{t{ess}}}", msgid, "", tag, err, matched ? matched : "", text );