Add bind handler which returns unwillingToPerform with

nasty message if password was provided.
This commit is contained in:
Kurt Zeilenga 2000-05-10 23:54:57 +00:00
parent 1dc3e3c408
commit cb8d9e16e9
4 changed files with 65 additions and 4 deletions

2
configure vendored
View file

@ -1,6 +1,6 @@
#! /bin/sh
# $OpenLDAP$
# from OpenLDAP: pkg/ldap/configure.in,v 1.298 2000/05/10 20:48:23 hyc Exp
# from OpenLDAP: pkg/ldap/configure.in,v 1.299 2000/05/10 21:30:54 kurt Exp
# Copyright 1998-2000 The OpenLDAP Foundation. All Rights Reserved.
#

View file

@ -10,9 +10,9 @@
# DNSSRV backend written by Kurt Zeilenga
##########################################################################
SRCS = init.c search.c config.c compare.c \
SRCS = init.c bind.c search.c config.c compare.c \
modify.c add.c modrdn.c delete.c request.c
OBJS = init.lo search.lo config.lo compare.lo \
OBJS = init.lo bind.lo search.lo config.lo compare.lo \
modify.lo add.lo modrdn.lo delete.lo request.lo
LDAP_INCDIR= ../../../include

View file

@ -0,0 +1,61 @@
/* bind.c - DNS SRV backend bind function */
/* $OpenLDAP$ */
/*
* Copyright 2000 The OpenLDAP Foundation, All Rights Reserved.
* COPYING RESTRICTIONS APPLY, see COPYRIGHT file
*/
#include "portable.h"
#include <stdio.h>
#include <ac/socket.h>
#include <ac/string.h>
#include "slap.h"
#include "back-dnssrv.h"
int
dnssrv_back_bind(
Backend *be,
Connection *conn,
Operation *op,
char *dn,
char *ndn,
int method,
char *mech,
struct berval *cred,
char **edn
)
{
Debug( LDAP_DEBUG_DEBUG, "DNSSRV: bind %s (%d/%s)\n",
dn == NULL ? "" : dn,
method,
mech == NULL ? "none" : mech );
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;
}

View file

@ -45,7 +45,7 @@ dnssrv_back_initialize(
bi->bi_db_close = 0;
bi->bi_db_destroy = dnssrv_back_db_destroy;
bi->bi_op_bind = 0;
bi->bi_op_bind = dnssrv_back_bind;
bi->bi_op_unbind = 0;
bi->bi_op_search = dnssrv_back_search;
bi->bi_op_compare = dnssrv_back_compare;