Ticket #623 (closed defect: fixed)
[PATCH] identity.from_host and identity.from_any_hosts() broken?
|Reported by:||Joost||Owned by:||anonymous|
I know that IP based security is pretty bad but it is *really* convinient for small non-public tools that need to accept connections from other apps. Today I tried to use the identity.fom_host and identity.from_any_host predicates yet both seem to be broken. There aren't any testcases for these two predicates but I think this patch is ok. An attempt to add two additional testcases resulted in nothing but 404 errors though...
Index: conditions.py =================================================================== --- conditions.py (revision 841) +++ conditions.py (working copy) @@ -200,7 +200,7 @@ Match the visitor's host against the criteria. ''' ip = _remoteHost() - if _match_ip( host, ip ): + if _match_ip( self.host, ip ): return True self.append_error_message( errors ) return False @@ -214,7 +214,7 @@ error_message= "Access from this host is not permitted." def __init__(self, hosts): - host_predicates= [require_host(h) for h in hosts] + host_predicates= [from_host(h) for h in hosts] super(from_any_host,self).__init__( *host_predicates )