]> git.sur5r.net Git - openldap/commitdiff
multiple precision with BIGNUM/gmp/ulong
authorPierangelo Masarati <ando@openldap.org>
Sun, 26 Sep 2004 22:58:47 +0000 (22:58 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 26 Sep 2004 22:58:47 +0000 (22:58 +0000)
58 files changed:
configure.in
include/ldap_pvt.h
servers/slapd/ad.c
servers/slapd/add.c
servers/slapd/at.c
servers/slapd/attr.c
servers/slapd/back-meta/search.c
servers/slapd/back-monitor/operation.c
servers/slapd/back-monitor/proto-back-monitor.h
servers/slapd/back-monitor/rww.c
servers/slapd/back-monitor/sent.c
servers/slapd/back-passwd/search.c
servers/slapd/back-sql/add.c
servers/slapd/back-sql/api.c
servers/slapd/back-sql/delete.c
servers/slapd/back-sql/entry-id.c
servers/slapd/back-sql/init.c
servers/slapd/back-sql/modify.c
servers/slapd/back-sql/modrdn.c
servers/slapd/back-sql/schema-map.c
servers/slapd/back-sql/search.c
servers/slapd/back-sql/sql-wrap.c
servers/slapd/back-sql/util.c
servers/slapd/bind.c
servers/slapd/compare.c
servers/slapd/component.c
servers/slapd/config.c
servers/slapd/connection.c
servers/slapd/cr.c
servers/slapd/ctxcsn.c
servers/slapd/daemon.c
servers/slapd/delete.c
servers/slapd/dn.c
servers/slapd/init.c
servers/slapd/ldapsync.c
servers/slapd/main.c
servers/slapd/modify.c
servers/slapd/modrdn.c
servers/slapd/mr.c
servers/slapd/oc.c
servers/slapd/overlays/pcache.c
servers/slapd/referral.c
servers/slapd/result.c
servers/slapd/sasl.c
servers/slapd/saslauthz.c
servers/slapd/schema.c
servers/slapd/schema_check.c
servers/slapd/schema_init.c
servers/slapd/schema_prep.c
servers/slapd/search.c
servers/slapd/sessionlog.c
servers/slapd/slap.h
servers/slapd/slapi/slapi_ext.c
servers/slapd/slapi/slapi_utils.c
servers/slapd/starttls.c
servers/slapd/str2filter.c
servers/slapd/syncrepl.c
servers/slapd/syntax.c

index db0cbaf7f43675089f1d4d546e2e9907d54c21dd..9f1752049aa27d9267b3d065efc79ef2c925713c 100644 (file)
@@ -171,6 +171,10 @@ OL_ARG_WITH(tls,[  --with-tls                with TLS/SSL support],
        auto, [auto ssleay openssl yes no] )
 OL_ARG_WITH(yielding_select,[  --with-yielding-select  with implicitly yielding select],
        auto, [auto yes no manual] )
+OL_ARG_WITH(multiple_precision,[  --with-multiple-precision
+                          multiple precision support for statistics
+                         auto|bignum|gmp],
+       auto, [auto bignum gmp yes no] )
 
 dnl ----------------------------------------------------------------
 dnl Server options
@@ -1207,10 +1211,11 @@ fi
 
 dnl ----------------------------------------------------------------
 dnl TLS/SSL
+       
 ol_link_tls=no
 if test $ol_with_tls != no ; then
        AC_CHECK_HEADERS(openssl/ssl.h ssl.h)
-       
+
        if test $ac_cv_header_openssl_ssl_h = yes \
                -o $ac_cv_header_ssl_h = yes ; then
                AC_CHECK_LIB(ssl, SSLeay_add_ssl_algorithms, 
@@ -2230,15 +2235,96 @@ if test $ol_enable_slp != no ; then
 fi
 
 dnl ----------------------------------------------------------------
-dnl Check for GMP API Library
-AC_CHECK_HEADERS( gmp.h )
+dnl Check for multiple precision support
+if test "$ol_with_multiple_precision" != "no" ; then
+       ol_have_bignum=no
+       ol_have_gmp=no
+
+       AC_CHECK_HEADERS(openssl/bn.h bn.h)
+       AC_CHECK_HEADERS(openssl/crypto.h crypto.h)
+       AC_CHECK_HEADERS( gmp.h )
+
+       if test "$ol_with_tls" = "found" ; then
+               ol_have_bn_h=no
+               ol_have_crypto_h=no
+
+               if test "$ac_cv_header_openssl_bn_h" = "yes" \
+                               -o "$ac_cv_header_bn_h" = "yes" ; then
+                       ol_have_bn_h=yes
+               fi
+
+               if test "$ac_cv_header_openssl_crypto_h" = "yes" \
+                               -o "$ac_cv_header_crypto_h" = "yes" ; then
+                       ol_have_crypto_h=yes
+               fi
+
+               if test "$ol_have_bn_h" = "yes" \
+                               -a "$ol_have_crypto_h" = "yes" ; then
+                       ol_have_bignum=yes
+               fi
+       fi
+
+       if test $ac_cv_header_gmp_h = yes ; then
+               AC_CHECK_LIB(gmp, __gmpz_add_ui, [have_gmp=yes], [have_gmp=no])
+               if test $have_gmp = yes ; then
+                       ol_have_gmp=yes
+               fi
+       fi
 
-if test $ac_cv_header_gmp_h = yes ; then
-       AC_CHECK_LIB(gmp, __gmpz_add_ui, [have_gmp=yes], [have_gmp=no])
-       if test $have_gmp = yes ; then
+       AC_MSG_CHECKING([for multiple precision support])
+
+       ol_mp_support="none"
+       case "$ol_with_multiple_precision" in
+       auto)
+               dnl preferred sequence:
+               dnl - OpenSSL's BIGNUM (if libssl is already linked)
+               dnl - GNU's MP
+               dnl - unsigned long
+               if test "$ol_have_bignum" = "yes" ; then
+                       ol_mp_support="bignum"
+               else
+                       if test "$ol_have_gmp" = "yes" ; then
+                               ol_mp_support="gmp"
+                       fi
+               fi
+               ;;
+       bignum)
+               if test "$ol_have_bignum" != "yes" ; then
+                       AC_MSG_ERROR([OpenSSL's BIGNUM not available])
+               fi
+               ol_mp_support="bignum"
+               ;;
+       gmp)
+               if test "$ol_have_gmp" != "yes" ; then
+                       AC_MSG_ERROR([GMP not available])
+               fi
+               ol_mp_support="gmp"
+               ;;
+       yes)
+               if test "$ol_have_bignum" = "yes" ; then
+                       ol_mp_support="bignum"
+               elif test "$ol_have_gmp" = "yes" ; then
+                       ol_mp_support="gmp"
+               else
+                       AC_MSG_ERROR([not available])
+               fi
+               ;;
+       esac
+
+       case "$ol_mp_support" in
+       bignum)
+               AC_DEFINE(HAVE_BIGNUM, 1,
+                       [define if you have SSLeay or OpenSSL's BIGNUM])
+               ;;
+       gmp)
                AC_DEFINE(HAVE_GMP, 1, [define if you have -lgmp])
                SLAPD_GMP_LIBS=-lgmp
-       fi
+               ;;
+       none)
+               ;;
+       esac
+
+       AC_MSG_RESULT($ol_mp_support)
 fi
 
 dnl ----------------------------------------------------------------
