httpd-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bnicho...@apache.org
Subject cvs commit: httpd-2.0/modules/experimental util_ldap.c
Date Mon, 12 Apr 2004 21:17:43 GMT
bnicholes    2004/04/12 14:17:43

  Modified:    .        Tag: APACHE_2_0_BRANCH STATUS
               modules/experimental Tag: APACHE_2_0_BRANCH util_ldap.c
  Log:
  Stop locking all of the connections while trying to find an available connection that meets
the specified criteria.  If a connection doesn't meet the criteria, unlock it so that it remains
available for other requests.
  
  Reviewed by: bnicholes, minfrin, trawick
  
  Revision  Changes    Path
  No                   revision
  No                   revision
  1.751.2.813 +1 -11     httpd-2.0/STATUS
  
  Index: STATUS
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/STATUS,v
  retrieving revision 1.751.2.812
  retrieving revision 1.751.2.813
  diff -u -r1.751.2.812 -r1.751.2.813
  --- STATUS	12 Apr 2004 17:38:39 -0000	1.751.2.812
  +++ STATUS	12 Apr 2004 21:17:42 -0000	1.751.2.813
  @@ -144,16 +144,6 @@
            modules/experimental/mod_auth_ldap.c: r1.22
          +1: bnicholes, minfrin, trawick
          
  -    *) util_ldap_connection_find() locks each cached connection while 
  -       testing to see if it matches the specified criteria.  But then 
  -       it forgets to unlock the connection if it doesn't match. This 
  -       results in all of the connections eventually being locked and 
  -       mod_ldap having to create additional connections to handle new
  -       requests. This patch unlocks the connection if it doesn't meet
  -       the connection criteria.
  -         modules/experimental/util_ldap.c: r1.23
  -       +1: bnicholes, minfrin, trawick
  -       
       *) Update the ldc->binddn and ldc->bindpw associated with the LDAP 
          connection to match the authenticating user DN and password after
          ldap_simple_bind_s() is called to authenticate the user.  Otherwise 
  
  
  
  No                   revision
  No                   revision
  1.6.2.12  +26 -18    httpd-2.0/modules/experimental/util_ldap.c
  
  Index: util_ldap.c
  ===================================================================
  RCS file: /home/cvs/httpd-2.0/modules/experimental/util_ldap.c,v
  retrieving revision 1.6.2.11
  retrieving revision 1.6.2.12
  diff -u -r1.6.2.11 -r1.6.2.12
  --- util_ldap.c	11 Feb 2004 18:07:46 -0000	1.6.2.11
  +++ util_ldap.c	12 Apr 2004 21:17:42 -0000	1.6.2.12
  @@ -362,18 +362,22 @@
        */
       for (l=st->connections,p=NULL; l; l=l->next) {
   #if APR_HAS_THREADS
  -        if ( (APR_SUCCESS == apr_thread_mutex_trylock(l->lock)) &&
  -#else
  -        if (
  +        if (APR_SUCCESS == apr_thread_mutex_trylock(l->lock)) {
   #endif
  -            l->port == port
  -	    && strcmp(l->host, host) == 0
  -	    && ( (!l->binddn && !binddn) || (l->binddn && binddn
&& !strcmp(l->binddn, binddn)) )
  -	    && ( (!l->bindpw && !bindpw) || (l->bindpw && bindpw
&& !strcmp(l->bindpw, bindpw)) )
  -            && l->deref == deref
  -            && l->secure == secure 
  -            )
  +        if ((l->port == port) && (strcmp(l->host, host) == 0) &&

  +            ((!l->binddn && !binddn) || (l->binddn && binddn &&
!strcmp(l->binddn, binddn))) && 
  +            ((!l->bindpw && !bindpw) || (l->bindpw && bindpw &&
!strcmp(l->bindpw, bindpw))) && 
  +            (l->deref == deref) && (l->secure == secure)) {
  +
               break;
  +        }
  +#if APR_HAS_THREADS
  +            /* If this connection didn't match the criteria, then we
  +             * need to unlock the mutex so it is available to be reused.
  +             */
  +            apr_thread_mutex_unlock(l->lock);
  +        }
  +#endif
           p = l;
       }
   
  @@ -383,21 +387,25 @@
       if (!l) {
           for (l=st->connections,p=NULL; l; l=l->next) {
   #if APR_HAS_THREADS
  -            if ( (APR_SUCCESS == apr_thread_mutex_trylock(l->lock)) &&
  -#else
  -            if (
  +            if (APR_SUCCESS == apr_thread_mutex_trylock(l->lock)) {
  +
   #endif
  -                l->port == port
  -	        && strcmp(l->host, host) == 0
  -                && l->deref == deref
  -                && l->secure == secure
  -                ) {
  +            if ((l->port == port) && (strcmp(l->host, host) == 0) &&

  +                (l->deref == deref) && (l->secure == secure)) {
  +
                   /* the bind credentials have changed */
                   l->bound = 0;
                   l->binddn = apr_pstrdup(st->pool, binddn);
                   l->bindpw = apr_pstrdup(st->pool, bindpw);
                   break;
               }
  +#if APR_HAS_THREADS
  +                /* If this connection didn't match the criteria, then we
  +                 * need to unlock the mutex so it is available to be reused.
  +                 */
  +                apr_thread_mutex_unlock(l->lock);
  +            }
  +#endif
               p = l;
           }
       }
  
  
  

Mime
View raw message