Fossil SCM
Resolve incorrect value being sent with the SMTP EHLO header when sending notification mails, per discussion in [forum:f183ab47a7beee47|forum post f183ab47a7beee47].
Commit
e7a5b98583dfceb561cae813c7d4f265a98cb2ebf014f7045ba5b9fbac4532c9
Parent
3037be63e21c149…
2 files changed
+5
-4
+5
-4
+5
-4
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -19,11 +19,11 @@ | ||
| 19 | 19 | ** |
| 20 | 20 | ** Are you looking for the code that reads and writes the internet |
| 21 | 21 | ** email protocol? That is not here. See the "smtp.c" file instead. |
| 22 | 22 | ** Yes, the choice of source code filenames is not the greatest, but |
| 23 | 23 | ** it is not so bad that changing them seems justified. |
| 24 | -*/ | |
| 24 | +*/ | |
| 25 | 25 | #include "config.h" |
| 26 | 26 | #include "alerts.h" |
| 27 | 27 | #include <assert.h> |
| 28 | 28 | #include <time.h> |
| 29 | 29 | |
| @@ -59,21 +59,21 @@ | ||
| 59 | 59 | @ subscriberId INTEGER PRIMARY KEY, -- numeric subscriber ID. Internal use |
| 60 | 60 | @ subscriberCode BLOB DEFAULT (randomblob(32)) UNIQUE, -- UUID for subscriber |
| 61 | 61 | @ semail TEXT UNIQUE COLLATE nocase,-- email address |
| 62 | 62 | @ suname TEXT, -- corresponding USER entry |
| 63 | 63 | @ sverified BOOLEAN DEFAULT true, -- email address verified |
| 64 | -@ sdonotcall BOOLEAN, -- true for Do Not Call | |
| 64 | +@ sdonotcall BOOLEAN, -- true for Do Not Call | |
| 65 | 65 | @ sdigest BOOLEAN, -- true for daily digests only |
| 66 | 66 | @ ssub TEXT, -- baseline subscriptions |
| 67 | 67 | @ sctime INTDATE, -- When this entry was created. unixtime |
| 68 | 68 | @ mtime INTDATE, -- Last change. unixtime |
| 69 | 69 | @ smip TEXT, -- IP address of last change |
| 70 | 70 | @ lastContact INT -- Last contact. days since 1970 |
| 71 | 71 | @ ); |
| 72 | 72 | @ CREATE INDEX repository.subscriberUname |
| 73 | 73 | @ ON subscriber(suname) WHERE suname IS NOT NULL; |
| 74 | -@ | |
| 74 | +@ | |
| 75 | 75 | @ DROP TABLE IF EXISTS repository.pending_alert; |
| 76 | 76 | @ -- Email notifications that need to be sent. |
| 77 | 77 | @ -- |
| 78 | 78 | @ -- The first character of the eventid determines the event type. |
| 79 | 79 | @ -- Remaining characters determine the specific event. For example, |
| @@ -615,11 +615,12 @@ | ||
| 615 | 615 | const char *zRelay = 0; |
| 616 | 616 | emailerGetSetting(p, &zRelay, "email-send-relayhost"); |
| 617 | 617 | if( zRelay ){ |
| 618 | 618 | u32 smtpFlags = SMTP_DIRECT; |
| 619 | 619 | 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); | |
| 621 | 622 | smtp_client_startup(p->pSmtp); |
| 622 | 623 | } |
| 623 | 624 | } |
| 624 | 625 | return p; |
| 625 | 626 | } |
| 626 | 627 |
| --- 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 @@ | ||
| 577 | 577 | return 0; |
| 578 | 578 | } |
| 579 | 579 | |
| 580 | 580 | /* |
| 581 | 581 | ** 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 "@". | |
| 583 | 584 | */ |
| 584 | -static const char *domainOfAddr(const char *z){ | |
| 585 | +const char *domain_of_addr(const char *z){ | |
| 585 | 586 | while( z[0] && z[0]!='@' ) z++; |
| 586 | 587 | if( z[0]==0 ) return 0; |
| 587 | 588 | return z+1; |
| 588 | 589 | } |
| 589 | 590 | |
| @@ -623,16 +624,16 @@ | ||
| 623 | 624 | if( g.argc<5 ) usage("EMAIL FROM TO ..."); |
| 624 | 625 | blob_read_from_file(&body, g.argv[2], ExtFILE); |
| 625 | 626 | zFrom = g.argv[3]; |
| 626 | 627 | nTo = g.argc-4; |
| 627 | 628 | azTo = (const char**)g.argv+4; |
| 628 | - zFromDomain = domainOfAddr(zFrom); | |
| 629 | + zFromDomain = domain_of_addr(zFrom); | |
| 629 | 630 | if( zRelay!=0 && zRelay[0]!= 0) { |
| 630 | 631 | smtpFlags |= SMTP_DIRECT; |
| 631 | 632 | zToDomain = zRelay; |
| 632 | 633 | }else{ |
| 633 | - zToDomain = domainOfAddr(azTo[0]); | |
| 634 | + zToDomain = domain_of_addr(azTo[0]); | |
| 634 | 635 | } |
| 635 | 636 | p = smtp_session_new(zFromDomain, zToDomain, smtpFlags, smtpPort); |
| 636 | 637 | if( p->zErr ){ |
| 637 | 638 | fossil_fatal("%s", p->zErr); |
| 638 | 639 | } |
| 639 | 640 |
| --- 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 |