From a2705b84c7442232e2908ae3c7ebc338720c5c66 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Thu, 30 Dec 2004 23:04:41 +0000 Subject: [PATCH] Update CancelOp's protocol values to those in RFC 3909 --- include/ldap.h | 24 ++++++++++++++++-------- libraries/libldap/error.c | 25 ++++++++++++++++++++++--- 2 files changed, 38 insertions(+), 11 deletions(-) diff --git a/include/ldap.h b/include/ldap.h index 12fcd7ee76..1bee276bd7 100644 --- a/include/ldap.h +++ b/include/ldap.h @@ -292,7 +292,7 @@ typedef struct ldapcontrol { #define LDAP_TAG_EXOP_MODIFY_PASSWD_GEN ((ber_tag_t) 0x80U) #define LDAP_EXOP_X_WHO_AM_I "1.3.6.1.4.1.4203.1.11.3" -#define LDAP_EXOP_X_CANCEL "1.3.6.1.4.1.4203.666.6.3" +#define LDAP_EXOP_X_CANCEL "1.3.6.1.1.8" /* LDAP Grouping of Related Operations *//* a work in progress */ #ifdef LDAP_DEVEL @@ -523,7 +523,21 @@ typedef struct ldapcontrol { #define LDAP_RESULTS_TOO_LARGE 0x46 /* CLDAP */ #define LDAP_AFFECTS_MULTIPLE_DSAS 0x47 /* LDAPv3 */ -#define LDAP_OTHER 0x50 +#define LDAP_OTHER 0x50 + +/* LCUP operation codes (113-117) */ +#define LDAP_CUP_RESOURCES_EXHAUSTED 0x71 +#define LDAP_CUP_SECURITY_VIOLATION 0x72 +#define LDAP_CUP_INVALID_DATA 0x73 +#define LDAP_CUP_UNSUPPORTED_SCHEME 0x74 +#define LDAP_CUP_RELOAD_REQUIRED 0x75 + +/* Cancel operation codes (118-121) */ +#define LDAP_CANCELLED 0x76 +#define LDAP_NO_SUCH_OPERATION 0x77 +#define LDAP_TOO_LATE 0x78 +#define LDAP_CANNOT_CANCEL 0x79 + /* Experimental result codes */ #define LDAP_E_ERROR(n) LDAP_RANGE((n),0x1000,0x3FFF) /* experimental */ @@ -538,12 +552,6 @@ typedef struct ldapcontrol { /* for the Assertion control */ #define LDAP_ASSERTION_FAILED 0x410f -/* for the Cancel operation */ -#define LDAP_CANCELLED 0x4110 -#define LDAP_NO_SUCH_OPERATION 0x4111 -#define LDAP_TOO_LATE 0x4112 -#define LDAP_CANNOT_CANCEL 0x4113 - /* API Error Codes * * Based on draft-ietf-ldap-c-api-xx diff --git a/libraries/libldap/error.c b/libraries/libldap/error.c index 2388238558..c6ac44b9b0 100644 --- a/libraries/libldap/error.c +++ b/libraries/libldap/error.c @@ -110,6 +110,12 @@ static struct ldaperror ldap_builtin_errlist[] = { {LDAP_NO_OPERATION, N_("No Operation")}, {LDAP_ASSERTION_FAILED, N_("Assertion Failed")}, + {LDAP_CUP_RESOURCES_EXHAUSTED, N_("LCUP Resources Exhausted")}, + {LDAP_CUP_SECURITY_VIOLATION, N_("LCUP Security Violation")}, + {LDAP_CUP_INVALID_DATA, N_("LCUP Invalid Data")}, + {LDAP_CUP_UNSUPPORTED_SCHEME, N_("LCUP Unsupported Scheme")}, + {LDAP_CUP_RELOAD_REQUIRED, N_("LCUP Reload Required")}, + {LDAP_CANCELLED, N_("Cancelled")}, {LDAP_NO_SUCH_OPERATION, N_("No Operation to Cancel")}, {LDAP_TOO_LATE, N_("Too Late to Cancel")}, @@ -147,7 +153,20 @@ ldap_err2string( int err ) e = ldap_int_error( err ); - return e ? _(e->e_reason) : _("Unknown error"); + if (e) { + return e->e_reason; + + } else if ( LDAP_API_ERROR(err) ) { + return _("Unknown API error"); + + } else if ( LDAP_E_ERROR(err) ) { + return _("Unknown (extension) error"); + + } else if ( LDAP_X_ERROR(err) ) { + return _("Unknown (private extension) error"); + } + + return _("Unknown error"); } /* deprecated */ @@ -166,7 +185,7 @@ ldap_perror( LDAP *ld, LDAP_CONST char *str ) fprintf( stderr, "%s: %s (%d)\n", str ? str : "ldap_perror", - e ? _(e->e_reason) : _("unknown LDAP result code"), + e ? _(e->e_reason) : _("unknown result code"), ld->ld_errno ); if ( ld->ld_matched != NULL && ld->ld_matched[0] != '\0' ) { @@ -213,7 +232,7 @@ ldap_result2error( LDAP *ld, LDAPMessage *r, int freeit ) * BindResponse ::= [APPLICATION 1] SEQUENCE { * COMPONENTS OF LDAPResult, * serverSaslCreds [7] OCTET STRING OPTIONAL } - * + * * and ExtendedOp results: * * ExtendedResponse ::= [APPLICATION 24] SEQUENCE { -- 2.39.5