]> git.sur5r.net Git - openldap/blob - servers/slapd/back-dnssrv/bind.c
Fixup bdb_entry_release now that entry_decode uses two memory blocks
[openldap] / servers / slapd / back-dnssrv / bind.c
1 /* bind.c - DNS SRV backend bind function */
2 /* $OpenLDAP$ */
3 /*
4  * Copyright 2000 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     Backend             *be,
22     Connection          *conn,
23     Operation           *op,
24     const char          *dn,
25     const char          *ndn,
26     int                 method,
27     struct berval       *cred,
28         char            **edn )
29 {
30         Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind %s (%d)\n",
31                 dn == NULL ? "" : dn, 
32                 method, NULL );
33                 
34         if( method == LDAP_AUTH_SIMPLE && cred != NULL && cred->bv_len ) {
35                 Statslog( LDAP_DEBUG_STATS,
36                         "conn=%ld op=%d DNSSRV BIND dn=\"%s\" provided passwd\n",
37                          op->o_connid, op->o_opid,
38                         dn == NULL ? "" : dn , 0, 0 );
39
40                 Debug( LDAP_DEBUG_TRACE,
41                         "DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
42                         dn == NULL ? "" : dn, 0, 0 );
43
44                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
45                         NULL, "you shouldn\'t send strangers your password",
46                         NULL, NULL );
47
48         } else {
49                 Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
50                         dn == NULL ? "" : dn, 0, 0 );
51
52                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
53                         NULL, "anonymous bind expected",
54                         NULL, NULL );
55         }
56
57         return 1;
58 }