]> git.sur5r.net Git - openldap/commitdiff
Mark error strings
authorKurt Zeilenga <kurt@openldap.org>
Sun, 6 Apr 2003 03:45:32 +0000 (03:45 +0000)
committerKurt Zeilenga <kurt@openldap.org>
Sun, 6 Apr 2003 03:45:32 +0000 (03:45 +0000)
libraries/libldap/error.c

index 882c5ba4d495d2fa85bd39b7dcb4ec6544a3a888..786ad7cc44ec59acb297073c04045eae0cecf5ee 100644 (file)
@@ -22,91 +22,91 @@ struct ldaperror {
 };
 
 static struct ldaperror ldap_builtin_errlist[] = {
-       {LDAP_SUCCESS,                                  "Success" },
-       {LDAP_OPERATIONS_ERROR,                 "Operations error" },
-       {LDAP_PROTOCOL_ERROR,                   "Protocol error" },
-       {LDAP_TIMELIMIT_EXCEEDED,               "Time limit exceeded" },
-       {LDAP_SIZELIMIT_EXCEEDED,               "Size limit exceeded" },
-       {LDAP_COMPARE_FALSE,                    "Compare False" },
-       {LDAP_COMPARE_TRUE,                     "Compare True" },
-       {LDAP_STRONG_AUTH_NOT_SUPPORTED, "Authentication method not supported" },
-       {LDAP_STRONG_AUTH_REQUIRED,     "Strong(er) authentication required" },
-       {LDAP_PARTIAL_RESULTS,                  "Partial results and referral received" },
-
-       {LDAP_REFERRAL,                                 "Referral"},
-       {LDAP_ADMINLIMIT_EXCEEDED,              "Administrative limit exceeded"},
+       {LDAP_SUCCESS,                                  N_("Success")},
+       {LDAP_OPERATIONS_ERROR,                 N_("Operations error")},
+       {LDAP_PROTOCOL_ERROR,                   N_("Protocol error")},
+       {LDAP_TIMELIMIT_EXCEEDED,               N_("Time limit exceeded")},
+       {LDAP_SIZELIMIT_EXCEEDED,               N_("Size limit exceeded")},
+       {LDAP_COMPARE_FALSE,                    N_("Compare False")},
+       {LDAP_COMPARE_TRUE,                     N_("Compare True")},
+       {LDAP_STRONG_AUTH_NOT_SUPPORTED, N_("Authentication method not supported")},
+       {LDAP_STRONG_AUTH_REQUIRED,     N_("Strong(er) authentication required")},
+       {LDAP_PARTIAL_RESULTS,                  N_("Partial results and referral received")},
+
+       {LDAP_REFERRAL,                                 N_("Referral")},
+       {LDAP_ADMINLIMIT_EXCEEDED,              N_("Administrative limit exceeded")},
        {LDAP_UNAVAILABLE_CRITICAL_EXTENSION,
-                                                                       "Critical extension is unavailable"},
-       {LDAP_CONFIDENTIALITY_REQUIRED, "Confidentiality required"},
-       {LDAP_SASL_BIND_IN_PROGRESS,    "SASL bind in progress"},
-
-       {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,                                  "Entry is a leaf" },
-       {LDAP_ALIAS_DEREF_PROBLEM,              "Alias dereferencing problem" },
-
-       {LDAP_PROXY_AUTHZ_FAILURE,              "Proxy Authorization Failure" },
-       {LDAP_INAPPROPRIATE_AUTH,               "Inappropriate authentication" },
-       {LDAP_INVALID_CREDENTIALS,              "Invalid credentials" },
-       {LDAP_INSUFFICIENT_ACCESS,              "Insufficient access" },
-       {LDAP_BUSY,                                     "Server is busy" },
-       {LDAP_UNAVAILABLE,                              "Server is unavailable" },
-       {LDAP_UNWILLING_TO_PERFORM,     "Server 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 non-leaf" },
-       {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_AFFECTS_MULTIPLE_DSAS,    "Operation affects multiple DSAs" },
-
-       {LDAP_OTHER,                                    "Internal (implementation specific) error" },
+                                                                       N_("Critical extension is unavailable")},
+       {LDAP_CONFIDENTIALITY_REQUIRED, N_("Confidentiality required")},
+       {LDAP_SASL_BIND_IN_PROGRESS,    N_("SASL bind in progress")},
+
+       {LDAP_NO_SUCH_ATTRIBUTE,                N_("No such attribute")},
+       {LDAP_UNDEFINED_TYPE,                   N_("Undefined attribute type")},
+       {LDAP_INAPPROPRIATE_MATCHING,   N_("Inappropriate matching")},
+       {LDAP_CONSTRAINT_VIOLATION,     N_("Constraint violation")},
+       {LDAP_TYPE_OR_VALUE_EXISTS,     N_("Type or value exists")},
+       {LDAP_INVALID_SYNTAX,                   N_("Invalid syntax")},
+
+       {LDAP_NO_SUCH_OBJECT,                   N_("No such object")},
+       {LDAP_ALIAS_PROBLEM,                    N_("Alias problem")},
+       {LDAP_INVALID_DN_SYNTAX,                N_("Invalid DN syntax")},
+       {LDAP_IS_LEAF,                                  N_("Entry is a leaf")},
+       {LDAP_ALIAS_DEREF_PROBLEM,              N_("Alias dereferencing problem")},
+
+       {LDAP_PROXY_AUTHZ_FAILURE,              N_("Proxy Authorization Failure")},
+       {LDAP_INAPPROPRIATE_AUTH,               N_("Inappropriate authentication")},
+       {LDAP_INVALID_CREDENTIALS,              N_("Invalid credentials")},
+       {LDAP_INSUFFICIENT_ACCESS,              N_("Insufficient access")},
+       {LDAP_BUSY,                                     N_("Server is busy")},
+       {LDAP_UNAVAILABLE,                              N_("Server is unavailable")},
+       {LDAP_UNWILLING_TO_PERFORM,     N_("Server is unwilling to perform")},
+       {LDAP_LOOP_DETECT,                              N_("Loop detected")},
+
+       {LDAP_NAMING_VIOLATION,                 N_("Naming violation")},
+       {LDAP_OBJECT_CLASS_VIOLATION,   N_("Object class violation")},
+       {LDAP_NOT_ALLOWED_ON_NONLEAF,   N_("Operation not allowed on non-leaf")},
+       {LDAP_NOT_ALLOWED_ON_RDN,               N_("Operation not allowed on RDN")},
+       {LDAP_ALREADY_EXISTS,                   N_("Already exists")},
+       {LDAP_NO_OBJECT_CLASS_MODS,     N_("Cannot modify object class")},
+       {LDAP_RESULTS_TOO_LARGE,                N_("Results too large")},
+       {LDAP_AFFECTS_MULTIPLE_DSAS,    N_("Operation affects multiple DSAs")},
+
+       {LDAP_OTHER,                                    N_("Internal (implementation specific) error")},
 
        /* API ResultCodes */
