error.c

Go to the documentation of this file.
00001 /* error.c --- Error handling functionality.
00002  * Copyright (C) 2002, 2003, 2004, 2005  Simon Josefsson
00003  *
00004  * This file is part of GNU SASL Library.
00005  *
00006  * GNU SASL Library is free software; you can redistribute it and/or
00007  * modify it under the terms of the GNU Lesser General Public License
00008  * as published by the Free Software Foundation; either version 2.1 of
00009  * the License, or (at your option) any later version.
00010  *
00011  * GNU SASL Library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014  * Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License License along with GNU SASL Library; if not, write to the
00018  * Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
00019  * Boston, MA 02110-1301, USA.
00020  *
00021  */
00022 
00023 #include "internal.h"
00024 
00025 /* I18n of error codes. */
00026 #include "gettext.h"
00027 #define _(String) dgettext (PACKAGE, String)
00028 #define gettext_noop(String) String
00029 #define N_(String) gettext_noop (String)
00030 
00041 const char *
00042 gsasl_strerror (int err)
00043 {
00044   const char *p;
00045 
00046   bindtextdomain (PACKAGE, LOCALEDIR);
00047 
00048   switch (err)
00049     {
00050     case GSASL_OK:
00051       p = _("Libgsasl success");
00052       break;
00053 
00054     case GSASL_NEEDS_MORE:
00055       p = _("SASL mechanism needs more data");
00056       break;
00057 
00058     case GSASL_UNKNOWN_MECHANISM:
00059       p = _("Unknown SASL mechanism");
00060       break;
00061 
00062     case GSASL_MECHANISM_CALLED_TOO_MANY_TIMES:
00063       p = _("SASL mechanism called too many times");
00064       break;
00065 
00066     case GSASL_MALLOC_ERROR:
00067       p = _("Memory allocation error in SASL library");
00068       break;
00069 
00070     case GSASL_BASE64_ERROR:
00071       p = _("Base 64 coding error in SASL library");
00072       break;
00073 
00074     case GSASL_CRYPTO_ERROR:
00075       p = _("Low-level crypto error in SASL library");
00076       break;
00077 
00078     case GSASL_GSSAPI_RELEASE_BUFFER_ERROR:
00079       p =
00080         _
00081         ("GSSAPI library could not deallocate memory in "
00082          "gss_release_buffer() in SASL library.  This is a serious "
00083          "internal error.");
00084       break;
00085 
00086     case GSASL_GSSAPI_IMPORT_NAME_ERROR:
00087       p =
00088         _
00089         ("GSSAPI library could not understand a peer name in "
00090          "gss_import_name() in SASL library.  This may be due to "
00091          "incorrect user supplied data.");
00092       break;
00093 
00094     case GSASL_GSSAPI_INIT_SEC_CONTEXT_ERROR:
00095       p =
00096         _
00097         ("GSSAPI error in client while negotiating security context in "
00098          "gss_init_sec_context() in SASL library.  This is most likely "
00099          "due insufficient credentials or malicious interactions.");
00100       break;
00101 
00102     case GSASL_GSSAPI_ACCEPT_SEC_CONTEXT_ERROR:
00103       p =
00104         _
00105         ("GSSAPI error in server while negotiating security context in "
00106          "gss_init_sec_context() in SASL library.  This is most likely "
00107          "due insufficient credentials or malicious interactions.");
00108       break;
00109 
00110     case GSASL_GSSAPI_UNWRAP_ERROR:
00111       p =
00112         _
00113         ("GSSAPI error while decrypting or decoding data in "
00114          "gss_unwrap() in SASL library.  This is most likely "
00115          "due to data corruption.");
00116       break;
00117 
00118     case GSASL_GSSAPI_WRAP_ERROR:
00119       p =
00120         _
00121         ("GSSAPI error while encrypting or encoding data in "
00122          "gss_wrap() in SASL library.");
00123       break;
00124 
00125     case GSASL_GSSAPI_ACQUIRE_CRED_ERROR:
00126       p =
00127         _
00128         ("GSSAPI error acquiring credentials in "
00129          "gss_acquire_cred() in SASL library.  This is most likely due"
00130          " to not having the proper Kerberos key available in "
00131          "/etc/krb5.keytab on the server.");
00132       break;
00133 
00134     case GSASL_GSSAPI_DISPLAY_NAME_ERROR:
00135       p =
00136         _
00137         ("GSSAPI error creating a display name denoting the client in "
00138          "gss_display_name() in SASL library.  This is probably because "
00139          "the client supplied bad data.");
00140       break;
00141 
00142     case GSASL_GSSAPI_UNSUPPORTED_PROTECTION_ERROR:
00143       p =
00144         _
00145         ("Other entity requested integrity or confidentiality protection "
00146          "in GSSAPI mechanism but this is currently not implemented.");
00147       break;
00148 
00149     case GSASL_MECHANISM_PARSE_ERROR:
00150       p = _("SASL mechanism could not parse input");
00151       break;
00152 
00153     case GSASL_AUTHENTICATION_ERROR:
00154       p = _("Error authenticating user");
00155       break;
00156 
00157     case GSASL_INTEGRITY_ERROR:
00158       p = _("Integrity error in application payload");
00159       break;
00160 
00161     case GSASL_NO_CLIENT_CODE:
00162       p = _("Client-side functionality not available in library "
00163             "(application error)");
00164       break;
00165 
00166     case GSASL_NO_SERVER_CODE:
00167       p = _("Server-side functionality not available in library "
00168             "(application error)");
00169       break;
00170 
00171     case GSASL_NO_CALLBACK:
00172       p = _("No callback specified by caller (application error).");
00173       break;
00174 
00175     case GSASL_NO_ANONYMOUS_TOKEN:
00176       p = _("Authentication failed because the "
00177             "anonymous token was not provided.");
00178       break;
00179 
00180     case GSASL_NO_AUTHID:
00181       p = _("Authentication failed because the "
00182             "authentication identity was not provided.");
00183       break;
00184 
00185     case GSASL_NO_AUTHZID:
00186       p = _("Authentication failed because the "
00187             "authorization identity was not provided.");
00188       break;
00189 
00190     case GSASL_NO_PASSWORD:
00191       p = _("Authentication failed because the "
00192             "password was not provided.");
00193       break;
00194 
00195     case GSASL_NO_PASSCODE:
00196       p = _("Authentication failed because the "
00197             "passcode was not provided.");
00198       break;
00199 
00200     case GSASL_NO_PIN:
00201       p = _("Authentication failed because the "
00202             "pin code was not provided.");
00203       break;
00204 
00205     case GSASL_NO_SERVICE:
00206       p = _("Authentication failed because the "
00207             "service name was not provided.");
00208       break;
00209 
00210     case GSASL_NO_HOSTNAME:
00211       p = _("Authentication failed because the "
00212             "host name was not provided.");
00213       break;
00214 
00215     case GSASL_SASLPREP_ERROR:
00216       p = _("Could not prepare internationalized (non-ASCII) string.");
00217       break;
00218 
00219 #ifndef GSASL_NO_OBSOLETE
00220     case GSASL_TOO_SMALL_BUFFER:
00221       p = _("SASL function needs larger buffer (internal error)");
00222       break;
00223 
00224     case GSASL_FOPEN_ERROR:
00225       p = _("Could not open file in SASL library");
00226       break;
00227 
00228     case GSASL_FCLOSE_ERROR:
00229       p = _("Could not close file in SASL library");
00230       break;
00231 
00232     case GSASL_CANNOT_GET_CTX:
00233       p = _("Cannot get internal library handle (library error)");
00234       break;
00235 
00236     case GSASL_NEED_CLIENT_ANONYMOUS_CALLBACK:
00237       p =
00238         _
00239         ("SASL mechanism needs gsasl_client_callback_anonymous() callback "
00240          "(application error)");
00241       break;
00242 
00243     case GSASL_NEED_CLIENT_PASSWORD_CALLBACK:
00244       p =
00245         _
00246         ("SASL mechanism needs gsasl_client_callback_password() callback "
00247          "(application error)");
00248       break;
00249 
00250     case GSASL_NEED_CLIENT_PASSCODE_CALLBACK:
00251       p =
00252         _
00253         ("SASL mechanism needs gsasl_client_callback_passcode() callback "
00254          "(application error)");
00255       break;
00256 
00257     case GSASL_NEED_CLIENT_PIN_CALLBACK:
00258       p =
00259         _
00260         ("SASL mechanism needs gsasl_client_callback_pin() callback "
00261          "(application error)");
00262       break;
00263 
00264     case GSASL_NEED_CLIENT_AUTHORIZATION_ID_CALLBACK:
00265       p =
00266         _
00267         ("SASL mechanism needs gsasl_client_callback_authorization_id() "
00268          "callback (application error)");
00269       break;
00270 
00271     case GSASL_NEED_CLIENT_AUTHENTICATION_ID_CALLBACK:
00272       p =
00273         _
00274         ("SASL mechanism needs gsasl_client_callback_authentication_id() "
00275          "callback (application error)");
00276       break;
00277 
00278     case GSASL_NEED_CLIENT_SERVICE_CALLBACK:
00279       p =
00280         _
00281         ("SASL mechanism needs gsasl_client_callback_service() callback "
00282          "(application error)");
00283       break;
00284 
00285     case GSASL_NEED_SERVER_VALIDATE_CALLBACK:
00286       p =
00287         _
00288         ("SASL mechanism needs gsasl_server_callback_validate() callback "
00289          "(application error)");
00290       break;
00291 
00292     case GSASL_NEED_SERVER_CRAM_MD5_CALLBACK:
00293       p =
00294         _
00295         ("SASL mechanism needs gsasl_server_callback_cram_md5() callback "
00296          "(application error)");
00297       break;
00298 
00299     case GSASL_NEED_SERVER_DIGEST_MD5_CALLBACK:
00300       p =
00301         _
00302         ("SASL mechanism needs gsasl_server_callback_digest_md5() callback "
00303          "(application error)");
00304       break;
00305 
00306     case GSASL_NEED_SERVER_ANONYMOUS_CALLBACK:
00307       p =
00308         _
00309         ("SASL mechanism needs gsasl_server_callback_anonymous() callback "
00310          "(application error)");
00311       break;
00312 
00313     case GSASL_NEED_SERVER_EXTERNAL_CALLBACK:
00314       p =
00315         _
00316         ("SASL mechanism needs gsasl_server_callback_external() callback "
00317          "(application error)");
00318       break;
00319 
00320     case GSASL_NEED_SERVER_REALM_CALLBACK:
00321       p =
00322         _
00323         ("SASL mechanism needs gsasl_server_callback_realm() callback "
00324          "(application error)");
00325       break;
00326 
00327     case GSASL_NEED_SERVER_SECURID_CALLBACK:
00328       p =
00329         _
00330         ("SASL mechanism needs gsasl_server_callback_securid() callback "
00331          "(application error)");
00332       break;
00333 
00334     case GSASL_NEED_SERVER_SERVICE_CALLBACK:
00335       p =
00336         _
00337         ("SASL mechanism needs gsasl_server_callback_service() callback "
00338          "(application error)");
00339       break;
00340 
00341     case GSASL_NEED_SERVER_GSSAPI_CALLBACK:
00342       p =
00343         _
00344         ("SASL mechanism needs gsasl_server_callback_gssapi() callback "
00345          "(application error)");
00346       break;
00347 
00348     case GSASL_NEED_SERVER_RETRIEVE_CALLBACK:
00349       p = _("SASL mechanism needs gsasl_server_callback_retrieve() "
00350             "callback (application error)");
00351       break;
00352 
00353     case GSASL_UNICODE_NORMALIZATION_ERROR:
00354       p = _("Failed to perform Unicode Normalization on string.");
00355       break;
00356 
00357     case GSASL_NO_MORE_REALMS:
00358       p = _("No more realms available (non-fatal)");
00359       break;
00360 
00361     case GSASL_INVALID_HANDLE:
00362       p = _("The provided library handle was invalid (application error)");
00363       break;
00364 #endif
00365 
00366     default:
00367       p = _("Libgsasl unknown error");
00368       break;
00369     }
00370 
00371   return p;
00372 
00373 }

Generated on Tue Aug 22 12:06:06 2006 for gsasl by  doxygen 1.4.7