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.
This commit is contained in:
Kurt Zeilenga 1999-01-21 02:21:39 +00:00
parent 7662b7ea7e
commit 09421a74db
3 changed files with 7 additions and 0 deletions

View file

@ -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 );
}

View file

@ -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 );
}

View file

@ -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 */