xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/unbind.c (revision bdc22b2e01993381dcefeff2bc9b56ca75a4235c)
1 /*	$NetBSD: unbind.c,v 1.1.1.6 2018/02/06 01:53:13 christos 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-2017 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 <sys/cdefs.h>
31 __RCSID("$NetBSD: unbind.c,v 1.1.1.6 2018/02/06 01:53:13 christos Exp $");
32 
33 #include "portable.h"
34 
35 #include <stdio.h>
36 
37 #include <ac/socket.h>
38 
39 #include "slap.h"
40 
41 int
42 do_unbind( Operation *op, SlapReply *rs )
43 {
44 	Debug( LDAP_DEBUG_TRACE, "%s do_unbind\n",
45 		op->o_log_prefix, 0, 0 );
46 
47 	/*
48 	 * Parse the unbind request.  It looks like this:
49 	 *
50 	 *	UnBindRequest ::= NULL
51 	 */
52 
53 	Statslog( LDAP_DEBUG_STATS, "%s UNBIND\n", op->o_log_prefix,
54 		0, 0, 0, 0 );
55 
56 	if ( frontendDB->be_unbind ) {
57 		op->o_bd = frontendDB;
58 		(void)frontendDB->be_unbind( op, rs );
59 		op->o_bd = NULL;
60 	}
61 
62 	/* pass the unbind to all backends */
63 	(void)backend_unbind( op, rs );
64 
65 	return 0;
66 }
67 
68