]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/tmplout.c
Fix off by one bug
[openldap] / libraries / libldap / tmplout.c
index 280e762965661ea36b2368decfdc2fcb777c05d2..e73a53bed547f5f8b059c235ec51a86acacb7dd4 100644 (file)
@@ -1,6 +1,6 @@
 /* $OpenLDAP$ */
 /*
- * Copyright 1998-1999 The OpenLDAP Foundation, All Rights Reserved.
+ * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
  */
 /*
@@ -12,6 +12,7 @@
 
 #include <stdio.h>
 
+#include <ac/socket.h>
 #include <ac/stdlib.h>
 
 #include <ac/ctype.h>
@@ -474,15 +475,9 @@ do_entry2text_search(
 
            ocattrs[0] = OCATTRNAME;
            ocattrs[1] = NULL;
-#ifdef LDAP_CONNECTIONLESS
-           if ( LDAP_IS_CLDAP( ld ))
-                   err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE,
-                       "objectClass=*", ocattrs, 0, &ldmp, NULL );
-           else
-#endif /* LDAP_CONNECTIONLESS */
-                   err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE,
-                           "objectClass=*", ocattrs, 0, &timeout, &ldmp );
 
+               err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE,
+                       NULL, ocattrs, 0, &timeout, &ldmp );
            if ( err == LDAP_SUCCESS ) {
                entry = ldap_first_entry( ld, ldmp );
            }
@@ -508,13 +503,7 @@ do_entry2text_search(
        fetchattrs = ldap_tmplattrs( tmpl, NULL, 1, LDAP_SYN_OPT_DEFER );
     }
 
-#ifdef LDAP_CONNECTIONLESS
-    if ( LDAP_IS_CLDAP( ld ))
-       err = cldap_search_s( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
-               fetchattrs, 0, &ldmp, NULL );
-    else
-#endif /* LDAP_CONNECTIONLESS */
-       err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, "objectClass=*",
+       err = ldap_search_st( ld, dn, LDAP_SCOPE_BASE, NULL,
                fetchattrs, 0, &timeout, &ldmp );
 
     if ( freedn ) {
@@ -900,7 +889,7 @@ time2text( char *ldtimestr, int dateonly )
            return( fmterr );
        }
        
-    memset( (char *)&t, 0, sizeof( struct tm ));
+    memset( (char *)&t, '\0', sizeof( struct tm ));
 
     p = ldtimestr;
 
@@ -937,7 +926,7 @@ time2text( char *ldtimestr, int dateonly )
    
     timestr[ strlen( timestr ) - 1 ] = zone;   /* replace trailing newline */
     if ( dateonly ) {
-       SAFEMEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
+               AC_MEMCPY( timestr + 11, timestr + 20, strlen( timestr + 20 ) + 1 );
     }
 
     return( timestr );
@@ -1077,12 +1066,6 @@ searchaction( LDAP *ld, char *buf, char *base, LDAPMessage *entry, char *dn,
     timeout.tv_sec = SEARCH_TIMEOUT_SECS;
     timeout.tv_usec = 0;
 
-#ifdef LDAP_CONNECTIONLESS
-    if ( LDAP_IS_CLDAP( ld ))
-       lderr = cldap_search_s( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
-               0, &ldmp, NULL );
-    else
-#endif /* LDAP_CONNECTIONLESS */
        lderr = ldap_search_st( ld, base, LDAP_SCOPE_SUBTREE, filter, retattrs,
                0, &timeout, &ldmp );