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

qmail-smtpd: introduce an array of EHLO string generators #172

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

Conversation

DerDakon
Copy link
Member

This is of no direct use for the vanilla version, but it allows to simplify the integration of different patches which add add EHLO arguments. They will only need to add their print function to this array and it will get called.

@leahneukirchen
Copy link
Contributor

Doesn't simply adding a newline to smtp_ehlo achieve the same patchability?

@DerDakon
Copy link
Member Author

No, it doesn't. STARTTLS introduces a struct stat to check if the certificate exists, SIZE adds a local buf to print the databytes into it… With this the collisions can simply be ignored and things are put into the array, in no particular order, which can easily solved during patching as simply "pick both". At least that's what I with my packager hat on would like to see.

@leahneukirchen
Copy link
Contributor

But what's the difference between:

--- foo.c	2020-07-26 22:17:54.612884429 +0200
+++ foo1.c	2020-07-26 22:18:14.456097603 +0200
@@ -1,3 +1,4 @@
 static void (*ehlo_gen[])() = {
+	ehlo_starttls,
 	NULL
 };

and

--- bar.c	2020-07-26 22:18:58.620572058 +0200
+++ bar1.c	2020-07-26 22:19:15.076748845 +0200
@@ -1,6 +1,7 @@
 void smtp_ehlo(arg) char *arg;
 {
   smtp_greet("250-");
+  ehlo_starttls();
   out("\r\n250-PIPELINING\r\n250 8BITMIME\r\n");
   seenmail = 0; dohelo(arg);
 }

@DerDakon
Copy link
Member Author

Right, that would be the same. But it would be possible even now, and it has not happened yet. So I guess we need to invent some sort of infrastructure, the crappy it may be, to move people in the right direction.

@josuah
Copy link

josuah commented Nov 14, 2020

The use case we might want to get hanlded (maybe the most complex): starttls and authentication:

Auth advertized never on port 25, never on non-tls, always on 465, only after STARTTLS on port 587.

But even so, I do not see a technical advantage on a function pointer, as then, there are still patch(1) conflicts that can occur: patch only sees text.

Do we want to move from patch toward (statically linked) modules interacting with qmail at pre-defined hooks?

Copy link

@josuah josuah left a comment

Choose a reason for hiding this comment

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

I am happy with it, two suggestions that might be for another commit.

qmail-smtpd.c Show resolved Hide resolved
qmail-smtpd.c Outdated Show resolved Hide resolved
@schmonz
Copy link
Member

schmonz commented Nov 14, 2020

Related, I've written up some design ideas for TLS, AUTH, etc.. Maybe this gives us a bigger picture worth arguing about :-)

This is of no direct use for the vanilla version, but it allows to simplify
the integration of different patches which add add EHLO arguments. They will
only need to add their print function to this array and it will get called.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants