2 * Copyright (c) 1990 Regents of the University of Michigan.
5 * Redistribution and use in source and binary forms are permitted
6 * provided that this notice is preserved and that due credit is given
7 * to the University of Michigan at Ann Arbor. The name of the University
8 * may not be used to endorse or promote products derived from this
9 * software without specific prior written permission. This software
10 * is provided ``as is'' without express or implied warranty.
18 #include <ac/socket.h>
20 #include <quipu/ds_error.h>
21 #include <quipu/attrvalue.h>
22 #include <quipu/name.h>
23 #include <quipu/commonarg.h>
30 print_error( struct DSError *e )
34 if ( (ps = ps_alloc( std_open )) == NULLPS ) {
35 fprintf( stderr, "error in ps_alloc\n" );
38 if ( std_setup( ps, stderr ) == NOTOK ) {
39 fprintf( stderr, "error in std_setup = %d", ps->ps_errno );
50 x500err2ldaperr( struct DSError *e, char **matched )
52 int ldaperr = LDAP_OTHER;
55 Debug( LDAP_DEBUG_TRACE, "x500err2ldaperr\n", 0, 0, 0 );
58 switch ( e->dse_type ) {
59 case DSE_ATTRIBUTEERROR:
60 #if ISODEPACKAGE == IC || ISODEPACKAGE == XT
61 switch ( e->ERR_ATTRIBUTE.DSE_at_plist->DSE_at_what ) {
63 switch ( e->ERR_ATTRIBUTE.DSE_at_plist.DSE_at_what ) {
65 case DSE_AT_NOSUCHATTRIBUTE:
66 ldaperr = LDAP_NO_SUCH_ATTRIBUTE;
68 case DSE_AT_INVALIDATTRIBUTESYNTAX:
69 ldaperr = LDAP_INVALID_SYNTAX;
71 case DSE_AT_UNDEFINEDATTRIBUTETYPE:
72 ldaperr = LDAP_UNDEFINED_TYPE;
74 case DSE_AT_INAPPROPRIATEMATCHING:
75 ldaperr = LDAP_INAPPROPRIATE_MATCHING;
77 case DSE_AT_CONSTRAINTVIOLATION:
78 ldaperr = LDAP_CONSTRAINT_VIOLATION;
80 case DSE_AT_TYPEORVALUEEXISTS:
81 ldaperr = LDAP_TYPE_OR_VALUE_EXISTS;
89 switch( e->ERR_NAME.DSE_na_problem ) {
90 case DSE_NA_NOSUCHOBJECT:
91 ldaperr = LDAP_NO_SUCH_OBJECT;
93 case DSE_NA_ALIASPROBLEM:
94 ldaperr = LDAP_ALIAS_PROBLEM;
96 case DSE_NA_INVALIDATTRIBUTESYNTAX:
97 ldaperr = LDAP_INVALID_SYNTAX;
99 case DSE_NA_ALIASDEREFERENCE:
100 ldaperr = LDAP_ALIAS_DEREF_PROBLEM;
106 if ( e->ERR_NAME.DSE_na_matched == NULLDN ) {
111 ps = ps_alloc( str_open );
112 str_setup( ps, NULLCP, 0, 0 );
114 ldap_dn_print( ps, e->ERR_NAME.DSE_na_matched, NULLDN, EDBOUT );
117 *matched = (char *) strdup( ps->ps_base );
119 ps->ps_ptr = ps->ps_base;
120 ps->ps_cnt = ps->ps_bufsiz;
123 case DSE_SERVICEERROR:
124 switch( e->ERR_SERVICE.DSE_sv_problem ) {
128 case DSE_SV_UNAVAILABLE:
129 ldaperr = LDAP_UNAVAILABLE;
131 case DSE_SV_UNWILLINGTOPERFORM:
132 ldaperr = LDAP_UNWILLING_TO_PERFORM;
134 case DSE_SV_TIMELIMITEXCEEDED:
135 ldaperr = LDAP_TIMELIMIT_EXCEEDED;
137 case DSE_SV_ADMINLIMITEXCEEDED:
138 ldaperr = LDAP_SIZELIMIT_EXCEEDED;
140 case DSE_SV_LOOPDETECT:
141 ldaperr = LDAP_LOOP_DETECT;
148 case DSE_SECURITYERROR:
149 switch( e->ERR_SECURITY.DSE_sc_problem ) {
150 case DSE_SC_AUTHENTICATION:
151 ldaperr = LDAP_INAPPROPRIATE_AUTH;
153 case DSE_SC_INVALIDCREDENTIALS:
154 ldaperr = LDAP_INVALID_CREDENTIALS;
156 case DSE_SC_ACCESSRIGHTS:
157 ldaperr = LDAP_INSUFFICIENT_ACCESS;
164 case DSE_UPDATEERROR:
165 switch( e->ERR_UPDATE.DSE_up_problem ) {
166 case DSE_UP_NAMINGVIOLATION:
167 ldaperr = LDAP_NAMING_VIOLATION;
169 case DSE_UP_OBJECTCLASSVIOLATION:
170 ldaperr = LDAP_OBJECT_CLASS_VIOLATION;
172 case DSE_UP_NOTONNONLEAF:
173 ldaperr = LDAP_NOT_ALLOWED_ON_NONLEAF;
175 case DSE_UP_NOTONRDN:
176 ldaperr = LDAP_NOT_ALLOWED_ON_RDN;
178 case DSE_UP_ALREADYEXISTS:
179 ldaperr = LDAP_ALREADY_EXISTS;
181 case DSE_UP_NOOBJECTCLASSMODS:
182 ldaperr = LDAP_NO_OBJECT_CLASS_MODS;