From: Kurt Zeilenga Date: Thu, 21 Jan 1999 02:21:39 +0000 (+0000) Subject: Add c_protocol to slap_conn to track protocol version used by client. X-Git-Tag: OPENLDAP_SLAPD_BACK_LDAP~729 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=09421a74db344a7a5f985c5514a40b0d4e483c6a;p=openldap Add c_protocol to slap_conn to track protocol version used by client. Is initialized to 0 (unknown) and then set to 2 or 3 on bind. Should also be 0->3 if a special (or any) operation occurs before the bind. --- diff --git a/servers/slapd/bind.c b/servers/slapd/bind.c index aed9559ffa..b7b3aba388 100644 --- a/servers/slapd/bind.c +++ b/servers/slapd/bind.c @@ -135,6 +135,8 @@ do_bind( free( cred.bv_val ); } + conn->c_protocol = version; + send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL ); return; } @@ -152,6 +154,7 @@ do_bind( free( cred.bv_val ); } if ( cred.bv_len == 0 ) { + conn->c_protocol = version; send_ldap_result( conn, op, LDAP_SUCCESS, NULL, NULL ); } else if ( default_referral && *default_referral ) { @@ -173,6 +176,8 @@ do_bind( if ( (*be->be_bind)( be, conn, op, ndn, method, &cred, &edn ) == 0 ) { pthread_mutex_lock( &conn->c_dnmutex ); + conn->c_protocol = version; + if ( conn->c_cdn != NULL ) { free( conn->c_cdn ); } diff --git a/servers/slapd/result.c b/servers/slapd/result.c index 12e90a805b..af4498bc9f 100644 --- a/servers/slapd/result.c +++ b/servers/slapd/result.c @@ -455,6 +455,7 @@ close_connection( Connection *conn, int opconnid, int opid ) close( conn->c_sb.sb_sd ); conn->c_sb.sb_sd = -1; conn->c_version = 0; + conn->c_protocol = 0; } pthread_mutex_unlock( &new_conn_mutex ); } diff --git a/servers/slapd/slap.h b/servers/slapd/slap.h index 45dc212122..3be752ae24 100644 --- a/servers/slapd/slap.h +++ b/servers/slapd/slap.h @@ -319,6 +319,7 @@ typedef struct slap_conn { char *c_cdn; /* DN provided by the client */ char *c_dn; /* DN bound to this conn */ pthread_mutex_t c_dnmutex; /* mutex for c_dn field */ + int c_protocol; /* version of the LDAP protocol used by client */ int c_authtype; /* auth method used to bind c_dn */ #ifdef LDAP_COMPAT int c_version; /* for compatibility w/2.0, 3.0 */