]> git.sur5r.net Git - openldap/commitdiff
improve error messages
authorPierangelo Masarati <ando@openldap.org>
Sun, 10 Nov 2002 18:16:43 +0000 (18:16 +0000)
committerPierangelo Masarati <ando@openldap.org>
Sun, 10 Nov 2002 18:16:43 +0000 (18:16 +0000)
14 files changed:
servers/slapd/back-ldap/add.c
servers/slapd/back-ldap/bind.c
servers/slapd/back-ldap/compare.c
servers/slapd/back-ldap/delete.c
servers/slapd/back-ldap/modify.c
servers/slapd/back-ldap/modrdn.c
servers/slapd/back-ldap/search.c
servers/slapd/back-meta/add.c
servers/slapd/back-meta/compare.c
servers/slapd/back-meta/conn.c
servers/slapd/back-meta/delete.c
servers/slapd/back-meta/modify.c
servers/slapd/back-meta/modrdn.c
servers/slapd/back-meta/search.c

index db1382042767276542b0a494b20eb69a4967c672..21ada672c311ad7d6519cc708c771583fd47dd78 100644 (file)
@@ -95,12 +95,12 @@ ldap_back_add(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
                
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
@@ -154,12 +154,15 @@ ldap_back_add(
 #ifdef ENABLE_REWRITE
                /*
                 * FIXME: dn-valued attrs should be rewritten
-                * to allow their use in ACLs at the back-ldap
-                * level.
+                * to allow their use in ACLs at back-ldap level.
                 */
                if ( strcmp( a->a_desc->ad_type->sat_syntax->ssyn_oid,
                                        SLAPD_DN_SYNTAX ) == 0 ) {
-                       ldap_dnattr_rewrite( li->rwinfo, a->a_vals, conn );
+                       /*
+                        * FIXME: rewrite could fail; in this case
+                        * the operation should give up, right?
+                        */
+                       (void)ldap_dnattr_rewrite( li->rwinfo, a->a_vals, conn );
                }
 #endif /* ENABLE_REWRITE */
 
index e65ea665a6804aa5f274a95d9d08dbb0663bb4b6..501e4d9802930dc7cceabb5c26d9c06c5fddd63d 100644 (file)
@@ -102,12 +102,12 @@ ldap_back_bind(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
@@ -228,7 +228,7 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
                if (err != LDAP_SUCCESS) {
                        err = ldap_back_map_result(err);
                        send_ldap_result( conn, op, err,
-                               NULL, "ldap_init failed", NULL, NULL );
+                               NULL, "ldap_initialize() failed", NULL, NULL );
                        return( NULL );
                }
                /* Set LDAP version. This will always succeed: If the client
@@ -263,7 +263,8 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
                                                &lc->bound_dn.bv_val ) ) {
                        case REWRITE_REGEXEC_OK:
                                if ( lc->bound_dn.bv_val == NULL ) {
-                                       ber_dupbv( &lc->bound_dn, &lc->conn->c_dn );
+                                       ber_dupbv( &lc->bound_dn,
+                                                       &lc->conn->c_dn );
                                }
 #ifdef NEW_LOGGING
                                LDAP_LOG( BACK_LDAP, DETAIL1, 
@@ -283,25 +284,28 @@ ldap_back_getconn(struct ldapinfo *li, Connection *conn, Operation *op)
                        case REWRITE_REGEXEC_UNWILLING:
                                send_ldap_result( conn, op,
                                                LDAP_UNWILLING_TO_PERFORM,
-                                               NULL, "Unwilling to perform",
+                                               NULL, "Operation not allowed",
                                                NULL, NULL );
                                return( NULL );
                                
                        case REWRITE_REGEXEC_ERR:
                                send_ldap_result( conn, op,
                                                LDAP_OTHER,
-                                               NULL, "Operations error",
+                                               NULL, "Rewrite error",
                                                NULL, NULL );
                                return( NULL );
                        }
+
 #else /* !ENABLE_REWRITE */
                        struct berval bv;
                        ldap_back_dn_massage( li, &lc->conn->c_dn, &bv, 0, 1 );
-                       if ( bv.bv_val == lc->conn->c_dn.bv_val )
+                       if ( bv.bv_val == lc->conn->c_dn.bv_val ) {
                                ber_dupbv( &lc->bound_dn, &bv );
-                       else
+                       } else {
                                lc->bound_dn = bv;
+                       }
 #endif /* !ENABLE_REWRITE */
+
                } else {
                        lc->bound_dn.bv_val = NULL;
                        lc->bound_dn.bv_len = 0;
index 2b677edb5a5bf1da5c98d5e7d29807693a74d5c6..e4c966f9e97808d476eb507406f5672c73e498b7 100644 (file)
@@ -85,12 +85,12 @@ ldap_back_compare(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
                
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
index d545f77b14701c032cc8e4015cb0bc2b937f328b..3766df2db9ec2094c7302853c61b4ad8db3099be 100644 (file)
@@ -85,12 +85,12 @@ ldap_back_delete(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
index bb45b385c09f1d352077d356cff095fb750e4399..8deeeaa88833d7591af263317d34c7a71e3c5eb9 100644 (file)
@@ -89,12 +89,12 @@ ldap_back_modify(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
index 8c7eee586999da39d18882f3c568f6dcee9f1738..2eb905c844814ed00202cd285e955d75ca2598b4 100644 (file)
@@ -96,13 +96,13 @@ ldap_back_modrdn(
 
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
+                                       NULL, "Operation not allowed",
                                        NULL, NULL );
                        return( -1 );
 
                case REWRITE_REGEXEC_ERR:
                        send_ldap_result( conn, op, LDAP_OTHER,
-                                       NULL, "Operations error",
+                                       NULL, "Rewrite error",
                                        NULL, NULL );
                        return( -1 );
                }
@@ -134,12 +134,12 @@ ldap_back_modrdn(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return( -1 );
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return( -1 );
        }
 #else /* !ENABLE_REWRITE */
index 47f211c5da48b3c6908612d6ef1aa4d259bb98d5..e2990e81d87ee05876cdc6c0ddef43623dc965b9 100644 (file)
@@ -172,13 +172,13 @@ ldap_back_search(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                rc = -1;
                goto finish;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, "Operations error", NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                rc = -1;
                goto finish;
        }
@@ -211,8 +211,13 @@ ldap_back_search(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, "Unwilling to perform", NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
+               rc = -1;
+               goto finish;
+
        case REWRITE_REGEXEC_ERR:
+               send_ldap_result( conn, op, LDAP_OTHER,
+                               NULL, "Rewrite error", NULL, NULL );
                rc = -1;
                goto finish;
        }
@@ -251,9 +256,9 @@ ldap_back_search(
                mapped_attrs[count] = NULL;
        }
 
-       if ((msgid = ldap_search(lc->ld, mbase.bv_val, scope, mapped_filter, mapped_attrs,
-               attrsonly)) == -1)
-       {
+       msgid = ldap_search(lc->ld, mbase.bv_val, scope, mapped_filter,
+                       mapped_attrs, attrsonly);
+       if ( msgid == -1 ) {
 fail:;
                rc = ldap_back_op_result(lc, op);
                goto finish;
@@ -364,19 +369,18 @@ fail:;
                        break;
                        
                case REWRITE_REGEXEC_UNWILLING:
-                       send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
-                                       NULL, NULL );
                        
                case REWRITE_REGEXEC_ERR:
-                       rc = -1;
-                       goto finish;
+                       /* FIXME: no error, but no matched ... */
+                       mmatch = NULL;
+                       break;
                }
        }
 
        if ( v2refs ) {
                sres = LDAP_REFERRAL;
        }
+
        send_search_result( conn, op, sres,
                mmatch, err, v2refs, NULL, count );
 
index e0d52e1173816311c022a1b4b48b49cde1c3f008..6408654e9dfe735a825aed8f2016f11ea2a43b9f 100644 (file)
@@ -131,12 +131,12 @@ meta_back_add(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return -1;
                
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return -1;
        }
 
index 71475fdc39214ac2875598f4f1201cf1949d13e1..75a4c868e4e3cf7bc4ba6d360ef638069c625050 100644 (file)
@@ -138,7 +138,7 @@ meta_back_compare(
                
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
+                                       NULL, "Operation not allowed",
                                        NULL, NULL );
                        return -1;
                        
@@ -324,7 +324,7 @@ finish:;
                
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
+                                       NULL, "Operation not allowed",
                                        NULL, NULL );
                        rc = -1;
                        goto cleanup;
index 249555836e04d23608fc19c6220b11759d4bf8a0..e9deeb00512356b457c86febf5c2523811aba765 100644 (file)
@@ -286,7 +286,7 @@ init_one_conn(
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op,
                                        LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, "Unwilling to perform",
+                                       NULL, "Operation not allowed",
                                        NULL, NULL );
                        return LDAP_UNWILLING_TO_PERFORM;
                        
index daeada0ad30d0d17507c34041092f458953538d0..4909e73a6268ae60e402a6141b4c603783006a34 100644 (file)
@@ -118,12 +118,12 @@ meta_back_delete(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return -1;
        }
        
index 7b3208bc53bc91c45542a520872607f5a151d176..57dc40f90b0b6c743d6c8e8d5911b21be83b3804 100644 (file)
@@ -122,12 +122,12 @@ meta_back_modify(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return -1;
        }
 
index c0f6d1437ff666c9359658cda0cd406afb8d9125..336001bdd2f98f87da3031c2c688102b81bdb027 100644 (file)
@@ -155,12 +155,13 @@ meta_back_modrdn(
 
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "Operation not allowed", 
+                                       NULL, NULL );
                        return -1;
 
                case REWRITE_REGEXEC_ERR:
                        send_ldap_result( conn, op, LDAP_OTHER,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "Rewrite error", NULL, NULL );
                        return -1;
                }
        }
