]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-ldap/extended.c
Merge remote-tracking branch 'origin/mdb.master' into OPENLDAP_REL_ENG_2_4
[openldap] / servers / slapd / back-ldap / extended.c
index 88a5174ea451fb5d8880abbdb38e71313a2024e4..c9bedc6e13b33048295b85e30d0c30ed3170c5ab 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2009 The OpenLDAP Foundation.
+ * Copyright 2003-2013 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -90,6 +90,9 @@ ldap_back_extended(
 {
        int     i;
 
+       RS_ASSERT( !(rs->sr_flags & REP_ENTRY_MASK) );
+       rs->sr_flags &= ~REP_ENTRY_MASK;        /* paranoia */
+
        for ( i = 0; exop_table[i].extended != NULL; i++ ) {
                if ( bvmatch( &exop_table[i].oid, &op->oq_extended.rs_reqoid ) )
                {
@@ -183,7 +186,7 @@ ldap_back_exop_passwd(
                dn.bv_val, isproxy ? " (proxy)" : "", 0 );
 
 retry:
-       rc = ldap_passwd( lc->lc_ld, isproxy ? &dn : NULL,
+       rc = ldap_passwd( lc->lc_ld,  &dn,
                qpw->rs_old.bv_val ? &qpw->rs_old : NULL,
                qpw->rs_new.bv_val ? &qpw->rs_new : NULL,
                op->o_ctrls, NULL, &msgid );
@@ -191,8 +194,7 @@ retry:
        if ( rc == LDAP_SUCCESS ) {
                /* TODO: set timeout? */
                /* by now, make sure no timeout is used (ITS#6282) */
-               struct timeval tv;
-               tv.tv_sec = -1;
+               struct timeval tv = { -1, 0 };
                if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, &tv, &res ) == -1 ) {
                        ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER, &rc );
                        rs->sr_err = rc;
@@ -262,6 +264,10 @@ retry:
                ldap_back_quarantine( op, rs );
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_EXTENDED ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        if ( freedn ) {
                op->o_tmpfree( dn.bv_val, op->o_tmpmemctx );
                op->o_tmpfree( ndn.bv_val, op->o_tmpmemctx );
@@ -306,11 +312,10 @@ ldap_back_exop_generic(
        int             do_retry = 1;
        char            *text = NULL;
 
-       assert( lc != NULL );
-       assert( rs->sr_ctrls == NULL );
-
        Debug( LDAP_DEBUG_ARGS, "==> ldap_back_exop_generic(%s, \"%s\")\n",
                op->ore_reqoid.bv_val, op->o_req_dn.bv_val, 0 );
+       assert( lc != NULL );
+       assert( rs->sr_ctrls == NULL );
 
 retry:
        rc = ldap_extended_operation( lc->lc_ld,
@@ -320,8 +325,7 @@ retry:
        if ( rc == LDAP_SUCCESS ) {
                /* TODO: set timeout? */
                /* by now, make sure no timeout is used (ITS#6282) */
-               struct timeval tv;
-               tv.tv_sec = -1;
+               struct timeval tv = { -1, 0 };
                if ( ldap_result( lc->lc_ld, msgid, LDAP_MSG_ALL, &tv, &res ) == -1 ) {
                        ldap_get_option( lc->lc_ld, LDAP_OPT_ERROR_NUMBER, &rc );
                        rs->sr_err = rc;
@@ -377,6 +381,10 @@ retry:
                ldap_back_quarantine( op, rs );
        }
 
+       ldap_pvt_thread_mutex_lock( &li->li_counter_mutex );
+       ldap_pvt_mp_add( li->li_ops_completed[ SLAP_OP_EXTENDED ], 1 );
+       ldap_pvt_thread_mutex_unlock( &li->li_counter_mutex );
+
        /* these have to be freed anyway... */
        if ( rs->sr_matched ) {
                free( (char *)rs->sr_matched );
@@ -400,4 +408,3 @@ retry:
 
        return rc;
 }
-