Fossil SCM

Resolve incorrect value being sent with the SMTP EHLO header when sending notification mails, per discussion in [forum:f183ab47a7beee47|forum post f183ab47a7beee47].

stephan 2023-03-03 14:34 trunk merge
Commit e7a5b98583dfceb561cae813c7d4f265a98cb2ebf014f7045ba5b9fbac4532c9
2 files changed +5 -4 +5 -4
+5 -4
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
1919
**
2020
** Are you looking for the code that reads and writes the internet
2121
** email protocol? That is not here. See the "smtp.c" file instead.
2222
** Yes, the choice of source code filenames is not the greatest, but
2323
** it is not so bad that changing them seems justified.
24
-*/
24
+*/
2525
#include "config.h"
2626
#include "alerts.h"
2727
#include <assert.h>
2828
#include <time.h>
2929
@@ -59,21 +59,21 @@
5959
@ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
6060
@ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
6161
@ semail TEXT UNIQUE COLLATE nocase,-- email address
6262
@ suname TEXT, -- corresponding USER entry
6363
@ sverified BOOLEAN DEFAULT true, -- email address verified
64
-@ sdonotcall BOOLEAN, -- true for Do Not Call
64
+@ sdonotcall BOOLEAN, -- true for Do Not Call
6565
@ sdigest BOOLEAN, -- true for daily digests only
6666
@ ssub TEXT, -- baseline subscriptions
6767
@ sctime INTDATE, -- When this entry was created. unixtime
6868
@ mtime INTDATE, -- Last change. unixtime
6969
@ smip TEXT, -- IP address of last change
7070
@ lastContact INT -- Last contact. days since 1970
7171
@ );
7272
@ CREATE INDEX repository.subscriberUname
7373
@ ON subscriber(suname) WHERE suname IS NOT NULL;
74
-@
74
+@
7575
@ DROP TABLE IF EXISTS repository.pending_alert;
7676
@ -- Email notifications that need to be sent.
7777
@ --
7878
@ -- The first character of the eventid determines the event type.
7979
@ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615615
const char *zRelay = 0;
616616
emailerGetSetting(p, &zRelay, "email-send-relayhost");
617617
if( zRelay ){
618618
u32 smtpFlags = SMTP_DIRECT;
619619
if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620
- p->pSmtp = smtp_session_new(p->zFrom, zRelay, smtpFlags);
620
+ p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
621
+ smtpFlags);
621622
smtp_client_startup(p->pSmtp);
622623
}
623624
}
624625
return p;
625626
}
626627
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
19 **
20 ** Are you looking for the code that reads and writes the internet
21 ** email protocol? That is not here. See the "smtp.c" file instead.
22 ** Yes, the choice of source code filenames is not the greatest, but
23 ** it is not so bad that changing them seems justified.
24 */
25 #include "config.h"
26 #include "alerts.h"
27 #include <assert.h>
28 #include <time.h>
29
@@ -59,21 +59,21 @@
59 @ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
60 @ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
61 @ semail TEXT UNIQUE COLLATE nocase,-- email address
62 @ suname TEXT, -- corresponding USER entry
63 @ sverified BOOLEAN DEFAULT true, -- email address verified
64 @ sdonotcall BOOLEAN, -- true for Do Not Call
65 @ sdigest BOOLEAN, -- true for daily digests only
66 @ ssub TEXT, -- baseline subscriptions
67 @ sctime INTDATE, -- When this entry was created. unixtime
68 @ mtime INTDATE, -- Last change. unixtime
69 @ smip TEXT, -- IP address of last change
70 @ lastContact INT -- Last contact. days since 1970
71 @ );
72 @ CREATE INDEX repository.subscriberUname
73 @ ON subscriber(suname) WHERE suname IS NOT NULL;
74 @
75 @ DROP TABLE IF EXISTS repository.pending_alert;
76 @ -- Email notifications that need to be sent.
77 @ --
78 @ -- The first character of the eventid determines the event type.
79 @ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615 const char *zRelay = 0;
616 emailerGetSetting(p, &zRelay, "email-send-relayhost");
617 if( zRelay ){
618 u32 smtpFlags = SMTP_DIRECT;
619 if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620 p->pSmtp = smtp_session_new(p->zFrom, zRelay, smtpFlags);
 
621 smtp_client_startup(p->pSmtp);
622 }
623 }
624 return p;
625 }
626
--- src/alerts.c
+++ src/alerts.c
@@ -19,11 +19,11 @@
19 **
20 ** Are you looking for the code that reads and writes the internet
21 ** email protocol? That is not here. See the "smtp.c" file instead.
22 ** Yes, the choice of source code filenames is not the greatest, but
23 ** it is not so bad that changing them seems justified.
24 */
25 #include "config.h"
26 #include "alerts.h"
27 #include <assert.h>
28 #include <time.h>
29
@@ -59,21 +59,21 @@
59 @ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use
60 @ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber
61 @ semail TEXT UNIQUE COLLATE nocase,-- email address
62 @ suname TEXT, -- corresponding USER entry
63 @ sverified BOOLEAN DEFAULT true, -- email address verified
64 @ sdonotcall BOOLEAN, -- true for Do Not Call
65 @ sdigest BOOLEAN, -- true for daily digests only
66 @ ssub TEXT, -- baseline subscriptions
67 @ sctime INTDATE, -- When this entry was created. unixtime
68 @ mtime INTDATE, -- Last change. unixtime
69 @ smip TEXT, -- IP address of last change
70 @ lastContact INT -- Last contact. days since 1970
71 @ );
72 @ CREATE INDEX repository.subscriberUname
73 @ ON subscriber(suname) WHERE suname IS NOT NULL;
74 @
75 @ DROP TABLE IF EXISTS repository.pending_alert;
76 @ -- Email notifications that need to be sent.
77 @ --
78 @ -- The first character of the eventid determines the event type.
79 @ -- Remaining characters determine the specific event. For example,
@@ -615,11 +615,12 @@
615 const char *zRelay = 0;
616 emailerGetSetting(p, &zRelay, "email-send-relayhost");
617 if( zRelay ){
618 u32 smtpFlags = SMTP_DIRECT;
619 if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
620 p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
621 smtpFlags);
622 smtp_client_startup(p->pSmtp);
623 }
624 }
625 return p;
626 }
627
+5 -4
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577577
return 0;
578578
}
579579
580580
/*
581581
** The input is a base email address of the form "local@domain".
582
-** Return a pointer to just the "domain" part.
582
+** Return a pointer to just the "domain" part, or 0 if the string
583
+** contains no "@".
583584
*/
584
-static const char *domainOfAddr(const char *z){
585
+const char *domain_of_addr(const char *z){
585586
while( z[0] && z[0]!='@' ) z++;
586587
if( z[0]==0 ) return 0;
587588
return z+1;
588589
}
589590
@@ -623,16 +624,16 @@
623624
if( g.argc<5 ) usage("EMAIL FROM TO ...");
624625
blob_read_from_file(&body, g.argv[2], ExtFILE);
625626
zFrom = g.argv[3];
626627
nTo = g.argc-4;
627628
azTo = (const char**)g.argv+4;
628
- zFromDomain = domainOfAddr(zFrom);
629
+ zFromDomain = domain_of_addr(zFrom);
629630
if( zRelay!=0 && zRelay[0]!= 0) {
630631
smtpFlags |= SMTP_DIRECT;
631632
zToDomain = zRelay;
632633
}else{
633
- zToDomain = domainOfAddr(azTo[0]);
634
+ zToDomain = domain_of_addr(azTo[0]);
634635
}
635636
p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
636637
if( p->zErr ){
637638
fossil_fatal("%s", p->zErr);
638639
}
639640
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577 return 0;
578 }
579
580 /*
581 ** The input is a base email address of the form "local@domain".
582 ** Return a pointer to just the "domain" part.
 
583 */
584 static const char *domainOfAddr(const char *z){
585 while( z[0] && z[0]!='@' ) z++;
586 if( z[0]==0 ) return 0;
587 return z+1;
588 }
589
@@ -623,16 +624,16 @@
623 if( g.argc<5 ) usage("EMAIL FROM TO ...");
624 blob_read_from_file(&body, g.argv[2], ExtFILE);
625 zFrom = g.argv[3];
626 nTo = g.argc-4;
627 azTo = (const char**)g.argv+4;
628 zFromDomain = domainOfAddr(zFrom);
629 if( zRelay!=0 && zRelay[0]!= 0) {
630 smtpFlags |= SMTP_DIRECT;
631 zToDomain = zRelay;
632 }else{
633 zToDomain = domainOfAddr(azTo[0]);
634 }
635 p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
636 if( p->zErr ){
637 fossil_fatal("%s", p->zErr);
638 }
639
--- src/smtp.c
+++ src/smtp.c
@@ -577,13 +577,14 @@
577 return 0;
578 }
579
580 /*
581 ** The input is a base email address of the form "local@domain".
582 ** Return a pointer to just the "domain" part, or 0 if the string
583 ** contains no "@".
584 */
585 const char *domain_of_addr(const char *z){
586 while( z[0] && z[0]!='@' ) z++;
587 if( z[0]==0 ) return 0;
588 return z+1;
589 }
590
@@ -623,16 +624,16 @@
624 if( g.argc<5 ) usage("EMAIL FROM TO ...");
625 blob_read_from_file(&body, g.argv[2], ExtFILE);
626 zFrom = g.argv[3];
627 nTo = g.argc-4;
628 azTo = (const char**)g.argv+4;
629 zFromDomain = domain_of_addr(zFrom);
630 if( zRelay!=0 && zRelay[0]!= 0) {
631 smtpFlags |= SMTP_DIRECT;
632 zToDomain = zRelay;
633 }else{
634 zToDomain = domain_of_addr(azTo[0]);
635 }
636 p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort);
637 if( p->zErr ){
638 fossil_fatal("%s", p->zErr);
639 }
640

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button