@@ -185,12 +186,12 @@ meta_back_modrdn(
                
        case REWRITE_REGEXEC_UNWILLING:
                send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Operation not allowed", NULL, NULL );
                return -1;
 
        case REWRITE_REGEXEC_ERR:
                send_ldap_result( conn, op, LDAP_OTHER,
-                               NULL, NULL, NULL, NULL );
+                               NULL, "Rewrite error", NULL, NULL );
                return -1;
        }
 
index 0f6bce2dc73952084d09310812f6bb037c67de99..35b0aae92deb6ac8be79a3da0b704052e8e2ba4f 100644 (file)
@@ -296,13 +296,14 @@ meta_back_search(
                
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "Operation not allowed",
+                                       NULL, NULL );
                        rc = -1;
                        goto finish;
 
                case REWRITE_REGEXEC_ERR:
                        send_ldap_result( conn, op, LDAP_OTHER,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "rewrite error", NULL, NULL );
                        rc = -1;
                        goto finish;
                }
@@ -335,13 +336,14 @@ meta_back_search(
                
                case REWRITE_REGEXEC_UNWILLING:
                        send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "Operation not allowed",
+                                       NULL, NULL );
                        rc = -1;
                        goto finish;
 
                case REWRITE_REGEXEC_ERR:
                        send_ldap_result( conn, op, LDAP_OTHER,
-                                       NULL, NULL, NULL, NULL );
+                                       NULL, "Rewrite error", NULL, NULL );
                        rc = -1;
                        goto finish;
                }
@@ -601,16 +603,11 @@ meta_back_search(
                        break;
                        
                case REWRITE_REGEXEC_UNWILLING:
-                       send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
-                                       NULL, NULL, NULL, NULL );
-                       rc = -1;
-                       goto finish;
                        
                case REWRITE_REGEXEC_ERR:
-                       send_ldap_result( conn, op, LDAP_OTHER,
-                                       NULL, NULL, NULL, NULL );
-                       rc = -1;
-                       goto finish;
+                       /* FIXME: no error, but no matched ... */
+                       mmatch = NULL;
+                       break;
                }
        }
 
@@ -691,8 +688,10 @@ meta_send_entry(
                }
                break;
                
-       case REWRITE_REGEXEC_ERR:
        case REWRITE_REGEXEC_UNWILLING:
+               return LDAP_UNWILLING_TO_PERFORM;
+
+       case REWRITE_REGEXEC_ERR:
                return LDAP_OTHER;
        }