]> git.sur5r.net Git - openldap/blobdiff - tests/progs/slapd-read.c
big mutex needs #ifdef HAVE_BERKELEY_DB_THREAD wrapper
[openldap] / tests / progs / slapd-read.c
index 2e15ce3decda7e029e130cc70b43489c7d12e37c..94f3d2194093355cf6511bb3c554c3bb05191744 100644 (file)
@@ -1,18 +1,22 @@
+/* $OpenLDAP$ */
+/*
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
+ * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
+ */
 #include "portable.h"
 
 #include <stdio.h>
-#include <stdlib.h>
 
-#include <ac/string.h>
+#include <ac/stdlib.h>
+
 #include <ac/ctype.h>
+#include <ac/param.h>
 #include <ac/socket.h>
+#include <ac/string.h>
 #include <ac/unistd.h>
 #include <ac/wait.h>
 
-#include <sys/param.h>
-
-#include "lber.h"
-#include "ldap.h"
+#include <ldap.h>
 
 #define LOOPS  100
 
@@ -24,13 +28,13 @@ usage( char *name )
 {
        fprintf( stderr, "usage: %s [-h <host>] -p port -e <entry> [-l <loops>]\n",
                        name );
-       exit( 1 );
+       exit( EXIT_FAILURE );
 }
 
 int
 main( int argc, char **argv )
 {
-       int             i, j;
+       int             i;
        char        *host = "localhost";
        int                     port = -1;
        char            *entry = NULL;
@@ -67,13 +71,13 @@ main( int argc, char **argv )
 
                fprintf( stderr, "%s: invalid EMPTY entry DN.\n",
                                argv[0] );
-               exit( 1 );
+               exit( EXIT_FAILURE );
 
        }
 
        do_read( host, port, entry, ( 4 * loops ));
 
-       exit( 0 );
+       exit( EXIT_SUCCESS );
 }
 
 
@@ -82,18 +86,17 @@ do_read( char *host, int port, char *entry, int maxloop )
 {
        LDAP    *ld;
        int     i;
-       char    *attrs[] = { "cn", "sn", NULL };
-       char    *filter = "(objectclass=*)";
+       char    *attrs[] = { "1.1", NULL };
        pid_t   pid = getpid();
 
        if (( ld = ldap_init( host, port )) == NULL ) {
                perror( "ldap_init" );
-               exit( 1 );
+               exit( EXIT_FAILURE );
        }
 
        if ( ldap_bind_s( ld, NULL, NULL, LDAP_AUTH_SIMPLE ) != LDAP_SUCCESS ) {
                ldap_perror( ld, "ldap_bind" );
-                exit( 1 );
+                exit( EXIT_FAILURE );
        }
 
 
@@ -105,7 +108,7 @@ do_read( char *host, int port, char *entry, int maxloop )
                int         rc;
 
                if (( rc = ldap_search_s( ld, entry, LDAP_SCOPE_BASE,
-                               filter, attrs, 0, &res )) != LDAP_SUCCESS ) {
+                               NULL, attrs, 1, &res )) != LDAP_SUCCESS ) {
 
                        ldap_perror( ld, "ldap_read" );
                        if ( rc != LDAP_NO_SUCH_OBJECT ) break;