]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/getentry.c
Fix ntohs/htons issues
[openldap] / libraries / libldap / getentry.c
index 8724758b8439c8d8e8aeb0b3f9eb33f67f6468d4..66d40656ade8d090db1c522abe2dd4f92e546267 100644 (file)
@@ -1,5 +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
  */
 /*  Portions
@@ -14,7 +15,6 @@
 #include <stdio.h>
 #include <ac/stdlib.h>
 
-#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -27,9 +27,10 @@ ldap_first_entry( LDAP *ld, LDAPMessage *chain )
 {
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
+       assert( chain != NULL );
 
-       if( ld == NULL || chain == NULLMSG ) {
-               return NULLMSG;
+       if( ld == NULL || chain == NULL ) {
+               return NULL;
        }
 
        return chain->lm_msgtype == LDAP_RES_SEARCH_ENTRY
@@ -42,14 +43,15 @@ ldap_next_entry( LDAP *ld, LDAPMessage *entry )
 {
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
+       assert( entry != NULL );
 
-       if ( ld == NULL || entry == NULLMSG ) {
-               return NULLMSG;
+       if ( ld == NULL || entry == NULL ) {
+               return NULL;
        }
 
        for (
                entry = entry->lm_chain;
-               entry != NULLMSG;
+               entry != NULL;
                entry = entry->lm_chain )
        {
                if( entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY ) {
@@ -57,7 +59,7 @@ ldap_next_entry( LDAP *ld, LDAPMessage *entry )
                }
        }
 
-       return( NULLMSG );
+       return( NULL );
 }
 
 int
@@ -96,13 +98,13 @@ ldap_get_entry_controls(
        assert( sctrls != NULL );
 
        if ( ld == NULL || sctrls == NULL ||
-               entry == NULL || entry->lm_msgtype == LDAP_RES_SEARCH_ENTRY )
+               entry == NULL || entry->lm_msgtype != LDAP_RES_SEARCH_ENTRY )
        {
                return LDAP_PARAM_ERROR;
        }
 
        /* make a local copy of the BerElement */
-       SAFEMEMCPY(&be, entry->lm_ber, sizeof(be));
+       AC_MEMCPY(&be, entry->lm_ber, sizeof(be));
 
        if ( ber_scanf( &be, "{xx" /*}*/ ) == LBER_ERROR ) {
                rc = LDAP_DECODING_ERROR;