Skip to content

Commit

Permalink
fixed #19. DN in error message
Browse files Browse the repository at this point in the history
  • Loading branch information
thedavidwhiteside committed Oct 2, 2016
1 parent 4ae1964 commit cdae7df
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions pivportal/lib/pivportal/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@


def dn_is_valid(dn):
if re.match(r'^[a-zA-Z0-9_\-,\(\):]+$', dn):
if re.match(r'^[a-zA-Z0-9_\-\,\(\)\+\=\:\s\. ]+$', dn):
return True
return False

Expand Down Expand Up @@ -112,11 +112,11 @@ def decorated_function(*args, **kwargs):

# Valid DN
if not dn_is_valid(user_dn):
return Response(response=json.dumps({"response": " Invalid Request DN"}), status=400, mimetype="application/json")
return Response(response=json.dumps({"response": " Invalid Request DN %s" % user_dn}), status=400, mimetype="application/json")

# Authorize User
if user_dn not in dn_to_username:
return Response(response=json.dumps({"response": "Authentication Failure"}), status=401, mimetype="application/json")
return Response(response=json.dumps({"response": "Authentication Failure for DN %s" % user_dn}), status=401, mimetype="application/json")

username = dn_to_username[user_dn]

Expand Down Expand Up @@ -238,6 +238,7 @@ class Cli(object):
""" Command Line Interface for pivportal """
# Parse CLI Arguments
def __init__(self):
global dn_to_username
parser = optparse.OptionParser()
parser.add_option("-p", "--port", dest="port",
help="port",
Expand Down

0 comments on commit cdae7df

Please sign in to comment.