]> git.sur5r.net Git - openldap/blob - servers/slapd/back-bdb/extended.c
don't segfault if a database doesn't have the suffix
[openldap] / servers / slapd / back-bdb / extended.c
1 /* extended.c - bdb backend extended routines */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 2000-2004 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16
17 #include "portable.h"
18
19 #include <stdio.h>
20 #include <ac/string.h>
21
22 #include "back-bdb.h"
23 #include "external.h"
24 #include "lber_pvt.h"
25
26 static struct exop {
27         struct berval *oid;
28         BI_op_extended  *extended;
29 } exop_table[] = {
30         { NULL, NULL }
31 };
32
33 int
34 bdb_extended( Operation *op, SlapReply *rs )
35 /*      struct berval           *reqoid,
36         struct berval   *reqdata,
37         char            **rspoid,
38         struct berval   **rspdata,
39         LDAPControl *** rspctrls,
40         const char**    text,
41         BerVarray       *refs 
42 ) */
43 {
44         int i;
45
46         for( i=0; exop_table[i].extended != NULL; i++ ) {
47                 if( ber_bvcmp( exop_table[i].oid, &op->oq_extended.rs_reqoid ) == 0 ) {
48                         return (exop_table[i].extended)( op, rs );
49                 }
50         }
51
52         rs->sr_text = "not supported within naming context";
53         return LDAP_UNWILLING_TO_PERFORM;
54 }
55