index f218223acf8412280b08030362f66e741dd119ef..ea73f3c53989670aa8cf1cd7117a4e9dde566d13 100644 (file)
@@ -249,7 +249,95 @@ LDAP_F (int) ldap_pvt_tls_get_strength LDAP_P(( void *ctx ));
 
 LDAP_END_DECL
 
-#include "ldap_pvt_uc.h"
+/*
+ * Multiple precision stuff
+ * 
+ * May use OpenSSL's BIGNUM if built with TLS,
+ * or GNU's multiple precision library.
+ *
+ * If none is available, unsigned long data is used.
+ */
+#ifdef HAVE_BIGNUM
+/*
+ * Use OpenSSL's BIGNUM
+ */
+#if defined(HAVE_OPENSSL_CRYPTO_H)
+#include <openssl/crypto.h>
+#elif HAVE_CRYPTO_H
+#include <crypto.h>
+#endif /* HAVE_OPENSSL_CRYPTO_H || HAVE_CRYPTO_H */
+#ifdef HAVE_OPENSSL_BN_H
+#include <openssl/bn.h>
+#elif HAVE_BN_H
+#include <bn.h>
+#endif /* HAVE_OPENSSL_BN_H || HAVE_BN_H */
+
+typedef        BIGNUM*         ldap_pvt_mp_t;
+
+#define        ldap_pvt_mp_init(mp) \
+       do { (mp) = BN_new(); BN_init((mp)); } while (0)
 
+/* FIXME: we rely on mpr being initialized */
+#define        ldap_pvt_mp_init_set(mpr,mpv) \
+       do { ldap_pvt_mp_init((mpr)); BN_add((mpr), (mpr), (mpv)); } while (0)
+
+#define        ldap_pvt_mp_add(mpr,mpv) \
+       BN_add((mpr), (mpr), (mpv))
+
+#define        ldap_pvt_mp_add_ulong(mp,v) \
+       BN_add_word((mp), (v))
+
+#define ldap_pvt_mp_clear(mp) \
+       do { BN_free((mp)); (mp) = 0; } while (0)
+
+#elif defined(HAVE_GMP)
+/*
+ * Use GNU's multiple precision library
+ */
+#ifdef HAVE_GMP_H
+#include <gmp.h>
 #endif
 
+typedef mpz_t          ldap_pvt_mp_t;
+#define ldap_pvt_mp_init(mp) \
+       mpz_init((mp))
+
+#define        ldap_pvt_mp_init_set(mpr,mpv) \
+       mpz_init_set((mpr), (mpv))
+
+#define        ldap_pvt_mp_add(mpr,mpv) \
+       mpz_add((mpr), (mpr), (mpv))
+
+#define        ldap_pvt_mp_add_ulong(mp,v)     \
+       mpz_add_ui((mp), (mp), (v))
+
+#define ldap_pvt_mp_clear(mp) \
+       mpz_clear((mp))
+
+#else /* ! HAVE_BIGNUM && ! HAVE_GMP */
+/*
+ * Use unsigned long
+ */
+
+typedef        unsigned long   ldap_pvt_mp_t;
+
+#define ldap_pvt_mp_init(mp) \
+       (mp) = 0
+
+#define        ldap_pvt_mp_init_set(mpr,mpv) \
+       (mpr) = (mpv)
+
+#define        ldap_pvt_mp_add(mpr,mpv) \
+       (mpr) += (mpv)
+
+#define        ldap_pvt_mp_add_ulong(mp,v) \
+       (mp) += (v)
+
+#define ldap_pvt_mp_clear(mp) \
+       (mp) = 0
+
+#endif /* ! HAVE_BIGNUM && ! HAVE_GMP */
+
+#include "ldap_pvt_uc.h"
+
+#endif
index 9b5805363edd18c934204253ebe4b7845807eb56..5b264409754484dec79e07c86934adcddacfe5ae 100644 (file)
@@ -24,7 +24,6 @@
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #include "lutil.h"
 
@@ -793,6 +792,7 @@ str2anlist( AttributeName *an, char *in, const char *brkstr )
        }
 
        an = ch_realloc( an, ( i + j + 1 ) * sizeof( AttributeName ) );
