error.c revision 1
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Portions Copyright 1999 Sun Microsystems, Inc. All rights reserved.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe * Use is subject to license terms.
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#pragma ident "%Z%%M% %I% %E% SMI"
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#else /* MACOS */
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#else /* DOS */
a9478106a12424322498e53cf7cd75bd8a4d6004Yuri Pankov#endif /* DOS */
c10c16dec587a0662068f6e2991c29ed3a9db943Richard Lowe#endif /* MACOS */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_TIMELIMIT_EXCEEDED, "Timelimit exceeded",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_SIZELIMIT_EXCEEDED, "Sizelimit exceeded",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_AUTH_METHOD_NOT_SUPPORTED, "Authentication method not supported",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_STRONG_AUTH_REQUIRED, "Strong authentication required",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_PARTIAL_RESULTS, "Partial results and referral received",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_ADMINLIMIT_EXCEEDED, "Admin. limit exceeded",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_UNAVAILABLE_CRITICAL_EXTENSION, "Unavailable critical extension",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_CONFIDENTIALITY_REQUIRED, "Confidentiality required",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_NO_SUCH_ATTRIBUTE, "No such attribute",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_UNDEFINED_TYPE, "Undefined attribute type",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_INAPPROPRIATE_MATCHING, "Inappropriate matching",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_CONSTRAINT_VIOLATION, "Constraint violation",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_TYPE_OR_VALUE_EXISTS, "Type or value exists",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_INVALID_DN_SYNTAX, "Invalid DN syntax",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_ALIAS_DEREF_PROBLEM, "Alias dereferencing problem",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_INAPPROPRIATE_AUTH, "Inappropriate authentication",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_INVALID_CREDENTIALS, "Invalid credentials",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_INSUFFICIENT_ACCESS, "Insufficient access",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_UNWILLING_TO_PERFORM, "DSA is unwilling to perform",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_OBJECT_CLASS_VIOLATION, "Object class violation",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_NOT_ALLOWED_ON_NONLEAF, "Operation not allowed on nonleaf",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_NOT_ALLOWED_ON_RDN, "Operation not allowed on RDN",
d2a70789f056fc6c9ce3ab047b52126d80b0e3daRichard Lowe LDAP_NO_OBJECT_CLASS_MODS, "Cannot modify object class",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_RESULTS_TOO_LARGE, "Results too large",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_AFFECTS_MULTIPLE_DSAS, "Affects multiple DSAs",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_SERVER_DOWN, "Can't contact LDAP server",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_AUTH_UNKNOWN, "Unknown authentication method",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_USER_CANCELLED, "User cancelled operation",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_PARAM_ERROR, "Bad parameter to an ldap routine",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_CONTROL_NOT_FOUND, "Control not found",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_NO_RESULTS_RETURNED, "No results have been returned",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_MORE_RESULTS_TO_RETURN, "More results to return",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_CLIENT_LOOP, "Loop detected in referrals",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi LDAP_REFERRAL_LIMIT_EXCEEDED, "Too many referrals followed",
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi Debug(LDAP_DEBUG_TRACE, "fill_ldap_errlist\n", 0, 0, 0 );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 130, "Success");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 131, "Operations error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 132, "Protocol error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 133, "Timelimit exceeded");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 134, "Sizelimit exceeded");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 135, "Compare false");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 136, "Compare true");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 137, "Strong authentication not supported");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 138, "Strong authentication required");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 139, "Partial results and referral received");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1262, "Referral received");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1263, "Admin. limit exceeded");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1264, "Unavailable critical extension");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1265, "Confidentiality required");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 140, "No such attribute");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 141, "Undefined attribute type");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 142, "Inappropriate matching");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 143, "Constraint violation");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 144, "Type or value exists");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 145, "Invalid syntax");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 146, "No such object");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 147, "Alias problem");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 148, "Invalid DN syntax");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 149, "Object is a leaf");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 150, "Alias dereferencing problem");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 151, "Inappropriate authentication");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 152, "Invalid credentials");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 153, "Insufficient access");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 154, "DSA is busy");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 155, "DSA is unavailable");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 156, "DSA is unwilling to perform");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 157, "Loop detected");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 158, "Naming violation");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 159, "Object class violation");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 160, "Operation not allowed on nonleaf");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 161, "Operation not allowed on RDN");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 162, "Already exists");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 163, "Cannot modify object class");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 164, "Results too large");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* new with ldapv3 */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1266, "Affects multiple DSAs");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi/* end of new */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 165, "Unknown error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 166, "Can't contact LDAP server");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 167, "Local error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 168, "Encoding error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 169, "Decoding error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 170, "Timed out");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 171, "Unknown authentication method");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 172, "Bad search filter");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 173, "User cancelled operation");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 174, "Bad parameter to an ldap routine");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 175, "Out of memory");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1267, "Connection error");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1268, "Not supported");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1269, "Control not found");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1270, "No results have been returned");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1271, "More results to return");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1272, "Loop detected in referrals");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi ldap_errlist[i++].e_reason = catgets(slapdcat, 1, 1273, "Too many referrals followed");
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi Debug( LDAP_DEBUG_TRACE, "ldap_err2string\n", 0, 0, 0 );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi for ( i = 0; ldap_errlist[i].e_code != -1; i++ ) {
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi return( catgets(slapdcat, 1 , 165, "Unknown error") );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi Debug( LDAP_DEBUG_TRACE, "ldap_perror\n", 0, 0, 0 );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi /* for I18N */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi } /* end if */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi for ( i = 0; ldap_errlist[i].e_code != -1; i++ ) {
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi if ( ld->ld_errno == ldap_errlist[i].e_code ) {
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi if ( ld->ld_matched != NULL && *ld->ld_matched != '\0' )
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi (void) fprintf( stderr, catgets(slapdcat, 1, 176, "%1$s: matched: %2$s\n"), s,
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi if ( ld->ld_error != NULL && *ld->ld_error != '\0' )
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi (void) fprintf( stderr, catgets(slapdcat, 1, 177, "%1$s: additional info: %2$s\n"),
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi (void) fprintf( stderr, catgets(slapdcat, 1, 178, "%1$s: Not an LDAP errno %2$d\n"), s, ld->ld_errno );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi#endif /* NO_USERINTERFACE */
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchildap_result2error( LDAP *ld, LDAPMessage *r, int freeit )
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi Debug( LDAP_DEBUG_TRACE, "ldap_result2error\n", 0, 0, 0 );
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi for ( lm = r; lm->lm_chain != NULL; lm = lm->lm_chain )
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi rc = ber_scanf( &ber, "{iaa}", &along, &ld->ld_matched,
43051d2742bbe5911de73322064cb573b6aff975Robert Mustacchi rc = ber_scanf( &ber, "{ia}", &along, &ld->ld_error );