]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/messages.c
Import ITS#3278 from HEAD
[openldap] / libraries / libldap / messages.c
index 57cd4dbd43a411d8598d611c19426ccd465e3240..3875d2ccd616175bc15f581582f9c73537cc32c0 100644 (file)
@@ -1,10 +1,17 @@
+/* messages.c */
 /* $OpenLDAP$ */
-/*
- * Copyright 1998-2000 The OpenLDAP Foundation, All Rights Reserved.
- * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
- */
-/*
- *  messages.c
+/* This work is part of OpenLDAP Software <http://www.openldap.org/>.
+ *
+ * Copyright 1998-2005 The OpenLDAP Foundation.
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted only as authorized by the OpenLDAP
+ * Public License.
+ *
+ * A copy of this license is available in the file LICENSE in the
+ * top-level directory of the distribution or, alternatively, at
+ * <http://www.OpenLDAP.org/license.html>.
  */
 
 #include "portable.h"
@@ -13,7 +20,6 @@
 
 #include <ac/stdlib.h>
 
-#include <ac/ctype.h>
 #include <ac/socket.h>
 #include <ac/string.h>
 #include <ac/time.h>
@@ -25,11 +31,8 @@ ldap_first_message( LDAP *ld, LDAPMessage *chain )
 {
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
+       assert( chain != NULL );
 
-       if ( ld == NULL || chain == NULL ) {
-               return NULL;
-       }
-       
        return chain;
 }
 
@@ -38,12 +41,9 @@ ldap_next_message( LDAP *ld, LDAPMessage *msg )
 {
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
+       assert( msg != NULL );
 
-       if ( ld == NULL || msg == NULL || msg->lm_chain == NULL ) {
-               return NULL;
-       }
-
-       return( msg->lm_chain );
+       return msg->lm_chain;
 }
 
 int
@@ -54,13 +54,15 @@ ldap_count_messages( LDAP *ld, LDAPMessage *chain )
        assert( ld != NULL );
        assert( LDAP_VALID( ld ) );
 
-       if ( ld == NULL ) {
-               return -1;
-       }
-
        for ( i = 0; chain != NULL; chain = chain->lm_chain ) {
                i++;
        }
 
        return( i );
 }
+
+BerElement*
+ldap_get_message_ber( LDAPMessage *ld )
+{
+       return ld->lm_ber;
+}