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