diff options
author | Eduardo Chappa <chappa@washington.edu> | 2020-06-29 14:23:13 -0600 |
---|---|---|
committer | Eduardo Chappa <chappa@washington.edu> | 2020-06-29 14:23:13 -0600 |
commit | 8657ba4f3d3b83e9c854f0cd5792d3d88592bfc6 (patch) | |
tree | 14e560df10122ee4f5cd496fd91522c28ba0a876 | |
parent | c6a938d3f92a03764408db0fe3526a781002913e (diff) | |
download | alpine-8657ba4f3d3b83e9c854f0cd5792d3d88592bfc6.tar.xz |
* Extension of the privacy changes to the generation of message-id when replying,
forwarding and bouncing.
-rw-r--r-- | alpine/adrbkcmd.c | 4 | ||||
-rw-r--r-- | alpine/help.c | 10 | ||||
-rw-r--r-- | alpine/mailpart.c | 10 | ||||
-rw-r--r-- | alpine/mailview.c | 2 | ||||
-rw-r--r-- | alpine/reply.c | 9 | ||||
-rw-r--r-- | alpine/send.c | 17 | ||||
-rw-r--r-- | pith/pine.hlp | 2 | ||||
-rw-r--r-- | pith/reply.c | 27 | ||||
-rw-r--r-- | pith/reply.h | 2 | ||||
-rw-r--r-- | pith/save.c | 4 | ||||
-rw-r--r-- | pith/send.c | 2 | ||||
-rw-r--r-- | web/src/alpined.d/alpined.c | 8 |
12 files changed, 55 insertions, 42 deletions
diff --git a/alpine/adrbkcmd.c b/alpine/adrbkcmd.c index a0d1c105..5979fa9d 100644 --- a/alpine/adrbkcmd.c +++ b/alpine/adrbkcmd.c @@ -4528,7 +4528,6 @@ ab_forward(struct pine *ps, long int cur_line, int agg) } outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); if(agg && as.selections > 1) outgoing->subject = cpystr("Forwarded address book entries from Alpine"); else @@ -4586,13 +4585,14 @@ ab_forward(struct pine *ps, long int cur_line, int agg) goto bomb; } + outgoing->message_id = generate_message_id(role); /*---- create the attachment, and write abook entry into it ----*/ *pp = mail_newbody_part(); pb = &((*pp)->body); pb->type = TYPETEXT; pb->encoding = ENCOTHER; /* let data decide */ - pb->id = generate_message_id(); + pb->id = generate_message_id(role); pb->subtype = cpystr("DIRECTORY"); if(agg && as.selections > 1) pb->description = cpystr("Alpine addressbook entries"); diff --git a/alpine/help.c b/alpine/help.c index 83211769..574f4a76 100644 --- a/alpine/help.c +++ b/alpine/help.c @@ -973,7 +973,7 @@ gripe_gripe_to(url) *optstr++ = '\0'; outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(NULL); if((outgoing->to = gripe_token_addr(url_copy)) != NULL){ composer_title = _("COMPOSE TO LOCAL SUPPORT"); @@ -1078,7 +1078,7 @@ gripe_newbody(ps, body, msgno, flags) pb = &((*pp)->body); pp = &((*pp)->next); pb->type = TYPETEXT; - pb->id = generate_message_id(); + pb->id = generate_message_id(NULL); pb->description = cpystr("Alpine Configuration Data"); pb->parameter = mail_newbody_parameter(); pb->parameter->attribute = cpystr("name"); @@ -1114,7 +1114,7 @@ gripe_newbody(ps, body, msgno, flags) pb = &((*pp)->body); pp = &((*pp)->next); pb->type = TYPETEXT; - pb->id = generate_message_id(); + pb->id = generate_message_id(NULL); pb->description = cpystr("Recent User Input"); pb->parameter = mail_newbody_parameter(); pb->parameter->attribute = cpystr("name"); @@ -1151,7 +1151,7 @@ gripe_newbody(ps, body, msgno, flags) pb = &((*pp)->body); pp = &((*pp)->next); pb->type = TYPETEXT; - pb->id = generate_message_id(); + pb->id = generate_message_id(NULL); pb->description = cpystr("Local Configuration Data"); pb->parameter = mail_newbody_parameter(); pb->parameter->attribute = cpystr("name"); @@ -1200,7 +1200,7 @@ gripe_newbody(ps, body, msgno, flags) pb = &((*pp)->body); pp = &((*pp)->next); pb->type = TYPEMESSAGE; - pb->id = generate_message_id(); + pb->id = generate_message_id(NULL); snprintf(tmp, sizeof(tmp), "Problem Message (%ld of %ld)", mn_get_cur(ps->msgmap), mn_get_total(ps->msgmap)); tmp[sizeof(tmp)-1] = '\0'; diff --git a/alpine/mailpart.c b/alpine/mailpart.c index 0e742fc7..5e1cac9a 100644 --- a/alpine/mailpart.c +++ b/alpine/mailpart.c @@ -3489,7 +3489,6 @@ forward_attachment(MAILSTREAM *stream, long int msgno, ATTACH_S *a) PAT_STATE dummy; outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); outgoing->subject = cpystr("Forwarded attachment..."); if(nonempty_patterns(rflags, &dummy)){ @@ -3514,6 +3513,7 @@ forward_attachment(MAILSTREAM *stream, long int msgno, ATTACH_S *a) q_status_message1(SM_ORDER, 3, 4, _("Forwarding using role \"%s\""), role->nick); + outgoing->message_id = generate_message_id(role); /* * as with all text bound for the composer, build it in * a storage object of the type it understands... @@ -3561,7 +3561,7 @@ forward_attachment(MAILSTREAM *stream, long int msgno, ATTACH_S *a) /*---- The corresponding things we're attaching ----*/ body->nested.part->next = mail_newbody_part(); - body->nested.part->next->body.id = generate_message_id(); + body->nested.part->next->body.id = generate_message_id(role); copy_body(&body->nested.part->next->body, a->body); if(fetch_contents(stream, msgno, a->number, @@ -3604,8 +3604,6 @@ forward_msg_att(MAILSTREAM *stream, long int msgno, ATTACH_S *a) REDRAFT_POS_S *redraft_pos = NULL; outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); - memset((void *)&reply, 0, sizeof(reply)); if((outgoing->subject = forward_subject(a->body->nested.msg->env, 0)) != NULL){ @@ -3640,6 +3638,8 @@ forward_msg_att(MAILSTREAM *stream, long int msgno, ATTACH_S *a) q_status_message1(SM_ORDER, 3, 4, _("Forwarding using role \"%s\""), role->nick); + outgoing->message_id = generate_message_id(role); + if(role && role->template){ char *filtered; @@ -3919,7 +3919,7 @@ reply_msg_att(MAILSTREAM *stream, long int msgno, ATTACH_S *a) outgoing->in_reply_to = reply_in_reply_to(a->body->nested.msg->env); outgoing->references = reply_build_refs(a->body->nested.msg->env); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); if(!outgoing->to && !outgoing->cc && !outgoing->bcc && !outgoing->newsgroups) diff --git a/alpine/mailview.c b/alpine/mailview.c index d1ace2f2..d5d6829f 100644 --- a/alpine/mailview.c +++ b/alpine/mailview.c @@ -1741,7 +1741,6 @@ url_local_mailto_and_atts(char *url, PATMT *attachlist) ACTION_S *role = NULL; outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); body = mail_newbody(); body->type = TYPETEXT; if((body->contents.text.data = (void *) so_get(PicoText,NULL,EDIT_ACCESS)) != NULL){ @@ -1833,6 +1832,7 @@ url_local_mailto_and_atts(char *url, PATMT *attachlist) if(role) q_status_message1(SM_ORDER, 3, 4, "Composing using role \"%s\"", role->nick); + outgoing->message_id = generate_message_id(role); if(!was_a_body && role && role->template){ char *filtered; diff --git a/alpine/reply.c b/alpine/reply.c index a35de1df..d7875a92 100644 --- a/alpine/reply.c +++ b/alpine/reply.c @@ -106,6 +106,7 @@ reply(struct pine *pine_state, ACTION_S *role_arg) REPLY_S reply; void *msgtext = NULL; char *tmpfix = NULL, *prefix = NULL, *fcc = NULL, *errmsg = NULL; + char *hostpart; long msgno, j, totalm, rflags, *seq = NULL; int i, include_text = 0, times = -1, warned = 0, rv = 0, flags = RSF_QUERY_REPLY_ALL, reply_raw_body = 0; @@ -434,7 +435,7 @@ reply(struct pine *pine_state, ACTION_S *role_arg) /*========== Other miscellaneous fields ===================*/ outgoing->in_reply_to = reply_in_reply_to(env); outgoing->references = reply_build_refs(env); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); if(!outgoing->to && !outgoing->cc && @@ -1518,7 +1519,6 @@ forward(struct pine *ps, ACTION_S *role_arg) memset((void *)&reply, 0, sizeof(reply)); outgoing = mail_newenvelope(); - outgoing->message_id = generate_message_id(); if(ps_global->full_header == 2 && F_ON(F_ENABLE_FULL_HDR_AND_TEXT, ps_global)) @@ -1602,6 +1602,8 @@ forward(struct pine *ps, ACTION_S *role_arg) q_status_message1(SM_ORDER, 3, 4, _("Forwarding using role \"%s\""), role->nick); + outgoing->message_id = generate_message_id(role); + if(role && role->template){ char *filtered; @@ -1887,7 +1889,6 @@ forward_text(struct pine *pine_state, void *text, SourceType source) if((msgtext = so_get(PicoText, NULL, EDIT_ACCESS)) != NULL){ env = mail_newenvelope(); - env->message_id = generate_message_id(); body = mail_newbody(); body->type = TYPETEXT; body->contents.text.data = (void *) msgtext; @@ -1912,6 +1913,8 @@ forward_text(struct pine *pine_state, void *text, SourceType source) q_status_message1(SM_ORDER, 3, 4, _("Composing using role \"%s\""), role->nick); + env->message_id = generate_message_id(role); + sig = detoken(role, NULL, 2, 0, 1, NULL, NULL); so_puts(msgtext, (sig && *sig) ? sig : NEWLINE); so_puts(msgtext, NEWLINE); diff --git a/alpine/send.c b/alpine/send.c index 2e6eace4..4d988a0c 100644 --- a/alpine/send.c +++ b/alpine/send.c @@ -656,7 +656,7 @@ compose_mail(char *given_to, char *fcc_arg, ACTION_S *role_arg, ps_global->hostname = cpystr(ps_global->maildomain); else ps_global->hostname = cpystr(hostpart); /* all for nothing */ - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); /* undo the changes above */ fs_give((void **) &ps_global->hostname); ps_global->hostname = cpystr(hostpart); @@ -1152,6 +1152,11 @@ pine_simple_send(ENVELOPE *outgoing, /* envelope for outgoing message */ while(!done){ int flags; + if(outgoing->message_id) + fs_give((void **) &outgoing->message_id); + + outgoing->message_id = generate_message_id(role); + if(outgoing->remail){ if(role) snprintf(tmp, sizeof(tmp), _("BOUNCE (redirect) message using role \"%s\" to : "), role->nick); @@ -3827,7 +3832,7 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body, if(outgoing->message_id) fs_give((void **) &outgoing->message_id); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); continue; } @@ -3983,7 +3988,7 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body, if(outgoing->message_id) fs_give((void **) &outgoing->message_id); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); continue; /* if we got here, there was a prob */ } @@ -4064,7 +4069,7 @@ pine_send(ENVELOPE *outgoing, struct mail_bodystruct **body, if(outgoing->message_id) fs_give((void **) &outgoing->message_id); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(role); continue; } @@ -5684,7 +5689,7 @@ outgoing2strings(METAENV *header, struct mail_bodystruct *bod, void **text, (*ppa)->size = cpystr(byte_string( send_body_size(&part->body))); if(!part->body.id) - part->body.id = generate_message_id(); + part->body.id = generate_message_id(NULL); (*ppa)->id = cpystr(part->body.id); (*ppa)->next = NULL; @@ -6061,7 +6066,7 @@ create_message_body(struct mail_bodystruct **b, PATMT *attach, int flow_it) p->next = mail_newbody_part(); p = p->next; - p->body.id = generate_message_id(); + p->body.id = generate_message_id(NULL); p->body.contents.text.data = file_contents; /* diff --git a/pith/pine.hlp b/pith/pine.hlp index 37858460..7219dd14 100644 --- a/pith/pine.hlp +++ b/pith/pine.hlp @@ -140,7 +140,7 @@ with help text for the config screen and the composer that didn't have any reasonable place to be called from. Dummy change to get revision in pine.hlp ============= h_revision ================= -Alpine Commit 472 2020-06-29 12:37:24 +Alpine Commit 473 2020-06-29 14:06:21 ============= h_news ================= <HTML> <HEAD> diff --git a/pith/reply.c b/pith/reply.c index 702832a0..534497de 100644 --- a/pith/reply.c +++ b/pith/reply.c @@ -1313,7 +1313,7 @@ reply_body(MAILSTREAM *stream, ENVELOPE *env, struct mail_bodystruct *orig_body, /*--- The second part, what ever it is ---*/ part->next = mail_newbody_part(); part = part->next; - part->body.id = generate_message_id(); + part->body.id = generate_message_id(NULL); copy_body(&(part->body), orig_body); /* @@ -2199,7 +2199,7 @@ forward_mime_msg(MAILSTREAM *stream, long int msgno, char *section, ENVELOPE *en *partp = mail_newbody_part(); b = &(*partp)->body; b->type = TYPEMESSAGE; - b->id = generate_message_id(); + b->id = generate_message_id(NULL); b->description = cpystr("Forwarded Message"); b->nested.msg = mail_newmsg(); b->disposition.type = cpystr("inline"); @@ -2550,7 +2550,7 @@ forward_body(MAILSTREAM *stream, ENVELOPE *env, struct mail_bodystruct *orig_bod /*--- The second part, what ever it is ---*/ part->next = mail_newbody_part(); part = part->next; - part->body.id = generate_message_id(); + part->body.id = generate_message_id(NULL); copy_body(&(part->body), orig_body); /* @@ -2596,7 +2596,6 @@ bounce_msg_body(MAILSTREAM *stream, gf_io_t pc; *outgoingp = mail_newenvelope(); - (*outgoingp)->message_id = generate_message_id(); (*outgoingp)->subject = cpystr(subject ? subject : "Resent mail...."); /* @@ -3108,7 +3107,7 @@ fetch_contents(MAILSTREAM *stream, long int msgno, char *section, struct mail_bo int got_one = 0; if(!body->id) - body->id = generate_message_id(); + body->id = generate_message_id(NULL); if(body->type == TYPEMULTIPART){ char subsection[256], *subp; @@ -3344,17 +3343,22 @@ Uniqueness is guaranteed by using the host name, process id, date to the second and a single unique character *----------------------------------------------------------------------*/ char * -generate_message_id(void) +generate_message_id(ACTION_S *role) { - char *id; - char *leftpart; - char *hostpart; + char *id, *leftpart, *hostpart, *prehostpart; + + if(role && role->from) + prehostpart = cpystr(role->from->host ? role->from->host : "huh"); + else if(ps_global->maildomain) /* as in generate_from() */ + prehostpart = cpystr(ps_global->maildomain); + else + prehostpart = cpystr(ps_global->hostname); if(F_ON(F_ROT13_MESSAGE_ID, ps_global)){ - hostpart = rot13(ps_global->hostname); + hostpart = rot13(prehostpart); leftpart = rot13(oauth2_generate_state()); } else { - hostpart = cpystr(ps_global->hostname); + hostpart = prehostpart; leftpart = oauth2_generate_state(); } @@ -3363,6 +3367,7 @@ generate_message_id(void) fs_give((void **) &hostpart); fs_give((void **) &leftpart); + prehostpart = NULL; return(id); } diff --git a/pith/reply.h b/pith/reply.h index c911b88e..ce1f9f79 100644 --- a/pith/reply.h +++ b/pith/reply.h @@ -92,7 +92,7 @@ BODY *copy_body(BODY *, BODY *); PARAMETER *copy_parameters(PARAMETER *); ENVELOPE *copy_envelope(ENVELOPE *); char *reply_in_reply_to(ENVELOPE *); -char *generate_message_id(void); +char *generate_message_id(ACTION_S *); char *generate_user_agent(void); char *rot13(char *); char *rot5n(char *); diff --git a/pith/save.c b/pith/save.c index 4592a949..2d74d544 100644 --- a/pith/save.c +++ b/pith/save.c @@ -572,9 +572,9 @@ save(struct pine *state, MAILSTREAM *stream, CONTEXT_S *context, char *folder, p = flags + strlen(flags); snprintf(p, newlen+1, "%s", "\\DELETED"); - id = generate_message_id(); + id = oauth2_generate_state(); idused = id ? id : "<xyz>"; - snprintf(dummymsg, sizeof(dummymsg), "Date: Thu, 18 May 2006 00:00 -0700\r\nFrom: dummy@example.com\r\nSubject: dummy\r\nMessage-ID: %s\r\n\r\ndummy\r\n", idused); + snprintf(dummymsg, sizeof(dummymsg), "Date: Thu, 18 May 2006 00:00 -0700\r\nFrom: dummy@example.com\r\nSubject: dummy\r\nMessage-ID: %s@example.com\r\n\r\ndummy\r\n", idused); /* * We need to get the uid of the message we are about to diff --git a/pith/send.c b/pith/send.c index 80db83f8..8d4d419a 100644 --- a/pith/send.c +++ b/pith/send.c @@ -826,7 +826,7 @@ redraft_work(MAILSTREAM **streamp, long int cont_msg, ENVELOPE **outgoing, if((*outgoing)->message_id) fs_give((void **)&(*outgoing)->message_id); - (*outgoing)->message_id = generate_message_id(); + (*outgoing)->message_id = generate_message_id(role ? *role : NULL); } if(b && b->type != TYPETEXT){ diff --git a/web/src/alpined.d/alpined.c b/web/src/alpined.d/alpined.c index 305f9d1f..7865863f 100644 --- a/web/src/alpined.d/alpined.c +++ b/web/src/alpined.d/alpined.c @@ -11116,7 +11116,7 @@ peMessageBounce(Tcl_Interp *interp, imapuid_t uid, int objc, Tcl_Obj **objv) outgoing->return_path = rfc822_cpy_adr(outgoing->from); if(!outgoing->message_id) - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(NULL); /* NO FCC */ @@ -11229,7 +11229,7 @@ peSendSpamReport(long rawno, char *to, char *subj, char *errbuf) outgoing->from = generate_from(); outgoing->subject = cpystr(subj); outgoing->return_path = rfc822_cpy_adr(outgoing->from); - outgoing->message_id = generate_message_id(); + outgoing->message_id = generate_message_id(NULL); rfc822_date(wtmp_20k_buf); outgoing->date = (unsigned char *) cpystr(wtmp_20k_buf); @@ -12570,7 +12570,7 @@ peMsgCollected(Tcl_Interp *interp, MSG_COL_S *md, char *err, long flags) rfc822_date(wtmp_20k_buf); md->outgoing->date = (unsigned char *) cpystr(wtmp_20k_buf); md->outgoing->return_path = rfc822_cpy_adr(md->outgoing->from); - md->outgoing->message_id = generate_message_id(); + md->outgoing->message_id = generate_message_id(NULL); body = mail_newbody(); @@ -12596,7 +12596,7 @@ peMsgCollected(Tcl_Interp *interp, MSG_COL_S *md, char *err, long flags) *np = mail_newbody_part(); if(a->file){ - (*np)->body.id = generate_message_id(); + (*np)->body.id = generate_message_id(NULL); (*np)->body.description = cpystr(a->l.f.description); /* set name parameter */ |