]> git.sur5r.net Git - openldap/blobdiff - libraries/libldap/error.c
Update with latest from -devel.
[openldap] / libraries / libldap / error.c
index b59563ef885bc37f6871c9cca4e070bfb94e147f..9f9cd136787003e0759468f32ab39fb410d1629c 100644 (file)
@@ -1,16 +1,12 @@
+#include "portable.h"
+
 #include <stdio.h>
-#include <string.h>
-#ifdef MACOS
 #include <stdlib.h>
-#else /* MACOS */
-#if defined( DOS ) || defined( _WIN32 )
-#include <malloc.h>
-#include "msdos.h"
-#else /* DOS */
-#include <sys/types.h>
-#include <sys/socket.h>
-#endif /* DOS */
-#endif /* MACOS */
+
+#include <ac/socket.h>
+#include <ac/string.h>
+#include <ac/time.h>
+
 #include "lber.h"
 #include "ldap.h"
 
@@ -20,53 +16,53 @@ struct ldaperror {
 };
 
 static struct ldaperror ldap_errlist[] = {
-       LDAP_SUCCESS,                   "Success",
-       LDAP_OPERATIONS_ERROR,          "Operations error",
-       LDAP_PROTOCOL_ERROR,            "Protocol error",
-       LDAP_TIMELIMIT_EXCEEDED,        "Timelimit exceeded",
-       LDAP_SIZELIMIT_EXCEEDED,        "Sizelimit exceeded",
-       LDAP_COMPARE_FALSE,             "Compare false",
-       LDAP_COMPARE_TRUE,              "Compare true",
-       LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported",
-       LDAP_STRONG_AUTH_REQUIRED,      "Strong authentication required",
-       LDAP_PARTIAL_RESULTS,           "Partial results and referral received",
-       LDAP_NO_SUCH_ATTRIBUTE,         "No such attribute",
-       LDAP_UNDEFINED_TYPE,            "Undefined attribute type",
-       LDAP_INAPPROPRIATE_MATCHING,    "Inappropriate matching",
-       LDAP_CONSTRAINT_VIOLATION,      "Constraint violation",
-       LDAP_TYPE_OR_VALUE_EXISTS,      "Type or value exists",
-       LDAP_INVALID_SYNTAX,            "Invalid syntax",
-       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_ALIAS_DEREF_PROBLEM,       "Alias dereferencing problem",
-       LDAP_INAPPROPRIATE_AUTH,        "Inappropriate authentication",
-       LDAP_INVALID_CREDENTIALS,       "Invalid credentials",
-       LDAP_INSUFFICIENT_ACCESS,       "Insufficient access",
-       LDAP_BUSY,                      "DSA is busy",
-       LDAP_UNAVAILABLE,               "DSA is unavailable",
-       LDAP_UNWILLING_TO_PERFORM,      "DSA is unwilling to perform",
-       LDAP_LOOP_DETECT,               "Loop detected",
-       LDAP_NAMING_VIOLATION,          "Naming violation",
-       LDAP_OBJECT_CLASS_VIOLATION,    "Object class violation",
-       LDAP_NOT_ALLOWED_ON_NONLEAF,    "Operation not allowed on nonleaf",
-       LDAP_NOT_ALLOWED_ON_RDN,        "Operation not allowed on RDN",
-       LDAP_ALREADY_EXISTS,            "Already exists",
-       LDAP_NO_OBJECT_CLASS_MODS,      "Cannot modify object class",
-       LDAP_RESULTS_TOO_LARGE,         "Results too large",
-       LDAP_OTHER,                     "Unknown error",
-       LDAP_SERVER_DOWN,               "Can't contact LDAP server",
-       LDAP_LOCAL_ERROR,               "Local error",
-       LDAP_ENCODING_ERROR,            "Encoding error",
-       LDAP_DECODING_ERROR,            "Decoding error",
-       LDAP_TIMEOUT,                   "Timed out",
-       LDAP_AUTH_UNKNOWN,              "Unknown authentication method",
-       LDAP_FILTER_ERROR,              "Bad search filter",
-       LDAP_USER_CANCELLED,            "User cancelled operation",
-       LDAP_PARAM_ERROR,               "Bad parameter to an ldap routine",
-       LDAP_NO_MEMORY,                 "Out of memory",
-       -1, 0
+       {LDAP_SUCCESS,                                  "Success" },
+       {LDAP_OPERATIONS_ERROR,                 "Operations error" },
+       {LDAP_PROTOCOL_ERROR,                   "Protocol error" },
+       {LDAP_TIMELIMIT_EXCEEDED,               "Timelimit exceeded" },
+       {LDAP_SIZELIMIT_EXCEEDED,               "Sizelimit exceeded" },
+       {LDAP_COMPARE_FALSE,                    "Compare false" },
+       {LDAP_COMPARE_TRUE,                     "Compare true" },
+       {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Strong authentication not supported" },
+       {LDAP_STRONG_AUTH_REQUIRED,     "Strong authentication required" },
+       {LDAP_PARTIAL_RESULTS,                  "Partial results and referral received" },
+       {LDAP_NO_SUCH_ATTRIBUTE,                "No such attribute" },
+       {LDAP_UNDEFINED_TYPE,                   "Undefined attribute type" },
+       {LDAP_INAPPROPRIATE_MATCHING,   "Inappropriate matching" },
+       {LDAP_CONSTRAINT_VIOLATION,     "Constraint violation" },
+       {LDAP_TYPE_OR_VALUE_EXISTS,     "Type or value exists" },
+       {LDAP_INVALID_SYNTAX,                   "Invalid syntax" },
+       {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_ALIAS_DEREF_PROBLEM,              "Alias dereferencing problem" },
+       {LDAP_INAPPROPRIATE_AUTH,               "Inappropriate authentication" },
+       {LDAP_INVALID_CREDENTIALS,              "Invalid credentials" },
+       {LDAP_INSUFFICIENT_ACCESS,              "Insufficient access" },
+       {LDAP_BUSY,                                     "DSA is busy" },
+       {LDAP_UNAVAILABLE,                              "DSA is unavailable" },
+       {LDAP_UNWILLING_TO_PERFORM,     "DSA is unwilling to perform" },
+       {LDAP_LOOP_DETECT,                              "Loop detected" },
+       {LDAP_NAMING_VIOLATION,                 "Naming violation" },
+       {LDAP_OBJECT_CLASS_VIOLATION,   "Object class violation" },
+       {LDAP_NOT_ALLOWED_ON_NONLEAF,   "Operation not allowed on nonleaf" },
+       {LDAP_NOT_ALLOWED_ON_RDN,               "Operation not allowed on RDN" },
+       {LDAP_ALREADY_EXISTS,                   "Already exists" },
+       {LDAP_NO_OBJECT_CLASS_MODS,     "Cannot modify object class" },
+       {LDAP_RESULTS_TOO_LARGE,                "Results too large" },
+       {LDAP_OTHER,                                    "Unknown error" },
+       {LDAP_SERVER_DOWN,                              "Can't contact LDAP server" },
+       {LDAP_LOCAL_ERROR,                              "Local error" },
+       {LDAP_ENCODING_ERROR,                   "Encoding error" },
+       {LDAP_DECODING_ERROR,                   "Decoding error" },
+       {LDAP_TIMEOUT,                                  "Timed out" },
+       {LDAP_AUTH_UNKNOWN,                             "Unknown authentication method" },
+       {LDAP_FILTER_ERROR,                             "Bad search filter" },
+       {LDAP_USER_CANCELLED,                   "User cancelled operation" },
+       {LDAP_PARAM_ERROR,                              "Bad parameter to an ldap routine" },
+       {LDAP_NO_MEMORY,                                "Out of memory" },
+       {-1, 0 }
 };
 
 char *
@@ -84,7 +80,7 @@ ldap_err2string( int err )
        return( "Unknown error" );
 }
 
-#ifndef NO_USERINTERFACE
+#ifdef LDAP_LIBUI
 void
 ldap_perror( LDAP *ld, char *s )
 {
@@ -123,7 +119,7 @@ ldap_perror( LDAP *ld, char *s )
 {
 }
 
-#endif /* NO_USERINTERFACE */
+#endif /* !LDAP_LIBUI */
 
 
 int
@@ -132,7 +128,7 @@ ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
        LDAPMessage     *lm;
        BerElement      ber;
        long            along;
-       int             rc;
+       unsigned long   rc;
 
        Debug( LDAP_DEBUG_TRACE, "ldap_result2error\n", 0, 0, 0 );