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