Changeset 1535

Show
Ignore:
Timestamp:
11/10/06 22:57:09 (2 years ago)
Author:
mgood
Message:

AccountManagerPlugin:

disable registration if ignore_auth_case is true to prevent permission hijacking (fixes #831)

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • accountmanagerplugin/0.10/acct_mgr/web_ui.py

    r1502 r1535  
    227227    implements(INavigationContributor, IRequestHandler, ITemplateProvider) 
    228228 
     229    def __init__(self): 
     230        self._enable_check(log=True) 
     231 
     232    def _enable_check(self, log=False): 
     233        ignore_case = auth.LoginModule(self.env).ignore_case 
     234        if log and ignore_case: 
     235            self.log.warn('RegistrationModule is disabled because ' 
     236                          'ignore_auth_case is enabled in trac.ini.  ' 
     237                          'This setting needs disabled to support ' 
     238                          'registration.') 
     239        return not ignore_case 
     240 
    229241    #INavigationContributor methods 
    230242 
     
    233245 
    234246    def get_navigation_items(self, req): 
     247        if not self._enable_check(): 
     248            return 
    235249        if req.authname == 'anonymous': 
    236250            yield 'metanav', 'register', Markup('<a href="%s">Register</a>', 
     
    240254 
    241255    def match_request(self, req): 
    242         return req.path_info == '/register' 
     256        return req.path_info == '/register' and self._enable_check(log=True) 
    243257 
    244258    def process_request(self, req): 
  • accountmanagerplugin/0.9/acct_mgr/web_ui.py

    r1064 r1535  
    9595    implements(INavigationContributor, IRequestHandler, ITemplateProvider) 
    9696 
     97    def __init__(self): 
     98        self._enable_check(log=True) 
     99 
     100    def _enable_check(self, log=False): 
     101        ignore_case = auth.LoginModule(self.env).ignore_case 
     102        if log and ignore_case: 
     103            self.log.warn('RegistrationModule is disabled because ' 
     104                          'ignore_auth_case is enabled in trac.ini.  ' 
     105                          'This setting needs disabled to support ' 
     106                          'registration.') 
     107        return not ignore_case 
     108 
    97109    #INavigationContributor methods 
    98110 
     
    101113 
    102114    def get_navigation_items(self, req): 
     115        if not self._enable_check(): 
     116            return 
    103117        if req.authname == 'anonymous': 
    104118            yield 'metanav', 'register', Markup('<a href="%s">Register</a>', 
     
    108122 
    109123    def match_request(self, req): 
    110         return req.path_info == '/register' 
     124        return req.path_info == '/register' and self._enable_check(log=True) 
    111125 
    112126    def process_request(self, req): 
  • accountmanagerplugin/trunk/acct_mgr/web_ui.py

    r1534 r1535  
    244244 
    245245    def __init__(self): 
    246         self._write_check(log=True) 
    247  
    248     def _write_check(self, log=False): 
     246        self._enable_check(log=True) 
     247 
     248    def _enable_check(self, log=False): 
    249249        writable = AccountManager(self.env).supports('set_password') 
    250         if not writable and log: 
    251             self.log.warn('RegistrationModule is disabled because the password ' 
    252                           'store does not support writing.') 
    253         return writable 
     250        ignore_case = auth.LoginModule(self.env).ignore_case 
     251        if log: 
     252            if not writable: 
     253                self.log.warn('RegistrationModule is disabled because the ' 
     254                              'password store does not support writing.') 
     255            if ignore_case: 
     256                self.log.warn('RegistrationModule is disabled because ' 
     257                              'ignore_auth_case is enabled in trac.ini.  ' 
     258                              'This setting needs disabled to support ' 
     259                              'registration.') 
     260        return writable and not ignore_case 
    254261 
    255262    #INavigationContributor methods 
     
    259266 
    260267    def get_navigation_items(self, req): 
    261         if not self._write_check(): 
     268        if not self._enable_check(): 
    262269            return 
    263270        if req.authname == 'anonymous': 
     
    268275 
    269276    def match_request(self, req): 
    270         return req.path_info == '/register' and self._write_check(log=True) 
     277        return req.path_info == '/register' and self._enable_check(log=True) 
    271278 
    272279    def process_request(self, req):