Changeset 2757 for trunk/server


Ignore:
Timestamp:
Feb 26, 2016, 2:48:37 AM (7 years ago)
Author:
andersk
Message:
whoisd: Use scriptsVhost records rather than apacheConfig records
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/server/common/oursrc/whoisd/whoisd.tac

    r2756 r2757  
    33from twisted.protocols import basic
    44import ldap, ldap.filter
    5 import pwd
     5import posixpath
    66
    77class WhoisProtocol(basic.LineReceiver):
     
    3232#            return vhost + ".mit.edu"
    3333    def searchLDAP(self, vhost):
     34        attrlist = ('scriptsVhostName', 'homeDirectory', 'scriptsVhostDirectory', 'uid')
    3435        results = self.ldap.search_st(self.ldap_base, ldap.SCOPE_SUBTREE,
    3536            ldap.filter.filter_format(
    36                 '(|(apacheServername=%s)(apacheServerAlias=%s))', (vhost,)*2),
    37                 timeout=5)
     37                '(|(scriptsVhostName=%s)(scriptsVhostAlias=%s))', (vhost,)*2),
     38                attrlist=attrlist, timeout=5)
    3839        if len(results) >= 1:
    3940            result = results[0]
    4041            attrs = result[1]
    41             for attr in ('apacheServerName','apacheDocumentRoot', 'apacheSuexecUid', 'apacheSuexecGid'):
     42            for attr in attrlist:
    4243                attrs[attr] = attrs[attr][0]
    43             user = pwd.getpwuid(int(attrs['apacheSuexecUid']))
    44             if user:
    45                 attrs['locker'] = user.pw_name
    46             else:
    47                 attrs['locker'] = None
    4844            return attrs
    4945        else:
     
    6359        if info:
    6460            ret = "Hostname: %s\nAlias: %s\nLocker: %s\nDocument Root: %s" % \
    65                 (info['apacheServerName'], vhost, info['locker'], info['apacheDocumentRoot'])
     61                (info['scriptsVhostName'], vhost, info['uid'],
     62                 posixpath.join(info['homeDirectory'], 'web_scripts', info['scriptsVhostDirectory']))
    6663        elif tries == 3:
    6764            ret = "The whois server is experiencing problems looking up LDAP records.\nPlease contact scripts@mit.edu for help if this problem persists."
Note: See TracChangeset for help on using the changeset viewer.