Back to index

openldap  2.4.31
init.c
Go to the documentation of this file.
00001 /* init.c - initialize shell backend */
00002 /* $OpenLDAP$ */
00003 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
00004  *
00005  * Copyright 1998-2012 The OpenLDAP Foundation.
00006  * All rights reserved.
00007  *
00008  * Redistribution and use in source and binary forms, with or without
00009  * modification, are permitted only as authorized by the OpenLDAP
00010  * Public License.
00011  *
00012  * A copy of this license is available in the file LICENSE in the
00013  * top-level directory of the distribution or, alternatively, at
00014  * <http://www.OpenLDAP.org/license.html>.
00015  */
00016 /* Portions Copyright (c) 1995 Regents of the University of Michigan.
00017  * All rights reserved.
00018  *
00019  * Redistribution and use in source and binary forms are permitted
00020  * provided that this notice is preserved and that due credit is given
00021  * to the University of Michigan at Ann Arbor. The name of the University
00022  * may not be used to endorse or promote products derived from this
00023  * software without specific prior written permission. This software
00024  * is provided ``as is'' without express or implied warranty.
00025  */
00026 /* ACKNOWLEDGEMENTS:
00027  * This work was originally developed by the University of Michigan
00028  * (as part of U-MICH LDAP).
00029  */
00030 
00031 #include "portable.h"
00032 
00033 #include <stdio.h>
00034 
00035 #include <ac/socket.h>
00036 
00037 #include "slap.h"
00038 
00039 #include "config.h"
00040 
00041 #include "shell.h"
00042 
00043 int
00044 shell_back_initialize(
00045     BackendInfo      *bi
00046 )
00047 {
00048        bi->bi_open = 0;
00049        bi->bi_config = 0;
00050        bi->bi_close = 0;
00051        bi->bi_destroy = 0;
00052 
00053        bi->bi_db_init = shell_back_db_init;
00054        bi->bi_db_config = 0;
00055        bi->bi_db_open = 0;
00056        bi->bi_db_close = 0;
00057        bi->bi_db_destroy = shell_back_db_destroy;
00058 
00059        bi->bi_op_bind = shell_back_bind;
00060        bi->bi_op_unbind = shell_back_unbind;
00061        bi->bi_op_search = shell_back_search;
00062        bi->bi_op_compare = shell_back_compare;
00063        bi->bi_op_modify = shell_back_modify;
00064        bi->bi_op_modrdn = shell_back_modrdn;
00065        bi->bi_op_add = shell_back_add;
00066        bi->bi_op_delete = shell_back_delete;
00067        bi->bi_op_abandon = 0;
00068 
00069        bi->bi_extended = 0;
00070 
00071        bi->bi_chk_referrals = 0;
00072 
00073        bi->bi_connection_init = 0;
00074        bi->bi_connection_destroy = 0;
00075 
00076        return shell_back_init_cf( bi );
00077 }
00078 
00079 int
00080 shell_back_db_init(
00081        Backend       *be,
00082        ConfigReply *cr
00083 )
00084 {
00085        struct shellinfo     *si;
00086 
00087        si = (struct shellinfo *) ch_calloc( 1, sizeof(struct shellinfo) );
00088 
00089        be->be_private = si;
00090        be->be_cf_ocs = be->bd_info->bi_cf_ocs;
00091 
00092        return si == NULL;
00093 }
00094 
00095 int
00096 shell_back_db_destroy(
00097        Backend       *be,
00098        ConfigReply *cr
00099 )
00100 {
00101        free( be->be_private );
00102        return 0;
00103 }
00104 
00105 #if SLAPD_SHELL == SLAPD_MOD_DYNAMIC
00106 
00107 /* conditionally define the init_module() function */
00108 SLAP_BACKEND_INIT_MODULE( shell )
00109 
00110 #endif /* SLAPD_SHELL == SLAPD_MOD_DYNAMIC */
00111