xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/unbind.c (revision b7b7574d3bf8eeb51a1fa3977b59142ec6434a55)
1 /*	$NetBSD: unbind.c,v 1.1.1.4 2014/05/28 09:58:48 tron Exp $	*/
2 
3 /* unbind.c - decode an ldap unbind operation and pass it to a backend db */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 1998-2014 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  */
29 
30 #include "portable.h"
31 
32 #include <stdio.h>
33 
34 #include <ac/socket.h>
35 
36 #include "slap.h"
37 
38 int
39 do_unbind( Operation *op, SlapReply *rs )
40 {
41 	Debug( LDAP_DEBUG_TRACE, "%s do_unbind\n",
42 		op->o_log_prefix, 0, 0 );
43 
44 	/*
45 	 * Parse the unbind request.  It looks like this:
46 	 *
47 	 *	UnBindRequest ::= NULL
48 	 */
49 
50 	Statslog( LDAP_DEBUG_STATS, "%s UNBIND\n", op->o_log_prefix,
51 		0, 0, 0, 0 );
52 
53 	if ( frontendDB->be_unbind ) {
54 		op->o_bd = frontendDB;
55 		(void)frontendDB->be_unbind( op, rs );
56 		op->o_bd = NULL;
57 	}
58 
59 	/* pass the unbind to all backends */
60 	(void)backend_unbind( op, rs );
61 
62 	return 0;
63 }
64 
65