]> git.sur5r.net Git - openldap/blob - servers/slapd/back-passwd/config.c
Fix access_allowed() error checking bug
[openldap] / servers / slapd / back-passwd / config.c
1 /* config.c - passwd backend configuration file routine */
2 /* $OpenLDAP$ */
3
4 #include "portable.h"
5
6 #include <stdio.h>
7
8 #include <ac/socket.h>
9 #include <ac/string.h>
10 #include <ac/time.h>
11
12 #include "slap.h"
13 #include "external.h"
14
15 int
16 passwd_back_db_config(
17     BackendDB   *be,
18     const char  *fname,
19     int         lineno,
20     int         argc,
21     char        **argv
22 )
23 {
24         /* alternate passwd file */
25         if ( strcasecmp( argv[0], "file" ) == 0 ) {
26 #ifdef HAVE_SETPWFILE
27                 if ( argc < 2 ) {
28                         fprintf( stderr,
29                 "%s: line %d: missing filename in \"file <filename>\" line\n",
30                             fname, lineno );
31                         return( 1 );
32                 }
33                 be->be_private = ch_strdup( argv[1] );
34 #else /* HAVE_SETPWFILE */
35                 fprintf( stderr,
36     "%s: line %d: ignoring \"file\" option (not supported on this platform)\n",
37                             fname, lineno );
38 #endif /* HAVE_SETPWFILE */
39
40         /* anything else */
41         } else {
42                 fprintf( stderr,
43 "%s: line %d: unknown directive \"%s\" in passwd database definition (ignored)\n",
44                     fname, lineno, argv[0] );
45         }
46
47         return( 0 );
48 }