Parcourir la source

Ticket #508 - part 2 - lock-free access to FrontendConfig structure

https://fedorahosted.org/389/ticket/508
Reviewed by: mreynolds (Thanks!)
Branch: master
Fix Description: When computing the idletimeout, only check the config
anon_limits_dn if the connection c_dn is NULL.
Platforms tested: RHEL6 x86_64
Flag Day: no
Doc impact: no
Rich Megginson il y a 13 ans
Parent
commit
3d212a5472
1 fichiers modifiés avec 13 ajouts et 12 suppressions
  1. 13 12
      ldap/servers/slapd/daemon.c

+ 13 - 12
ldap/servers/slapd/daemon.c

@@ -1798,27 +1798,28 @@ compute_idletimeout( slapdFrontendConfig_t *fecfg, Connection *conn )
 		 * this is not an anonymous user and no bind-based limits are set,
 		 * use the default idle timeout.
 	 	 */
-		char *anon_dn = config_get_anon_limits_dn();
 
-		if ((conn->c_dn == NULL) && anon_dn && (strlen(anon_dn) > 0)) {
-			Slapi_DN *anon_sdn = slapi_sdn_new_dn_byref( anon_dn );
+		if (conn->c_dn == NULL) {
+			char *anon_dn = config_get_anon_limits_dn();
+			if (anon_dn && (strlen(anon_dn) > 0)) {
+				Slapi_DN *anon_sdn = slapi_sdn_new_dn_byref(anon_dn);
 
-			reslimit_update_from_dn( conn, anon_sdn );
+				reslimit_update_from_dn(conn, anon_sdn);
 
-			if ( slapi_reslimit_get_integer_limit( conn,
-			    idletimeout_reslimit_handle, &idletimeout ) !=
-			    SLAPI_RESLIMIT_STATUS_SUCCESS ) {
-				idletimeout = fecfg->idletimeout;
-			}
+				if (slapi_reslimit_get_integer_limit(conn, idletimeout_reslimit_handle,
+													 &idletimeout)
+					!= SLAPI_RESLIMIT_STATUS_SUCCESS) {
+					idletimeout = fecfg->idletimeout;
+				}
 
-			slapi_sdn_free( &anon_sdn );
+				slapi_sdn_free(&anon_sdn);
+			}
+			slapi_ch_free_string(&anon_dn);
 		} else if ( conn->c_isroot ) {
 			idletimeout = 0;	/* no limit for Directory Manager */
 		} else {
 			idletimeout = fecfg->idletimeout;
 		}
-
-		slapi_ch_free_string( &anon_dn );
 	}
 
 	return( idletimeout );