]> git.sur5r.net Git - openldap/blobdiff - servers/ldapd/result.c
Round 2 of connection management changes.
[openldap] / servers / ldapd / result.c
index 3f77032342c0a02d1762be5d6e5685593336e1f5..777aec2e68a6da5459f40fb949c957e6dcc324ca 100644 (file)
  * is provided ``as is'' without express or implied warranty.
  */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/types.h>
-#include <sys/socket.h>
-#include <netinet/in.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/syslog.h>
+
 #include <quipu/dsap.h>
 #include <quipu/dap2.h>
 #include <quipu/dua.h>
-#ifdef __hpux
-#include <syslog.h>
-#else
-#include <sys/syslog.h>
-#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 );