]> git.sur5r.net Git - openldap/blobdiff - servers/slurpd/ri.c
fix: changing bdb_cache_return_entry_w() to bdb_cache_return_entry_r()
[openldap] / servers / slurpd / ri.c
index 5335943ff534d4bdccc0606f06de851b2d17a88e..a805060a98f0672683e25c0127854154cd7d09a5 100644 (file)
@@ -1,4 +1,8 @@
 /* $OpenLDAP$ */
+/*
+ * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 /*
  * Copyright (c) 1996 Regents of the University of Michigan.
  * All rights reserved.
@@ -44,7 +48,7 @@ Ri_process(
 )
 {
     Rq         *rq = sglob->rq;
-    Re         *re, *new_re;
+    Re         *re = NULL, *new_re = NULL;
     int                rc ;
     char       *errmsg;
 
@@ -62,7 +66,13 @@ Ri_process(
     rq->rq_lock( rq );
     while ( !sglob->slurpd_shutdown &&
            (( re = rq->rq_gethead( rq )) == NULL )) {
-       /* No work - wait on condition variable */
+       /* No work */
+       if ( sglob->one_shot_mode ) {
+           /* give up if in one shot mode */
+           rq->rq_unlock( rq );
+           return 0;
+       }
+       /* wait on condition variable */
        ldap_pvt_thread_cond_wait( &rq->rq_more, &rq->rq_mutex );
     }
 
@@ -161,7 +171,7 @@ Ri_init(
     Ri **ri
 )
 {
-    (*ri) = ( Ri * ) malloc( sizeof( Ri ));
+    (*ri) = ( Ri * ) calloc( 1, sizeof( Ri ));
     if ( *ri == NULL ) {
        return -1;
     }
@@ -172,12 +182,10 @@ Ri_init(
 
     /* Initialize private data */
     (*ri)->ri_hostname = NULL;
-    (*ri)->ri_port = 0;
     (*ri)->ri_ldp = NULL;
-    (*ri)->ri_bind_method = 0;
     (*ri)->ri_bind_dn = NULL;
     (*ri)->ri_password = NULL;
-    (*ri)->ri_principal = NULL;
+    (*ri)->ri_authcId = NULL;
     (*ri)->ri_srvtab = NULL;
     (*ri)->ri_curr = NULL;
 
@@ -230,12 +238,12 @@ isnew(
     Re *re
 )
 {
-    int        x;
+    long x;
     int        ret;
 
     /* Lock the St struct to avoid a race */
     sglob->st->st_lock( sglob->st );
-    x = strcmp( re->re_timestamp, ri->ri_stel->last );
+    x = re->re_timestamp - ri->ri_stel->last;
     if ( x > 0 ) {
        /* re timestamp is newer */
        ret = 1;