]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
Update SASL bufsize checks
[openldap] / libraries / libldap / error.c
index 379e673daf13a6a12ce5d026acdb85875873a594..61ae88f4b6797db61a6d1d82c7aa78ceee796777 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
  */
 
@@ -50,7 +50,7 @@ static const struct ldaperror ldap_errlist[] = {
        {LDAP_NO_SUCH_OBJECT,                   "No such object" },
        {LDAP_ALIAS_PROBLEM,                    "Alias problem" },
        {LDAP_INVALID_DN_SYNTAX,                "Invalid DN syntax" },
-       {LDAP_IS_LEAF,                                  "Object is a leaf" },
+       {LDAP_IS_LEAF,                                  "Entry is a leaf" },
        {LDAP_ALIAS_DEREF_PROBLEM,              "Alias dereferencing problem" },
 
        {LDAP_INAPPROPRIATE_AUTH,               "Inappropriate authentication" },
@@ -71,6 +71,8 @@ static const struct ldaperror ldap_errlist[] = {
        {LDAP_AFFECTS_MULTIPLE_DSAS,    "Operation affects multiple DSAs" },
 
        {LDAP_OTHER,                                    "Unknown error" },
+
+       /* API ResultCodes */
        {LDAP_SERVER_DOWN,                              "Can't contact LDAP server" },
        {LDAP_LOCAL_ERROR,                              "Local error" },
        {LDAP_ENCODING_ERROR,                   "Encoding error" },
@@ -90,7 +92,7 @@ static const struct ldaperror ldap_errlist[] = {
        {LDAP_CLIENT_LOOP,                              "Client Loop" },
        {LDAP_REFERRAL_LIMIT_EXCEEDED,  "Referral Limit Exceeded" },
 
-       {-1, 0 }
+       {-1, NULL }
 };
 
 static const struct ldaperror *
@@ -148,7 +150,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str )
        }
 
        if ( ld->ld_matched != NULL && ld->ld_matched[0] != '\0' ) {
-               fprintf( stderr, "\tmatched: \"%s\"\n",
+               fprintf( stderr, "\tmatched DN: \"%s\"\n",
                        ld->ld_matched );
        }
 
@@ -209,7 +211,6 @@ ldap_parse_result(
        LDAPMessage     *lm;
        ber_int_t errcode = LDAP_SUCCESS;
 
-       int rc;
        ber_tag_t tag;
        BerElement      *ber;
 
@@ -230,10 +231,11 @@ ldap_parse_result(
        if(serverctrls != NULL) *serverctrls = NULL;
 
        /* Find the next result... */
-       for ( lm = r; lm->lm_chain != NULL; lm = lm->lm_chain ) {
+       for ( lm = r; lm != NULL; lm = lm->lm_chain ) {
                /* skip over entries and references */
                if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
-                       lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE )
+                       lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
+                       lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL )
                {
                        break;
                }
@@ -304,7 +306,7 @@ ldap_parse_result(
                }
 
                if( tag != LBER_ERROR ) {
-                       rc = ldap_int_get_controls( ber, serverctrls );
+                       int rc = ldap_int_get_controls( ber, serverctrls );
 
                        if( rc != LDAP_SUCCESS ) {
                                tag = LBER_ERROR;
@@ -325,10 +327,10 @@ ldap_parse_result(
        }
 
        /* return */
+       if( errcodep != NULL ) {
+               *errcodep = ld->ld_errno;
+       }
        if ( errcode == LDAP_SUCCESS ) {
-               if( errcodep != NULL ) {
-                       *errcodep = ld->ld_errno;
-               }
                if( matcheddnp != NULL ) {
                        *matcheddnp = LDAP_STRDUP( ld->ld_matched );
                }
@@ -340,7 +342,8 @@ ldap_parse_result(
                for ( lm = lm->lm_chain; lm != NULL; lm = lm->lm_chain ) {
                        /* skip over entries and references */
                        if( lm->lm_msgtype != LDAP_RES_SEARCH_ENTRY &&
-                               lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE )
+                               lm->lm_msgtype != LDAP_RES_SEARCH_REFERENCE &&
+                               lm->lm_msgtype != LDAP_RES_EXTENDED_PARTIAL )
                        {
                                /* more results to return */
                                errcode = LDAP_MORE_RESULTS_TO_RETURN;