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