xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-passwd/config.c (revision 6a493d6bc668897c91594964a732d38505b70cbb)
1 /*	$NetBSD: config.c,v 1.1.1.3 2010/12/12 15:23:20 adam Exp $	*/
2 
3 /* config.c - passwd backend configuration file routine */
4 /* OpenLDAP: pkg/ldap/servers/slapd/back-passwd/config.c,v 1.14.2.5 2010/04/13 20:23:36 kurt Exp */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 1998-2010 The OpenLDAP Foundation.
8  * All rights reserved.
9  *
10  * Redistribution and use in source and binary forms, with or without
11  * modification, are permitted only as authorized by the OpenLDAP
12  * Public License.
13  *
14  * A copy of this license is available in the file LICENSE in the
15  * top-level directory of the distribution or, alternatively, at
16  * <http://www.OpenLDAP.org/license.html>.
17  */
18 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
19  * All rights reserved.
20  *
21  * Redistribution and use in source and binary forms are permitted
22  * provided that this notice is preserved and that due credit is given
23  * to the University of Michigan at Ann Arbor. The name of the University
24  * may not be used to endorse or promote products derived from this
25  * software without specific prior written permission. This software
26  * is provided ``as is'' without express or implied warranty.
27  */
28 /* ACKNOWLEDGEMENTS:
29  * This work was originally developed by the University of Michigan
30  * (as part of U-MICH LDAP).
31  */
32 
33 #include "portable.h"
34 
35 #include <stdio.h>
36 
37 #include <ac/socket.h>
38 #include <ac/string.h>
39 #include <ac/time.h>
40 
41 #include "slap.h"
42 #include "back-passwd.h"
43 
44 int
45 passwd_back_db_config(
46     BackendDB	*be,
47     const char	*fname,
48     int		lineno,
49     int		argc,
50     char	**argv
51 )
52 {
53 	/* alternate passwd file */
54 	if ( strcasecmp( argv[0], "file" ) == 0 ) {
55 #ifdef HAVE_SETPWFILE
56 		if ( argc < 2 ) {
57 			fprintf( stderr,
58 		"%s: line %d: missing filename in \"file <filename>\" line\n",
59 			    fname, lineno );
60 			return( 1 );
61 		}
62 		be->be_private = ch_strdup( argv[1] );
63 #else /* HAVE_SETPWFILE */
64 		fprintf( stderr,
65     "%s: line %d: ignoring \"file\" option (not supported on this platform)\n",
66 			    fname, lineno );
67 #endif /* HAVE_SETPWFILE */
68 
69 	/* anything else */
70 	} else {
71 		return SLAP_CONF_UNKNOWN;
72 	}
73 
74 	return( 0 );
75 }
76