xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/unbind.c (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: unbind.c,v 1.3 2021/08/14 16:14:58 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-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 /* 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.3 2021/08/14 16:14:58 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
do_unbind(Operation * op,SlapReply * rs)42 do_unbind( Operation *op, SlapReply *rs )
43 {
44 	Debug( LDAP_DEBUG_TRACE, "%s do_unbind\n",
45 		op->o_log_prefix );
46 
47 	/*
48 	 * Parse the unbind request.  It looks like this:
49 	 *
50 	 *	UnBindRequest ::= NULL
51 	 */
52 
53 	Debug( LDAP_DEBUG_STATS, "%s UNBIND\n", op->o_log_prefix );
54 
55 	if ( frontendDB->be_unbind ) {
56 		op->o_bd = frontendDB;
57 		(void)frontendDB->be_unbind( op, rs );
58 		op->o_bd = NULL;
59 	}
60 
61 	/* pass the unbind to all backends */
62 	(void)backend_unbind( op, rs );
63 
64 	return 0;
65 }
66 
67