]> git.sur5r.net Git - openldap/blob - servers/slapd/back-dnssrv/bind.c
Major API change - (SLAP_OP_BLOCKS) All request parameters are
[openldap] / servers / slapd / back-dnssrv / bind.c
1 /* bind.c - DNS SRV backend bind function */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 2000-2003 The OpenLDAP Foundation, All Rights Reserved.
5  * COPYING RESTRICTIONS APPLY, see COPYRIGHT file
6  */
7
8
9 #include "portable.h"
10
11 #include <stdio.h>
12
13 #include <ac/socket.h>
14 #include <ac/string.h>
15
16 #include "slap.h"
17 #include "external.h"
18
19 int
20 dnssrv_back_bind(
21     Operation           *op,
22     SlapReply           *rs )
23 {
24         Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind %s (%d)\n",
25                 op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val, 
26                 op->oq_bind.rb_method, NULL );
27                 
28         if( op->oq_bind.rb_method == LDAP_AUTH_SIMPLE && op->oq_bind.rb_cred.bv_val != NULL && op->oq_bind.rb_cred.bv_len ) {
29                 Statslog( LDAP_DEBUG_STATS,
30                         "conn=%lu op=%lu DNSSRV BIND dn=\"%s\" provided passwd\n",
31                          op->o_connid, op->o_opid,
32                         op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val , 0, 0 );
33
34                 Debug( LDAP_DEBUG_TRACE,
35                         "DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
36                         op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val, 0, 0 );
37
38                 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
39                         "you shouldn\'t send strangers your password" );
40
41         } else {
42                 Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
43                         op->o_req_dn.bv_val == NULL ? "" : op->o_req_dn.bv_val, 0, 0 );
44
45                 send_ldap_error( op, rs, LDAP_UNWILLING_TO_PERFORM,
46                         "anonymous bind expected" );
47         }
48
49         return 1;
50 }