def getAuth(req):
    if hasattr(req, 'headers_in'):
        # mod_python
        headers_in = req.headers_in
        remote_ip = req.connection.remote_ip
    else:
        # webob
        headers_in = req.headers
        remote_ip = req.remote_addr

    if not headers_in in 'Authorization':
        authToken = ['anonymous', 'anonymous']
    else:
        info = headers_in['Authorization'].split(' ', 1)
        if len(info) != 2 or info[0] != "Basic":
            return None

        try:
            authString = base64.decodestring(info[1])
        except:
            return None

        authToken = authString.split(":", 1)
        if len(authToken) != 2:
            # No password
            authToken.append(util.ProtectedString(''))
        else:
            authToken[1] = util.ProtectedString(authToken[1])

    try:
        entitlementList = parseEntitlement(
                        headers_in.get('X-Conary-Entitlement', ''))
    except:
        return None

    authToken.append(entitlementList)
    authToken.append(remote_ip)
    return authToken
dataset/ETHPy150Open sassoftware/conary/conary/web/webauth.py/getAuth/swapped operands of `in`