2000-05-11 07:54:57 +08:00
|
|
|
/* bind.c - DNS SRV backend bind function */
|
|
|
|
/* $OpenLDAP$ */
|
|
|
|
/*
|
2000-05-22 02:15:00 +08:00
|
|
|
* Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
|
2000-05-11 07:54:57 +08:00
|
|
|
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
|
|
#include "portable.h"
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
|
|
|
#include <ac/socket.h>
|
|
|
|
#include <ac/string.h>
|
|
|
|
|
|
|
|
#include "slap.h"
|
2000-06-16 11:50:02 +08:00
|
|
|
#include "external.h"
|
2000-05-11 07:54:57 +08:00
|
|
|
|
|
|
|
int
|
|
|
|
dnssrv_back_bind(
|
|
|
|
Backend *be,
|
|
|
|
Connection *conn,
|
|
|
|
Operation *op,
|
2000-05-22 11:46:57 +08:00
|
|
|
const char *dn,
|
|
|
|
const char *ndn,
|
2000-05-11 07:54:57 +08:00
|
|
|
int method,
|
|
|
|
struct berval *cred,
|
2000-06-16 14:42:34 +08:00
|
|
|
char **edn )
|
2000-05-11 07:54:57 +08:00
|
|
|
{
|
2000-05-22 11:46:57 +08:00
|
|
|
Debug( LDAP_DEBUG_TRACE, "DNSSRV: bind %s (%d)\n",
|
2000-05-11 07:54:57 +08:00
|
|
|
dn == NULL ? "" : dn,
|
2000-05-22 11:46:57 +08:00
|
|
|
method, NULL );
|
2000-05-11 07:54:57 +08:00
|
|
|
|
|
|
|
if( method == LDAP_AUTH_SIMPLE && cred != NULL && cred->bv_len ) {
|
|
|
|
Statslog( LDAP_DEBUG_STATS,
|
|
|
|
"conn=%ld op=%d DNSSRV BIND dn=\"%s\" provided passwd\n",
|
|
|
|
op->o_connid, op->o_opid,
|
|
|
|
dn == NULL ? "" : dn , 0, 0 );
|
|
|
|
|
|
|
|
Debug( LDAP_DEBUG_TRACE,
|
|
|
|
"DNSSRV: BIND dn=\"%s\" provided cleartext password\n",
|
|
|
|
dn == NULL ? "" : dn, 0, 0 );
|
|
|
|
|
|
|
|
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
|
|
|
|
NULL, "you shouldn\'t send strangers your password",
|
|
|
|
NULL, NULL );
|
|
|
|
|
|
|
|
} else {
|
|
|
|
Debug( LDAP_DEBUG_TRACE, "DNSSRV: BIND dn=\"%s\"\n",
|
|
|
|
dn == NULL ? "" : dn, 0, 0 );
|
|
|
|
|
|
|
|
send_ldap_result( conn, op, LDAP_UNWILLING_TO_PERFORM,
|
|
|
|
NULL, "anonymous bind expected",
|
|
|
|
NULL, NULL );
|
|
|
|
}
|
|
|
|
|
|
|
|
return 1;
|
|
|
|
}
|