From 4d77713f495bc1e797393cb05e88f17f78ff91d1 Mon Sep 17 00:00:00 2001 From: Eduardo Chappa Date: Mon, 29 Jun 2020 03:19:56 -0600 Subject: * Modifications to protect the privacy of users: + Alpine does not generate Sender or X-X-Sender by default by making [X] Do Not Generate Sender Header the default. + Alpine does not disclose User Agent by default by making [X] Suppress User Agent When Sending the default. + Alpine uses the domain in the From: header of a message to generate a message-id and suppresses all information about Alpine, version, revision, and time of generation of the message-id from this header. This information is replaced by a random string. --- pith/reply.c | 59 ++++++++++++----------------------------------------------- 1 file changed, 12 insertions(+), 47 deletions(-) (limited to 'pith/reply.c') diff --git a/pith/reply.c b/pith/reply.c index ab4e97c2..702832a0 100644 --- a/pith/reply.c +++ b/pith/reply.c @@ -3346,58 +3346,23 @@ second and a single unique character char * generate_message_id(void) { - static short osec = 0, cnt = 0; - char idbuf[128], revisionbuf[128]; char *id; - time_t now; - struct tm *now_x; - char *revision = NULL; - char *hostpart = NULL; - char *alpine_name = NULL; - char *alpine_version = NULL; - char *system_os = NULL; - - now = time((time_t *)0); - now_x = localtime(&now); - - if(now_x->tm_sec == osec) - cnt++; - else{ - cnt = 0; - osec = now_x->tm_sec; - } + char *leftpart; + char *hostpart; - get_alpine_revision_number(revisionbuf, sizeof(revisionbuf)); if(F_ON(F_ROT13_MESSAGE_ID, ps_global)){ - hostpart = rot13(ps_global->hostname); - alpine_name = rot13("alpine"); - alpine_version = rot5n(ALPINE_VERSION); - system_os = rot13(SYSTYPE); - revision = rot5n(revisionbuf); + hostpart = rot13(ps_global->hostname); + leftpart = rot13(oauth2_generate_state()); } else { - hostpart = cpystr(ps_global->hostname); - alpine_name = cpystr("alpine"); - alpine_version = cpystr(ALPINE_VERSION); - system_os = cpystr(SYSTYPE); - revision = cpystr(revisionbuf); + hostpart = cpystr(ps_global->hostname); + leftpart = oauth2_generate_state(); } - - if(!hostpart) - hostpart = cpystr("huh"); - - snprintf(idbuf, sizeof(idbuf), "<%.6s.%.4s.%.20s.%.10s.%02d%02d%02d%02d%02d%02d%X.%d@%.50s>", - alpine_name, system_os, alpine_version, revision,(now_x->tm_year) % 100, now_x->tm_mon + 1, - now_x->tm_mday, now_x->tm_hour, now_x->tm_min, now_x->tm_sec, - cnt, getpid(), hostpart); - idbuf[sizeof(idbuf)-1] = '\0'; - - id = cpystr(idbuf); - - if(hostpart) fs_give((void **) &hostpart); - if(alpine_name) fs_give((void **) & alpine_name); - if(alpine_version) fs_give((void **)&alpine_version); - if(system_os) fs_give((void **)&system_os); - if(revision) fs_give((void **)&revision); + + id = fs_get(strlen(leftpart) + strlen(hostpart) + 4); + sprintf(id, "<%s@%s>", leftpart, hostpart); + + fs_give((void **) &hostpart); + fs_give((void **) &leftpart); return(id); } -- cgit v1.2.3-54-g00ecf