]> git.proxmox.com Git - pmg-log-tracker.git/commitdiff
debcargo: fix maintainer directive
authorFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 1 Feb 2021 10:22:56 +0000 (11:22 +0100)
committerFabian Grünbichler <f.gruenbichler@proxmox.com>
Mon, 1 Feb 2021 10:29:02 +0000 (11:29 +0100)
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
debian/debcargo.toml
src/main.rs
tests/tests_after_queue.rs
tests/tests_before_queue.rs
tests/utils.rs

index 9d6eda974dc0bdb1a362307b6ae290e87de05174..5ee94900bb6e614d6838b1ed3b4e541bff7ecebf 100644 (file)
@@ -1,8 +1,8 @@
 overlay = "."
 crate_src_path = ".."
+maintainer = "Proxmox Support Team <support@proxmox.com>"
 
 [source]
-maintainer = "Proxmox Support Team <support@proxmox.com>"
 section = "admin"
 homepage = "http://www.proxmox.com"
 vcs_git = "git://git.proxmox.com/git/pmg-log-tracker.git"
index 34952695d0611408d83ea9eae62f825a451d875e..50692529959398dd813b36428e9dc10580b9a3be 100644 (file)
@@ -438,14 +438,9 @@ fn handle_lmtp_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8]) {
             5 => DStatus::BqReject,
             _ => return,
         }
-
     }
-    qe.borrow_mut().add_to_entry(
-        to,
-        relay,
-        dstatus,
-        parser.current_record_state.timestamp,
-    );
+    qe.borrow_mut()
+        .add_to_entry(to, relay, dstatus, parser.current_record_state.timestamp);
 
     // here the match happens between a QEntry and the corresponding FEntry
     // (only after-queue)
@@ -678,10 +673,7 @@ fn handle_smtpd_message(msg: &[u8], parser: &mut Parser, complete_line: &[u8]) {
 
             if let Some(to_index) = find(data, b"to=<") {
                 let data = &data[to_index + 4..];
-                let to_count = data
-                    .iter()
-                    .take_while(|b| (**b as char) != '>')
-                    .count();
+                let to_count = data.iter().take_while(|b| (**b as char) != '>').count();
                 let to = &data[..to_count];
 
                 se.borrow_mut().add_noqueue_entry(
@@ -912,8 +904,10 @@ impl SEntry {
             // are set.
             // if neither of them is filtered, we can skip this check
             if let Some(fe) = &self.filter() {
-                if !parser.options.from.is_empty() && find_lowercase(&self.bq_from, parser.options.from.as_bytes()).is_none() {
-                        return false;
+                if !parser.options.from.is_empty()
+                    && find_lowercase(&self.bq_from, parser.options.from.as_bytes()).is_none()
+                {
+                    return false;
                 }
                 let to_option_set = !parser.options.to.is_empty();
                 if to_option_set && fe.borrow().is_bq && !fe.borrow().is_accepted {
@@ -1022,21 +1016,20 @@ impl SEntry {
             }
         }
 
-        let print_filter_to_entries_fn = |fe: &Rc<RefCell<FEntry>>,
-                                          parser: &mut Parser,
-                                          se: &SEntry| {
-            for to in fe.borrow().to_entries.iter().rev() {
-                parser.write_all_ok(format!(
-                    "TO:{:X}:T{:08X}L{:08X}:{}: from <",
-                    to.timestamp as i32, se.timestamp as i32, se.rel_line_nr, to.dstatus,
-                ));
-                parser.write_all_ok(&se.bq_from);
-                parser.write_all_ok(b"> to <");
-                parser.write_all_ok(&to.to);
-                parser.write_all_ok(b">\n");
-                parser.count += 1;
-            }
-        };
+        let print_filter_to_entries_fn =
+            |fe: &Rc<RefCell<FEntry>>, parser: &mut Parser, se: &SEntry| {
+                for to in fe.borrow().to_entries.iter().rev() {
+                    parser.write_all_ok(format!(
+                        "TO:{:X}:T{:08X}L{:08X}:{}: from <",
+                        to.timestamp as i32, se.timestamp as i32, se.rel_line_nr, to.dstatus,
+                    ));
+                    parser.write_all_ok(&se.bq_from);
+                    parser.write_all_ok(b"> to <");
+                    parser.write_all_ok(&to.to);
+                    parser.write_all_ok(b">\n");
+                    parser.count += 1;
+                }
+            };
 
         // only true in before queue filtering case
         if let Some(fe) = &self.filter() {
index f6441fa6e1c6b04544407b1d6018773262fbff58..f47932577255081910d897563d1980153c8e488f 100644 (file)
@@ -17,8 +17,8 @@ fn after_queue_start_end_time_string() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_after_queue")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_after_queue").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -38,8 +38,8 @@ fn after_queue_start_end_timestamp() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_after_queue")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_after_queue").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -61,8 +61,8 @@ fn after_queue_qid() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_after_queue_qid")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_after_queue_qid").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -84,8 +84,8 @@ fn after_queue_host() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_after_queue_host")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_after_queue_host").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
index fb7a149d6be022c2110fd6a08f6bdf40685ab0fd..5f36ec2dfd93c19a4b0e71c1c592713abcb00ae3 100644 (file)
@@ -16,8 +16,8 @@ fn before_queue_start_end_time_string() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -37,8 +37,8 @@ fn before_queue_start_end_timestamp() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -60,8 +60,8 @@ fn before_queue_qid() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue_qid")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue_qid").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -83,8 +83,8 @@ fn before_queue_host() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue_host")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue_host").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -152,8 +152,8 @@ fn before_queue_exclude_greylist_ndr() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
@@ -175,8 +175,8 @@ fn before_queue_to() {
         .output()
         .expect("failed to execute pmg-log-tracker");
 
-    let expected_file = File::open("tests/test_output_before_queue_to")
-        .expect("failed to open test_output");
+    let expected_file =
+        File::open("tests/test_output_before_queue_to").expect("failed to open test_output");
 
     let expected_output = BufReader::new(&expected_file);
     let output_reader = BufReader::new(&output.stdout[..]);
index 1d14c88254e2ffeca9a60570ff98590c8860b1e3..936efc9244725e66bacf61c609fcc5a5ef1d368f 100644 (file)
@@ -16,7 +16,6 @@ pub fn log_tracker_path() -> String {
     target_dir.to_str().unwrap().to_string()
 }
 
-
 pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
     let expected_lines: Vec<String> = expected.lines().map(|l| l.unwrap()).collect();
     let command_lines: Vec<String> = command.lines().map(|l| l.unwrap()).collect();
@@ -27,8 +26,7 @@ pub fn compare_output<R: BufRead, R2: BufRead>(command: R, expected: R2) {
         expected_lines.len(),
         command_lines.len()
     );
-    for (old, new) in expected_lines.iter().zip(command_lines.iter())
-    {
+    for (old, new) in expected_lines.iter().zip(command_lines.iter()) {
         if new.starts_with("# ") && old.starts_with("# ") {
             continue;
         } else if new.starts_with("# ") {