1 /* config.c - shell backend configuration file routine */
4 * Copyright 1998-2002 The OpenLDAP Foundation, All Rights Reserved.
5 * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
12 #include <ac/string.h>
13 #include <ac/socket.h>
18 #ifdef SHELL_SURROGATE_PARENT
20 static struct berval make_cmd_info(
24 struct berval ret = { 0, 0 };
27 for( i = 0; args[i] != NULL; i++ )
28 ret.bv_len += strlen( args[i] ) + 1;
29 ret.bv_val = ch_malloc( ret.bv_len );
31 for( i = 0; args[i] != NULL; i++ ) {
32 strcpy( ret.bv_val + offset, args[i] );
33 offset += strlen( args[i] ) + 1;
38 #endif /* SHELL_SURROGATE_PARENT */
49 struct shellinfo *si = (struct shellinfo *) be->be_private;
52 fprintf( stderr, "%s: line %d: shell backend info is null!\n",
57 /* command + args to exec for binds */
58 if ( strcasecmp( argv[0], "bind" ) == 0 ) {
61 "%s: line %d: missing executable in \"bind <executable>\" line\n",
65 si->si_bind = MAKE_CMD_INFO( &argv[1] );
67 /* command + args to exec for unbinds */
68 } else if ( strcasecmp( argv[0], "unbind" ) == 0 ) {
71 "%s: line %d: missing executable in \"unbind <executable>\" line\n",
75 si->si_unbind = MAKE_CMD_INFO( &argv[1] );
77 /* command + args to exec for searches */
78 } else if ( strcasecmp( argv[0], "search" ) == 0 ) {
81 "%s: line %d: missing executable in \"search <executable>\" line\n",
85 si->si_search = MAKE_CMD_INFO( &argv[1] );
87 /* command + args to exec for compares */
88 } else if ( strcasecmp( argv[0], "compare" ) == 0 ) {
91 "%s: line %d: missing executable in \"compare <executable>\" line\n",
95 si->si_compare = MAKE_CMD_INFO( &argv[1] );
97 /* command + args to exec for modifies */
98 } else if ( strcasecmp( argv[0], "modify" ) == 0 ) {
101 "%s: line %d: missing executable in \"modify <executable>\" line\n",
105 si->si_modify = MAKE_CMD_INFO( &argv[1] );
107 /* command + args to exec for modrdn */
108 } else if ( strcasecmp( argv[0], "modrdn" ) == 0 ) {
111 "%s: line %d: missing executable in \"modrdn <executable>\" line\n",
115 si->si_modrdn = MAKE_CMD_INFO( &argv[1] );
117 /* command + args to exec for add */
118 } else if ( strcasecmp( argv[0], "add" ) == 0 ) {
121 "%s: line %d: missing executable in \"add <executable>\" line\n",
125 si->si_add = MAKE_CMD_INFO( &argv[1] );
127 /* command + args to exec for delete */
128 } else if ( strcasecmp( argv[0], "delete" ) == 0 ) {
131 "%s: line %d: missing executable in \"delete <executable>\" line\n",
135 si->si_delete = MAKE_CMD_INFO( &argv[1] );
137 /* command + args to exec for abandon */
138 } else if ( strcasecmp( argv[0], "abandon" ) == 0 ) {
141 "%s: line %d: missing executable in \"abandon <executable>\" line\n",
145 si->si_abandon = MAKE_CMD_INFO( &argv[1] );
150 "%s: line %d: unknown directive \"%s\" in shell database definition (ignored)\n",
151 fname, lineno, argv[0] );