Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force password as string so unexpected characters do not raise and error #96

Open
wants to merge 1 commit into
base: v5_backport
Choose a base branch
from

Conversation

destanyol
Copy link

Sometimes when the password has special characters an error is raised by hmac library which does not expect the incoming password.
The error in question is the following one:

  File "/home/erp/src/erp/server/bin/addons/poweremail/poweremail_mailbox.py", line 241, in send_this_mail
    }, payload=payload, context=ctx
  File "/home/erp/src/erp/server/bin/addons/poweremail/poweremail_core.py", line 567, in send_mail
    ssl=account.smtpssl
  File "/home/erp/local/lib/python2.7/site-packages/qreu/sendcontext.py", line 112, in __enter__
    self._connection.login(user=self._user, password=self._passwd)
  File "/usr/lib/python2.7/smtplib.py", line 608, in login
    (code, resp) = self.docmd(encode_cram_md5(resp, user, password))
  File "/usr/lib/python2.7/smtplib.py", line 572, in encode_cram_md5
    response = user + " " + hmac.HMAC(password, challenge).hexdigest()
  File "/usr/lib/python2.7/hmac.py", line 75, in __init__
    self.outer.update(key.translate(trans_5C))
TypeError: character mapping must return integer, None or unicode

In this PR I force the password as a string so now the password is correct. Maybe there are other or better solutions, but this just fix the bug atm.

@polsala
Copy link
Member

polsala commented Oct 26, 2022

@destanyol le poso de moment a blocked, amb això es corregeix el problema, però vull revisar demà per python 3

@ecarreras
Copy link
Member

@destanyol @polsala mireu aquesta #84

@ecarreras
Copy link
Member

@destanyol @polsala heu pogut revisar el meu comentari #96 (comment) ?

@polsala polsala added this to the v23.12 milestone Oct 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants