]> git.sur5r.net Git - openldap/blob - servers/slapd/back-dnssrv/bind.c
Rework referral entry point with DNS SRV implementation (needs testing).
[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 {
31         Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind %s (%d)\n",
32                 dn == NULL ? "" : dn, 
33                 method, NULL );
34                 
35         if( method == LDAP_AUTH_SIMPLE && cred != NULL && cred->bv_len ) {
36                 Statslog( LDAP_DEBUG_STATS,
37                         "conn=%ld op=%d DNSSRV BIND dn=\"%s\" provided passwd\n",
38                          op->o_connid, op->o_opid,
39                         dn == NULL ? "" : dn , 0, 0 );
40
41                 Debug( LDAP_DEBUG_TRACE,
42                         "DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
43                         dn == NULL ? "" : dn, 0, 0 );
44
45                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
46                         NULL, "you shouldn\'t send strangers your password",
47                         NULL, NULL );
48
49         } else {
50                 Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
51                         dn == NULL ? "" : dn, 0, 0 );
52
53                 send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
54                         NULL, "anonymous bind expected",
55                         NULL, NULL );
56         }
57
58         return 1;
59 }