xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-passwd/config.c (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: config.c,v 1.3 2021/08/14 16:15:01 christos Exp $	*/
2 
3 /* config.c - passwd backend configuration file routine */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 1998-2021 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 <sys/cdefs.h>
34 __RCSID("$NetBSD: config.c,v 1.3 2021/08/14 16:15:01 christos Exp $");
35 
36 #include "portable.h"
37 
38 #include <stdio.h>
39 
40 #include <ac/socket.h>
41 #include <ac/string.h>
42 #include <ac/time.h>
43 
44 #include "slap.h"
45 #include "back-passwd.h"
46 #include "slap-config.h"
47 
48 static ConfigTable passwdcfg[] = {
49 	{ "file", "filename", 2, 2, 0,
50 #ifdef HAVE_SETPWFILE
51 		ARG_STRING|ARG_OFFSET, NULL,
52 #else
53 		ARG_IGNORED, NULL,
54 #endif
55 		"( OLcfgDbAt:9.1 NAME 'olcPasswdFile' "
56 			"DESC 'File containing passwd records' "
57 			"EQUALITY caseExactMatch "
58 			"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
59 	{ NULL, NULL, 0, 0, 0, ARG_IGNORED,
60 		NULL, NULL, NULL, NULL }
61 };
62 
63 static ConfigOCs passwdocs[] = {
64 	{ "( OLcfgDbOc:9.1 "
65 			"NAME 'olcPasswdConfig' "
66 			"DESC 'Passwd backend configuration' "
67 			"SUP olcDatabaseConfig "
68 			"MAY olcPasswdFile )",
69 			Cft_Database, passwdcfg },
70 	{ NULL, 0, NULL }
71 };
72 
73 int
passwd_back_init_cf(BackendInfo * bi)74 passwd_back_init_cf( BackendInfo *bi )
75 {
76 	bi->bi_cf_ocs = passwdocs;
77 	return config_register_schema( passwdcfg, passwdocs );
78 }
79