1 /* config.c - sock backend configuration file routine */
3 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
5 * Copyright 2007-2011 The OpenLDAP Foundation.
8 * Redistribution and use in source and binary forms, with or without
9 * modification, are permitted only as authorized by the OpenLDAP
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>.
17 * This work was initially developed by Brian Candler for inclusion
18 * in OpenLDAP Software. Dynamic config support by Howard Chu.
25 #include <ac/string.h>
26 #include <ac/socket.h>
30 #include "back-sock.h"
32 static ConfigDriver bs_cf_gen;
38 static ConfigTable bscfg[] = {
39 { "socketpath", "pathname", 2, 2, 0, ARG_STRING|ARG_OFFSET,
40 (void *)offsetof(struct sockinfo, si_sockpath),
41 "( OLcfgDbAt:7.1 NAME 'olcDbSocketPath' "
42 "DESC 'Pathname for Unix domain socket' "
43 "EQUALITY caseExactMatch "
44 "SYNTAX OMsDirectoryString SINGLE-VALUE )", NULL, NULL },
45 { "extensions", "ext", 2, 0, 0, ARG_MAGIC|BS_EXT,
46 bs_cf_gen, "( OLcfgDbAt:7.2 NAME 'olcDbSocketExtensions' "
47 "DESC 'binddn, peername, or ssf' "
48 "EQUALITY caseIgnoreMatch "
49 "SYNTAX OMsDirectoryString )", NULL, NULL },
53 static ConfigOCs bsocs[] = {
55 "NAME 'olcDbSocketConfig' "
56 "DESC 'Socket backend configuration' "
57 "SUP olcDatabaseConfig "
58 "MUST olcDbSocketPath "
59 "MAY olcDbSocketExtensions )",
60 Cft_Database, bscfg },
64 static slap_verbmasks bs_exts[] = {
65 { BER_BVC("binddn"), SOCK_EXT_BINDDN },
66 { BER_BVC("peername"), SOCK_EXT_PEERNAME },
67 { BER_BVC("ssf"), SOCK_EXT_SSF },
72 bs_cf_gen( ConfigArgs *c )
74 struct sockinfo *si = c->be->be_private;
77 if ( c->op == SLAP_CONFIG_EMIT ) {
80 return mask_to_verbs( bs_exts, si->si_extensions, &c->rvalue_vals );
82 } else if ( c->op == LDAP_MOD_DELETE ) {
86 si->si_extensions = 0;
90 rc = verbs_to_mask( c->argc, c->argv, bs_exts, &dels );
92 si->si_extensions ^= dels;
100 return verbs_to_mask( c->argc, c->argv, bs_exts, &si->si_extensions );
107 sock_back_init_cf( BackendInfo *bi )
109 bi->bi_cf_ocs = bsocs;
111 return config_register_schema( bscfg, bsocs );