xref: /netbsd-src/external/bsd/openldap/dist/servers/slapd/back-monitor/bind.c (revision 549b59ed3ccf0d36d3097190a0db27b770f3a839)
1 /*	$NetBSD: bind.c,v 1.3 2021/08/14 16:15:00 christos Exp $	*/
2 
3 /* bind.c - monitor backend bind routine */
4 /* $OpenLDAP$ */
5 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
6  *
7  * Copyright 2001-2021 The OpenLDAP Foundation.
8  * Portions Copyright 2001-2003 Pierangelo Masarati.
9  * All rights reserved.
10  *
11  * Redistribution and use in source and binary forms, with or without
12  * modification, are permitted only as authorized by the OpenLDAP
13  * Public License.
14  *
15  * A copy of this license is available in file LICENSE in the
16  * top-level directory of the distribution or, alternatively, at
17  * <http://www.OpenLDAP.org/license.html>.
18  */
19 /* ACKNOWLEDGEMENTS:
20  * This work was initially developed by Pierangelo Masarati for inclusion
21  * in OpenLDAP Software.
22  */
23 
24 #include <sys/cdefs.h>
25 __RCSID("$NetBSD: bind.c,v 1.3 2021/08/14 16:15:00 christos Exp $");
26 
27 #include "portable.h"
28 
29 #include <stdio.h>
30 
31 #include <slap.h>
32 #include "back-monitor.h"
33 
34 /*
35  * At present, only rootdn can bind with simple bind
36  */
37 
38 int
monitor_back_bind(Operation * op,SlapReply * rs)39 monitor_back_bind( Operation *op, SlapReply *rs )
40 {
41 	Debug(LDAP_DEBUG_ARGS, "==> monitor_back_bind: dn: %s\n",
42 			op->o_req_dn.bv_val );
43 
44 	if ( be_isroot_pw( op ) ) {
45 		return LDAP_SUCCESS;
46 	}
47 
48 	rs->sr_err = LDAP_INVALID_CREDENTIALS;
49 	send_ldap_result( op, rs );
50 
51 	return rs->sr_err;
52 }
53 
54