]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-passwd/search.c
ITS#3607 add automatic BDB recovery
[openldap] / servers / slapd / back-passwd / search.c
index 3e3560e5690cdfac656f42349045e20883edb0cb..ab2c7c1a2262af6289fd10dcf39a556db774de9f 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 1998-2004 The OpenLDAP Foundation.
+ * Copyright 1998-2005 The OpenLDAP Foundation.
  * All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
@@ -45,7 +45,6 @@
 
 #include "slap.h"
 #include "back-passwd.h"
-#include <ldap_pvt.h>
 
 static void pw_start( Backend *be );
 
@@ -65,15 +64,13 @@ passwd_back_search(
        time_t          stoptime;
 
        LDAPRDN rdn = NULL;
-       struct berval parent = { 0, NULL };
+       struct berval parent = BER_BVNULL;
 
        AttributeDescription *ad_objectClass = slap_schema.si_ad_objectClass;
 
-       op->ors_tlimit = (op->ors_tlimit > op->o_bd->be_timelimit || op->ors_tlimit < 1) ? op->o_bd->be_timelimit
-           : op->ors_tlimit;
-       stoptime = op->o_time + op->ors_tlimit;
-       op->ors_slimit = (op->ors_slimit > op->o_bd->be_sizelimit || op->ors_slimit < 1) ? op->o_bd->be_sizelimit
-           : op->ors_slimit;
+       if (op->ors_tlimit != SLAP_NO_LIMIT ) {
+               stoptime = op->o_time + op->ors_tlimit;
+       }
 
        /* Handle a query for the base of this backend */
        if ( be_issuffix( op->o_bd, &op->o_req_ndn ) ) {
@@ -146,11 +143,13 @@ passwd_back_search(
                                if ( op->o_abandon ) {
                                        endpwent();
                                        ldap_pvt_thread_mutex_unlock( &passwd_mutex );
-                                       return( -1 );
+                                       return( SLAPD_ABANDON );
                                }
 
                                /* check time limit */
-                               if ( slap_get_time() > stoptime ) {
+                               if ( op->ors_tlimit != SLAP_NO_LIMIT
+                                               && slap_get_time() > stoptime )
+                               {
                                        send_ldap_error( op, rs, LDAP_TIMELIMIT_EXCEEDED, NULL );
                                        endpwent();
                                        ldap_pvt_thread_mutex_unlock( &passwd_mutex );