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