Changeset 818

Show
Ignore:
Timestamp:
11/07/2005 09:50:34 AM (3 years ago)
Author:
jan
Message:

added auto-reconnect to ldap (fixes #294), patch from joerg@…

Location:
branches/lighttpd-merge-1.4.x/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • branches/lighttpd-merge-1.4.x/src/http_auth.c

    r733 r818  
    4949}; 
    5050#endif 
     51 
     52handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s); 
    5153 
    5254static const char base64_pad = '='; 
     
    578580                 
    579581                /* 2. */ 
    580                 if (LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) { 
     582                if (p->conf.ldap == NULL || 
     583                    LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) { 
     584                        if (auth_ldap_init(srv, &p->conf) != HANDLER_GO_ON) 
     585                                return -1; 
     586                        if (LDAP_SUCCESS != (ret = ldap_search_s(p->conf.ldap, p->conf.auth_ldap_basedn->ptr, LDAP_SCOPE_SUBTREE, p->ldap_filter->ptr, attrs, 0, &lm))) { 
     587 
    581588                        log_error_write(srv, __FILE__, __LINE__, "sssb",  
    582589                                        "ldap:", ldap_err2string(ret), "filter:", p->ldap_filter); 
    583590                         
    584591                        return -1; 
     592                        } 
    585593                } 
    586594                 
  • branches/lighttpd-merge-1.4.x/src/mod_auth.c

    r687 r818  
    1212#include "log.h" 
    1313#include "response.h" 
     14 
     15handler_t auth_ldap_init(server *srv, mod_auth_plugin_config *s); 
    1416 
    1517 
     
    506508                        } 
    507509                        break; 
    508                 case AUTH_BACKEND_LDAP:  
     510                case AUTH_BACKEND_LDAP: { 
     511                        handler_t ret = auth_ldap_init(srv, s); 
     512                        if (ret == HANDLER_ERROR) 
     513                                return (ret); 
     514                        break; 
     515                } 
     516                default: 
     517                        break; 
     518                } 
     519        } 
     520 
     521        return HANDLER_GO_ON; 
     522} 
     523 
     524handler_t 
     525auth_ldap_init(server *srv, mod_auth_plugin_config *s) 
     526{ 
    509527#ifdef USE_LDAP 
     528                        int ret; 
    510529#if 0                    
    511530                        if (s->auth_ldap_basedn->used == 0) { 
     
    587606                        return HANDLER_ERROR; 
    588607#endif 
    589                         break; 
    590                 default: 
    591                         break; 
    592                 } 
    593         } 
    594          
    595         return HANDLER_GO_ON; 
     608                return HANDLER_GO_ON; 
    596609} 
    597610