]> git.sur5r.net Git - openldap/commitdiff
Sync with HEAD (LCUP and CLDAP cleanup)
authorKurt Zeilenga <kurt@openldap.org>
Tue, 17 Sep 2002 04:26:39 +0000 (04:26 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Tue, 17 Sep 2002 04:26:39 +0000 (04:26 +0000)
servers/slapd/connection.c
servers/slapd/controls.c
servers/slapd/daemon.c
servers/slapd/operation.c
servers/slapd/proto-slap.h
servers/slapd/result.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/slap.h

index e59d4f047b695f617fb1d0198fcaaeb2b4116ba6..241c6003915b825b4968eb7072889b5389b3e1f6 100644 (file)
@@ -501,26 +501,25 @@ long connection_init(
 
 #ifdef LDAP_CONNECTIONLESS
        c->c_is_udp = 0;
-       if (tls_udp_option == 2)
-       {
+       if( tls_udp_option == 2 ) {
                c->c_is_udp = 1;
 #ifdef LDAP_DEBUG
-       ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_debug,
-               LBER_SBIOD_LEVEL_PROVIDER, (void*)"udp_" );
+               ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_debug,
+                       LBER_SBIOD_LEVEL_PROVIDER, (void*)"udp_" );
 #endif
-       ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_udp,
-               LBER_SBIOD_LEVEL_PROVIDER, (void *)&s );
-       ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_readahead,
-               LBER_SBIOD_LEVEL_PROVIDER, NULL );
+               ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_udp,
+                       LBER_SBIOD_LEVEL_PROVIDER, (void *)&s );
+               ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_readahead,
+                       LBER_SBIOD_LEVEL_PROVIDER, NULL );
        } else
 #endif
        {
 #ifdef LDAP_DEBUG
-       ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_debug,
-               LBER_SBIOD_LEVEL_PROVIDER, (void*)"tcp_" );
+               ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_debug,
+                       LBER_SBIOD_LEVEL_PROVIDER, (void*)"tcp_" );
 #endif
-       ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_tcp,
-               LBER_SBIOD_LEVEL_PROVIDER, (void *)&s );
+               ber_sockbuf_add_io( c->c_sb, &ber_sockbuf_io_tcp,
+                       LBER_SBIOD_LEVEL_PROVIDER, (void *)&s );
        }
 
 #ifdef LDAP_DEBUG
