ldap/servers/slapd/bind.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
New commits:
commit 088dbaf22712a2b5422d87a4715ede5d0b6c14ac
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 3 15:42:01 2013 -0400
Ticket 580 - Wrong error code return when using EXTERNAL SASL and no client certificate
Bug Description: When doing a SASL EXTERNAL bind, and no client certificate is provided,
the bind succeeds(as anonymous). However, the bind should fail with
an error 48.
Fix Description: Check for the missing client certificate and return the appropriate
error.
https://fedorahosted.org/389/ticket/580
Reviewed by: Noriko(Thanks!)
(cherry picked from commit 2a81336e582c68fe0326a76a2f156b469688cc9b)
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index d4d3b49..e92add5 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -403,10 +403,12 @@ do_bind( Slapi_PBlock *pb )
supported = slapi_get_supported_saslmechanisms_copy();
if ( (pmech = supported) != NULL ) while (1) {
if (*pmech == NULL) {
- /* As we call the safe function, we receive a strdup'd saslmechanisms
- charray. Therefore, we need to remove it instead of NULLing it */
- charray_free(supported);
- pmech = supported = NULL;
+ /*
+ * As we call the safe function, we receive a strdup'd saslmechanisms
+ * charray. Therefore, we need to remove it instead of NULLing it
+ */
+ charray_free(supported);
+ pmech = supported = NULL;
break;
}
if (!strcasecmp (saslmech, *pmech)) break;
@@ -450,11 +452,21 @@ do_bind( Slapi_PBlock *pb )
}
/*
+ * Check for the client certificate.
+ */
+ if( NULL == pb->pb_conn->c_client_cert){
+ send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
+ "missing client certificate", 0, NULL );
+ /* call postop plugins */
+ plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
+ goto free_and_return;
+ }
+
+ /*
* if the client sent us a certificate but we could not map it
* to an LDAP DN, fail and return an invalidCredentials error.
*/
- if ( NULL != pb->pb_conn->c_client_cert &&
- NULL == pb->pb_conn->c_external_dn ) {
+ if ( NULL == pb->pb_conn->c_external_dn ) {
send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
"client certificate mapping failed", 0, NULL );
/* call postop plugins */
@@ -463,7 +475,7 @@ do_bind( Slapi_PBlock *pb )
}
if (!isroot ) {
- /* check if the account is locked */
+ /* check if the account is locked */
bind_target_entry = get_entry(pb, pb->pb_conn->c_external_dn);
if ( bind_target_entry != NULL && slapi_check_account_lock(pb, bind_target_entry,
pw_response_requested, 1 /*check password policy*/, 1 /*send ldap result*/) == 1) {
ldap/servers/slapd/bind.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
New commits:
commit 47a8402cf826fd3ecd7b6f05e0e0691ffae62ccc
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 3 15:42:01 2013 -0400
Ticket 580 - Wrong error code return when using EXTERNAL SASL and no client certificate
Bug Description: When doing a SASL EXTERNAL bind, and no client certificate is provided,
the bind succeeds(as anonymous). However, the bind should fail with
an error 48.
Fix Description: Check for the missing client certificate and return the appropriate
error.
https://fedorahosted.org/389/ticket/580
Reviewed by: Noriko(Thanks!)
(cherry picked from commit 2a81336e582c68fe0326a76a2f156b469688cc9b)
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index d4d3b49..e92add5 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -403,10 +403,12 @@ do_bind( Slapi_PBlock *pb )
supported = slapi_get_supported_saslmechanisms_copy();
if ( (pmech = supported) != NULL ) while (1) {
if (*pmech == NULL) {
- /* As we call the safe function, we receive a strdup'd saslmechanisms
- charray. Therefore, we need to remove it instead of NULLing it */
- charray_free(supported);
- pmech = supported = NULL;
+ /*
+ * As we call the safe function, we receive a strdup'd saslmechanisms
+ * charray. Therefore, we need to remove it instead of NULLing it
+ */
+ charray_free(supported);
+ pmech = supported = NULL;
break;
}
if (!strcasecmp (saslmech, *pmech)) break;
@@ -450,11 +452,21 @@ do_bind( Slapi_PBlock *pb )
}
/*
+ * Check for the client certificate.
+ */
+ if( NULL == pb->pb_conn->c_client_cert){
+ send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
+ "missing client certificate", 0, NULL );
+ /* call postop plugins */
+ plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
+ goto free_and_return;
+ }
+
+ /*
* if the client sent us a certificate but we could not map it
* to an LDAP DN, fail and return an invalidCredentials error.
*/
- if ( NULL != pb->pb_conn->c_client_cert &&
- NULL == pb->pb_conn->c_external_dn ) {
+ if ( NULL == pb->pb_conn->c_external_dn ) {
send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
"client certificate mapping failed", 0, NULL );
/* call postop plugins */
@@ -463,7 +475,7 @@ do_bind( Slapi_PBlock *pb )
}
if (!isroot ) {
- /* check if the account is locked */
+ /* check if the account is locked */
bind_target_entry = get_entry(pb, pb->pb_conn->c_external_dn);
if ( bind_target_entry != NULL && slapi_check_account_lock(pb, bind_target_entry,
pw_response_requested, 1 /*check password policy*/, 1 /*send ldap result*/) == 1) {
ldap/servers/slapd/bind.c | 26 +++++++++++++++++++-------
1 file changed, 19 insertions(+), 7 deletions(-)
New commits:
commit 9bea04c9578f0e1fc48bc2b316b1daf1cf384d42
Author: Mark Reynolds <mreynolds(a)redhat.com>
Date: Fri May 3 15:42:01 2013 -0400
Ticket 580 - Wrong error code return when using EXTERNAL SASL and no client certificate
Bug Description: When doing a SASL EXTERNAL bind, and no client certificate is provided,
the bind succeeds(as anonymous). However, the bind should fail with
an error 48.
Fix Description: Check for the missing client certificate and return the appropriate
error.
https://fedorahosted.org/389/ticket/580
Reviewed by: Noriko(Thanks!)
(cherry picked from commit 2a81336e582c68fe0326a76a2f156b469688cc9b)
diff --git a/ldap/servers/slapd/bind.c b/ldap/servers/slapd/bind.c
index d4d3b49..e92add5 100644
--- a/ldap/servers/slapd/bind.c
+++ b/ldap/servers/slapd/bind.c
@@ -403,10 +403,12 @@ do_bind( Slapi_PBlock *pb )
supported = slapi_get_supported_saslmechanisms_copy();
if ( (pmech = supported) != NULL ) while (1) {
if (*pmech == NULL) {
- /* As we call the safe function, we receive a strdup'd saslmechanisms
- charray. Therefore, we need to remove it instead of NULLing it */
- charray_free(supported);
- pmech = supported = NULL;
+ /*
+ * As we call the safe function, we receive a strdup'd saslmechanisms
+ * charray. Therefore, we need to remove it instead of NULLing it
+ */
+ charray_free(supported);
+ pmech = supported = NULL;
break;
}
if (!strcasecmp (saslmech, *pmech)) break;
@@ -450,11 +452,21 @@ do_bind( Slapi_PBlock *pb )
}
/*
+ * Check for the client certificate.
+ */
+ if( NULL == pb->pb_conn->c_client_cert){
+ send_ldap_result( pb, LDAP_INAPPROPRIATE_AUTH, NULL,
+ "missing client certificate", 0, NULL );
+ /* call postop plugins */
+ plugin_call_plugins( pb, SLAPI_PLUGIN_POST_BIND_FN );
+ goto free_and_return;
+ }
+
+ /*
* if the client sent us a certificate but we could not map it
* to an LDAP DN, fail and return an invalidCredentials error.
*/
- if ( NULL != pb->pb_conn->c_client_cert &&
- NULL == pb->pb_conn->c_external_dn ) {
+ if ( NULL == pb->pb_conn->c_external_dn ) {
send_ldap_result( pb, LDAP_INVALID_CREDENTIALS, NULL,
"client certificate mapping failed", 0, NULL );
/* call postop plugins */
@@ -463,7 +475,7 @@ do_bind( Slapi_PBlock *pb )
}
if (!isroot ) {
- /* check if the account is locked */
+ /* check if the account is locked */
bind_target_entry = get_entry(pb, pb->pb_conn->c_external_dn);
if ( bind_target_entry != NULL && slapi_check_account_lock(pb, bind_target_entry,
pw_response_requested, 1 /*check password policy*/, 1 /*send ldap result*/) == 1) {
ldap/servers/slapd/daemon.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
New commits:
commit d1754414bffca63ceec42812387e233c717fe14e
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Apr 24 20:36:37 2013 -0600
Ticket #47349 - DS instance crashes under a high load
https://fedorahosted.org/389/ticket/47349
Reviewed by: nkinder (Thanks!)
Branch: 389-ds-base-1.2.11
Fix Description: handle_new_connection initializes the connection object,
then calls connection_table_move_connection_on_to_active_list to put it
on the list of active connections, then unlocks the c_mutex, then calls
connection_new_private to allocate c_private. If another thread
interrupts after the conn has been moved to the active list, but before
c_private has been allocated, the new conn will be available via
connection_table_iterate_active_connections where table_iterate_function
will attempt to dereference the NULL c_private.
The fix is to move connection_new_private inside the c_mutex lock, and to
move connection_table_move_connection_on_to_active_list to be the very last
thing before releasing the c_mutex lock. Once the conn is on the active
list it is live and we cannot do anything else to it.
Note: I have still not been able to reproduce the problem in a non-debug
optimized build.
Platforms tested: RHEL6 x86_64
Note: Before patch, server would crash within 5 minutes. After patch, server
has been running for several days in customer environment.
Flag Day: no
Doc impact: no
(cherry picked from commit 05d209432571dc64b242ae47113ae4cbb43607d2)
(cherry picked from commit 11c0f99aaa2deead80bde7e35dd9f9aabac5cc20)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index de7f18c..3f3061c 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2694,16 +2694,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
/* Call the plugin extension constructors */
conn->c_extension = factory_create_extension(connection_type,conn,NULL /* Parent */);
-
- /* Add this connection slot to the doubly linked list of active connections. This
- * list is used to find the connections that should be used in the poll call. This
- * connection will be added directly after slot 0 which serves as the head of the list */
- if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL )
- {
- /* Now give the new connection to the connection code */
- connection_table_move_connection_on_to_active_list(the_connection_table,conn);
- }
-
#if defined(ENABLE_LDAPI)
#if !defined( XP_WIN32 )
/* ldapi */
@@ -2716,10 +2706,21 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
#endif
#endif /* ENABLE_LDAPI */
- PR_Unlock( conn->c_mutex );
-
connection_new_private(conn);
+ /* Add this connection slot to the doubly linked list of active connections. This
+ * list is used to find the connections that should be used in the poll call. This
+ * connection will be added directly after slot 0 which serves as the head of the list.
+ * This must be done as the very last thing before we unlock the mutex, because once it
+ * is added to the active list, it is live. */
+ if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL )
+ {
+ /* Now give the new connection to the connection code */
+ connection_table_move_connection_on_to_active_list(the_connection_table,conn);
+ }
+
+ PR_Unlock( conn->c_mutex );
+
g_increment_current_conn_count();
return 0;
ldap/servers/slapd/daemon.c | 25 +++++++++++++------------
1 file changed, 13 insertions(+), 12 deletions(-)
New commits:
commit 11c0f99aaa2deead80bde7e35dd9f9aabac5cc20
Author: Rich Megginson <rmeggins(a)redhat.com>
Date: Wed Apr 24 20:36:37 2013 -0600
Ticket #47349 - DS instance crashes under a high load
https://fedorahosted.org/389/ticket/47349
Reviewed by: nkinder (Thanks!)
Branch: 389-ds-base-1.3.0
Fix Description: handle_new_connection initializes the connection object,
then calls connection_table_move_connection_on_to_active_list to put it
on the list of active connections, then unlocks the c_mutex, then calls
connection_new_private to allocate c_private. If another thread
interrupts after the conn has been moved to the active list, but before
c_private has been allocated, the new conn will be available via
connection_table_iterate_active_connections where table_iterate_function
will attempt to dereference the NULL c_private.
The fix is to move connection_new_private inside the c_mutex lock, and to
move connection_table_move_connection_on_to_active_list to be the very last
thing before releasing the c_mutex lock. Once the conn is on the active
list it is live and we cannot do anything else to it.
Note: I have still not been able to reproduce the problem in a non-debug
optimized build.
Platforms tested: RHEL6 x86_64
Note: Before patch, server would crash within 5 minutes. After patch, server
has been running for several days in customer environment.
Flag Day: no
Doc impact: no
(cherry picked from commit 05d209432571dc64b242ae47113ae4cbb43607d2)
diff --git a/ldap/servers/slapd/daemon.c b/ldap/servers/slapd/daemon.c
index 1fd40f6..18ca091 100644
--- a/ldap/servers/slapd/daemon.c
+++ b/ldap/servers/slapd/daemon.c
@@ -2699,16 +2699,6 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
/* Call the plugin extension constructors */
conn->c_extension = factory_create_extension(connection_type,conn,NULL /* Parent */);
-
- /* Add this connection slot to the doubly linked list of active connections. This
- * list is used to find the connections that should be used in the poll call. This
- * connection will be added directly after slot 0 which serves as the head of the list */
- if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL )
- {
- /* Now give the new connection to the connection code */
- connection_table_move_connection_on_to_active_list(the_connection_table,conn);
- }
-
#if defined(ENABLE_LDAPI)
#if !defined( XP_WIN32 )
/* ldapi */
@@ -2721,10 +2711,21 @@ handle_new_connection(Connection_Table *ct, int tcps, PRFileDesc *pr_acceptfd, i
#endif
#endif /* ENABLE_LDAPI */
- PR_Unlock( conn->c_mutex );
-
connection_new_private(conn);
+ /* Add this connection slot to the doubly linked list of active connections. This
+ * list is used to find the connections that should be used in the poll call. This
+ * connection will be added directly after slot 0 which serves as the head of the list.
+ * This must be done as the very last thing before we unlock the mutex, because once it
+ * is added to the active list, it is live. */
+ if ( conn != NULL && conn->c_next == NULL && conn->c_prev == NULL )
+ {
+ /* Now give the new connection to the connection code */
+ connection_table_move_connection_on_to_active_list(the_connection_table,conn);
+ }
+
+ PR_Unlock( conn->c_mutex );
+
g_increment_current_conn_count();
return 0;