liquid_feedback_frontend

diff lib/mldap/mldap_errorcodes.c @ 1071:58f48a8a202a

Imported and merged LDAP patch
author bsw
date Fri Jul 18 21:42:59 2014 +0200 (2014-07-18)
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/lib/mldap/mldap_errorcodes.c	Fri Jul 18 21:42:59 2014 +0200
     1.3 @@ -0,0 +1,199 @@
     1.4 +/* This file contains error code mappings of LDAP error codes and OpenLDAP
     1.5 + * error codes.
     1.6 + *
     1.7 + * The collection of error codes (mldap_errorcodes[]) has been derived from
     1.8 + * the file ldap.h that is part of OpenLDAP Software. OpenLDAP's license
     1.9 + * information is stated below:
    1.10 + *
    1.11 + * This work is part of OpenLDAP Software <http://www.openldap.org/>.
    1.12 + * 
    1.13 + * Copyright 1998-2013 The OpenLDAP Foundation.
    1.14 + * All rights reserved.
    1.15 + *
    1.16 + * Redistribution and use in source and binary forms, with or without
    1.17 + * modification, are permitted only as authorized by the OpenLDAP
    1.18 + * Public License.
    1.19 + *
    1.20 + * A copy of this license is available below:
    1.21 + *
    1.22 + * The OpenLDAP Public License
    1.23 + * Version 2.8, 17 August 2003
    1.24 + *
    1.25 + * Redistribution and use of this software and associated documentation
    1.26 + * ("Software"), with or without modification, are permitted provided
    1.27 + * that the following conditions are met:
    1.28 + * 
    1.29 + * 1. Redistributions in source form must retain copyright statements
    1.30 + *    and notices,
    1.31 + * 
    1.32 + * 2. Redistributions in binary form must reproduce applicable copyright
    1.33 + *    statements and notices, this list of conditions, and the following
    1.34 + *    disclaimer in the documentation and/or other materials provided
    1.35 + *    with the distribution, and
    1.36 + * 
    1.37 + * 3. Redistributions must contain a verbatim copy of this document.
    1.38 + * 
    1.39 + * The OpenLDAP Foundation may revise this license from time to time.
    1.40 + * Each revision is distinguished by a version number.  You may use
    1.41 + * this Software under terms of this license revision or under the
    1.42 + * terms of any subsequent revision of the license.
    1.43 + * 
    1.44 + * THIS SOFTWARE IS PROVIDED BY THE OPENLDAP FOUNDATION AND ITS
    1.45 + * CONTRIBUTORS ``AS IS'' AND ANY EXPRESSED OR IMPLIED WARRANTIES,
    1.46 + * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
    1.47 + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT
    1.48 + * SHALL THE OPENLDAP FOUNDATION, ITS CONTRIBUTORS, OR THE AUTHOR(S)
    1.49 + * OR OWNER(S) OF THE SOFTWARE BE LIABLE FOR ANY DIRECT, INDIRECT,
    1.50 + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
    1.51 + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    1.52 + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
    1.53 + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
    1.54 + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
    1.55 + * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
    1.56 + * POSSIBILITY OF SUCH DAMAGE.
    1.57 + * 
    1.58 + * The names of the authors and copyright holders must not be used in
    1.59 + * advertising or otherwise to promote the sale, use or other dealing
    1.60 + * in this Software without specific, written prior permission.  Title
    1.61 + * to copyright in this Software shall at all times remain with copyright
    1.62 + * holders.
    1.63 + * 
    1.64 + * OpenLDAP is a registered trademark of the OpenLDAP Foundation.
    1.65 + * 
    1.66 + * Copyright 1999-2003 The OpenLDAP Foundation, Redwood City,
    1.67 + * California, USA.  All Rights Reserved.  Permission to copy and
    1.68 + * distribute verbatim copies of this document is granted.
    1.69 + *
    1.70 + * End of OpenLDAP Public License
    1.71 + *
    1.72 + * Portions Copyright (c) 1990 Regents of the University of Michigan.
    1.73 + * All rights reserved.
    1.74 + *
    1.75 + * Redistribution and use in source and binary forms are permitted
    1.76 + * provided that this notice is preserved and that due credit is given
    1.77 + * to the University of Michigan at Ann Arbor. The name of the University
    1.78 + * may not be used to endorse or promote products derived from this
    1.79 + * software without specific prior written permission. This software
    1.80 + * is provided ``as is'' without express or implied warranty.
    1.81 + *
    1.82 + * End of OpenLDAP's license information
    1.83 + */
    1.84 +
    1.85 +// type for entry in mldap_errorcodes[] array:
    1.86 +struct mldap_errorcode {
    1.87 +  const char *ident;
    1.88 +  int code;
    1.89 +};
    1.90 +
    1.91 +// NULL terminated array of error code strings with error code integers
    1.92 +// derived from ldap.h (see above copyright notice):
    1.93 +static const struct mldap_errorcode mldap_errorcodes[] = {
    1.94 +  {"operations_error", 1},
    1.95 +  {"protocol_error", 2},
    1.96 +  {"timelimit_exceeded", 3},
    1.97 +  {"sizelimit_exceeded", 4},
    1.98 +  {"compare_false", 5},
    1.99 +  {"compare_true", 6},
   1.100 +//  {"auth_method_not_supported", 7},
   1.101 +  {"strong_auth_not_supported", 7},
   1.102 +  {"strong_auth_required", 8},
   1.103 +//  {"stronger_auth_required", 8},
   1.104 +  {"partial_results", 9},
   1.105 +  {"referral", 10},
   1.106 +  {"adminlimit_exceeded", 11},
   1.107 +  {"unavailable_critical_extension", 12},
   1.108 +  {"confidentiality_required", 13},
   1.109 +  {"sasl_bind_in_progress", 14},
   1.110 +  {"no_such_attribute", 16},
   1.111 +  {"undefined_type", 17},
   1.112 +  {"inappropriate_matching", 18},
   1.113 +  {"constraint_violation", 19},
   1.114 +  {"type_or_value_exists", 20},
   1.115 +  {"invalid_syntax", 21},
   1.116 +  {"no_such_object", 32},
   1.117 +  {"alias_problem", 33},
   1.118 +  {"invalid_dn_syntax", 34},
   1.119 +  {"is_leaf", 35},
   1.120 +  {"alias_deref_problem", 36},
   1.121 +  {"x_proxy_authz_failure", 47},
   1.122 +  {"inappropriate_auth", 48},
   1.123 +  {"invalid_credentials", 49},
   1.124 +  {"insufficient_access", 50},
   1.125 +  {"busy", 51},
   1.126 +  {"unavailable", 52},
   1.127 +  {"unwilling_to_perform", 53},
   1.128 +  {"loop_detect", 54},
   1.129 +  {"naming_violation", 64},
   1.130 +  {"object_class_violation", 65},
   1.131 +  {"not_allowed_on_nonleaf", 66},
   1.132 +  {"not_allowed_on_rdn", 67},
   1.133 +  {"already_exists", 68},
   1.134 +  {"no_object_class_mods", 69},
   1.135 +  {"results_too_large", 70},
   1.136 +  {"affects_multiple_dsas", 71},
   1.137 +  {"vlv_error", 76},
   1.138 +  {"other", 80},
   1.139 +  {"cup_resources_exhausted", 113},
   1.140 +  {"cup_security_violation", 114},
   1.141 +  {"cup_invalid_data", 115},
   1.142 +  {"cup_unsupported_scheme", 116},
   1.143 +  {"cup_reload_required", 117},
   1.144 +  {"cancelled", 118},
   1.145 +  {"no_such_operation", 119},
   1.146 +  {"too_late", 120},
   1.147 +  {"cannot_cancel", 121},
   1.148 +  {"assertion_failed", 122},
   1.149 +  {"proxied_authorization_denied", 123},
   1.150 +  {"sync_refresh_required", 4096},
   1.151 +  {"x_sync_refresh_required", 16640},
   1.152 +  {"x_assertion_failed", 16655},
   1.153 +  {"x_no_operation", 16654},
   1.154 +  {"x_no_referrals_found", 16656},
   1.155 +  {"x_cannot_chain", 16657},
   1.156 +  {"x_invalidreference", 16658},
   1.157 +  {"x_txn_specify_okay", 16672},
   1.158 +  {"x_txn_id_invalid", 16673},
   1.159 +  {"server_down", (-1)},
   1.160 +  {"local_error", (-2)},
   1.161 +  {"encoding_error", (-3)},
   1.162 +  {"decoding_error", (-4)},
   1.163 +  {"timeout", (-5)},
   1.164 +  {"auth_unknown", (-6)},
   1.165 +  {"filter_error", (-7)},
   1.166 +  {"user_cancelled", (-8)},
   1.167 +  {"param_error", (-9)},
   1.168 +  {"no_memory", (-10)},
   1.169 +  {"connect_error", (-11)},
   1.170 +  {"not_supported", (-12)},
   1.171 +  {"control_not_found", (-13)},
   1.172 +  {"no_results_returned", (-14)},
   1.173 +  {"more_results_to_return", (-15)},
   1.174 +  {"client_loop", (-16)},
   1.175 +  {"referral_limit_exceeded", (-17)},
   1.176 +  {"x_connecting", (-18)},
   1.177 +  {NULL, 0}
   1.178 +};
   1.179 +
   1.180 +void mldap_set_errorcodes(lua_State *L) {
   1.181 +  // stores mldap_errorcodes[] mappings in the Lua table on top of the stack
   1.182 +  // in both directions (string mapped to integer and vice versa)
   1.183 +
   1.184 +  const struct mldap_errorcode *errorcode;  // pointer to entry in mldap_errorcodes[] array
   1.185 +
   1.186 +  // iterate through entries in mldap_errorcodes[] array:
   1.187 +  for (errorcode=mldap_errorcodes; errorcode->ident; errorcode++) {
   1.188 +
   1.189 +    // store a mapping from the string to the integer:
   1.190 +    lua_pushstring(L, errorcode->ident);
   1.191 +    lua_pushinteger(L, errorcode->code);
   1.192 +    lua_settable(L, -3);
   1.193 +
   1.194 +    // store a mapping from the integer to the string:
   1.195 +    lua_pushinteger(L, errorcode->code);
   1.196 +    lua_pushstring(L, errorcode->ident);
   1.197 +    lua_settable(L, -3);
   1.198 +
   1.199 +  }
   1.200 +
   1.201 +}
   1.202 +

Impressum / About Us