Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
| Comment: | Improved debugging and diagnostic capabilities for announcement sending, especially when using relay. |
|---|---|
| Downloads: | Tarball | ZIP archive |
| Timelines: | family | ancestors | descendants | both | trunk |
| Files: | files | file ages | folders |
| SHA3-256: |
056c83d120080925b0b6225ac98a08e1 |
| User & Date: | drh 2025-04-07 16:42:48.167 |
Context
|
2025-04-07
| ||
| 16:57 | Usage hints on email-send-relayhost to suggest using an IP address to avoid name lookup problems from within chroot jails. ... (check-in: 8266b5b3cf user: drh tags: trunk) | |
| 16:42 | Improved debugging and diagnostic capabilities for announcement sending, especially when using relay. ... (check-in: 056c83d120 user: drh tags: trunk) | |
| 16:03 | New debugging option for /announce shows the SMTP transcript when the notification type is "relay". ... (check-in: bbfca4cb64 user: drh tags: trunk) | |
Changes
Changes to src/alerts.c.
| ︙ | ︙ | |||
643 644 645 646 647 648 649 |
emailerGetSetting(p, &zRelay, "email-send-relayhost");
if( zRelay ){
u32 smtpFlags = SMTP_DIRECT;
if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
blob_init(&p->out, 0, 0);
p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
smtpFlags, 0);
| > > > | | 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 |
emailerGetSetting(p, &zRelay, "email-send-relayhost");
if( zRelay ){
u32 smtpFlags = SMTP_DIRECT;
if( mFlags & ALERT_TRACE ) smtpFlags |= SMTP_TRACE_STDOUT;
blob_init(&p->out, 0, 0);
p->pSmtp = smtp_session_new(domain_of_addr(p->zFrom), zRelay,
smtpFlags, 0);
if( p->pSmtp==0 || p->pSmtp->zErr ){
emailerError(p, "Could not start SMTP session: %s",
p->pSmtp ? p->pSmtp->zErr : "reason unknown");
}else if( p->zDest[0]=='d' ){
smtp_session_config(p->pSmtp, SMTP_TRACE_BLOB, &p->out);
}
smtp_client_startup(p->pSmtp);
}
}
return p;
}
|
| ︙ | ︙ | |||
3499 3500 3501 3502 3503 3504 3505 |
blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n",
zURL, zCode);
}
alert_send(pSender, &hdr, &body, 0);
}
db_finalize(&q);
}
| | | | | > > > > > > | 3502 3503 3504 3505 3506 3507 3508 3509 3510 3511 3512 3513 3514 3515 3516 3517 3518 3519 3520 3521 3522 3523 3524 3525 |
blob_appendf(&body,"\n-- \nSubscription info: %s/alerts/%s\n",
zURL, zCode);
}
alert_send(pSender, &hdr, &body, 0);
}
db_finalize(&q);
}
if( bTest && blob_size(&pSender->out) ){
/* If the URL is "/announce/test2" then no email is actually sent.
** Instead, the text of the email that would have been sent is
** displayed in the result window.
**
** If the URL is "/announce/test3" and the email-send-method is "relay"
** then the announcement is sent as it normally would be, but a
** transcript of the SMTP conversation with the MTA is shown here.
*/
blob_trim(&pSender->out);
@ <pre style='border: 2px solid blue; padding: 1ex;'>
@ %h(blob_str(&pSender->out))
@ </pre>
blob_reset(&pSender->out);
}
zErr = pSender->zErr;
pSender->zErr = 0;
|
| ︙ | ︙ | |||
3556 3557 3558 3559 3560 3561 3562 |
@ <p style='border: 1px solid black; padding: 1ex;'>
cgi_print_all(0, 0, 0);
@ </p>
}else if( P("submit")!=0 && cgi_csrf_safe(2) ){
char *zErr = alert_send_announcement();
style_header("Announcement Sent");
if( zErr ){
| | | > | 3565 3566 3567 3568 3569 3570 3571 3572 3573 3574 3575 3576 3577 3578 3579 3580 3581 |
@ <p style='border: 1px solid black; padding: 1ex;'>
cgi_print_all(0, 0, 0);
@ </p>
}else if( P("submit")!=0 && cgi_csrf_safe(2) ){
char *zErr = alert_send_announcement();
style_header("Announcement Sent");
if( zErr ){
@ <h1>Error</h1>
@ <p>The following error was reported by the
@ announcement-sending subsystem:
@ <blockquote><pre>
@ %h(zErr)
@ </pre></blockquote>
}else{
@ <p>The announcement has been sent.
@ <a href="%h(PD("REQUEST_URI","/"))">Send another</a></p>
}
|
| ︙ | ︙ |
Changes to src/main.c.
| ︙ | ︙ | |||
3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 | ** and the SSH_CONNECTION environment variable is set. Use the --test ** option on interactive sessions to avoid that special processing when ** using this command interactively over SSH. A better solution would be ** to use a different command for "ssh" sync, but we cannot do that without ** breaking legacy. ** ** Options: ** --nobody Pretend to be user "nobody" ** --test Do not do special "sync" processing when operating ** over an SSH link ** --th-trace Trace TH1 execution (for debugging purposes) ** --usercap CAP User capability string (Default: "sxy") | > < > > | 3066 3067 3068 3069 3070 3071 3072 3073 3074 3075 3076 3077 3078 3079 3080 3081 3082 3083 3084 3085 3086 3087 3088 3089 3090 3091 3092 3093 3094 |
** and the SSH_CONNECTION environment variable is set. Use the --test
** option on interactive sessions to avoid that special processing when
** using this command interactively over SSH. A better solution would be
** to use a different command for "ssh" sync, but we cannot do that without
** breaking legacy.
**
** Options:
** --csrf-safe N Set cgi_csrf_safe() to to return N
** --nobody Pretend to be user "nobody"
** --test Do not do special "sync" processing when operating
** over an SSH link
** --th-trace Trace TH1 execution (for debugging purposes)
** --usercap CAP User capability string (Default: "sxy")
*/
void cmd_test_http(void){
const char *zIpAddr; /* IP address of remote client */
const char *zUserCap;
int bTest = 0;
const char *zCsrfSafe = find_option("csrf-safe",0,1);
Th_InitTraceLog();
if( zCsrfSafe ) g.okCsrf = atoi(zCsrfSafe);
zUserCap = find_option("usercap",0,1);
if( !find_option("nobody",0,0) ){
if( zUserCap==0 ){
g.useLocalauth = 1;
zUserCap = "sxy";
}
login_set_capabilities(zUserCap, 0);
|
| ︙ | ︙ |
Changes to src/smtp.c.
| ︙ | ︙ | |||
379 380 381 382 383 384 385 |
** Have the client send a QUIT message.
*/
int smtp_client_quit(SmtpSession *p){
Blob in = BLOB_INITIALIZER;
int iCode = 0;
int bMore = 0;
char *zArg = 0;
| > | | | | | > > | 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 |
** Have the client send a QUIT message.
*/
int smtp_client_quit(SmtpSession *p){
Blob in = BLOB_INITIALIZER;
int iCode = 0;
int bMore = 0;
char *zArg = 0;
if( !p->atEof ){
smtp_send_line(p, "QUIT\r\n");
do{
smtp_get_reply_from_server(p, &in, &iCode, &bMore, &zArg);
}while( bMore );
p->atEof = 1;
}
socket_close();
return 0;
}
/*
** Begin a client SMTP session. Wait for the initial 220 then send
** the EHLO and wait for a 250.
**
** Return 0 on success and non-zero for a failure.
*/
int smtp_client_startup(SmtpSession *p){
Blob in = BLOB_INITIALIZER;
int iCode = 0;
int bMore = 0;
char *zArg = 0;
if( p==0 || p->atEof ) return 1;
do{
smtp_get_reply_from_server(p, &in, &iCode, &bMore, &zArg);
}while( bMore );
if( iCode!=220 ){
smtp_client_quit(p);
return 1;
}
|
| ︙ | ︙ |