]> git.sur5r.net Git - openldap/commitdiff
Misc changes from HEAD
authorKurt Zeilenga <kurt@openldap.org>
Mon, 13 Feb 2006 18:28:42 +0000 (18:28 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Mon, 13 Feb 2006 18:28:42 +0000 (18:28 +0000)
12 files changed:
CHANGES
servers/slapd/back-bdb/cache.c
servers/slapd/config.c
servers/slapd/daemon.c
servers/slapd/overlays/README
servers/slapd/overlays/accesslog.c
servers/slapd/overlays/auditlog.c
servers/slapd/schema/core.schema
servers/slapd/slapi/slapi_pblock.c
servers/slapd/value.c
servers/slapd/zn_malloc.c
servers/slurpd/reject.c

diff --git a/CHANGES b/CHANGES
index 052d771c2964c7ba6397a16d5462fdd1adb6615b..1a1e55bc70685874684f92cdad5ff4bcef4880ce 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,7 +1,10 @@
 OpenLDAP 2.3 Change Log
 
 OpenLDAP 2.3.20 Engineering
-       Added libldap SASL workaround for broken LDAP servers
+       Added libldap SASL workaround for broken LDAP servers (ITS#4391)
+       Fixed slapo-auditlog crash (ITS#4394)
+       Fixed slapd-bdb/hdb wake listener on runqueue submit (ITS#4385)
+       Fixed slurpd reject error formating (ITS#4382)
 
 OpenLDAP 2.3.19 Release
        Fixed libldap disable DH key exchange with DH params (ITS#4354)
index 826459506076613333e12a5934cea9d6f1213130..1fdeafda92f90742a0e33f381d1569d477341ca2 100644 (file)
@@ -642,6 +642,7 @@ bdb_cache_lru_add(
                        rtask.arg = bdb;
                        bdb_cache_lru_purge( NULL, &rtask );
                } else {
+                       int wake = 0;
                        ldap_pvt_thread_mutex_lock( &slapd_rq.rq_mutex );
                        if ( bdb->bi_cache_task ) {
                                if ( !ldap_pvt_runqueue_isrunning( &slapd_rq,
@@ -652,13 +653,18 @@ bdb_cache_lru_add(
                                                0 );
                                        /* But don't try to reschedule it while it's running */
                                        bdb->bi_cache_task->interval.tv_sec = 3600;
+                                       wake = 1;
                                }
                        } else {
                                bdb->bi_cache_task = ldap_pvt_runqueue_insert( &slapd_rq, 3600,
                                        bdb_cache_lru_purge, bdb, "bdb_cache_lru_purge",
                                        bdb->bi_dbenv_home );
+                               wake = 1;
                        }
                        ldap_pvt_thread_mutex_unlock( &slapd_rq.rq_mutex );
+                       /* Don't bother waking if the purge task is already running */
+                       if ( wake )
+                               slap_wake_listener();
                }
        }
 }
index e65986f386690476fc7810b924bc9eb30d1e05fb..5146a85c5a4e0a5cfaceb6bd8d46f2b2cc877e7b 100644 (file)
@@ -1497,6 +1497,8 @@ int config_generic_wrapper( Backend *be, const char *fname, int lineno,
        c.argc = argc;
        c.argv = argv;
        c.valx = -1;
+       c.line = line;
+       c.op = SLAP_CONFIG_ADD;
        snprintf( c.log, sizeof( c.log ), "%s: line %d", fname, lineno );
 
        rc = SLAP_CONF_UNKNOWN;
index dac4749ae547b0ff816544004d7a389640cade57..41127d291c16c54ecc87518f2a05c7c4ab22300d 100644 (file)
@@ -2088,7 +2088,7 @@ slapd_daemon_task(
 #endif
 
                for (i=0; i<ns; i++) {
-                       int rc = 1, fd;
+                       int rc = 1, fd, waswrite = 0;
 
                        if ( SLAP_EVENT_IS_LISTENER(i) ) {
 #ifdef SLAP_LIGHTWEIGHT_DISPATCHER
@@ -2118,6 +2118,8 @@ slapd_daemon_task(
                                                "daemon: write active on %d\n",
                                                fd, 0, 0 );
 
+                                       waswrite = 1;
+
 #ifdef SLAP_LIGHTWEIGHT_DISPATCHER
                                        connection_write_activate( fd );
 #else
@@ -2132,7 +2134,8 @@ slapd_daemon_task(
                                        }
 #endif
                                }
-                               if( SLAP_EVENT_IS_READ( i ) ) {
+                               /* If event is a read or an error */
+                               if( SLAP_EVENT_IS_READ( i ) || !waswrite ) {
                                        Debug( LDAP_DEBUG_CONNS,
                                                "daemon: read active on %d\n",
                                                fd, 0, 0 );
index 32cb8dc878588c1b0f3deaf18555b87254eed5bd..e426e4b987b6f8f03346f8a2bd1b64b353fd5067 100644 (file)
@@ -1,4 +1,5 @@
 This directory contains a number of SLAPD overlays, some
 project-maintained, some not.  Some are generally usable,
-others are purely experimental.
+others are purely experimental.  Additional overlays can
+be found in the contrib/slapd-modules directory.
 
index 06a05f1d7dced155b8744409dd25dfd2c53249b2..bd61096dbbb9f8e01c5e267438b588eca0bc0c43 100644 (file)
@@ -1112,7 +1112,7 @@ accesslog_unbind( Operation *op, SlapReply *rs )
        slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
        if ( op->o_conn->c_authz_backend == on->on_info->oi_origdb ) {
                log_info *li = on->on_bi.bi_private;
-               Operation op2;
+               Operation op2 = {0};
                void *cids[SLAP_MAX_CIDS];
                SlapReply rs2 = {REP_RESULT};
                Entry *e;
@@ -1132,7 +1132,6 @@ accesslog_unbind( Operation *op, SlapReply *rs )
                op2.o_callback = &nullsc;
                op2.o_controls = cids;
                memset(cids, 0, sizeof( cids ));
-               memset(op2.o_ctrlflag, 0, sizeof( op2.o_ctrlflag ));
 
                op2.o_bd->be_add( &op2, &rs2 );
                entry_free( e );
@@ -1145,7 +1144,7 @@ accesslog_abandon( Operation *op, SlapReply *rs )
 {
        slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
        log_info *li = on->on_bi.bi_private;
-       Operation op2;
+       Operation op2 = {0};
        void *cids[SLAP_MAX_CIDS];
        SlapReply rs2 = {REP_RESULT};
        Entry *e;
@@ -1171,7 +1170,6 @@ accesslog_abandon( Operation *op, SlapReply *rs )
        op2.o_callback = &nullsc;
        op2.o_controls = cids;
        memset(cids, 0, sizeof( cids ));
-       memset(op2.o_ctrlflag, 0, sizeof( op2.o_ctrlflag ));
 
        op2.o_bd->be_add( &op2, &rs2 );
        entry_free( e );
index 441df6c68fd062f69fd30e1324523b4d50aa6878..c617bb02ba27763bc82dec6c0230ebbabc4e9dda 100644 (file)
@@ -36,7 +36,7 @@ typedef struct auditlog_data {
        char *ad_logfile;
 } auditlog_data;
 
-int fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
+static int fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
        char *s;
        if((s = ldif_put(LDIF_PUT_VALUE, name, val, len)) == NULL)
                return(-1);
@@ -45,7 +45,7 @@ int fprint_ldif(FILE *f, char *name, char *val, ber_len_t len) {
        return(0);
 }
 
-int auditlog_response(Operation *op, SlapReply *rs) {
+static int auditlog_response(Operation *op, SlapReply *rs) {
        slap_overinst *on = (slap_overinst *)op->o_bd->bd_info;
        auditlog_data *ad = on->on_bi.bi_private;
        FILE *f;
@@ -78,7 +78,9 @@ int auditlog_response(Operation *op, SlapReply *rs) {
                case LDAP_REQ_MODIFY:
                        what = "modify";
                        for(m = op->orm_modlist; m; m = m->sml_next)
-                               if( m->sml_desc == slap_schema.si_ad_modifiersName ) {
+                               if( m->sml_desc == slap_schema.si_ad_modifiersName &&
+                                       ( m->sml_op == LDAP_MOD_ADD ||
+                                       m->sml_op == LDAP_MOD_REPLACE )) {
                                        who = m->sml_values[0].bv_val;
                                        break;
                                }
index 73e209b1bef39ccaabb3736e8b880cc9aadb287a..4551f7a095e618a88ee259936340be921c39af34 100644 (file)
@@ -272,7 +272,7 @@ attributetype ( 2.5.4.40 NAME 'crossCertificatePair'
        DESC 'RFC2256: X.509 cross certificate pair, use ;binary'
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.10 )
 
-# 2.5.4.41 is defined above as it's used for subtyping
+# system schema
 #attributetype ( 2.5.4.41 NAME 'name'
 #      EQUALITY caseIgnoreMatch
 #      SUBSTR caseIgnoreSubstringsMatch
@@ -311,7 +311,7 @@ attributetype ( 2.5.4.48 NAME 'protocolInformation'
        EQUALITY protocolInformationMatch
        SYNTAX 1.3.6.1.4.1.1466.115.121.1.42 )
 
-# 2.5.4.49 is defined above as it's used for subtyping
+# system schema
 #attributetype ( 2.5.4.49 NAME 'distinguishedName'
 #      EQUALITY distinguishedNameMatch
 #      SYNTAX 1.3.6.1.4.1.1466.115.121.1.12 )
index 9835eaa2a28f7b4f496dc84a4709e93f6cd2b2f8..2b25ca0d42b57577fd52293fd91d0f55f230fbce 100644 (file)
@@ -293,13 +293,13 @@ pblock_get_param_class( int param )
 static void
 pblock_lock( Slapi_PBlock *pb )
 {
-       ldap_pvt_thread_mutex_lock(&pb->pb_mutex);
+       ldap_pvt_thread_mutex_lock( &pb->pb_mutex );
 }
 
 static void
 pblock_unlock( Slapi_PBlock *pb )
 {
-       ldap_pvt_thread_mutex_unlock(&pb->pb_mutex);
+       ldap_pvt_thread_mutex_unlock( &pb->pb_mutex );
 }
 
 static int 
index 9ccdf5c0533558386f4f8eb8fe944a673bd15717..dbd30cff8f055ed371843ffacbb8dff3d9193990 100644 (file)
@@ -153,8 +153,12 @@ int asserted_value_validate_normalize(
                rc = (mr->smr_syntax->ssyn_pretty)( mr->smr_syntax, in, &pval, ctx );
                in = &pval;
 
-       } else {
+       } else if ( mr->smr_syntax->ssyn_validate ) {
                rc = (mr->smr_syntax->ssyn_validate)( mr->smr_syntax, in );
+
+       } else {
+               *text = "inappropriate matching request";
+               return LDAP_INAPPROPRIATE_MATCHING;
        }
 
        if( rc != LDAP_SUCCESS ) {
index 1a6266d6d9524c91e763b47eea88cd847a0dd92e..dbd8863cb515424db20d01f6ad9be01a96d567d0 100644 (file)
  * top-level directory of the distribution or, alternatively, at
  * <http://www.OpenLDAP.org/license.html>.
  */
-/* Copyright 2004 IBM Corporation
+/* Portions Copyright 2004 IBM Corporation
  * All rights reserved.
- * Redisribution and use in source and binary forms, with or without
- * modification, are permitted only as  authorizd by the OpenLDAP
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
  * Public License.
  */
 /* ACKNOWLEDGEMENTS
- * This work originally developed by Jong-Hyuk Choi
- * 2004/12/09   jongchoi@OpenLDAP.org
+ * This work originally developed by Jong-Hyuk Choi for inclusion in
+ * OpenLDAP Software.
  */
 
 #include "portable.h"
index fd5e8bd447c3bbc74f7446609a4f71289f2138b7..4f49f6a4e02e899f231ee5db2c3a40df206f139c 100644 (file)
@@ -39,6 +39,7 @@
 #include <stdio.h>
 
 #include <ac/stdlib.h>
+#include <ac/string.h>
 #include <ac/errno.h>
 #include <ac/unistd.h>
 
@@ -48,6 +49,9 @@
 #include "slurp.h"
 #include "globals.h"
 
+#include "lber_pvt.h"
+#include "lutil.h"
+
 #ifdef _WIN32
 #define        PORTSEP ","
 #else
@@ -96,12 +100,45 @@ write_reject(
        Debug( LDAP_DEBUG_ANY, "Error: cannot open reject file \"%s\"\n",
                rejfile, 0, 0 );
     } else {
-       fseek( rfp, 0, 2 );
-       fprintf( rfp, "%s: %s", ERROR_STR, ldap_err2string( lderr ));
+       struct berval   bv = BER_BVNULL,
+                       errstrbv,
+                       errmsgbv = BER_BVNULL;
+       char            *ptr;
+
+       ber_str2bv( ldap_err2string( lderr ), 0, 0, &errstrbv );
        if ( errmsg && *errmsg ) {
-           fprintf( rfp, ": %s", errmsg );
+               ber_str2bv( errmsg, 0, 0, &errmsgbv );
+               bv.bv_len = errstrbv.bv_len
+                       + STRLENOF( ": " ) + errmsgbv.bv_len;
+
+               ptr = bv.bv_val = ber_memalloc( bv.bv_len + 1 );
+               ptr = lutil_strcopy( ptr, errstrbv.bv_val );
+               ptr = lutil_strcopy( ptr, ": " );
+               ptr = lutil_strcopy( ptr, errmsgbv.bv_val );
+
+       } else {
+               bv = errstrbv;
        }
-       fprintf( rfp, "\n" );
+
+       fseek( rfp, 0, 2 );
+
+       ptr = ldif_put( LDIF_PUT_VALUE, ERROR_STR, bv.bv_val, bv.bv_len );
+       if ( bv.bv_val != errstrbv.bv_val ) {
+               ber_memfree( bv.bv_val );
+       }
+       if ( ptr == NULL ) {
+               Debug( LDAP_DEBUG_ANY,
+                       "Error: cannot convert error message(s) \"%s%s%s\" "
+                       "into LDIF format\n",
+                       errstrbv.bv_val,
+                       BER_BVISNULL( &errmsgbv ) ? "" : ": ",
+                       BER_BVISNULL( &errmsgbv ) ? "" : errmsgbv.bv_val );
+               return;
+       }
+
+       fputs( ptr, rfp );
+       ber_memfree( ptr );
+
        if ((rc = re->re_write( ri, re, rfp )) < 0 ) {
            Debug( LDAP_DEBUG_ANY,
                    "Error: cannot write reject file \"%s\"\n",