]> git.sur5r.net Git - openldap/blob - servers/slapd/back-shell/config.c
Add reference to slapd.conf(5) and recommendation to avoid cleartext passwords.
[openldap] / servers / slapd / back-shell / config.c
1 /* config.c - shell backend configuration file routine */
2
3 #include "portable.h"
4
5 #include <stdio.h>
6
7 #include <ac/string.h>
8 #include <ac/socket.h>
9
10 #include "slap.h"
11 #include "shell.h"
12
13 void
14 shell_back_config(
15     Backend     *be,
16     char        *fname,
17     int         lineno,
18     int         argc,
19     char        **argv
20 )
21 {
22         struct shellinfo        *si = (struct shellinfo *) be->be_private;
23
24         if ( si == NULL ) {
25                 fprintf( stderr, "%s: line %d: shell backend info is null!\n",
26                     fname, lineno );
27                 exit( 1 );
28         }
29
30         /* command + args to exec for binds */
31         if ( strcasecmp( argv[0], "bind" ) == 0 ) {
32                 if ( argc < 2 ) {
33                         fprintf( stderr,
34         "%s: line %d: missing executable in \"bind <executable>\" line\n",
35                             fname, lineno );
36                         exit( 1 );
37                 }
38                 si->si_bind = charray_dup( &argv[1] );
39
40         /* command + args to exec for unbinds */
41         } else if ( strcasecmp( argv[0], "unbind" ) == 0 ) {
42                 if ( argc < 2 ) {
43                         fprintf( stderr,
44         "%s: line %d: missing executable in \"unbind <executable>\" line\n",
45                             fname, lineno );
46                         exit( 1 );
47                 }
48                 si->si_unbind = charray_dup( &argv[1] );
49
50         /* command + args to exec for searches */
51         } else if ( strcasecmp( argv[0], "search" ) == 0 ) {
52                 if ( argc < 2 ) {
53                         fprintf( stderr,
54         "%s: line %d: missing executable in \"search <executable>\" line\n",
55                             fname, lineno );
56                         exit( 1 );
57                 }
58                 si->si_search = charray_dup( &argv[1] );
59
60         /* command + args to exec for compares */
61         } else if ( strcasecmp( argv[0], "compare" ) == 0 ) {
62                 if ( argc < 2 ) {
63                         fprintf( stderr,
64         "%s: line %d: missing executable in \"compare <executable>\" line\n",
65                             fname, lineno );
66                         exit( 1 );
67                 }
68                 si->si_compare = charray_dup( &argv[1] );
69
70         /* command + args to exec for modifies */
71         } else if ( strcasecmp( argv[0], "modify" ) == 0 ) {
72                 if ( argc < 2 ) {
73                         fprintf( stderr,
74         "%s: line %d: missing executable in \"modify <executable>\" line\n",
75                             fname, lineno );
76                         exit( 1 );
77                 }
78                 si->si_modify = charray_dup( &argv[1] );
79
80         /* command + args to exec for modrdn */
81         } else if ( strcasecmp( argv[0], "modrdn" ) == 0 ) {
82                 if ( argc < 2 ) {
83                         fprintf( stderr,
84         "%s: line %d: missing executable in \"modrdn <executable>\" line\n",
85                             fname, lineno );
86                         exit( 1 );
87                 }
88                 si->si_modrdn = charray_dup( &argv[1] );
89
90         /* command + args to exec for add */
91         } else if ( strcasecmp( argv[0], "add" ) == 0 ) {
92                 if ( argc < 2 ) {
93                         fprintf( stderr,
94         "%s: line %d: missing executable in \"add <executable>\" line\n",
95                             fname, lineno );
96                         exit( 1 );
97                 }
98                 si->si_add = charray_dup( &argv[1] );
99
100         /* command + args to exec for delete */
101         } else if ( strcasecmp( argv[0], "delete" ) == 0 ) {
102                 if ( argc < 2 ) {
103                         fprintf( stderr,
104         "%s: line %d: missing executable in \"delete <executable>\" line\n",
105                             fname, lineno );
106                         exit( 1 );
107                 }
108                 si->si_delete = charray_dup( &argv[1] );
109
110         /* command + args to exec for abandon */
111         } else if ( strcasecmp( argv[0], "abandon" ) == 0 ) {
112                 if ( argc < 2 ) {
113                         fprintf( stderr,
114         "%s: line %d: missing executable in \"abandon <executable>\" line\n",
115                             fname, lineno );
116                         exit( 1 );
117                 }
118                 si->si_abandon = charray_dup( &argv[1] );
119
120         /* anything else */
121         } else {
122                 fprintf( stderr,
123 "%s: line %d: unknown directive \"%s\" in shell database definition (ignored)\n",
124                     fname, lineno, argv[0] );
125         }
126 }