+       BER_BVZERO( &an[i + j].an_name );
        anew = an + i;
        for ( s = ldap_pvt_strtok( str, brkstr, &lasts );
                s != NULL;
index 086efa4ba7ce1434e327f6161a060dbbb79973d5..1c3a5f276633720013b86c669426f578a65cf498 100644 (file)
@@ -30,7 +30,6 @@
 #include <ac/time.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 
 #ifdef LDAP_SLAPI
index 740a2b7ef58d355c5f2f97f5d8dd151cbe59fb78..bc3d12f53e4fdc72771102bd89072d2e68ec8a27 100644 (file)
@@ -24,7 +24,6 @@
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 
 
index 87bfb97a5bb85f12f2b922d702698db1172187df..70600c4eb942fd4a362c160728fba4948ed5578c 100644 (file)
@@ -38,7 +38,6 @@
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 
 void
index b3266084a40c176602e0e5b134b2dee5cfc0de9b..a399805a7c99fc1cf87b186a7b41fa16ecdb221e 100644 (file)
@@ -31,7 +31,6 @@
 #include "slap.h"
 #include "../back-ldap/back-ldap.h"
 #include "back-meta.h"
-#include "ldap_pvt.h"
 #undef ldap_debug      /* silence a warning in ldap-int.h */
 #include "ldap_log.h"
 #include "../../../libraries/libldap/ldap-int.h"
index a04aab28d0b12fa72dff129ba6d71fca751a966e..96c635bdba3dd117d7eb2910d7d55fac718d0887 100644 (file)
@@ -159,13 +159,8 @@ monitor_subsys_ops_update(
        struct monitorinfo      *mi = 
                (struct monitorinfo *)op->o_bd->be_private;
 
-#ifdef HAVE_GMP
-       mpz_t                   nInitiated,
+       ldap_pvt_mp_t           nInitiated,
                                nCompleted;
-#else /* ! HAVE_GMP */
-       unsigned long           nInitiated = 0,
-                               nCompleted = 0;
-#endif /* ! HAVE_GMP */
        struct berval           rdn;
        int                     i;
        Attribute               *a;
@@ -177,20 +172,13 @@ monitor_subsys_ops_update(
        dnRdn( &e->e_nname, &rdn );
 
        if ( dn_match( &rdn, &bv_ops ) ) {
-#ifdef HAVE_GMP
-               mpz_init( nInitiated );
-               mpz_init( nCompleted );
-#endif /* HAVE_GMP */
+               ldap_pvt_mp_init( nInitiated );
+               ldap_pvt_mp_init( nCompleted );
 
                ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-#ifdef HAVE_GMP
-                       mpz_add( nInitiated, nInitiated, slap_counters.sc_ops_initiated_[ i ] );
-                       mpz_add( nCompleted, nCompleted, slap_counters.sc_ops_completed_[ i ] );
-#else /* ! HAVE_GMP */
-                       nInitiated += slap_counters.sc_ops_initiated_[ i ];
-                       nCompleted += slap_counters.sc_ops_completed_[ i ];
-#endif /* ! HAVE_GMP */
+                       ldap_pvt_mp_add( nInitiated, slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_add( nCompleted, slap_counters.sc_ops_completed_[ i ] );
                }
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
                
@@ -199,13 +187,8 @@ monitor_subsys_ops_update(
                        if ( dn_match( &rdn, &monitor_op[ i ].nrdn ) )
                        {
                                ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
-#ifdef HAVE_GMP
-                               mpz_init_set( nInitiated, slap_counters.sc_ops_initiated_[ i ] );
-                               mpz_init_set( nCompleted, slap_counters.sc_ops_completed_[ i ] );
-#else /* ! HAVE_GMP */
-                               nInitiated = slap_counters.sc_ops_initiated_[ i ];
-                               nCompleted = slap_counters.sc_ops_completed_[ i ];
-#endif /* ! HAVE_GMP */
+                               ldap_pvt_mp_init_set( nInitiated, slap_counters.sc_ops_initiated_[ i ] );
+                               ldap_pvt_mp_init_set( nCompleted, slap_counters.sc_ops_completed_[ i ] );
                                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
                                break;
                        }
@@ -222,18 +205,14 @@ monitor_subsys_ops_update(
 
        /* NOTE: no minus sign is allowed in the counters... */
        UI2BV( &a->a_vals[ 0 ], nInitiated );
-#ifdef HAVE_GMP
-       mpz_clear( nInitiated );
-#endif /* HAVE_GMP */
+       ldap_pvt_mp_clear( nInitiated );
        
        a = attr_find( e->e_attrs, mi->mi_ad_monitorOpCompleted );
        assert ( a != NULL );
 
        /* NOTE: no minus sign is allowed in the counters... */
        UI2BV( &a->a_vals[ 0 ], nCompleted );
-#ifdef HAVE_GMP
-       mpz_clear( nCompleted );
-#endif /* HAVE_GMP */
+       ldap_pvt_mp_clear( nCompleted );
 
        return( 0 );
 }
index cfda44b07b10c34d021a53328c21a22c6dbd7fe0..f1643e924b301947dc97d8958d1a73334126708f 100644 (file)
@@ -99,7 +99,26 @@ int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
 
 /* NOTE: this macro assumes that bv has been allocated
  * by ber_* malloc functions or is { 0L, NULL } */
-#ifdef HAVE_GMP
+#if defined(HAVE_BIGNUM)
+#define UI2BV(bv,ui) \
+       do { \
+               char            *val; \
+               ber_len_t       len; \
+               val = BN_bn2dec(ui); \
+               if (val) { \
+                       len = strlen(val); \
+                       if ( len > (bv)->bv_len ) { \
+                               (bv)->bv_val = ber_memrealloc( (bv)->bv_val, len + 1 ); \
+                       } \
+                       AC_MEMCPY((bv)->bv_val, val, len + 1); \
+                       (bv)->bv_len = len; \
+                       OPENSSL_free(val); \
+               } else { \
+                       ber_memfree( (bv)->bv_val ); \
+                       BER_BVZERO( (bv) ); \
+               } \
+       } while ( 0 )
+#elif defined(HAVE_GMP)
 /* NOTE: according to the documentation, the result 
  * of mpz_sizeinbase() can exceed the length of the
  * string representation of the number by 1
@@ -116,7 +135,7 @@ int monitor_subsys_time_update LDAP_P(( Operation *op, Entry *e ));
                } \
                (bv)->bv_len = len; \
        } while ( 0 )
-#else /* ! HAVE_GMP */
+#else /* ! HAVE_BIGNUM && ! HAVE_GMP */
 #define UI2BV(bv,ui) \
        do { \
                char            buf[] = "+9223372036854775807L"; \
index 60ad9f468d19073643e426e8d9b69bf15e631fdc..6a4c70d540549337d3384c4c4aecc877ea4c812c 100644 (file)
 #include "lutil.h"
 #include "back-monitor.h"
 
+enum {
+       MONITOR_RWW_READ = 0,
+       MONITOR_RWW_WRITE,
+
+       MONITOR_RWW_LAST
+};
+
+struct monitor_rww_t {
+       struct berval   rdn;
+       struct berval   nrdn;
+} monitor_rww[] = {
+       { BER_BVC("cn=Read"),           BER_BVNULL },
+       { BER_BVC("cn=Write"),          BER_BVNULL },
+       { BER_BVNULL,                   BER_BVNULL }
+};
+
 int
 monitor_subsys_rww_init(
        BackendDB               *be
@@ -35,10 +51,9 @@ monitor_subsys_rww_init(
 {
        struct monitorinfo      *mi;
        
-       Entry                   *e, **ep, *e_conn;
+       Entry                   **ep, *e_conn;
        struct monitorentrypriv *mp;
-       char                    buf[ BACKMONITOR_BUFSIZE ];
-       struct berval           bv;
+       int                     i;
 
        assert( be != NULL );
 
@@ -57,109 +72,66 @@ monitor_subsys_rww_init(
        mp->mp_children = NULL;
        ep = &mp->mp_children;
 
-       /*
-        * Total conns
-        */
-       snprintf( buf, sizeof( buf ),
-               "dn: cn=Read,%s\n"
-               "objectClass: %s\n"
-               "structuralObjectClass: %s\n"
-               "cn: Read\n"
-               "creatorsName: %s\n"
-               "modifiersName: %s\n"
-               "createTimestamp: %s\n"
-               "modifyTimestamp: %s\n",
-               monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
-               mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
-               mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
-               mi->mi_creatorsName.bv_val,
-               mi->mi_creatorsName.bv_val,
-               mi->mi_startTime.bv_val,
-               mi->mi_startTime.bv_val );
-       
-       e = str2entry( buf );
-       if ( e == NULL ) {
-               Debug( LDAP_DEBUG_ANY,
-                       "monitor_subsys_rww_init: "
-                       "unable to create entry \"cn=Read,%s\"\n",
-                       monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
-               return( -1 );
-       }
-       
-       bv.bv_val = "0";
-       bv.bv_len = 1;
-       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
-       
-       mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
-       e->e_private = ( void * )mp;
-       mp->mp_next = NULL;
-       mp->mp_children = NULL;
-       mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
-       mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
-               | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
-
-       if ( monitor_cache_add( mi, e ) ) {
-               Debug( LDAP_DEBUG_ANY,
-                       "monitor_subsys_rww_init: "
-                       "unable to add entry \"cn=Read,%s\"\n",
-                       monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
-               return( -1 );
-       }
-       
-       *ep = e;
-       ep = &mp->mp_next;
-
-       /*
-        * Current conns
-        */
-       snprintf( buf, sizeof( buf ),
-                       "dn: cn=Write,%s\n"
+       for ( i = 0; i < MONITOR_RWW_LAST; i++ ) {
+               char                    buf[ BACKMONITOR_BUFSIZE ];
+               struct berval           nrdn, bv;
+               Entry                   *e;
+               
+               snprintf( buf, sizeof( buf ),
+                       "dn: %s,%s\n"
                        "objectClass: %s\n"
                        "structuralObjectClass: %s\n"
-                       "cn: Write\n"
+                       "cn: %s\n"
                        "creatorsName: %s\n"
                        "modifiersName: %s\n"
                        "createTimestamp: %s\n"
                        "modifyTimestamp: %s\n",
+                       monitor_rww[i].rdn.bv_val,
                        monitor_subsys[SLAPD_MONITOR_RWW].mss_dn.bv_val,
                        mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
                        mi->mi_oc_monitorCounterObject->soc_cname.bv_val,
+                       &monitor_rww[i].rdn.bv_val[STRLENOF("cn")],
                        mi->mi_creatorsName.bv_val,
                        mi->mi_creatorsName.bv_val,
                        mi->mi_startTime.bv_val,
                        mi->mi_startTime.bv_val );
        
-       e = str2entry( buf );
-       if ( e == NULL ) {
-               Debug( LDAP_DEBUG_ANY,
-                       "monitor_subsys_rww_init: "
-                       "unable to create entry \"cn=Write,%s\"\n",
-                       monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
-               return( -1 );
-       }
+               e = str2entry( buf );
+               if ( e == NULL ) {
+                       Debug( LDAP_DEBUG_ANY,
+                               "monitor_subsys_rww_init: "
+                               "unable to create entry \"cn=Read,%s\"\n",
+                               monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
+                       return( -1 );
+               }
+
+               /* steal normalized RDN */
+               dnRdn( &e->e_nname, &nrdn );
+               ber_dupbv( &monitor_rww[i].nrdn, &nrdn );
        
-       bv.bv_val = "0";
-       bv.bv_len = 1;
-       attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
+               BER_BVSTR( &bv, "0" );
+               attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
        
-       mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
-       e->e_private = ( void * )mp;
-       mp->mp_next = NULL;
-       mp->mp_children = NULL;
-       mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
-       mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
-               | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
-
-       if ( monitor_cache_add( mi, e ) ) {
-               Debug( LDAP_DEBUG_ANY,
-                       "monitor_subsys_rww_init: "
-                       "unable to add entry \"cn=Write,%s\"\n",
-                       monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0, 0 );
-               return( -1 );
-       }
+               mp = ( struct monitorentrypriv * )ch_calloc( sizeof( struct monitorentrypriv ), 1 );
+               e->e_private = ( void * )mp;
+               mp->mp_next = NULL;
+               mp->mp_children = NULL;
+               mp->mp_info = &monitor_subsys[SLAPD_MONITOR_RWW];
+               mp->mp_flags = monitor_subsys[SLAPD_MONITOR_RWW].mss_flags \
+                       | MONITOR_F_SUB | MONITOR_F_PERSISTENT;
+
+               if ( monitor_cache_add( mi, e ) ) {
+                       Debug( LDAP_DEBUG_ANY,
+                               "monitor_subsys_rww_init: "
+                               "unable to add entry \"%s,%s\"\n",
+                               monitor_rww[i].rdn.bv_val,
+                               monitor_subsys[SLAPD_MONITOR_RWW].mss_ndn.bv_val, 0 );
+                       return( -1 );
+               }
        
-       *ep = e;
-       ep = &mp->mp_next;
+               *ep = e;
+               ep = &mp->mp_next;
+       }
 
        monitor_cache_release( mi, e_conn );
 
@@ -177,49 +149,51 @@ monitor_subsys_rww_update(
        int                     connindex;
        long                    nconns, nwritewaiters, nreadwaiters;
 
-#define RWW_NONE       0
-#define RWW_READ       1
-#define RWW_WRITE      2
-       int                     type = RWW_NONE;
-       
+       int                     i;
+       struct berval           nrdn;
+
        Attribute               *a;
        char                    buf[] = "+9223372036854775807L";
        long                    num = 0;
+       ber_len_t               len;
 
        assert( mi != NULL );
        assert( e != NULL );
-       
-       if ( strncasecmp( e->e_ndn, "cn=read", 
-                               sizeof("cn=read")-1 ) == 0 ) {
-               type = RWW_READ;
 
-       } else if ( strncasecmp( e->e_ndn, "cn=write", 
-                               sizeof("cn=write")-1 ) == 0 ) {
-               type = RWW_WRITE;
+       dnRdn( &e->e_nname, &nrdn );
+
+       for ( i = 0; !BER_BVISNULL( &monitor_rww[i].nrdn ); i++ ) {
+               if ( dn_match( &nrdn, &monitor_rww[i].nrdn ) ) {
+                       break;
+               }
+       }
 
-       } else {
-               return( 0 );
+       if ( i == MONITOR_RWW_LAST ) {
+               return 0;
        }
 
        nconns = nwritewaiters = nreadwaiters = 0;
        for ( c = connection_first( &connindex );
                        c != NULL;
-                       c = connection_next( c, &connindex ), nconns++ ) {
+                       c = connection_next( c, &connindex ), nconns++ )
+       {
                if ( c->c_writewaiter ) {
                        nwritewaiters++;
                }
+
+               /* FIXME: ?!? */
                if ( c->c_currentber != NULL ) {
                        nreadwaiters++;
                }
        }
        connection_done(c);
 
-       switch ( type ) {
-       case RWW_READ:
+       switch ( i ) {
+       case MONITOR_RWW_READ:
                num = nreadwaiters;
                break;
 
-       case RWW_WRITE:
+       case MONITOR_RWW_WRITE:
                num = nwritewaiters;
                break;
 
@@ -231,8 +205,16 @@ monitor_subsys_rww_update(
 
        a = attr_find( e->e_attrs, mi->mi_ad_monitorCounter );
        assert( a );
-       free( a->a_vals[0].bv_val );
-       ber_str2bv( buf, 0, 1, &a->a_vals[ 0 ] );
+       len = strlen( buf );
+       if ( len > a->a_vals[0].bv_len ) {
+               a->a_vals[0].bv_val = ber_memrealloc( a->a_vals[0].bv_val, len + 1 );
+               if ( a->a_vals[0].bv_val == NULL ) {
+                       BER_BVZERO( &a->a_vals[0] );
+                       return( 0 );
+               }
+       }
+       AC_MEMCPY( a->a_vals[0].bv_val, buf, len + 1 );
+       a->a_vals[ 0 ].bv_len = len;
 
        return( 0 );
 }
index f996f9ec558c154616db6d6e4b93d5df225c5352..9f3df46618db6f7d9b543989ff866b835709a3b4 100644 (file)
@@ -77,7 +77,7 @@ monitor_subsys_sent_init(
 
        for ( i = 0; i < MONITOR_SENT_LAST; i++ ) {
                char                    buf[ BACKMONITOR_BUFSIZE ];
-               struct berval           rdn, bv;
+               struct berval           nrdn, bv;
                Entry                   *e;
 
                snprintf( buf, sizeof( buf ),
@@ -110,8 +110,8 @@ monitor_subsys_sent_init(
                }
 
                /* steal normalized RDN */
-               dnRdn( &e->e_nname, &rdn );
-               ber_dupbv( &monitor_sent[i].nrdn, &rdn );
+               dnRdn( &e->e_nname, &nrdn );
+               ber_dupbv( &monitor_sent[i].nrdn, &nrdn );
        
                BER_BVSTR( &bv, "0" );
                attr_merge_one( e, mi->mi_ad_monitorCounter, &bv, NULL );
@@ -151,22 +151,18 @@ monitor_subsys_sent_update(
        struct monitorinfo      *mi = 
                (struct monitorinfo *)op->o_bd->be_private;
        
-       struct berval           rdn;
-#ifdef HAVE_GMP
-       mpz_t                   n;
-#else /* ! HAVE_GMP */
-       unsigned long           n;
-#endif /* ! HAVE_GMP */
+       struct berval           nrdn;
+       ldap_pvt_mp_t           n;
        Attribute               *a;
        int                     i;
 
        assert( mi );
        assert( e );
 
-       dnRdn( &e->e_nname, &rdn );
+       dnRdn( &e->e_nname, &nrdn );
 
        for ( i = 0; i < MONITOR_SENT_LAST; i++ ) {
-               if ( dn_match( &rdn, &monitor_sent[i].nrdn ) ) {
+               if ( dn_match( &nrdn, &monitor_sent[i].nrdn ) ) {
                        break;
                }
        }
@@ -178,35 +174,19 @@ monitor_subsys_sent_update(
        ldap_pvt_thread_mutex_lock(&slap_counters.sc_sent_mutex);
        switch ( i ) {
        case MONITOR_SENT_ENTRIES:
-#ifdef HAVE_GMP
-               mpz_init_set( n, slap_counters.sc_entries );
-#else /* ! HAVE_GMP */
-               n = slap_counters.sc_entries;
-#endif /* ! HAVE_GMP */
+               ldap_pvt_mp_init_set( n, slap_counters.sc_entries );
                break;
 
        case MONITOR_SENT_REFERRALS:
-#ifdef HAVE_GMP
-               mpz_init_set( n, slap_counters.sc_refs );
-#else /* ! HAVE_GMP */
-               n = slap_counters.sc_refs;
-#endif /* ! HAVE_GMP */
+               ldap_pvt_mp_init_set( n, slap_counters.sc_refs );
                break;
 
        case MONITOR_SENT_PDU:
-#ifdef HAVE_GMP
-               mpz_init_set( n, slap_counters.sc_pdu );
-#else /* ! HAVE_GMP */
-               n = slap_counters.sc_pdu;
-#endif /* ! HAVE_GMP */
+               ldap_pvt_mp_init_set( n, slap_counters.sc_pdu );
                break;
 
        case MONITOR_SENT_BYTES:
-#ifdef HAVE_GMP
-               mpz_init_set( n, slap_counters.sc_bytes );
-#else /* ! HAVE_GMP */
-               n = slap_counters.sc_bytes;
-#endif /* ! HAVE_GMP */
+               ldap_pvt_mp_init_set( n, slap_counters.sc_bytes );
                break;
 
        default:
@@ -219,9 +199,7 @@ monitor_subsys_sent_update(
 
        /* NOTE: no minus sign is allowed in the counters... */
        UI2BV( &a->a_vals[ 0 ], n );
-#ifdef HAVE_GMP
-       mpz_clear( n );
-#endif /* HAVE_GMP */
+       ldap_pvt_mp_clear( n );
 
        return 0;
 }
index 1317459fd5b2fb227bff4bfd897969ff6c14cc16..239a1ba67b3d6547a519b72511b79d461e2feb8b 100644 (file)
@@ -45,7 +45,6 @@
 
 #include "slap.h"
 #include "back-passwd.h"
-#include <ldap_pvt.h>
 
 static void pw_start( Backend *be );
 
index c0918b8ccf1d8b5eea5dfbb88f055d337f208758..bf733ff08d666eee3685cd775fe970cab5f954fb 100644 (file)
@@ -27,7 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 /*
index 431a94495ae1ad863d705e9188ad4c344f0cd3e5..715e22b63b53c93de438473de6755dea960e6a62 100644 (file)
@@ -26,8 +26,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "lber_pvt.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 static backsql_api *backsqlapi;
index 29e58c07424bef414cd55b34917f5ec03c350ade..f0f5b58b5f035f0f3c8ed879e22306b3ce7666dd 100644 (file)
@@ -27,7 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 typedef struct backsql_delete_attr_t {
index 0b422d223a49d52e1d5548c9ff57399219b06648..b53384a9aa6c8531c9f6f680a3443692d8ce7776 100644 (file)
@@ -26,8 +26,6 @@
 #include <sys/types.h>
 #include "ac/string.h"
 
-#include "lber_pvt.h"
-#include "ldap_pvt.h"
 #include "slap.h"
 #include "proto-sql.h"
 
index 9924349930d8736a505569c13ca3eccdb5ce1218..24d6d201f6acc6561ba7d38d71f64d643fd8a50b 100644 (file)
@@ -27,7 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 #if SLAPD_SQL == SLAPD_MOD_DYNAMIC
index 1a528091d8ca47a4aee36f69a537b25081873e4b..2e43e13c120cd5ddd5f1ed44d465e8323c45596c 100644 (file)
@@ -27,7 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 int
index 83fd4ee0c499f319fbf9fb3bb5e695dab7e5e4bb..698daed1c77923769ea6feecb09578587e2d7400 100644 (file)
@@ -27,7 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 int
index 8b2d8f678f4f41985820d4c141dd72be37c1f8d7..fd524e721f91a183ba6251e88650796f27b32096 100644 (file)
@@ -27,8 +27,6 @@
 #include "ac/string.h"
 
 #include "slap.h"
-#include "lber_pvt.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 #define BACKSQL_DUPLICATE      (-1)
index 7b1f960e032086728419737811d272dcb1b70330..f3951734bb63f27ca359b8648c5b76c362a8be8b 100644 (file)
@@ -28,8 +28,6 @@
 #include "ac/ctype.h"
 
 #include "slap.h"
-#include "lber_pvt.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 static int backsql_process_filter( backsql_srch_info *bsi, Filter *f );
index ff0fa3d94117c9c2d13462fed4eb1305045f46db..f6337fe31e4b08b9454204b683e311d9dff5f97b 100644 (file)
@@ -27,7 +27,6 @@
 #include <sys/types.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 #define MAX_ATTR_LEN 16384
index 16084ef4ef414d0fd768e8094d50859edc5e5590..41f099ce18988ca75edda0b7872552c6925e5c53 100644 (file)
@@ -29,8 +29,6 @@
 #include "ac/stdarg.h"
 
 #include "slap.h"
-#include "lber_pvt.h"
-#include "ldap_pvt.h"
 #include "proto-sql.h"
 
 #define BACKSQL_MAX(a,b) ((a)>(b)?(a):(b))
index c9d200bfbafe8c8351214078399086abd067a644..55c9e8bb471acdfcc34e9a090102ee36a8c03be3 100644 (file)
@@ -31,7 +31,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi/slapi.h"
index 0ade75a500b9678b843558f45f283c329f03f42a..6a7d1d47aa7240b0769f33b722861355c3d2229f 100644 (file)
@@ -29,7 +29,6 @@
 #include <ac/socket.h>
 #include <ac/string.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi/slapi.h"
index d0b7e0af61d6f15813977f50914fb9e03bd9eb2c..46559c760c89eaab3c0c55b941f3a065014d0634 100644 (file)
@@ -20,7 +20,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include <ldap.h>
 #include "slap.h"
index 0b65dd33df2ed8ced5506133a1a0c0dd40b9555d..d44ad0005ff4b83960b6a77cd3e88310ca879800 100644 (file)
@@ -34,7 +34,6 @@
 #include <ac/socket.h>
 #include <ac/errno.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi/slapi.h"
index d01e907d07328e581605e054561b5a813eb79a66..baab32cb15afff7d2eacdc24b519d3dba9a44e2f 100644 (file)
@@ -34,7 +34,6 @@
 #include <ac/time.h>
 #include <ac/unistd.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 
@@ -863,38 +862,20 @@ void connection_done( Connection *c )
  */
 
 #ifdef SLAPD_MONITOR
-#ifdef HAVE_GMP
+/* FIXME: returns 0 in case of failure */
 #define INCR_OP_INITIATED(index) \
        do { \
                ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
-               mpz_add_ui(slap_counters.sc_ops_initiated_[(index)], \
-                               slap_counters.sc_ops_initiated_[(index)], 1); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_initiated_[(index)], 1); \
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
        } while (0)
 #define INCR_OP_COMPLETED(index) \
        do { \
                ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
-               mpz_add_ui(slap_counters.sc_ops_completed, \
-                               slap_counters.sc_ops_completed, 1); \
-               mpz_add_ui(slap_counters.sc_ops_completed_[(index)], \
-                               slap_counters.sc_ops_completed_[(index)], 1); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_completed, 1); \
+               ldap_pvt_mp_add_ulong(slap_counters.sc_ops_completed_[(index)], 1); \
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
        } while (0)
-#else /* ! HAVE_GMP */
-#define INCR_OP_INITIATED(index) \
-       do { \
-               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
-               slap_counters.sc_ops_initiated_[(index)]++; \
-               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
-       } while (0)
-#define INCR_OP_COMPLETED(index) \
-       do { \
-               ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex ); \
-               slap_counters.sc_ops_completed++; \
-               slap_counters.sc_ops_completed_[(index)]++; \
-               ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex ); \
-       } while (0)
-#endif /* ! HAVE_GMP */
 #else /* !SLAPD_MONITOR */
 #define INCR_OP_INITIATED(index) 
 #define INCR_OP_COMPLETED(index) 
@@ -916,11 +897,8 @@ connection_operation( void *ctx, void *arg_v )
        ber_len_t memsiz;
 
        ldap_pvt_thread_mutex_lock( &slap_counters.sc_ops_mutex );
-#ifdef HAVE_GMP
-       mpz_add_ui(slap_counters.sc_ops_initiated, slap_counters.sc_ops_initiated, 1);
-#else /* ! HAVE_GMP */
-       slap_counters.sc_ops_initiated++;
-#endif /* ! HAVE_GMP */
+       /* FIXME: returns 0 in case of failure */
+       ldap_pvt_mp_add_ulong(slap_counters.sc_ops_initiated, 1);
        ldap_pvt_thread_mutex_unlock( &slap_counters.sc_ops_mutex );
 
        op->o_threadctx = ctx;
index f69c321cb9ed6b80b9f619308443804848df424b..4280b740e6978818b6a2c0a0c2712fbc8a9c13c0 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 
 struct cindexrec {
        struct berval   cir_name;
index b67fc7dff9061310325282065d5a9990d53e49da..3080ea312a46ce40e309f59998c3086b8a474bad 100644 (file)
@@ -22,7 +22,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 #include "lutil_ldap.h"
index c3e98eb0b21062a782fb752f08e1389aee43d4b9..bd91a1a3501b4c9c16d9ae8c8d1bcb8cf3d79dcb 100644 (file)
@@ -35,7 +35,6 @@
 #include <ac/unistd.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "ldap_pvt_thread.h"
 #include "lutil.h"
 
index bc502ebf0e23c2d65c6e084feea9643f785af449..3ee66eac7dbd41a86964a89c813d23089107f535 100644 (file)
@@ -30,7 +30,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 
 #include "lutil.h"
index 7f3a34537ff421d9554c3a9a2eb0eded6db50a6e..151d6d35cee0ee66e37c2791952ef72408d0be63 100644 (file)
@@ -34,7 +34,6 @@
 #include <ac/time.h>
 
 #include "slap.h"
-#include "ldap_pvt.h" /* must be after slap.h, to get ldap_bv2dn_x() & co */
 #include "lutil.h"
 
 /*
index c20bb4bbd64ce8eb4bf65517d362568f2196352c..b7a3fc3bac0a9d8e2094767c8c043049dba22550 100644 (file)
@@ -121,36 +121,20 @@ slap_init( int mode, const char *name )
 
                ldap_pvt_thread_mutex_init( &slap_counters.sc_sent_mutex );
                ldap_pvt_thread_mutex_init( &slap_counters.sc_ops_mutex );
-#ifdef HAVE_GMP
-               mpz_init( slap_counters.sc_bytes );
-               mpz_init( slap_counters.sc_pdu );
-               mpz_init( slap_counters.sc_entries );
-               mpz_init( slap_counters.sc_refs );
+               ldap_pvt_mp_init( slap_counters.sc_bytes );
+               ldap_pvt_mp_init( slap_counters.sc_pdu );
+               ldap_pvt_mp_init( slap_counters.sc_entries );
+               ldap_pvt_mp_init( slap_counters.sc_refs );
 
-               mpz_init( slap_counters.sc_ops_completed );
-               mpz_init( slap_counters.sc_ops_initiated );
+               ldap_pvt_mp_init( slap_counters.sc_ops_completed );
+               ldap_pvt_mp_init( slap_counters.sc_ops_initiated );
 
 #ifdef SLAPD_MONITOR
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       mpz_init( slap_counters.sc_ops_initiated_[ i ] );
-                       mpz_init( slap_counters.sc_ops_completed_[ i ] );
+                       ldap_pvt_mp_init( slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_init( slap_counters.sc_ops_completed_[ i ] );
                }
 #endif /* SLAPD_MONITOR */
-#else /* ! HAVE_GMP */
-               slap_counters.sc_bytes = 0;
-               slap_counters.sc_pdu = 0;
-               slap_counters.sc_entries = 0;
-               slap_counters.sc_refs = 0;
-
-               slap_counters.sc_ops_completed = 0;
-               slap_counters.sc_ops_initiated = 0;
-#ifdef SLAPD_MONITOR
-               for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       slap_counters.sc_ops_initiated_[ i ] = 0;
-                       slap_counters.sc_ops_completed_[ i ] = 0;
-               }
-#endif /* SLAPD_MONITOR */
-#endif /* ! HAVE_GMP */
 
 #ifndef HAVE_GMTIME_R
                ldap_pvt_thread_mutex_init( &gmtime_mutex );
@@ -251,21 +235,19 @@ int slap_destroy(void)
 
                ldap_pvt_thread_mutex_destroy( &slap_counters.sc_sent_mutex );
                ldap_pvt_thread_mutex_destroy( &slap_counters.sc_ops_mutex );
-#ifdef HAVE_GMP
-               mpz_clear( slap_counters.sc_bytes );
-               mpz_clear( slap_counters.sc_pdu );
-               mpz_clear( slap_counters.sc_entries );
-               mpz_clear( slap_counters.sc_refs );
-               mpz_clear( slap_counters.sc_ops_completed );
-               mpz_clear( slap_counters.sc_ops_initiated );
+               ldap_pvt_mp_clear( slap_counters.sc_bytes );
+               ldap_pvt_mp_clear( slap_counters.sc_pdu );
+               ldap_pvt_mp_clear( slap_counters.sc_entries );
+               ldap_pvt_mp_clear( slap_counters.sc_refs );
+               ldap_pvt_mp_clear( slap_counters.sc_ops_completed );
+               ldap_pvt_mp_clear( slap_counters.sc_ops_initiated );
 
 #ifdef SLAPD_MONITOR
                for ( i = 0; i < SLAP_OP_LAST; i++ ) {
-                       mpz_clear( slap_counters.sc_ops_initiated_[ i ] );
-                       mpz_clear( slap_counters.sc_ops_completed_[ i ] );
+                       ldap_pvt_mp_clear( slap_counters.sc_ops_initiated_[ i ] );
+                       ldap_pvt_mp_clear( slap_counters.sc_ops_completed_[ i ] );
                }
 #endif /* SLAPD_MONITOR */
-#endif /* HAVE_GMP */
                break;
 
        default:
index 19c74eb6b5d63cd518a8325cc53ce48e29e08e10..c0b916193666aa78780447c2de20611ae3e09564 100644 (file)
@@ -22,7 +22,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 #include "../../libraries/liblber/lber-int.h" /* get ber_strndup() */
index 01fbf316af4f763501d0a60c363bb8174c619659..3f5f835d0e61e8e07a9a338b4a83fae4dc5602db 100644 (file)
@@ -34,8 +34,6 @@
 #include <ac/wait.h>
 #include <ac/errno.h>
 
-#include "ldap_pvt.h"
-
 #include "slap.h"
 #include "lutil.h"
 #include "ldif.h"
index 1b707e175fce811be156a6d973f0436bc6a699ef..f7dbeb026e48fd7ed92831ad2396557fe368bd33 100644 (file)
@@ -31,7 +31,6 @@
 #include <ac/string.h>
 #include <ac/time.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi/slapi.h"
index f5c8a33bf012060cba8a0e6cfa8201cbc5b8fff0..6446a311af7b8791d23deb93efb4018fbac6f3ed 100644 (file)
@@ -38,7 +38,6 @@
 #include <ac/socket.h>
 #include <ac/string.h>
 
-#include "ldap_pvt.h"
 #include "slap.h"
 #ifdef LDAP_SLAPI
 #include "slapi/slapi.h"
index ea1c9bd4154d79a10d417c17015bba6a88926d38..e810c3764871f5eb85c89f645245cc279ad9a332 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 
 struct mindexrec {
        struct berval   mir_name;
index b31defeaef19610d784a8d705591721c062bae33..fcefc34449aa2ff4aa07a6b50251f79a65838134 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 
 int is_object_subclass(
        ObjectClass *sup,
index b631a58efded3f18488c4a081e533cb3fe046eda..3b667e5380175c13fbb37fbde40bbba5ca7500de 100644 (file)
@@ -29,7 +29,6 @@
 #include <ac/time.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "ldap_rq.h"
 
index 91db896f1c0bb3e4869a4546d18a912107154f5c..039e1957f3c00554564c8e81be3e87fcf7e94d07 100644 (file)
@@ -25,8 +25,6 @@
 #include <ac/time.h>
 #include <ac/unistd.h>
 
-#include <ldap_pvt.h>
-
 #include "slap.h"
 
 /*
index 1f87393182191f24f05599c87afd41d16eadf46b..b2f611c4eb0e193bcdeac381bf950c05ed040c9c 100644 (file)
@@ -448,13 +448,8 @@ send_ldap_response(
 #endif /* LDAP_SLAPI */
 
        ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
-#ifdef HAVE_GMP
-       mpz_add_ui( slap_counters.sc_pdu, slap_counters.sc_pdu, 1 );
-       mpz_add_ui( slap_counters.sc_bytes, slap_counters.sc_bytes, bytes );
-#else /* ! HAVE_GMP */
-       slap_counters.sc_bytes += bytes;
-       slap_counters.sc_pdu++;
-#endif /* ! HAVE_GMP */
+       ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
        ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
 
 cleanup:;
@@ -1181,15 +1176,9 @@ slap_send_search_entry( Operation *op, SlapReply *rs )
                rs->sr_nentries++;
 
                ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
-#ifdef HAVE_GMP
-               mpz_add_ui( slap_counters.sc_bytes, slap_counters.sc_bytes, bytes );
-               mpz_add_ui( slap_counters.sc_entries, slap_counters.sc_entries, 1 );
-               mpz_add_ui( slap_counters.sc_pdu, slap_counters.sc_pdu, 1 );
-#else /* ! HAVE_GMP */
-               slap_counters.sc_bytes += bytes;
-               slap_counters.sc_entries++;
-               slap_counters.sc_pdu++;
-#endif /* ! HAVE_GMP */
+               ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_entries, 1 );
+               ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
                ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
        }
 
@@ -1376,15 +1365,9 @@ slap_send_search_reference( Operation *op, SlapReply *rs )
        ber_free_buf( ber );
 
        ldap_pvt_thread_mutex_lock( &slap_counters.sc_sent_mutex );
-#ifdef HAVE_GMP
-       mpz_add_ui( slap_counters.sc_bytes, slap_counters.sc_bytes, bytes );
-       mpz_add_ui( slap_counters.sc_refs, slap_counters.sc_refs, 1 );
-       mpz_add_ui( slap_counters.sc_pdu, slap_counters.sc_pdu, 1 );
-#else /* ! HAVE_GMP */
-       slap_counters.sc_bytes += bytes;
-       slap_counters.sc_refs++;
-       slap_counters.sc_pdu++;
-#endif /* ! HAVE_GMP */
+       ldap_pvt_mp_add_ulong( slap_counters.sc_bytes, bytes );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_refs, 1 );
+       ldap_pvt_mp_add_ulong( slap_counters.sc_pdu, 1 );
        ldap_pvt_thread_mutex_unlock( &slap_counters.sc_sent_mutex );
 #ifdef LDAP_CONNECTIONLESS
        }
index f00d0ab6b875373aa1fc683a0640465d63737f79..3363294e01de7847447f477120b7e32c6d51f070 100644 (file)
@@ -60,8 +60,6 @@ typedef struct sasl_ctx {
 
 #endif
 
-#include "ldap_pvt.h"
-#include "lber_pvt.h"
 #include <lutil.h>
 
 static struct berval ext_bv = BER_BVC( "EXTERNAL" );
index 7b61f06e0c7dcc76ff5ce9c81bc8bb5199966692..28044d69936965f608feceb5e7a586688e5306a8 100644 (file)
@@ -26,7 +26,6 @@
 
 #include <limits.h>
 
-#include <ldap_pvt.h>
 #include "lutil.h"
 
 #define SASLREGEX_REPLACE 10
index 8f6f2af6196ea7ec578f7081d263f7335e29580c..69d243b04d5dc4fb540fc7483b212111b121f6eb 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 #include "lutil.h"
 
 
index 1a11a0b011dc35f71094d9a9d02dcd7a1743a52b..0da634d81246dd7093d3a421630c2f87efd27117 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 
 static char * oc_check_required(
        Entry *e,
index a0e5fe6a061d63a86e490fb4d86b2aefae3d6e6f..4390130435d8c0f14acc29a74a8edf816f78d7ba 100644 (file)
@@ -25,8 +25,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
-#include "lber_pvt.h"
 
 #include "ldap_utf8.h"
 
index a368e51e310a45063f1bbc621380abd2fb52e5e0..e81009a57b8da271d0d1c40acd35736cb770d82b 100644 (file)
@@ -23,8 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
-#include "ldap_pvt_uc.h"
 
 #define OCDEBUG 0
 
index 30532922b9522a66837d07b8453bf5dbd5927bb0..805e5a180fa811b0decc22739bded8105afccaf9 100644 (file)
@@ -30,7 +30,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 
index 2e9bbfca16495acebd0fda7f07a49b64ea005da1..a573be68303237dc31e9b04f6d7d0674a4a013a8 100644 (file)
@@ -22,7 +22,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 #include "lutil_ldap.h"
index 7234f15db7a6df98cb37edf08cc37ef9866e06b9..e973c363db6e5006d6b4ee2ae1be77401dc69467 100644 (file)
 #include <ac/time.h>
 #include <ac/param.h>
 
-#ifdef HAVE_GMP
-#include <gmp.h>
-#endif /* HAVE_GMP */
-
 #include "avl.h"
 
 #ifndef ldap_debug
@@ -56,6 +52,7 @@
 #include <ldap_schema.h>
 
 #include "lber_pvt.h"
+#include "ldap_pvt.h"
 #include "ldap_pvt_thread.h"
 #include "ldap_queue.h"
 
@@ -2434,47 +2431,20 @@ enum {
 
 typedef struct slap_counters_t {
        ldap_pvt_thread_mutex_t sc_sent_mutex;
-#ifdef HAVE_GMP
-       mpz_t                   sc_bytes;
-       mpz_t                   sc_pdu;
-       mpz_t                   sc_entries;
-       mpz_t                   sc_refs;
-#else /* ! HAVE_GMP */
-       unsigned long           sc_bytes;
-       unsigned long           sc_pdu;
-       unsigned long           sc_entries;
-       unsigned long           sc_refs;
-#endif /* ! HAVE_GMP */
+       ldap_pvt_mp_t           sc_bytes;
+       ldap_pvt_mp_t           sc_pdu;
+       ldap_pvt_mp_t           sc_entries;
+       ldap_pvt_mp_t           sc_refs;
 
        ldap_pvt_thread_mutex_t sc_ops_mutex;
-#ifdef HAVE_GMP
-       mpz_t                   sc_ops_completed;
-       mpz_t                   sc_ops_initiated;
-#ifdef SLAPD_MONITOR
-       mpz_t                   sc_ops_completed_[SLAP_OP_LAST];
-       mpz_t                   sc_ops_initiated_[SLAP_OP_LAST];
-#endif /* SLAPD_MONITOR */
-#else /* ! HAVE_GMP */
-       unsigned long           sc_ops_completed;
-       unsigned long           sc_ops_initiated;
+       ldap_pvt_mp_t           sc_ops_completed;
+       ldap_pvt_mp_t           sc_ops_initiated;
 #ifdef SLAPD_MONITOR
-       unsigned long           sc_ops_completed_[SLAP_OP_LAST];
-       unsigned long           sc_ops_initiated_[SLAP_OP_LAST];
+       ldap_pvt_mp_t           sc_ops_completed_[SLAP_OP_LAST];
+       ldap_pvt_mp_t           sc_ops_initiated_[SLAP_OP_LAST];
 #endif /* SLAPD_MONITOR */
-#endif /* ! HAVE_GMP */
 } slap_counters_t;
 
-#define        num_sent_mutex          slap_counters.sc_sent_mutex
-#define        num_bytes_sent          slap_counters.sc_bytes
-#define        num_pdu_sent            slap_counters.sc_pdu
-#define        num_entries_sent        slap_counters.sc_entries
-#define        num_refs_sent           slap_counters.sc_refs
-#define        num_ops_mutex           slap_counters.sc_ops_mutex
-#define num_ops_completed      slap_counters.sc_ops_completed
-#define num_ops_initiated      slap_counters.sc_ops_initiated
-#define num_ops_completed_     slap_counters.sc_ops_completed_
-#define num_ops_initiated_     slap_counters.sc_ops_initiated_
-
 /*
  * Better know these all around slapd
  */
index 0bc87bb80f320147d637e1c1ba7010b586dce3b0..d83b77a2a8e52e565014a47d971030d4840d9543 100644 (file)
@@ -29,7 +29,6 @@
 #include <ac/stdarg.h>
 #include <ac/ctype.h>
 #include <ac/unistd.h>
-#include <ldap_pvt.h>
 
 #include <slap.h>
 #include <slapi.h>
index a4f177246da2d4ae8ad874b29d88325ce9a50d3a..7209e43e986fe93c58060b9e272ded20b73a4d50 100644 (file)
@@ -26,7 +26,6 @@
 #include <ac/stdarg.h>
 #include <ac/ctype.h>
 #include <ac/unistd.h>
-#include <ldap_pvt.h>
 
 #include <slap.h>
 #include <slapi.h>
index 5ed9c5b5ac92bd77d26712bab99747c2cdf36bd8..cc47ee736dfe4ca234b0770c0d3315f42df0b0bf 100644 (file)
@@ -18,8 +18,6 @@
 #include <stdio.h>
 #include <ac/socket.h>
 
-#include <ldap_pvt.h>
-
 #include "slap.h"
 
 #ifdef HAVE_TLS
index f8b9cfcdf3a6d8e20638a600c70aa5de673aa2fb..39fa95eaecda42e23ba33b01a6fb9c0b8d8aeba5 100644 (file)
@@ -33,7 +33,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include <ldap_pvt.h>
 
 #if 0 /* unused */
 static char    *find_matching_paren( const char *s );
index 7346da5cd342ae03970dab9bc21b121d9b664fb3..696101ab649e5b38882cdd0dcf36e1c6f853a4bf 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/string.h>
 #include <ac/socket.h>
 
-#include "ldap_pvt.h"
 #include "lutil.h"
 #include "slap.h"
 #include "lutil_ldap.h"
index 711ed6171c925dd33875410b1147d9c04cf452c1..92c1e0681f34be5d7ef5898d12d4a43103930750 100644 (file)
@@ -23,7 +23,6 @@
 #include <ac/socket.h>
 
 #include "slap.h"
-#include "ldap_pvt.h"
 
 struct sindexrec {
        char            *sir_name;