bcoe / bcoe/secure-smtpd

AUTH LOGIN returns unicode 334 answer

Open
#24 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
123
Forks
41
PR merge metrics
No merged PRs in 30d

Description

With Python 2.7.3, I am getting the strange effect, that the answer to AUTH LOGIN apparently is transmitted as a unicode string which clients do not understand.

This is a tcpflow snippet demonstrating this:

```
046.163.077.142.01025-176.083.128.183.54917: 250-AUTH LOGIN PLAIN
250 EHLO
176.083.128.183.54917-046.163.077.142.01025: AUTH LOGIN
....163.077.142.01025-176.083.128.183.54917: 3...3...4... ...V...X...N...l...c...m...5...h...b...W...U...=...
```

Dots are zeros in tcpflow-speak.

If I change encode_b64 as follows (i.e., remove the final 'decode' statement), it works like a charm:

``` python
def encode_b64(data):
'''Wrapper for b64encode, without having to struggle with bytestrings.'''
byte_string = data.encode('utf-8')
encoded = base64.b64encode(byte_string)
return encoded
```

Contributor guide

No contributing guide indexed for this repository

Research direction

Locate the encode_b64 function and trace where it is used for the AUTH LOGIN response. Compare the returned value with the tcpflow example and reproduce the behavior on the reported Python 2.7.3 setup. Done means AUTH LOGIN sends the expected byte response without the unexpected Unicode representation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.