Overview
| Comment: | Make buildable on older Rust versions, check that config file is only readable by owner |
|---|---|
| Downloads: | Tarball | ZIP archive | SQL archive |
| Timelines: | family | ancestors | descendants | both | trunk | v0.3.4 |
| Files: | files | file ages | folders |
| SHA3-256: |
cfe321bd6f9bf28a8a0af7b90c2564c1 |
| User & Date: | arcade on 2025-01-23 12:20:39.173 |
| Other Links: | manifest | tags |
Context
|
2025-01-25
| ||
| 06:21 | fix markdown errors, message passing, errors produced check-in: 65b2967a92 user: arcade tags: trunk, v0.3.5 | |
|
2025-01-23
| ||
| 12:20 | Make buildable on older Rust versions, check that config file is only readable by owner check-in: cfe321bd6f user: arcade tags: trunk, v0.3.4 | |
|
2025-01-21
| ||
| 19:31 | add arg parsing check-in: e66352b9cc user: arcade tags: trunk, v0.3.4 | |
Changes
Modified Cargo.lock
from [732c2f949c]
to [77073657ea].
1 2 | 1 2 3 4 5 6 7 8 9 10 | - + | # This file is automatically @generated by Cargo. # It is not intended for manual editing. |
| ︙ | |||
508 509 510 511 512 513 514 | 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 | - + - + - + | name = "equivalent" version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "erasable" |
| ︙ | |||
765 766 767 768 769 770 771 | 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 | - + - + - + | name = "hermit-abi" version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbf6a919d6cf397374f7dfeeea91d974c7c0a7221d0d0f4f20d859d329e53fcc" [[package]] name = "home" |
| ︙ | |||
1120 1121 1122 1123 1124 1125 1126 | 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 | - + | [[package]] name = "libloading" version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", |
| ︙ | |||
1467 1468 1469 1470 1471 1472 1473 | 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 | - + - + | checksum = "0e4dccaaaf89514f546c693ddc140f729f958c247918a13380cccc6078391acc" dependencies = [ "proc-macro2", ] [[package]] name = "rc-box" |
| ︙ | |||
1596 1597 1598 1599 1600 1601 1602 | 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 | - + | source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a78891ee6bf2340288408954ac787aa063d8e8817e9f53abb37c695c6d834ef6" dependencies = [ "bitflags 2.8.0", "errno", "libc", "linux-raw-sys", |
| ︙ | |||
2035 2036 2037 2038 2039 2040 2041 | 2035 2036 2037 2038 2039 2040 2041 2042 2043 2044 2045 2046 2047 2048 2049 | - + | checksum = "9a8a559c81686f576e8cd0290cd2a24a2a9ad80c98b3478856500fcbd7acd704" dependencies = [ "cfg-if", "fastrand", "getrandom", "once_cell", "rustix", |
| ︙ |
Modified src/main.rs
from [1f629cd869]
to [86c96bbf98].
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | + |
//! Simple SMTP-to-Telegram gateway. Can parse email and send them as telegram
//! messages to specified chats, generally you specify which email address is
//! available in configuration, everything else is sent to default address.
use anyhow::{
anyhow,
bail,
Result,
};
use async_std::{
fs::metadata,
io::Error,
task,
};
use just_getopt::{
OptFlags,
OptSpecs,
OptValueType,
|
| ︙ | |||
36 37 38 39 40 41 42 43 44 45 46 47 48 49 | 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | + |
use std::{
borrow::Cow,
collections::{
HashMap,
HashSet,
},
os::unix::fs::PermissionsExt,
path::Path,
vec::Vec,
};
/// `SomeHeaders` object to store data through SMTP session
#[derive(Clone, Debug)]
struct SomeHeaders {
|
| ︙ | |||
371 372 373 374 375 376 377 378 379 380 381 382 383 384 | 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 | + + + + + + + + + |
} else {
"smtp2tg.toml"
});
if !config_file.exists() {
eprintln!("Error: can't read configuration from {:?}", config_file);
std::process::exit(1);
};
{
let meta = metadata(config_file).await?;
if (!0o100600 & meta.permissions().mode()) > 0 {
eprintln!("Error: other users can read or write config file {:?}\n\
File permissions: {:o}",
config_file, meta.permissions().mode());
std::process::exit(1);
}
}
let settings: config::Config = config::Config::builder()
.set_default("fields", vec!["date", "from", "subject"]).unwrap()
.set_default("hostname", "smtp.2.tg").unwrap()
.set_default("listen_on", "0.0.0.0:1025").unwrap()
.set_default("unknown", "relay").unwrap()
.add_source(config::File::from(config_file))
.build()
|
| ︙ |