comparison src/accept.c @ 304:d5ce2ba71e7b

manual formating of Received: hdrs; changed hdr for local receival Now the Received: headers are much friendlier to read. About folding: We must fold any line at 998 chars before transfer. We should fold the lines we produce at 78 chars. That is what RFC 2821 requests. We should think about it, somewhen. The header for locally (i.e. non-SMTP) received mail is changed to the format postfix uses. This matches RFC 2821 better. The `from' clause should contain a domain or IP, not a user name. Also, the `with' clause should contain a registered standard protocol name, which ``local'' is not.
author markus schnalke <meillo@marmaro.de>
date Thu, 09 Dec 2010 18:28:11 -0300
parents 3e3c280ca5b2
children 29de6a1c4538
comparison
equal deleted inserted replaced
303:3e3c280ca5b2 304:d5ce2ba71e7b
360 360
361 DEBUG(3) debugf("adding 'Received:' header\n"); 361 DEBUG(3) debugf("adding 'Received:' header\n");
362 362
363 if (g_list_length(msg->rcpt_list) == 1) { 363 if (g_list_length(msg->rcpt_list) == 1) {
364 address *addr = (address *) (g_list_first(msg->rcpt_list)->data); 364 address *addr = (address *) (g_list_first(msg->rcpt_list)->data);
365 for_string = g_strdup_printf(" for %s", addr_string(addr)); 365 for_string = g_strdup_printf("\n\tfor %s", addr_string(addr));
366 } 366 }
367 367
368 if (!msg->received_host) { 368 if (!msg->received_host) {
369 /* received locally */ 369 /* received locally */
370 hdr = create_header(HEAD_RECEIVED, 370 hdr = create_header(HEAD_RECEIVED,
371 "Received: from %s by %s with %s (%s %s) id %s%s; %s\n", 371 "Received: by %s (%s %s, from userid %d)\n\tid %s%s; %s\n",
372 passwd->pw_name, conf.host_name, 372 conf.host_name, PACKAGE, VERSION, geteuid(),
373 prot_names[msg->received_prot], PACKAGE, VERSION,
374 msg->uid, for_string ? for_string : "", rec_timestamp()); 373 msg->uid, for_string ? for_string : "", rec_timestamp());
375 } else { 374 } else {
376 /* received from remote */ 375 /* received from remote */
377 #ifdef ENABLE_IDENT 376 #ifdef ENABLE_IDENT
378 DEBUG(5) debugf("adding 'Received:' header (5)\n"); 377 DEBUG(5) debugf("adding 'Received:' header (5)\n");
379 hdr = create_header(HEAD_RECEIVED, 378 hdr = create_header(HEAD_RECEIVED,
380 "Received: from %s (ident=%s) by %s with %s (%s %s) id %s%s; %s\n", 379 "Received: from %s (ident=%s)\n\tby %s with %s (%s %s)\n\tid %s%s; %s\n",
381 msg->received_host, msg->ident ? msg->ident : "unknown", 380 msg->received_host, msg->ident ? msg->ident : "unknown",
382 conf.host_name, prot_names[msg->received_prot], PACKAGE, 381 conf.host_name, prot_names[msg->received_prot], PACKAGE,
383 VERSION, msg->uid, for_string ? for_string : "", 382 VERSION, msg->uid, for_string ? for_string : "",
384 rec_timestamp()); 383 rec_timestamp());
385 #else 384 #else
386 hdr = create_header(HEAD_RECEIVED, 385 hdr = create_header(HEAD_RECEIVED,
387 "Received: from %s by %s with %s (%s %s) id %s%s; %s\n", 386 "Received: from %s\n\tby %s with %s (%s %s)\n\tid %s%s; %s\n",
388 msg->received_host, conf.host_name, 387 msg->received_host, conf.host_name,
389 prot_names[msg->received_prot], PACKAGE, VERSION, 388 prot_names[msg->received_prot], PACKAGE, VERSION,
390 msg->uid, for_string ? for_string : "", rec_timestamp()); 389 msg->uid, for_string ? for_string : "", rec_timestamp());
391 #endif 390 #endif
392 } 391 }
393 header_fold(hdr, 78);
394 msg->hdr_list = g_list_prepend(msg->hdr_list, hdr); 392 msg->hdr_list = g_list_prepend(msg->hdr_list, hdr);
395 393
396 if (for_string) 394 if (for_string)
397 g_free(for_string); 395 g_free(for_string);
398 396