1 /* config.c - passwd backend configuration file routine */
2 /* $OpenLDAP$ */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
4  *
5  * Copyright 1998-2021 The OpenLDAP Foundation.
6  * All rights reserved.
7  *
8  * Redistribution and use in source and binary forms, with or without
9  * modification, are permitted only as authorized by the OpenLDAP
10  * Public License.
11  *
12  * A copy of this license is available in the file LICENSE in the
13  * top-level directory of the distribution or, alternatively, at
14  * <http://www.OpenLDAP.org/license.html>.
15  */
16 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
17  * All rights reserved.
18  *
19  * Redistribution and use in source and binary forms are permitted
20  * provided that this notice is preserved and that due credit is given
21  * to the University of Michigan at Ann Arbor. The name of the University
22  * may not be used to endorse or promote products derived from this
23  * software without specific prior written permission. This software
24  * is provided ``as is'' without express or implied warranty.
25  */
26 /* ACKNOWLEDGEMENTS:
27  * This work was originally developed by the University of Michigan
28  * (as part of U-MICH LDAP).
29  */
30 
31 #include "portable.h"
32 
33 #include <stdio.h>
34 
35 #include <ac/socket.h>
36 #include <ac/string.h>
37 #include <ac/time.h>
38 
39 #include "slap.h"
40 #include "back-passwd.h"
41 #include "slap-config.h"
42 
43 static ConfigTable passwdcfg[] = {
44 	{ "file", "filename", 2, 2, 0,
45 #ifdef HAVE_SETPWFILE
46 		ARG_STRING|ARG_OFFSET, NULL,
47 #else
48 		ARG_IGNORED, NULL,
49 #endif
50 		"( OLcfgDbAt:9.1 NAME 'olcPasswdFile' "
51 			"DESC 'File containing passwd records' "
52 			"EQUALITY caseExactMatch "
53 			"SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
54 	{ NULL, NULL, 0, 0, 0, ARG_IGNORED,
55 		NULL, NULL, NULL, NULL }
56 };
57 
58 static ConfigOCs passwdocs[] = {
59 	{ "( OLcfgDbOc:9.1 "
60 			"NAME 'olcPasswdConfig' "
61 			"DESC 'Passwd backend configuration' "
62 			"SUP olcDatabaseConfig "
63 			"MAY olcPasswdFile )",
64 			Cft_Database, passwdcfg },
65 	{ NULL, 0, NULL }
66 };
67 
68 int
passwd_back_init_cf(BackendInfo * bi)69 passwd_back_init_cf( BackendInfo *bi )
70 {
71 	bi->bi_cf_ocs = passwdocs;
72 	return config_register_schema( passwdcfg, passwdocs );
73 }
74