Skip to content

Commit

Permalink
Merge pull request #2 from jacobborisov/master
Browse files Browse the repository at this point in the history
appropriate handling of '1999 You are not authorized.' dir response
  • Loading branch information
joergsteffens committed Oct 23, 2016
2 parents 9c22f56 + 188d350 commit 454d20b
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
7 changes: 7 additions & 0 deletions bareos/bsock/lowlevel.py
Expand Up @@ -346,8 +346,15 @@ def _cram_md5_respond(self, password, tls_remote_need=0, compatible=True):
except RuntimeError:
self.logger.error("RuntimeError exception in recv")
return (0, True, False)

# invalid username
if ProtocolMessages.is_not_authorized(msg):
self.logger.error("failed: " + str(msg))
return (0, True, False)

# check the receive message
self.logger.debug("(recv): " + str(msg))

msg_list = msg.split(b" ")
chal = msg_list[2]
# get th timestamp and the tle info from director response
Expand Down
8 changes: 8 additions & 0 deletions bareos/bsock/protocolmessages.py
Expand Up @@ -27,6 +27,14 @@ def auth_ok():
def auth_failed():
return b"1999 Authorization failed.\n"

@staticmethod
def not_authorized():
return b"1999 You are not authorized.\n"

@staticmethod
def is_auth_ok(msg):
return msg == ProtocolMessages.auth_ok()

@staticmethod
def is_not_authorized(msg):
return msg == ProtocolMessages.not_authorized()

0 comments on commit 454d20b

Please sign in to comment.