Changeset 09370c in indico
- Timestamp:
- 07/27/11 15:38:57 (22 months ago)
- Branches:
- master, burotel, hello-world-walkthrough, ipv6, v0.98-series, v0.98.2, v0.98.3, v0.98b1, v0.98b2, v0.99, 051b2622c51afb171a1dedb46a0df4fbb0cbd02e, 4c7d4152dff271ba5df5a8606605969cab454080
- Children:
- 6c9393
- Parents:
- 44d915
- Location:
- indico
- Files:
-
- 2 edited
-
MaKaC/RSSinterface/conference.py (modified) (1 diff)
-
htdocs/scripts/export.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
indico/MaKaC/RSSinterface/conference.py
r5e7b56 r09370c 28 28 from MaKaC.common.timezoneUtils import nowutc 29 29 import MaKaC.common.info as info 30 import struct, socket 30 31 31 32 33 # TOREMOVE 32 34 def ACLfiltered(iter, requestIP, aw=None): 33 35 36 def _inIPList(iplist, ip): 37 38 for rule in iplist: 39 if '/' in rule: 40 # it's a netmask (CIDR), check if ip belongs to it 41 # ipv4-specific, non-endian-safe check! 42 ipaddr = struct.unpack('L', socket.inet_aton(ip))[0] 43 netaddr, bits = rule.split('/') 44 netmask = struct.unpack('L', socket.inet_aton(netaddr))[0] & ((2L << int(bits) - 1) - 1) 45 if ipaddr & netmask == netmask: 46 return True 47 else: 48 if ip in iplist: 49 return True 50 return False 51 34 52 acl = Config.getInstance().getExportACL().iteritems() 35 blIds = list(categ for (categ, iplist) in acl if ( requestIP not in iplist))53 blIds = list(categ for (categ, iplist) in acl if (not _inIPList(iplist, requestIP))) 36 54 37 55 for conf in iter: -
indico/htdocs/scripts/export.py
rfcbd84 r09370c 48 48 minfo = info.HelperMaKaCInfo.getMaKaCInfoInstance() 49 49 50 hostIP = req.get_remote_ host()50 hostIP = req.get_remote_ip() 51 51 if minfo.useProxy(): 52 52 # if we're behind a proxy, use X-Forwarded-For 53 xff = req.headers_in.get("X-Forwarded-For", hostIP).split(", ")[-1] 54 hostIP = socket.gethostbyname(xff) 53 hostIP = req.headers_in.get("X-Forwarded-For", hostIP).split(", ")[-1] 55 54 56 55 if minfo.getRoomBookingModuleActive():
Note: See TracChangeset
for help on using the changeset viewer.