@@ -1307,8 +1306,9 @@ connection_input(
        char            *cdn = NULL;
 #endif
 
-       if ( conn->c_currentber == NULL && (conn->c_currentber = ber_alloc())
-           == NULL ) {
+       if ( conn->c_currentber == NULL &&
+               ( conn->c_currentber = ber_alloc()) == NULL )
+       {
 #ifdef NEW_LOGGING
                LDAP_LOG( CONNECTION, ERR, 
                        "connection_input: conn %lu  ber_alloc failed.\n", 
@@ -1322,8 +1322,7 @@ connection_input(
        errno = 0;
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp)
-       {
+       if ( conn->c_is_udp ) {
                char    peername[sizeof("IP=255.255.255.255:65336")];
                len = ber_int_sb_read(conn->c_sb, &peeraddr,
                        sizeof(struct sockaddr));
@@ -1396,12 +1395,12 @@ connection_input(
        }
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp) {
-               if (tag == LBER_OCTETSTRING) {
+       if( conn->c_is_udp ) {
+               if( tag == LBER_OCTETSTRING ) {
                        ber_get_stringa( ber, &cdn );
                        tag = ber_peek_tag(ber, &len);
                }
-               if (tag != LDAP_REQ_ABANDON && tag != LDAP_REQ_SEARCH) {
+               if( tag != LDAP_REQ_ABANDON && tag != LDAP_REQ_SEARCH ) {
 #ifdef NEW_LOGGING
                    LDAP_LOG( CONNECTION, ERR, 
                               "connection_input: conn %lu  invalid req for UDP 0x%lx.\n",
@@ -1427,7 +1426,7 @@ connection_input(
        op->o_pagedresults_state = conn->c_pagedresults_state;
 #ifdef LDAP_CONNECTIONLESS
        op->o_peeraddr = peeraddr;
-       if (cdn) {
+       if (cdn ) {
            ber_str2bv( cdn, 0, 1, &op->o_dn );
            op->o_protocol = LDAP_VERSION2;
        }
index 45ef4efd4e2d8d0725a8f86222b074172e198a99..7c26ff1c38fb4876cf072298de6dfbda2dcc92e7 100644 (file)
@@ -90,7 +90,7 @@ static struct slap_control {
        { LDAP_CONTROL_CLIENT_UPDATE,
                SLAP_CTRL_SEARCH, NULL,
                parseClientUpdate },
-#endif
+#endif /* LDAP_CLIENT_UPDATE */
        { NULL }
 };
 
@@ -703,18 +703,18 @@ static int parseClientUpdate (
 
        /* TODO : Cookie Scheme Validation */
 #if 0
-       if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
-               *text = "Invalid LCUP cookie";
-               return LCUP_INVALID_COOKIE;
-       }
-
        if ( lcup_cookie_scheme_validate(scheme) != LDAP_SUCCESS ) {
                *text = "Unsupported LCUP cookie scheme";
                return LCUP_UNSUPPORTED_SCHEME;
        }
+
+       if ( lcup_cookie_validate(scheme, cookie) != LDAP_SUCCESS ) {
+               *text = "Invalid LCUP cookie";
+               return LCUP_INVALID_COOKIE;
+       }
 #endif
 
-       op->o_clientupdate_state = ber_dupbv(NULL, &cookie);
+       ber_dupbv( &op->o_clientupdate_state, &cookie );
 
        (void) ber_free( ber, 1 );
 
@@ -727,4 +727,4 @@ static int parseClientUpdate (
 
        return LDAP_SUCCESS;
 }
-#endif
+#endif /* LDAP_CLIENT_UPDATE */
index f4022fc27c4be7f938cb624a53c4b80159e3138e..151b6d395bf7e0d37125859d9d238c7899f71cc8 100644 (file)
@@ -676,8 +676,7 @@ static int slap_open_listener(
                        continue;
                }
 #ifdef LDAP_CONNECTIONLESS
-               if (l.sl_is_udp)
-                   socktype = SOCK_DGRAM;
+               if( l.sl_is_udp ) socktype = SOCK_DGRAM;
 #endif
                l.sl_sd = socket( (*sal)->sa_family, socktype, 0);
                if ( l.sl_sd == AC_SOCKET_INVALID ) {
@@ -1063,8 +1062,7 @@ slapd_daemon_task(
                 * listening port. The listen() and accept() calls
                 * are unnecessary.
                 */
-               if ( slap_listeners[l]->sl_is_udp )
-               {
+               if ( slap_listeners[l]->sl_is_udp ) {
                        slapd_add( slap_listeners[l]->sl_sd );
                        continue;
                }
@@ -1349,14 +1347,12 @@ slapd_daemon_task(
                                continue;
 
 #ifdef LDAP_CONNECTIONLESS
-                       if ( slap_listeners[l]->sl_is_udp )
-                       {
-                       /* The first time we receive a query, we set this
-                        * up as a "connection". It remains open for the life
-                        * of the slapd.
-                        */
-                               if ( slap_listeners[l]->sl_is_udp < 2 )
-                               {
+                       if ( slap_listeners[l]->sl_is_udp ) {
+                               /* The first time we receive a query, we set this
+                                * up as a "connection". It remains open for the life
+                                * of the slapd.
+                                */
+                               if ( slap_listeners[l]->sl_is_udp < 2 ) {
                                    id = connection_init(
                                        slap_listeners[l]->sl_sd,
                                        slap_listeners[l]->sl_url, "", "",
@@ -1665,8 +1661,7 @@ slapd_daemon_task(
                                /* The listener is the data port. Don't
                                 * skip it.
                                 */
-                                       if (slap_listeners[l]->sl_is_udp)
-                                               continue;
+                                       if (slap_listeners[l]->sl_is_udp) continue;
 #endif
                                        is_listener = 1;
                                        break;
@@ -1717,8 +1712,7 @@ slapd_daemon_task(
                        for ( l = 0; slap_listeners[l] != NULL; l++ ) {
                                if ( i == slap_listeners[l]->sl_sd ) {
 #ifdef LDAP_CONNECTIONLESS
-                                       if (slap_listeners[l]->sl_is_udp)
-                                               continue;
+                                       if (slap_listeners[l]->sl_is_udp) continue;
 #endif
                                        is_listener = 1;
                                        break;
@@ -1769,8 +1763,7 @@ slapd_daemon_task(
                        for ( l = 0; slap_listeners[l] != NULL; l++ ) {
                                if ( rd == slap_listeners[l]->sl_sd ) {
 #ifdef LDAP_CONNECTIONLESS
-                                       if (slap_listeners[l]->sl_is_udp)
-                                               continue;
+                                       if (slap_listeners[l]->sl_is_udp) continue;
 #endif
                                        is_listener = 1;
                                        break;
index 49c1a7b58c50815c7506a5fef15d79119f1d3c93..59fc1b9cd7e7c494388081a8406c3fc05fc79b9c 100644 (file)
@@ -36,6 +36,12 @@ slap_op_free( Operation *op )
                ldap_controls_free( op->o_ctrls );
        }
 
+#ifdef LDAP_CLIENT_UPDATE
+       if ( op->o_clientupdate_state.bv_val != NULL ) {
+               free( op->o_clientupdate_state.bv_val );
+       }
+#endif /* LDAP_CLIENT_UPDATE */
+
        free( (char *) op );
 }
 
index bde85b5368170e99c1ddc8f85d967310c30239ff..c77416108bd7f5d173d4645362d723b34e2e4423 100644 (file)
@@ -471,7 +471,7 @@ LDAP_SLAPD_F (void) vrFilter2bv LDAP_P(( ValuesReturnFilter *f, struct berval *f
 /*
  * define to honor hasSubordinates operational attribute in search filters
  */
-#define SLAP_X_FILTER_HASSUBORDINATES
+#undef SLAP_X_FILTER_HASSUBORDINATES
 
 #ifdef SLAP_X_FILTER_HASSUBORDINATES
 LDAP_SLAPD_F (int) filter_has_subordinates LDAP_P(( Filter *filter ));
index 8df2efcb1bcedd652cc902fe29697d1677800e65..2e772774cd8c9823033fad5d6279b66d26fced0a 100644 (file)
@@ -224,8 +224,6 @@ send_ldap_response(
                return;
        }
                
-       assert( ctrls == NULL ); /* ctrls not implemented */
-
        ber_init_w_nullc( ber, LBER_USE_DER );
 
 #ifdef NEW_LOGGING
@@ -252,8 +250,9 @@ send_ldap_response(
        }
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp) {
-           rc = ber_write(ber, (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
+       if( conn->c_is_udp ) {
+           rc = ber_write(ber,
+                       (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
            if (rc != sizeof(struct sockaddr)) {
 #ifdef NEW_LOGGING
                LDAP_LOG( OPERATION, ERR, 
@@ -711,17 +710,18 @@ send_search_entry(
 
 #ifdef LDAP_CONNECTIONLESS
        if (conn->c_is_udp) {
-           rc = ber_write(ber, (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
+           rc = ber_write(ber,
+                       (char *)&op->o_peeraddr, sizeof(struct sockaddr), 0);
            if (rc != sizeof(struct sockaddr)) {
 #ifdef NEW_LOGGING
-               LDAP_LOG( OPERATION, ERR, 
-                       "send_search_entry: conn %lu  ber_printf failed\n",
-                       conn ? conn->c_connid : 0, 0, 0 );
+                       LDAP_LOG( OPERATION, ERR, 
+                               "send_search_entry: conn %lu  ber_printf failed\n",
+                               conn ? conn->c_connid : 0, 0, 0 );
 #else
-               Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
+                       Debug( LDAP_DEBUG_ANY, "ber_printf failed\n", 0, 0, 0 );
 #endif
-               ber_free_buf( ber );
-               return( 1 );
+                       ber_free_buf( ber );
+                       return( 1 );
            }
        }
        if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2) {
@@ -1127,8 +1127,9 @@ send_search_entry(
        }
 
 #ifdef LDAP_CONNECTIONLESS
-       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2 && rc != -1)
+       if (conn->c_is_udp && op->o_protocol == LDAP_VERSION2 && rc != -1) {
                rc = ber_printf( ber, "}" );
+       }
 #endif
        if ( rc == -1 ) {
 #ifdef NEW_LOGGING
index af322982a376b6580790b7d67600706937d1b6db..5409bc1e002969ca07af2155b6e96591380517d1 100644 (file)
 #define caseIgnoreOrderingMatch                        caseIgnoreMatch
 #define caseExactOrderingMatch                 caseExactMatch
 #define integerOrderingMatch                   integerMatch
-
-#ifdef LDAP_CLIENT_UPDATE
 #define        octetStringOrderingMatch                octetStringMatch
-#endif /* LDAP_CLIENT_UPDATE */
 
 /* unimplemented matching routines */
 #define caseIgnoreListMatch                            NULL
@@ -4462,7 +4459,6 @@ char *objectIdentifierFirstComponentMatchSyntaxes[] = {
  * Other matching rules in X.520 that we do not use (yet):
  *
  * 2.5.13.9            numericStringOrderingMatch
- * 2.5.13.18   octetStringOrderingMatch
  * 2.5.13.19   octetStringSubstringsMatch
  * 2.5.13.25   uTCTimeMatch
  * 2.5.13.26   uTCTimeOrderingMatch
@@ -4635,14 +4631,12 @@ static slap_mrule_defs_rec mrule_defs[] = {
                octetStringMatch, octetStringIndexer, octetStringFilter,
                NULL},
 
-#ifdef LDAP_CLIENT_UPDATE
        {"( 2.5.13.18 NAME 'octetStringOrderingMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40 )",
                SLAP_MR_ORDERING, NULL,
                NULL, NULL,
                octetStringOrderingMatch, NULL, NULL,
                NULL},
-#endif /* LDAP_CLIENT_UPDATE */
 
        {"( 2.5.13.20 NAME 'telephoneNumberMatch' "
                "SYNTAX 1.3.6.1.4.1.1466.115.121.1.50 )",
index 6c9f77f167af8e3464afdcf7bb976d256e2e385b..7625eefed1fad8bdafb27c81eaeaf0cc6aee3b6c 100644 (file)
@@ -423,9 +423,7 @@ static struct slap_schema_ad_map {
        { "entryCSN", "( 1.3.6.1.4.1.4203.666.1.7 NAME 'entryCSN' "
                        "DESC 'LCUP/LDUP: change sequence number' "
                        "EQUALITY octetStringMatch "
-#ifdef LDAP_CLIENT_UPDATE
                        "ORDERING octetStringOrderingMatch "
-#endif /* LDAP_CLIENT_UPDATE */
                        "SYNTAX 1.3.6.1.4.1.1466.115.121.1.40{64} "
                        "SINGLE-VALUE NO-USER-MODIFICATION USAGE directoryOperation )",
                NULL, SLAP_AT_HIDE,
index 798b40b9ba331be23921fa82ab2d6a846db5c394..e57053f94e59357e1d3a62b80e86ae43f4f34b3a 100644 (file)
@@ -215,6 +215,10 @@ typedef struct slap_ssf_set {
 #define SLAP_SYNTAX_ATTRIBUTETYPES_OID "1.3.6.1.4.1.1466.115.121.1.3"
 #define SLAP_SYNTAX_OBJECTCLASSES_OID  "1.3.6.1.4.1.1466.115.121.1.37"
 
+#ifdef LDAP_CLIENT_UPDATE
+#define LCUP_COOKIE_OID "1.3.6.1.4.1.4203.666.10.1"
+#endif /* LDAP_CLIENT_UPDATE */
+
 /*
  * represents schema information for a database
  */
@@ -1585,8 +1589,8 @@ typedef struct slap_op {
 #define SLAP_LCUP_PERSIST                      (0x2)
 #define SLAP_LCUP_SYNC_AND_PERSIST     (0x3)
        ber_int_t o_clientupdate_interval;
-       struct berval* o_clientupdate_state;
-#endif
+       struct berval o_clientupdate_state;
+#endif /* LDAP_CLIENT_UPDATE */
 
 #ifdef LDAP_CONNECTIONLESS
        Sockaddr        o_peeraddr;     /* UDP peer address               */
@@ -1742,6 +1746,16 @@ enum {
 #define SLAP_LDAPDN_PRETTY 0x1
 #define SLAP_LDAPDN_MAXLEN 8192
 
+/*
+ * Macros for LCUP
+ */
+#ifdef LDAP_CLIENT_UPDATE
+#define SLAP_LCUP_STATE_UPDATE_TRUE    1
+#define SLAP_LCUP_STATE_UPDATE_FALSE   0
+#define SLAP_LCUP_ENTRY_DELETED_TRUE   1
+#define SLAP_LCUP_ENTRY_DELETED_FALSE  0
+#endif /* LDAP_CLIENT_UPDATE */
+
 LDAP_END_DECL
 
 #include "proto-slap.h"