Changeset 1741 for trunk/server/common/oursrc
- Timestamp:
- Nov 22, 2010, 5:59:19 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/server/common/oursrc/whoisd/whoisd.tac
r772 r1741 65 65 # return vhost + ".mit.edu" 66 66 def searchLDAP(self, vhost): 67 results = self.ldap.search_s (self.ldap_base, ldap.SCOPE_SUBTREE,67 results = self.ldap.search_st(self.ldap_base, ldap.SCOPE_SUBTREE, 68 68 ldap.filter.filter_format( 69 '(|(apacheServername=%s)(apacheServerAlias=%s))', (vhost,)*2)) 69 '(|(apacheServername=%s)(apacheServerAlias=%s))', (vhost,)*2), 70 timeout=5) 70 71 if len(results) >= 1: 71 72 result = results[0] … … 84 85 vhost = self.canonicalize(vhost) 85 86 info = self.vhosts.get(vhost) 86 if not info: 87 info = self.searchLDAP(vhost) 87 tries = 0 88 while (tries < 3) and not info: 89 tries += 1 90 try: 91 info = self.searchLDAP(vhost) 92 except (ldap.TIMEOUT, ldap.SERVER_DOWN): 93 self.ldap.unbind() 94 self.ldap = ldap.initialize(self.ldap_URL) 88 95 if info: 89 96 ret = "Hostname: %s\nAlias: %s\nLocker: %s\nDocument Root: %s" % \ 90 97 (info['apacheServerName'], vhost, info['locker'], info['apacheDocumentRoot']) 98 elif tries == 3: 99 ret = "The whois server is experiencing problems looking up LDAP records.\nPlease contact scripts@mit.edu for help if this problem persists." 91 100 else: 92 101 ret = "No such hostname"
Note: See TracChangeset
for help on using the changeset viewer.