-       {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" },
-
-       {LDAP_CONNECT_ERROR,                    "Connect error" },
-       {LDAP_NOT_SUPPORTED,                    "Not Supported" },
-       {LDAP_CONTROL_NOT_FOUND,                "Control not found" },
-       {LDAP_NO_RESULTS_RETURNED,              "No results returned" },
-       {LDAP_MORE_RESULTS_TO_RETURN,   "More results to return" },
-       {LDAP_CLIENT_LOOP,                              "Client Loop" },
-       {LDAP_REFERRAL_LIMIT_EXCEEDED,  "Referral Limit Exceeded" },
+       {LDAP_SERVER_DOWN,                              N_("Can't contact LDAP server")},
+       {LDAP_LOCAL_ERROR,                              N_("Local error")},
+       {LDAP_ENCODING_ERROR,                   N_("Encoding error")},
+       {LDAP_DECODING_ERROR,                   N_("Decoding error")},
+       {LDAP_TIMEOUT,                                  N_("Timed out")},
+       {LDAP_AUTH_UNKNOWN,                             N_("Unknown authentication method")},
+       {LDAP_FILTER_ERROR,                             N_("Bad search filter")},
+       {LDAP_USER_CANCELLED,                   N_("User cancelled operation")},
+       {LDAP_PARAM_ERROR,                              N_("Bad parameter to an ldap routine")},
+       {LDAP_NO_MEMORY,                                N_("Out of memory")},
+
+       {LDAP_CONNECT_ERROR,                    N_("Connect error")},
+       {LDAP_NOT_SUPPORTED,                    N_("Not Supported")},
+       {LDAP_CONTROL_NOT_FOUND,                N_("Control not found")},
+       {LDAP_NO_RESULTS_RETURNED,              N_("No results returned")},
+       {LDAP_MORE_RESULTS_TO_RETURN,   N_("More results to return")},
+       {LDAP_CLIENT_LOOP,                              N_("Client Loop")},
+       {LDAP_REFERRAL_LIMIT_EXCEEDED,  N_("Referral Limit Exceeded")},
 
 #ifdef LDAP_CLIENT_UPDATE
-       {LDAP_CUP_RESOURCES_EXHAUSTED,  "Client Update Resource Exhausted" },
-       {LDAP_CUP_SECURITY_VIOLATION,   "Client Update Security Violation" },
-       {LDAP_CUP_INVALID_COOKIE,               "Client Update Invalid Cookie" },
-       {LDAP_CUP_UNSUPPORTED_SCHEME,   "Client Update Unsupported Scheme" },
-       {LDAP_CUP_CLIENT_DISCONNECT,    "Client Update Client Disconnect" },
-       {LDAP_CUP_RELOAD_REQUIRED,              "Client Update Reload Required" },
+       {LDAP_CUP_RESOURCES_EXHAUSTED,  N_("Client Update Resource Exhausted")},
+       {LDAP_CUP_SECURITY_VIOLATION,   N_("Client Update Security Violation")},
+       {LDAP_CUP_INVALID_COOKIE,               N_("Client Update Invalid Cookie")},
+       {LDAP_CUP_UNSUPPORTED_SCHEME,   N_("Client Update Unsupported Scheme")},
+       {LDAP_CUP_CLIENT_DISCONNECT,    N_("Client Update Client Disconnect")},
+       {LDAP_CUP_RELOAD_REQUIRED,              N_("Client Update Reload Required")},
 #endif
 
 #ifdef LDAP_EXOP_X_CANCEL
-       {LDAP_CANCELLED,                                "Cancelled" },
-       {LDAP_NO_SUCH_OPERATION,                "No Operation to Cancel" },
-       {LDAP_TOO_LATE,                                 "Too Late to Cancel" },
-       {LDAP_CANNOT_CANCEL,                    "Cannot Cancel" },
+       {LDAP_CANCELLED,                                N_("Cancelled")},
+       {LDAP_NO_SUCH_OPERATION,                N_("No Operation to Cancel")},
+       {LDAP_TOO_LATE,                                 N_("Too Late to Cancel")},
+       {LDAP_CANNOT_CANCEL,                    N_("Cannot Cancel")},
 #endif
 
        {-1, NULL}
@@ -115,32 +115,20 @@ static struct ldaperror ldap_builtin_errlist[] = {
 static struct ldaperror *ldap_errlist = ldap_builtin_errlist; 
 
 void ldap_int_error_init( void ) {
-#ifdef LDAP_NLS
-#define LDAP_NLS_SDK_CAT "openldap_sdk"
-#define LDAP_NLS_LIBLDAP_SET (0)
-
+#ifdef LDAP_LOCALIZE
        int     i;
-       nl_catd catd = catopen( LDAP_NLS_SDK_CAT, NL_CAT_LOCALE );
-
-       if( catd == -1 ) {
-               return;
-       }
+       char *reason;
 
        for ( i=0; ldap_errlist[i].e_reason != NULL; i++ ) {
-               char *msg = catgets( catd,
-                       LDAP_NLS_LIBLDAP_SET,
-                       ldap_errlist[i].e_code, NULL );
-
-               if( msg != NULL ) {
-                       msg = LDAP_STRDUP( msg );
+               reason = gettext( ldap_errlist[i].e_reason );
+               if( reason != NULL && reason != ldap_errlist[i].e_reason ) {
+                       reason = LDAP_STRDUP( gettext( reason ) );
 
                        if( msg != NULL ) {
-                               ldap_errlist[i].e_reason = msg;
+                               ldap_errlist[i].e_reason = reason;
                        }
                }
        }
-
-       catclose( catd );
 #endif
 }