1/* $NetBSD: init.c,v 1.3 2021/08/14 16:15:01 christos Exp $ */ 2 3/* init.c - initialize sock backend */ 4/* $OpenLDAP$ */ 5/* This work is part of OpenLDAP Software <http://www.openldap.org/>. 6 * 7 * Copyright 2007-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/* ACKNOWLEDGEMENTS: 19 * This work was initially developed by Brian Candler for inclusion 20 * in OpenLDAP Software. 21 */ 22 23#include <sys/cdefs.h> 24__RCSID("$NetBSD: init.c,v 1.3 2021/08/14 16:15:01 christos Exp $"); 25 26#include "portable.h" 27 28#include <stdio.h> 29 30#include <ac/socket.h> 31 32#include "slap.h" 33#include "back-sock.h" 34 35int 36sock_back_initialize( 37 BackendInfo *bi 38) 39{ 40 bi->bi_open = 0; 41 bi->bi_config = 0; 42 bi->bi_close = 0; 43 bi->bi_destroy = 0; 44 45 bi->bi_db_init = sock_back_db_init; 46 bi->bi_db_config = 0; 47 bi->bi_db_open = 0; 48 bi->bi_db_close = 0; 49 bi->bi_db_destroy = sock_back_db_destroy; 50 51 bi->bi_op_bind = sock_back_bind; 52 bi->bi_op_unbind = sock_back_unbind; 53 bi->bi_op_search = sock_back_search; 54 bi->bi_op_compare = sock_back_compare; 55 bi->bi_op_modify = sock_back_modify; 56 bi->bi_op_modrdn = sock_back_modrdn; 57 bi->bi_op_add = sock_back_add; 58 bi->bi_op_delete = sock_back_delete; 59 bi->bi_op_abandon = 0; 60 61 bi->bi_extended = sock_back_extended; 62 63 bi->bi_chk_referrals = 0; 64 65 bi->bi_connection_init = 0; 66 bi->bi_connection_destroy = 0; 67 68 return sock_back_init_cf( bi ); 69} 70 71int 72sock_back_db_init( 73 Backend *be, 74 struct config_reply_s *cr 75) 76{ 77 struct sockinfo *si; 78 79 si = (struct sockinfo *) ch_calloc( 1, sizeof(struct sockinfo) ); 80 81 be->be_private = si; 82 be->be_cf_ocs = be->bd_info->bi_cf_ocs; 83 84 return si == NULL; 85} 86 87int 88sock_back_db_destroy( 89 Backend *be, 90 struct config_reply_s *cr 91) 92{ 93 free( be->be_private ); 94 return 0; 95} 96 97#if SLAPD_SOCK == SLAPD_MOD_DYNAMIC 98 99/* conditionally define the init_module() function */ 100SLAP_BACKEND_INIT_MODULE( sock ) 101 102#endif /* SLAPD_SOCK == SLAPD_MOD_DYNAMIC */ 103