From 1ee85df297dfa0bea0854c674ef9b95640938fc8 Mon Sep 17 00:00:00 2001 From: Kurt Zeilenga Date: Tue, 29 Jun 1999 03:17:22 +0000 Subject: [PATCH] Add framework for sasl and controls. --- servers/slapd/back-ldbm/bind.c | 1 + servers/slapd/back-ldbm/external.h | 2 +- servers/slapd/bind.c | 2 +- servers/slapd/connection.c | 2 ++ servers/slapd/libslapd.dsp | 4 ---- servers/slapd/modrdn.c | 13 ++++++++----- servers/slapd/slap.h | 8 +++++++- 7 files changed, 20 insertions(+), 12 deletions(-) diff --git a/servers/slapd/back-ldbm/bind.c b/servers/slapd/back-ldbm/bind.c index 70d3d06d4a..97d88b921c 100644 --- a/servers/slapd/back-ldbm/bind.c +++ b/servers/slapd/back-ldbm/bind.c @@ -64,6 +64,7 @@ ldbm_back_bind( Operation *op, char *dn, int method, + char *mech, struct berval *cred, char** edn ) diff --git a/servers/slapd/back-ldbm/external.h b/servers/slapd/back-ldbm/external.h index 144b56c78e..6b674eef52 100644 --- a/servers/slapd/back-ldbm/external.h +++ b/servers/slapd/back-ldbm/external.h @@ -18,7 +18,7 @@ extern int ldbm_back_db_config LDAP_P(( BackendDB *bd, extern int ldbm_back_bind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op, - char *dn, int method, struct berval *cred, char** edn )); + char *dn, int method, char* mech, struct berval *cred, char** edn )); extern int ldbm_back_unbind LDAP_P(( BackendDB *bd, Connection *conn, Operation *op )); diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index 54759e8d16..ee532b1444 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -164,7 +164,7 @@ do_bind( ndn = suffixAlias( ndn, op, be ); - if ( (*be->be_bind)( be, conn, op, ndn, method, &cred, &edn ) == 0 ) { + if ( (*be->be_bind)( be, conn, op, ndn, method, NULL, &cred, &edn ) == 0 ) { ldap_pvt_thread_mutex_lock( &conn->c_mutex ); conn->c_protocol = version; diff --git a/servers/slapd/connection.c b/servers/slapd/connection.c index 4def5161be..7546d42e1e 100644 --- a/servers/slapd/connection.c +++ b/servers/slapd/connection.c @@ -898,6 +898,8 @@ static int connection_op_activate( Connection *conn, Operation *op ) arg->co_op->o_dn = ch_strdup( tmpdn != NULL ? tmpdn : "" ); arg->co_op->o_ndn = dn_normalize_case( ch_strdup( arg->co_op->o_dn ) ); + arg->co_op->o_protocol = conn->c_protocol; + slap_op_add( &conn->c_ops, arg->co_op ); if(tag == LDAP_REQ_BIND) { diff --git a/servers/slapd/libslapd.dsp b/servers/slapd/libslapd.dsp index f1b794db01..3c58616d44 100644 --- a/servers/slapd/libslapd.dsp +++ b/servers/slapd/libslapd.dsp @@ -224,10 +224,6 @@ SOURCE=.\monitor.c # End Source File # Begin Source File -SOURCE=.\nt_debug.c -# End Source File -# Begin Source File - SOURCE=.\operation.c # End Source File # Begin Source File diff --git a/servers/slapd/modrdn.c b/servers/slapd/modrdn.c index a38160f4f2..33a4bc35b7 100644 --- a/servers/slapd/modrdn.c +++ b/servers/slapd/modrdn.c @@ -76,13 +76,16 @@ do_modrdn( if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR ) { - if ( conn->c_protocol == 0 ) { + if ( op->o_protocol == 0 ) { /* * Promote to LDAPv3 */ + ldap_pvt_thread_mutex_lock( &conn->c_mutex ); conn->c_protocol = LDAP_VERSION3; + ldap_pvt_thread_mutex_unlock( &conn->c_mutex ); + op->o_protocol = LDAP_VERSION3; - } else if ( conn->c_protocol < LDAP_VERSION3 ) { + } else if ( op->o_protocol < LDAP_VERSION3 ) { /* Conection record indicates v2 but field * newSuperior is present: report error. */ @@ -103,7 +106,7 @@ do_modrdn( "" ); return; - }/* if ( ber_scanf( ber, { "a}", &newSuperior ) == ... ) */ + } Debug( LDAP_DEBUG_ARGS, "do_modrdn: newSuperior=(%s)\n", @@ -138,7 +141,7 @@ do_modrdn( } - }/* if ( ber_peek_tag( op->o_ber, &length ) == LDAP_TAG_NEWSUPERIOR )*/ + } dn_normalize_case( ndn ); @@ -180,7 +183,7 @@ do_modrdn( return; - }/* if ( (newSuperior_be != NULL) && ( be != newSuperior_be) ) */ + } /* alias suffix if approp */ diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index e34f4e38f3..c9b944fc09 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -427,7 +427,8 @@ struct backend_info { /* LDAP Operations Handling Routines */ int (*bi_op_bind) LDAP_P(( BackendDB *bd, struct slap_conn *c, struct slap_op *o, - char *dn, int method, struct berval *cred, char** edn )); + char *dn, int method, char* mechanism, + struct berval *cred, char** edn )); int (*bi_op_unbind) LDAP_P((BackendDB *bd, struct slap_conn *c, struct slap_op *o )); int (*bi_op_search) LDAP_P((BackendDB *bd, @@ -491,9 +492,13 @@ typedef struct slap_op { time_t o_time; /* time op was initiated */ char *o_dn; /* dn bound when op was initiated */ char *o_ndn; /* normalized dn bound when op was initiated */ + ber_int_t o_protocol; /* version of the LDAP protocol used by client */ ber_tag_t o_authtype; /* auth method used to bind dn */ /* values taken from ldap.h */ /* LDAP_AUTH_* */ + char *o_authmech; /* SASL mechanism used to bind dn */ + + LDAPControl **o_ctrls; /* controls */ /* long o_connid; *//* id of conn initiating this op */ @@ -533,6 +538,7 @@ typedef struct slap_conn { char *c_dn; /* DN bound to this conn */ ber_int_t c_protocol; /* version of the LDAP protocol used by client */ ber_tag_t c_authtype; /* auth method used to bind c_dn */ + char *c_authmech; /* SASL mechanism used to bind c_dn */ Operation *c_ops; /* list of operations being processed */ Operation *c_pending_ops; /* list of pending operations */ -- 2.39.5