]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/back-passwd/search.c
Update for Alpha3 from -devel as of OPENLDAP_DEVEL_981116.
[openldap] / servers / slapd / back-passwd / search.c
index 11c1d8e7192424712a5acd60e0e9f6592fc0a722..86fb55e6102f5822f6973e7b43f288071d5f6e24 100644 (file)
@@ -1,18 +1,18 @@
 /* search.c - /etc/passwd backend search function */
 
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/socket.h>
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include <pwd.h>
-#include "portable.h"
-#include "slap.h"
 
-extern time_t          currenttime;
-extern pthread_mutex_t currenttime_mutex;
+#include "slap.h"
 
-static Entry   *pw2entry();
+static Entry   *pw2entry(Backend *be, struct passwd *pw);
 
 int
 passwd_back_search(
@@ -80,14 +80,6 @@ passwd_back_search(
                }
                pthread_mutex_unlock( &op->o_abandonmutex );
 
-               /* check size limit */
-               if ( --slimit == -1 ) {
-                       send_ldap_result( conn, op, LDAP_SIZELIMIT_EXCEEDED,
-                           NULL, NULL );
-                       endpwent();
-                       return( 0 );
-               }
-
                /* check time limit */
                pthread_mutex_lock( &currenttime_mutex );
                time( &currenttime );
@@ -103,6 +95,14 @@ passwd_back_search(
                e = pw2entry( be, pw );
 
                if ( test_filter( be, conn, op, e, filter ) == 0 ) {
+                       /* check size limit */
+                       if ( --slimit == -1 ) {
+                               send_ldap_result( conn, op, LDAP_SIZELIMIT_EXCEEDED,
+                                   NULL, NULL );
+                               endpwent();
+                               return( 0 );
+                       }
+
                        send_search_entry( be, conn, op, e, attrs, attrsonly );
                }