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

SMTP Protocol Support #1201

Merged
merged 46 commits into from
Jan 31, 2024
Merged

SMTP Protocol Support #1201

merged 46 commits into from
Jan 31, 2024

Conversation

egecetin
Copy link
Collaborator

No description provided.

@codecov
Copy link

codecov bot commented Sep 17, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f49f009) 82.48% compared to head (b3dc78a) 82.64%.
Report is 5 commits behind head on dev.

Additional details and impacted files
@@            Coverage Diff             @@
##              dev    #1201      +/-   ##
==========================================
+ Coverage   82.48%   82.64%   +0.15%     
==========================================
  Files         161      163       +2     
  Lines       20770    20962     +192     
  Branches     7847     7962     +115     
==========================================
+ Hits        17133    17324     +191     
- Misses       2961     2964       +3     
+ Partials      676      674       -2     
Flag Coverage Δ
alpine317 72.40% <95.71%> (+0.19%) ⬆️
centos7 74.14% <96.99%> (+0.24%) ⬆️
fedora37 72.41% <95.71%> (+0.19%) ⬆️
macos-11 61.34% <81.81%> (+0.18%) ⬆️
macos-12 61.40% <82.46%> (+0.19%) ⬆️
macos-ventura 61.46% <84.10%> (+0.21%) ⬆️
mingw32 70.25% <96.40%> (+0.18%) ⬆️
mingw64 70.27% <96.40%> (+0.18%) ⬆️
npcap 83.35% <100.00%> (+0.11%) ⬆️
ubuntu1804 74.80% <96.18%> (+0.20%) ⬆️
ubuntu2004 73.22% <95.45%> (+0.23%) ⬆️
ubuntu2204 72.24% <95.55%> (+0.19%) ⬆️
ubuntu2204-icpx 59.02% <45.73%> (-0.08%) ⬇️
unittest 82.64% <100.00%> (+0.15%) ⬆️
windows-2019 83.39% <100.00%> (+0.14%) ⬆️
windows-2022 83.40% <100.00%> (+0.14%) ⬆️
winpcap 83.38% <100.00%> (+0.16%) ⬆️
xdp 59.02% <95.55%> (+0.33%) ⬆️
zstd 73.78% <96.10%> (+0.17%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Packet++/header/SmtpLayer.h Outdated Show resolved Hide resolved
@egecetin egecetin marked this pull request as ready for review November 6, 2023 19:28
@egecetin egecetin requested a review from seladb as a code owner November 6, 2023 19:28
@egecetin
Copy link
Collaborator Author

egecetin commented Nov 6, 2023

@seladb I'll double check parsing with different SMTP packets but it's ready for review.

@seladb
Copy link
Owner

seladb commented Nov 7, 2023

@seladb I'll double check parsing with different SMTP packets but it's ready for review.

Thank you @egecetin ! It might take me a few days to review but I'll get to it ASAP

Packet++/CMakeLists.txt Show resolved Hide resolved
Packet++/src/TcpLayer.cpp Show resolved Hide resolved
Packet++/header/SmtpLayer.h Outdated Show resolved Hide resolved
Packet++/header/SmtpLayer.h Show resolved Hide resolved
Packet++/header/SmtpLayer.h Show resolved Hide resolved
Packet++/src/SmtpLayer.cpp Outdated Show resolved Hide resolved
Packet++/header/SmtpLayer.h Outdated Show resolved Hide resolved
Packet++/src/SmtpLayer.cpp Outdated Show resolved Hide resolved
Packet++/src/SmtpLayer.cpp Outdated Show resolved Hide resolved
Packet++/src/SingleCommandTextProtocol.cpp Outdated Show resolved Hide resolved
@seladb
Copy link
Owner

seladb commented Dec 5, 2023

es not fit into single p

@egecetin I think I understand now. But if the TCP port is SMTP (25 or 587) and the packet ends with \r\n - isn't it a good enough indication that this is an SMTP packet? Are there additional checks we can do? 🤔

@egecetin
Copy link
Collaborator Author

egecetin commented Dec 5, 2023

Probably nothing we can do instead of checking of the session (at least i dont know)

@egecetin egecetin marked this pull request as ready for review December 9, 2023 12:50
@egecetin egecetin requested a review from seladb December 9, 2023 13:17
Packet++/src/SmtpLayer.cpp Show resolved Hide resolved
Packet++/src/SmtpLayer.cpp Outdated Show resolved Hide resolved
Packet++/src/SmtpLayer.cpp Outdated Show resolved Hide resolved
Tests/Packet++Test/Tests/SmtpTests.cpp Show resolved Hide resolved
Tests/Packet++Test/Tests/SmtpTests.cpp Outdated Show resolved Hide resolved
Tests/Packet++Test/Tests/SmtpTests.cpp Show resolved Hide resolved
@egecetin
Copy link
Collaborator Author

egecetin commented Jan 3, 2024

@seladb I saw your comments but still don't have time to fix them. I try to fix your comments and update the PR as soon as possible for protocol type changes. Sorry for the delay

@seladb
Copy link
Owner

seladb commented Jan 4, 2024

@seladb I saw your comments but still don't have time to fix them. I try to fix your comments and update the PR as soon as possible for protocol type changes. Sorry for the delay

Sure @egecetin no worries. We can keep the PR open until you're available to address the comments

@egecetin egecetin requested a review from seladb January 18, 2024 17:05
@egecetin
Copy link
Collaborator Author

@seladb It's ready for review. You can check the PR when you have time

@seladb
Copy link
Owner

seladb commented Jan 19, 2024

@seladb It's ready for review. You can check the PR when you have time

@egecetin you can update the branch, the FreeBSD issue should be fixed. I'll try to review the PR in the coming days

image

Copy link
Owner

@seladb seladb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please take a look at one comment below. I'm ok to merge this PR without it

Comment on lines 56 to 57
"xc90.websitewelcome.com ESMTP Exim 4.69 #1 Mon, 05 Oct 2009 01:05:54 -0500 220-We do not authorize "
"the use of this system to transport unsolicited, 220 and/or bulk e-mail.");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case of multiline, do we want to remove the status code from all the lines?

Meaning, remove 220- from the second and third lines?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I remember I also thought about it but to be honest I can't remember why I don't add any support for it. Let me check the code and protocol again before merging.

Copy link
Collaborator Author

@egecetin egecetin Jan 28, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@seladb Updated the code for support it in both SMTP and FTP (They use same structure for it) but codecov-action currently broken because of node version (Check codecov/codecov-action#1230 and codecov/codecov-action#1228) so workflow is failing for now. Can you check the code again?

Comment on lines 147 to 148
vDelim.push_back(getCommandInternal() + "-");
vDelim.push_back(getCommandInternal() + " ");
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: we could run getCommandInternal() only once and create + init the vector in one line:

auto option = getCommandInternal();
auto vDelim = std::vector<std::string> { option + " ", option + "-"}

@egecetin egecetin merged commit c43617a into seladb:dev Jan 31, 2024
39 checks passed
@egecetin egecetin deleted the smtp branch January 31, 2024 18:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants