No empty .Rs/.Re
[netbsd-mini2440.git] / external / bsd / openldap / dist / servers / slapd / back-shell / config.c
blob9fd87f76c01956772b577bf44040274983d15a46
1 /* config.c - shell backend configuration file routine */
2 /* $OpenLDAP: pkg/ldap/servers/slapd/back-shell/config.c,v 1.18.2.3 2008/02/11 23:26:47 kurt Exp $ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 1998-2008 The OpenLDAP Foundation.
6 * All rights reserved.
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.
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>.
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17 * All rights reserved.
19 * Redistribution and use in source and binary forms are permitted
20 * provided that this notice is preserved and that due credit is given
21 * to the University of Michigan at Ann Arbor. The name of the University
22 * may not be used to endorse or promote products derived from this
23 * software without specific prior written permission. This software
24 * is provided ``as is'' without express or implied warranty.
26 /* ACKNOWLEDGEMENTS:
27 * This work was originally developed by the University of Michigan
28 * (as part of U-MICH LDAP).
31 #include "portable.h"
33 #include <stdio.h>
35 #include <ac/string.h>
36 #include <ac/socket.h>
38 #include "slap.h"
39 #include "shell.h"
41 int
42 shell_back_db_config(
43 BackendDB *be,
44 const char *fname,
45 int lineno,
46 int argc,
47 char **argv
50 struct shellinfo *si = (struct shellinfo *) be->be_private;
52 if ( si == NULL ) {
53 fprintf( stderr, "%s: line %d: shell backend info is null!\n",
54 fname, lineno );
55 return( 1 );
58 /* command + args to exec for binds */
59 if ( strcasecmp( argv[0], "bind" ) == 0 ) {
60 if ( argc < 2 ) {
61 fprintf( stderr,
62 "%s: line %d: missing executable in \"bind <executable>\" line\n",
63 fname, lineno );
64 return( 1 );
66 si->si_bind = ldap_charray_dup( &argv[1] );
68 /* command + args to exec for unbinds */
69 } else if ( strcasecmp( argv[0], "unbind" ) == 0 ) {
70 if ( argc < 2 ) {
71 fprintf( stderr,
72 "%s: line %d: missing executable in \"unbind <executable>\" line\n",
73 fname, lineno );
74 return( 1 );
76 si->si_unbind = ldap_charray_dup( &argv[1] );
78 /* command + args to exec for searches */
79 } else if ( strcasecmp( argv[0], "search" ) == 0 ) {
80 if ( argc < 2 ) {
81 fprintf( stderr,
82 "%s: line %d: missing executable in \"search <executable>\" line\n",
83 fname, lineno );
84 return( 1 );
86 si->si_search = ldap_charray_dup( &argv[1] );
88 /* command + args to exec for compares */
89 } else if ( strcasecmp( argv[0], "compare" ) == 0 ) {
90 if ( argc < 2 ) {
91 fprintf( stderr,
92 "%s: line %d: missing executable in \"compare <executable>\" line\n",
93 fname, lineno );
94 return( 1 );
96 si->si_compare = ldap_charray_dup( &argv[1] );
98 /* command + args to exec for modifies */
99 } else if ( strcasecmp( argv[0], "modify" ) == 0 ) {
100 if ( argc < 2 ) {
101 fprintf( stderr,
102 "%s: line %d: missing executable in \"modify <executable>\" line\n",
103 fname, lineno );
104 return( 1 );
106 si->si_modify = ldap_charray_dup( &argv[1] );
108 /* command + args to exec for modrdn */
109 } else if ( strcasecmp( argv[0], "modrdn" ) == 0 ) {
110 if ( argc < 2 ) {
111 fprintf( stderr,
112 "%s: line %d: missing executable in \"modrdn <executable>\" line\n",
113 fname, lineno );
114 return( 1 );
116 si->si_modrdn = ldap_charray_dup( &argv[1] );
118 /* command + args to exec for add */
119 } else if ( strcasecmp( argv[0], "add" ) == 0 ) {
120 if ( argc < 2 ) {
121 fprintf( stderr,
122 "%s: line %d: missing executable in \"add <executable>\" line\n",
123 fname, lineno );
124 return( 1 );
126 si->si_add = ldap_charray_dup( &argv[1] );
128 /* command + args to exec for delete */
129 } else if ( strcasecmp( argv[0], "delete" ) == 0 ) {
130 if ( argc < 2 ) {
131 fprintf( stderr,
132 "%s: line %d: missing executable in \"delete <executable>\" line\n",
133 fname, lineno );
134 return( 1 );
136 si->si_delete = ldap_charray_dup( &argv[1] );
138 /* anything else */
139 } else {
140 return SLAP_CONF_UNKNOWN;
143 return 0;