| rev | line source | 
| bsw@1071 | 1 /* This file contains error code mappings of LDAP error codes and OpenLDAP | 
| bsw@1071 | 2  * error codes. | 
| bsw@1071 | 3  * | 
| bsw@1071 | 4  * The collection of error codes (mldap_errorcodes[]) has been derived from | 
| bsw@1071 | 5  * the file ldap.h that is part of OpenLDAP Software. OpenLDAP's license | 
| bsw@1071 | 6  * information is stated below: | 
| bsw@1071 | 7  * | 
| bsw@1071 | 8  * This work is part of OpenLDAP Software <http://www.openldap.org/>. | 
| bsw@1071 | 9  * | 
| bsw@1071 | 10  * Copyright 1998-2013 The OpenLDAP Foundation. | 
| bsw@1071 | 11  * All rights reserved. | 
| bsw@1071 | 12  * | 
| bsw@1071 | 13  * Redistribution and use in source and binary forms, with or without | 
| bsw@1071 | 14  * modification, are permitted only as authorized by the OpenLDAP | 
| bsw@1071 | 15  * Public License. | 
| bsw@1071 | 16  * | 
| bsw@1071 | 17  * A copy of this license is available below: | 
| bsw@1071 | 18  * | 
| bsw@1071 | 19  * The OpenLDAP Public License | 
| bsw@1071 | 20  * Version 2.8, 17 August 2003 | 
| bsw@1071 | 21  * | 
| bsw@1071 | 22  * Redistribution and use of this software and associated documentation | 
| bsw@1071 | 23  * ("Software"), with or without modification, are permitted provided | 
| bsw@1071 | 24  * that the following conditions are met: | 
| bsw@1071 | 25  * | 
| bsw@1071 | 26  * 1. Redistributions in source form must retain copyright statements | 
| bsw@1071 | 27  *    and notices, | 
| bsw@1071 | 28  * | 
| bsw@1071 | 29  * 2. Redistributions in binary form must reproduce applicable copyright | 
| bsw@1071 | 30  *    statements and notices, this list of conditions, and the following | 
| bsw@1071 | 31  *    disclaimer in the documentation and/or other materials provided | 
| bsw@1071 | 32  *    with the distribution, and | 
| bsw@1071 | 33  * | 
| bsw@1071 | 34  * 3. Redistributions must contain a verbatim copy of this document. | 
| bsw@1071 | 35  * | 
| bsw@1071 | 36  * The OpenLDAP Foundation may revise this license from time to time. | 
| bsw@1071 | 37  * Each revision is distinguished by a version number.  You may use | 
| bsw@1071 | 38  * this Software under terms of this license revision or under the | 
| bsw@1071 | 39  * terms of any subsequent revision of the license. | 
| bsw@1071 | 40  * | 
| bsw@1071 | 41  * THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS | 
| bsw@1071 | 42  * CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES, | 
| bsw@1071 | 43  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY | 
| bsw@1071 | 44  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT | 
| bsw@1071 | 45  * SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S) | 
| bsw@1071 | 46  * OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT, | 
| bsw@1071 | 47  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, | 
| bsw@1071 | 48  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 
| bsw@1071 | 49  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | 
| bsw@1071 | 50  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 
| bsw@1071 | 51  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN | 
| bsw@1071 | 52  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 
| bsw@1071 | 53  * POSSIBILITY OF SUCH DAMAGE. | 
| bsw@1071 | 54  * | 
| bsw@1071 | 55  * The names of the authors and copyright holders must not be used in | 
| bsw@1071 | 56  * advertising or otherwise to promote the sale, use or other dealing | 
| bsw@1071 | 57  * in this Software without specific, written prior permission.  Title | 
| bsw@1071 | 58  * to copyright in this Software shall at all times remain with copyright | 
| bsw@1071 | 59  * holders. | 
| bsw@1071 | 60  * | 
| bsw@1071 | 61  * OpenLDAP is a registered trademark of the OpenLDAP Foundation. | 
| bsw@1071 | 62  * | 
| bsw@1071 | 63  * Copyright 1999-2003 The OpenLDAP Foundation, Redwood City, | 
| bsw@1071 | 64  * California, USA.  All Rights Reserved.  Permission to copy and | 
| bsw@1071 | 65  * distribute verbatim copies of this document is granted. | 
| bsw@1071 | 66  * | 
| bsw@1071 | 67  * End of OpenLDAP Public License | 
| bsw@1071 | 68  * | 
| bsw@1071 | 69  * Portions Copyright (c) 1990 Regents of the University of Michigan. | 
| bsw@1071 | 70  * All rights reserved. | 
| bsw@1071 | 71  * | 
| bsw@1071 | 72  * Redistribution and use in source and binary forms are permitted | 
| bsw@1071 | 73  * provided that this notice is preserved and that due credit is given | 
| bsw@1071 | 74  * to the University of Michigan at Ann Arbor. The name of the University | 
| bsw@1071 | 75  * may not be used to endorse or promote products derived from this | 
| bsw@1071 | 76  * software without specific prior written permission. This software | 
| bsw@1071 | 77  * is provided ``as is'' without express or implied warranty. | 
| bsw@1071 | 78  * | 
| bsw@1071 | 79  * End of OpenLDAP's license information | 
| bsw@1071 | 80  */ | 
| bsw@1071 | 81 | 
| bsw@1071 | 82 // type for entry in mldap_errorcodes[] array: | 
| bsw@1071 | 83 struct mldap_errorcode { | 
| bsw@1071 | 84   const char *ident; | 
| bsw@1071 | 85   int code; | 
| bsw@1071 | 86 }; | 
| bsw@1071 | 87 | 
| bsw@1071 | 88 // NULL terminated array of error code strings with error code integers | 
| bsw@1071 | 89 // derived from ldap.h (see above copyright notice): | 
| bsw@1071 | 90 static const struct mldap_errorcode mldap_errorcodes[] = { | 
| bsw@1071 | 91   {"operations_error", 1}, | 
| bsw@1071 | 92   {"protocol_error", 2}, | 
| bsw@1071 | 93   {"timelimit_exceeded", 3}, | 
| bsw@1071 | 94   {"sizelimit_exceeded", 4}, | 
| bsw@1071 | 95   {"compare_false", 5}, | 
| bsw@1071 | 96   {"compare_true", 6}, | 
| bsw@1071 | 97 //  {"auth_method_not_supported", 7}, | 
| bsw@1071 | 98   {"strong_auth_not_supported", 7}, | 
| bsw@1071 | 99   {"strong_auth_required", 8}, | 
| bsw@1071 | 100 //  {"stronger_auth_required", 8}, | 
| bsw@1071 | 101   {"partial_results", 9}, | 
| bsw@1071 | 102   {"referral", 10}, | 
| bsw@1071 | 103   {"adminlimit_exceeded", 11}, | 
| bsw@1071 | 104   {"unavailable_critical_extension", 12}, | 
| bsw@1071 | 105   {"confidentiality_required", 13}, | 
| bsw@1071 | 106   {"sasl_bind_in_progress", 14}, | 
| bsw@1071 | 107   {"no_such_attribute", 16}, | 
| bsw@1071 | 108   {"undefined_type", 17}, | 
| bsw@1071 | 109   {"inappropriate_matching", 18}, | 
| bsw@1071 | 110   {"constraint_violation", 19}, | 
| bsw@1071 | 111   {"type_or_value_exists", 20}, | 
| bsw@1071 | 112   {"invalid_syntax", 21}, | 
| bsw@1071 | 113   {"no_such_object", 32}, | 
| bsw@1071 | 114   {"alias_problem", 33}, | 
| bsw@1071 | 115   {"invalid_dn_syntax", 34}, | 
| bsw@1071 | 116   {"is_leaf", 35}, | 
| bsw@1071 | 117   {"alias_deref_problem", 36}, | 
| bsw@1071 | 118   {"x_proxy_authz_failure", 47}, | 
| bsw@1071 | 119   {"inappropriate_auth", 48}, | 
| bsw@1071 | 120   {"invalid_credentials", 49}, | 
| bsw@1071 | 121   {"insufficient_access", 50}, | 
| bsw@1071 | 122   {"busy", 51}, | 
| bsw@1071 | 123   {"unavailable", 52}, | 
| bsw@1071 | 124   {"unwilling_to_perform", 53}, | 
| bsw@1071 | 125   {"loop_detect", 54}, | 
| bsw@1071 | 126   {"naming_violation", 64}, | 
| bsw@1071 | 127   {"object_class_violation", 65}, | 
| bsw@1071 | 128   {"not_allowed_on_nonleaf", 66}, | 
| bsw@1071 | 129   {"not_allowed_on_rdn", 67}, | 
| bsw@1071 | 130   {"already_exists", 68}, | 
| bsw@1071 | 131   {"no_object_class_mods", 69}, | 
| bsw@1071 | 132   {"results_too_large", 70}, | 
| bsw@1071 | 133   {"affects_multiple_dsas", 71}, | 
| bsw@1071 | 134   {"vlv_error", 76}, | 
| bsw@1071 | 135   {"other", 80}, | 
| bsw@1071 | 136   {"cup_resources_exhausted", 113}, | 
| bsw@1071 | 137   {"cup_security_violation", 114}, | 
| bsw@1071 | 138   {"cup_invalid_data", 115}, | 
| bsw@1071 | 139   {"cup_unsupported_scheme", 116}, | 
| bsw@1071 | 140   {"cup_reload_required", 117}, | 
| bsw@1071 | 141   {"cancelled", 118}, | 
| bsw@1071 | 142   {"no_such_operation", 119}, | 
| bsw@1071 | 143   {"too_late", 120}, | 
| bsw@1071 | 144   {"cannot_cancel", 121}, | 
| bsw@1071 | 145   {"assertion_failed", 122}, | 
| bsw@1071 | 146   {"proxied_authorization_denied", 123}, | 
| bsw@1071 | 147   {"sync_refresh_required", 4096}, | 
| bsw@1071 | 148   {"x_sync_refresh_required", 16640}, | 
| bsw@1071 | 149   {"x_assertion_failed", 16655}, | 
| bsw@1071 | 150   {"x_no_operation", 16654}, | 
| bsw@1071 | 151   {"x_no_referrals_found", 16656}, | 
| bsw@1071 | 152   {"x_cannot_chain", 16657}, | 
| bsw@1071 | 153   {"x_invalidreference", 16658}, | 
| bsw@1071 | 154   {"x_txn_specify_okay", 16672}, | 
| bsw@1071 | 155   {"x_txn_id_invalid", 16673}, | 
| bsw@1071 | 156   {"server_down", (-1)}, | 
| bsw@1071 | 157   {"local_error", (-2)}, | 
| bsw@1071 | 158   {"encoding_error", (-3)}, | 
| bsw@1071 | 159   {"decoding_error", (-4)}, | 
| bsw@1071 | 160   {"timeout", (-5)}, | 
| bsw@1071 | 161   {"auth_unknown", (-6)}, | 
| bsw@1071 | 162   {"filter_error", (-7)}, | 
| bsw@1071 | 163   {"user_cancelled", (-8)}, | 
| bsw@1071 | 164   {"param_error", (-9)}, | 
| bsw@1071 | 165   {"no_memory", (-10)}, | 
| bsw@1071 | 166   {"connect_error", (-11)}, | 
| bsw@1071 | 167   {"not_supported", (-12)}, | 
| bsw@1071 | 168   {"control_not_found", (-13)}, | 
| bsw@1071 | 169   {"no_results_returned", (-14)}, | 
| bsw@1071 | 170   {"more_results_to_return", (-15)}, | 
| bsw@1071 | 171   {"client_loop", (-16)}, | 
| bsw@1071 | 172   {"referral_limit_exceeded", (-17)}, | 
| bsw@1071 | 173   {"x_connecting", (-18)}, | 
| bsw@1071 | 174   {NULL, 0} | 
| bsw@1071 | 175 }; | 
| bsw@1071 | 176 | 
| bsw@1071 | 177 void mldap_set_errorcodes(lua_State *L) { | 
| bsw@1071 | 178   // stores mldap_errorcodes[] mappings in the Lua table on top of the stack | 
| bsw@1071 | 179   // in both directions (string mapped to integer and vice versa) | 
| bsw@1071 | 180 | 
| bsw@1071 | 181   const struct mldap_errorcode *errorcode;  // pointer to entry in mldap_errorcodes[] array | 
| bsw@1071 | 182 | 
| bsw@1071 | 183   // iterate through entries in mldap_errorcodes[] array: | 
| bsw@1071 | 184   for (errorcode=mldap_errorcodes; errorcode->ident; errorcode++) { | 
| bsw@1071 | 185 | 
| bsw@1071 | 186     // store a mapping from the string to the integer: | 
| bsw@1071 | 187     lua_pushstring(L, errorcode->ident); | 
| bsw@1071 | 188     lua_pushinteger(L, errorcode->code); | 
| bsw@1071 | 189     lua_settable(L, -3); | 
| bsw@1071 | 190 | 
| bsw@1071 | 191     // store a mapping from the integer to the string: | 
| bsw@1071 | 192     lua_pushinteger(L, errorcode->code); | 
| bsw@1071 | 193     lua_pushstring(L, errorcode->ident); | 
| bsw@1071 | 194     lua_settable(L, -3); | 
| bsw@1071 | 195 | 
| bsw@1071 | 196   } | 
| bsw@1071 | 197 | 
| bsw@1071 | 198 } | 
| bsw@1071 | 199 |